[riot-notifications] [RIOT] Implemented ASM module for mc1322x MCU (#172)

René Kijewski notifications at github.com
Sun Aug 25 20:15:20 CEST 2013


> +    };
> +    union {
> +        uint32_t STATUS;			///< status register
> +        struct ASM_STATUS {
> +            uint32_t : 24;
> +            uint32_t DONE: 1;		///< operation is done
> +            uint32_t TEST_PASS: 1;	///< self test did pass
> +            uint32_t : 6;
> +        } STATUS_bits;
> +    };
> +    uint32_t reserved;
> +    uint32_t CBC_MAC_0;				///< Result of MAC calculation 0:31
> +    uint32_t CBC_MAC_1;				///< Result of MAC calculation 32:63
> +    uint32_t CBC_MAC_2;				///< Result of MAC calculation 64:95
> +    uint32_t CBC_MAC_3;				///< Result of MAC calculation 96:127
> +};

@thomaseichinger, that's not what I meant (well, I didn't really explain myself, I guess):

Normally the compiler is allowed to add padding to structures. That is good and well as long as it is done consistently. But if a hardware manual describes a struct, the software must not add any padding. One can prohibit the compiler by using bit fields and by using `__attribute__ ((__packed__))`. Since there are bit fields inside the members of `ASM_struct`, the don't-use-padding attribute might be propagated to the outer struct as well, but I am not sure about that, are you?

The safe course would be to add `__attribute__ ((__packed__))` to the definition.

---
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/172/files#r5969165
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20130825/e2ead151/attachment.html>


More information about the notifications mailing list