comparison src/cs/drivers/drv_app/spi/spi_api.h @ 0:4e78acac3d88

src/{condat,cs,gpf,nucleus}: import from Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:23:26 +0000
parents
children 365833d1d186
comparison
equal deleted inserted replaced
-1:000000000000 0:4e78acac3d88
1 /****************************************************************************/
2 /* */
3 /* File Name: spi_api.h */
4 /* */
5 /* Purpose: This file contains data structures and functions prototypes */
6 /* used to send events to the SPI SWE. */
7 /* */
8 /* Version 0.1 */
9 /* */
10 /* Date Modification */
11 /* ------------------------------------ */
12 /* 20/08/2000 Create */
13 /* */
14 /* Author */
15 /* */
16 /* (C) Copyright 2000 by Texas Instruments Incorporated, All Rights Reserved*/
17 /****************************************************************************/
18 #ifndef __SPI_API_H_
19 #define __SPI_API_H_
20
21
22 #include "rv/rv_general.h"
23 #include "abb/abb.h"
24
25 #ifdef __cplusplus
26 extern "C"
27 {
28 #endif
29
30
31 /* the message offset must differ for each SWE in order to have unique msg_id in the system */
32 #define SPI_MESSAGES_OFFSET (0x34 << 10)
33
34
35 /* define a first msg id */
36 #define SPI_MESSAGE_1 (SPI_MESSAGES_OFFSET | 0x0001)
37
38
39 typedef void (*CALLBACK_FUNC_NO_PARAM)(void);
40 typedef void (*CALLBACK_FUNC_U16)(UINT16 *);
41
42
43
44 /*****************************************/
45 /* structures of messages send to SPI */
46 /*****************************************/
47
48 typedef struct
49 { T_RV_HDR os_hdr;
50 UINT16 page;
51 UINT16 address;
52 UINT16 data;
53 } T_SPI_WRITE;
54
55
56 typedef struct
57 { T_RV_HDR os_hdr;
58 UINT16 page;
59 UINT16 address;
60 } T_SPI_READ;
61
62
63 typedef struct
64 { T_RV_HDR os_hdr;
65 UINT16 channels;
66 UINT16 itval;
67 } T_SPI_ABB_CONF_ADC;
68
69
70 typedef struct
71 { T_RV_HDR os_hdr;
72 UINT16 *Buff;
73 CALLBACK_FUNC_NO_PARAM callback_func;
74 } T_SPI_ABB_READ_ADC;
75
76
77
78 #ifdef __cplusplus
79 }
80 #endif
81
82
83 /* Prototypes */
84
85 /********************************************************************************/
86 /* */
87 /* Function Name: spi_abb_write */
88 /* */
89 /* Purpose: This function is used to send to the SPI mailbox a */
90 /* WRITE REGISTER rqst msg. */
91 /* */
92 /* Input Parameters: */
93 /* - page : ABB Page where to read the register. */
94 /* - address : address of the ABB register to read. */
95 /* - data : data to write in the ABB register */
96 /* */
97 /* Return : */
98 /* - RVM_NOT_READY : the SPI task is not ready */
99 /* - RV_MEMORY_ERR : the SPI task has not enough memory */
100 /* - RV_OK : normal processing */
101 /* */
102 /* Note: */
103 /* None. */
104 /* */
105 /********************************************************************************/
106 T_RV_RET spi_abb_write(UINT16 page, UINT16 address, UINT16 data);
107
108 /********************************************************************************/
109 /* */
110 /* Function Name: spi_abb_read */
111 /* */
112 /* Purpose: This function is used to send a READ REGISTER rqst msg */
113 /* to the SPI mailbox. */
114 /* */
115 /* Input Parameters: */
116 /* - page : ABB Page where to read the register. */
117 /* - address : address of the ABB register to read. */
118 /* - CallBack : callback function called by the spi task */
119 /* at the end of the read process. */
120 /* */
121 /* Return : */
122 /* - RVM_NOT_READY : the SPI task is not ready */
123 /* - RV_MEMORY_ERR : the SPI task has not enough memory */
124 /* - RV_OK : normal processing */
125 /* */
126 /* Note: */
127 /* None. */
128 /* */
129 /********************************************************************************/
130 T_RV_RET spi_abb_read(UINT16 page, UINT16 address, CALLBACK_FUNC_U16 CallBack);
131
132 /********************************************************************************/
133 /* */
134 /* Function Name: spi_abb_conf_ADC */
135 /* */
136 /* Purpose: This function is used to send to the SPI mailbox a rqst msg */
137 /* for configuring ABB MADC for conversions. */
138 /* */
139 /* Input Parameters: */
140 /* - channels : ABB channels to be converted. */
141 /* - itval : configure the End Of Conversion IT. */
142 /* */
143 /* Return : */
144 /* - RVM_NOT_READY : the SPI task is not ready */
145 /* - RV_MEMORY_ERR : the SPI task has not enough memory */
146 /* - RV_OK : normal processing */
147 /* */
148 /* Note: */
149 /* None. */
150 /* */
151 /********************************************************************************/
152 T_RV_RET spi_abb_conf_ADC(UINT16 channels, UINT16 itval);
153
154 /********************************************************************************/
155 /* */
156 /* Function Name: spi_abb_read_ADC */
157 /* */
158 /* Purpose: This function is used to send to the SPI mailbox a rqst msg */
159 /* for reading the ABB ADC results. */
160 /* */
161 /* Input Parameters: */
162 /* - Buff : pointer to the buffer filled with ADC results. */
163 /* - CallBack : callback function called by the spi task */
164 /* at the end of the read process. */
165 /* */
166 /* Return : */
167 /* - RVM_NOT_READY : the SPI task is not ready */
168 /* - RV_MEMORY_ERR : the SPI task has not enough memory */
169 /* - RV_OK : normal processing */
170 /* */
171 /* Note: */
172 /* None. */
173 /* */
174 /********************************************************************************/
175 T_RV_RET spi_abb_read_ADC(UINT16 *Buff, CALLBACK_FUNC_NO_PARAM CallBack);
176
177 #endif /* __SPI_API_H_ */
178