dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
main.c
Go to the documentation of this file.
1 
16 /*
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation; either version 3 of the License, or
20  * (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful, but
23  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25  * for more details.
26  *
27  * You should have received a copy of the GNU General Public License along
28  * with this program; if not, see <http://www.gnu.org/licenses/>
29  */
30 
31 /* OpenPilot Includes */
32 #if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__)
33 #include <winsock2.h>
34 #endif
35 
36 #include "openpilot.h"
37 #include "uavobjectsinit.h"
38 #include "systemmod.h"
39 #include "pios_thread.h"
40 #include "pios_hal.h"
41 
42 /* Prototype of PIOS_Board_Init() function */
43 extern void PIOS_Board_Init(void);
44 extern void Stack_Change(void);
45 
46 /* Function Prototypes */
47 static void initTask();
48 
49 static int g_argc;
50 static char **g_argv;
51 
52 int main(int argc, char *argv[]) {
53  setvbuf(stdout, NULL, _IONBF, 1);
54  printf("Beginning simulation environment\n");
55 #if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__)
56  WSADATA wsaData;
57  WSAStartup(MAKEWORD(2, 2), &wsaData);
58 #endif
59 
60  g_argc = argc;
61  g_argv = argv;
62 
64 
65  initTask();
66 
67  return 0;
68 }
69 
71 
72 void system_task();
73 
79 void initTask()
80 {
81  printf("Initialization task running\n");
82 
83  PIOS_SYS_Init();
84 
86 
87  /* Initialize the task monitor library */
89 
91 
93 
94  /* board driver init */
96 
97  /* Initialize modules */
99 
100  /* create all modules thread */
102 
103  printf("Initialization task completed-- invoking system task\n");
104 
105  system_task();
106 
107  printf("System task exited? Shouldn't happen.\n");
108 }
109 
int main(void)
Definition: main.c:441
void PIOS_HAL_InitUAVTalkReceiver()
Definition: pios_hal.c:1435
#define MODULE_TASKCREATE_ALL
Definition: pios_initcall.h:77
System module.
void system_task()
Definition: systemmod.c:223
static char ** g_argv
Definition: main.c:50
void PIOS_SYS_Init(void)
#define MODULE_INITIALISE_ALL(wdgfn)
Definition: pios_initcall.h:69
void PIOS_Board_Init(void)
Definition: pios_board.c:44
void PIOS_WDG_Clear(void)
Clear the watchdog timer.
Definition: pios_wdg.c:147
static void initTask()
Definition: main.c:79
static int g_argc
Definition: main.c:49
void PIOS_heap_initialize_blocks(void)
Definition: pios_heap.c:228
void Stack_Change(void)
Definition: pios_board.c:53
int32_t TaskMonitorInitialize(void)
Definition: taskmonitor.c:50
Includes PiOS and core architecture components.
int printf(const char *format,...)
int32_t UAVObjInitialize()
void PIOS_SYS_Args(int argc, char *argv[])
MODULE_INITSYSTEM_DECLS
Definition: main.c:70