I have the following problem - my embedded system has four fifos consisting of 64-byte chunks of data. These fifo's and the corresponding data chunks are represented in the diagram below. Once all 4 fifo's have been popped, I need to interleave the data chunks. I can do a simple loop but I am concerned this might be too processor intensive. Does anyone have a smarter way that is less processor intensive in which I can rapidly interleave the different chunks of memory?
2
There are 2 best solutions below
0
0___________
On
#define FIFO1 (volatile uint64_t *)FIFO1_ADDRESS
#define FIFO2 (volatile uint64_t *)FIFO2_ADDRESS
#define FIFO3 (volatile uint64_t *)FIFO3_ADDRESS
#define FIFO4 (volatile uint64_t *)FIFO4_ADDRESS
static inline uint64_t *popfifos(uint64_t *data)
{
data[0] = *FIFO1;
data[1] = *FIFO2;
data[2] = *FIFO3;
data[3] = *FIFO4;
return data + 4;
}
void readFIFOS(uint64_t *buff, size_t nreads)
{
while(nreads--)
{
if(fifosReady()) buff = popfifos(buff);
}
}
fifosReady reads some hardware registers waiting for data to be ready.
Related Questions in C
- Passing arguments to main in C using Eclipse
- kernel module does not print packet info
- error C2016 (C requires that a struct or union has at least one member) and structs typedefs
- Drawing with ncurses, sockets and fork
- How to catch delay-import dll errors (missing dll or symbol) in MinGW(-w64)?
- Configured TTL for A record(s) backing CNAME records
- Allocating memory for pointers inside structures in functions
- Finding articulation point of undirected graph by DFS
- C first fgets() is being skipped while the second runs
- C std library don't appear to be linked in object file
- gcc static library compilation
- How to do a case-insensitive string comparison?
- C programming: Create and write 2D array of files as function
- How to read a file then store to array and then print?
- Function timeouts in C and thread
Related Questions in MEMORY
- DataTable does not release memory
- Impala Resource Estimation for queries with Group by
- Is there any way to get a lru list in Linux kernel?
- C# console application - Unhandled exception while finding the Available and free Ram space.Getting exact answer in windows forms application
- Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) in PHP
- C# equivalent of Java Memory mapping methods
- How to figure out the optimal fetch size for the select query
- Creating two arrays with malloc on the same line
- Using parse.com and having allocation memory issue
- error reading variable: cannot access memory at address
- CentOS memory availability
- Correct idiom for freeing repr(C) structs using Drop trait
- Find Ram/Memory manufacturer in Linux?
- Profiling memory usage on App Engine
- Access Violation: 0xC0000005, why is this happening?
Related Questions in EMBEDDED
- PHP don't use temp file for upload
- Sparkfun SC16IS750 does not work on Raspberry Pi
- Reserve memory space in m_text memory region of FLASH on embedded target
- SAE J1939 Standards Collection -- How much is necessary?
- How to call multiple slaves for Spi data transmission?
- Deployment over GPRS to embedded devices
- Changing just one byte in SD card sector
- Comparion of values won't work without delay
- Better to pass struct, or pointer to struct?
- STM32F4 Handling peripheral error while making a DMA Transfer (RX)
- USB programming, transfer file from iOS device to Embedded os device?
- using Diab, dcc 5.9.4 to compile a windows executable
- does b64_pton() work if input contains special characters? I am using it in C code
- u-boot select boot partition based on GPIO state
- Why is a write to a memory-mapped peripheral register not actioned (LPC43xx)?
Related Questions in INTERLEAVE
- Are MongoDB bulk updates atomic if they apply to the same document?
- Prolog How can I construct a list of list into a single list by interleaving?
- Interleaving two decimal digits in Python
- Fast interleave and deinterleave of (jagged) arrays of variable lengths
- Interleaving array in C
- Use binary search to find interleaving sequence in C
- what function can I use to make several nested calls to this other function?
- How create combined file from two text files in powershell?
- i have 2 txt file in powershell each having four Lines i need to join two texts into one text file
- interleave mutliple arrays in javascript
- Interleave/interweave Dask Arrays lazily
- Interleaving Data in C
- How to convert PCM audio stream for online play
- What does interleaved stereo PCM linear Int16 big endian audio look like?
- How to interleave two arrays into a new array
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?

Use an array of FIFO pointers:
Then when you read from a FIFO read from the one referenced by
cur_fifo, then increment it with wraparound: