palWriteGroup(LCD_DATA_PORT_1, PAL_GROUP_MASK(4), LCD_DATA_PORT_1_BASE, d >> 12); palWriteGroup(LCD_DATA_PORT_2, PAL_GROUP_MASK(4), LCD_DATA_PORT_2_BASE, d >> 8); palWriteGroup(LCD_DATA_PORT_3, PAL_GROUP_MASK(4), LCD_DATA_PORT_3_BASE, d >> 4); palWriteGroup(LCD_DATA_PORT_4, PAL_GROUP_MASK(4), LCD_DATA_PORT_4_BASE, d >> 0);
@mabl: I am a guy who always reads the documentation first - I know how it is when you write a shitload of documentation and people don't even read it then. I wouldn't even know about the two macros, when I wouldn't have read it. I was just confused about the playing together with the mask and the offset. I tried to understand the macro, but because I didn', I asked here. I thought this forum might be there for such questions
this reverse shift order is only due on how you choose to label your ports. I'd propose to do it the other way around, since it's more common to start numbering from the lower bits.
What you could also think about is grouping several IOBus together and specify the shifts. That way you would be totally generic from how many ports you split. But I don't know the speed trade-off for that.
Last edited by mabl on Mon Jun 25, 2012 9:41 am, edited 1 time in total.
Yeah, I already took a look at the IOBus stuff after Giovanni pointed to it. I am not sure about the performance either. But the thing I worry more is the configuration. I couldn't figure out how to use it a way the configuration for the user is easy and the sourcecode is still clean and readable.
Maybe Giovanni can give some more informations to this?
The IOBus structure contains the same parameters of the "group" functions but bus functions have a performance impact compared to "groups". Groups are inlined and become a direct access to the GPIO register in the generated asm code.
The advantage with IOBus is that you could have those supplied from outside the library, you just do writes on the bus without knowing how it is done.
One thing I don't like is splitting the write in 4 operations, that will hurt performance a lot. You should assume from 1 to N "groups" of variable size (not always 4 bits). The best way would be to expect an external write_lcd() function (for example) and do not try to abstract it internally, the integrator would have to provide the function.
Giovanni wrote:The best way would be to expect an external write_lcd() function (for example) and do not try to abstract it internally, the integrator would have to provide the function.
That solutions dosen't sound that bad. That would be two functions (one writing 16-bit and one reading 16-bit).
I'll think about it. Thank you very much for your suggestion!
I want drive LCD that is 16bit wide data interface but I dosn't have single port 16bit wide free so palWriteGroup,IOBus,IOBus_DATA can I declare 2 port bits as SINGLE BUS what is deference between palWriteGroup,palWriteBus and palWritePort