usbd_mem_if_template.c
Go to the documentation of this file.
1 
30 /* Includes ------------------------------------------------------------------*/
31 #include "usbd_mem_if_template.h"
32 #include "usbd_dfu_mal.h"
33 
34 /* Private typedef -----------------------------------------------------------*/
35 /* Private define ------------------------------------------------------------*/
36 /* Private macro -------------------------------------------------------------*/
37 
38 /* Private function prototypes -----------------------------------------------*/
39 uint16_t MEM_If_Init(void);
40 uint16_t MEM_If_Erase (uint32_t Add);
41 uint16_t MEM_If_Write (uint32_t Add, uint32_t Len);
42 uint8_t *MEM_If_Read (uint32_t Add, uint32_t Len);
43 uint16_t MEM_If_DeInit(void);
44 uint16_t MEM_If_CheckAdd(uint32_t Add);
45 
46 
47 /* Private variables ---------------------------------------------------------*/
49  {
57  10, /* Erase Time in ms */
58  10 /* Programming Time in ms */
59  };
60 
61 /* Private functions ---------------------------------------------------------*/
62 
69 uint16_t MEM_If_Init(void)
70 {
71  return MAL_OK;
72 }
73 
80 uint16_t MEM_If_DeInit(void)
81 {
82  return MAL_OK;
83 }
84 
91 uint16_t MEM_If_Erase(uint32_t Add)
92 {
93  return MAL_OK;
94 }
95 
103 uint16_t MEM_If_Write(uint32_t Add, uint32_t Len)
104 {
105  return MAL_OK;
106 }
107 
115 uint8_t *MEM_If_Read (uint32_t Add, uint32_t Len)
116 {
117  /* Return a valid address to avoid HardFault */
118  return (uint8_t*)(MAL_Buffer);
119 }
120 
128 uint16_t MEM_If_CheckAdd(uint32_t Add)
129 {
130  if ((Add >= MEM_START_ADD) && (Add < MEM_END_ADD))
131  {
132  return MAL_OK;
133  }
134  else
135  {
136  return MAL_FAIL;
137  }
138 }
139 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
uint16_t MEM_If_DeInit(void)
MEM_If_DeInit Memory deinitialization routine.
Header for usbd_mem_if_template.c file.
#define MEM_START_ADD
uint16_t MEM_If_CheckAdd(uint32_t Add)
MEM_If_CheckAdd Check if the address is an allowed address for this memory.
#define MEM_END_ADD
#define MEM_IF_STRING
uint8_t * MEM_If_Read(uint32_t Add, uint32_t Len)
MEM_If_Read Memory read routine.
uint8_t MAL_Buffer[XFERSIZE]
Definition: usbd_dfu_mal.c:83
uint16_t MEM_If_Init(void)
MEM_If_Init Memory initialization routine.
Header for usbd_dfu_mal.c file.
uint16_t MEM_If_Erase(uint32_t Add)
MEM_If_Erase Erase sector.
#define MAL_OK
Definition: usbd_dfu_mal.h:55
uint16_t MEM_If_Write(uint32_t Add, uint32_t Len)
MEM_If_Write Memory write routine.
DFU_MAL_Prop_TypeDef DFU_Mem_cb
#define MAL_FAIL
Definition: usbd_dfu_mal.h:56


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 19:59:26