void draw_jpg(BltConfigParams stConfig,U32 JPD_OUTADDR) { GFX_BufferInfo src_info; GFX_Block Blk; UBOOT_TRACE("IN\n"); src_info.u32Addr = JPD_OUTADDR; UBOOT_DEBUG("src_info.u32Addr=0x%x\n",(unsigned int)src_info.u32Addr); src_info.u32ColorFmt = GFX_FMT_YUV422; UBOOT_DEBUG("src_info.u32ColorFmt=0x%x\n",(unsigned int)src_info.u32ColorFmt); src_info.u32Width = (U32)JPG_GetAlignmentWidth(); UBOOT_DEBUG("src_info.u32Width=0x%x\n",(unsigned int)src_info.u32Width); src_info.u32Height = (U32)JPG_GetAlignmentHeight(); UBOOT_DEBUG("src_info.u32Height=0x%x\n",(unsigned int)src_info.u32Height); src_info.u32Pitch = (U32)JPG_GetAlignmentPitch()<<1; UBOOT_DEBUG("src_info.u32Pitch=0x%x\n",(unsigned int)src_info.u32Pitch); Blk.x = (U16)((stConfig.u16DispX+15)&0xFFFFF0); Blk.y = stConfig.u16DispY; Blk.width = (U16)((stConfig.u16DispW+15)&0xFFFFF0);; Blk.height = stConfig.u16DispH; MsApiDrawJPG(src_info,Blk); UBOOT_TRACE("OK\n"); }
int MsApiChunkHeader_GetValue(EN_CHUNK_HEADER_ITEM enItem,unsigned int *puValue) { UBOOT_TRACE("IN\n"); //UBOOT_DUMP(gu8ChunkHeader,CH_ITEM_LAST); if(puValue==NULL) { UBOOT_ERROR("puValue is a null pointer\n"); return -1; } if(ChunkHeaderReady != TRUE) { if(MsApiChunkHeader_Init() !=0) { UBOOT_ERROR("MsApiChunkHeader_Init fail\n"); return -1; } } if((enItem>=CH_ITEM_FIRST) && (enItem<=CH_ITEM_LAST)) { *puValue = gu32ChunkHeader[enItem]; UBOOT_DEBUG("ChunkHeaderOffset(0x%x): 0x%x\n",enItem,*puValue); } else { UBOOT_ERROR("ERROR: Out of chunk header bound : %d \n",enItem); return -1; } UBOOT_TRACE("OK\n"); return 0; }
int do_spi_wrc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unsigned int dram_addr=0; unsigned int flash_addr=0; unsigned int len=0; int ret=0; UBOOT_TRACE("IN\n"); /* check argc */ if (argc != WRITE_CODE_INPUT_LEN) { UBOOT_ERROR("Usage:\n%s\n", cmdtp->usage); return 1; } arg_off_size_nor(argc - 2, argv + 2, &flash_addr, &len); dram_addr = (0 == strncmp(argv[1], UPGRADE_ADDR_STR, strlen(UPGRADE_ADDR_STR))) ? UPGRADE_BUFFER_ADDR : simple_strtoul(argv[1], NULL, 16); ret=_spi_wrc(dram_addr,flash_addr,len); if(ret==0) { UBOOT_TRACE("OK\n"); } else { UBOOT_ERROR("write partition fail\n"); } return ret; }
int setUpgradePartition(int partitionId) { UBOOT_TRACE("IN\n"); g_partition=partitionId; UBOOT_TRACE("OK\n"); return 0; }
int clearScritSizeOfUpgradeImage(void) { UBOOT_TRACE("IN\n"); scriptSizeOfUpgradeImage=0; UBOOT_TRACE("OK\n"); return 0; }
int setUpgradeMode(EN_UPDATE_MODE enMode) { UBOOT_TRACE("IN\n"); s_UpdateMode=enMode; UBOOT_TRACE("OK\n"); return 0; }
int deleteUpgradeFileName(void) { char *buffer=NULL; int ret=0; UBOOT_TRACE("IN\n"); buffer=malloc(CMD_BUF); if(buffer==NULL) { UBOOT_ERROR("malloc fail \n"); return -1; } memset(buffer,0,CMD_BUF); snprintf(buffer,CMD_BUF, "setenv %s ",ENV_UPGRADE_NAME); UBOOT_DEBUG("cmd: %s \n",buffer); ret=run_command(buffer,0); if(ret==-1) { free(buffer); UBOOT_ERROR("delete ENV_UPGRADE_NAME fail\n"); } else { free(buffer); UBOOT_TRACE("OK\n"); } return ret; }
int setScritSizeOfUpgradeImage(unsigned int size) { UBOOT_TRACE("IN\n"); scriptSizeOfUpgradeImage=size; UBOOT_TRACE("OK\n"); return 0; }
int do_check_file_partition(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *cFile =NULL; int partition=0; int device=0; int ret=-1; UBOOT_TRACE("IN\n"); if(argc < 2) { cmd_usage(cmdtp); return -1; } cFile=argv[1]; if(check_file_partition(cFile,&partition,&device)!= 0) { UBOOT_INFO("FAIL: no file in usb or Usb no init!\n"); ret =-1; } else { UBOOT_INFO("file:%s is existed.[device:%d partition:%d]\n",cFile,device,partition); ret = 0; } UBOOT_TRACE("OK\n"); return ret; }
int check_file_partition(char *upgradeFile,int *device, int *partition) { char buffer[CMD_BUF] = "\0"; UBOOT_TRACE("IN\n"); for(g_device = 0 ; g_device < MAX_DEVICE ;g_device++) { for(g_partition = 0 ; g_partition < MAX_PARTITION ; g_partition++) { snprintf(buffer, CMD_BUF, "fatload usb %d:%d %X %s 1",g_device, g_partition, UPGRADE_BUFFER_ADDR, upgradeFile); UBOOT_DEBUG("cmd: %s \n",buffer); if(run_command(buffer, 0) == 0) { if((device != NULL) && (partition != NULL)) { *device=g_device; *partition=g_partition; } UBOOT_TRACE("OK\n"); return 0; } } } UBOOT_TRACE("OK\n"); return -1; }
// if is_dont_overwrite_cmd return TRUE, we skip this line. // if is_dont_overwrite_cmd return FALSE, we execute this line. BOOLEAN check_skip_cmd(char *next_line) { char *pLine = NULL; UBOOT_TRACE("IN\n"); if(next_line==NULL) { UBOOT_ERROR("The input parameter 'next_line' is a null pointer\n"); return FALSE; } if(is_dont_overwrite_cmd(next_line)==TRUE) { if(is_force_overwrite_cmd(next_line)==TRUE) { goto END; } UBOOT_TRACE("OK\n"); return TRUE; } END: //This part is for filter command. pLine=strstr(next_line,"#"); if(pLine!=NULL){ *pLine='\0'; } UBOOT_TRACE("OK\n"); return FALSE; }
int do_force_overwrite(char *partionName) { UBOOT_TRACE("IN\n"); if(partionName==NULL) { UBOOT_ERROR("The input parameter 'partionName' is a null pointer\n"); return -1; } if(force_overwrite_count==MAX_FORCEWRIE_COUNT){ UBOOT_ERROR("The number os 'fore overwrite' is up to max vaulue:%d\n",MAX_FORCEWRIE_COUNT); return -1; } if(force_overwrite_flag!=TRUE){ UBOOT_DEBUG("The function of 'force overwrite' is not enable\n"); UBOOT_TRACE("OK\n"); return 0; } pforce_overwrite_partition[force_overwrite_count]=malloc(strlen(partionName)+1); if(pforce_overwrite_partition[force_overwrite_count]==NULL){ UBOOT_ERROR("malloc for %s fail\n",partionName); return -1; } memset(pforce_overwrite_partition[force_overwrite_count],0,strlen(partionName)+1); strncpy(pforce_overwrite_partition[force_overwrite_count],partionName, strlen(partionName)); force_overwrite_count++; UBOOT_TRACE("OK\n"); return 0; }
int Secure_AES_ECB_Encrypt(MS_U32 u32Addr, MS_U32 u32Len, MS_U8 *bKey) { AES_ParamStruct AESParam; int ret=0; UBOOT_TRACE("IN\n"); AESParam.eMode = E_DRVAESDMA_CIPHER_ECB; AESParam.pChiperBuf = u32Addr; AESParam.pPlainBuf = u32Addr; AESParam.pKey = (MS_U32 *)bKey; AESParam.u32Len = u32Len; AESParam.pIV= (MS_U32 *)NULL; AESParam.bIsDecrypt = FALSE; ret=CommonAES128(&AESParam); if(ret==0) { UBOOT_TRACE("OK\n"); } else { UBOOT_ERROR("Secure_AES_Encrypt fail\n"); } return ret; }
int do_spi_create (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { #if defined (CONFIG_APP_IN_SPI) unsigned int size=0; int ret=0; UBOOT_TRACE("IN\n"); if(argc!=CREATE_PARTITION_INPUT_LEN) { cmd_usage(cmdtp); return -1; } size=simple_strtol(argv[2], NULL,16); ret=add_partition(argv[1],size); if(ret==0) { UBOOT_TRACE("OK\n"); } else { UBOOT_ERROR("create partition fail\n"); } return ret; #else UBOOT_TRACE("IN\n"); UBOOT_ERROR("This function doesn't support\n"); return -1; #endif }
int setUpgradeDevice(int deviceId) { UBOOT_TRACE("IN\n"); g_device=deviceId; UBOOT_TRACE("OK\n"); return 0; }
int do_spi_init_partition (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { #if defined (CONFIG_APP_IN_SPI) int ret=0; UBOOT_TRACE("IN\n"); if(argc!=1) { cmd_usage(cmdtp); return -1; } ret=init_spi_partition(); if(ret==0) { UBOOT_TRACE("OK\n"); } else { UBOOT_ERROR("init spi partition fail\n"); } return ret; #else UBOOT_TRACE("IN\n"); UBOOT_ERROR("This function doesn't support\n"); return -1; #endif }
int do_spi_rmgpt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { #if defined (CONFIG_APP_IN_SPI) int ret=0; UBOOT_TRACE("IN\n"); if(argc!=RMGPT_INPUT_LEN) { cmd_usage(cmdtp); return -1; } ret=del_all_partitions(); if(ret==0) { ret=add_mboot_partition(); if(ret==-1) { UBOOT_ERROR("add mboot partition fail\n"); return -1; } } else { UBOOT_ERROR("remove partition fail\n"); } return ret; #else UBOOT_TRACE("IN\n"); UBOOT_ERROR("This function doesn't support\n"); return -1; #endif }
int get_addr_from_mmap(char *id, U32 *addr) { MMapInfo_s mmapInfo; UBOOT_TRACE("IN\n"); if((id==NULL)||(addr==NULL)) { UBOOT_ERROR("One of the parameters is a null pointer\n"); return -1; } UBOOT_DEBUG("id=%s\n",id); if(get_mmap(id,&mmapInfo)!=0) { UBOOT_ERROR("get mmap fail\n"); return -1; } if(mmapInfo.b_is_miu0==0) { UBOOT_DEBUG("In MIU0\n"); *addr=mmapInfo.u32Addr+miu_interval; } else { UBOOT_DEBUG("In MIU1\n"); *addr=mmapInfo.u32Addr; } UBOOT_DEBUG("addr=0x%x\n",*addr); UBOOT_TRACE("OK\n"); return 0; }
MS_BOOL MsDrv_MIU_Protect(MS_U8 u8Blockx, MS_U8 *pu8ProtectId, MS_U32 u32Start, MS_U32 u32End, MS_BOOL bSetFlag) { MS_BOOL isProtect=FALSE; MS_U32 u32PageShift; UBOOT_TRACE("IN\n"); UBOOT_DEBUG("MsDrv_MIU_Protect Index[%d] LX[0x%lx][0x%lx] \n",u8Blockx,u32Start,u32End); if(!MDrv_MIU_ProtectAlign(&u32PageShift)) { UBOOT_ERROR("ERROR MDrv_MIU_ProtectAlign FAIL \n"); } isProtect=MDrv_MIU_Protect(u8Blockx, pu8ProtectId, MIU_ALIGN(u32Start, u32PageShift), MIU_ALIGN(u32End, u32PageShift), bSetFlag); if(!isProtect) { UBOOT_ERROR("ERROR MDrv_MIU_Protect FAIL \n"); } UBOOT_TRACE("OK\n"); return isProtect; }
int do_spi_remove (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { #if defined (CONFIG_APP_IN_SPI) int ret=0; UBOOT_TRACE("IN\n"); if(argc!=REMOVE_PARTITION_INPUT_LEN) { cmd_usage(cmdtp); return -1; } ret=del_partition(argv[1]); if(ret==0) { UBOOT_TRACE("OK\n"); } else { UBOOT_ERROR("remove partition fail\n"); } return ret; #else UBOOT_TRACE("IN\n"); UBOOT_ERROR("This function doesn't support\n"); return -1; #endif }
char* loadscript(char *filedir,U32 *filesize) { char *script = NULL; UBOOT_TRACE("IN\n"); *filesize = vfs_getsize(filedir); if( (*filesize > SCRIPT_BUFSIZE) || (*filesize == 0) ) { UBOOT_ERROR("No enough buffer or path fail(%s) :\n[%s] [%s]\n",filedir,__FILE__,__FUNCTION__); return NULL; } script = (char *)malloc(*filesize); if(script == NULL) { UBOOT_ERROR("No enough buffer %s %s\n",__FILE__,__FUNCTION__); return NULL; } if(vfs_read((void *)script,filedir,0,(unsigned int)(*filesize))==-1) { free(script); UBOOT_ERROR("Error: vfs_read Fail \n"); return NULL; } UBOOT_TRACE("OK\n"); return script; }
int appInitUsbDisk(void) { char idx=0; #if defined(ENABLE_THIRD_EHC) const char u8UsbPortCount = 3; #elif defined(ENABLE_SECOND_EHC) const char u8UsbPortCount = 2; #else const char u8UsbPortCount = 1; #endif UBOOT_TRACE("IN\n"); for(idx=0; idx<u8UsbPortCount; idx++) { if (usb_init(idx) == 0) { if (usb_stor_scan(1) == 0) { UBOOT_TRACE("OK\n"); return 0 ; } } } UBOOT_TRACE("OK\n"); return -1; }
//-------------------------------------------------------------------------------------------------- ///Entry function for JPD testing. //-------------------------------------------------------------------------------------------------- int MsDrv_JPD_Decode(MS_U32 u32SrcAddr, MS_U32 u32SrcSize) { UBOOT_TRACE("IN\n"); TARGET_LOGO_ADDR =MS_PA2KSEG1(u32SrcAddr) ; TARGET_LOGO_SIZE = u32SrcSize; MsDrv_JpdInit(); if(u32ReadBuffPA==0xFFFF || u32WriteBuffPA==0xFFFF ||u32InterBuffPA==0xFFFF) { UBOOT_ERROR("Get Mmap for JPD Fail Skip JPD Decode !!! \n"); return -1; } //Preload data for init JPEG decoder data. s32InitByteRead = MsDrv_FILE_read((MS_U8 *)u32ReadBuffVirAddr, u32ReadBuffSize, &u8EOF_flag); if(s32InitByteRead < 0) { UBOOT_ERROR("Initial read file error!!\n"); return -1; } MsDrv_JpdStartDecode(E_JPD_MAIN_DECODE); UBOOT_TRACE("OK\n"); return 1; }
U32 vfs_getsize(char *filedir) { U32 filesize = 0; int ret = 0; char *buffer=NULL; UBOOT_TRACE("IN\n"); if(filedir==NULL) { UBOOT_ERROR("filedir is a null pointer\n"); return -1; } if(bVfsReady==FALSE) { UBOOT_ERROR("filesystem is not mounted\n"); return -1; } buffer=malloc(CMD_BUF); if(buffer==NULL) { UBOOT_ERROR("malloc buffer fail\n"); return -1; } memset(buffer,0,CMD_BUF); #ifdef KONKA_BOOT_CFG printf("mingwu_mboot----vfs_getsize->filedir = %s\n",filedir); if(strncmp(filedir, "/customercfg/",13)==0) { printf("mingwu_mboot----------vfs_getsize--=000=\n"); filedir +=13;//skip /customercfg mmc_volume="customercfg"; snprintf(buffer, CMD_BUF, "ext4filesize mmc 0:0xA %s %x",filedir,(U32)&filesize); } else { printf("mingwu_mboot----------vfs_getsize--=111=\n"); snprintf(buffer, CMD_BUF, "ext4filesize mmc 0:%s %s %x",mmc_volume,filedir,(U32)&filesize); } #else //snprintf(cmd, CMD_BUF, "ext4filesize mmc 0:%s %s",mmc_partition,filedir); snprintf(buffer, CMD_BUF, "ext4filesize mmc 0:%s %s %x",mmc_volume,filedir,(U32)&filesize); #endif UBOOT_DEBUG("cmd=%s\n",buffer); ret=run_command(buffer, 0); if(ret==-1) { UBOOT_DEBUG("ext4filesize mmc fail\n"); filesize=0; } else { UBOOT_TRACE("OK\n"); } free(buffer); return filesize; }
void MsDrv_kernelProtect(MS_U8 u8Blockx,MS_U32 u32Lx1Start, MS_U32 u32Lx1End) { UBOOT_TRACE("IN\n"); MsDrv_MiuInit(); MS_U8 u8MIUProtectkernel_ID[16]={0}; // ==== Linux kernel ID Protect UBOOT_DEBUG("Kernel Protect Index[%d] LX[0x%lx][0x%lx] \n",u8Blockx,u32Lx1Start,u32Lx1End); #if ENABLE_NIKON u8MIUProtectkernel_ID[0] = MIU_CLIENT_MIPS_RW; //MIPS W u8MIUProtectkernel_ID[1] = MIU_CLIENT_BDMA_RW;//MIU_CLIENT_NAND_RW;//MIU_CLIENT_BDMA_RW; //BDMA u8MIUProtectkernel_ID[2] = MIU_CLIENT_USB_UHC0_RW; //USB0 u8MIUProtectkernel_ID[3] = MIU_CLIENT_USB_UHC1_RW; //USB1 u8MIUProtectkernel_ID[4] = MIU_CLIENT_USB_UHC2_RW; //USB2 u8MIUProtectkernel_ID[5] = MIU_CLIENT_FCIE_RW;//MIU_CLIENT_G3D_RW; //G3D // u8MIUProtectkernel_ID[6] = MIU_CLIENT_USB3_RW; //USB3.0 // u8MIUProtectkernel_ID[7] = MIU_CLIENT_SDIO_RW; //SD IO // u8MIUProtectkernel_ID[8] = MIU_CLIENT_SATA_RW; //SATA #else u8MIUProtectkernel_ID[0] = MIU_CLIENT_MIPS_RW; //MIPS W u8MIUProtectkernel_ID[1] = MIU_CLIENT_NAND_RW;//MIU_CLIENT_BDMA_RW; //BDMA u8MIUProtectkernel_ID[2] = MIU_CLIENT_USB_UHC0_RW; //USB0 u8MIUProtectkernel_ID[3] = MIU_CLIENT_USB_UHC1_RW; //USB1 u8MIUProtectkernel_ID[4] = MIU_CLIENT_USB_UHC2_RW; //USB2 u8MIUProtectkernel_ID[5] = MIU_CLIENT_G3D_RW; //G3D u8MIUProtectkernel_ID[6] = MIU_CLIENT_USB3_RW; //USB3.0 u8MIUProtectkernel_ID[7] = MIU_CLIENT_SDIO_RW; //SD IO u8MIUProtectkernel_ID[8] = MIU_CLIENT_SATA_RW; //SATA u8MIUProtectkernel_ID[9] = MIU_CLIENT_USB_UHC3_RW; //USB3 #endif MsDrv_MIU_Protect(u8Blockx, &u8MIUProtectkernel_ID[0], u32Lx1Start, u32Lx1End, ENABLE); UBOOT_TRACE("OK\n"); }
int vfs_umount(void) { int ret = 0; UBOOT_TRACE("IN\n"); mmc_volume = ""; bVfsReady=FALSE; UBOOT_TRACE("OK\n"); return ret; }
//-------------------------------------------------------------------------------------------------- static void MsDrv_SetStatus(void) { UBOOT_TRACE("IN\n"); if( g_state == E_JPEG_DECODE_DONE ) { UBOOT_DEBUG("MsDrv_SetStatus:E_JPEG_DECODE_DONE\n"); //u16ImageWidth = MApi_JPEG_GetWidth(); //u16ImageHeight = MApi_JPEG_GetHeight(); //bIsProgressive = MApi_JPEG_IsProgressive(); //u16ImageOriWidth = MApi_JPEG_GetOriginalWidth(); //u16ImageOriHeight = MApi_JPEG_GetOriginalHeight(); //u16ImageNonAlignWidth = MApi_JPEG_GetNonAlignmentWidth(); //u16ImageNonAlignHeight = MApi_JPEG_GetNonAlignmentHeight(); //u8ScaleDownFactor = MApi_JPEG_GetScaleDownFactor(); //u8DebugLevel = MApi_JPEG_GetDbgLevel(); MApi_JPEG_GetInfo(&stJPEG_Info); MApi_JPEG_GetStatus(&stJPEG_Status); MApi_JPEG_GetLibVer(&pu8JPEG_Ver); u16ImageAlignPitch = MApi_JPEG_GetAlignedPitch(), u16ImageAlignWidth = MApi_JPEG_GetAlignedWidth(), u16ImageAlignHeight = MApi_JPEG_GetAlignedHeight(); // bThumbnailFound = MApi_JPEG_ThumbnailFound(); UBOOT_DEBUG("MsDrv_SetStatus >>>>>>>>>>> w:%d, h:%d, p:%d\n",u16ImageAlignWidth,u16ImageAlignHeight,u16ImageAlignPitch); g_JpgPitch = MApi_JPEG_GetAlignedPitch(); g_JpgHeight = MApi_JPEG_GetAlignedHeight(); g_JpgWidth = MApi_JPEG_GetAlignedWidth(); MApi_JPEG_GetEXIFDateTime(&_gEXIF_DateTime); MApi_JPEG_GetEXIFOrientation(&_gEXIF_Orientation); } else if( g_state == E_JPEG_DECODE_ERR ) { UBOOT_ERROR("MsDrv_SetStatus:E_JPEG_DECODE_ERR\n"); //u16ImageWidth = MApi_JPEG_GetWidth(); //u16ImageHeight = MApi_JPEG_GetHeight(); //bIsProgressive = MApi_JPEG_IsProgressive(); //u16ImageOriWidth = MApi_JPEG_GetOriginalWidth(); //u16ImageOriHeight = MApi_JPEG_GetOriginalHeight(); //u16ImageNonAlignWidth = MApi_JPEG_GetNonAlignmentWidth(); //u16ImageNonAlignHeight = MApi_JPEG_GetNonAlignmentHeight(); //u8ScaleDownFactor = MApi_JPEG_GetScaleDownFactor(); //u16ErrorCode = MApi_JPEG_GetErrorCode(); //u8DebugLevel = MApi_JPEG_GetDbgLevel(); MApi_JPEG_GetInfo(&stJPEG_Info); MApi_JPEG_GetStatus(&stJPEG_Status); MApi_JPEG_GetLibVer(&pu8JPEG_Ver); u16ImageAlignPitch = MApi_JPEG_GetAlignedPitch(), u16ImageAlignWidth = MApi_JPEG_GetAlignedWidth(), u16ImageAlignHeight = MApi_JPEG_GetAlignedHeight(); // bThumbnailFound = MApi_JPEG_ThumbnailFound(); MApi_JPEG_GetEXIFDateTime(&_gEXIF_DateTime); MApi_JPEG_GetEXIFOrientation(&_gEXIF_Orientation); } UBOOT_TRACE("OK\n"); }
int do_spi_erase_partition ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { #if defined (CONFIG_APP_IN_SPI) #define PARTITION_NAME argv[1] int ret=0; unsigned int partiton_size=0; unsigned int partiton_offset=0; UBOOT_TRACE("IN\n"); if(argc!=ERASE_PARTITION_INPUT_LEN) { cmd_usage(cmdtp); return -1; } ret=get_spi_partition_info(PARTITION_NAME,&partiton_offset,&partiton_size); if(ret!=0) { UBOOT_ERROR("get %s info fail\n",PARTITION_NAME); return -1; } UBOOT_DEBUG("partiton_offset=0x%x\n",partiton_offset); UBOOT_DEBUG("partiton_size=0x%x\n",partiton_size); if(MDrv_SERFLASH_WriteProtect(0)==0) { UBOOT_ERROR ("SPI write protect diable fail\n"); return -1; } ret=MDrv_SERFLASH_AddressErase (partiton_offset, partiton_size, TRUE) ? 0 : -1; if(ret!=0) { UBOOT_ERROR("erase partition fail\n"); } // even erase fail, we still have to enable write protect function if(MDrv_SERFLASH_WriteProtect(1)==0) { UBOOT_ERROR ("SPI write protect enable fail\n"); return -1; } if(ret==0) { UBOOT_TRACE("OK\n"); } return ret; #undef PARTITION_NAME #else UBOOT_TRACE("IN\n"); UBOOT_ERROR("This function doesn't support\n"); return -1; #endif }
int vfs_mount(char *volume) { int ret = 0; UBOOT_TRACE("IN\n"); mmc_volume = volume; UBOOT_INFO("mmc change mount : %s\n",mmc_volume); bVfsReady=TRUE; UBOOT_TRACE("OK\n"); return ret; }
int MsApiChunkHeader_Init(void) { U32 u32ChunkHeaderOffset = 0; int ret = -1; UBOOT_TRACE("IN\n"); raw_io_config_push(); ret = mboot_raw_io_Config(); if(ret != 0) { UBOOT_ERROR("raw_io_config setting fail!\n"); raw_io_config_pop(); return ret; } if(get_raw_status()==E_RAW_DATA_IN_SPI) { if(IsHouseKeepingBootingMode()==FALSE){ u32ChunkHeaderOffset = 0x30000; } else { #if(CONFIG_MSTAR_RT_PM_IN_SPI==1) u32ChunkHeaderOffset = 0x30000; #else #if defined(CONFIG_PM_SIZE_KB_FORCED) && (0!=CONFIG_PM_SIZE_KB_FORCED) u32ChunkHeaderOffset = 0x10000+(CONFIG_PM_SIZE_KB_FORCED*0x400); #else u32ChunkHeaderOffset = 0x20000; #endif #endif } #if(ENABLE_MSTAR_PUMABOOT) u32ChunkHeaderOffset = u32ChunkHeaderOffset + CONFIG_PUMABOOT_SIZE; #endif } else { u32ChunkHeaderOffset = 0; } ret = raw_read((U32)gu32ChunkHeader,u32ChunkHeaderOffset,(CH_ITEM_LAST+1)*4); raw_io_config_pop(); if(ret != 0) { UBOOT_ERROR("raw_read gu8ChunkHeader fail\n"); return -1; } ChunkHeaderReady = TRUE; UBOOT_TRACE("OK\n"); return 0; }