mirror of
https://github.com/eclipse-threadx/levelx.git
synced 2026-09-14 04:06:00 +08:00
Updated copyright headers and removed trailing whitespace
This commit is contained in:
@@ -38,7 +38,7 @@ void thread_0_entry(ULONG thread_input);
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
|
||||
/* Enter the ThreadX kernel. */
|
||||
#ifndef LX_STANDALONE_ENABLE
|
||||
tx_kernel_enter();
|
||||
@@ -56,8 +56,8 @@ void tx_application_define(void *first_unused_memory)
|
||||
|
||||
|
||||
/* Create the main thread. */
|
||||
tx_thread_create(&thread_0, "thread 0", thread_0_entry, 0,
|
||||
thread_0_stack, DEMO_STACK_SIZE,
|
||||
tx_thread_create(&thread_0, "thread 0", thread_0_entry, 0,
|
||||
thread_0_stack, DEMO_STACK_SIZE,
|
||||
1, 1, TX_NO_TIME_SLICE, TX_AUTO_START);
|
||||
}
|
||||
#endif
|
||||
@@ -72,13 +72,13 @@ UINT status;
|
||||
|
||||
ULONG *word_ptr;
|
||||
|
||||
|
||||
|
||||
/* Initialize LevelX. */
|
||||
_lx_nor_flash_initialize();
|
||||
|
||||
|
||||
/* Test 1: Simple write 100 sectors and read 100 sectors. */
|
||||
printf("Test 1: Simple write-read 100 sectors...........");
|
||||
|
||||
|
||||
lx_nor_flash_format(&nor_sim_flash, "sim nor flash", _lx_nor_flash_simulator_initialize, NULL);
|
||||
lx_nor_flash_open(&nor_sim_flash, "sim nor flash", _lx_nor_flash_simulator_initialize);
|
||||
#ifndef LX_NOR_DISABLE_EXTENDED_CACHE
|
||||
@@ -115,9 +115,9 @@ lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_
|
||||
{
|
||||
for (j = 0; j < 128; j++)
|
||||
buffer[j] = i;
|
||||
|
||||
|
||||
status = lx_nor_flash_sector_write(&nor_sim_flash, i, buffer);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -129,13 +129,13 @@ lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Read back 100 sectors... */
|
||||
for (i = 0; i < 100; i++)
|
||||
{
|
||||
|
||||
|
||||
status = lx_nor_flash_sector_read(&nor_sim_flash, i, buffer);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -146,10 +146,10 @@ lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (j = 0; j < 128; j++)
|
||||
{
|
||||
|
||||
|
||||
if (buffer[j] != i)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -198,9 +198,9 @@ lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_
|
||||
/* Release 100 sectors... */
|
||||
for (i = 0; i < 100; i++)
|
||||
{
|
||||
|
||||
|
||||
status = lx_nor_flash_sector_release(&nor_sim_flash, i);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -262,9 +262,9 @@ lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_
|
||||
|
||||
/* Test 2: Write same sector 120 times. */
|
||||
printf("Test 2: Write same sector 120 times.............");
|
||||
|
||||
/* Reinitialize... */
|
||||
|
||||
|
||||
/* Reinitialize... */
|
||||
|
||||
lx_nor_flash_initialize();
|
||||
lx_nor_flash_format(&nor_sim_flash, "sim nor flash", _lx_nor_flash_simulator_initialize, NULL);
|
||||
lx_nor_flash_open(&nor_sim_flash, "sim nor flash", _lx_nor_flash_simulator_initialize);
|
||||
@@ -274,15 +274,15 @@ lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_
|
||||
|
||||
for (j = 0; j < 128; j++)
|
||||
buffer[j] = 0xFFFFFFFF;
|
||||
|
||||
|
||||
/* Write same sector 120 sectors.... */
|
||||
for (i = 0; i < 120; i++)
|
||||
{
|
||||
for (j = 0; j < 128; j++)
|
||||
buffer[j] = i;
|
||||
|
||||
|
||||
status = lx_nor_flash_sector_write(&nor_sim_flash, 7, buffer);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -293,9 +293,9 @@ lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
status = lx_nor_flash_sector_read(&nor_sim_flash, 7, readbuffer);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -306,10 +306,10 @@ lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (j = 0; j < 128; j++)
|
||||
{
|
||||
|
||||
|
||||
if (buffer[j] != readbuffer[j])
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -321,7 +321,7 @@ lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Write other sectors just to have additional sectors to manage. */
|
||||
if (i == 1)
|
||||
lx_nor_flash_sector_write(&nor_sim_flash, 1, buffer);
|
||||
@@ -343,7 +343,7 @@ lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_
|
||||
|
||||
status = lx_nor_flash_defragment(&nor_sim_flash);
|
||||
|
||||
|
||||
|
||||
status = lx_nor_flash_sector_read(&nor_sim_flash, 7, readbuffer);
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
@@ -535,7 +535,7 @@ lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_
|
||||
}
|
||||
|
||||
status = lx_nor_flash_defragment(&nor_sim_flash);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -546,13 +546,13 @@ lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Point at the simulated NOR flash memory. */
|
||||
word_ptr = nor_sim_flash.lx_nor_flash_base_address;
|
||||
|
||||
|
||||
status = lx_nor_flash_close(&nor_sim_flash);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -564,14 +564,14 @@ lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_
|
||||
}
|
||||
}
|
||||
printf("SUCCESS!\n");
|
||||
|
||||
/* Test 3: Corrupt block 0, simulate a power interruption during erase of block 0,
|
||||
|
||||
/* Test 3: Corrupt block 0, simulate a power interruption during erase of block 0,
|
||||
after the erase, but before the free bit map and erase count is setup. */
|
||||
printf("Test 3: Block erase-initialize interrupted......");
|
||||
word_ptr[0] = 0xFFFFFFFF;
|
||||
word_ptr[3] = 0xFFFFFFFF;
|
||||
|
||||
/* Open the flash and see if we recover properly. */
|
||||
/* Open the flash and see if we recover properly. */
|
||||
status = lx_nor_flash_open(&nor_sim_flash, "sim nor flash", _lx_nor_flash_simulator_initialize);
|
||||
#ifndef LX_NOR_DISABLE_EXTENDED_CACHE
|
||||
status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_cache_memory));
|
||||
@@ -581,7 +581,7 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
(nor_sim_flash.lx_nor_flash_free_physical_sectors != 111) ||
|
||||
(nor_sim_flash.lx_nor_flash_mapped_physical_sectors != 9))
|
||||
{
|
||||
|
||||
|
||||
printf("FAILED!\n");
|
||||
#ifdef BATCH_TEST
|
||||
exit(1);
|
||||
@@ -590,9 +590,9 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
status = lx_nor_flash_close(&nor_sim_flash);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -603,12 +603,12 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/* Corrupt block 0, simulate a power interruption during erase of block 0,
|
||||
|
||||
/* Corrupt block 0, simulate a power interruption during erase of block 0,
|
||||
after the erase, and after the free bit map setup, but before erase count is setup. */
|
||||
word_ptr[0] = 0xFFFFFFFF;
|
||||
|
||||
/* Open the flash and see if we recover properly. */
|
||||
/* Open the flash and see if we recover properly. */
|
||||
status = lx_nor_flash_open(&nor_sim_flash, "sim nor flash", _lx_nor_flash_simulator_initialize);
|
||||
#ifndef LX_NOR_DISABLE_EXTENDED_CACHE
|
||||
status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_cache_memory));
|
||||
@@ -618,7 +618,7 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
(nor_sim_flash.lx_nor_flash_free_physical_sectors != 111) ||
|
||||
(nor_sim_flash.lx_nor_flash_mapped_physical_sectors != 9))
|
||||
{
|
||||
|
||||
|
||||
printf("FAILED!\n");
|
||||
#ifdef BATCH_TEST
|
||||
exit(1);
|
||||
@@ -629,7 +629,7 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
}
|
||||
|
||||
status = lx_nor_flash_close(&nor_sim_flash);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -647,7 +647,7 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
printf("Test 4: Power interrupted new block allocation..");
|
||||
word_ptr[3] = word_ptr[3] & ~((ULONG) 1);
|
||||
|
||||
/* Open the flash and see if we recover properly. */
|
||||
/* Open the flash and see if we recover properly. */
|
||||
status = lx_nor_flash_open(&nor_sim_flash, "sim nor flash", _lx_nor_flash_simulator_initialize);
|
||||
#ifndef LX_NOR_DISABLE_EXTENDED_CACHE
|
||||
status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_cache_memory));
|
||||
@@ -657,7 +657,7 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
(nor_sim_flash.lx_nor_flash_free_physical_sectors != 110) ||
|
||||
(nor_sim_flash.lx_nor_flash_mapped_physical_sectors != 9))
|
||||
{
|
||||
|
||||
|
||||
printf("FAILED!\n");
|
||||
#ifdef BATCH_TEST
|
||||
exit(1);
|
||||
@@ -666,9 +666,9 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
status = lx_nor_flash_close(&nor_sim_flash);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -684,7 +684,7 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
anything else can be done. */
|
||||
word_ptr[(16*128)+3] = 0x7C00;
|
||||
|
||||
/* Open the flash and see if we recover properly. */
|
||||
/* Open the flash and see if we recover properly. */
|
||||
status = lx_nor_flash_open(&nor_sim_flash, "sim nor flash", _lx_nor_flash_simulator_initialize);
|
||||
#ifndef LX_NOR_DISABLE_EXTENDED_CACHE
|
||||
status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_cache_memory));
|
||||
@@ -694,7 +694,7 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
(nor_sim_flash.lx_nor_flash_free_physical_sectors != 109) ||
|
||||
(nor_sim_flash.lx_nor_flash_mapped_physical_sectors != 9))
|
||||
{
|
||||
|
||||
|
||||
printf("FAILED!\n");
|
||||
#ifdef BATCH_TEST
|
||||
exit(1);
|
||||
@@ -705,7 +705,7 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
}
|
||||
|
||||
status = lx_nor_flash_close(&nor_sim_flash);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -722,8 +722,8 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
setup. */
|
||||
word_ptr[3] = 0x7FFC;
|
||||
word_ptr[(16*128)+6] = word_ptr[(16*128)+6] & ~((ULONG) 0x40000000);
|
||||
|
||||
/* Open the flash and see if we recover properly. */
|
||||
|
||||
/* Open the flash and see if we recover properly. */
|
||||
status = lx_nor_flash_open(&nor_sim_flash, "sim nor flash", _lx_nor_flash_simulator_initialize);
|
||||
#ifndef LX_NOR_DISABLE_EXTENDED_CACHE
|
||||
status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_cache_memory));
|
||||
@@ -733,7 +733,7 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
(nor_sim_flash.lx_nor_flash_free_physical_sectors != 108) ||
|
||||
(nor_sim_flash.lx_nor_flash_mapped_physical_sectors != 9))
|
||||
{
|
||||
|
||||
|
||||
printf("FAILED!\n");
|
||||
#ifdef BATCH_TEST
|
||||
exit(1);
|
||||
@@ -744,7 +744,7 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
}
|
||||
|
||||
lx_nor_flash_close(&nor_sim_flash);
|
||||
|
||||
|
||||
/* Simulate a power interruption after a new sector is allocated, after data
|
||||
had been copied, and the superceeded bit is clear, the new entry is setup, but the old entry
|
||||
has not been invalidated. */
|
||||
@@ -754,8 +754,8 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
{
|
||||
word_ptr[(3*128)+i] = 0x70;
|
||||
}
|
||||
|
||||
/* Open the flash and see if we recover properly. */
|
||||
|
||||
/* Open the flash and see if we recover properly. */
|
||||
status = lx_nor_flash_open(&nor_sim_flash, "sim nor flash", _lx_nor_flash_simulator_initialize);
|
||||
#ifndef LX_NOR_DISABLE_EXTENDED_CACHE
|
||||
status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_cache_memory));
|
||||
@@ -765,7 +765,7 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
(nor_sim_flash.lx_nor_flash_free_physical_sectors != 107) ||
|
||||
(nor_sim_flash.lx_nor_flash_mapped_physical_sectors != 9))
|
||||
{
|
||||
|
||||
|
||||
printf("FAILED!\n");
|
||||
#ifdef BATCH_TEST
|
||||
exit(1);
|
||||
@@ -966,7 +966,7 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
}
|
||||
|
||||
status = lx_nor_flash_defragment(&nor_sim_flash);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -977,10 +977,10 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
status = lx_nor_flash_defragment(&nor_sim_flash);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -991,7 +991,7 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
status = lx_nor_flash_sector_read(&nor_sim_flash, 7, readbuffer);
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
@@ -1372,7 +1372,7 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
status = lx_nor_flash_sector_release(&nor_sim_flash, 7);
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
@@ -1395,9 +1395,9 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
status = lx_nor_flash_defragment(&nor_sim_flash);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -1421,24 +1421,24 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
printf("SUCCESS!\n");
|
||||
|
||||
printf("Test 5: Randow write/read sector................");
|
||||
|
||||
/*format the simulated NOR flash. */
|
||||
|
||||
|
||||
/* Open the flash. */
|
||||
|
||||
/* Open the flash. */
|
||||
status = lx_nor_flash_format(&nor_sim_flash, "sim nor flash", _lx_nor_flash_simulator_initialize, NULL);
|
||||
status = lx_nor_flash_open(&nor_sim_flash, "sim nor flash", _lx_nor_flash_simulator_initialize);
|
||||
#ifndef LX_NOR_DISABLE_EXTENDED_CACHE
|
||||
status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, sizeof(nor_cache_memory));
|
||||
#endif
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
printf("FAILED!\n");
|
||||
#ifdef BATCH_TEST
|
||||
exit(1);
|
||||
@@ -1447,15 +1447,15 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Write 100 sectors.... */
|
||||
for (i = 0; i < 100; i++)
|
||||
{
|
||||
for (j = 0; j < 128; j++)
|
||||
buffer[j] = i;
|
||||
|
||||
|
||||
status = lx_nor_flash_sector_write(&nor_sim_flash, i, buffer);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -1467,13 +1467,13 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Read back 100 sectors... */
|
||||
for (i = 0; i < 100; i++)
|
||||
{
|
||||
|
||||
|
||||
status = lx_nor_flash_sector_read(&nor_sim_flash, i, buffer);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -1484,10 +1484,10 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (j = 0; j < 128; j++)
|
||||
{
|
||||
|
||||
|
||||
if (buffer[j] != i)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -1500,18 +1500,18 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Now, perform 1000 sector writes to randomly selected sectors, each time
|
||||
reading first to make sure the previous contents are valid. */
|
||||
for (i = 0; i < 1000; i++)
|
||||
{
|
||||
|
||||
|
||||
/* Pickup random sector. */
|
||||
sector = (rand() % 100);
|
||||
|
||||
/* Read that sector. */
|
||||
status = lx_nor_flash_sector_read(&nor_sim_flash, sector, buffer);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -1522,10 +1522,10 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (j = 0; j < 128; j++)
|
||||
{
|
||||
|
||||
|
||||
if ((buffer[j] & 0x0000FFFF) != sector)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -1541,10 +1541,10 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
/* Include the itteraction in the buffer to generate a new write. */
|
||||
for (j = 0; j < 128; j++)
|
||||
{
|
||||
|
||||
|
||||
buffer[j] = (buffer[j] & 0x0000FFFF) | (i << 16);
|
||||
}
|
||||
|
||||
|
||||
status = lx_nor_flash_sector_write(&nor_sim_flash, sector, buffer);
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
@@ -1558,9 +1558,9 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
status = lx_nor_flash_close(&nor_sim_flash);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -1578,15 +1578,15 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory, s
|
||||
/* Format the simulated NOR flash. */
|
||||
status = lx_nor_flash_format(&nor_sim_flash, "sim nor flash", _lx_nor_flash_simulator_initialize, NULL);
|
||||
|
||||
/* Open the flash. */
|
||||
/* Open the flash. */
|
||||
status = lx_nor_flash_open(&nor_sim_flash, "sim nor flash", _lx_nor_flash_simulator_initialize);
|
||||
#ifndef LX_NOR_DISABLE_EXTENDED_CACHE
|
||||
status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory2, sizeof(nor_cache_memory2));
|
||||
#endif
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
printf("FAILED!\n");
|
||||
#ifdef BATCH_TEST
|
||||
exit(1);
|
||||
@@ -1601,9 +1601,9 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory2,
|
||||
{
|
||||
for (j = 0; j < 128; j++)
|
||||
buffer[j] = i;
|
||||
|
||||
|
||||
status = lx_nor_flash_sector_write(&nor_sim_flash, i, buffer);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -1615,13 +1615,13 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory2,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Read back 100 sectors... */
|
||||
for (i = 0; i < 100; i++)
|
||||
{
|
||||
|
||||
|
||||
status = lx_nor_flash_sector_read(&nor_sim_flash, i, buffer);
|
||||
|
||||
|
||||
if (status != LX_SUCCESS)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -1632,10 +1632,10 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory2,
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (j = 0; j < 128; j++)
|
||||
{
|
||||
|
||||
|
||||
if (buffer[j] != i)
|
||||
{
|
||||
printf("FAILED!\n");
|
||||
@@ -1648,7 +1648,7 @@ status += lx_nor_flash_extended_cache_enable(&nor_sim_flash, nor_cache_memory2,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef BATCH_TEST
|
||||
exit(0);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user