Subversion Repositories DashDisplay

Rev

Rev 17 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
16 mjames 1
/**
2
  ******************************************************************************
3
  * @file    EEPROM_Emulation/inc/eeprom.h
4
  * @author  MCD Application Team
5
  * @version V3.1.0
6
  * @date    07/27/2009
7
  * @brief   This file contains all the functions prototypes for the EEPROM
8
  *          emulation firmware library.
9
  ******************************************************************************
10
  * @copy
11
  *
12
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
14
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
15
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
16
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
17
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18
  *
19
  * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2>
20
  */
21
 
22
/* Define to prevent recursive inclusion -------------------------------------*/
23
#ifndef __EEPROM_H
24
#define __EEPROM_H
25
 
26
/* Includes ------------------------------------------------------------------*/
27
/* #include "stm32f10x.h" */
28
#define HAL_FLASH_MODULE_ENABLED
29
#define STM32F10X_MD
30
#include "stm32f1xx_hal_flash.h"
31
 
32
 
33
/* Exported constants --------------------------------------------------------*/
34
/* Define the STM32F10Xxx Flash page size depending on the used STM32 device */
35
#if defined (STM32F10X_LD) || defined (STM32F10X_MD)
36
  #define PAGE_SIZE  (uint16_t)0x400  /* Page size = 1KByte */
37
#elif defined (STM32F10X_HD) || defined (STM32F10X_CL)
38
  #define PAGE_SIZE  (uint16_t)0x800  /* Page size = 2KByte */
39
#endif
40
 
41
 
42
typedef uint8_t FlashPage_t[PAGE_SIZE];
43
 
44
 
45
extern FlashPage_t FlashPage[2];
46
 
47
 
48
typedef uint16_t FLASH_Status;
49
 
50
 
51
/* Pages 0 and 1 base and end addresses */
52
#define PAGE0_BASE_ADDRESS      ((uint32_t)(&FlashPage[0]))
53
#define PAGE0_END_ADDRESS       ((uint32_t)(&FlashPage[0] + (PAGE_SIZE - 1)))
54
 
55
#define PAGE1_BASE_ADDRESS      ((uint32_t)(&FlashPage[1]))
56
#define PAGE1_END_ADDRESS       ((uint32_t)(&FlashPage[1] +(PAGE_SIZE - 1)))
57
 
58
/* Used Flash pages for EEPROM emulation */
59
#define PAGE0                   ((uint16_t)0x0000)
60
#define PAGE1                   ((uint16_t)0x0001)
61
 
62
/* No valid page define */
63
#define NO_VALID_PAGE           ((uint16_t)0x00AB)
64
 
65
/* Page status definitions */
66
#define ERASED                  ((uint16_t)0xFFFF)     /* PAGE is empty */
67
#define RECEIVE_DATA            ((uint16_t)0xEEEE)     /* PAGE is marked to receive data */
68
#define VALID_PAGE              ((uint16_t)0x0000)     /* PAGE containing valid data */
69
 
70
/* Valid pages in read and write defines */
71
#define READ_FROM_VALID_PAGE    ((uint8_t)0x00)
72
#define WRITE_IN_VALID_PAGE     ((uint8_t)0x01)
73
 
74
/* Page full define */
75
#define PAGE_FULL               ((uint8_t)0x80)
76
 
77
/* Variables' number */
17 mjames 78
#define NumbOfVar               ((uint8_t)0x02)
16 mjames 79
 
80
/* Exported types ------------------------------------------------------------*/
81
/* Exported macro ------------------------------------------------------------*/
82
/* Exported functions ------------------------------------------------------- */
83
uint16_t EE_Init(void);
84
uint16_t EE_ReadVariable(uint16_t VirtAddress, uint16_t* Data);
85
uint16_t EE_WriteVariable(uint16_t VirtAddress, uint16_t Data);
86
 
87
#endif /* __EEPROM_H */
88
 
89
/******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/