no-OS
max22516.h
Go to the documentation of this file.
1 /***************************************************************************/
34 #ifndef MAX22516_H_
35 #define MAX22516_H_
36 
37 /******************************************************************************/
38 /***************************** Include Files **********************************/
39 /******************************************************************************/
40 #include <stdint.h>
41 #include <math.h>
42 #include <stdbool.h>
43 #include "no_os_spi.h"
44 #include "no_os_gpio.h"
45 #include "no_os_util.h"
46 
47 /******************************************************************************/
48 /********************** Macros and Constants Definitions **********************/
49 /******************************************************************************/
50 #define REG_CHIP_ID 0x00
51 #define REG_REV_ID 0x01
52 #define REG_IOL_STAT 0x02
53 #define REG_DEV_STAT1 0x03
54 #define REG_DEV_STAT2 0x04
55 #define REG_ISDU_STAT 0x05
56 #define REG_IOL_ERR_CNT 0x06
57 #define REG_FRM_ERR_CNT 0x07
58 #define REG_IOL_INT 0x08
59 #define REG_DEV_INT 0x09
60 #define REG_ISDU_INT 0x0A
61 #define REG_IOL_INT_EN 0x0E
62 #define REG_DEV_INT_EN 0x0F
63 #define REG_ISDU_INT_EN 0x10
64 #define REG_IOL_CFG 0x14
65 #define REG_WATCHDOG 0x15
66 #define REG_WDGCLR 0x16
67 #define REG_MISC_CFG 0x17
68 #define REG_CLK_CFG 0x18
69 #define REG_CLK_TRIM 0x19
70 #define REG_PG1_MSTCMD 0x1A
71 #define REG_PG1_MSTCYCTM 0x1B
72 #define REG_PG1_MINCYCTM 0x1C
73 #define REG_PG1_MSEQCAP 0x1D
74 #define REG_PG1_REVID 0x1E
75 #define REG_PG1_PDIN 0x1F
76 #define REG_PG1_PDOUT 0x20
77 #define REG_PG1_VID1 0x21
78 #define REG_PG1_VID2 0x22
79 #define REG_PG1_DEVID1 0x23
80 #define REG_PG1_DEVID2 0x24
81 #define REG_PG1_DEVID3 0x25
82 #define REG_PG1_FUNCID1 0x26
83 #define REG_PG1_FUNCID2 0x27
84 #define REG_PG1_RES1 0x28
85 #define REG_PG1_RES2 0x29
86 #define REG_WDG_EVENT 0x2A
87 #define REG_STATUS_CODE_DEF 0x2B
88 #define REG_STATUS_CODE 0x2C
89 #define REG_EVENT_QUAL 0x2D
90 #define REG_EVENT_CODE_MSB 0x2E
91 #define REG_EVENT_CODE_LSB 0x2F
92 #define REG_EVENT_FLAG 0x30
93 #define REG_PDIN_FIFO 0x35
94 #define REG_PDIN_DATA_RDY 0x36
95 #define REG_PDOUT_FIFO 0x37
96 #define REG_ISDU_OFFSET 0x3F
97 #define REG_ISDU_INFIFO 0x40
98 #define REG_ISDU_DATARDY 0x41
99 #define REG_ISDU_OUTFIFO 0x42
100 #define REG_ISDU_LEVEL 0x43
101 #define REG_LED1_CTRL_MSB 0x50
102 #define REG_LED1_CTRL_LSB 0x51
103 #define REG_LED2_CTRL_MSB 0x52
104 #define REG_LED2_CTRL_LSB 0x53
105 #define REG_GPIO1_CTRL 0x54
106 #define REG_GPIO2_CTRL 0x55
107 #define REG_CQ_CTRL1 0x56
108 #define REG_CQ_CTRL2 0x57
109 #define REG_DO_CTRL1 0x58
110 #define REG_DO_CTRL2 0x59
111 #define REG_TX_CTRL 0x5A
112 #define REG_RX_CTRL 0x5B
113 #define REG_MISC_CTRL 0x5C
114 
115 /* REG_DEV_STAT2 */
116 #define DEV_STAT2_SET_DOFAULT NO_OS_BIT(5)
117 #define DEV_STAT2_SET_CQFAULT NO_OS_BIT(4)
118 #define DEV_STAT2_SET_V24ERR NO_OS_BIT(3)
119 #define DEV_STAT2_SET_VMWERR NO_OS_BIT(2)
120 #define DEV_STAT2_SET_THWARN NO_OS_BIT(1)
121 #define DEV_STAT2_SET_TSHD NO_OS_BIT(0)
122 
123 /* REG_CQ_CTRL1 */
124 #define BIT_CQCTRL1_CQ_SLEW0 0x00
125 #define BIT_CQCTRL1_CQ_SLEW1 NO_OS_BIT(6)
126 #define BIT_CQCTRL1_CQ_SLEW2 NO_OS_BIT(7)
127 #define BIT_CQCTRL1_CQ_SLEW3 NO_OS_BIT(7, 6)
128 #define BIT_CQCTRL1_CQ_PD NO_OS_BIT(5)
129 #define BIT_CQCTRL1_CQ_PU NO_OS_BIT(4)
130 #define BIT_CQCTRL1_CQ_NPN NO_OS_BIT(3)
131 #define BIT_CQCTRL1_CQ_PP NO_OS_BIT(2)
132 #define BIT_CQCTRL1_CQ_INV NO_OS_BIT(1)
133 #define BIT_CQCTRL1_CQ_EN NO_OS_BIT(0)
134 
135 /* REG_CQ_CTRL2 */
136 #define BIT_CQ_CL_50MA 0x00
137 #define BIT_CQ_CL_100MA NO_OS_BIT(6)
138 #define BIT_CQ_CL_200MA NO_OS_BIT(7)
139 #define BIT_CQ_CL_250MA NO_OS_BIT(7, 6)
140 #define BIT_CQ_CLBL_128US 0x00
141 #define BIT_CQ_CLBL_500US NO_OS_BIT(3)
142 #define BIT_CQ_CLBL_1000US NO_OS_BIT(4)
143 #define BIT_CQ_CLBL_5000US NO_OS_BIT(4, 3)
144 #define BIT_CQ_AUTORTY_TIME_50MS 0x00
145 #define BIT_CQ_AUTORTY_TIME_100MS NO_OS_BIT(1)
146 #define BIT_CQ_AUTORTY_TIME_200MS NO_OS_BIT(2)
147 #define BIT_CQ_AUTORTY_TIME_500MS NO_OS_BIT(2, 1)
148 #define BIT_CQ_AUTORTY NO_OS_BIT(0)
149 
150 /* REG_DO_CTRL1 */
151 #define BIT_DOCTRL1_DO_SLEW0 0x00
152 #define BIT_DOCTRL1_DO_SLEW1 NO_OS_BIT(6)
153 #define BIT_DOCTRL1_DO_SLEW2 NO_OS_BIT(7)
154 #define BIT_DOCTRL1_DO_SLEW3 NO_OS_BIT(7, 6)
155 #define BIT_DOCTRL1_DO_PD NO_OS_BIT(5)
156 #define BIT_DOCTRL1_DO_PU NO_OS_BIT(4)
157 #define BIT_DOCTRL1_DO_NPN NO_OS_BIT(3)
158 #define BIT_DOCTRL1_DO_PP NO_OS_BIT(2)
159 #define BIT_DOCTRL1_DO_INV NO_OS_BIT(1)
160 #define BIT_DOCTRL1_DO_EN NO_OS_BIT(0)
161 
162 /* REG_DO_CTRL2 */
163 #define BIT_DO_CL_50MA 0x00
164 #define BIT_DO_CL_100MA NO_OS_BIT(6)
165 #define BIT_DO_CL_200MA NO_OS_BIT(7)
166 #define BIT_DO_CL_250MA NO_OS_BIT(7, 6)
167 #define BIT_DO_CLBL_128US 0x00
168 #define BIT_DO_CLBL_500US NO_OS_BIT(3)
169 #define BIT_DO_CLBL_1000US NO_OS_BIT(4)
170 #define BIT_DO_CLBL_5000US NO_OS_BIT(4, 3)
171 #define BIT_DO_AUTORTY_TIME_50MS 0x00
172 #define BIT_DO_AUTORTY_TIME_100MS NO_OS_BIT(1)
173 #define BIT_DO_AUTORTY_TIME_200MS NO_OS_BIT(2)
174 #define BIT_DO_AUTORTY_TIME_500MS NO_OS_BIT(2, 1)
175 #define BIT_DO_AUTORTY NO_OS_BIT(0)
176 
177 /* REG_TX_CTRL */
178 #define BIT_TXC_CQTX NO_OS_BIT(7)
179 #define BIT_TXC_CQTXEN NO_OS_BIT(6)
180 #define BIT_TXC_CQDRVSEL NO_OS_BIT(5)
181 #define BIT_TXC_DOTX NO_OS_BIT(4)
182 #define BIT_TXC_DODRVSEL NO_OS_BIT(3)
183 #define BIT_TXC_CQDOPAR NO_OS_BIT(1)
184 #define BIT_TXC_DO_AV NO_OS_BIT(0)
185 
186 /* REG_DEV_STAT2 */
187 #define DEV_STAT2_SET_V24ERR NO_OS_BIT(3)
188 #define DEV_STAT2_SET_VMERR NO_OS_BIT(2)
189 #define DEV_STAT2_SET_THWARN NO_OS_BIT(1)
190 #define DEV_STAT2_SET_TSHD NO_OS_BIT(0)
191 
192 /* REG_EVENT_FLAG */
193 #define EVF_EVENT_FLG NO_OS_BIT(0)
194 
195 /* MAX22516 EVENT CODE Masks */
196 #define REG_EVENT_CODE_MSB_MSK NO_OS_GENMASK(15, 8)
197 #define REG_EVENT_CODE_LSB_MSK NO_OS_GENMASK(7, 0)
198 
199 /* MAX22516 VID Masks*/
200 #define PG1_VID1_MSK NO_OS_GENMASK(15, 8)
201 #define PG1_VID2_MSK NO_OS_GENMASK(7, 0)
202 
203 /* MAX22516 DEVID Masks*/
204 #define PG1_DEVID1_MSK NO_OS_GENMASK(23, 16)
205 #define PG1_DEVID2_MSK NO_OS_GENMASK(15, 8)
206 #define PG1_DEVID3_MSK NO_OS_GENMASK(7, 0)
207 
208 /* MAX22516 FUNCID1 Masks */
209 #define PG1_FUNCID1_MSB_MSK NO_OS_GENMASK(15, 8)
210 #define PG1_FUNCID1_LSB_MSK NO_OS_GENMASK(7, 0)
211 
212 /* MAX22516 LED1_CTRL Masks */
213 #define REG_LED1_CTRL_MSB_MSK NO_OS_GENMASK(15, 8)
214 #define REG_LED1_CTRL_LSB_MSK NO_OS_GENMASK(7, 0)
215 
216 /* MAX22516 LED2_CTRL Masks */
217 #define REG_LED2_CTRL_MSB_MSK NO_OS_GENMASK(15, 8)
218 #define REG_LED2_CTRL_LSB_MSK NO_OS_GENMASK(7, 0)
219 
220 /* MAX22516 Extra Definitions */
221 #define MAX22516_SPI_DUMMY_DATA 0x00
222 #define MAX22516_BUFF_SIZE_BYTES 64
223 #define MAX22516_SPI_READ_CMD NO_OS_BIT(7)
224 
225 /******************************************************************************/
226 /*************************** Types Declarations *******************************/
227 /******************************************************************************/
228 
234  /* SPI Initialization parameters */
236 };
237 
242 struct max22516_dev {
243  /* SPI Initialization parameters */
247 };
248 
249 /******************************************************************************/
250 /************************ Functions Declarations ******************************/
251 /******************************************************************************/
252 
253 /* MAX22516 SPI write */
254 int max22516_write(struct max22516_dev *dev, uint8_t reg_addr,
255  uint8_t data);
256 
257 /* MAX22516 SPI Read */
258 int max22516_read(struct max22516_dev *dev, uint8_t reg_addr,
259  uint8_t *data);
260 
261 /* MAX22516 Register Update */
262 int max22516_update(struct max22516_dev *dev, uint8_t reg_addr,
263  uint8_t mask, uint8_t data);
264 
265 /* MAX22516 Burst Write */
266 int max22516_burst_write_register(struct max22516_dev *dev, uint8_t reg_addr,
267  uint8_t count, uint8_t *data);
268 
269 /* MAX22516 Burst Read */
270 int max22516_burst_read_register(struct max22516_dev *dev, uint8_t reg_addr,
271  uint8_t count, uint8_t *data);
272 
273 /* MAX22516 build tcyc */
274 void max22516_build_tcyc(int16_t t, uint8_t *tmr);
275 
276 /* MAX22516 rebuild min cyct to microseconds */
277 void max22516_rebuild_min_cyct_to_us(int16_t t, uint8_t *tmr);
278 
279 /* MAX22516 set min ctmr */
280 int max22516_set_min_ctmr(struct max22516_dev *dev, uint16_t min_t);
281 
282 /* MAX22516 set id */
283 int max22516_set_id(struct max22516_dev *dev, uint16_t vid, uint32_t id,
284  uint16_t fid);
285 
286 /* MAX22516 decode tcyc */
287 void max22516_decode_tcyc(uint8_t tmr, int16_t *t);
288 
289 /* MAX22516 get mst ctmr */
290 int max22516_get_mst_ctmr(struct max22516_dev *dev, uint16_t min_t,
291  int16_t *c_tmr);
292 
293 /* MAX22516 get dl mode */
294 int max22516_get_dl_mode(struct max22516_dev *dev, uint8_t *mode);
295 
296 /* MAX22516 get iol err cnt */
297 int max22516_get_iol_err_cnt(struct max22516_dev *dev, uint8_t *cnt);
298 
299 /* MAX22516 get frm err cnt */
300 int max22516_get_frm_err_cnt(struct max22516_dev *dev, uint8_t *cnt);
301 
302 /* MAX22516 clr iol err cnt */
303 int max22516_clr_iol_err_cnt(struct max22516_dev *dev);
304 
305 /* MAX22516 clr frm err cnt */
306 int max22516_clr_frm_err_cnt(struct max22516_dev *dev);
307 
308 /* MAX22516 set led1 */
309 int max22516_set_led1(struct max22516_dev *dev, uint16_t ltmr);
310 
311 /* MAX22516 set led2 */
312 int max22516_set_led2(struct max22516_dev *dev, uint16_t ltmr);
313 
314 /* MAX22516 get v24 */
315 int max22516_get_v24(struct max22516_dev *dev, uint8_t *status3);
316 
317 /* MAX22516 get THD */
318 int max22516_get_thd(struct max22516_dev *dev, uint8_t *status3);
319 
320 /* MAX22516 setup cq dis */
321 int max22516_setup_cq_dis(struct max22516_dev *dev);
322 
323 /* MAX22516 setup cq pp */
324 int max22516_setup_cq_pp(struct max22516_dev *dev);
325 
326 /* MAX22516 setup cq pnp */
327 int max22516_setup_cq_pnp(struct max22516_dev *dev);
328 
329 /* MAX22516 setup cq npn */
330 int max22516_setup_cq_npn(struct max22516_dev *dev);
331 
332 /* MAX22516 tx set */
333 int max22516_tx_set(struct max22516_dev *dev, uint8_t low_high);
334 
335 /* MAX22516 txen set */
336 int max22516_txen_set(struct max22516_dev *dev, uint8_t lvl);
337 
338 /* MAX22516 set cq */
339 int max22516_set_cq(struct max22516_dev *dev, uint8_t lvl);
340 
341 /* MAX22516 tx get */
342 int max22516_tx_get(struct max22516_dev *dev, uint8_t *low_high);
343 
344 /* MAX22516 get cq */
345 int max22516_get_cq(struct max22516_dev *dev, uint8_t *cq);
346 
347 /* MAX22516 get cq stat */
348 int max22516_get_cq_stat(struct max22516_dev *dev, uint8_t *status3);
349 
350 /* MAX22516 get cq */
351 int max22516_setup_do_dis(struct max22516_dev *dev);
352 
353 /* MAX22516 setup do pp */
354 int max22516_setup_do_pp(struct max22516_dev *dev);
355 
356 /* MAX22516 setup do pnp */
357 int max22516_setup_do_pnp(struct max22516_dev *dev);
358 
359 /* MAX22516 setup do npn */
360 int max22516_setup_do_npn(struct max22516_dev *dev);
361 
362 /* MAX22516 do set */
363 int max22516_do_set(struct max22516_dev *dev, uint8_t lvl);
364 
365 /* MAX22516 do get */
366 int max22516_do_get(struct max22516_dev *dev, uint8_t *lvl);
367 
368 /* MAX22516 get do stat */
369 int max22516_get_do_stat(struct max22516_dev *dev, uint8_t *status3);
370 
371 /* MAX22516 set event */
372 int max22516_set_event(struct max22516_dev *dev, uint8_t ev_qual,
373  uint16_t ev_code);
374 
375 /* MAX22516 setup watchdog */
376 int max22516_setup_watchdog(struct max22516_dev *dev, uint8_t wd_timeout,
377  uint8_t wd_clr, uint8_t wd_event_en,
378  uint8_t wd_event_flag);
379 
380 /* MAX22516 Initialization */
381 int max22516_init(struct max22516_dev **device,
383 
384 /* MAX22516 Resources Deallocation */
385 int max22516_remove(struct max22516_dev *dev);
386 
387 #endif /* MAX22516_H_ */
max22516_set_cq
int max22516_set_cq(struct max22516_dev *dev, uint8_t lvl)
MAX22516 set cq.
Definition: max22516.c:554
max22516_burst_read_register
int max22516_burst_read_register(struct max22516_dev *dev, uint8_t reg_addr, uint8_t count, uint8_t *data)
MAX22516 burst read.
Definition: max22516.c:138
max22516_set_led1
int max22516_set_led1(struct max22516_dev *dev, uint16_t ltmr)
MAX22516 set led1.
Definition: max22516.c:361
no_os_alloc.h
max22516_update
int max22516_update(struct max22516_dev *dev, uint8_t reg_addr, uint8_t mask, uint8_t data)
Update MAX22516 register.
Definition: max22516.c:93
max22516_setup_do_pnp
int max22516_setup_do_pnp(struct max22516_dev *dev)
MAX22516 setup do pnp.
Definition: max22516.c:671
max22516_get_cq_stat
int max22516_get_cq_stat(struct max22516_dev *dev, uint8_t *status3)
MAX22516 get cq stat.
Definition: max22516.c:622
MAX22516_SPI_READ_CMD
#define MAX22516_SPI_READ_CMD
Definition: max22516.h:223
max22516_setup_watchdog
int max22516_setup_watchdog(struct max22516_dev *dev, uint8_t wd_timeout, uint8_t wd_clr, uint8_t wd_event_en, uint8_t wd_event_flag)
MAX22516 setup watchdog.
Definition: max22516.c:799
REG_LED1_CTRL_MSB_MSK
#define REG_LED1_CTRL_MSB_MSK
Definition: max22516.h:213
REG_EVENT_CODE_MSB
#define REG_EVENT_CODE_MSB
Definition: max22516.h:90
max22516_remove
int max22516_remove(struct max22516_dev *dev)
Free resoulces allocated for MAX22516.
Definition: max22516.c:868
REG_FRM_ERR_CNT
#define REG_FRM_ERR_CNT
Definition: max22516.h:57
MAX22516_SPI_DUMMY_DATA
#define MAX22516_SPI_DUMMY_DATA
Definition: max22516.h:221
max22516_do_get
int max22516_do_get(struct max22516_dev *dev, uint8_t *lvl)
MAX22516 do get.
Definition: max22516.c:723
no_os_spi_write_and_read
int32_t no_os_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: no_os_spi.c:159
REG_LED2_CTRL_MSB
#define REG_LED2_CTRL_MSB
Definition: max22516.h:103
BIT_DOCTRL1_DO_EN
#define BIT_DOCTRL1_DO_EN
Definition: max22516.h:160
max22516_set_id
int max22516_set_id(struct max22516_dev *dev, uint16_t vid, uint32_t id, uint16_t fid)
MAX22516 set id.
Definition: max22516.c:221
no_os_spi.h
Header file of SPI Interface.
max22516_setup_do_pp
int max22516_setup_do_pp(struct max22516_dev *dev)
MAX22516 setup do pp.
Definition: max22516.c:651
REG_PG1_MSTCYCTM
#define REG_PG1_MSTCYCTM
Definition: max22516.h:71
max22516_burst_write_register
int max22516_burst_write_register(struct max22516_dev *dev, uint8_t reg_addr, uint8_t count, uint8_t *data)
MAX22516 burst write.
Definition: max22516.c:117
max22516_setup_cq_pp
int max22516_setup_cq_pp(struct max22516_dev *dev)
MAX22516 setup cq pp.
Definition: max22516.c:458
max22516_do_set
int max22516_do_set(struct max22516_dev *dev, uint8_t lvl)
MAX22516 do set.
Definition: max22516.c:711
max22516_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: max22516.h:244
max22516_clr_iol_err_cnt
int max22516_clr_iol_err_cnt(struct max22516_dev *dev)
MAX22516 clr iol err cnt.
Definition: max22516.c:340
max22516_get_cq
int max22516_get_cq(struct max22516_dev *dev, uint8_t *cq)
MAX22516 get cq.
Definition: max22516.c:599
BIT_DO_AUTORTY
#define BIT_DO_AUTORTY
Definition: max22516.h:175
max22516_tx_set
int max22516_tx_set(struct max22516_dev *dev, uint8_t low_high)
MAX22516 tx set.
Definition: max22516.c:516
DEV_STAT2_SET_DOFAULT
#define DEV_STAT2_SET_DOFAULT
Definition: max22516.h:116
max22516_init
int max22516_init(struct max22516_dev **device, struct max22516_init_param *init_param)
Initialize the MAX22516 device.
Definition: max22516.c:839
no_os_delay.h
Header file of Delay functions.
max22516_init_param::spi_init
struct no_os_spi_init_param * spi_init
Definition: max22516.h:235
DEV_STAT2_SET_TSHD
#define DEV_STAT2_SET_TSHD
Definition: max22516.h:190
REG_IOL_ERR_CNT
#define REG_IOL_ERR_CNT
Definition: max22516.h:56
max22516_get_mst_ctmr
int max22516_get_mst_ctmr(struct max22516_dev *dev, uint16_t min_t, int16_t *c_tmr)
MAX22516 get mst ctmr.
Definition: max22516.c:287
max22516_write
int max22516_write(struct max22516_dev *dev, uint8_t reg_addr, uint8_t data)
Writes data to max22516 over SPI.
Definition: max22516.c:54
max22516.h
Header file for max22516 Driver.
max22516_init_param
MAX22516 Initialization Parameters structure.
Definition: max22516.h:233
max22516_set_min_ctmr
int max22516_set_min_ctmr(struct max22516_dev *dev, uint16_t min_t)
MAX22516 set min ctmr.
Definition: max22516.c:203
max22516_rebuild_min_cyct_to_us
void max22516_rebuild_min_cyct_to_us(int16_t t, uint8_t *tmr)
MAX22516 rebuild min cyct to microseconds.
Definition: max22516.c:182
REG_LED1_CTRL_LSB_MSK
#define REG_LED1_CTRL_LSB_MSK
Definition: max22516.h:214
max22516_burst_read_register
int max22516_burst_read_register(struct max22516_dev *dev, uint8_t reg_addr, uint8_t count, uint8_t *data)
MAX22516 burst read.
Definition: max22516.c:138
device
Definition: ad9361_util.h:69
max22516_clr_frm_err_cnt
int max22516_clr_frm_err_cnt(struct max22516_dev *dev)
MAX22516 clr frm err cnt.
Definition: max22516.c:350
max22516_dev
MAX22516 Device Descriptor.
Definition: max22516.h:242
max22516_get_dl_mode
int max22516_get_dl_mode(struct max22516_dev *dev, uint8_t *mode)
MAX22516 get dl mode.
Definition: max22516.c:308
max22516_read
int max22516_read(struct max22516_dev *dev, uint8_t reg_addr, uint8_t *data)
Reads data from max22516 over SPI.
Definition: max22516.c:69
max22516_get_iol_err_cnt
int max22516_get_iol_err_cnt(struct max22516_dev *dev, uint8_t *cnt)
MAX22516 get iol err cnt.
Definition: max22516.c:319
REG_LED1_CTRL_MSB
#define REG_LED1_CTRL_MSB
Definition: max22516.h:101
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
BIT_CQ_AUTORTY_TIME_200MS
#define BIT_CQ_AUTORTY_TIME_200MS
Definition: max22516.h:146
BIT_TXC_CQTXEN
#define BIT_TXC_CQTXEN
Definition: max22516.h:179
REG_WDGCLR
#define REG_WDGCLR
Definition: max22516.h:66
max22516_get_thd
int max22516_get_thd(struct max22516_dev *dev, uint8_t *status3)
MAX22516 get THD.
Definition: max22516.c:424
max22516_get_do_stat
int max22516_get_do_stat(struct max22516_dev *dev, uint8_t *status3)
MAX22516 get do stat.
Definition: max22516.c:743
max22516_remove
int max22516_remove(struct max22516_dev *dev)
Free resoulces allocated for MAX22516.
Definition: max22516.c:868
max22516_tx_get
int max22516_tx_get(struct max22516_dev *dev, uint8_t *low_high)
MAX22516 tx get.
Definition: max22516.c:579
max22516_setup_cq_npn
int max22516_setup_cq_npn(struct max22516_dev *dev)
MAX22516 setup cq npn.
Definition: max22516.c:496
BIT_TXC_CQDRVSEL
#define BIT_TXC_CQDRVSEL
Definition: max22516.h:180
REG_DEV_STAT2
#define REG_DEV_STAT2
Definition: max22516.h:54
max22516_set_led2
int max22516_set_led2(struct max22516_dev *dev, uint16_t ltmr)
MAX22516 set led2.
Definition: max22516.c:380
max22516_setup_do_pp
int max22516_setup_do_pp(struct max22516_dev *dev)
MAX22516 setup do pp.
Definition: max22516.c:651
max22516_burst_write_register
int max22516_burst_write_register(struct max22516_dev *dev, uint8_t reg_addr, uint8_t count, uint8_t *data)
MAX22516 burst write.
Definition: max22516.c:117
REG_CQ_CTRL2
#define REG_CQ_CTRL2
Definition: max22516.h:108
max22516_setup_cq_pp
int max22516_setup_cq_pp(struct max22516_dev *dev)
MAX22516 setup cq pp.
Definition: max22516.c:458
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
max22516_build_tcyc
void max22516_build_tcyc(int16_t t, uint8_t *tmr)
MAX22516 build tcyc.
Definition: max22516.c:160
max22516_set_event
int max22516_set_event(struct max22516_dev *dev, uint8_t ev_qual, uint16_t ev_code)
MAX22516 set event.
Definition: max22516.c:764
REG_TX_CTRL
#define REG_TX_CTRL
Definition: max22516.h:111
no_os_error.h
Error codes definition.
REG_LED2_CTRL_LSB
#define REG_LED2_CTRL_LSB
Definition: max22516.h:104
max22516_decode_tcyc
void max22516_decode_tcyc(uint8_t tmr, int16_t *t)
MAX22516 decode tcyc.
Definition: max22516.c:265
REG_EVENT_CODE_LSB_MSK
#define REG_EVENT_CODE_LSB_MSK
Definition: max22516.h:197
BIT_CQCTRL1_CQ_PP
#define BIT_CQCTRL1_CQ_PP
Definition: max22516.h:131
REG_DO_CTRL2
#define REG_DO_CTRL2
Definition: max22516.h:110
PG1_DEVID2_MSK
#define PG1_DEVID2_MSK
Definition: max22516.h:205
max22516_set_cq
int max22516_set_cq(struct max22516_dev *dev, uint8_t lvl)
MAX22516 set cq.
Definition: max22516.c:554
max22516_set_led1
int max22516_set_led1(struct max22516_dev *dev, uint16_t ltmr)
MAX22516 set led1.
Definition: max22516.c:361
PG1_FUNCID1_LSB_MSK
#define PG1_FUNCID1_LSB_MSK
Definition: max22516.h:210
max22516_txen_set
int max22516_txen_set(struct max22516_dev *dev, uint8_t lvl)
MAX22516 txen set.
Definition: max22516.c:535
max22516_write
int max22516_write(struct max22516_dev *dev, uint8_t reg_addr, uint8_t data)
Writes data to max22516 over SPI.
Definition: max22516.c:54
REG_DO_CTRL1
#define REG_DO_CTRL1
Definition: max22516.h:109
max22516_setup_watchdog
int max22516_setup_watchdog(struct max22516_dev *dev, uint8_t wd_timeout, uint8_t wd_clr, uint8_t wd_event_en, uint8_t wd_event_flag)
MAX22516 setup watchdog.
Definition: max22516.c:799
max22516_clr_frm_err_cnt
int max22516_clr_frm_err_cnt(struct max22516_dev *dev)
MAX22516 clr frm err cnt.
Definition: max22516.c:350
DEV_STAT2_SET_VMERR
#define DEV_STAT2_SET_VMERR
Definition: max22516.h:188
BIT_DO_CLBL_500US
#define BIT_DO_CLBL_500US
Definition: max22516.h:168
max22516_setup_cq_pnp
int max22516_setup_cq_pnp(struct max22516_dev *dev)
MAX22516 setup cq pnp.
Definition: max22516.c:477
max22516_do_get
int max22516_do_get(struct max22516_dev *dev, uint8_t *lvl)
MAX22516 do get.
Definition: max22516.c:723
max22516_setup_do_dis
int max22516_setup_do_dis(struct max22516_dev *dev)
MAX22516 setup do dis.
Definition: max22516.c:641
REG_PG1_DEVID3
#define REG_PG1_DEVID3
Definition: max22516.h:81
max22516_setup_cq_dis
int max22516_setup_cq_dis(struct max22516_dev *dev)
MAX22516 setup cq dis.
Definition: max22516.c:448
REG_WDG_EVENT
#define REG_WDG_EVENT
Definition: max22516.h:86
max22516_setup_cq_npn
int max22516_setup_cq_npn(struct max22516_dev *dev)
MAX22516 setup cq npn.
Definition: max22516.c:496
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
DEV_STAT2_SET_V24ERR
#define DEV_STAT2_SET_V24ERR
Definition: max22516.h:187
PG1_DEVID3_MSK
#define PG1_DEVID3_MSK
Definition: max22516.h:206
max22516_clr_iol_err_cnt
int max22516_clr_iol_err_cnt(struct max22516_dev *dev)
MAX22516 clr iol err cnt.
Definition: max22516.c:340
max22516_get_cq
int max22516_get_cq(struct max22516_dev *dev, uint8_t *cq)
MAX22516 get cq.
Definition: max22516.c:599
BIT_CQ_AUTORTY
#define BIT_CQ_AUTORTY
Definition: max22516.h:148
max22516_setup_do_npn
int max22516_setup_do_npn(struct max22516_dev *dev)
MAX22516 setup do npn.
Definition: max22516.c:690
BIT_DOCTRL1_DO_NPN
#define BIT_DOCTRL1_DO_NPN
Definition: max22516.h:157
BIT_DO_CL_200MA
#define BIT_DO_CL_200MA
Definition: max22516.h:165
BIT_CQ_CL_200MA
#define BIT_CQ_CL_200MA
Definition: max22516.h:138
BIT_TXC_CQTX
#define BIT_TXC_CQTX
Definition: max22516.h:178
REG_LED2_CTRL_MSB_MSK
#define REG_LED2_CTRL_MSB_MSK
Definition: max22516.h:217
max22516_set_event
int max22516_set_event(struct max22516_dev *dev, uint8_t ev_qual, uint16_t ev_code)
MAX22516 set event.
Definition: max22516.c:764
max22516_set_min_ctmr
int max22516_set_min_ctmr(struct max22516_dev *dev, uint16_t min_t)
MAX22516 set min ctmr.
Definition: max22516.c:203
max22516_rebuild_min_cyct_to_us
void max22516_rebuild_min_cyct_to_us(int16_t t, uint8_t *tmr)
MAX22516 rebuild min cyct to microseconds.
Definition: max22516.c:182
REG_LED2_CTRL_LSB_MSK
#define REG_LED2_CTRL_LSB_MSK
Definition: max22516.h:218
MAX22516_BUFF_SIZE_BYTES
#define MAX22516_BUFF_SIZE_BYTES
Definition: max22516.h:222
BIT_DOCTRL1_DO_PP
#define BIT_DOCTRL1_DO_PP
Definition: max22516.h:158
max22516_setup_do_pnp
int max22516_setup_do_pnp(struct max22516_dev *dev)
MAX22516 setup do pnp.
Definition: max22516.c:671
REG_PG1_MINCYCTM
#define REG_PG1_MINCYCTM
Definition: max22516.h:72
PG1_DEVID1_MSK
#define PG1_DEVID1_MSK
Definition: max22516.h:204
PG1_VID1_MSK
#define PG1_VID1_MSK
Definition: max22516.h:200
REG_CQ_CTRL1
#define REG_CQ_CTRL1
Definition: max22516.h:107
max22516_get_v24
int max22516_get_v24(struct max22516_dev *dev, uint8_t *status3)
MAX22516 get v24.
Definition: max22516.c:399
no_os_field_get
uint32_t no_os_field_get(uint32_t mask, uint32_t word)
REG_PG1_VID1
#define REG_PG1_VID1
Definition: max22516.h:77
PG1_FUNCID1_MSB_MSK
#define PG1_FUNCID1_MSB_MSK
Definition: max22516.h:209
max22516_get_do_stat
int max22516_get_do_stat(struct max22516_dev *dev, uint8_t *status3)
MAX22516 get do stat.
Definition: max22516.c:743
EVF_EVENT_FLG
#define EVF_EVENT_FLG
Definition: max22516.h:193
max22516_get_frm_err_cnt
int max22516_get_frm_err_cnt(struct max22516_dev *dev, uint8_t *cnt)
MAX22516 get frm err cnt.
Definition: max22516.c:330
REG_LED1_CTRL_LSB
#define REG_LED1_CTRL_LSB
Definition: max22516.h:102
max22516_tx_get
int max22516_tx_get(struct max22516_dev *dev, uint8_t *low_high)
MAX22516 tx get.
Definition: max22516.c:579
max22516_do_set
int max22516_do_set(struct max22516_dev *dev, uint8_t lvl)
MAX22516 do set.
Definition: max22516.c:711
max22516_setup_cq_dis
int max22516_setup_cq_dis(struct max22516_dev *dev)
MAX22516 setup cq dis.
Definition: max22516.c:448
REG_PG1_FUNCID1
#define REG_PG1_FUNCID1
Definition: max22516.h:82
BIT_DOCTRL1_DO_PD
#define BIT_DOCTRL1_DO_PD
Definition: max22516.h:155
max22516_set_led2
int max22516_set_led2(struct max22516_dev *dev, uint16_t ltmr)
MAX22516 set led2.
Definition: max22516.c:380
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
REG_EVENT_QUAL
#define REG_EVENT_QUAL
Definition: max22516.h:89
REG_STATUS_CODE
#define REG_STATUS_CODE
Definition: max22516.h:88
BIT_CQCTRL1_CQ_PD
#define BIT_CQCTRL1_CQ_PD
Definition: max22516.h:128
DEV_STAT2_SET_CQFAULT
#define DEV_STAT2_SET_CQFAULT
Definition: max22516.h:117
BIT_CQ_CLBL_500US
#define BIT_CQ_CLBL_500US
Definition: max22516.h:141
max22516_update
int max22516_update(struct max22516_dev *dev, uint8_t reg_addr, uint8_t mask, uint8_t data)
Update MAX22516 register.
Definition: max22516.c:93
no_os_spi_remove
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:116
max22516_get_cq_stat
int max22516_get_cq_stat(struct max22516_dev *dev, uint8_t *status3)
MAX22516 get cq stat.
Definition: max22516.c:622
BIT_CQCTRL1_CQ_EN
#define BIT_CQCTRL1_CQ_EN
Definition: max22516.h:133
REG_EVENT_FLAG
#define REG_EVENT_FLAG
Definition: max22516.h:92
no_os_gpio.h
Header file of GPIO Interface.
max22516_txen_set
int max22516_txen_set(struct max22516_dev *dev, uint8_t lvl)
MAX22516 txen set.
Definition: max22516.c:535
max22516_get_dl_mode
int max22516_get_dl_mode(struct max22516_dev *dev, uint8_t *mode)
MAX22516 get dl mode.
Definition: max22516.c:308
PG1_VID2_MSK
#define PG1_VID2_MSK
Definition: max22516.h:201
max22516_read
int max22516_read(struct max22516_dev *dev, uint8_t reg_addr, uint8_t *data)
Reads data from max22516 over SPI.
Definition: max22516.c:69
REG_EVENT_CODE_MSB_MSK
#define REG_EVENT_CODE_MSB_MSK
Definition: max22516.h:196
max22516_get_iol_err_cnt
int max22516_get_iol_err_cnt(struct max22516_dev *dev, uint8_t *cnt)
MAX22516 get iol err cnt.
Definition: max22516.c:319
DEV_STAT2_SET_THWARN
#define DEV_STAT2_SET_THWARN
Definition: max22516.h:189
no_os_spi_init
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:52
REG_PG1_DEVID2
#define REG_PG1_DEVID2
Definition: max22516.h:80
REG_PG1_VID2
#define REG_PG1_VID2
Definition: max22516.h:78
max22516_set_id
int max22516_set_id(struct max22516_dev *dev, uint16_t vid, uint32_t id, uint16_t fid)
MAX22516 set id.
Definition: max22516.c:221
max22516_get_thd
int max22516_get_thd(struct max22516_dev *dev, uint8_t *status3)
MAX22516 get THD.
Definition: max22516.c:424
no_os_util.h
Header file of utility functions.
max22516_get_v24
int max22516_get_v24(struct max22516_dev *dev, uint8_t *status3)
MAX22516 get v24.
Definition: max22516.c:399
max22516_setup_cq_pnp
int max22516_setup_cq_pnp(struct max22516_dev *dev)
MAX22516 setup cq pnp.
Definition: max22516.c:477
REG_EVENT_CODE_LSB
#define REG_EVENT_CODE_LSB
Definition: max22516.h:91
max22516_setup_do_dis
int max22516_setup_do_dis(struct max22516_dev *dev)
MAX22516 setup do dis.
Definition: max22516.c:641
no_os_spi_desc::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:202
max22516_get_frm_err_cnt
int max22516_get_frm_err_cnt(struct max22516_dev *dev, uint8_t *cnt)
MAX22516 get frm err cnt.
Definition: max22516.c:330
max22516_tx_set
int max22516_tx_set(struct max22516_dev *dev, uint8_t low_high)
MAX22516 tx set.
Definition: max22516.c:516
max22516_init
int max22516_init(struct max22516_dev **device, struct max22516_init_param *init_param)
Initialize the MAX22516 device.
Definition: max22516.c:839
max22516_build_tcyc
void max22516_build_tcyc(int16_t t, uint8_t *tmr)
MAX22516 build tcyc.
Definition: max22516.c:160
max22516_get_mst_ctmr
int max22516_get_mst_ctmr(struct max22516_dev *dev, uint16_t min_t, int16_t *c_tmr)
MAX22516 get mst ctmr.
Definition: max22516.c:287
BIT_TXC_DOTX
#define BIT_TXC_DOTX
Definition: max22516.h:181
max22516_setup_do_npn
int max22516_setup_do_npn(struct max22516_dev *dev)
MAX22516 setup do npn.
Definition: max22516.c:690
BIT_DO_AUTORTY_TIME_200MS
#define BIT_DO_AUTORTY_TIME_200MS
Definition: max22516.h:173
max22516_decode_tcyc
void max22516_decode_tcyc(uint8_t tmr, int16_t *t)
MAX22516 decode tcyc.
Definition: max22516.c:265
REG_PG1_DEVID1
#define REG_PG1_DEVID1
Definition: max22516.h:79
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
max22516_dev::comm_buff
uint8_t comm_buff[MAX22516_BUFF_SIZE_BYTES]
Definition: max22516.h:246