void osalInitTasks(void) { uint8 taskID = 0; tasksEvents = (uint16*)osal_mem_alloc(sizeof(uint16) * tasksCnt); osal_memset(tasksEvents, 0, (sizeof(uint16) * tasksCnt)); LL_Init(taskID++); Hal_Init(taskID++); HCI_Init(taskID++); #if defined (OSAL_CBTIMER_NUM_TASKS) osal_CbTimerInit(taskID); taskID += OSAL_CBTIMER_NUM_TASKS; #endif L2CAP_Init( taskID++ ); GAP_Init(taskID++); GATT_Init(taskID++); SM_Init(taskID++); GAPRole_Init(taskID++); GAPBondMgr_Init(taskID++); GATTServApp_Init(taskID++); RemotePeripheralInit(taskID); };
/********************************************************************* * @fn osalInitTasks * * @brief This function invokes the initialization function for each task. * * @param void * * @return none */ void osalInitTasks( void ) { uint8 taskID = 0; tasksEvents = (uint16 *)osal_mem_alloc( sizeof( uint16 ) * tasksCnt); VOID osal_memset( tasksEvents, 0, (sizeof( uint16 ) * tasksCnt)); /* LL Task */ LL_Init( taskID++ ); /* Hal Task */ Hal_Init( taskID++ ); /* HCI Task */ HCI_Init( taskID++ ); #if defined ( OSAL_CBTIMER_NUM_TASKS ) /* Callback Timer Tasks */ osal_CbTimerInit( taskID ); taskID += OSAL_CBTIMER_NUM_TASKS; #endif /* L2CAP Task */ L2CAP_Init( taskID++ ); /* GAP Task */ GAP_Init( taskID++ ); /* SM Task */ SM_Init( taskID++ ); /* GATT Task */ GATT_Init( taskID++ ); #if !defined ( GATT_DB_OFF_CHIP ) /* GATT Server App Task */ GATTServApp_Init( taskID++ ); #if defined ( GATT_TEST ) /* GATT Test Task */ GATTTest_Init( taskID++ ); #endif #endif // GATT_DB_OFF_CHIP #if defined ( GAP_BOND_MGR ) GAPBondMgr_Init( taskID++ ); #endif /* HCI Extension GAP Task */ HCI_EXT_App_Init( taskID ); }
/********************************************************************* * @fn osalInitTasks * * @brief This function invokes the initialization function for each task. * * @param void * * @return none */ void osalInitTasks( void ) { uint8 taskID = 0; tasksEvents = (uint16 *)osal_mem_alloc( sizeof( uint16 ) * tasksCnt); osal_memset( tasksEvents, 0, (sizeof( uint16 ) * tasksCnt)); /* LL Task */ LL_Init( taskID++ ); /* Hal Task */ Hal_Init( taskID++ ); /* HCI Task */ HCI_Init( taskID++ ); #if defined ( OSAL_CBTIMER_NUM_TASKS ) /* Callback Timer Tasks */ osal_CbTimerInit( taskID ); taskID += OSAL_CBTIMER_NUM_TASKS; #endif /* L2CAP Task */ L2CAP_Init( taskID++ ); /* GAP Task */ GAP_Init( taskID++ ); /* GATT Task */ GATT_Init( taskID++ ); /* SM Task */ SM_Init( taskID++ ); /* Profiles */ GAPCentralRole_Init( taskID++ ); GAPBondMgr_Init( taskID++ ); /* Application */ #if defined ( ZIGBEE_APP ) Zigbee_Init( taskID++ ); #endif #if defined _XBEE_APP_ XBeeInit(taskID ++); Hidapp_Init( taskID ); #endif //SimpleBLEPeripheral_Init( taskID ); }
/********************************************************************* * @fn osalInitTasks * * @brief This function invokes the initialization function for each task. * * @param void * * @return none */ void osalInitTasks( void ) { uint8 taskID = 0; tasksEvents = (uint16 *)osal_mem_alloc( sizeof( uint16 ) * tasksCnt); osal_memset( tasksEvents, 0, (sizeof( uint16 ) * tasksCnt)); /* LL Task */ LL_Init( taskID++ ); /* Hal Task */ Hal_Init( taskID++ ); /* HCI Task */ HCI_Init( taskID++ ); #if defined ( OSAL_CBTIMER_NUM_TASKS ) /* Callback Timer Tasks */ osal_CbTimerInit( taskID ); taskID += OSAL_CBTIMER_NUM_TASKS; #endif /* L2CAP Task */ L2CAP_Init( taskID++ ); /* GAP Task */ GAP_Init( taskID++ ); /* GATT Task */ GATT_Init( taskID++ ); /* SM Task */ SM_Init( taskID++ ); /* Profiles */ GAPRole_Init( taskID++ ); GAPBondMgr_Init( taskID++ ); GATTServApp_Init( taskID++ ); HidDev_Init( taskID++ ); /* Application */ HidKbdMouse_Init( taskID ); }
// the main routine makes the window, and then runs an even loop // until the window is closed int main(int argc, char *argv[]) { LOG_INIT( "log.txt" ); srand(time(NULL)); _wind = new Fl_Double_Window(6,MENUBAR_HEIGHT,WINDOW_WIDTH,WINDOW_HEIGHT+MENUBAR_HEIGHT,"Omnivision"); /* 0 */ _gl_main = new MyGlWindow(0,MENUBAR_HEIGHT,WINDOW_WIDTH-CONTROLBAR_WIDTH,WINDOW_HEIGHT); // main window /* 1 */ _gl_main->_menu_bar = new Fl_Menu_Bar(0, 0, WINDOW_WIDTH-CONTROLBAR_WIDTH, MENUBAR_HEIGHT); // menu bar /* 2 */ _gl_control = new MyControlBarWindow(WINDOW_WIDTH-CONTROLBAR_WIDTH,MENUBAR_HEIGHT,CONTROLBAR_WIDTH,\ CONTROLBAR_HEIGHT); // control bar _gl_main->_control_bar = _gl_control; initMainWindow(_gl_main,_gl_control); // init the state machine SM_Init( _gl_main, _gl_main->MAINTENANCE_MAX_CORRESPONDENCES, _gl_main->MAINTENANCE_HISTORY_SIZE ); _wind->begin(); _tempo = 0.0; Fl::add_timeout(_tempo, callback); _wind->end(); _wind->show(); /*_wind->begin(); glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE); glutInitWindowSize(WINDOW_WIDTH,WINDOW_HEIGHT); int ww = glutCreateWindow(argv[0]); LOG(LEVEL_INFO, "created window %d\n", ww); GLuint textures[10]; glGenTextures( 10, textures ); _wind->end();*/ return Fl::run(); //delete _gl_main; //delete _gl_control; //return 1; }
/********************************************************************* * @fn osalInitTasks * * @brief This function invokes the initialization function for each task. * * @param void * * @return none */ void osalInitTasks( void ) { ICall_EntityID entity; ICall_Semaphore sem; uint8 taskID = 0; uint8 i; tasksEvents = (uint16 *)osal_mem_alloc( sizeof( uint16 ) * tasksCnt); osal_memset( tasksEvents, 0, (sizeof( uint16 ) * tasksCnt)); /* LL Task */ LL_Init( taskID++ ); /* HCI Task */ HCI_Init( taskID++ ); #if defined ( OSAL_CBTIMER_NUM_TASKS ) /* Callback Timer Tasks */ osal_CbTimerInit( taskID ); taskID += OSAL_CBTIMER_NUM_TASKS; #endif /* L2CAP Task */ L2CAP_Init( taskID++ ); /* GAP Task */ GAP_Init( taskID++ ); /* SM Task */ SM_Init( taskID++ ); /* GATT Task */ GATT_Init( taskID++ ); /* GATT Server App Task */ GATTServApp_Init( taskID++ ); #if defined ( GAP_BOND_MGR ) /* Bond Manager Task */ GAPBondMgr_Init( taskID++ ); #endif /* ICall BLE Dispatcher Task */ bleDispatch_Init( taskID ); // ICall enrollment /* Enroll the service that this stack represents */ ICall_enrollService(ICALL_SERVICE_CLASS_BLE, NULL, &entity, &sem); /* Enroll the obtained dispatcher entity and OSAL task ID of HCI Ext App * to OSAL so that OSAL can route the dispatcher message into * the appropriate OSAL task. */ osal_enroll_dispatchid(taskID, entity); /* Register all other OSAL tasks to use the registered dispatcher entity * ID as the source of dispatcher messages, even though the other OSAL * tasks didn't register themselves to receive messages from application. */ for (i = 0; i < taskID; i++) { osal_enroll_senderid(i, entity); } }
static void setupStateMachine(void) { SMM_Config(1, 3); sm_index = SM_Init(&stateWaitForBatt, MAX_EVENT, MAX_STATE, sm); SM_SetActive(sm_index, true); }
static void setupStateMachine(void) { SMM_Config(1, 3); SM_Init(&sm); SM_SetActive(&sm, true); }