Felícito Manzano
/
DTK_Guaria2_ABInBev
Proyecto ABInBev para la tarjeta Guaria 1/2.
Embed:
(wiki syntax)
Show/hide line numbers
flash_eeprom.h
00001 /** 00002 ****************************************************************************** 00003 * @file EEPROM/EEPROM_Emulation/inc/eeprom.h 00004 * @author MCD Application Team 00005 * @brief This file contains all the functions prototypes for the EEPROM 00006 * emulation firmware library. 00007 ****************************************************************************** 00008 * @attention 00009 * 00010 * <h2><center>© Copyright (c) 2017 STMicroelectronics. 00011 * All rights reserved.</center></h2> 00012 * 00013 * This software component is licensed by ST under Ultimate Liberty license 00014 * SLA0044, the "License"; You may not use this file except in compliance with 00015 * the License. You may obtain a copy of the License at: 00016 * www.st.com/SLA0044 00017 * 00018 ****************************************************************************** 00019 */ 00020 00021 /* Define to prevent recursive inclusion -------------------------------------*/ 00022 #ifndef __FLASH_EEPROM_H 00023 #define __FLASH_EEPROM_H 00024 00025 /* Includes ------------------------------------------------------------------*/ 00026 #include "stm32f4xx_hal.h" 00027 00028 /* Exported constants --------------------------------------------------------*/ 00029 /* EEPROM emulation firmware error codes */ 00030 #define EE_OK (uint32_t)HAL_OK 00031 #define EE_ERROR (uint32_t)HAL_ERROR 00032 #define EE_BUSY (uint32_t)HAL_BUSY 00033 #define EE_TIMEOUT (uint32_t)HAL_TIMEOUT 00034 00035 /* Define the size of the sectors to be used */ 00036 #define PAGE_SIZE (uint32_t)0x4000 /* Page size = 16KByte */ 00037 00038 /* Device voltage range supposed to be [2.7V to 3.6V], the operation will 00039 be done by word */ 00040 #define VOLTAGE_RANGE (uint8_t)VOLTAGE_RANGE_3 00041 00042 /* EEPROM start address in Flash */ 00043 #define EEPROM_START_ADDRESS ((uint32_t)0x08008000) /* EEPROM emulation start address: 00044 from sector2 : after 16KByte of used 00045 Flash memory */ 00046 00047 /* Pages 0 and 1 base and end addresses */ 00048 #define PAGE0_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 0x0000)) 00049 #define PAGE0_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + (PAGE_SIZE - 1))) 00050 #define PAGE0_ID FLASH_SECTOR_2 00051 00052 #define PAGE1_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 0x4000)) 00053 #define PAGE1_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + (2 * PAGE_SIZE - 1))) 00054 #define PAGE1_ID FLASH_SECTOR_3 00055 00056 /* Used Flash pages for EEPROM emulation */ 00057 #define PAGE0 ((uint16_t)0x0000) 00058 #define PAGE1 ((uint16_t)0x0001) /* Page nb between PAGE0_BASE_ADDRESS & PAGE1_BASE_ADDRESS*/ 00059 00060 /* No valid page define */ 00061 #define NO_VALID_PAGE ((uint16_t)0x00AB) 00062 00063 /* Page status definitions */ 00064 #define ERASED ((uint16_t)0xFFFF) /* Page is empty */ 00065 #define RECEIVE_DATA ((uint16_t)0xEEEE) /* Page is marked to receive data */ 00066 #define VALID_PAGE ((uint16_t)0x0000) /* Page containing valid data */ 00067 00068 /* Valid pages in read and write defines */ 00069 #define READ_FROM_VALID_PAGE ((uint8_t)0x00) 00070 #define WRITE_IN_VALID_PAGE ((uint8_t)0x01) 00071 00072 /* Page full define */ 00073 #define PAGE_FULL ((uint8_t)0x80) 00074 00075 /* Variables' number */ 00076 #define NB_OF_VAR ((uint8_t)0x20) 00077 00078 /* Exported types ------------------------------------------------------------*/ 00079 /* Exported macro ------------------------------------------------------------*/ 00080 /* Exported functions ------------------------------------------------------- */ 00081 uint16_t EE_Init(void); 00082 uint16_t EE_ReadVariable(uint16_t VirtAddress, uint16_t* Data); 00083 uint16_t EE_WriteVariable(uint16_t VirtAddress, uint16_t Data); 00084 00085 #endif /* __FLASH_EEPROM_H */ 00086 00087 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Thu Jul 28 2022 19:27:02 by 1.7.2