メモリダンプの大枠完成

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_card_test@7 ff8ce827-af98-4349-adb5-4c00699b5328
This commit is contained in:
(no author) 2010-02-22 08:14:33 +00:00
parent cf445c8195
commit ec416726f6
4 changed files with 612 additions and 306 deletions

View File

@ -2,128 +2,153 @@
using namespace nn::red::nakayama; using namespace nn::red::nakayama;
class ReadID1: public Program class ReadID1: public CardTestProgram
{ {
public: public:
virtual void Execute() virtual void Execute()
{ {
Page page; Page page;
Label title; Label title;
title.X = 20; title.X = 10;
title.Y = 10; title.Y = 10;
title.Text = "RD_ID1"; title.Text = "[RD_ID1]";
page.Add(title); page.Add(title);
Label lb0; Label lb0;
lb0.X = 100; lb0.X = 100;
lb0.Y = 50; lb0.Y = 50;
lb0.Text = "ID1_0"; lb0.Text = "ID1_0";
page.Add(lb0); page.Add(lb0);
Label lb1; Label lb1;
lb1.X = 100; lb1.X = 100;
lb1.Y = 80; lb1.Y = 80;
lb1.Text = "ID1_1"; lb1.Text = "ID1_1";
page.Add(lb1); page.Add(lb1);
Label lb2; Label lb2;
lb2.X = 100; lb2.X = 100;
lb2.Y = 110; lb2.Y = 110;
lb2.Text = "ID1_2"; lb2.Text = "ID1_2";
page.Add(lb2); page.Add(lb2);
Label lb3; Label lb3;
lb3.X = 100; lb3.X = 100;
lb3.Y = 140; lb3.Y = 140;
lb3.Text = "ID1_3"; lb3.Text = "ID1_3";
page.Add(lb3); page.Add(lb3);
KeyPad& pad = KeyPad::GetInstance(); KeyPad& pad = KeyPad::GetInstance();
while (1) while (1)
{ {
pad.ReadKey(); pad.ReadKey();
page.Show(Display::GetInstance(Display::Lower)); page.Show(Display::GetInstance(Display::Lower));
if (pad.IsTrigger(KeyPad::B)) if (pad.IsTrigger(KeyPad::A))
{ {
Display::GetInstance(Display::Lower).Clear(); // 引数:buffer, BUFFER_SIZE, TestCaseID(TID_FUNC_RDID1), detailInfo
Display::GetInstance(Display::Lower).SwapBuffer();
break; //cardFunctionTestStart();
} }
}
} if (pad.IsTrigger(KeyPad::B))
; {
Display::GetInstance(Display::Lower).Clear();
Display::GetInstance(Display::Lower).SwapBuffer();
break;
}
}
};
}; };
class ReadID2: public Program class ReadID2: public CardTestProgram
{ {
public: public:
virtual void Execute() virtual void Execute()
{ {
Page page; Page page;
Label title; Label title;
title.X = 20; title.X = 10;
title.Y = 10; title.Y = 10;
title.Text = "RD_ID2"; title.Text = "[RD_ID2]";
page.Add(title); page.Add(title);
Label lb0; Label lb0;
lb0.X = 100; lb0.X = 100;
lb0.Y = 50; lb0.Y = 50;
lb0.Text = "ID2_0"; lb0.Text = "ID2_0";
page.Add(lb0); page.Add(lb0);
Label lb1; Label lb1;
lb1.X = 100; lb1.X = 100;
lb1.Y = 80; lb1.Y = 80;
lb1.Text = "ID2_1"; lb1.Text = "ID2_1";
page.Add(lb1); page.Add(lb1);
Label lb2; Label lb2;
lb2.X = 100; lb2.X = 100;
lb2.Y = 110; lb2.Y = 110;
lb2.Text = "ID2_2"; lb2.Text = "ID2_2";
page.Add(lb2); page.Add(lb2);
Label lb3; Label lb3;
lb3.X = 100; lb3.X = 100;
lb3.Y = 140; lb3.Y = 140;
lb3.Text = "ID2_3"; lb3.Text = "ID2_3";
page.Add(lb3); page.Add(lb3);
KeyPad& pad = KeyPad::GetInstance(); KeyPad& pad = KeyPad::GetInstance();
while (1) while (1)
{ {
pad.ReadKey(); pad.ReadKey();
page.Show(Display::GetInstance(Display::Lower)); page.Show(Display::GetInstance(Display::Lower));
if (pad.IsTrigger(KeyPad::B)) if (pad.IsTrigger(KeyPad::A))
{ {
Display::GetInstance(Display::Lower).Clear(); // 引数:buffer, BUFFER_SIZE, TestCaseID(TID_FUNC_RDID2), detailInfo
Display::GetInstance(Display::Lower).SwapBuffer();
break; //cardFunctionTestStart();
} }
}
} if (pad.IsTrigger(KeyPad::B))
; {
Display::GetInstance(Display::Lower).Clear();
Display::GetInstance(Display::Lower).SwapBuffer();
break;
}
}
};
}; };
#define DUMP_NUM 0x10 #define TEMP_BUFFER_SIZE 0x90
#define DUMP_NUM 0x100
#define ONE_PAGE_SIZE 0x80
#define DUMP_MAP_BASE_X 0
#define DUMP_MUP_BASE_Y 70
class ReadSeqPageVerify: public Program class ReadSeqPageVerify: public CardTestProgram
{ {
public: public:
virtual void Execute() virtual void Execute()
{ {
Page page; Page page;
u64 dump_start_address;
u32 ofs;
size_t show_size;
Label title;
title.X = 10;
title.Y = 10;
title.Text = "[Read SeqPage with Verify]";
page.Add(title);
VariableSelector menu; VariableSelector menu;
menu.X = 10; menu.X = 10;
menu.Y = 0; menu.Y = 20;
page.Add(menu); page.Add(menu);
VariableValue<u64> address; VariableValue<u64> address;
@ -138,66 +163,186 @@ public:
Label verify; Label verify;
verify.X = 200; verify.X = 200;
verify.Y = 10; verify.Y = 50;
verify.Text = "Verify :";
page.Add(verify); page.Add(verify);
// 固定ラベル // メモリダンプ表示
Label index; Label dump[DUMP_NUM + 2];
index.X = 0; u8 temp_buffer[TEMP_BUFFER_SIZE];
index.Y = 50;
index.Text = " |00 01 02 03 04 05 06 07";
page.Add(index);
Label line; // デバッグ用
line.X = 0; for (int index=0; index<TEMP_BUFFER_SIZE; index++)
line.Y = 60;
line.Text = "---------------------------------------";
page.Add(line);
// [TODO]バッファを与えて表示できるように。その他もろもろ調整。
int start = 0x0;
Label dump[DUMP_NUM];
for(int i=0; i<DUMP_NUM; i++)
{ {
ostringstream adr; temp_buffer[index] = index & 0xff;
}
dump[i].X = 0;
dump[i].Y = 70 + 10 * i;
// アドレス表示部分 // キー操作読み出し用
adr << "0x"; KeyPad& pad = KeyPad::GetInstance();
adr.fill('0');
adr << setw(12) << right << hex << start + (0x10 * i) << "|";
// dump部分 // 表示用フラグ
for(int j=0; j<0x8; j++) bool done = false;
bool refresh = false;
ofs = 0;
show_size = 0;
// デバッグ用
verify_result = true;
// ループ
while (1)
{
pad.ReadKey();
page.Show(Display::GetInstance(Display::Lower));
if (pad.IsTrigger(KeyPad::A))
{ {
adr << setw(2) << left << hex << 0x00 + j << " "; // 引数:buffer, BUFFER_SIZE, TestCaseID(TID_FUNC_RDSEQ_WITH_VERIFY), detailInfo
//cardFunctionTestStart();
// ダンプ表示開始アドレス & 表示サイズ
dump_start_address = address.GetValue();
show_size = read_size.GetValue() > ONE_PAGE_SIZE ? ONE_PAGE_SIZE : read_size.GetValue();
// ベリファイ結果
verify.Text = verify_result ? "Verify:OK" : "Verify:NG";
// 表示用フラグ
done = true;
refresh = true;
} }
dump[i].Text = adr.str(); // 1画面分アドレスをデクリメント
if(pad.IsTrigger(KeyPad::L))
{
if( ofs >= ONE_PAGE_SIZE )
{
// ダンプ表示オフセット & 表示サイズ
ofs -= ONE_PAGE_SIZE;
show_size = ONE_PAGE_SIZE;
page.Add(dump[i]); refresh = true;
} }
}
// [TODO]ベリファイの結果に応じて変更 // 1画面分アドレスをインクリメント
if (1) if(pad.IsTrigger(KeyPad::R))
{ {
verify.Text = "Verify : OK"; // [TODO] バッファを正式なものに。バッファサイズも正式なものに。
} if( (ofs + ONE_PAGE_SIZE) < sizeof(temp_buffer) )
else {
{ // ダンプ表示オフセット & 表示サイズ
verify.Text = "Verify : NG"; ofs += ONE_PAGE_SIZE;
show_size = ONE_PAGE_SIZE;
// ケツの中途半端なバッファを表示する場合
if( (ofs + ONE_PAGE_SIZE) > sizeof(temp_buffer) )
{
show_size = sizeof(temp_buffer) - ofs;
}
refresh = true;
}
}
// メモリダンプの表示を更新
if(refresh && done)
{
NN_TLOG_("[ofs : 0x%08x]\n", ofs);
ShowMemDump( &page, dump, dump_start_address + ofs, temp_buffer + ofs, show_size );
refresh = false;
}
if (menu.Canceled)
{
menu.Canceled = false;
Display::GetInstance(Display::Lower).Clear();
Display::GetInstance(Display::Lower).SwapBuffer();
break;
}
} }
};
};
class ReadSeqPage: public CardTestProgram
{
public:
virtual void Execute()
{
Page page;
Label title;
title.X = 10;
title.Y = 10;
title.Text = "[Read SeqPage]";
page.Add(title);
VariableSelector menu;
menu.X = 10;
menu.Y = 20;
page.Add(menu);
VariableValue<u64> address;
address.SetShiftRange(16,0);
address.SetShiftBitSize(4);
menu.Register("address", address);
VariableValue<u64> read_size;
read_size.SetShiftRange(8,0);
read_size.SetShiftBitSize(4);
menu.Register("size", read_size);
// メモリダンプ表示
Label dump[DUMP_NUM + 2];
u8 temp_buffer[DUMP_NUM];
KeyPad& pad = KeyPad::GetInstance();
bool done = false;
bool refresh = false;
while (1) while (1)
{ {
pad.ReadKey();
page.Show(Display::GetInstance(Display::Lower)); page.Show(Display::GetInstance(Display::Lower));
if (pad.IsTrigger(KeyPad::A))
{
// 引数:buffer, BUFFER_SIZE, TestCaseID(TID_FUNC_RDSEQ), detailInfo
//cardFunctionTestStart();
done = true;
refresh = true;
}
// 1画面分アドレスをデクリメント
if (pad.IsTrigger(KeyPad::L))
{
refresh = true;
}
// 1画面分アドレスをインクリメント
if (pad.IsTrigger(KeyPad::R))
{
refresh = true;
}
// メモリダンプの表示を更新
if(refresh && done)
{
ShowMemDump( &page, dump, address.GetValue(), temp_buffer, sizeof(temp_buffer) );
refresh = false;
}
if (menu.Canceled) if (menu.Canceled)
{ {
menu.Canceled = false; menu.Canceled = false;
Display::GetInstance(Display::Lower).Clear();
Display::GetInstance(Display::Lower).SwapBuffer();
break; break;
} }
} }
@ -205,16 +350,22 @@ public:
}; };
class ReadSeqPage: public Program class WritePageStart: public CardTestProgram
{ {
public: public:
virtual void Execute() virtual void Execute()
{ {
Page page; Page page;
Label title;
title.X = 10;
title.Y = 10;
title.Text = "[Write Page Start]";
page.Add(title);
VariableSelector menu; VariableSelector menu;
menu.X = 10; menu.X = 10;
menu.Y = 0; menu.Y = 20;
page.Add(menu); page.Add(menu);
VariableValue<u64> address; VariableValue<u64> address;
@ -222,56 +373,65 @@ public:
address.SetShiftBitSize(4); address.SetShiftBitSize(4);
menu.Register("address", address); menu.Register("address", address);
VariableValue<u64> read_size; SelectableValue<NamedValue<int> > write_pattern;
read_size.SetShiftRange(8,0); write_pattern.Add(*(new NamedValue<int> ("0x0000", 0)));
read_size.SetShiftBitSize(4); write_pattern.Add(*(new NamedValue<int> ("0x00FF", 1)));
menu.Register("size", read_size); write_pattern.Add(*(new NamedValue<int> ("0x55AA", 2)));
write_pattern.Add(*(new NamedValue<int> ("0xFFFF", 3)));
write_pattern.Add(*(new NamedValue<int> ("DEC", 4)));
write_pattern.Add(*(new NamedValue<int> ("INC", 5)));
menu.Register("Write Pattern", write_pattern);
// 固定ラベル // メモリダンプ表示
Label index; Label dump[DUMP_NUM + 2];
index.X = 0; u8 temp_buffer[DUMP_NUM];
index.Y = 50;
index.Text = " |00 01 02 03 04 05 06 07";
page.Add(index);
Label line; KeyPad& pad = KeyPad::GetInstance();
line.X = 0;
line.Y = 60;
line.Text = "---------------------------------------";
page.Add(line);
int start = 0x0; bool done = false;
Label dump[DUMP_NUM]; bool refresh = false;
for(int i=0; i<DUMP_NUM; i++)
{
ostringstream adr;
dump[i].X = 0;
dump[i].Y = 70 + 10 * i;
// アドレス表示部分
adr << "0x";
adr.fill('0');
adr << setw(12) << right << hex << start + (0x10 * i) << "|";
// dump部分
for(int j=0; j<0x8; j++)
{
adr << setw(2) << left << hex << 0x00 + j << " ";
}
dump[i].Text = adr.str();
page.Add(dump[i]);
}
while (1) while (1)
{ {
pad.ReadKey();
page.Show(Display::GetInstance(Display::Lower)); page.Show(Display::GetInstance(Display::Lower));
if (pad.IsTrigger(KeyPad::A))
{
// 引数:buffer, BUFFER_SIZE, TestCaseID(TID_WR_PAGE_START), detailInfo
//cardFunctionTestStart();
done = true;
refresh = true;
}
// 1画面分アドレスをデクリメント
if (pad.IsTrigger(KeyPad::L))
{
refresh = true;
}
// 1画面分アドレスをインクリメント
if (pad.IsTrigger(KeyPad::R))
{
refresh = true;
}
// メモリダンプの表示を更新
if(refresh && done)
{
ShowMemDump( &page, dump, address.GetValue(), temp_buffer, sizeof(temp_buffer) );
refresh = false;
}
if (menu.Canceled) if (menu.Canceled)
{ {
menu.Canceled = false; menu.Canceled = false;
Display::GetInstance(Display::Lower).Clear();
Display::GetInstance(Display::Lower).SwapBuffer();
break; break;
} }
} }
@ -279,90 +439,22 @@ public:
}; };
class WritePageStart: public Program class WritePage: public CardTestProgram
{ {
public: public:
virtual void Execute() virtual void Execute()
{ {
Page page; Page page;
Label title;
title.X = 10;
title.Y = 10;
title.Text = "[Write Page]";
page.Add(title);
VariableSelector menu; VariableSelector menu;
menu.X = 10; menu.X = 10;
menu.Y = 0; menu.Y = 20;
page.Add(menu);
VariableValue<u64> address;
address.SetShiftRange(16,0);
address.SetShiftBitSize(4);
menu.Register("address", address);
VariableValue<u64> read_size;
read_size.SetShiftRange(8,0);
read_size.SetShiftBitSize(4);
menu.Register("size", read_size);
// 固定ラベル
Label index;
index.X = 0;
index.Y = 50;
index.Text = " |00 01 02 03 04 05 06 07";
page.Add(index);
Label line;
line.X = 0;
line.Y = 60;
line.Text = "---------------------------------------";
page.Add(line);
int start = 0x0;
Label dump[DUMP_NUM];
for(int i=0; i<DUMP_NUM; i++)
{
ostringstream adr;
dump[i].X = 0;
dump[i].Y = 70 + 10 * i;
// アドレス表示部分
adr << "0x";
adr.fill('0');
adr << setw(12) << right << hex << start + (0x10 * i) << "|";
// dump部分
for(int j=0; j<0x8; j++)
{
adr << setw(2) << left << hex << 0x00 + j << " ";
}
dump[i].Text = adr.str();
page.Add(dump[i]);
}
while (1)
{
page.Show(Display::GetInstance(Display::Lower));
if (menu.Canceled)
{
menu.Canceled = false;
break;
}
}
};
};
class WritePage: public Program
{
public:
virtual void Execute()
{
Page page;
VariableSelector menu;
menu.X = 10;
menu.Y = 50;
page.Add(menu); page.Add(menu);
SelectableValue<NamedValue<int> > write_pattern; SelectableValue<NamedValue<int> > write_pattern;
@ -374,13 +466,56 @@ public:
write_pattern.Add(*(new NamedValue<int> ("INC", 5))); write_pattern.Add(*(new NamedValue<int> ("INC", 5)));
menu.Register("Write Pattern", write_pattern); menu.Register("Write Pattern", write_pattern);
// メモリダンプ表示
Label dump[DUMP_NUM + 2];
u8 temp_buffer[DUMP_NUM];
KeyPad& pad = KeyPad::GetInstance();
bool done = false;
bool refresh = false;
while (1) while (1)
{ {
pad.ReadKey();
page.Show(Display::GetInstance(Display::Lower)); page.Show(Display::GetInstance(Display::Lower));
if (pad.IsTrigger(KeyPad::A))
{
// 引数:buffer, BUFFER_SIZE, TestCaseID(TID_WR_PAGE), detailInfo
//cardFunctionTestStart();
done = true;
refresh = true;
}
// 1画面分アドレスをデクリメント
if (pad.IsTrigger(KeyPad::L))
{
refresh = true;
}
// 1画面分アドレスをインクリメント
if (pad.IsTrigger(KeyPad::R))
{
refresh = true;
}
// メモリダンプの表示を更新
if(refresh && done)
{
ShowMemDump( &page, dump, 0x0, temp_buffer, sizeof(temp_buffer) );
refresh = false;
}
if (menu.Canceled) if (menu.Canceled)
{ {
menu.Canceled = false; menu.Canceled = false;
Display::GetInstance(Display::Lower).Clear();
Display::GetInstance(Display::Lower).SwapBuffer();
break; break;
} }
} }
@ -388,16 +523,22 @@ public:
}; };
class ReadWREXE: public Program class ReadWREXE: public CardTestProgram
{ {
public: public:
virtual void Execute() virtual void Execute()
{ {
Page page; Page page;
Label title;
title.X = 10;
title.Y = 10;
title.Text = "[Read WREXE]";
page.Add(title);
VariableSelector menu; VariableSelector menu;
menu.X = 10; menu.X = 10;
menu.Y = 0; menu.Y = 20;
page.Add(menu); page.Add(menu);
VariableValue<u64> address; VariableValue<u64> address;
@ -405,56 +546,56 @@ public:
address.SetShiftBitSize(4); address.SetShiftBitSize(4);
menu.Register("address", address); menu.Register("address", address);
VariableValue<u64> read_size; // メモリダンプ表示
read_size.SetShiftRange(8,0); Label dump[DUMP_NUM + 2];
read_size.SetShiftBitSize(4); u8 temp_buffer[DUMP_NUM];
menu.Register("size", read_size);
// 固定ラベル KeyPad& pad = KeyPad::GetInstance();
Label index;
index.X = 0;
index.Y = 50;
index.Text = " |00 01 02 03 04 05 06 07";
page.Add(index);
Label line; bool done = false;
line.X = 0; bool refresh = false;
line.Y = 60;
line.Text = "---------------------------------------";
page.Add(line);
int start = 0x0;
Label dump[DUMP_NUM];
for(int i=0; i<DUMP_NUM; i++)
{
ostringstream adr;
dump[i].X = 0;
dump[i].Y = 70 + 10 * i;
// アドレス表示部分
adr << "0x";
adr.fill('0');
adr << setw(12) << right << hex << start + (0x10 * i) << "|";
// dump部分
for(int j=0; j<0x8; j++)
{
adr << setw(2) << left << hex << 0x00 + j << " ";
}
dump[i].Text = adr.str();
page.Add(dump[i]);
}
while (1) while (1)
{ {
pad.ReadKey();
page.Show(Display::GetInstance(Display::Lower)); page.Show(Display::GetInstance(Display::Lower));
if (pad.IsTrigger(KeyPad::A))
{
// 引数:buffer, BUFFER_SIZE, TestCaseID(TID_RD_WREXE), detailInfo
//cardFunctionTestStart();
done = true;
refresh = true;
}
// 1画面分アドレスをデクリメント
if (pad.IsTrigger(KeyPad::L))
{
refresh = true;
}
// 1画面分アドレスをインクリメント
if (pad.IsTrigger(KeyPad::R))
{
refresh = true;
}
// メモリダンプの表示を更新
if(refresh && done)
{
ShowMemDump( &page, dump, address.GetValue(), temp_buffer, sizeof(temp_buffer) );
refresh = false;
}
if (menu.Canceled) if (menu.Canceled)
{ {
menu.Canceled = false; menu.Canceled = false;
Display::GetInstance(Display::Lower).Clear();
Display::GetInstance(Display::Lower).SwapBuffer();
break; break;
} }
} }
@ -462,7 +603,7 @@ public:
}; };
class ReadUID: public Program class ReadUID: public CardTestProgram
{ {
public: public:
virtual void Execute() virtual void Execute()
@ -470,9 +611,9 @@ public:
Page page; Page page;
Label title; Label title;
title.X = 20; title.X = 10;
title.Y = 10; title.Y = 10;
title.Text = "RD_UID"; title.Text = "[Read UID]";
page.Add(title); page.Add(title);
Label lb0; Label lb0;
@ -488,6 +629,13 @@ public:
pad.ReadKey(); pad.ReadKey();
page.Show(Display::GetInstance(Display::Lower)); page.Show(Display::GetInstance(Display::Lower));
if (pad.IsTrigger(KeyPad::A))
{
// 引数:buffer, BUFFER_SIZE, TestCaseID(TID_RD_UID), detailInfo
//cardFunctionTestStart();
}
if (pad.IsTrigger(KeyPad::B)) if (pad.IsTrigger(KeyPad::B))
{ {
Display::GetInstance(Display::Lower).Clear(); Display::GetInstance(Display::Lower).Clear();
@ -499,7 +647,7 @@ public:
}; };
class ReadRefresh: public Program class ReadRefresh: public CardTestProgram
{ {
public: public:
virtual void Execute() virtual void Execute()
@ -507,9 +655,9 @@ public:
Page page; Page page;
Label title; Label title;
title.X = 20; title.X = 10;
title.Y = 10; title.Y = 10;
title.Text = "RD_REFRESH"; title.Text = "[Read REFRESH]";
page.Add(title); page.Add(title);
Label lb0; Label lb0;
@ -525,6 +673,13 @@ public:
pad.ReadKey(); pad.ReadKey();
page.Show(Display::GetInstance(Display::Lower)); page.Show(Display::GetInstance(Display::Lower));
if (pad.IsTrigger(KeyPad::A))
{
// 引数:buffer, BUFFER_SIZE, TestCaseID(TID_RD_REFRESH), detailInfo
//cardFunctionTestStart();
}
if (pad.IsTrigger(KeyPad::B)) if (pad.IsTrigger(KeyPad::B))
{ {
Display::GetInstance(Display::Lower).Clear(); Display::GetInstance(Display::Lower).Clear();
@ -536,7 +691,7 @@ public:
}; };
class ReadUndefinedCommand: public Program class ReadUndefinedCommand: public CardTestProgram
{ {
public: public:
virtual void Execute() virtual void Execute()
@ -573,7 +728,7 @@ public:
}; };
class CommandTest: public Program class CommandTest: public CardTestProgram
{ {
virtual void Execute() virtual void Execute()
{ {
@ -591,7 +746,7 @@ class CommandTest: public Program
date.Text = __DATE__; date.Text = __DATE__;
page.Add(date); page.Add(date);
Selector<Program> menu; Selector<CardTestProgram> menu;
menu.X = 20; menu.X = 20;
menu.Y = 40; menu.Y = 40;
page.Add(menu); page.Add(menu);

View File

@ -2,7 +2,7 @@
using namespace nn::red::nakayama; using namespace nn::red::nakayama;
class CardFunctionTest: public Program class CardFunctionTest: public CardTestProgram
{ {
public: public:
virtual void Execute() virtual void Execute()
@ -10,6 +10,19 @@ public:
bool run = false; bool run = false;
Page page; Page page;
Label title;
title.X = 10;
title.Y = 10;
if ( card_type == CARD_TYPE_S1 )
{
title.Text = "[S1 Function Test]";
}
else
{
title.Text = "[S2 Function Test]";
}
page.Add(title);
Label running; Label running;
running.X = 120; running.X = 120;
running.Y = 100; running.Y = 100;
@ -41,6 +54,10 @@ public:
if( !run ) if( !run )
{ {
run = true; run = true;
// S1なら 引数:buffer, BUFFER_SIZE, TestCaseID(TID_FUNC_TEST1), detailInfo
// S2なら 引数:buffer, BUFFER_SIZE, TestCaseID(TID_FUNC_TEST2), detailInfo
//cardFunctionTestStart(); //cardFunctionTestStart();
} }
} }
@ -64,11 +81,72 @@ public:
}; };
}; };
class IrregularAccessTest: public Program class IrregularAccessTest: public CardTestProgram
{ {
public:
virtual void Execute()
{
bool run = false;
Page page;
Label title;
title.X = 10;
title.Y = 10;
title.Text = "[Irregular Access Test]";
page.Add(title);
Label loop;
loop.X = 10;
loop.Y = 200;
loop.Text = "Loop:";
page.Add(loop);
Label count;
count.X = 60;
count.Y = 200;
count.Text = "0000000000000";
page.Add(count);
KeyPad& pad = KeyPad::GetInstance();
while (1)
{
pad.ReadKey();
page.Show(Display::GetInstance(Display::Lower));
if (pad.IsTrigger(KeyPad::A))
{
// 実行中でなければ
if( !run )
{
run = true;
// 引数:buffer, BUFFER_SIZE, TestCaseID(TID_FUNC_INTEG), detailInfo
//cardFunctionTestStart();
}
}
if (pad.IsTrigger(KeyPad::B))
{
// 実行中であれば
if( run )
{
run = false;
cardFunctionTestEnd();
}
else
{
Display::GetInstance(Display::Lower).Clear();
Display::GetInstance(Display::Lower).SwapBuffer();
break;
}
}
}
};
}; };
class FunctionTest: public Program class FunctionTest: public CardTestProgram
{ {
virtual void Execute() virtual void Execute()
{ {
@ -87,15 +165,15 @@ class FunctionTest: public Program
date.Text = __DATE__; date.Text = __DATE__;
page.Add(date); page.Add(date);
Selector<Program> menu; Selector<CardTestProgram> menu;
menu.X = 30; menu.X = 30;
menu.Y = 40; menu.Y = 40;
page.Add(menu); page.Add(menu);
// [TODO] カードID読み出し // [TODO] カードID読み出し
card_type = CARD_TYPE_S1;
if (1) if ( card_type == CARD_TYPE_S1 )
{ {
test_label = "S1 Function Test"; test_label = "S1 Function Test";
} }

View File

@ -1747,7 +1747,61 @@ void LastAverage::Add(double value)
// //
#define DUMP_NUM 0x10
#define DUMP_MAP_BASE_X 0
#define DUMP_MUP_BASE_Y 70
#define ADR_INDEX_LABEL_NUM 0
#define ADR_LINE_LABEL_NUM 1
#define DUMP_DATA_LABEL_START_NUM 2
void ShowMemDump( Page *page, Label *lb, u64 address, u8* buffer, size_t size)
{
NN_TLOG_("-- showMemDump\n");
// NN_TLOG_("start adr:0x%08x\n", address);
// NN_TLOG_("buffer:0x%08x\n", buffer);
NN_TLOG_("size:0x%08x\n\n", size);
lb[ADR_INDEX_LABEL_NUM].X = DUMP_MAP_BASE_X;
lb[ADR_INDEX_LABEL_NUM].Y = DUMP_MUP_BASE_Y;
lb[ADR_INDEX_LABEL_NUM].Text = " |00 01 02 03 04 05 06 07";
page->Add(lb[ADR_INDEX_LABEL_NUM]);
lb[ADR_LINE_LABEL_NUM].X = DUMP_MAP_BASE_X;
lb[ADR_LINE_LABEL_NUM].Y = DUMP_MUP_BASE_Y + 5;
lb[ADR_LINE_LABEL_NUM].Text = "---------------------------------------";
page->Add(lb[ADR_LINE_LABEL_NUM]);
u32 current_size = 0;
for(int i=DUMP_DATA_LABEL_START_NUM, j=0; i<DUMP_DATA_LABEL_START_NUM+DUMP_NUM; i++, j++)
{
ostringstream adr;
lb[i].X = 0;
lb[i].Y = DUMP_MUP_BASE_Y + 10 + 10 * j;
// アドレス表示部分
adr << "0x";
adr.fill('0');
adr << setw(12) << right << hex << address + (0x8 * j) << "|";
// dump部分
for(int k=0; k<0x8; k++)
{
if( size > current_size )
{
// u32 にキャストしないとだめ(u8だと文字として扱われる)
adr << setw(2) << right << hex << (u32)buffer[current_size] << " ";
current_size++;
}
}
lb[i].Text = adr.str();
page->Add(lb[i]);
}
}
} /* nakayama */ } /* nakayama */

View File

@ -1472,6 +1472,24 @@ public:
/*!--------------------------------------------------------------------------*
@brief
Editor : Akabane
*---------------------------------------------------------------------------*/
class CardTestProgram : public Program{
public:
static settingInfo setting;
static detailInfo detail;
CardType card_type;
bool verify_result;
};
/*!--------------------------------------------------------------------------* /*!--------------------------------------------------------------------------*
@brief @brief
@ -1849,7 +1867,8 @@ public:
//}; //};
// メモリダンプ表示用関数
void ShowMemDump( Page *page, Label *lb, u64 address, u8* buffer, size_t size );
} /* nakayama */ } /* nakayama */