/*..........................................................................*/ int main() { static QEvt const *tableQueueSto[N_PHILO]; static QEvt const *philoQueueSto[N_PHILO][N_PHILO]; static QSubscrList subscrSto[MAX_PUB_SIG]; static QF_MPOOL_EL(TableEvt) smlPoolSto[2*N_PHILO]; /* small pool */ uint8_t n; Philo_ctor(); /* instantiate all Philosopher active objects */ Table_ctor(); /* instantiate the Table active object */ QF_init(); /* initialize the framework and the underlying RT kernel */ BSP_init(); /* initialize the Board Support Package */ /* object dictionaries... */ QS_OBJ_DICTIONARY(smlPoolSto); QS_OBJ_DICTIONARY(tableQueueSto); QS_OBJ_DICTIONARY(philoQueueSto[0]); QS_OBJ_DICTIONARY(philoQueueSto[1]); QS_OBJ_DICTIONARY(philoQueueSto[2]); QS_OBJ_DICTIONARY(philoQueueSto[3]); QS_OBJ_DICTIONARY(philoQueueSto[4]); /* initialize publish-subscribe... */ QF_psInit(subscrSto, Q_DIM(subscrSto)); /* initialize event pools... */ QF_poolInit(smlPoolSto, sizeof(smlPoolSto), sizeof(smlPoolSto[0])); /* start the active objects... */ for (n = 0U; n < N_PHILO; ++n) { QACTIVE_START(AO_Philo[n], /* AO to start */ (uint_fast8_t)(n + 1), /* QP priority of the AO */ philoQueueSto[n], /* event queue storage */ Q_DIM(philoQueueSto[n]), /* queue length [events] */ (void *)0, /* stack storage (not used) */ 0U, /* size of the stack (default) */ (QEvt *)0); /* initialization event */ } /* Table AO uses the custom stack size. * NOTE: Remember to configure sufficient number of threads with * user-provided stack size OS_PRIVCNT in RTX_Conf_CM.c */ QF_setRtxPrio(AO_Table, osPriorityHigh); /* set RTX priority */ QACTIVE_START(AO_Table, /* AO to start */ (uint_fast8_t)(N_PHILO + 1), /* QP priority of the AO */ tableQueueSto, /* event queue storage */ Q_DIM(tableQueueSto), /* queue length [events] */ (void *)0, /* stack storage (not used) */ 128U*4U, /* stack size [bytes] (or 0) */ (QEvt *)0); /* initialization event */ return QF_run(); /* run the QF application */ }
/*..........................................................................*/ int main() { static QEvt const *tableQueueSto[N_PHILO]; static QEvt const *philoQueueSto[N_PHILO][N_PHILO]; static QSubscrList subscrSto[MAX_PUB_SIG]; static QF_MPOOL_EL(TableEvt) smlPoolSto[2*N_PHILO]; /* small pool */ uint8_t n; Philo_ctor(); /* instantiate all Philosopher active objects */ Table_ctor(); /* instantiate the Table active object */ QF_init(); /* initialize the framework and the underlying RT kernel */ BSP_init(); /* initialize the Board Support Package */ /* object dictionaries... */ QS_OBJ_DICTIONARY(smlPoolSto); QS_OBJ_DICTIONARY(tableQueueSto); QS_OBJ_DICTIONARY(philoQueueSto[0]); QS_OBJ_DICTIONARY(philoQueueSto[1]); QS_OBJ_DICTIONARY(philoQueueSto[2]); QS_OBJ_DICTIONARY(philoQueueSto[3]); QS_OBJ_DICTIONARY(philoQueueSto[4]); /* initialize publish-subscribe... */ QF_psInit(subscrSto, Q_DIM(subscrSto)); /* initialize event pools... */ QF_poolInit(smlPoolSto, sizeof(smlPoolSto), sizeof(smlPoolSto[0])); /* start the active objects... */ for (n = 0U; n < N_PHILO; ++n) { QACTIVE_START(AO_Philo[n], /* AO to start */ (uint_fast8_t)(n + 1), /* QP priority of the AO */ philoQueueSto[n], /* event queue storage */ Q_DIM(philoQueueSto[n]), /* queue length [events] */ (void *)0, /* stack storage (not used) */ 0U, /* size of the stack [bytes] */ (QEvt *)0); /* initialization event */ } QACTIVE_START(AO_Table, /* AO to start */ (uint_fast8_t)(N_PHILO + 1), /* QP priority of the AO */ tableQueueSto, /* event queue storage */ Q_DIM(tableQueueSto), /* queue length [events] */ (void *)0, /* stack storage (not used) */ 0U, /* size of the stack [bytes] */ (QEvt *)0); /* initialization event */ return QF_run(); /* run the QF application */ }
int main(void) { static QEvt const *l_filterQSto[10]; filter_ctor(); QACTIVE_START(AO_filter, 1U, l_filterQSto, Q_DIM(l_filterQSto), (void *)0, 0U, (QEvt *)0); return QF_run(); }
/*..........................................................................*/ int main(void) { uint8_t n; Philo_ctor(); /* instantiate all Philosopher active objects */ Table_ctor(); /* instantiate the Table active object */ LwIPMgr_ctor(); /* instantiate all LwIP-Manager active object */ BSP_init(); /* initialize the Board Support Package */ QF_init(); /* initialize the framework and the underlying RT kernel */ /* object dictionaries... */ QS_OBJ_DICTIONARY(l_smlPoolSto); QS_OBJ_DICTIONARY(l_medPoolSto); QS_OBJ_DICTIONARY(l_lwIPMgrQueueSto); QS_OBJ_DICTIONARY(l_philoQueueSto[0]); QS_OBJ_DICTIONARY(l_philoQueueSto[1]); QS_OBJ_DICTIONARY(l_philoQueueSto[2]); QS_OBJ_DICTIONARY(l_philoQueueSto[3]); QS_OBJ_DICTIONARY(l_philoQueueSto[4]); QS_OBJ_DICTIONARY(l_tableQueueSto); QF_psInit(l_subscrSto, Q_DIM(l_subscrSto)); /* init publish-subscribe */ /* initialize event pools... */ QF_poolInit(l_smlPoolSto, sizeof(l_smlPoolSto), sizeof(l_smlPoolSto[0])); QF_poolInit(l_medPoolSto, sizeof(l_medPoolSto), sizeof(l_medPoolSto[0])); QACTIVE_START(AO_LwIPMgr, 1, l_lwIPMgrQueueSto, Q_DIM(l_lwIPMgrQueueSto), (void *)0, 0, (QEvt *)0); for (n = 0; n < N_PHILO; ++n) { /* start the active objects... */ QACTIVE_START(AO_Philo[n], (uint8_t)(n + 2), l_philoQueueSto[n], Q_DIM(l_philoQueueSto[n]), (void *)0, 0, (QEvt *)0); } QACTIVE_START(AO_Table, (uint8_t)(N_PHILO + 2), l_tableQueueSto, Q_DIM(l_tableQueueSto), (void *)0, 0, (QEvt *)0); return QF_run(); /* run the QF application */ }
/*..........................................................................*/ int main() { static QEvt const *tableQueueSto[N_PHILO]; static QEvt const *philoQueueSto[N_PHILO][N_PHILO]; static QSubscrList subscrSto[MAX_PUB_SIG]; static QF_MPOOL_EL(TableEvt) smlPoolSto[2*N_PHILO]; /* small pool */ uint8_t n; Philo_ctor(); /* instantiate all Philosopher active objects */ Table_ctor(); /* instantiate the Table active object */ QF_init(); /* initialize the framework and the underlying RT kernel */ BSP_init(); /* initialize the Board Support Package */ /* object dictionaries... */ QS_OBJ_DICTIONARY(smlPoolSto); QS_OBJ_DICTIONARY(tableQueueSto); QS_OBJ_DICTIONARY(philoQueueSto[0]); QS_OBJ_DICTIONARY(philoQueueSto[1]); QS_OBJ_DICTIONARY(philoQueueSto[2]); QS_OBJ_DICTIONARY(philoQueueSto[3]); QS_OBJ_DICTIONARY(philoQueueSto[4]); QF_psInit(subscrSto, Q_DIM(subscrSto)); /* init publish-subscribe */ /* initialize event pools... */ QF_poolInit(smlPoolSto, sizeof(smlPoolSto), sizeof(smlPoolSto[0])); for (n = 0U; n < N_PHILO; ++n) { /* start the active objects... */ QACTIVE_START(AO_Philo[n], (uint8_t)(n + 1), philoQueueSto[n], Q_DIM(philoQueueSto[n]), (void *)0, 0U, (QEvt *)0); } QACTIVE_START(AO_Table, (uint8_t)(N_PHILO + 1), tableQueueSto, Q_DIM(tableQueueSto), (void *)0, 0U, (QEvt *)0); return QF_run(); /* run the QF application */ }
int main(void) { static QEvt const *l_tableQueueSto[N_PHILO]; static QEvt const *l_philoQueueSto[N_PHILO][N_PHILO]; static QSubscrList l_subscrSto[MAX_PUB_SIG]; /* storage for event pools... */ static QF_MPOOL_EL(TableEvt) l_smlPoolSto[2*N_PHILO]; /* small pool */ uint8_t n; Philo_ctor(); /* instantiate all Philosopher active objects */ Table_ctor(); /* instantiate the Table active object */ QF_init(); /* initialize the framework and the underlying RT kernel */ BSP_init(); /* initialize the BSP */ /* send object dictionaries for event pools... */ QS_OBJ_DICTIONARY(l_smlPoolSto); /* init publish-subscribe... */ QF_psInit(l_subscrSto, Q_DIM(l_subscrSto)); /* initialize event pools... */ QF_poolInit(l_smlPoolSto, sizeof(l_smlPoolSto), sizeof(l_smlPoolSto[0])); /* start the active objects... */ for (n = 0; n < N_PHILO; ++n) { QACTIVE_START(AO_Philo[n], (uint8_t)(n + 1), l_philoQueueSto[n], Q_DIM(l_philoQueueSto[n]), (void *)0, 0U, (QEvt *)0); } QACTIVE_START(AO_Table, (uint8_t)(N_PHILO + 1), l_tableQueueSto, Q_DIM(l_tableQueueSto), (void *)0, 0U, (QEvt *)0); return QF_run(); /* run the QF application, QF_run() does not return */ }
/*..........................................................................*/ int main(int argc, char *argv[]) { printf("Reminder state pattern\nQEP version: %s\nQF version: %s\n" "Press 'e' to echo the current value...\n" "Press ESC to quit...\n", QEP_getVersion(), QF_getVersion()); Cruncher_ctor(&l_cruncher); BSP_init(argc, argv); /* initialize the BSP */ QF_init(); /* initialize the framework and the underlying RT kernel */ /* publish-subscribe not used, no call to QF_psInit() */ QF_poolInit(l_smlPoolSto, sizeof(l_smlPoolSto), sizeof(l_smlPoolSto[0])); /* instantiate and start the active objects... */ QACTIVE_START((QActive *)&l_cruncher, 1, l_cruncherQSto, Q_DIM(l_cruncherQSto), (void *)0, 1024, (QEvt *)0); return QF_run(); /* run the QF application */ }
/*............................................................................*/ int main(void) { /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup files (startup_stm32f40_41xxx.s/startup_stm32f427_437xx.s/ startup_stm32f429_439xx.s/startup_stm32f401xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f4xx.c file */ /* Enable debugging for select modules - Note: this has no effect in rel * builds since all DBG level logging is disabled and only LOG and up msgs * will get printed. */ DBG_setDefaults(); /* initialize the Board Support Package */ BSP_init(); dbg_slow_printf("Initialized BSP\n"); log_slow_printf("Starting Bootloader version %s built on %s\n", FW_VER, BUILD_DATE); /* Instantiate the Active objects by calling their "constructors" */ dbg_slow_printf("Initializing AO constructors\n"); /* Make sure the comm interfaces are up first */ SerialMgr_ctor(); LWIPMgr_ctor(); /* Iterate though the available I2C busses on the system and call the ctor() * for each instance of the I2CBusMgr AO for each bus. */ for( uint8_t i = 0; i < MAX_I2C_BUS; ++i ) { I2CBusMgr_ctor( i ); /* Start this instance of AO for this bus. */ } I2C1DevMgr_ctor(); CommMgr_ctor(); FlashMgr_ctor(); SysMgr_ctor(); dbg_slow_printf("Initializing QF\n"); QF_init(); /* initialize the framework and the underlying RT kernel */ /* object dictionaries... */ dbg_slow_printf("Initializing object dictionaries for QSPY\n"); QS_OBJ_DICTIONARY(l_smlPoolSto); QS_OBJ_DICTIONARY(l_medPoolSto); QS_OBJ_DICTIONARY(l_lrgPoolSto); QS_OBJ_DICTIONARY(l_SerialMgrQueueSto); QS_OBJ_DICTIONARY(l_LWIPMgrQueueSto); QS_OBJ_DICTIONARY(l_I2CBusMgrQueueSto); QS_OBJ_DICTIONARY(l_I2C1DevMgrQueueSto); QS_OBJ_DICTIONARY(l_CommMgrQueueSto); QS_OBJ_DICTIONARY(l_FlashMgrQueueSto); QS_OBJ_DICTIONARY(l_SysMgrQueueSto); QF_psInit(l_subscrSto, Q_DIM(l_subscrSto)); /* init publish-subscribe */ /* initialize the general memory pool */ dbg_slow_printf("Initializing general purpose memory pool in CCMRAM\n"); QMPool_init( p_glbMemPool, l_memPoolSto, sizeof(l_memPoolSto), DC3_MAX_MEM_BLK_SIZE ); /* initialize event pools... */ dbg_slow_printf("Initializing small event storage pool\n"); QF_poolInit(l_smlPoolSto, sizeof(l_smlPoolSto), sizeof(l_smlPoolSto[0])); dbg_slow_printf("Initializing medium event storage pool\n"); QF_poolInit(l_medPoolSto, sizeof(l_medPoolSto), sizeof(l_medPoolSto[0])); dbg_slow_printf("Initializing large event storage pool\n"); QF_poolInit(l_lrgPoolSto, sizeof(l_lrgPoolSto), sizeof(l_lrgPoolSto[0])); /* Start Active objects */ dbg_slow_printf("Starting Active Objects\n"); QACTIVE_START(AO_SerialMgr, SERIAL_MGR_PRIORITY, /* priority */ l_SerialMgrQueueSto, Q_DIM(l_SerialMgrQueueSto), /* evt queue */ (void *)0, 0, /* per-thread stack size */ (QEvt *)0, /* no initialization event */ "SerialMgr" /* Name of the task */ ); QACTIVE_START(AO_LWIPMgr, ETH_PRIORITY, /* priority */ l_LWIPMgrQueueSto, Q_DIM(l_LWIPMgrQueueSto), /* evt queue */ (void *)0, 0, /* per-thread stack size */ (QEvt *)0, /* no initialization event */ "LWIPMgr" /* Name of the task */ ); /* Iterate though the available I2C busses on the system and start an * instance of the I2CBusMgr AO for each bus. * WARNING!!!: make sure that the priorities for them are all together since * this loop will iterates through them and will take another AO's priority. * You will end up with clashing priorities for your AOs.*/ for( uint8_t i = 0; i < MAX_I2C_BUS; ++i ) { QACTIVE_START(AO_I2CBusMgr[i], I2CBUS1MGR_PRIORITY + i, /* priority */ l_I2CBusMgrQueueSto[i], Q_DIM(l_I2CBusMgrQueueSto[i]), /* evt queue */ (void *)0, 0, /* per-thread stack size */ (QEvt *)0, /* no initialization event */ "I2CBusMgr" /* Name of the task */ ); } QACTIVE_START(AO_I2C1DevMgr, I2C1DEVMGR_PRIORITY, /* priority */ l_I2C1DevMgrQueueSto, Q_DIM(l_I2C1DevMgrQueueSto), /* evt queue */ (void *)0, 0, /* per-thread stack size */ (QEvt *)0, /* no initialization event */ "I2CDevMgr" /* Name of the task */ ); QACTIVE_START(AO_CommMgr, COMM_MGR_PRIORITY, /* priority */ l_CommMgrQueueSto, Q_DIM(l_CommMgrQueueSto), /* evt queue */ (void *)0, 0, /* per-thread stack size */ (QEvt *)0, /* no initialization event */ "CommMgr" /* Name of the task */ ); QACTIVE_START(AO_FlashMgr, FLASH_MGR_PRIORITY, /* priority */ l_FlashMgrQueueSto, Q_DIM(l_FlashMgrQueueSto), /* evt queue */ (void *)0, 0, /* per-thread stack size */ (QEvt *)0, /* no initialization event */ "FlashMgr" /* Name of the task */ ); QACTIVE_START(AO_SysMgr, SYS_MGR_PRIORITY, /* priority */ l_SysMgrQueueSto, Q_DIM(l_SysMgrQueueSto), /* evt queue */ (void *)0, 0, /* per-thread stack size */ (QEvt *)0, /* no initialization event */ "SysMgr" /* Name of the task */ ); log_slow_printf("Starting QPC. All logging from here on out shouldn't show 'SLOW'!!!\n\n"); QF_run(); /* run the QF application */ return(0); }
/*..........................................................................*/ int main() { static QEvt const *tableQueueSto[N_PHILO]; static QEvt const *philoQueueSto[N_PHILO][N_PHILO]; static OS_STK philoStk[N_PHILO][128]; /* stacks for the Philosophers */ static OS_STK tableStk[256]; /* stack for the Table */ static QSubscrList subscrSto[MAX_PUB_SIG]; static TableEvt smlPoolSto[2*N_PHILO]; /* storage for small event pool */ uint8_t n; /* in C you need to explicitly instantiate all AOs... */ Philo_ctor(); Table_ctor(); QF_init(); /* initialize the framework and the underlying RT kernel */ BSP_init(); /* initialize the Board Support Package */ /* object dictionaries... */ QS_OBJ_DICTIONARY(smlPoolSto); QS_OBJ_DICTIONARY(tableQueueSto); QS_OBJ_DICTIONARY(philoQueueSto[0]); QS_OBJ_DICTIONARY(philoQueueSto[1]); QS_OBJ_DICTIONARY(philoQueueSto[2]); QS_OBJ_DICTIONARY(philoQueueSto[3]); QS_OBJ_DICTIONARY(philoQueueSto[4]); /* init publish-subscribe */ QF_psInit(subscrSto, Q_DIM(subscrSto)); /* initialize event pools... */ QF_poolInit(smlPoolSto, sizeof(smlPoolSto), sizeof(smlPoolSto[0])); /* start the active objects... */ /* CAUTION: * Make sure to configure **SUFFICIENT** number of uC/OS-II tasks and * message queues in "os_cfg.h" for all your active objects!!! */ for (n = 0U; n < N_PHILO; ++n) { /* NOTE: provide uC/OS-II task attributes for the AO's task */ QF_setUCosTaskAttr(AO_Philo[n], OS_TASK_OPT_STK_CHK); QACTIVE_START(AO_Philo[n], (uint_fast8_t)(n + 1), /* QP priority */ philoQueueSto[n], /* storage for the AO's queue */ Q_DIM(philoQueueSto[n]), /* queue's length [entries] */ philoStk[n], /* stack storage */ sizeof(philoStk[n]), /* sack size [bytes] */ (QEvt const *)0); /* initialization event */ } /* NOTE: provide uC/OS-II task attributes for the AO's task */ QF_setUCosTaskAttr(AO_Table, OS_TASK_OPT_STK_CHK); QACTIVE_START(AO_Table, (uint_fast8_t)(N_PHILO + 1), /* QP priority */ tableQueueSto, /* storage for the AO's queue */ Q_DIM(tableQueueSto), /* queue's length [entries] */ tableStk, /* stack storage */ sizeof(tableStk), /* sack size [bytes] */ (QEvt const *)0); /* initialization event */ return QF_run(); /* run the QF application */ }
/*..........................................................................*/ int main() { static QEvt const *tableQueueSto[N_PHILO]; static uint64_t tableStackSto[64]; static QEvt const *philoQueueSto[N_PHILO][N_PHILO]; static uint64_t philoStackSto[N_PHILO][64]; static QSubscrList subscrSto[MAX_PUB_SIG]; static QF_MPOOL_EL(TableEvt) smlPoolSto[2*N_PHILO]; /* small pool */ /* stack for the "naked" test thread */ static void const *testQueueSto[5]; static uint64_t testStackSto[64]; /* stack for the QXK's idle thread */ static uint64_t idleStackSto[32]; uint8_t n; Philo_ctor(); /* instantiate all Philosopher active objects */ Table_ctor(); /* instantiate the Table active object */ Test_ctor(); /* instantiate the Test "naked" thread */ QF_init(); /* initialize the framework */ BSP_init(); /* initialize the Board Support Package */ /* object dictionaries... */ QS_OBJ_DICTIONARY(smlPoolSto); QS_OBJ_DICTIONARY(tableQueueSto); QS_OBJ_DICTIONARY(philoQueueSto[0]); QS_OBJ_DICTIONARY(philoQueueSto[1]); QS_OBJ_DICTIONARY(philoQueueSto[2]); QS_OBJ_DICTIONARY(philoQueueSto[3]); QS_OBJ_DICTIONARY(philoQueueSto[4]); /* initialize QXK... */ QXK_init(idleStackSto, sizeof(idleStackSto)); /* initialize publish-subscribe... */ QF_psInit(subscrSto, Q_DIM(subscrSto)); /* initialize event pools... */ QF_poolInit(smlPoolSto, sizeof(smlPoolSto), sizeof(smlPoolSto[0])); /* start the active objects... */ for (n = 0U; n < N_PHILO; ++n) { QACTIVE_START(AO_Philo[n], /* AO to start */ (uint_fast8_t)(n + 1), /* QP priority of the AO */ philoQueueSto[n], /* event queue storage */ Q_DIM(philoQueueSto[n]), /* queue length [events] */ philoStackSto[n], /* stack storage */ sizeof(philoStackSto[n]), /* stack size [bytes] */ (QEvt *)0); /* initialization event */ } QACTIVE_START(AO_Table, /* AO to start */ (uint_fast8_t)(N_PHILO + 1), /* QP priority of the AO */ tableQueueSto, /* event queue storage */ Q_DIM(tableQueueSto), /* queue length [events] */ tableStackSto, /* stack storage */ sizeof(tableStackSto), /* stack size [bytes] */ (QEvt *)0); /* initialization event */ /* start the "naked" thread */ QXTHREAD_START(&XT_Test->super, /* Thread to start */ (uint_fast8_t)10U, /* QP priority of the thread */ testQueueSto, /* message queue storage */ Q_DIM(testQueueSto), /* message length [events] */ testStackSto, /* stack storage */ sizeof(testStackSto), /* stack size [bytes] */ (QEvt *)0); /* initialization event */ return QF_run(); /* run the QF application */ }