GD32F1x0: USB/GD32_USB_Device_Library/Class/IAP/inc/usbd_iap_mal.h Source File

GD32F1x0

usbd_iap_mal.h
Go to the documentation of this file.
1 
11 /* Define to prevent recursive inclusion -------------------------------------*/
12 #ifndef __GD32F1X0_USBD_IAP_MAL_H
13 #define __GD32F1X0_USBD_IAP_MAL_H
14 
15 /* Includes ------------------------------------------------------------------*/
16 #include "usbd_conf.h"
17 #include "usbd_iap_core.h"
18 
38 typedef struct _IAP_MAL_PROPERTY
39 {
40  const uint8_t* pStrDesc;
41  uint8_t (*pMAL_Init) (void);
42  uint8_t (*pMAL_DeInit) (void);
43  uint8_t (*pMAL_Erase) (uint32_t Addr, uint32_t PageCount);
44  uint8_t (*pMAL_Write) (uint8_t Data[], uint32_t Addr, uint32_t Len);
45  uint8_t* (*pMAL_Read) (uint32_t Addr, uint32_t Len);
46  uint8_t (*pMAL_CheckAdd) (uint32_t Addr);
47  const uint32_t EraseTimeout;
48  const uint32_t WriteTimeout;
49 }
51 
59 typedef enum
60 {
61  MAL_OK = 0,
62  MAL_FAIL
63 } MAL_Status;
64 
72 #define _1st_BYTE(x) (uint8_t)((x) & 0xFF)
73 #define _2nd_BYTE(x) (uint8_t)(((x) & 0xFF00) >> 8)
74 #define _3rd_BYTE(x) (uint8_t)(((x) & 0xFF0000) >> 16)
76 #define SET_POLLING_TIMEOUT(x) buffer[1] = _1st_BYTE(x);\
77  buffer[2] = _2nd_BYTE(x);\
78  buffer[3] = _3rd_BYTE(x);
79 
87 uint8_t IAP_MAL_Init (void);
88 uint8_t IAP_MAL_DeInit (void);
89 uint8_t IAP_MAL_Erase (uint32_t Addr, uint32_t PageCount);
90 uint8_t IAP_MAL_Write (uint8_t Data[], uint32_t Addr, uint32_t Len);
91 uint8_t* IAP_MAL_Read (uint32_t Addr, uint32_t Len);
92 uint8_t IAP_MAL_GetStatus (uint32_t Addr, uint8_t Cmd, uint8_t *buffer);
93 
101 extern uint8_t MAL_Buffer[TRANSFER_SIZE];
102 
107 #endif /* __GD32F1X0_USBD_DFU_MAL_H */
108 
125 /************************ (C) COPYRIGHT 2014 GIGADEVICE *****END OF FILE****/
Custom HID device class core defines for usb iap.
uint8_t * IAP_MAL_Read(uint32_t Addr, uint32_t Len)
Read data from sectors of memory.
Definition: usbd_iap_mal.c:182
uint8_t IAP_MAL_Erase(uint32_t Addr, uint32_t PageCount)
Erase a memory sector.
Definition: usbd_iap_mal.c:114
uint8_t IAP_MAL_Init(void)
Initialize the memory media on the GD32.
Definition: usbd_iap_mal.c:70
uint8_t IAP_MAL_GetStatus(uint32_t Addr, uint8_t Cmd, uint8_t *buffer)
Get the status of a given memory and store in buffer.
Definition: usbd_iap_mal.c:216
uint8_t IAP_MAL_Write(uint8_t Data[], uint32_t Addr, uint32_t Len)
Write data to sectors of memory.
Definition: usbd_iap_mal.c:148
uint8_t IAP_MAL_DeInit(void)
Deinitialize the memory media on the GD32.
Definition: usbd_iap_mal.c:92
Generated by   doxygen 1.8.10