changing circuitry to disable RTC, update initialization to match
[fw/openalt] / main.c
1 //
2 //  Standard includes
3 //
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <unistd.h>
7 #include <string.h>
8
9 //
10 // Scheduler includes
11 //
12 #include "FreeRTOS.h"
13 #include "task.h"
14
15 //
16 //  Demo application includes
17 //
18 #include "main.h"
19 #include "adc/adc.h"
20 #include "cpu/cpu.h"
21 #include "dac/dac.h"
22 #include "eints/eints.h"
23 #include "gps/gps.h"
24 #include "fiq/fiq.h"
25 #include "i2c/i2c.h"
26 #include "iap/iap.h"
27 #include "leds/leds.h"
28 #include "monitor/monitor.h"
29 #include "rtc/rtc.h"
30 #include "sensors/sensors.h"
31 #include "uart/uart.h"
32 #include "usbser/usbser.h"
33 #include "usbmass/usbmass.h"
34
35 //
36 //
37 //
38 #define BAUD_UART0 115200
39 #define BAUD_UART1 4800
40
41 #ifdef CFG_CONSOLE_UART1
42 #undef BAUD_UART1
43 #define BAUD_UART1 115200
44 #endif
45
46 #if defined CFG_CONSOLE_USB && defined CFG_USB_MSC
47 #error Cannot have USB console and MSC defined at the same time
48 #endif
49
50 //
51 //
52 //
53 xTaskHandle taskHandles [TASKHANDLE_LAST];
54
55 //
56 //
57 //
58 int main (void)
59 {
60   cpuSetupHardware ();
61   uartInit (0, BAUD_UART0, 64);
62   uartInit (1, BAUD_UART1, 64);
63 #ifndef CFG_USB_MSC
64   usbserInit ();
65 #else
66   usbmassInit ();
67 #endif
68 //  rtcInit ();
69   adcInit ();
70   dacInit ();
71   i2cInit ();
72   eintsInit ();
73   fiqInit ();
74   iapInit ();
75
76   memset (taskHandles, 0, sizeof (taskHandles));
77
78   xTaskCreate (vSensorsTask,  (const signed portCHAR * const) "Sensors",  1024,                      NULL, (configMAX_PRIORITIES - 2), &taskHandles [TASKHANDLE_SENSORS]);
79 #ifndef CFG_CONSOLE_UART1
80   xTaskCreate (vGPSTask,      (const signed portCHAR * const) "GPS",      768,                      NULL, (tskIDLE_PRIORITY + 1),     &taskHandles [TASKHANDLE_GPS]);
81 #endif
82   xTaskCreate (vMonitorTask,  (const signed portCHAR * const) "Monitor",  1024,                     NULL, (tskIDLE_PRIORITY + 1),     &taskHandles [TASKHANDLE_MONITOR]);
83   xTaskCreate (vLEDFlashTask, (const signed portCHAR * const) "LEDx",     configMINIMAL_STACK_SIZE, NULL, (tskIDLE_PRIORITY + 1),     &taskHandles [TASKHANDLE_LED]);
84   vTaskStartScheduler ();
85
86   return 0;
87 }