1 /**
2 ******************************************************************************
3 * @file otp.c
4 * @author MCD Application Team
5 * @brief OTP manager
6 ******************************************************************************
7 * @attention
8 *
9 * <h2><center>© Copyright (c) 2019 STMicroelectronics.
10 * All rights reserved.</center></h2>
11 *
12 * This software component is licensed by ST under BSD 3-Clause license,
13 * the "License"; You may not use this file except in compliance with the
14 * License. You may obtain a copy of the License at:
15 * opensource.org/licenses/BSD-3-Clause
16 *
17 ******************************************************************************
18 */
19
20
21 /* Includes ------------------------------------------------------------------*/
22 #include "utilities_common.h"
23
24 #include "otp.h"
25
26 /* Private typedef -----------------------------------------------------------*/
27 /* Private defines -----------------------------------------------------------*/
28 /* Private macros ------------------------------------------------------------*/
29 /* Private variables ---------------------------------------------------------*/
30 /* Global variables ----------------------------------------------------------*/
31 /* Private function prototypes -----------------------------------------------*/
32 /* Functions Definition ------------------------------------------------------*/
33
OTP_Read(uint8_t id)34 uint8_t * OTP_Read( uint8_t id )
35 {
36 uint8_t *p_id;
37
38 p_id = (uint8_t*)(CFG_OTP_END_ADRESS - 7) ;
39
40 while( ((*( p_id + 7 )) != id) && ( p_id != (uint8_t*)CFG_OTP_BASE_ADDRESS) )
41 {
42 p_id -= 8 ;
43 }
44
45 if((*( p_id + 7 )) != id)
46 {
47 p_id = 0 ;
48 }
49
50 return p_id ;
51 }
52
53 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
54