📄 sn8_usb_macro.h
字号:
;*************************************************************************
; Function: Macro Function
;-------------------------------------------------------------------------
; Descriptor:
; For FIFO R/W's macro function
; STEP for using this macro function
; 1. User decide which Endpoint to R/W
; 2. Decide Read or Write
; 3. Determine the Address of RAM
; 3.1 Use EPX_RD_RAM_addr_add to add address with A
; 3.2 Use EPX_WR_RAM_addr_add to add address with A
; 4. Read the data from RAM to A or write the data from A to RAM
;*************************************************************************
// -- Set endpoint's RAM address which is going to be read -- //
EP0_RD_RAM_addr_set expand ep0_address
mov a, ep0_address
CALL EP0_FIFO_RD_addr_set
endm
EP1_RD_RAM_addr_set expand ep1_address
mov a, ep1_address
CALL EP1_FIFO_RD_addr_set
endm
EP2_RD_RAM_addr_set expand ep2_address
mov a, ep2_address
CALL EP2_FIFO_RD_addr_set
endm
// -- Set endpoint's RAM address which is going to be write -- //
EP0_WR_RAM_addr_set expand ep0_address
mov a, ep0_address
CALL EP0_FIFO_WR_addr_set
endm
EP1_WR_RAM_addr_set expand ep1_address
mov a, ep1_address
CALL EP1_FIFO_WR_addr_set
endm
EP2_WR_RAM_addr_set expand ep2_address
mov a, ep2_address
CALL EP2_FIFO_WR_addr_set
endm
// -- Add the RAM (for read data from RAM) address with A -- //
EP0_RD_RAM_addr_add expand add_value
mov a, add_value
CALL EP0_FIFO_RD_addr_add
endm
EP1_RD_RAM_addr_add expand add_value
mov a, add_value
CALL EP1_FIFO_RD_addr_add
endm
EP2_RD_RAM_addr_add expand add_value
mov a, add_value
CALL EP2_FIFO_RD_addr_add
endm
// -- Add the RAM (for write data to RAM) address with A -- //
EP0_WR_RAM_addr_add expand add_value
mov a, add_value
CALL EP0_FIFO_WR_addr_add
endm
EP1_WR_RAM_addr_add expand add_value
mov a, add_value
CALL EP1_FIFO_WR_addr_add
endm
EP2_WR_RAM_addr_add expand add_value
mov a, add_value
CALL EP2_FIFO_WR_addr_add
endm
// -- Read data from RAM to A -- //
EP0_RD_RAM_to_A expand
CALL EP0_FIFO_RD_data
endm
EP1_RD_RAM_to_A expand
CALL EP1_FIFO_RD_data
endm
EP2_RD_RAM_to_A expand
CALL EP2_FIFO_RD_data
endm
// -- Write data from A to RAM -- //
EP0_WR_RAM_data expand wr_data
mov a, wr_data
CALL EP0_FIFO_WR_data
endm
EP1_WR_RAM_data expand wr_data
mov a, wr_data
CALL EP1_FIFO_WR_data
endm
EP2_WR_RAM_data expand wr_data
mov a, wr_data
CALL EP2_FIFO_WR_data
endm
;*************************************************************************
; End of Macro Function
;*************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -