• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright (C) 2009-2018 Realtek Corporation.
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 /******************************************************************************
19  *
20  *	Module Name:
21  *	    rtk_parse.h
22  *
23  *	Abstract:
24  *	    Contains wifi-bt coex functions implemented by bluedroid stack
25  *
26  *	Major Change History:
27  *	      When             Who       What
28  *	    ---------------------------------------------------------------
29  *	    2015-12-15      lamparten   modified
30  *	    2014-10-23       kyle_xu    modified
31  *
32  *	Notes:
33  *         This is designed for wifi-bt Coex in Android 6.0.
34  *
35  ******************************************************************************/
36 
37 #ifndef RTK_PARSE_H
38 #define RTK_PARSE_H
39 
40 #pragma once
41 
42 #include <stdlib.h>
43 #include <strings.h>
44 #include "bt_vendor_rtk.h"
45 #include "userial_vendor.h"
46 
47 /******************************************************************************
48 **  Constants & Macros
49 ******************************************************************************/
50 #define HOST_PROFILE_INFO
51 
52 /******************************************************************************
53 **  Type definitions
54 ******************************************************************************/
55 typedef unsigned char UINT8;
56 #define BD_ADDR_LEN 6				/* Device address length */
57 typedef UINT8 BD_ADDR[BD_ADDR_LEN]; /* Device address */
58 typedef void *TRANSAC;
59 
60 /******************************************************************************
61 **  Extern variables and functions
62 ******************************************************************************/
63 extern uint8_t coex_log_enable;
64 
65 /******************************************************************************
66 **  Functions
67 ******************************************************************************/
68 typedef struct rtk_parse_manager_t
69 {
70 
71 	void (*rtk_parse_internal_event_intercept)(uint8_t *p);
72 
73 	void (*rtk_parse_l2cap_data)(uint8_t *p, uint8_t direction);
74 
75 	void (*rtk_parse_init)(void);
76 
77 	void (*rtk_parse_cleanup)(void);
78 
79 	void (*rtk_parse_command)(uint8_t *p);
80 
81 	void (*rtk_add_le_profile)(BD_ADDR bdaddr, uint16_t handle, uint8_t profile_map);
82 
83 	void (*rtk_delete_le_profile)(BD_ADDR bdaddr, uint16_t handle, uint8_t profile_map);
84 
85 	void (*rtk_add_le_data_count)(uint8_t data_type);
86 
87 	void (*rtk_set_bt_on)(uint8_t bt_on);
88 
89 } rtk_parse_manager_t;
90 
91 rtk_parse_manager_t *rtk_parse_manager_get_interface();
92 
93 #ifdef __LITTLE_ENDIAN
94 struct sbc_frame_hdr
95 {
96 	uint8_t syncword : 8;			/* Sync word */
97 	uint8_t subbands : 1;			/* Subbands */
98 	uint8_t allocation_method : 1;	/* Allocation method */
99 	uint8_t channel_mode : 2;		/* Channel mode */
100 	uint8_t blocks : 2;				/* Blocks */
101 	uint8_t sampling_frequency : 2; /* Sampling frequency */
102 	uint8_t bitpool : 8;			/* Bitpool */
103 	uint8_t crc_check : 8;			/* CRC check */
104 } __attribute__((packed));
105 
106 /* NOTE: The code is copied from pa.
107  * only the bit field in 8-bit is affected by endian, not the 16-bit or 32-bit.
108  * why?
109  */
110 struct rtp_header
111 {
112 	unsigned cc : 4;
113 	unsigned x : 1;
114 	unsigned p : 1;
115 	unsigned v : 2;
116 
117 	unsigned pt : 7;
118 	unsigned m : 1;
119 
120 	uint16_t sequence_number;
121 	uint32_t timestamp;
122 	uint32_t ssrc;
123 	uint32_t csrc[0];
124 } __attribute__((packed));
125 
126 #else
127 /* big endian */
128 struct sbc_frame_hdr
129 {
130 	uint8_t syncword : 8;			/* Sync word */
131 	uint8_t sampling_frequency : 2; /* Sampling frequency */
132 	uint8_t blocks : 2;				/* Blocks */
133 	uint8_t channel_mode : 2;		/* Channel mode */
134 	uint8_t allocation_method : 1;	/* Allocation method */
135 	uint8_t subbands : 1;			/* Subbands */
136 	uint8_t bitpool : 8;			/* Bitpool */
137 	uint8_t crc_check : 8;			/* CRC check */
138 } __attribute__((packed));
139 
140 struct rtp_header
141 {
142 	unsigned v : 2;
143 	unsigned p : 1;
144 	unsigned x : 1;
145 	unsigned cc : 4;
146 
147 	unsigned m : 1;
148 	unsigned pt : 7;
149 
150 	uint16_t sequence_number;
151 	uint32_t timestamp;
152 	uint32_t ssrc;
153 	uint32_t csrc[0];
154 } __attribute__((packed));
155 #endif /* __LITTLE_ENDIAN */
156 
157 #endif /*RTK_PARSE_H*/
158