]> git.sur5r.net Git - freertos/blob - Demo/Common/ethernet/lwip-1.4.0/ports/win32/sys_arch.c
4ac5542e916b9fc0a5036abe8e2518d3df3fb73d
[freertos] / Demo / Common / ethernet / lwip-1.4.0 / ports / win32 / 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 /*---------------------------------------------------------------------------*\r
52  * Globals:\r
53  *---------------------------------------------------------------------------*/\r
54 \r
55 #if 0\r
56 _RB_\r
57 struct timeoutlist\r
58 {\r
59         struct sys_timeouts timeouts;\r
60         xTaskHandle pid;\r
61 };\r
62 \r
63 /* This is the number of threads that can be started with sys_thread_new() */\r
64 #define SYS_THREAD_MAX 4\r
65 \r
66 static u16_t s_nextthread = 0;\r
67 \r
68 static struct timeoutlist s_timeoutlist[SYS_THREAD_MAX];\r
69 #endif\r
70 \r
71 /*-----------------------------------------------------------------------------------*/\r
72 \r
73 /*---------------------------------------------------------------------------*\r
74  * Routine:  sys_mbox_new\r
75  *---------------------------------------------------------------------------*\r
76  * Description:\r
77  *      Creates a new mailbox\r
78  * Inputs:\r
79  *      int size                -- Size of elements in the mailbox\r
80  * Outputs:\r
81  *      sys_mbox_t              -- Handle to new mailbox\r
82  *---------------------------------------------------------------------------*/\r
83 err_t sys_mbox_new(sys_mbox_t *mbox, int size)\r
84 {\r
85 err_t lwip_err= ERR_MEM;\r
86 \r
87         *mbox = xQueueCreate( size, sizeof( void * ) );\r
88 \r
89         // Created succesfully?\r
90         if(*mbox != NULL)\r
91         {\r
92                 lwip_err = ERR_OK;\r
93 #if SYS_STATS\r
94                 SYS_STATS_INC(mbox.used);\r
95 #endif /* SYS_STATS */\r
96         }\r
97 \r
98         return lwip_err;\r
99 }\r
100 \r
101 \r
102 /*---------------------------------------------------------------------------*\r
103  * Routine:  sys_mbox_free\r
104  *---------------------------------------------------------------------------*\r
105  * Description:\r
106  *      Deallocates a mailbox. If there are messages still present in the\r
107  *      mailbox when the mailbox is deallocated, it is an indication of a\r
108  *      programming error in lwIP and the developer should be notified.\r
109  * Inputs:\r
110  *      sys_mbox_t mbox         -- Handle of mailbox\r
111  * Outputs:\r
112  *      sys_mbox_t              -- Handle to new mailbox\r
113  *---------------------------------------------------------------------------*/\r
114 void sys_mbox_free(sys_mbox_t *mbox)\r
115 {\r
116 unsigned portBASE_TYPE uxMessagesWaiting;\r
117 \r
118         uxMessagesWaiting = uxQueueMessagesWaiting( *mbox );\r
119         configASSERT( ( uxMessagesWaiting == 0 ) );\r
120 \r
121 #if SYS_STATS\r
122         if (uxMessagesWaiting != 0U)\r
123         {\r
124                 SYS_STATS_INC(mbox.err);\r
125         }\r
126 \r
127         SYS_STATS_DEC(mbox.used);\r
128 #endif /* SYS_STATS */\r
129 \r
130         vQueueDelete( *mbox );\r
131 }\r
132 \r
133 /*---------------------------------------------------------------------------*\r
134  * Routine:  sys_mbox_post\r
135  *---------------------------------------------------------------------------*\r
136  * Description:\r
137  *      Post the "msg" to the mailbox.\r
138  * Inputs:\r
139  *      sys_mbox_t mbox         -- Handle of mailbox\r
140  *      void *data              -- Pointer to data to post\r
141  *---------------------------------------------------------------------------*/\r
142 void sys_mbox_post(sys_mbox_t *mbox, void *msg)\r
143 {\r
144         while( xQueueSendToBack( *mbox, &msg, portMAX_DELAY ) != pdTRUE );\r
145 }\r
146 \r
147 /*---------------------------------------------------------------------------*\r
148  * Routine:  sys_mbox_trypost\r
149  *---------------------------------------------------------------------------*\r
150  * Description:\r
151  *      Try to post the "msg" to the mailbox.  Returns immediately with\r
152  *      error if cannot.\r
153  * Inputs:\r
154  *      sys_mbox_t mbox         -- Handle of mailbox\r
155  *      void *msg               -- Pointer to data to post\r
156  * Outputs:\r
157  *      err_t                   -- ERR_OK if message posted, else ERR_MEM\r
158  *                                  if not.\r
159  *---------------------------------------------------------------------------*/\r
160 err_t sys_mbox_trypost(sys_mbox_t *mbox, void *msg)\r
161 {\r
162 err_t result;\r
163 \r
164         if ( xQueueSend( *mbox, &msg, 0 ) == pdPASS )\r
165         {\r
166                 result = ERR_OK;\r
167         }\r
168         else\r
169         {\r
170                 // could not post, queue must be full\r
171                 result = ERR_MEM;\r
172 #if SYS_STATS\r
173                 SYS_STATS_INC(mbox.err);\r
174 #endif /* SYS_STATS */\r
175         }\r
176         return result;\r
177 }\r
178 \r
179 /*---------------------------------------------------------------------------*\r
180  * Routine:  sys_arch_mbox_fetch\r
181  *---------------------------------------------------------------------------*\r
182  * Description:\r
183  *      Blocks the thread until a message arrives in the mailbox, but does\r
184  *      not block the thread longer than "timeout" milliseconds (similar to\r
185  *      the sys_arch_sem_wait() function). The "msg" argument is a result\r
186  *      parameter that is set by the function (i.e., by doing "*msg =\r
187  *      ptr"). The "msg" parameter maybe NULL to indicate that the message\r
188  *      should be dropped.\r
189  *\r
190  *      The return values are the same as for the sys_arch_sem_wait() function:\r
191  *      Number of milliseconds spent waiting or SYS_ARCH_TIMEOUT if there was a\r
192  *      timeout.\r
193  *\r
194  *      Note that a function with a similar name, sys_mbox_fetch(), is\r
195  *      implemented by lwIP.\r
196  * Inputs:\r
197  *      sys_mbox_t mbox         -- Handle of mailbox\r
198  *      void **msg              -- Pointer to pointer to msg received\r
199  *      u32_t timeout           -- Number of milliseconds until timeout\r
200  * Outputs:\r
201  *      u32_t                   -- SYS_ARCH_TIMEOUT if timeout, else number\r
202  *                                  of milliseconds until received.\r
203  *---------------------------------------------------------------------------*/\r
204 u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout)\r
205 {\r
206 void *dummyptr;\r
207 portTickType StartTime, EndTime, Elapsed;\r
208 \r
209         StartTime = xTaskGetTickCount();\r
210 \r
211         if (NULL == msg)\r
212         {\r
213                 msg = &dummyptr;\r
214         }\r
215 \r
216         if (timeout != 0)\r
217         {\r
218                 if ( pdTRUE == xQueueReceive( *mbox, &(*msg), timeout / portTICK_RATE_MS ) )\r
219                 {\r
220                         EndTime = xTaskGetTickCount();\r
221                         Elapsed = (EndTime - StartTime) * portTICK_RATE_MS;\r
222 \r
223                         return ( Elapsed );\r
224                 }\r
225                 else // timed out blocking for message\r
226                 {\r
227                         *msg = NULL;\r
228 \r
229                         return SYS_ARCH_TIMEOUT;\r
230                 }\r
231         }\r
232         else\r
233         {\r
234                 while( pdTRUE != xQueueReceive( mbox, &(*msg), portMAX_DELAY ) ); // time is arbitrary\r
235                 EndTime = xTaskGetTickCount();\r
236                 Elapsed = (EndTime - StartTime) * portTICK_RATE_MS;\r
237 \r
238                 if (Elapsed == 0)\r
239                 {\r
240                         Elapsed = 1;\r
241                 }\r
242 \r
243                 // return time blocked TBD test\r
244                 return (Elapsed);\r
245         }\r
246 }\r
247 \r
248 /*---------------------------------------------------------------------------*\r
249  * Routine:  sys_arch_mbox_tryfetch\r
250  *---------------------------------------------------------------------------*\r
251  * Description:\r
252  *      Similar to sys_arch_mbox_fetch, but if message is not ready\r
253  *      immediately, we'll return with SYS_MBOX_EMPTY.  On success, 0 is\r
254  *      returned.\r
255  * Inputs:\r
256  *      sys_mbox_t mbox         -- Handle of mailbox\r
257  *      void **msg              -- Pointer to pointer to msg received\r
258  * Outputs:\r
259  *      u32_t                   -- SYS_MBOX_EMPTY if no messages.  Otherwise,\r
260  *                                  return ERR_OK.\r
261  *---------------------------------------------------------------------------*/\r
262 u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg)\r
263 {\r
264         void *dummyptr;\r
265 \r
266         if (msg == NULL)\r
267         {\r
268                 msg = &dummyptr;\r
269         }\r
270 \r
271         if ( pdTRUE == xQueueReceive( *mbox, &(*msg), 0 ) )\r
272         {\r
273                 return ERR_OK;\r
274         }\r
275         else\r
276         {\r
277                 return SYS_MBOX_EMPTY;\r
278         }\r
279 }\r
280 \r
281 /*---------------------------------------------------------------------------*\r
282  * Routine:  sys_sem_new\r
283  *---------------------------------------------------------------------------*\r
284  * Description:\r
285  *      Creates and returns a new semaphore. The "count" argument specifies\r
286  *      the initial state of the semaphore.\r
287  *      NOTE: Currently this routine only creates counts of 1 or 0\r
288  * Inputs:\r
289  *      sys_mbox_t mbox         -- Handle of mailbox\r
290  *      u8_t count              -- Initial count of semaphore (1 or 0)\r
291  * Outputs:\r
292  *      sys_sem_t               -- Created semaphore or 0 if could not create.\r
293  *---------------------------------------------------------------------------*/\r
294 err_t sys_sem_new(sys_sem_t *sem, u8_t count)\r
295 {\r
296         err_t lwip_err = ERR_MEM;\r
297 \r
298         vSemaphoreCreateBinary( (*sem) );\r
299 \r
300         if( *sem != NULL )\r
301         {\r
302                 // Means it can't be taken\r
303                 if (count == 0)\r
304                 {\r
305                         xSemaphoreTake(*sem, 1);\r
306                 }\r
307 \r
308                 lwip_err = ERR_OK;\r
309 \r
310 #if SYS_STATS\r
311                 SYS_STATS_INC(sem.used);\r
312 #endif\r
313         }\r
314         else\r
315         {\r
316 #if SYS_STATS\r
317                 SYS_STATS_INC(sem.err);\r
318 #endif\r
319         }\r
320 \r
321         return lwip_err;\r
322 }\r
323 \r
324 /*---------------------------------------------------------------------------*\r
325  * Routine:  sys_arch_sem_wait\r
326  *---------------------------------------------------------------------------*\r
327  * Description:\r
328  *      Blocks the thread while waiting for the semaphore to be\r
329  *      signaled. If the "timeout" argument is non-zero, the thread should\r
330  *      only be blocked for the specified time (measured in\r
331  *      milliseconds).\r
332  *\r
333  *      If the timeout argument is non-zero, the return value is the number of\r
334  *      milliseconds spent waiting for the semaphore to be signaled. If the\r
335  *      semaphore wasn't signaled within the specified time, the return value is\r
336  *      SYS_ARCH_TIMEOUT. If the thread didn't have to wait for the semaphore\r
337  *      (i.e., it was already signaled), the function may return zero.\r
338  *\r
339  *      Notice that lwIP implements a function with a similar name,\r
340  *      sys_sem_wait(), that uses the sys_arch_sem_wait() function.\r
341  * Inputs:\r
342  *      sys_sem_t sem           -- Semaphore to wait on\r
343  *      u32_t timeout           -- Number of milliseconds until timeout\r
344  * Outputs:\r
345  *      u32_t                   -- Time elapsed or SYS_ARCH_TIMEOUT.\r
346  *---------------------------------------------------------------------------*/\r
347 u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)\r
348 {\r
349 portTickType StartTime, EndTime, Elapsed;\r
350 \r
351         StartTime = xTaskGetTickCount();\r
352 \r
353         if (timeout != 0)\r
354         {\r
355                 if( xSemaphoreTake( *sem, timeout / portTICK_RATE_MS ) == pdTRUE )\r
356                 {\r
357                         EndTime = xTaskGetTickCount();\r
358                         Elapsed = (EndTime - StartTime) * portTICK_RATE_MS;\r
359 \r
360                         return (Elapsed); // return time blocked TODO test\r
361                 }\r
362                 else\r
363                 {\r
364                         return SYS_ARCH_TIMEOUT;\r
365                 }\r
366 \r
367         }\r
368         else\r
369         {\r
370                 while( xSemaphoreTake( sem, portMAX_DELAY ) != pdTRUE );\r
371                 EndTime = xTaskGetTickCount();\r
372                 Elapsed = (EndTime - StartTime) * portTICK_RATE_MS;\r
373 \r
374                 if (Elapsed == 0)\r
375                 {\r
376                         Elapsed = 1;\r
377                 }\r
378 \r
379                 // return time blocked\r
380                 return (Elapsed);\r
381         }\r
382 }\r
383 \r
384 /** Create a new mutex\r
385  * @param mutex pointer to the mutex to create\r
386  * @return a new mutex */\r
387 err_t sys_mutex_new(sys_mutex_t *mutex) \r
388 {\r
389 err_t lwip_err = ERR_MEM;\r
390 \r
391         *mutex = xQueueCreateMutex();\r
392 \r
393         if( *mutex != NULL ) \r
394         {\r
395                 lwip_err = ERR_OK;\r
396 #if SYS_STATS\r
397                 SYS_STATS_INC(mutex.used);\r
398 #endif\r
399         } \r
400         else \r
401         {\r
402 #if SYS_STATS\r
403                 SYS_STATS_INC(mutex.err);\r
404 #endif\r
405         }\r
406         \r
407         return lwip_err;\r
408 }\r
409 \r
410 /** Lock a mutex\r
411  * @param mutex the mutex to lock */\r
412 void sys_mutex_lock(sys_mutex_t *mutex)\r
413 {\r
414         while( xSemaphoreTake( *mutex, portMAX_DELAY ) != pdPASS );\r
415 }\r
416 \r
417 /** Unlock a mutex\r
418  * @param mutex the mutex to unlock */\r
419 void sys_mutex_unlock(sys_mutex_t *mutex)\r
420 {\r
421         xSemaphoreGive(*mutex);\r
422 }\r
423 \r
424 \r
425 /** Delete a semaphore\r
426  * @param mutex the mutex to delete */\r
427 void sys_mutex_free(sys_mutex_t *mutex)\r
428 {\r
429 #if SYS_STATS\r
430         SYS_STATS_DEC(mutex.used);\r
431 #endif /* SYS_STATS */\r
432         vQueueDelete(*mutex);\r
433 }\r
434 \r
435 \r
436 /*---------------------------------------------------------------------------*\r
437  * Routine:  sys_sem_signal\r
438  *---------------------------------------------------------------------------*\r
439  * Description:\r
440  *      Signals (releases) a semaphore\r
441  * Inputs:\r
442  *      sys_sem_t sem           -- Semaphore to signal\r
443  *---------------------------------------------------------------------------*/\r
444 void sys_sem_signal(sys_sem_t * sem)\r
445 {\r
446         //LWIP_ASSERT( "sys_sem_signal: sem != SYS_SEM_NULL", sem != SYS_SEM_NULL );\r
447         xSemaphoreGive(*sem);\r
448 }\r
449 \r
450 /*---------------------------------------------------------------------------*\r
451  * Routine:  sys_sem_free\r
452  *---------------------------------------------------------------------------*\r
453  * Description:\r
454  *      Deallocates a semaphore\r
455  * Inputs:\r
456  *      sys_sem_t sem           -- Semaphore to free\r
457  *---------------------------------------------------------------------------*/\r
458 void sys_sem_free(sys_sem_t * sem)\r
459 {\r
460         //LWIP_ASSERT( "sys_sem_free: sem != SYS_SEM_NULL", sem != SYS_SEM_NULL );\r
461 \r
462 #if SYS_STATS\r
463         SYS_STATS_DEC(sem.used);\r
464 #endif /* SYS_STATS */\r
465 \r
466         vQueueDelete(*sem);\r
467 }\r
468 \r
469 /*---------------------------------------------------------------------------*\r
470  * Routine:  sys_init\r
471  *---------------------------------------------------------------------------*\r
472  * Description:\r
473  *      Initialize sys arch\r
474  *---------------------------------------------------------------------------*/\r
475 void sys_init(void)\r
476 {\r
477 #if 0\r
478         int i;\r
479 \r
480         // Initialize the the per-thread sys_timeouts structures\r
481         // make sure there are no valid pids in the list\r
482         for (i = 0; i < SYS_THREAD_MAX; i++)\r
483         {\r
484                 s_timeoutlist[i].pid = SYS_THREAD_NULL;\r
485         //      s_timeoutlist[i].timeouts.next = NULL;\r
486         }\r
487 \r
488         // keep track of how many threads have been created\r
489         s_nextthread = 0;\r
490 #endif\r
491 }\r
492 \r
493 u32_t sys_now(void)\r
494 {\r
495         return xTaskGetTickCount();\r
496 }\r
497 \r
498 #if 0\r
499 _RB_\r
500 u32_t sys_jiffies(void)\r
501 {\r
502         return UEZTickCounterGet();\r
503 }\r
504 #endif\r
505 \r
506 /*---------------------------------------------------------------------------*\r
507  * Routine:  sys_arch_timeouts\r
508  *---------------------------------------------------------------------------*\r
509  * Description:\r
510  *      Returns a pointer to the per-thread sys_timeouts structure. In lwIP,\r
511  *      each thread has a list of timeouts which is represented as a linked\r
512  *      list of sys_timeout structures. The sys_timeouts structure holds a\r
513  *      pointer to a linked list of timeouts. This function is called by\r
514  *      the lwIP timeout scheduler and must not return a NULL value.\r
515  *\r
516  *      In a single threaded sys_arch implementation, this function will\r
517  *      simply return a pointer to a global sys_timeouts variable stored in\r
518  *      the sys_arch module.\r
519  * Outputs:\r
520  *      sys_timeouts *          -- Pointer to per-thread timeouts.\r
521  *---------------------------------------------------------------------------*/\r
522 #if 0\r
523 struct sys_timeouts *sys_arch_timeouts(void)\r
524 {\r
525         int i;\r
526         T_uezTask pid;\r
527         struct timeoutlist *tl;\r
528 \r
529         pid = UEZTaskGetCurrent();\r
530 \r
531         for (i = 0; i < s_nextthread; i++)\r
532         {\r
533                 tl = &(s_timeoutlist[i]);\r
534                 if (tl->pid == pid)\r
535                 {\r
536                 //      return &(tl->timeouts);\r
537                 }\r
538         }\r
539 \r
540         // Error\r
541         return NULL;\r
542 }\r
543 #endif\r
544 /*---------------------------------------------------------------------------*\r
545  * Routine:  sys_thread_new\r
546  *---------------------------------------------------------------------------*\r
547  * Description:\r
548  *      Starts a new thread with priority "prio" that will begin its\r
549  *      execution in the function "thread()". The "arg" argument will be\r
550  *      passed as an argument to the thread() function. The id of the new\r
551  *      thread is returned. Both the id and the priority are system\r
552  *      dependent.\r
553  * Inputs:\r
554  *      char *name              -- Name of thread\r
555  *      void (* thread)(void *arg) -- Pointer to function to run.\r
556  *      void *arg               -- Argument passed into function\r
557  *      int stacksize           -- Required stack amount in bytes\r
558  *      int prio                -- Thread priority\r
559  * Outputs:\r
560  *      sys_thread_t            -- Pointer to per-thread timeouts.\r
561  *---------------------------------------------------------------------------*/\r
562 sys_thread_t sys_thread_new(const char *name, void(* thread)(void *arg), void *arg, int stacksize, int prio)\r
563 {\r
564 xTaskHandle CreatedTask;\r
565 int result;\r
566 \r
567         result = xTaskCreate( thread, ( signed portCHAR * ) name, stacksize, arg, prio, &CreatedTask );\r
568 \r
569         if(result == pdPASS)\r
570         {\r
571                 return CreatedTask;\r
572         }\r
573         else\r
574         {\r
575                 return NULL;\r
576         }\r
577 }\r
578 \r
579 /*---------------------------------------------------------------------------*\r
580  * Routine:  sys_arch_protect\r
581  *---------------------------------------------------------------------------*\r
582  * Description:\r
583  *      This optional function does a "fast" critical region protection and\r
584  *      returns the previous protection level. This function is only called\r
585  *      during very short critical regions. An embedded system which supports\r
586  *      ISR-based drivers might want to implement this function by disabling\r
587  *      interrupts. Task-based systems might want to implement this by using\r
588  *      a mutex or disabling tasking. This function should support recursive\r
589  *      calls from the same task or interrupt. In other words,\r
590  *      sys_arch_protect() could be called while already protected. In\r
591  *      that case the return value indicates that it is already protected.\r
592  *\r
593  *      sys_arch_protect() is only required if your port is supporting an\r
594  *      operating system.\r
595  * Outputs:\r
596  *      sys_prot_t              -- Previous protection level (not used here)\r
597  *---------------------------------------------------------------------------*/\r
598 sys_prot_t sys_arch_protect(void)\r
599 {\r
600         vPortEnterCritical();\r
601         return 1;\r
602 }\r
603 \r
604 /*---------------------------------------------------------------------------*\r
605  * Routine:  sys_arch_unprotect\r
606  *---------------------------------------------------------------------------*\r
607  * Description:\r
608  *      This optional function does a "fast" set of critical region\r
609  *      protection to the value specified by pval. See the documentation for\r
610  *      sys_arch_protect() for more information. This function is only\r
611  *      required if your port is supporting an operating system.\r
612  * Inputs:\r
613  *      sys_prot_t              -- Previous protection level (not used here)\r
614  *---------------------------------------------------------------------------*/\r
615 void sys_arch_unprotect(sys_prot_t pval)\r
616 {\r
617         (void) pval;\r
618         taskEXIT_CRITICAL();\r
619 }\r
620 \r
621 /*\r
622  * Prints an assertion messages and aborts execution.\r
623  */\r
624 void sys_assert(const char *msg)\r
625 {\r
626         (void) msg;\r
627 \r
628         for (;;)\r
629         {\r
630         }\r
631 }\r
632 /*-------------------------------------------------------------------------*\r
633  * End of File:  sys_arch.c\r
634  *-------------------------------------------------------------------------*/\r
635 \r