xref: /btstack/src/btstack_uart_slip_wrapper.h (revision dd90474ba4d89f63a397d9d13cb91269e202dda7)
1*dd90474bSMatthias Ringwald /*
2*dd90474bSMatthias Ringwald  * Copyright (C) 2021 BlueKitchen GmbH
3*dd90474bSMatthias Ringwald  *
4*dd90474bSMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
5*dd90474bSMatthias Ringwald  * modification, are permitted provided that the following conditions
6*dd90474bSMatthias Ringwald  * are met:
7*dd90474bSMatthias Ringwald  *
8*dd90474bSMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
9*dd90474bSMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
10*dd90474bSMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11*dd90474bSMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
12*dd90474bSMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
13*dd90474bSMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
14*dd90474bSMatthias Ringwald  *    contributors may be used to endorse or promote products derived
15*dd90474bSMatthias Ringwald  *    from this software without specific prior written permission.
16*dd90474bSMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
17*dd90474bSMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
18*dd90474bSMatthias Ringwald  *    monetary gain.
19*dd90474bSMatthias Ringwald  *
20*dd90474bSMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21*dd90474bSMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22*dd90474bSMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23*dd90474bSMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
24*dd90474bSMatthias Ringwald  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25*dd90474bSMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26*dd90474bSMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27*dd90474bSMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28*dd90474bSMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29*dd90474bSMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30*dd90474bSMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31*dd90474bSMatthias Ringwald  * SUCH DAMAGE.
32*dd90474bSMatthias Ringwald  *
33*dd90474bSMatthias Ringwald  * Please inquire about commercial licensing options at
34*dd90474bSMatthias Ringwald  * [email protected]
35*dd90474bSMatthias Ringwald  *
36*dd90474bSMatthias Ringwald  */
37*dd90474bSMatthias Ringwald 
38*dd90474bSMatthias Ringwald /*
39*dd90474bSMatthias Ringwald  *  btstack_uart_slip_wrapper.h
40*dd90474bSMatthias Ringwald  *
41*dd90474bSMatthias Ringwald  *  Compatibility layer to use new H5 implementation with btstack_uart.h implementations without SLIP support
42*dd90474bSMatthias Ringwald  *  Using this compatibility layer caused increased processing as it uses single byte UART reads
43*dd90474bSMatthias Ringwald  *
44*dd90474bSMatthias Ringwald  *  If you're using H5, please consider implement the H5/SLIP functions in your btstack_uart.h or hal_uart_dma.h implementation
45*dd90474bSMatthias Ringwald  */
46*dd90474bSMatthias Ringwald 
47*dd90474bSMatthias Ringwald #ifndef BTSTACK_UART_SLIP_WRAPPER_H
48*dd90474bSMatthias Ringwald #define BTSTACK_UART_SLIP_WRAPPER_H
49*dd90474bSMatthias Ringwald 
50*dd90474bSMatthias Ringwald #include <stdint.h>
51*dd90474bSMatthias Ringwald #include "btstack_uart.h"
52*dd90474bSMatthias Ringwald 
53*dd90474bSMatthias Ringwald /**
54*dd90474bSMatthias Ringwald  * @brief Initialize SLIP wrapper for existing btstack_uart_block_t instance without SLIP support
55*dd90474bSMatthias Ringwald  * @param uart_block_without_slip
56*dd90474bSMatthias Ringwald  * @returns btstack_uart_t instance with SLIP support for use with hci_trasnport_h5
57*dd90474bSMatthias Ringwald  */
58*dd90474bSMatthias Ringwald const btstack_uart_t * btstack_uart_slip_wrapper_instance(const btstack_uart_t * uart_without_slip);
59*dd90474bSMatthias Ringwald 
60*dd90474bSMatthias Ringwald #endif
61