-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathS2LP_Types.h
More file actions
245 lines (199 loc) · 6.39 KB
/
S2LP_Types.h
File metadata and controls
245 lines (199 loc) · 6.39 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
/**
* @file S2LP_Types.h
* @author LowPower RF BU - AMG
* @version 1.3.0
* @date April 12, 2017
* @brief Header file for S2-LP types.
* @details
*
* This module provide some types definitions which will be used in
* all the modules of this library. Here is defined also the global
* variable @ref g_xStatus which contains the status of S2-LP and
* is updated every time an SPI transaction occurs.
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* THIS SOURCE CODE IS PROTECTED BY A LICENSE.
* FOR MORE INFORMATION PLEASE CAREFULLY READ THE LICENSE AGREEMENT FILE LOCATED
* IN THE ROOT DIRECTORY OF THIS FIRMWARE PACKAGE.
*
* <h2><center>© COPYRIGHT 2019 STMicroelectronics</center></h2>
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __S2LP_GENERICTYPES_H
#define __S2LP_GENERICTYPES_H
/* Includes ------------------------------------------------------------------*/
/* Include all integer types definitions */
#include <stdint.h>
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup S2LP_Libraries
* @{
*/
/**
* @defgroup S2LP_Types Types
* @brief Module for S2LP types definition.
* * @details See the file <i>@ref S2LP_Types.h</i> for more details.
* @{
*/
/**
* @defgroup Types_Exported_Types Types Exported Types
* @{
*/
/**
* @brief S2LP Functional state. Used to enable or disable a specific option.
*/
typedef enum {
S_DISABLE = 0,
S_ENABLE = !S_DISABLE
} SFunctionalState;
/**
* @brief S2LP Flag status. Used to control the state of a flag.
*/
typedef enum {
S_RESET = 0,
S_SET = !S_RESET
} SFlagStatus;
/**
* @brief boolean type enumeration.
*/
typedef enum {
S_FALSE = 0,
S_TRUE = !S_FALSE
} SBool;
/**
* @brief S2LP States enumeration.
*/
typedef enum {
MC_STATE_READY =0x00, /*!< READY */
MC_STATE_SLEEP_NOFIFO =0x01, /*!< SLEEP NO FIFO RETENTION */
MC_STATE_STANDBY =0x02, /*!< STANDBY */
MC_STATE_SLEEP =0x03, /*!< SLEEP */
MC_STATE_LOCKON =0x0C, /*!< LOCKON */
MC_STATE_RX =0x30, /*!< RX */
MC_STATE_LOCK_ST =0x14, /*!< LOCK_ST */
MC_STATE_TX =0x5C, /*!< TX */
MC_STATE_SYNTH_SETUP =0x50 /*!< SYNTH_SETUP */
} S2LPState;
/**
* @brief S2LP Status. This definition represents the single field of the S2LP
* status returned on each SPI transaction, equal also to the MC_STATE registers.
* This field-oriented structure allows user to address in simple way the single
* field of the S2LP status.
* The user shall define a variable of S2LPStatus type to access on S2LP status fields.
* @note The fields order in the structure depends on used endianness (little or big
* endian). The actual definition is valid ONLY for LITTLE ENDIAN mode. Be sure to
* change opportunely the fields order when use a different endianness.
*/
typedef struct {
uint8_t XO_ON:1; /*!< XO is operating state */
S2LPState MC_STATE: 7; /*!< The state of the Main Controller of S2LP @ref S2LPState */
uint8_t ERROR_LOCK: 1; /*!< RCO calibration error */
uint8_t RX_FIFO_EMPTY: 1; /*!< RX FIFO is empty */
uint8_t TX_FIFO_FULL: 1; /*!< TX FIFO is full */
uint8_t ANT_SELECT: 1; /*!< Currently selected antenna */
uint8_t RCCAL_OK: 1; /*!< RCO successfully terminated */
uint8_t : 3; /*!< This 3 bits field are reserved and equal to 2 */
}S2LPStatus;
/**
* @brief S2LP Range Extender type. This definition represents the possible Range Extender of the S2-LP
* component.
*/
typedef enum
{
RANGE_EXT_NONE = 0,
RANGE_EXT_SKY_66100_11 = 1,
RANGE_EXT_SKYWORKS_SE2435L = 2,
RANGE_EXT_SKYWORKS_SKY66420 = 3,
RANGE_EXT_CUSTOM = 4
} RangeExtType;
/**
* @brief S2LP CUT type. This definition represents the possible CUT versions of the S2-LP
* component.
*/
typedef enum
{
S2LP_CUT_2_1 = 0x91,
S2LP_CUT_2_0 = 0x81,
S2LP_CUT_3_0 = 0xC1,
} S2LPCutType;
/**
* @brief FEM Operation type. This definition represents the structure to manage External PA.
*/
typedef enum
{
FEM_SHUTDOWN = 0x00,
FEM_TX_BYPASS = 0x01,
FEM_TX = 0x02,
FEM_RX = 0x03,
} FEM_OperationType;
/**
* @}
*/
/**
* @defgroup Types_Exported_Constants Types Exported Constants
* @{
*/
/**
* @}
*/
/**
* @defgroup Types_Exported_Macros Types Exported Macros
* @{
*/
#define IS_SFUNCTIONAL_STATE(STATE) (STATE == S_DISABLE || STATE == S_ENABLE)
#define IS_SFLAG_STATUS(STATUS) (STATUS == S_RESET || STATUS == S_SET)
#define IS_SBOOL(STATUS) (STATUS == S_FALSE || STATUS == S_TRUE)
#define S_ABS(a) ((a)>0?(a):-(a))
/**
* @}
*/
/**
* @defgroup Types_Exported_Functions Types Exported Functions
* @{
*/
#ifdef S2LP_USE_FULL_ASSERT
/**
* @brief The s_assert_param macro is used for function's parameters check.
* @param expr If expr is false, it calls assert_failed function which reports
* the name of the source file and the source line number of the call
* that failed. If expr is true, it returns no value.
* @retval None
*/
#define s_assert_param(expr) ((expr) ? (void)0 : s_assert_failed((uint8_t *)__FILE__, __LINE__))
void s_assert_failed(uint8_t* file, uint32_t line);
#elif S2LP_USE_VCOM_ASSERT
/**
* @brief The s_assert_param macro is used for function's parameters check.
* @param expr If expr is false, it calls assert_failed function which reports
* the name of the source file and the source line number of the call
* that failed. If expr is true, it returns no value.
* @retval None
*/
#define s_assert_param(expr) ((expr) ? (void)0 : s_assert_failed((uint8_t *)__FILE__, __LINE__,#expr))
void s_assert_failed(uint8_t* file, uint32_t line, char* expression);
#else
#define s_assert_param(expr) {}
#endif
/**
*@}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif
/******************* (C) COPYRIGHT 2019 STMicroelectronics *****END OF FILE****/