void main(void) { OS_Init(); // OS System init ADC_init(); // Should be done first PWM_init(); // Beware pwm ports go together with ANALOG in setPortBIO(0x04); // Set port B in output mode setPortDIO(0x00); // Set port D in output mode XLCDInit(); // initialize the LCD module XLCDClear(); // Push een kleine lijst //push(2); //push(1); //push(3); OS_Task_Create(0, Task_Server); // BT Connection OS_Task_Create(1, Task_Hartbeat); // Show I am alive (called by scheduler)// OS_Task_Create(1, Task_Run); // Run me through the maze (called by scheduler)// OS_Task_Create(2, Task_Display); // be called by scheduler OS_Run(); // Run scheduler }
void main() { CNC_INITIALIZE(); // Init periphery OS_Init(); // Init OS OS_Task_Create(1,CNC_CONTROL); OS_Task_Create(2,STEPPER_CONTROL); OS_EI(); // Enable interrupts OS_Run(); }
int main (void) { Init(); // Init periphery OS_Init(); // Init OS OS_Task_Create(0, Task_Rolling); // Create tasks. OS_Task_Create(0, Task_SetSpeed); // OS_Task_Create(0, Task_Button); // m_cPosition = 0; // rotation phase m_cDirection = 1; // direction OS_EI(); // Enable interrupts OS_Run(); // Running scheduler }
void main(void) { clock_int_48MHz(); PIC_Init(); // Configurações gerais do PIC OS_Init(); TRISB=0b00000000; TRISA=0b00000000; OS_Task_Create(1,Task_1); // Criando uma tarefa, prioridade 1 OS_Task_Create(2,Task_2); // Criando uma tarefa, prioridade 2 OS_Task_Create(3,Task_3); // Criando uma tarefa, prioridade 3 //OS_Task_Create(4,Task_4); // Criando uma tarefa, prioridade 4 OS_EI(); // Habilita interrupcoes OS_Run(); // Executa o RTOS }
//**************************************************************************** //**** main //**************************************************************************** void main(void){ Inicio(); OS_Init(); // Init OS OS_Task_Define(USB); // Define tasks. OS_Task_Define(Gla); OS_Task_Define(Glc_PIDdiscreto); OS_Task_Define(MotorX); OS_Task_Define(MotorY); OS_Task_Define(MotorZ); OS_Task_Define(MotorE); // Create tasks. // if 0 = no priorities OS_Task_Create(0, USB); OS_Task_Create(0, Gla); OS_Task_Create(0, Glc_PIDdiscreto); OS_Task_Create(0, MotorX); OS_Task_Create(0, MotorY); OS_Task_Create(0, MotorZ); OS_Task_Create(0, MotorE); // Create tasks, Task priority. Allowed values from 0(highest) to 7(lowest) /*OS_Task_Create(0, USB); OS_Task_Create(7, Gla); OS_Task_Create(1, Glc_PIDdiscreto); OS_Task_Create(2, MotorX); OS_Task_Create(2, MotorY); OS_Task_Create(2, MotorZ); OS_Task_Create(2, MotorE); OS_Bsem_Set(BS_GLAGLC_FREE);*/ OS_EI(); // Enable interrupts OS_Run(); // Running scheduler }
int main(int argc, char **argv) { int c, test_config = 0,run_foreground = 0; int uid = 0,gid = 0; const char *dir = DEFAULTDIR; const char *user = MAILUSER; const char *group = GROUPGLOBAL; const char *cfg = DEFAULTCPATH; /* Mail Structure */ MailConfig mail; /* Setting the name */ OS_SetName(ARGV0); while((c = getopt(argc, argv, "Vdhtfu:g:D:c:")) != -1){ switch(c){ case 'V': print_version(); break; case 'h': help_maild(); break; case 'd': nowDebug(); break; case 'f': run_foreground = 1; break; case 'u': if(!optarg) ErrorExit("%s: -u needs an argument",ARGV0); user=optarg; break; case 'g': if(!optarg) ErrorExit("%s: -g needs an argument",ARGV0); group=optarg; break; case 'D': if(!optarg) ErrorExit("%s: -D needs an argument",ARGV0); dir=optarg; break; case 'c': if(!optarg) ErrorExit("%s: -c needs an argument",ARGV0); cfg = optarg; break; case 't': test_config = 1; break; default: help_maild(); break; } } /* Starting daemon */ debug1(STARTED_MSG,ARGV0); /*Check if the user/group given are valid */ uid = Privsep_GetUser(user); gid = Privsep_GetGroup(group); if((uid < 0)||(gid < 0)) ErrorExit(USER_ERROR,ARGV0,user,group); /* Reading configuration */ if(MailConf(test_config, cfg, &mail) < 0) ErrorExit(CONFIG_ERROR, ARGV0, cfg); /* Reading internal options */ mail.strict_checking = getDefine_Int("maild", "strict_checking", 0, 1); /* Get groupping */ mail.groupping = getDefine_Int("maild", "groupping", 0, 1); /* Getting subject type */ mail.subject_full = getDefine_Int("maild", "full_subject", 0, 1); #ifdef GEOIP /* Get GeoIP */ mail.geoip = getDefine_Int("maild", "geoip", 0, 1); #endif /* Exit here if test config is set */ if(test_config) exit(0); if(!run_foreground) { nowDaemon(); goDaemon(); } /* Privilege separation */ if(Privsep_SetGroup(gid) < 0) ErrorExit(SETGID_ERROR,ARGV0,group); /* chrooting */ if(Privsep_Chroot(dir) < 0) ErrorExit(CHROOT_ERROR,ARGV0,dir); nowChroot(); /* Changing user */ if(Privsep_SetUser(uid) < 0) ErrorExit(SETUID_ERROR,ARGV0,user); debug1(PRIVSEP_MSG,ARGV0,dir,user); /* Signal manipulation */ StartSIG(ARGV0); /* Creating PID files */ if(CreatePID(ARGV0, getpid()) < 0) ErrorExit(PID_ERROR, ARGV0); /* Start up message */ verbose(STARTUP_MSG, ARGV0, (int)getpid()); /* the real daemon now */ OS_Run(&mail); }