ras_common.h
Go to the documentation of this file.
1 #ifndef __RAS_COMMON_H__
2 #define __RAS_COMMON_H__
3 
4 #include <stdint.h>
5 
6 #define RAS_CONNECTION_MAX (4)
7 #define RAS_CCCD_LEN (0x02)
8 #define RAS_FEATURE_CHAR_LEN (4)
9 
10 #define RAS_RANGING_COUNTER_BIT_MASK (0x0FFF)
11 #define RAS_CFG_ID_BIT_MASK (0xF000)
12 #define RAS_ANT_PATH_BIT_MASK (0x3F)
13 
14 // RAS control point
15 #define RAS_CTRL_PT_OPCODE_LEN (1)
16 #define RAS_CTRL_PT_OPERAND_MAX_LEN (6)
17 #define RAS_CTRL_PT_CHAR_MAX_LEN (RAS_CTRL_PT_OPCODE_LEN + RAS_CTRL_PT_OPERAND_MAX_LEN)
18 
19 #define RAS_CTRL_PT_OPCODE_OFFSET (0)
20 #define RAS_CTRL_PT_OPERAND_OFFSET (1)
21 
22 #define RAS_MODE_TYPE_BIT_MASK (0xC000)
23 #define RAS_MODE_TYPE_BIT_OFFSET (14)
24 
25 #define RAS_MODE0_DATA_BIT_MASK (0x000F)
26 #define RAS_MODE1_DATA_BIT_MASK (0x007F)
27 #define RAS_MODE2_DATA_BIT_MASK (0x007F)
28 #define RAS_MODE3_DATA_BIT_MASK (0x3FFF)
29 
30 #define RAS_PCT_FORMAT_BIT_MASK (0x01)
31 
32 #define RAS_ERROR_PROC_ALREADY_IN_PROGRESS (0xFE)
33 
34 // Ranging data
35 #define RAS_SEGMENT_HEADER_LEN (1)
36 #define RAS_SEGMENT_HEADER_FIRST_SEG_BITMASK (0x01)
37 #define RAS_SEGMENT_HEADER_LAST_SEG_BITMASK (0x02)
38 #define RAS_SEGMENT_HEADER_ROLL_SEG_COUNT_BITMASK (0xFC)
39 #define RAS_ROLLING_SEGMENT_COUNTER_MIN (0x00)
40 #define RAS_ROLLING_SEGMENT_COUNTER_MAX (0x3F)
41 
42 #define RAS_RANGING_HEADER_LEN (4)
43 #define RAS_ANTENNA_PATH_1_MASK (0x01)
44 #define RAS_ANTENNA_PATH_2_MASK (0x02)
45 #define RAS_ANTENNA_PATH_3_MASK (0x04)
46 #define RAS_ANTENNA_PATH_4_MASK (0x08)
47 #define RAS_PCT_FORMAT_MASK (0x40)
48 
49 #define RAS_SUBEVENT_HEADER_LEN (8)
50 #define RAS_SUBEVENT_HEADER_START_ACL_CON_EVENT_OFFSET (0)
51 #define RAS_SUBEVENT_HEADER_FREQ_COMPENSATION_OFFSET (2)
52 #define RAS_SUBEVENT_HEADER_RANGING_DONE_STATUS_OFFSET (4)
53 #define RAS_SUBEVENT_HEADER_SUBEVENT_DONE_STATUS_OFFSET (5)
54 #define RAS_SUBEVENT_HEADER_REF_POWER_LEVEL_OFFSET (6)
55 #define RAS_SUBEVENT_HEADER_NUM_STEPS_REPORTED_OFFSET (7)
56 
57 typedef enum
58 {
66 
67 typedef enum
68 {
69  RAS_MODE_0 = 0x00,
70  RAS_MODE_1 = 0x01,
71  RAS_MODE_2 = 0x02,
72  RAS_MODE_3 = 0x03,
73  RAS_MODE_NUM = 0x04,
75 
76 typedef enum
77 {
78  MODE0_PACKET_QUALITY = 0x01 << 0,
79  MODE0_PACKET_RSSI = 0x01 << 1,
80  MODE0_PACKET_ANT = 0x01 << 2,
81  MODE0_MEA_FREQ_OFFSET = 0x01 << 3,
83 
84 typedef enum
85 {
86  MODE1_PACKET_QUALITY = 0x01 << 0,
87  MODE1_PACKET_NADM = 0x01 << 1,
88  MODE1_PACKET_RSSI = 0x01 << 2,
89  MODE1_TOD_TOA = 0x01 << 3,
90  MODE1_PACKET_ANT = 0x01 << 4,
91  MODE1_PACKET_PCT1 = 0x01 << 5,
92  MODE1_PACKET_PCT2 = 0x01 << 6,
94 
95 typedef enum
96 {
97  MODE2_ANT_PERM_IDX = 0x01 << 0,
98  MODE2_TON_PCT = 0x01 << 1,
99  MODE2_TON_QUALITY_IND = 0x01 << 2,
100  MODE2_ANT_PATH_1 = 0x01 << 3,
101  MODE2_ANT_PATH_2 = 0x01 << 4,
102  MODE2_ANT_PATH_3 = 0x01 << 5,
103  MODE2_ANT_PATH_4 = 0x01 << 6,
105 
106 typedef enum
107 {
108  MODE3_PACKET_QUALITY = 0x01 << 0,
109  MODE3_PACKET_NADM = 0x01 << 1,
110  MODE3_PACKET_RSSI = 0x01 << 2,
111  MODE3_PACKET_ANT = 0x01 << 3,
112  MODE3_PACKET_PCT1 = 0x01 << 4,
113  MODE3_PACKET_PCT2 = 0x01 << 5,
114  MODE3_TOD_TOA = 0x01 << 6,
115  MODE3_ANT_PERM_IDX = 0x01 << 7,
116  MODE3_TONE_PCT = 0x01 << 8,
118  MODE3_ANT_PATH_1 = 0x01 << 10,
119  MODE3_ANT_PATH_2 = 0x01 << 11,
120  MODE3_ANT_PATH_3 = 0x01 << 12,
121  MODE3_ANT_PATH_4 = 0x01 << 13,
123 
124 typedef enum
125 {
133 
134 typedef enum
135 {
140 
141 typedef enum
142 {
146 
147 typedef struct
148 {
149  uint16_t ras_counter;
151 
152 typedef struct
153 {
154  uint16_t ras_num;
156 
157 typedef struct
158 {
159  uint16_t ras_counter;
160  uint8_t start_seg;
161  uint8_t end_seg;
163 
164 typedef struct
165 {
166  // Bit14~15: CS mode, bit0~13: data bit mask.
167  uint8_t mode;
168  uint16_t bit_mask;
170 
171 typedef enum
172 {
182 
183 typedef struct
184 {
185  uint8_t conidx;
186  uint8_t cfg_id;
188  uint16_t procedure_cnt;
190  uint8_t ref_pwr_level;
193  uint8_t abort_reason;
194  uint8_t num_ante_path;
196  uint16_t result_len;
197  uint8_t step_result[__ARRAY_EMPTY];
199 
200 typedef struct
201 {
203  union
204  {
210  } operands;
212 
213 typedef struct
214 {
216  union
217  {
221  } operands;
223 
224 #endif /* __RAS_COMMON_H__ */
225 
RAS_MODE_0
@ RAS_MODE_0
Definition: ras_common.h:69
RAS_OP_ABORT_OPERATION
@ RAS_OP_ABORT_OPERATION
Definition: ras_common.h:129
ras_subevt_data_t::procedure_cnt
uint16_t procedure_cnt
Definition: ras_common.h:188
ras_ctr_pt_rsp_t::cmp_lost_data_seg_rsp
ras_ctr_lost_data_seg_operand_t cmp_lost_data_seg_rsp
Definition: ras_common.h:219
RAS_RSP_ABORT_UNSUCCESSFUL
@ RAS_RSP_ABORT_UNSUCCESSFUL
Definition: ras_common.h:177
ras_subevt_data_t::num_ante_path
uint8_t num_ante_path
Definition: ras_common.h:194
ras_filter_data_operand_t::bit_mask
uint16_t bit_mask
Definition: ras_common.h:168
MODE3_ANT_PATH_2
@ MODE3_ANT_PATH_2
Definition: ras_common.h:119
ras_ctr_pt_rsp_t::rsp_code_val
ras_rsp_code_val_t rsp_code_val
Definition: ras_common.h:220
MODE1_PACKET_ANT
@ MODE1_PACKET_ANT
Definition: ras_common.h:90
MODE2_ANT_PATH_3
@ MODE2_ANT_PATH_3
Definition: ras_common.h:102
RAS_RSP_PROCEDURE_NOT_COMPLETED
@ RAS_RSP_PROCEDURE_NOT_COMPLETED
Definition: ras_common.h:178
MODE3_PACKET_PCT1
@ MODE3_PACKET_PCT1
Definition: ras_common.h:112
RAS_MODE_1
@ RAS_MODE_1
Definition: ras_common.h:70
MODE2_TON_QUALITY_IND
@ MODE2_TON_QUALITY_IND
Definition: ras_common.h:99
ras_ctr_pt_operation_t
Definition: ras_common.h:201
MODE2_ANT_PERM_IDX
@ MODE2_ANT_PERM_IDX
Definition: ras_common.h:97
ras_ctr_lost_data_seg_operand_t::start_seg
uint8_t start_seg
Definition: ras_common.h:160
ras_subevt_data_t::ref_pwr_level
uint8_t ref_pwr_level
Definition: ras_common.h:190
RAS_RSP_SERVER_BUSY
@ RAS_RSP_SERVER_BUSY
Definition: ras_common.h:179
ras_ctr_lost_data_seg_operand_t
Definition: ras_common.h:158
ras_subevt_data_t
Definition: ras_common.h:184
ras_pct_format_operand_t
ras_pct_format_operand_t
Definition: ras_common.h:142
MODE3_ANT_PERM_IDX
@ MODE3_ANT_PERM_IDX
Definition: ras_common.h:115
ras_ctr_lost_data_seg_operand_t::ras_counter
uint16_t ras_counter
Definition: ras_common.h:159
ras_subevt_data_t::start_acl_conn_event_num
uint16_t start_acl_conn_event_num
Definition: ras_common.h:187
RAS_MODE_NUM
@ RAS_MODE_NUM
Definition: ras_common.h:73
ras_ctr_pt_rsp_t::cmp_data_rsp
ras_cmp_data_rsp_operand_t cmp_data_rsp
Definition: ras_common.h:218
ras_subevt_data_t::procedure_done_status
uint8_t procedure_done_status
Definition: ras_common.h:191
ras_subevt_data_t::result_len
uint16_t result_len
Definition: ras_common.h:196
MODE3_PACKET_QUALITY
@ MODE3_PACKET_QUALITY
Definition: ras_common.h:108
MODE1_PACKET_RSSI
@ MODE1_PACKET_RSSI
Definition: ras_common.h:88
ras_ctr_pt_operation_t::ack_ra_data_param
ras_ctr_data_operand_t ack_ra_data_param
Definition: ras_common.h:206
ras_cmp_data_rsp_operand_t
Definition: ras_common.h:153
MODE0_PACKET_RSSI
@ MODE0_PACKET_RSSI
Definition: ras_common.h:79
ras_ctr_pt_operation_t::get_ra_data_param
ras_ctr_data_operand_t get_ra_data_param
Definition: ras_common.h:205
RAS_OP_CMP_LOST_RA_DATA_SEG_RSP
@ RAS_OP_CMP_LOST_RA_DATA_SEG_RSP
Definition: ras_common.h:137
RAS_OP_PCT_FORMAT
@ RAS_OP_PCT_FORMAT
Definition: ras_common.h:131
MODE1_PACKET_PCT2
@ MODE1_PACKET_PCT2
Definition: ras_common.h:92
ras_filter_data_operand_t::mode
uint8_t mode
Definition: ras_common.h:167
ras_mode0_data_bit_t
ras_mode0_data_bit_t
Definition: ras_common.h:77
MODE3_TON_QUALITY_IND
@ MODE3_TON_QUALITY_IND
Definition: ras_common.h:117
RAS_FEA_RL_RA_DATA_BIT_MASK
@ RAS_FEA_RL_RA_DATA_BIT_MASK
Definition: ras_common.h:59
ras_ctr_data_operand_t::ras_counter
uint16_t ras_counter
Definition: ras_common.h:149
MODE2_ANT_PATH_1
@ MODE2_ANT_PATH_1
Definition: ras_common.h:100
MODE1_PACKET_PCT1
@ MODE1_PACKET_PCT1
Definition: ras_common.h:91
MODE3_TONE_PCT
@ MODE3_TONE_PCT
Definition: ras_common.h:116
ras_subevt_data_t::frequency_compensation
uint16_t frequency_compensation
Definition: ras_common.h:189
RAS_FEA_RETR_LOST_RA_DATA_SEG_BIT_MASK
@ RAS_FEA_RETR_LOST_RA_DATA_SEG_BIT_MASK
Definition: ras_common.h:60
ras_subevt_data_t::num_steps_report
uint8_t num_steps_report
Definition: ras_common.h:195
ras_ctr_pt_operation_t::retr_ra_data_param
ras_ctr_lost_data_seg_operand_t retr_ra_data_param
Definition: ras_common.h:207
ras_filter_data_operand_t
Definition: ras_common.h:165
ras_ctr_pt_operation_t::pct_fmt_param
ras_pct_format_operand_t pct_fmt_param
Definition: ras_common.h:209
ras_subevt_data_t::abort_reason
uint8_t abort_reason
Definition: ras_common.h:193
RAS_FEA_FILTER_RA_DATA_BIT_MASK
@ RAS_FEA_FILTER_RA_DATA_BIT_MASK
Definition: ras_common.h:62
ras_subevt_data_t::cfg_id
uint8_t cfg_id
Definition: ras_common.h:186
RAS_MODE_3
@ RAS_MODE_3
Definition: ras_common.h:72
ras_ctrl_pt_rsp_opd_t
ras_ctrl_pt_rsp_opd_t
Definition: ras_common.h:135
MODE3_ANT_PATH_1
@ MODE3_ANT_PATH_1
Definition: ras_common.h:118
RAS_FEA_PCT_PHASE_FORMAT_BIT_MASK
@ RAS_FEA_PCT_PHASE_FORMAT_BIT_MASK
Definition: ras_common.h:63
ras_mode3_data_bit_t
ras_mode3_data_bit_t
Definition: ras_common.h:107
__ARRAY_EMPTY
#define __ARRAY_EMPTY
Definition: gr55xx_sys_cfg.h:53
ras_fea_bit_mask_t
ras_fea_bit_mask_t
Definition: ras_common.h:58
RAS_OP_ACK_RA_DATA
@ RAS_OP_ACK_RA_DATA
Definition: ras_common.h:127
ras_mode_type_t
ras_mode_type_t
Definition: ras_common.h:68
MODE2_ANT_PATH_4
@ MODE2_ANT_PATH_4
Definition: ras_common.h:103
ras_ctr_pt_rsp_t
Definition: ras_common.h:214
RAS_RSP_OPCODE_NOT_SUPPORTED
@ RAS_RSP_OPCODE_NOT_SUPPORTED
Definition: ras_common.h:174
RAS_OP_FILTER
@ RAS_OP_FILTER
Definition: ras_common.h:130
RAS_OP_RETR_LOST_RA_DATA_SEGMENTS
@ RAS_OP_RETR_LOST_RA_DATA_SEGMENTS
Definition: ras_common.h:128
MODE1_PACKET_NADM
@ MODE1_PACKET_NADM
Definition: ras_common.h:87
ras_ctr_data_operand_t
Definition: ras_common.h:148
RAS_FEA_ALL_BIT_MASK
@ RAS_FEA_ALL_BIT_MASK
Definition: ras_common.h:64
RAS_MODE_2
@ RAS_MODE_2
Definition: ras_common.h:71
MODE3_ANT_PATH_4
@ MODE3_ANT_PATH_4
Definition: ras_common.h:121
RAS_RSP_NO_RECORDS_FOUND
@ RAS_RSP_NO_RECORDS_FOUND
Definition: ras_common.h:180
ras_subevt_data_t::conidx
uint8_t conidx
Definition: ras_common.h:185
MODE3_TOD_TOA
@ MODE3_TOD_TOA
Definition: ras_common.h:114
MODE3_ANT_PATH_3
@ MODE3_ANT_PATH_3
Definition: ras_common.h:120
RAS_OP_RSP_CODE
@ RAS_OP_RSP_CODE
Definition: ras_common.h:138
MODE0_PACKET_ANT
@ MODE0_PACKET_ANT
Definition: ras_common.h:80
RAS_PCT_FORMAT_IQ
@ RAS_PCT_FORMAT_IQ
Definition: ras_common.h:143
MODE2_TON_PCT
@ MODE2_TON_PCT
Definition: ras_common.h:98
ras_subevt_data_t::subevent_done_status
uint8_t subevent_done_status
Definition: ras_common.h:192
MODE1_PACKET_QUALITY
@ MODE1_PACKET_QUALITY
Definition: ras_common.h:86
ras_cmp_data_rsp_operand_t::ras_num
uint16_t ras_num
Definition: ras_common.h:154
MODE3_PACKET_RSSI
@ MODE3_PACKET_RSSI
Definition: ras_common.h:110
MODE2_ANT_PATH_2
@ MODE2_ANT_PATH_2
Definition: ras_common.h:101
RAS_RSP_INVALID_PARAM
@ RAS_RSP_INVALID_PARAM
Definition: ras_common.h:175
RAS_PCT_FORMAT_PHASE
@ RAS_PCT_FORMAT_PHASE
Definition: ras_common.h:144
ras_ctr_pt_operation_t::filter_param
ras_filter_data_operand_t filter_param
Definition: ras_common.h:208
ras_ctrl_pt_cmd_opd_t
ras_ctrl_pt_cmd_opd_t
Definition: ras_common.h:125
RAS_OP_CMP_RA_DATA_RSP
@ RAS_OP_CMP_RA_DATA_RSP
Definition: ras_common.h:136
RAS_RSP_SUCCESS
@ RAS_RSP_SUCCESS
Definition: ras_common.h:173
MODE3_PACKET_PCT2
@ MODE3_PACKET_PCT2
Definition: ras_common.h:113
RAS_RSP_PARAM_NOT_SUPPORTED
@ RAS_RSP_PARAM_NOT_SUPPORTED
Definition: ras_common.h:176
ras_ctr_pt_rsp_t::opcode
ras_ctrl_pt_rsp_opd_t opcode
Definition: ras_common.h:215
ras_mode2_data_bit_t
ras_mode2_data_bit_t
Definition: ras_common.h:96
RAS_OP_GET_RA_DATA
@ RAS_OP_GET_RA_DATA
Definition: ras_common.h:126
ras_ctr_pt_operation_t::opcode
ras_ctrl_pt_cmd_opd_t opcode
Definition: ras_common.h:202
MODE1_TOD_TOA
@ MODE1_TOD_TOA
Definition: ras_common.h:89
ras_rsp_code_val_t
ras_rsp_code_val_t
Definition: ras_common.h:172
MODE0_PACKET_QUALITY
@ MODE0_PACKET_QUALITY
Definition: ras_common.h:78
ras_ctr_lost_data_seg_operand_t::end_seg
uint8_t end_seg
Definition: ras_common.h:161
MODE3_PACKET_ANT
@ MODE3_PACKET_ANT
Definition: ras_common.h:111
MODE0_MEA_FREQ_OFFSET
@ MODE0_MEA_FREQ_OFFSET
Definition: ras_common.h:81
MODE3_PACKET_NADM
@ MODE3_PACKET_NADM
Definition: ras_common.h:109
RAS_FEA_ABORT_OPERATION_BIT_MASK
@ RAS_FEA_ABORT_OPERATION_BIT_MASK
Definition: ras_common.h:61
ras_mode1_data_bit_t
ras_mode1_data_bit_t
Definition: ras_common.h:85