84 lines
2.8 KiB
C
84 lines
2.8 KiB
C
/**
|
|
******************************************************************************
|
|
* @file TIM.h
|
|
* @author TMC Team
|
|
* @version V3.1.0
|
|
* @date 06/19/2009
|
|
* @brief This file contains all the functions prototypes for the TIM firmware
|
|
* library.
|
|
******************************************************************************
|
|
* @copy
|
|
*
|
|
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
|
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
|
|
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
|
|
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
|
|
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
|
|
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
|
*
|
|
* <h2><center>© COPYRIGHT 2009 STMicroelectronics</center></h2>
|
|
*/
|
|
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
#ifndef __FLASH_H
|
|
#define __FLASH_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
#define FL_STS_OVER (Flash->FLSTS & Bit0_En)
|
|
#define CLR_FL_STS_OVER (Flash->FLSTS = Bit0_En)
|
|
#define FL_STS_OP_ERR (Flash->FLSTS & Bit1_En)
|
|
#define CLR_FL_STS_OP_ERR (Flash->FLSTS = Bit1_En)
|
|
#define FL_STS_EV_ERR (Flash->FLSTS1 & Bit2_En)
|
|
#define CLR_FL_STS_EV_ERR (Flash->FLSTS1 = Bit2_En)
|
|
#define FL_STS_PV_ERR (Flash->FLSTS1 & Bit3_En)
|
|
#define CLR_FL_STS_PV_ERR (Flash->FLSTS1 = Bit3_En)
|
|
#define FL_STS_HV_ERR (Flash->FLSTS1 & Bit4_En)
|
|
#define CLR_FL_STS_HV_ERR (Flash->FLSTS1 = Bit4_En)
|
|
|
|
/*- Data convert ------------------------------------------------------------------*/
|
|
#define B2L(x) (*(x+3)*0x1000000 + *(x+2)*0x10000 + *(x+1)*0x100 + *(x))
|
|
#define B2S(x) (*(x+1)*0x100 + *(x))
|
|
#define B2LT(x) (*(x)*0x1000000 + *(x+1)*0x10000 + *(x+2)*0x100 + *(x+3))
|
|
#define B2ST(x) (*(x)*0x100+*(x+1))
|
|
|
|
|
|
//flash state definition
|
|
#define FLASH_FLAG_OVER (0x00000001UL) /*!< FLASH Operation flag*/
|
|
#define FLASH_FLAG_OPERR (0x00000002UL) /*!< FLASH SPD Error flag*/
|
|
#define FLASH_FLAG_EVERR (0x00000004UL) /*!< FLASH Erase Verify fkag*/
|
|
#define FLASH_FLAG_PVERR (0x00000008UL) /*!< FLASH Program Hardware Verify error flag*/
|
|
#define FLASH_FLAG_HVERR (0x00000010UL) /*!< FLASH Erase Hardware Verify error flag*/
|
|
|
|
/**
|
|
* @}
|
|
*/
|
|
/** @addtogroup FLASH_exported_function
|
|
* @{
|
|
*/
|
|
uint8_t FLASH_NormalErase(uint8_t *destAddr);
|
|
uint8_t FLASH_WriteDoubleWords(uint32_t destAddr, uint32_t srcAddr, uint16_t length);
|
|
uint16_t FLASH_Update(uint32_t flashAddr,uint8_t * dataBuf,uint16_t len);
|
|
void TMC_FLASH_Msp_Init(void);
|
|
/**
|
|
* @}
|
|
*/
|
|
/**
|
|
* @}
|
|
*/
|
|
/**
|
|
* @}
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|