add: performance values for Lattice MachXO2
[zpu.git] / zpu / sw / freertos / sample / test1.c
blob41b42964eb5faea05da9ea407bf99268f9b3c458
1 /* Scheduler includes. */
2 #include "FreeRTOS.h"
3 #include "task.h"
5 #include "devices.h"
7 #define mainTINY_STACK 256
8 void vTest(void *pvParameters);
9 void vTest2(void *pvParameters);
11 /*-----------------------------------------------------------*/
14 * Create all the demo tasks - then start the scheduler.
16 int main (void)
18 /* When re-starting a debug session (rather than cold booting) we want
19 to ensure the installed interrupt handlers do not execute until after the
20 scheduler has been started. */
21 portDISABLE_INTERRUPTS();
23 #if configUSE_PREEMPTION == 1
24 xTaskCreate( vTest, "TST1", mainTINY_STACK, ( void * ) 10, tskIDLE_PRIORITY, NULL );
25 xTaskCreate( vTest2, "TST2", mainTINY_STACK, ( void * ) 10, tskIDLE_PRIORITY, NULL );
26 #endif
28 /* Finally start the scheduler. */
29 vTaskStartScheduler();
31 /* Should not get here as the processor is now under control of the
32 scheduler! */
34 return 0;
37 void vTest(void *pvParameters)
39 const portTickType xDelay = 100 / portTICK_RATE_MS;
40 unsigned bit = 16;
41 unsigned dir = 0;
43 for(;;)
45 CLEAR_BIT(SP3SK_GPIO, bit);
46 if(dir == 0) { if(++bit == 23) { dir=1; } }
47 else { if(--bit == 16) { dir=0;} }
48 SET_BIT(SP3SK_GPIO, bit);
49 vTaskDelay( xDelay );
53 void vTest2(void *pvParameters)
55 const portTickType xDelay = 250 / portTICK_RATE_MS;
56 unsigned pos;
57 char marcas[] = "|/-\\";
59 for(;;)
61 uart1_printline("\r");
62 uart1_printline("Running...");
63 uart1_printchar(marcas[pos]);
64 if(++pos == 4) pos = 0;
65 vTaskDelay( xDelay );