2 ******************************************************************************
4 * @author MCD Application Team
7 * @brief Header for usbd_dfu_mal.c file.
8 ******************************************************************************
11 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18 * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
19 ******************************************************************************
22 /* Define to prevent recursive inclusion -------------------------------------*/
26 /* Includes ------------------------------------------------------------------*/
28 #include "stm32f2xx.h"
29 #elif defined(STM32F10X_CL)
30 #include "stm32f10x.h"
31 #endif /* STM32F2XX */
33 #include "usbd_conf.h"
34 #include "usbd_dfu_core.h"
36 /* Exported types ------------------------------------------------------------*/
37 typedef struct _DFU_MAL_PROP
39 const uint8_t* pStrDesc;
40 uint16_t (*pMAL_Init) (void);
41 uint16_t (*pMAL_DeInit) (void);
42 uint16_t (*pMAL_Erase) (uint32_t Add);
43 uint16_t (*pMAL_Write) (uint32_t Add, uint32_t Len);
44 uint8_t *(*pMAL_Read) (uint32_t Add, uint32_t Len);
45 uint16_t (*pMAL_CheckAdd) (uint32_t Add);
46 const uint32_t EraseTiming;
47 const uint32_t WriteTiming;
52 /* Exported constants --------------------------------------------------------*/
56 /* utils macro ---------------------------------------------------------------*/
57 #define _1st_BYTE(x) (uint8_t)((x)&0xFF) /* 1st addressing cycle */
58 #define _2nd_BYTE(x) (uint8_t)(((x)&0xFF00)>>8) /* 2nd addressing cycle */
59 #define _3rd_BYTE(x) (uint8_t)(((x)&0xFF0000)>>16) /* 3rd addressing cycle */
60 #define _4th_BYTE(x) (uint8_t)(((x)&0xFF000000)>>24) /* 4th addressing cycle */
62 /* Exported macro ------------------------------------------------------------*/
63 #define SET_POLLING_TIMING(x) buffer[1] = _1st_BYTE(x);\
64 buffer[2] = _2nd_BYTE(x);\
65 buffer[3] = _3rd_BYTE(x);
67 /* Exported functions ------------------------------------------------------- */
69 uint16_t MAL_Init (void);
70 uint16_t MAL_DeInit (void);
71 uint16_t MAL_Erase (uint32_t SectorAddress);
72 uint16_t MAL_Write (uint32_t SectorAddress, uint32_t DataLength);
73 uint8_t *MAL_Read (uint32_t SectorAddress, uint32_t DataLength);
74 uint16_t MAL_GetStatus(uint32_t SectorAddress ,uint8_t Cmd, uint8_t *buffer);
76 extern uint8_t MAL_Buffer[XFERSIZE]; /* RAM Buffer for Downloaded Data */
77 #endif /* __DFU_MAL_H */
79 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/