Update version of Reliance Edge.

pull/4/head
Richard Barry 8 years ago
parent 7cce089e40
commit 7fcc976248

@ -11,5 +11,5 @@
const VOLCONF gaRedVolConf[REDCONF_VOLUME_COUNT] = const VOLCONF gaRedVolConf[REDCONF_VOLUME_COUNT] =
{ {
{ 512U, 65536U, false, 256U, "" } { 512U, 65536U, false, 256U, 0, "" }
}; };

@ -189,7 +189,6 @@
<ClInclude Include="..\..\..\FreeRTOS\Source\include\task.h" /> <ClInclude Include="..\..\..\FreeRTOS\Source\include\task.h" />
<ClInclude Include="..\..\..\FreeRTOS\Source\include\timers.h" /> <ClInclude Include="..\..\..\FreeRTOS\Source\include\timers.h" />
<ClInclude Include="..\..\Source\FreeRTOS-Plus-CLI\FreeRTOS_CLI.h" /> <ClInclude Include="..\..\Source\FreeRTOS-Plus-CLI\FreeRTOS_CLI.h" />
<ClInclude Include="..\..\Source\Reliance-Edge\os\freertos\include\ostypes.h" />
<ClInclude Include="ConfigurationFiles\FreeRTOSConfig.h" /> <ClInclude Include="ConfigurationFiles\FreeRTOSConfig.h" />
<ClInclude Include="ConfigurationFiles\redconf.h" /> <ClInclude Include="ConfigurationFiles\redconf.h" />
<ClInclude Include="ConfigurationFiles\redtypes.h" /> <ClInclude Include="ConfigurationFiles\redtypes.h" />

@ -209,9 +209,6 @@
<ClInclude Include="ConfigurationFiles\FreeRTOSConfig.h"> <ClInclude Include="ConfigurationFiles\FreeRTOSConfig.h">
<Filter>Configuration Files</Filter> <Filter>Configuration Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\Source\Reliance-Edge\os\freertos\include\ostypes.h">
<Filter>FreeRTOS+\FreeRTOS+Reliance Edge\port</Filter>
</ClInclude>
<ClInclude Include="ConfigurationFiles\redconf.h"> <ClInclude Include="ConfigurationFiles\redconf.h">
<Filter>Configuration Files</Filter> <Filter>Configuration Files</Filter>
</ClInclude> </ClInclude>

@ -1,164 +1,198 @@
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <---- /* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
Copyright (c) 2014-2015 Datalight, Inc. Copyright (c) 2014-2015 Datalight, Inc.
All Rights Reserved Worldwide. All Rights Reserved Worldwide.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; use version 2 of the License. the Free Software Foundation; use version 2 of the License.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc., with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
/* Businesses and individuals that for commercial or other reasons cannot /* Businesses and individuals that for commercial or other reasons cannot
comply with the terms of the GPLv2 license may obtain a commercial license comply with the terms of the GPLv2 license may obtain a commercial license
before incorporating Reliance Edge into proprietary software for before incorporating Reliance Edge into proprietary software for
distribution in any form. Visit http://www.datalight.com/reliance-edge for distribution in any form. Visit http://www.datalight.com/reliance-edge for
more information. more information.
*/ */
/** @file /** @file
@brief Implements block device I/O using logical blocks as the units. @brief Implements block device I/O using logical blocks as the units.
The OS block device implementations operate on sectors. The core does I/O The OS block device implementations operate on sectors. The core does I/O
in terms of logical blocks: this module translates from logical blocks to in terms of logical blocks: this module translates from logical blocks to
sectors. sectors.
*/
#include <redfs.h> If bBlockIoRetries is greater than 0 for the current volume, then this
#include <redcore.h> module will retry block device calls on failure up to the configured number
of times. This behavior caters to the type of unreliable hardware and
drivers that are sometimes found in the IoT world, where one operation may
/** @brief Read a range of logical blocks. fail but the next may still succeed.
*/
@param bVolNum The volume whose block device is being read from. #include <redfs.h>
@param ulBlockStart The first block to read. #include <redcore.h>
@param ulBlockCount The number of blocks to read.
@param pBuffer The buffer to populate with the data read.
/** @brief Read a range of logical blocks.
@return A negated ::REDSTATUS code indicating the operation result.
@param bVolNum The volume whose block device is being read from.
@retval 0 Operation was successful. @param ulBlockStart The first block to read.
@retval -RED_EIO A disk I/O error occurred. @param ulBlockCount The number of blocks to read.
@retval -RED_EINVAL Invalid parameters. @param pBuffer The buffer to populate with the data read.
*/
REDSTATUS RedIoRead( @return A negated ::REDSTATUS code indicating the operation result.
uint8_t bVolNum,
uint32_t ulBlockStart, @retval 0 Operation was successful.
uint32_t ulBlockCount, @retval -RED_EIO A disk I/O error occurred.
void *pBuffer) @retval -RED_EINVAL Invalid parameters.
{ */
REDSTATUS ret; REDSTATUS RedIoRead(
uint8_t bVolNum,
if( (bVolNum >= REDCONF_VOLUME_COUNT) uint32_t ulBlockStart,
|| (ulBlockStart >= gaRedVolume[bVolNum].ulBlockCount) uint32_t ulBlockCount,
|| ((gaRedVolume[bVolNum].ulBlockCount - ulBlockStart) < ulBlockCount) void *pBuffer)
|| (ulBlockCount == 0U) {
|| (pBuffer == NULL)) REDSTATUS ret = 0;
{
REDERROR(); if( (bVolNum >= REDCONF_VOLUME_COUNT)
ret = -RED_EINVAL; || (ulBlockStart >= gaRedVolume[bVolNum].ulBlockCount)
} || ((gaRedVolume[bVolNum].ulBlockCount - ulBlockStart) < ulBlockCount)
else || (ulBlockCount == 0U)
{ || (pBuffer == NULL))
uint8_t bSectorShift = gaRedVolume[bVolNum].bBlockSectorShift; {
uint64_t ullSectorStart = (uint64_t)ulBlockStart << bSectorShift; REDERROR();
uint32_t ulSectorCount = ulBlockCount << bSectorShift; ret = -RED_EINVAL;
}
REDASSERT(bSectorShift < 32U); else
REDASSERT((ulSectorCount >> bSectorShift) == ulBlockCount); {
uint8_t bSectorShift = gaRedVolume[bVolNum].bBlockSectorShift;
ret = RedOsBDevRead(bVolNum, ullSectorStart, ulSectorCount, pBuffer); uint64_t ullSectorStart = (uint64_t)ulBlockStart << bSectorShift;
} uint32_t ulSectorCount = ulBlockCount << bSectorShift;
uint8_t bRetryIdx;
CRITICAL_ASSERT(ret == 0);
REDASSERT(bSectorShift < 32U);
return ret; REDASSERT((ulSectorCount >> bSectorShift) == ulBlockCount);
}
for(bRetryIdx = 0U; bRetryIdx <= gpRedVolConf->bBlockIoRetries; bRetryIdx++)
{
#if REDCONF_READ_ONLY == 0 ret = RedOsBDevRead(bVolNum, ullSectorStart, ulSectorCount, pBuffer);
/** @brief Write a range of logical blocks.
if(ret == 0)
@param bVolNum The volume whose block device is being written to. {
@param ulBlockStart The first block to write. break;
@param ulBlockCount The number of blocks to write. }
@param pBuffer The buffer containing the data to write. }
}
@return A negated ::REDSTATUS code indicating the operation result.
CRITICAL_ASSERT(ret == 0);
@retval 0 Operation was successful.
@retval -RED_EIO A disk I/O error occurred. return ret;
@retval -RED_EINVAL Invalid parameters. }
*/
REDSTATUS RedIoWrite(
uint8_t bVolNum, #if REDCONF_READ_ONLY == 0
uint32_t ulBlockStart, /** @brief Write a range of logical blocks.
uint32_t ulBlockCount,
const void *pBuffer) @param bVolNum The volume whose block device is being written to.
{ @param ulBlockStart The first block to write.
REDSTATUS ret; @param ulBlockCount The number of blocks to write.
@param pBuffer The buffer containing the data to write.
if( (bVolNum >= REDCONF_VOLUME_COUNT)
|| (ulBlockStart >= gaRedVolume[bVolNum].ulBlockCount) @return A negated ::REDSTATUS code indicating the operation result.
|| ((gaRedVolume[bVolNum].ulBlockCount - ulBlockStart) < ulBlockCount)
|| (ulBlockCount == 0U) @retval 0 Operation was successful.
|| (pBuffer == NULL)) @retval -RED_EIO A disk I/O error occurred.
{ @retval -RED_EINVAL Invalid parameters.
REDERROR(); */
ret = -RED_EINVAL; REDSTATUS RedIoWrite(
} uint8_t bVolNum,
else uint32_t ulBlockStart,
{ uint32_t ulBlockCount,
uint8_t bSectorShift = gaRedVolume[bVolNum].bBlockSectorShift; const void *pBuffer)
uint64_t ullSectorStart = (uint64_t)ulBlockStart << bSectorShift; {
uint32_t ulSectorCount = ulBlockCount << bSectorShift; REDSTATUS ret = 0;
REDASSERT(bSectorShift < 32U); if( (bVolNum >= REDCONF_VOLUME_COUNT)
REDASSERT((ulSectorCount >> bSectorShift) == ulBlockCount); || (ulBlockStart >= gaRedVolume[bVolNum].ulBlockCount)
|| ((gaRedVolume[bVolNum].ulBlockCount - ulBlockStart) < ulBlockCount)
ret = RedOsBDevWrite(bVolNum, ullSectorStart, ulSectorCount, pBuffer); || (ulBlockCount == 0U)
} || (pBuffer == NULL))
{
CRITICAL_ASSERT(ret == 0); REDERROR();
ret = -RED_EINVAL;
return ret; }
} else
{
uint8_t bSectorShift = gaRedVolume[bVolNum].bBlockSectorShift;
/** @brief Flush any caches beneath the file system. uint64_t ullSectorStart = (uint64_t)ulBlockStart << bSectorShift;
uint32_t ulSectorCount = ulBlockCount << bSectorShift;
@param bVolNum The volume number of the volume whose block device is being uint8_t bRetryIdx;
flushed.
REDASSERT(bSectorShift < 32U);
@return A negated ::REDSTATUS code indicating the operation result. REDASSERT((ulSectorCount >> bSectorShift) == ulBlockCount);
@retval 0 Operation was successful. for(bRetryIdx = 0U; bRetryIdx <= gpRedVolConf->bBlockIoRetries; bRetryIdx++)
@retval -RED_EINVAL @p bVolNum is an invalid volume number. {
@retval -RED_EIO A disk I/O error occurred. ret = RedOsBDevWrite(bVolNum, ullSectorStart, ulSectorCount, pBuffer);
*/
REDSTATUS RedIoFlush( if(ret == 0)
uint8_t bVolNum) {
{ break;
REDSTATUS ret; }
}
if(bVolNum >= REDCONF_VOLUME_COUNT) }
{
REDERROR(); CRITICAL_ASSERT(ret == 0);
ret = -RED_EINVAL;
} return ret;
else }
{
ret = RedOsBDevFlush(bVolNum);
} /** @brief Flush any caches beneath the file system.
CRITICAL_ASSERT(ret == 0); @param bVolNum The volume number of the volume whose block device is being
flushed.
return ret;
} @return A negated ::REDSTATUS code indicating the operation result.
#endif /* REDCONF_READ_ONLY == 0 */
@retval 0 Operation was successful.
@retval -RED_EINVAL @p bVolNum is an invalid volume number.
@retval -RED_EIO A disk I/O error occurred.
*/
REDSTATUS RedIoFlush(
uint8_t bVolNum)
{
REDSTATUS ret = 0;
if(bVolNum >= REDCONF_VOLUME_COUNT)
{
REDERROR();
ret = -RED_EINVAL;
}
else
{
uint8_t bRetryIdx;
for(bRetryIdx = 0U; bRetryIdx <= gpRedVolConf->bBlockIoRetries; bRetryIdx++)
{
ret = RedOsBDevFlush(bVolNum);
if(ret == 0)
{
break;
}
}
}
CRITICAL_ASSERT(ret == 0);
return ret;
}
#endif /* REDCONF_READ_ONLY == 0 */

File diff suppressed because it is too large Load Diff

@ -1,61 +1,102 @@
# Reliance Edge Release Notes # Reliance Edge Release Notes
This file contains a list of updates made to Reliance Edge over the course of This file contains a list of updates made to Reliance Edge over the course of
recent releases and a list of known issues. recent releases and a list of known issues.
## Release History and Changes ## Release History and Changes
### Reliance Edge v1.0, July 2015 ### Reliance Edge v1.0.4, July 2016
#### Common Code Changes - Added ARM mbed and ARM mbed OS support in the commercial kit, with an example
projects for ARM mbed OS on the NXP FRDM-K64F board.
- First release of commercial kit and MISRA C:2012 Design Assurance Package. - Some minor deficiencies in the POSIX-like API test suite have been addressed.
The commercial kit includes many new tools and tests which were not previously
available. ### Reliance Edge v1.0.3, June 2016
- Overhauled parsing of command-line parameters to be consistent for all tools
and tests. Command-line tools now use Unix-style short and long options (such - Added support for static memory allocation configuration in FreeRTOS
as `-H` and `--help`) instead of DOS-style switches (such as `/?`). version 9. No common code changes.
- Renamed all os/\*/include/ostypes.h headers to os/\*/include/redostypes.h, so
that all headers use the product prefix. If you created a port using v0.9, ### Reliance Edge v1.0.2, February 2016
this header needs to be renamed and its header guard (#ifndef OSTYPES_H etc.)
should also be updated. #### Common Code Changes
- Add a new header for OS-specific MISRA C:2012 deviation macros, located at - A new per-volume configuration option has been added: users can specify a
os/\*/include/redosdeviations.h. If you created a port using v0.9, copy the number of times to retry a block device read, write or flush operation before
template from os/stub/include/redosdeviations.h into the include directory. returning a failure. The configuration tool has been updated to version 1.0.2
- Eliminated support for sector sizes less than 256. If using a smaller sector with this change.
size (say for a RAM disk), this must now be emulated in the implementation of - This added a new field to the volume configuration in to redconf.c: existing
the block device OS service. redconf.c files from v1.0.1 and earlier must be updated to work with v1.0.2.
- Added RedFseFormat() as an optional FSE API, allowing FSE applications to Open redconf.h and redconf.c with the configuration tool, enable
format the volume at run-time. "Retry block device I/O on failure" for any volumes if desired, and save the
- This added a new macro to redconf.h: existing redconf.h files from v0.9 must redconf files.
be updated to work with v1.0. Open redconf.h with the configuration tool,
ignore the warning about the missing macro, and save it. #### FreeRTOS Port Changes
- Internal restructuring has renamed the macros for the string and memory - Added support for the STM32 HAL SD card driver in the FreeRTOS block device
functions used in redconf.h. An existing redconf.h file from v0.9 will need interface. Two boards are supported out-of-the-box: the STM324xG-EVAL and the
to be updated; for a file containing the old names, the new config tool will STM32F746NG-Discovery. A sample project is included for the STM324xG-EVAL.
default to using the (slow) Reliance Edge string/memory functions; to use the
C library or custom versions, this will need to be selected in the #### MQX Port Changes
configuration utility. - Fixed a bug which prevented Reliance Edge from compiling if the File System
- Fix a bug which would result in an error when attempting to create a name with Essentials API was selected in the configuration.
one or more trailing path separators (such as `red_mkdir("/foo/bar/")`). - Fixed a bug which would have returned an uninitialized value from
- Fix a bug where an open handle for an inode on one volume would prevent the `RedOsBDevFlush()` for block devices that support flushing.
same inode number from being deleted on a different volume.
### Reliance Edge v1.0.1, October 2015
#### FreeRTOS Port Changes
- Added MQX RTOS support in the commercial kit, with example projects for
- The implementation of the timestamp OS service no longer requires that the Kinetis Design Studio.
`configUSE_TIMERS` be set to `1`. - Bug fix in the F_DRIVER implementation of the FreeRTOS block device service.
### Reliance Edge v0.9 (Beta), April 2015 ### Reliance Edge v1.0, July 2015
First public release. #### Common Code Changes
## Known Issues - First release of commercial kit and MISRA C:2012 Design Assurance Package.
The commercial kit includes many new tools and tests which were not previously
### Visual Studio 2005 available.
- Overhauled parsing of command-line parameters to be consistent for all tools
The Reliance Edge Win32 port (used for the host tools and the Win32 test and tests. Command-line tools now use Unix-style short and long options (such
project) cannot be compiled by Visual Studio 2005. This is not going to be as `-H` and `--help`) instead of DOS-style switches (such as `/?`).
fixed since VS2005 is an old toolset. Newer versions of Visual Studio, starting - Renamed all os/\*/include/ostypes.h headers to os/\*/include/redostypes.h, so
with Visual Studio 2008, work just fine. that all headers use the product prefix. If you created a port using v0.9,
this header needs to be renamed and its header guard (#ifndef OSTYPES_H etc.)
should also be updated.
- Add a new header for OS-specific MISRA C:2012 deviation macros, located at
os/\*/include/redosdeviations.h. If you created a port using v0.9, copy the
template from os/stub/include/redosdeviations.h into the include directory.
- Eliminated support for sector sizes less than 256. If using a smaller sector
size (say for a RAM disk), this must now be emulated in the implementation of
the block device OS service.
- Added RedFseFormat() as an optional FSE API, allowing FSE applications to
format the volume at run-time.
- This added a new macro to redconf.h: existing redconf.h files from v0.9 must
be updated to work with v1.0. Open redconf.h with the configuration tool,
ignore the warning about the missing macro, and save it.
- Internal restructuring has renamed the macros for the string and memory
functions used in redconf.h. An existing redconf.h file from v0.9 will need
to be updated; for a file containing the old names, the new config tool will
default to using the (slow) Reliance Edge string/memory functions; to use the
C library or custom versions, this will need to be selected in the
configuration utility.
- Fix a bug which would result in an error when attempting to create a name with
one or more trailing path separators (such as `red_mkdir("/foo/bar/")`).
- Fix a bug where an open handle for an inode on one volume would prevent the
same inode number from being deleted on a different volume.
#### FreeRTOS Port Changes
- The implementation of the timestamp OS service no longer requires that
`configUSE_TIMERS` be set to `1`.
### Reliance Edge v0.9 (Beta), April 2015
First public release.
## Known Issues
### Visual Studio 2005
The Reliance Edge Win32 port (used for the host tools and the Win32 test
project) cannot be compiled by Visual Studio 2005. This is not going to be
fixed since VS2005 is an old toolset. Newer versions of Visual Studio, starting
with Visual Studio 2008, work just fine.

@ -1,71 +1,118 @@
RELIANCE EDGE RELEASE NOTES RELIANCE EDGE RELEASE NOTES
This file contains a list of updates made to Reliance Edge over the This file contains a list of updates made to Reliance Edge over the
course of recent releases and a list of known issues. course of recent releases and a list of known issues.
Release History and Changes Release History and Changes
Reliance Edge v1.0, July 2015 Reliance Edge v1.0.4, July 2016
Common Code Changes - Added ARM mbed and ARM mbed OS support in the commercial kit, with
an example projects for ARM mbed OS on the NXP FRDM-K64F board.
- First release of commercial kit and MISRA C:2012 Design - Some minor deficiencies in the POSIX-like API test suite have
Assurance Package. The commercial kit includes many new tools and been addressed.
tests which were not previously available.
- Overhauled parsing of command-line parameters to be consistent for Reliance Edge v1.0.3, June 2016
all tools and tests. Command-line tools now use Unix-style short and
long options (such as -H and --help) instead of DOS-style switches - Added support for static memory allocation configuration in FreeRTOS
(such as /?). version 9. No common code changes.
- Renamed all os/*/include/ostypes.h headers to
os/*/include/redostypes.h, so that all headers use the Reliance Edge v1.0.2, February 2016
product prefix. If you created a port using v0.9, this header needs
to be renamed and its header guard (#ifndef OSTYPES_H etc.) should Common Code Changes
also be updated.
- Add a new header for OS-specific MISRA C:2012 deviation macros, - A new per-volume configuration option has been added: users can
located at os/*/include/redosdeviations.h. If you created a port specify a number of times to retry a block device read, write or
using v0.9, copy the template from os/stub/include/redosdeviations.h flush operation before returning a failure. The configuration tool
into the include directory. has been updated to version 1.0.2 with this change.
- Eliminated support for sector sizes less than 256. If using a - This added a new field to the volume configuration in to redconf.c:
smaller sector size (say for a RAM disk), this must now be emulated existing redconf.c files from v1.0.1 and earlier must be updated to
in the implementation of the block device OS service. work with v1.0.2. Open redconf.h and redconf.c with the
- Added RedFseFormat() as an optional FSE API, allowing FSE configuration tool, enable "Retry block device I/O on failure" for
applications to format the volume at run-time. any volumes if desired, and save the redconf files.
- This added a new macro to redconf.h: existing redconf.h files from
v0.9 must be updated to work with v1.0. Open redconf.h with the FreeRTOS Port Changes
configuration tool, ignore the warning about the missing macro, and
save it. - Added support for the STM32 HAL SD card driver in the FreeRTOS block
- Internal restructuring has renamed the macros for the string and device interface. Two boards are supported out-of-the-box: the
memory functions used in redconf.h. An existing redconf.h file from STM324xG-EVAL and the STM32F746NG-Discovery. A sample project is
v0.9 will need to be updated; for a file containing the old names, included for the STM324xG-EVAL.
the new config tool will default to using the (slow) Reliance Edge
string/memory functions; to use the C library or custom versions, MQX Port Changes
this will need to be selected in the configuration utility.
- Fix a bug which would result in an error when attempting to create a - Fixed a bug which prevented Reliance Edge from compiling if the File
name with one or more trailing path separators (such as System Essentials API was selected in the configuration.
red_mkdir("/foo/bar/")). - Fixed a bug which would have returned an uninitialized value from
- Fix a bug where an open handle for an inode on one volume would RedOsBDevFlush() for block devices that support flushing.
prevent the same inode number from being deleted on a
different volume. Reliance Edge v1.0.1, October 2015
FreeRTOS Port Changes - Added MQX RTOS support in the commercial kit, with example projects
for the Kinetis Design Studio.
- The implementation of the timestamp OS service no longer requires - Bug fix in the F_DRIVER implementation of the FreeRTOS block
that configUSE_TIMERS be set to 1. device service.
Reliance Edge v0.9 (Beta), April 2015 Reliance Edge v1.0, July 2015
First public release. Common Code Changes
- First release of commercial kit and MISRA C:2012 Design
Known Issues Assurance Package. The commercial kit includes many new tools and
tests which were not previously available.
Visual Studio 2005 - Overhauled parsing of command-line parameters to be consistent for
all tools and tests. Command-line tools now use Unix-style short and
The Reliance Edge Win32 port (used for the host tools and the Win32 test long options (such as -H and --help) instead of DOS-style switches
project) cannot be compiled by Visual Studio 2005. This is not going to (such as /?).
be fixed since VS2005 is an old toolset. Newer versions of Visual - Renamed all os/*/include/ostypes.h headers to
Studio, starting with Visual Studio 2008, work just fine. os/*/include/redostypes.h, so that all headers use the
product prefix. If you created a port using v0.9, this header needs
to be renamed and its header guard (#ifndef OSTYPES_H etc.) should
also be updated.
- Add a new header for OS-specific MISRA C:2012 deviation macros,
located at os/*/include/redosdeviations.h. If you created a port
using v0.9, copy the template from os/stub/include/redosdeviations.h
into the include directory.
- Eliminated support for sector sizes less than 256. If using a
smaller sector size (say for a RAM disk), this must now be emulated
in the implementation of the block device OS service.
- Added RedFseFormat() as an optional FSE API, allowing FSE
applications to format the volume at run-time.
- This added a new macro to redconf.h: existing redconf.h files from
v0.9 must be updated to work with v1.0. Open redconf.h with the
configuration tool, ignore the warning about the missing macro, and
save it.
- Internal restructuring has renamed the macros for the string and
memory functions used in redconf.h. An existing redconf.h file from
v0.9 will need to be updated; for a file containing the old names,
the new config tool will default to using the (slow) Reliance Edge
string/memory functions; to use the C library or custom versions,
this will need to be selected in the configuration utility.
- Fix a bug which would result in an error when attempting to create a
name with one or more trailing path separators (such as
red_mkdir("/foo/bar/")).
- Fix a bug where an open handle for an inode on one volume would
prevent the same inode number from being deleted on a
different volume.
FreeRTOS Port Changes
- The implementation of the timestamp OS service no longer requires
that configUSE_TIMERS be set to 1.
Reliance Edge v0.9 (Beta), April 2015
First public release.
Known Issues
Visual Studio 2005
The Reliance Edge Win32 port (used for the host tools and the Win32 test
project) cannot be compiled by Visual Studio 2005. This is not going to
be fixed since VS2005 is an old toolset. Newer versions of Visual
Studio, starting with Visual Studio 2008, work just fine.

@ -1,38 +1,38 @@
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <---- /* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
Copyright (c) 2014-2015 Datalight, Inc. Copyright (c) 2014-2015 Datalight, Inc.
All Rights Reserved Worldwide. All Rights Reserved Worldwide.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; use version 2 of the License. the Free Software Foundation; use version 2 of the License.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc., with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
/* Businesses and individuals that for commercial or other reasons cannot /* Businesses and individuals that for commercial or other reasons cannot
comply with the terms of the GPLv2 license may obtain a commercial license comply with the terms of the GPLv2 license may obtain a commercial license
before incorporating Reliance Edge into proprietary software for before incorporating Reliance Edge into proprietary software for
distribution in any form. Visit http://www.datalight.com/reliance-edge for distribution in any form. Visit http://www.datalight.com/reliance-edge for
more information. more information.
*/ */
/** @file /** @file
@brief Interfaces of path utilities for the POSIX-like API layer. @brief Interfaces of path utilities for the POSIX-like API layer.
*/ */
#ifndef REDPATH_H #ifndef REDPATH_H
#define REDPATH_H #define REDPATH_H
REDSTATUS RedPathSplit(const char *pszPath, uint8_t *pbVolNum, const char **ppszLocalPath); REDSTATUS RedPathSplit(const char *pszPath, uint8_t *pbVolNum, const char **ppszLocalPath);
REDSTATUS RedPathLookup(const char *pszLocalPath, uint32_t *pulInode); REDSTATUS RedPathLookup(const char *pszLocalPath, uint32_t *pulInode);
REDSTATUS RedPathToName(const char *pszLocalPath, uint32_t *pulPInode, const char **ppszName); REDSTATUS RedPathToName(const char *pszLocalPath, uint32_t *pulPInode, const char **ppszName);
#endif #endif

@ -1,249 +1,265 @@
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <---- /* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
Copyright (c) 2014-2015 Datalight, Inc. Copyright (c) 2014-2015 Datalight, Inc.
All Rights Reserved Worldwide. All Rights Reserved Worldwide.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; use version 2 of the License. the Free Software Foundation; use version 2 of the License.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc., with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
/* Businesses and individuals that for commercial or other reasons cannot /* Businesses and individuals that for commercial or other reasons cannot
comply with the terms of the GPLv2 license may obtain a commercial license comply with the terms of the GPLv2 license may obtain a commercial license
before incorporating Reliance Edge into proprietary software for before incorporating Reliance Edge into proprietary software for
distribution in any form. Visit http://www.datalight.com/reliance-edge for distribution in any form. Visit http://www.datalight.com/reliance-edge for
more information. more information.
*/ */
/** @file /** @file
@brief Prototypes for Reliance Edge test entry points. @brief Prototypes for Reliance Edge test entry points.
*/ */
#ifndef REDTESTS_H #ifndef REDTESTS_H
#define REDTESTS_H #define REDTESTS_H
#include <redtypes.h> #include <redtypes.h>
#include "redtestutils.h" #include "redtestutils.h"
#include "redver.h" #include "redver.h"
/* This macro is only defined by the error injection project. /* This macro is only defined by the error injection project.
*/ */
#ifdef REDCONF_ERROR_INJECTION #ifdef REDCONF_ERROR_INJECTION
#include <rederrinject.h> #include <rederrinject.h>
#endif #endif
#define FSSTRESS_SUPPORTED \ #define FSSTRESS_SUPPORTED \
( ((RED_KIT == RED_KIT_GPL) || (RED_KIT == RED_KIT_SANDBOX)) \ ( ((RED_KIT == RED_KIT_GPL) || (RED_KIT == RED_KIT_SANDBOX)) \
&& (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_PATH_SEPARATOR == '/') \ && (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_PATH_SEPARATOR == '/') \
&& (REDCONF_API_POSIX == 1) && (REDCONF_API_POSIX_UNLINK == 1) && (REDCONF_API_POSIX_MKDIR == 1) \ && (REDCONF_API_POSIX == 1) && (REDCONF_API_POSIX_UNLINK == 1) && (REDCONF_API_POSIX_MKDIR == 1) \
&& (REDCONF_API_POSIX_RMDIR == 1) && (REDCONF_API_POSIX_RENAME == 1) && (REDCONF_API_POSIX_LINK == 1) \ && (REDCONF_API_POSIX_RMDIR == 1) && (REDCONF_API_POSIX_RENAME == 1) && (REDCONF_API_POSIX_LINK == 1) \
&& (REDCONF_API_POSIX_FTRUNCATE == 1) && (REDCONF_API_POSIX_READDIR == 1)) && (REDCONF_API_POSIX_FTRUNCATE == 1) && (REDCONF_API_POSIX_READDIR == 1))
#define FSE_STRESS_TEST_SUPPORTED \ #define FSE_STRESS_TEST_SUPPORTED \
( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \ ( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
&& (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_FSE == 1) \ && (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_FSE == 1) \
&& (REDCONF_API_FSE_FORMAT == 1) && (REDCONF_API_FSE_TRANSMASKSET == 1) && (REDCONF_API_FSE_TRANSMASKGET == 1) \ && (REDCONF_API_FSE_FORMAT == 1) && (REDCONF_API_FSE_TRANSMASKSET == 1) && (REDCONF_API_FSE_TRANSMASKGET == 1) \
&& (REDCONF_API_FSE_TRUNCATE == 1)) && (REDCONF_API_FSE_TRUNCATE == 1))
#define POSIX_API_TEST_SUPPORTED \ #define POSIX_API_TEST_SUPPORTED \
( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \ ( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
&& (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX == 1) \ && (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX == 1) \
&& (REDCONF_API_POSIX_FORMAT == 1) && (REDCONF_API_POSIX_UNLINK == 1)) && (REDCONF_API_POSIX_FORMAT == 1) && (REDCONF_API_POSIX_UNLINK == 1))
#define FSE_API_TEST_SUPPORTED \ #define FSE_API_TEST_SUPPORTED \
( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \ ( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
&& (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_FSE == 1) \ && (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_FSE == 1) \
&& (REDCONF_API_FSE_FORMAT == 1)) && (REDCONF_API_FSE_FORMAT == 1))
#define STOCH_POSIX_TEST_SUPPORTED \ #define STOCH_POSIX_TEST_SUPPORTED \
( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \ ( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
&& (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX == 1) \ && (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX == 1) \
&& (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX_FORMAT == 1) && (REDCONF_API_POSIX_READDIR == 1) \ && (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX_FORMAT == 1) && (REDCONF_API_POSIX_READDIR == 1) \
&& (REDCONF_API_POSIX_MKDIR == 1) && (REDCONF_API_POSIX_RMDIR == 1) && (REDCONF_API_POSIX_UNLINK == 1) \ && (REDCONF_API_POSIX_MKDIR == 1) && (REDCONF_API_POSIX_RMDIR == 1) && (REDCONF_API_POSIX_UNLINK == 1) \
&& (REDCONF_API_POSIX_RENAME == 1)) && (REDCONF_API_POSIX_RENAME == 1))
#define FSIOTEST_SUPPORTED \ #define FSIOTEST_SUPPORTED \
( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \ ( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
&& (REDCONF_OUTPUT == 1) && (REDCONF_API_POSIX == 1)) && (REDCONF_OUTPUT == 1) && (REDCONF_API_POSIX == 1))
#define BDEVTEST_SUPPORTED \ #define BDEVTEST_SUPPORTED \
( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \ ( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
&& (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0)) && (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0))
#define DISKFULL_TEST_SUPPORTED \ #define DISKFULL_TEST_SUPPORTED \
( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \ ( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
&& (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX == 1) \ && (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX == 1) \
&& (REDCONF_API_POSIX_FORMAT == 1) && (REDCONF_API_POSIX_FTRUNCATE == 1)) && (REDCONF_API_POSIX_FORMAT == 1) && (REDCONF_API_POSIX_FTRUNCATE == 1))
typedef enum typedef enum
{ {
PARAMSTATUS_OK, /* Parameters were good; continue. */ PARAMSTATUS_OK, /* Parameters were good; continue. */
PARAMSTATUS_BAD, /* Parameters were bad; stop. */ PARAMSTATUS_BAD, /* Parameters were bad; stop. */
PARAMSTATUS_HELP /* Help request; not an error, but stop. */ PARAMSTATUS_HELP /* Help request; not an error, but stop. */
} PARAMSTATUS; } PARAMSTATUS;
#if FSSTRESS_SUPPORTED #if FSSTRESS_SUPPORTED
typedef struct typedef struct
{ {
bool fNoCleanup; /**< --no-cleanup */ bool fNoCleanup; /**< --no-cleanup */
uint32_t ulLoops; /**< --loops */ uint32_t ulLoops; /**< --loops */
uint32_t ulNops; /**< --nops */ uint32_t ulNops; /**< --nops */
bool fNamePad; /**< --namepad */ bool fNamePad; /**< --namepad */
uint32_t ulSeed; /**< --seed */ uint32_t ulSeed; /**< --seed */
bool fVerbose; /**< --verbose */ bool fVerbose; /**< --verbose */
} FSSTRESSPARAM; } FSSTRESSPARAM;
PARAMSTATUS FsstressParseParams(int argc, char *argv[], FSSTRESSPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice); PARAMSTATUS FsstressParseParams(int argc, char *argv[], FSSTRESSPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
void FsstressDefaultParams(FSSTRESSPARAM *pParam); void FsstressDefaultParams(FSSTRESSPARAM *pParam);
int FsstressStart(const FSSTRESSPARAM *pParam); int FsstressStart(const FSSTRESSPARAM *pParam);
#endif #endif
#if STOCH_POSIX_TEST_SUPPORTED #if STOCH_POSIX_TEST_SUPPORTED
typedef struct typedef struct
{ {
const char *pszVolume; /**< Volume path prefix. */ const char *pszVolume; /**< Volume path prefix. */
uint32_t ulIterations; /**< --iterations */ uint32_t ulIterations; /**< --iterations */
uint32_t ulFileListMax; /**< --files */ uint32_t ulFileListMax; /**< --files */
uint32_t ulDirListMax; /**< --dirs */ uint32_t ulDirListMax; /**< --dirs */
uint32_t ulOpenFileListMax; /**< --open-files */ uint32_t ulOpenFileListMax; /**< --open-files */
uint32_t ulOpenDirListMax; /**< --open-dirs */ uint32_t ulOpenDirListMax; /**< --open-dirs */
uint32_t ulRandomSeed; /**< --seed */ uint32_t ulRandomSeed; /**< --seed */
} STOCHPOSIXPARAM; } STOCHPOSIXPARAM;
PARAMSTATUS RedStochPosixParseParams(int argc, char *argv[], STOCHPOSIXPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice); PARAMSTATUS RedStochPosixParseParams(int argc, char *argv[], STOCHPOSIXPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
void RedStochPosixDefaultParams(STOCHPOSIXPARAM *pParam); void RedStochPosixDefaultParams(STOCHPOSIXPARAM *pParam);
int RedStochPosixStart(const STOCHPOSIXPARAM *pParam); int RedStochPosixStart(const STOCHPOSIXPARAM *pParam);
#endif #endif
#if FSE_STRESS_TEST_SUPPORTED #if FSE_STRESS_TEST_SUPPORTED
typedef struct typedef struct
{ {
uint8_t bVolNum; /**< Volume number. */ uint8_t bVolNum; /**< Volume number. */
uint32_t ulFileCount; /**< --files */ uint32_t ulFileCount; /**< --files */
uint32_t ulMaxFileSize; /**< --max */ uint32_t ulMaxFileSize; /**< --max */
uint32_t ulMaxOpSize; /**< --buffer-size */ uint32_t ulMaxOpSize; /**< --buffer-size */
uint32_t ulNops; /**< --nops */ uint32_t ulNops; /**< --nops */
uint32_t ulLoops; /**< --loops */ uint32_t ulLoops; /**< --loops */
uint32_t ulSampleRate; /**< --sample-rate */ uint32_t ulSampleRate; /**< --sample-rate */
uint64_t ullSeed; /**< --seed */ uint64_t ullSeed; /**< --seed */
} FSESTRESSPARAM; } FSESTRESSPARAM;
PARAMSTATUS FseStressParseParams(int argc, char *argv[], FSESTRESSPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice); PARAMSTATUS FseStressParseParams(int argc, char *argv[], FSESTRESSPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
void FseStressDefaultParams(FSESTRESSPARAM *pParam); void FseStressDefaultParams(FSESTRESSPARAM *pParam);
int FseStressStart(const FSESTRESSPARAM *pParam); int FseStressStart(const FSESTRESSPARAM *pParam);
#endif #endif
#if POSIX_API_TEST_SUPPORTED #if POSIX_API_TEST_SUPPORTED
typedef struct typedef struct
{ {
const char *pszVolume; /**< Volume path prefix. */ const char *pszVolume; /**< Volume path prefix. */
bool fQuick; /**< --quick */ bool fQuick; /**< --quick */
bool fQuitOnFailure; /**< --quit-on-failure */ bool fQuitOnFailure; /**< --quit-on-failure */
bool fDebugErrors; /**< --debug */ bool fDebugErrors; /**< --debug */
} POSIXTESTPARAM; } POSIXTESTPARAM;
PARAMSTATUS RedPosixTestParseParams(int argc, char *argv[], POSIXTESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice); PARAMSTATUS RedPosixTestParseParams(int argc, char *argv[], POSIXTESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
void RedPosixTestDefaultParams(POSIXTESTPARAM *pParam); void RedPosixTestDefaultParams(POSIXTESTPARAM *pParam);
int RedPosixTestStart(const POSIXTESTPARAM *pParam); int RedPosixTestStart(const POSIXTESTPARAM *pParam);
#endif #endif
#if FSE_API_TEST_SUPPORTED #if POSIX_API_TEST_SUPPORTED
typedef struct typedef struct
{ {
uint8_t bVolNum; /**< Volume number. */ const char *pszVolume; /**< Volume path prefix. */
bool fQuitOnFailure; /**< --quit-on-failure */ bool fQuick; /**< --quick */
bool fDebugErrors; /**< --debug */ bool fVerbose; /**< --verbose */
} FSETESTPARAM; bool fQuitOnFailure; /**< --quit-on-failure */
bool fDebugErrors; /**< --debug */
PARAMSTATUS RedFseTestParseParams(int argc, char *argv[], FSETESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice); } OSAPITESTPARAM;
void RedFseTestDefaultParams(FSETESTPARAM *pParam);
int RedFseTestStart(const FSETESTPARAM *pParam); PARAMSTATUS RedOsApiTestParseParams(int argc, char *argv[], OSAPITESTPARAM *pParam, const char **ppszDevice);
#endif void RedOsApiTestDefaultParams(OSAPITESTPARAM *pParam);
int RedOsApiTestStart(const OSAPITESTPARAM *pParam);
#if FSIOTEST_SUPPORTED #endif
typedef enum
{
TESTFS_RELEDGE, /* Datalight Reliance Edge */ #if FSE_API_TEST_SUPPORTED
TESTFS_FATFS, /* ChaN's FatFs */ typedef struct
TESTFS_FATSL /* FreeRTOS+FAT SL */ {
} TESTFS; uint8_t bVolNum; /**< Volume number. */
bool fQuitOnFailure; /**< --quit-on-failure */
typedef struct bool fDebugErrors; /**< --debug */
{ } FSETESTPARAM;
TESTFS testfs; /**< --fs */
const char *pszVolume; /**< Volume path prefix. */ PARAMSTATUS RedFseTestParseParams(int argc, char *argv[], FSETESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
bool fSeqRead; /**< --seq=r */ void RedFseTestDefaultParams(FSETESTPARAM *pParam);
bool fSeqWrite; /**< --seq=w */ int RedFseTestStart(const FSETESTPARAM *pParam);
bool fSeqRewrite; /**< --seq=e */ #endif
bool fRandomRead; /**< --rand=r */
bool fRandomWrite; /**< --rand=w */ #if FSIOTEST_SUPPORTED
bool fMixedWrite; /**< --mixed */ typedef enum
bool fScanTest; /**< --scan */ {
uint32_t ulFSBlockSize; /**< --block-size */ TESTFS_RELEDGE, /* Datalight Reliance Edge */
uint32_t ulMaxFileSize; /**< --max */ TESTFS_FATFS, /* ChaN's FatFs */
uint32_t ulRandomReadPasses; /**< --rand-pass=r:w (r part) */ TESTFS_FATSL /* FreeRTOS+FAT SL */
uint32_t ulRandomWritePasses; /**< --rand-pass=r:w (w part) */ } TESTFS;
uint32_t ulMixedWritePasses; /**< --mixed-pass */
int32_t iFlushOnWriteRatio; /**< --rand-fow */ typedef struct
uint32_t ulBufferMin; /**< --start */ {
uint32_t ulBufferSize; /**< --buffer-size */ TESTFS testfs; /**< --fs */
bool fWriteVerify; /**< --verify */ const char *pszVolume; /**< Volume path prefix. */
uint32_t ulSampleRate; /**< --sample-rate */ bool fSeqRead; /**< --seq=r */
uint32_t ulScanCount; /**< --scan-files */ bool fSeqWrite; /**< --seq=w */
uint64_t ullSeed; /**< --seed */ bool fSeqRewrite; /**< --seq=e */
} FSIOTESTPARAM; bool fRandomRead; /**< --rand=r */
bool fRandomWrite; /**< --rand=w */
PARAMSTATUS FSIOTestParseParams(int argc, char *argv[], FSIOTESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice); bool fMixedWrite; /**< --mixed */
void FSIOTestDefaultParams(FSIOTESTPARAM *pParam); bool fScanTest; /**< --scan */
int FSIOTestStart(const FSIOTESTPARAM *pParam); uint32_t ulFSBlockSize; /**< --block-size */
#endif uint32_t ulMaxFileSize; /**< --max */
uint32_t ulRandomReadPasses; /**< --rand-pass=r:w (r part) */
#if BDEVTEST_SUPPORTED uint32_t ulRandomWritePasses; /**< --rand-pass=r:w (w part) */
typedef struct uint32_t ulMixedWritePasses; /**< --mixed-pass */
{ int32_t iFlushOnWriteRatio; /**< --rand-fow */
uint8_t bDrvNum; /**< Volume number (for sector size/count). */ uint32_t ulBufferMin; /**< --start */
bool fSeqWrite; /**< --seq:w */ uint32_t ulBufferSize; /**< --buffer-size */
bool fSeqRead; /**< --seq:r */ bool fWriteVerify; /**< --verify */
bool fRandWrite; /**< --rand:w */ uint32_t ulSampleRate; /**< --sample-rate */
bool fRandRead; /**< --rand:r */ uint32_t ulScanCount; /**< --scan-files */
uint32_t ulSampleSecs; /**< --sample-rate */ uint64_t ullSeed; /**< --seed */
uint32_t ulPasses; /**< --passes */ } FSIOTESTPARAM;
uint32_t ulMinIOSectors; /**< --count=min[:max] (min part) */
uint32_t ulMaxIOSectors; /**< --count=min[:max] (max part) */ PARAMSTATUS FSIOTestParseParams(int argc, char *argv[], FSIOTESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
uint32_t ulMaxSizeKB; /**< --max */ void FSIOTestDefaultParams(FSIOTESTPARAM *pParam);
uint32_t ulTestSeconds; /**< --time */ int FSIOTestStart(const FSIOTESTPARAM *pParam);
bool fVerify; /**< --verify */ #endif
bool fAsyncWrites; /**< --async */
uint64_t ullSeed; /**< --seed */ #if BDEVTEST_SUPPORTED
} BDEVTESTPARAM; typedef struct
{
PARAMSTATUS BDevTestParseParams(int argc, char *argv[], BDEVTESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice); uint8_t bDrvNum; /**< Volume number (for sector size/count). */
void BDevTestDefaultParams(BDEVTESTPARAM *pParam); bool fSeqWrite; /**< --seq:w */
int BDevTestStart(const BDEVTESTPARAM *pParam); bool fSeqRead; /**< --seq:r */
#endif bool fRandWrite; /**< --rand:w */
bool fRandRead; /**< --rand:r */
#if DISKFULL_TEST_SUPPORTED uint32_t ulSampleSecs; /**< --sample-rate */
typedef struct uint32_t ulPasses; /**< --passes */
{ uint32_t ulMinIOSectors; /**< --count=min[:max] (min part) */
const char *pszVolume; /**< Volume path prefix. */ uint32_t ulMaxIOSectors; /**< --count=min[:max] (max part) */
bool fQuitOnFailure; /**< --quit-on-failure */ uint32_t ulMaxSizeKB; /**< --max */
bool fDebugErrors; /**< --debug */ uint32_t ulTestSeconds; /**< --time */
} DISKFULLTESTPARAM; bool fVerify; /**< --verify */
bool fAsyncWrites; /**< --async */
PARAMSTATUS DiskFullTestParseParams(int argc, char *argv[], DISKFULLTESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice); uint64_t ullSeed; /**< --seed */
void DiskFullTestDefaultParams(DISKFULLTESTPARAM *pParam); } BDEVTESTPARAM;
int DiskFullTestStart(const DISKFULLTESTPARAM *pParam);
#endif PARAMSTATUS BDevTestParseParams(int argc, char *argv[], BDEVTESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
void BDevTestDefaultParams(BDEVTESTPARAM *pParam);
int BDevTestStart(const BDEVTESTPARAM *pParam);
#endif #endif
#if DISKFULL_TEST_SUPPORTED
typedef struct
{
const char *pszVolume; /**< Volume path prefix. */
bool fQuitOnFailure; /**< --quit-on-failure */
bool fDebugErrors; /**< --debug */
} DISKFULLTESTPARAM;
PARAMSTATUS DiskFullTestParseParams(int argc, char *argv[], DISKFULLTESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
void DiskFullTestDefaultParams(DISKFULLTESTPARAM *pParam);
int DiskFullTestStart(const DISKFULLTESTPARAM *pParam);
#endif
#endif

@ -33,7 +33,7 @@
<!-- This macro is updated automatically: do not edit! --> <!-- This macro is updated automatically: do not edit! -->
*/ */
#define RED_BUILD_NUMBER "664" #define RED_BUILD_NUMBER "677"
#define RED_KIT_GPL 0U /* Open source GPL kit. */ #define RED_KIT_GPL 0U /* Open source GPL kit. */
#define RED_KIT_COMMERCIAL 1U /* Commercially-licensed kit. */ #define RED_KIT_COMMERCIAL 1U /* Commercially-licensed kit. */
@ -48,7 +48,7 @@
/** @brief Version number to display in output. /** @brief Version number to display in output.
*/ */
#define RED_VERSION "v1.0" #define RED_VERSION "v1.0.4"
/** @brief On-disk version number. /** @brief On-disk version number.
@ -78,12 +78,12 @@
/** @brief Full product name and version. /** @brief Full product name and version.
*/ */
#define RED_PRODUCT_NAME "Datalight "RED_PRODUCT_BASE_NAME" "RED_VERSION" Build "RED_BUILD_NUMBER ALPHABETA #define RED_PRODUCT_NAME "Datalight " RED_PRODUCT_BASE_NAME " " RED_VERSION " Build " RED_BUILD_NUMBER ALPHABETA
/** @brief Product copyright. /** @brief Product copyright.
*/ */
#define RED_PRODUCT_LEGAL "Copyright (c) 2014-2015 Datalight, Inc. All Rights Reserved Worldwide." #define RED_PRODUCT_LEGAL "Copyright (c) 2014-2016 Datalight, Inc. All Rights Reserved Worldwide."
/** @brief Product patents. /** @brief Product patents.
@ -94,11 +94,11 @@
/** @brief Product edition. /** @brief Product edition.
*/ */
#if RED_KIT == RED_KIT_GPL #if RED_KIT == RED_KIT_GPL
#define RED_PRODUCT_EDITION "Open-Source GPLv2 Edition -- Compiled "__DATE__" at "__TIME__ #define RED_PRODUCT_EDITION "Open-Source GPLv2 Edition -- Compiled " __DATE__ " at " __TIME__
#elif RED_KIT == RED_KIT_COMMERCIAL #elif RED_KIT == RED_KIT_COMMERCIAL
#define RED_PRODUCT_EDITION "Commercial Edition -- Compiled "__DATE__" at "__TIME__ #define RED_PRODUCT_EDITION "Commercial Edition -- Compiled " __DATE__ " at " __TIME__
#else #else
#define RED_PRODUCT_EDITION "Developer Sandbox -- Compiled "__DATE__" at "__TIME__ #define RED_PRODUCT_EDITION "Developer Sandbox -- Compiled " __DATE__ " at " __TIME__
#endif #endif

@ -1,134 +1,141 @@
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <---- /* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
Copyright (c) 2014-2015 Datalight, Inc. Copyright (c) 2014-2015 Datalight, Inc.
All Rights Reserved Worldwide. All Rights Reserved Worldwide.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; use version 2 of the License. the Free Software Foundation; use version 2 of the License.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc., with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
/* Businesses and individuals that for commercial or other reasons cannot /* Businesses and individuals that for commercial or other reasons cannot
comply with the terms of the GPLv2 license may obtain a commercial license comply with the terms of the GPLv2 license may obtain a commercial license
before incorporating Reliance Edge into proprietary software for before incorporating Reliance Edge into proprietary software for
distribution in any form. Visit http://www.datalight.com/reliance-edge for distribution in any form. Visit http://www.datalight.com/reliance-edge for
more information. more information.
*/ */
/** @file /** @file
*/ */
#ifndef REDVOLUME_H #ifndef REDVOLUME_H
#define REDVOLUME_H #define REDVOLUME_H
/** @brief Per-volume configuration structure. /** @brief Per-volume configuration structure.
Contains the configuration values that may differ between volumes. Must be Contains the configuration values that may differ between volumes. Must be
declared in an array in redconf.c in the Reliance Edge project directory and declared in an array in redconf.c in the Reliance Edge project directory and
statically initialized with values representing the volume configuration of statically initialized with values representing the volume configuration of
the target system. the target system.
*/ */
typedef struct typedef struct
{ {
/** The sector size for the block device underlying the volume: the basic /** The sector size for the block device underlying the volume: the basic
unit for reading and writing to the storage media. Commonly ranges unit for reading and writing to the storage media. Commonly ranges
between 512 and 4096, but any power-of-two value not greater than the between 512 and 4096, but any power-of-two value not greater than the
block size will work. block size will work.
*/ */
uint32_t ulSectorSize; uint32_t ulSectorSize;
/** The number of sectors in this file system volume. /** The number of sectors in this file system volume.
*/ */
uint64_t ullSectorCount; uint64_t ullSectorCount;
/** Whether a sector write on the block device underlying the volume is /** Whether a sector write on the block device underlying the volume is
atomic. It is atomic if when the sector write is interrupted, the atomic. It is atomic if when the sector write is interrupted, the
contents of the sector are guaranteed to be either all of the new data, contents of the sector are guaranteed to be either all of the new data,
or all of the old data. If unsure, leave as false. or all of the old data. If unsure, leave as false.
*/ */
bool fAtomicSectorWrite; bool fAtomicSectorWrite;
/** This is the maximum number of inodes (files and directories). This /** This is the maximum number of inodes (files and directories). This
number includes the root directory inode (inode 2; created during number includes the root directory inode (inode 2; created during
format), but does not include inodes 0 or 1, which do not exist on format), but does not include inodes 0 or 1, which do not exist on
disk. The number of inodes cannot be less than 1. disk. The number of inodes cannot be less than 1.
*/ */
uint32_t ulInodeCount; uint32_t ulInodeCount;
#if REDCONF_API_POSIX == 1 /** This is the maximum number of times a block device I/O operation will
/** The path prefix for the volume; for example, "VOL1:", "FlashDisk", etc. be retried. If a block device read, write, or flush fails, Reliance
*/ Edge will try again up to this number of times until the operation is
const char *pszPathPrefix; successful. Set this to 0 to disable retries.
#endif */
} VOLCONF; uint8_t bBlockIoRetries;
extern const VOLCONF gaRedVolConf[REDCONF_VOLUME_COUNT]; #if REDCONF_API_POSIX == 1
extern const VOLCONF * CONST_IF_ONE_VOLUME gpRedVolConf; /** The path prefix for the volume; for example, "VOL1:", "FlashDisk", etc.
*/
const char *pszPathPrefix;
/** @brief Per-volume run-time data. #endif
*/ } VOLCONF;
typedef struct
{ extern const VOLCONF gaRedVolConf[REDCONF_VOLUME_COUNT];
/** Whether the volume is currently mounted. extern const VOLCONF * CONST_IF_ONE_VOLUME gpRedVolConf;
*/
bool fMounted;
/** @brief Per-volume run-time data.
#if REDCONF_READ_ONLY == 0 */
/** Whether the volume is read-only. typedef struct
*/ {
bool fReadOnly; /** Whether the volume is currently mounted.
*/
/** The active automatic transaction mask. bool fMounted;
*/
uint32_t ulTransMask; #if REDCONF_READ_ONLY == 0
#endif /** Whether the volume is read-only.
*/
/** The power of 2 difference between sector size and block size. bool fReadOnly;
*/
uint8_t bBlockSectorShift; /** The active automatic transaction mask.
*/
/** The number of logical blocks in this file system volume. The unit here uint32_t ulTransMask;
is the global block size. #endif
*/
uint32_t ulBlockCount; /** The power of 2 difference between sector size and block size.
*/
/** The total number of allocable blocks; Also the maximum count of free uint8_t bBlockSectorShift;
blocks.
*/ /** The number of logical blocks in this file system volume. The unit here
uint32_t ulBlocksAllocable; is the global block size.
*/
/** The maximum number of bytes that an inode is capable of addressing. uint32_t ulBlockCount;
*/
uint64_t ullMaxInodeSize; /** The total number of allocable blocks; Also the maximum count of free
blocks.
/** The current metadata sequence number. This value is included in all */
metadata nodes and incremented every time a metadata node is written. uint32_t ulBlocksAllocable;
It is assumed to never wrap around.
*/ /** The maximum number of bytes that an inode is capable of addressing.
uint64_t ullSequence; */
} VOLUME; uint64_t ullMaxInodeSize;
/* Array of VOLUME structures, populated at during RedCoreInit(). /** The current metadata sequence number. This value is included in all
*/ metadata nodes and incremented every time a metadata node is written.
extern VOLUME gaRedVolume[REDCONF_VOLUME_COUNT]; It is assumed to never wrap around.
*/
/* Volume number currently being accessed; populated during uint64_t ullSequence;
RedCoreVolSetCurrent(). } VOLUME;
*/
extern CONST_IF_ONE_VOLUME uint8_t gbRedVolNum; /* Array of VOLUME structures, populated at during RedCoreInit().
*/
/* Pointer to the volume currently being accessed; populated during extern VOLUME gaRedVolume[REDCONF_VOLUME_COUNT];
RedCoreVolSetCurrent().
*/ /* Volume number currently being accessed; populated during
extern VOLUME * CONST_IF_ONE_VOLUME gpRedVolume; RedCoreVolSetCurrent().
*/
#endif extern CONST_IF_ONE_VOLUME uint8_t gbRedVolNum;
/* Pointer to the volume currently being accessed; populated during
RedCoreVolSetCurrent().
*/
extern VOLUME * CONST_IF_ONE_VOLUME gpRedVolume;
#endif

@ -1,165 +1,244 @@
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <---- /* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
Copyright (c) 2014-2015 Datalight, Inc. Copyright (c) 2014-2015 Datalight, Inc.
All Rights Reserved Worldwide. All Rights Reserved Worldwide.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; use version 2 of the License. the Free Software Foundation; use version 2 of the License.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc., with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
/* Businesses and individuals that for commercial or other reasons cannot /* Businesses and individuals that for commercial or other reasons cannot
comply with the terms of the GPLv2 license may obtain a commercial license comply with the terms of the GPLv2 license may obtain a commercial license
before incorporating Reliance Edge into proprietary software for before incorporating Reliance Edge into proprietary software for
distribution in any form. Visit http://www.datalight.com/reliance-edge for distribution in any form. Visit http://www.datalight.com/reliance-edge for
more information. more information.
*/ */
/** @file /** @file
@brief Macros to encapsulate MISRA C:2012 deviations in OS-specific code. @brief Macros to encapsulate MISRA C:2012 deviations in OS-specific code.
*/ */
#ifndef REDOSDEVIATIONS_H #ifndef REDOSDEVIATIONS_H
#define REDOSDEVIATIONS_H #define REDOSDEVIATIONS_H
#if REDCONF_OUTPUT == 1 #if REDCONF_OUTPUT == 1
/* Needed for PRINT_ASSERT() and OUTPUT_CHARACTER(). /* Needed for PRINT_ASSERT() and OUTPUT_CHARACTER().
*/ */
#include <stdio.h> #include <stdio.h>
#endif #endif
#if REDCONF_ASSERTS == 1 #if (REDCONF_ASSERTS == 1) && (REDCONF_OUTPUT == 1)
#if REDCONF_OUTPUT == 1 /** Print a formatted message for an assertion.
/** Print a formatted message for an assertion.
Usages of this macro deviate from MISRA C:2012 Rule 21.6 (required). Using
Usages of this macro deviate from MISRA C:2012 Rule 21.6 (required). Using printf() is the most convenient way to output this information; and the risk
printf() is the most convenient way to output this information; and the risk of "unspecified, undefined and implementation-defined" behavior causing
of "unspecified, undefined and implementation-defined" behavior causing problems (as cited in the rationale for the rule) is small. The driver does
problems (as cited in the rationale for the rule) is small. The driver does not depend on this string being outputted correctly. Furthermore, use of
not depend on this string being outputted correctly. Furthermore, use of printf() disappears when either asserts or output are disabled.
printf() disappears when either asserts or output are disabled.
As Rule 21.6 is required, a separate deviation record is required.
As Rule 21.6 is required, a separate deviation record is required. */
*/ #define PRINT_ASSERT(file, line) \
#define PRINT_ASSERT(file, line) \ printf("Assertion failed in \"%s\" at line %u\n\r", ((file) == NULL) ? "" : (file), (unsigned)(line))
(void)printf("Assertion failed in \"%s\" at line %u\n\r", ((file) == NULL) ? "" : (file), (unsigned)(line)) #endif
#else
#define PRINT_ASSERT(file, line) do { (void)(file); (void)(line); } while(false)
#endif /* REDCONF_OUTPUT == 1 */ /** Cast a value to unsigned long.
#endif /* REDCONF_ASSERTS == 1 */
Usages of this macro deviate from MISRA C:2012 Directive 4.6. This macro is
used in two places to cast a uint64_t value (used by the block device
/** Cast a value to unsigned long. abstraction for sector numbers) to unsigned long, since third-party code
which is not under the control of this project uses unsigned long for sector
Usages of this macro deviate from MISRA C:2012 Directive 4.6. This macro is numbers. The cast is guaranteed to not lose any information, since when the
used in two places to cast a uint64_t value (used by the block device disk is opened the sector count is verified to be less than or equal to an
abstraction for sector numbers) to unsigned long, since third-party code unsigned long value. The text of the directive mentions that "it might be
which is not under the control of this project uses unsigned long for sector desirable not to apply this guideline when interfacing with ... code outside
numbers. The cast is guaranteed to not lose any information, since when the the project's control", which describes the situation for this deviation.
disk is opened the sector count is verified to be less than or equal to an
unsigned long value. The text of the directive mentions that "it might be As Directive 4.6 is advisory, a deviation record is not required. This
desirable not to apply this guideline when interfacing with ... code outside notice is the only record of the deviation.
the project's control", which describes the situation for this deviation. */
#define CAST_ULONG(ull) ((unsigned long)(ull))
As Directive 4.6 is advisory, a deviation record is not required. This
notice is the only record of the deviation.
*/ /** Cast a const-qualified pointer to a pointer which is *not* const-qualified.
#define CAST_ULONG(ull) ((unsigned long)(ull))
Usages of this macro deviate from MISRA C:2012 Rule 11.8. This macro is
used in exactly one place in order to cope with a poorly designed
/** Cast a const-qualified pointer to a pointer which is *not* const-qualified. third-party interface. Reliance Edge, at every level of the stack, uses
const-qualified pointers for buffers used in write operations, since the
Usages of this macro deviate from MISRA C:2012 Rule 11.8. This macro is data is read from the buffer, and the buffer does not need to be modified
used in exactly one place in order to cope with a poorly designed (consistent with Rule 8.13). One of the third-party block device interfaces
third-party interface. Reliance Edge, at every level of the stack, uses that Reliance Edge interfaces with does not follow this convention: it uses
const-qualified pointers for buffers used in write operations, since the an unqualified pointer for the buffer parameter of its sector write
data is read from the buffer, and the buffer does not need to be modified function. This forces the need for the cast to avoid warnings. The
(consistent with Rule 8.13). One of the third-party block device interfaces implementation of the sector write function is provided by the user, so it
that Reliance Edge interfaces with does not follow this convention: it uses is to be hoped that the buffer is not actually modified.
an unqualified pointer for the buffer parameter of its sector write
function. This forces the need for the cast to avoid warnings. The As Rule 11.8 is required, a separate deviation record is required.
implementation of the sector write function is provided by the user, so it */
is to be hoped that the buffer is not actually modified. #define CAST_AWAY_CONST(type, ptr) ((type *)(ptr))
As Rule 11.8 is required, a separate deviation record is required.
*/ /** Allocate zero-initialized (cleared) memory.
#define CAST_AWAY_CONST(type, ptr) ((type *)(ptr))
All usages of this macro deviate from MISRA C:2012 Directive 4.12 (required)
and Rule 21.3 (required). In the context of the single place it is actually
/** Allocate zero-initialized (cleared) memory. used, this macro also deviates from Rule 22.1 (required).
All usages of this macro deviate from MISRA C:2012 Directive 4.12 (required) This macro is used in the FreeRTOS block device code in order to allocate a
and Rule 21.3 (required). In the context of the single place it is actually RAM disk, when that implementation of the block device is selected. The
used, this macro also deviates from Rule 22.1 (required). primary rationale for all these deviations is that a) the RAM disk cannot be
allocated statically (since the volume information is stored in a
This macro is used in the FreeRTOS block device code in order to allocate a structure), and b) the RAM disk is primarily intended as a temporary testing
RAM disk, when that implementation of the block device is selected. The tool for users who want to try out Reliance Edge before the real storage
primary rationale for all these deviations is that a) the RAM disk cannot be media is available. In most real systems, Reliance Edge is used with
allocated statically (since the volume information is stored in a non-volatile storage like SD/MMC or eMMC, not with RAM disks.
structure), and b) the RAM disk is primarily intended as a temporary testing
tool for users who want to try out Reliance Edge before the real storage Rule 22.1 states that all resources which are allocated must also be
media is available. In most real systems, Reliance Edge is used with explicitly freed. The RAM disk is allocated and never freed, deviating from
non-volatile storage like SD/MMC or eMMC, not with RAM disks. that rule. This is done because the data in the RAM disk is emulating a
non-volatile storage medium, and thus needs to persist even after the block
Rule 22.1 states that all resources which are allocated must also be device is closed, to allow the file system to be ormatted and then mounted,
explicitly freed. The RAM disk is allocated and never freed, deviating from or unmounted and remounted in the course of a test. Thus the memory will
that rule. This is done because the data in the RAM disk is emulating a remain allocated until the target device is rebooted. This is assumed to be
non-volatile storage medium, and thus needs to persist even after the block acceptable for the primary purpose of the RAM disk, which is preliminary
device is closed, to allow the file system to be ormatted and then mounted, testing.
or unmounted and remounted in the course of a test. Thus the memory will
remain allocated until the target device is rebooted. This is assumed to be As Directive 4.12, Rule 21.3, and Rule 22.1 are all required, separate
acceptable for the primary purpose of the RAM disk, which is preliminary deviation records are required.
testing. */
#define ALLOCATE_CLEARED_MEMORY(nelem, elsize) calloc(nelem, elsize)
As Directive 4.12, Rule 21.3, and Rule 22.1 are all required, separate
deviation records are required.
*/ #if REDCONF_OUTPUT == 1
#define ALLOCATE_CLEARED_MEMORY(nelem, elsize) calloc(nelem, elsize) /** Output a character to a serial port or other display device.
Usages of this macro deviate from MISRA C:2012 Rule 21.6 (required).
#if REDCONF_OUTPUT == 1 FreeRTOS does not include a standard method of printing characters, so
/** Output a character to a serial port or other display device. putchar() is the most convenient and portable way to accomplish the task.
The risk of "unspecified, undefined and implementation-defined" behavior
Usages of this macro deviate from MISRA C:2012 Rule 21.6 (required). causing problems (as cited in the rationale for the rule) is small. The
FreeRTOS does not include a standard method of printing characters, so driver does not depend on the character being outputted correctly.
putchar() is the most convenient and portable way to accomplish the task. Furthermore, use of putchar() disappears when output is disabled.
The risk of "unspecified, undefined and implementation-defined" behavior
causing problems (as cited in the rationale for the rule) is small. The As Rule 21.6 is required, a separate deviation record is required.
driver does not depend on the character being outputted correctly. */
Furthermore, use of putchar() disappears when output is disabled. #define OUTPUT_CHARACTER(ch) (void)putchar(ch)
#endif
As Rule 21.6 is required, a separate deviation record is required.
*/
#define OUTPUT_CHARACTER(ch) (void)putchar(ch) #if (REDCONF_TASK_COUNT > 1U) && (REDCONF_API_POSIX == 1)
#endif /** Cast a TaskHandle_t (a pointer type) to uintptr_t.
Usage of this macro deivate from MISRA-C:2012 Rule 11.4 (advisory). This
#if (REDCONF_TASK_COUNT > 1U) && (REDCONF_API_POSIX == 1) macro is used for the FreeRTOS version of RedOsTaskId(). Some RTOSes
/** Cast a TaskHandle_t (a pointer type) to uintptr_t. natively use an integer for task IDs; others use pointers. RedOsTaskId()
uses integers, FreeRTOS uses pointers; to reconcile this difference, the
Usage of this macro deivate from MISRA-C:2012 Rule 11.4 (advisory). This pointer must be cast to integer. This is fairly safe, since the resulting
macro is used for the FreeRTOS version of RedOsTaskId(). Some RTOSes integer is never cast back to a pointer; and although the integer
natively use an integer for task IDs; others use pointers. RedOsTaskId() representation of a pointer is implementation-defined, the representation is
uses integers, FreeRTOS uses pointers; to reconcile this difference, the irrelevant provided that unique pointers are converted to unique integers.
pointer must be cast to integer. This is fairly safe, since the resulting
integer is never cast back to a pointer; and although the integer As Rule 11.4 is advisory, a deviation record is not required. This notice
representation of a pointer is implementation-defined, the representation is is the only record of the deviation.
irrelevant provided that unique pointers are converted to unique integers. */
#define CAST_TASK_PTR_TO_UINTPTR(taskptr) ((uintptr_t)(taskptr))
As Rule 11.4 is advisory, a deviation record is not required. This notice #endif
is the only record of the deviation.
*/
#define CAST_TASK_PTR_TO_UINTPTR(taskptr) ((uintptr_t)(taskptr)) /** Ignore the return value of a function (cast to void)
#endif
Usages of this macro deviate from MISRA C:2012 Directive 4.7, which states
that error information must be checked immediately after a function returns
#endif potential error information.
If asserts and output are enabled, then this macro is used to document that
the return value of printf() is ignored. A failure of printf() does not
impact the filesystem core, nor is there anything the filesystem can do to
respond to such an error (especially since it occurs within an assert).
Thus, the most reasonable action is to ignore the error.
In the STM32 SDIO block device implementation, errors are also ignored in an
IRQ interrupt handler. This is the most reasonable action to take for two
reasons: (a) it would be dangerous to spend processor time responding to the
error inside the IRQ handler; (b) it has been verified that the same error
is propegated to the DiskRead/Write method, which does return the error to
the core.
In the Atmel SD/MMC block device implementation, error information from
sd_mmc_read_capacity() is ignored. This is a reasonable action because all
of the possible error conditions were eliminated by a previous check.
sd_mmc_read_capacity() fails under the same conditions as
sd_mmc_test_unit_ready(), which was checked ealier in the same function.
In the mutex module, error information returned from the mutex release
function is ignored when asserts are disabled. This is a reasonable action
because the mutex release function (xSemaphoreGive) is documented only to
fail if the mutex was not obtained correctly, which can be demonstrably
avoided.
As Directive 4.7 is required, a separate deviation record is required.
*/
#define IGNORE_ERRORS(fn) ((void) (fn))
/** @brief Determine whether a pointer is aligned on a 32-bit boundary.
This is used to determine whether a data buffer meets the requirements of
the underlying block device implementation. When transferring data via
DMA (Direct Memory Access) on an STM32 device, the data buffer must be cast
as a uint32 pointer, and unexpected behavior may occur if the buffer is not
aligned correctly.
There is no way to perform this check without deviating from MISRA C rules
against casting pointers to integer types. Usage of this macro deviates
from MISRA C:2012 Rule 11.4 (advisory). The main rationale the rule cites
against converting pointers to integers is that the chosen integer type may
not be able to represent the pointer; this is a non-issue here since we use
uintptr_t. The text says the rule still applies when using uintptr_t due to
concern about unaligned pointers, but that is not an issue here since the
integer value of the pointer is not saved and not converted back into a
pointer and dereferenced. The result of casting a pointer to a sufficiently
large integer is implementation-defined, but macros similar to this one have
been used by Datalight for a long time in a wide variety of environments and
they have always worked as expected.
This deviation only occurs when using the STM32 SDIO block device
implementation.
As Rule 11.4 is advisory, a deviation record is not required. This notice
is the only record of deviation.
*/
#define IS_UINT32_ALIGNED_PTR(ptr) (((uintptr_t)(ptr) & (sizeof(uint32_t) - 1U)) == 0U)
/** @brief Cast a 32-bit aligned void pointer to a uint32 pointer.
Usages of this macro deviate from MISRA C:2012 Rule 11.5 (advisory). A
cast from a void pointer to an object pointer is discouraged because of
potential alignment issues. However, this macro is only used to cast
pointers that have already been tested to be 32-bit aligned, so the
operation will be safe.
This deviation only occurs when using the STM32 SDIO block device
implementation.
As rule 11.5 is advisory, a deviation record is not required. This notice
is the only record of the deviation.
*/
#define CAST_UINT32_PTR(ptr) ((uint32_t *) (ptr))
#endif

@ -1,54 +1,56 @@
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <---- /* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
Copyright (c) 2014-2015 Datalight, Inc. Copyright (c) 2014-2015 Datalight, Inc.
All Rights Reserved Worldwide. All Rights Reserved Worldwide.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; use version 2 of the License. the Free Software Foundation; use version 2 of the License.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc., with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
/* Businesses and individuals that for commercial or other reasons cannot /* Businesses and individuals that for commercial or other reasons cannot
comply with the terms of the GPLv2 license may obtain a commercial license comply with the terms of the GPLv2 license may obtain a commercial license
before incorporating Reliance Edge into proprietary software for before incorporating Reliance Edge into proprietary software for
distribution in any form. Visit http://www.datalight.com/reliance-edge for distribution in any form. Visit http://www.datalight.com/reliance-edge for
more information. more information.
*/ */
/** @file /** @file
@brief Implements assertion handling. @brief Implements assertion handling.
*/ */
#include <redfs.h> #include <redfs.h>
#if REDCONF_ASSERTS == 1 #if REDCONF_ASSERTS == 1
#include <redosdeviations.h> #include <redosdeviations.h>
/** @brief Invoke the native assertion handler. /** @brief Invoke the native assertion handler.
@param pszFileName Null-terminated string containing the name of the file @param pszFileName Null-terminated string containing the name of the file
where the assertion fired. where the assertion fired.
@param ulLineNum Line number in @p pszFileName where the assertion @param ulLineNum Line number in @p pszFileName where the assertion
fired. fired.
*/ */
void RedOsAssertFail( void RedOsAssertFail(
const char *pszFileName, const char *pszFileName,
uint32_t ulLineNum) uint32_t ulLineNum)
{ {
PRINT_ASSERT(pszFileName, ulLineNum); #if REDCONF_OUTPUT == 1
IGNORE_ERRORS(PRINT_ASSERT(pszFileName, ulLineNum));
for( ;; ) #endif
{
} while(true)
} {
}
#endif }
#endif

@ -1,120 +1,134 @@
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <---- /* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
Copyright (c) 2014-2015 Datalight, Inc. Copyright (c) 2014-2015 Datalight, Inc.
All Rights Reserved Worldwide. All Rights Reserved Worldwide.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; use version 2 of the License. the Free Software Foundation; use version 2 of the License.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc., with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
/* Businesses and individuals that for commercial or other reasons cannot /* Businesses and individuals that for commercial or other reasons cannot
comply with the terms of the GPLv2 license may obtain a commercial license comply with the terms of the GPLv2 license may obtain a commercial license
before incorporating Reliance Edge into proprietary software for before incorporating Reliance Edge into proprietary software for
distribution in any form. Visit http://www.datalight.com/reliance-edge for distribution in any form. Visit http://www.datalight.com/reliance-edge for
more information. more information.
*/ */
/** @file /** @file
@brief Implements a synchronization object to provide mutual exclusion. @brief Implements a synchronization object to provide mutual exclusion.
*/ */
#include <FreeRTOS.h> #include <FreeRTOS.h>
#include <semphr.h> #include <semphr.h>
#include <redfs.h> #include <redfs.h>
#include <redosdeviations.h>
#if REDCONF_TASK_COUNT > 1U
#if REDCONF_TASK_COUNT > 1U
static SemaphoreHandle_t xMutex;
static SemaphoreHandle_t xMutex;
#if defined(configSUPPORT_STATIC_ALLOCATION) && (configSUPPORT_STATIC_ALLOCATION == 1)
/** @brief Initialize the mutex. static StaticSemaphore_t xMutexBuffer;
#endif
After initialization, the mutex is in the released state.
The behavior of calling this function when the mutex is still initialized /** @brief Initialize the mutex.
is undefined.
After initialization, the mutex is in the released state.
@return A negated ::REDSTATUS code indicating the operation result.
The behavior of calling this function when the mutex is still initialized
@retval 0 Operation was successful. is undefined.
*/
REDSTATUS RedOsMutexInit(void) @return A negated ::REDSTATUS code indicating the operation result.
{
REDSTATUS ret; @retval 0 Operation was successful.
*/
xMutex = xSemaphoreCreateMutex(); REDSTATUS RedOsMutexInit(void)
if(xMutex != NULL) {
{ REDSTATUS ret = 0;
ret = 0;
} #if defined(configSUPPORT_STATIC_ALLOCATION) && (configSUPPORT_STATIC_ALLOCATION == 1)
else xMutex = xSemaphoreCreateMutexStatic(&xMutexBuffer);
{
ret = -RED_ENOMEM; if(xMutex == NULL)
} {
/* The only error case for xSemaphoreCreateMutexStatic is that the mutex
return ret; buffer parameter is NULL, which is not the case.
} */
REDERROR();
ret = -RED_EINVAL;
/** @brief Uninitialize the mutex. }
The behavior of calling this function when the mutex is not initialized is #else
undefined; likewise, the behavior of uninitializing the mutex when it is xMutex = xSemaphoreCreateMutex();
in the acquired state is undefined. if(xMutex == NULL)
{
@return A negated ::REDSTATUS code indicating the operation result. ret = -RED_ENOMEM;
}
@retval 0 Operation was successful. #endif
*/
REDSTATUS RedOsMutexUninit(void) return ret;
{ }
vSemaphoreDelete(xMutex);
xMutex = NULL;
/** @brief Uninitialize the mutex.
return 0;
} The behavior of calling this function when the mutex is not initialized is
undefined; likewise, the behavior of uninitializing the mutex when it is
in the acquired state is undefined.
/** @brief Acquire the mutex.
@return A negated ::REDSTATUS code indicating the operation result.
The behavior of calling this function when the mutex is not initialized is
undefined; likewise, the behavior of recursively acquiring the mutex is @retval 0 Operation was successful.
undefined. */
*/ REDSTATUS RedOsMutexUninit(void)
void RedOsMutexAcquire(void) {
{ vSemaphoreDelete(xMutex);
while(xSemaphoreTake(xMutex, portMAX_DELAY) != pdTRUE) xMutex = NULL;
{
} return 0;
} }
/** @brief Release the mutex. /** @brief Acquire the mutex.
The behavior is undefined in the following cases: The behavior of calling this function when the mutex is not initialized is
undefined; likewise, the behavior of recursively acquiring the mutex is
- Releasing the mutex when the mutex is not initialized. undefined.
- Releasing the mutex when it is not in the acquired state. */
- Releasing the mutex from a task or thread other than the one which void RedOsMutexAcquire(void)
acquired the mutex. {
*/ while(xSemaphoreTake(xMutex, portMAX_DELAY) != pdTRUE)
void RedOsMutexRelease(void) {
{ }
BaseType_t xSuccess; }
xSuccess = xSemaphoreGive(xMutex);
REDASSERT(xSuccess == pdTRUE); /** @brief Release the mutex.
(void)xSuccess;
} The behavior is undefined in the following cases:
#endif - Releasing the mutex when the mutex is not initialized.
- Releasing the mutex when it is not in the acquired state.
- Releasing the mutex from a task or thread other than the one which
acquired the mutex.
*/
void RedOsMutexRelease(void)
{
BaseType_t xSuccess;
xSuccess = xSemaphoreGive(xMutex);
REDASSERT(xSuccess == pdTRUE);
IGNORE_ERRORS(xSuccess);
}
#endif

@ -891,6 +891,7 @@ static PRINTTYPE ParseFormatType(
case 'u': case 'u':
fmtType = MAPULONGLONG; fmtType = MAPULONGLONG;
break; break;
case 'x':
case 'X': case 'X':
fmtType = MAPHEXULONGLONG; fmtType = MAPHEXULONGLONG;
break; break;

Loading…
Cancel
Save