|
| 1 | +/* |
| 2 | + ******************************************************************************* |
| 3 | + * Copyright (c) 2021, STMicroelectronics |
| 4 | + * All rights reserved. |
| 5 | + * |
| 6 | + * This software component is licensed by ST under BSD 3-Clause license, |
| 7 | + * the "License"; You may not use this file except in compliance with the |
| 8 | + * License. You may obtain a copy of the License at: |
| 9 | + * opensource.org/licenses/BSD-3-Clause |
| 10 | + * |
| 11 | + ******************************************************************************* |
| 12 | + */ |
| 13 | + |
| 14 | +/* Define to prevent recursive inclusion -------------------------------------*/ |
| 15 | +#ifndef __OTP_H |
| 16 | +#define __OTP_H |
| 17 | + |
| 18 | +#include "stm32_def.h" |
| 19 | + |
| 20 | +#ifdef OTP_AREA_BASE |
| 21 | +#ifdef __cplusplus |
| 22 | +extern "C" { |
| 23 | +#endif |
| 24 | + |
| 25 | +#ifdef STM32WBxx |
| 26 | +/* |
| 27 | + * See AN5042: Precise HSE frequency and startup time tuning |
| 28 | + * for STM32 wireless MCUs. Each OTP structure type is indicated |
| 29 | + * by its index (one byte).The index used for the BT structure is 0. |
| 30 | + */ |
| 31 | +typedef struct __packed { |
| 32 | + uint8_t bd_address[6]; |
| 33 | + uint8_t hse_tuning; |
| 34 | + uint8_t id; |
| 35 | +} OTP_BT_t; |
| 36 | +#endif /* STM32WBxx */ |
| 37 | + |
| 38 | +/* Exported functions --------------------------------------------------------*/ |
| 39 | + |
| 40 | +/** |
| 41 | + * @brief This API return the address (64 bits aligned) of the ID parameter in the OTP |
| 42 | + * It returns the first ID declaration found from the higher address down to the base address |
| 43 | + * The user shall fill the OTP from the base address to the top of the OTP so that the more recent |
| 44 | + * declaration is returned by the API |
| 45 | + * The OTP manager handles only 64 bits parameter |
| 46 | + * | Id | Parameter | |
| 47 | + * | 8bits | 58bits | |
| 48 | + * | MSB | LSB | |
| 49 | + * |
| 50 | + * @param id: ID of the parameter to read from OTP |
| 51 | + * @retval Address of the ID in the OTP - returns 0 when no ID found |
| 52 | + */ |
| 53 | +uint8_t *OTP_Read(uint8_t id); |
| 54 | + |
| 55 | +#ifdef __cplusplus |
| 56 | +} |
| 57 | +#endif |
| 58 | +#endif /* OTP_AREA_BASE */ |
| 59 | +#endif /*__OTP_H */ |
| 60 | + |
| 61 | +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
0 commit comments