xref: /btstack/chipset/nxp/btstack_chipset_nxp.h (revision a57c424f361dd8f37049d3e9a01e55fa1d77444c)
1cc528b9dSMatthias Ringwald /*
2cc528b9dSMatthias Ringwald  * Copyright (C) 2023 BlueKitchen GmbH
3cc528b9dSMatthias Ringwald  *
4cc528b9dSMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
5cc528b9dSMatthias Ringwald  * modification, are permitted provided that the following conditions
6cc528b9dSMatthias Ringwald  * are met:
7cc528b9dSMatthias Ringwald  *
8cc528b9dSMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
9cc528b9dSMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
10cc528b9dSMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11cc528b9dSMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
12cc528b9dSMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
13cc528b9dSMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
14cc528b9dSMatthias Ringwald  *    contributors may be used to endorse or promote products derived
15cc528b9dSMatthias Ringwald  *    from this software without specific prior written permission.
16cc528b9dSMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
17cc528b9dSMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
18cc528b9dSMatthias Ringwald  *    monetary gain.
19cc528b9dSMatthias Ringwald  *
20cc528b9dSMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21cc528b9dSMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22cc528b9dSMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23cc528b9dSMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
24cc528b9dSMatthias Ringwald  * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25cc528b9dSMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26cc528b9dSMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27cc528b9dSMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28cc528b9dSMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29cc528b9dSMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30cc528b9dSMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31cc528b9dSMatthias Ringwald  * SUCH DAMAGE.
32cc528b9dSMatthias Ringwald  *
33cc528b9dSMatthias Ringwald  * Please inquire about commercial licensing options at
34cc528b9dSMatthias Ringwald  * [email protected]
35cc528b9dSMatthias Ringwald  *
36cc528b9dSMatthias Ringwald  */
37cc528b9dSMatthias Ringwald 
38cc528b9dSMatthias Ringwald /*
39cc528b9dSMatthias Ringwald  *  btstack_chipset_nxp
40cc528b9dSMatthias Ringwald  *
41cc528b9dSMatthias Ringwald  *  Adapter to use NXP/Marvel-based chipsets with BTstack
42cc528b9dSMatthias Ringwald  */
43cc528b9dSMatthias Ringwald 
44cc528b9dSMatthias Ringwald #ifndef BTSTACK_CHIPSET_MARVEL_H
45cc528b9dSMatthias Ringwald #define BTSTACK_CHIPSET_MARVEL_H
46cc528b9dSMatthias Ringwald 
47cc528b9dSMatthias Ringwald #if defined __cplusplus
48cc528b9dSMatthias Ringwald extern "C" {
49cc528b9dSMatthias Ringwald #endif
50cc528b9dSMatthias Ringwald 
51cc528b9dSMatthias Ringwald #include "bluetooth.h"
52cc528b9dSMatthias Ringwald #include "btstack_chipset.h"
53cc528b9dSMatthias Ringwald #include "btstack_uart.h"
54cc528b9dSMatthias Ringwald #include <stdint.h>
55cc528b9dSMatthias Ringwald 
56cc528b9dSMatthias Ringwald /**
57cc528b9dSMatthias Ringwald  * @brief Set path to firmware file for Controller with v1 bootloader, e.g. 88W8997
58cc528b9dSMatthias Ringwald  * @note used for systems with HAVE_POSIX_FILE_IO
59cc528b9dSMatthias Ringwald  * @param path
60cc528b9dSMatthias Ringwald  */
61cc528b9dSMatthias Ringwald void btstack_chipset_nxp_set_v1_firmware_path(const char * firmware_path);
62cc528b9dSMatthias Ringwald 
63cc528b9dSMatthias Ringwald /**
64cc528b9dSMatthias Ringwald  * @brieft Provide firmware as data
65cc528b9dSMatthias Ringwald  * @note used for systems without HAVE_POSIX_FILE_IO
66cc528b9dSMatthias Ringwald  * @param fw_data
67cc528b9dSMatthias Ringwald  * @param fw_size
68cc528b9dSMatthias Ringwald  */
69cc528b9dSMatthias Ringwald void btstack_chipset_nxp_set_firmware(const uint8_t * fw_data, uint32_t fw_size);
70cc528b9dSMatthias Ringwald 
71cc528b9dSMatthias Ringwald /**
72cc528b9dSMatthias Ringwald * @brief Download firmware via uart_driver
73cc528b9dSMatthias Ringwald * @param uart_driver -- already initialized
74ffa921b1SMatthias Ringwald * @param callback. 0 = Success
75cc528b9dSMatthias Ringwald */
76ffa921b1SMatthias Ringwald void btstack_chipset_nxp_download_firmware_with_uart(const btstack_uart_t *uart_driver, void (*callback)(uint8_t status));
77cc528b9dSMatthias Ringwald 
78cc528b9dSMatthias Ringwald /**
79*a57c424fSMatthias Ringwald  * @brief Get baudrate after firmware download
80*a57c424fSMatthias Ringwald  * @note iw612 with current firmware is set to 3mbps instead of 115200. to be called after firmware download complete
81*a57c424fSMatthias Ringwald  */
82*a57c424fSMatthias Ringwald uint32_t btstack_chipset_nxp_get_initial_baudrate(void);
83*a57c424fSMatthias Ringwald 
84*a57c424fSMatthias Ringwald /**
85cc528b9dSMatthias Ringwald  * Get chipset instance for NXP chipsets
86cc528b9dSMatthias Ringwald  */
87cc528b9dSMatthias Ringwald const btstack_chipset_t *btstack_chipset_nxp_instance(void);
88cc528b9dSMatthias Ringwald 
89cc528b9dSMatthias Ringwald #if defined __cplusplus
90cc528b9dSMatthias Ringwald }
91cc528b9dSMatthias Ringwald #endif
92cc528b9dSMatthias Ringwald 
93cc528b9dSMatthias Ringwald #endif  // BTSTACK_CHIPSET_NXP_H
94