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] =
{
{ 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\timers.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\redconf.h" />
<ClInclude Include="ConfigurationFiles\redtypes.h" />

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

@ -1,164 +1,198 @@
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
Copyright (c) 2014-2015 Datalight, Inc.
All Rights Reserved Worldwide.
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
the Free Software Foundation; use version 2 of the License.
This program is distributed in the hope that it will be useful,
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* Businesses and individuals that for commercial or other reasons cannot
comply with the terms of the GPLv2 license may obtain a commercial license
before incorporating Reliance Edge into proprietary software for
distribution in any form. Visit http://www.datalight.com/reliance-edge for
more information.
*/
/** @file
@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
in terms of logical blocks: this module translates from logical blocks to
sectors.
*/
#include <redfs.h>
#include <redcore.h>
/** @brief Read a range of logical blocks.
@param bVolNum The volume whose block device is being read from.
@param ulBlockStart The first block to read.
@param ulBlockCount The number of blocks to read.
@param pBuffer The buffer to populate with the data read.
@return A negated ::REDSTATUS code indicating the operation result.
@retval 0 Operation was successful.
@retval -RED_EIO A disk I/O error occurred.
@retval -RED_EINVAL Invalid parameters.
*/
REDSTATUS RedIoRead(
uint8_t bVolNum,
uint32_t ulBlockStart,
uint32_t ulBlockCount,
void *pBuffer)
{
REDSTATUS ret;
if( (bVolNum >= REDCONF_VOLUME_COUNT)
|| (ulBlockStart >= gaRedVolume[bVolNum].ulBlockCount)
|| ((gaRedVolume[bVolNum].ulBlockCount - ulBlockStart) < ulBlockCount)
|| (ulBlockCount == 0U)
|| (pBuffer == NULL))
{
REDERROR();
ret = -RED_EINVAL;
}
else
{
uint8_t bSectorShift = gaRedVolume[bVolNum].bBlockSectorShift;
uint64_t ullSectorStart = (uint64_t)ulBlockStart << bSectorShift;
uint32_t ulSectorCount = ulBlockCount << bSectorShift;
REDASSERT(bSectorShift < 32U);
REDASSERT((ulSectorCount >> bSectorShift) == ulBlockCount);
ret = RedOsBDevRead(bVolNum, ullSectorStart, ulSectorCount, pBuffer);
}
CRITICAL_ASSERT(ret == 0);
return ret;
}
#if REDCONF_READ_ONLY == 0
/** @brief Write a range of logical blocks.
@param bVolNum The volume whose block device is being written to.
@param ulBlockStart The first block to write.
@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.
@retval 0 Operation was successful.
@retval -RED_EIO A disk I/O error occurred.
@retval -RED_EINVAL Invalid parameters.
*/
REDSTATUS RedIoWrite(
uint8_t bVolNum,
uint32_t ulBlockStart,
uint32_t ulBlockCount,
const void *pBuffer)
{
REDSTATUS ret;
if( (bVolNum >= REDCONF_VOLUME_COUNT)
|| (ulBlockStart >= gaRedVolume[bVolNum].ulBlockCount)
|| ((gaRedVolume[bVolNum].ulBlockCount - ulBlockStart) < ulBlockCount)
|| (ulBlockCount == 0U)
|| (pBuffer == NULL))
{
REDERROR();
ret = -RED_EINVAL;
}
else
{
uint8_t bSectorShift = gaRedVolume[bVolNum].bBlockSectorShift;
uint64_t ullSectorStart = (uint64_t)ulBlockStart << bSectorShift;
uint32_t ulSectorCount = ulBlockCount << bSectorShift;
REDASSERT(bSectorShift < 32U);
REDASSERT((ulSectorCount >> bSectorShift) == ulBlockCount);
ret = RedOsBDevWrite(bVolNum, ullSectorStart, ulSectorCount, pBuffer);
}
CRITICAL_ASSERT(ret == 0);
return ret;
}
/** @brief Flush any caches beneath the file system.
@param bVolNum The volume number of the volume whose block device is being
flushed.
@return A negated ::REDSTATUS code indicating the operation result.
@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;
if(bVolNum >= REDCONF_VOLUME_COUNT)
{
REDERROR();
ret = -RED_EINVAL;
}
else
{
ret = RedOsBDevFlush(bVolNum);
}
CRITICAL_ASSERT(ret == 0);
return ret;
}
#endif /* REDCONF_READ_ONLY == 0 */
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
Copyright (c) 2014-2015 Datalight, Inc.
All Rights Reserved Worldwide.
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
the Free Software Foundation; use version 2 of the License.
This program is distributed in the hope that it will be useful,
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* Businesses and individuals that for commercial or other reasons cannot
comply with the terms of the GPLv2 license may obtain a commercial license
before incorporating Reliance Edge into proprietary software for
distribution in any form. Visit http://www.datalight.com/reliance-edge for
more information.
*/
/** @file
@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
in terms of logical blocks: this module translates from logical blocks to
sectors.
If bBlockIoRetries is greater than 0 for the current volume, then this
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
fail but the next may still succeed.
*/
#include <redfs.h>
#include <redcore.h>
/** @brief Read a range of logical blocks.
@param bVolNum The volume whose block device is being read from.
@param ulBlockStart The first block to read.
@param ulBlockCount The number of blocks to read.
@param pBuffer The buffer to populate with the data read.
@return A negated ::REDSTATUS code indicating the operation result.
@retval 0 Operation was successful.
@retval -RED_EIO A disk I/O error occurred.
@retval -RED_EINVAL Invalid parameters.
*/
REDSTATUS RedIoRead(
uint8_t bVolNum,
uint32_t ulBlockStart,
uint32_t ulBlockCount,
void *pBuffer)
{
REDSTATUS ret = 0;
if( (bVolNum >= REDCONF_VOLUME_COUNT)
|| (ulBlockStart >= gaRedVolume[bVolNum].ulBlockCount)
|| ((gaRedVolume[bVolNum].ulBlockCount - ulBlockStart) < ulBlockCount)
|| (ulBlockCount == 0U)
|| (pBuffer == NULL))
{
REDERROR();
ret = -RED_EINVAL;
}
else
{
uint8_t bSectorShift = gaRedVolume[bVolNum].bBlockSectorShift;
uint64_t ullSectorStart = (uint64_t)ulBlockStart << bSectorShift;
uint32_t ulSectorCount = ulBlockCount << bSectorShift;
uint8_t bRetryIdx;
REDASSERT(bSectorShift < 32U);
REDASSERT((ulSectorCount >> bSectorShift) == ulBlockCount);
for(bRetryIdx = 0U; bRetryIdx <= gpRedVolConf->bBlockIoRetries; bRetryIdx++)
{
ret = RedOsBDevRead(bVolNum, ullSectorStart, ulSectorCount, pBuffer);
if(ret == 0)
{
break;
}
}
}
CRITICAL_ASSERT(ret == 0);
return ret;
}
#if REDCONF_READ_ONLY == 0
/** @brief Write a range of logical blocks.
@param bVolNum The volume whose block device is being written to.
@param ulBlockStart The first block to write.
@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.
@retval 0 Operation was successful.
@retval -RED_EIO A disk I/O error occurred.
@retval -RED_EINVAL Invalid parameters.
*/
REDSTATUS RedIoWrite(
uint8_t bVolNum,
uint32_t ulBlockStart,
uint32_t ulBlockCount,
const void *pBuffer)
{
REDSTATUS ret = 0;
if( (bVolNum >= REDCONF_VOLUME_COUNT)
|| (ulBlockStart >= gaRedVolume[bVolNum].ulBlockCount)
|| ((gaRedVolume[bVolNum].ulBlockCount - ulBlockStart) < ulBlockCount)
|| (ulBlockCount == 0U)
|| (pBuffer == NULL))
{
REDERROR();
ret = -RED_EINVAL;
}
else
{
uint8_t bSectorShift = gaRedVolume[bVolNum].bBlockSectorShift;
uint64_t ullSectorStart = (uint64_t)ulBlockStart << bSectorShift;
uint32_t ulSectorCount = ulBlockCount << bSectorShift;
uint8_t bRetryIdx;
REDASSERT(bSectorShift < 32U);
REDASSERT((ulSectorCount >> bSectorShift) == ulBlockCount);
for(bRetryIdx = 0U; bRetryIdx <= gpRedVolConf->bBlockIoRetries; bRetryIdx++)
{
ret = RedOsBDevWrite(bVolNum, ullSectorStart, ulSectorCount, pBuffer);
if(ret == 0)
{
break;
}
}
}
CRITICAL_ASSERT(ret == 0);
return ret;
}
/** @brief Flush any caches beneath the file system.
@param bVolNum The volume number of the volume whose block device is being
flushed.
@return A negated ::REDSTATUS code indicating the operation result.
@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
This file contains a list of updates made to Reliance Edge over the course of
recent releases and a list of known issues.
## Release History and Changes
### Reliance Edge v1.0, July 2015
#### Common Code Changes
- 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
available.
- 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
as `-H` and `--help`) instead of DOS-style switches (such as `/?`).
- 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,
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.
# Reliance Edge Release Notes
This file contains a list of updates made to Reliance Edge over the course of
recent releases and a list of known issues.
## Release History and Changes
### Reliance Edge v1.0.4, July 2016
- 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.
- Some minor deficiencies in the POSIX-like API test suite have been addressed.
### Reliance Edge v1.0.3, June 2016
- Added support for static memory allocation configuration in FreeRTOS
version 9. No common code changes.
### Reliance Edge v1.0.2, February 2016
#### Common Code Changes
- A new per-volume configuration option has been added: users can specify a
number of times to retry a block device read, write or flush operation before
returning a failure. The configuration tool has been updated to version 1.0.2
with this change.
- This added a new field to the volume configuration in to redconf.c: existing
redconf.c files from v1.0.1 and earlier must be updated to work with v1.0.2.
Open redconf.h and redconf.c with the configuration tool, enable
"Retry block device I/O on failure" for any volumes if desired, and save the
redconf files.
#### FreeRTOS Port Changes
- Added support for the STM32 HAL SD card driver in the FreeRTOS block device
interface. Two boards are supported out-of-the-box: the STM324xG-EVAL and the
STM32F746NG-Discovery. A sample project is included for the STM324xG-EVAL.
#### MQX Port Changes
- Fixed a bug which prevented Reliance Edge from compiling if the File System
Essentials API was selected in the configuration.
- Fixed a bug which would have returned an uninitialized value from
`RedOsBDevFlush()` for block devices that support flushing.
### Reliance Edge v1.0.1, October 2015
- Added MQX RTOS support in the commercial kit, with example projects for
the Kinetis Design Studio.
- Bug fix in the F_DRIVER implementation of the FreeRTOS block device service.
### Reliance Edge v1.0, July 2015
#### Common Code Changes
- 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
available.
- 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
as `-H` and `--help`) instead of DOS-style switches (such as `/?`).
- 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,
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
This file contains a list of updates made to Reliance Edge over the
course of recent releases and a list of known issues.
Release History and Changes
Reliance Edge v1.0, July 2015
Common Code Changes
- 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 available.
- 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 as -H and --help) instead of DOS-style switches
(such as /?).
- 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, 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.
RELIANCE EDGE RELEASE NOTES
This file contains a list of updates made to Reliance Edge over the
course of recent releases and a list of known issues.
Release History and Changes
Reliance Edge v1.0.4, July 2016
- 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.
- Some minor deficiencies in the POSIX-like API test suite have
been addressed.
Reliance Edge v1.0.3, June 2016
- Added support for static memory allocation configuration in FreeRTOS
version 9. No common code changes.
Reliance Edge v1.0.2, February 2016
Common Code Changes
- A new per-volume configuration option has been added: users can
specify a number of times to retry a block device read, write or
flush operation before returning a failure. The configuration tool
has been updated to version 1.0.2 with this change.
- This added a new field to the volume configuration in to redconf.c:
existing redconf.c files from v1.0.1 and earlier must be updated to
work with v1.0.2. Open redconf.h and redconf.c with the
configuration tool, enable "Retry block device I/O on failure" for
any volumes if desired, and save the redconf files.
FreeRTOS Port Changes
- Added support for the STM32 HAL SD card driver in the FreeRTOS block
device interface. Two boards are supported out-of-the-box: the
STM324xG-EVAL and the STM32F746NG-Discovery. A sample project is
included for the STM324xG-EVAL.
MQX Port Changes
- Fixed a bug which prevented Reliance Edge from compiling if the File
System Essentials API was selected in the configuration.
- Fixed a bug which would have returned an uninitialized value from
RedOsBDevFlush() for block devices that support flushing.
Reliance Edge v1.0.1, October 2015
- Added MQX RTOS support in the commercial kit, with example projects
for the Kinetis Design Studio.
- Bug fix in the F_DRIVER implementation of the FreeRTOS block
device service.
Reliance Edge v1.0, July 2015
Common Code Changes
- 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 available.
- 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 as -H and --help) instead of DOS-style switches
(such as /?).
- 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, 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 <----
Copyright (c) 2014-2015 Datalight, Inc.
All Rights Reserved Worldwide.
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
the Free Software Foundation; use version 2 of the License.
This program is distributed in the hope that it will be useful,
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* Businesses and individuals that for commercial or other reasons cannot
comply with the terms of the GPLv2 license may obtain a commercial license
before incorporating Reliance Edge into proprietary software for
distribution in any form. Visit http://www.datalight.com/reliance-edge for
more information.
*/
/** @file
@brief Interfaces of path utilities for the POSIX-like API layer.
*/
#ifndef REDPATH_H
#define REDPATH_H
REDSTATUS RedPathSplit(const char *pszPath, uint8_t *pbVolNum, const char **ppszLocalPath);
REDSTATUS RedPathLookup(const char *pszLocalPath, uint32_t *pulInode);
REDSTATUS RedPathToName(const char *pszLocalPath, uint32_t *pulPInode, const char **ppszName);
#endif
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
Copyright (c) 2014-2015 Datalight, Inc.
All Rights Reserved Worldwide.
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
the Free Software Foundation; use version 2 of the License.
This program is distributed in the hope that it will be useful,
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* Businesses and individuals that for commercial or other reasons cannot
comply with the terms of the GPLv2 license may obtain a commercial license
before incorporating Reliance Edge into proprietary software for
distribution in any form. Visit http://www.datalight.com/reliance-edge for
more information.
*/
/** @file
@brief Interfaces of path utilities for the POSIX-like API layer.
*/
#ifndef REDPATH_H
#define REDPATH_H
REDSTATUS RedPathSplit(const char *pszPath, uint8_t *pbVolNum, const char **ppszLocalPath);
REDSTATUS RedPathLookup(const char *pszLocalPath, uint32_t *pulInode);
REDSTATUS RedPathToName(const char *pszLocalPath, uint32_t *pulPInode, const char **ppszName);
#endif

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

@ -1,134 +1,141 @@
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
Copyright (c) 2014-2015 Datalight, Inc.
All Rights Reserved Worldwide.
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
the Free Software Foundation; use version 2 of the License.
This program is distributed in the hope that it will be useful,
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* Businesses and individuals that for commercial or other reasons cannot
comply with the terms of the GPLv2 license may obtain a commercial license
before incorporating Reliance Edge into proprietary software for
distribution in any form. Visit http://www.datalight.com/reliance-edge for
more information.
*/
/** @file
*/
#ifndef REDVOLUME_H
#define REDVOLUME_H
/** @brief Per-volume configuration structure.
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
statically initialized with values representing the volume configuration of
the target system.
*/
typedef struct
{
/** The sector size for the block device underlying the volume: the basic
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
block size will work.
*/
uint32_t ulSectorSize;
/** The number of sectors in this file system volume.
*/
uint64_t ullSectorCount;
/** Whether a sector write on the block device underlying the volume is
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,
or all of the old data. If unsure, leave as false.
*/
bool fAtomicSectorWrite;
/** This is the maximum number of inodes (files and directories). This
number includes the root directory inode (inode 2; created during
format), but does not include inodes 0 or 1, which do not exist on
disk. The number of inodes cannot be less than 1.
*/
uint32_t ulInodeCount;
#if REDCONF_API_POSIX == 1
/** The path prefix for the volume; for example, "VOL1:", "FlashDisk", etc.
*/
const char *pszPathPrefix;
#endif
} VOLCONF;
extern const VOLCONF gaRedVolConf[REDCONF_VOLUME_COUNT];
extern const VOLCONF * CONST_IF_ONE_VOLUME gpRedVolConf;
/** @brief Per-volume run-time data.
*/
typedef struct
{
/** Whether the volume is currently mounted.
*/
bool fMounted;
#if REDCONF_READ_ONLY == 0
/** Whether the volume is read-only.
*/
bool fReadOnly;
/** The active automatic transaction mask.
*/
uint32_t ulTransMask;
#endif
/** The power of 2 difference between sector size and block size.
*/
uint8_t bBlockSectorShift;
/** The number of logical blocks in this file system volume. The unit here
is the global block size.
*/
uint32_t ulBlockCount;
/** The total number of allocable blocks; Also the maximum count of free
blocks.
*/
uint32_t ulBlocksAllocable;
/** The maximum number of bytes that an inode is capable of addressing.
*/
uint64_t ullMaxInodeSize;
/** The current metadata sequence number. This value is included in all
metadata nodes and incremented every time a metadata node is written.
It is assumed to never wrap around.
*/
uint64_t ullSequence;
} VOLUME;
/* Array of VOLUME structures, populated at during RedCoreInit().
*/
extern VOLUME gaRedVolume[REDCONF_VOLUME_COUNT];
/* Volume number currently being accessed; populated during
RedCoreVolSetCurrent().
*/
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
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
Copyright (c) 2014-2015 Datalight, Inc.
All Rights Reserved Worldwide.
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
the Free Software Foundation; use version 2 of the License.
This program is distributed in the hope that it will be useful,
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* Businesses and individuals that for commercial or other reasons cannot
comply with the terms of the GPLv2 license may obtain a commercial license
before incorporating Reliance Edge into proprietary software for
distribution in any form. Visit http://www.datalight.com/reliance-edge for
more information.
*/
/** @file
*/
#ifndef REDVOLUME_H
#define REDVOLUME_H
/** @brief Per-volume configuration structure.
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
statically initialized with values representing the volume configuration of
the target system.
*/
typedef struct
{
/** The sector size for the block device underlying the volume: the basic
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
block size will work.
*/
uint32_t ulSectorSize;
/** The number of sectors in this file system volume.
*/
uint64_t ullSectorCount;
/** Whether a sector write on the block device underlying the volume is
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,
or all of the old data. If unsure, leave as false.
*/
bool fAtomicSectorWrite;
/** This is the maximum number of inodes (files and directories). This
number includes the root directory inode (inode 2; created during
format), but does not include inodes 0 or 1, which do not exist on
disk. The number of inodes cannot be less than 1.
*/
uint32_t ulInodeCount;
/** This is the maximum number of times a block device I/O operation will
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
successful. Set this to 0 to disable retries.
*/
uint8_t bBlockIoRetries;
#if REDCONF_API_POSIX == 1
/** The path prefix for the volume; for example, "VOL1:", "FlashDisk", etc.
*/
const char *pszPathPrefix;
#endif
} VOLCONF;
extern const VOLCONF gaRedVolConf[REDCONF_VOLUME_COUNT];
extern const VOLCONF * CONST_IF_ONE_VOLUME gpRedVolConf;
/** @brief Per-volume run-time data.
*/
typedef struct
{
/** Whether the volume is currently mounted.
*/
bool fMounted;
#if REDCONF_READ_ONLY == 0
/** Whether the volume is read-only.
*/
bool fReadOnly;
/** The active automatic transaction mask.
*/
uint32_t ulTransMask;
#endif
/** The power of 2 difference between sector size and block size.
*/
uint8_t bBlockSectorShift;
/** The number of logical blocks in this file system volume. The unit here
is the global block size.
*/
uint32_t ulBlockCount;
/** The total number of allocable blocks; Also the maximum count of free
blocks.
*/
uint32_t ulBlocksAllocable;
/** The maximum number of bytes that an inode is capable of addressing.
*/
uint64_t ullMaxInodeSize;
/** The current metadata sequence number. This value is included in all
metadata nodes and incremented every time a metadata node is written.
It is assumed to never wrap around.
*/
uint64_t ullSequence;
} VOLUME;
/* Array of VOLUME structures, populated at during RedCoreInit().
*/
extern VOLUME gaRedVolume[REDCONF_VOLUME_COUNT];
/* Volume number currently being accessed; populated during
RedCoreVolSetCurrent().
*/
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 <----
Copyright (c) 2014-2015 Datalight, Inc.
All Rights Reserved Worldwide.
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
the Free Software Foundation; use version 2 of the License.
This program is distributed in the hope that it will be useful,
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* Businesses and individuals that for commercial or other reasons cannot
comply with the terms of the GPLv2 license may obtain a commercial license
before incorporating Reliance Edge into proprietary software for
distribution in any form. Visit http://www.datalight.com/reliance-edge for
more information.
*/
/** @file
@brief Macros to encapsulate MISRA C:2012 deviations in OS-specific code.
*/
#ifndef REDOSDEVIATIONS_H
#define REDOSDEVIATIONS_H
#if REDCONF_OUTPUT == 1
/* Needed for PRINT_ASSERT() and OUTPUT_CHARACTER().
*/
#include <stdio.h>
#endif
#if REDCONF_ASSERTS == 1
#if REDCONF_OUTPUT == 1
/** Print a formatted message for an assertion.
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
of "unspecified, undefined and implementation-defined" behavior causing
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
printf() disappears when either asserts or output are disabled.
As Rule 21.6 is required, a separate deviation record is required.
*/
#define PRINT_ASSERT(file, line) \
(void)printf("Assertion failed in \"%s\" at line %u\n\r", ((file) == NULL) ? "" : (file), (unsigned)(line))
#else
#define PRINT_ASSERT(file, line) do { (void)(file); (void)(line); } while(false)
#endif /* REDCONF_OUTPUT == 1 */
#endif /* REDCONF_ASSERTS == 1 */
/** Cast a value to unsigned long.
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
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
numbers. The cast is guaranteed to not lose any information, since when the
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
desirable not to apply this guideline when interfacing with ... code outside
the project's control", which describes the situation for this deviation.
As Directive 4.6 is advisory, a deviation record is not required. This
notice is the only record of the deviation.
*/
#define CAST_ULONG(ull) ((unsigned long)(ull))
/** Cast a const-qualified pointer to a pointer which is *not* const-qualified.
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
third-party interface. Reliance Edge, at every level of the stack, uses
const-qualified pointers for buffers used in write operations, since the
data is read from the buffer, and the buffer does not need to be modified
(consistent with Rule 8.13). One of the third-party block device interfaces
that Reliance Edge interfaces with does not follow this convention: it uses
an unqualified pointer for the buffer parameter of its sector write
function. This forces the need for the cast to avoid warnings. The
implementation of the sector write function is provided by the user, so it
is to be hoped that the buffer is not actually modified.
As Rule 11.8 is required, a separate deviation record is required.
*/
#define CAST_AWAY_CONST(type, ptr) ((type *)(ptr))
/** Allocate zero-initialized (cleared) memory.
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
used, this macro also deviates from Rule 22.1 (required).
This macro is used in the FreeRTOS block device code in order to allocate a
RAM disk, when that implementation of the block device is selected. The
primary rationale for all these deviations is that a) the RAM disk cannot be
allocated statically (since the volume information is stored in a
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
media is available. In most real systems, Reliance Edge is used with
non-volatile storage like SD/MMC or eMMC, not with RAM disks.
Rule 22.1 states that all resources which are allocated must also be
explicitly freed. The RAM disk is allocated and never freed, deviating from
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
device is closed, to allow the file system to be ormatted and then mounted,
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
acceptable for the primary purpose of the RAM disk, which is preliminary
testing.
As Directive 4.12, Rule 21.3, and Rule 22.1 are all required, separate
deviation records are required.
*/
#define ALLOCATE_CLEARED_MEMORY(nelem, elsize) calloc(nelem, elsize)
#if REDCONF_OUTPUT == 1
/** Output a character to a serial port or other display device.
Usages of this macro deviate from MISRA C:2012 Rule 21.6 (required).
FreeRTOS does not include a standard method of printing characters, so
putchar() is the most convenient and portable way to accomplish the task.
The risk of "unspecified, undefined and implementation-defined" behavior
causing problems (as cited in the rationale for the rule) is small. The
driver does not depend on the character being outputted correctly.
Furthermore, use of putchar() disappears when output is disabled.
As Rule 21.6 is required, a separate deviation record is required.
*/
#define OUTPUT_CHARACTER(ch) (void)putchar(ch)
#endif
#if (REDCONF_TASK_COUNT > 1U) && (REDCONF_API_POSIX == 1)
/** Cast a TaskHandle_t (a pointer type) to uintptr_t.
Usage of this macro deivate from MISRA-C:2012 Rule 11.4 (advisory). This
macro is used for the FreeRTOS version of RedOsTaskId(). Some RTOSes
natively use an integer for task IDs; others use pointers. RedOsTaskId()
uses integers, FreeRTOS uses pointers; to reconcile this difference, the
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
representation of a pointer is implementation-defined, the representation is
irrelevant provided that unique pointers are converted to unique integers.
As Rule 11.4 is advisory, a deviation record is not required. This notice
is the only record of the deviation.
*/
#define CAST_TASK_PTR_TO_UINTPTR(taskptr) ((uintptr_t)(taskptr))
#endif
#endif
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
Copyright (c) 2014-2015 Datalight, Inc.
All Rights Reserved Worldwide.
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
the Free Software Foundation; use version 2 of the License.
This program is distributed in the hope that it will be useful,
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* Businesses and individuals that for commercial or other reasons cannot
comply with the terms of the GPLv2 license may obtain a commercial license
before incorporating Reliance Edge into proprietary software for
distribution in any form. Visit http://www.datalight.com/reliance-edge for
more information.
*/
/** @file
@brief Macros to encapsulate MISRA C:2012 deviations in OS-specific code.
*/
#ifndef REDOSDEVIATIONS_H
#define REDOSDEVIATIONS_H
#if REDCONF_OUTPUT == 1
/* Needed for PRINT_ASSERT() and OUTPUT_CHARACTER().
*/
#include <stdio.h>
#endif
#if (REDCONF_ASSERTS == 1) && (REDCONF_OUTPUT == 1)
/** Print a formatted message for an assertion.
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
of "unspecified, undefined and implementation-defined" behavior causing
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
printf() disappears when either asserts or output are disabled.
As Rule 21.6 is required, a separate deviation record is required.
*/
#define PRINT_ASSERT(file, line) \
printf("Assertion failed in \"%s\" at line %u\n\r", ((file) == NULL) ? "" : (file), (unsigned)(line))
#endif
/** Cast a value to unsigned long.
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
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
numbers. The cast is guaranteed to not lose any information, since when the
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
desirable not to apply this guideline when interfacing with ... code outside
the project's control", which describes the situation for this deviation.
As Directive 4.6 is advisory, a deviation record is not required. This
notice is the only record of the deviation.
*/
#define CAST_ULONG(ull) ((unsigned long)(ull))
/** Cast a const-qualified pointer to a pointer which is *not* const-qualified.
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
third-party interface. Reliance Edge, at every level of the stack, uses
const-qualified pointers for buffers used in write operations, since the
data is read from the buffer, and the buffer does not need to be modified
(consistent with Rule 8.13). One of the third-party block device interfaces
that Reliance Edge interfaces with does not follow this convention: it uses
an unqualified pointer for the buffer parameter of its sector write
function. This forces the need for the cast to avoid warnings. The
implementation of the sector write function is provided by the user, so it
is to be hoped that the buffer is not actually modified.
As Rule 11.8 is required, a separate deviation record is required.
*/
#define CAST_AWAY_CONST(type, ptr) ((type *)(ptr))
/** Allocate zero-initialized (cleared) memory.
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
used, this macro also deviates from Rule 22.1 (required).
This macro is used in the FreeRTOS block device code in order to allocate a
RAM disk, when that implementation of the block device is selected. The
primary rationale for all these deviations is that a) the RAM disk cannot be
allocated statically (since the volume information is stored in a
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
media is available. In most real systems, Reliance Edge is used with
non-volatile storage like SD/MMC or eMMC, not with RAM disks.
Rule 22.1 states that all resources which are allocated must also be
explicitly freed. The RAM disk is allocated and never freed, deviating from
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
device is closed, to allow the file system to be ormatted and then mounted,
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
acceptable for the primary purpose of the RAM disk, which is preliminary
testing.
As Directive 4.12, Rule 21.3, and Rule 22.1 are all required, separate
deviation records are required.
*/
#define ALLOCATE_CLEARED_MEMORY(nelem, elsize) calloc(nelem, elsize)
#if REDCONF_OUTPUT == 1
/** Output a character to a serial port or other display device.
Usages of this macro deviate from MISRA C:2012 Rule 21.6 (required).
FreeRTOS does not include a standard method of printing characters, so
putchar() is the most convenient and portable way to accomplish the task.
The risk of "unspecified, undefined and implementation-defined" behavior
causing problems (as cited in the rationale for the rule) is small. The
driver does not depend on the character being outputted correctly.
Furthermore, use of putchar() disappears when output is disabled.
As Rule 21.6 is required, a separate deviation record is required.
*/
#define OUTPUT_CHARACTER(ch) (void)putchar(ch)
#endif
#if (REDCONF_TASK_COUNT > 1U) && (REDCONF_API_POSIX == 1)
/** Cast a TaskHandle_t (a pointer type) to uintptr_t.
Usage of this macro deivate from MISRA-C:2012 Rule 11.4 (advisory). This
macro is used for the FreeRTOS version of RedOsTaskId(). Some RTOSes
natively use an integer for task IDs; others use pointers. RedOsTaskId()
uses integers, FreeRTOS uses pointers; to reconcile this difference, the
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
representation of a pointer is implementation-defined, the representation is
irrelevant provided that unique pointers are converted to unique integers.
As Rule 11.4 is advisory, a deviation record is not required. This notice
is the only record of the deviation.
*/
#define CAST_TASK_PTR_TO_UINTPTR(taskptr) ((uintptr_t)(taskptr))
#endif
/** Ignore the return value of a function (cast to void)
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
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 <----
Copyright (c) 2014-2015 Datalight, Inc.
All Rights Reserved Worldwide.
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
the Free Software Foundation; use version 2 of the License.
This program is distributed in the hope that it will be useful,
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* Businesses and individuals that for commercial or other reasons cannot
comply with the terms of the GPLv2 license may obtain a commercial license
before incorporating Reliance Edge into proprietary software for
distribution in any form. Visit http://www.datalight.com/reliance-edge for
more information.
*/
/** @file
@brief Implements assertion handling.
*/
#include <redfs.h>
#if REDCONF_ASSERTS == 1
#include <redosdeviations.h>
/** @brief Invoke the native assertion handler.
@param pszFileName Null-terminated string containing the name of the file
where the assertion fired.
@param ulLineNum Line number in @p pszFileName where the assertion
fired.
*/
void RedOsAssertFail(
const char *pszFileName,
uint32_t ulLineNum)
{
PRINT_ASSERT(pszFileName, ulLineNum);
for( ;; )
{
}
}
#endif
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
Copyright (c) 2014-2015 Datalight, Inc.
All Rights Reserved Worldwide.
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
the Free Software Foundation; use version 2 of the License.
This program is distributed in the hope that it will be useful,
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* Businesses and individuals that for commercial or other reasons cannot
comply with the terms of the GPLv2 license may obtain a commercial license
before incorporating Reliance Edge into proprietary software for
distribution in any form. Visit http://www.datalight.com/reliance-edge for
more information.
*/
/** @file
@brief Implements assertion handling.
*/
#include <redfs.h>
#if REDCONF_ASSERTS == 1
#include <redosdeviations.h>
/** @brief Invoke the native assertion handler.
@param pszFileName Null-terminated string containing the name of the file
where the assertion fired.
@param ulLineNum Line number in @p pszFileName where the assertion
fired.
*/
void RedOsAssertFail(
const char *pszFileName,
uint32_t ulLineNum)
{
#if REDCONF_OUTPUT == 1
IGNORE_ERRORS(PRINT_ASSERT(pszFileName, ulLineNum));
#endif
while(true)
{
}
}
#endif

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

Loading…
Cancel
Save