code

Fork of BSP_DISCO_F746NG by ST

Committer:
shoaib_ahmed
Date:
Sun Jul 30 16:14:12 2017 +0000
Revision:
10:040ff14a2358
Parent:
1:ee089790cdbb
mbed core for link sprite camera

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 1:ee089790cdbb 1 /**
bcostm 1:ee089790cdbb 2 ******************************************************************************
bcostm 1:ee089790cdbb 3 * @file stm32746g_discovery_eeprom.h
bcostm 1:ee089790cdbb 4 * @author MCD Application Team
bcostm 1:ee089790cdbb 5 * @version V1.0.0
bcostm 1:ee089790cdbb 6 * @date 25-June-2015
bcostm 1:ee089790cdbb 7 * @brief This file contains all the functions prototypes for
bcostm 1:ee089790cdbb 8 * the stm32746g_discovery_eeprom.c firmware driver.
bcostm 1:ee089790cdbb 9 ******************************************************************************
bcostm 1:ee089790cdbb 10 * @attention
bcostm 1:ee089790cdbb 11 *
bcostm 1:ee089790cdbb 12 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
bcostm 1:ee089790cdbb 13 *
bcostm 1:ee089790cdbb 14 * Redistribution and use in source and binary forms, with or without modification,
bcostm 1:ee089790cdbb 15 * are permitted provided that the following conditions are met:
bcostm 1:ee089790cdbb 16 * 1. Redistributions of source code must retain the above copyright notice,
bcostm 1:ee089790cdbb 17 * this list of conditions and the following disclaimer.
bcostm 1:ee089790cdbb 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
bcostm 1:ee089790cdbb 19 * this list of conditions and the following disclaimer in the documentation
bcostm 1:ee089790cdbb 20 * and/or other materials provided with the distribution.
bcostm 1:ee089790cdbb 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bcostm 1:ee089790cdbb 22 * may be used to endorse or promote products derived from this software
bcostm 1:ee089790cdbb 23 * without specific prior written permission.
bcostm 1:ee089790cdbb 24 *
bcostm 1:ee089790cdbb 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bcostm 1:ee089790cdbb 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bcostm 1:ee089790cdbb 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bcostm 1:ee089790cdbb 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bcostm 1:ee089790cdbb 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bcostm 1:ee089790cdbb 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bcostm 1:ee089790cdbb 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bcostm 1:ee089790cdbb 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bcostm 1:ee089790cdbb 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bcostm 1:ee089790cdbb 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bcostm 1:ee089790cdbb 35 *
bcostm 1:ee089790cdbb 36 ******************************************************************************
bcostm 1:ee089790cdbb 37 */
bcostm 1:ee089790cdbb 38
bcostm 1:ee089790cdbb 39 /* Define to prevent recursive inclusion -------------------------------------*/
bcostm 1:ee089790cdbb 40 #ifndef __STM32746G_DISCOVERY_EEPROM_H
bcostm 1:ee089790cdbb 41 #define __STM32746G_DISCOVERY_EEPROM_H
bcostm 1:ee089790cdbb 42
bcostm 1:ee089790cdbb 43 #ifdef __cplusplus
bcostm 1:ee089790cdbb 44 extern "C" {
bcostm 1:ee089790cdbb 45 #endif
bcostm 1:ee089790cdbb 46
bcostm 1:ee089790cdbb 47 /* Includes ------------------------------------------------------------------*/
bcostm 1:ee089790cdbb 48 #include "stm32746g_discovery.h"
bcostm 1:ee089790cdbb 49
bcostm 1:ee089790cdbb 50 /** @addtogroup BSP
bcostm 1:ee089790cdbb 51 * @{
bcostm 1:ee089790cdbb 52 */
bcostm 1:ee089790cdbb 53
bcostm 1:ee089790cdbb 54 /** @addtogroup STM32746G_DISCOVERY
bcostm 1:ee089790cdbb 55 * @{
bcostm 1:ee089790cdbb 56 */
bcostm 1:ee089790cdbb 57
bcostm 1:ee089790cdbb 58 /** @addtogroup STM32746G_DISCOVERY_EEPROM
bcostm 1:ee089790cdbb 59 * @brief This file includes the I2C EEPROM driver of STM32746G-Discovery board.
bcostm 1:ee089790cdbb 60 * @{
bcostm 1:ee089790cdbb 61 */
bcostm 1:ee089790cdbb 62
bcostm 1:ee089790cdbb 63 /** @defgroup STM32746G_DISCOVERY_EEPROM_Exported_Types STM32746G_DISCOVERY_EEPROM Exported Types
bcostm 1:ee089790cdbb 64 * @{
bcostm 1:ee089790cdbb 65 */
bcostm 1:ee089790cdbb 66 /**
bcostm 1:ee089790cdbb 67 * @}
bcostm 1:ee089790cdbb 68 */
bcostm 1:ee089790cdbb 69
bcostm 1:ee089790cdbb 70 /** @defgroup STM32746G_DISCOVERY_EEPROM_Exported_Constants STM32746G_DISCOVERY_EEPROM Exported Constants
bcostm 1:ee089790cdbb 71 * @{
bcostm 1:ee089790cdbb 72 */
bcostm 1:ee089790cdbb 73 /* EEPROM hardware address and page size */
bcostm 1:ee089790cdbb 74 #define EEPROM_PAGESIZE ((uint8_t)4)
bcostm 1:ee089790cdbb 75 #define EEPROM_MAX_SIZE ((uint16_t)0x2000) /* 64Kbit */
bcostm 1:ee089790cdbb 76
bcostm 1:ee089790cdbb 77
bcostm 1:ee089790cdbb 78 /* Maximum number of trials for EEPROM_WaitEepromStandbyState() function */
bcostm 1:ee089790cdbb 79 #define EEPROM_MAX_TRIALS ((uint32_t)3000)
bcostm 1:ee089790cdbb 80
bcostm 1:ee089790cdbb 81 #define EEPROM_OK ((uint32_t)0)
bcostm 1:ee089790cdbb 82 #define EEPROM_FAIL ((uint32_t)1)
bcostm 1:ee089790cdbb 83 #define EEPROM_TIMEOUT ((uint32_t)2)
bcostm 1:ee089790cdbb 84 /**
bcostm 1:ee089790cdbb 85 * @}
bcostm 1:ee089790cdbb 86 */
bcostm 1:ee089790cdbb 87
bcostm 1:ee089790cdbb 88 /** @defgroup STM32746G_DISCOVERY_EEPROM_Exported_Macros STM32746G_DISCOVERY_EEPROM Exported Macros
bcostm 1:ee089790cdbb 89 * @{
bcostm 1:ee089790cdbb 90 */
bcostm 1:ee089790cdbb 91 /**
bcostm 1:ee089790cdbb 92 * @}
bcostm 1:ee089790cdbb 93 */
bcostm 1:ee089790cdbb 94
bcostm 1:ee089790cdbb 95 /** @addtogroup STM32746G_DISCOVERY_EEPROM_Exported_Functions
bcostm 1:ee089790cdbb 96 * @{
bcostm 1:ee089790cdbb 97 */
bcostm 1:ee089790cdbb 98 uint32_t BSP_EEPROM_Init(void);
bcostm 1:ee089790cdbb 99 uint8_t BSP_EEPROM_DeInit(void);
bcostm 1:ee089790cdbb 100 uint32_t BSP_EEPROM_ReadBuffer(uint8_t* pBuffer, uint16_t ReadAddr, uint16_t* NumByteToRead);
bcostm 1:ee089790cdbb 101 uint32_t BSP_EEPROM_WritePage(uint8_t* pBuffer, uint16_t WriteAddr, uint8_t* NumByteToWrite);
bcostm 1:ee089790cdbb 102 uint32_t BSP_EEPROM_WriteBuffer(uint8_t* pBuffer, uint16_t WriteAddr, uint16_t NumByteToWrite);
bcostm 1:ee089790cdbb 103 uint32_t BSP_EEPROM_WaitEepromStandbyState(void);
bcostm 1:ee089790cdbb 104
bcostm 1:ee089790cdbb 105 /* USER Callbacks: This function is declared as __weak in EEPROM driver and
bcostm 1:ee089790cdbb 106 should be implemented into user application.
bcostm 1:ee089790cdbb 107 BSP_EEPROM_TIMEOUT_UserCallback() function is called whenever a timeout condition
bcostm 1:ee089790cdbb 108 occurs during communication (waiting on an event that doesn't occur, bus
bcostm 1:ee089790cdbb 109 errors, busy devices ...). */
bcostm 1:ee089790cdbb 110 void BSP_EEPROM_TIMEOUT_UserCallback(void);
bcostm 1:ee089790cdbb 111
bcostm 1:ee089790cdbb 112 /* Link function for I2C EEPROM peripheral */
bcostm 1:ee089790cdbb 113 void EEPROM_IO_Init(void);
bcostm 1:ee089790cdbb 114 HAL_StatusTypeDef EEPROM_IO_WriteData(uint16_t DevAddress, uint16_t MemAddress, uint8_t *pBuffer, uint32_t BufferSize);
bcostm 1:ee089790cdbb 115 HAL_StatusTypeDef EEPROM_IO_ReadData(uint16_t DevAddress, uint16_t MemAddress, uint8_t *pBuffer, uint32_t BufferSize);
bcostm 1:ee089790cdbb 116 HAL_StatusTypeDef EEPROM_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials);
bcostm 1:ee089790cdbb 117
bcostm 1:ee089790cdbb 118 /**
bcostm 1:ee089790cdbb 119 * @}
bcostm 1:ee089790cdbb 120 */
bcostm 1:ee089790cdbb 121
bcostm 1:ee089790cdbb 122 /**
bcostm 1:ee089790cdbb 123 * @}
bcostm 1:ee089790cdbb 124 */
bcostm 1:ee089790cdbb 125
bcostm 1:ee089790cdbb 126 /**
bcostm 1:ee089790cdbb 127 * @}
bcostm 1:ee089790cdbb 128 */
bcostm 1:ee089790cdbb 129
bcostm 1:ee089790cdbb 130 /**
bcostm 1:ee089790cdbb 131 * @}
bcostm 1:ee089790cdbb 132 */
bcostm 1:ee089790cdbb 133
bcostm 1:ee089790cdbb 134 #ifdef __cplusplus
bcostm 1:ee089790cdbb 135 }
bcostm 1:ee089790cdbb 136 #endif
bcostm 1:ee089790cdbb 137
bcostm 1:ee089790cdbb 138 #endif /* __STM32746G_DISCOVERY_EEPROM_H */
bcostm 1:ee089790cdbb 139
bcostm 1:ee089790cdbb 140 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/