-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrf_sw_cmds.h
More file actions
144 lines (129 loc) · 3.86 KB
/
rf_sw_cmds.h
File metadata and controls
144 lines (129 loc) · 3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
* Copyright 2020-2023 NXP
*
*/
#ifndef __RF_SW_CMDS_H__
#define __RF_SW_CMDS_H__
#include "rf_sw_cmd_types.h"
static inline const char *rf_err2str(rf_sw_cmd_result_t r)
{
switch (r) {
RET_CASE(RF_SW_CMD_RESULT_OK);
RET_CASE(RF_SW_CMD_RESULT_TIMEOUT);
RET_CASE(RF_SW_CMD_RESULT_CMD_INVALID);
RET_CASE(RF_SW_CMD_RESULT_BUSY);
RET_CASE(RF_SW_CMD_RESULT_ENQUEUE_ERROR);
RET_CASE(RF_SW_CMD_RESULT_CMD_PARAMS_INVALID);
RET_CASE(RF_SW_CMD_RESULT_DESC_INVALID);
RET_CASE(RF_SW_CMD_RESULT_ERROR);
RET_CASE(RF_SW_CMD_RESULT_NOT_IMPLEMENTED);
RET_CASE(RF_SW_CMD_RESULT_PENDING);
RET_CASE(RF_SW_CMD_RESULT_REJECTED);
RET_CASE(RF_SW_CMD_RESULT_GAIN_MAXOUT);
RET_CASE(RF_SW_CMD_RESULT_GAIN_MINOUT);
RET_CASE(RF_SW_CMD_RESULT_INVALID_CORE);
RET_CASE(RF_SW_CMD_RESULT_INVALID_MODE);
RET_CASE(RF_SW_CMD_RESULT_INVALID_SM_STATE);
RET_CASE(RF_SW_CMD_RESULT_INVALID_CALDATA);
RET_CASE(RF_SW_CMD_RESULT_RFIC_ERR);
RET_CASE(RF_SW_CMD_RESULT_RFIC_TIMEOUT);
RET_CASE(RF_SW_CMD_RESULT_SM_ERROR);
RET_CASE(RF_SW_CMD_RESULT_INVALID_GAIN);
RET_CASE(RF_SW_CMD_RESULT_INVALID_DPDPATH);
RET_CASE(RF_SW_CMD_RESULT_APIPLAYER_DISABLED);
default:
return "RF_SW_CMD_RESULT_UNKNOWN";
}
}
static inline const char *rf_apiid2str(rf_api_id_t r)
{
switch(r)
{
RET_CASE(RF_API_CHANGE_MODE);
RET_CASE(RF_API_ADJUST_PLL_FREQ);
RET_CASE(RF_API_SWITCH_TX);
RET_CASE(RF_API_SWITCH_RX);
RET_CASE(RF_API_ENABLE_TRX);
RET_CASE(RF_API_PLL_STATUS);
RET_CASE(RF_API_CTRL_RELATIVE_TX_GAIN);
RET_CASE(RF_API_CTRL_RELATIVE_RX_GAIN);
RET_CASE(RF_API_CTRL_RELATIVE_SRX_GAIN);
RET_CASE(RF_API_SET_SRX);
RET_CASE(RF_API_GET_RX_GAIN_IDX);
RET_CASE(RF_API_GET_TX_GAIN_IDX);
RET_CASE(RF_API_GET_TX_GAIN_TBL);
RET_CASE(RF_API_GET_RX_GAIN_TBL);
default:
return "RF_API_UNKNOWN";
}
}
typedef struct rf_sw_cmd_desc {
uint32_t cmd; /* command id */
uint32_t flags; /* remote or local */
uint32_t timeout; /* command specific timeout in us */
uint32_t core_id; /* Descriptor owner */
uint32_t ipi_event_id;
uint32_t priority;
rf_sw_cmd_status_t status; /* desc status */
rf_sw_cmd_result_t result;
uint8_t data[RF_SW_CMD_DATA_SIZE]; /* command specific data */
} __attribute__ ((packed)) rf_sw_cmd_desc_t;
struct rf_common_mdata {
uint32_t rfic_type;
rf_sw_cmd_desc_t host_swcmd;
} __attribute__ ((packed));
struct rf_priv_mdata {
rf_sw_cmd_desc_t swcmd_descs[E200_CORE_COUNT];
uint8_t rfdev[RF_DEVICE_SIZE];
uint8_t rficdev[RFIC_DEVICE_SIZE];
} __attribute__ ((packed));
struct rf_reg_rw_data {
uint32_t addr;
uint32_t val;
} __attribute__ ((packed));
struct rf_swcmd_reg_rw {
uint32_t count;
struct rf_reg_rw_data reg_data[MAX_RW_REGS];
} __attribute__ ((packed));
typedef struct sw_cmd_setget_mode_t
{
uint32_t mode;
uint32_t type;
uint32_t idx;
uint32_t duplexmode;
} __attribute__( ( packed ) ) sw_cmd_setget_mode_t;
typedef struct sw_cmd_setget_txrxbw
{
uint32_t rtc;
uint32_t bw;
uint32_t bw_ftune;
} __attribute__( ( packed ) ) sw_cmd_setget_txrxbw_t;
typedef struct sw_cmd_setget_trxpll
{
uint32_t rtc;
uint32_t mode;
uint32_t vco_sel;
uint32_t freq_khz;
uint32_t cal_cap;
uint32_t cal_current;
uint32_t trxpath;
} __attribute__( ( packed ) ) sw_cmd_setget_trxpll_t;
typedef struct sw_cmd_ctrl_relative_gain
{
int32_t ucGainIndB;
int32_t psEnforcedGain;
} __attribute__( ( packed ) ) sw_cmd_ctrl_relative_gain_t;
typedef struct sw_cmd_pll_status
{
uint32_t yuc1_trxstatus;
uint32_t yuc1_calstatus;
uint32_t yuc2_trxstatus;
uint32_t yuc2_calstatus;
} __attribute__( ( packed ) ) sw_cmd_pll_status_t;
typedef struct sw_cmd_setdpd
{
uint32_t dpd_path;
uint32_t enable;
} __attribute__( ( packed ) ) sw_cmd_setdpd_t;
#endif /* __RF_SW_CMDS_H__ */