]> begriffs open source - freertos/blob - portable/template/port.c
Correct ARM port folder capitalization (#981)
[freertos] / portable / template / port.c
1 /*
2  * FreeRTOS Kernel <DEVELOPMENT BRANCH>
3  * license and copyright intentionally withheld to promote copying into user code.
4  */
5
6 #include "FreeRTOS.h"
7 #include "task.h"
8
9 BaseType_t xPortStartScheduler( void )
10 {
11     return pdTRUE;
12 }
13
14 void vPortEndScheduler( void )
15 {
16 }
17
18 StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
19                                      TaskFunction_t pxCode,
20                                      void * pvParameters )
21 {
22     return NULL;
23 }
24
25 void vPortYield( void )
26 {
27     /* Save the current Context */
28
29     /* Switch to the highest priority task that is ready to run. */
30     #if ( configNUMBER_OF_CORES == 1 )
31     {
32         vTaskSwitchContext();
33     }
34     #else
35     {
36         vTaskSwitchContext( portGET_CORE_ID() );
37     }
38     #endif
39
40     /* Start executing the task we have just switched to. */
41 }
42
43 static void prvTickISR( void )
44 {
45     /* Interrupts must have been enabled for the ISR to fire, so we have to
46      * save the context with interrupts enabled. */
47
48     #if ( configNUMBER_OF_CORES == 1 )
49     {
50         /* Maintain the tick count. */
51         if( xTaskIncrementTick() != pdFALSE )
52         {
53             /* Switch to the highest priority task that is ready to run. */
54             vTaskSwitchContext();
55         }
56     }
57     #else
58     {
59         UBaseType_t ulPreviousMask;
60
61         /* Tasks or ISRs running on other cores may still in critical section in
62          * multiple cores environment. Incrementing tick needs to performed in
63          * critical section. */
64         ulPreviousMask = taskENTER_CRITICAL_FROM_ISR();
65
66         /* Maintain the tick count. */
67         if( xTaskIncrementTick() != pdFALSE )
68         {
69             /* Switch to the highest priority task that is ready to run. */
70             vTaskSwitchContext( portGET_CORE_ID() );
71         }
72
73         taskEXIT_CRITICAL_FROM_ISR( ulPreviousMask );
74     }
75     #endif /* if ( configNUMBER_OF_CORES == 1 ) */
76
77     /* start executing the new task */
78 }