/* ***************************************************************************************** * DESCRIPTION: Process commands I2C commands that are not processed in the interrupt. * - Slow porcessing commands will be processed here so that the interrupt will not block communications ******************************************************************************************/ void I2C_process_task( void) { //PROCESS I2C PENDING TASK - CURRENTLY ONLY ONE AT A TIME - NO STACK NEEDED AT THIS POINT switch( i2c_task) { case I2C_TASK_LPC_MODE: //set pins to default lpc mode InitGPIO_LPC_Mode(); LED0_TOGGLE; i2c_cmd_rx = 0; //done processing the command break; case I2C_TASK_PASSIVE_MODE: //received command from i2c go into passive mode //set pins to default lpc mode InitGPIO_Passive_Mode(); LED1_TOGGLE; i2c_cmd_rx = 0; //done processing the command break; case I2C_TASK_LPC_CFG: //received command from i2c to reconfigure InitGPIO_LPC_Mode(); //make sure we are not setup for passive FPGA_Config("config.bit"); i2c_cmd_rx = 0; //done processing the command break; case I2C_TASK_SLAVE_CFG_INIT: //received command from i2c to reconfigure i2c_slave_cfg_init_status = -1; //reset the return status i2c_slave_cfg_init_status = InitFPGA_Config(); CFG_MUX_MASTER_CTL; //set the mux control pin for master peripheral control to config lines i2c_cmd_rx = 0; //done processing the command break; default: i2c_cmd_rx = 0; //don't know why we are here, bail. break; }//switch }//function
void mboot(void) { U32 i; U32 ByteToRead; U32 ByteRead; FRESULT res; DIR dirs; FATFS fs; FIL FileObject; memset(&fs, 0, sizeof(FATFS)); for(i=ZPARAMADDR; i < ZRELADDR; i++) *((volatile S8 *)(i)) = 0; res = f_mount(0, &fs); if( res != FR_OK ) { TRACE_ERR("Mount OS SD card failed: 0x%X", res); return; } res = f_opendir(&dirs, STR_ROOT_DIRECTORY); if(res == FR_OK ) { scan_files(STR_ROOT_DIRECTORY); TRACE_MSG("Load FPGA code (grid.bin) to buffer."); res = f_open(&FileObject, gridName, FA_OPEN_EXISTING|FA_READ); if(res != FR_OK) { TRACE_ERR("Open grid.rbf file failed: 0x%X", res); return; } ByteToRead = FileObject.fsize; gridFileSize = FileObject.fsize; res = f_read(&FileObject, (void*)GRIDADDR, ByteToRead, &ByteRead); if(res != FR_OK) { TRACE_ERR("Load grid.rbf file failed: 0x%X", res); return; } else { TRACE_FIN("FPGA code file load OK."); FPGA_Config(); } TRACE_MSG("Load kernel command line."); res = f_open(&FileObject, kcmdName, FA_OPEN_EXISTING|FA_READ); if(res != FR_OK) { TRACE_ERR("Open kernel command line file failed: 0x%X", res); return; } ByteToRead = FileObject.fsize; kcmdFileSize = FileObject.fsize; res = f_read(&FileObject, (void*)(ZPARAMADDR + 4*11), ByteToRead, &ByteRead); if(res != FR_OK) { TRACE_ERR("Load kernel command line file failed: 0x%X", res); return; } TRACE_MSG("Load zImage to ZRELADDR: 0x%X.", ZRELADDR); res = f_open(&FileObject, zImageName, FA_OPEN_EXISTING|FA_READ); if(res != FR_OK) { TRACE_ERR("Open zImage file failed: 0x%X", res); return; } ByteToRead = FileObject.fsize; res = f_read(&FileObject, (void*)(ZRELADDR), ByteToRead, &ByteRead); if(res != FR_OK) { TRACE_ERR("Load zImage file failed: 0x%X", res); return; } else { TRACE_FIN("zImage file Load OK, now let's just enjoy Linux :)\n\r"); BTNDIS_N(); Boot_Linux(); } } }