mirror of
https://github.com/nqtronix/fifofast.git
synced 2026-10-06 17:04:28 +08:00
[change] index type set by typedef instead of macro
This commit is contained in:
@@ -41,7 +41,7 @@
|
||||
<Attribute>template</Attribute>
|
||||
<Category>source</Category>
|
||||
<Condition>C Exe</Condition>
|
||||
<FileContentHash>GMS7o1n/J7/B8J0iqKV+AA==</FileContentHash>
|
||||
<FileContentHash>GD1k8YYhulqRs6FD1B2Hog==</FileContentHash>
|
||||
<FileVersion></FileVersion>
|
||||
<Name>templates/main.c</Name>
|
||||
<SelectString>Main file (.c)</SelectString>
|
||||
|
||||
+29
-29
@@ -88,35 +88,35 @@
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<ToolchainSettings>
|
||||
<AvrGcc>
|
||||
<avrgcc.common.Device>-mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.0.90\gcc\dev\atmega328p"</avrgcc.common.Device>
|
||||
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
|
||||
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
|
||||
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
|
||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>DEBUG</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.symbols.DefSymbols>
|
||||
<avrgcc.compiler.directories.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.90\include</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.directories.IncludePaths>
|
||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
<avrgcc.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>libm</Value>
|
||||
</ListValues>
|
||||
</avrgcc.linker.libraries.Libraries>
|
||||
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
|
||||
</AvrGcc>
|
||||
<avrgcc.common.Device>-mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.0.90\gcc\dev\atmega328p"</avrgcc.common.Device>
|
||||
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
|
||||
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
|
||||
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
|
||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>DEBUG</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.symbols.DefSymbols>
|
||||
<avrgcc.compiler.directories.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.90\include</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.directories.IncludePaths>
|
||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
<avrgcc.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>libm</Value>
|
||||
</ListValues>
|
||||
</avrgcc.linker.libraries.Libraries>
|
||||
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
|
||||
</AvrGcc>
|
||||
</ToolchainSettings>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
||||
+17
-15
@@ -48,9 +48,11 @@
|
||||
// User Config
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Defines the index data type for point-able fifos. This has to be a global setting (and not per
|
||||
// Typedef's the index data type for point-able fifos. This has to be a global setting (and not per
|
||||
// fifo) so that the inline functions can work accordingly yet fast
|
||||
#define FIFOFAST_INDEX_TYPE uint8_t
|
||||
// v INSERT YOUR TYPE HERE
|
||||
typedef uint8_t fff_index_t;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// General Info
|
||||
@@ -59,7 +61,7 @@
|
||||
// version numbering is based on "Semantic Versioning 2.0.0" (semver.org)
|
||||
#define FIFOFAST_VERSION_MAJOR 0
|
||||
#define FIFOFAST_VERSION_MINOR 4
|
||||
#define FIFOFAST_VERSION_PATCH 1
|
||||
#define FIFOFAST_VERSION_PATCH 2
|
||||
#define FIFOFAST_VERSION_SUFFIX
|
||||
#define FIFOFAST_VERSION_META
|
||||
|
||||
@@ -84,11 +86,11 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const FIFOFAST_INDEX_TYPE data_size; // bytes per element in data array
|
||||
const FIFOFAST_INDEX_TYPE mask; // (max amount of elements in data array) - 1
|
||||
FIFOFAST_INDEX_TYPE read; // index from which to read next element
|
||||
FIFOFAST_INDEX_TYPE write; // index to which to write next element
|
||||
FIFOFAST_INDEX_TYPE level; // possible writes without further checking
|
||||
const fff_index_t data_size; // bytes per element in data array
|
||||
const fff_index_t mask; // (max amount of elements in data array) - 1
|
||||
fff_index_t read; // index from which to read next element
|
||||
fff_index_t write; // index to which to write next element
|
||||
fff_index_t level; // possible writes without further checking
|
||||
uint8_t data[]; // data storage array
|
||||
} fff_proto_t;
|
||||
|
||||
@@ -146,11 +148,11 @@ struct _fff__name_struct(_id) { \
|
||||
|
||||
#define _fff_declare_p(_type, _id, _depth) \
|
||||
struct _fff__name_struct(_id) { \
|
||||
const FIFOFAST_INDEX_TYPE data_size; \
|
||||
const FIFOFAST_INDEX_TYPE mask; \
|
||||
FIFOFAST_INDEX_TYPE read; \
|
||||
FIFOFAST_INDEX_TYPE write; \
|
||||
FIFOFAST_INDEX_TYPE level; \
|
||||
const fff_index_t data_size; \
|
||||
const fff_index_t mask; \
|
||||
fff_index_t read; \
|
||||
fff_index_t write; \
|
||||
fff_index_t level; \
|
||||
_type data[_fff__get_arraydepth8(_depth)]; \
|
||||
} _id
|
||||
|
||||
@@ -160,7 +162,7 @@ struct _fff__name_struct(_id) { \
|
||||
#define _fff_declare_a(_type, _id, _depth) _fff_declare(_type, _id, _depth) []
|
||||
#define _fff_declare_pa(_type, _id, _depth) _fff_declare_p(_type, _id, _depth) []
|
||||
|
||||
// TODO: make '_fff__get_arraydepth8(_depth)' dependent on FIFOFAST_INDEX_TYPE
|
||||
// TODO: make '_fff__get_arraydepth8(_depth)' dependent on fff_index_t
|
||||
|
||||
|
||||
// initializes the fifo with the name '<_id>'
|
||||
@@ -360,7 +362,7 @@ do{ \
|
||||
if(!_fff_is_full(_id)) \
|
||||
_return = _fff_add_lite(_id); \
|
||||
else \
|
||||
_return = (typeof(&_id.data[0]))NULL; \
|
||||
_return = (typeof(&_id.data[0]))NULL; \
|
||||
_return; \
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user