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