文檔CH32FV2x_V3xRM.PDF中關(guān)于OTG_FS/USBFS的描述問題

使用ch32v303的OTG_FS/USBFS,但是例程中的寄存器描述與文檔CH32FV2x_V3xRM.PDF中關(guān)于OTG_FS/USBFS的描述并不一致,兩者如何對應(yīng)的?文檔版本v1.6。例程:EXAM\USB\USBFS\DEVICE\CompatibilityHID

#define USBOTG_FS? ? ? ? ? ?((USBOTG_FS_TypeDef *)USBFS_BASE)

#define USBFS_BASE? ? ? ? ? ? ((uint32_t)0x50000000)

image.png


image.png


熱門產(chǎn)品 : USB3.0 HUB控制器:CH634

您好,例程中的庫是采用基地址與結(jié)構(gòu)體映射的方式操作寄存器的,USBFS所有相關(guān)寄存器都可在USBOTGH_FS_TypeDef機構(gòu)中找到對應(yīng)關(guān)系。

typedef struct? __attribute__((packed))

{

? ?__IO uint8_t? ?BASE_CTRL;

? ?__IO uint8_t? ?HOST_CTRL;

? ?__IO uint8_t? ?INT_EN;

? ?__IO uint8_t? ?DEV_ADDR;

? ?__IO uint8_t? ?Reserve0;

? ?__IO uint8_t? ?MIS_ST;

? ?__IO uint8_t? ?INT_FG;

? ?__IO uint8_t? ?INT_ST;

? ?__IO uint16_t? RX_LEN;

? ?__IO uint16_t? Reserve1;

? ?__IO uint8_t? ?Reserve2;

? ?__IO uint8_t? ?HOST_EP_MOD;

? ?__IO uint16_t? Reserve3;

? ?__IO uint32_t? Reserve4;

? ?__IO uint32_t? Reserve5;

? ?__IO uint32_t? HOST_RX_DMA;

? ?__IO uint32_t? HOST_TX_DMA;

? ?__IO uint32_t? Reserve6;

? ?__IO uint32_t? Reserve7;

? ?__IO uint32_t? Reserve8;

? ?__IO uint32_t? Reserve9;

? ?__IO uint32_t? Reserve10;

? ?__IO uint16_t? Reserve11;

? ?__IO uint16_t? HOST_SETUP;

? ?__IO uint8_t? ?HOST_EP_PID;

? ?__IO uint8_t? ?Reserve12;

? ?__IO uint8_t? ?Reserve13;

? ?__IO uint8_t? ?HOST_RX_CTRL;

? ?__IO uint16_t? HOST_TX_LEN;

? ?__IO uint8_t? ?HOST_TX_CTRL;

? ?__IO uint8_t? ?Reserve14;

? ?__IO uint32_t? Reserve15;

? ?__IO uint32_t? Reserve16;

? ?__IO uint32_t? Reserve17;

? ?__IO uint32_t? Reserve18;

? ?__IO uint32_t? Reserve19;

? ?__IO uint32_t? OTG_CR;

? ?__IO uint32_t? OTG_SR;

}USBOTGH_FS_TypeDef;

BASE_CTRL即對應(yīng)USBFS的基地址又對應(yīng)R8_USB_CTRL(USB控制寄存器)。


建議文檔的命名最好能跟寄存器名稱一致,這樣看這方便。


只有登錄才能回復(fù),可以選擇微信賬號登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频