1 /**************************************************************************************************\r
2 * Filename: main.c\r
3 * Description: This file contains the main for the TI-RTOS platform.\r
4 *\r
5 *\r
6 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/\r
7 *\r
8 *\r
9 * Redistribution and use in source and binary forms, with or without\r
10 * modification, are permitted provided that the following conditions\r
11 * are met:\r
12 *\r
13 * Redistributions of source code must retain the above copyright\r
14 * notice, this list of conditions and the following disclaimer.\r
15 *\r
16 * Redistributions in binary form must reproduce the above copyright\r
17 * notice, this list of conditions and the following disclaimer in the\r
18 * documentation and/or other materials provided with the\r
19 * distribution.\r
20 *\r
21 * Neither the name of Texas Instruments Incorporated nor the names of\r
22 * its contributors may be used to endorse or promote products derived\r
23 * from this software without specific prior written permission.\r
24 *\r
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
36 *\r
37 */\r
38 /* XDCtools Header files */\r
39 #include <xdc/std.h>\r
40 #include <xdc/cfg/global.h>\r
41 #include <xdc/runtime/System.h>\r
42 \r
43 /* BIOS Header files */\r
44 #include <ti/sysbios/BIOS.h>\r
45 \r
46 /* TI-RTOS Header files */\r
47 #include <ti/drivers/GPIO.h>\r
48 #include <ti/drivers/SPI.h>\r
49 \r
50 /* Example/Board Header files */\r
51 #include "Board.h"\r
52 #include "UARTConsole.h"\r
53 \r
54 #include "rpc.h"\r
55 #include "nwkTopology.h"\r
56 \r
57 #include "dbgPrint.h"\r
58 \r
59 Void rpcTaskFxn(UArg arg0, UArg arg1)\r
60 {\r
61 while (1)\r
62 {\r
63 rpcProcess();\r
64 }\r
65 }\r
66 \r
67 Void appTaskFxn(UArg arg0, UArg arg1)\r
68 {\r
69 //init the RPC queue\r
70 rpcInitMq();\r
71 \r
72 //init the application thread to register the callbacks\r
73 appInit();\r
74 \r
75 while (1)\r
76 {\r
77 appProcess(NULL);\r
78 }\r
79 }\r
80 \r
81 int main(void)\r
82 {\r
83 /* Call board init functions. */\r
84 Board_initGeneral();\r
85 Board_initGPIO();\r
86 Board_initUART();\r
87 \r
88 UARTConsole_open(false);\r
89 \r
90 int serialPortFd = rpcOpen(NULL, 0);\r
91 if (serialPortFd == -1)\r
92 {\r
93 dbg_print(PRINT_LEVEL_ERROR, "could not open serial port\n");\r
94 //exit(-1);\r
95 while (1)\r
96 ;\r
97 }\r
98 \r
99 /* Start BIOS */\r
100 BIOS_start();\r
101 \r
102 }\r