/**************************************************************** * * Function Name : init_interrupt_btn * Comments : * Open the pin BSP_BTN1 for input, initialize interrupt and set * interrupt handler. * *****************************************************************/ void init_interrupt_btn(void * button) { LWGPIO_STRUCT_PTR btn_ptr = (LWGPIO_STRUCT_PTR) button; /* opening pins for input */ if (!lwgpio_init(btn_ptr, BSP_BUTTON1, LWGPIO_DIR_INPUT, LWGPIO_VALUE_NOCHANGE)) { printf("Initializing button GPIO as input failed.\n"); _task_block(); } #ifdef BSP_BUTTON1_MUX_IRQ lwgpio_set_functionality(btn_ptr, BSP_BUTTON1_MUX_IRQ); #if defined(BSP_BUTTONS_ACTIVE_HIGH) lwgpio_set_attribute(btn_ptr, LWGPIO_ATTR_PULL_DOWN, LWGPIO_AVAL_ENABLE); #else lwgpio_set_attribute(btn_ptr, LWGPIO_ATTR_PULL_UP, LWGPIO_AVAL_ENABLE); #endif /* enable gpio functionality for given pin, react on falling edge */ if (! lwgpio_int_init(btn_ptr, LWGPIO_INT_MODE_FALLING)) { printf("Initializing button GPIO for interrupt failed.\n"); _task_block(); } /* Install the interrupt directly to the vector table in the processor. */ if(! _int_install_kernel_isr(lwgpio_int_get_vector(btn_ptr), btn_kernel_isr)) { printf("Install interrupt handler to hardware vector table failed.\n"); _task_block(); } /* set the interrupt level, and unmask the interrupt in interrupt controller */ if(MQX_OK != _bsp_int_init(lwgpio_int_get_vector(btn_ptr), 3, 0, TRUE)) { printf("Initialize interrupt failed.\n"); _task_block(); } /* enable interrupt on GPIO peripheral module */ lwgpio_int_enable(btn_ptr, TRUE); #else printf("This platform does not support pin mux interrupt function\n"); _task_block(); #endif /* BSP_BUTTON1_MUX_IRQ */ }
static void button_led_init ( void ) { static LWGPIO_STRUCT sw; /* Set the pin to input */ if (!lwgpio_init(&sw, BSP_SW2, LWGPIO_DIR_INPUT, LWGPIO_VALUE_NOCHANGE)) { printf("\nSW initialization failed.\n"); _task_block(); } /* Set functionality to GPIO mode */ lwgpio_set_functionality(&sw, BSP_SW2_MUX_GPIO); /* Enable pull up */ lwgpio_set_attribute(&sw, LWGPIO_ATTR_PULL_UP, LWGPIO_AVAL_ENABLE); /* Setup the pin interrupt mode */ if (!lwgpio_int_init(&sw, LWGPIO_INT_MODE_FALLING)) { printf("Initializing SW for interrupt failed.\n"); _task_block(); } /* Install gpio interrupt service routine */ _int_install_isr(lwgpio_int_get_vector(&sw), button_isr, (void *) &sw); /* Set interrupt priority and enable interrupt source in the interrupt controller */ _bsp_int_init(lwgpio_int_get_vector(&sw), 3, 0, TRUE); /* Enable interrupt for pin */ lwgpio_int_enable(&sw, TRUE); /* Initialize LED pin for output */ if (!lwgpio_init(&led1, BSP_LED1, LWGPIO_DIR_OUTPUT, LWGPIO_VALUE_HIGH)) { printf("\nLED1 initialization failed.\n"); _task_block(); } /* Set LED pin to GPIO functionality */ lwgpio_set_functionality(&led1, BSP_LED1_MUX_GPIO); }
static uint32_t init_IRQ_interrupt(LWGPIO_STRUCT_PTR irq_pin, INT_ISR_FPTR isr) { /* Configure GPIO for nRF24L01 module */ if (FALSE == lwgpio_init(irq_pin, nRF24L01_IRQ_PIN, LWGPIO_DIR_INPUT, LWGPIO_VALUE_NOCHANGE)) { return MQX_ERROR; } /* swich pin functionality (MUX) to GPIO mode */ lwgpio_set_functionality(irq_pin, nRF24L01_IRQ_PIN_MUX); if(!lwgpio_int_init(irq_pin, LWGPIO_INT_MODE_FALLING)) { return MQX_ERROR; } _int_install_isr(lwgpio_int_get_vector(irq_pin), isr, irq_pin); lwgpio_int_enable(irq_pin, TRUE); return _bsp_int_init(lwgpio_int_get_vector(irq_pin), 4, 0, TRUE); }
/*TASK*------------------------------------------------------------------- * * Task Name : spi_read_task func * Comments : * *END*----------------------------------------------------------------------*/ static void taskRead(uint32_t para) { MQX_FILE_PTR dev_file = (MQX_FILE_PTR)para; SPI_CS_CALLBACK_STRUCT callback; uint8_t tmp, *buf; _lwsem_create(&IRQ_SEM, 0); lwgpio_init(&SPI_IRQ_PIN, BSP_EM9301_IRQ_PIN, LWGPIO_DIR_INPUT, LWGPIO_VALUE_NOCHANGE); lwgpio_set_functionality(&SPI_IRQ_PIN, BSP_EM9301_IRQ_MUX_IRQ); lwgpio_set_attribute(&SPI_IRQ_PIN, LWGPIO_ATTR_PULL_DOWN, LWGPIO_AVAL_ENABLE); lwgpio_int_init(&SPI_IRQ_PIN, LWGPIO_INT_MODE_RISING); _int_install_isr(lwgpio_int_get_vector(&SPI_IRQ_PIN), em9301_isr, &SPI_IRQ_PIN); _bsp_int_init(lwgpio_int_get_vector(&SPI_IRQ_PIN), BSP_DSPI_INT_LEVEL, 0, TRUE); lwgpio_int_enable(&SPI_IRQ_PIN, TRUE); for(;;) { _lwsem_wait(&IRQ_SEM); callback.CALLBACK = read_cs_callback; callback.USERDATA = dev_file; ioctl(dev_file, IO_IOCTL_SPI_SET_CS_CALLBACK, &callback); buf = hciBuffer; while(lwgpio_get_value(&SPI_IRQ_PIN)) { if(IO_ERROR != fread(&tmp, 1, 1,dev_file)) *buf++ = tmp; } fflush(dev_file); #if 1 uint8_t *start = hciBuffer; SYSTEM_Log("--Rx:"); while(start < buf) { SYSTEM_Log(" %02X", *start++); } SYSTEM_Log("\n"); #endif } }
boolean SEC_InitializeIO(void) { /* Init Gpio for Leds as output to drive LEDs (LED10 - LED13) */ #ifdef LED_1 output_port = lwgpio_init(&led1, LED_1, LWGPIO_DIR_OUTPUT, LWGPIO_VALUE_NOCHANGE); if(!output_port){ printf("Initializing LWGPIO for LED1 failed.\n"); } lwgpio_set_functionality(&led1, BSP_LED1_MUX_GPIO); /*Turn off Led */ lwgpio_set_value(&led1, LWGPIO_VALUE_LOW); #endif #ifdef LED_2 output_port = lwgpio_init(&led2, LED_2, LWGPIO_DIR_OUTPUT, LWGPIO_VALUE_NOCHANGE); if(!output_port){ printf("Initializing LWGPIO for LED2 failed.\n"); } lwgpio_set_functionality(&led2, BSP_LED2_MUX_GPIO); /*Turn off Led */ lwgpio_set_value(&led2, LWGPIO_VALUE_LOW); #endif #ifdef LED_3 output_port = lwgpio_init(&led3, LED_3, LWGPIO_DIR_OUTPUT, LWGPIO_VALUE_NOCHANGE); if(!output_port){ printf("Initializing LWGPIO for LED3 failed.\n"); } lwgpio_set_functionality(&led3, BSP_LED3_MUX_GPIO); /*Turn off Led */ lwgpio_set_value(&led3, LWGPIO_VALUE_LOW); #endif #ifdef LED_4 output_port = lwgpio_init(&led4, LED_4, LWGPIO_DIR_OUTPUT, LWGPIO_VALUE_NOCHANGE); if(!output_port){ printf("Initializing LWGPIO for LED3 failed.\n"); } lwgpio_set_functionality(&led4, BSP_LED4_MUX_GPIO); /*Turn off Led */ lwgpio_set_value(&led4, LWGPIO_VALUE_LOW); #endif #ifdef BSP_BUTTON1 /* Open and set port DD as input to read value from switches */ input_port = lwgpio_init(&button1, DOOR_STATE, LWGPIO_DIR_INPUT, LWGPIO_VALUE_NOCHANGE); if(!input_port) { printf("Initializing LW GPIO for button1 as input failed.\n"); _task_block(); } #if (defined BSP_BUTTON1_MUX_IRQ && defined SECEMAIL_TWRMCF51CN_STOP_ENABLED) lwgpio_set_functionality(&button1 ,BSP_BUTTON1_MUX_IRQ); lwgpio_set_attribute(&button1, LWGPIO_ATTR_PULL_UP, LWGPIO_AVAL_ENABLE); if (!lwgpio_int_init(&button1, LWGPIO_INT_MODE_RISING)) { printf("Initializing button GPIO for interrupt failed.\n"); } #else lwgpio_set_functionality(&button1 ,BSP_BUTTON1_MUX_GPIO); lwgpio_set_attribute(&button1, LWGPIO_ATTR_PULL_UP, LWGPIO_AVAL_ENABLE); #endif /* install gpio interrupt service routine */ _int_install_isr(lwgpio_int_get_vector(&button1), kbi_callback, (void *) &button1); _bsp_int_init(lwgpio_int_get_vector(&button1), 3, 0, TRUE); lwgpio_int_enable(&button1, TRUE); #endif #ifdef BSP_BUTTON2 input_port = lwgpio_init(&button2, WINDOW_STATE, LWGPIO_DIR_INPUT, LWGPIO_VALUE_NOCHANGE); if(!input_port) { printf("Initializing LW GPIO for button2 as input failed.\n"); _task_block(); } #if (defined BSP_BUTTON2_MUX_IRQ && defined SECEMAIL_TWRMCF51CN_STOP_ENABLED) lwgpio_set_functionality(&button2 ,BSP_BUTTON2_MUX_IRQ); lwgpio_set_attribute(&button2, LWGPIO_ATTR_PULL_UP, LWGPIO_AVAL_ENABLE); if (!lwgpio_int_init(&button2, LWGPIO_INT_MODE_FALLING)) { printf("Initializing button GPIO for interrupt failed.\n"); } #else lwgpio_set_functionality(&button2 ,BSP_BUTTON2_MUX_GPIO); lwgpio_set_attribute(&button2, LWGPIO_ATTR_PULL_UP, LWGPIO_AVAL_ENABLE); #endif /* install gpio interrupt service routine */ _int_install_isr(lwgpio_int_get_vector(&button2), kbi_callback, (void *) &button2); _bsp_int_init(lwgpio_int_get_vector(&button2), 3, 0, TRUE); lwgpio_int_enable(&button2, TRUE); #endif return (input_port!=0) && (output_port!=0); }
/*FUNCTION**************************************************************** * * Function Name : _io_spi_install * Returned Value : MQX error code * Comments : * Installs SPI device. * *END**********************************************************************/ _mqx_int _io_spi_install ( /* [IN] A string that identifies the device for fopen */ char *identifier, /* [IN] Pointer to driver initialization data */ SPI_INIT_STRUCT_CPTR init_data_ptr ) { SPI_DRIVER_DATA_STRUCT_PTR driver_data; _mqx_int error_code = MQX_OK; if ((init_data_ptr->DEVIF->SETPARAM == NULL) || (init_data_ptr->DEVIF->TX_RX == NULL)) { /* Missing mandatory low level driver function */ return IO_ERROR_DEVICE_INVALID; } driver_data = (SPI_DRIVER_DATA_STRUCT_PTR)_mem_alloc_system_zero((_mem_size)sizeof(SPI_DRIVER_DATA_STRUCT)); if (driver_data == NULL) { return MQX_OUT_OF_MEMORY; } _mem_set_type(driver_data, MEM_TYPE_IO_SPI_POLLED_DEVICE_STRUCT); driver_data->CS_CALLBACK = init_data_ptr->CS_CALLBACK; driver_data->CS_USERDATA= init_data_ptr->CS_USERDATA; driver_data->PARAMS = init_data_ptr->PARAMS; driver_data->DEVIF = init_data_ptr->DEVIF; /* initialize low level driver */ if (driver_data->DEVIF->INIT) error_code = driver_data->DEVIF->INIT(init_data_ptr->DEVIF_INIT, &(driver_data->DEVIF_DATA)); if (error_code != MQX_OK) { _mem_free(driver_data); return error_code; } _lwsem_create(&driver_data->BUS_LOCK, 1); /********************************************/ /*special for em9301 IRQ*/ _lwsem_create(&driver_data->IRQ_SEM, 0); lwgpio_init(&driver_data->SPI_IRQ_PIN, BSP_EM9301_IRQ_PIN, LWGPIO_DIR_INPUT, LWGPIO_VALUE_NOCHANGE); lwgpio_set_functionality(&driver_data->SPI_IRQ_PIN, BSP_EM9301_IRQ_MUX_IRQ); lwgpio_set_attribute(&driver_data->SPI_IRQ_PIN, LWGPIO_ATTR_PULL_DOWN, LWGPIO_AVAL_ENABLE); lwgpio_int_init(&driver_data->SPI_IRQ_PIN, LWGPIO_INT_MODE_RISING); _int_install_isr(lwgpio_int_get_vector(&driver_data->SPI_IRQ_PIN), _dspi_em9301_isr, driver_data); _bsp_int_init(lwgpio_int_get_vector(&driver_data->SPI_IRQ_PIN), BSP_DSPI_INT_LEVEL, 0, TRUE); lwgpio_int_enable(&driver_data->SPI_IRQ_PIN, TRUE); /********************************************/ error_code = _io_dev_install_ext(identifier, _io_spi_open, _io_spi_close, _io_spi_read, _io_spi_write, _io_spi_ioctl, _io_spi_uninstall, (void *)driver_data); if (error_code) { /* deinitialize low level driver */ if (driver_data->DEVIF->DEINIT) driver_data->DEVIF->DEINIT(driver_data->DEVIF_DATA); _lwsem_destroy(&driver_data->BUS_LOCK); _mem_free(driver_data); return error_code; } return MQX_OK; }
/*TASK*----------------------------------------------------------------- * * Function Name : Sdcard_task * Returned Value : void * Comments : * *END------------------------------------------------------------------*/ void Sdcard_task ( uint_32 temp ) { boolean inserted = TRUE, last = FALSE; _mqx_int error_code; MQX_FILE_PTR com_handle; //#if defined BSP_SDCARD_GPIO_DETECT // LWGPIO_STRUCT sd_detect; //#endif #if defined BSP_SDCARD_GPIO_PROTECT LWGPIO_STRUCT sd_protect; #endif #ifdef BSP_SDCARD_GPIO_CS LWGPIO_STRUCT sd_cs; SPI_CS_CALLBACK_STRUCT callback; #endif _task_id player_task_id, sd_walker_id; _mqx_int sd_event_value; _mqx_uint wait_state; #ifdef USB_ACCESSORY_PLAY connect_msg_t msg; int delaySetp = 0; #endif if (MQX_OK !=_lwevent_create(&(sddetect_event), LWEVENT_AUTO_CLEAR)) { printf("\n_lwevent_create sddetect_event failed\n"); _task_block(); } /* Open low level communication device */ com_handle = fopen (SDCARD_COM_CHANNEL, NULL); if (NULL == com_handle) { printf("Error installing communication handle.\n"); _task_block(); } #ifdef BSP_SDCARD_GPIO_CS /* Open GPIO file for SPI CS signal emulation */ error_code = lwgpio_init(&sd_cs, BSP_SDCARD_GPIO_CS, LWGPIO_DIR_OUTPUT, LWGPIO_VALUE_NOCHANGE); if (!error_code) { printf("Initializing GPIO with associated pins failed.\n"); _task_block(); } lwgpio_set_functionality(&sd_cs,BSP_SDCARD_CS_MUX_GPIO); lwgpio_set_attribute(&sd_cs, LWGPIO_ATTR_PULL_UP, LWGPIO_AVAL_ENABLE); /* Set CS callback */ callback.MASK = BSP_SDCARD_SPI_CS; callback.CALLBACK = set_CS; callback.USERDATA = &sd_cs; if (SPI_OK != ioctl (com_handle, IO_IOCTL_SPI_SET_CS_CALLBACK, &callback)) { printf ("Setting CS callback failed.\n"); _task_block(); } #endif #if defined BSP_SDCARD_GPIO_DETECT /* Init GPIO pins for other SD card signals */ error_code = lwgpio_init(&sd_detect, BSP_SDCARD_GPIO_DETECT, LWGPIO_DIR_INPUT, LWGPIO_VALUE_NOCHANGE); if (!error_code) { printf("Initializing GPIO with sdcard detect pin failed.\n"); _task_block(); } /*Set detect and protect pins as GPIO Function */ lwgpio_set_functionality(&sd_detect,BSP_SDCARD_DETECT_MUX_GPIO); lwgpio_set_attribute(&sd_detect, LWGPIO_ATTR_PULL_UP, LWGPIO_AVAL_ENABLE); #ifndef SD_DETECT_POLLING // init sd detcet pin interrupt lwgpio_int_init(&sd_detect,LWGPIO_INT_MODE_RISING | LWGPIO_INT_MODE_FALLING /* LWGPIO_INT_MODE_HIGH*/); /* falling,raising mode = 3 */ /* install gpio interrupt service routine */ _int_install_isr(lwgpio_int_get_vector(&sd_detect), EXT_SDDETECT_ISR, (void *) &sd_detect); _bsp_int_init(lwgpio_int_get_vector(&sd_detect), 5, 0, TRUE); lwgpio_int_enable(&sd_detect, TRUE); #endif #endif #if defined BSP_SDCARD_GPIO_PROTECT /* Init GPIO pins for other SD card signals */ error_code = lwgpio_init(&sd_protect, BSP_SDCARD_GPIO_PROTECT, LWGPIO_DIR_INPUT, LWGPIO_VALUE_NOCHANGE); if (!error_code) { printf("Initializing GPIO with sdcard protect pin failed.\n"); _task_block(); } /*Set detect and protect pins as GPIO Function */ lwgpio_set_functionality(&sd_protect,BSP_SDCARD_PROTECT_MUX_GPIO); lwgpio_set_attribute(&sd_protect, LWGPIO_ATTR_PULL_UP, LWGPIO_AVAL_ENABLE); #endif /* Install SD card device */ error_code = _io_sdcard_install("sdcard:", (pointer)&_bsp_sdcard0_init, com_handle); if ( error_code != MQX_OK ) { printf("Error installing SD card device (0x%x)\n", error_code); _task_block(); } _lwevent_set(&sddetect_event,SD_ATTACHED_EVENT); // set attached event at mode manager _time_delay(1000); /* wait otg main task ready */ printf("start sd card task\n"); // use sd detect interrupt for (;;) { #ifdef SD_DETECT_POLLING wait_state = _lwevent_wait_ticks(&sddetect_event,SD_EVENT_MASK, FALSE, 4/* 0*/); #else wait_state = _lwevent_wait_ticks(&sddetect_event,SD_EVENT_MASK, FALSE, 0); #endif //if (wait_state == LWEVENT_WAIT_TIMEOUT/* MQX_OK*/) { if (wait_state != MQX_OK ) { #ifndef SD_DETECT_POLLING printf("waiting sddetect_event fail\n"); // _task_block(); // _lwevent_destroy(&sddetect_event); //-goto wait_timeout; continue; #else _lwevent_set(&sddetect_event,SD_ATTACHED_EVENT); #endif } //else sd_event_value = _lwevent_get_signalled(); if (sd_event_value == SD_ATTACHED_EVENT ) { _time_delay (200); inserted = !lwgpio_get_value(&sd_detect); if(!inserted) // mount sd fs ,must attached sd card ! continue; // printf("mount sd card...\n"); // mount_sdcard(); #ifndef USB_ACCESSORY_PLAY /* create player and sd_walker task*/ player_task_id = _task_create(0, PLAYER_TASK, 0); printf("Creating sd player task................"); if (player_task_id == MQX_NULL_TASK_ID) { printf("[FAIL]\n"); } else { printf("[OK]\n"); } sd_walker_id = _task_create(0, SD_WALKER_TASK, 0); printf("Creating sd walker task................"); if (sd_walker_id == MQX_NULL_TASK_ID) { printf("[FAIL]\n"); } else { printf("[OK]\n"); } #else msg.conct_source = mp_for_TF; msg.conct_action = mp_plugIn; /* post message, TFcard plug in*/ if (LWMSGQ_FULL == _lwmsgq_send(connect_taskq, (uint_32 *) &msg, 0)) { printf("Could not inform about TFCard device attached\n"); } //_time_delay (1); // give mode manager task some times to cancel play ,if sd task high than mode task #endif // _lwevent_set(&player_event, PLAYER_EVENT_MSK_SD_FS_MOUNTED); //auto play event last = inserted; } // SD_ATTACHED_EVENT else if (sd_event_value == SD_DETTACHED_EVENT ) { // _time_delay (100); //inserted = !lwgpio_get_value(&sd_detect); //if(inserted) // continue; #ifndef USB_ACCESSORY_PLAY _lwevent_set(&player_event, PLAYER_EVENT_MSK_SD_FS_UNMOUNTED); _lwevent_wait_ticks(&player_event, PLAYER_EVENT_MSK_PLAYER_TASK_KILLED, TRUE, 0); _lwevent_clear(&player_event, PLAYER_EVENT_MSK_PLAYER_TASK_KILLED); /* And the destroy play_task and sd_walker task */ _task_destroy(sd_walker_id); _task_destroy(player_task_id); #else /* post message, TFcard plug out*/ msg.conct_source = mp_for_TF; msg.conct_action = mp_plugOut; /* post message, TFcard plug out*/ if (LWMSGQ_FULL == _lwmsgq_send(connect_taskq, (uint_32 *) &msg, 0)) { printf("Could not inform about TFCard device de-attached\n"); } //_time_delay (1); // give mode manager task some times to cancel play ,if sd task high than mode task #endif // printf("unmount sd card...\n"); // unmount_sdcard(); // printf ("SD card uninstalled.\n"); } } }
/*TASK*----------------------------------------------------------------- * * Function Name : localPlay_init_task * Returned Value : void * Comments : * *END------------------------------------------------------------------*/ void localPlay_init_task ( uint_32 temp ) { MQX_TICK_STRUCT time; _mqx_int errcode = 0; /* Install MQX default unexpected ISR routines */ _int_install_unexpected_isr(); if(_lwevent_create(&player_event, 0)!= MQX_OK) { printf("\nMake event failed"); } /* Setup time */ printf("Setting up time......................"); time.TICKS[0] = 0L; time.TICKS[1] = 0L; time.HW_TICKS = 0; _time_set_ticks(&time); printf("[OK]\n"); /* Init GPIOs */ lwgpio_init(&btn_next, BSP_SW1, LWGPIO_DIR_INPUT, LWGPIO_VALUE_NOCHANGE); lwgpio_set_functionality(&btn_next,BSP_SW1_MUX_GPIO); lwgpio_set_attribute(&btn_next, LWGPIO_ATTR_PULL_UP, LWGPIO_AVAL_ENABLE); lwgpio_int_init(&btn_next, LWGPIO_INT_MODE_RISING); _int_install_isr(lwgpio_int_get_vector(&btn_next), int_service_routine_btn_pause, (void *) &btn_next); hmi_init(); sgtl5000_power_on(); hmi_install(1, int_service_routine_btn_prev); _bsp_int_init(lwgpio_int_get_vector(&btn_next), BTN_ISR_PRIORITY, 0, TRUE); lwgpio_init(&btn_prev, BSP_SW2, LWGPIO_DIR_INPUT, LWGPIO_VALUE_NOCHANGE); lwgpio_set_functionality(&btn_prev, BSP_SW2_MUX_GPIO); lwgpio_set_attribute(&btn_prev, LWGPIO_ATTR_PULL_UP, LWGPIO_AVAL_ENABLE); #ifdef SD_DETECT_POLLING lwgpio_int_init(&btn_prev, LWGPIO_INT_MODE_RISING); _int_install_isr(lwgpio_int_get_vector(&btn_prev), int_service_routine_btn_stop, (void *) &btn_prev); _bsp_int_init(lwgpio_int_get_vector(&btn_prev), BTN_ISR_PRIORITY, 0, TRUE); #endif hmi_install(2, int_service_routine_btn_next); hmi_install(3, int_service_routine_vol_up); hmi_install(4, int_service_routine_vol_down); #if 0 /* Initialize audio codec */ printf("Initializing audio codec............."); if (errcode != 0) { printf("[FAIL]\n"); printf(" Error 0x%X\n", errcode); } else { printf("[OK]\n"); } //#else /* Initialize audio driver and codec */ /************************************************/ if ((errcode = msi_snd_init()) != 0) { printf("Initializing audio driver and codec........[FAIL]\n"); printf(" Error 0x%X\n", errcode); return; } else { printf("Initializing audio driver and codec........[OK]\n"); } /************************************************/ #endif /* Create tasks */ errcode = _task_create(0, SDCARD_TASK, 0); printf("Creating SD card task................"); if (errcode == MQX_NULL_TASK_ID) { printf("[FAIL]\n"); printf(" Error 0x%X.\n"); } else { printf("[OK]\n"); } #ifdef SD_PLAYER_SHELL_SUPPORTED printf("Creating shell task.................."); errcode = _task_create(0, SHELL_TASK, 0); if (errcode == MQX_NULL_TASK_ID) { printf("[FAIL]\n"); printf(" Error 0x%X.\n"); } else { printf("[OK]\n"); } #endif lwgpio_int_enable(&btn_next, TRUE); #ifdef SD_DETECT_POLLING lwgpio_int_enable(&btn_prev, TRUE); #endif _task_abort(MQX_NULL_TASK_ID); }