[riot-devel] Use fixed size types in 'hwtimer_arch' function signatures

ROUSSEL Kévin Kevin.Roussel at inria.fr
Wed Feb 12 10:18:54 CET 2014


Hello Martine,

Indeed, it depends on the use case.

In the case of the 'hwtimer_arch' functions, we have two situations:

* the definition of a counter value (be it absolute or relative) which 
is currently implemented as an 'unsigned long' ; since we want to keep 
high precision (that is: high frequency) while allowing for long enough 
delays to be specified, I propose to stick on 32-bit values (==> use 
'uint32_t')

* the definition of a timer ID, currently done using 'short' ; since it 
is highly unlikely that any MCU will offer us more than 255 hardware 
timer instances to play with, I propose to use 8-bit IDs (==> use uint8_t)

Best regards,


Le 12/02/2014 10:10, Martine Lenders a écrit :
> Hi,
> I think that this is dependent on the use-case. For the timer it may be
> a good idea, as for example type definitions in the network stack. Where
> I see a problem with fixed type sizes in data that comes from certain
> periphirals, though (e.g. network hardware addresses, which are
> currently 16-bit fixed size in the transceiver module, though the cc1100
> chip e.g. uses 8-bit addresses, IEEE 802.15.4 uses 64-bit AND 16-bit
> addresses, and when we want to have Ethernet support sometime we have to
> deal with 48-bit addresses).
>
> Martine
>
>
> 2014-02-12 9:57 GMT+01:00 ROUSSEL Kévin <Kevin.Roussel at inria.fr
> <mailto:Kevin.Roussel at inria.fr>>:
>
>     Hello,
>
>     While working on the MSP430 hwtimer implementations, I came to
>     wonder whether we should use fixed size type (i.e.: uint32_t or
>     uint8_t) instead of ambiguous types like long or short.
>
>     It seems to me fixed bit sizes would be preferable, since we work on
>     various architectures for which long or short may not mean the same
>     number of bits. What do you think?
>     --
>
>
>           Kévin Roussel
>           Doctorant, projet LAR
>           Équipe MADYNES, INRIA Nancy Grand-Est / LORIA
>           Tél. : +33 3 54 95 86 27 <tel:%2B33%203%2054%2095%2086%2027>
>     Kevin.Roussel at inria.fr <mailto:Kevin.Roussel at inria.fr>
>
>     _________________________________________________
>     devel mailing list
>     devel at riot-os.org <mailto:devel at riot-os.org>
>     http://lists.riot-os.org/__mailman/listinfo/devel
>     <http://lists.riot-os.org/mailman/listinfo/devel>
>
>
>
>
> _______________________________________________
> devel mailing list
> devel at riot-os.org
> http://lists.riot-os.org/mailman/listinfo/devel
>

-- 


      Kévin Roussel
      Doctorant, projet LAR
      Équipe MADYNES, INRIA Nancy Grand-Est / LORIA
      Tél. : +33 3 54 95 86 27
      Kevin.Roussel at inria.fr



More information about the devel mailing list