]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwIP_Demo/lwIP_port/sys_arch.c
Add additional comments to the Zynq lwIP demo.
[freertos] / FreeRTOS / Demo / CORTEX_A9_Zynq_ZC702 / RTOSDemo / src / lwIP_Demo / lwIP_port / sys_arch.c
1 /*\r
2  * Copyright (c) 2001-2003 Swedish Institute of Computer Science.\r
3  * All rights reserved.\r
4  *\r
5  * Redistribution and use in source and binary forms, with or without modification,\r
6  * are permitted provided that the following conditions are met:\r
7  *\r
8  * 1. Redistributions of source code must retain the above copyright notice,\r
9  *    this list of conditions and the following disclaimer.\r
10  * 2. Redistributions in binary form must reproduce the above copyright notice,\r
11  *    this list of conditions and the following disclaimer in the documentation\r
12  *    and/or other materials provided with the distribution.\r
13  * 3. The name of the author may not be used to endorse or promote products\r
14  *    derived from this software without specific prior written permission.\r
15  *\r
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED\r
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
18  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT\r
19  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT\r
21  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\r
24  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY\r
25  * OF SUCH DAMAGE.\r
26  *\r
27  * This file is part of the lwIP TCP/IP stack.\r
28  *\r
29  * Author: Adam Dunkels <adam@sics.se>\r
30  *\r
31  */\r
32 \r
33 //*****************************************************************************\r
34 //\r
35 // Include OS functionality.\r
36 //\r
37 //*****************************************************************************\r
38 \r
39 /* ------------------------ System architecture includes ----------------------------- */\r
40 #include "arch/sys_arch.h"\r
41 \r
42 /* ------------------------ lwIP includes --------------------------------- */\r
43 #include "lwip/opt.h"\r
44 \r
45 #include "lwip/debug.h"\r
46 #include "lwip/def.h"\r
47 #include "lwip/sys.h"\r
48 #include "lwip/mem.h"\r
49 #include "lwip/stats.h"\r
50 \r
51 /* Very crude mechanism used to determine if the critical section handling\r
52 functions are being called from an interrupt context or not.  This relies on\r
53 the interrupt handler setting this variable manually. */\r
54 BaseType_t xInsideISR = pdFALSE;\r
55 \r
56 /*---------------------------------------------------------------------------*\r
57  * Routine:  sys_mbox_new\r
58  *---------------------------------------------------------------------------*\r
59  * Description:\r
60  *      Creates a new mailbox\r
61  * Inputs:\r
62  *      int size                -- Size of elements in the mailbox\r
63  * Outputs:\r
64  *      sys_mbox_t              -- Handle to new mailbox\r
65  *---------------------------------------------------------------------------*/\r
66 err_t sys_mbox_new( sys_mbox_t *pxMailBox, int iSize )\r
67 {\r
68 err_t xReturn = ERR_MEM;\r
69 \r
70         *pxMailBox = xQueueCreate( iSize, sizeof( void * ) );\r
71 \r
72         if( *pxMailBox != NULL )\r
73         {\r
74                 xReturn = ERR_OK;\r
75                 SYS_STATS_INC_USED( mbox );\r
76         }\r
77 \r
78         return xReturn;\r
79 }\r
80 \r
81 \r
82 /*---------------------------------------------------------------------------*\r
83  * Routine:  sys_mbox_free\r
84  *---------------------------------------------------------------------------*\r
85  * Description:\r
86  *      Deallocates a mailbox. If there are messages still present in the\r
87  *      mailbox when the mailbox is deallocated, it is an indication of a\r
88  *      programming error in lwIP and the developer should be notified.\r
89  * Inputs:\r
90  *      sys_mbox_t mbox         -- Handle of mailbox\r
91  * Outputs:\r
92  *      sys_mbox_t              -- Handle to new mailbox\r
93  *---------------------------------------------------------------------------*/\r
94 void sys_mbox_free( sys_mbox_t *pxMailBox )\r
95 {\r
96 unsigned long ulMessagesWaiting;\r
97 \r
98         ulMessagesWaiting = uxQueueMessagesWaiting( *pxMailBox );\r
99         configASSERT( ( ulMessagesWaiting == 0 ) );\r
100 \r
101         #if SYS_STATS\r
102         {\r
103                 if( ulMessagesWaiting != 0UL )\r
104                 {\r
105                         SYS_STATS_INC( mbox.err );\r
106                 }\r
107 \r
108                 SYS_STATS_DEC( mbox.used );\r
109         }\r
110         #endif /* SYS_STATS */\r
111 \r
112         vQueueDelete( *pxMailBox );\r
113 }\r
114 \r
115 /*---------------------------------------------------------------------------*\r
116  * Routine:  sys_mbox_post\r
117  *---------------------------------------------------------------------------*\r
118  * Description:\r
119  *      Post the "msg" to the mailbox.\r
120  * Inputs:\r
121  *      sys_mbox_t mbox         -- Handle of mailbox\r
122  *      void *data              -- Pointer to data to post\r
123  *---------------------------------------------------------------------------*/\r
124 void sys_mbox_post( sys_mbox_t *pxMailBox, void *pxMessageToPost )\r
125 {\r
126         while( xQueueSendToBack( *pxMailBox, &pxMessageToPost, portMAX_DELAY ) != pdTRUE );\r
127 }\r
128 \r
129 /*---------------------------------------------------------------------------*\r
130  * Routine:  sys_mbox_trypost\r
131  *---------------------------------------------------------------------------*\r
132  * Description:\r
133  *      Try to post the "msg" to the mailbox.  Returns immediately with\r
134  *      error if cannot.\r
135  * Inputs:\r
136  *      sys_mbox_t mbox         -- Handle of mailbox\r
137  *      void *msg               -- Pointer to data to post\r
138  * Outputs:\r
139  *      err_t                   -- ERR_OK if message posted, else ERR_MEM\r
140  *                                  if not.\r
141  *---------------------------------------------------------------------------*/\r
142 err_t sys_mbox_trypost( sys_mbox_t *pxMailBox, void *pxMessageToPost )\r
143 {\r
144 err_t xReturn;\r
145 portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
146 \r
147         if( xInsideISR != pdFALSE )\r
148         {\r
149                 xReturn = xQueueSendFromISR( *pxMailBox, &pxMessageToPost, &xHigherPriorityTaskWoken );\r
150                 portYIELD_FROM_ISR( xHigherPriorityTaskWoken );\r
151         }\r
152         else\r
153         {\r
154                 xReturn = xQueueSend( *pxMailBox, &pxMessageToPost, ( TickType_t ) 0 );\r
155         }\r
156 \r
157         if( xReturn == pdPASS )\r
158         {\r
159                 xReturn = ERR_OK;\r
160         }\r
161         else\r
162         {\r
163                 /* The queue was already full. */\r
164                 xReturn = ERR_MEM;\r
165                 SYS_STATS_INC( mbox.err );\r
166         }\r
167 \r
168         return xReturn;\r
169 }\r
170 \r
171 /*---------------------------------------------------------------------------*\r
172  * Routine:  sys_arch_mbox_fetch\r
173  *---------------------------------------------------------------------------*\r
174  * Description:\r
175  *      Blocks the thread until a message arrives in the mailbox, but does\r
176  *      not block the thread longer than "timeout" milliseconds (similar to\r
177  *      the sys_arch_sem_wait() function). The "msg" argument is a result\r
178  *      parameter that is set by the function (i.e., by doing "*msg =\r
179  *      ptr"). The "msg" parameter maybe NULL to indicate that the message\r
180  *      should be dropped.\r
181  *\r
182  *      The return values are the same as for the sys_arch_sem_wait() function:\r
183  *      Number of milliseconds spent waiting or SYS_ARCH_TIMEOUT if there was a\r
184  *      timeout.\r
185  *\r
186  *      Note that a function with a similar name, sys_mbox_fetch(), is\r
187  *      implemented by lwIP.\r
188  * Inputs:\r
189  *      sys_mbox_t mbox         -- Handle of mailbox\r
190  *      void **msg              -- Pointer to pointer to msg received\r
191  *      u32_t timeout           -- Number of milliseconds until timeout\r
192  * Outputs:\r
193  *      u32_t                   -- SYS_ARCH_TIMEOUT if timeout, else number\r
194  *                                  of milliseconds until received.\r
195  *---------------------------------------------------------------------------*/\r
196 u32_t sys_arch_mbox_fetch( sys_mbox_t *pxMailBox, void **ppvBuffer, u32_t ulTimeOut )\r
197 {\r
198 void *pvDummy;\r
199 TickType_t xStartTime, xEndTime, xElapsed;\r
200 unsigned long ulReturn;\r
201 \r
202         xStartTime = xTaskGetTickCount();\r
203 \r
204         if( NULL == ppvBuffer )\r
205         {\r
206                 ppvBuffer = &pvDummy;\r
207         }\r
208 \r
209         if( ulTimeOut != 0UL )\r
210         {\r
211                 configASSERT( xInsideISR == ( portBASE_TYPE ) 0 );\r
212 \r
213                 if( pdTRUE == xQueueReceive( *pxMailBox, &( *ppvBuffer ), ulTimeOut/ portTICK_PERIOD_MS ) )\r
214                 {\r
215                         xEndTime = xTaskGetTickCount();\r
216                         xElapsed = ( xEndTime - xStartTime ) * portTICK_PERIOD_MS;\r
217 \r
218                         ulReturn = xElapsed;\r
219                 }\r
220                 else\r
221                 {\r
222                         /* Timed out. */\r
223                         *ppvBuffer = NULL;\r
224                         ulReturn = SYS_ARCH_TIMEOUT;\r
225                 }\r
226         }\r
227         else\r
228         {\r
229                 while( pdTRUE != xQueueReceive( *pxMailBox, &( *ppvBuffer ), portMAX_DELAY ) );\r
230                 xEndTime = xTaskGetTickCount();\r
231                 xElapsed = ( xEndTime - xStartTime ) * portTICK_PERIOD_MS;\r
232 \r
233                 if( xElapsed == 0UL )\r
234                 {\r
235                         xElapsed = 1UL;\r
236                 }\r
237 \r
238                 ulReturn = xElapsed;\r
239         }\r
240 \r
241         return ulReturn;\r
242 }\r
243 \r
244 /*---------------------------------------------------------------------------*\r
245  * Routine:  sys_arch_mbox_tryfetch\r
246  *---------------------------------------------------------------------------*\r
247  * Description:\r
248  *      Similar to sys_arch_mbox_fetch, but if message is not ready\r
249  *      immediately, we'll return with SYS_MBOX_EMPTY.  On success, 0 is\r
250  *      returned.\r
251  * Inputs:\r
252  *      sys_mbox_t mbox         -- Handle of mailbox\r
253  *      void **msg              -- Pointer to pointer to msg received\r
254  * Outputs:\r
255  *      u32_t                   -- SYS_MBOX_EMPTY if no messages.  Otherwise,\r
256  *                                  return ERR_OK.\r
257  *---------------------------------------------------------------------------*/\r
258 u32_t sys_arch_mbox_tryfetch( sys_mbox_t *pxMailBox, void **ppvBuffer )\r
259 {\r
260 void *pvDummy;\r
261 unsigned long ulReturn;\r
262 long lResult;\r
263 portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
264 \r
265         if( ppvBuffer== NULL )\r
266         {\r
267                 ppvBuffer = &pvDummy;\r
268         }\r
269 \r
270         if( xInsideISR != pdFALSE )\r
271         {\r
272                 lResult = xQueueReceiveFromISR( *pxMailBox, &( *ppvBuffer ), &xHigherPriorityTaskWoken );\r
273                 portYIELD_FROM_ISR( xHigherPriorityTaskWoken );\r
274         }\r
275         else\r
276         {\r
277                 lResult = xQueueReceive( *pxMailBox, &( *ppvBuffer ), 0UL );\r
278         }\r
279 \r
280         if( lResult == pdPASS )\r
281         {\r
282                 ulReturn = ERR_OK;\r
283         }\r
284         else\r
285         {\r
286                 ulReturn = SYS_MBOX_EMPTY;\r
287         }\r
288 \r
289         return ulReturn;\r
290 }\r
291 \r
292 /*---------------------------------------------------------------------------*\r
293  * Routine:  sys_sem_new\r
294  *---------------------------------------------------------------------------*\r
295  * Description:\r
296  *      Creates and returns a new semaphore. The "ucCount" argument specifies\r
297  *      the initial state of the semaphore.\r
298  *      NOTE: Currently this routine only creates counts of 1 or 0\r
299  * Inputs:\r
300  *      sys_mbox_t mbox         -- Handle of mailbox\r
301  *      u8_t ucCount              -- Initial ucCount of semaphore (1 or 0)\r
302  * Outputs:\r
303  *      sys_sem_t               -- Created semaphore or 0 if could not create.\r
304  *---------------------------------------------------------------------------*/\r
305 err_t sys_sem_new( sys_sem_t *pxSemaphore, u8_t ucCount )\r
306 {\r
307 err_t xReturn = ERR_MEM;\r
308 \r
309         //vSemaphoreCreateBinary( ( *pxSemaphore ) );\r
310         *pxSemaphore = xSemaphoreCreateCounting( 0xffff, ( unsigned long ) ucCount );\r
311 \r
312         if( *pxSemaphore != NULL )\r
313         {\r
314                 if( ucCount == 0U )\r
315                 {\r
316 //                      xSemaphoreTake( *pxSemaphore, 1UL );\r
317                 }\r
318 \r
319                 xReturn = ERR_OK;\r
320                 SYS_STATS_INC_USED( sem );\r
321         }\r
322         else\r
323         {\r
324                 SYS_STATS_INC( sem.err );\r
325         }\r
326 \r
327         return xReturn;\r
328 }\r
329 \r
330 /*---------------------------------------------------------------------------*\r
331  * Routine:  sys_arch_sem_wait\r
332  *---------------------------------------------------------------------------*\r
333  * Description:\r
334  *      Blocks the thread while waiting for the semaphore to be\r
335  *      signaled. If the "timeout" argument is non-zero, the thread should\r
336  *      only be blocked for the specified time (measured in\r
337  *      milliseconds).\r
338  *\r
339  *      If the timeout argument is non-zero, the return value is the number of\r
340  *      milliseconds spent waiting for the semaphore to be signaled. If the\r
341  *      semaphore wasn't signaled within the specified time, the return value is\r
342  *      SYS_ARCH_TIMEOUT. If the thread didn't have to wait for the semaphore\r
343  *      (i.e., it was already signaled), the function may return zero.\r
344  *\r
345  *      Notice that lwIP implements a function with a similar name,\r
346  *      sys_sem_wait(), that uses the sys_arch_sem_wait() function.\r
347  * Inputs:\r
348  *      sys_sem_t sem           -- Semaphore to wait on\r
349  *      u32_t timeout           -- Number of milliseconds until timeout\r
350  * Outputs:\r
351  *      u32_t                   -- Time elapsed or SYS_ARCH_TIMEOUT.\r
352  *---------------------------------------------------------------------------*/\r
353 u32_t sys_arch_sem_wait( sys_sem_t *pxSemaphore, u32_t ulTimeout )\r
354 {\r
355 TickType_t xStartTime, xEndTime, xElapsed;\r
356 unsigned long ulReturn;\r
357 \r
358         xStartTime = xTaskGetTickCount();\r
359 \r
360         if( ulTimeout != 0UL )\r
361         {\r
362                 if( xSemaphoreTake( *pxSemaphore, ulTimeout / portTICK_PERIOD_MS ) == pdTRUE )\r
363                 {\r
364                         xEndTime = xTaskGetTickCount();\r
365                         xElapsed = (xEndTime - xStartTime) * portTICK_PERIOD_MS;\r
366                         ulReturn = xElapsed;\r
367                 }\r
368                 else\r
369                 {\r
370                         ulReturn = SYS_ARCH_TIMEOUT;\r
371                 }\r
372         }\r
373         else\r
374         {\r
375                 while( xSemaphoreTake( *pxSemaphore, portMAX_DELAY ) != pdTRUE );\r
376                 xEndTime = xTaskGetTickCount();\r
377                 xElapsed = ( xEndTime - xStartTime ) * portTICK_PERIOD_MS;\r
378 \r
379                 if( xElapsed == 0UL )\r
380                 {\r
381                         xElapsed = 1UL;\r
382                 }\r
383 \r
384                 ulReturn = xElapsed;\r
385         }\r
386 \r
387         return ulReturn;\r
388 }\r
389 \r
390 /** Create a new mutex\r
391  * @param mutex pointer to the mutex to create\r
392  * @return a new mutex */\r
393 err_t sys_mutex_new( sys_mutex_t *pxMutex )\r
394 {\r
395 err_t xReturn = ERR_MEM;\r
396 \r
397         *pxMutex = xSemaphoreCreateMutex();\r
398 \r
399         if( *pxMutex != NULL )\r
400         {\r
401                 xReturn = ERR_OK;\r
402                 SYS_STATS_INC_USED( mutex );\r
403         }\r
404         else\r
405         {\r
406                 SYS_STATS_INC( mutex.err );\r
407         }\r
408 \r
409         return xReturn;\r
410 }\r
411 \r
412 /** Lock a mutex\r
413  * @param mutex the mutex to lock */\r
414 void sys_mutex_lock( sys_mutex_t *pxMutex )\r
415 {\r
416 BaseType_t xGotSemaphore;\r
417 BaseType_t xHigherPriorityTaskWoken = pdFALSE;\r
418 \r
419         if( xInsideISR == 0 )\r
420         {\r
421                 while( xSemaphoreTake( *pxMutex, portMAX_DELAY ) != pdPASS );\r
422         }\r
423         else\r
424         {\r
425                 xGotSemaphore = xSemaphoreTakeFromISR( *pxMutex, &xHigherPriorityTaskWoken );\r
426                 configASSERT( xGotSemaphore );\r
427                 portYIELD_FROM_ISR( xHigherPriorityTaskWoken );\r
428         }\r
429 }\r
430 \r
431 /** Unlock a mutex\r
432  * @param mutex the mutex to unlock */\r
433 void sys_mutex_unlock(sys_mutex_t *pxMutex )\r
434 {\r
435         xSemaphoreGive( *pxMutex );\r
436 }\r
437 \r
438 \r
439 /** Delete a semaphore\r
440  * @param mutex the mutex to delete */\r
441 void sys_mutex_free( sys_mutex_t *pxMutex )\r
442 {\r
443         SYS_STATS_DEC( mutex.used );\r
444         vQueueDelete( *pxMutex );\r
445 }\r
446 \r
447 \r
448 /*---------------------------------------------------------------------------*\r
449  * Routine:  sys_sem_signal\r
450  *---------------------------------------------------------------------------*\r
451  * Description:\r
452  *      Signals (releases) a semaphore\r
453  * Inputs:\r
454  *      sys_sem_t sem           -- Semaphore to signal\r
455  *---------------------------------------------------------------------------*/\r
456 void sys_sem_signal( sys_sem_t *pxSemaphore )\r
457 {\r
458 portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
459 \r
460         if( xInsideISR != pdFALSE )\r
461         {\r
462                 xSemaphoreGiveFromISR( *pxSemaphore, &xHigherPriorityTaskWoken );\r
463                 portYIELD_FROM_ISR( xHigherPriorityTaskWoken );\r
464         }\r
465         else\r
466         {\r
467                 xSemaphoreGive( *pxSemaphore );\r
468         }\r
469 }\r
470 \r
471 /*---------------------------------------------------------------------------*\r
472  * Routine:  sys_sem_free\r
473  *---------------------------------------------------------------------------*\r
474  * Description:\r
475  *      Deallocates a semaphore\r
476  * Inputs:\r
477  *      sys_sem_t sem           -- Semaphore to free\r
478  *---------------------------------------------------------------------------*/\r
479 void sys_sem_free( sys_sem_t *pxSemaphore )\r
480 {\r
481         SYS_STATS_DEC(sem.used);\r
482         vQueueDelete( *pxSemaphore );\r
483 }\r
484 \r
485 /*---------------------------------------------------------------------------*\r
486  * Routine:  sys_init\r
487  *---------------------------------------------------------------------------*\r
488  * Description:\r
489  *      Initialize sys arch\r
490  *---------------------------------------------------------------------------*/\r
491 void sys_init(void)\r
492 {\r
493 }\r
494 \r
495 u32_t sys_now(void)\r
496 {\r
497         return xTaskGetTickCount();\r
498 }\r
499 \r
500 /*---------------------------------------------------------------------------*\r
501  * Routine:  sys_thread_new\r
502  *---------------------------------------------------------------------------*\r
503  * Description:\r
504  *      Starts a new thread with priority "prio" that will begin its\r
505  *      execution in the function "thread()". The "arg" argument will be\r
506  *      passed as an argument to the thread() function. The id of the new\r
507  *      thread is returned. Both the id and the priority are system\r
508  *      dependent.\r
509  * Inputs:\r
510  *      char *name              -- Name of thread\r
511  *      void (* thread)(void *arg) -- Pointer to function to run.\r
512  *      void *arg               -- Argument passed into function\r
513  *      int stacksize           -- Required stack amount in bytes\r
514  *      int prio                -- Thread priority\r
515  * Outputs:\r
516  *      sys_thread_t            -- Pointer to per-thread timeouts.\r
517  *---------------------------------------------------------------------------*/\r
518 sys_thread_t sys_thread_new( const char *pcName, void( *pxThread )( void *pvParameters ), void *pvArg, int iStackSize, int iPriority )\r
519 {\r
520 TaskHandle_t xCreatedTask;\r
521 portBASE_TYPE xResult;\r
522 sys_thread_t xReturn;\r
523 \r
524         xResult = xTaskCreate( pxThread, pcName, iStackSize, pvArg, iPriority, &xCreatedTask );\r
525 \r
526         if( xResult == pdPASS )\r
527         {\r
528                 xReturn = xCreatedTask;\r
529         }\r
530         else\r
531         {\r
532                 xReturn = NULL;\r
533         }\r
534 \r
535         return xReturn;\r
536 }\r
537 \r
538 /*---------------------------------------------------------------------------*\r
539  * Routine:  sys_arch_protect\r
540  *---------------------------------------------------------------------------*\r
541  * Description:\r
542  *      This optional function does a "fast" critical region protection and\r
543  *      returns the previous protection level. This function is only called\r
544  *      during very short critical regions. An embedded system which supports\r
545  *      ISR-based drivers might want to implement this function by disabling\r
546  *      interrupts. Task-based systems might want to implement this by using\r
547  *      a mutex or disabling tasking. This function should support recursive\r
548  *      calls from the same task or interrupt. In other words,\r
549  *      sys_arch_protect() could be called while already protected. In\r
550  *      that case the return value indicates that it is already protected.\r
551  *\r
552  *      sys_arch_protect() is only required if your port is supporting an\r
553  *      operating system.\r
554  * Outputs:\r
555  *      sys_prot_t              -- Previous protection level (not used here)\r
556  *---------------------------------------------------------------------------*/\r
557 sys_prot_t sys_arch_protect( void )\r
558 {\r
559         if( xInsideISR == pdFALSE )\r
560         {\r
561                 taskENTER_CRITICAL();\r
562         }\r
563         return ( sys_prot_t ) 1;\r
564 }\r
565 \r
566 /*---------------------------------------------------------------------------*\r
567  * Routine:  sys_arch_unprotect\r
568  *---------------------------------------------------------------------------*\r
569  * Description:\r
570  *      This optional function does a "fast" set of critical region\r
571  *      protection to the value specified by pval. See the documentation for\r
572  *      sys_arch_protect() for more information. This function is only\r
573  *      required if your port is supporting an operating system.\r
574  * Inputs:\r
575  *      sys_prot_t              -- Previous protection level (not used here)\r
576  *---------------------------------------------------------------------------*/\r
577 void sys_arch_unprotect( sys_prot_t xValue )\r
578 {\r
579         (void) xValue;\r
580         if( xInsideISR == pdFALSE )\r
581         {\r
582                 taskEXIT_CRITICAL();\r
583         }\r
584 }\r
585 \r
586 /*\r
587  * Prints an assertion messages and aborts execution.\r
588  */\r
589 void sys_assert( const char *pcMessage )\r
590 {\r
591         (void) pcMessage;\r
592 \r
593         for (;;)\r
594         {\r
595         }\r
596 }\r
597 /*-------------------------------------------------------------------------*\r
598  * End of File:  sys_arch.c\r
599  *-------------------------------------------------------------------------*/\r
600 \r