1 /**
2   ******************************************************************************
3   * @file    EEPROM_Emul/Core/eeprom_emul_types.h
4   * @author  MCD Application Team
5   * @brief   This file contains all the functions prototypes for the EEPROM
6   *          emulation firmware library.
7   ******************************************************************************
8   * @attention
9   *
10   * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
11   * All rights reserved.</center></h2>
12   *
13   * Redistribution and use in source and binary forms, with or without
14   * modification, are permitted, provided that the following conditions are met:
15   *
16   * 1. Redistribution of source code must retain the above copyright notice,
17   *    this list of conditions and the following disclaimer.
18   * 2. Redistributions in binary form must reproduce the above copyright notice,
19   *    this list of conditions and the following disclaimer in the documentation
20   *    and/or other materials provided with the distribution.
21   * 3. Neither the name of STMicroelectronics nor the names of other
22   *    contributors to this software may be used to endorse or promote products
23   *    derived from this software without specific written permission.
24   * 4. This software, including modifications and/or derivative works of this
25   *    software, must execute solely and exclusively on microcontroller or
26   *    microprocessor devices manufactured by or for STMicroelectronics.
27   * 5. Redistribution and use of this software other than as permitted under
28   *    this license is void and will automatically terminate your rights under
29   *    this license.
30   *
31   * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
32   * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
33   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
34   * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
35   * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
36   * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
37   * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
38   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
39   * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
40   * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41   * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
42   * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43   *
44   ******************************************************************************
45   */
46 
47 /* Define to prevent recursive inclusion -------------------------------------*/
48 #ifndef __EEPROM_EMUL_TYPES_H
49 #define __EEPROM_EMUL_TYPES_H
50 
51 /** @addtogroup EEPROM_Emulation
52   * @{
53   */
54 
55 /* Exported constants --------------------------------------------------------*/
56 /** @defgroup EEPROM_Exported_Constants EEPROM Exported Constants
57   * @{
58   */
59 
60 /** @defgroup Exported_Other_Constants Exported Other Constants
61   * @{
62   */
63 
64 /**
65   * @brief  EE Status enum definition.
66   */
67 /* Define of the return value */
68 typedef enum {
69   /* External return codes : ok */
70   EE_OK = 0U,
71 
72   /* External return codes : errors */
73   EE_ERASE_ERROR,
74   EE_WRITE_ERROR,
75   EE_ERROR_NOACTIVE_PAGE,
76   EE_ERROR_NOERASE_PAGE,
77   EE_ERROR_NOERASING_PAGE,
78   EE_ERROR_NOACTIVE_NORECEIVE_NOVALID_PAGE,
79   EE_NO_DATA,
80   EE_INVALID_VIRTUALADDRESS,
81   EE_INVALID_PAGE,
82   EE_INVALID_PAGE_SEQUENCE,
83   EE_INVALID_ELEMENT,
84   EE_TRANSFER_ERROR,
85   EE_DELETE_ERROR,
86   EE_INVALID_BANK_CFG,
87 
88   /* Internal return code */
89   EE_NO_PAGE_FOUND,
90   EE_PAGE_NOTERASED,
91   EE_PAGE_ERASED,
92   EE_PAGE_FULL,
93 
94   /* External return code : action required */
95   EE_CLEANUP_REQUIRED = 0x100U,
96 } EE_Status;
97 
98 /* Type of page erasing:
99        EE_FORCED_ERASE     --> pages to erase are erased unconditionnally
100        EE_CONDITONAL_ERASE --> pages to erase are erased only if not fully erased */
101 typedef enum {
102    EE_FORCED_ERASE,
103    EE_CONDITIONAL_ERASE
104 } EE_Erase_type;
105 
106 /* Masks of EE_Status return codes */
107 #define EE_STATUSMASK_ERROR   (uint16_t)0x00FFU /*!< Mask on EE_Status return code, selecting error codes */
108 #define EE_STATUSMASK_CLEANUP (uint16_t)0x0100U /*!< Mask on EE_Status return code, selecting cleanup request codes */
109 
110 /**
111   * @}
112   */
113 
114 /**
115   * @}
116   */
117 
118 /**
119   * @}
120   */
121 
122 #endif /* __EEPROM_EMUL_TYPES_H */
123 
124 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
125