modm_data.cubehal
STMicro STM32CubeHAL Source Code
The STM32CubeHAL source code provides useful information:
- Determine canonical names of conflicting data items.
- Determine the map of register bit field values to names.
1# Copyright 2022, Niklas Hauser 2# SPDX-License-Identifier: MPL-2.0 3 4""" 5# STMicro STM32CubeHAL Source Code 6 7The STM32CubeHAL source code provides useful information: 8 9- Determine canonical names of conflicting data items. 10- Determine the map of register bit field values to names. 11""" 12 13from .dmamux_requests import read_request_map, read_bdma_request_map 14 15__all__ = ["read_request_map", "read_bdma_request_map"]
16def read_request_map(did: DeviceIdentifier) -> dict[str, int]: 17 """ 18 Reads the DMA requests mapping from the Low-Level (LL) CubeHAL header files. 19 20 :param did: Device to query for. 21 :return: A dictionary of DMA trigger name to trigger position. 22 """ 23 dma_header = _get_hal_dma_header_path(did) 24 dmamux_header = _get_ll_dmamux_header_path(did) 25 request_map = None 26 if did.family in ["c0", "g4", "h7", "l5"]: 27 request_map = _read_requests(dma_header, _REQUEST_PATTERN) 28 elif did.family in ["g0", "u0", "wb", "wl"]: 29 request_map = _read_requests_from_ll_dmamux(dma_header, dmamux_header) 30 elif did.family == "l4" and did.name[0] in ["p", "q", "r", "s"]: 31 request_map = _read_requests_l4(did) 32 else: 33 raise RuntimeError("No DMAMUX request data available for {}".format(did)) 34 _fix_request_data(request_map, "DMA") 35 return request_map
Reads the DMA requests mapping from the Low-Level (LL) CubeHAL header files.
Parameters
- did: Device to query for.
Returns
A dictionary of DMA trigger name to trigger position.
def
read_bdma_request_map(did):