comparison src/cs/drivers/drv_app/spi/spi_api.h @ 260:34b7059b9337

drv_app/spi/*: code readability fixes
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 14 May 2021 02:13:47 +0000
parents 365833d1d186
children
comparison
equal deleted inserted replaced
259:365833d1d186 260:34b7059b9337
38 38
39 typedef void (*CALLBACK_FUNC_NO_PARAM)(void); 39 typedef void (*CALLBACK_FUNC_NO_PARAM)(void);
40 typedef void (*CALLBACK_FUNC_U16)(UINT16 *); 40 typedef void (*CALLBACK_FUNC_U16)(UINT16 *);
41 41
42 42
43
44 /*****************************************/ 43 /*****************************************/
45 /* structures of messages send to SPI */ 44 /* structures of messages send to SPI */
46 /*****************************************/ 45 /*****************************************/
47 46
48 typedef struct 47 typedef struct
49 { T_RV_HDR os_hdr; 48 { T_RV_HDR os_hdr;
50 UINT16 page; 49 UINT16 page;
51 UINT16 address; 50 UINT16 address;
52 UINT16 data; 51 UINT16 data;
53 } T_SPI_WRITE; 52 } T_SPI_WRITE;
54 53
55 54
56 typedef struct 55 typedef struct
57 { T_RV_HDR os_hdr; 56 { T_RV_HDR os_hdr;
58 UINT16 page; 57 UINT16 page;
59 UINT16 address; 58 UINT16 address;
60 } T_SPI_READ; 59 } T_SPI_READ;
61 60
62 61
63 typedef struct 62 typedef struct
64 { T_RV_HDR os_hdr; 63 { T_RV_HDR os_hdr;
65 UINT16 channels; 64 UINT16 channels;
66 UINT16 itval; 65 UINT16 itval;
67 } T_SPI_ABB_CONF_ADC; 66 } T_SPI_ABB_CONF_ADC;
68 67
69 68
70 typedef struct 69 typedef struct
71 { T_RV_HDR os_hdr; 70 { T_RV_HDR os_hdr;
72 UINT16 *Buff; 71 UINT16 *Buff;
73 CALLBACK_FUNC_NO_PARAM callback_func; 72 CALLBACK_FUNC_NO_PARAM callback_func;
74 } T_SPI_ABB_READ_ADC; 73 } T_SPI_ABB_READ_ADC;
75 74
76 75
77
78 #ifdef __cplusplus 76 #ifdef __cplusplus
79 } 77 }
80 #endif 78 #endif
81 79
82 80
83 /* Prototypes */ 81 /* Prototypes */
84 82
85 /********************************************************************************/ 83 /******************************************************************************/
86 /* */ 84 /* */
87 /* Function Name: spi_abb_write */ 85 /* Function Name: spi_abb_write */
88 /* */ 86 /* */
89 /* Purpose: This function is used to send to the SPI mailbox a */ 87 /* Purpose: This function is used to send to the SPI mailbox a */
90 /* WRITE REGISTER rqst msg. */ 88 /* WRITE REGISTER rqst msg. */
91 /* */ 89 /* */
92 /* Input Parameters: */ 90 /* Input Parameters: */
93 /* - page : ABB Page where to read the register. */ 91 /* - page : ABB Page where to read the register. */
94 /* - address : address of the ABB register to read. */ 92 /* - address : address of the ABB register to read. */
95 /* - data : data to write in the ABB register */ 93 /* - data : data to write in the ABB register */
96 /* */ 94 /* */
97 /* Return : */ 95 /* Return : */
98 /* - RVM_NOT_READY : the SPI task is not ready */ 96 /* - RVM_NOT_READY : the SPI task is not ready */
99 /* - RV_MEMORY_ERR : the SPI task has not enough memory */ 97 /* - RV_MEMORY_ERR : the SPI task has not enough memory */
100 /* - RV_OK : normal processing */ 98 /* - RV_OK : normal processing */
101 /* */ 99 /* */
102 /* Note: */ 100 /* Note: */
103 /* None. */ 101 /* None. */
104 /* */ 102 /* */
105 /********************************************************************************/ 103 /******************************************************************************/
106 T_RV_RET spi_abb_write(UINT16 page, UINT16 address, UINT16 data); 104 T_RV_RET spi_abb_write(UINT16 page, UINT16 address, UINT16 data);
107 105
108 /********************************************************************************/ 106 /******************************************************************************/
109 /* */ 107 /* */
110 /* Function Name: spi_abb_read */ 108 /* Function Name: spi_abb_read */
111 /* */ 109 /* */
112 /* Purpose: This function is used to send a READ REGISTER rqst msg */ 110 /* Purpose: This function is used to send a READ REGISTER rqst msg */
113 /* to the SPI mailbox. */ 111 /* to the SPI mailbox. */
114 /* */ 112 /* */
115 /* Input Parameters: */ 113 /* Input Parameters: */
116 /* - page : ABB Page where to read the register. */ 114 /* - page : ABB Page where to read the register. */
117 /* - address : address of the ABB register to read. */ 115 /* - address : address of the ABB register to read. */
118 /* - CallBack : callback function called by the spi task */ 116 /* - CallBack : callback function called by the spi task */
119 /* at the end of the read process. */ 117 /* at the end of the read process. */
120 /* */ 118 /* */
121 /* Return : */ 119 /* Return : */
122 /* - RVM_NOT_READY : the SPI task is not ready */ 120 /* - RVM_NOT_READY : the SPI task is not ready */
123 /* - RV_MEMORY_ERR : the SPI task has not enough memory */ 121 /* - RV_MEMORY_ERR : the SPI task has not enough memory */
124 /* - RV_OK : normal processing */ 122 /* - RV_OK : normal processing */
125 /* */ 123 /* */
126 /* Note: */ 124 /* Note: */
127 /* None. */ 125 /* None. */
128 /* */ 126 /* */
129 /********************************************************************************/ 127 /******************************************************************************/
130 T_RV_RET spi_abb_read(UINT16 page, UINT16 address, CALLBACK_FUNC_U16 CallBack); 128 T_RV_RET spi_abb_read(UINT16 page, UINT16 address, CALLBACK_FUNC_U16 CallBack);
131 129
132 /********************************************************************************/ 130 /******************************************************************************/
133 /* */ 131 /* */
134 /* Function Name: spi_abb_conf_ADC */ 132 /* Function Name: spi_abb_conf_ADC */
135 /* */ 133 /* */
136 /* Purpose: This function is used to send to the SPI mailbox a rqst msg */ 134 /* Purpose: This function is used to send to the SPI mailbox a rqst msg*/
137 /* for configuring ABB MADC for conversions. */ 135 /* for configuring ABB MADC for conversions. */
138 /* */ 136 /* */
139 /* Input Parameters: */ 137 /* Input Parameters: */
140 /* - channels : ABB channels to be converted. */ 138 /* - channels : ABB channels to be converted. */
141 /* - itval : configure the End Of Conversion IT. */ 139 /* - itval : configure the End Of Conversion IT. */
142 /* */ 140 /* */
143 /* Return : */ 141 /* Return : */
144 /* - RVM_NOT_READY : the SPI task is not ready */ 142 /* - RVM_NOT_READY : the SPI task is not ready */
145 /* - RV_MEMORY_ERR : the SPI task has not enough memory */ 143 /* - RV_MEMORY_ERR : the SPI task has not enough memory */
146 /* - RV_OK : normal processing */ 144 /* - RV_OK : normal processing */
147 /* */ 145 /* */
148 /* Note: */ 146 /* Note: */
149 /* None. */ 147 /* None. */
150 /* */ 148 /* */
151 /********************************************************************************/ 149 /******************************************************************************/
152 T_RV_RET spi_abb_conf_ADC(UINT16 channels, UINT16 itval); 150 T_RV_RET spi_abb_conf_ADC(UINT16 channels, UINT16 itval);
153 151
154 /********************************************************************************/ 152 /******************************************************************************/
155 /* */ 153 /* */
156 /* Function Name: spi_abb_read_ADC */ 154 /* Function Name: spi_abb_read_ADC */
157 /* */ 155 /* */
158 /* Purpose: This function is used to send to the SPI mailbox a rqst msg */ 156 /* Purpose: This function is used to send to the SPI mailbox a rqst msg*/
159 /* for reading the ABB ADC results. */ 157 /* for reading the ABB ADC results. */
160 /* */ 158 /* */
161 /* Input Parameters: */ 159 /* Input Parameters: */
162 /* - Buff : pointer to the buffer filled with ADC results. */ 160 /* - Buff : pointer to the buffer filled with ADC results.*/
163 /* - CallBack : callback function called by the spi task */ 161 /* - CallBack : callback function called by the spi task */
164 /* at the end of the read process. */ 162 /* at the end of the read process. */
165 /* */ 163 /* */
166 /* Return : */ 164 /* Return : */
167 /* - RVM_NOT_READY : the SPI task is not ready */ 165 /* - RVM_NOT_READY : the SPI task is not ready */
168 /* - RV_MEMORY_ERR : the SPI task has not enough memory */ 166 /* - RV_MEMORY_ERR : the SPI task has not enough memory */
169 /* - RV_OK : normal processing */ 167 /* - RV_OK : normal processing */
170 /* */ 168 /* */
171 /* Note: */ 169 /* Note: */
172 /* None. */ 170 /* None. */
173 /* */ 171 /* */
174 /********************************************************************************/ 172 /******************************************************************************/
175 T_RV_RET spi_abb_read_ADC(UINT16 *Buff, CALLBACK_FUNC_NO_PARAM CallBack); 173 T_RV_RET spi_abb_read_ADC(UINT16 *Buff, CALLBACK_FUNC_NO_PARAM CallBack);
176 174
177 #endif /* __SPI_API_H_ */ 175 #endif /* __SPI_API_H_ */
178