From 3be0749a186b89b3f25d08f1f9ee00e4f9b1875f Mon Sep 17 00:00:00 2001 From: miya Date: Fri, 1 May 2009 00:04:19 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E6=9C=9F=E8=A8=AD=E5=AE=9A=E3=82=B7?= =?UTF-8?q?=E3=83=BC=E3=82=B1=E3=83=B3=E3=82=B9=E3=81=AB=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@269 7061adef-622a-194b-ae81-725974e89856 --- build/tools/sctools/common/src/hwi.c | 86 +++++++++++++++++-- build/tools/sctools/common/src/my_fs_util.c | 4 + build/tools/sctools/copy_dst/Makefile | 2 +- build/tools/sctools/copy_dst/src/main.c | 34 +++++++- .../tools/sctools/my_armadillo.TWL/src/main.c | 11 ++- 5 files changed, 127 insertions(+), 10 deletions(-) diff --git a/build/tools/sctools/common/src/hwi.c b/build/tools/sctools/common/src/hwi.c index 653188a..db5d742 100644 --- a/build/tools/sctools/common/src/hwi.c +++ b/build/tools/sctools/common/src/hwi.c @@ -127,10 +127,14 @@ static BOOL ReadTWLSettings( LCFGTWLSettingsData *cfg_data ) STD_CopyMemory( (void *)cfg_data, (void *)LCFGi_GetTSD(), sizeof(LCFGTWLSettingsData) ); OS_TPrintf( "TSD read succeeded.\n" ); }else { - OS_TPrintf( "TSD read failed.\n" ); + OS_TPrintf( "TSD read func. failed.\n" ); + mprintf( "TSD read func. failed.\n" ); } OS_Free( pBuffer ); } + else { + mprintf( "TSD read alloc failed.\n" ); + } return isReadTSD; } @@ -148,14 +152,20 @@ static BOOL WriteTWLSettings( LCFGTWLSettingsData *cfg_data ) STD_CopyMemory( (void *)LCFGi_GetTSD(), (void *)cfg_data, sizeof(LCFGTWLSettingsData) ); isWriteTSD = LCFG_WriteTWLSettings( (u8 (*)[ LCFG_TEMP_BUFFER_SIZE ] )pBuffer ); if( isWriteTSD == FALSE ) { - OS_TPrintf( "TSD write failed.\n" ); - mprintf( "TSD write failed.\n" ); + OS_TPrintf( "TSD write func. failed.\n" ); + mprintf( "TSD write func. failed.\n" ); } OS_Free( pBuffer ); } + else { + mprintf( "TSD write alloc failed.\n" ); + } return isWriteTSD; } + + + BOOL MiyaBackupTWLSettings(const char *path) { FSFile f; @@ -177,6 +187,41 @@ BOOL MiyaBackupTWLSettings(const char *path) return FALSE; } + + +#if 1 + // 国が選択されていないなら適当に設定 + if( LCFG_TSD_GetCountry() == LCFG_TWL_COUNTRY_UNDEFINED ) { + switch( LCFG_THW_GetRegion() ) { + case OS_TWL_REGION_JAPAN: + cfg_data.country = LCFG_TWL_COUNTRY_JAPAN; + break; + case OS_TWL_REGION_AMERICA: + cfg_data.country = LCFG_TWL_COUNTRY_UNITED_STATES; + break; + case OS_TWL_REGION_EUROPE: + cfg_data.country = LCFG_TWL_COUNTRY_UNITED_KINGDOM; + break; + case OS_TWL_REGION_AUSTRALIA: + cfg_data.country = LCFG_TWL_COUNTRY_AUSTRALIA; + break; + case OS_TWL_REGION_CHINA: + cfg_data.country = LCFG_TWL_COUNTRY_CHINA; + break; + case OS_TWL_REGION_KOREA: + cfg_data.country = LCFG_TWL_COUNTRY_SOUTH_KOREA; + break; + case OS_TWL_REGION_MAX: + default: + // cfg_data.country = LCFG_TWL_COUNTRY_JAPAN; + mprintf("detect unknown region code..\n"); + break; + } + } +#endif + + + FS_InitFile(&f); /* delete file ? */ @@ -240,7 +285,6 @@ void MiyaReadTpCalData(void) - BOOL MiyaRestoreTWLSettings(const char *path) { FSFile f; @@ -311,13 +355,45 @@ BOOL MiyaRestoreTWLSettings(const char *path) STD_CopyMemory( (void *)&cfg_data.tp, (void *)&tp_cal_data ,sizeof(LCFGTWLTPCalibData) ); } + +#if 1 + // 国が選択されていないなら適当に設定 + if( LCFG_TSD_GetCountry() == LCFG_TWL_COUNTRY_UNDEFINED ) { + switch( LCFG_THW_GetRegion() ) { + case OS_TWL_REGION_JAPAN: + cfg_data.country = LCFG_TWL_COUNTRY_JAPAN; + break; + case OS_TWL_REGION_AMERICA: + cfg_data.country = LCFG_TWL_COUNTRY_UNITED_STATES; + break; + case OS_TWL_REGION_EUROPE: + cfg_data.country = LCFG_TWL_COUNTRY_UNITED_KINGDOM; + break; + case OS_TWL_REGION_AUSTRALIA: + cfg_data.country = LCFG_TWL_COUNTRY_AUSTRALIA; + break; + case OS_TWL_REGION_CHINA: + cfg_data.country = LCFG_TWL_COUNTRY_CHINA; + break; + case OS_TWL_REGION_KOREA: + cfg_data.country = LCFG_TWL_COUNTRY_SOUTH_KOREA; + break; + case OS_TWL_REGION_MAX: + default: + cfg_data.country = LCFG_TWL_COUNTRY_JAPAN; + mprintf("detect unknown region code..\n"); + break; + } + } +#endif + /* 実際に書き出し */ if( FALSE == WriteTWLSettings( &cfg_data ) ) { return FALSE; } // LCFG_TSD_SetCountry(LCFG_TWL_COUNTRY_JAPAN); - LCFG_TSD_SetCountry(cfg_data.country); + LCFG_TSD_SetCountry( (LCFGTWLCountryCode)cfg_data.country ); diff --git a/build/tools/sctools/common/src/my_fs_util.c b/build/tools/sctools/common/src/my_fs_util.c index bfda574..6c605fd 100644 --- a/build/tools/sctools/common/src/my_fs_util.c +++ b/build/tools/sctools/common/src/my_fs_util.c @@ -2041,6 +2041,8 @@ BOOL MydataLoadDecrypt(const char *path, void *pBuffer, int size, FSFile *log_fd readSize = my_fs_crypto_read(&f, pBuffer, (s32)size); if( readSize != size ) { miya_log_fprintf(log_fd, "%s Failed Read File: %s\n",__FUNCTION__,path); + (void)FS_CloseFile(&f); + return FALSE; } bSuccess = FS_CloseFile(&f); if( ! bSuccess ) { @@ -2691,6 +2693,8 @@ BOOL CleanSDCardFiles(char *log_file_name) } else if( STD_StrCmp(direntry.longname, "nup_log.txt") == 0 ) { } + else if( STD_StrCmp(direntry.longname, "tad") == 0 ) { + } else if( direntry.attributes & FS_ATTRIBUTE_DOS_VOLUME ) { } else { diff --git a/build/tools/sctools/copy_dst/Makefile b/build/tools/sctools/copy_dst/Makefile index 22eb3b5..ad47037 100644 --- a/build/tools/sctools/copy_dst/Makefile +++ b/build/tools/sctools/copy_dst/Makefile @@ -27,7 +27,7 @@ SRCS = main.c mfiler.c key.c font.c text.c mprintf.c logprintf.c \ hatamotolib.cpp miya_mcu.c error_report.c \ sitedefs.c wcm_control.c netconnect.c mywlan.c \ mynuc.c nuc_error_msg.c stream.c myfilename.c menu_version.c \ - ntp.c + ntp.c myimport.c TARGET_BIN = copy_dst.srl ROM_SPEC = copy_dst.rsf diff --git a/build/tools/sctools/copy_dst/src/main.c b/build/tools/sctools/copy_dst/src/main.c index b1d1ef9..2d2ece9 100644 --- a/build/tools/sctools/copy_dst/src/main.c +++ b/build/tools/sctools/copy_dst/src/main.c @@ -55,6 +55,10 @@ #include "menu_version.h" #include "ntp.h" +#include "myimport.h" + + +// #define PRE_INSTALL 1 //================================================================================ #define THREAD_COMMAND_NUP_FUNCTION 0 @@ -775,6 +779,14 @@ static BOOL RestoreFromSDCard7(void) mprintf("Original user download app. list saving failed\n"); } +#ifdef PRE_INSTALL + /* ここでプリンストールする。 */ + miya_log_fprintf(log_fd,"start Import Tad..\n"); + (void)myImportTad("sdmc:/tad/HNLJ.tad"); + miya_log_fprintf(log_fd,"end Import Tad.\n"); +#endif + + // mprintf(" "); miya_log_fprintf(log_fd,"-wireless AP conf. load.. "); mprintf("-wireless AP conf. load "); @@ -1528,9 +1540,29 @@ void TwlMain(void) break; } mprintf("\n"); - } + /****************** + + static inline LCFGTWLCountryCode LCFG_TSD_GetCountry( void ) + { + return (LCFGTWLCountryCode)LCFGi_GetTSD()->country; + } + + // 国コードのセット。 + static inline void LCFG_TSD_SetCountry( LCFGTWLCountryCode country ) + { + LCFGi_GetTSD()->country = (u8)country; + LCFGi_GetTSD_OS()->country = (u8)country; + } + + extern LCFGTWLSettingsData s_settings; + #define LCFGi_GetTSD() ( &s_settings ) + #define LCFGi_GetTSD_OS() ( (OSTWLSettingsData*)HW_PARAM_TWL_SETTINGS_DATA ) + + + + *******************/ org_fuseId = SCFG_ReadFuseData(); diff --git a/build/tools/sctools/my_armadillo.TWL/src/main.c b/build/tools/sctools/my_armadillo.TWL/src/main.c index 0784d07..0f52152 100644 --- a/build/tools/sctools/my_armadillo.TWL/src/main.c +++ b/build/tools/sctools/my_armadillo.TWL/src/main.c @@ -58,8 +58,12 @@ #define ROMHEADER_FOR_KOREA_BIT 0x40 /* 使用 DMA 番号 */ -#define DMA_NO_FATFS FATFS_DMA_4 // = 0 -#define DMA_NO_NWM NWMSP_DMA_7 +//#define DMA_NO_FATFS FATFS_DMA_4 // = 0 +//#define DMA_NO_NWM NWMSP_DMA_7 +#define DMA_NO_FATFS FATFS_DMA_4 // 0 +#define DMA_NO_NWM NWMSP_DMA_5 // 1 +#define DMA_NO_AES_SEND AES_DMA_6 // 2 +#define DMA_NO_AES_RECV AES_DMA_7 // 3 /*---------------------------------------------------------------------------* 内部関数定義 @@ -172,7 +176,8 @@ TwlSpMain(void) (void)OS_EnableInterrupts(); /* 各ライブラリ初期化 */ - AES_Init(THREAD_PRIO_AES); // AES + AES_Init(DMA_NO_AES_SEND, DMA_NO_AES_RECV, THREAD_PRIO_AES); // AES + // AES_Init(THREAD_PRIO_AES); // AES SEA_Init(THREAD_PRIO_SEA); // SEA // FS_Init(FS_DMA_NOT_USE); // FS for CARD // FS_CreateReadServerThread(THREAD_PRIO_FS); // FS for CARD