lundi 26 janvier 2015

Unified Driver model for low speed and high speed microcontrollers with limited and good memory [on hold]


I am trying to develop an experimental RTOS. I am stuck in the driver layer design. I want to make the driver layer libraries friendly for the other layers but then again I would like to have high performance. I have narrowed this down to a mixture of 2 approaches. The first is to have a structure for the controller with callbacks as elements. For eg:



struct peripheral_controller {
int32_t (*init) (struct peripheral_instance_regs *peripheral_instance_regs);
int32_t (*isFull) (struct peripheral_instance_regs *peripheral_instance_regs);
};


The second approach is to have helper macros which take the peripheral_instance_regs as arguements.


For eg:



#define isFull(reg)
(reg&0x01 == 1)


Is this the right approach? Will it confuse the users of my library? The problem with the callbacks as I see is in the interrupt routine where I would not want to call any functions.





Aucun commentaire:

Enregistrer un commentaire