atbetaflight/lib/main
jflyper 6fbc0f44ca [H7][LIB][SPI] Use union to access size sensitive SPI data register
Application of

Use union to access access size sensitive registers (7a0d3e7)

to V1.4.0

----
Note from "Use union to access access size sensitive registers (7a0d3e7)":
----

Use union to access access size sensitive registers

As described in RM0433 section 49.4.13 "Data packing", STM32H7's SPI data register supports data packing and it is sensitive to actual access width.

The original code used pointer casting to obtain a code to access the register in a desired size.
However, these operation results in strict aliasing warnings (deferencing punned pointer) and are not desirable.

Here, we declare a union that allow access to a 32-bit register in 8, 16 or 32-bit width and cast pointer to the original RXDR and TXDR data registers and then access the portion of the register through an appropriate union member.

XXX FIXME Only handled 16-bit access case, as 32-bit (original declaration) and 8-bit (allowed) cases do not generate warnings, but these should be handled similarly for correctness and consistency of the code.
2019-07-08 09:36:04 +09:00
..
CMSIS CF/BF - Update DSP_Lib and STM32F7/Drivers/CMSIS to CMSIS 5.3.0. (#5431) 2018-03-12 09:34:43 +13:00
MAVLink Fixed permissions on files. 2017-11-28 23:31:55 +13:00
STM32F1 Fix UNUSED() macro conflict with STM libraries 2019-02-18 11:26:03 -05:00
STM32F3 Fix UNUSED() macro conflict with STM libraries 2019-02-18 11:26:03 -05:00
STM32F4 Fix UNUSED() macro conflict with STM libraries 2019-02-18 11:26:03 -05:00
STM32F7 [F7] Move non-library CDC-HID code out of lib tree 2019-05-08 11:59:23 +09:00
STM32H7 [H7][LIB][SPI] Use union to access size sensitive SPI data register 2019-07-08 09:36:04 +09:00
STM32_USB-FS-Device_Driver Further improvements to serial const correctness 2016-10-04 09:01:28 +01:00
STM32_USB_Device_Library Fix UNUSED() macro conflict with STM libraries 2019-02-18 11:26:03 -05:00
STM32_USB_OTG_Driver Per mikeller's comment. 2018-04-13 02:59:17 +09:00
dyad Fixed build for gcc 8 (SITL). 2019-02-25 15:34:34 +13:00