OpenCores
URL https://opencores.org/ocsvn/openfire2/openfire2/trunk

Subversion Repositories openfire2

[/] [openfire2/] [trunk/] [sw/] [freertos-sample1/] [sample.c] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 toni32
#include <stdio.h>
2
#include <stdlib.h>
3
#include <string.h>
4
 
5
/* Scheduler include files. */
6
#include "FreeRTOS.h"
7
#include "task.h"
8
 
9
#define PERIODO1        ( ( portTickType ) 1000 / portTICK_RATE_MS  )
10
#define PERIODO2        ( ( portTickType ) 3000 / portTICK_RATE_MS  )
11
#define PERIODO3        ( ( portTickType )  100 / portTICK_RATE_MS  )
12
 
13
unsigned int lectura_pot;               /* para comunicarselo entre tareas */
14
 
15
/*-----------------------------------------------------------*/
16
static void vTask1( void *pvParameters )
17
{
18
        unsigned marca;
19
        /* The parameters are not used. */
20
        ( void ) pvParameters;
21
 
22
        uart1_printline("\r\n\r\n");
23
 
24
        marca = 0;
25
 
26
        /* Cycle for ever, delaying then checking all the other tasks are still
27
        operating without error. */
28
        for( ;; )
29
        {
30
                switch(marca)
31
                {
32
                  case 0 : uart1_printchar('-'); break;
33
                  case 1 : uart1_printchar('\\'); break;
34
                  case 2 : uart1_printchar('|'); break;
35
                  case 3 : uart1_printchar('/'); break;
36
                }
37
                uart1_printchar('\r');
38
                marca++;
39
                if(marca == 4) marca = 0;
40
 
41
                vTaskDelay( PERIODO1 );
42
        }
43
}
44
 
45
/*-----------------------------------------------------------*/
46
 
47
portSHORT main( void )
48
{
49
        portBASE_TYPE xReturn;
50
 
51
        uart1_printline("entering main()\r\n");
52
 
53
        /* Create the tasks defined within this file. */
54
        xReturn = xTaskCreate( vTask1, (const signed portCHAR *) "TSK1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
55
        if(xReturn != pdPASS)
56
        {
57
          uart1_printline("xTaskCreate failed\r\n");
58
          return 0;
59
        }
60
 
61
        /* In this port, to use preemptive scheduler define configUSE_PREEMPTION
62
        as 1 in portmacro.h.  To use the cooperative scheduler define
63
        configUSE_PREEMPTION as 0. */
64
 
65
        uart1_printline("starting scheduler....\r\n");
66
        vTaskStartScheduler();
67
 
68
        uart1_printline("end\r\n");
69
        return 0;
70
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.