xref: /btstack/src/btstack_sco_transport.h (revision aac273849f5a269113469c8cb4a797616fe5ac34)
1*aac27384SMatthias Ringwald /*
2*aac27384SMatthias Ringwald  * Copyright (C) 2021 BlueKitchen GmbH
3*aac27384SMatthias Ringwald  *
4*aac27384SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
5*aac27384SMatthias Ringwald  * modification, are permitted provided that the following conditions
6*aac27384SMatthias Ringwald  * are met:
7*aac27384SMatthias Ringwald  *
8*aac27384SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
9*aac27384SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
10*aac27384SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11*aac27384SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
12*aac27384SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
13*aac27384SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
14*aac27384SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
15*aac27384SMatthias Ringwald  *    from this software without specific prior written permission.
16*aac27384SMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
17*aac27384SMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
18*aac27384SMatthias Ringwald  *    monetary gain.
19*aac27384SMatthias Ringwald  *
20*aac27384SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21*aac27384SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22*aac27384SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23*aac27384SMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
24*aac27384SMatthias Ringwald  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25*aac27384SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26*aac27384SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27*aac27384SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28*aac27384SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29*aac27384SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30*aac27384SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31*aac27384SMatthias Ringwald  * SUCH DAMAGE.
32*aac27384SMatthias Ringwald  *
33*aac27384SMatthias Ringwald  * Please inquire about commercial licensing options at
34*aac27384SMatthias Ringwald  * [email protected]
35*aac27384SMatthias Ringwald  *
36*aac27384SMatthias Ringwald  */
37*aac27384SMatthias Ringwald 
38*aac27384SMatthias Ringwald /*
39*aac27384SMatthias Ringwald  * btstack_sco_transport.h
40*aac27384SMatthias Ringwald  * Hardware abstraction for PCM/I2S Inteface used for HSP/HFP profiles
41*aac27384SMatthias Ringwald  */
42*aac27384SMatthias Ringwald 
43*aac27384SMatthias Ringwald #ifndef BTSTACK_SCO_TRANSPORT_H
44*aac27384SMatthias Ringwald #define BTSTACK_SCO_TRANSPORT_H
45*aac27384SMatthias Ringwald 
46*aac27384SMatthias Ringwald #include "btstack_config.h"
47*aac27384SMatthias Ringwald 
48*aac27384SMatthias Ringwald #include "bluetooth.h"
49*aac27384SMatthias Ringwald #include "btstack_defines.h"
50*aac27384SMatthias Ringwald 
51*aac27384SMatthias Ringwald #include <stdint.h>
52*aac27384SMatthias Ringwald 
53*aac27384SMatthias Ringwald #if defined __cplusplus
54*aac27384SMatthias Ringwald extern "C" {
55*aac27384SMatthias Ringwald #endif
56*aac27384SMatthias Ringwald 
57*aac27384SMatthias Ringwald typedef enum {
58*aac27384SMatthias Ringwald     SCO_FORMAT_8_BIT,
59*aac27384SMatthias Ringwald     SCO_FORMAT_16_BIT,
60*aac27384SMatthias Ringwald } sco_format_t;
61*aac27384SMatthias Ringwald 
62*aac27384SMatthias Ringwald typedef struct {
63*aac27384SMatthias Ringwald 
64*aac27384SMatthias Ringwald     /**
65*aac27384SMatthias Ringwald      * register packet handler for SCO HCI packets
66*aac27384SMatthias Ringwald      */
67*aac27384SMatthias Ringwald     void (*register_packet_handler)(void (*handler)(uint8_t packet_type, uint8_t *packet, uint16_t size));
68*aac27384SMatthias Ringwald 
69*aac27384SMatthias Ringwald     /**
70*aac27384SMatthias Ringwald      * open transport
71*aac27384SMatthias Ringwald      * @param con_handle of SCO connection
72*aac27384SMatthias Ringwald      * @param sco_format
73*aac27384SMatthias Ringwald      */
74*aac27384SMatthias Ringwald     void (*open)(hci_con_handle_t con_handle, sco_format_t sco_format);
75*aac27384SMatthias Ringwald 
76*aac27384SMatthias Ringwald     /**
77*aac27384SMatthias Ringwald      * send SCO packet
78*aac27384SMatthias Ringwald      */
79*aac27384SMatthias Ringwald     void (*send_packet)(const uint8_t *buffer, uint16_t length);
80*aac27384SMatthias Ringwald 
81*aac27384SMatthias Ringwald     /**
82*aac27384SMatthias Ringwald      * close transport
83*aac27384SMatthias Ringwald      * @param con_handle of SCO connection
84*aac27384SMatthias Ringwald      */
85*aac27384SMatthias Ringwald     void (*close)(hci_con_handle_t con_handle);
86*aac27384SMatthias Ringwald 
87*aac27384SMatthias Ringwald } btstack_sco_transport_t;
88*aac27384SMatthias Ringwald 
89*aac27384SMatthias Ringwald #if defined __cplusplus
90*aac27384SMatthias Ringwald }
91*aac27384SMatthias Ringwald #endif
92*aac27384SMatthias Ringwald 
93*aac27384SMatthias Ringwald #endif