Click here to Skip to main content
14,138,179 members

ATL / WTL / STL

 
PinnedHOW TO ANSWER A QUESTION PinPopular
Chris Maunder16-Jul-09 3:09
adminChris Maunder16-Jul-09 3:09 
PinnedHow to get an answer to your question PinPopular
Chris Maunder16-Jul-09 3:05
adminChris Maunder16-Jul-09 3:05 
QuestionWhy non-template function does not compile where as template function compiles? Pin
PBMBJoshi2-May-19 23:23
memberPBMBJoshi2-May-19 23:23 
AnswerRe: Why non-template function does not compile where as template function compiles? Pin
Richard MacCutchan2-May-19 23:29
protectorRichard MacCutchan2-May-19 23:29 
QuestionAdvice on interdependent asynchronous functions and task queuing? Pin
arnold_w7-Feb-19 23:07
memberarnold_w7-Feb-19 23:07 
AnswerRe: Advice on interdependent asynchronous functions and task queuing? Pin
arnold_w7-Feb-19 23:34
memberarnold_w7-Feb-19 23:34 
QuestionRecommended way to deal with queues and pointers to buffers Pin
arnold_w3-Feb-19 9:09
memberarnold_w3-Feb-19 9:09 
I am working with embedded programming in standard C and there are 2 microcontrollers communication with each other using a home-made protocol. The scheduler and task queues are also home-made so no realtime operating system is used. My tasks look like this:
void (*task_t)(uint8_t* taskData, uint16_t sizeOfTaskDataInBytes);
My add-task-to-queue-function looks like this:
Bool_t addTaskToQueue(queueSelector_e, task_t, uint8_t* taskData, uint16_t sizeOfTaskDataInBytes);
Please note that the taskData is also inserted into the queue (in an area called task data pool area) so it's not just a pointer to taskData that is being queued. The task data to write data from microcontroller 1 to microcontroller 2 needs to look something like this:
struct writeRegTaskData_s {
    uint32_t startAddr;
    uint16_t numRegsToWrite;
    uint8_t dataToWrite[numRegsToWrite]; // When I want the data to be put inside the queue as well
or
    uint8_t* dataToWrite // When I have a big static buffer that I don't want to put inside the queue
}
The problem is with the dataToWrite parameter. Sometimes a lot of data will be written, for example, during a firmware upgrade, and then it's overkill to put all the dataToWrite into the queue, it's perfectly fine to have one static buffer. At other times, for example when reacting to different push button events, I want to put my dataToWrite on the stack and then add it into my task queue. However, when I do this, I must make sure dataToWrite points to the proper location inside my task queue data pool and not on the original buffer on the stack. What's the recommended way to solve this issue in a clean way?
AnswerRe: Recommended way to deal with queues and pointers to buffers Pin
Richard MacCutchan3-Feb-19 22:19
protectorRichard MacCutchan3-Feb-19 22:19 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
arnold_w3-Feb-19 23:40
memberarnold_w3-Feb-19 23:40 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
Richard MacCutchan3-Feb-19 23:48
protectorRichard MacCutchan3-Feb-19 23:48 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
arnold_w4-Feb-19 3:15
memberarnold_w4-Feb-19 3:15 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
Richard MacCutchan4-Feb-19 3:46
protectorRichard MacCutchan4-Feb-19 3:46 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
arnold_w4-Feb-19 3:55
memberarnold_w4-Feb-19 3:55 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
Richard MacCutchan4-Feb-19 4:04
protectorRichard MacCutchan4-Feb-19 4:04 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
Business2sell18-Feb-19 18:08
professionalBusiness2sell18-Feb-19 18:08 
QuestionCan a union in standard C "skip" members? Pin
arnold_w31-Jan-19 22:46
memberarnold_w31-Jan-19 22:46 
AnswerRe: Can a union in standard C "skip" members? Pin
Richard MacCutchan31-Jan-19 23:18
protectorRichard MacCutchan31-Jan-19 23:18 
GeneralRe: Can a union in standard C "skip" members? Pin
arnold_w31-Jan-19 23:47
memberarnold_w31-Jan-19 23:47 
GeneralRe: Can a union in standard C "skip" members? Pin
Richard MacCutchan31-Jan-19 23:52
protectorRichard MacCutchan31-Jan-19 23:52 
GeneralRe: Can a union in standard C "skip" members? Pin
arnold_w1-Feb-19 0:13
memberarnold_w1-Feb-19 0:13 
GeneralRe: Can a union in standard C "skip" members? Pin
Richard MacCutchan1-Feb-19 1:42
protectorRichard MacCutchan1-Feb-19 1:42 
GeneralRe: Can a union in standard C "skip" members? Pin
arnold_w1-Feb-19 2:08
memberarnold_w1-Feb-19 2:08 
GeneralRe: Can a union in standard C "skip" members? Pin
Richard MacCutchan1-Feb-19 2:57
protectorRichard MacCutchan1-Feb-19 2:57 
QuestionWhich type of Regex best to learn for programming with C? Pin
HS_C_Student17-Dec-18 3:43
memberHS_C_Student17-Dec-18 3:43 
AnswerRe: Which type of Regex best to learn for programming with C? Pin
Richard MacCutchan17-Dec-18 3:53
protectorRichard MacCutchan17-Dec-18 3:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Cookies | Terms of Service
Web03 | 2.8.190518.1 | Last Updated 3 May 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid