xref: /btstack/src/btstack_chipset.h (revision 1565be948b71971df9807d27879e4910bbb0b1a4)
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
230af2bb27SMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
240af2bb27SMatthias Ringwald  * RINGWALD 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 
380af2bb27SMatthias Ringwald /*
390af2bb27SMatthias Ringwald  *  btstack_chipset.h
400af2bb27SMatthias Ringwald  *
410af2bb27SMatthias Ringwald  *  Chipset Driver - implements custom chipset initializtion and support proprietary extensions
420af2bb27SMatthias Ringwald  *  to set UART baud rate, Bluetooth Address, and similar.
430af2bb27SMatthias Ringwald  */
440af2bb27SMatthias Ringwald 
4580e33422SMatthias Ringwald #ifndef BTSTACK_CHIPSET_H
4680e33422SMatthias Ringwald #define BTSTACK_CHIPSET_H
470af2bb27SMatthias Ringwald 
480af2bb27SMatthias Ringwald #include <stdint.h>
490af2bb27SMatthias Ringwald #include "btstack_util.h"
500af2bb27SMatthias Ringwald 
510af2bb27SMatthias Ringwald #if defined __cplusplus
520af2bb27SMatthias Ringwald extern "C" {
530af2bb27SMatthias Ringwald #endif
540af2bb27SMatthias Ringwald 
550af2bb27SMatthias Ringwald typedef enum {
560af2bb27SMatthias Ringwald   BTSTACK_CHIPSET_DONE = 0,
570af2bb27SMatthias Ringwald   BTSTACK_CHIPSET_VALID_COMMAND,
580af2bb27SMatthias Ringwald   BTSTACK_CHIPSET_WARMSTART_REQUIRED,
59*1565be94SMatthias Ringwald   BTSTACK_CHIPSET_NO_INIT_SCRIPT,
600af2bb27SMatthias Ringwald } btstack_chipset_result_t;
610af2bb27SMatthias Ringwald 
6258360f58SMatthias Ringwald 
630af2bb27SMatthias Ringwald typedef struct {
640af2bb27SMatthias Ringwald     /**
650af2bb27SMatthias Ringwald      * chipset driver name
660af2bb27SMatthias Ringwald      */
670af2bb27SMatthias Ringwald     const char * name;
680af2bb27SMatthias Ringwald 
690af2bb27SMatthias Ringwald     /**
700af2bb27SMatthias Ringwald      * init driver
710af2bb27SMatthias Ringwald      * allows to reset init script index
7224b3c629SMatthias Ringwald      * @param transport_config
730af2bb27SMatthias Ringwald      */
7424b3c629SMatthias Ringwald     void (*init)(const void * transport_config);
750af2bb27SMatthias Ringwald 
760af2bb27SMatthias Ringwald     /**
770af2bb27SMatthias Ringwald      * support custom init sequences after RESET command
780af2bb27SMatthias Ringwald      * @param  hci_cmd_buffer to store generated command
790af2bb27SMatthias Ringwald      * @return result see btstack_chipset_result_t
800af2bb27SMatthias Ringwald      */
8158360f58SMatthias Ringwald     btstack_chipset_result_t (*next_command)(uint8_t * hci_cmd_buffer);
820af2bb27SMatthias Ringwald 
830af2bb27SMatthias Ringwald     /**
840af2bb27SMatthias Ringwald      * provide UART Baud Rate change command.
850af2bb27SMatthias Ringwald      * @param baudrate
860af2bb27SMatthias Ringwald      * @param hci_cmd_buffer to store generated command
870af2bb27SMatthias Ringwald      */
8858360f58SMatthias Ringwald     void (*set_baudrate_command)(uint32_t baudrate, uint8_t *hci_cmd_buffer);
890af2bb27SMatthias Ringwald 
900af2bb27SMatthias Ringwald     /** provide Set BD Addr command
910af2bb27SMatthias Ringwald      * @param baudrate
920af2bb27SMatthias Ringwald      * @param hci_cmd_buffer to store generated command
930af2bb27SMatthias Ringwald      */
9458360f58SMatthias Ringwald     void (*set_bd_addr_command)(bd_addr_t addr, uint8_t *hci_cmd_buffer);
950af2bb27SMatthias Ringwald 
960af2bb27SMatthias Ringwald } btstack_chipset_t;
970af2bb27SMatthias Ringwald 
980af2bb27SMatthias Ringwald #if defined __cplusplus
990af2bb27SMatthias Ringwald }
1000af2bb27SMatthias Ringwald #endif
1010af2bb27SMatthias Ringwald 
10280e33422SMatthias Ringwald #endif // BTSTACK_CHIPSET_H
103