From ae4c62df49505944043a538fc901cba1f78bd1ef Mon Sep 17 00:00:00 2001 From: yutaka Date: Tue, 8 May 2007 11:48:33 +0000 Subject: [PATCH] bug fix git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/twl_wrapsdk/trunk@69 4ee2a332-4b2b-5046-8439-1ba90f034370 --- build/tests/aes/aes-1/ARM7/src/main.c | 10 ++++---- build/tests/aes/aes-1/ARM9/src/main.c | 34 ++++++++++++++++++++------- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/build/tests/aes/aes-1/ARM7/src/main.c b/build/tests/aes/aes-1/ARM7/src/main.c index 8ffdecc..64aeda3 100644 --- a/build/tests/aes/aes-1/ARM7/src/main.c +++ b/build/tests/aes/aes-1/ARM7/src/main.c @@ -1,5 +1,5 @@ /*---------------------------------------------------------------------------* - Project: NitroSDK - AES - demos - _ARM7-aes-1 + Project: NitroSDK - AES - demos - aes-1 File: main.c Copyright 2007 Nintendo. All rights reserved. @@ -65,15 +65,15 @@ static const u32 gs_data[] ATTRIBUTE_ALIGN(32) = { 0x89abcdef, 0x01234567, 0x89abcdef, 0x01234567, 0x89abcdef, 0x01234567, 0x89abcdef, 0x01234567 }; -static u32 dataA[(sizeof(gs_data) + sizeof(u128)) / sizeof(u32)] ATTRIBUTE_ALIGN(32); -static u32 dataB[(sizeof(gs_data) + sizeof(u128)) / sizeof(u32)] ATTRIBUTE_ALIGN(32); +static u8 dataA[sizeof(gs_data) + sizeof(u128)] ATTRIBUTE_ALIGN(32); +static u8 dataB[sizeof(gs_data) + sizeof(u128)] ATTRIBUTE_ALIGN(32); //================================================================================ static void dump(const char *str, void *ptr, u32 length) { u8 *data = (u8*)ptr; int i; - OS_TPrintf("\n[%s]:\n\t", str); + OS_TPrintf("\n[%s] (%d bytes):\n\t", str, length); for (i = 0; i < length; i++) { OS_TPrintf("%02X", *data++); if ((i & 0xF) == 0xF) OS_TPrintf("\n\t"); @@ -131,7 +131,7 @@ static void test0(void) OS_TPrintf("%s: %d usec.\n", __func__, (u32)OS_TicksToMicroSeconds(OS_GetTick()-begin)); // 出力結果の表示 - dump(__func__, dataA, sizeof(gs_data)); + dump(__func__, dataA, sizeof(gs_data) + sizeof(u128)); } static void test1(void) diff --git a/build/tests/aes/aes-1/ARM9/src/main.c b/build/tests/aes/aes-1/ARM9/src/main.c index 5a3aa53..9f47054 100644 --- a/build/tests/aes/aes-1/ARM9/src/main.c +++ b/build/tests/aes/aes-1/ARM9/src/main.c @@ -61,15 +61,15 @@ static const u32 gs_data[] ATTRIBUTE_ALIGN(32) = { 0x89abcdef, 0x01234567, 0x89abcdef, 0x01234567, 0x89abcdef, 0x01234567, 0x89abcdef, 0x01234567 }; -static u32 dataA[(sizeof(gs_data) + sizeof(u128)) / sizeof(u32)] ATTRIBUTE_ALIGN(32); -static u32 dataB[(sizeof(gs_data) + sizeof(u128)) / sizeof(u32)] ATTRIBUTE_ALIGN(32); +static u8 dataA[sizeof(gs_data) + sizeof(u128)] ATTRIBUTE_ALIGN(32); +static u8 dataB[sizeof(gs_data) + sizeof(u128)] ATTRIBUTE_ALIGN(32); //================================================================================ static void dump(const char *str, void *ptr, u32 length) { u8 *data = (u8*)ptr; int i; - OS_TPrintf("\n[%s]:\n\t", str); + OS_TPrintf("\n[%s] (%d bytes):\n\t", str, length); for (i = 0; i < length; i++) { OS_TPrintf("%02X", *data++); if ((i & 0xF) == 0xF) OS_TPrintf("\n\t"); @@ -113,7 +113,7 @@ static void test0(void) #ifdef TEST0_USE_DMA_OUTPUT // 出力DMA設定 MI_CpuClear32(dataA, sizeof(dataA)); - DC_InvalidateRange(dataA, sizeof(dataA)); + DC_FlushRange(dataA, sizeof(dataA)); result = AES_StartDmaRecv(OUTPUT_DMA, dataA, sizeof(gs_data) + sizeof(u128)); // adata + pdata + mac if (AES_RESULT_SUCCESS != result) { @@ -191,7 +191,7 @@ static void test1(void) // 出力バッファのクリア MI_CpuClear32(dataB, sizeof(dataB)); - DC_InvalidateRange(dataB, sizeof(dataB)); + DC_FlushRange(dataB, sizeof(dataB)); begin = OS_GetTick(); @@ -212,9 +212,17 @@ static void test1(void) OS_TPrintf("%s: %d usec.\n", __func__, (u32)OS_TicksToMicroSeconds(OS_GetTick()-begin)); // 出力結果の表示 - dump("[test1]", dataA, sizeof(gs_data)); + dump(__func__, dataB, sizeof(gs_data)); - OS_TPrintf("Result: %s\n", AES_IsValid() ? "Success" : "Failed"); + result = AES_IsValid(); + if (AES_RESULT_SUCCESS_TRUE != result && AES_RESULT_SUCCESS_FALSE != result) + { + OS_TPrintf("%s: Failed to call AES_IsValid (%d).\n", __func__, result); + } + else + { + OS_TPrintf("Result: %s\n", AES_RESULT_SUCCESS_TRUE == result ? "Success" : "Failed"); + } } static void test2(void) @@ -240,7 +248,7 @@ static void test2(void) // 出力DMA設定 MI_CpuClear32(dataB, sizeof(dataB)); - DC_InvalidateRange(dataB, sizeof(dataB)); + DC_FlushRange(dataB, sizeof(dataB)); result = AES_StartDmaRecv(OUTPUT_DMA, dataB, sizeof(gs_data)); // adata + pdata if (AES_RESULT_SUCCESS != result) { @@ -268,7 +276,15 @@ static void test2(void) // 出力結果の表示 dump(__func__, dataB, sizeof(gs_data)); - OS_TPrintf("Result: %s\n", AES_IsValid() ? "Success" : "Failed"); + result = AES_IsValid(); + if (AES_RESULT_SUCCESS_TRUE != result && AES_RESULT_SUCCESS_FALSE != result) + { + OS_TPrintf("%s: Failed to call AES_IsValid (%d).\n", __func__, result); + } + else + { + OS_TPrintf("Result: %s\n", AES_RESULT_SUCCESS_TRUE == result ? "Success" : "Failed"); + } }