From eeacdb0f702d6cb906fb46f5178e209c5aa50be2 Mon Sep 17 00:00:00 2001 From: areviu Date: Wed, 28 Feb 2018 17:44:20 +0000 Subject: removed old reg check and correct some indent git-svn-id: https://svn.code.sf.net/p/chibios/svn2/trunk@11594 110e8d01-0319-4d1e-a829-52ad28d1bb01 --- testhal/ATSAMA5D2/SDMMC/fat32test.c | 27 +++-- testhal/ATSAMA5D2/SDMMC/main.c | 2 +- testhal/ATSAMA5D2/SDMMC/mcuconf.h | 2 +- testhal/ATSAMA5D2/SDMMC/redconf.c | 22 ++-- testhal/ATSAMA5D2/SDMMC/reledgetest.c | 216 +++++++++++++++++----------------- 5 files changed, 135 insertions(+), 134 deletions(-) (limited to 'testhal') diff --git a/testhal/ATSAMA5D2/SDMMC/fat32test.c b/testhal/ATSAMA5D2/SDMMC/fat32test.c index 83a199add..4a81d813d 100644 --- a/testhal/ATSAMA5D2/SDMMC/fat32test.c +++ b/testhal/ATSAMA5D2/SDMMC/fat32test.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -*/ + */ #include #include "ch.h" #include "hal.h" @@ -30,8 +30,8 @@ extern BaseSequentialStream * ts; #define DEMO_VOLUMES 2 PARTITION VolToPart[] = { - {1, 1}, /* "0:" ==> Physical drive 1, 1st partition */ - {1, 2}, /* "1:" ==> Physical drive 1, 2nd partition */ + {1, 1}, /* "0:" ==> Physical drive 1, 1st partition */ + {1, 2}, /* "1:" ==> Physical drive 1, 2nd partition */ }; const TCHAR volume_paths[DEMO_VOLUMES][3] = @@ -73,10 +73,11 @@ static FIL f_header; const char test_file_path[] = "test.txt"; //Welcome to Chibios! -const uint8_t buffer[19]={ 0x57,0x65,0x6C,0x63,0x6F, - 0x6D,0x65,0x20,0x74,0x6F, - 0x20,0x43,0x68,0x69,0x62, - 0x69,0x4F,0x53,0x21 +const uint8_t buffer[19]={ + 0x57,0x65,0x6C,0x63,0x6F, + 0x6D,0x65,0x20,0x74,0x6F, + 0x20,0x43,0x68,0x69,0x62, + 0x69,0x4F,0x53,0x21 }; static void getdir(uint8_t vi); @@ -91,17 +92,17 @@ extern CACHE_ALIGNED uint8_t data_buf[]; void fat32test_demo(void) { uint8_t i; - chprintf(ts,"Init FAT32 FS\r\n" ); + chprintf(ts,"Init FAT32 FS\r\n" ); if ( format() ) { for (i=0;i #include "ch.h" #include "hal.h" diff --git a/testhal/ATSAMA5D2/SDMMC/mcuconf.h b/testhal/ATSAMA5D2/SDMMC/mcuconf.h index 5e2eeefe3..22725886a 100644 --- a/testhal/ATSAMA5D2/SDMMC/mcuconf.h +++ b/testhal/ATSAMA5D2/SDMMC/mcuconf.h @@ -83,7 +83,7 @@ * SECUMOD */ #define HAL_USE_SECUMOD FALSE -#define SAMA_ST_USE_PIT TRUE +#define SAMA_ST_USE_PIT FALSE #define SAMA_ST_USE_TC0 FALSE #define SAMA_ST_USE_TC1 FALSE diff --git a/testhal/ATSAMA5D2/SDMMC/redconf.c b/testhal/ATSAMA5D2/SDMMC/redconf.c index 7c0647332..480af8e03 100644 --- a/testhal/ATSAMA5D2/SDMMC/redconf.c +++ b/testhal/ATSAMA5D2/SDMMC/redconf.c @@ -2,9 +2,9 @@ UTILITY. DO NOT MODIFY. Generated by configuration utility version 2.02 -*/ + */ /** @file -*/ + */ #include "hal.h" @@ -20,15 +20,15 @@ const VOLCONF gaRedVolConf[REDCONF_VOLUME_COUNT] = { - { - SDMMC_BLOCK_SIZE, //ulSectorSize - 1048576U, //ullSectorCount - 0U, //ullSectorOffset - false, //fAtomicSectorWrite - 1024U, //ulInodeCount - 2U, //bBlockIoRetries - "CHIBIVOL" - } + { + SDMMC_BLOCK_SIZE, //ulSectorSize + 1048576U, //ullSectorCount + 0U, //ullSectorOffset + false, //fAtomicSectorWrite + 1024U, //ulInodeCount + 2U, //bBlockIoRetries + "CHIBIVOL" + } }; #endif diff --git a/testhal/ATSAMA5D2/SDMMC/reledgetest.c b/testhal/ATSAMA5D2/SDMMC/reledgetest.c index e7689b6b6..2fb743113 100644 --- a/testhal/ATSAMA5D2/SDMMC/reledgetest.c +++ b/testhal/ATSAMA5D2/SDMMC/reledgetest.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -*/ + */ #include #include #include "ch.h" @@ -63,7 +63,7 @@ void relianceedge_demo(void) writefiles(volnum); chprintf(ts,"OK\r\n reading files ..\r\n" ); readfiles(); - chprintf(ts,"OK\r\n" ); + chprintf(ts,"OK\r\n" ); } } else @@ -85,97 +85,97 @@ static void writefiles(uint8_t volnum) int iByte; const char *pszVolume = gaRedVolConf[volnum].pszPathPrefix; - /* Save the current transaction point settings. */ - status = red_gettransmask( pszVolume, &ulEventMask ); - osalDbgCheck( status == 0 ); + /* Save the current transaction point settings. */ + status = red_gettransmask( pszVolume, &ulEventMask ); + osalDbgCheck( status == 0 ); - /* Disable automatic transaction points so that all of the files can be + /* Disable automatic transaction points so that all of the files can be created in one atomic operation. */ - status = red_settransmask( pszVolume, RED_TRANSACT_MANUAL ); - osalDbgCheck( status == 0 ); + status = red_settransmask( pszVolume, RED_TRANSACT_MANUAL ); + osalDbgCheck( status == 0 ); - /* Create filen files. Each created file will be + /* Create filen files. Each created file will be ( i * fsRAM_BUFFER_SIZE ) bytes in length, and filled with a different repeating character. */ - for( i = 1; i <= filen; i++ ) - { - /* Generate a file name. */ - sprintf( path, "/root%03d.txt", (int)i ); + for( i = 1; i <= filen; i++ ) + { + /* Generate a file name. */ + sprintf( path, "/root%03d.txt", (int)i ); - /* Print out the file name and the directory into which the file is + /* Print out the file name and the directory into which the file is being written. */ - chprintf(ts,"Creating file %s\r\n", path ); + chprintf(ts,"Creating file %s\r\n", path ); - /* Open the file, creating the file if it does not already exist. */ - filedescr = red_open( path, RED_O_CREAT|RED_O_TRUNC|RED_O_WRONLY ); - osalDbgCheck( filedescr != -1 ); + /* Open the file, creating the file if it does not already exist. */ + filedescr = red_open( path, RED_O_CREAT|RED_O_TRUNC|RED_O_WRONLY ); + osalDbgCheck( filedescr != -1 ); - /* Fill the RAM buffer with data that will be written to the file. This + /* Fill the RAM buffer with data that will be written to the file. This is just a repeating ascii character that indicates the file number. */ - memset( cRAMBuffer, ( int ) ( '0' + i ), fsRAM_BUFFER_SIZE ); + memset( cRAMBuffer, ( int ) ( '0' + i ), fsRAM_BUFFER_SIZE ); - /* Write the RAM buffer to the opened file a number of times. The + /* Write the RAM buffer to the opened file a number of times. The number of times the RAM buffer is written to the file depends on the file number, so the length of each created file will be different. */ - for( j = 0; j < i; j++ ) - { - written = red_write( filedescr, cRAMBuffer, fsRAM_BUFFER_SIZE ); - osalDbgCheck( written == fsRAM_BUFFER_SIZE ); - } - - /* Close the file so another file can be created. */ - status = red_close( filedescr ); - osalDbgCheck( status == 0 ); + for( j = 0; j < i; j++ ) + { + written = red_write( filedescr, cRAMBuffer, fsRAM_BUFFER_SIZE ); + osalDbgCheck( written == fsRAM_BUFFER_SIZE ); } - /* Commit a transaction point, atomically adding the set of files to the - transacted state. */ - status = red_transact( pszVolume ); + /* Close the file so another file can be created. */ + status = red_close( filedescr ); osalDbgCheck( status == 0 ); + } - /* Create a sub directory. */ - chprintf(ts,"Creating directory %s\r\n", pcDirectory1 ); + /* Commit a transaction point, atomically adding the set of files to the + transacted state. */ + status = red_transact( pszVolume ); + osalDbgCheck( status == 0 ); - status = red_mkdir( pcDirectory1 ); - osalDbgCheck( status == 0 ); + /* Create a sub directory. */ + chprintf(ts,"Creating directory %s\r\n", pcDirectory1 ); - /* Create a subdirectory in the new directory. */ - chprintf(ts, "Creating directory %s\r\n", pcDirectory2 ); + status = red_mkdir( pcDirectory1 ); + osalDbgCheck( status == 0 ); - status = red_mkdir( pcDirectory2 ); - osalDbgCheck( status == 0 ); + /* Create a subdirectory in the new directory. */ + chprintf(ts, "Creating directory %s\r\n", pcDirectory2 ); - /* Generate the file name. */ - sprintf( path, "%s/file.txt", pcDirectory2 ); + status = red_mkdir( pcDirectory2 ); + osalDbgCheck( status == 0 ); + + /* Generate the file name. */ + sprintf( path, "%s/file.txt", pcDirectory2 ); - /* Print out the file name and the directory into which the file is being + /* Print out the file name and the directory into which the file is being written. */ - chprintf(ts, "Writing file %s\r\n", path ); + chprintf(ts, "Writing file %s\r\n", path ); - filedescr = red_open( path, RED_O_CREAT|RED_O_TRUNC|RED_O_WRONLY ); + filedescr = red_open( path, RED_O_CREAT|RED_O_TRUNC|RED_O_WRONLY ); - /* Write the file. It is filled with incrementing ascii characters starting + /* Write the file. It is filled with incrementing ascii characters starting from '0'. */ - for( iByte = 0; iByte < fsRAM_BUFFER_SIZE; iByte++ ) - { - cRAMBuffer[ iByte ] = ( char ) ( ( int ) '0' + iByte ); - } + for( iByte = 0; iByte < fsRAM_BUFFER_SIZE; iByte++ ) + { + cRAMBuffer[ iByte ] = ( char ) ( ( int ) '0' + iByte ); + } - written = red_write( filedescr, cRAMBuffer, fsRAM_BUFFER_SIZE ); - osalDbgCheck( written == fsRAM_BUFFER_SIZE ); + written = red_write( filedescr, cRAMBuffer, fsRAM_BUFFER_SIZE ); + osalDbgCheck( written == fsRAM_BUFFER_SIZE ); - /* Finished so close the file. */ - status = red_close( filedescr ); - osalDbgCheck( status == 0 ); + /* Finished so close the file. */ + status = red_close( filedescr ); + osalDbgCheck( status == 0 ); - /* Commit a transaction point, atomically adding the set of files and + /* Commit a transaction point, atomically adding the set of files and directories to the transacted state. */ - status = red_transact( pszVolume ); - osalDbgCheck( status == 0 ); + status = red_transact( pszVolume ); + osalDbgCheck( status == 0 ); - /* Restore previous transaction point settings. */ - status = red_settransmask( pszVolume, ulEventMask ); - osalDbgCheck( status == 0 ); + /* Restore previous transaction point settings. */ + status = red_settransmask( pszVolume, ulEventMask ); + osalDbgCheck( status == 0 ); } static void readfiles(void) @@ -188,68 +188,68 @@ static void readfiles(void) int iByte; - /* Read back the files that were created by prvCreateDemoFiles(). */ - for( i = 1; i <= filen; i++ ) - { - /* Generate the file name. */ - sprintf( path, "/root%03d.txt",(int) i ); + /* Read back the files that were created by prvCreateDemoFiles(). */ + for( i = 1; i <= filen; i++ ) + { + /* Generate the file name. */ + sprintf( path, "/root%03d.txt",(int) i ); - /* Print out the file name and the directory from which the file is + /* Print out the file name and the directory from which the file is being read. */ - chprintf(ts,"Reading file %s\r\n", path ); + chprintf(ts,"Reading file %s\r\n", path ); - /* Open the file for reading. */ - filedescr = red_open( path, RED_O_RDONLY ); - osalDbgCheck( filedescr != -1 ); + /* Open the file for reading. */ + filedescr = red_open( path, RED_O_RDONLY ); + osalDbgCheck( filedescr != -1 ); - /* Read the file into the RAM buffer, checking the file contents are as + /* Read the file into the RAM buffer, checking the file contents are as expected. The size of the file depends on the file number. */ - for( j = 0; j < i; j++ ) - { - /* Start with the RAM buffer clear. */ - memset( cRAMBuffer, 0x00, fsRAM_BUFFER_SIZE ); + for( j = 0; j < i; j++ ) + { + /* Start with the RAM buffer clear. */ + memset( cRAMBuffer, 0x00, fsRAM_BUFFER_SIZE ); - lBytesRead = red_read( filedescr, cRAMBuffer, fsRAM_BUFFER_SIZE ); - osalDbgCheck( lBytesRead == fsRAM_BUFFER_SIZE ); + lBytesRead = red_read( filedescr, cRAMBuffer, fsRAM_BUFFER_SIZE ); + osalDbgCheck( lBytesRead == fsRAM_BUFFER_SIZE ); - /* Check the RAM buffer is filled with the expected data. Each + /* Check the RAM buffer is filled with the expected data. Each file contains a different repeating ascii character that indicates the number of the file. */ - for( lChar = 0; lChar < fsRAM_BUFFER_SIZE; lChar++ ) - { - osalDbgCheck( cRAMBuffer[ lChar ] == ( '0' + ( char ) i ) ); - } + for( lChar = 0; lChar < fsRAM_BUFFER_SIZE; lChar++ ) + { + osalDbgCheck( cRAMBuffer[ lChar ] == ( '0' + ( char ) i ) ); } - - /* Close the file. */ - status = red_close( filedescr ); - osalDbgCheck( status == 0 ); } - /* Generate the file name. */ - sprintf( path, "%s/file.txt", pcDirectory2 ); + /* Close the file. */ + status = red_close( filedescr ); + osalDbgCheck( status == 0 ); + } - /* Print out the file name and the directory from which the file is being + /* Generate the file name. */ + sprintf( path, "%s/file.txt", pcDirectory2 ); + + /* Print out the file name and the directory from which the file is being read. */ - chprintf(ts, "Reading file %s\r\n", path ); + chprintf(ts, "Reading file %s\r\n", path ); - /* This time the file is opened for reading. */ - filedescr = red_open( path, RED_O_RDONLY ); - osalDbgCheck( filedescr != -1 ); + /* This time the file is opened for reading. */ + filedescr = red_open( path, RED_O_RDONLY ); + osalDbgCheck( filedescr != -1 ); - /* Read the file. */ - lBytesRead = red_read( filedescr, cRAMBuffer, fsRAM_BUFFER_SIZE ); - osalDbgCheck( lBytesRead == fsRAM_BUFFER_SIZE ); + /* Read the file. */ + lBytesRead = red_read( filedescr, cRAMBuffer, fsRAM_BUFFER_SIZE ); + osalDbgCheck( lBytesRead == fsRAM_BUFFER_SIZE ); - /* Verify the file 1 byte at a time. */ - for( iByte = 0; iByte < fsRAM_BUFFER_SIZE; iByte++ ) - { - osalDbgCheck( cRAMBuffer[ iByte ] == ( char ) ( ( int ) '0' + iByte ) ); - } + /* Verify the file 1 byte at a time. */ + for( iByte = 0; iByte < fsRAM_BUFFER_SIZE; iByte++ ) + { + osalDbgCheck( cRAMBuffer[ iByte ] == ( char ) ( ( int ) '0' + iByte ) ); + } - /* Finished so close the file. */ - status = red_close( filedescr ); - osalDbgCheck( status == 0 ); + /* Finished so close the file. */ + status = red_close( filedescr ); + osalDbgCheck( status == 0 ); } @@ -259,10 +259,10 @@ static int32_t format(uint8_t volnum) int32_t ret=-1; #if REDCONF_API_POSIX_FORMAT == 1 const char *pszVolume = gaRedVolConf[volnum].pszPathPrefix; - ret = red_format(pszVolume); + ret = red_format(pszVolume); #endif - return ret; + return ret; } #endif -- cgit v1.2.3