xref: /btstack/src/btstack_chipset.h (revision 80e33422a96c028b3a9c308fc4b9b874712dafb4)
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 
45*80e33422SMatthias Ringwald #ifndef BTSTACK_CHIPSET_H
46*80e33422SMatthias 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,
590af2bb27SMatthias Ringwald } btstack_chipset_result_t;
600af2bb27SMatthias Ringwald 
6158360f58SMatthias Ringwald 
620af2bb27SMatthias Ringwald typedef struct {
630af2bb27SMatthias Ringwald     /**
640af2bb27SMatthias Ringwald      * chipset driver name
650af2bb27SMatthias Ringwald      */
660af2bb27SMatthias Ringwald     const char * name;
670af2bb27SMatthias Ringwald 
680af2bb27SMatthias Ringwald     /**
690af2bb27SMatthias Ringwald      * init driver
700af2bb27SMatthias Ringwald      * allows to reset init script index
7124b3c629SMatthias Ringwald      * @param transport_config
720af2bb27SMatthias Ringwald      */
7324b3c629SMatthias Ringwald     void (*init)(const void * transport_config);
740af2bb27SMatthias Ringwald 
750af2bb27SMatthias Ringwald     /**
760af2bb27SMatthias Ringwald      * support custom init sequences after RESET command
770af2bb27SMatthias Ringwald      * @param  hci_cmd_buffer to store generated command
780af2bb27SMatthias Ringwald      * @return result see btstack_chipset_result_t
790af2bb27SMatthias Ringwald      */
8058360f58SMatthias Ringwald     btstack_chipset_result_t (*next_command)(uint8_t * hci_cmd_buffer);
810af2bb27SMatthias Ringwald 
820af2bb27SMatthias Ringwald     /**
830af2bb27SMatthias Ringwald      * provide UART Baud Rate change command.
840af2bb27SMatthias Ringwald      * @param baudrate
850af2bb27SMatthias Ringwald      * @param hci_cmd_buffer to store generated command
860af2bb27SMatthias Ringwald      */
8758360f58SMatthias Ringwald     void (*set_baudrate_command)(uint32_t baudrate, uint8_t *hci_cmd_buffer);
880af2bb27SMatthias Ringwald 
890af2bb27SMatthias Ringwald     /** provide Set BD Addr command
900af2bb27SMatthias Ringwald      * @param baudrate
910af2bb27SMatthias Ringwald      * @param hci_cmd_buffer to store generated command
920af2bb27SMatthias Ringwald      */
9358360f58SMatthias Ringwald     void (*set_bd_addr_command)(bd_addr_t addr, uint8_t *hci_cmd_buffer);
940af2bb27SMatthias Ringwald 
950af2bb27SMatthias Ringwald } btstack_chipset_t;
960af2bb27SMatthias Ringwald 
970af2bb27SMatthias Ringwald #if defined __cplusplus
980af2bb27SMatthias Ringwald }
990af2bb27SMatthias Ringwald #endif
1000af2bb27SMatthias Ringwald 
101*80e33422SMatthias Ringwald #endif // BTSTACK_CHIPSET_H
102