xref: /btstack/src/btstack_chipset.h (revision 2fca4dad957cd7b88f4657ed51e89c12615dda72)
10af2bb27SMatthias Ringwald /*
20af2bb27SMatthias Ringwald  * Copyright (C) 2016 BlueKitchen GmbH
30af2bb27SMatthias Ringwald  *
40af2bb27SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
50af2bb27SMatthias Ringwald  * modification, are permitted provided that the following conditions
60af2bb27SMatthias Ringwald  * are met:
70af2bb27SMatthias Ringwald  *
80af2bb27SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
90af2bb27SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
100af2bb27SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
110af2bb27SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
120af2bb27SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
130af2bb27SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
140af2bb27SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
150af2bb27SMatthias Ringwald  *    from this software without specific prior written permission.
160af2bb27SMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
170af2bb27SMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
180af2bb27SMatthias Ringwald  *    monetary gain.
190af2bb27SMatthias Ringwald  *
200af2bb27SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
210af2bb27SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
220af2bb27SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23*2fca4dadSMilanka Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
24*2fca4dadSMilanka Ringwald  * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
250af2bb27SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
260af2bb27SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
270af2bb27SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
280af2bb27SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
290af2bb27SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
300af2bb27SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
310af2bb27SMatthias Ringwald  * SUCH DAMAGE.
320af2bb27SMatthias Ringwald  *
330af2bb27SMatthias Ringwald  * Please inquire about commercial licensing options at
340af2bb27SMatthias Ringwald  * [email protected]
350af2bb27SMatthias Ringwald  *
360af2bb27SMatthias Ringwald  */
370af2bb27SMatthias Ringwald 
38fe5a6c4eSMilanka Ringwald /**
39fe5a6c4eSMilanka Ringwald  * @title Chipset Driver
400af2bb27SMatthias Ringwald  *
41fe5a6c4eSMilanka Ringwald  * The API implements custom chipset initialization and support of proprietary extensions
420af2bb27SMatthias Ringwald  * to set UART baud rate, Bluetooth Address, and similar.
43fe5a6c4eSMilanka Ringwald  *
440af2bb27SMatthias Ringwald  */
450af2bb27SMatthias Ringwald 
4680e33422SMatthias Ringwald #ifndef BTSTACK_CHIPSET_H
4780e33422SMatthias Ringwald #define BTSTACK_CHIPSET_H
480af2bb27SMatthias Ringwald 
490af2bb27SMatthias Ringwald #include <stdint.h>
500af2bb27SMatthias Ringwald #include "btstack_util.h"
510af2bb27SMatthias Ringwald 
520af2bb27SMatthias Ringwald #if defined __cplusplus
530af2bb27SMatthias Ringwald extern "C" {
540af2bb27SMatthias Ringwald #endif
550af2bb27SMatthias Ringwald 
560af2bb27SMatthias Ringwald typedef enum {
570af2bb27SMatthias Ringwald   BTSTACK_CHIPSET_DONE = 0,
580af2bb27SMatthias Ringwald   BTSTACK_CHIPSET_VALID_COMMAND,
590af2bb27SMatthias Ringwald   BTSTACK_CHIPSET_WARMSTART_REQUIRED,
601565be94SMatthias Ringwald   BTSTACK_CHIPSET_NO_INIT_SCRIPT,
610af2bb27SMatthias Ringwald } btstack_chipset_result_t;
620af2bb27SMatthias Ringwald 
6390f75057SMilanka Ringwald /* API_START */
6458360f58SMatthias Ringwald 
650af2bb27SMatthias Ringwald typedef struct {
660af2bb27SMatthias Ringwald     /**
670af2bb27SMatthias Ringwald      * chipset driver name
680af2bb27SMatthias Ringwald      */
690af2bb27SMatthias Ringwald     const char * name;
700af2bb27SMatthias Ringwald 
710af2bb27SMatthias Ringwald     /**
720af2bb27SMatthias Ringwald      * init driver
730af2bb27SMatthias Ringwald      * allows to reset init script index
7424b3c629SMatthias Ringwald      * @param transport_config
750af2bb27SMatthias Ringwald      */
7624b3c629SMatthias Ringwald     void (*init)(const void * transport_config);
770af2bb27SMatthias Ringwald 
780af2bb27SMatthias Ringwald     /**
790af2bb27SMatthias Ringwald      * support custom init sequences after RESET command
800af2bb27SMatthias Ringwald      * @param  hci_cmd_buffer to store generated command
810af2bb27SMatthias Ringwald      * @return result see btstack_chipset_result_t
820af2bb27SMatthias Ringwald      */
8358360f58SMatthias Ringwald     btstack_chipset_result_t (*next_command)(uint8_t * hci_cmd_buffer);
840af2bb27SMatthias Ringwald 
850af2bb27SMatthias Ringwald     /**
860af2bb27SMatthias Ringwald      * provide UART Baud Rate change command.
870af2bb27SMatthias Ringwald      * @param baudrate
880af2bb27SMatthias Ringwald      * @param hci_cmd_buffer to store generated command
890af2bb27SMatthias Ringwald      */
9058360f58SMatthias Ringwald     void (*set_baudrate_command)(uint32_t baudrate, uint8_t *hci_cmd_buffer);
910af2bb27SMatthias Ringwald 
920af2bb27SMatthias Ringwald     /** provide Set BD Addr command
930af2bb27SMatthias Ringwald      * @param baudrate
940af2bb27SMatthias Ringwald      * @param hci_cmd_buffer to store generated command
950af2bb27SMatthias Ringwald      */
9658360f58SMatthias Ringwald     void (*set_bd_addr_command)(bd_addr_t addr, uint8_t *hci_cmd_buffer);
970af2bb27SMatthias Ringwald 
980af2bb27SMatthias Ringwald } btstack_chipset_t;
990af2bb27SMatthias Ringwald 
10090f75057SMilanka Ringwald /* API_END */
10190f75057SMilanka Ringwald 
1020af2bb27SMatthias Ringwald #if defined __cplusplus
1030af2bb27SMatthias Ringwald }
1040af2bb27SMatthias Ringwald #endif
1050af2bb27SMatthias Ringwald 
10680e33422SMatthias Ringwald #endif // BTSTACK_CHIPSET_H
107