int main (void) { OS_ERR err; #if (CPU_CFG_NAME_EN == DEF_ENABLED) CPU_ERR cpu_err; #endif hardware_init(); GPIO_DRV_Init(switchPins, ledPins); #if (CPU_CFG_NAME_EN == DEF_ENABLED) CPU_NameSet((CPU_CHAR *)"MK64FN1M0VMD12", (CPU_ERR *)&cpu_err); #endif OSA_Init(); /* Init uC/OS-III. */ OSSemCreate(&MySem1, /* Create Semaphore 1 */ "sem 1", 0, &err); OSSemCreate(&MySem2, /* Create Semaphore 2 */ "sem 2", 0, &err); INT_SYS_InstallHandler(PORTC_IRQn, SW1_Intr_Handler); // associate ISR with sw1 intr source INT_SYS_InstallHandler(PORTA_IRQn, SW2_Intr_Handler); // associate ISR with sw2 intr source OSTaskCreate(&AppTaskStartTCB, /* Create the start task */ "App Task Start", AppTaskStart, 0u, APP_CFG_TASK_START_PRIO, &AppTaskStartStk[0u], (APP_CFG_TASK_START_STK_SIZE / 10u), APP_CFG_TASK_START_STK_SIZE, 0u, 0u, 0u, (OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR | OS_OPT_TASK_SAVE_FP), &err); OSA_Start(); /* Start multitasking (i.e. give control to uC/OS-III). */ while (DEF_ON) { /* Should Never Get Here */ ; } }
/*FUNCTION********************************************************************** * * Function Name : OSA_InstallIntHandler * Description : This function is used to install interrupt handler. * *END**************************************************************************/ osa_status_t OSA_InstallIntHandler (int32_t IRQNumber, void (*handler)(void)) { INT_SYS_InstallHandler((IRQn_Type)IRQNumber, handler); return kStatus_OSA_Success; }
/*! * @brief initializes LLWU module */ void llwu_init(void) { /* Configure the interrupt vector for the interrupt handler */ INT_SYS_InstallHandler(LLW_IRQn, &llwu_isr); /* Enable the IRQs */ INT_SYS_EnableIRQ(LLW_IRQn); /* Configure the interrupt vector for the interrupt handler */ INT_SYS_InstallHandler(LPTimer_IRQn, &demo_lptmr_isr); /* * TWR_K22F120M and TWR_K64F120M: SW1,PTC6 LLWU_P10 * FRDM_K64F120M: SW2,PTC6 LLWU_P10 * FRDM_K22F120M: SW2,PTC1 LLWU_P6 */ llwu_configure(LLWU_PIN_NUM, kLlwuExternalPinFallingEdge, kLlwuWakeupModule0); }