]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - rpp/src/sys/notification.c
Fixed compile errors when building the POSIX version
[pes-rpp/rpp-lib.git] / rpp / src / sys / notification.c
1 /** @file notification.c
2 *   @brief User Notification Definition File
3 *   @date 15.Mar.2012
4 *   @version 03.01.00
5 *
6 *   This file  defines  empty  notification  routines.
7 *   The user needs to remove the while loop and define
8 *   the sequence.
9 *
10 */
11
12 /* Include Files */
13
14 //#include "ti_drv_esm.h"
15 //#include "sys_selftest.h"
16 //#include "ti_drv_adc.h"
17 //#include "ti_drv_can.h"
18 //#include "ti_drv_gio.h"
19 //#include "ti_drv_lin.h"
20 //#include "ti_drv_mibspi.h"
21 //#include "ti_drv_sci.h"
22 //#include "ti_drv_het.h"
23 //#include "ti_drv_i2c.h"
24 /* USER CODE BEGIN (0) */
25 //#include "FreeRTOS.h"
26 //#include "os_semphr.h"
27 //#include "os_task.h"
28
29 #include "rpp/RppConfig.h"
30 #include "sys/sys.h"
31 #include "rpp/eth.h"
32
33 /* USER CODE END */
34
35 void esmGroup1Notification(uint32_t channel)
36 {
37 /*  enter user code and remove the while loop... */
38     while(1);
39 /* USER CODE BEGIN (1) */
40 /* USER CODE END */
41
42 }
43
44 /* USER CODE BEGIN (2) */
45 /* USER CODE END */
46
47 void esmGroup2Notification(uint32_t channel)
48 {
49 /*  enter user code and remove the while loop... */
50     while(1);
51 /* USER CODE BEGIN (3) */
52 /* USER CODE END */
53
54 }
55
56 /* USER CODE BEGIN (4) */
57 /* USER CODE END */
58
59 void memoryPort0TestFailNotification(uint32_t groupSelect, uint32_t dataSelect, uint32_t address, uint32_t data)
60 {
61 /*  enter user code and remove the while loop... */
62     while(1);
63 /* USER CODE BEGIN (5) */
64 /* USER CODE END */
65
66 }
67
68 /* USER CODE BEGIN (6) */
69 /* USER CODE END */
70
71 void memoryPort1TestFailNotification(uint32_t groupSelect, uint32_t dataSelect, uint32_t address, uint32_t data)
72 {
73 /*  enter user code and remove the while loop... */
74     while(1);
75 /* USER CODE BEGIN (7) */
76 /* USER CODE END */
77
78 }
79
80 /* USER CODE BEGIN (8) */
81 /* USER CODE END */
82
83 /* USER CODE BEGIN (12) */
84 /** @brief Semaphore blocking task when it waits for interrupt signaling message receive
85  *
86  */
87 // FIXME It seems that all the following are test application specific, because no one
88 // else in the library uses this variables. The functionality the notification
89 // provides could be replaced with a proper interface between subsystems.
90 // This where called extern on the file, which is not a good approach to include
91 // application specific variables in lower layers, coupling bidireccionally both
92 // layers.
93 // This was moved from cmd_can.c
94 /** Semaphore used for blocking task until message is received */
95 xSemaphoreHandle canMsgReceived;
96 /** Semaphore used for blocking task until message is sent */
97 xSemaphoreHandle canMsgSent;
98 /** Pointer to Destination CAN registers */
99 canBASE_t* canDst;
100 /** Pointer to Source CAN registers */
101 canBASE_t* canSrc;
102 /** Can message box for received messages */
103 uint32_t canMsgBox;
104 /** Error counter for errors in sending */
105 uint32_t canSendError;
106 /** Error counter for errors in receiving */
107 uint32_t canRecError;
108
109 /* USER CODE END */
110 void canErrorNotification(canBASE_t *node, uint32_t notification)
111 {
112 /* USER CODE BEGIN (13) */
113
114     if (node == canSrc) {
115         canSendError = notification;
116         xSemaphoreGiveFromISR(canMsgSent, NULL);
117     }
118     if (node == canDst) {
119         canRecError = notification;
120         xSemaphoreGiveFromISR(canMsgReceived, NULL);
121     }
122
123 /* USER CODE END */
124
125 }
126
127 /* USER CODE BEGIN (14) */
128 /* USER CODE END */
129
130 void canMessageNotification(canBASE_t *node, uint32_t messageBox)
131 {
132 /* USER CODE BEGIN (15) */
133
134     if (messageBox == canMsgBox)
135     {
136         if (node == canDst) {
137             // node 2 - receive testloopback message complete
138             while(!canIsRxMessageArrived(node, canMsgBox))
139                 ;
140             xSemaphoreGiveFromISR(canMsgReceived, NULL);
141         }
142         if (node == canSrc) {
143             xSemaphoreGiveFromISR(canMsgSent, NULL);
144         }
145     }
146 /* USER CODE END */
147 }
148
149 /* USER CODE BEGIN (16) */
150 /* USER CODE END */
151 void gioNotification(int bit)
152 {
153 /*  enter user code and remove the while loop... */
154     while(1);
155 /* USER CODE BEGIN (19) */
156 /* USER CODE END */
157
158 }
159
160 /* USER CODE BEGIN (20) */
161 /* USER CODE END */
162 void i2cNotification(i2cBASE_t *i2c, uint32_t flags)
163 {
164 /*  enter user code and remove the while loop... */
165     while(1);
166 /* USER CODE BEGIN (21) */
167 /* USER CODE END */
168
169 }
170
171 /* USER CODE BEGIN (24) */
172 /* USER CODE END */
173 void mibspiNotification(mibspiBASE_t *mibspi, uint32_t flags)
174 {
175 /*  enter user code and remove the while loop... */
176     while(1);
177 /* USER CODE BEGIN (25) */
178 /* USER CODE END */
179
180 }
181
182 /* USER CODE BEGIN (26) */
183 /* USER CODE END */
184
185 void mibspiGroupNotification(mibspiBASE_t *mibspi, uint32_t group)
186 {
187 /*  enter user code and remove the while loop... */
188     while(1);
189 /* USER CODE BEGIN (27) */
190 /* USER CODE END */
191
192 }
193 /* USER CODE BEGIN (28) */
194 /* USER CODE END */
195
196 /* USER CODE BEGIN (30) */
197 /* USER CODE END */
198 void pwmNotification(hetBASE_t * hetREG,uint32_t pwm, uint32_t notification)
199 {
200 /*  enter user code and remove the while loop... */
201     while(1);
202 /* USER CODE BEGIN (33) */
203 /* USER CODE END */
204
205 }
206
207 /* USER CODE BEGIN (34) */
208 /* USER CODE END */
209
210 void edgeNotification(hetBASE_t * hetREG,uint32_t edge)
211 {
212 /*  enter user code and remove the while loop... */
213     while(1);
214 /* USER CODE BEGIN (35) */
215 /* USER CODE END */
216
217 }
218
219 /* USER CODE BEGIN (36) */
220 /* USER CODE END */
221
222 void hetNotification(hetBASE_t *het, uint32_t offset)
223 {
224 /*  enter user code and remove the while loop... */
225     while(1);
226 /* USER CODE BEGIN (37) */
227 /* USER CODE END */
228
229 }
230
231 /** Semaphore used to stop command, until message is received */
232 xSemaphoreHandle linMsgReceived;
233 /** Semaphore used to stop command, until ID is received */
234 xSemaphoreHandle linIDReceived;
235 void linNotification(linBASE_t *lin, uint32_t flags)
236 {
237     /* FIXME Moved code from somewhere else. It was in cmd_lin.c
238      * It seems that nobody in the library uses this.
239      * sys/ti_drv_lin.c calls this function from linLowLevelInterrupt()
240      * The function prototipe is in sys/ti_drv_lin.h, so maybe it should be
241      * better to move it there, but because it is a "high-level" notification
242      * it could be here.
243      */
244     if (flags & LIN_ID_INT) {
245         xSemaphoreGiveFromISR(linIDReceived, NULL);
246     }
247     if (flags & LIN_RX_INT) {
248         lin->FLR |= (1 << 9);
249         xSemaphoreGiveFromISR(linMsgReceived, NULL);
250     }
251 }
252
253 #ifndef FREERTOS_POSIX
254 extern boolean_t HostPendErrHandler(void);
255 #if PHY_LINK_MONITOR_INT
256 extern boolean_t LinkIntHandler(void);
257 #endif
258 #pragma INTERRUPT(MDIOMiscInt, IRQ)
259 void MDIOMiscInt(void)
260 {
261         if(HostPendErrHandler())return;
262 #if PHY_LINK_MONITOR_INT
263         if(LinkIntHandler())return;
264 #endif
265 }
266
267 extern void RxIntHandler(uint32_t instNum);
268 extern void TxIntHandler(uint32_t instNum);
269
270 volatile int countEMACCore0RxIsr = 0;
271 #pragma INTERRUPT(EMACCore0RxIsr, IRQ)
272 void EMACCore0RxIsr(void)
273 {
274         countEMACCore0RxIsr++;
275         RxIntHandler(0);
276     /* FIXME was in emac_cmd.c/eth.c and should move somewhere else.
277     rx_irq_cnt++;
278
279     // We know we have only one RX Packet Buffer descriptor --
280     // so we write it in CP to disable interrupt
281     EMACRxCPWrite(emacBase, channel, (unsigned int)rx_desc);
282     EMACCoreIntAck(emacBase, EMAC_INT_CORE0_RX);
283     */
284 }
285
286 volatile int countEMACCore0TxIsr = 0;
287 #pragma INTERRUPT(EMACCore0TxIsr, IRQ)
288 void EMACCore0TxIsr(void)
289 {
290         countEMACCore0TxIsr++;
291         TxIntHandler(0);
292     /* FIXME Was in emac_cmd.c/eth.c and should move somewhere else
293     tx_irq_cnt++;
294     // If is not being processed by the EMAC anymore
295     if (!(fr1.PktFlgLen & EMAC_DSC_FLAG_OWNER)) {
296         EMACTxCPWrite(emacBase, channel, (unsigned int)&fr1);
297         EMACCoreIntAck(emacBase, EMAC_INT_CORE0_TX);
298     }
299     */
300 }
301 #endif
302
303 /* USER CODE BEGIN (38) */
304 /* USER CODE END */