git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@55 7061adef-622a-194b-ae81-725974e89856

This commit is contained in:
miya 2008-11-27 05:41:30 +00:00
parent 644ad79921
commit 0e98d26a61
10 changed files with 234 additions and 80 deletions

View File

@ -487,33 +487,16 @@ const u32 d_CharData[0xe0 * 8] = {
};
#if 0
const u32 d_PaletteData[16][16] = {
{0x0000,0x5294,0x0000,0x0000,}, // Black
{0x0000,0x001f,0x7c00,0x001f,
0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x7c00},
{0x0000,0x001f,0x7c00,0x001f,
0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x7fff},
{0x7fff,0x7c00,0x7c00,0x7c00,}, // Blue
{0x7fff,0x7c1f,0x0000,0x0000,}, //
{0x7fff,0x7fe0,0x0000,0x0000,}, //
{0x7fff,0x03ff,0x0000,0x0000,}, //
{ 0x7c00,0x7fff,0x739c,0x6b5a,0x6318,0x5ad6,0x5294,0x4a52, // 0000h
0x4210,0x39ce,0x318c,0x294a,0x2108,0x18c6,0x1084,0x0842},
{0x7fff,0x0000,0x0000,0x0000,}, //
{0x7fff,0x0000,0x0000,0x0000,}, //
{0x7fff,0x0000,0x0000,0x0000,}, //
{0x7fff,0x0000,0x0000,0x0000,}, //
{0x7fff,0x0000,0x0000,0x0000,}, //
{0x7fff,0x0000,0x0000,0x0000,}, //
{0x7fff,0x0000,0x0000,0x0000,}, //
{0x7fff,0x001f,0x0000,0x0000,} //
};
0x001f0000, // red
0x03e00000, // green
0x7c000000, // blue
0x03ff0000, // yellow
0x01ff0000, // orange
0x00ef0000, // brown
0x3dff0000, // pink
0x7c1f0000, // purple
#endif
#else
const u32 d_PaletteData[8 * 16] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000, // black
0x00000000, 0x00000000, 0x00000000, 0x00000000,
@ -529,17 +512,17 @@ const u32 d_PaletteData[8 * 16] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red
0x000f0000, 0x00000000, 0x00000000, 0x00000000, // dark red
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green
0x01e00000, 0x00000000, 0x00000000, 0x00000000, // dark green
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue
0x3c000000, 0x00000000, 0x00000000, 0x00000000, // dark blue
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow
0x01ff0000, 0x00000000, 0x00000000, 0x00000000, // orange
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple
0x00ef0000, 0x00000000, 0x00000000, 0x00000000, // brown
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue
0x3dff0000, 0x00000000, 0x00000000, 0x00000000, // pink
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray
0x00000000, 0x00000000, 0x00000000, 0x00000000,
@ -549,8 +532,6 @@ const u32 d_PaletteData[8 * 16] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000
};
#endif
const u32 d_IconCharData[0x80 * 8] = {
0x00000000,0x0003d300,0x32111100,0x111cb100, // 0000h
@ -821,9 +802,7 @@ const u16 d_IconPaletteData[16 * 4] = {
0x5ee0,0x7fe0,0x7fe7,0x7fef,0x7ff7,0x7fff,0x0000,0x0000,
0x7c1f,0x7fff,0x5ef7,0x3def,0x1ce7,0x0000,0x00e7,0x01ef, // 0003h
0x02f7,0x03ff,0x1fff,0x3fff,0x5fff,0x7fff,0x0000,0x0000
};

View File

@ -61,6 +61,29 @@ void WLAN_FORCE_ON(void)
}
}
BOOL IsThisDevelopmentConsole(void)
{
/* 0 ~ 3 : bonding option information */
/*
0
1
2
3 ??
*/
u16 scfg_bonding_option = 0xffff;
scfg_bonding_option = SCFG_ReadBondingOption();
if( scfg_bonding_option == 0 ) {
/* 量産機 */
return FALSE;
}
/* 開発機 */
return TRUE;
}
/*
BOOL OS_IsAvailableWireless(void)
{

View File

@ -43,6 +43,7 @@ BOOL MiyaReadHWSecureInfo( LCFGTWLHWSecureInfo *Info );
BOOL MiyaReadHWNormalInfo_From_SD(const char *path, LCFGTWLHWNormalInfo *info);
void WLAN_FORCE_ON(void);
void MiyaReadTpCalData(void);
BOOL IsThisDevelopmentConsole(void);
#if 0
typedef struct LCFGTWLHWNormalInfo

View File

@ -258,10 +258,13 @@ BOOL LoadWlanConfigFile(char *path)
char c;
#define LINE_BUF_SIZE 256
#define LINE_BUF_SIZE 512
char line_buf[LINE_BUF_SIZE];
FS_InitFile(&f);
OS_TPrintf("%s %s\n",__FUNCTION__,path);
bSuccess = FS_OpenFileEx(&f, path, FS_FILEMODE_R);
if (bSuccess == FALSE) {
res = FS_GetArchiveResultCode(path);

View File

@ -19,13 +19,15 @@
#define M_TEXT_COLOR_DARKRED 7
#define M_TEXT_COLOR_DARKGREEN 8
#define M_TEXT_COLOR_DARKBLUE 9
#define M_TEXT_COLOR_DARKYELLOW 0xa
#define M_TEXT_COLOR_DARKPURPLE 0xb
#define M_TEXT_COLOR_DARKLIGHTBLUE 0xc
#define M_TEXT_COLOR_ORANGE 0xa
#define M_TEXT_COLOR_BROWN 0xb
#define M_TEXT_COLOR_PINK 0xc
#define M_TEXT_COLOR_GRAY 0xd
#define M_TEXT_COLOR_DARKGRAY 0xe
#define M_TEXT_COLOR_WHITE 0x0f
/* オレンジとかほしい */
typedef struct LINE_BUF_s {
int buf[LINE_BUF_X_SIZE];

View File

@ -519,7 +519,7 @@ static char CheckRegistration()
if( printf_status_flag == TRUE ) {
#define ECDL_DI_FMT "%-30s"
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "isKeyPairConfirmed", di.isKeyPairConfirmed);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "deviceId", di.deviceId);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %dll\n", "deviceId", di.deviceId);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %s\n", "serial", di.serial);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %s\n", "originalSerial", di.originalSerial);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %s\n", "accountId", di.accountId);

View File

@ -59,6 +59,7 @@
#define THREAD_COMMAND_FULL_FUNCTION 1
#define THREAD_COMMAND_WIFI_FUNCTION 2
#define THREAD_COMMAND_USERDATA_AND_WIFI_FUNCTION 3
#define THREAD_COMMAND_REBOOT_FUNCTION 4
// #define MIYA_MCU 1
@ -74,7 +75,7 @@ static BOOL ec_download_success_flag = TRUE;
static BOOL wlan_active_flag = TRUE;
static BOOL development_console_flag = FALSE;
static u8 org_region = 0;
static u64 org_fuseId = 0;
@ -89,12 +90,14 @@ static u8 WorkForNA[NA_VERSION_DATA_WORK_SIZE];
static BOOL pushed_power_button = FALSE;
static BOOL throw_pushed_power_button = FALSE;
static PMExitCallbackInfo pmexitcallbackinfo;
static void pmexitcallback(void *arg)
{
#pragma unused(arg)
/* 処理中(データ書き込み中)ならリセットをブロックしなければならない */
pushed_power_button = TRUE;
}
@ -133,7 +136,6 @@ static void SDEvents(void *userdata, FSEvent event, void *arg)
}
static MyData mydata;
static int vram_num_main = 1;
@ -185,7 +187,7 @@ static BOOL start_my_thread(u32 command)
{
OSMessage message;
if( TRUE == OS_ReceiveMessage(&MyMesgQueue_response, &message, OS_MESSAGE_NOBLOCK) ) {
(void)OS_SendMessage(&MyMesgQueue_request, (OSMessage)command, OS_MESSAGE_NOBLOCK);
(void)OS_SendMessage(&MyMesgQueue_request, (OSMessage)command, OS_MESSAGE_BLOCK);
return TRUE;
}
return FALSE;
@ -837,6 +839,13 @@ static void MyThreadProc(void *arg)
}
function_counter++;
break;
case THREAD_COMMAND_REBOOT_FUNCTION:
mprintf("%s Power button pressed!\n",__FUNCTION__);
OS_TPrintf("%s Power button pressed!\n",__FUNCTION__);
MCU_SetFreeRegister( 0x00 );
PM_ReadyToExit();
OS_Sleep(100000);
break;
default:
function_table_max = 0;
function_counter = 0;
@ -877,10 +886,16 @@ static void MyThreadProc(void *arg)
(void)MCU_SetBackLightBrightness((u8)(mydata.backlight_brightness));
OS_TPrintf("vol = %d\n",mydata.volume );
OS_TPrintf("bright = %d\n", mydata.backlight_brightness);
OS_Sleep(200000);
OS_Sleep(20);
#endif
break;
}
if( pushed_power_button == TRUE ) {
OS_TPrintf("%s Power button pressed!\n",__FUNCTION__);
MCU_SetFreeRegister( 0x00 );
PM_ReadyToExit();
pushed_power_button = FALSE;
}
OS_Sleep(200);
}
@ -912,11 +927,19 @@ static void MyThreadProcNuc(void *arg)
(void)OS_SendMessage(&MyMesgQueue_response, (OSMessage)0, OS_MESSAGE_NOBLOCK);
(void)OS_ReceiveMessage(&MyMesgQueue_request, &message, OS_MESSAGE_BLOCK);
if( (u32)message != THREAD_COMMAND_NUP_FUNCTION ) {
if( (u32)message == THREAD_COMMAND_REBOOT_FUNCTION ) {
mprintf("%s Power button pressed!\n",__FUNCTION__);
OS_TPrintf("%s Power button pressed!\n",__FUNCTION__);
MCU_SetFreeRegister( 0x00 );
PM_ReadyToExit();
pushed_power_button = FALSE;
}
else if( (u32)message != THREAD_COMMAND_NUP_FUNCTION ) {
mprintf("%s unknown command!\n",__FUNCTION__);
continue;
}
mprintf("-Wireless AP conf. load ");
if( TRUE == LoadWlanConfig() ) {
m_set_palette(tc[0], M_TEXT_COLOR_GREEN ); /* green */
@ -935,12 +958,17 @@ static void MyThreadProcNuc(void *arg)
}
mprintf("Network Update failed!\n");
OS_TPrintf("Network Update failed!\n");
while( 1 ) {
keyData = m_get_key_code();
if ( keyData & (PAD_BUTTON_A | PAD_BUTTON_START) ) {
OS_RebootSystem();
}
if( pushed_power_button == TRUE ) {
OS_TPrintf("%s Power button pressed!\n",__FUNCTION__);
MCU_SetFreeRegister( 0x00 );
PM_ReadyToExit();
pushed_power_button = FALSE;
}
OS_Sleep(20);
}
}
@ -979,6 +1007,12 @@ static void MyThreadProcNuc(void *arg)
if ( keyData & (PAD_BUTTON_A | PAD_BUTTON_START) ) {
OS_RebootSystem();
}
if( pushed_power_button == TRUE ) {
OS_TPrintf("%s Power button pressed!\n",__FUNCTION__);
MCU_SetFreeRegister( 0x00 );
PM_ReadyToExit();
pushed_power_button = FALSE;
}
OS_Sleep(20);
}
}
@ -1051,6 +1085,9 @@ void TwlMain(void)
int select_mode = 0;
u8 free_reg;
u16 BatterylevelBuf = 0;
BOOL isAcConnectedBuf = FALSE;
OS_Init();
OS_InitThread();
@ -1115,9 +1152,10 @@ void TwlMain(void)
reboot_flag = FALSE;
}
/* デバッグのために今だけ強制的にオン(UPDATE mode) */
/* miya */
// reboot_flag = TRUE;
development_console_flag = IsThisDevelopmentConsole();
if(TRUE == development_console_flag ) {
mprintf("--development console--\n");
}
PM_SetAutoExit( FALSE );
PM_SetExitCallbackInfo( &pmexitcallbackinfo,pmexitcallback, NULL);
@ -1460,6 +1498,10 @@ void TwlMain(void)
}
}
else if( s_flag && mydata.sys_ver_flag && (sys_version < sys_version_org) ) {
if(TRUE == IsThisDevelopmentConsole()) {
/* 開発機ではシステムバージョンアップが微妙なため */
goto label1;
}
m_set_palette(tc[0], M_TEXT_COLOR_RED );
mprintf("NG.\n");
m_set_palette(tc[0], M_TEXT_COLOR_YELLOW );
@ -1474,9 +1516,13 @@ void TwlMain(void)
}
}
else {
label1:
m_set_palette(tc[0], 0x2); /* green */
mprintf("OK.\n");
m_set_palette(tc[0], 0xF); /* white */
if(TRUE == development_console_flag ) {
mprintf("--development console--\n");
}
vram_num_sub = 0;
MydataLoadDecrypt_message_flag = TRUE;
@ -1671,9 +1717,40 @@ void TwlMain(void)
}
mfprintf(tc[1],"\n");
mfprintf(tc[1], "%4d/%02d/%02d %02d:%02d:%02d\n\n",
if( (loop_counter % 60) == 0 ) {
// PM_RESULT_SUCCESS
(void)PM_GetACAdapter( &isAcConnectedBuf );
(void)PM_GetBatteryLevel( &BatterylevelBuf );
}
mfprintf(tc[1], "%4d/%02d/%02d %02d:%02d:%02d ",
rtc_date.year + 2000, rtc_date.month , rtc_date.day,
rtc_time.hour , rtc_time.minute , rtc_time.second );
rtc_time.hour , rtc_time.minute , rtc_time.second );
if( isAcConnectedBuf == TRUE ) {
m_set_palette(tc[1], M_TEXT_COLOR_BLUE );
mfprintf(tc[1], "AC. \n\n");
m_set_palette(tc[1], M_TEXT_COLOR_WHITE );
}
else {
mfprintf(tc[1], "Batt.Lv ");
switch( BatterylevelBuf ) {
case 0:
case 1:
m_set_palette(tc[1], M_TEXT_COLOR_RED );
break;
case 2:
case 3:
case 4:
m_set_palette(tc[1], M_TEXT_COLOR_YELLOW );
break;
default:
m_set_palette(tc[0], M_TEXT_COLOR_GREEN );
break;
}
mfprintf(tc[1], "%d/5\n\n" , BatterylevelBuf);
m_set_palette(tc[1], M_TEXT_COLOR_WHITE );
}
if( FALSE == reboot_flag ) {
mfprintf(tc[1], "press Y button to RESTORE mode\n");
@ -1760,13 +1837,14 @@ void TwlMain(void)
MFILER_DisplayDir(tc[2], &mfiler_list_head, 0 );
}
if( pushed_power_button == TRUE ) {
MCU_SetFreeRegister( 0x00 );
// OS_TPrintf("ahondara\n");
PM_ReadyToExit();
if( (pushed_power_button == TRUE) && (throw_pushed_power_button == FALSE) ) {
if( FALSE == start_my_thread((u32)THREAD_COMMAND_REBOOT_FUNCTION) ) {
}
else {
throw_pushed_power_button = TRUE;
}
}
loop_counter++;
}

View File

@ -283,7 +283,7 @@ void MFILER_DisplayDir(TEXT_CTRL *tc, MY_ENTRY_LIST **headp, int mode )
int list_count = 0;
int backslash_count = 0;
mfprintf(tc, "page %d entry no. %d/%d\n", display_offset_y, cursor_pos_y , list_count_max);
mfprintf(tc, "page %d entry no. %d/%d\n", display_offset_y, cursor_pos_y , list_count_max+1);
m_set_palette(tc, 0x4); /* yellow */
mfprintf(tc,"-------------------------------\n");
m_set_palette(tc, 0xF); /* white */

View File

@ -146,11 +146,20 @@ NucStatus ProgressNupCheck(void)
}
if (TestState.count++ % STRING_ANIM_CNT == 0)
{
u32 num = (TestState.count / STRING_ANIM_CNT) % 3;
u32 num = (TestState.count / STRING_ANIM_CNT) % 11;
const char* msg[] = {
"Now checking list. ",
"Now checking list.. ",
"Now checking list... "};
"Now checking list. ",
"Now checking list.. ",
"Now checking list... ",
"Now checking list.... ",
"Now checking list..... ",
"Now checking list...... ",
"Now checking list....... ",
"Now checking list........ ",
"Now checking list......... ",
"Now checking list.......... ",
"Now checking list........... ",
"Now checking list............"};
mprintf("%s\r", msg[num]);
}
@ -184,22 +193,33 @@ NucStatus ProgressNupDownload(void)
{
u64 CurrentSize, TotalSize;
NucStatus status;
int error_code;
NUC_GetProgress(&CurrentSize, &TotalSize, &status);
if (status == NUC_STATUS_ERROR)
{ // ƒGƒ‰<C692>[”­<E2809D>
// NUC_GetProgress() failed in checking, error code=34303
miya_log_fprintf(log_fd, "NUC_GetProgress() failed in download, error code=%d\n", NUC_GetLastError());
mprintf("\nNUC_GetProgress() failed\n in download\n error code=%d\n", NUC_GetLastError());
error_code = NUC_GetLastError();
miya_log_fprintf(log_fd, "NUC_GetProgress failed in download, error code=%d\n", NUC_GetLastError());
mprintf("\nNUC_GetProgress failed in download\n");
ShowErrorMsg(error_code);
}
if (TestState.count++ % STRING_ANIM_CNT == 0)
{
u32 num = (TestState.count / STRING_ANIM_CNT) % 3;
u32 num = (TestState.count / STRING_ANIM_CNT) % 12;
const char* msg[] = {
"Now downloading. ",
"Now downloading.. ",
"Now downloading... "};
"Now downloading. ",
"Now downloading.. ",
"Now downloading... ",
"Now downloading.... ",
"Now downloading..... ",
"Now downloading...... ",
"Now downloading....... ",
"Now downloading........ ",
"Now downloading......... ",
"Now downloading.......... ",
"Now downloading........... ",
"Now downloading............"};
mprintf("%s\r", msg[num]);
}
@ -229,11 +249,20 @@ void ProgressNetConnect(void)
{
if (TestState.count++ % STRING_ANIM_CNT == 0)
{
u32 num = (TestState.count / STRING_ANIM_CNT) % 3;
u32 num = (TestState.count / STRING_ANIM_CNT) % 12;
const char* msg[] = {
"Connecting network. ",
"Connecting network.. ",
"Connecting network..."};
"Connecting network. ",
"Connecting network.. ",
"Connecting network... ",
"Connecting network.... ",
"Connecting network..... ",
"Connecting network...... ",
"Connecting network....... ",
"Connecting network........ ",
"Connecting network......... ",
"Connecting network.......... ",
"Connecting network........... ",
"Connecting network............"};
mprintf("%s\r", msg[num]);
}
}

View File

@ -46,6 +46,8 @@ static FSEventHook sSDHook;
static BOOL sd_card_flag = FALSE;
static BOOL no_sd_clean_flag = FALSE;
static BOOL development_console_flag = FALSE;
//static int miya_debug_level = 0;
@ -617,6 +619,8 @@ void TwlMain(void)
u32 s_timestamp;
ESError es_error_code;
int select_mode = 0;
u16 BatterylevelBuf = 0;
BOOL isAcConnectedBuf = FALSE;
OS_Init();
OS_InitThread();
@ -686,6 +690,15 @@ void TwlMain(void)
mydata.sys_ver_minor = s_minor;
}
development_console_flag = IsThisDevelopmentConsole();
if(TRUE == development_console_flag ) {
mprintf("--development console--\n");
m_set_palette(tc[0], M_TEXT_COLOR_PINK );
m_set_palette(tc[0], M_TEXT_COLOR_PURPLE );
m_set_palette(tc[0], M_TEXT_COLOR_ORANGE );
m_set_palette(tc[0], M_TEXT_COLOR_BROWN );
m_set_palette(tc[0], M_TEXT_COLOR_WHITE );
}
// •s—v<E28094>FNAM Ì<E2809A>‰Šú‰»
@ -803,9 +816,6 @@ void TwlMain(void)
MCU_SetBackLightBrightness( (u8)4 );
#endif
// static inline BOOL MCU_SetVolume( u8 volume )
// static inline BOOL MCU_SetBackLightBrightness( u8 brightness )
if( FALSE == SDCardValidation() ) {
sd_card_flag = FALSE;
m_set_palette(tc[0], 0x1); /* red */
@ -813,8 +823,6 @@ void TwlMain(void)
}
else {
sd_card_flag = TRUE;
// m_set_palette(tc[0], 0x2); /* green */
// mprintf("Detect SD Card\n");
}
m_set_palette(tc[0], 0xF); /* white */
@ -1007,9 +1015,40 @@ void TwlMain(void)
}
mfprintf(tc[1],"\n");
mfprintf(tc[1], "%4d/%02d/%02d %02d:%02d:%02d\n\n",
if( (loop_counter % 60) == 0 ) {
// PM_RESULT_SUCCESS
(void)PM_GetACAdapter( &isAcConnectedBuf );
(void)PM_GetBatteryLevel( &BatterylevelBuf );
}
mfprintf(tc[1], "%4d/%02d/%02d %02d:%02d:%02d ",
rtc_date.year + 2000, rtc_date.month , rtc_date.day,
rtc_time.hour , rtc_time.minute , rtc_time.second );
rtc_time.hour , rtc_time.minute , rtc_time.second );
if( isAcConnectedBuf == TRUE ) {
m_set_palette(tc[1], M_TEXT_COLOR_BLUE );
mfprintf(tc[1], "AC. \n\n");
m_set_palette(tc[1], M_TEXT_COLOR_WHITE );
}
else {
mfprintf(tc[1], "Batt.Lv ");
switch( BatterylevelBuf ) {
case 0:
case 1:
m_set_palette(tc[1], M_TEXT_COLOR_RED );
break;
case 2:
case 3:
case 4:
m_set_palette(tc[1], M_TEXT_COLOR_YELLOW );
break;
default:
m_set_palette(tc[0], M_TEXT_COLOR_GREEN );
break;
}
mfprintf(tc[1], "%d/5\n\n" , BatterylevelBuf);
m_set_palette(tc[1], M_TEXT_COLOR_WHITE );
}
if( select_mode == 0 ) {