From 04dbb0e4bb315549121755ee1643bcf1f422684e Mon Sep 17 00:00:00 2001 From: Dean Netherton Date: Sat, 16 Nov 2024 10:02:57 +1100 Subject: [PATCH] ch376-native: some cleanup of build process and an initial readme added --- Source/HBIOS/ch376-native/Dockerfile | 6 - Source/HBIOS/ch376-native/Makefile | 148 +- Source/HBIOS/ch376-native/base-drv.asm | 20 +- Source/HBIOS/ch376-native/base-drv.s | 16 +- .../HBIOS/ch376-native/base-drv/ch376.c.asm | 1136 +++++++++++++ Source/HBIOS/ch376-native/base-drv/ch376.c.s | 323 ++-- .../ch376-native/base-drv/class_hub.c.asm | 458 +++++ .../HBIOS/ch376-native/base-drv/class_hub.c.s | 22 +- .../base-drv/critical-section.c.s | 6 +- .../ch376-native/base-drv/dev_transfers.c.asm | 834 ++++++++++ .../ch376-native/base-drv/dev_transfers.c.s | 345 ++-- .../ch376-native/base-drv/enumerate.c.asm | 1472 +++++++++++++++++ .../HBIOS/ch376-native/base-drv/enumerate.c.s | 524 +++--- .../ch376-native/base-drv/enumerate_hub.c.s | 160 +- .../base-drv/enumerate_storage.c.s | 77 +- .../HBIOS/ch376-native/base-drv/protocol.c.s | 182 +- .../ch376-native/base-drv/transfers.c.asm | 829 ++++++++++ .../HBIOS/ch376-native/base-drv/transfers.c.s | 160 +- .../ch376-native/base-drv/usb-base-drv.c.asm | 441 +++++ .../ch376-native/base-drv/usb-base-drv.c.s | 22 +- .../HBIOS/ch376-native/base-drv/usb-init.c.s | 75 +- .../ch376-native/base-drv/usb_state.c.asm | 605 +++++++ .../HBIOS/ch376-native/base-drv/usb_state.c.s | 82 +- .../ch376-native/base-drv/work-area.c.asm | 520 ++++++ .../HBIOS/ch376-native/base-drv/work-area.c.s | 2 +- Source/HBIOS/ch376-native/build-docker.sh | 0 Source/HBIOS/ch376-native/cruntime.asm | 112 +- Source/HBIOS/ch376-native/keyboard.s | 2 +- .../HBIOS/ch376-native/keyboard/class_hid.c.s | 87 +- .../keyboard/class_hid_keyboard.c.s | 24 +- .../HBIOS/ch376-native/keyboard/kyb-init.c.s | 185 +-- Source/HBIOS/ch376-native/readme.md | 60 + Source/HBIOS/ch376-native/root.md | 0 Source/HBIOS/ch376-native/scsi-drv.s | 2 +- .../ch376-native/scsi-drv/class_scsi.c.s | 432 +++-- .../HBIOS/ch376-native/scsi-drv/scsi-init.c.s | 26 +- .../HBIOS/ch376-native/source-doc/depends.d | 30 - Source/HBIOS/ch376-native/ufi-drv.s | 2 +- .../HBIOS/ch376-native/ufi-drv/class_ufi.c.s | 265 +-- .../HBIOS/ch376-native/ufi-drv/ufi-init.c.s | 127 +- .../HBIOS/ch376-native/ufi-drv/usb_cbi.c.asm | 599 +++++++ Source/HBIOS/ch376-native/ufi-drv/usb_cbi.c.s | 72 +- Source/HBIOS/util.asm | 11 - 43 files changed, 8536 insertions(+), 1965 deletions(-) delete mode 100644 Source/HBIOS/ch376-native/Dockerfile create mode 100644 Source/HBIOS/ch376-native/base-drv/ch376.c.asm create mode 100644 Source/HBIOS/ch376-native/base-drv/class_hub.c.asm create mode 100644 Source/HBIOS/ch376-native/base-drv/dev_transfers.c.asm create mode 100644 Source/HBIOS/ch376-native/base-drv/enumerate.c.asm create mode 100644 Source/HBIOS/ch376-native/base-drv/transfers.c.asm create mode 100644 Source/HBIOS/ch376-native/base-drv/usb-base-drv.c.asm create mode 100644 Source/HBIOS/ch376-native/base-drv/usb_state.c.asm create mode 100644 Source/HBIOS/ch376-native/base-drv/work-area.c.asm delete mode 100644 Source/HBIOS/ch376-native/build-docker.sh create mode 100644 Source/HBIOS/ch376-native/readme.md delete mode 100644 Source/HBIOS/ch376-native/root.md delete mode 100644 Source/HBIOS/ch376-native/source-doc/depends.d create mode 100644 Source/HBIOS/ch376-native/ufi-drv/usb_cbi.c.asm diff --git a/Source/HBIOS/ch376-native/Dockerfile b/Source/HBIOS/ch376-native/Dockerfile deleted file mode 100644 index 47156098..00000000 --- a/Source/HBIOS/ch376-native/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -# Build with: docker build --progress plain -t romwbw-z88dk . -# run with : docker run -v ${PWD}:/src/ --privileged=true -u $(id -u ${USER}):$(id -g ${USER}) -it romwbw-z88dk:latest - -FROM z88dk/z88dk - -RUN apk add build-base diff --git a/Source/HBIOS/ch376-native/Makefile b/Source/HBIOS/ch376-native/Makefile index 6cb8f757..ffdc9715 100644 --- a/Source/HBIOS/ch376-native/Makefile +++ b/Source/HBIOS/ch376-native/Makefile @@ -3,18 +3,21 @@ SHELLFLAGS := -c -e -x .ONESHELL: MAKEFLAGS += --warn-undefined-variables MAKEFLAGS += --no-builtin-rules - -ZCC_EXTRA := --vc -Cs --Werror - -ZCCRELFLAGS= -ifdef RELEASE -ZCCRELFLAGS=-SO3 --max-allocs-per-node600000 --allow-unsafe-read --opt-code-speed -endif +MAKEFLAGS += --always-make +ZCCRELFLAGS := -SO3 --max-allocs-per-node600000 --allow-unsafe-read --opt-code-speed SRC := ./source-doc/ LIBS := -I./$(SRC)base-drv/ +ZCCFLAGS := +z80 -vn -startup=0 -clib=sdcc_iy -crt0 $(SRC)crt.asm -compiler=sdcc -Cs--std=c23 -Cs--Werror $(ZCCRELFLAGS) $(LIBS) -ZCC := zcc +z80 -vn -startup=0 -clib=sdcc_iy -crt0 $(SRC)crt.asm -compiler=sdcc -Cs--std=c23 -Cs--Werror $(ZCCRELFLAGS) $(LIBS) +ZCC_PATH := $(shell command -v zcc) +ZCC := $(shell command -v zcc >/dev/null 2>&1 && echo zcc || echo 'docker run -w /host/${PWD} -v /:/host/ -u $(shell id -u ${USER}):$(shell id -g ${USER}) -t z88dk/z88dk zcc') + +ifeq ($(ZCC_PATH),) + $(info ZCC is set to use Docker to run zcc) +else + $(info ZCC is set to $(ZCC_PATH)) +endif ASSDIR := ./ @@ -30,42 +33,6 @@ clean: rm base-drv.s rm keyboard.s -$(ASSDIR)base-drv.s: - @echo "Creating base-drv.s" - echo "; Generated File -- not to be modify directly" > $(ASSDIR)base-drv.s - for dep in $^; do - dep=$${dep#*/} - dep=$${dep#*/} - echo '#include "'ch376-native/base-drv/$${dep}'"' >> $(ASSDIR)base-drv.s - done - -$(ASSDIR)scsi-drv.s: - @echo "Creating scsi-drv.s" - echo "; Generated File -- not to be modify directly" > $(ASSDIR)scsi-drv.s - for dep in $^; do - dep=$${dep#*/} - dep=$${dep#*/} - echo '#include "'ch376-native/scsi-drv/$${dep}'"' >> $(ASSDIR)scsi-drv.s - done - -$(ASSDIR)ufi-drv.s: - @echo "Creating ufi-drv.s" - echo "; Generated File -- not to be modify directly" > $(ASSDIR)ufi-drv.s - for dep in $^; do - dep=$${dep#*/} - dep=$${dep#*/} - echo '#include "'ch376-native/ufi-drv/$${dep}'"' >> $(ASSDIR)ufi-drv.s - done - -$(ASSDIR)keyboard.s: - @echo "Creating keyboard.s" - echo "; Generated File -- not to be modify directly" > $(ASSDIR)keyboard.s - for dep in $^; do - dep=$${dep#*/} - dep=$${dep#*/} - echo '#include "'ch376-native/keyboard/$${dep}'"' >> $(ASSDIR)keyboard.s - done - $(ASSDIR)%.c.s: $(ASSDIR)%.c.asm @mkdir -p $(dir $@) echo "Converting $< to $@" @@ -78,87 +45,30 @@ $(ASSDIR)%.s: $(SRC)%.asm define compile @mkdir -p $(dir $@) - $(ZCC) --c-code-in-asm --assemble-only $< -o $@ + $(ZCC) $(ZCCFLAGS) --c-code-in-asm --assemble-only $< -o $@ echo "Compiled $(notdir $@) from $(notdir $<)" endef -$(ASSDIR)base-drv/%.c.asm: $(SRC)base-drv/%.c; $(compile) -$(ASSDIR)scsi-drv/%.c.asm: $(SRC)scsi-drv/%.c; $(compile) -$(ASSDIR)keyboard/%.c.asm: $(SRC)keyboard/%.c; $(compile) -$(ASSDIR)ufi-drv/%.c.asm: $(SRC)ufi-drv/%.c; $(compile) -$(ASSDIR)%.c.asm: $(SRC)%.c; $(compile) -$(ASSDIR)libraries/delay/%.c.asm: ../apps/libraries/delay/%.c; $(compile) -$(ASSDIR)libraries/usb/%.c.asm: ../apps/libraries/usb/%.c; $(compile) - -.PHONY: format -format: SHELL:=/bin/bash -format: - @clang-format --version - find \( -name "*.c" -o -name "*.h" \) -exec echo "formating {}" \; -exec clang-format -i {} \; - ZSDCPP_FLAGS= -I"${ZCCCFG}../../include/_DEVELOPMENT/sdcc" $(LIBS) -include ${SRC}depends.d - -deps: - @echo "" > ${SRC}/depends.d - # C Dependencies - (cd ${SRC} && find -name "*.c") | while read -r file; do - file_no_ext="$${file%.*}" - file_no_ext=$${file_no_ext#./} - filename=$$(basename $$file_no_ext) - from="$$filename.o" - to="${ASSDIR}$$file_no_ext.c.s" - echo -n "$${file}: " > /tmp/deps.deps - echo -n "$${file_no_ext}.c " >> /tmp/deps.deps - z88dk-ucpp ${ZSDCPP_FLAGS} -M ./${SRC}$$file_no_ext.c >> /tmp/deps.deps - touch /tmp/deps.deps - sed "s+$$from+$$to+g" /tmp/deps.deps >> ${SRC}/depends.d - done - - # configure base-drv.s to all .s files - printf "##\r\n" >> ${SRC}/depends.d - printf "./base-drv.s: " >> ${SRC}/depends.d - (cd ${SRC}/base-drv && find -name "*.c") | while read -r file; do - file_no_ext="$${file%.*}" - file_no_ext=$${file_no_ext#./} - filename=$$(basename $$file_no_ext) - printf "base-drv/$$file.s " >> ${SRC}/depends.d +define build_subsystem = +$$(ASSDIR)$(1).s: + @echo "Creating $(1).s" + echo "; Generated File -- not to be modify directly" > $$(ASSDIR)$(1).s + for dep in $$^; do + dep=$$$${dep#*/} + dep=$$$${dep#*/} + echo '#include "'ch376-native/$(1)/$$$${dep}'"' >> $$(ASSDIR)$(1).s done - printf "\r\n" >> ${SRC}/depends.d - # # configure scsi-drv.s to all .s files - printf "##\r\n" >> ${SRC}/depends.d - printf "./scsi-drv.s: " >> ${SRC}/depends.d - (cd ${SRC}/scsi-drv && find -name "*.c") | while read -r file; do - file_no_ext="$${file%.*}" - file_no_ext=$${file_no_ext#./} - filename=$$(basename $$file_no_ext) - printf "scsi-drv/$$file.s " >> ${SRC}/depends.d - done - - printf "\r\n" >> ${SRC}/depends.d - # # configure ufi-drv.s to all .s files - printf "##\r\n" >> ${SRC}/depends.d - printf "./ufi-drv.s: " >> ${SRC}/depends.d - (cd ${SRC}/ufi-drv && find -name "*.c") | while read -r file; do - file_no_ext="$${file%.*}" - file_no_ext=$${file_no_ext#./} - filename=$$(basename $$file_no_ext) - printf "ufi-drv/$$file.s " >> ${SRC}/depends.d - done +$$(ASSDIR)$(1)/%.c.asm: $$(SRC)$(1)/%.c; $$(compile) - printf "\r\n" >> ${SRC}/depends.d - # # configure keyboard.s to all .s files - printf "##\r\n" >> ${SRC}/depends.d - printf "./keyboard.s: " >> ${SRC}/depends.d - (cd ${SRC}/keyboard && find -name "*.c") | while read -r file; do - file_no_ext="$${file%.*}" - file_no_ext=$${file_no_ext#./} - filename=$$(basename $$file_no_ext) - printf "keyboard/$$file.s " >> ${SRC}/depends.d - done - - echo "" >> ${SRC}/depends.d +$(1)_C_FILES := $$(wildcard $$(SRC)$(1)/*.c) +$(1)_S_FILES := $$(patsubst ./source-doc/%, ./%, $$($(1)_C_FILES:.c=.c.s)) +./$(1).s: $$($(1)_S_FILES) +endef - echo "${SRC}depends.d created" +$(eval $(call build_subsystem,base-drv)) +$(eval $(call build_subsystem,scsi-drv)) +$(eval $(call build_subsystem,keyboard)) +$(eval $(call build_subsystem,ufi-drv)) diff --git a/Source/HBIOS/ch376-native/base-drv.asm b/Source/HBIOS/ch376-native/base-drv.asm index 12e1c250..67583ba6 100644 --- a/Source/HBIOS/ch376-native/base-drv.asm +++ b/Source/HBIOS/ch376-native/base-drv.asm @@ -1,10 +1,10 @@ DELAY_FACTOR .EQU 640 -CMD01_RD_USB_DATA0 .EQU 0x27 ; Read data block from current USB interrupt endpoint buffer or host endpoint receive buffer +CMD01_RD_USB_DATA0 .EQU $27 ; Read data block from current USB interrupt endpoint buffer or host endpoint receive buffer ; output: length, data stream -CMD10_WR_HOST_DATA .EQU 0x2C ; Write a data block to the send buffer of the USB host endpoint +CMD10_WR_HOST_DATA .EQU $2C ; Write a data block to the send buffer of the USB host endpoint ; input: length, data stream CH_CMD_RD_USB_DATA0 .EQU CMD01_RD_USB_DATA0 @@ -36,26 +36,25 @@ keep_waiting: or l jr nz, _ch_wait_int_and_get_status - CALL _delay + call _delay ld a, $FF - in a, (_CH376_COMMAND_PORT & 0xFF) - bit 4, a ; _CH376_COMMAND_PORT & PARA_STATE_BUSY + in a, (_CH376_COMMAND_PORT & $FF) + bit 4, a ; _CH376_COMMAND_PORT & PARA_STATE_BUSY - ld l, 0x0C ; USB_ERR_CH376_BLOCKED; + ld l, $0C ; USB_ERR_CH376_BLOCKED; ret nz - ld l, 0x0D ; USB_ERR_CH376_TIMEOUT + ld l, $0D ; USB_ERR_CH376_TIMEOUT ret ; uint8_t ch_read_data(uint8_t *buffer) __sdcccall(1); _ch_read_data: - ; ch_command(CH_CMD_RD_USB_DATA0); push hl ld l, CH_CMD_RD_USB_DATA0 call _ch_command pop hl - CALL _delay + call _delay ld bc, _CH376_DATA_PORT in a, (c) @@ -65,7 +64,7 @@ _ch_read_data: ld e, a push af read_block: - CALL _delay + call _delay in a, (c) ld (hl), a inc hl @@ -77,7 +76,6 @@ read_block: ;const uint8_t *ch_write_data(const uint8_t *buffer, uint8_t length) _ch_write_data: -;libraries/usb/ch376.c:125: ch_command(CH_CMD_WR_HOST_DATA); ld l, CH_CMD_WR_HOST_DATA call _ch_command diff --git a/Source/HBIOS/ch376-native/base-drv.s b/Source/HBIOS/ch376-native/base-drv.s index cb623d53..fb66e985 100644 --- a/Source/HBIOS/ch376-native/base-drv.s +++ b/Source/HBIOS/ch376-native/base-drv.s @@ -1,14 +1,14 @@ ; Generated File -- not to be modify directly -#include "ch376-native/base-drv/dev_transfers.c.s" +#include "ch376-native/base-drv/ch376.c.s" +#include "ch376-native/base-drv/class_hub.c.s" #include "ch376-native/base-drv/critical-section.c.s" +#include "ch376-native/base-drv/dev_transfers.c.s" #include "ch376-native/base-drv/enumerate.c.s" -#include "ch376-native/base-drv/usb_state.c.s" -#include "ch376-native/base-drv/class_hub.c.s" -#include "ch376-native/base-drv/enumerate_storage.c.s" #include "ch376-native/base-drv/enumerate_hub.c.s" -#include "ch376-native/base-drv/usb-base-drv.c.s" -#include "ch376-native/base-drv/transfers.c.s" -#include "ch376-native/base-drv/ch376.c.s" +#include "ch376-native/base-drv/enumerate_storage.c.s" #include "ch376-native/base-drv/protocol.c.s" -#include "ch376-native/base-drv/work-area.c.s" +#include "ch376-native/base-drv/transfers.c.s" +#include "ch376-native/base-drv/usb-base-drv.c.s" #include "ch376-native/base-drv/usb-init.c.s" +#include "ch376-native/base-drv/usb_state.c.s" +#include "ch376-native/base-drv/work-area.c.s" diff --git a/Source/HBIOS/ch376-native/base-drv/ch376.c.asm b/Source/HBIOS/ch376-native/base-drv/ch376.c.asm new file mode 100644 index 00000000..f698491b --- /dev/null +++ b/Source/HBIOS/ch376-native/base-drv/ch376.c.asm @@ -0,0 +1,1136 @@ +;-------------------------------------------------------- +; File Created by SDCC : free open source ISO C Compiler +; Version 4.4.0 #14648 (Linux) +;-------------------------------------------------------- +; Processed by Z88DK +;-------------------------------------------------------- + + EXTERN __divschar + EXTERN __divschar_callee + EXTERN __divsint + EXTERN __divsint_callee + EXTERN __divslong + EXTERN __divslong_callee + EXTERN __divslonglong + EXTERN __divslonglong_callee + EXTERN __divsuchar + EXTERN __divsuchar_callee + EXTERN __divuchar + EXTERN __divuchar_callee + EXTERN __divuint + EXTERN __divuint_callee + EXTERN __divulong + EXTERN __divulong_callee + EXTERN __divulonglong + EXTERN __divulonglong_callee + EXTERN __divuschar + EXTERN __divuschar_callee + EXTERN __modschar + EXTERN __modschar_callee + EXTERN __modsint + EXTERN __modsint_callee + EXTERN __modslong + EXTERN __modslong_callee + EXTERN __modslonglong + EXTERN __modslonglong_callee + EXTERN __modsuchar + EXTERN __modsuchar_callee + EXTERN __moduchar + EXTERN __moduchar_callee + EXTERN __moduint + EXTERN __moduint_callee + EXTERN __modulong + EXTERN __modulong_callee + EXTERN __modulonglong + EXTERN __modulonglong_callee + EXTERN __moduschar + EXTERN __moduschar_callee + EXTERN __mulint + EXTERN __mulint_callee + EXTERN __mullong + EXTERN __mullong_callee + EXTERN __mullonglong + EXTERN __mullonglong_callee + EXTERN __mulschar + EXTERN __mulschar_callee + EXTERN __mulsuchar + EXTERN __mulsuchar_callee + EXTERN __muluchar + EXTERN __muluchar_callee + EXTERN __muluschar + EXTERN __muluschar_callee + EXTERN __rlslonglong + EXTERN __rlslonglong_callee + EXTERN __rlulonglong + EXTERN __rlulonglong_callee + EXTERN __rrslonglong + EXTERN __rrslonglong_callee + EXTERN __rrulonglong + EXTERN __rrulonglong_callee + EXTERN ___mulsint2slong + EXTERN ___mulsint2slong_callee + EXTERN ___muluint2ulong + EXTERN ___muluint2ulong_callee + EXTERN ___sdcc_call_hl + EXTERN ___sdcc_call_iy + EXTERN ___sdcc_enter_ix + EXTERN banked_call + EXTERN _banked_ret + EXTERN ___fs2schar + EXTERN ___fs2schar_callee + EXTERN ___fs2sint + EXTERN ___fs2sint_callee + EXTERN ___fs2slong + EXTERN ___fs2slong_callee + EXTERN ___fs2slonglong + EXTERN ___fs2slonglong_callee + EXTERN ___fs2uchar + EXTERN ___fs2uchar_callee + EXTERN ___fs2uint + EXTERN ___fs2uint_callee + EXTERN ___fs2ulong + EXTERN ___fs2ulong_callee + EXTERN ___fs2ulonglong + EXTERN ___fs2ulonglong_callee + EXTERN ___fsadd + EXTERN ___fsadd_callee + EXTERN ___fsdiv + EXTERN ___fsdiv_callee + EXTERN ___fseq + EXTERN ___fseq_callee + EXTERN ___fsgt + EXTERN ___fsgt_callee + EXTERN ___fslt + EXTERN ___fslt_callee + EXTERN ___fsmul + EXTERN ___fsmul_callee + EXTERN ___fsneq + EXTERN ___fsneq_callee + EXTERN ___fssub + EXTERN ___fssub_callee + EXTERN ___schar2fs + EXTERN ___schar2fs_callee + EXTERN ___sint2fs + EXTERN ___sint2fs_callee + EXTERN ___slong2fs + EXTERN ___slong2fs_callee + EXTERN ___slonglong2fs + EXTERN ___slonglong2fs_callee + EXTERN ___uchar2fs + EXTERN ___uchar2fs_callee + EXTERN ___uint2fs + EXTERN ___uint2fs_callee + EXTERN ___ulong2fs + EXTERN ___ulong2fs_callee + EXTERN ___ulonglong2fs + EXTERN ___ulonglong2fs_callee + EXTERN ____sdcc_2_copy_src_mhl_dst_deix + EXTERN ____sdcc_2_copy_src_mhl_dst_bcix + EXTERN ____sdcc_4_copy_src_mhl_dst_deix + EXTERN ____sdcc_4_copy_src_mhl_dst_bcix + EXTERN ____sdcc_4_copy_src_mhl_dst_mbc + EXTERN ____sdcc_4_ldi_nosave_bc + EXTERN ____sdcc_4_ldi_save_bc + EXTERN ____sdcc_4_push_hlix + EXTERN ____sdcc_4_push_mhl + EXTERN ____sdcc_lib_setmem_hl + EXTERN ____sdcc_ll_add_de_bc_hl + EXTERN ____sdcc_ll_add_de_bc_hlix + EXTERN ____sdcc_ll_add_de_hlix_bc + EXTERN ____sdcc_ll_add_de_hlix_bcix + EXTERN ____sdcc_ll_add_deix_bc_hl + EXTERN ____sdcc_ll_add_deix_hlix + EXTERN ____sdcc_ll_add_hlix_bc_deix + EXTERN ____sdcc_ll_add_hlix_deix_bc + EXTERN ____sdcc_ll_add_hlix_deix_bcix + EXTERN ____sdcc_ll_asr_hlix_a + EXTERN ____sdcc_ll_asr_mbc_a + EXTERN ____sdcc_ll_copy_src_de_dst_hlix + EXTERN ____sdcc_ll_copy_src_de_dst_hlsp + EXTERN ____sdcc_ll_copy_src_deix_dst_hl + EXTERN ____sdcc_ll_copy_src_deix_dst_hlix + EXTERN ____sdcc_ll_copy_src_deixm_dst_hlsp + EXTERN ____sdcc_ll_copy_src_desp_dst_hlsp + EXTERN ____sdcc_ll_copy_src_hl_dst_de + EXTERN ____sdcc_ll_copy_src_hlsp_dst_de + EXTERN ____sdcc_ll_copy_src_hlsp_dst_deixm + EXTERN ____sdcc_ll_lsl_hlix_a + EXTERN ____sdcc_ll_lsl_mbc_a + EXTERN ____sdcc_ll_lsr_hlix_a + EXTERN ____sdcc_ll_lsr_mbc_a + EXTERN ____sdcc_ll_push_hlix + EXTERN ____sdcc_ll_push_mhl + EXTERN ____sdcc_ll_sub_de_bc_hl + EXTERN ____sdcc_ll_sub_de_bc_hlix + EXTERN ____sdcc_ll_sub_de_hlix_bc + EXTERN ____sdcc_ll_sub_de_hlix_bcix + EXTERN ____sdcc_ll_sub_deix_bc_hl + EXTERN ____sdcc_ll_sub_deix_hlix + EXTERN ____sdcc_ll_sub_hlix_bc_deix + EXTERN ____sdcc_ll_sub_hlix_deix_bc + EXTERN ____sdcc_ll_sub_hlix_deix_bcix + EXTERN ____sdcc_load_debc_deix + EXTERN ____sdcc_load_dehl_deix + EXTERN ____sdcc_load_debc_mhl + EXTERN ____sdcc_load_hlde_mhl + EXTERN ____sdcc_store_dehl_bcix + EXTERN ____sdcc_store_debc_hlix + EXTERN ____sdcc_store_debc_mhl + EXTERN ____sdcc_cpu_pop_ei + EXTERN ____sdcc_cpu_pop_ei_jp + EXTERN ____sdcc_cpu_push_di + EXTERN ____sdcc_outi + EXTERN ____sdcc_outi_128 + EXTERN ____sdcc_outi_256 + EXTERN ____sdcc_ldi + EXTERN ____sdcc_ldi_128 + EXTERN ____sdcc_ldi_256 + EXTERN ____sdcc_4_copy_srcd_hlix_dst_deix + EXTERN ____sdcc_4_and_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_or_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_or_src_dehl_dst_bcix + EXTERN ____sdcc_4_xor_src_dehl_dst_bcix + EXTERN ____sdcc_4_and_src_dehl_dst_bcix + EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_or_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_cpl_src_mhl_dst_debc + EXTERN ____sdcc_4_xor_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_or_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_debc_hlix_dst_debc + EXTERN ____sdcc_4_or_src_debc_hlix_dst_debc + EXTERN ____sdcc_4_xor_src_debc_hlix_dst_debc + +;-------------------------------------------------------- +; Public variables in this module +;-------------------------------------------------------- + GLOBAL _ch_issue_token_out + GLOBAL _ch_issue_token_in + GLOBAL _ch_issue_token + GLOBAL _result + GLOBAL _ch_command + GLOBAL _ch_long_wait_int_and_get_status + GLOBAL _ch_short_wait_int_and_get_status + GLOBAL _ch_very_short_wait_int_and_get_status + GLOBAL _ch_get_status + GLOBAL _ch_cmd_reset_all + GLOBAL _ch_probe + GLOBAL _ch_cmd_set_usb_mode + GLOBAL _ch_cmd_get_ic_version + GLOBAL _ch_issue_token_out_ep0 + GLOBAL _ch_issue_token_in_ep0 + GLOBAL _ch_issue_token_setup + GLOBAL _ch_data_in_transfer + GLOBAL _ch_data_in_transfer_n + GLOBAL _ch_data_out_transfer + GLOBAL _ch_set_usb_address +;-------------------------------------------------------- +; Externals used +;-------------------------------------------------------- + GLOBAL _ch_wait_int_and_get_status + GLOBAL _print_uint16 + GLOBAL _print_string + GLOBAL _print_hex + GLOBAL _ch_control_transfer_set_config + GLOBAL _ch_control_transfer_set_address + GLOBAL _ch_control_transfer_request_descriptor + GLOBAL _ch_write_data + GLOBAL _ch_read_data + GLOBAL _delay_medium + GLOBAL _delay_short + GLOBAL _delay_20ms + GLOBAL _printf + GLOBAL _delay + GLOBAL _ulltoa_callee + GLOBAL _ulltoa + GLOBAL _strtoull_callee + GLOBAL _strtoull + GLOBAL _strtoll_callee + GLOBAL _strtoll + GLOBAL _lltoa_callee + GLOBAL _lltoa + GLOBAL _llabs_callee + GLOBAL _llabs + GLOBAL __lldivu__callee + GLOBAL __lldivu_ + GLOBAL __lldiv__callee + GLOBAL __lldiv_ + GLOBAL _atoll_callee + GLOBAL _atoll + GLOBAL _realloc_unlocked_callee + GLOBAL _realloc_unlocked + GLOBAL _malloc_unlocked_fastcall + GLOBAL _malloc_unlocked + GLOBAL _free_unlocked_fastcall + GLOBAL _free_unlocked + GLOBAL _calloc_unlocked_callee + GLOBAL _calloc_unlocked + GLOBAL _aligned_alloc_unlocked_callee + GLOBAL _aligned_alloc_unlocked + GLOBAL _realloc_callee + GLOBAL _realloc + GLOBAL _malloc_fastcall + GLOBAL _malloc + GLOBAL _free_fastcall + GLOBAL _free + GLOBAL _calloc_callee + GLOBAL _calloc + GLOBAL _aligned_alloc_callee + GLOBAL _aligned_alloc + GLOBAL _utoa_callee + GLOBAL _utoa + GLOBAL _ultoa_callee + GLOBAL _ultoa + GLOBAL _system_fastcall + GLOBAL _system + GLOBAL _strtoul_callee + GLOBAL _strtoul + GLOBAL _strtol_callee + GLOBAL _strtol + GLOBAL _strtof_callee + GLOBAL _strtof + GLOBAL _strtod_callee + GLOBAL _strtod + GLOBAL _srand_fastcall + GLOBAL _srand + GLOBAL _rand + GLOBAL _quick_exit_fastcall + GLOBAL _quick_exit + GLOBAL _qsort_callee + GLOBAL _qsort + GLOBAL _ltoa_callee + GLOBAL _ltoa + GLOBAL _labs_fastcall + GLOBAL _labs + GLOBAL _itoa_callee + GLOBAL _itoa + GLOBAL _ftoh_callee + GLOBAL _ftoh + GLOBAL _ftog_callee + GLOBAL _ftog + GLOBAL _ftoe_callee + GLOBAL _ftoe + GLOBAL _ftoa_callee + GLOBAL _ftoa + GLOBAL _exit_fastcall + GLOBAL _exit + GLOBAL _dtoh_callee + GLOBAL _dtoh + GLOBAL _dtog_callee + GLOBAL _dtog + GLOBAL _dtoe_callee + GLOBAL _dtoe + GLOBAL _dtoa_callee + GLOBAL _dtoa + GLOBAL _bsearch_callee + GLOBAL _bsearch + GLOBAL _atol_fastcall + GLOBAL _atol + GLOBAL _atoi_fastcall + GLOBAL _atoi + GLOBAL _atof_fastcall + GLOBAL _atof + GLOBAL _atexit_fastcall + GLOBAL _atexit + GLOBAL _at_quick_exit_fastcall + GLOBAL _at_quick_exit + GLOBAL _abs_fastcall + GLOBAL _abs + GLOBAL _abort + GLOBAL __strtou__callee + GLOBAL __strtou_ + GLOBAL __strtoi__callee + GLOBAL __strtoi_ + GLOBAL __random_uniform_xor_8__fastcall + GLOBAL __random_uniform_xor_8_ + GLOBAL __random_uniform_xor_32__fastcall + GLOBAL __random_uniform_xor_32_ + GLOBAL __random_uniform_cmwc_8__fastcall + GLOBAL __random_uniform_cmwc_8_ + GLOBAL __shellsort__callee + GLOBAL __shellsort_ + GLOBAL __quicksort__callee + GLOBAL __quicksort_ + GLOBAL __insertion_sort__callee + GLOBAL __insertion_sort_ + GLOBAL __ldivu__callee + GLOBAL __ldivu_ + GLOBAL __ldiv__callee + GLOBAL __ldiv_ + GLOBAL __divu__callee + GLOBAL __divu_ + GLOBAL __div__callee + GLOBAL __div_ +;-------------------------------------------------------- +; special function registers +;-------------------------------------------------------- +defc _CH376_DATA_PORT = 0xff88 +defc _CH376_COMMAND_PORT = 0xff89 +defc _USB_MODULE_LEDS = 0xff8a +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + SECTION bss_compiler +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + +IF 0 + +; .area _INITIALIZED removed by z88dk + +_result: + DEFS 1 + +ENDIF + +;-------------------------------------------------------- +; absolute external ram data +;-------------------------------------------------------- + SECTION IGNORE +;-------------------------------------------------------- +; global & static initialisations +;-------------------------------------------------------- + SECTION code_crt_init +;-------------------------------------------------------- +; Home +;-------------------------------------------------------- + SECTION IGNORE +;-------------------------------------------------------- +; code +;-------------------------------------------------------- + SECTION code_compiler +;source-doc/base-drv/ch376.c:8: void ch_command(const uint8_t command) __z88dk_fastcall { +; --------------------------------- +; Function ch_command +; --------------------------------- +_ch_command: +;source-doc/base-drv/ch376.c:10: while ((CH376_COMMAND_PORT & PARA_STATE_BUSY) && --counter != 0) + ld c,0xff +l_ch_command_00102: + ld a, +((_CH376_COMMAND_PORT) / 256) + in a, (((_CH376_COMMAND_PORT) & 0xFF)) + bit 4, a + jr Z,l_ch_command_00104 + dec c + jr NZ,l_ch_command_00102 +l_ch_command_00104: +;source-doc/base-drv/ch376.c:21: CH376_COMMAND_PORT = command; + ld a, l + ld bc,_CH376_COMMAND_PORT + out (c),a +;source-doc/base-drv/ch376.c:22: } + ret +;source-doc/base-drv/ch376.c:26: usb_error ch_long_wait_int_and_get_status(void) { return ch_wait_int_and_get_status(5000); } +; --------------------------------- +; Function ch_long_wait_int_and_get_status +; --------------------------------- +_ch_long_wait_int_and_get_status: + ld hl,0x1388 + jp _ch_wait_int_and_get_status +;source-doc/base-drv/ch376.c:28: usb_error ch_short_wait_int_and_get_status(void) { return ch_wait_int_and_get_status(100); } +; --------------------------------- +; Function ch_short_wait_int_and_get_status +; --------------------------------- +_ch_short_wait_int_and_get_status: + ld hl,0x0064 + jp _ch_wait_int_and_get_status +;source-doc/base-drv/ch376.c:30: usb_error ch_very_short_wait_int_and_get_status(void) { return ch_wait_int_and_get_status(10); } +; --------------------------------- +; Function ch_very_short_wait_int_and_get_status +; --------------------------------- +_ch_very_short_wait_int_and_get_status: + ld hl,0x000a + jp _ch_wait_int_and_get_status +;source-doc/base-drv/ch376.c:32: usb_error ch_get_status(void) { +; --------------------------------- +; Function ch_get_status +; --------------------------------- +_ch_get_status: +;source-doc/base-drv/ch376.c:33: ch_command(CH_CMD_GET_STATUS); + ld l,0x22 + call _ch_command +;source-doc/base-drv/ch376.c:34: uint8_t ch_status = CH376_DATA_PORT; + ld a, +((_CH376_DATA_PORT) / 256) + in a, (((_CH376_DATA_PORT) & 0xFF)) +;source-doc/base-drv/ch376.c:36: if (ch_status >= USB_FILERR_MIN && ch_status <= USB_FILERR_MAX) + ld l,a + sub a,0x41 + jr C,l_ch_get_status_00102 + ld a,0xb4 + sub a, l +;source-doc/base-drv/ch376.c:37: return ch_status; + jr NC,l_ch_get_status_00126 +l_ch_get_status_00102: +;source-doc/base-drv/ch376.c:39: if (ch_status == CH_CMD_RET_SUCCESS) + ld a, l +;source-doc/base-drv/ch376.c:40: return USB_ERR_OK; + sub a,0x51 + jr NZ,l_ch_get_status_00105 + ld l,a + jr l_ch_get_status_00126 +l_ch_get_status_00105: +;source-doc/base-drv/ch376.c:42: if (ch_status == CH_USB_INT_SUCCESS) + ld a, l +;source-doc/base-drv/ch376.c:43: return USB_ERR_OK; + sub a,0x14 + jr NZ,l_ch_get_status_00107 + ld l,a + jr l_ch_get_status_00126 +l_ch_get_status_00107: +;source-doc/base-drv/ch376.c:45: if (ch_status == CH_USB_INT_CONNECT) + ld a, l + sub a,0x15 + jr NZ,l_ch_get_status_00109 +;source-doc/base-drv/ch376.c:46: return USB_INT_CONNECT; + ld l,0x81 + jr l_ch_get_status_00126 +l_ch_get_status_00109: +;source-doc/base-drv/ch376.c:48: if (ch_status == CH_USB_INT_DISK_READ) + ld a, l + sub a,0x1d + jr NZ,l_ch_get_status_00111 +;source-doc/base-drv/ch376.c:49: return USB_ERR_DISK_READ; + ld l,0x1d + jr l_ch_get_status_00126 +l_ch_get_status_00111: +;source-doc/base-drv/ch376.c:51: if (ch_status == CH_USB_INT_DISK_WRITE) + ld a, l + sub a,0x1e + jr NZ,l_ch_get_status_00113 +;source-doc/base-drv/ch376.c:52: return USB_ERR_DISK_WRITE; + ld l,0x1e + jr l_ch_get_status_00126 +l_ch_get_status_00113: +;source-doc/base-drv/ch376.c:54: if (ch_status == CH_USB_INT_DISCONNECT) { + ld a, l + sub a,0x16 + jr NZ,l_ch_get_status_00115 +;source-doc/base-drv/ch376.c:55: ch_cmd_set_usb_mode(5); + ld l,0x05 + call _ch_cmd_set_usb_mode +;source-doc/base-drv/ch376.c:56: return USB_ERR_NO_DEVICE; + ld l,0x05 + jr l_ch_get_status_00126 +l_ch_get_status_00115: +;source-doc/base-drv/ch376.c:59: if (ch_status == CH_USB_INT_BUF_OVER) + ld a, l + sub a,0x17 + jr NZ,l_ch_get_status_00117 +;source-doc/base-drv/ch376.c:60: return USB_ERR_DATA_ERROR; + ld l,0x04 + jr l_ch_get_status_00126 +l_ch_get_status_00117: +;source-doc/base-drv/ch376.c:62: ch_status &= 0x2F; + ld a, l + and a,0x2f +;source-doc/base-drv/ch376.c:64: if (ch_status == 0x2A) + cp a,0x2a + jr NZ,l_ch_get_status_00119 +;source-doc/base-drv/ch376.c:65: return USB_ERR_NAK; + ld l,0x01 + jr l_ch_get_status_00126 +l_ch_get_status_00119: +;source-doc/base-drv/ch376.c:67: if (ch_status == 0x2E) + cp a,0x2e + jr NZ,l_ch_get_status_00121 +;source-doc/base-drv/ch376.c:68: return USB_ERR_STALL; + ld l,0x02 + jr l_ch_get_status_00126 +l_ch_get_status_00121: +;source-doc/base-drv/ch376.c:70: ch_status &= 0x23; + and a,0x23 +;source-doc/base-drv/ch376.c:72: if (ch_status == 0x20) + cp a,0x20 + jr NZ,l_ch_get_status_00123 +;source-doc/base-drv/ch376.c:73: return USB_ERR_TIMEOUT; + ld l,0x03 + jr l_ch_get_status_00126 +l_ch_get_status_00123: +;source-doc/base-drv/ch376.c:75: if (ch_status == 0x23) + sub a,0x23 + jr NZ,l_ch_get_status_00125 +;source-doc/base-drv/ch376.c:76: return USB_TOKEN_OUT_OF_SYNC; + ld l,0x07 + jr l_ch_get_status_00126 +l_ch_get_status_00125: +;source-doc/base-drv/ch376.c:78: return USB_ERR_UNEXPECTED_STATUS_FROM_HOST; + ld l,0x08 +l_ch_get_status_00126: +;source-doc/base-drv/ch376.c:79: } + ret +;source-doc/base-drv/ch376.c:81: void ch_cmd_reset_all(void) { ch_command(CH_CMD_RESET_ALL); } +; --------------------------------- +; Function ch_cmd_reset_all +; --------------------------------- +_ch_cmd_reset_all: + ld l,0x05 + jp _ch_command +;source-doc/base-drv/ch376.c:100: uint8_t ch_probe(void) { +; --------------------------------- +; Function ch_probe +; --------------------------------- +_ch_probe: + push ix + ld ix,0 + add ix,sp + dec sp +;source-doc/base-drv/ch376.c:102: do { + ld (ix-1),0x05 +l_ch_probe_00103: +;source-doc/base-drv/ch376.c:85: ch_command(CH_CMD_CHECK_EXIST); + ld l,0x06 + call _ch_command +;source-doc/base-drv/ch376.c:86: CH376_DATA_PORT = (uint8_t)~0x55; + ld a,0xaa + ld bc,_CH376_DATA_PORT + out (c),a +;source-doc/base-drv/ch376.c:87: delay(); + call _delay +;source-doc/base-drv/ch376.c:88: complement = CH376_DATA_PORT; + ld a, +((_CH376_DATA_PORT) / 256) + in a, (((_CH376_DATA_PORT) & 0xFF)) +;source-doc/base-drv/ch376.c:89: return complement == 0x55; + sub a,0x55 + jr NZ,l_ch_probe_00102 +;source-doc/base-drv/ch376.c:103: if (ch_cmd_check_exist()) +;source-doc/base-drv/ch376.c:104: return true; + ld l,0x01 + jr l_ch_probe_00107 +l_ch_probe_00102: +;source-doc/base-drv/ch376.c:106: delay_medium(); + call _delay_medium +;source-doc/base-drv/ch376.c:107: } while (--i != 0); + dec (ix-1) + jr NZ,l_ch_probe_00103 +;source-doc/base-drv/ch376.c:109: return false; + ld l,0x00 +l_ch_probe_00107: +;source-doc/base-drv/ch376.c:110: } + inc sp + pop ix + ret +;source-doc/base-drv/ch376.c:112: uint8_t ch_cmd_set_usb_mode(const uint8_t mode) __z88dk_fastcall { +; --------------------------------- +; Function ch_cmd_set_usb_mode +; --------------------------------- +_ch_cmd_set_usb_mode: + ld c, l +;source-doc/base-drv/ch376.c:113: uint8_t result = 0; + ld b,0x00 +;source-doc/base-drv/ch376.c:115: CH376_COMMAND_PORT = CH_CMD_SET_USB_MODE; + ld a,0x15 + push bc + ld bc,_CH376_COMMAND_PORT + out (c),a + call _delay + pop bc +;source-doc/base-drv/ch376.c:117: CH376_DATA_PORT = mode; + ld a, c + push bc + ld bc,_CH376_DATA_PORT + out (c),a + call _delay + pop bc +;source-doc/base-drv/ch376.c:122: while (result != CH_CMD_RET_SUCCESS && result != CH_CMD_RET_ABORT && --count != 0) { + ld c,0x7f +l_ch_cmd_set_usb_mode_00103: + ld a, b + sub a,0x51 + jr NZ,l_ch_cmd_set_usb_mode_00146 + ld a,0x01 + jr l_ch_cmd_set_usb_mode_00147 +l_ch_cmd_set_usb_mode_00146: + xor a,a +l_ch_cmd_set_usb_mode_00147: + ld e,a + bit 0,a + jr NZ,l_ch_cmd_set_usb_mode_00105 + ld a, b + sub a,0x5f + jr Z,l_ch_cmd_set_usb_mode_00105 + dec c + jr Z,l_ch_cmd_set_usb_mode_00105 +;source-doc/base-drv/ch376.c:123: result = CH376_DATA_PORT; + ld a, +((_CH376_DATA_PORT) / 256) + in a, (((_CH376_DATA_PORT) & 0xFF)) + ld b, a +;source-doc/base-drv/ch376.c:124: delay(); + push bc + call _delay + pop bc + jr l_ch_cmd_set_usb_mode_00103 +l_ch_cmd_set_usb_mode_00105: +;source-doc/base-drv/ch376.c:127: return (result == CH_CMD_RET_SUCCESS) ? USB_ERR_OK : USB_ERR_FAIL; + ld a, e + or a, a + jr Z,l_ch_cmd_set_usb_mode_00108 + ld l,0x00 + jr l_ch_cmd_set_usb_mode_00109 +l_ch_cmd_set_usb_mode_00108: + ld l,0x0e +l_ch_cmd_set_usb_mode_00109: +;source-doc/base-drv/ch376.c:128: } + ret +;source-doc/base-drv/ch376.c:130: uint8_t ch_cmd_get_ic_version(void) { +; --------------------------------- +; Function ch_cmd_get_ic_version +; --------------------------------- +_ch_cmd_get_ic_version: +;source-doc/base-drv/ch376.c:131: ch_command(CH_CMD_GET_IC_VER); + ld l,0x01 + call _ch_command +;source-doc/base-drv/ch376.c:132: return CH376_DATA_PORT & 0x1f; + ld a, +((_CH376_DATA_PORT) / 256) + in a, (((_CH376_DATA_PORT) & 0xFF)) + and a,0x1f + ld l, a +;source-doc/base-drv/ch376.c:133: } + ret +;source-doc/base-drv/ch376.c:135: void ch_issue_token(const uint8_t toggle_bit, const uint8_t endpoint, const ch376_pid pid) { +; --------------------------------- +; Function ch_issue_token +; --------------------------------- +_ch_issue_token: + push ix + ld ix,0 + add ix,sp +;source-doc/base-drv/ch376.c:136: ch_command(CH_CMD_ISSUE_TKN_X); + ld l,0x4e + call _ch_command +;source-doc/base-drv/ch376.c:137: CH376_DATA_PORT = toggle_bit; + ld a,(ix+4) + ld bc,_CH376_DATA_PORT + out (c),a +;source-doc/base-drv/ch376.c:138: CH376_DATA_PORT = endpoint << 4 | pid; + ld a,(ix+5) + add a, a + add a, a + add a, a + add a, a + or a,(ix+6) + ld bc,_CH376_DATA_PORT + out (c),a +;source-doc/base-drv/ch376.c:139: } + pop ix + ret +;source-doc/base-drv/ch376.c:141: void ch_issue_token_in(const endpoint_param *const endpoint) __z88dk_fastcall { +; --------------------------------- +; Function ch_issue_token_in +; --------------------------------- +_ch_issue_token_in: +;source-doc/base-drv/ch376.c:142: ch_issue_token(endpoint->toggle ? 0x80 : 0x00, endpoint->number, CH_PID_IN); + ld e,l + ld d,h + ld a, (hl) + rrca + and a,0x07 + ld b, a + ex de, hl + ld a, (hl) + and a,0x01 + jr Z,l_ch_issue_token_in_00103 + ld a,0x80 + jr l_ch_issue_token_in_00104 +l_ch_issue_token_in_00103: + xor a, a +l_ch_issue_token_in_00104: + ld h,0x09 + ld l,b + push hl + push af + inc sp + call _ch_issue_token + pop af + inc sp +;source-doc/base-drv/ch376.c:143: } + ret +;source-doc/base-drv/ch376.c:145: void ch_issue_token_out(const endpoint_param *const endpoint) __z88dk_fastcall { +; --------------------------------- +; Function ch_issue_token_out +; --------------------------------- +_ch_issue_token_out: +;source-doc/base-drv/ch376.c:146: ch_issue_token(endpoint->toggle ? 0x40 : 0x00, endpoint->number, CH_PID_OUT); + ld e,l + ld d,h + ld a, (hl) + rrca + and a,0x07 + ld b, a + ex de, hl + ld a, (hl) + and a,0x01 + jr Z,l_ch_issue_token_out_00103 + ld a,0x40 + jr l_ch_issue_token_out_00104 +l_ch_issue_token_out_00103: + xor a, a +l_ch_issue_token_out_00104: + ld h,0x01 + ld l,b + push hl + push af + inc sp + call _ch_issue_token + pop af + inc sp +;source-doc/base-drv/ch376.c:147: } + ret +;source-doc/base-drv/ch376.c:149: void ch_issue_token_out_ep0(void) { ch_issue_token(0x40, 0, CH_PID_OUT); } +; --------------------------------- +; Function ch_issue_token_out_ep0 +; --------------------------------- +_ch_issue_token_out_ep0: + ld a,0x01 + push af + inc sp + xor a, a + ld d,a + ld e,0x40 + push de + call _ch_issue_token + pop af + inc sp + ret +;source-doc/base-drv/ch376.c:151: void ch_issue_token_in_ep0(void) { ch_issue_token(0x80, 0, CH_PID_IN); } +; --------------------------------- +; Function ch_issue_token_in_ep0 +; --------------------------------- +_ch_issue_token_in_ep0: + ld a,0x09 + push af + inc sp + xor a, a + ld d,a + ld e,0x80 + push de + call _ch_issue_token + pop af + inc sp + ret +;source-doc/base-drv/ch376.c:153: void ch_issue_token_setup(void) { ch_issue_token(0, 0, CH_PID_SETUP); } +; --------------------------------- +; Function ch_issue_token_setup +; --------------------------------- +_ch_issue_token_setup: + ld a,0x0d + push af + inc sp + xor a, a + push af + inc sp + xor a, a + push af + inc sp + call _ch_issue_token + pop af + inc sp + ret +;source-doc/base-drv/ch376.c:155: usb_error ch_data_in_transfer(uint8_t *buffer, int16_t buffer_size, endpoint_param *const endpoint) { +; --------------------------------- +; Function ch_data_in_transfer +; --------------------------------- +_ch_data_in_transfer: + push ix + ld ix,0 + add ix,sp + push af +;source-doc/base-drv/ch376.c:158: if (buffer_size == 0) + ld a,(ix+7) + or a,(ix+6) + jr NZ,l_ch_data_in_transfer_00102 +;source-doc/base-drv/ch376.c:159: return USB_ERR_OK; + ld l,0x00 + jp l_ch_data_in_transfer_00111 +l_ch_data_in_transfer_00102: +;source-doc/base-drv/ch376.c:161: USB_MODULE_LEDS = 0x01; + ld a,0x01 + ld bc,_USB_MODULE_LEDS + out (c),a +;source-doc/base-drv/ch376.c:162: do { + ld c,(ix+8) + ld b,(ix+9) + pop de + push bc +l_ch_data_in_transfer_00107: +;source-doc/base-drv/ch376.c:163: ch_issue_token_in(endpoint); + ld l,c + ld h,b + push hl + call _ch_issue_token_in + call _ch_long_wait_int_and_get_status + pop bc + ld a, l + ld (_result), a +;source-doc/base-drv/ch376.c:166: CHECK(result); + ld a,(_result) + or a, a + jr NZ,l_ch_data_in_transfer_00110 +;source-doc/base-drv/ch376.c:168: endpoint->toggle = !endpoint->toggle; + ld e, c + ld d, b + pop hl + ld a,(hl) + push hl + and a,0x01 + xor a,0x01 + and a,0x01 + ld l, a + ld a, (de) + and a,0xfe + or a, l + ld (de), a +;source-doc/base-drv/ch376.c:170: count = ch_read_data(buffer); + push bc + ld l,(ix+4) + ld h,(ix+5) + call _ch_read_data + ld e, a + pop bc +;source-doc/base-drv/ch376.c:172: if (count == 0) { + ld a, e +;source-doc/base-drv/ch376.c:173: USB_MODULE_LEDS = 0x00; + or a,a + jr NZ,l_ch_data_in_transfer_00106 + ld bc,_USB_MODULE_LEDS + out (c),a +;source-doc/base-drv/ch376.c:174: return USB_ERR_DATA_ERROR; + ld l,0x04 + jr l_ch_data_in_transfer_00111 +l_ch_data_in_transfer_00106: +;source-doc/base-drv/ch376.c:177: buffer += count; + ld a,(ix+4) + add a, e + ld (ix+4),a + jr NC,l_ch_data_in_transfer_00148 + inc (ix+5) +l_ch_data_in_transfer_00148: +;source-doc/base-drv/ch376.c:178: buffer_size -= count; + ld d,0x00 + ld a,(ix+6) + sub a, e + ld (ix+6),a + ld a,(ix+7) + sbc a, d + ld (ix+7),a +;source-doc/base-drv/ch376.c:179: } while (buffer_size > 0); + xor a, a + cp a,(ix+6) + sbc a,(ix+7) + jp PO, l_ch_data_in_transfer_00149 + xor a,0x80 +l_ch_data_in_transfer_00149: + jp M, l_ch_data_in_transfer_00107 +;source-doc/base-drv/ch376.c:181: USB_MODULE_LEDS = 0x00; + ld a,0x00 + ld bc,_USB_MODULE_LEDS + out (c),a +;source-doc/base-drv/ch376.c:183: return USB_ERR_OK; + ld l,0x00 + jr l_ch_data_in_transfer_00111 +;source-doc/base-drv/ch376.c:184: done: +l_ch_data_in_transfer_00110: +;source-doc/base-drv/ch376.c:185: return result; + ld hl,(_result) + ld h,+((_result) / 256) +l_ch_data_in_transfer_00111: +;source-doc/base-drv/ch376.c:186: } + ld sp, ix + pop ix + ret +;source-doc/base-drv/ch376.c:188: usb_error ch_data_in_transfer_n(uint8_t *const buffer, int8_t *const buffer_size, endpoint_param *const endpoint) { +; --------------------------------- +; Function ch_data_in_transfer_n +; --------------------------------- +_ch_data_in_transfer_n: + push ix + ld ix,0 + add ix,sp +;source-doc/base-drv/ch376.c:192: USB_MODULE_LEDS = 0x01; + ld a,0x01 + ld bc,_USB_MODULE_LEDS + out (c),a +;source-doc/base-drv/ch376.c:194: ch_issue_token_in(endpoint); + ld l,(ix+8) + ld h,(ix+9) + call _ch_issue_token_in +;source-doc/base-drv/ch376.c:196: CHECK(ch_long_wait_int_and_get_status()); + call _ch_long_wait_int_and_get_status + ld a, l + ld b, a + or a, a + jr NZ,l_ch_data_in_transfer_n_00103 +;source-doc/base-drv/ch376.c:198: endpoint->toggle = !endpoint->toggle; + ld e,(ix+8) + ld d,(ix+9) + ld c, e + ld b, d + ex de, hl + ld a, (hl) + and a,0x01 + xor a,0x01 + and a,0x01 + ld e, a + ld a, (bc) + and a,0xfe + or a, e + ld (bc), a +;source-doc/base-drv/ch376.c:200: count = ch_read_data(buffer); + ld l,(ix+4) + ld h,(ix+5) + call _ch_read_data +;source-doc/base-drv/ch376.c:202: *buffer_size = count; + ld c,(ix+6) + ld b,(ix+7) + ld (bc), a +;source-doc/base-drv/ch376.c:204: USB_MODULE_LEDS = 0x00; + ld a,0x00 + ld bc,_USB_MODULE_LEDS + out (c),a +;source-doc/base-drv/ch376.c:206: return USB_ERR_OK; + ld l,0x00 + jr l_ch_data_in_transfer_n_00104 +;source-doc/base-drv/ch376.c:207: done: +l_ch_data_in_transfer_n_00103: +;source-doc/base-drv/ch376.c:208: return result; + ld l, b +l_ch_data_in_transfer_n_00104: +;source-doc/base-drv/ch376.c:209: } + pop ix + ret +;source-doc/base-drv/ch376.c:211: usb_error ch_data_out_transfer(const uint8_t *buffer, int16_t buffer_length, endpoint_param *const endpoint) { +; --------------------------------- +; Function ch_data_out_transfer +; --------------------------------- +_ch_data_out_transfer: + push ix + ld ix,0 + add ix,sp + push af + dec sp +;source-doc/base-drv/ch376.c:214: const uint8_t max_packet_size = calc_max_packet_size(endpoint->max_packet_sizex); + ld c,(ix+8) + ld b,(ix+9) + ld e, c + ld d, b + inc de + ld a, (de) + ld (ix-3),a +;source-doc/base-drv/ch376.c:216: USB_MODULE_LEDS = 0x02; + ld a,0x02 + push bc + ld bc,_USB_MODULE_LEDS + out (c),a + pop bc +;source-doc/base-drv/ch376.c:218: while (buffer_length > 0) { + ld (ix-2),c + ld (ix-1),b +l_ch_data_out_transfer_00103: + xor a, a + cp a,(ix+6) + sbc a,(ix+7) + jp PO, l_ch_data_out_transfer_00139 + xor a,0x80 +l_ch_data_out_transfer_00139: + jp P, l_ch_data_out_transfer_00105 +;source-doc/base-drv/ch376.c:219: const uint8_t size = max_packet_size < buffer_length ? max_packet_size : buffer_length; + ld d,(ix-3) + ld e,0x00 + ld a, d + sub a,(ix+6) + ld a, e + sbc a,(ix+7) + jp PO, l_ch_data_out_transfer_00140 + xor a,0x80 +l_ch_data_out_transfer_00140: + jp P, l_ch_data_out_transfer_00109 + jr l_ch_data_out_transfer_00110 +l_ch_data_out_transfer_00109: + ld d,(ix+6) + ld e,(ix+7) +l_ch_data_out_transfer_00110: +;source-doc/base-drv/ch376.c:220: buffer = ch_write_data(buffer, size); + push bc + push de + push de + inc sp + ld l,(ix+4) + ld h,(ix+5) + push hl + call _ch_write_data + pop af + inc sp + pop de + pop bc + ld (ix+4),l + ld (ix+5),h +;source-doc/base-drv/ch376.c:221: buffer_length -= size; + ld e,0x00 + ld a,(ix+6) + sub a, d + ld (ix+6),a + ld a,(ix+7) + sbc a, e + ld (ix+7),a +;source-doc/base-drv/ch376.c:222: ch_issue_token_out(endpoint); + ld l,c + ld h,b + push hl + call _ch_issue_token_out + call _ch_long_wait_int_and_get_status + ld a, l + pop bc + ld l, a + or a, a + jr NZ,l_ch_data_out_transfer_00106 +;source-doc/base-drv/ch376.c:226: endpoint->toggle = !endpoint->toggle; + ld e, c + ld d, b + ld l,(ix-2) + ld h,(ix-1) + ld a, (hl) + and a,0x01 + xor a,0x01 + and a,0x01 + ld l, a + ld a, (de) + and a,0xfe + or a, l + ld (de), a + jr l_ch_data_out_transfer_00103 +l_ch_data_out_transfer_00105: +;source-doc/base-drv/ch376.c:229: USB_MODULE_LEDS = 0x00; + ld a,0x00 + ld bc,_USB_MODULE_LEDS + out (c),a +;source-doc/base-drv/ch376.c:231: return USB_ERR_OK; + ld l,0x00 +;source-doc/base-drv/ch376.c:232: done: +;source-doc/base-drv/ch376.c:233: return result; +l_ch_data_out_transfer_00106: +;source-doc/base-drv/ch376.c:234: } + ld sp, ix + pop ix + ret +;source-doc/base-drv/ch376.c:236: void ch_set_usb_address(const uint8_t device_address) __z88dk_fastcall { +; --------------------------------- +; Function ch_set_usb_address +; --------------------------------- +_ch_set_usb_address: +;source-doc/base-drv/ch376.c:237: ch_command(CH_CMD_SET_USB_ADDR); + push hl + ld l,0x13 + call _ch_command + pop hl +;source-doc/base-drv/ch376.c:238: CH376_DATA_PORT = device_address; + ld a, l + ld bc,_CH376_DATA_PORT + out (c),a +;source-doc/base-drv/ch376.c:239: } + ret + SECTION data_compiler +_result: + DEFB +0x00 + SECTION IGNORE diff --git a/Source/HBIOS/ch376-native/base-drv/ch376.c.s b/Source/HBIOS/ch376-native/base-drv/ch376.c.s index 8e731447..746f8893 100644 --- a/Source/HBIOS/ch376-native/base-drv/ch376.c.s +++ b/Source/HBIOS/ch376-native/base-drv/ch376.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/base-drv/./ch376.c.asm -- not to be modify directly +; Generated from source-doc/base-drv/ch376.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -50,12 +50,12 @@ _result: ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/base-drv/./ch376.c:8: void ch_command(const uint8_t command) __z88dk_fastcall { +;source-doc/base-drv/ch376.c:8: void ch_command(const uint8_t command) __z88dk_fastcall { ; --------------------------------- ; Function ch_command ; --------------------------------- _ch_command: -;source-doc/base-drv/./ch376.c:10: while ((CH376_COMMAND_PORT & PARA_STATE_BUSY) && --counter != 0) +;source-doc/base-drv/ch376.c:10: while ((CH376_COMMAND_PORT & PARA_STATE_BUSY) && --counter != 0) ld c,0xff l_ch_command_00102: ld a, +((_CH376_COMMAND_PORT) / 256) @@ -65,223 +65,224 @@ l_ch_command_00102: dec c jr NZ,l_ch_command_00102 l_ch_command_00104: -;source-doc/base-drv/./ch376.c:21: CH376_COMMAND_PORT = command; +;source-doc/base-drv/ch376.c:21: CH376_COMMAND_PORT = command; ld a, l ld bc,_CH376_COMMAND_PORT out (c),a -;source-doc/base-drv/./ch376.c:22: } +;source-doc/base-drv/ch376.c:22: } ret -;source-doc/base-drv/./ch376.c:26: usb_error ch_long_wait_int_and_get_status(void) { return ch_wait_int_and_get_status(5000); } +;source-doc/base-drv/ch376.c:26: usb_error ch_long_wait_int_and_get_status(void) { return ch_wait_int_and_get_status(5000); } ; --------------------------------- ; Function ch_long_wait_int_and_get_status ; --------------------------------- _ch_long_wait_int_and_get_statu: ld hl,0x1388 jp _ch_wait_int_and_get_status -;source-doc/base-drv/./ch376.c:28: usb_error ch_short_wait_int_and_get_statu(void) { return ch_wait_int_and_get_status(100); } +;source-doc/base-drv/ch376.c:28: usb_error ch_short_wait_int_and_get_statu(void) { return ch_wait_int_and_get_status(100); } ; --------------------------------- ; Function ch_short_wait_int_and_get_statu ; --------------------------------- _ch_short_wait_int_and_get_stat: ld hl,0x0064 jp _ch_wait_int_and_get_status -;source-doc/base-drv/./ch376.c:30: usb_error ch_very_short_wait_int_and_get_(void) { return ch_wait_int_and_get_status(10); } +;source-doc/base-drv/ch376.c:30: usb_error ch_very_short_wait_int_and_get_(void) { return ch_wait_int_and_get_status(10); } ; --------------------------------- ; Function ch_very_short_wait_int_and_get_ ; --------------------------------- _ch_very_short_wait_int_and_get: ld hl,0x000a jp _ch_wait_int_and_get_status -;source-doc/base-drv/./ch376.c:32: usb_error ch_get_status(void) { +;source-doc/base-drv/ch376.c:32: usb_error ch_get_status(void) { ; --------------------------------- ; Function ch_get_status ; --------------------------------- _ch_get_status: -;source-doc/base-drv/./ch376.c:33: ch_command(CH_CMD_GET_STATUS); +;source-doc/base-drv/ch376.c:33: ch_command(CH_CMD_GET_STATUS); ld l,0x22 call _ch_command -;source-doc/base-drv/./ch376.c:34: uint8_t ch_status = CH376_DATA_PORT; +;source-doc/base-drv/ch376.c:34: uint8_t ch_status = CH376_DATA_PORT; ld a, +((_CH376_DATA_PORT) / 256) in a, (((_CH376_DATA_PORT) & 0xFF)) -;source-doc/base-drv/./ch376.c:36: if (ch_status >= USB_FILERR_MIN && ch_status <= USB_FILERR_MAX) +;source-doc/base-drv/ch376.c:36: if (ch_status >= USB_FILERR_MIN && ch_status <= USB_FILERR_MAX) ld l,a sub 0x41 jr C,l_ch_get_status_00102 ld a,0xb4 sub l -;source-doc/base-drv/./ch376.c:37: return ch_status; +;source-doc/base-drv/ch376.c:37: return ch_status; jr NC,l_ch_get_status_00126 l_ch_get_status_00102: -;source-doc/base-drv/./ch376.c:39: if (ch_status == CH_CMD_RET_SUCCESS) +;source-doc/base-drv/ch376.c:39: if (ch_status == CH_CMD_RET_SUCCESS) ld a, l -;source-doc/base-drv/./ch376.c:40: return USB_ERR_OK; +;source-doc/base-drv/ch376.c:40: return USB_ERR_OK; sub 0x51 jr NZ,l_ch_get_status_00105 ld l,a jr l_ch_get_status_00126 l_ch_get_status_00105: -;source-doc/base-drv/./ch376.c:42: if (ch_status == CH_USB_INT_SUCCESS) +;source-doc/base-drv/ch376.c:42: if (ch_status == CH_USB_INT_SUCCESS) ld a, l -;source-doc/base-drv/./ch376.c:43: return USB_ERR_OK; +;source-doc/base-drv/ch376.c:43: return USB_ERR_OK; sub 0x14 jr NZ,l_ch_get_status_00107 ld l,a jr l_ch_get_status_00126 l_ch_get_status_00107: -;source-doc/base-drv/./ch376.c:45: if (ch_status == CH_USB_INT_CONNECT) +;source-doc/base-drv/ch376.c:45: if (ch_status == CH_USB_INT_CONNECT) ld a, l sub 0x15 jr NZ,l_ch_get_status_00109 -;source-doc/base-drv/./ch376.c:46: return USB_INT_CONNECT; +;source-doc/base-drv/ch376.c:46: return USB_INT_CONNECT; ld l,0x81 jr l_ch_get_status_00126 l_ch_get_status_00109: -;source-doc/base-drv/./ch376.c:48: if (ch_status == CH_USB_INT_DISK_READ) +;source-doc/base-drv/ch376.c:48: if (ch_status == CH_USB_INT_DISK_READ) ld a, l sub 0x1d jr NZ,l_ch_get_status_00111 -;source-doc/base-drv/./ch376.c:49: return USB_ERR_DISK_READ; +;source-doc/base-drv/ch376.c:49: return USB_ERR_DISK_READ; ld l,0x1d jr l_ch_get_status_00126 l_ch_get_status_00111: -;source-doc/base-drv/./ch376.c:51: if (ch_status == CH_USB_INT_DISK_WRITE) +;source-doc/base-drv/ch376.c:51: if (ch_status == CH_USB_INT_DISK_WRITE) ld a, l sub 0x1e jr NZ,l_ch_get_status_00113 -;source-doc/base-drv/./ch376.c:52: return USB_ERR_DISK_WRITE; +;source-doc/base-drv/ch376.c:52: return USB_ERR_DISK_WRITE; ld l,0x1e jr l_ch_get_status_00126 l_ch_get_status_00113: -;source-doc/base-drv/./ch376.c:54: if (ch_status == CH_USB_INT_DISCONNECT) { +;source-doc/base-drv/ch376.c:54: if (ch_status == CH_USB_INT_DISCONNECT) { ld a, l sub 0x16 jr NZ,l_ch_get_status_00115 -;source-doc/base-drv/./ch376.c:55: ch_cmd_set_usb_mode(5); +;source-doc/base-drv/ch376.c:55: ch_cmd_set_usb_mode(5); ld l,0x05 call _ch_cmd_set_usb_mode -;source-doc/base-drv/./ch376.c:56: return USB_ERR_NO_DEVICE; +;source-doc/base-drv/ch376.c:56: return USB_ERR_NO_DEVICE; ld l,0x05 jr l_ch_get_status_00126 l_ch_get_status_00115: -;source-doc/base-drv/./ch376.c:59: if (ch_status == CH_USB_INT_BUF_OVER) +;source-doc/base-drv/ch376.c:59: if (ch_status == CH_USB_INT_BUF_OVER) ld a, l sub 0x17 jr NZ,l_ch_get_status_00117 -;source-doc/base-drv/./ch376.c:60: return USB_ERR_DATA_ERROR; +;source-doc/base-drv/ch376.c:60: return USB_ERR_DATA_ERROR; ld l,0x04 jr l_ch_get_status_00126 l_ch_get_status_00117: -;source-doc/base-drv/./ch376.c:62: ch_status &= 0x2F; +;source-doc/base-drv/ch376.c:62: ch_status &= 0x2F; ld a, l and 0x2f -;source-doc/base-drv/./ch376.c:64: if (ch_status == 0x2A) +;source-doc/base-drv/ch376.c:64: if (ch_status == 0x2A) cp 0x2a jr NZ,l_ch_get_status_00119 -;source-doc/base-drv/./ch376.c:65: return USB_ERR_NAK; +;source-doc/base-drv/ch376.c:65: return USB_ERR_NAK; ld l,0x01 jr l_ch_get_status_00126 l_ch_get_status_00119: -;source-doc/base-drv/./ch376.c:67: if (ch_status == 0x2E) +;source-doc/base-drv/ch376.c:67: if (ch_status == 0x2E) cp 0x2e jr NZ,l_ch_get_status_00121 -;source-doc/base-drv/./ch376.c:68: return USB_ERR_STALL; +;source-doc/base-drv/ch376.c:68: return USB_ERR_STALL; ld l,0x02 jr l_ch_get_status_00126 l_ch_get_status_00121: -;source-doc/base-drv/./ch376.c:70: ch_status &= 0x23; +;source-doc/base-drv/ch376.c:70: ch_status &= 0x23; and 0x23 -;source-doc/base-drv/./ch376.c:72: if (ch_status == 0x20) +;source-doc/base-drv/ch376.c:72: if (ch_status == 0x20) cp 0x20 jr NZ,l_ch_get_status_00123 -;source-doc/base-drv/./ch376.c:73: return USB_ERR_TIMEOUT; +;source-doc/base-drv/ch376.c:73: return USB_ERR_TIMEOUT; ld l,0x03 jr l_ch_get_status_00126 l_ch_get_status_00123: -;source-doc/base-drv/./ch376.c:75: if (ch_status == 0x23) +;source-doc/base-drv/ch376.c:75: if (ch_status == 0x23) sub 0x23 jr NZ,l_ch_get_status_00125 -;source-doc/base-drv/./ch376.c:76: return USB_TOKEN_OUT_OF_SYNC; +;source-doc/base-drv/ch376.c:76: return USB_TOKEN_OUT_OF_SYNC; ld l,0x07 jr l_ch_get_status_00126 l_ch_get_status_00125: -;source-doc/base-drv/./ch376.c:78: return USB_ERR_UNEXPECTED_STATUS_FROM_; +;source-doc/base-drv/ch376.c:78: return USB_ERR_UNEXPECTED_STATUS_FROM_; ld l,0x08 l_ch_get_status_00126: -;source-doc/base-drv/./ch376.c:79: } +;source-doc/base-drv/ch376.c:79: } ret -;source-doc/base-drv/./ch376.c:81: void ch_cmd_reset_all(void) { ch_command(CH_CMD_RESET_ALL); } +;source-doc/base-drv/ch376.c:81: void ch_cmd_reset_all(void) { ch_command(CH_CMD_RESET_ALL); } ; --------------------------------- ; Function ch_cmd_reset_all ; --------------------------------- _ch_cmd_reset_all: ld l,0x05 jp _ch_command -;source-doc/base-drv/./ch376.c:100: uint8_t ch_probe(void) { +;source-doc/base-drv/ch376.c:100: uint8_t ch_probe(void) { ; --------------------------------- ; Function ch_probe ; --------------------------------- _ch_probe: -;source-doc/base-drv/./ch376.c:102: do { - ld c,0x05 + push ix + ld ix,0 + add ix,sp + dec sp +;source-doc/base-drv/ch376.c:102: do { + ld (ix-1),0x05 l_ch_probe_00103: -;source-doc/base-drv/./ch376.c:85: ch_command(CH_CMD_CHECK_EXIST); - push bc +;source-doc/base-drv/ch376.c:85: ch_command(CH_CMD_CHECK_EXIST); ld l,0x06 call _ch_command - pop bc -;source-doc/base-drv/./ch376.c:86: CH376_DATA_PORT = (uint8_t)~0x55; +;source-doc/base-drv/ch376.c:86: CH376_DATA_PORT = (uint8_t)~0x55; ld a,0xaa - push bc ld bc,_CH376_DATA_PORT out (c),a +;source-doc/base-drv/ch376.c:87: delay(); call _delay - pop bc -;source-doc/base-drv/./ch376.c:88: complement = CH376_DATA_PORT; +;source-doc/base-drv/ch376.c:88: complement = CH376_DATA_PORT; ld a, +((_CH376_DATA_PORT) / 256) in a, (((_CH376_DATA_PORT) & 0xFF)) -;source-doc/base-drv/./ch376.c:89: return complement == 0x55; +;source-doc/base-drv/ch376.c:89: return complement == 0x55; sub 0x55 jr NZ,l_ch_probe_00102 -;source-doc/base-drv/./ch376.c:103: if (ch_cmd_check_exist()) -;source-doc/base-drv/./ch376.c:104: return true; +;source-doc/base-drv/ch376.c:103: if (ch_cmd_check_exist()) +;source-doc/base-drv/ch376.c:104: return true; ld l,0x01 jr l_ch_probe_00107 l_ch_probe_00102: -;source-doc/base-drv/./ch376.c:106: delay_medium(); - push bc +;source-doc/base-drv/ch376.c:106: delay_medium(); call _delay_medium - pop bc -;source-doc/base-drv/./ch376.c:107: } while (--i != 0); - dec c +;source-doc/base-drv/ch376.c:107: } while (--i != 0); + dec (ix-1) jr NZ,l_ch_probe_00103 -;source-doc/base-drv/./ch376.c:109: return false; +;source-doc/base-drv/ch376.c:109: return false; ld l,0x00 l_ch_probe_00107: -;source-doc/base-drv/./ch376.c:110: } +;source-doc/base-drv/ch376.c:110: } + inc sp + pop ix ret -;source-doc/base-drv/./ch376.c:112: uint8_t ch_cmd_set_usb_mode(const uint8_t mode) __z88dk_fastcall { +;source-doc/base-drv/ch376.c:112: uint8_t ch_cmd_set_usb_mode(const uint8_t mode) __z88dk_fastcall { ; --------------------------------- ; Function ch_cmd_set_usb_mode ; --------------------------------- _ch_cmd_set_usb_mode: ld c, l -;source-doc/base-drv/./ch376.c:113: uint8_t result = 0; +;source-doc/base-drv/ch376.c:113: uint8_t result = 0; ld b,0x00 -;source-doc/base-drv/./ch376.c:115: CH376_COMMAND_PORT = CH_CMD_SET_USB_MODE; +;source-doc/base-drv/ch376.c:115: CH376_COMMAND_PORT = CH_CMD_SET_USB_MODE; ld a,0x15 push bc ld bc,_CH376_COMMAND_PORT out (c),a call _delay pop bc -;source-doc/base-drv/./ch376.c:117: CH376_DATA_PORT = mode; +;source-doc/base-drv/ch376.c:117: CH376_DATA_PORT = mode; ld a, c push bc ld bc,_CH376_DATA_PORT out (c),a call _delay pop bc -;source-doc/base-drv/./ch376.c:122: while (result != CH_CMD_RET_SUCCESS && result != CH_CMD_RET_ABORT && --count != 0) { +;source-doc/base-drv/ch376.c:122: while (result != CH_CMD_RET_SUCCESS && result != CH_CMD_RET_ABORT && --count != 0) { ld c,0x7f l_ch_cmd_set_usb_mode_00103: ld a, b @@ -292,25 +293,25 @@ l_ch_cmd_set_usb_mode_00103: l_ch_cmd_set_usb_mode_00146: xor a l_ch_cmd_set_usb_mode_00147: - ld e, a - bit 0, e + ld e,a + bit 0,a jr NZ,l_ch_cmd_set_usb_mode_00105 ld a, b sub 0x5f jr Z,l_ch_cmd_set_usb_mode_00105 dec c jr Z,l_ch_cmd_set_usb_mode_00105 -;source-doc/base-drv/./ch376.c:123: result = CH376_DATA_PORT; +;source-doc/base-drv/ch376.c:123: result = CH376_DATA_PORT; ld a, +((_CH376_DATA_PORT) / 256) in a, (((_CH376_DATA_PORT) & 0xFF)) ld b, a -;source-doc/base-drv/./ch376.c:124: delay(); +;source-doc/base-drv/ch376.c:124: delay(); push bc call _delay pop bc jr l_ch_cmd_set_usb_mode_00103 l_ch_cmd_set_usb_mode_00105: -;source-doc/base-drv/./ch376.c:127: return (result == CH_CMD_RET_SUCCESS) ? USB_ERR_OK : USB_ERR_FAIL; +;source-doc/base-drv/ch376.c:127: return (result == CH_CMD_RET_SUCCESS) ? USB_ERR_OK : USB_ERR_FAIL; ld a, e or a jr Z,l_ch_cmd_set_usb_mode_00108 @@ -319,24 +320,24 @@ l_ch_cmd_set_usb_mode_00105: l_ch_cmd_set_usb_mode_00108: ld l,0x0e l_ch_cmd_set_usb_mode_00109: -;source-doc/base-drv/./ch376.c:128: } +;source-doc/base-drv/ch376.c:128: } ret -;source-doc/base-drv/./ch376.c:130: uint8_t ch_cmd_get_ic_version(void) { +;source-doc/base-drv/ch376.c:130: uint8_t ch_cmd_get_ic_version(void) { ; --------------------------------- ; Function ch_cmd_get_ic_version ; --------------------------------- _ch_cmd_get_ic_version: -;source-doc/base-drv/./ch376.c:131: ch_command(CH_CMD_GET_IC_VER); +;source-doc/base-drv/ch376.c:131: ch_command(CH_CMD_GET_IC_VER); ld l,0x01 call _ch_command -;source-doc/base-drv/./ch376.c:132: return CH376_DATA_PORT & 0x1f; +;source-doc/base-drv/ch376.c:132: return CH376_DATA_PORT & 0x1f; ld a, +((_CH376_DATA_PORT) / 256) in a, (((_CH376_DATA_PORT) & 0xFF)) and 0x1f ld l, a -;source-doc/base-drv/./ch376.c:133: } +;source-doc/base-drv/ch376.c:133: } ret -;source-doc/base-drv/./ch376.c:135: void ch_issue_token(const uint8_t toggle_bit, const uint8_t endpoint, const ch376_pid pid) { +;source-doc/base-drv/ch376.c:135: void ch_issue_token(const uint8_t toggle_bit, const uint8_t endpoint, const ch376_pid pid) { ; --------------------------------- ; Function ch_issue_token ; --------------------------------- @@ -344,14 +345,14 @@ _ch_issue_token: push ix ld ix,0 add ix,sp -;source-doc/base-drv/./ch376.c:136: ch_command(CH_CMD_ISSUE_TKN_X); +;source-doc/base-drv/ch376.c:136: ch_command(CH_CMD_ISSUE_TKN_X); ld l,0x4e call _ch_command -;source-doc/base-drv/./ch376.c:137: CH376_DATA_PORT = toggle_bit; +;source-doc/base-drv/ch376.c:137: CH376_DATA_PORT = toggle_bit; ld a,(ix+4) ld bc,_CH376_DATA_PORT out (c),a -;source-doc/base-drv/./ch376.c:138: CH376_DATA_PORT = endpoint << 4 | pid; +;source-doc/base-drv/ch376.c:138: CH376_DATA_PORT = endpoint << 4 | pid; ld a,(ix+5) add a, a add a, a @@ -360,18 +361,17 @@ _ch_issue_token: or (ix+6) ld bc,_CH376_DATA_PORT out (c),a -;source-doc/base-drv/./ch376.c:139: } +;source-doc/base-drv/ch376.c:139: } pop ix ret -;source-doc/base-drv/./ch376.c:141: void ch_issue_token_in(const endpoint_param *const endpoint) __z88dk_fastcall { +;source-doc/base-drv/ch376.c:141: void ch_issue_token_in(const endpoint_param *const endpoint) __z88dk_fastcall { ; --------------------------------- ; Function ch_issue_token_in ; --------------------------------- _ch_issue_token_in: - ex de, hl -;source-doc/base-drv/./ch376.c:142: ch_issue_token(endpoint->toggle ? 0x80 : 0x00, endpoint->number, CH_PID_IN); - ld l, e - ld h, d +;source-doc/base-drv/ch376.c:142: ch_issue_token(endpoint->toggle ? 0x80 : 0x00, endpoint->number, CH_PID_IN); + ld e,l + ld d,h ld a, (hl) rrca and 0x07 @@ -386,26 +386,23 @@ l_ch_issue_token_in_00103: xor a l_ch_issue_token_in_00104: ld h,0x09 + ld l,b push hl - inc sp - push bc - inc sp push af inc sp call _ch_issue_token pop af inc sp -;source-doc/base-drv/./ch376.c:143: } +;source-doc/base-drv/ch376.c:143: } ret -;source-doc/base-drv/./ch376.c:145: void ch_issue_token_out(const endpoint_param *const endpoint) __z88dk_fastcall { +;source-doc/base-drv/ch376.c:145: void ch_issue_token_out(const endpoint_param *const endpoint) __z88dk_fastcall { ; --------------------------------- ; Function ch_issue_token_out ; --------------------------------- _ch_issue_token_out: - ex de, hl -;source-doc/base-drv/./ch376.c:146: ch_issue_token(endpoint->toggle ? 0x40 : 0x00, endpoint->number, CH_PID_OUT); - ld l, e - ld h, d +;source-doc/base-drv/ch376.c:146: ch_issue_token(endpoint->toggle ? 0x40 : 0x00, endpoint->number, CH_PID_OUT); + ld e,l + ld d,h ld a, (hl) rrca and 0x07 @@ -420,18 +417,16 @@ l_ch_issue_token_out_00103: xor a l_ch_issue_token_out_00104: ld h,0x01 + ld l,b push hl - inc sp - push bc - inc sp push af inc sp call _ch_issue_token pop af inc sp -;source-doc/base-drv/./ch376.c:147: } +;source-doc/base-drv/ch376.c:147: } ret -;source-doc/base-drv/./ch376.c:149: void ch_issue_token_out_ep0(void) { ch_issue_token(0x40, 0, CH_PID_OUT); } +;source-doc/base-drv/ch376.c:149: void ch_issue_token_out_ep0(void) { ch_issue_token(0x40, 0, CH_PID_OUT); } ; --------------------------------- ; Function ch_issue_token_out_ep0 ; --------------------------------- @@ -447,7 +442,7 @@ _ch_issue_token_out_ep0: pop af inc sp ret -;source-doc/base-drv/./ch376.c:151: void ch_issue_token_in_ep0(void) { ch_issue_token(0x80, 0, CH_PID_IN); } +;source-doc/base-drv/ch376.c:151: void ch_issue_token_in_ep0(void) { ch_issue_token(0x80, 0, CH_PID_IN); } ; --------------------------------- ; Function ch_issue_token_in_ep0 ; --------------------------------- @@ -463,7 +458,7 @@ _ch_issue_token_in_ep0: pop af inc sp ret -;source-doc/base-drv/./ch376.c:153: void ch_issue_token_setup(void) { ch_issue_token(0, 0, CH_PID_SETUP); } +;source-doc/base-drv/ch376.c:153: void ch_issue_token_setup(void) { ch_issue_token(0, 0, CH_PID_SETUP); } ; --------------------------------- ; Function ch_issue_token_setup ; --------------------------------- @@ -481,7 +476,7 @@ _ch_issue_token_setup: pop af inc sp ret -;source-doc/base-drv/./ch376.c:155: usb_error ch_data_in_transfer(uint8_t *buffer, int16_t buffer_size, endpoint_param *const endpoint) { +;source-doc/base-drv/ch376.c:155: usb_error ch_data_in_transfer(uint8_t *buffer, int16_t buffer_size, endpoint_param *const endpoint) { ; --------------------------------- ; Function ch_data_in_transfer ; --------------------------------- @@ -490,44 +485,43 @@ _ch_data_in_transfer: ld ix,0 add ix,sp push af -;source-doc/base-drv/./ch376.c:158: if (buffer_size == 0) +;source-doc/base-drv/ch376.c:158: if (buffer_size == 0) ld a,(ix+7) or (ix+6) jr NZ,l_ch_data_in_transfer_00102 -;source-doc/base-drv/./ch376.c:159: return USB_ERR_OK; +;source-doc/base-drv/ch376.c:159: return USB_ERR_OK; ld l,0x00 jp l_ch_data_in_transfer_00111 l_ch_data_in_transfer_00102: -;source-doc/base-drv/./ch376.c:161: USB_MODULE_LEDS = 0x01; +;source-doc/base-drv/ch376.c:161: USB_MODULE_LEDS = 0x01; ld a,0x01 ld bc,_USB_MODULE_LEDS out (c),a -;source-doc/base-drv/./ch376.c:162: do { +;source-doc/base-drv/ch376.c:162: do { ld c,(ix+8) ld b,(ix+9) - inc sp - inc sp + pop de push bc l_ch_data_in_transfer_00107: -;source-doc/base-drv/./ch376.c:163: ch_issue_token_in(endpoint); - push bc - ld l, c - ld h, b +;source-doc/base-drv/ch376.c:163: ch_issue_token_in(endpoint); + ld l,c + ld h,b + push hl call _ch_issue_token_in call _ch_long_wait_int_and_get_statu pop bc ld a, l ld (_result), a -;source-doc/base-drv/./ch376.c:166: CHECK(result); +;source-doc/base-drv/ch376.c:166: CHECK(result); ld a,(_result) or a jr NZ,l_ch_data_in_transfer_00110 -;source-doc/base-drv/./ch376.c:168: endpoint->toggle = !endpoint->toggle; +;source-doc/base-drv/ch376.c:168: endpoint->toggle = !endpoint->toggle; ld e, c ld d, b pop hl + ld a,(hl) push hl - ld a, (hl) and 0x01 xor 0x01 and 0x01 @@ -536,32 +530,32 @@ l_ch_data_in_transfer_00107: and 0xfe or l ld (de), a -;source-doc/base-drv/./ch376.c:170: count = ch_read_data(buffer); +;source-doc/base-drv/ch376.c:170: count = ch_read_data(buffer); push bc ld l,(ix+4) ld h,(ix+5) call _ch_read_data ld e, a pop bc -;source-doc/base-drv/./ch376.c:172: if (count == 0) { +;source-doc/base-drv/ch376.c:172: if (count == 0) { ld a, e -;source-doc/base-drv/./ch376.c:173: USB_MODULE_LEDS = 0x00; +;source-doc/base-drv/ch376.c:173: USB_MODULE_LEDS = 0x00; or a jr NZ,l_ch_data_in_transfer_00106 ld bc,_USB_MODULE_LEDS out (c),a -;source-doc/base-drv/./ch376.c:174: return USB_ERR_DATA_ERROR; +;source-doc/base-drv/ch376.c:174: return USB_ERR_DATA_ERROR; ld l,0x04 jr l_ch_data_in_transfer_00111 l_ch_data_in_transfer_00106: -;source-doc/base-drv/./ch376.c:177: buffer += count; +;source-doc/base-drv/ch376.c:177: buffer += count; ld a,(ix+4) add a, e ld (ix+4),a jr NC,l_ch_data_in_transfer_00148 inc (ix+5) l_ch_data_in_transfer_00148: -;source-doc/base-drv/./ch376.c:178: buffer_size -= count; +;source-doc/base-drv/ch376.c:178: buffer_size -= count; ld d,0x00 ld a,(ix+6) sub e @@ -569,7 +563,7 @@ l_ch_data_in_transfer_00148: ld a,(ix+7) sbc a, d ld (ix+7),a -;source-doc/base-drv/./ch376.c:179: } while (buffer_size > 0); +;source-doc/base-drv/ch376.c:179: } while (buffer_size > 0); xor a cp (ix+6) sbc a,(ix+7) @@ -577,24 +571,24 @@ l_ch_data_in_transfer_00148: xor 0x80 l_ch_data_in_transfer_00149: jp M, l_ch_data_in_transfer_00107 -;source-doc/base-drv/./ch376.c:181: USB_MODULE_LEDS = 0x00; +;source-doc/base-drv/ch376.c:181: USB_MODULE_LEDS = 0x00; ld a,0x00 ld bc,_USB_MODULE_LEDS out (c),a -;source-doc/base-drv/./ch376.c:183: return USB_ERR_OK; +;source-doc/base-drv/ch376.c:183: return USB_ERR_OK; ld l,0x00 jr l_ch_data_in_transfer_00111 -;source-doc/base-drv/./ch376.c:184: done: +;source-doc/base-drv/ch376.c:184: done: l_ch_data_in_transfer_00110: -;source-doc/base-drv/./ch376.c:185: return result; - ld hl,_result - ld l, (hl) +;source-doc/base-drv/ch376.c:185: return result; + ld hl,(_result) + ld h,+((_result) / 256) l_ch_data_in_transfer_00111: -;source-doc/base-drv/./ch376.c:186: } +;source-doc/base-drv/ch376.c:186: } ld sp, ix pop ix ret -;source-doc/base-drv/./ch376.c:188: usb_error ch_data_in_transfer_n(uint8_t *const buffer, int8_t *const buffer_size, endpoint_param *const endpoint) { +;source-doc/base-drv/ch376.c:188: usb_error ch_data_in_transfer_n(uint8_t *const buffer, int8_t *const buffer_size, endpoint_param *const endpoint) { ; --------------------------------- ; Function ch_data_in_transfer_n ; --------------------------------- @@ -602,21 +596,21 @@ _ch_data_in_transfer_n: push ix ld ix,0 add ix,sp -;source-doc/base-drv/./ch376.c:192: USB_MODULE_LEDS = 0x01; +;source-doc/base-drv/ch376.c:192: USB_MODULE_LEDS = 0x01; ld a,0x01 ld bc,_USB_MODULE_LEDS out (c),a -;source-doc/base-drv/./ch376.c:194: ch_issue_token_in(endpoint); +;source-doc/base-drv/ch376.c:194: ch_issue_token_in(endpoint); ld l,(ix+8) ld h,(ix+9) call _ch_issue_token_in -;source-doc/base-drv/./ch376.c:196: CHECK(ch_long_wait_int_and_get_status()); +;source-doc/base-drv/ch376.c:196: CHECK(ch_long_wait_int_and_get_status()); call _ch_long_wait_int_and_get_statu ld a, l - ld b,a + ld b, a or a jr NZ,l_ch_data_in_transfer_n_00103 -;source-doc/base-drv/./ch376.c:198: endpoint->toggle = !endpoint->toggle; +;source-doc/base-drv/ch376.c:198: endpoint->toggle = !endpoint->toggle; ld e,(ix+8) ld d,(ix+9) ld c, e @@ -631,30 +625,30 @@ _ch_data_in_transfer_n: and 0xfe or e ld (bc), a -;source-doc/base-drv/./ch376.c:200: count = ch_read_data(buffer); +;source-doc/base-drv/ch376.c:200: count = ch_read_data(buffer); ld l,(ix+4) ld h,(ix+5) call _ch_read_data -;source-doc/base-drv/./ch376.c:202: *buffer_size = count; +;source-doc/base-drv/ch376.c:202: *buffer_size = count; ld c,(ix+6) ld b,(ix+7) ld (bc), a -;source-doc/base-drv/./ch376.c:204: USB_MODULE_LEDS = 0x00; +;source-doc/base-drv/ch376.c:204: USB_MODULE_LEDS = 0x00; ld a,0x00 ld bc,_USB_MODULE_LEDS out (c),a -;source-doc/base-drv/./ch376.c:206: return USB_ERR_OK; +;source-doc/base-drv/ch376.c:206: return USB_ERR_OK; ld l,0x00 jr l_ch_data_in_transfer_n_00104 -;source-doc/base-drv/./ch376.c:207: done: +;source-doc/base-drv/ch376.c:207: done: l_ch_data_in_transfer_n_00103: -;source-doc/base-drv/./ch376.c:208: return result; +;source-doc/base-drv/ch376.c:208: return result; ld l, b l_ch_data_in_transfer_n_00104: -;source-doc/base-drv/./ch376.c:209: } +;source-doc/base-drv/ch376.c:209: } pop ix ret -;source-doc/base-drv/./ch376.c:211: usb_error ch_data_out_transfer(const uint8_t *buffer, int16_t buffer_length, endpoint_param *const endpoint) { +;source-doc/base-drv/ch376.c:211: usb_error ch_data_out_transfer(const uint8_t *buffer, int16_t buffer_length, endpoint_param *const endpoint) { ; --------------------------------- ; Function ch_data_out_transfer ; --------------------------------- @@ -664,7 +658,7 @@ _ch_data_out_transfer: add ix,sp push af dec sp -;source-doc/base-drv/./ch376.c:214: const uint8_t max_packet_size = calc_max_packet_size(endpoint->max_packet_sizex); +;source-doc/base-drv/ch376.c:214: const uint8_t max_packet_size = calc_max_packet_size(endpoint->max_packet_sizex); ld c,(ix+8) ld b,(ix+9) ld e, c @@ -672,13 +666,13 @@ _ch_data_out_transfer: inc de ld a, (de) ld (ix-3),a -;source-doc/base-drv/./ch376.c:216: USB_MODULE_LEDS = 0x02; +;source-doc/base-drv/ch376.c:216: USB_MODULE_LEDS = 0x02; ld a,0x02 push bc ld bc,_USB_MODULE_LEDS out (c),a pop bc -;source-doc/base-drv/./ch376.c:218: while (buffer_length > 0) { +;source-doc/base-drv/ch376.c:218: while (buffer_length > 0) { ld (ix-2),c ld (ix-1),b l_ch_data_out_transfer_00103: @@ -689,7 +683,7 @@ l_ch_data_out_transfer_00103: xor 0x80 l_ch_data_out_transfer_00139: jp P, l_ch_data_out_transfer_00105 -;source-doc/base-drv/./ch376.c:219: const uint8_t size = max_packet_size < buffer_length ? max_packet_size : buffer_length; +;source-doc/base-drv/ch376.c:219: const uint8_t size = max_packet_size < buffer_length ? max_packet_size : buffer_length; ld d,(ix-3) ld e,0x00 ld a, d @@ -703,8 +697,9 @@ l_ch_data_out_transfer_00140: jr l_ch_data_out_transfer_00110 l_ch_data_out_transfer_00109: ld d,(ix+6) + ld e,(ix+7) l_ch_data_out_transfer_00110: -;source-doc/base-drv/./ch376.c:220: buffer = ch_write_data(buffer, size); +;source-doc/base-drv/ch376.c:220: buffer = ch_write_data(buffer, size); push bc push de push de @@ -719,7 +714,7 @@ l_ch_data_out_transfer_00110: pop bc ld (ix+4),l ld (ix+5),h -;source-doc/base-drv/./ch376.c:221: buffer_length -= size; +;source-doc/base-drv/ch376.c:221: buffer_length -= size; ld e,0x00 ld a,(ix+6) sub d @@ -727,10 +722,10 @@ l_ch_data_out_transfer_00110: ld a,(ix+7) sbc a, e ld (ix+7),a -;source-doc/base-drv/./ch376.c:222: ch_issue_token_out(endpoint); - push bc - ld l, c - ld h, b +;source-doc/base-drv/ch376.c:222: ch_issue_token_out(endpoint); + ld l,c + ld h,b + push hl call _ch_issue_token_out call _ch_long_wait_int_and_get_statu ld a, l @@ -738,7 +733,7 @@ l_ch_data_out_transfer_00110: ld l, a or a jr NZ,l_ch_data_out_transfer_00106 -;source-doc/base-drv/./ch376.c:226: endpoint->toggle = !endpoint->toggle; +;source-doc/base-drv/ch376.c:226: endpoint->toggle = !endpoint->toggle; ld e, c ld d, b ld l,(ix-2) @@ -754,34 +749,34 @@ l_ch_data_out_transfer_00110: ld (de), a jr l_ch_data_out_transfer_00103 l_ch_data_out_transfer_00105: -;source-doc/base-drv/./ch376.c:229: USB_MODULE_LEDS = 0x00; +;source-doc/base-drv/ch376.c:229: USB_MODULE_LEDS = 0x00; ld a,0x00 ld bc,_USB_MODULE_LEDS out (c),a -;source-doc/base-drv/./ch376.c:231: return USB_ERR_OK; +;source-doc/base-drv/ch376.c:231: return USB_ERR_OK; ld l,0x00 -;source-doc/base-drv/./ch376.c:232: done: -;source-doc/base-drv/./ch376.c:233: return result; +;source-doc/base-drv/ch376.c:232: done: +;source-doc/base-drv/ch376.c:233: return result; l_ch_data_out_transfer_00106: -;source-doc/base-drv/./ch376.c:234: } +;source-doc/base-drv/ch376.c:234: } ld sp, ix pop ix ret -;source-doc/base-drv/./ch376.c:236: void ch_set_usb_address(const uint8_t device_address) __z88dk_fastcall { +;source-doc/base-drv/ch376.c:236: void ch_set_usb_address(const uint8_t device_address) __z88dk_fastcall { ; --------------------------------- ; Function ch_set_usb_address ; --------------------------------- _ch_set_usb_address: -;source-doc/base-drv/./ch376.c:237: ch_command(CH_CMD_SET_USB_ADDR); +;source-doc/base-drv/ch376.c:237: ch_command(CH_CMD_SET_USB_ADDR); push hl ld l,0x13 call _ch_command pop hl -;source-doc/base-drv/./ch376.c:238: CH376_DATA_PORT = device_address; +;source-doc/base-drv/ch376.c:238: CH376_DATA_PORT = device_address; ld a, l ld bc,_CH376_DATA_PORT out (c),a -;source-doc/base-drv/./ch376.c:239: } +;source-doc/base-drv/ch376.c:239: } ret _result: DEFB +0x00 diff --git a/Source/HBIOS/ch376-native/base-drv/class_hub.c.asm b/Source/HBIOS/ch376-native/base-drv/class_hub.c.asm new file mode 100644 index 00000000..15506295 --- /dev/null +++ b/Source/HBIOS/ch376-native/base-drv/class_hub.c.asm @@ -0,0 +1,458 @@ +;-------------------------------------------------------- +; File Created by SDCC : free open source ISO C Compiler +; Version 4.4.0 #14648 (Linux) +;-------------------------------------------------------- +; Processed by Z88DK +;-------------------------------------------------------- + + EXTERN __divschar + EXTERN __divschar_callee + EXTERN __divsint + EXTERN __divsint_callee + EXTERN __divslong + EXTERN __divslong_callee + EXTERN __divslonglong + EXTERN __divslonglong_callee + EXTERN __divsuchar + EXTERN __divsuchar_callee + EXTERN __divuchar + EXTERN __divuchar_callee + EXTERN __divuint + EXTERN __divuint_callee + EXTERN __divulong + EXTERN __divulong_callee + EXTERN __divulonglong + EXTERN __divulonglong_callee + EXTERN __divuschar + EXTERN __divuschar_callee + EXTERN __modschar + EXTERN __modschar_callee + EXTERN __modsint + EXTERN __modsint_callee + EXTERN __modslong + EXTERN __modslong_callee + EXTERN __modslonglong + EXTERN __modslonglong_callee + EXTERN __modsuchar + EXTERN __modsuchar_callee + EXTERN __moduchar + EXTERN __moduchar_callee + EXTERN __moduint + EXTERN __moduint_callee + EXTERN __modulong + EXTERN __modulong_callee + EXTERN __modulonglong + EXTERN __modulonglong_callee + EXTERN __moduschar + EXTERN __moduschar_callee + EXTERN __mulint + EXTERN __mulint_callee + EXTERN __mullong + EXTERN __mullong_callee + EXTERN __mullonglong + EXTERN __mullonglong_callee + EXTERN __mulschar + EXTERN __mulschar_callee + EXTERN __mulsuchar + EXTERN __mulsuchar_callee + EXTERN __muluchar + EXTERN __muluchar_callee + EXTERN __muluschar + EXTERN __muluschar_callee + EXTERN __rlslonglong + EXTERN __rlslonglong_callee + EXTERN __rlulonglong + EXTERN __rlulonglong_callee + EXTERN __rrslonglong + EXTERN __rrslonglong_callee + EXTERN __rrulonglong + EXTERN __rrulonglong_callee + EXTERN ___mulsint2slong + EXTERN ___mulsint2slong_callee + EXTERN ___muluint2ulong + EXTERN ___muluint2ulong_callee + EXTERN ___sdcc_call_hl + EXTERN ___sdcc_call_iy + EXTERN ___sdcc_enter_ix + EXTERN banked_call + EXTERN _banked_ret + EXTERN ___fs2schar + EXTERN ___fs2schar_callee + EXTERN ___fs2sint + EXTERN ___fs2sint_callee + EXTERN ___fs2slong + EXTERN ___fs2slong_callee + EXTERN ___fs2slonglong + EXTERN ___fs2slonglong_callee + EXTERN ___fs2uchar + EXTERN ___fs2uchar_callee + EXTERN ___fs2uint + EXTERN ___fs2uint_callee + EXTERN ___fs2ulong + EXTERN ___fs2ulong_callee + EXTERN ___fs2ulonglong + EXTERN ___fs2ulonglong_callee + EXTERN ___fsadd + EXTERN ___fsadd_callee + EXTERN ___fsdiv + EXTERN ___fsdiv_callee + EXTERN ___fseq + EXTERN ___fseq_callee + EXTERN ___fsgt + EXTERN ___fsgt_callee + EXTERN ___fslt + EXTERN ___fslt_callee + EXTERN ___fsmul + EXTERN ___fsmul_callee + EXTERN ___fsneq + EXTERN ___fsneq_callee + EXTERN ___fssub + EXTERN ___fssub_callee + EXTERN ___schar2fs + EXTERN ___schar2fs_callee + EXTERN ___sint2fs + EXTERN ___sint2fs_callee + EXTERN ___slong2fs + EXTERN ___slong2fs_callee + EXTERN ___slonglong2fs + EXTERN ___slonglong2fs_callee + EXTERN ___uchar2fs + EXTERN ___uchar2fs_callee + EXTERN ___uint2fs + EXTERN ___uint2fs_callee + EXTERN ___ulong2fs + EXTERN ___ulong2fs_callee + EXTERN ___ulonglong2fs + EXTERN ___ulonglong2fs_callee + EXTERN ____sdcc_2_copy_src_mhl_dst_deix + EXTERN ____sdcc_2_copy_src_mhl_dst_bcix + EXTERN ____sdcc_4_copy_src_mhl_dst_deix + EXTERN ____sdcc_4_copy_src_mhl_dst_bcix + EXTERN ____sdcc_4_copy_src_mhl_dst_mbc + EXTERN ____sdcc_4_ldi_nosave_bc + EXTERN ____sdcc_4_ldi_save_bc + EXTERN ____sdcc_4_push_hlix + EXTERN ____sdcc_4_push_mhl + EXTERN ____sdcc_lib_setmem_hl + EXTERN ____sdcc_ll_add_de_bc_hl + EXTERN ____sdcc_ll_add_de_bc_hlix + EXTERN ____sdcc_ll_add_de_hlix_bc + EXTERN ____sdcc_ll_add_de_hlix_bcix + EXTERN ____sdcc_ll_add_deix_bc_hl + EXTERN ____sdcc_ll_add_deix_hlix + EXTERN ____sdcc_ll_add_hlix_bc_deix + EXTERN ____sdcc_ll_add_hlix_deix_bc + EXTERN ____sdcc_ll_add_hlix_deix_bcix + EXTERN ____sdcc_ll_asr_hlix_a + EXTERN ____sdcc_ll_asr_mbc_a + EXTERN ____sdcc_ll_copy_src_de_dst_hlix + EXTERN ____sdcc_ll_copy_src_de_dst_hlsp + EXTERN ____sdcc_ll_copy_src_deix_dst_hl + EXTERN ____sdcc_ll_copy_src_deix_dst_hlix + EXTERN ____sdcc_ll_copy_src_deixm_dst_hlsp + EXTERN ____sdcc_ll_copy_src_desp_dst_hlsp + EXTERN ____sdcc_ll_copy_src_hl_dst_de + EXTERN ____sdcc_ll_copy_src_hlsp_dst_de + EXTERN ____sdcc_ll_copy_src_hlsp_dst_deixm + EXTERN ____sdcc_ll_lsl_hlix_a + EXTERN ____sdcc_ll_lsl_mbc_a + EXTERN ____sdcc_ll_lsr_hlix_a + EXTERN ____sdcc_ll_lsr_mbc_a + EXTERN ____sdcc_ll_push_hlix + EXTERN ____sdcc_ll_push_mhl + EXTERN ____sdcc_ll_sub_de_bc_hl + EXTERN ____sdcc_ll_sub_de_bc_hlix + EXTERN ____sdcc_ll_sub_de_hlix_bc + EXTERN ____sdcc_ll_sub_de_hlix_bcix + EXTERN ____sdcc_ll_sub_deix_bc_hl + EXTERN ____sdcc_ll_sub_deix_hlix + EXTERN ____sdcc_ll_sub_hlix_bc_deix + EXTERN ____sdcc_ll_sub_hlix_deix_bc + EXTERN ____sdcc_ll_sub_hlix_deix_bcix + EXTERN ____sdcc_load_debc_deix + EXTERN ____sdcc_load_dehl_deix + EXTERN ____sdcc_load_debc_mhl + EXTERN ____sdcc_load_hlde_mhl + EXTERN ____sdcc_store_dehl_bcix + EXTERN ____sdcc_store_debc_hlix + EXTERN ____sdcc_store_debc_mhl + EXTERN ____sdcc_cpu_pop_ei + EXTERN ____sdcc_cpu_pop_ei_jp + EXTERN ____sdcc_cpu_push_di + EXTERN ____sdcc_outi + EXTERN ____sdcc_outi_128 + EXTERN ____sdcc_outi_256 + EXTERN ____sdcc_ldi + EXTERN ____sdcc_ldi_128 + EXTERN ____sdcc_ldi_256 + EXTERN ____sdcc_4_copy_srcd_hlix_dst_deix + EXTERN ____sdcc_4_and_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_or_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_or_src_dehl_dst_bcix + EXTERN ____sdcc_4_xor_src_dehl_dst_bcix + EXTERN ____sdcc_4_and_src_dehl_dst_bcix + EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_or_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_cpl_src_mhl_dst_debc + EXTERN ____sdcc_4_xor_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_or_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_debc_hlix_dst_debc + EXTERN ____sdcc_4_or_src_debc_hlix_dst_debc + EXTERN ____sdcc_4_xor_src_debc_hlix_dst_debc + +;-------------------------------------------------------- +; Public variables in this module +;-------------------------------------------------------- + GLOBAL _cmd_get_hub_descriptor + GLOBAL _hub_get_descriptor +;-------------------------------------------------------- +; Externals used +;-------------------------------------------------------- + GLOBAL _get_usb_device_config + GLOBAL _find_device_config + GLOBAL _next_device_config + GLOBAL _first_device_config + GLOBAL _find_first_free + GLOBAL _usbtrn_clear_endpoint_halt + GLOBAL _usbtrn_set_address + GLOBAL _usbtrn_set_configuration + GLOBAL _usbtrn_gfull_cfg_desc + GLOBAL _usbtrn_get_config_descriptor + GLOBAL _usbtrn_get_descriptor2 + GLOBAL _usbtrn_get_descriptor + GLOBAL _usbdev_dat_in_trnsfer_0 + GLOBAL _usbdev_dat_in_trnsfer + GLOBAL _usbdev_bulk_in_transfer + GLOBAL _usbdev_blk_out_trnsfer + GLOBAL _usbdev_control_transfer + GLOBAL _usb_data_out_transfer + GLOBAL _usb_data_in_transfer_n + GLOBAL _usb_data_in_transfer + GLOBAL _usb_control_transfer + GLOBAL _ch_issue_token_in_ep0 + GLOBAL _ch_issue_token_out_ep0 + GLOBAL _ch_issue_token_setup + GLOBAL _ch_data_out_transfer + GLOBAL _ch_data_in_transfer_n + GLOBAL _ch_data_in_transfer + GLOBAL _ch_control_transfer_set_config + GLOBAL _ch_control_transfer_set_address + GLOBAL _ch_control_transfer_request_descriptor + GLOBAL _ch_set_usb_address + GLOBAL _ch_write_data + GLOBAL _ch_cmd_get_ic_version + GLOBAL _ch_cmd_set_usb_mode + GLOBAL _ch_probe + GLOBAL _ch_cmd_reset_all + GLOBAL _ch_read_data + GLOBAL _ch_very_short_wait_int_and_get_status + GLOBAL _ch_short_wait_int_and_get_status + GLOBAL _ch_long_wait_int_and_get_status + GLOBAL _ch_get_status + GLOBAL _ch_command + GLOBAL _delay_medium + GLOBAL _delay_short + GLOBAL _delay_20ms + GLOBAL _printf + GLOBAL _delay + GLOBAL _ulltoa_callee + GLOBAL _ulltoa + GLOBAL _strtoull_callee + GLOBAL _strtoull + GLOBAL _strtoll_callee + GLOBAL _strtoll + GLOBAL _lltoa_callee + GLOBAL _lltoa + GLOBAL _llabs_callee + GLOBAL _llabs + GLOBAL __lldivu__callee + GLOBAL __lldivu_ + GLOBAL __lldiv__callee + GLOBAL __lldiv_ + GLOBAL _atoll_callee + GLOBAL _atoll + GLOBAL _realloc_unlocked_callee + GLOBAL _realloc_unlocked + GLOBAL _malloc_unlocked_fastcall + GLOBAL _malloc_unlocked + GLOBAL _free_unlocked_fastcall + GLOBAL _free_unlocked + GLOBAL _calloc_unlocked_callee + GLOBAL _calloc_unlocked + GLOBAL _aligned_alloc_unlocked_callee + GLOBAL _aligned_alloc_unlocked + GLOBAL _realloc_callee + GLOBAL _realloc + GLOBAL _malloc_fastcall + GLOBAL _malloc + GLOBAL _free_fastcall + GLOBAL _free + GLOBAL _calloc_callee + GLOBAL _calloc + GLOBAL _aligned_alloc_callee + GLOBAL _aligned_alloc + GLOBAL _utoa_callee + GLOBAL _utoa + GLOBAL _ultoa_callee + GLOBAL _ultoa + GLOBAL _system_fastcall + GLOBAL _system + GLOBAL _strtoul_callee + GLOBAL _strtoul + GLOBAL _strtol_callee + GLOBAL _strtol + GLOBAL _strtof_callee + GLOBAL _strtof + GLOBAL _strtod_callee + GLOBAL _strtod + GLOBAL _srand_fastcall + GLOBAL _srand + GLOBAL _rand + GLOBAL _quick_exit_fastcall + GLOBAL _quick_exit + GLOBAL _qsort_callee + GLOBAL _qsort + GLOBAL _ltoa_callee + GLOBAL _ltoa + GLOBAL _labs_fastcall + GLOBAL _labs + GLOBAL _itoa_callee + GLOBAL _itoa + GLOBAL _ftoh_callee + GLOBAL _ftoh + GLOBAL _ftog_callee + GLOBAL _ftog + GLOBAL _ftoe_callee + GLOBAL _ftoe + GLOBAL _ftoa_callee + GLOBAL _ftoa + GLOBAL _exit_fastcall + GLOBAL _exit + GLOBAL _dtoh_callee + GLOBAL _dtoh + GLOBAL _dtog_callee + GLOBAL _dtog + GLOBAL _dtoe_callee + GLOBAL _dtoe + GLOBAL _dtoa_callee + GLOBAL _dtoa + GLOBAL _bsearch_callee + GLOBAL _bsearch + GLOBAL _atol_fastcall + GLOBAL _atol + GLOBAL _atoi_fastcall + GLOBAL _atoi + GLOBAL _atof_fastcall + GLOBAL _atof + GLOBAL _atexit_fastcall + GLOBAL _atexit + GLOBAL _at_quick_exit_fastcall + GLOBAL _at_quick_exit + GLOBAL _abs_fastcall + GLOBAL _abs + GLOBAL _abort + GLOBAL __strtou__callee + GLOBAL __strtou_ + GLOBAL __strtoi__callee + GLOBAL __strtoi_ + GLOBAL __random_uniform_xor_8__fastcall + GLOBAL __random_uniform_xor_8_ + GLOBAL __random_uniform_xor_32__fastcall + GLOBAL __random_uniform_xor_32_ + GLOBAL __random_uniform_cmwc_8__fastcall + GLOBAL __random_uniform_cmwc_8_ + GLOBAL __shellsort__callee + GLOBAL __shellsort_ + GLOBAL __quicksort__callee + GLOBAL __quicksort_ + GLOBAL __insertion_sort__callee + GLOBAL __insertion_sort_ + GLOBAL __ldivu__callee + GLOBAL __ldivu_ + GLOBAL __ldiv__callee + GLOBAL __ldiv_ + GLOBAL __divu__callee + GLOBAL __divu_ + GLOBAL __div__callee + GLOBAL __div_ + GLOBAL _result +;-------------------------------------------------------- +; special function registers +;-------------------------------------------------------- +defc _CH376_DATA_PORT = 0xff88 +defc _CH376_COMMAND_PORT = 0xff89 +defc _USB_MODULE_LEDS = 0xff8a +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + SECTION bss_compiler +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + +IF 0 + +; .area _INITIALIZED removed by z88dk + + +ENDIF + +;-------------------------------------------------------- +; absolute external ram data +;-------------------------------------------------------- + SECTION IGNORE +;-------------------------------------------------------- +; global & static initialisations +;-------------------------------------------------------- + SECTION code_crt_init +;-------------------------------------------------------- +; Home +;-------------------------------------------------------- + SECTION IGNORE +;-------------------------------------------------------- +; code +;-------------------------------------------------------- + SECTION code_compiler +;source-doc/base-drv/class_hub.c:7: usb_error hub_get_descriptor(const device_config_hub *const hub_config, hub_descriptor *const hub_description) __sdcccall(1) { +; --------------------------------- +; Function hub_get_descriptor +; --------------------------------- +_hub_get_descriptor: +;source-doc/base-drv/class_hub.c:8: return usb_control_transfer(&cmd_get_hub_descriptor, hub_description, hub_config->address, hub_config->max_packet_size); + ld a,l + ld c,h + inc hl + ld b, (hl) + ld l, a + ld h, c + ld a, (hl) + rlca + rlca + rlca + rlca + and a,0x0f + ld c, a + push bc + push de + ld hl,_cmd_get_hub_descriptor + push hl + call _usb_control_transfer + pop af + pop af + pop af + ld a, l +;source-doc/base-drv/class_hub.c:9: } + ret + SECTION rodata_compiler +_cmd_get_hub_descriptor: + DEFB +0xa0 + DEFB +0x06 + DEFB +0x00 + DEFB +0x29 + DEFB +0x00 + DEFB +0x00 + DEFW +0x0008 + SECTION IGNORE diff --git a/Source/HBIOS/ch376-native/base-drv/class_hub.c.s b/Source/HBIOS/ch376-native/base-drv/class_hub.c.s index 2ba02fa6..89e43f5d 100644 --- a/Source/HBIOS/ch376-native/base-drv/class_hub.c.s +++ b/Source/HBIOS/ch376-native/base-drv/class_hub.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/base-drv/./class_hub.c.asm -- not to be modify directly +; Generated from source-doc/base-drv/class_hub.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -48,39 +48,35 @@ _USB_MODULE_LEDS .EQU 0xff8a ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/base-drv/./class_hub.c:7: usb_error hub_get_descriptor(const device_config_hub *const hub_config, hub_descriptor *const hub_description) __sdcccall(1) { +;source-doc/base-drv/class_hub.c:7: usb_error hub_get_descriptor(const device_config_hub *const hub_config, hub_descriptor *const hub_description) __sdcccall(1) { ; --------------------------------- ; Function hub_get_descriptor ; --------------------------------- _hub_get_descriptor: -;source-doc/base-drv/./class_hub.c:8: return usb_control_transfer(&cmd_get_hub_descriptor, hub_description, hub_config->address, hub_config->max_packet_size); +;source-doc/base-drv/class_hub.c:8: return usb_control_transfer(&cmd_get_hub_descriptor, hub_description, hub_config->address, hub_config->max_packet_size); ld a,l - ld b,h + ld c,h inc hl - ld c, (hl) + ld b, (hl) ld l, a - ld h, b + ld h, c ld a, (hl) rlca rlca rlca rlca and 0x0f - ld b, a - ld hl,_cmd_get_hub_descriptor - ld a, c - push af - inc sp + ld c, a push bc - inc sp push de + ld hl,_cmd_get_hub_descriptor push hl call _usb_control_transfer pop af pop af pop af ld a, l -;source-doc/base-drv/./class_hub.c:9: } +;source-doc/base-drv/class_hub.c:9: } ret _cmd_get_hub_descriptor: DEFB +0xa0 diff --git a/Source/HBIOS/ch376-native/base-drv/critical-section.c.s b/Source/HBIOS/ch376-native/base-drv/critical-section.c.s index 97ea4e02..51f86184 100644 --- a/Source/HBIOS/ch376-native/base-drv/critical-section.c.s +++ b/Source/HBIOS/ch376-native/base-drv/critical-section.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/base-drv/./critical-section.c.asm -- not to be modify directly +; Generated from source-doc/base-drv/critical-section.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -47,7 +47,7 @@ _in_critical_usb_section: ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/base-drv/./critical-section.c:6: void critical_begin() { in_critical_usb_section++; } +;source-doc/base-drv/critical-section.c:6: void critical_begin() { in_critical_usb_section++; } ; --------------------------------- ; Function critical_begin ; --------------------------------- @@ -55,7 +55,7 @@ _critical_begin: ld hl,_in_critical_usb_section inc (hl) ret -;source-doc/base-drv/./critical-section.c:8: void critical_end() { in_critical_usb_section--; } +;source-doc/base-drv/critical-section.c:8: void critical_end() { in_critical_usb_section--; } ; --------------------------------- ; Function critical_end ; --------------------------------- diff --git a/Source/HBIOS/ch376-native/base-drv/dev_transfers.c.asm b/Source/HBIOS/ch376-native/base-drv/dev_transfers.c.asm new file mode 100644 index 00000000..0d971506 --- /dev/null +++ b/Source/HBIOS/ch376-native/base-drv/dev_transfers.c.asm @@ -0,0 +1,834 @@ +;-------------------------------------------------------- +; File Created by SDCC : free open source ISO C Compiler +; Version 4.4.0 #14648 (Linux) +;-------------------------------------------------------- +; Processed by Z88DK +;-------------------------------------------------------- + + EXTERN __divschar + EXTERN __divschar_callee + EXTERN __divsint + EXTERN __divsint_callee + EXTERN __divslong + EXTERN __divslong_callee + EXTERN __divslonglong + EXTERN __divslonglong_callee + EXTERN __divsuchar + EXTERN __divsuchar_callee + EXTERN __divuchar + EXTERN __divuchar_callee + EXTERN __divuint + EXTERN __divuint_callee + EXTERN __divulong + EXTERN __divulong_callee + EXTERN __divulonglong + EXTERN __divulonglong_callee + EXTERN __divuschar + EXTERN __divuschar_callee + EXTERN __modschar + EXTERN __modschar_callee + EXTERN __modsint + EXTERN __modsint_callee + EXTERN __modslong + EXTERN __modslong_callee + EXTERN __modslonglong + EXTERN __modslonglong_callee + EXTERN __modsuchar + EXTERN __modsuchar_callee + EXTERN __moduchar + EXTERN __moduchar_callee + EXTERN __moduint + EXTERN __moduint_callee + EXTERN __modulong + EXTERN __modulong_callee + EXTERN __modulonglong + EXTERN __modulonglong_callee + EXTERN __moduschar + EXTERN __moduschar_callee + EXTERN __mulint + EXTERN __mulint_callee + EXTERN __mullong + EXTERN __mullong_callee + EXTERN __mullonglong + EXTERN __mullonglong_callee + EXTERN __mulschar + EXTERN __mulschar_callee + EXTERN __mulsuchar + EXTERN __mulsuchar_callee + EXTERN __muluchar + EXTERN __muluchar_callee + EXTERN __muluschar + EXTERN __muluschar_callee + EXTERN __rlslonglong + EXTERN __rlslonglong_callee + EXTERN __rlulonglong + EXTERN __rlulonglong_callee + EXTERN __rrslonglong + EXTERN __rrslonglong_callee + EXTERN __rrulonglong + EXTERN __rrulonglong_callee + EXTERN ___mulsint2slong + EXTERN ___mulsint2slong_callee + EXTERN ___muluint2ulong + EXTERN ___muluint2ulong_callee + EXTERN ___sdcc_call_hl + EXTERN ___sdcc_call_iy + EXTERN ___sdcc_enter_ix + EXTERN banked_call + EXTERN _banked_ret + EXTERN ___fs2schar + EXTERN ___fs2schar_callee + EXTERN ___fs2sint + EXTERN ___fs2sint_callee + EXTERN ___fs2slong + EXTERN ___fs2slong_callee + EXTERN ___fs2slonglong + EXTERN ___fs2slonglong_callee + EXTERN ___fs2uchar + EXTERN ___fs2uchar_callee + EXTERN ___fs2uint + EXTERN ___fs2uint_callee + EXTERN ___fs2ulong + EXTERN ___fs2ulong_callee + EXTERN ___fs2ulonglong + EXTERN ___fs2ulonglong_callee + EXTERN ___fsadd + EXTERN ___fsadd_callee + EXTERN ___fsdiv + EXTERN ___fsdiv_callee + EXTERN ___fseq + EXTERN ___fseq_callee + EXTERN ___fsgt + EXTERN ___fsgt_callee + EXTERN ___fslt + EXTERN ___fslt_callee + EXTERN ___fsmul + EXTERN ___fsmul_callee + EXTERN ___fsneq + EXTERN ___fsneq_callee + EXTERN ___fssub + EXTERN ___fssub_callee + EXTERN ___schar2fs + EXTERN ___schar2fs_callee + EXTERN ___sint2fs + EXTERN ___sint2fs_callee + EXTERN ___slong2fs + EXTERN ___slong2fs_callee + EXTERN ___slonglong2fs + EXTERN ___slonglong2fs_callee + EXTERN ___uchar2fs + EXTERN ___uchar2fs_callee + EXTERN ___uint2fs + EXTERN ___uint2fs_callee + EXTERN ___ulong2fs + EXTERN ___ulong2fs_callee + EXTERN ___ulonglong2fs + EXTERN ___ulonglong2fs_callee + EXTERN ____sdcc_2_copy_src_mhl_dst_deix + EXTERN ____sdcc_2_copy_src_mhl_dst_bcix + EXTERN ____sdcc_4_copy_src_mhl_dst_deix + EXTERN ____sdcc_4_copy_src_mhl_dst_bcix + EXTERN ____sdcc_4_copy_src_mhl_dst_mbc + EXTERN ____sdcc_4_ldi_nosave_bc + EXTERN ____sdcc_4_ldi_save_bc + EXTERN ____sdcc_4_push_hlix + EXTERN ____sdcc_4_push_mhl + EXTERN ____sdcc_lib_setmem_hl + EXTERN ____sdcc_ll_add_de_bc_hl + EXTERN ____sdcc_ll_add_de_bc_hlix + EXTERN ____sdcc_ll_add_de_hlix_bc + EXTERN ____sdcc_ll_add_de_hlix_bcix + EXTERN ____sdcc_ll_add_deix_bc_hl + EXTERN ____sdcc_ll_add_deix_hlix + EXTERN ____sdcc_ll_add_hlix_bc_deix + EXTERN ____sdcc_ll_add_hlix_deix_bc + EXTERN ____sdcc_ll_add_hlix_deix_bcix + EXTERN ____sdcc_ll_asr_hlix_a + EXTERN ____sdcc_ll_asr_mbc_a + EXTERN ____sdcc_ll_copy_src_de_dst_hlix + EXTERN ____sdcc_ll_copy_src_de_dst_hlsp + EXTERN ____sdcc_ll_copy_src_deix_dst_hl + EXTERN ____sdcc_ll_copy_src_deix_dst_hlix + EXTERN ____sdcc_ll_copy_src_deixm_dst_hlsp + EXTERN ____sdcc_ll_copy_src_desp_dst_hlsp + EXTERN ____sdcc_ll_copy_src_hl_dst_de + EXTERN ____sdcc_ll_copy_src_hlsp_dst_de + EXTERN ____sdcc_ll_copy_src_hlsp_dst_deixm + EXTERN ____sdcc_ll_lsl_hlix_a + EXTERN ____sdcc_ll_lsl_mbc_a + EXTERN ____sdcc_ll_lsr_hlix_a + EXTERN ____sdcc_ll_lsr_mbc_a + EXTERN ____sdcc_ll_push_hlix + EXTERN ____sdcc_ll_push_mhl + EXTERN ____sdcc_ll_sub_de_bc_hl + EXTERN ____sdcc_ll_sub_de_bc_hlix + EXTERN ____sdcc_ll_sub_de_hlix_bc + EXTERN ____sdcc_ll_sub_de_hlix_bcix + EXTERN ____sdcc_ll_sub_deix_bc_hl + EXTERN ____sdcc_ll_sub_deix_hlix + EXTERN ____sdcc_ll_sub_hlix_bc_deix + EXTERN ____sdcc_ll_sub_hlix_deix_bc + EXTERN ____sdcc_ll_sub_hlix_deix_bcix + EXTERN ____sdcc_load_debc_deix + EXTERN ____sdcc_load_dehl_deix + EXTERN ____sdcc_load_debc_mhl + EXTERN ____sdcc_load_hlde_mhl + EXTERN ____sdcc_store_dehl_bcix + EXTERN ____sdcc_store_debc_hlix + EXTERN ____sdcc_store_debc_mhl + EXTERN ____sdcc_cpu_pop_ei + EXTERN ____sdcc_cpu_pop_ei_jp + EXTERN ____sdcc_cpu_push_di + EXTERN ____sdcc_outi + EXTERN ____sdcc_outi_128 + EXTERN ____sdcc_outi_256 + EXTERN ____sdcc_ldi + EXTERN ____sdcc_ldi_128 + EXTERN ____sdcc_ldi_256 + EXTERN ____sdcc_4_copy_srcd_hlix_dst_deix + EXTERN ____sdcc_4_and_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_or_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_or_src_dehl_dst_bcix + EXTERN ____sdcc_4_xor_src_dehl_dst_bcix + EXTERN ____sdcc_4_and_src_dehl_dst_bcix + EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_or_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_cpl_src_mhl_dst_debc + EXTERN ____sdcc_4_xor_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_or_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_debc_hlix_dst_debc + EXTERN ____sdcc_4_or_src_debc_hlix_dst_debc + EXTERN ____sdcc_4_xor_src_debc_hlix_dst_debc + +;-------------------------------------------------------- +; Public variables in this module +;-------------------------------------------------------- + GLOBAL _usbdev_control_transfer + GLOBAL _usbdev_blk_out_trnsfer + GLOBAL _usbdev_bulk_in_transfer + GLOBAL _usbdev_dat_in_trnsfer + GLOBAL _usbdev_dat_in_trnsfer_0 +;-------------------------------------------------------- +; Externals used +;-------------------------------------------------------- + GLOBAL _critical_end + GLOBAL _critical_begin + GLOBAL _usbtrn_clear_endpoint_halt + GLOBAL _usbtrn_set_address + GLOBAL _usbtrn_set_configuration + GLOBAL _usbtrn_gfull_cfg_desc + GLOBAL _usbtrn_get_config_descriptor + GLOBAL _usbtrn_get_descriptor2 + GLOBAL _usbtrn_get_descriptor + GLOBAL _usb_data_out_transfer + GLOBAL _usb_data_in_transfer_n + GLOBAL _usb_data_in_transfer + GLOBAL _usb_control_transfer + GLOBAL _ch_issue_token_in_ep0 + GLOBAL _ch_issue_token_out_ep0 + GLOBAL _ch_issue_token_setup + GLOBAL _ch_data_out_transfer + GLOBAL _ch_data_in_transfer_n + GLOBAL _ch_data_in_transfer + GLOBAL _ch_control_transfer_set_config + GLOBAL _ch_control_transfer_set_address + GLOBAL _ch_control_transfer_request_descriptor + GLOBAL _ch_set_usb_address + GLOBAL _ch_write_data + GLOBAL _ch_cmd_get_ic_version + GLOBAL _ch_cmd_set_usb_mode + GLOBAL _ch_probe + GLOBAL _ch_cmd_reset_all + GLOBAL _ch_read_data + GLOBAL _ch_very_short_wait_int_and_get_status + GLOBAL _ch_short_wait_int_and_get_status + GLOBAL _ch_long_wait_int_and_get_status + GLOBAL _ch_get_status + GLOBAL _ch_command + GLOBAL _delay_medium + GLOBAL _delay_short + GLOBAL _delay_20ms + GLOBAL _printf + GLOBAL _delay + GLOBAL _ulltoa_callee + GLOBAL _ulltoa + GLOBAL _strtoull_callee + GLOBAL _strtoull + GLOBAL _strtoll_callee + GLOBAL _strtoll + GLOBAL _lltoa_callee + GLOBAL _lltoa + GLOBAL _llabs_callee + GLOBAL _llabs + GLOBAL __lldivu__callee + GLOBAL __lldivu_ + GLOBAL __lldiv__callee + GLOBAL __lldiv_ + GLOBAL _atoll_callee + GLOBAL _atoll + GLOBAL _realloc_unlocked_callee + GLOBAL _realloc_unlocked + GLOBAL _malloc_unlocked_fastcall + GLOBAL _malloc_unlocked + GLOBAL _free_unlocked_fastcall + GLOBAL _free_unlocked + GLOBAL _calloc_unlocked_callee + GLOBAL _calloc_unlocked + GLOBAL _aligned_alloc_unlocked_callee + GLOBAL _aligned_alloc_unlocked + GLOBAL _realloc_callee + GLOBAL _realloc + GLOBAL _malloc_fastcall + GLOBAL _malloc + GLOBAL _free_fastcall + GLOBAL _free + GLOBAL _calloc_callee + GLOBAL _calloc + GLOBAL _aligned_alloc_callee + GLOBAL _aligned_alloc + GLOBAL _utoa_callee + GLOBAL _utoa + GLOBAL _ultoa_callee + GLOBAL _ultoa + GLOBAL _system_fastcall + GLOBAL _system + GLOBAL _strtoul_callee + GLOBAL _strtoul + GLOBAL _strtol_callee + GLOBAL _strtol + GLOBAL _strtof_callee + GLOBAL _strtof + GLOBAL _strtod_callee + GLOBAL _strtod + GLOBAL _srand_fastcall + GLOBAL _srand + GLOBAL _rand + GLOBAL _quick_exit_fastcall + GLOBAL _quick_exit + GLOBAL _qsort_callee + GLOBAL _qsort + GLOBAL _ltoa_callee + GLOBAL _ltoa + GLOBAL _labs_fastcall + GLOBAL _labs + GLOBAL _itoa_callee + GLOBAL _itoa + GLOBAL _ftoh_callee + GLOBAL _ftoh + GLOBAL _ftog_callee + GLOBAL _ftog + GLOBAL _ftoe_callee + GLOBAL _ftoe + GLOBAL _ftoa_callee + GLOBAL _ftoa + GLOBAL _exit_fastcall + GLOBAL _exit + GLOBAL _dtoh_callee + GLOBAL _dtoh + GLOBAL _dtog_callee + GLOBAL _dtog + GLOBAL _dtoe_callee + GLOBAL _dtoe + GLOBAL _dtoa_callee + GLOBAL _dtoa + GLOBAL _bsearch_callee + GLOBAL _bsearch + GLOBAL _atol_fastcall + GLOBAL _atol + GLOBAL _atoi_fastcall + GLOBAL _atoi + GLOBAL _atof_fastcall + GLOBAL _atof + GLOBAL _atexit_fastcall + GLOBAL _atexit + GLOBAL _at_quick_exit_fastcall + GLOBAL _at_quick_exit + GLOBAL _abs_fastcall + GLOBAL _abs + GLOBAL _abort + GLOBAL __strtou__callee + GLOBAL __strtou_ + GLOBAL __strtoi__callee + GLOBAL __strtoi_ + GLOBAL __random_uniform_xor_8__fastcall + GLOBAL __random_uniform_xor_8_ + GLOBAL __random_uniform_xor_32__fastcall + GLOBAL __random_uniform_xor_32_ + GLOBAL __random_uniform_cmwc_8__fastcall + GLOBAL __random_uniform_cmwc_8_ + GLOBAL __shellsort__callee + GLOBAL __shellsort_ + GLOBAL __quicksort__callee + GLOBAL __quicksort_ + GLOBAL __insertion_sort__callee + GLOBAL __insertion_sort_ + GLOBAL __ldivu__callee + GLOBAL __ldivu_ + GLOBAL __ldiv__callee + GLOBAL __ldiv_ + GLOBAL __divu__callee + GLOBAL __divu_ + GLOBAL __div__callee + GLOBAL __div_ + GLOBAL _in_critical_usb_section + GLOBAL _result +;-------------------------------------------------------- +; special function registers +;-------------------------------------------------------- +defc _CH376_DATA_PORT = 0xff88 +defc _CH376_COMMAND_PORT = 0xff89 +defc _USB_MODULE_LEDS = 0xff8a +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + SECTION bss_compiler +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + +IF 0 + +; .area _INITIALIZED removed by z88dk + + +ENDIF + +;-------------------------------------------------------- +; absolute external ram data +;-------------------------------------------------------- + SECTION IGNORE +;-------------------------------------------------------- +; global & static initialisations +;-------------------------------------------------------- + SECTION code_crt_init +;-------------------------------------------------------- +; Home +;-------------------------------------------------------- + SECTION IGNORE +;-------------------------------------------------------- +; code +;-------------------------------------------------------- + SECTION code_compiler +;source-doc/base-drv/dev_transfers.c:31: usb_error usbdev_control_transfer(device_config *const device, const setup_packet *const cmd_packet, uint8_t *const buffer) { +; --------------------------------- +; Function usbdev_control_transfer +; --------------------------------- +_usbdev_control_transfer: + push ix + ld ix,0 + add ix,sp +;source-doc/base-drv/dev_transfers.c:32: return usb_control_transfer(cmd_packet, buffer, device->address, device->max_packet_size); + ld l,(ix+4) + ld h,(ix+5) + ld e,l + ld d,h + inc hl + ld b, (hl) + ex de, hl + ld a, (hl) + rlca + rlca + rlca + rlca + and a,0x0f + ld e,(ix+8) + ld d,(ix+9) + ld c,a + push bc + push de + ld l,(ix+6) + ld h,(ix+7) + push hl + call _usb_control_transfer + pop af + pop af + pop af +;source-doc/base-drv/dev_transfers.c:33: } + pop ix + ret +;source-doc/base-drv/dev_transfers.c:35: usb_error usbdev_blk_out_trnsfer(device_config *const dev, const uint8_t *const buffer, const uint16_t buffer_size) { +; --------------------------------- +; Function usbdev_blk_out_trnsfer +; --------------------------------- +_usbdev_blk_out_trnsfer: + push ix + ld ix,0 + add ix,sp + dec sp +;source-doc/base-drv/dev_transfers.c:37: endpoint_param *const endpoint = &dev->endpoints[ENDPOINT_BULK_OUT]; + ld e,(ix+4) + ld d,(ix+5) + ld c, e + ld b, d + inc bc + inc bc + inc bc +;source-doc/base-drv/dev_transfers.c:39: result = usb_data_out_transfer(buffer, buffer_size, dev->address, endpoint); + ld l, e + ld h, d + ld a, (hl) + rlca + rlca + rlca + rlca + and a,0x0f + push bc + push de + push bc + push af + inc sp + ld l,(ix+8) + ld h,(ix+9) + push hl + ld l,(ix+6) + ld h,(ix+7) + push hl + call _usb_data_out_transfer + pop af + pop af + pop af + inc sp + pop de + pop bc + ld a, l + ld (_result), a +;source-doc/base-drv/dev_transfers.c:41: if (result == USB_ERR_STALL) { + ld a,(_result) + sub a,0x02 + jr NZ,l_usbdev_blk_out_trnsfer_00102 +;source-doc/base-drv/dev_transfers.c:42: usbtrn_clear_endpoint_halt(endpoint->number, dev->address, dev->max_packet_size); + ld l, e + ld h, d + inc hl + ld a, (hl) + ld (ix-1),a + ex de, hl + ld a, (hl) + rlca + rlca + rlca + rlca + and a,0x0f + ld d, a + ld l, c + ld h, b + ld a, (hl) + rrca + and a,0x07 + push bc + ld h,(ix-1) + ld l,d + push hl + push af + inc sp + call _usbtrn_clear_endpoint_halt + pop af + inc sp + pop bc +;source-doc/base-drv/dev_transfers.c:43: endpoint->toggle = 0; + ld a, (bc) + and a,0xfe + ld (bc), a +;source-doc/base-drv/dev_transfers.c:44: return USB_ERR_STALL; + ld l,0x02 + jr l_usbdev_blk_out_trnsfer_00104 +l_usbdev_blk_out_trnsfer_00102: +;source-doc/base-drv/dev_transfers.c:47: RETURN_CHECK(result); +;source-doc/base-drv/dev_transfers.c:50: return result; + ld hl,(_result) +l_usbdev_blk_out_trnsfer_00104: +;source-doc/base-drv/dev_transfers.c:51: } + inc sp + pop ix + ret +;source-doc/base-drv/dev_transfers.c:53: usb_error usbdev_bulk_in_transfer(device_config *const dev, uint8_t *const buffer, uint8_t *const buffer_size) { +; --------------------------------- +; Function usbdev_bulk_in_transfer +; --------------------------------- +_usbdev_bulk_in_transfer: + push ix + ld ix,0 + add ix,sp + dec sp +;source-doc/base-drv/dev_transfers.c:54: endpoint_param *const endpoint = &dev->endpoints[ENDPOINT_BULK_IN]; + ld c,(ix+4) + ld b,(ix+5) + ld hl,0x0006 + add hl, bc +;source-doc/base-drv/dev_transfers.c:56: result = usb_data_in_transfer_n(buffer, buffer_size, dev->address, endpoint); + ld e,c + ld d,b + ex de,hl + ld a, (hl) + rlca + rlca + rlca + rlca + and a,0x0f + push bc + push de + push de + push af + inc sp + ld l,(ix+8) + ld h,(ix+9) + push hl + ld l,(ix+6) + ld h,(ix+7) + push hl + call _usb_data_in_transfer_n + pop af + pop af + pop af + inc sp + pop de + pop bc + ld a, l + ld (_result), a +;source-doc/base-drv/dev_transfers.c:58: if (result == USB_ERR_STALL) { + ld a,(_result) + sub a,0x02 + jr NZ,l_usbdev_bulk_in_transfer_00102 +;source-doc/base-drv/dev_transfers.c:59: usbtrn_clear_endpoint_halt(endpoint->number, dev->address, dev->max_packet_size); + ld l, c + ld h, b + inc hl + ld a, (hl) + ld (ix-1),a + ld l, c + ld h, b + ld a, (hl) + rlca + rlca + rlca + rlca + and a,0x0f + ld b, a + ld l, e + ld h, d + ld a, (hl) + rrca + and a,0x07 + push de + ld h,(ix-1) + ld l,b + push hl + push af + inc sp + call _usbtrn_clear_endpoint_halt + pop af + inc sp + pop de +;source-doc/base-drv/dev_transfers.c:60: endpoint->toggle = 0; + ex de, hl + res 0, (hl) +;source-doc/base-drv/dev_transfers.c:61: return USB_ERR_STALL; + ld l,0x02 + jr l_usbdev_bulk_in_transfer_00104 +l_usbdev_bulk_in_transfer_00102: +;source-doc/base-drv/dev_transfers.c:64: RETURN_CHECK(result); +;source-doc/base-drv/dev_transfers.c:66: return result; + ld hl,(_result) +l_usbdev_bulk_in_transfer_00104: +;source-doc/base-drv/dev_transfers.c:67: } + inc sp + pop ix + ret +;source-doc/base-drv/dev_transfers.c:69: usb_error usbdev_dat_in_trnsfer(device_config *const device, +; --------------------------------- +; Function usbdev_dat_in_trnsfer +; --------------------------------- +_usbdev_dat_in_trnsfer: + push ix + ld ix,0 + add ix,sp + dec sp +;source-doc/base-drv/dev_transfers.c:74: endpoint_param *const endpoint = &device->endpoints[endpoint_type]; + ld e,(ix+4) + ld d,(ix+5) + ld c, e + ld b, d + inc bc + inc bc + inc bc + push de + ld a,(ix+10) + ld e, a + add a, a + add a, e + pop de + add a, c + ld c, a + ld a,0x00 + adc a, b + ld b, a +;source-doc/base-drv/dev_transfers.c:76: result = usb_data_in_transfer(buffer, buffer_size, device->address, endpoint); + ld l, e + ld h, d + ld a, (hl) + rlca + rlca + rlca + rlca + and a,0x0f + push bc + push de + push bc + push af + inc sp + ld l,(ix+8) + ld h,(ix+9) + push hl + ld l,(ix+6) + ld h,(ix+7) + push hl + call _usb_data_in_transfer + pop af + pop af + pop af + inc sp + pop de + pop bc + ld a, l + ld (_result), a +;source-doc/base-drv/dev_transfers.c:78: if (result == USB_ERR_STALL) { + ld a,(_result) + sub a,0x02 + jr NZ,l_usbdev_dat_in_trnsfer_00102 +;source-doc/base-drv/dev_transfers.c:79: usbtrn_clear_endpoint_halt(endpoint->number, device->address, device->max_packet_size); + ld l, e + ld h, d + inc hl + ld a, (hl) + ld (ix-1),a + ex de, hl + ld a, (hl) + rlca + rlca + rlca + rlca + and a,0x0f + ld d, a + ld l, c + ld h, b + ld a, (hl) + rrca + and a,0x07 + push bc + ld h,(ix-1) + ld l,d + push hl + push af + inc sp + call _usbtrn_clear_endpoint_halt + pop af + inc sp + pop bc +;source-doc/base-drv/dev_transfers.c:80: endpoint->toggle = 0; + ld a, (bc) + and a,0xfe + ld (bc), a +;source-doc/base-drv/dev_transfers.c:81: return USB_ERR_STALL; + ld l,0x02 + jr l_usbdev_dat_in_trnsfer_00104 +l_usbdev_dat_in_trnsfer_00102: +;source-doc/base-drv/dev_transfers.c:84: RETURN_CHECK(result); +;source-doc/base-drv/dev_transfers.c:86: return result; + ld hl,(_result) +l_usbdev_dat_in_trnsfer_00104: +;source-doc/base-drv/dev_transfers.c:87: } + inc sp + pop ix + ret +;source-doc/base-drv/dev_transfers.c:89: usb_error usbdev_dat_in_trnsfer_0(device_config *const device, uint8_t *const buffer, const uint8_t buffer_size) { +; --------------------------------- +; Function usbdev_dat_in_trnsfer_0 +; --------------------------------- +_usbdev_dat_in_trnsfer_0: + push ix + ld ix,0 + add ix,sp + push af +;source-doc/base-drv/dev_transfers.c:90: endpoint_param *const endpoint = &device->endpoints[0]; + ld e,(ix+4) + ld d,(ix+5) + ld hl,0x0003 + add hl, de + ex (sp), hl +;source-doc/base-drv/dev_transfers.c:92: result = usb_data_in_transfer(buffer, buffer_size, device->address, endpoint); + ld l, e + ld h, d + ld a, (hl) + rlca + rlca + rlca + rlca + and a,0x0f + ld c,(ix+8) + ld b,0x00 + push de + ld l,(ix-2) + ld h,(ix-1) + push hl + push af + inc sp + push bc + ld l,(ix+6) + ld h,(ix+7) + push hl + call _usb_data_in_transfer + pop af + pop af + pop af + inc sp + pop de + ld a, l + ld (_result), a +;source-doc/base-drv/dev_transfers.c:94: if (result == USB_ERR_STALL) { + ld a,(_result) + sub a,0x02 + jr NZ,l_usbdev_dat_in_trnsfer_0_00102 +;source-doc/base-drv/dev_transfers.c:95: usbtrn_clear_endpoint_halt(endpoint->number, device->address, device->max_packet_size); + ld l, e + ld h, d + inc hl + ld b, (hl) + ex de, hl + ld a, (hl) + rlca + rlca + rlca + rlca + and a,0x0f + ld d, a + pop hl + ld a,(hl) + push hl + rrca + and a,0x07 + ld c, d + push bc + push af + inc sp + call _usbtrn_clear_endpoint_halt + pop af + inc sp +;source-doc/base-drv/dev_transfers.c:96: endpoint->toggle = 0; + pop hl + push hl + res 0, (hl) +;source-doc/base-drv/dev_transfers.c:97: return USB_ERR_STALL; + ld l,0x02 + jr l_usbdev_dat_in_trnsfer_0_00103 +l_usbdev_dat_in_trnsfer_0_00102: +;source-doc/base-drv/dev_transfers.c:100: return result; + ld hl,(_result) +l_usbdev_dat_in_trnsfer_0_00103: +;source-doc/base-drv/dev_transfers.c:101: } + ld sp, ix + pop ix + ret + SECTION IGNORE diff --git a/Source/HBIOS/ch376-native/base-drv/dev_transfers.c.s b/Source/HBIOS/ch376-native/base-drv/dev_transfers.c.s index 2412ace0..8b622ba9 100644 --- a/Source/HBIOS/ch376-native/base-drv/dev_transfers.c.s +++ b/Source/HBIOS/ch376-native/base-drv/dev_transfers.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/base-drv/./dev_transfers.c.asm -- not to be modify directly +; Generated from source-doc/base-drv/dev_transfers.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -48,7 +48,7 @@ _USB_MODULE_LEDS .EQU 0xff8a ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/base-drv/./dev_transfers.c:31: usb_error usbdev_control_transfer(device_config *const device, const setup_packet *const cmd_packet, uint8_t *const buffer) { +;source-doc/base-drv/dev_transfers.c:31: usb_error usbdev_control_transfer(device_config *const device, const setup_packet *const cmd_packet, uint8_t *const buffer) { ; --------------------------------- ; Function usbdev_control_transfer ; --------------------------------- @@ -56,11 +56,11 @@ _usbdev_control_transfer: push ix ld ix,0 add ix,sp -;source-doc/base-drv/./dev_transfers.c:32: return usb_control_transfer(cmd_packet, buffer, device->address, device->max_packet_size); - ld e,(ix+4) - ld d,(ix+5) - ld l, e - ld h, d +;source-doc/base-drv/dev_transfers.c:32: return usb_control_transfer(cmd_packet, buffer, device->address, device->max_packet_size); + ld l,(ix+4) + ld h,(ix+5) + ld e,l + ld d,h inc hl ld b, (hl) ex de, hl @@ -72,10 +72,8 @@ _usbdev_control_transfer: and 0x0f ld e,(ix+8) ld d,(ix+9) + ld c,a push bc - inc sp - push af - inc sp push de ld l,(ix+6) ld h,(ix+7) @@ -84,10 +82,10 @@ _usbdev_control_transfer: pop af pop af pop af -;source-doc/base-drv/./dev_transfers.c:33: } +;source-doc/base-drv/dev_transfers.c:33: } pop ix ret -;source-doc/base-drv/./dev_transfers.c:35: usb_error usbdev_blk_out_trnsfer(device_config *const dev, const uint8_t *const buffer, const uint16_t buffer_size) { +;source-doc/base-drv/dev_transfers.c:35: usb_error usbdev_blk_out_trnsfer(device_config *const dev, const uint8_t *const buffer, const uint16_t buffer_size) { ; --------------------------------- ; Function usbdev_blk_out_trnsfer ; --------------------------------- @@ -95,33 +93,27 @@ _usbdev_blk_out_trnsfer: push ix ld ix,0 add ix,sp - push af - push af -;source-doc/base-drv/./dev_transfers.c:37: endpoint_param *const endpoint = &dev->endpoints[ENDPOINT_BULK_OUT]; - ld a,(ix+4) - ld (ix-4),a - ld a,(ix+5) - ld (ix-3),a - ld a,(ix-4) - add a,0x03 - ld (ix-2),a - ld a,(ix-3) - adc a,0x00 - ld (ix-1),a -;source-doc/base-drv/./dev_transfers.c:39: result = usb_data_out_transfer(buffer, buffer_size, dev->address, endpoint); - pop hl - push hl + dec sp +;source-doc/base-drv/dev_transfers.c:37: endpoint_param *const endpoint = &dev->endpoints[ENDPOINT_BULK_OUT]; + ld e,(ix+4) + ld d,(ix+5) + ld c, e + ld b, d + inc bc + inc bc + inc bc +;source-doc/base-drv/dev_transfers.c:39: result = usb_data_out_transfer(buffer, buffer_size, dev->address, endpoint); + ld l, e + ld h, d ld a, (hl) rlca rlca rlca rlca and 0x0f - pop de - pop hl - push hl + push bc push de - push hl + push bc push af inc sp ld l,(ix+8) @@ -135,60 +127,60 @@ _usbdev_blk_out_trnsfer: pop af pop af inc sp + pop de + pop bc ld a, l ld (_result), a -;source-doc/base-drv/./dev_transfers.c:41: if (result == USB_ERR_STALL) { +;source-doc/base-drv/dev_transfers.c:41: if (result == USB_ERR_STALL) { ld a,(_result) sub 0x02 jr NZ,l_usbdev_blk_out_trnsfer_00102 -;source-doc/base-drv/./dev_transfers.c:42: usbtrn_clear_endpoint_halt(endpoint->number, dev->address, dev->max_packet_size); - pop hl - push hl +;source-doc/base-drv/dev_transfers.c:42: usbtrn_clear_endpoint_halt(endpoint->number, dev->address, dev->max_packet_size); + ld l, e + ld h, d inc hl - ld d, (hl) - pop hl - push hl + ld a, (hl) + ld (ix-1),a + ex de, hl ld a, (hl) rlca rlca rlca rlca and 0x0f - ld b, a - ld l,(ix-2) - ld h,(ix-1) + ld d, a + ld l, c + ld h, b ld a, (hl) rrca and 0x07 - push de - inc sp push bc - inc sp + ld h,(ix-1) + ld l,d + push hl push af inc sp call _usbtrn_clear_endpoint_halt pop af inc sp -;source-doc/base-drv/./dev_transfers.c:43: endpoint->toggle = 0; - pop de - pop hl - push hl - push de - res 0, (hl) -;source-doc/base-drv/./dev_transfers.c:44: return USB_ERR_STALL; + pop bc +;source-doc/base-drv/dev_transfers.c:43: endpoint->toggle = 0; + ld a, (bc) + and 0xfe + ld (bc), a +;source-doc/base-drv/dev_transfers.c:44: return USB_ERR_STALL; ld l,0x02 jr l_usbdev_blk_out_trnsfer_00104 l_usbdev_blk_out_trnsfer_00102: -;source-doc/base-drv/./dev_transfers.c:47: RETURN_CHECK(result); -;source-doc/base-drv/./dev_transfers.c:50: return result; - ld hl,_result - ld l, (hl) +;source-doc/base-drv/dev_transfers.c:47: RETURN_CHECK(result); +;source-doc/base-drv/dev_transfers.c:50: return result; + ld hl,(_result) l_usbdev_blk_out_trnsfer_00104: -;source-doc/base-drv/./dev_transfers.c:51: } - ld sp, ix +;source-doc/base-drv/dev_transfers.c:51: } + inc sp pop ix ret -;source-doc/base-drv/./dev_transfers.c:53: usb_error usbdev_bulk_in_transfer(device_config *const dev, uint8_t *const buffer, uint8_t *const buffer_size) { +;source-doc/base-drv/dev_transfers.c:53: usb_error usbdev_bulk_in_transfer(device_config *const dev, uint8_t *const buffer, uint8_t *const buffer_size) { ; --------------------------------- ; Function usbdev_bulk_in_transfer ; --------------------------------- @@ -196,33 +188,25 @@ _usbdev_bulk_in_transfer: push ix ld ix,0 add ix,sp - push af - push af -;source-doc/base-drv/./dev_transfers.c:54: endpoint_param *const endpoint = &dev->endpoints[ENDPOINT_BULK_IN]; - ld a,(ix+4) - ld (ix-4),a - ld a,(ix+5) - ld (ix-3),a - ld a,(ix-4) - add a,0x06 - ld (ix-2),a - ld a,(ix-3) - adc a,0x00 - ld (ix-1),a -;source-doc/base-drv/./dev_transfers.c:56: result = usb_data_in_transfer_n(buffer, buffer_size, dev->address, endpoint); - pop hl - push hl + dec sp +;source-doc/base-drv/dev_transfers.c:54: endpoint_param *const endpoint = &dev->endpoints[ENDPOINT_BULK_IN]; + ld c,(ix+4) + ld b,(ix+5) + ld hl,0x0006 + add hl, bc +;source-doc/base-drv/dev_transfers.c:56: result = usb_data_in_transfer_n(buffer, buffer_size, dev->address, endpoint); + ld e,c + ld d,b + ex de,hl ld a, (hl) rlca rlca rlca rlca and 0x0f - pop de - pop hl - push hl + push bc + push de push de - push hl push af inc sp ld l,(ix+8) @@ -236,19 +220,22 @@ _usbdev_bulk_in_transfer: pop af pop af inc sp + pop de + pop bc ld a, l ld (_result), a -;source-doc/base-drv/./dev_transfers.c:58: if (result == USB_ERR_STALL) { +;source-doc/base-drv/dev_transfers.c:58: if (result == USB_ERR_STALL) { ld a,(_result) sub 0x02 jr NZ,l_usbdev_bulk_in_transfer_00102 -;source-doc/base-drv/./dev_transfers.c:59: usbtrn_clear_endpoint_halt(endpoint->number, dev->address, dev->max_packet_size); - pop hl - push hl +;source-doc/base-drv/dev_transfers.c:59: usbtrn_clear_endpoint_halt(endpoint->number, dev->address, dev->max_packet_size); + ld l, c + ld h, b inc hl - ld d, (hl) - pop hl - push hl + ld a, (hl) + ld (ix-1),a + ld l, c + ld h, b ld a, (hl) rlca rlca @@ -256,40 +243,37 @@ _usbdev_bulk_in_transfer: rlca and 0x0f ld b, a - ld l,(ix-2) - ld h,(ix-1) + ld l, e + ld h, d ld a, (hl) rrca and 0x07 push de - inc sp - push bc - inc sp + ld h,(ix-1) + ld l,b + push hl push af inc sp call _usbtrn_clear_endpoint_halt pop af inc sp -;source-doc/base-drv/./dev_transfers.c:60: endpoint->toggle = 0; pop de - pop hl - push hl - push de +;source-doc/base-drv/dev_transfers.c:60: endpoint->toggle = 0; + ex de, hl res 0, (hl) -;source-doc/base-drv/./dev_transfers.c:61: return USB_ERR_STALL; +;source-doc/base-drv/dev_transfers.c:61: return USB_ERR_STALL; ld l,0x02 jr l_usbdev_bulk_in_transfer_00104 l_usbdev_bulk_in_transfer_00102: -;source-doc/base-drv/./dev_transfers.c:64: RETURN_CHECK(result); -;source-doc/base-drv/./dev_transfers.c:66: return result; - ld hl,_result - ld l, (hl) +;source-doc/base-drv/dev_transfers.c:64: RETURN_CHECK(result); +;source-doc/base-drv/dev_transfers.c:66: return result; + ld hl,(_result) l_usbdev_bulk_in_transfer_00104: -;source-doc/base-drv/./dev_transfers.c:67: } - ld sp, ix +;source-doc/base-drv/dev_transfers.c:67: } + inc sp pop ix ret -;source-doc/base-drv/./dev_transfers.c:69: usb_error usbdev_dat_in_trnsfer(device_config *const device, +;source-doc/base-drv/dev_transfers.c:69: usb_error usbdev_dat_in_trnsfer(device_config *const device, ; --------------------------------- ; Function usbdev_dat_in_trnsfer ; --------------------------------- @@ -297,41 +281,38 @@ _usbdev_dat_in_trnsfer: push ix ld ix,0 add ix,sp - push af - push af -;source-doc/base-drv/./dev_transfers.c:74: endpoint_param *const endpoint = &device->endpoints[endpoint_type]; - ld a,(ix+4) - ld (ix-4),a - ld a,(ix+5) - ld (ix-3),a - pop bc - push bc + dec sp +;source-doc/base-drv/dev_transfers.c:74: endpoint_param *const endpoint = &device->endpoints[endpoint_type]; + ld e,(ix+4) + ld d,(ix+5) + ld c, e + ld b, d inc bc inc bc inc bc + push de ld a,(ix+10) ld e, a add a, a add a, e + pop de add a, c - ld (ix-2),a + ld c, a ld a,0x00 adc a, b - ld (ix-1),a -;source-doc/base-drv/./dev_transfers.c:76: result = usb_data_in_transfer(buffer, buffer_size, device->address, endpoint); - pop hl - push hl + ld b, a +;source-doc/base-drv/dev_transfers.c:76: result = usb_data_in_transfer(buffer, buffer_size, device->address, endpoint); + ld l, e + ld h, d ld a, (hl) rlca rlca rlca rlca and 0x0f - pop de - pop hl - push hl + push bc push de - push hl + push bc push af inc sp ld l,(ix+8) @@ -345,60 +326,60 @@ _usbdev_dat_in_trnsfer: pop af pop af inc sp + pop de + pop bc ld a, l ld (_result), a -;source-doc/base-drv/./dev_transfers.c:78: if (result == USB_ERR_STALL) { +;source-doc/base-drv/dev_transfers.c:78: if (result == USB_ERR_STALL) { ld a,(_result) sub 0x02 jr NZ,l_usbdev_dat_in_trnsfer_00102 -;source-doc/base-drv/./dev_transfers.c:79: usbtrn_clear_endpoint_halt(endpoint->number, device->address, device->max_packet_size); - pop hl - push hl +;source-doc/base-drv/dev_transfers.c:79: usbtrn_clear_endpoint_halt(endpoint->number, device->address, device->max_packet_size); + ld l, e + ld h, d inc hl - ld d, (hl) - pop hl - push hl + ld a, (hl) + ld (ix-1),a + ex de, hl ld a, (hl) rlca rlca rlca rlca and 0x0f - ld b, a - ld l,(ix-2) - ld h,(ix-1) + ld d, a + ld l, c + ld h, b ld a, (hl) rrca and 0x07 - push de - inc sp push bc - inc sp + ld h,(ix-1) + ld l,d + push hl push af inc sp call _usbtrn_clear_endpoint_halt pop af inc sp -;source-doc/base-drv/./dev_transfers.c:80: endpoint->toggle = 0; - pop de - pop hl - push hl - push de - res 0, (hl) -;source-doc/base-drv/./dev_transfers.c:81: return USB_ERR_STALL; + pop bc +;source-doc/base-drv/dev_transfers.c:80: endpoint->toggle = 0; + ld a, (bc) + and 0xfe + ld (bc), a +;source-doc/base-drv/dev_transfers.c:81: return USB_ERR_STALL; ld l,0x02 jr l_usbdev_dat_in_trnsfer_00104 l_usbdev_dat_in_trnsfer_00102: -;source-doc/base-drv/./dev_transfers.c:84: RETURN_CHECK(result); -;source-doc/base-drv/./dev_transfers.c:86: return result; - ld hl,_result - ld l, (hl) +;source-doc/base-drv/dev_transfers.c:84: RETURN_CHECK(result); +;source-doc/base-drv/dev_transfers.c:86: return result; + ld hl,(_result) l_usbdev_dat_in_trnsfer_00104: -;source-doc/base-drv/./dev_transfers.c:87: } - ld sp, ix +;source-doc/base-drv/dev_transfers.c:87: } + inc sp pop ix ret -;source-doc/base-drv/./dev_transfers.c:89: usb_error usbdev_dat_in_trnsfer_0(device_config *const device, uint8_t *const buffer, const uint8_t buffer_size) { +;source-doc/base-drv/dev_transfers.c:89: usb_error usbdev_dat_in_trnsfer_0(device_config *const device, uint8_t *const buffer, const uint8_t buffer_size) { ; --------------------------------- ; Function usbdev_dat_in_trnsfer_0 ; --------------------------------- @@ -407,21 +388,15 @@ _usbdev_dat_in_trnsfer_0: ld ix,0 add ix,sp push af - push af -;source-doc/base-drv/./dev_transfers.c:90: endpoint_param *const endpoint = &device->endpoints[0]; - ld a,(ix+4) - ld (ix-4),a - ld a,(ix+5) - ld (ix-3),a - ld a,(ix-4) - add a,0x03 - ld (ix-2),a - ld a,(ix-3) - adc a,0x00 - ld (ix-1),a -;source-doc/base-drv/./dev_transfers.c:92: result = usb_data_in_transfer(buffer, buffer_size, device->address, endpoint); - pop hl - push hl +;source-doc/base-drv/dev_transfers.c:90: endpoint_param *const endpoint = &device->endpoints[0]; + ld e,(ix+4) + ld d,(ix+5) + ld hl,0x0003 + add hl, de + ex (sp), hl +;source-doc/base-drv/dev_transfers.c:92: result = usb_data_in_transfer(buffer, buffer_size, device->address, endpoint); + ld l, e + ld h, d ld a, (hl) rlca rlca @@ -430,10 +405,9 @@ _usbdev_dat_in_trnsfer_0: and 0x0f ld c,(ix+8) ld b,0x00 - pop de - pop hl - push hl push de + ld l,(ix-2) + ld h,(ix-1) push hl push af inc sp @@ -446,55 +420,50 @@ _usbdev_dat_in_trnsfer_0: pop af pop af inc sp + pop de ld a, l ld (_result), a -;source-doc/base-drv/./dev_transfers.c:94: if (result == USB_ERR_STALL) { +;source-doc/base-drv/dev_transfers.c:94: if (result == USB_ERR_STALL) { ld a,(_result) sub 0x02 jr NZ,l_usbdev_dat_in_trnsfer_0_00102 -;source-doc/base-drv/./dev_transfers.c:95: usbtrn_clear_endpoint_halt(endpoint->number, device->address, device->max_packet_size); - pop hl - push hl +;source-doc/base-drv/dev_transfers.c:95: usbtrn_clear_endpoint_halt(endpoint->number, device->address, device->max_packet_size); + ld l, e + ld h, d inc hl - ld d, (hl) - pop hl - push hl + ld b, (hl) + ex de, hl ld a, (hl) rlca rlca rlca rlca and 0x0f - ld b, a - ld l,(ix-2) - ld h,(ix-1) - ld a, (hl) + ld d, a + pop hl + ld a,(hl) + push hl rrca and 0x07 - push de - inc sp + ld c, d push bc - inc sp push af inc sp call _usbtrn_clear_endpoint_halt pop af inc sp -;source-doc/base-drv/./dev_transfers.c:96: endpoint->toggle = 0; - pop de +;source-doc/base-drv/dev_transfers.c:96: endpoint->toggle = 0; pop hl push hl - push de res 0, (hl) -;source-doc/base-drv/./dev_transfers.c:97: return USB_ERR_STALL; +;source-doc/base-drv/dev_transfers.c:97: return USB_ERR_STALL; ld l,0x02 jr l_usbdev_dat_in_trnsfer_0_00103 l_usbdev_dat_in_trnsfer_0_00102: -;source-doc/base-drv/./dev_transfers.c:100: return result; - ld hl,_result - ld l, (hl) +;source-doc/base-drv/dev_transfers.c:100: return result; + ld hl,(_result) l_usbdev_dat_in_trnsfer_0_00103: -;source-doc/base-drv/./dev_transfers.c:101: } +;source-doc/base-drv/dev_transfers.c:101: } ld sp, ix pop ix ret diff --git a/Source/HBIOS/ch376-native/base-drv/enumerate.c.asm b/Source/HBIOS/ch376-native/base-drv/enumerate.c.asm new file mode 100644 index 00000000..5fbd81a5 --- /dev/null +++ b/Source/HBIOS/ch376-native/base-drv/enumerate.c.asm @@ -0,0 +1,1472 @@ +;-------------------------------------------------------- +; File Created by SDCC : free open source ISO C Compiler +; Version 4.4.0 #14648 (Linux) +;-------------------------------------------------------- +; Processed by Z88DK +;-------------------------------------------------------- + + EXTERN __divschar + EXTERN __divschar_callee + EXTERN __divsint + EXTERN __divsint_callee + EXTERN __divslong + EXTERN __divslong_callee + EXTERN __divslonglong + EXTERN __divslonglong_callee + EXTERN __divsuchar + EXTERN __divsuchar_callee + EXTERN __divuchar + EXTERN __divuchar_callee + EXTERN __divuint + EXTERN __divuint_callee + EXTERN __divulong + EXTERN __divulong_callee + EXTERN __divulonglong + EXTERN __divulonglong_callee + EXTERN __divuschar + EXTERN __divuschar_callee + EXTERN __modschar + EXTERN __modschar_callee + EXTERN __modsint + EXTERN __modsint_callee + EXTERN __modslong + EXTERN __modslong_callee + EXTERN __modslonglong + EXTERN __modslonglong_callee + EXTERN __modsuchar + EXTERN __modsuchar_callee + EXTERN __moduchar + EXTERN __moduchar_callee + EXTERN __moduint + EXTERN __moduint_callee + EXTERN __modulong + EXTERN __modulong_callee + EXTERN __modulonglong + EXTERN __modulonglong_callee + EXTERN __moduschar + EXTERN __moduschar_callee + EXTERN __mulint + EXTERN __mulint_callee + EXTERN __mullong + EXTERN __mullong_callee + EXTERN __mullonglong + EXTERN __mullonglong_callee + EXTERN __mulschar + EXTERN __mulschar_callee + EXTERN __mulsuchar + EXTERN __mulsuchar_callee + EXTERN __muluchar + EXTERN __muluchar_callee + EXTERN __muluschar + EXTERN __muluschar_callee + EXTERN __rlslonglong + EXTERN __rlslonglong_callee + EXTERN __rlulonglong + EXTERN __rlulonglong_callee + EXTERN __rrslonglong + EXTERN __rrslonglong_callee + EXTERN __rrulonglong + EXTERN __rrulonglong_callee + EXTERN ___mulsint2slong + EXTERN ___mulsint2slong_callee + EXTERN ___muluint2ulong + EXTERN ___muluint2ulong_callee + EXTERN ___sdcc_call_hl + EXTERN ___sdcc_call_iy + EXTERN ___sdcc_enter_ix + EXTERN banked_call + EXTERN _banked_ret + EXTERN ___fs2schar + EXTERN ___fs2schar_callee + EXTERN ___fs2sint + EXTERN ___fs2sint_callee + EXTERN ___fs2slong + EXTERN ___fs2slong_callee + EXTERN ___fs2slonglong + EXTERN ___fs2slonglong_callee + EXTERN ___fs2uchar + EXTERN ___fs2uchar_callee + EXTERN ___fs2uint + EXTERN ___fs2uint_callee + EXTERN ___fs2ulong + EXTERN ___fs2ulong_callee + EXTERN ___fs2ulonglong + EXTERN ___fs2ulonglong_callee + EXTERN ___fsadd + EXTERN ___fsadd_callee + EXTERN ___fsdiv + EXTERN ___fsdiv_callee + EXTERN ___fseq + EXTERN ___fseq_callee + EXTERN ___fsgt + EXTERN ___fsgt_callee + EXTERN ___fslt + EXTERN ___fslt_callee + EXTERN ___fsmul + EXTERN ___fsmul_callee + EXTERN ___fsneq + EXTERN ___fsneq_callee + EXTERN ___fssub + EXTERN ___fssub_callee + EXTERN ___schar2fs + EXTERN ___schar2fs_callee + EXTERN ___sint2fs + EXTERN ___sint2fs_callee + EXTERN ___slong2fs + EXTERN ___slong2fs_callee + EXTERN ___slonglong2fs + EXTERN ___slonglong2fs_callee + EXTERN ___uchar2fs + EXTERN ___uchar2fs_callee + EXTERN ___uint2fs + EXTERN ___uint2fs_callee + EXTERN ___ulong2fs + EXTERN ___ulong2fs_callee + EXTERN ___ulonglong2fs + EXTERN ___ulonglong2fs_callee + EXTERN ____sdcc_2_copy_src_mhl_dst_deix + EXTERN ____sdcc_2_copy_src_mhl_dst_bcix + EXTERN ____sdcc_4_copy_src_mhl_dst_deix + EXTERN ____sdcc_4_copy_src_mhl_dst_bcix + EXTERN ____sdcc_4_copy_src_mhl_dst_mbc + EXTERN ____sdcc_4_ldi_nosave_bc + EXTERN ____sdcc_4_ldi_save_bc + EXTERN ____sdcc_4_push_hlix + EXTERN ____sdcc_4_push_mhl + EXTERN ____sdcc_lib_setmem_hl + EXTERN ____sdcc_ll_add_de_bc_hl + EXTERN ____sdcc_ll_add_de_bc_hlix + EXTERN ____sdcc_ll_add_de_hlix_bc + EXTERN ____sdcc_ll_add_de_hlix_bcix + EXTERN ____sdcc_ll_add_deix_bc_hl + EXTERN ____sdcc_ll_add_deix_hlix + EXTERN ____sdcc_ll_add_hlix_bc_deix + EXTERN ____sdcc_ll_add_hlix_deix_bc + EXTERN ____sdcc_ll_add_hlix_deix_bcix + EXTERN ____sdcc_ll_asr_hlix_a + EXTERN ____sdcc_ll_asr_mbc_a + EXTERN ____sdcc_ll_copy_src_de_dst_hlix + EXTERN ____sdcc_ll_copy_src_de_dst_hlsp + EXTERN ____sdcc_ll_copy_src_deix_dst_hl + EXTERN ____sdcc_ll_copy_src_deix_dst_hlix + EXTERN ____sdcc_ll_copy_src_deixm_dst_hlsp + EXTERN ____sdcc_ll_copy_src_desp_dst_hlsp + EXTERN ____sdcc_ll_copy_src_hl_dst_de + EXTERN ____sdcc_ll_copy_src_hlsp_dst_de + EXTERN ____sdcc_ll_copy_src_hlsp_dst_deixm + EXTERN ____sdcc_ll_lsl_hlix_a + EXTERN ____sdcc_ll_lsl_mbc_a + EXTERN ____sdcc_ll_lsr_hlix_a + EXTERN ____sdcc_ll_lsr_mbc_a + EXTERN ____sdcc_ll_push_hlix + EXTERN ____sdcc_ll_push_mhl + EXTERN ____sdcc_ll_sub_de_bc_hl + EXTERN ____sdcc_ll_sub_de_bc_hlix + EXTERN ____sdcc_ll_sub_de_hlix_bc + EXTERN ____sdcc_ll_sub_de_hlix_bcix + EXTERN ____sdcc_ll_sub_deix_bc_hl + EXTERN ____sdcc_ll_sub_deix_hlix + EXTERN ____sdcc_ll_sub_hlix_bc_deix + EXTERN ____sdcc_ll_sub_hlix_deix_bc + EXTERN ____sdcc_ll_sub_hlix_deix_bcix + EXTERN ____sdcc_load_debc_deix + EXTERN ____sdcc_load_dehl_deix + EXTERN ____sdcc_load_debc_mhl + EXTERN ____sdcc_load_hlde_mhl + EXTERN ____sdcc_store_dehl_bcix + EXTERN ____sdcc_store_debc_hlix + EXTERN ____sdcc_store_debc_mhl + EXTERN ____sdcc_cpu_pop_ei + EXTERN ____sdcc_cpu_pop_ei_jp + EXTERN ____sdcc_cpu_push_di + EXTERN ____sdcc_outi + EXTERN ____sdcc_outi_128 + EXTERN ____sdcc_outi_256 + EXTERN ____sdcc_ldi + EXTERN ____sdcc_ldi_128 + EXTERN ____sdcc_ldi_256 + EXTERN ____sdcc_4_copy_srcd_hlix_dst_deix + EXTERN ____sdcc_4_and_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_or_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_or_src_dehl_dst_bcix + EXTERN ____sdcc_4_xor_src_dehl_dst_bcix + EXTERN ____sdcc_4_and_src_dehl_dst_bcix + EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_or_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_cpl_src_mhl_dst_debc + EXTERN ____sdcc_4_xor_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_or_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_debc_hlix_dst_debc + EXTERN ____sdcc_4_or_src_debc_hlix_dst_debc + EXTERN ____sdcc_4_xor_src_debc_hlix_dst_debc + +;-------------------------------------------------------- +; Public variables in this module +;-------------------------------------------------------- + GLOBAL _op_get_cfg_desc + GLOBAL _op_cap_drv_intf + GLOBAL _op_capture_hub_driver_interface + GLOBAL _configure_device + GLOBAL _op_endpoint_next + GLOBAL _op_interface_next + GLOBAL _identify_class_driver + GLOBAL _parse_endpoint_keyboard + GLOBAL _op_parse_endpoint + GLOBAL _op_id_class_drv + GLOBAL _read_all_configs + GLOBAL _enumerate_all_devices +;-------------------------------------------------------- +; Externals used +;-------------------------------------------------------- + GLOBAL _print_uint16 + GLOBAL _print_string + GLOBAL _print_hex + GLOBAL _ffsll_callee + GLOBAL _ffsll + GLOBAL _strxfrm_callee + GLOBAL _strxfrm + GLOBAL _strupr_fastcall + GLOBAL _strupr + GLOBAL _strtok_r_callee + GLOBAL _strtok_r + GLOBAL _strtok_callee + GLOBAL _strtok + GLOBAL _strstrip_fastcall + GLOBAL _strstrip + GLOBAL _strstr_callee + GLOBAL _strstr + GLOBAL _strspn_callee + GLOBAL _strspn + GLOBAL _strsep_callee + GLOBAL _strsep + GLOBAL _strrstrip_fastcall + GLOBAL _strrstrip + GLOBAL _strrstr_callee + GLOBAL _strrstr + GLOBAL _strrspn_callee + GLOBAL _strrspn + GLOBAL _strrev_fastcall + GLOBAL _strrev + GLOBAL _strrcspn_callee + GLOBAL _strrcspn + GLOBAL _strrchr_callee + GLOBAL _strrchr + GLOBAL _strpbrk_callee + GLOBAL _strpbrk + GLOBAL _strnlen_callee + GLOBAL _strnlen + GLOBAL _strnicmp_callee + GLOBAL _strnicmp + GLOBAL _strndup_callee + GLOBAL _strndup + GLOBAL _strncpy_callee + GLOBAL _strncpy + GLOBAL _strncmp_callee + GLOBAL _strncmp + GLOBAL _strnchr_callee + GLOBAL _strnchr + GLOBAL _strncat_callee + GLOBAL _strncat + GLOBAL _strncasecmp_callee + GLOBAL _strncasecmp + GLOBAL _strlwr_fastcall + GLOBAL _strlwr + GLOBAL _strlen_fastcall + GLOBAL _strlen + GLOBAL _strlcpy_callee + GLOBAL _strlcpy + GLOBAL _strlcat_callee + GLOBAL _strlcat + GLOBAL _stricmp_callee + GLOBAL _stricmp + GLOBAL _strerror_fastcall + GLOBAL _strerror + GLOBAL _strdup_fastcall + GLOBAL _strdup + GLOBAL _strcspn_callee + GLOBAL _strcspn + GLOBAL _strcpy_callee + GLOBAL _strcpy + GLOBAL _strcoll_callee + GLOBAL _strcoll + GLOBAL _strcmp_callee + GLOBAL _strcmp + GLOBAL _strchrnul_callee + GLOBAL _strchrnul + GLOBAL _strchr_callee + GLOBAL _strchr + GLOBAL _strcat_callee + GLOBAL _strcat + GLOBAL _strcasecmp_callee + GLOBAL _strcasecmp + GLOBAL _stpncpy_callee + GLOBAL _stpncpy + GLOBAL _stpcpy_callee + GLOBAL _stpcpy + GLOBAL _memswap_callee + GLOBAL _memswap + GLOBAL _memset_wr_callee + GLOBAL _memset_wr + GLOBAL _memset_callee + GLOBAL _memset + GLOBAL _memrchr_callee + GLOBAL _memrchr + GLOBAL _memmove_callee + GLOBAL _memmove + GLOBAL _memmem_callee + GLOBAL _memmem + GLOBAL _memcpy_callee + GLOBAL _memcpy + GLOBAL _memcmp_callee + GLOBAL _memcmp + GLOBAL _memchr_callee + GLOBAL _memchr + GLOBAL _memccpy_callee + GLOBAL _memccpy + GLOBAL _ffsl_fastcall + GLOBAL _ffsl + GLOBAL _ffs_fastcall + GLOBAL _ffs + GLOBAL __strrstrip__fastcall + GLOBAL __strrstrip_ + GLOBAL __memupr__callee + GLOBAL __memupr_ + GLOBAL __memstrcpy__callee + GLOBAL __memstrcpy_ + GLOBAL __memlwr__callee + GLOBAL __memlwr_ + GLOBAL _rawmemchr_callee + GLOBAL _rawmemchr + GLOBAL _strnset_callee + GLOBAL _strnset + GLOBAL _strset_callee + GLOBAL _strset + GLOBAL _rindex_callee + GLOBAL _rindex + GLOBAL _index_callee + GLOBAL _index + GLOBAL _bzero_callee + GLOBAL _bzero + GLOBAL _bcopy_callee + GLOBAL _bcopy + GLOBAL _bcmp_callee + GLOBAL _bcmp + GLOBAL _get_number_of_usb_drives + GLOBAL _parse_endpoints + GLOBAL _configure_usb_hub + GLOBAL _get_usb_device_config + GLOBAL _find_device_config + GLOBAL _next_device_config + GLOBAL _first_device_config + GLOBAL _find_first_free + GLOBAL _usbtrn_clear_endpoint_halt + GLOBAL _usbtrn_set_address + GLOBAL _usbtrn_set_configuration + GLOBAL _usbtrn_gfull_cfg_desc + GLOBAL _usbtrn_get_config_descriptor + GLOBAL _usbtrn_get_descriptor2 + GLOBAL _usbtrn_get_descriptor + GLOBAL _usbdev_dat_in_trnsfer_0 + GLOBAL _usbdev_dat_in_trnsfer + GLOBAL _usbdev_bulk_in_transfer + GLOBAL _usbdev_blk_out_trnsfer + GLOBAL _usbdev_control_transfer + GLOBAL _usb_data_out_transfer + GLOBAL _usb_data_in_transfer_n + GLOBAL _usb_data_in_transfer + GLOBAL _usb_control_transfer + GLOBAL _ch_issue_token_in_ep0 + GLOBAL _ch_issue_token_out_ep0 + GLOBAL _ch_issue_token_setup + GLOBAL _ch_data_out_transfer + GLOBAL _ch_data_in_transfer_n + GLOBAL _ch_data_in_transfer + GLOBAL _ch_control_transfer_set_config + GLOBAL _ch_control_transfer_set_address + GLOBAL _ch_control_transfer_request_descriptor + GLOBAL _ch_set_usb_address + GLOBAL _ch_write_data + GLOBAL _ch_cmd_get_ic_version + GLOBAL _ch_cmd_set_usb_mode + GLOBAL _ch_probe + GLOBAL _ch_cmd_reset_all + GLOBAL _ch_read_data + GLOBAL _ch_very_short_wait_int_and_get_status + GLOBAL _ch_short_wait_int_and_get_status + GLOBAL _ch_long_wait_int_and_get_status + GLOBAL _ch_get_status + GLOBAL _ch_command + GLOBAL _delay_medium + GLOBAL _delay_short + GLOBAL _delay_20ms + GLOBAL _printf + GLOBAL _delay + GLOBAL _ulltoa_callee + GLOBAL _ulltoa + GLOBAL _strtoull_callee + GLOBAL _strtoull + GLOBAL _strtoll_callee + GLOBAL _strtoll + GLOBAL _lltoa_callee + GLOBAL _lltoa + GLOBAL _llabs_callee + GLOBAL _llabs + GLOBAL __lldivu__callee + GLOBAL __lldivu_ + GLOBAL __lldiv__callee + GLOBAL __lldiv_ + GLOBAL _atoll_callee + GLOBAL _atoll + GLOBAL _realloc_unlocked_callee + GLOBAL _realloc_unlocked + GLOBAL _malloc_unlocked_fastcall + GLOBAL _malloc_unlocked + GLOBAL _free_unlocked_fastcall + GLOBAL _free_unlocked + GLOBAL _calloc_unlocked_callee + GLOBAL _calloc_unlocked + GLOBAL _aligned_alloc_unlocked_callee + GLOBAL _aligned_alloc_unlocked + GLOBAL _realloc_callee + GLOBAL _realloc + GLOBAL _malloc_fastcall + GLOBAL _malloc + GLOBAL _free_fastcall + GLOBAL _free + GLOBAL _calloc_callee + GLOBAL _calloc + GLOBAL _aligned_alloc_callee + GLOBAL _aligned_alloc + GLOBAL _utoa_callee + GLOBAL _utoa + GLOBAL _ultoa_callee + GLOBAL _ultoa + GLOBAL _system_fastcall + GLOBAL _system + GLOBAL _strtoul_callee + GLOBAL _strtoul + GLOBAL _strtol_callee + GLOBAL _strtol + GLOBAL _strtof_callee + GLOBAL _strtof + GLOBAL _strtod_callee + GLOBAL _strtod + GLOBAL _srand_fastcall + GLOBAL _srand + GLOBAL _rand + GLOBAL _quick_exit_fastcall + GLOBAL _quick_exit + GLOBAL _qsort_callee + GLOBAL _qsort + GLOBAL _ltoa_callee + GLOBAL _ltoa + GLOBAL _labs_fastcall + GLOBAL _labs + GLOBAL _itoa_callee + GLOBAL _itoa + GLOBAL _ftoh_callee + GLOBAL _ftoh + GLOBAL _ftog_callee + GLOBAL _ftog + GLOBAL _ftoe_callee + GLOBAL _ftoe + GLOBAL _ftoa_callee + GLOBAL _ftoa + GLOBAL _exit_fastcall + GLOBAL _exit + GLOBAL _dtoh_callee + GLOBAL _dtoh + GLOBAL _dtog_callee + GLOBAL _dtog + GLOBAL _dtoe_callee + GLOBAL _dtoe + GLOBAL _dtoa_callee + GLOBAL _dtoa + GLOBAL _bsearch_callee + GLOBAL _bsearch + GLOBAL _atol_fastcall + GLOBAL _atol + GLOBAL _atoi_fastcall + GLOBAL _atoi + GLOBAL _atof_fastcall + GLOBAL _atof + GLOBAL _atexit_fastcall + GLOBAL _atexit + GLOBAL _at_quick_exit_fastcall + GLOBAL _at_quick_exit + GLOBAL _abs_fastcall + GLOBAL _abs + GLOBAL _abort + GLOBAL __strtou__callee + GLOBAL __strtou_ + GLOBAL __strtoi__callee + GLOBAL __strtoi_ + GLOBAL __random_uniform_xor_8__fastcall + GLOBAL __random_uniform_xor_8_ + GLOBAL __random_uniform_xor_32__fastcall + GLOBAL __random_uniform_xor_32_ + GLOBAL __random_uniform_cmwc_8__fastcall + GLOBAL __random_uniform_cmwc_8_ + GLOBAL __shellsort__callee + GLOBAL __shellsort_ + GLOBAL __quicksort__callee + GLOBAL __quicksort_ + GLOBAL __insertion_sort__callee + GLOBAL __insertion_sort_ + GLOBAL __ldivu__callee + GLOBAL __ldivu_ + GLOBAL __ldiv__callee + GLOBAL __ldiv_ + GLOBAL __divu__callee + GLOBAL __divu_ + GLOBAL __div__callee + GLOBAL __div_ + GLOBAL _x + GLOBAL _result +;-------------------------------------------------------- +; special function registers +;-------------------------------------------------------- +defc _CH376_DATA_PORT = 0xff88 +defc _CH376_COMMAND_PORT = 0xff89 +defc _USB_MODULE_LEDS = 0xff8a +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + SECTION bss_compiler +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + +IF 0 + +; .area _INITIALIZED removed by z88dk + + +ENDIF + +;-------------------------------------------------------- +; absolute external ram data +;-------------------------------------------------------- + SECTION IGNORE +;-------------------------------------------------------- +; global & static initialisations +;-------------------------------------------------------- + SECTION code_crt_init +;-------------------------------------------------------- +; Home +;-------------------------------------------------------- + SECTION IGNORE +;-------------------------------------------------------- +; code +;-------------------------------------------------------- + SECTION code_compiler +;source-doc/base-drv/enumerate.c:13: void parse_endpoint_keyboard(device_config_keyboard *const keyboard_config, const endpoint_descriptor const *pEndpoint) +; --------------------------------- +; Function parse_endpoint_keyboard +; --------------------------------- +_parse_endpoint_keyboard: + push ix + ld ix,0 + add ix,sp + push af +;source-doc/base-drv/enumerate.c:15: endpoint_param *const ep = &keyboard_config->endpoints[0]; + inc hl + inc hl + inc hl +;source-doc/base-drv/enumerate.c:16: ep->number = pEndpoint->bEndpointAddress; + ld c,l + ld b,h + ex (sp),hl + ld l, e + ld h, d + inc hl + inc hl + ld a, (hl) + pop hl + push hl + rlca + and a,0x0e + push bc + ld c, a + ld a, (hl) + and a,0xf1 + or a, c + ld (hl), a +;source-doc/base-drv/enumerate.c:17: ep->toggle = 0; + pop hl + ld c,l + ld b,h + res 0, (hl) +;source-doc/base-drv/enumerate.c:18: ep->max_packet_sizex = calc_max_packet_sizex(pEndpoint->wMaxPacketSize); + inc bc + ld hl,4 + add hl, de + ld e, (hl) + inc hl + ld a, (hl) + and a,0x03 + ld d, a + ld a, e + ld (bc), a + inc bc + ld a, d + and a,0x03 + ld l,a + ld a, (bc) + and a,0xfc + or a, l + ld (bc), a +;source-doc/base-drv/enumerate.c:19: } + ld sp, ix + pop ix + ret +;source-doc/base-drv/enumerate.c:21: usb_device_type identify_class_driver(_working *const working) { +; --------------------------------- +; Function identify_class_driver +; --------------------------------- +_identify_class_driver: + push ix + ld ix,0 + add ix,sp +;source-doc/base-drv/enumerate.c:22: const interface_descriptor *const p = (const interface_descriptor *)working->ptr; + ld c,(ix+4) + ld b,(ix+5) + ld hl,27 + add hl, bc + ld c, (hl) + inc hl + ld b, (hl) +;source-doc/base-drv/enumerate.c:23: if (p->bInterfaceClass == 2) + ld hl,5 + add hl,bc + ld a,(hl) + ld e,a + sub a,0x02 + jr NZ,l_identify_class_driver_00102 +;source-doc/base-drv/enumerate.c:24: return USB_IS_CDC; + ld l,0x03 + jr l_identify_class_driver_00118 +l_identify_class_driver_00102: +;source-doc/base-drv/enumerate.c:26: if (p->bInterfaceClass == 8 && (p->bInterfaceSubClass == 6 || p->bInterfaceSubClass == 5) && p->bInterfaceProtocol == 80) + ld a, e + sub a,0x08 + jr NZ,l_identify_class_driver_00199 + ld a,0x01 + jr l_identify_class_driver_00200 +l_identify_class_driver_00199: + xor a,a +l_identify_class_driver_00200: + ld d,a + or a, a + jr Z,l_identify_class_driver_00104 + ld hl,0x0006 + add hl,bc + ld a, (hl) + cp a,0x06 + jr Z,l_identify_class_driver_00107 + sub a,0x05 + jr NZ,l_identify_class_driver_00104 +l_identify_class_driver_00107: + ld hl,0x0007 + add hl,bc + ld a, (hl) + sub a,0x50 + jr NZ,l_identify_class_driver_00104 +;source-doc/base-drv/enumerate.c:27: return USB_IS_MASS_STORAGE; + ld l,0x02 + jr l_identify_class_driver_00118 +l_identify_class_driver_00104: +;source-doc/base-drv/enumerate.c:29: if (p->bInterfaceClass == 8 && p->bInterfaceSubClass == 4 && p->bInterfaceProtocol == 0) + ld a, d + or a, a + jr Z,l_identify_class_driver_00109 + ld hl,0x0006 + add hl,bc + ld a, (hl) + sub a,0x04 + jr NZ,l_identify_class_driver_00109 + ld hl,0x0007 + add hl,bc + ld a, (hl) + or a, a + jr NZ,l_identify_class_driver_00109 +;source-doc/base-drv/enumerate.c:30: return USB_IS_FLOPPY; + ld l,0x01 + jr l_identify_class_driver_00118 +l_identify_class_driver_00109: +;source-doc/base-drv/enumerate.c:32: if (p->bInterfaceClass == 9 && p->bInterfaceSubClass == 0 && p->bInterfaceProtocol == 0) + ld a, e + sub a,0x09 + jr NZ,l_identify_class_driver_00113 + ld hl,0x0006 + add hl,bc + ld a, (hl) + or a, a + jr NZ,l_identify_class_driver_00113 + ld hl,7 + add hl, bc + ld a, (hl) + or a, a + jr NZ,l_identify_class_driver_00113 +;source-doc/base-drv/enumerate.c:33: return USB_IS_HUB; + ld l,0x0f + jr l_identify_class_driver_00118 +l_identify_class_driver_00113: +;source-doc/base-drv/enumerate.c:35: if (p->bInterfaceClass == 3) + ld a, e + sub a,0x03 + jr NZ,l_identify_class_driver_00117 +;source-doc/base-drv/enumerate.c:36: return USB_IS_KEYBOARD; + ld l,0x04 + jr l_identify_class_driver_00118 +l_identify_class_driver_00117: +;source-doc/base-drv/enumerate.c:38: return USB_IS_UNKNOWN; + ld l,0x06 +l_identify_class_driver_00118: +;source-doc/base-drv/enumerate.c:39: } + pop ix + ret +;source-doc/base-drv/enumerate.c:41: usb_error op_interface_next(_working *const working) __z88dk_fastcall { +; --------------------------------- +; Function op_interface_next +; --------------------------------- +_op_interface_next: + ex de, hl +;source-doc/base-drv/enumerate.c:42: if (--working->interface_count == 0) + ld hl,0x0016 + add hl, de + ld a, (hl) + dec a + ld (hl), a +;source-doc/base-drv/enumerate.c:43: return USB_ERR_OK; + or a,a + jr NZ,l_op_interface_next_00102 + ld l,a + jr l_op_interface_next_00103 +l_op_interface_next_00102: +;source-doc/base-drv/enumerate.c:45: return op_id_class_drv(working); + ex de, hl + call _op_id_class_drv + ld l, a +l_op_interface_next_00103: +;source-doc/base-drv/enumerate.c:46: } + ret +;source-doc/base-drv/enumerate.c:48: usb_error op_endpoint_next(_working *const working) __sdcccall(1) { +; --------------------------------- +; Function op_endpoint_next +; --------------------------------- +_op_endpoint_next: + ex de, hl +;source-doc/base-drv/enumerate.c:49: if (--working->endpoint_count > 0) { + ld hl,0x0017 + add hl, de + ld a, (hl) + dec a + ld (hl), a + or a, a + jr Z,l_op_endpoint_next_00102 +;source-doc/base-drv/enumerate.c:50: working->ptr += ((endpoint_descriptor *)working->ptr)->bLength; + ld hl,0x001b + add hl, de + ld c, (hl) + inc hl + ld b, (hl) + dec hl + ld a, (bc) + add a, c + ld c, a + ld a,0x00 + adc a, b + ld (hl), c + inc hl + ld (hl), a +;source-doc/base-drv/enumerate.c:51: return op_parse_endpoint(working); + ex de, hl + jp _op_parse_endpoint + jr l_op_endpoint_next_00103 +l_op_endpoint_next_00102: +;source-doc/base-drv/enumerate.c:54: return op_interface_next(working); + ex de, hl + call _op_interface_next + ld a, l +l_op_endpoint_next_00103: +;source-doc/base-drv/enumerate.c:55: } + ret +;source-doc/base-drv/enumerate.c:57: usb_error op_parse_endpoint(_working *const working) __sdcccall(1) { +; --------------------------------- +; Function op_parse_endpoint +; --------------------------------- +_op_parse_endpoint: + push ix + ld ix,0 + add ix,sp + push af +;source-doc/base-drv/enumerate.c:58: const endpoint_descriptor *endpoint = (endpoint_descriptor *)working->ptr; + ld de,0x001c + ld c,l + ld b,h + add hl, de + ld a, (hl) + dec hl + ld l, (hl) + ld (ix-2),l + ld (ix-1),a +;source-doc/base-drv/enumerate.c:59: device_config *const device = working->p_current_device; + ld hl,29 + add hl,bc + ld e, (hl) + inc hl + ld d, (hl) +;source-doc/base-drv/enumerate.c:61: switch (working->usb_device) { + ld l, c + ld h, b + inc hl + inc hl + ld a, (hl) + cp a,0x01 + jr Z,l_op_parse_endpoint_00102 + cp a,0x02 + jr Z,l_op_parse_endpoint_00102 + sub a,0x04 + jr Z,l_op_parse_endpoint_00103 + jr l_op_parse_endpoint_00104 +;source-doc/base-drv/enumerate.c:63: case USB_IS_MASS_STORAGE: { +l_op_parse_endpoint_00102: +;source-doc/base-drv/enumerate.c:64: parse_endpoints(device, endpoint); + push bc + ld l,(ix-2) + ld h,(ix-1) + push hl + push de + call _parse_endpoints + pop af + pop af + pop bc +;source-doc/base-drv/enumerate.c:65: break; + jr l_op_parse_endpoint_00104 +;source-doc/base-drv/enumerate.c:68: case USB_IS_KEYBOARD: { +l_op_parse_endpoint_00103: +;source-doc/base-drv/enumerate.c:69: parse_endpoint_keyboard((device_config_keyboard *)device, endpoint); + ex de, hl + push bc + ld e,(ix-2) + ld d,(ix-1) + call _parse_endpoint_keyboard + pop bc +;source-doc/base-drv/enumerate.c:72: } +l_op_parse_endpoint_00104: +;source-doc/base-drv/enumerate.c:74: return op_endpoint_next(working); + ld l, c + ld h, b + call _op_endpoint_next +;source-doc/base-drv/enumerate.c:75: } + ld sp, ix + pop ix + ret +;source-doc/base-drv/enumerate.c:78: configure_device(const _working *const working, const interface_descriptor *const interface, device_config *const dev_cfg) { +; --------------------------------- +; Function configure_device +; --------------------------------- +_configure_device: + push ix + ld ix,0 + add ix,sp + push af + push af +;source-doc/base-drv/enumerate.c:79: dev_cfg->interface_number = interface->bInterfaceNumber; + ld a,(ix+8) + ld (ix-4),a + ld a,(ix+9) + ld (ix-3),a + pop bc + push bc + inc bc + inc bc + ld e,(ix+6) + ld d,(ix+7) + inc de + inc de + ld a, (de) + ld (bc), a +;source-doc/base-drv/enumerate.c:80: dev_cfg->max_packet_size = working->desc.bMaxPacketSize0; + ld a,(ix-4) + add a,0x01 + ld (ix-2),a + ld a,(ix-3) + adc a,0x00 + ld (ix-1),a + ld c,(ix+4) + ld b,(ix+5) + ld hl,10 + add hl,bc + ld a, (hl) + pop de + pop hl + push hl +;source-doc/base-drv/enumerate.c:81: dev_cfg->address = working->current_device_address; + ld (hl),a + push de + ld hl,0x0018 + add hl,bc + ld a, (hl) + add a, a + add a, a + add a, a + add a, a + ld l, a + ld a, (de) + and a,0x0f + or a, l + ld (de), a +;source-doc/base-drv/enumerate.c:82: dev_cfg->type = working->usb_device; + pop de + push de + ld l, c + ld h, b + inc hl + inc hl + ld a, (hl) + and a,0x0f + ld l, a + ld a, (de) + and a,0xf0 + or a, l + ld (de), a +;source-doc/base-drv/enumerate.c:84: return usbtrn_set_configuration(dev_cfg->address, dev_cfg->max_packet_size, working->config.desc.bConfigurationvalue); + ld hl,36 + add hl, bc + ld b, (hl) + ld l,(ix-2) + ld h,(ix-1) + ld d, (hl) + pop hl + ld a,(hl) + push hl + rlca + rlca + rlca + rlca + and a,0x0f + ld c, d + push bc + push af + inc sp + call _usbtrn_set_configuration +;source-doc/base-drv/enumerate.c:85: } + ld sp,ix + pop ix + ret +;source-doc/base-drv/enumerate.c:87: usb_error op_capture_hub_driver_interface(_working *const working) __sdcccall(1) { +; --------------------------------- +; Function op_capture_hub_driver_interface +; --------------------------------- +_op_capture_hub_driver_interface: + push ix + ld ix,0 + add ix,sp + push af + push af + push af + dec sp + ex de, hl +;source-doc/base-drv/enumerate.c:88: const interface_descriptor *const interface = (interface_descriptor *)working->ptr; + ld hl,0x001c + add hl,de + ld a, (hl) + dec hl + ld l, (hl) + ld (ix-4),l + ld (ix-3),a +;source-doc/base-drv/enumerate.c:92: working->hub_config = &hub_config; + ld hl,0x0019 + add hl, de + ld (ix-2),l + ld (ix-1),h + ld hl,0 + add hl, sp + ld c, l + ld l,(ix-2) + ld b,h + ld h,(ix-1) + ld (hl), c + inc hl + ld (hl), b +;source-doc/base-drv/enumerate.c:94: hub_config.type = USB_IS_HUB; + ld hl,0 + add hl, sp + ld a, (hl) + or a,0x0f + ld (hl), a +;source-doc/base-drv/enumerate.c:95: CHECK(configure_device(working, interface, (device_config *const)&hub_config)); + push de + ld hl,2 + add hl, sp + push hl + ld l,(ix-4) + ld h,(ix-3) + push hl + push de + call _configure_device + pop af + pop af + pop af + pop de + ld a, l + inc l + dec l + jr NZ,l_op_capture_hub_driver_interface_00103 +;source-doc/base-drv/enumerate.c:96: RETURN_CHECK(configure_usb_hub(working)); + ex de, hl + call _configure_usb_hub + ld a, l +;source-doc/base-drv/enumerate.c:97: done: +l_op_capture_hub_driver_interface_00103: +;source-doc/base-drv/enumerate.c:98: return result; +;source-doc/base-drv/enumerate.c:99: } + ld sp, ix + pop ix + ret +;source-doc/base-drv/enumerate.c:101: usb_error op_cap_drv_intf(_working *const working) __z88dk_fastcall { +; --------------------------------- +; Function op_cap_drv_intf +; --------------------------------- +_op_cap_drv_intf: + push ix + ld ix,0 + add ix,sp + ld c, l + ld b, h + ld hl, -16 + add hl, sp + ld sp, hl +;source-doc/base-drv/enumerate.c:104: const interface_descriptor *const interface = (interface_descriptor *)working->ptr; + ld (ix-2),c + ld l, c + ld (ix-1),b + ld h,b + ld de,0x001b + add hl, de + ld e, (hl) + inc hl + ld d, (hl) + dec hl + ld c, e + ld b, d +;source-doc/base-drv/enumerate.c:106: working->ptr += interface->bLength; + ld a, (bc) + add a, e + ld e, a + ld a,0x00 + adc a, d + ld (hl), e + inc hl + ld (hl), a +;source-doc/base-drv/enumerate.c:107: working->endpoint_count = interface->bNumEndpoints; + ld a,(ix-2) + add a,0x17 + ld e, a + ld a,(ix-1) + adc a,0x00 + ld d, a + ld l, c + ld h, b + inc hl + inc hl + inc hl + inc hl + ld a, (hl) + ld (de), a +;source-doc/base-drv/enumerate.c:108: working->p_current_device = NULL; + ld a,(ix-2) + add a,0x1d + ld (ix-4),a + ld l,a + ld a,(ix-1) + adc a,0x00 + ld (ix-3),a + ld h,a + xor a, a + ld (hl), a + inc hl + ld (hl), a +;source-doc/base-drv/enumerate.c:110: switch (working->usb_device) { + ld l,(ix-2) + ld h,(ix-1) + inc hl + inc hl + ld a, (hl) + cp a,0x06 + jr Z,l_op_cap_drv_intf_00104 + sub a,0x0f + jr NZ,l_op_cap_drv_intf_00107 +;source-doc/base-drv/enumerate.c:112: CHECK(op_capture_hub_driver_interface(working)) + ld l,(ix-2) + ld h,(ix-1) + call _op_capture_hub_driver_interface + or a, a + jr Z,l_op_cap_drv_intf_00112 + jr l_op_cap_drv_intf_00113 +;source-doc/base-drv/enumerate.c:116: case USB_IS_UNKNOWN: { +l_op_cap_drv_intf_00104: +;source-doc/base-drv/enumerate.c:118: memset(&unkown_dev_cfg, 0, sizeof(device_config)); + push bc + ld hl,2 + add hl, sp + ld b,0x06 +l_op_cap_drv_intf_00154: + xor a, a + ld (hl), a + inc hl + ld (hl), a + inc hl + djnz l_op_cap_drv_intf_00154 + pop bc +;source-doc/base-drv/enumerate.c:119: working->p_current_device = &unkown_dev_cfg; + ld hl,0 + add hl, sp + ex de, hl + ld l,(ix-4) + ld h,(ix-3) + ld (hl), e + inc hl + ld (hl), d +;source-doc/base-drv/enumerate.c:120: CHECK(configure_device(working, interface, &unkown_dev_cfg)); + ld hl,0 + add hl, sp + push hl + push bc + ld l,(ix-2) + ld h,(ix-1) + push hl + call _configure_device + pop af + pop af + pop af + ld a, l + or a, a + jr Z,l_op_cap_drv_intf_00112 + jr l_op_cap_drv_intf_00113 +;source-doc/base-drv/enumerate.c:124: default: { +l_op_cap_drv_intf_00107: +;source-doc/base-drv/enumerate.c:125: device_config *dev_cfg = find_first_free(); + push bc + call _find_first_free +;source-doc/base-drv/enumerate.c:126: if (dev_cfg == NULL) + pop bc + ld a,h + or a,l + ex de,hl + jr NZ,l_op_cap_drv_intf_00109 +;source-doc/base-drv/enumerate.c:127: return USB_ERR_OUT_OF_MEMORY; + ld l,0x83 + jr l_op_cap_drv_intf_00114 +l_op_cap_drv_intf_00109: +;source-doc/base-drv/enumerate.c:128: working->p_current_device = dev_cfg; + ld l,(ix-4) + ld h,(ix-3) + ld (hl), e + inc hl + ld (hl), d +;source-doc/base-drv/enumerate.c:129: CHECK(configure_device(working, interface, dev_cfg)); + push de + push bc + ld l,(ix-2) + ld h,(ix-1) + push hl + call _configure_device + pop af + pop af + pop af + ld a, l + or a, a + jr NZ,l_op_cap_drv_intf_00113 +;source-doc/base-drv/enumerate.c:132: } +l_op_cap_drv_intf_00112: +;source-doc/base-drv/enumerate.c:134: result = op_parse_endpoint(working); + ld l,(ix-2) + ld h,(ix-1) + call _op_parse_endpoint +;source-doc/base-drv/enumerate.c:136: done: +l_op_cap_drv_intf_00113: +;source-doc/base-drv/enumerate.c:137: return result; + ld l, a +l_op_cap_drv_intf_00114: +;source-doc/base-drv/enumerate.c:138: } + ld sp, ix + pop ix + ret +;source-doc/base-drv/enumerate.c:140: usb_error op_id_class_drv(_working *const working) __sdcccall(1) { +; --------------------------------- +; Function op_id_class_drv +; --------------------------------- +_op_id_class_drv: + ex de, hl +;source-doc/base-drv/enumerate.c:141: const interface_descriptor *const ptr = (const interface_descriptor *)working->ptr; + ld hl,0x001c + add hl,de + ld a, (hl) + dec hl + ld l, (hl) +;source-doc/base-drv/enumerate.c:143: working->usb_device = ptr->bLength > 5 ? identify_class_driver(working) : 0; + ld c, e + ld b, d + inc bc + inc bc + ld h, a + ld l, (hl) + ld a,0x05 + sub a, l + jr NC,l_op_id_class_drv_00103 + push bc + push de + push de + call _identify_class_driver + pop af + ld a, l + pop de + pop bc + jr l_op_id_class_drv_00104 +l_op_id_class_drv_00103: + xor a, a +l_op_id_class_drv_00104: + ld (bc), a +;source-doc/base-drv/enumerate.c:145: return op_cap_drv_intf(working); + ex de, hl + call _op_cap_drv_intf + ld a, l +;source-doc/base-drv/enumerate.c:146: } + ret +;source-doc/base-drv/enumerate.c:148: usb_error op_get_cfg_desc(_working *const working) __sdcccall(1) { +; --------------------------------- +; Function op_get_cfg_desc +; --------------------------------- +_op_get_cfg_desc: + push ix + ld ix,0 + add ix,sp + push af + ex de, hl +;source-doc/base-drv/enumerate.c:149: memset(working->config.buffer, 0, MAX_CONFIG_SIZE); + ld hl,0x001f + add hl, de + pop af + push hl + ld b,0x46 +l_op_get_cfg_desc_00113: + xor a, a + ld (hl), a + inc hl + ld (hl), a + inc hl + djnz l_op_get_cfg_desc_00113 +;source-doc/base-drv/enumerate.c:151: const uint8_t max_packet_size = working->desc.bMaxPacketSize0; + ld c, e + ld b, d + inc bc + inc bc + inc bc + ld hl,7 + add hl, bc + ld a, (hl) +;source-doc/base-drv/enumerate.c:154: working->config.buffer)); + ld c, e + ld b, d + ld hl,24 + add hl, bc + ld b, (hl) + ld l, e + ld h, d + push bc + ld bc,0x0015 + add hl, bc + pop bc + ld c, (hl) + push de + ld l,(ix-2) + ld h,(ix-1) + push hl + ld h,0x8c + ld l,a + push hl + push bc + call _usbtrn_gfull_cfg_desc + pop af + pop af + pop af + pop de + ld a, l + ld (_result), a + ld a,(_result) + or a, a + jr NZ,l_op_get_cfg_desc_00103 +;source-doc/base-drv/enumerate.c:156: working->ptr = (working->config.buffer + sizeof(config_descriptor)); + ld hl,0x001b + add hl, de + ld a, e + add a,0x1f + ld c, a + ld a, d + adc a,0x00 + ld b, a + ld a, c + add a,0x09 + ld c, a + ld a, b + adc a,0x00 + ld (hl), c + inc hl + ld (hl), a +;source-doc/base-drv/enumerate.c:157: working->interface_count = working->config.desc.bNumInterfaces; + ld hl,0x0016 + add hl, de + ld c, l + ld b, h + pop hl + push hl + inc hl + inc hl + inc hl + inc hl + ld a, (hl) + ld (bc), a +;source-doc/base-drv/enumerate.c:159: return op_id_class_drv(working); + ex de, hl + call _op_id_class_drv + jr l_op_get_cfg_desc_00104 +;source-doc/base-drv/enumerate.c:160: done: +l_op_get_cfg_desc_00103: +;source-doc/base-drv/enumerate.c:161: return result; + ld hl,_result + ld a, (hl) +l_op_get_cfg_desc_00104: +;source-doc/base-drv/enumerate.c:162: } + ld sp, ix + pop ix + ret +;source-doc/base-drv/enumerate.c:164: usb_error read_all_configs(enumeration_state *const state) { +; --------------------------------- +; Function read_all_configs +; --------------------------------- +_read_all_configs: + push ix + ld ix,0 + add ix,sp + ld hl, -171 + add hl, sp + ld sp, hl +;source-doc/base-drv/enumerate.c:169: memset(&working, 0, sizeof(_working)); + ld hl,0 + add hl, sp + ld (hl),0x00 + ld e, l + ld d, h + inc de + ld bc,0x00aa + ldir +;source-doc/base-drv/enumerate.c:170: working.state = state; + ld a,(ix+4) + ld hl,0 + add hl, sp + ld (hl), a + ld a,(ix+5) + inc hl + ld (hl), a +;source-doc/base-drv/enumerate.c:172: CHECK(usbtrn_get_descriptor(&working.desc)); + ld hl,3 + add hl, sp + push hl + call _usbtrn_get_descriptor + pop af + ld a, l + or a, a + jr NZ,l_read_all_configs_00108 +;source-doc/base-drv/enumerate.c:174: state->next_device_address++; + ld e,(ix+4) + ld d,(ix+5) + ld a, (de) + inc a + ld c,a + ld (de), a +;source-doc/base-drv/enumerate.c:175: working.current_device_address = state->next_device_address; + ld hl,24 + add hl, sp + ld (hl), c +;source-doc/base-drv/enumerate.c:176: CHECK(usbtrn_set_address(working.current_device_address)); + ld l, c + call _usbtrn_set_address + ld a, l +;source-doc/base-drv/enumerate.c:178: for (uint8_t config_index = 0; config_index < working.desc.bNumConfigurations; config_index++) { + or a,a + jr NZ,l_read_all_configs_00108 + ld c,a +l_read_all_configs_00110: + ld hl,20 + add hl, sp + ld b, (hl) + ld a, c + sub a, b + jr NC,l_read_all_configs_00107 +;source-doc/base-drv/enumerate.c:179: working.config_index = config_index; + inc hl + ld (hl), c +;source-doc/base-drv/enumerate.c:181: CHECK(op_get_cfg_desc(&working)); + push bc + ld hl,2 + add hl, sp + call _op_get_cfg_desc + pop bc + or a, a + jr NZ,l_read_all_configs_00108 +;source-doc/base-drv/enumerate.c:178: for (uint8_t config_index = 0; config_index < working.desc.bNumConfigurations; config_index++) { + inc c + jr l_read_all_configs_00110 +l_read_all_configs_00107: +;source-doc/base-drv/enumerate.c:184: return USB_ERR_OK; + ld l,0x00 + jr l_read_all_configs_00112 +;source-doc/base-drv/enumerate.c:185: done: +l_read_all_configs_00108: +;source-doc/base-drv/enumerate.c:186: return result; + ld l, a +l_read_all_configs_00112: +;source-doc/base-drv/enumerate.c:187: } + ld sp, ix + pop ix + ret +;source-doc/base-drv/enumerate.c:189: usb_error enumerate_all_devices(void) { +; --------------------------------- +; Function enumerate_all_devices +; --------------------------------- +_enumerate_all_devices: + push ix + dec sp +;source-doc/base-drv/enumerate.c:190: _usb_state *const work_area = get_usb_work_area(); +;source-doc/base-drv/enumerate.c:192: memset(&state, 0, sizeof(enumeration_state)); + ld hl,0 + add hl, sp + ld e,l + ld d,h +;source-doc/base-drv/enumerate.c:193: state.next_device_address = 0; + xor a,a + ld (hl),a + ld (de), a +;source-doc/base-drv/enumerate.c:195: usb_error result = read_all_configs(&state); + push de + push de + call _read_all_configs + pop af + ld c, l + pop de +;source-doc/base-drv/enumerate.c:197: work_area->count_of_detected_usb_devices = state.next_device_address; + ld a, (de) + ld ((_x + 1)),a +;source-doc/base-drv/enumerate.c:200: return result; + ld l, c +;source-doc/base-drv/enumerate.c:201: } + inc sp + pop ix + ret + SECTION IGNORE diff --git a/Source/HBIOS/ch376-native/base-drv/enumerate.c.s b/Source/HBIOS/ch376-native/base-drv/enumerate.c.s index f1e3e0e0..37dc3d50 100644 --- a/Source/HBIOS/ch376-native/base-drv/enumerate.c.s +++ b/Source/HBIOS/ch376-native/base-drv/enumerate.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/base-drv/./enumerate.c.asm -- not to be modify directly +; Generated from source-doc/base-drv/enumerate.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -48,7 +48,7 @@ _USB_MODULE_LEDS .EQU 0xff8a ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/base-drv/./enumerate.c:13: void parse_endpoint_keyboard(device_config_keyboard *const keyboard_config, const endpoint_descriptor const *pEndpoint) +;source-doc/base-drv/enumerate.c:13: void parse_endpoint_keyboard(device_config_keyboard *const keyboard_config, const endpoint_descriptor const *pEndpoint) ; --------------------------------- ; Function parse_endpoint_keyboard ; --------------------------------- @@ -57,16 +57,14 @@ _parse_endpoint_keyboard: ld ix,0 add ix,sp push af -;source-doc/base-drv/./enumerate.c:15: endpoint_param *const ep = &keyboard_config->endpoints[0]; +;source-doc/base-drv/enumerate.c:15: endpoint_param *const ep = &keyboard_config->endpoints[0]; inc hl inc hl inc hl +;source-doc/base-drv/enumerate.c:16: ep->number = pEndpoint->bEndpointAddress; ld c,l ld b,h -;source-doc/base-drv/./enumerate.c:16: ep->number = pEndpoint->bEndpointAddress; - inc sp - inc sp - push bc + ex (sp),hl ld l, e ld h, d inc hl @@ -82,12 +80,12 @@ _parse_endpoint_keyboard: and 0xf1 or c ld (hl), a - pop bc -;source-doc/base-drv/./enumerate.c:17: ep->toggle = 0; - ld l, c - ld h, b +;source-doc/base-drv/enumerate.c:17: ep->toggle = 0; + pop hl + ld c,l + ld b,h res 0, (hl) -;source-doc/base-drv/./enumerate.c:18: ep->max_packet_sizex = calc_max_packet_sizex(pEndpoint->wMaxPacketSize); +;source-doc/base-drv/enumerate.c:18: ep->max_packet_sizex = calc_max_packet_sizex(pEndpoint->wMaxPacketSize); inc bc ld hl,4 add hl, de @@ -106,11 +104,11 @@ _parse_endpoint_keyboard: and 0xfc or l ld (bc), a -;source-doc/base-drv/./enumerate.c:19: } +;source-doc/base-drv/enumerate.c:19: } ld sp, ix pop ix ret -;source-doc/base-drv/./enumerate.c:21: usb_device_type identify_class_driver(_working *const working) { +;source-doc/base-drv/enumerate.c:21: usb_device_type identify_class_driver(_working *const working) { ; --------------------------------- ; Function identify_class_driver ; --------------------------------- @@ -118,9 +116,7 @@ _identify_class_driver: push ix ld ix,0 add ix,sp - push af - dec sp -;source-doc/base-drv/./enumerate.c:22: const interface_descriptor *const p = (const interface_descriptor *)working->ptr; +;source-doc/base-drv/enumerate.c:22: const interface_descriptor *const p = (const interface_descriptor *)working->ptr; ld c,(ix+4) ld b,(ix+5) ld hl,27 @@ -128,20 +124,18 @@ _identify_class_driver: ld c, (hl) inc hl ld b, (hl) -;source-doc/base-drv/./enumerate.c:23: if (p->bInterfaceClass == 2) - ld e, c - ld d, b +;source-doc/base-drv/enumerate.c:23: if (p->bInterfaceClass == 2) ld hl,5 - add hl, de - ld e, (hl) - ld a, e + add hl,bc + ld a,(hl) + ld e,a sub 0x02 jr NZ,l_identify_class_driver_00102 -;source-doc/base-drv/./enumerate.c:24: return USB_IS_CDC; +;source-doc/base-drv/enumerate.c:24: return USB_IS_CDC; ld l,0x03 - jp l_identify_class_driver_00118 + jr l_identify_class_driver_00118 l_identify_class_driver_00102: -;source-doc/base-drv/./enumerate.c:26: if (p->bInterfaceClass == 8 && (p->bInterfaceSubClass == 6 || p->bInterfaceSubClass == 5) && p->bInterfaceProtocol == 80) +;source-doc/base-drv/enumerate.c:26: if (p->bInterfaceClass == 8 && (p->bInterfaceSubClass == 6 || p->bInterfaceSubClass == 5) && p->bInterfaceProtocol == 80) ld a, e sub 0x08 jr NZ,l_identify_class_driver_00199 @@ -150,112 +144,108 @@ l_identify_class_driver_00102: l_identify_class_driver_00199: xor a l_identify_class_driver_00200: - ld (ix-3),a - ld hl,0x0006 - add hl, bc - ld (ix-2),l - ld (ix-1),h - ld hl,0x0007 - add hl, bc - ld c, l - ld b, h - ld a,(ix-3) + ld d,a or a jr Z,l_identify_class_driver_00104 - ld l,(ix-2) - ld h,(ix-1) + ld hl,0x0006 + add hl,bc ld a, (hl) cp 0x06 jr Z,l_identify_class_driver_00107 sub 0x05 jr NZ,l_identify_class_driver_00104 l_identify_class_driver_00107: - ld a, (bc) + ld hl,0x0007 + add hl,bc + ld a, (hl) sub 0x50 jr NZ,l_identify_class_driver_00104 -;source-doc/base-drv/./enumerate.c:27: return USB_IS_MASS_STORAGE; +;source-doc/base-drv/enumerate.c:27: return USB_IS_MASS_STORAGE; ld l,0x02 jr l_identify_class_driver_00118 l_identify_class_driver_00104: -;source-doc/base-drv/./enumerate.c:29: if (p->bInterfaceClass == 8 && p->bInterfaceSubClass == 4 && p->bInterfaceProtocol == 0) - ld a,(ix-3) +;source-doc/base-drv/enumerate.c:29: if (p->bInterfaceClass == 8 && p->bInterfaceSubClass == 4 && p->bInterfaceProtocol == 0) + ld a, d or a jr Z,l_identify_class_driver_00109 - ld l,(ix-2) - ld h,(ix-1) + ld hl,0x0006 + add hl,bc ld a, (hl) sub 0x04 jr NZ,l_identify_class_driver_00109 - ld a, (bc) + ld hl,0x0007 + add hl,bc + ld a, (hl) or a jr NZ,l_identify_class_driver_00109 -;source-doc/base-drv/./enumerate.c:30: return USB_IS_FLOPPY; +;source-doc/base-drv/enumerate.c:30: return USB_IS_FLOPPY; ld l,0x01 jr l_identify_class_driver_00118 l_identify_class_driver_00109: -;source-doc/base-drv/./enumerate.c:32: if (p->bInterfaceClass == 9 && p->bInterfaceSubClass == 0 && p->bInterfaceProtocol == 0) +;source-doc/base-drv/enumerate.c:32: if (p->bInterfaceClass == 9 && p->bInterfaceSubClass == 0 && p->bInterfaceProtocol == 0) ld a, e sub 0x09 jr NZ,l_identify_class_driver_00113 - ld l,(ix-2) - ld h,(ix-1) + ld hl,0x0006 + add hl,bc ld a, (hl) or a jr NZ,l_identify_class_driver_00113 - ld a, (bc) + ld hl,7 + add hl, bc + ld a, (hl) or a jr NZ,l_identify_class_driver_00113 -;source-doc/base-drv/./enumerate.c:33: return USB_IS_HUB; +;source-doc/base-drv/enumerate.c:33: return USB_IS_HUB; ld l,0x0f jr l_identify_class_driver_00118 l_identify_class_driver_00113: -;source-doc/base-drv/./enumerate.c:35: if (p->bInterfaceClass == 3) +;source-doc/base-drv/enumerate.c:35: if (p->bInterfaceClass == 3) ld a, e sub 0x03 jr NZ,l_identify_class_driver_00117 -;source-doc/base-drv/./enumerate.c:36: return USB_IS_KEYBOARD; +;source-doc/base-drv/enumerate.c:36: return USB_IS_KEYBOARD; ld l,0x04 jr l_identify_class_driver_00118 l_identify_class_driver_00117: -;source-doc/base-drv/./enumerate.c:38: return USB_IS_UNKNOWN; +;source-doc/base-drv/enumerate.c:38: return USB_IS_UNKNOWN; ld l,0x06 l_identify_class_driver_00118: -;source-doc/base-drv/./enumerate.c:39: } - ld sp, ix +;source-doc/base-drv/enumerate.c:39: } pop ix ret -;source-doc/base-drv/./enumerate.c:41: usb_error op_interface_next(_working *const working) __z88dk_fastcall { +;source-doc/base-drv/enumerate.c:41: usb_error op_interface_next(_working *const working) __z88dk_fastcall { ; --------------------------------- ; Function op_interface_next ; --------------------------------- _op_interface_next: ex de, hl -;source-doc/base-drv/./enumerate.c:42: if (--working->interface_count == 0) +;source-doc/base-drv/enumerate.c:42: if (--working->interface_count == 0) ld hl,0x0016 add hl, de ld a, (hl) dec a ld (hl), a -;source-doc/base-drv/./enumerate.c:43: return USB_ERR_OK; +;source-doc/base-drv/enumerate.c:43: return USB_ERR_OK; or a jr NZ,l_op_interface_next_00102 ld l,a jr l_op_interface_next_00103 l_op_interface_next_00102: -;source-doc/base-drv/./enumerate.c:45: return op_id_class_drv(working); +;source-doc/base-drv/enumerate.c:45: return op_id_class_drv(working); ex de, hl call _op_id_class_drv ld l, a l_op_interface_next_00103: -;source-doc/base-drv/./enumerate.c:46: } +;source-doc/base-drv/enumerate.c:46: } ret -;source-doc/base-drv/./enumerate.c:48: usb_error op_endpoint_next(_working *const working) __sdcccall(1) { +;source-doc/base-drv/enumerate.c:48: usb_error op_endpoint_next(_working *const working) __sdcccall(1) { ; --------------------------------- ; Function op_endpoint_next ; --------------------------------- _op_endpoint_next: ex de, hl -;source-doc/base-drv/./enumerate.c:49: if (--working->endpoint_count > 0) { +;source-doc/base-drv/enumerate.c:49: if (--working->endpoint_count > 0) { ld hl,0x0017 add hl, de ld a, (hl) @@ -263,7 +253,7 @@ _op_endpoint_next: ld (hl), a or a jr Z,l_op_endpoint_next_00102 -;source-doc/base-drv/./enumerate.c:50: working->ptr += ((endpoint_descriptor *)working->ptr)->bLength; +;source-doc/base-drv/enumerate.c:50: working->ptr += ((endpoint_descriptor *)working->ptr)->bLength; ld hl,0x001b add hl, de ld c, (hl) @@ -278,19 +268,19 @@ _op_endpoint_next: ld (hl), c inc hl ld (hl), a -;source-doc/base-drv/./enumerate.c:51: return op_parse_endpoint(working); +;source-doc/base-drv/enumerate.c:51: return op_parse_endpoint(working); ex de, hl jp _op_parse_endpoint jr l_op_endpoint_next_00103 l_op_endpoint_next_00102: -;source-doc/base-drv/./enumerate.c:54: return op_interface_next(working); +;source-doc/base-drv/enumerate.c:54: return op_interface_next(working); ex de, hl call _op_interface_next ld a, l l_op_endpoint_next_00103: -;source-doc/base-drv/./enumerate.c:55: } +;source-doc/base-drv/enumerate.c:55: } ret -;source-doc/base-drv/./enumerate.c:57: usb_error op_parse_endpoint(_working *const working) __sdcccall(1) { +;source-doc/base-drv/enumerate.c:57: usb_error op_parse_endpoint(_working *const working) __sdcccall(1) { ; --------------------------------- ; Function op_parse_endpoint ; --------------------------------- @@ -299,25 +289,23 @@ _op_parse_endpoint: ld ix,0 add ix,sp push af -;source-doc/base-drv/./enumerate.c:58: const endpoint_descriptor *endpoint = (endpoint_descriptor *)working->ptr; +;source-doc/base-drv/enumerate.c:58: const endpoint_descriptor *endpoint = (endpoint_descriptor *)working->ptr; + ld de,0x001c ld c,l ld b,h - ld de,0x001c add hl, de ld a, (hl) dec hl ld l, (hl) ld (ix-2),l ld (ix-1),a -;source-doc/base-drv/./enumerate.c:59: device_config *const device = working->p_current_device; - ld e, c - ld d, b +;source-doc/base-drv/enumerate.c:59: device_config *const device = working->p_current_device; ld hl,29 - add hl, de + add hl,bc ld e, (hl) inc hl ld d, (hl) -;source-doc/base-drv/./enumerate.c:61: switch (working->usb_device) { +;source-doc/base-drv/enumerate.c:61: switch (working->usb_device) { ld l, c ld h, b inc hl @@ -330,9 +318,9 @@ _op_parse_endpoint: sub 0x04 jr Z,l_op_parse_endpoint_00103 jr l_op_parse_endpoint_00104 -;source-doc/base-drv/./enumerate.c:63: case USB_IS_MASS_STORAGE: { +;source-doc/base-drv/enumerate.c:63: case USB_IS_MASS_STORAGE: { l_op_parse_endpoint_00102: -;source-doc/base-drv/./enumerate.c:64: parse_endpoints(device, endpoint); +;source-doc/base-drv/enumerate.c:64: parse_endpoints(device, endpoint); push bc ld l,(ix-2) ld h,(ix-1) @@ -342,28 +330,28 @@ l_op_parse_endpoint_00102: pop af pop af pop bc -;source-doc/base-drv/./enumerate.c:65: break; +;source-doc/base-drv/enumerate.c:65: break; jr l_op_parse_endpoint_00104 -;source-doc/base-drv/./enumerate.c:68: case USB_IS_KEYBOARD: { +;source-doc/base-drv/enumerate.c:68: case USB_IS_KEYBOARD: { l_op_parse_endpoint_00103: -;source-doc/base-drv/./enumerate.c:69: parse_endpoint_keyboard((device_config_keyboard *)device, endpoint); +;source-doc/base-drv/enumerate.c:69: parse_endpoint_keyboard((device_config_keyboard *)device, endpoint); ex de, hl push bc ld e,(ix-2) ld d,(ix-1) call _parse_endpoint_keyboard pop bc -;source-doc/base-drv/./enumerate.c:72: } +;source-doc/base-drv/enumerate.c:72: } l_op_parse_endpoint_00104: -;source-doc/base-drv/./enumerate.c:74: return op_endpoint_next(working); +;source-doc/base-drv/enumerate.c:74: return op_endpoint_next(working); ld l, c ld h, b call _op_endpoint_next -;source-doc/base-drv/./enumerate.c:75: } +;source-doc/base-drv/enumerate.c:75: } ld sp, ix pop ix ret -;source-doc/base-drv/./enumerate.c:78: configure_device(const _working *const working, const interface_descriptor *const interface, device_config *const dev_cfg) { +;source-doc/base-drv/enumerate.c:78: configure_device(const _working *const working, const interface_descriptor *const interface, device_config *const dev_cfg) { ; --------------------------------- ; Function configure_device ; --------------------------------- @@ -373,7 +361,7 @@ _configure_device: add ix,sp push af push af -;source-doc/base-drv/./enumerate.c:79: dev_cfg->interface_number = interface->bInterfaceNumber; +;source-doc/base-drv/enumerate.c:79: dev_cfg->interface_number = interface->bInterfaceNumber; ld a,(ix+8) ld (ix-4),a ld a,(ix+9) @@ -388,7 +376,7 @@ _configure_device: inc de ld a, (de) ld (bc), a -;source-doc/base-drv/./enumerate.c:80: dev_cfg->max_packet_size = working->desc.bMaxPacketSize0; +;source-doc/base-drv/enumerate.c:80: dev_cfg->max_packet_size = working->desc.bMaxPacketSize0; ld a,(ix-4) add a,0x01 ld (ix-2),a @@ -397,25 +385,17 @@ _configure_device: ld (ix-1),a ld c,(ix+4) ld b,(ix+5) - ld e, c - ld d, b ld hl,10 - add hl, de + add hl,bc ld a, (hl) pop de pop hl push hl +;source-doc/base-drv/enumerate.c:81: dev_cfg->address = working->current_device_address; + ld (hl),a push de - ld (hl), a -;source-doc/base-drv/./enumerate.c:81: dev_cfg->address = working->current_device_address; - pop de - push de - ld l, c - ld h, b - push bc - ld bc,0x0018 - add hl, bc - pop bc + ld hl,0x0018 + add hl,bc ld a, (hl) add a, a add a, a @@ -426,7 +406,7 @@ _configure_device: and 0x0f or l ld (de), a -;source-doc/base-drv/./enumerate.c:82: dev_cfg->type = working->usb_device; +;source-doc/base-drv/enumerate.c:82: dev_cfg->type = working->usb_device; pop de push de ld l, c @@ -440,34 +420,31 @@ _configure_device: and 0xf0 or l ld (de), a -;source-doc/base-drv/./enumerate.c:84: return usbtrn_set_configuration(dev_cfg->address, dev_cfg->max_packet_size, working->config.desc.bConfigurationvalue); +;source-doc/base-drv/enumerate.c:84: return usbtrn_set_configuration(dev_cfg->address, dev_cfg->max_packet_size, working->config.desc.bConfigurationvalue); ld hl,36 add hl, bc - ld c, (hl) + ld b, (hl) ld l,(ix-2) ld h,(ix-1) - ld b, (hl) + ld d, (hl) pop hl + ld a,(hl) push hl - ld a, (hl) rlca rlca rlca rlca and 0x0f - ld h, c - push hl - inc sp + ld c, d push bc - inc sp push af inc sp call _usbtrn_set_configuration -;source-doc/base-drv/./enumerate.c:85: } +;source-doc/base-drv/enumerate.c:85: } ld sp,ix pop ix ret -;source-doc/base-drv/./enumerate.c:87: usb_error op_capture_hub_driver_interface(_working *const working) __sdcccall(1) { +;source-doc/base-drv/enumerate.c:87: usb_error op_capture_hub_driver_interface(_working *const working) __sdcccall(1) { ; --------------------------------- ; Function op_capture_hub_driver_interface ; --------------------------------- @@ -480,17 +457,15 @@ _op_capture_hub_driver_interfac: push af dec sp ex de, hl -;source-doc/base-drv/./enumerate.c:88: const interface_descriptor *const interface = (interface_descriptor *)working->ptr; - ld l, e - ld h, d - ld bc,0x001c - add hl, bc +;source-doc/base-drv/enumerate.c:88: const interface_descriptor *const interface = (interface_descriptor *)working->ptr; + ld hl,0x001c + add hl,de ld a, (hl) dec hl ld l, (hl) ld (ix-4),l ld (ix-3),a -;source-doc/base-drv/./enumerate.c:92: working->hub_config = &hub_config; +;source-doc/base-drv/enumerate.c:92: working->hub_config = &hub_config; ld hl,0x0019 add hl, de ld (ix-2),l @@ -498,19 +473,19 @@ _op_capture_hub_driver_interfac: ld hl,0 add hl, sp ld c, l - ld b, h ld l,(ix-2) + ld b,h ld h,(ix-1) ld (hl), c inc hl ld (hl), b -;source-doc/base-drv/./enumerate.c:94: hub_config.type = USB_IS_HUB; +;source-doc/base-drv/enumerate.c:94: hub_config.type = USB_IS_HUB; ld hl,0 add hl, sp ld a, (hl) or 0x0f ld (hl), a -;source-doc/base-drv/./enumerate.c:95: CHECK(configure_device(working, interface, (device_config *const)&hub_config)); +;source-doc/base-drv/enumerate.c:95: CHECK(configure_device(working, interface, (device_config *const)&hub_config)); push de ld hl,2 add hl, sp @@ -528,18 +503,18 @@ _op_capture_hub_driver_interfac: inc l dec l jr NZ,l_op_capture_hub_driver_interfa -;source-doc/base-drv/./enumerate.c:96: RETURN_CHECK(configure_usb_hub(working)); +;source-doc/base-drv/enumerate.c:96: RETURN_CHECK(configure_usb_hub(working)); ex de, hl call _configure_usb_hub ld a, l -;source-doc/base-drv/./enumerate.c:97: done: +;source-doc/base-drv/enumerate.c:97: done: l_op_capture_hub_driver_interfa: -;source-doc/base-drv/./enumerate.c:98: return result; -;source-doc/base-drv/./enumerate.c:99: } +;source-doc/base-drv/enumerate.c:98: return result; +;source-doc/base-drv/enumerate.c:99: } ld sp, ix pop ix ret -;source-doc/base-drv/./enumerate.c:101: usb_error op_cap_drv_intf(_working *const working) __z88dk_fastcall { +;source-doc/base-drv/enumerate.c:101: usb_error op_cap_drv_intf(_working *const working) __z88dk_fastcall { ; --------------------------------- ; Function op_cap_drv_intf ; --------------------------------- @@ -552,11 +527,11 @@ _op_cap_drv_intf: ld hl, -16 add hl, sp ld sp, hl +;source-doc/base-drv/enumerate.c:104: const interface_descriptor *const interface = (interface_descriptor *)working->ptr; ld (ix-2),c + ld l, c ld (ix-1),b -;source-doc/base-drv/./enumerate.c:104: const interface_descriptor *const interface = (interface_descriptor *)working->ptr; - ld l,(ix-2) - ld h,(ix-1) + ld h,b ld de,0x001b add hl, de ld e, (hl) @@ -565,7 +540,7 @@ _op_cap_drv_intf: dec hl ld c, e ld b, d -;source-doc/base-drv/./enumerate.c:106: working->ptr += interface->bLength; +;source-doc/base-drv/enumerate.c:106: working->ptr += interface->bLength; ld a, (bc) add a, e ld e, a @@ -574,7 +549,7 @@ _op_cap_drv_intf: ld (hl), e inc hl ld (hl), a -;source-doc/base-drv/./enumerate.c:107: working->endpoint_count = interface->bNumEndpoints; +;source-doc/base-drv/enumerate.c:107: working->endpoint_count = interface->bNumEndpoints; ld a,(ix-2) add a,0x17 ld e, a @@ -589,20 +564,20 @@ _op_cap_drv_intf: inc hl ld a, (hl) ld (de), a -;source-doc/base-drv/./enumerate.c:108: working->p_current_device = NULL; +;source-doc/base-drv/enumerate.c:108: working->p_current_device = NULL; ld a,(ix-2) add a,0x1d ld (ix-4),a + ld l,a ld a,(ix-1) adc a,0x00 ld (ix-3),a - ld l,(ix-4) - ld h,(ix-3) + ld h,a xor a ld (hl), a inc hl ld (hl), a -;source-doc/base-drv/./enumerate.c:110: switch (working->usb_device) { +;source-doc/base-drv/enumerate.c:110: switch (working->usb_device) { ld l,(ix-2) ld h,(ix-1) inc hl @@ -612,26 +587,29 @@ _op_cap_drv_intf: jr Z,l_op_cap_drv_intf_00104 sub 0x0f jr NZ,l_op_cap_drv_intf_00107 -;source-doc/base-drv/./enumerate.c:112: CHECK(op_capture_hub_driver_interface(working)) +;source-doc/base-drv/enumerate.c:112: CHECK(op_capture_hub_driver_interface(working)) ld l,(ix-2) ld h,(ix-1) call _op_capture_hub_driver_interfac or a jr Z,l_op_cap_drv_intf_00112 jr l_op_cap_drv_intf_00113 -;source-doc/base-drv/./enumerate.c:116: case USB_IS_UNKNOWN: { +;source-doc/base-drv/enumerate.c:116: case USB_IS_UNKNOWN: { l_op_cap_drv_intf_00104: -;source-doc/base-drv/./enumerate.c:118: memset(&unkown_dev_cfg, 0, sizeof(device_config)); +;source-doc/base-drv/enumerate.c:118: memset(&unkown_dev_cfg, 0, sizeof(device_config)); push bc ld hl,2 add hl, sp - ld b,0x0c + ld b,0x06 l_op_cap_drv_intf_00154: - ld (hl),0x00 + xor a + ld (hl), a + inc hl + ld (hl), a inc hl djnz l_op_cap_drv_intf_00154 pop bc -;source-doc/base-drv/./enumerate.c:119: working->p_current_device = &unkown_dev_cfg; +;source-doc/base-drv/enumerate.c:119: working->p_current_device = &unkown_dev_cfg; ld hl,0 add hl, sp ex de, hl @@ -640,7 +618,7 @@ l_op_cap_drv_intf_00154: ld (hl), e inc hl ld (hl), d -;source-doc/base-drv/./enumerate.c:120: CHECK(configure_device(working, interface, &unkown_dev_cfg)); +;source-doc/base-drv/enumerate.c:120: CHECK(configure_device(working, interface, &unkown_dev_cfg)); ld hl,0 add hl, sp push hl @@ -656,28 +634,28 @@ l_op_cap_drv_intf_00154: or a jr Z,l_op_cap_drv_intf_00112 jr l_op_cap_drv_intf_00113 -;source-doc/base-drv/./enumerate.c:124: default: { +;source-doc/base-drv/enumerate.c:124: default: { l_op_cap_drv_intf_00107: -;source-doc/base-drv/./enumerate.c:125: device_config *dev_cfg = find_first_free(); +;source-doc/base-drv/enumerate.c:125: device_config *dev_cfg = find_first_free(); push bc call _find_first_free - ex de, hl +;source-doc/base-drv/enumerate.c:126: if (dev_cfg == NULL) pop bc -;source-doc/base-drv/./enumerate.c:126: if (dev_cfg == NULL) - ld a, d - or e + ld a,h + or l + ex de,hl jr NZ,l_op_cap_drv_intf_00109 -;source-doc/base-drv/./enumerate.c:127: return USB_ERR_OUT_OF_MEMORY; +;source-doc/base-drv/enumerate.c:127: return USB_ERR_OUT_OF_MEMORY; ld l,0x83 jr l_op_cap_drv_intf_00114 l_op_cap_drv_intf_00109: -;source-doc/base-drv/./enumerate.c:128: working->p_current_device = dev_cfg; +;source-doc/base-drv/enumerate.c:128: working->p_current_device = dev_cfg; ld l,(ix-4) ld h,(ix-3) ld (hl), e inc hl ld (hl), d -;source-doc/base-drv/./enumerate.c:129: CHECK(configure_device(working, interface, dev_cfg)); +;source-doc/base-drv/enumerate.c:129: CHECK(configure_device(working, interface, dev_cfg)); push de push bc ld l,(ix-2) @@ -690,41 +668,39 @@ l_op_cap_drv_intf_00109: ld a, l or a jr NZ,l_op_cap_drv_intf_00113 -;source-doc/base-drv/./enumerate.c:132: } +;source-doc/base-drv/enumerate.c:132: } l_op_cap_drv_intf_00112: -;source-doc/base-drv/./enumerate.c:134: result = op_parse_endpoint(working); +;source-doc/base-drv/enumerate.c:134: result = op_parse_endpoint(working); ld l,(ix-2) ld h,(ix-1) call _op_parse_endpoint -;source-doc/base-drv/./enumerate.c:136: done: +;source-doc/base-drv/enumerate.c:136: done: l_op_cap_drv_intf_00113: -;source-doc/base-drv/./enumerate.c:137: return result; +;source-doc/base-drv/enumerate.c:137: return result; ld l, a l_op_cap_drv_intf_00114: -;source-doc/base-drv/./enumerate.c:138: } +;source-doc/base-drv/enumerate.c:138: } ld sp, ix pop ix ret -;source-doc/base-drv/./enumerate.c:140: usb_error op_id_class_drv(_working *const working) __sdcccall(1) { +;source-doc/base-drv/enumerate.c:140: usb_error op_id_class_drv(_working *const working) __sdcccall(1) { ; --------------------------------- ; Function op_id_class_drv ; --------------------------------- _op_id_class_drv: ex de, hl -;source-doc/base-drv/./enumerate.c:141: const interface_descriptor *const ptr = (const interface_descriptor *)working->ptr; - ld l, e - ld h, d - ld bc,0x001c - add hl, bc +;source-doc/base-drv/enumerate.c:141: const interface_descriptor *const ptr = (const interface_descriptor *)working->ptr; + ld hl,0x001c + add hl,de ld a, (hl) dec hl ld l, (hl) - ld h, a -;source-doc/base-drv/./enumerate.c:143: working->usb_device = ptr->bLength > 5 ? identify_class_driver(working) : 0; +;source-doc/base-drv/enumerate.c:143: working->usb_device = ptr->bLength > 5 ? identify_class_driver(working) : 0; ld c, e ld b, d inc bc inc bc + ld h, a ld l, (hl) ld a,0x05 sub l @@ -742,13 +718,13 @@ l_op_id_class_drv_00103: xor a l_op_id_class_drv_00104: ld (bc), a -;source-doc/base-drv/./enumerate.c:145: return op_cap_drv_intf(working); +;source-doc/base-drv/enumerate.c:145: return op_cap_drv_intf(working); ex de, hl call _op_cap_drv_intf ld a, l -;source-doc/base-drv/./enumerate.c:146: } +;source-doc/base-drv/enumerate.c:146: } ret -;source-doc/base-drv/./enumerate.c:148: usb_error op_get_cfg_desc(_working *const working) __sdcccall(1) { +;source-doc/base-drv/enumerate.c:148: usb_error op_get_cfg_desc(_working *const working) __sdcccall(1) { ; --------------------------------- ; Function op_get_cfg_desc ; --------------------------------- @@ -757,81 +733,67 @@ _op_get_cfg_desc: ld ix,0 add ix,sp push af - push af - ld (ix-2),l - ld (ix-1),h -;source-doc/base-drv/./enumerate.c:149: memset(working->config.buffer, 0, MAX_CONFIG_SIZE); - ld a,(ix-2) - add a,0x1f - ld (ix-4),a - ld a,(ix-1) - adc a,0x00 - ld (ix-3),a - pop hl + ex de, hl +;source-doc/base-drv/enumerate.c:149: memset(working->config.buffer, 0, MAX_CONFIG_SIZE); + ld hl,0x001f + add hl, de + pop af push hl - ld b,0x8c + ld b,0x46 l_op_get_cfg_desc_00113: - ld (hl),0x00 + xor a + ld (hl), a + inc hl + ld (hl), a inc hl djnz l_op_get_cfg_desc_00113 -;source-doc/base-drv/./enumerate.c:151: const uint8_t max_packet_size = working->desc.bMaxPacketSize0; - pop hl - pop bc - push bc - push hl +;source-doc/base-drv/enumerate.c:151: const uint8_t max_packet_size = working->desc.bMaxPacketSize0; + ld c, e + ld b, d inc bc inc bc inc bc ld hl,7 add hl, bc - ld d, (hl) -;source-doc/base-drv/./enumerate.c:154: working->config.buffer)); - pop hl - pop bc - push bc - push hl + ld a, (hl) +;source-doc/base-drv/enumerate.c:154: working->config.buffer)); + ld c, e + ld b, d ld hl,24 add hl, bc - ld a, (hl) - pop hl - pop bc + ld b, (hl) + ld l, e + ld h, d push bc - push hl - ld hl,21 + ld bc,0x0015 add hl, bc - ld b, (hl) - pop hl - push hl + pop bc + ld c, (hl) + push de + ld l,(ix-2) + ld h,(ix-1) push hl ld h,0x8c + ld l,a push hl - inc sp - push de - inc sp - push af - inc sp push bc - inc sp call _usbtrn_gfull_cfg_desc pop af pop af pop af + pop de ld a, l ld (_result), a ld a,(_result) or a jr NZ,l_op_get_cfg_desc_00103 -;source-doc/base-drv/./enumerate.c:156: working->ptr = (working->config.buffer + sizeof(config_descriptor)); - pop de - pop hl - push hl - push de - ld de,0x001b +;source-doc/base-drv/enumerate.c:156: working->ptr = (working->config.buffer + sizeof(config_descriptor)); + ld hl,0x001b add hl, de - ld a,(ix-2) + ld a, e add a,0x1f ld c, a - ld a,(ix-1) + ld a, d adc a,0x00 ld b, a ld a, c @@ -842,37 +804,34 @@ l_op_get_cfg_desc_00113: ld (hl), c inc hl ld (hl), a -;source-doc/base-drv/./enumerate.c:157: working->interface_count = working->config.desc.bNumInterfaces; - ld a,(ix-2) - add a,0x16 - ld c, a - ld a,(ix-1) - adc a,0x00 - ld b, a - pop de - push de - ld hl,4 +;source-doc/base-drv/enumerate.c:157: working->interface_count = working->config.desc.bNumInterfaces; + ld hl,0x0016 add hl, de - ld a, (hl) - ld (bc), a -;source-doc/base-drv/./enumerate.c:159: return op_id_class_drv(working); - pop de + ld c, l + ld b, h pop hl push hl - push de + inc hl + inc hl + inc hl + inc hl + ld a, (hl) + ld (bc), a +;source-doc/base-drv/enumerate.c:159: return op_id_class_drv(working); + ex de, hl call _op_id_class_drv jr l_op_get_cfg_desc_00104 -;source-doc/base-drv/./enumerate.c:160: done: +;source-doc/base-drv/enumerate.c:160: done: l_op_get_cfg_desc_00103: -;source-doc/base-drv/./enumerate.c:161: return result; +;source-doc/base-drv/enumerate.c:161: return result; ld hl,_result ld a, (hl) l_op_get_cfg_desc_00104: -;source-doc/base-drv/./enumerate.c:162: } +;source-doc/base-drv/enumerate.c:162: } ld sp, ix pop ix ret -;source-doc/base-drv/./enumerate.c:164: usb_error read_all_configs(enumeration_state *const state) { +;source-doc/base-drv/enumerate.c:164: usb_error read_all_configs(enumeration_state *const state) { ; --------------------------------- ; Function read_all_configs ; --------------------------------- @@ -883,57 +842,48 @@ _read_all_configs: ld hl, -171 add hl, sp ld sp, hl -;source-doc/base-drv/./enumerate.c:169: memset(&working, 0, sizeof(_working)); +;source-doc/base-drv/enumerate.c:169: memset(&working, 0, sizeof(_working)); ld hl,0 add hl, sp - ex de, hl - ld l, e - ld h, d - ld b,0xab -l_read_all_configs_00149: ld (hl),0x00 - inc hl - djnz l_read_all_configs_00149 -;source-doc/base-drv/./enumerate.c:170: working.state = state; - ld l, e - ld h, d + ld e, l + ld d, h + inc de + ld bc,0x00aa + ldir +;source-doc/base-drv/enumerate.c:170: working.state = state; ld a,(ix+4) + ld hl,0 + add hl, sp ld (hl), a - inc hl ld a,(ix+5) + inc hl ld (hl), a -;source-doc/base-drv/./enumerate.c:172: CHECK(usbtrn_get_descriptor(&working.desc)); - push de - ld hl,5 +;source-doc/base-drv/enumerate.c:172: CHECK(usbtrn_get_descriptor(&working.desc)); + ld hl,3 add hl, sp push hl call _usbtrn_get_descriptor pop af ld a, l - pop de or a jr NZ,l_read_all_configs_00108 -;source-doc/base-drv/./enumerate.c:174: state->next_device_address++; - ld a,(ix+4) - ld b,(ix+5) - ld l, a - ld h, b - ld c, (hl) - inc c - ld l, a - ld h, b - ld (hl), c -;source-doc/base-drv/./enumerate.c:175: working.current_device_address = state->next_device_address; - ld hl,0x0018 - add hl, de +;source-doc/base-drv/enumerate.c:174: state->next_device_address++; + ld e,(ix+4) + ld d,(ix+5) + ld a, (de) + inc a + ld c,a + ld (de), a +;source-doc/base-drv/enumerate.c:175: working.current_device_address = state->next_device_address; + ld hl,24 + add hl, sp ld (hl), c -;source-doc/base-drv/./enumerate.c:176: CHECK(usbtrn_set_address(working.current_device_address)); - push de +;source-doc/base-drv/enumerate.c:176: CHECK(usbtrn_set_address(working.current_device_address)); ld l, c call _usbtrn_set_address ld a, l - pop de -;source-doc/base-drv/./enumerate.c:178: for (uint8_t config_index = 0; config_index < working.desc.bNumConfigurations; config_index++) { +;source-doc/base-drv/enumerate.c:178: for (uint8_t config_index = 0; config_index < working.desc.bNumConfigurations; config_index++) { or a jr NZ,l_read_all_configs_00108 ld c,a @@ -944,69 +894,63 @@ l_read_all_configs_00110: ld a, c sub b jr NC,l_read_all_configs_00107 -;source-doc/base-drv/./enumerate.c:179: working.config_index = config_index; - ld hl,0x0015 - add hl, de +;source-doc/base-drv/enumerate.c:179: working.config_index = config_index; + inc hl ld (hl), c -;source-doc/base-drv/./enumerate.c:181: CHECK(op_get_cfg_desc(&working)); +;source-doc/base-drv/enumerate.c:181: CHECK(op_get_cfg_desc(&working)); push bc - push de - ld hl,4 + ld hl,2 add hl, sp call _op_get_cfg_desc - pop de pop bc or a jr NZ,l_read_all_configs_00108 -;source-doc/base-drv/./enumerate.c:178: for (uint8_t config_index = 0; config_index < working.desc.bNumConfigurations; config_index++) { +;source-doc/base-drv/enumerate.c:178: for (uint8_t config_index = 0; config_index < working.desc.bNumConfigurations; config_index++) { inc c jr l_read_all_configs_00110 l_read_all_configs_00107: -;source-doc/base-drv/./enumerate.c:184: return USB_ERR_OK; +;source-doc/base-drv/enumerate.c:184: return USB_ERR_OK; ld l,0x00 jr l_read_all_configs_00112 -;source-doc/base-drv/./enumerate.c:185: done: +;source-doc/base-drv/enumerate.c:185: done: l_read_all_configs_00108: -;source-doc/base-drv/./enumerate.c:186: return result; +;source-doc/base-drv/enumerate.c:186: return result; ld l, a l_read_all_configs_00112: -;source-doc/base-drv/./enumerate.c:187: } +;source-doc/base-drv/enumerate.c:187: } ld sp, ix pop ix ret -;source-doc/base-drv/./enumerate.c:189: usb_error enumerate_all_devices(void) { +;source-doc/base-drv/enumerate.c:189: usb_error enumerate_all_devices(void) { ; --------------------------------- ; Function enumerate_all_devices ; --------------------------------- _enumerate_all_devices: push ix dec sp -;source-doc/base-drv/./enumerate.c:190: _usb_state *const work_area = get_usb_work_area(); -;source-doc/base-drv/./enumerate.c:192: memset(&state, 0, sizeof(enumeration_state)); +;source-doc/base-drv/enumerate.c:190: _usb_state *const work_area = get_usb_work_area(); +;source-doc/base-drv/enumerate.c:192: memset(&state, 0, sizeof(enumeration_state)); ld hl,0 add hl, sp - ex de, hl - ld l, e - ld h, d - ld (hl),0x00 -;source-doc/base-drv/./enumerate.c:193: state.next_device_address = 0; + ld e,l + ld d,h +;source-doc/base-drv/enumerate.c:193: state.next_device_address = 0; xor a + ld (hl),a ld (de), a -;source-doc/base-drv/./enumerate.c:195: usb_error result = read_all_configs(&state); - ld c, e - ld b, d +;source-doc/base-drv/enumerate.c:195: usb_error result = read_all_configs(&state); + push de push de - push bc call _read_all_configs pop af ld c, l pop de -;source-doc/base-drv/./enumerate.c:197: work_area->count_of_detected_usb_devices = state.next_device_address; +;source-doc/base-drv/enumerate.c:197: work_area->count_of_detected_usb_devices = state.next_device_address; ld a, (de) ld ((_x + 1)),a -;source-doc/base-drv/./enumerate.c:200: return result; +;source-doc/base-drv/enumerate.c:200: return result; ld l, c -;source-doc/base-drv/./enumerate.c:201: } +;source-doc/base-drv/enumerate.c:201: } inc sp pop ix ret diff --git a/Source/HBIOS/ch376-native/base-drv/enumerate_hub.c.s b/Source/HBIOS/ch376-native/base-drv/enumerate_hub.c.s index 7a66b97e..0fc01bd3 100644 --- a/Source/HBIOS/ch376-native/base-drv/enumerate_hub.c.s +++ b/Source/HBIOS/ch376-native/base-drv/enumerate_hub.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/base-drv/./enumerate_hub.c.asm -- not to be modify directly +; Generated from source-doc/base-drv/enumerate_hub.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -48,7 +48,7 @@ _USB_MODULE_LEDS .EQU 0xff8a ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/base-drv/./enumerate_hub.c:13: usb_error hub_set_feature(const device_config_hub *const hub_config, const uint8_t feature, const uint8_t index) { +;source-doc/base-drv/enumerate_hub.c:13: usb_error hub_set_feature(const device_config_hub *const hub_config, const uint8_t feature, const uint8_t index) { ; --------------------------------- ; Function hub_set_feature ; --------------------------------- @@ -59,49 +59,44 @@ _hub_set_feature: ld hl, -8 add hl, sp ld sp, hl -;source-doc/base-drv/./enumerate_hub.c:15: set_feature = cmd_set_feature; +;source-doc/base-drv/enumerate_hub.c:15: set_feature = cmd_set_feature; ld hl,0 add hl, sp - ld c, l - ld b, h - ld e, c - ld d, b - push bc - ld hl,_cmd_set_feature + ld e,l + ld d,h + push hl ld bc,0x0008 + ld hl,_cmd_set_feature ldir pop bc -;source-doc/base-drv/./enumerate_hub.c:17: set_feature.bValue[0] = feature; +;source-doc/base-drv/enumerate_hub.c:17: set_feature.bValue[0] = feature; ld a,(ix+6) ld (ix-6),a -;source-doc/base-drv/./enumerate_hub.c:18: set_feature.bIndex[0] = index; +;source-doc/base-drv/enumerate_hub.c:18: set_feature.bIndex[0] = index; ld a,(ix+7) ld (ix-4),a -;source-doc/base-drv/./enumerate_hub.c:19: return usb_control_transfer(&set_feature, 0, hub_config->address, hub_config->max_packet_size); +;source-doc/base-drv/enumerate_hub.c:19: return usb_control_transfer(&set_feature, 0, hub_config->address, hub_config->max_packet_size); + ld e,(ix+5) ld a,(ix+4) - ld d,(ix+5) ld l, a - ld h, d + ld h, e inc hl - ld e, (hl) + ld d, (hl) ld l, a - ld h, d + ld h, e ld a, (hl) rlca rlca rlca rlca and 0x0f - ld h, e - push hl - inc sp - push af - inc sp + ld e,a + push de ld hl,0x0000 push hl push bc call _usb_control_transfer -;source-doc/base-drv/./enumerate_hub.c:20: } +;source-doc/base-drv/enumerate_hub.c:20: } ld sp,ix pop ix ret @@ -129,7 +124,7 @@ _cmd_get_status_port: DEFB +0x01 DEFB +0x00 DEFW +0x0004 -;source-doc/base-drv/./enumerate_hub.c:22: usb_error hub_clear_feature(const device_config_hub *const hub_config, const uint8_t feature, const uint8_t index) { +;source-doc/base-drv/enumerate_hub.c:22: usb_error hub_clear_feature(const device_config_hub *const hub_config, const uint8_t feature, const uint8_t index) { ; --------------------------------- ; Function hub_clear_feature ; --------------------------------- @@ -140,53 +135,48 @@ _hub_clear_feature: ld hl, -8 add hl, sp ld sp, hl -;source-doc/base-drv/./enumerate_hub.c:24: clear_feature = cmd_clear_feature; +;source-doc/base-drv/enumerate_hub.c:24: clear_feature = cmd_clear_feature; ld hl,0 add hl, sp - ld c, l - ld b, h - ld e, c - ld d, b - push bc - ld hl,_cmd_clear_feature + ld e,l + ld d,h + push hl ld bc,0x0008 + ld hl,_cmd_clear_feature ldir pop bc -;source-doc/base-drv/./enumerate_hub.c:26: clear_feature.bValue[0] = feature; +;source-doc/base-drv/enumerate_hub.c:26: clear_feature.bValue[0] = feature; ld a,(ix+6) ld (ix-6),a -;source-doc/base-drv/./enumerate_hub.c:27: clear_feature.bIndex[0] = index; +;source-doc/base-drv/enumerate_hub.c:27: clear_feature.bIndex[0] = index; ld a,(ix+7) ld (ix-4),a -;source-doc/base-drv/./enumerate_hub.c:28: return usb_control_transfer(&clear_feature, 0, hub_config->address, hub_config->max_packet_size); +;source-doc/base-drv/enumerate_hub.c:28: return usb_control_transfer(&clear_feature, 0, hub_config->address, hub_config->max_packet_size); + ld e,(ix+5) ld a,(ix+4) - ld d,(ix+5) ld l, a - ld h, d + ld h, e inc hl - ld e, (hl) + ld d, (hl) ld l, a - ld h, d + ld h, e ld a, (hl) rlca rlca rlca rlca and 0x0f - ld h, e - push hl - inc sp - push af - inc sp + ld e,a + push de ld hl,0x0000 push hl push bc call _usb_control_transfer -;source-doc/base-drv/./enumerate_hub.c:29: } +;source-doc/base-drv/enumerate_hub.c:29: } ld sp,ix pop ix ret -;source-doc/base-drv/./enumerate_hub.c:31: usb_error hub_get_status_port(const device_config_hub *const hub_config, const uint8_t index, hub_port_status *const port_status) { +;source-doc/base-drv/enumerate_hub.c:31: usb_error hub_get_status_port(const device_config_hub *const hub_config, const uint8_t index, hub_port_status *const port_status) { ; --------------------------------- ; Function hub_get_status_port ; --------------------------------- @@ -197,21 +187,21 @@ _hub_get_status_port: ld hl, -8 add hl, sp ld sp, hl -;source-doc/base-drv/./enumerate_hub.c:33: get_status_port = cmd_get_status_port; +;source-doc/base-drv/enumerate_hub.c:33: get_status_port = cmd_get_status_port; ld hl,0 add hl, sp ex de, hl - ld hl,_cmd_get_status_port ld bc,0x0008 + ld hl,_cmd_get_status_port ldir -;source-doc/base-drv/./enumerate_hub.c:35: get_status_port.bIndex[0] = index; +;source-doc/base-drv/enumerate_hub.c:35: get_status_port.bIndex[0] = index; ld a,(ix+6) ld (ix-4),a -;source-doc/base-drv/./enumerate_hub.c:36: return usb_control_transfer(&get_status_port, port_status, hub_config->address, hub_config->max_packet_size); - ld e,(ix+4) - ld d,(ix+5) - ld l, e - ld h, d +;source-doc/base-drv/enumerate_hub.c:36: return usb_control_transfer(&get_status_port, port_status, hub_config->address, hub_config->max_packet_size); + ld l,(ix+4) + ld h,(ix+5) + ld e,l + ld d,h inc hl ld b, (hl) ex de, hl @@ -223,20 +213,18 @@ _hub_get_status_port: and 0x0f ld e,(ix+7) ld d,(ix+8) - ld hl,0 - add hl, sp + ld c,a push bc - inc sp - push af - inc sp push de + ld hl,4 + add hl, sp push hl call _usb_control_transfer -;source-doc/base-drv/./enumerate_hub.c:37: } +;source-doc/base-drv/enumerate_hub.c:37: } ld sp,ix pop ix ret -;source-doc/base-drv/./enumerate_hub.c:39: usb_error configure_usb_hub(_working *const working) __z88dk_fastcall { +;source-doc/base-drv/enumerate_hub.c:39: usb_error configure_usb_hub(_working *const working) __z88dk_fastcall { ; --------------------------------- ; Function configure_usb_hub ; --------------------------------- @@ -249,32 +237,30 @@ _configure_usb_hub: ld hl, -14 add hl, sp ld sp, hl +;source-doc/base-drv/enumerate_hub.c:45: const device_config_hub *const hub_config = working->hub_config; ld (ix-2),c ld (ix-1),b -;source-doc/base-drv/./enumerate_hub.c:45: const device_config_hub *const hub_config = working->hub_config; - ld c,(ix-2) - ld b,(ix-1) ld hl,25 add hl, bc ld c, (hl) inc hl ld b, (hl) -;source-doc/base-drv/./enumerate_hub.c:47: CHECK(hub_get_descriptor(hub_config, &hub_description)); +;source-doc/base-drv/enumerate_hub.c:47: CHECK(hub_get_descriptor(hub_config, &hub_description)); push bc ld hl,2 add hl, sp - ex de, hl - ld l, c - ld h, b + ld e,c + ld d,b + ex de,hl call _hub_get_descriptor pop bc or a jp NZ, l_configure_usb_hub_00129 -;source-doc/base-drv/./enumerate_hub.c:49: uint8_t i = hub_description.bNbrPorts; +;source-doc/base-drv/enumerate_hub.c:49: uint8_t i = hub_description.bNbrPorts; ld d,(ix-12) -;source-doc/base-drv/./enumerate_hub.c:50: do { +;source-doc/base-drv/enumerate_hub.c:50: do { l_configure_usb_hub_00126: -;source-doc/base-drv/./enumerate_hub.c:51: CHECK(hub_clear_feature(hub_config, FEAT_PORT_POWER, i)); +;source-doc/base-drv/enumerate_hub.c:51: CHECK(hub_clear_feature(hub_config, FEAT_PORT_POWER, i)); push bc push de ld e,0x08 @@ -288,7 +274,7 @@ l_configure_usb_hub_00126: pop bc or a jp NZ, l_configure_usb_hub_00129 -;source-doc/base-drv/./enumerate_hub.c:53: CHECK(hub_set_feature(hub_config, FEAT_PORT_POWER, i)); +;source-doc/base-drv/enumerate_hub.c:53: CHECK(hub_set_feature(hub_config, FEAT_PORT_POWER, i)); push bc push de ld e,0x08 @@ -302,7 +288,7 @@ l_configure_usb_hub_00126: pop bc or a jp NZ, l_configure_usb_hub_00129 -;source-doc/base-drv/./enumerate_hub.c:55: hub_clear_feature(hub_config, FEAT_PORT_RESET, i); +;source-doc/base-drv/enumerate_hub.c:55: hub_clear_feature(hub_config, FEAT_PORT_RESET, i); push bc push de ld e,0x04 @@ -313,7 +299,7 @@ l_configure_usb_hub_00126: pop af pop de pop bc -;source-doc/base-drv/./enumerate_hub.c:57: CHECK(hub_set_feature(hub_config, FEAT_PORT_RESET, i)); +;source-doc/base-drv/enumerate_hub.c:57: CHECK(hub_set_feature(hub_config, FEAT_PORT_RESET, i)); push bc push de ld e,0x04 @@ -327,7 +313,7 @@ l_configure_usb_hub_00126: pop bc or a jp NZ, l_configure_usb_hub_00129 -;source-doc/base-drv/./enumerate_hub.c:59: CHECK(hub_get_status_port(hub_config, i, &port_status)); +;source-doc/base-drv/enumerate_hub.c:59: CHECK(hub_get_status_port(hub_config, i, &port_status)); push bc push de ld hl,12 @@ -345,13 +331,13 @@ l_configure_usb_hub_00126: pop bc or a jp NZ, l_configure_usb_hub_00129 -;source-doc/base-drv/./enumerate_hub.c:61: if (port_status.wPortStatus.port_connection) { +;source-doc/base-drv/enumerate_hub.c:61: if (port_status.wPortStatus.port_connection) { ld hl,8 add hl, sp ld a, (hl) and 0x01 jr Z,l_configure_usb_hub_00124 -;source-doc/base-drv/./enumerate_hub.c:62: CHECK(hub_clear_feature(hub_config, HUB_FEATURE_PORT_CONNECTION_CHA, i)); +;source-doc/base-drv/enumerate_hub.c:62: CHECK(hub_clear_feature(hub_config, HUB_FEATURE_PORT_CONNECTION_CHA, i)); push bc push de ld e,0x10 @@ -365,7 +351,7 @@ l_configure_usb_hub_00126: pop bc or a jr NZ,l_configure_usb_hub_00129 -;source-doc/base-drv/./enumerate_hub.c:64: CHECK(hub_clear_feature(hub_config, FEAT_PORT_ENABLE_CHANGE, i)); +;source-doc/base-drv/enumerate_hub.c:64: CHECK(hub_clear_feature(hub_config, FEAT_PORT_ENABLE_CHANGE, i)); push bc push de ld e,0x11 @@ -379,7 +365,7 @@ l_configure_usb_hub_00126: pop bc or a jr NZ,l_configure_usb_hub_00129 -;source-doc/base-drv/./enumerate_hub.c:66: CHECK(hub_clear_feature(hub_config, FEAT_PORT_RESET_CHANGE, i)); +;source-doc/base-drv/enumerate_hub.c:66: CHECK(hub_clear_feature(hub_config, FEAT_PORT_RESET_CHANGE, i)); push bc push de ld e,0x14 @@ -393,13 +379,13 @@ l_configure_usb_hub_00126: pop bc or a jr NZ,l_configure_usb_hub_00129 -;source-doc/base-drv/./enumerate_hub.c:67: delay_short(); +;source-doc/base-drv/enumerate_hub.c:67: delay_short(); push bc push de call _delay_short pop de pop bc -;source-doc/base-drv/./enumerate_hub.c:69: CHECK(hub_get_status_port(hub_config, i, &port_status)); +;source-doc/base-drv/enumerate_hub.c:69: CHECK(hub_get_status_port(hub_config, i, &port_status)); push bc push de ld hl,12 @@ -417,13 +403,13 @@ l_configure_usb_hub_00126: pop bc or a jr NZ,l_configure_usb_hub_00129 -;source-doc/base-drv/./enumerate_hub.c:70: delay_short(); +;source-doc/base-drv/enumerate_hub.c:70: delay_short(); push bc push de call _delay_short pop de pop bc -;source-doc/base-drv/./enumerate_hub.c:72: CHECK(read_all_configs(working->state)); +;source-doc/base-drv/enumerate_hub.c:72: CHECK(read_all_configs(working->state)); ld l,(ix-2) ld h,(ix-1) ld a, (hl) @@ -442,7 +428,7 @@ l_configure_usb_hub_00126: jr Z,l_configure_usb_hub_00127 jr l_configure_usb_hub_00129 l_configure_usb_hub_00124: -;source-doc/base-drv/./enumerate_hub.c:75: CHECK(hub_clear_feature(hub_config, FEAT_PORT_POWER, i)); +;source-doc/base-drv/enumerate_hub.c:75: CHECK(hub_clear_feature(hub_config, FEAT_PORT_POWER, i)); push bc push de ld e,0x08 @@ -457,18 +443,18 @@ l_configure_usb_hub_00124: or a jr NZ,l_configure_usb_hub_00129 l_configure_usb_hub_00127: -;source-doc/base-drv/./enumerate_hub.c:77: } while (--i != 0); +;source-doc/base-drv/enumerate_hub.c:77: } while (--i != 0); dec d jp NZ, l_configure_usb_hub_00126 -;source-doc/base-drv/./enumerate_hub.c:79: return USB_ERR_OK; +;source-doc/base-drv/enumerate_hub.c:79: return USB_ERR_OK; ld l,0x00 jr l_configure_usb_hub_00130 -;source-doc/base-drv/./enumerate_hub.c:80: done: +;source-doc/base-drv/enumerate_hub.c:80: done: l_configure_usb_hub_00129: -;source-doc/base-drv/./enumerate_hub.c:81: return result; +;source-doc/base-drv/enumerate_hub.c:81: return result; ld l, a l_configure_usb_hub_00130: -;source-doc/base-drv/./enumerate_hub.c:82: } +;source-doc/base-drv/enumerate_hub.c:82: } ld sp, ix pop ix ret diff --git a/Source/HBIOS/ch376-native/base-drv/enumerate_storage.c.s b/Source/HBIOS/ch376-native/base-drv/enumerate_storage.c.s index 0211f31d..72982a22 100644 --- a/Source/HBIOS/ch376-native/base-drv/enumerate_storage.c.s +++ b/Source/HBIOS/ch376-native/base-drv/enumerate_storage.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/base-drv/./enumerate_storage.c.asm -- not to be modify directly +; Generated from source-doc/base-drv/enumerate_storage.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -48,7 +48,7 @@ _USB_MODULE_LEDS .EQU 0xff8a ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/base-drv/./enumerate_storage.c:5: void parse_endpoints(device_config *const storage_dev, const endpoint_descriptor const *pEndpoint) { +;source-doc/base-drv/enumerate_storage.c:5: void parse_endpoints(device_config *const storage_dev, const endpoint_descriptor const *pEndpoint) { ; --------------------------------- ; Function parse_endpoints ; --------------------------------- @@ -57,80 +57,75 @@ _parse_endpoints: ld ix,0 add ix,sp push af -;source-doc/base-drv/./enumerate_storage.c:7: if (!(pEndpoint->bmAttributes & 0x02)) - ld c,(ix+6) - ld b,(ix+7) - ld l, c - ld h, b +;source-doc/base-drv/enumerate_storage.c:7: if (!(pEndpoint->bmAttributes & 0x02)) + ld l,(ix+6) + ld h,(ix+7) + ld c,l + ld b,h inc hl inc hl inc hl ld a, (hl) ld (ix-2),a - bit 1,(ix-2) -;source-doc/base-drv/./enumerate_storage.c:8: return; + bit 1,a +;source-doc/base-drv/enumerate_storage.c:8: return; jr Z,l_parse_endpoints_00108 -;source-doc/base-drv/./enumerate_storage.c:10: const uint8_t x = calc_max_packet_sizex(pEndpoint->wMaxPacketSize); - ld e, c - ld d, b +;source-doc/base-drv/enumerate_storage.c:10: const uint8_t x = calc_max_packet_sizex(pEndpoint->wMaxPacketSize); ld hl,4 - add hl, de + add hl,bc ld a, (hl) ld (ix-1),a -;source-doc/base-drv/./enumerate_storage.c:11: endpoint_param *const eps = storage_dev->endpoints; +;source-doc/base-drv/enumerate_storage.c:11: endpoint_param *const eps = storage_dev->endpoints; ld e,(ix+4) ld d,(ix+5) inc de inc de inc de -;source-doc/base-drv/./enumerate_storage.c:15: if (!(pEndpoint->bEndpointAddress & 0x80)) +;source-doc/base-drv/enumerate_storage.c:15: if (!(pEndpoint->bEndpointAddress & 0x80)) inc bc inc bc ld a, (bc) - ld l,a + ld c,a and 0x80 - ld c, a - xor a -;source-doc/base-drv/./enumerate_storage.c:14: if (pEndpoint->bmAttributes & 0x01) { // 3 -> Interrupt + ld b,0x00 +;source-doc/base-drv/enumerate_storage.c:14: if (pEndpoint->bmAttributes & 0x01) { // 3 -> Interrupt bit 0,(ix-2) jr Z,l_parse_endpoints_00106 -;source-doc/base-drv/./enumerate_storage.c:15: if (!(pEndpoint->bEndpointAddress & 0x80)) - or c -;source-doc/base-drv/./enumerate_storage.c:16: return; +;source-doc/base-drv/enumerate_storage.c:15: if (!(pEndpoint->bEndpointAddress & 0x80)) + or b +;source-doc/base-drv/enumerate_storage.c:16: return; jr Z,l_parse_endpoints_00108 -;source-doc/base-drv/./enumerate_storage.c:18: ep = &eps[ENDPOINT_INTERRUPT_IN]; - ld a, e - add a,0x06 - ld e, a - jr NC,l_parse_endpoints_00107 - inc d +;source-doc/base-drv/enumerate_storage.c:18: ep = &eps[ENDPOINT_INTERRUPT_IN]; + ld hl,0x0006 + add hl, de + ex de, hl jr l_parse_endpoints_00107 l_parse_endpoints_00106: -;source-doc/base-drv/./enumerate_storage.c:21: ep = (pEndpoint->bEndpointAddress & 0x80) ? &eps[ENDPOINT_BULK_IN] : &eps[ENDPOINT_BULK_OUT]; - or c +;source-doc/base-drv/enumerate_storage.c:21: ep = (pEndpoint->bEndpointAddress & 0x80) ? &eps[ENDPOINT_BULK_IN] : &eps[ENDPOINT_BULK_OUT]; + or b jr Z,l_parse_endpoints_00110 inc de inc de inc de l_parse_endpoints_00110: l_parse_endpoints_00107: -;source-doc/base-drv/./enumerate_storage.c:24: ep->number = pEndpoint->bEndpointAddress & 0x07; - ld c, e - ld b, d - ld a, l +;source-doc/base-drv/enumerate_storage.c:24: ep->number = pEndpoint->bEndpointAddress & 0x07; + ld l, e + ld h, d + ld a, c and 0x07 rlca and 0x0e - ld l, a - ld a, (bc) + ld c, a + ld a, (hl) and 0xf1 - or l - ld (bc), a -;source-doc/base-drv/./enumerate_storage.c:25: ep->toggle = 0; + or c + ld (hl), a +;source-doc/base-drv/enumerate_storage.c:25: ep->toggle = 0; ld l, e ld h, d res 0, (hl) -;source-doc/base-drv/./enumerate_storage.c:26: ep->max_packet_sizex = x; +;source-doc/base-drv/enumerate_storage.c:26: ep->max_packet_sizex = x; inc de ld a,(ix-1) ld b,0x00 @@ -144,7 +139,7 @@ l_parse_endpoints_00107: or l ld (de), a l_parse_endpoints_00108: -;source-doc/base-drv/./enumerate_storage.c:27: } +;source-doc/base-drv/enumerate_storage.c:27: } ld sp, ix pop ix ret diff --git a/Source/HBIOS/ch376-native/base-drv/protocol.c.s b/Source/HBIOS/ch376-native/base-drv/protocol.c.s index 0ffb9902..d91b03d5 100644 --- a/Source/HBIOS/ch376-native/base-drv/protocol.c.s +++ b/Source/HBIOS/ch376-native/base-drv/protocol.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/base-drv/./protocol.c.asm -- not to be modify directly +; Generated from source-doc/base-drv/protocol.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -48,7 +48,7 @@ _USB_MODULE_LEDS .EQU 0xff8a ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/base-drv/./protocol.c:29: usb_error usbtrn_get_descriptor(device_descriptor *const buffer) { +;source-doc/base-drv/protocol.c:29: usb_error usbtrn_get_descriptor(device_descriptor *const buffer) { ; --------------------------------- ; Function usbtrn_get_descriptor ; --------------------------------- @@ -59,18 +59,18 @@ _usbtrn_get_descriptor: ld hl, -8 add hl, sp ld sp, hl -;source-doc/base-drv/./protocol.c:31: cmd = cmd_get_device_descriptor; +;source-doc/base-drv/protocol.c:31: cmd = cmd_get_device_descriptor; ld hl,0 add hl, sp ex de, hl - ld hl,_cmd_get_device_descriptor ld bc,0x0008 + ld hl,_cmd_get_device_descriptor ldir -;source-doc/base-drv/./protocol.c:32: cmd.wLength = 8; +;source-doc/base-drv/protocol.c:32: cmd.wLength = 8; ld (ix-2),0x08 xor a ld (ix-1),a -;source-doc/base-drv/./protocol.c:34: result = usb_control_transfer(&cmd, (uint8_t *)buffer, 0, 8); +;source-doc/base-drv/protocol.c:34: result = usb_control_transfer(&cmd, (uint8_t *)buffer, 0, 8); ld c,(ix+4) ld b,(ix+5) ld e, c @@ -93,24 +93,24 @@ _usbtrn_get_descriptor: pop bc ld a, l ld (_result), a -;source-doc/base-drv/./protocol.c:36: CHECK(result); +;source-doc/base-drv/protocol.c:36: CHECK(result); ld a,(_result) or a jr NZ,l_usbtrn_get_descriptor_00103 -;source-doc/base-drv/./protocol.c:38: cmd = cmd_get_device_descriptor; +;source-doc/base-drv/protocol.c:38: cmd = cmd_get_device_descriptor; ld hl,0 add hl, sp ex de, hl push bc - ld hl,_cmd_get_device_descriptor ld bc,0x0008 + ld hl,_cmd_get_device_descriptor ldir pop bc -;source-doc/base-drv/./protocol.c:39: cmd.wLength = 18; +;source-doc/base-drv/protocol.c:39: cmd.wLength = 18; ld (ix-2),0x12 xor a ld (ix-1),a -;source-doc/base-drv/./protocol.c:40: result = usb_control_transfer(&cmd, (uint8_t *)buffer, 0, buffer->bMaxPacketSize0); +;source-doc/base-drv/protocol.c:40: result = usb_control_transfer(&cmd, (uint8_t *)buffer, 0, buffer->bMaxPacketSize0); ld e,(ix+4) ld d,(ix+5) ld hl,7 @@ -131,13 +131,12 @@ _usbtrn_get_descriptor: pop af ld a, l ld (_result), a -;source-doc/base-drv/./protocol.c:42: RETURN_CHECK(result); -;source-doc/base-drv/./protocol.c:44: done: +;source-doc/base-drv/protocol.c:42: RETURN_CHECK(result); +;source-doc/base-drv/protocol.c:44: done: l_usbtrn_get_descriptor_00103: -;source-doc/base-drv/./protocol.c:45: return result; - ld hl,_result - ld l, (hl) -;source-doc/base-drv/./protocol.c:46: } +;source-doc/base-drv/protocol.c:45: return result; + ld hl,(_result) +;source-doc/base-drv/protocol.c:46: } ld sp, ix pop ix ret @@ -149,7 +148,7 @@ _cmd_get_device_descriptor: DEFB +0x00 DEFB +0x00 DEFW +0x0008 -;source-doc/base-drv/./protocol.c:54: usb_error usbtrn_get_descriptor2(device_descriptor *const buffer, const uint8_t device_address) { +;source-doc/base-drv/protocol.c:54: usb_error usbtrn_get_descriptor2(device_descriptor *const buffer, const uint8_t device_address) { ; --------------------------------- ; Function usbtrn_get_descriptor2 ; --------------------------------- @@ -160,29 +159,26 @@ _usbtrn_get_descriptor2: ld hl, -8 add hl, sp ld sp, hl -;source-doc/base-drv/./protocol.c:56: cmd = cmd_get_device_descriptor; +;source-doc/base-drv/protocol.c:56: cmd = cmd_get_device_descriptor; ld hl,0 add hl, sp ex de, hl - ld hl,_cmd_get_device_descriptor ld bc,0x0008 + ld hl,_cmd_get_device_descriptor ldir -;source-doc/base-drv/./protocol.c:57: cmd.wLength = 8; +;source-doc/base-drv/protocol.c:57: cmd.wLength = 8; ld (ix-2),0x08 xor a ld (ix-1),a -;source-doc/base-drv/./protocol.c:59: result = usb_control_transfer(&cmd, (uint8_t *)buffer, device_address, 8); +;source-doc/base-drv/protocol.c:59: result = usb_control_transfer(&cmd, (uint8_t *)buffer, device_address, 8); ld c,(ix+4) ld b,(ix+5) ld e, c ld d, b push bc - ld a,0x08 - push af - inc sp - ld a,(ix+6) - push af - inc sp + ld h,0x08 + ld l,(ix+6) + push hl push de ld hl,6 add hl, sp @@ -194,34 +190,31 @@ _usbtrn_get_descriptor2: pop bc ld a, l ld (_result), a -;source-doc/base-drv/./protocol.c:61: CHECK(result); +;source-doc/base-drv/protocol.c:61: CHECK(result); ld a,(_result) or a jr NZ,l_usbtrn_get_descriptor2_00103 -;source-doc/base-drv/./protocol.c:63: cmd = cmd_get_device_descriptor; +;source-doc/base-drv/protocol.c:63: cmd = cmd_get_device_descriptor; ld hl,0 add hl, sp ex de, hl push bc - ld hl,_cmd_get_device_descriptor ld bc,0x0008 + ld hl,_cmd_get_device_descriptor ldir pop bc -;source-doc/base-drv/./protocol.c:64: cmd.wLength = 18; +;source-doc/base-drv/protocol.c:64: cmd.wLength = 18; ld (ix-2),0x12 xor a ld (ix-1),a -;source-doc/base-drv/./protocol.c:65: RETURN_CHECK(usb_control_transfer(&cmd, (uint8_t *)buffer, device_address, buffer->bMaxPacketSize0)); +;source-doc/base-drv/protocol.c:65: RETURN_CHECK(usb_control_transfer(&cmd, (uint8_t *)buffer, device_address, buffer->bMaxPacketSize0)); ld e,(ix+4) ld d,(ix+5) ld hl,7 add hl, de - ld a, (hl) - push af - inc sp - ld a,(ix+6) - push af - inc sp + ld h,(hl) + ld l,(ix+6) + push hl push bc ld hl,4 add hl, sp @@ -232,16 +225,15 @@ _usbtrn_get_descriptor2: pop af ld a, l ld (_result), a -;source-doc/base-drv/./protocol.c:66: done: +;source-doc/base-drv/protocol.c:66: done: l_usbtrn_get_descriptor2_00103: -;source-doc/base-drv/./protocol.c:67: return result; - ld hl,_result - ld l, (hl) -;source-doc/base-drv/./protocol.c:68: } +;source-doc/base-drv/protocol.c:67: return result; + ld hl,(_result) +;source-doc/base-drv/protocol.c:68: } ld sp, ix pop ix ret -;source-doc/base-drv/./protocol.c:78: usb_error usbtrn_set_address(const uint8_t device_address) __z88dk_fastcall { +;source-doc/base-drv/protocol.c:78: usb_error usbtrn_set_address(const uint8_t device_address) __z88dk_fastcall { ; --------------------------------- ; Function usbtrn_set_address ; --------------------------------- @@ -254,18 +246,18 @@ _usbtrn_set_address: push af push af ld c, l -;source-doc/base-drv/./protocol.c:80: cmd = cmd_set_device_address; +;source-doc/base-drv/protocol.c:80: cmd = cmd_set_device_address; ld hl,0 add hl, sp ex de, hl push bc - ld hl,_cmd_set_device_address ld bc,0x0008 + ld hl,_cmd_set_device_address ldir pop bc -;source-doc/base-drv/./protocol.c:81: cmd.bValue[0] = device_address; +;source-doc/base-drv/protocol.c:81: cmd.bValue[0] = device_address; ld (ix-6),c -;source-doc/base-drv/./protocol.c:83: return usb_control_transfer(&cmd, 0, 0, 0); +;source-doc/base-drv/protocol.c:83: return usb_control_transfer(&cmd, 0, 0, 0); xor a push af inc sp @@ -278,7 +270,7 @@ _usbtrn_set_address: add hl, sp push hl call _usb_control_transfer -;source-doc/base-drv/./protocol.c:84: } +;source-doc/base-drv/protocol.c:84: } ld sp,ix pop ix ret @@ -290,7 +282,7 @@ _cmd_set_device_address: DEFB +0x00 DEFB +0x00 DEFW +0x0000 -;source-doc/base-drv/./protocol.c:94: usb_error usbtrn_set_configuration(const uint8_t device_address, const uint8_t max_packet_size, const uint8_t configuration) { +;source-doc/base-drv/protocol.c:94: usb_error usbtrn_set_configuration(const uint8_t device_address, const uint8_t max_packet_size, const uint8_t configuration) { ; --------------------------------- ; Function usbtrn_set_configuration ; --------------------------------- @@ -301,22 +293,20 @@ _usbtrn_set_configuration: ld hl, -8 add hl, sp ld sp, hl -;source-doc/base-drv/./protocol.c:96: cmd = cmd_set_configuration; +;source-doc/base-drv/protocol.c:96: cmd = cmd_set_configuration; ld hl,0 add hl, sp - ld c, l - ld b, h - ld e, c - ld d, b - push bc - ld hl,_cmd_set_configuration + ld e,l + ld d,h + push hl ld bc,0x0008 + ld hl,_cmd_set_configuration ldir pop bc -;source-doc/base-drv/./protocol.c:97: cmd.bValue[0] = configuration; +;source-doc/base-drv/protocol.c:97: cmd.bValue[0] = configuration; ld a,(ix+6) ld (ix-6),a -;source-doc/base-drv/./protocol.c:99: return usb_control_transfer(&cmd, 0, device_address, max_packet_size); +;source-doc/base-drv/protocol.c:99: return usb_control_transfer(&cmd, 0, device_address, max_packet_size); ld h,(ix+5) ld l,(ix+4) push hl @@ -324,7 +314,7 @@ _usbtrn_set_configuration: push hl push bc call _usb_control_transfer -;source-doc/base-drv/./protocol.c:100: } +;source-doc/base-drv/protocol.c:100: } ld sp,ix pop ix ret @@ -336,7 +326,7 @@ _cmd_set_configuration: DEFB +0x00 DEFB +0x00 DEFW +0x0000 -;source-doc/base-drv/./protocol.c:114: usb_error usbtrn_get_config_descriptor(config_descriptor *const buffer, +;source-doc/base-drv/protocol.c:114: usb_error usbtrn_get_config_descriptor(config_descriptor *const buffer, ; --------------------------------- ; Function usbtrn_get_config_descriptor ; --------------------------------- @@ -347,26 +337,24 @@ _usbtrn_get_config_descriptor: ld hl, -8 add hl, sp ld sp, hl -;source-doc/base-drv/./protocol.c:120: cmd = cmd_get_config_descriptor; +;source-doc/base-drv/protocol.c:120: cmd = cmd_get_config_descriptor; ld hl,0 add hl, sp - ld c, l - ld b, h - ld e, c - ld d, b - push bc - ld hl,_cmd_get_config_descriptor + ld e,l + ld d,h + push hl ld bc,0x0008 + ld hl,_cmd_get_config_descriptor ldir pop bc -;source-doc/base-drv/./protocol.c:121: cmd.bValue[0] = config_index; +;source-doc/base-drv/protocol.c:121: cmd.bValue[0] = config_index; ld a,(ix+6) ld (ix-6),a -;source-doc/base-drv/./protocol.c:122: cmd.wLength = (uint16_t)buffer_size; +;source-doc/base-drv/protocol.c:122: cmd.wLength = (uint16_t)buffer_size; ld e,(ix+7) ld (ix-2),e ld (ix-1),0x00 -;source-doc/base-drv/./protocol.c:124: return usb_control_transfer(&cmd, (uint8_t *)buffer, device_address, max_packet_size); +;source-doc/base-drv/protocol.c:124: return usb_control_transfer(&cmd, (uint8_t *)buffer, device_address, max_packet_size); ld e,(ix+4) ld d,(ix+5) ld h,(ix+9) @@ -375,7 +363,7 @@ _usbtrn_get_config_descriptor: push de push bc call _usb_control_transfer -;source-doc/base-drv/./protocol.c:125: } +;source-doc/base-drv/protocol.c:125: } ld sp,ix pop ix ret @@ -387,7 +375,7 @@ _cmd_get_config_descriptor: DEFB +0x00 DEFB +0x00 DEFW +0x0000 -;source-doc/base-drv/./protocol.c:127: usb_error usbtrn_gfull_cfg_desc(const uint8_t config_index, +;source-doc/base-drv/protocol.c:127: usb_error usbtrn_gfull_cfg_desc(const uint8_t config_index, ; --------------------------------- ; Function usbtrn_gfull_cfg_desc ; --------------------------------- @@ -395,7 +383,7 @@ _usbtrn_gfull_cfg_desc: push ix ld ix,0 add ix,sp -;source-doc/base-drv/./protocol.c:134: max_packet_size)); +;source-doc/base-drv/protocol.c:134: max_packet_size)); ld c,(ix+8) ld b,(ix+9) push bc @@ -419,28 +407,25 @@ _usbtrn_gfull_cfg_desc: ld a,(_result) or a jr NZ,l_usbtrn_gfull_cfg_desc_00107 -;source-doc/base-drv/./protocol.c:136: uint8_t max_length = ((config_descriptor *)buffer)->wTotalLength; +;source-doc/base-drv/protocol.c:136: uint8_t max_length = ((config_descriptor *)buffer)->wTotalLength; ld l, c ld h, b inc hl inc hl ld d, (hl) -;source-doc/base-drv/./protocol.c:137: if (max_length > max_buffer_size) +;source-doc/base-drv/protocol.c:137: if (max_length > max_buffer_size) ld a,(ix+7) sub d jr NC,l_usbtrn_gfull_cfg_desc_00104 -;source-doc/base-drv/./protocol.c:138: max_length = max_buffer_size; +;source-doc/base-drv/protocol.c:138: max_length = max_buffer_size; ld d,(ix+7) l_usbtrn_gfull_cfg_desc_00104: -;source-doc/base-drv/./protocol.c:140: CHECK(usbtrn_get_config_descriptor((config_descriptor *)buffer, config_index, max_length, device_address, max_packet_size)); +;source-doc/base-drv/protocol.c:140: CHECK(usbtrn_get_config_descriptor((config_descriptor *)buffer, config_index, max_length, device_address, max_packet_size)); ld h,(ix+6) ld l,(ix+5) push hl + ld e,(ix+4) push de - inc sp - ld a,(ix+4) - push af - inc sp push bc call _usbtrn_get_config_descriptor pop af @@ -449,21 +434,20 @@ l_usbtrn_gfull_cfg_desc_00104: ld a, l ld (_result), a ld a,(_result) -;source-doc/base-drv/./protocol.c:142: return USB_ERR_OK; +;source-doc/base-drv/protocol.c:142: return USB_ERR_OK; or a jr NZ,l_usbtrn_gfull_cfg_desc_00107 ld l,a jr l_usbtrn_gfull_cfg_desc_00108 -;source-doc/base-drv/./protocol.c:143: done: +;source-doc/base-drv/protocol.c:143: done: l_usbtrn_gfull_cfg_desc_00107: -;source-doc/base-drv/./protocol.c:144: return result; - ld hl,_result - ld l, (hl) +;source-doc/base-drv/protocol.c:144: return result; + ld hl,(_result) l_usbtrn_gfull_cfg_desc_00108: -;source-doc/base-drv/./protocol.c:145: } +;source-doc/base-drv/protocol.c:145: } pop ix ret -;source-doc/base-drv/./protocol.c:149: usb_error usbtrn_clear_endpoint_halt(const uint8_t endpoint_number, const uint8_t device_address, const uint8_t max_packet_size) { +;source-doc/base-drv/protocol.c:149: usb_error usbtrn_clear_endpoint_halt(const uint8_t endpoint_number, const uint8_t device_address, const uint8_t max_packet_size) { ; --------------------------------- ; Function usbtrn_clear_endpoint_halt ; --------------------------------- @@ -474,22 +458,20 @@ _usbtrn_clear_endpoint_halt: ld hl, -8 add hl, sp ld sp, hl -;source-doc/base-drv/./protocol.c:151: cmd = usb_cmd_clear_endpoint_halt; +;source-doc/base-drv/protocol.c:151: cmd = usb_cmd_clear_endpoint_halt; ld hl,0 add hl, sp - ld c, l - ld b, h - ld e, c - ld d, b - push bc - ld hl,_usb_cmd_clear_endpoint_halt + ld e,l + ld d,h + push hl ld bc,0x0008 + ld hl,_usb_cmd_clear_endpoint_halt ldir pop bc -;source-doc/base-drv/./protocol.c:152: cmd.bIndex[0] = endpoint_number; +;source-doc/base-drv/protocol.c:152: cmd.bIndex[0] = endpoint_number; ld a,(ix+4) ld (ix-4),a -;source-doc/base-drv/./protocol.c:154: return usb_control_transfer(&cmd, (uint8_t *)0, device_address, max_packet_size); +;source-doc/base-drv/protocol.c:154: return usb_control_transfer(&cmd, (uint8_t *)0, device_address, max_packet_size); ld h,(ix+6) ld l,(ix+5) push hl @@ -497,7 +479,7 @@ _usbtrn_clear_endpoint_halt: push hl push bc call _usb_control_transfer -;source-doc/base-drv/./protocol.c:155: } +;source-doc/base-drv/protocol.c:155: } ld sp,ix pop ix ret diff --git a/Source/HBIOS/ch376-native/base-drv/transfers.c.asm b/Source/HBIOS/ch376-native/base-drv/transfers.c.asm new file mode 100644 index 00000000..0bc83830 --- /dev/null +++ b/Source/HBIOS/ch376-native/base-drv/transfers.c.asm @@ -0,0 +1,829 @@ +;-------------------------------------------------------- +; File Created by SDCC : free open source ISO C Compiler +; Version 4.4.0 #14648 (Linux) +;-------------------------------------------------------- +; Processed by Z88DK +;-------------------------------------------------------- + + EXTERN __divschar + EXTERN __divschar_callee + EXTERN __divsint + EXTERN __divsint_callee + EXTERN __divslong + EXTERN __divslong_callee + EXTERN __divslonglong + EXTERN __divslonglong_callee + EXTERN __divsuchar + EXTERN __divsuchar_callee + EXTERN __divuchar + EXTERN __divuchar_callee + EXTERN __divuint + EXTERN __divuint_callee + EXTERN __divulong + EXTERN __divulong_callee + EXTERN __divulonglong + EXTERN __divulonglong_callee + EXTERN __divuschar + EXTERN __divuschar_callee + EXTERN __modschar + EXTERN __modschar_callee + EXTERN __modsint + EXTERN __modsint_callee + EXTERN __modslong + EXTERN __modslong_callee + EXTERN __modslonglong + EXTERN __modslonglong_callee + EXTERN __modsuchar + EXTERN __modsuchar_callee + EXTERN __moduchar + EXTERN __moduchar_callee + EXTERN __moduint + EXTERN __moduint_callee + EXTERN __modulong + EXTERN __modulong_callee + EXTERN __modulonglong + EXTERN __modulonglong_callee + EXTERN __moduschar + EXTERN __moduschar_callee + EXTERN __mulint + EXTERN __mulint_callee + EXTERN __mullong + EXTERN __mullong_callee + EXTERN __mullonglong + EXTERN __mullonglong_callee + EXTERN __mulschar + EXTERN __mulschar_callee + EXTERN __mulsuchar + EXTERN __mulsuchar_callee + EXTERN __muluchar + EXTERN __muluchar_callee + EXTERN __muluschar + EXTERN __muluschar_callee + EXTERN __rlslonglong + EXTERN __rlslonglong_callee + EXTERN __rlulonglong + EXTERN __rlulonglong_callee + EXTERN __rrslonglong + EXTERN __rrslonglong_callee + EXTERN __rrulonglong + EXTERN __rrulonglong_callee + EXTERN ___mulsint2slong + EXTERN ___mulsint2slong_callee + EXTERN ___muluint2ulong + EXTERN ___muluint2ulong_callee + EXTERN ___sdcc_call_hl + EXTERN ___sdcc_call_iy + EXTERN ___sdcc_enter_ix + EXTERN banked_call + EXTERN _banked_ret + EXTERN ___fs2schar + EXTERN ___fs2schar_callee + EXTERN ___fs2sint + EXTERN ___fs2sint_callee + EXTERN ___fs2slong + EXTERN ___fs2slong_callee + EXTERN ___fs2slonglong + EXTERN ___fs2slonglong_callee + EXTERN ___fs2uchar + EXTERN ___fs2uchar_callee + EXTERN ___fs2uint + EXTERN ___fs2uint_callee + EXTERN ___fs2ulong + EXTERN ___fs2ulong_callee + EXTERN ___fs2ulonglong + EXTERN ___fs2ulonglong_callee + EXTERN ___fsadd + EXTERN ___fsadd_callee + EXTERN ___fsdiv + EXTERN ___fsdiv_callee + EXTERN ___fseq + EXTERN ___fseq_callee + EXTERN ___fsgt + EXTERN ___fsgt_callee + EXTERN ___fslt + EXTERN ___fslt_callee + EXTERN ___fsmul + EXTERN ___fsmul_callee + EXTERN ___fsneq + EXTERN ___fsneq_callee + EXTERN ___fssub + EXTERN ___fssub_callee + EXTERN ___schar2fs + EXTERN ___schar2fs_callee + EXTERN ___sint2fs + EXTERN ___sint2fs_callee + EXTERN ___slong2fs + EXTERN ___slong2fs_callee + EXTERN ___slonglong2fs + EXTERN ___slonglong2fs_callee + EXTERN ___uchar2fs + EXTERN ___uchar2fs_callee + EXTERN ___uint2fs + EXTERN ___uint2fs_callee + EXTERN ___ulong2fs + EXTERN ___ulong2fs_callee + EXTERN ___ulonglong2fs + EXTERN ___ulonglong2fs_callee + EXTERN ____sdcc_2_copy_src_mhl_dst_deix + EXTERN ____sdcc_2_copy_src_mhl_dst_bcix + EXTERN ____sdcc_4_copy_src_mhl_dst_deix + EXTERN ____sdcc_4_copy_src_mhl_dst_bcix + EXTERN ____sdcc_4_copy_src_mhl_dst_mbc + EXTERN ____sdcc_4_ldi_nosave_bc + EXTERN ____sdcc_4_ldi_save_bc + EXTERN ____sdcc_4_push_hlix + EXTERN ____sdcc_4_push_mhl + EXTERN ____sdcc_lib_setmem_hl + EXTERN ____sdcc_ll_add_de_bc_hl + EXTERN ____sdcc_ll_add_de_bc_hlix + EXTERN ____sdcc_ll_add_de_hlix_bc + EXTERN ____sdcc_ll_add_de_hlix_bcix + EXTERN ____sdcc_ll_add_deix_bc_hl + EXTERN ____sdcc_ll_add_deix_hlix + EXTERN ____sdcc_ll_add_hlix_bc_deix + EXTERN ____sdcc_ll_add_hlix_deix_bc + EXTERN ____sdcc_ll_add_hlix_deix_bcix + EXTERN ____sdcc_ll_asr_hlix_a + EXTERN ____sdcc_ll_asr_mbc_a + EXTERN ____sdcc_ll_copy_src_de_dst_hlix + EXTERN ____sdcc_ll_copy_src_de_dst_hlsp + EXTERN ____sdcc_ll_copy_src_deix_dst_hl + EXTERN ____sdcc_ll_copy_src_deix_dst_hlix + EXTERN ____sdcc_ll_copy_src_deixm_dst_hlsp + EXTERN ____sdcc_ll_copy_src_desp_dst_hlsp + EXTERN ____sdcc_ll_copy_src_hl_dst_de + EXTERN ____sdcc_ll_copy_src_hlsp_dst_de + EXTERN ____sdcc_ll_copy_src_hlsp_dst_deixm + EXTERN ____sdcc_ll_lsl_hlix_a + EXTERN ____sdcc_ll_lsl_mbc_a + EXTERN ____sdcc_ll_lsr_hlix_a + EXTERN ____sdcc_ll_lsr_mbc_a + EXTERN ____sdcc_ll_push_hlix + EXTERN ____sdcc_ll_push_mhl + EXTERN ____sdcc_ll_sub_de_bc_hl + EXTERN ____sdcc_ll_sub_de_bc_hlix + EXTERN ____sdcc_ll_sub_de_hlix_bc + EXTERN ____sdcc_ll_sub_de_hlix_bcix + EXTERN ____sdcc_ll_sub_deix_bc_hl + EXTERN ____sdcc_ll_sub_deix_hlix + EXTERN ____sdcc_ll_sub_hlix_bc_deix + EXTERN ____sdcc_ll_sub_hlix_deix_bc + EXTERN ____sdcc_ll_sub_hlix_deix_bcix + EXTERN ____sdcc_load_debc_deix + EXTERN ____sdcc_load_dehl_deix + EXTERN ____sdcc_load_debc_mhl + EXTERN ____sdcc_load_hlde_mhl + EXTERN ____sdcc_store_dehl_bcix + EXTERN ____sdcc_store_debc_hlix + EXTERN ____sdcc_store_debc_mhl + EXTERN ____sdcc_cpu_pop_ei + EXTERN ____sdcc_cpu_pop_ei_jp + EXTERN ____sdcc_cpu_push_di + EXTERN ____sdcc_outi + EXTERN ____sdcc_outi_128 + EXTERN ____sdcc_outi_256 + EXTERN ____sdcc_ldi + EXTERN ____sdcc_ldi_128 + EXTERN ____sdcc_ldi_256 + EXTERN ____sdcc_4_copy_srcd_hlix_dst_deix + EXTERN ____sdcc_4_and_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_or_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_or_src_dehl_dst_bcix + EXTERN ____sdcc_4_xor_src_dehl_dst_bcix + EXTERN ____sdcc_4_and_src_dehl_dst_bcix + EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_or_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_cpl_src_mhl_dst_debc + EXTERN ____sdcc_4_xor_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_or_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_debc_hlix_dst_debc + EXTERN ____sdcc_4_or_src_debc_hlix_dst_debc + EXTERN ____sdcc_4_xor_src_debc_hlix_dst_debc + +;-------------------------------------------------------- +; Public variables in this module +;-------------------------------------------------------- + GLOBAL _usb_dat_in_trns_n_ext + GLOBAL _usb_dat_in_trnsfer_ext + GLOBAL _usb_ctrl_trnsfer_ext + GLOBAL _usb_control_transfer + GLOBAL _usb_data_in_transfer + GLOBAL _usb_data_in_transfer_n + GLOBAL _usb_data_out_transfer +;-------------------------------------------------------- +; Externals used +;-------------------------------------------------------- + GLOBAL _critical_end + GLOBAL _critical_begin + GLOBAL _print_uint16 + GLOBAL _print_string + GLOBAL _print_hex + GLOBAL _ch_issue_token_in_ep0 + GLOBAL _ch_issue_token_out_ep0 + GLOBAL _ch_issue_token_setup + GLOBAL _ch_data_out_transfer + GLOBAL _ch_data_in_transfer_n + GLOBAL _ch_data_in_transfer + GLOBAL _ch_control_transfer_set_config + GLOBAL _ch_control_transfer_set_address + GLOBAL _ch_control_transfer_request_descriptor + GLOBAL _ch_set_usb_address + GLOBAL _ch_write_data + GLOBAL _ch_cmd_get_ic_version + GLOBAL _ch_cmd_set_usb_mode + GLOBAL _ch_probe + GLOBAL _ch_cmd_reset_all + GLOBAL _ch_read_data + GLOBAL _ch_very_short_wait_int_and_get_status + GLOBAL _ch_short_wait_int_and_get_status + GLOBAL _ch_long_wait_int_and_get_status + GLOBAL _ch_get_status + GLOBAL _ch_command + GLOBAL _delay_medium + GLOBAL _delay_short + GLOBAL _delay_20ms + GLOBAL _printf + GLOBAL _delay + GLOBAL _ulltoa_callee + GLOBAL _ulltoa + GLOBAL _strtoull_callee + GLOBAL _strtoull + GLOBAL _strtoll_callee + GLOBAL _strtoll + GLOBAL _lltoa_callee + GLOBAL _lltoa + GLOBAL _llabs_callee + GLOBAL _llabs + GLOBAL __lldivu__callee + GLOBAL __lldivu_ + GLOBAL __lldiv__callee + GLOBAL __lldiv_ + GLOBAL _atoll_callee + GLOBAL _atoll + GLOBAL _realloc_unlocked_callee + GLOBAL _realloc_unlocked + GLOBAL _malloc_unlocked_fastcall + GLOBAL _malloc_unlocked + GLOBAL _free_unlocked_fastcall + GLOBAL _free_unlocked + GLOBAL _calloc_unlocked_callee + GLOBAL _calloc_unlocked + GLOBAL _aligned_alloc_unlocked_callee + GLOBAL _aligned_alloc_unlocked + GLOBAL _realloc_callee + GLOBAL _realloc + GLOBAL _malloc_fastcall + GLOBAL _malloc + GLOBAL _free_fastcall + GLOBAL _free + GLOBAL _calloc_callee + GLOBAL _calloc + GLOBAL _aligned_alloc_callee + GLOBAL _aligned_alloc + GLOBAL _utoa_callee + GLOBAL _utoa + GLOBAL _ultoa_callee + GLOBAL _ultoa + GLOBAL _system_fastcall + GLOBAL _system + GLOBAL _strtoul_callee + GLOBAL _strtoul + GLOBAL _strtol_callee + GLOBAL _strtol + GLOBAL _strtof_callee + GLOBAL _strtof + GLOBAL _strtod_callee + GLOBAL _strtod + GLOBAL _srand_fastcall + GLOBAL _srand + GLOBAL _rand + GLOBAL _quick_exit_fastcall + GLOBAL _quick_exit + GLOBAL _qsort_callee + GLOBAL _qsort + GLOBAL _ltoa_callee + GLOBAL _ltoa + GLOBAL _labs_fastcall + GLOBAL _labs + GLOBAL _itoa_callee + GLOBAL _itoa + GLOBAL _ftoh_callee + GLOBAL _ftoh + GLOBAL _ftog_callee + GLOBAL _ftog + GLOBAL _ftoe_callee + GLOBAL _ftoe + GLOBAL _ftoa_callee + GLOBAL _ftoa + GLOBAL _exit_fastcall + GLOBAL _exit + GLOBAL _dtoh_callee + GLOBAL _dtoh + GLOBAL _dtog_callee + GLOBAL _dtog + GLOBAL _dtoe_callee + GLOBAL _dtoe + GLOBAL _dtoa_callee + GLOBAL _dtoa + GLOBAL _bsearch_callee + GLOBAL _bsearch + GLOBAL _atol_fastcall + GLOBAL _atol + GLOBAL _atoi_fastcall + GLOBAL _atoi + GLOBAL _atof_fastcall + GLOBAL _atof + GLOBAL _atexit_fastcall + GLOBAL _atexit + GLOBAL _at_quick_exit_fastcall + GLOBAL _at_quick_exit + GLOBAL _abs_fastcall + GLOBAL _abs + GLOBAL _abort + GLOBAL __strtou__callee + GLOBAL __strtou_ + GLOBAL __strtoi__callee + GLOBAL __strtoi_ + GLOBAL __random_uniform_xor_8__fastcall + GLOBAL __random_uniform_xor_8_ + GLOBAL __random_uniform_xor_32__fastcall + GLOBAL __random_uniform_xor_32_ + GLOBAL __random_uniform_cmwc_8__fastcall + GLOBAL __random_uniform_cmwc_8_ + GLOBAL __shellsort__callee + GLOBAL __shellsort_ + GLOBAL __quicksort__callee + GLOBAL __quicksort_ + GLOBAL __insertion_sort__callee + GLOBAL __insertion_sort_ + GLOBAL __ldivu__callee + GLOBAL __ldivu_ + GLOBAL __ldiv__callee + GLOBAL __ldiv_ + GLOBAL __divu__callee + GLOBAL __divu_ + GLOBAL __div__callee + GLOBAL __div_ + GLOBAL _in_critical_usb_section + GLOBAL _result +;-------------------------------------------------------- +; special function registers +;-------------------------------------------------------- +defc _CH376_DATA_PORT = 0xff88 +defc _CH376_COMMAND_PORT = 0xff89 +defc _USB_MODULE_LEDS = 0xff8a +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + SECTION bss_compiler +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + +IF 0 + +; .area _INITIALIZED removed by z88dk + + +ENDIF + +;-------------------------------------------------------- +; absolute external ram data +;-------------------------------------------------------- + SECTION IGNORE +;-------------------------------------------------------- +; global & static initialisations +;-------------------------------------------------------- + SECTION code_crt_init +;-------------------------------------------------------- +; Home +;-------------------------------------------------------- + SECTION IGNORE +;-------------------------------------------------------- +; code +;-------------------------------------------------------- + SECTION code_compiler +;source-doc/base-drv/transfers.c:24: usb_error usb_ctrl_trnsfer_ext(const setup_packet *const cmd_packet, +; --------------------------------- +; Function usb_ctrl_trnsfer_ext +; --------------------------------- +_usb_ctrl_trnsfer_ext: + push ix + ld ix,0 + add ix,sp +;source-doc/base-drv/transfers.c:28: if ((uint16_t)cmd_packet < LOWER_SAFE_RAM_ADDRESS) + ld a,(ix+5) + sub a,0x80 + jr NC,l_usb_ctrl_trnsfer_ext_00102 +;source-doc/base-drv/transfers.c:29: return USB_BAD_ADDRESS; + ld l,0x82 + jr l_usb_ctrl_trnsfer_ext_00106 +l_usb_ctrl_trnsfer_ext_00102: +;source-doc/base-drv/transfers.c:31: if (buffer != 0 && (uint16_t)buffer < LOWER_SAFE_RAM_ADDRESS) + ld a,(ix+7) + or a,(ix+6) + jr Z,l_usb_ctrl_trnsfer_ext_00104 + ld a,(ix+7) + sub a,0x80 + jr NC,l_usb_ctrl_trnsfer_ext_00104 +;source-doc/base-drv/transfers.c:32: return USB_BAD_ADDRESS; + ld l,0x82 + jr l_usb_ctrl_trnsfer_ext_00106 +l_usb_ctrl_trnsfer_ext_00104: +;source-doc/base-drv/transfers.c:34: return usb_control_transfer(cmd_packet, buffer, device_address, max_packet_size); + ld h,(ix+9) + ld l,(ix+8) + push hl + ld l,(ix+6) + ld h,(ix+7) + push hl + ld l,(ix+4) + ld h,(ix+5) + push hl + call _usb_control_transfer + pop af + pop af + pop af +l_usb_ctrl_trnsfer_ext_00106: +;source-doc/base-drv/transfers.c:35: } + pop ix + ret +;source-doc/base-drv/transfers.c:47: usb_error usb_control_transfer(const setup_packet *const cmd_packet, +; --------------------------------- +; Function usb_control_transfer +; --------------------------------- +_usb_control_transfer: + push ix + ld ix,0 + add ix,sp + push af + push af +;source-doc/base-drv/transfers.c:52: endpoint_param endpoint = {1, 0, max_packet_size}; + ld hl,0 + add hl, sp + set 0, (hl) + ld hl,0 + add hl, sp + ld a, (hl) + and a,0xf1 + ld (hl), a + ld c,(ix+9) + ld b,0x00 + ld hl,1 + add hl, sp + ld (hl), c + inc hl + ld a, b + and a,0x03 + ld e,a + ld a, (hl) + and a,0xfc + or a, e + ld (hl), a +;source-doc/base-drv/transfers.c:54: const uint8_t transferIn = (cmd_packet->bmRequestType & 0x80); + ld c,(ix+4) + ld b,(ix+5) + ld a, (bc) + and a,0x80 +;source-doc/base-drv/transfers.c:56: if (transferIn && buffer == 0) + ld (ix-1),a + or a, a + jr Z,l_usb_control_transfer_00102 + ld a,(ix+7) + or a,(ix+6) + jr NZ,l_usb_control_transfer_00102 +;source-doc/base-drv/transfers.c:57: return USB_ERR_OTHER; + ld l,0x0f + jp l_usb_control_transfer_00114 +l_usb_control_transfer_00102: +;source-doc/base-drv/transfers.c:59: critical_begin(); + push bc + call _critical_begin + ld l,(ix+8) + call _ch_set_usb_address + pop bc +;source-doc/base-drv/transfers.c:63: ch_write_data((const uint8_t *)cmd_packet, sizeof(setup_packet)); + ld e,(ix+4) + ld d,(ix+5) + push bc + ld a,0x08 + push af + inc sp + push de + call _ch_write_data + pop af + inc sp + call _ch_issue_token_setup + call _ch_short_wait_int_and_get_status + pop bc +;source-doc/base-drv/transfers.c:66: CHECK(result); + ld a, l + or a, a + jr NZ,l_usb_control_transfer_00113 +;source-doc/base-drv/transfers.c:68: const uint16_t length = cmd_packet->wLength; + ld hl,6 + add hl, bc + ld c, (hl) + inc hl +;source-doc/base-drv/transfers.c:71: ? (transferIn ? ch_data_in_transfer(buffer, length, &endpoint) : ch_data_out_transfer(buffer, length, &endpoint)) + ld a,(hl) + ld b,a + or a, c + jr Z,l_usb_control_transfer_00116 + ld e,(ix+6) + ld d,(ix+7) + ld a,(ix-1) + or a, a + jr Z,l_usb_control_transfer_00118 + ld hl,0 + add hl, sp + push hl + push bc + push de + call _ch_data_in_transfer + pop af + pop af + pop af + jr l_usb_control_transfer_00119 +l_usb_control_transfer_00118: + ld hl,0 + add hl, sp + push hl + push bc + push de + call _ch_data_out_transfer + pop af + pop af + pop af +l_usb_control_transfer_00119: + jr l_usb_control_transfer_00117 +l_usb_control_transfer_00116: +;source-doc/base-drv/transfers.c:72: : USB_ERR_OK; + ld l,0x00 +l_usb_control_transfer_00117: +;source-doc/base-drv/transfers.c:74: CHECK(result) + ld a, l + or a, a + jr NZ,l_usb_control_transfer_00113 +;source-doc/base-drv/transfers.c:76: if (transferIn) { + ld a,(ix-1) + or a, a + jr Z,l_usb_control_transfer_00112 +;source-doc/base-drv/transfers.c:77: ch_command(CH_CMD_WR_HOST_DATA); + ld l,0x2c + call _ch_command +;source-doc/base-drv/transfers.c:78: CH376_DATA_PORT = 0; + ld a,0x00 + ld bc,_CH376_DATA_PORT + out (c),a +;source-doc/base-drv/transfers.c:79: ch_issue_token_out_ep0(); + call _ch_issue_token_out_ep0 +;source-doc/base-drv/transfers.c:80: result = ch_long_wait_int_and_get_status(); /* sometimes we get STALL here - seems to be ok to ignore */ + call _ch_long_wait_int_and_get_status +;source-doc/base-drv/transfers.c:82: if (result == USB_ERR_OK || result == USB_ERR_STALL) { + ld a,l + or a, a + jr Z,l_usb_control_transfer_00108 + sub a,0x02 + jr NZ,l_usb_control_transfer_00113 +l_usb_control_transfer_00108: +;source-doc/base-drv/transfers.c:83: result = USB_ERR_OK; + ld l,0x00 +;source-doc/base-drv/transfers.c:84: goto done; + jr l_usb_control_transfer_00113 +;source-doc/base-drv/transfers.c:87: RETURN_CHECK(result); +l_usb_control_transfer_00112: +;source-doc/base-drv/transfers.c:90: ch_issue_token_in_ep0(); + call _ch_issue_token_in_ep0 +;source-doc/base-drv/transfers.c:91: result = ch_long_wait_int_and_get_status(); + call _ch_long_wait_int_and_get_status +;source-doc/base-drv/transfers.c:95: done: +l_usb_control_transfer_00113: +;source-doc/base-drv/transfers.c:96: critical_end(); + push hl + call _critical_end + pop hl +;source-doc/base-drv/transfers.c:97: return result; +l_usb_control_transfer_00114: +;source-doc/base-drv/transfers.c:98: } + ld sp, ix + pop ix + ret +;source-doc/base-drv/transfers.c:101: usb_dat_in_trnsfer_ext(uint8_t *buffer, const uint16_t buffer_size, const uint8_t device_address, endpoint_param *const endpoint) { +; --------------------------------- +; Function usb_dat_in_trnsfer_ext +; --------------------------------- +_usb_dat_in_trnsfer_ext: + push ix + ld ix,0 + add ix,sp +;source-doc/base-drv/transfers.c:102: if (buffer != 0 && (uint16_t)buffer < LOWER_SAFE_RAM_ADDRESS) + ld a,(ix+5) + or a,(ix+4) + jr Z,l_usb_dat_in_trnsfer_ext_00102 + ld a,(ix+5) + sub a,0x80 + jr NC,l_usb_dat_in_trnsfer_ext_00102 +;source-doc/base-drv/transfers.c:103: return USB_BAD_ADDRESS; + ld l,0x82 + jr l_usb_dat_in_trnsfer_ext_00106 +l_usb_dat_in_trnsfer_ext_00102: +;source-doc/base-drv/transfers.c:105: if ((uint16_t)endpoint < LOWER_SAFE_RAM_ADDRESS) + ld a,(ix+10) + sub a,0x80 + jr NC,l_usb_dat_in_trnsfer_ext_00105 +;source-doc/base-drv/transfers.c:106: return USB_BAD_ADDRESS; + ld l,0x82 + jr l_usb_dat_in_trnsfer_ext_00106 +l_usb_dat_in_trnsfer_ext_00105: +;source-doc/base-drv/transfers.c:108: return usb_data_in_transfer(buffer, buffer_size, device_address, endpoint); + ld l,(ix+9) + ld h,(ix+10) + push hl + ld a,(ix+8) + push af + inc sp + ld l,(ix+6) + ld h,(ix+7) + push hl + ld l,(ix+4) + ld h,(ix+5) + push hl + call _usb_data_in_transfer + pop af + pop af + pop af + inc sp +l_usb_dat_in_trnsfer_ext_00106: +;source-doc/base-drv/transfers.c:109: } + pop ix + ret +;source-doc/base-drv/transfers.c:112: usb_dat_in_trns_n_ext(uint8_t *buffer, uint16_t *buffer_size, const uint8_t device_address, endpoint_param *const endpoint) { +; --------------------------------- +; Function usb_dat_in_trns_n_ext +; --------------------------------- +_usb_dat_in_trns_n_ext: + push ix + ld ix,0 + add ix,sp +;source-doc/base-drv/transfers.c:113: if (buffer != 0 && ((uint16_t)buffer & 0xC000) == 0) + ld a,(ix+5) + or a,(ix+4) + jr Z,l_usb_dat_in_trns_n_ext_00102 + ld a,(ix+5) + and a,0xc0 + jr NZ,l_usb_dat_in_trns_n_ext_00102 +;source-doc/base-drv/transfers.c:114: return USB_BAD_ADDRESS; + ld l,0x82 + jr l_usb_dat_in_trns_n_ext_00108 +l_usb_dat_in_trns_n_ext_00102: +;source-doc/base-drv/transfers.c:116: if (((uint16_t)endpoint & 0xC000) == 0) + ld a,(ix+10) + and a,0xc0 + jr NZ,l_usb_dat_in_trns_n_ext_00105 +;source-doc/base-drv/transfers.c:117: return USB_BAD_ADDRESS; + ld l,0x82 + jr l_usb_dat_in_trns_n_ext_00108 +l_usb_dat_in_trns_n_ext_00105: +;source-doc/base-drv/transfers.c:119: if (((uint16_t)buffer_size & 0xC000) == 0) + ld a,(ix+7) + and a,0xc0 + jr NZ,l_usb_dat_in_trns_n_ext_00107 +;source-doc/base-drv/transfers.c:120: return USB_BAD_ADDRESS; + ld l,0x82 + jr l_usb_dat_in_trns_n_ext_00108 +l_usb_dat_in_trns_n_ext_00107: +;source-doc/base-drv/transfers.c:122: return usb_data_in_transfer_n(buffer, buffer_size, device_address, endpoint); + ld c,(ix+6) + ld b,(ix+7) + ld l,(ix+9) + ld h,(ix+10) + push hl + ld a,(ix+8) + push af + inc sp + push bc + ld l,(ix+4) + ld h,(ix+5) + push hl + call _usb_data_in_transfer_n + pop af + pop af + pop af + inc sp +l_usb_dat_in_trns_n_ext_00108: +;source-doc/base-drv/transfers.c:123: } + pop ix + ret +;source-doc/base-drv/transfers.c:135: usb_data_in_transfer(uint8_t *buffer, const uint16_t buffer_size, const uint8_t device_address, endpoint_param *const endpoint) { +; --------------------------------- +; Function usb_data_in_transfer +; --------------------------------- +_usb_data_in_transfer: + push ix + ld ix,0 + add ix,sp +;source-doc/base-drv/transfers.c:136: critical_begin(); + call _critical_begin +;source-doc/base-drv/transfers.c:138: ch_set_usb_address(device_address); + ld l,(ix+8) + call _ch_set_usb_address +;source-doc/base-drv/transfers.c:140: result = ch_data_in_transfer(buffer, buffer_size, endpoint); + ld l,(ix+9) + ld h,(ix+10) + push hl + ld l,(ix+6) + ld h,(ix+7) + push hl + ld l,(ix+4) + ld h,(ix+5) + push hl + call _ch_data_in_transfer + pop af + pop af + pop af + ld a, l + ld (_result), a +;source-doc/base-drv/transfers.c:142: critical_end(); + call _critical_end +;source-doc/base-drv/transfers.c:144: return result; + ld hl,(_result) +;source-doc/base-drv/transfers.c:145: } + pop ix + ret +;source-doc/base-drv/transfers.c:157: usb_data_in_transfer_n(uint8_t *buffer, uint8_t *const buffer_size, const uint8_t device_address, endpoint_param *const endpoint) { +; --------------------------------- +; Function usb_data_in_transfer_n +; --------------------------------- +_usb_data_in_transfer_n: + push ix + ld ix,0 + add ix,sp +;source-doc/base-drv/transfers.c:158: critical_begin(); + call _critical_begin +;source-doc/base-drv/transfers.c:160: ch_set_usb_address(device_address); + ld l,(ix+8) + call _ch_set_usb_address +;source-doc/base-drv/transfers.c:162: result = ch_data_in_transfer_n(buffer, buffer_size, endpoint); + ld l,(ix+9) + ld h,(ix+10) + push hl + ld l,(ix+6) + ld h,(ix+7) + push hl + ld l,(ix+4) + ld h,(ix+5) + push hl + call _ch_data_in_transfer_n + pop af + pop af + pop af + ld a, l + ld (_result), a +;source-doc/base-drv/transfers.c:164: critical_end(); + call _critical_end +;source-doc/base-drv/transfers.c:166: return result; + ld hl,(_result) +;source-doc/base-drv/transfers.c:167: } + pop ix + ret +;source-doc/base-drv/transfers.c:179: usb_data_out_transfer(const uint8_t *buffer, uint16_t buffer_size, const uint8_t device_address, endpoint_param *const endpoint) { +; --------------------------------- +; Function usb_data_out_transfer +; --------------------------------- +_usb_data_out_transfer: + push ix + ld ix,0 + add ix,sp +;source-doc/base-drv/transfers.c:180: critical_begin(); + call _critical_begin +;source-doc/base-drv/transfers.c:182: ch_set_usb_address(device_address); + ld l,(ix+8) + call _ch_set_usb_address +;source-doc/base-drv/transfers.c:184: result = ch_data_out_transfer(buffer, buffer_size, endpoint); + ld l,(ix+9) + ld h,(ix+10) + push hl + ld l,(ix+6) + ld h,(ix+7) + push hl + ld l,(ix+4) + ld h,(ix+5) + push hl + call _ch_data_out_transfer + pop af + pop af + pop af + ld a, l + ld (_result), a +;source-doc/base-drv/transfers.c:186: critical_end(); + call _critical_end +;source-doc/base-drv/transfers.c:188: return result; + ld hl,(_result) +;source-doc/base-drv/transfers.c:189: } + pop ix + ret + SECTION IGNORE diff --git a/Source/HBIOS/ch376-native/base-drv/transfers.c.s b/Source/HBIOS/ch376-native/base-drv/transfers.c.s index 199747fe..cd7bb9a1 100644 --- a/Source/HBIOS/ch376-native/base-drv/transfers.c.s +++ b/Source/HBIOS/ch376-native/base-drv/transfers.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/base-drv/./transfers.c.asm -- not to be modify directly +; Generated from source-doc/base-drv/transfers.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -48,7 +48,7 @@ _USB_MODULE_LEDS .EQU 0xff8a ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/base-drv/./transfers.c:24: usb_error usb_ctrl_trnsfer_ext(const setup_packet *const cmd_packet, +;source-doc/base-drv/transfers.c:24: usb_error usb_ctrl_trnsfer_ext(const setup_packet *const cmd_packet, ; --------------------------------- ; Function usb_ctrl_trnsfer_ext ; --------------------------------- @@ -56,26 +56,26 @@ _usb_ctrl_trnsfer_ext: push ix ld ix,0 add ix,sp -;source-doc/base-drv/./transfers.c:28: if ((uint16_t)cmd_packet < LOWER_SAFE_RAM_ADDRESS) +;source-doc/base-drv/transfers.c:28: if ((uint16_t)cmd_packet < LOWER_SAFE_RAM_ADDRESS) ld a,(ix+5) sub 0x80 jr NC,l_usb_ctrl_trnsfer_ext_00102 -;source-doc/base-drv/./transfers.c:29: return USB_BAD_ADDRESS; +;source-doc/base-drv/transfers.c:29: return USB_BAD_ADDRESS; ld l,0x82 jr l_usb_ctrl_trnsfer_ext_00106 l_usb_ctrl_trnsfer_ext_00102: -;source-doc/base-drv/./transfers.c:31: if (buffer != 0 && (uint16_t)buffer < LOWER_SAFE_RAM_ADDRESS) +;source-doc/base-drv/transfers.c:31: if (buffer != 0 && (uint16_t)buffer < LOWER_SAFE_RAM_ADDRESS) ld a,(ix+7) or (ix+6) jr Z,l_usb_ctrl_trnsfer_ext_00104 ld a,(ix+7) sub 0x80 jr NC,l_usb_ctrl_trnsfer_ext_00104 -;source-doc/base-drv/./transfers.c:32: return USB_BAD_ADDRESS; +;source-doc/base-drv/transfers.c:32: return USB_BAD_ADDRESS; ld l,0x82 jr l_usb_ctrl_trnsfer_ext_00106 l_usb_ctrl_trnsfer_ext_00104: -;source-doc/base-drv/./transfers.c:34: return usb_control_transfer(cmd_packet, buffer, device_address, max_packet_size); +;source-doc/base-drv/transfers.c:34: return usb_control_transfer(cmd_packet, buffer, device_address, max_packet_size); ld h,(ix+9) ld l,(ix+8) push hl @@ -90,10 +90,10 @@ l_usb_ctrl_trnsfer_ext_00104: pop af pop af l_usb_ctrl_trnsfer_ext_00106: -;source-doc/base-drv/./transfers.c:35: } +;source-doc/base-drv/transfers.c:35: } pop ix ret -;source-doc/base-drv/./transfers.c:47: usb_error usb_control_transfer(const setup_packet *const cmd_packet, +;source-doc/base-drv/transfers.c:47: usb_error usb_control_transfer(const setup_packet *const cmd_packet, ; --------------------------------- ; Function usb_control_transfer ; --------------------------------- @@ -103,7 +103,7 @@ _usb_control_transfer: add ix,sp push af push af -;source-doc/base-drv/./transfers.c:52: endpoint_param endpoint = {1, 0, max_packet_size}; +;source-doc/base-drv/transfers.c:52: endpoint_param endpoint = {1, 0, max_packet_size}; ld hl,0 add hl, sp set 0, (hl) @@ -125,29 +125,29 @@ _usb_control_transfer: and 0xfc or e ld (hl), a -;source-doc/base-drv/./transfers.c:54: const uint8_t transferIn = (cmd_packet->bmRequestType & 0x80); +;source-doc/base-drv/transfers.c:54: const uint8_t transferIn = (cmd_packet->bmRequestType & 0x80); ld c,(ix+4) ld b,(ix+5) ld a, (bc) and 0x80 -;source-doc/base-drv/./transfers.c:56: if (transferIn && buffer == 0) +;source-doc/base-drv/transfers.c:56: if (transferIn && buffer == 0) ld (ix-1),a or a jr Z,l_usb_control_transfer_00102 ld a,(ix+7) or (ix+6) jr NZ,l_usb_control_transfer_00102 -;source-doc/base-drv/./transfers.c:57: return USB_ERR_OTHER; +;source-doc/base-drv/transfers.c:57: return USB_ERR_OTHER; ld l,0x0f jp l_usb_control_transfer_00114 l_usb_control_transfer_00102: -;source-doc/base-drv/./transfers.c:59: critical_begin(); +;source-doc/base-drv/transfers.c:59: critical_begin(); push bc call _critical_begin ld l,(ix+8) call _ch_set_usb_address pop bc -;source-doc/base-drv/./transfers.c:63: ch_write_data((const uint8_t *)cmd_packet, sizeof(setup_packet)); +;source-doc/base-drv/transfers.c:63: ch_write_data((const uint8_t *)cmd_packet, sizeof(setup_packet)); ld e,(ix+4) ld d,(ix+5) push bc @@ -161,18 +161,18 @@ l_usb_control_transfer_00102: call _ch_issue_token_setup call _ch_short_wait_int_and_get_stat pop bc -;source-doc/base-drv/./transfers.c:66: CHECK(result); +;source-doc/base-drv/transfers.c:66: CHECK(result); ld a, l or a jr NZ,l_usb_control_transfer_00113 -;source-doc/base-drv/./transfers.c:68: const uint16_t length = cmd_packet->wLength; +;source-doc/base-drv/transfers.c:68: const uint16_t length = cmd_packet->wLength; ld hl,6 add hl, bc ld c, (hl) inc hl - ld b, (hl) -;source-doc/base-drv/./transfers.c:71: ? (transferIn ? ch_data_in_transfer(buffer, length, &endpoint) : ch_data_out_transfer(buffer, length, &endpoint)) - ld a, b +;source-doc/base-drv/transfers.c:71: ? (transferIn ? ch_data_in_transfer(buffer, length, &endpoint) : ch_data_out_transfer(buffer, length, &endpoint)) + ld a,(hl) + ld b,a or c jr Z,l_usb_control_transfer_00116 ld e,(ix+6) @@ -203,59 +203,58 @@ l_usb_control_transfer_00118: l_usb_control_transfer_00119: jr l_usb_control_transfer_00117 l_usb_control_transfer_00116: -;source-doc/base-drv/./transfers.c:72: : USB_ERR_OK; +;source-doc/base-drv/transfers.c:72: : USB_ERR_OK; ld l,0x00 l_usb_control_transfer_00117: -;source-doc/base-drv/./transfers.c:74: CHECK(result) +;source-doc/base-drv/transfers.c:74: CHECK(result) ld a, l or a jr NZ,l_usb_control_transfer_00113 -;source-doc/base-drv/./transfers.c:76: if (transferIn) { +;source-doc/base-drv/transfers.c:76: if (transferIn) { ld a,(ix-1) or a jr Z,l_usb_control_transfer_00112 -;source-doc/base-drv/./transfers.c:77: ch_command(CH_CMD_WR_HOST_DATA); +;source-doc/base-drv/transfers.c:77: ch_command(CH_CMD_WR_HOST_DATA); ld l,0x2c call _ch_command -;source-doc/base-drv/./transfers.c:78: CH376_DATA_PORT = 0; +;source-doc/base-drv/transfers.c:78: CH376_DATA_PORT = 0; ld a,0x00 ld bc,_CH376_DATA_PORT out (c),a -;source-doc/base-drv/./transfers.c:79: ch_issue_token_out_ep0(); +;source-doc/base-drv/transfers.c:79: ch_issue_token_out_ep0(); call _ch_issue_token_out_ep0 -;source-doc/base-drv/./transfers.c:80: result = ch_long_wait_int_and_get_status(); /* sometimes we get STALL here - seems to be ok to ignore */ +;source-doc/base-drv/transfers.c:80: result = ch_long_wait_int_and_get_status(); /* sometimes we get STALL here - seems to be ok to ignore */ call _ch_long_wait_int_and_get_statu -;source-doc/base-drv/./transfers.c:82: if (result == USB_ERR_OK || result == USB_ERR_STALL) { - ld a, l +;source-doc/base-drv/transfers.c:82: if (result == USB_ERR_OK || result == USB_ERR_STALL) { + ld a,l or a jr Z,l_usb_control_transfer_00108 - ld a, l sub 0x02 jr NZ,l_usb_control_transfer_00113 l_usb_control_transfer_00108: -;source-doc/base-drv/./transfers.c:83: result = USB_ERR_OK; +;source-doc/base-drv/transfers.c:83: result = USB_ERR_OK; ld l,0x00 -;source-doc/base-drv/./transfers.c:84: goto done; +;source-doc/base-drv/transfers.c:84: goto done; jr l_usb_control_transfer_00113 -;source-doc/base-drv/./transfers.c:87: RETURN_CHECK(result); +;source-doc/base-drv/transfers.c:87: RETURN_CHECK(result); l_usb_control_transfer_00112: -;source-doc/base-drv/./transfers.c:90: ch_issue_token_in_ep0(); +;source-doc/base-drv/transfers.c:90: ch_issue_token_in_ep0(); call _ch_issue_token_in_ep0 -;source-doc/base-drv/./transfers.c:91: result = ch_long_wait_int_and_get_status(); +;source-doc/base-drv/transfers.c:91: result = ch_long_wait_int_and_get_status(); call _ch_long_wait_int_and_get_statu -;source-doc/base-drv/./transfers.c:95: done: +;source-doc/base-drv/transfers.c:95: done: l_usb_control_transfer_00113: -;source-doc/base-drv/./transfers.c:96: critical_end(); +;source-doc/base-drv/transfers.c:96: critical_end(); push hl call _critical_end pop hl -;source-doc/base-drv/./transfers.c:97: return result; +;source-doc/base-drv/transfers.c:97: return result; l_usb_control_transfer_00114: -;source-doc/base-drv/./transfers.c:98: } +;source-doc/base-drv/transfers.c:98: } ld sp, ix pop ix ret -;source-doc/base-drv/./transfers.c:101: usb_dat_in_trnsfer_ext(uint8_t *buffer, const uint16_t buffer_size, const uint8_t device_address, endpoint_param *const endpoint) { +;source-doc/base-drv/transfers.c:101: usb_dat_in_trnsfer_ext(uint8_t *buffer, const uint16_t buffer_size, const uint8_t device_address, endpoint_param *const endpoint) { ; --------------------------------- ; Function usb_dat_in_trnsfer_ext ; --------------------------------- @@ -263,26 +262,26 @@ _usb_dat_in_trnsfer_ext: push ix ld ix,0 add ix,sp -;source-doc/base-drv/./transfers.c:102: if (buffer != 0 && (uint16_t)buffer < LOWER_SAFE_RAM_ADDRESS) +;source-doc/base-drv/transfers.c:102: if (buffer != 0 && (uint16_t)buffer < LOWER_SAFE_RAM_ADDRESS) ld a,(ix+5) or (ix+4) jr Z,l_usb_dat_in_trnsfer_ext_00102 ld a,(ix+5) sub 0x80 jr NC,l_usb_dat_in_trnsfer_ext_00102 -;source-doc/base-drv/./transfers.c:103: return USB_BAD_ADDRESS; +;source-doc/base-drv/transfers.c:103: return USB_BAD_ADDRESS; ld l,0x82 jr l_usb_dat_in_trnsfer_ext_00106 l_usb_dat_in_trnsfer_ext_00102: -;source-doc/base-drv/./transfers.c:105: if ((uint16_t)endpoint < LOWER_SAFE_RAM_ADDRESS) +;source-doc/base-drv/transfers.c:105: if ((uint16_t)endpoint < LOWER_SAFE_RAM_ADDRESS) ld a,(ix+10) sub 0x80 jr NC,l_usb_dat_in_trnsfer_ext_00105 -;source-doc/base-drv/./transfers.c:106: return USB_BAD_ADDRESS; +;source-doc/base-drv/transfers.c:106: return USB_BAD_ADDRESS; ld l,0x82 jr l_usb_dat_in_trnsfer_ext_00106 l_usb_dat_in_trnsfer_ext_00105: -;source-doc/base-drv/./transfers.c:108: return usb_data_in_transfer(buffer, buffer_size, device_address, endpoint); +;source-doc/base-drv/transfers.c:108: return usb_data_in_transfer(buffer, buffer_size, device_address, endpoint); ld l,(ix+9) ld h,(ix+10) push hl @@ -301,10 +300,10 @@ l_usb_dat_in_trnsfer_ext_00105: pop af inc sp l_usb_dat_in_trnsfer_ext_00106: -;source-doc/base-drv/./transfers.c:109: } +;source-doc/base-drv/transfers.c:109: } pop ix ret -;source-doc/base-drv/./transfers.c:112: usb_dat_in_trns_n_ext(uint8_t *buffer, uint16_t *buffer_size, const uint8_t device_address, endpoint_param *const endpoint) { +;source-doc/base-drv/transfers.c:112: usb_dat_in_trns_n_ext(uint8_t *buffer, uint16_t *buffer_size, const uint8_t device_address, endpoint_param *const endpoint) { ; --------------------------------- ; Function usb_dat_in_trns_n_ext ; --------------------------------- @@ -312,34 +311,34 @@ _usb_dat_in_trns_n_ext: push ix ld ix,0 add ix,sp -;source-doc/base-drv/./transfers.c:113: if (buffer != 0 && ((uint16_t)buffer & 0xC000) == 0) +;source-doc/base-drv/transfers.c:113: if (buffer != 0 && ((uint16_t)buffer & 0xC000) == 0) ld a,(ix+5) or (ix+4) jr Z,l_usb_dat_in_trns_n_ext_00102 ld a,(ix+5) and 0xc0 jr NZ,l_usb_dat_in_trns_n_ext_00102 -;source-doc/base-drv/./transfers.c:114: return USB_BAD_ADDRESS; +;source-doc/base-drv/transfers.c:114: return USB_BAD_ADDRESS; ld l,0x82 jr l_usb_dat_in_trns_n_ext_00108 l_usb_dat_in_trns_n_ext_00102: -;source-doc/base-drv/./transfers.c:116: if (((uint16_t)endpoint & 0xC000) == 0) +;source-doc/base-drv/transfers.c:116: if (((uint16_t)endpoint & 0xC000) == 0) ld a,(ix+10) and 0xc0 jr NZ,l_usb_dat_in_trns_n_ext_00105 -;source-doc/base-drv/./transfers.c:117: return USB_BAD_ADDRESS; +;source-doc/base-drv/transfers.c:117: return USB_BAD_ADDRESS; ld l,0x82 jr l_usb_dat_in_trns_n_ext_00108 l_usb_dat_in_trns_n_ext_00105: -;source-doc/base-drv/./transfers.c:119: if (((uint16_t)buffer_size & 0xC000) == 0) +;source-doc/base-drv/transfers.c:119: if (((uint16_t)buffer_size & 0xC000) == 0) ld a,(ix+7) and 0xc0 jr NZ,l_usb_dat_in_trns_n_ext_00107 -;source-doc/base-drv/./transfers.c:120: return USB_BAD_ADDRESS; +;source-doc/base-drv/transfers.c:120: return USB_BAD_ADDRESS; ld l,0x82 jr l_usb_dat_in_trns_n_ext_00108 l_usb_dat_in_trns_n_ext_00107: -;source-doc/base-drv/./transfers.c:122: return usb_data_in_transfer_n(buffer, buffer_size, device_address, endpoint); +;source-doc/base-drv/transfers.c:122: return usb_data_in_transfer_n(buffer, buffer_size, device_address, endpoint); ld c,(ix+6) ld b,(ix+7) ld l,(ix+9) @@ -358,10 +357,10 @@ l_usb_dat_in_trns_n_ext_00107: pop af inc sp l_usb_dat_in_trns_n_ext_00108: -;source-doc/base-drv/./transfers.c:123: } +;source-doc/base-drv/transfers.c:123: } pop ix ret -;source-doc/base-drv/./transfers.c:135: usb_data_in_transfer(uint8_t *buffer, const uint16_t buffer_size, const uint8_t device_address, endpoint_param *const endpoint) { +;source-doc/base-drv/transfers.c:135: usb_data_in_transfer(uint8_t *buffer, const uint16_t buffer_size, const uint8_t device_address, endpoint_param *const endpoint) { ; --------------------------------- ; Function usb_data_in_transfer ; --------------------------------- @@ -369,12 +368,12 @@ _usb_data_in_transfer: push ix ld ix,0 add ix,sp -;source-doc/base-drv/./transfers.c:136: critical_begin(); +;source-doc/base-drv/transfers.c:136: critical_begin(); call _critical_begin -;source-doc/base-drv/./transfers.c:138: ch_set_usb_address(device_address); +;source-doc/base-drv/transfers.c:138: ch_set_usb_address(device_address); ld l,(ix+8) call _ch_set_usb_address -;source-doc/base-drv/./transfers.c:140: result = ch_data_in_transfer(buffer, buffer_size, endpoint); +;source-doc/base-drv/transfers.c:140: result = ch_data_in_transfer(buffer, buffer_size, endpoint); ld l,(ix+9) ld h,(ix+10) push hl @@ -390,15 +389,14 @@ _usb_data_in_transfer: pop af ld a, l ld (_result), a -;source-doc/base-drv/./transfers.c:142: critical_end(); +;source-doc/base-drv/transfers.c:142: critical_end(); call _critical_end -;source-doc/base-drv/./transfers.c:144: return result; - ld hl,_result - ld l, (hl) -;source-doc/base-drv/./transfers.c:145: } +;source-doc/base-drv/transfers.c:144: return result; + ld hl,(_result) +;source-doc/base-drv/transfers.c:145: } pop ix ret -;source-doc/base-drv/./transfers.c:157: usb_data_in_transfer_n(uint8_t *buffer, uint8_t *const buffer_size, const uint8_t device_address, endpoint_param *const endpoint) { +;source-doc/base-drv/transfers.c:157: usb_data_in_transfer_n(uint8_t *buffer, uint8_t *const buffer_size, const uint8_t device_address, endpoint_param *const endpoint) { ; --------------------------------- ; Function usb_data_in_transfer_n ; --------------------------------- @@ -406,12 +404,12 @@ _usb_data_in_transfer_n: push ix ld ix,0 add ix,sp -;source-doc/base-drv/./transfers.c:158: critical_begin(); +;source-doc/base-drv/transfers.c:158: critical_begin(); call _critical_begin -;source-doc/base-drv/./transfers.c:160: ch_set_usb_address(device_address); +;source-doc/base-drv/transfers.c:160: ch_set_usb_address(device_address); ld l,(ix+8) call _ch_set_usb_address -;source-doc/base-drv/./transfers.c:162: result = ch_data_in_transfer_n(buffer, buffer_size, endpoint); +;source-doc/base-drv/transfers.c:162: result = ch_data_in_transfer_n(buffer, buffer_size, endpoint); ld l,(ix+9) ld h,(ix+10) push hl @@ -427,15 +425,14 @@ _usb_data_in_transfer_n: pop af ld a, l ld (_result), a -;source-doc/base-drv/./transfers.c:164: critical_end(); +;source-doc/base-drv/transfers.c:164: critical_end(); call _critical_end -;source-doc/base-drv/./transfers.c:166: return result; - ld hl,_result - ld l, (hl) -;source-doc/base-drv/./transfers.c:167: } +;source-doc/base-drv/transfers.c:166: return result; + ld hl,(_result) +;source-doc/base-drv/transfers.c:167: } pop ix ret -;source-doc/base-drv/./transfers.c:179: usb_data_out_transfer(const uint8_t *buffer, uint16_t buffer_size, const uint8_t device_address, endpoint_param *const endpoint) { +;source-doc/base-drv/transfers.c:179: usb_data_out_transfer(const uint8_t *buffer, uint16_t buffer_size, const uint8_t device_address, endpoint_param *const endpoint) { ; --------------------------------- ; Function usb_data_out_transfer ; --------------------------------- @@ -443,12 +440,12 @@ _usb_data_out_transfer: push ix ld ix,0 add ix,sp -;source-doc/base-drv/./transfers.c:180: critical_begin(); +;source-doc/base-drv/transfers.c:180: critical_begin(); call _critical_begin -;source-doc/base-drv/./transfers.c:182: ch_set_usb_address(device_address); +;source-doc/base-drv/transfers.c:182: ch_set_usb_address(device_address); ld l,(ix+8) call _ch_set_usb_address -;source-doc/base-drv/./transfers.c:184: result = ch_data_out_transfer(buffer, buffer_size, endpoint); +;source-doc/base-drv/transfers.c:184: result = ch_data_out_transfer(buffer, buffer_size, endpoint); ld l,(ix+9) ld h,(ix+10) push hl @@ -464,11 +461,10 @@ _usb_data_out_transfer: pop af ld a, l ld (_result), a -;source-doc/base-drv/./transfers.c:186: critical_end(); +;source-doc/base-drv/transfers.c:186: critical_end(); call _critical_end -;source-doc/base-drv/./transfers.c:188: return result; - ld hl,_result - ld l, (hl) -;source-doc/base-drv/./transfers.c:189: } +;source-doc/base-drv/transfers.c:188: return result; + ld hl,(_result) +;source-doc/base-drv/transfers.c:189: } pop ix ret diff --git a/Source/HBIOS/ch376-native/base-drv/usb-base-drv.c.asm b/Source/HBIOS/ch376-native/base-drv/usb-base-drv.c.asm new file mode 100644 index 00000000..2668b656 --- /dev/null +++ b/Source/HBIOS/ch376-native/base-drv/usb-base-drv.c.asm @@ -0,0 +1,441 @@ +;-------------------------------------------------------- +; File Created by SDCC : free open source ISO C Compiler +; Version 4.4.0 #14648 (Linux) +;-------------------------------------------------------- +; Processed by Z88DK +;-------------------------------------------------------- + + EXTERN __divschar + EXTERN __divschar_callee + EXTERN __divsint + EXTERN __divsint_callee + EXTERN __divslong + EXTERN __divslong_callee + EXTERN __divslonglong + EXTERN __divslonglong_callee + EXTERN __divsuchar + EXTERN __divsuchar_callee + EXTERN __divuchar + EXTERN __divuchar_callee + EXTERN __divuint + EXTERN __divuint_callee + EXTERN __divulong + EXTERN __divulong_callee + EXTERN __divulonglong + EXTERN __divulonglong_callee + EXTERN __divuschar + EXTERN __divuschar_callee + EXTERN __modschar + EXTERN __modschar_callee + EXTERN __modsint + EXTERN __modsint_callee + EXTERN __modslong + EXTERN __modslong_callee + EXTERN __modslonglong + EXTERN __modslonglong_callee + EXTERN __modsuchar + EXTERN __modsuchar_callee + EXTERN __moduchar + EXTERN __moduchar_callee + EXTERN __moduint + EXTERN __moduint_callee + EXTERN __modulong + EXTERN __modulong_callee + EXTERN __modulonglong + EXTERN __modulonglong_callee + EXTERN __moduschar + EXTERN __moduschar_callee + EXTERN __mulint + EXTERN __mulint_callee + EXTERN __mullong + EXTERN __mullong_callee + EXTERN __mullonglong + EXTERN __mullonglong_callee + EXTERN __mulschar + EXTERN __mulschar_callee + EXTERN __mulsuchar + EXTERN __mulsuchar_callee + EXTERN __muluchar + EXTERN __muluchar_callee + EXTERN __muluschar + EXTERN __muluschar_callee + EXTERN __rlslonglong + EXTERN __rlslonglong_callee + EXTERN __rlulonglong + EXTERN __rlulonglong_callee + EXTERN __rrslonglong + EXTERN __rrslonglong_callee + EXTERN __rrulonglong + EXTERN __rrulonglong_callee + EXTERN ___mulsint2slong + EXTERN ___mulsint2slong_callee + EXTERN ___muluint2ulong + EXTERN ___muluint2ulong_callee + EXTERN ___sdcc_call_hl + EXTERN ___sdcc_call_iy + EXTERN ___sdcc_enter_ix + EXTERN banked_call + EXTERN _banked_ret + EXTERN ___fs2schar + EXTERN ___fs2schar_callee + EXTERN ___fs2sint + EXTERN ___fs2sint_callee + EXTERN ___fs2slong + EXTERN ___fs2slong_callee + EXTERN ___fs2slonglong + EXTERN ___fs2slonglong_callee + EXTERN ___fs2uchar + EXTERN ___fs2uchar_callee + EXTERN ___fs2uint + EXTERN ___fs2uint_callee + EXTERN ___fs2ulong + EXTERN ___fs2ulong_callee + EXTERN ___fs2ulonglong + EXTERN ___fs2ulonglong_callee + EXTERN ___fsadd + EXTERN ___fsadd_callee + EXTERN ___fsdiv + EXTERN ___fsdiv_callee + EXTERN ___fseq + EXTERN ___fseq_callee + EXTERN ___fsgt + EXTERN ___fsgt_callee + EXTERN ___fslt + EXTERN ___fslt_callee + EXTERN ___fsmul + EXTERN ___fsmul_callee + EXTERN ___fsneq + EXTERN ___fsneq_callee + EXTERN ___fssub + EXTERN ___fssub_callee + EXTERN ___schar2fs + EXTERN ___schar2fs_callee + EXTERN ___sint2fs + EXTERN ___sint2fs_callee + EXTERN ___slong2fs + EXTERN ___slong2fs_callee + EXTERN ___slonglong2fs + EXTERN ___slonglong2fs_callee + EXTERN ___uchar2fs + EXTERN ___uchar2fs_callee + EXTERN ___uint2fs + EXTERN ___uint2fs_callee + EXTERN ___ulong2fs + EXTERN ___ulong2fs_callee + EXTERN ___ulonglong2fs + EXTERN ___ulonglong2fs_callee + EXTERN ____sdcc_2_copy_src_mhl_dst_deix + EXTERN ____sdcc_2_copy_src_mhl_dst_bcix + EXTERN ____sdcc_4_copy_src_mhl_dst_deix + EXTERN ____sdcc_4_copy_src_mhl_dst_bcix + EXTERN ____sdcc_4_copy_src_mhl_dst_mbc + EXTERN ____sdcc_4_ldi_nosave_bc + EXTERN ____sdcc_4_ldi_save_bc + EXTERN ____sdcc_4_push_hlix + EXTERN ____sdcc_4_push_mhl + EXTERN ____sdcc_lib_setmem_hl + EXTERN ____sdcc_ll_add_de_bc_hl + EXTERN ____sdcc_ll_add_de_bc_hlix + EXTERN ____sdcc_ll_add_de_hlix_bc + EXTERN ____sdcc_ll_add_de_hlix_bcix + EXTERN ____sdcc_ll_add_deix_bc_hl + EXTERN ____sdcc_ll_add_deix_hlix + EXTERN ____sdcc_ll_add_hlix_bc_deix + EXTERN ____sdcc_ll_add_hlix_deix_bc + EXTERN ____sdcc_ll_add_hlix_deix_bcix + EXTERN ____sdcc_ll_asr_hlix_a + EXTERN ____sdcc_ll_asr_mbc_a + EXTERN ____sdcc_ll_copy_src_de_dst_hlix + EXTERN ____sdcc_ll_copy_src_de_dst_hlsp + EXTERN ____sdcc_ll_copy_src_deix_dst_hl + EXTERN ____sdcc_ll_copy_src_deix_dst_hlix + EXTERN ____sdcc_ll_copy_src_deixm_dst_hlsp + EXTERN ____sdcc_ll_copy_src_desp_dst_hlsp + EXTERN ____sdcc_ll_copy_src_hl_dst_de + EXTERN ____sdcc_ll_copy_src_hlsp_dst_de + EXTERN ____sdcc_ll_copy_src_hlsp_dst_deixm + EXTERN ____sdcc_ll_lsl_hlix_a + EXTERN ____sdcc_ll_lsl_mbc_a + EXTERN ____sdcc_ll_lsr_hlix_a + EXTERN ____sdcc_ll_lsr_mbc_a + EXTERN ____sdcc_ll_push_hlix + EXTERN ____sdcc_ll_push_mhl + EXTERN ____sdcc_ll_sub_de_bc_hl + EXTERN ____sdcc_ll_sub_de_bc_hlix + EXTERN ____sdcc_ll_sub_de_hlix_bc + EXTERN ____sdcc_ll_sub_de_hlix_bcix + EXTERN ____sdcc_ll_sub_deix_bc_hl + EXTERN ____sdcc_ll_sub_deix_hlix + EXTERN ____sdcc_ll_sub_hlix_bc_deix + EXTERN ____sdcc_ll_sub_hlix_deix_bc + EXTERN ____sdcc_ll_sub_hlix_deix_bcix + EXTERN ____sdcc_load_debc_deix + EXTERN ____sdcc_load_dehl_deix + EXTERN ____sdcc_load_debc_mhl + EXTERN ____sdcc_load_hlde_mhl + EXTERN ____sdcc_store_dehl_bcix + EXTERN ____sdcc_store_debc_hlix + EXTERN ____sdcc_store_debc_mhl + EXTERN ____sdcc_cpu_pop_ei + EXTERN ____sdcc_cpu_pop_ei_jp + EXTERN ____sdcc_cpu_push_di + EXTERN ____sdcc_outi + EXTERN ____sdcc_outi_128 + EXTERN ____sdcc_outi_256 + EXTERN ____sdcc_ldi + EXTERN ____sdcc_ldi_128 + EXTERN ____sdcc_ldi_256 + EXTERN ____sdcc_4_copy_srcd_hlix_dst_deix + EXTERN ____sdcc_4_and_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_or_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_or_src_dehl_dst_bcix + EXTERN ____sdcc_4_xor_src_dehl_dst_bcix + EXTERN ____sdcc_4_and_src_dehl_dst_bcix + EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_or_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_cpl_src_mhl_dst_debc + EXTERN ____sdcc_4_xor_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_or_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_debc_hlix_dst_debc + EXTERN ____sdcc_4_or_src_debc_hlix_dst_debc + EXTERN ____sdcc_4_xor_src_debc_hlix_dst_debc + +;-------------------------------------------------------- +; Public variables in this module +;-------------------------------------------------------- + GLOBAL _chnative_seek +;-------------------------------------------------------- +; Externals used +;-------------------------------------------------------- + GLOBAL _usbdev_dat_in_trnsfer_0 + GLOBAL _usbdev_dat_in_trnsfer + GLOBAL _usbdev_bulk_in_transfer + GLOBAL _usbdev_blk_out_trnsfer + GLOBAL _usbdev_control_transfer + GLOBAL _usb_data_out_transfer + GLOBAL _usb_data_in_transfer_n + GLOBAL _usb_data_in_transfer + GLOBAL _usb_control_transfer + GLOBAL _ch_issue_token_in_ep0 + GLOBAL _ch_issue_token_out_ep0 + GLOBAL _ch_issue_token_setup + GLOBAL _ch_data_out_transfer + GLOBAL _ch_data_in_transfer_n + GLOBAL _ch_data_in_transfer + GLOBAL _ch_control_transfer_set_config + GLOBAL _ch_control_transfer_set_address + GLOBAL _ch_control_transfer_request_descriptor + GLOBAL _ch_set_usb_address + GLOBAL _ch_write_data + GLOBAL _ch_cmd_get_ic_version + GLOBAL _ch_cmd_set_usb_mode + GLOBAL _ch_probe + GLOBAL _ch_cmd_reset_all + GLOBAL _ch_read_data + GLOBAL _ch_very_short_wait_int_and_get_status + GLOBAL _ch_short_wait_int_and_get_status + GLOBAL _ch_long_wait_int_and_get_status + GLOBAL _ch_get_status + GLOBAL _ch_command + GLOBAL _delay_medium + GLOBAL _delay_short + GLOBAL _delay_20ms + GLOBAL _printf + GLOBAL _delay + GLOBAL _ulltoa_callee + GLOBAL _ulltoa + GLOBAL _strtoull_callee + GLOBAL _strtoull + GLOBAL _strtoll_callee + GLOBAL _strtoll + GLOBAL _lltoa_callee + GLOBAL _lltoa + GLOBAL _llabs_callee + GLOBAL _llabs + GLOBAL __lldivu__callee + GLOBAL __lldivu_ + GLOBAL __lldiv__callee + GLOBAL __lldiv_ + GLOBAL _atoll_callee + GLOBAL _atoll + GLOBAL _realloc_unlocked_callee + GLOBAL _realloc_unlocked + GLOBAL _malloc_unlocked_fastcall + GLOBAL _malloc_unlocked + GLOBAL _free_unlocked_fastcall + GLOBAL _free_unlocked + GLOBAL _calloc_unlocked_callee + GLOBAL _calloc_unlocked + GLOBAL _aligned_alloc_unlocked_callee + GLOBAL _aligned_alloc_unlocked + GLOBAL _realloc_callee + GLOBAL _realloc + GLOBAL _malloc_fastcall + GLOBAL _malloc + GLOBAL _free_fastcall + GLOBAL _free + GLOBAL _calloc_callee + GLOBAL _calloc + GLOBAL _aligned_alloc_callee + GLOBAL _aligned_alloc + GLOBAL _utoa_callee + GLOBAL _utoa + GLOBAL _ultoa_callee + GLOBAL _ultoa + GLOBAL _system_fastcall + GLOBAL _system + GLOBAL _strtoul_callee + GLOBAL _strtoul + GLOBAL _strtol_callee + GLOBAL _strtol + GLOBAL _strtof_callee + GLOBAL _strtof + GLOBAL _strtod_callee + GLOBAL _strtod + GLOBAL _srand_fastcall + GLOBAL _srand + GLOBAL _rand + GLOBAL _quick_exit_fastcall + GLOBAL _quick_exit + GLOBAL _qsort_callee + GLOBAL _qsort + GLOBAL _ltoa_callee + GLOBAL _ltoa + GLOBAL _labs_fastcall + GLOBAL _labs + GLOBAL _itoa_callee + GLOBAL _itoa + GLOBAL _ftoh_callee + GLOBAL _ftoh + GLOBAL _ftog_callee + GLOBAL _ftog + GLOBAL _ftoe_callee + GLOBAL _ftoe + GLOBAL _ftoa_callee + GLOBAL _ftoa + GLOBAL _exit_fastcall + GLOBAL _exit + GLOBAL _dtoh_callee + GLOBAL _dtoh + GLOBAL _dtog_callee + GLOBAL _dtog + GLOBAL _dtoe_callee + GLOBAL _dtoe + GLOBAL _dtoa_callee + GLOBAL _dtoa + GLOBAL _bsearch_callee + GLOBAL _bsearch + GLOBAL _atol_fastcall + GLOBAL _atol + GLOBAL _atoi_fastcall + GLOBAL _atoi + GLOBAL _atof_fastcall + GLOBAL _atof + GLOBAL _atexit_fastcall + GLOBAL _atexit + GLOBAL _at_quick_exit_fastcall + GLOBAL _at_quick_exit + GLOBAL _abs_fastcall + GLOBAL _abs + GLOBAL _abort + GLOBAL __strtou__callee + GLOBAL __strtou_ + GLOBAL __strtoi__callee + GLOBAL __strtoi_ + GLOBAL __random_uniform_xor_8__fastcall + GLOBAL __random_uniform_xor_8_ + GLOBAL __random_uniform_xor_32__fastcall + GLOBAL __random_uniform_xor_32_ + GLOBAL __random_uniform_cmwc_8__fastcall + GLOBAL __random_uniform_cmwc_8_ + GLOBAL __shellsort__callee + GLOBAL __shellsort_ + GLOBAL __quicksort__callee + GLOBAL __quicksort_ + GLOBAL __insertion_sort__callee + GLOBAL __insertion_sort_ + GLOBAL __ldivu__callee + GLOBAL __ldivu_ + GLOBAL __ldiv__callee + GLOBAL __ldiv_ + GLOBAL __divu__callee + GLOBAL __divu_ + GLOBAL __div__callee + GLOBAL __div_ + GLOBAL _result +;-------------------------------------------------------- +; special function registers +;-------------------------------------------------------- +defc _CH376_DATA_PORT = 0xff88 +defc _CH376_COMMAND_PORT = 0xff89 +defc _USB_MODULE_LEDS = 0xff8a +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + SECTION bss_compiler +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + +IF 0 + +; .area _INITIALIZED removed by z88dk + + +ENDIF + +;-------------------------------------------------------- +; absolute external ram data +;-------------------------------------------------------- + SECTION IGNORE +;-------------------------------------------------------- +; global & static initialisations +;-------------------------------------------------------- + SECTION code_crt_init +;-------------------------------------------------------- +; Home +;-------------------------------------------------------- + SECTION IGNORE +;-------------------------------------------------------- +; code +;-------------------------------------------------------- + SECTION code_compiler +;source-doc/base-drv/usb-base-drv.c:6: uint8_t chnative_seek(const uint32_t lba, device_config_storage *const storage_device) __sdcccall(1) { +; --------------------------------- +; Function chnative_seek +; --------------------------------- +_chnative_seek: + push ix +;source-doc/base-drv/usb-base-drv.c:7: storage_device->current_lba = lba; + ld ix,0 + add ix,sp + ld c,(ix+4) + ld b,(ix+5) + push bc + ld a,(ix-2) + add a,0x0c + ld c,l + ld b,h + ld l, a + ld a,(ix-1) + adc a,0x00 + ld h, a + ld (hl), e + inc hl + ld (hl), d + inc hl + ld (hl), c + inc hl + ld (hl), b +;source-doc/base-drv/usb-base-drv.c:8: return 0; + xor a, a +;source-doc/base-drv/usb-base-drv.c:9: } + ld sp, ix + pop ix + pop hl + pop bc + jp (hl) + SECTION IGNORE diff --git a/Source/HBIOS/ch376-native/base-drv/usb-base-drv.c.s b/Source/HBIOS/ch376-native/base-drv/usb-base-drv.c.s index 3728d20a..2484c0eb 100644 --- a/Source/HBIOS/ch376-native/base-drv/usb-base-drv.c.s +++ b/Source/HBIOS/ch376-native/base-drv/usb-base-drv.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/base-drv/./usb-base-drv.c.asm -- not to be modify directly +; Generated from source-doc/base-drv/usb-base-drv.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -48,24 +48,22 @@ _USB_MODULE_LEDS .EQU 0xff8a ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/base-drv/./usb-base-drv.c:6: uint8_t chnative_seek(const uint32_t lba, device_config_storage *const storage_device) __sdcccall(1) { +;source-doc/base-drv/usb-base-drv.c:6: uint8_t chnative_seek(const uint32_t lba, device_config_storage *const storage_device) __sdcccall(1) { ; --------------------------------- ; Function chnative_seek ; --------------------------------- _chnative_seek: push ix +;source-doc/base-drv/usb-base-drv.c:7: storage_device->current_lba = lba; ld ix,0 add ix,sp - push af - ld c, l - ld b, h -;source-doc/base-drv/./usb-base-drv.c:7: storage_device->current_lba = lba; - ld a,(ix+4) - ld (ix-2),a - ld a,(ix+5) - ld (ix-1),a + ld c,(ix+4) + ld b,(ix+5) + push bc ld a,(ix-2) add a,0x0c + ld c,l + ld b,h ld l, a ld a,(ix-1) adc a,0x00 @@ -77,9 +75,9 @@ _chnative_seek: ld (hl), c inc hl ld (hl), b -;source-doc/base-drv/./usb-base-drv.c:8: return 0; +;source-doc/base-drv/usb-base-drv.c:8: return 0; xor a -;source-doc/base-drv/./usb-base-drv.c:9: } +;source-doc/base-drv/usb-base-drv.c:9: } ld sp, ix pop ix pop hl diff --git a/Source/HBIOS/ch376-native/base-drv/usb-init.c.s b/Source/HBIOS/ch376-native/base-drv/usb-init.c.s index 625480b2..53dbab60 100644 --- a/Source/HBIOS/ch376-native/base-drv/usb-init.c.s +++ b/Source/HBIOS/ch376-native/base-drv/usb-init.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/base-drv/./usb-init.c.asm -- not to be modify directly +; Generated from source-doc/base-drv/usb-init.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -48,109 +48,110 @@ _USB_MODULE_LEDS .EQU 0xff8a ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/base-drv/./usb-init.c:8: static usb_error usb_host_bus_reset(void) { +;source-doc/base-drv/usb-init.c:8: static usb_error usb_host_bus_reset(void) { ; --------------------------------- ; Function usb_host_bus_reset ; --------------------------------- _usb_host_bus_reset: -;source-doc/base-drv/./usb-init.c:9: ch_cmd_set_usb_mode(CH_MODE_HOST); +;source-doc/base-drv/usb-init.c:9: ch_cmd_set_usb_mode(CH_MODE_HOST); ld l,0x06 call _ch_cmd_set_usb_mode -;source-doc/base-drv/./usb-init.c:10: delay_20ms(); +;source-doc/base-drv/usb-init.c:10: delay_20ms(); call _delay_20ms -;source-doc/base-drv/./usb-init.c:12: ch_cmd_set_usb_mode(CH_MODE_HOST_RESET); +;source-doc/base-drv/usb-init.c:12: ch_cmd_set_usb_mode(CH_MODE_HOST_RESET); ld l,0x07 call _ch_cmd_set_usb_mode -;source-doc/base-drv/./usb-init.c:13: delay_20ms(); +;source-doc/base-drv/usb-init.c:13: delay_20ms(); call _delay_20ms -;source-doc/base-drv/./usb-init.c:15: ch_cmd_set_usb_mode(CH_MODE_HOST); +;source-doc/base-drv/usb-init.c:15: ch_cmd_set_usb_mode(CH_MODE_HOST); ld l,0x06 call _ch_cmd_set_usb_mode -;source-doc/base-drv/./usb-init.c:16: delay_20ms(); +;source-doc/base-drv/usb-init.c:16: delay_20ms(); call _delay_20ms -;source-doc/base-drv/./ch376.h:163: ch_command(CH_CMD_WRITE_VAR8); +;source-doc/base-drv/ch376.h:163: ch_command(CH_CMD_WRITE_VAR8); ld l,0x0b call _ch_command -;source-doc/base-drv/./ch376.h:164: CH376_DATA_PORT = CH_VAR_RETRY_TIMES; +;source-doc/base-drv/ch376.h:164: CH376_DATA_PORT = CH_VAR_RETRY_TIMES; ld a,0x25 ld bc,_CH376_DATA_PORT out (c),a -;source-doc/base-drv/./ch376.h:165: CH376_DATA_PORT = retry << 6 | (number_of_retries & 0x1F); +;source-doc/base-drv/ch376.h:165: CH376_DATA_PORT = retry << 6 | (number_of_retries & 0x1F); ld a,0xdf ld bc,_CH376_DATA_PORT out (c),a -;source-doc/base-drv/./usb-init.c:20: return USB_ERR_OK; +;source-doc/base-drv/usb-init.c:20: return USB_ERR_OK; ld l,0x00 -;source-doc/base-drv/./usb-init.c:21: } +;source-doc/base-drv/usb-init.c:21: } ret -;source-doc/base-drv/./usb-init.c:25: void chnative_init(void) { +;source-doc/base-drv/usb-init.c:25: void chnative_init(void) { ; --------------------------------- ; Function chnative_init ; --------------------------------- _chnative_init: -;source-doc/base-drv/./usb-init.c:26: memset(get_usb_work_area(), 0, sizeof(_usb_state)); +;source-doc/base-drv/usb-init.c:26: memset(get_usb_work_area(), 0, sizeof(_usb_state)); ld hl,_x - ld b,0x63 -l_chnative_init_00139: ld (hl),0x00 - inc hl - djnz l_chnative_init_00139 -;source-doc/base-drv/./usb-init.c:28: ch_cmd_reset_all(); + ld e, l + ld d, h + inc de + ld bc,0x0062 + ldir +;source-doc/base-drv/usb-init.c:28: ch_cmd_reset_all(); call _ch_cmd_reset_all -;source-doc/base-drv/./usb-init.c:30: delay_medium(); +;source-doc/base-drv/usb-init.c:30: delay_medium(); call _delay_medium -;source-doc/base-drv/./usb-init.c:32: if (!ch_probe()) { +;source-doc/base-drv/usb-init.c:32: if (!ch_probe()) { call _ch_probe ld a, l or a jr NZ,l_chnative_init_00102 -;source-doc/base-drv/./usb-init.c:33: print_string("\r\nCH376: NOT PRESENT$"); -;source-doc/base-drv/./usb-init.c:34: return; +;source-doc/base-drv/usb-init.c:33: print_string("\r\nCH376: NOT PRESENT$"); +;source-doc/base-drv/usb-init.c:34: return; ld hl,usb_init_str_0 jp _print_string l_chnative_init_00102: -;source-doc/base-drv/./usb-init.c:37: print_string("\r\nCH376: PRESENT (VER $"); +;source-doc/base-drv/usb-init.c:37: print_string("\r\nCH376: PRESENT (VER $"); ld hl,usb_init_str_1 call _print_string -;source-doc/base-drv/./usb-init.c:38: print_hex(ch_cmd_get_ic_version()); +;source-doc/base-drv/usb-init.c:38: print_hex(ch_cmd_get_ic_version()); call _ch_cmd_get_ic_version call _print_hex -;source-doc/base-drv/./usb-init.c:39: print_string("); $"); +;source-doc/base-drv/usb-init.c:39: print_string("); $"); ld hl,usb_init_str_2 call _print_string -;source-doc/base-drv/./usb-init.c:41: usb_host_bus_reset(); +;source-doc/base-drv/usb-init.c:41: usb_host_bus_reset(); call _usb_host_bus_reset -;source-doc/base-drv/./usb-init.c:43: for (uint8_t i = 0; i < 4; i++) { +;source-doc/base-drv/usb-init.c:43: for (uint8_t i = 0; i < 4; i++) { ld c,0x00 l_chnative_init_00107: ld a, c sub 0x04 jr NC,l_chnative_init_00105 -;source-doc/base-drv/./usb-init.c:44: const uint8_t r = ch_very_short_wait_int_and_get_(); +;source-doc/base-drv/usb-init.c:44: const uint8_t r = ch_very_short_wait_int_and_get_(); push bc call _ch_very_short_wait_int_and_get ld a, l pop bc -;source-doc/base-drv/./usb-init.c:46: if (r == USB_INT_CONNECT) { +;source-doc/base-drv/usb-init.c:46: if (r == USB_INT_CONNECT) { sub 0x81 jr NZ,l_chnative_init_00108 -;source-doc/base-drv/./usb-init.c:47: print_string("USB: CONNECTED$"); +;source-doc/base-drv/usb-init.c:47: print_string("USB: CONNECTED$"); ld hl,usb_init_str_3 call _print_string -;source-doc/base-drv/./usb-init.c:49: enumerate_all_devices(); +;source-doc/base-drv/usb-init.c:49: enumerate_all_devices(); jp _enumerate_all_devices -;source-doc/base-drv/./usb-init.c:51: return; +;source-doc/base-drv/usb-init.c:51: return; jr l_chnative_init_00109 l_chnative_init_00108: -;source-doc/base-drv/./usb-init.c:43: for (uint8_t i = 0; i < 4; i++) { +;source-doc/base-drv/usb-init.c:43: for (uint8_t i = 0; i < 4; i++) { inc c jr l_chnative_init_00107 l_chnative_init_00105: -;source-doc/base-drv/./usb-init.c:55: print_string("USB: DISCONNECTED$"); +;source-doc/base-drv/usb-init.c:55: print_string("USB: DISCONNECTED$"); ld hl,usb_init_str_4 jp _print_string l_chnative_init_00109: -;source-doc/base-drv/./usb-init.c:56: } +;source-doc/base-drv/usb-init.c:56: } ret usb_init_str_0: DEFB 0x0d diff --git a/Source/HBIOS/ch376-native/base-drv/usb_state.c.asm b/Source/HBIOS/ch376-native/base-drv/usb_state.c.asm new file mode 100644 index 00000000..a6764589 --- /dev/null +++ b/Source/HBIOS/ch376-native/base-drv/usb_state.c.asm @@ -0,0 +1,605 @@ +;-------------------------------------------------------- +; File Created by SDCC : free open source ISO C Compiler +; Version 4.4.0 #14648 (Linux) +;-------------------------------------------------------- +; Processed by Z88DK +;-------------------------------------------------------- + + EXTERN __divschar + EXTERN __divschar_callee + EXTERN __divsint + EXTERN __divsint_callee + EXTERN __divslong + EXTERN __divslong_callee + EXTERN __divslonglong + EXTERN __divslonglong_callee + EXTERN __divsuchar + EXTERN __divsuchar_callee + EXTERN __divuchar + EXTERN __divuchar_callee + EXTERN __divuint + EXTERN __divuint_callee + EXTERN __divulong + EXTERN __divulong_callee + EXTERN __divulonglong + EXTERN __divulonglong_callee + EXTERN __divuschar + EXTERN __divuschar_callee + EXTERN __modschar + EXTERN __modschar_callee + EXTERN __modsint + EXTERN __modsint_callee + EXTERN __modslong + EXTERN __modslong_callee + EXTERN __modslonglong + EXTERN __modslonglong_callee + EXTERN __modsuchar + EXTERN __modsuchar_callee + EXTERN __moduchar + EXTERN __moduchar_callee + EXTERN __moduint + EXTERN __moduint_callee + EXTERN __modulong + EXTERN __modulong_callee + EXTERN __modulonglong + EXTERN __modulonglong_callee + EXTERN __moduschar + EXTERN __moduschar_callee + EXTERN __mulint + EXTERN __mulint_callee + EXTERN __mullong + EXTERN __mullong_callee + EXTERN __mullonglong + EXTERN __mullonglong_callee + EXTERN __mulschar + EXTERN __mulschar_callee + EXTERN __mulsuchar + EXTERN __mulsuchar_callee + EXTERN __muluchar + EXTERN __muluchar_callee + EXTERN __muluschar + EXTERN __muluschar_callee + EXTERN __rlslonglong + EXTERN __rlslonglong_callee + EXTERN __rlulonglong + EXTERN __rlulonglong_callee + EXTERN __rrslonglong + EXTERN __rrslonglong_callee + EXTERN __rrulonglong + EXTERN __rrulonglong_callee + EXTERN ___mulsint2slong + EXTERN ___mulsint2slong_callee + EXTERN ___muluint2ulong + EXTERN ___muluint2ulong_callee + EXTERN ___sdcc_call_hl + EXTERN ___sdcc_call_iy + EXTERN ___sdcc_enter_ix + EXTERN banked_call + EXTERN _banked_ret + EXTERN ___fs2schar + EXTERN ___fs2schar_callee + EXTERN ___fs2sint + EXTERN ___fs2sint_callee + EXTERN ___fs2slong + EXTERN ___fs2slong_callee + EXTERN ___fs2slonglong + EXTERN ___fs2slonglong_callee + EXTERN ___fs2uchar + EXTERN ___fs2uchar_callee + EXTERN ___fs2uint + EXTERN ___fs2uint_callee + EXTERN ___fs2ulong + EXTERN ___fs2ulong_callee + EXTERN ___fs2ulonglong + EXTERN ___fs2ulonglong_callee + EXTERN ___fsadd + EXTERN ___fsadd_callee + EXTERN ___fsdiv + EXTERN ___fsdiv_callee + EXTERN ___fseq + EXTERN ___fseq_callee + EXTERN ___fsgt + EXTERN ___fsgt_callee + EXTERN ___fslt + EXTERN ___fslt_callee + EXTERN ___fsmul + EXTERN ___fsmul_callee + EXTERN ___fsneq + EXTERN ___fsneq_callee + EXTERN ___fssub + EXTERN ___fssub_callee + EXTERN ___schar2fs + EXTERN ___schar2fs_callee + EXTERN ___sint2fs + EXTERN ___sint2fs_callee + EXTERN ___slong2fs + EXTERN ___slong2fs_callee + EXTERN ___slonglong2fs + EXTERN ___slonglong2fs_callee + EXTERN ___uchar2fs + EXTERN ___uchar2fs_callee + EXTERN ___uint2fs + EXTERN ___uint2fs_callee + EXTERN ___ulong2fs + EXTERN ___ulong2fs_callee + EXTERN ___ulonglong2fs + EXTERN ___ulonglong2fs_callee + EXTERN ____sdcc_2_copy_src_mhl_dst_deix + EXTERN ____sdcc_2_copy_src_mhl_dst_bcix + EXTERN ____sdcc_4_copy_src_mhl_dst_deix + EXTERN ____sdcc_4_copy_src_mhl_dst_bcix + EXTERN ____sdcc_4_copy_src_mhl_dst_mbc + EXTERN ____sdcc_4_ldi_nosave_bc + EXTERN ____sdcc_4_ldi_save_bc + EXTERN ____sdcc_4_push_hlix + EXTERN ____sdcc_4_push_mhl + EXTERN ____sdcc_lib_setmem_hl + EXTERN ____sdcc_ll_add_de_bc_hl + EXTERN ____sdcc_ll_add_de_bc_hlix + EXTERN ____sdcc_ll_add_de_hlix_bc + EXTERN ____sdcc_ll_add_de_hlix_bcix + EXTERN ____sdcc_ll_add_deix_bc_hl + EXTERN ____sdcc_ll_add_deix_hlix + EXTERN ____sdcc_ll_add_hlix_bc_deix + EXTERN ____sdcc_ll_add_hlix_deix_bc + EXTERN ____sdcc_ll_add_hlix_deix_bcix + EXTERN ____sdcc_ll_asr_hlix_a + EXTERN ____sdcc_ll_asr_mbc_a + EXTERN ____sdcc_ll_copy_src_de_dst_hlix + EXTERN ____sdcc_ll_copy_src_de_dst_hlsp + EXTERN ____sdcc_ll_copy_src_deix_dst_hl + EXTERN ____sdcc_ll_copy_src_deix_dst_hlix + EXTERN ____sdcc_ll_copy_src_deixm_dst_hlsp + EXTERN ____sdcc_ll_copy_src_desp_dst_hlsp + EXTERN ____sdcc_ll_copy_src_hl_dst_de + EXTERN ____sdcc_ll_copy_src_hlsp_dst_de + EXTERN ____sdcc_ll_copy_src_hlsp_dst_deixm + EXTERN ____sdcc_ll_lsl_hlix_a + EXTERN ____sdcc_ll_lsl_mbc_a + EXTERN ____sdcc_ll_lsr_hlix_a + EXTERN ____sdcc_ll_lsr_mbc_a + EXTERN ____sdcc_ll_push_hlix + EXTERN ____sdcc_ll_push_mhl + EXTERN ____sdcc_ll_sub_de_bc_hl + EXTERN ____sdcc_ll_sub_de_bc_hlix + EXTERN ____sdcc_ll_sub_de_hlix_bc + EXTERN ____sdcc_ll_sub_de_hlix_bcix + EXTERN ____sdcc_ll_sub_deix_bc_hl + EXTERN ____sdcc_ll_sub_deix_hlix + EXTERN ____sdcc_ll_sub_hlix_bc_deix + EXTERN ____sdcc_ll_sub_hlix_deix_bc + EXTERN ____sdcc_ll_sub_hlix_deix_bcix + EXTERN ____sdcc_load_debc_deix + EXTERN ____sdcc_load_dehl_deix + EXTERN ____sdcc_load_debc_mhl + EXTERN ____sdcc_load_hlde_mhl + EXTERN ____sdcc_store_dehl_bcix + EXTERN ____sdcc_store_debc_hlix + EXTERN ____sdcc_store_debc_mhl + EXTERN ____sdcc_cpu_pop_ei + EXTERN ____sdcc_cpu_pop_ei_jp + EXTERN ____sdcc_cpu_push_di + EXTERN ____sdcc_outi + EXTERN ____sdcc_outi_128 + EXTERN ____sdcc_outi_256 + EXTERN ____sdcc_ldi + EXTERN ____sdcc_ldi_128 + EXTERN ____sdcc_ldi_256 + EXTERN ____sdcc_4_copy_srcd_hlix_dst_deix + EXTERN ____sdcc_4_and_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_or_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_or_src_dehl_dst_bcix + EXTERN ____sdcc_4_xor_src_dehl_dst_bcix + EXTERN ____sdcc_4_and_src_dehl_dst_bcix + EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_or_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_cpl_src_mhl_dst_debc + EXTERN ____sdcc_4_xor_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_or_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_debc_hlix_dst_debc + EXTERN ____sdcc_4_or_src_debc_hlix_dst_debc + EXTERN ____sdcc_4_xor_src_debc_hlix_dst_debc + +;-------------------------------------------------------- +; Public variables in this module +;-------------------------------------------------------- + GLOBAL _device_config_sizes + GLOBAL _find_device_config + GLOBAL _find_first_free + GLOBAL _first_device_config + GLOBAL _next_device_config + GLOBAL _get_usb_device_config +;-------------------------------------------------------- +; Externals used +;-------------------------------------------------------- + GLOBAL _get_number_of_usb_drives + GLOBAL _usbtrn_clear_endpoint_halt + GLOBAL _usbtrn_set_address + GLOBAL _usbtrn_set_configuration + GLOBAL _usbtrn_gfull_cfg_desc + GLOBAL _usbtrn_get_config_descriptor + GLOBAL _usbtrn_get_descriptor2 + GLOBAL _usbtrn_get_descriptor + GLOBAL _usbdev_dat_in_trnsfer_0 + GLOBAL _usbdev_dat_in_trnsfer + GLOBAL _usbdev_bulk_in_transfer + GLOBAL _usbdev_blk_out_trnsfer + GLOBAL _usbdev_control_transfer + GLOBAL _usb_data_out_transfer + GLOBAL _usb_data_in_transfer_n + GLOBAL _usb_data_in_transfer + GLOBAL _usb_control_transfer + GLOBAL _ch_issue_token_in_ep0 + GLOBAL _ch_issue_token_out_ep0 + GLOBAL _ch_issue_token_setup + GLOBAL _ch_data_out_transfer + GLOBAL _ch_data_in_transfer_n + GLOBAL _ch_data_in_transfer + GLOBAL _ch_control_transfer_set_config + GLOBAL _ch_control_transfer_set_address + GLOBAL _ch_control_transfer_request_descriptor + GLOBAL _ch_set_usb_address + GLOBAL _ch_write_data + GLOBAL _ch_cmd_get_ic_version + GLOBAL _ch_cmd_set_usb_mode + GLOBAL _ch_probe + GLOBAL _ch_cmd_reset_all + GLOBAL _ch_read_data + GLOBAL _ch_very_short_wait_int_and_get_status + GLOBAL _ch_short_wait_int_and_get_status + GLOBAL _ch_long_wait_int_and_get_status + GLOBAL _ch_get_status + GLOBAL _ch_command + GLOBAL _delay_medium + GLOBAL _delay_short + GLOBAL _delay_20ms + GLOBAL _printf + GLOBAL _delay + GLOBAL _ulltoa_callee + GLOBAL _ulltoa + GLOBAL _strtoull_callee + GLOBAL _strtoull + GLOBAL _strtoll_callee + GLOBAL _strtoll + GLOBAL _lltoa_callee + GLOBAL _lltoa + GLOBAL _llabs_callee + GLOBAL _llabs + GLOBAL __lldivu__callee + GLOBAL __lldivu_ + GLOBAL __lldiv__callee + GLOBAL __lldiv_ + GLOBAL _atoll_callee + GLOBAL _atoll + GLOBAL _realloc_unlocked_callee + GLOBAL _realloc_unlocked + GLOBAL _malloc_unlocked_fastcall + GLOBAL _malloc_unlocked + GLOBAL _free_unlocked_fastcall + GLOBAL _free_unlocked + GLOBAL _calloc_unlocked_callee + GLOBAL _calloc_unlocked + GLOBAL _aligned_alloc_unlocked_callee + GLOBAL _aligned_alloc_unlocked + GLOBAL _realloc_callee + GLOBAL _realloc + GLOBAL _malloc_fastcall + GLOBAL _malloc + GLOBAL _free_fastcall + GLOBAL _free + GLOBAL _calloc_callee + GLOBAL _calloc + GLOBAL _aligned_alloc_callee + GLOBAL _aligned_alloc + GLOBAL _utoa_callee + GLOBAL _utoa + GLOBAL _ultoa_callee + GLOBAL _ultoa + GLOBAL _system_fastcall + GLOBAL _system + GLOBAL _strtoul_callee + GLOBAL _strtoul + GLOBAL _strtol_callee + GLOBAL _strtol + GLOBAL _strtof_callee + GLOBAL _strtof + GLOBAL _strtod_callee + GLOBAL _strtod + GLOBAL _srand_fastcall + GLOBAL _srand + GLOBAL _rand + GLOBAL _quick_exit_fastcall + GLOBAL _quick_exit + GLOBAL _qsort_callee + GLOBAL _qsort + GLOBAL _ltoa_callee + GLOBAL _ltoa + GLOBAL _labs_fastcall + GLOBAL _labs + GLOBAL _itoa_callee + GLOBAL _itoa + GLOBAL _ftoh_callee + GLOBAL _ftoh + GLOBAL _ftog_callee + GLOBAL _ftog + GLOBAL _ftoe_callee + GLOBAL _ftoe + GLOBAL _ftoa_callee + GLOBAL _ftoa + GLOBAL _exit_fastcall + GLOBAL _exit + GLOBAL _dtoh_callee + GLOBAL _dtoh + GLOBAL _dtog_callee + GLOBAL _dtog + GLOBAL _dtoe_callee + GLOBAL _dtoe + GLOBAL _dtoa_callee + GLOBAL _dtoa + GLOBAL _bsearch_callee + GLOBAL _bsearch + GLOBAL _atol_fastcall + GLOBAL _atol + GLOBAL _atoi_fastcall + GLOBAL _atoi + GLOBAL _atof_fastcall + GLOBAL _atof + GLOBAL _atexit_fastcall + GLOBAL _atexit + GLOBAL _at_quick_exit_fastcall + GLOBAL _at_quick_exit + GLOBAL _abs_fastcall + GLOBAL _abs + GLOBAL _abort + GLOBAL __strtou__callee + GLOBAL __strtou_ + GLOBAL __strtoi__callee + GLOBAL __strtoi_ + GLOBAL __random_uniform_xor_8__fastcall + GLOBAL __random_uniform_xor_8_ + GLOBAL __random_uniform_xor_32__fastcall + GLOBAL __random_uniform_xor_32_ + GLOBAL __random_uniform_cmwc_8__fastcall + GLOBAL __random_uniform_cmwc_8_ + GLOBAL __shellsort__callee + GLOBAL __shellsort_ + GLOBAL __quicksort__callee + GLOBAL __quicksort_ + GLOBAL __insertion_sort__callee + GLOBAL __insertion_sort_ + GLOBAL __ldivu__callee + GLOBAL __ldivu_ + GLOBAL __ldiv__callee + GLOBAL __ldiv_ + GLOBAL __divu__callee + GLOBAL __divu_ + GLOBAL __div__callee + GLOBAL __div_ + GLOBAL _x + GLOBAL _result +;-------------------------------------------------------- +; special function registers +;-------------------------------------------------------- +defc _CH376_DATA_PORT = 0xff88 +defc _CH376_COMMAND_PORT = 0xff89 +defc _USB_MODULE_LEDS = 0xff8a +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + SECTION bss_compiler +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + +IF 0 + +; .area _INITIALIZED removed by z88dk + + +ENDIF + +;-------------------------------------------------------- +; absolute external ram data +;-------------------------------------------------------- + SECTION IGNORE +;-------------------------------------------------------- +; global & static initialisations +;-------------------------------------------------------- + SECTION code_crt_init +;-------------------------------------------------------- +; Home +;-------------------------------------------------------- + SECTION IGNORE +;-------------------------------------------------------- +; code +;-------------------------------------------------------- + SECTION code_compiler +;source-doc/base-drv/usb_state.c:13: device_config *find_device_config(const usb_device_type requested_type) { +; --------------------------------- +; Function find_device_config +; --------------------------------- +_find_device_config: + push ix + ld ix,0 + add ix,sp +;source-doc/base-drv/usb_state.c:14: _usb_state *const p = get_usb_work_area(); +;source-doc/base-drv/usb_state.c:16: const device_config *p_config = first_device_config(p); + ld hl,_x + call _first_device_config +;source-doc/base-drv/usb_state.c:17: while (p_config) { +l_find_device_config_00103: + ld a, d + or a, e + jr Z,l_find_device_config_00105 +;source-doc/base-drv/usb_state.c:18: const uint8_t type = p_config->type; + ld l, e + ld h, d + ld a, (hl) + and a,0x0f + ld c, a +;source-doc/base-drv/usb_state.c:20: if (type == requested_type) + ld a,(ix+4) + sub a, c + jr NZ,l_find_device_config_00102 +;source-doc/base-drv/usb_state.c:21: return (device_config *)p_config; + ex de, hl + jr l_find_device_config_00106 +l_find_device_config_00102: +;source-doc/base-drv/usb_state.c:23: p_config = next_device_config(p, p_config); + ld hl,_x + call _next_device_config + jr l_find_device_config_00103 +l_find_device_config_00105: +;source-doc/base-drv/usb_state.c:26: return NULL; + ld hl,0x0000 +l_find_device_config_00106: +;source-doc/base-drv/usb_state.c:27: } + pop ix + ret + SECTION rodata_compiler +_device_config_sizes: + DEFB +0x00 + DEFB +0x10 + DEFB +0x10 + DEFB +0x0c + DEFB +0x06 + DEFB 0x00 + DEFB 0x00 + SECTION code_compiler +;source-doc/base-drv/usb_state.c:30: device_config *find_first_free(void) { +; --------------------------------- +; Function find_first_free +; --------------------------------- +_find_first_free: +;source-doc/base-drv/usb_state.c:31: _usb_state *const boot_state = get_usb_work_area(); +;source-doc/base-drv/usb_state.c:34: device_config *p = first_device_config(boot_state); + ld hl,_x + call _first_device_config +;source-doc/base-drv/usb_state.c:35: while (p) { +l_find_first_free_00103: + ld a, d + or a, e + jr Z,l_find_first_free_00105 +;source-doc/base-drv/usb_state.c:36: if (p->type == 0) + ld l, e + ld h, d + ld a, (hl) + and a,0x0f + jr NZ,l_find_first_free_00102 +;source-doc/base-drv/usb_state.c:37: return p; + ex de, hl + jr l_find_first_free_00106 +l_find_first_free_00102: +;source-doc/base-drv/usb_state.c:39: p = next_device_config(boot_state, p); + ld hl,_x + call _next_device_config + jr l_find_first_free_00103 +l_find_first_free_00105: +;source-doc/base-drv/usb_state.c:42: return NULL; + ld hl,0x0000 +l_find_first_free_00106: +;source-doc/base-drv/usb_state.c:43: } + ret +;source-doc/base-drv/usb_state.c:45: device_config *first_device_config(const _usb_state *const p) __sdcccall(1) { return (device_config *)&p->device_configs[0]; } +; --------------------------------- +; Function first_device_config +; --------------------------------- +_first_device_config: + ex de, hl + inc de + inc de + ret +;source-doc/base-drv/usb_state.c:47: device_config *next_device_config(const _usb_state *const usb_state, const device_config *const p) __sdcccall(1) { +; --------------------------------- +; Function next_device_config +; --------------------------------- +_next_device_config: + ld c, l + ld b, h +;source-doc/base-drv/usb_state.c:48: if (p->type == 0) + ld l, e + ld h, d + ld a, (hl) + and a,0x0f + jr NZ,l_next_device_config_00102 +;source-doc/base-drv/usb_state.c:49: return NULL; + ld de,0x0000 + jr l_next_device_config_00105 +l_next_device_config_00102: +;source-doc/base-drv/usb_state.c:51: const uint8_t size = device_config_sizes[p->type]; + ld l, e + ld h, d + ld a, (hl) + and a,0x0f + add a, +((_device_config_sizes) & 0xFF) + ld l, a + ld a,0x00 + adc a, +((_device_config_sizes) / 256) + ld h, a + ld l, (hl) +;source-doc/base-drv/usb_state.c:58: const uint8_t *_p = (uint8_t *)p; +;source-doc/base-drv/usb_state.c:59: device_config *const result = (device_config *)(_p + size); + ld h,0x00 + add hl, de + ex de, hl +;source-doc/base-drv/usb_state.c:61: if (result >= (device_config *)&usb_state->device_configs_end) + ld hl,0x0062 + add hl, bc + ld a, e + sub a, l + ld a, d + sbc a, h + ret C +;source-doc/base-drv/usb_state.c:62: return NULL; + ld de,0x0000 +;source-doc/base-drv/usb_state.c:64: return result; +l_next_device_config_00105: +;source-doc/base-drv/usb_state.c:65: } + ret +;source-doc/base-drv/usb_state.c:68: device_config *get_usb_device_config(const uint8_t device_index) __sdcccall(1) { +; --------------------------------- +; Function get_usb_device_config +; --------------------------------- +_get_usb_device_config: + ld c, a +;source-doc/base-drv/usb_state.c:69: const _usb_state *const usb_state = get_usb_work_area(); +;source-doc/base-drv/usb_state.c:73: for (device_config *p = first_device_config(usb_state); p; p = next_device_config(usb_state, p)) { + push bc + ld hl,_x + call _first_device_config + pop bc + ld b,0x01 +l_get_usb_device_config_00107: + ld a, d + or a, e + jr Z,l_get_usb_device_config_00105 +;source-doc/base-drv/usb_state.c:74: if (p->type != USB_NOT_SUPPORTED) { + ld l, e + ld h, d + ld a, (hl) + and a,0x0f + jr Z,l_get_usb_device_config_00108 +;source-doc/base-drv/usb_state.c:75: if (counter == device_index) + ld a, c + sub a, b +;source-doc/base-drv/usb_state.c:76: return p; + jr Z,l_get_usb_device_config_00109 +;source-doc/base-drv/usb_state.c:77: counter++; + inc b +l_get_usb_device_config_00108: +;source-doc/base-drv/usb_state.c:73: for (device_config *p = first_device_config(usb_state); p; p = next_device_config(usb_state, p)) { + push bc + ld hl,_x + call _next_device_config + pop bc + jr l_get_usb_device_config_00107 +l_get_usb_device_config_00105: +;source-doc/base-drv/usb_state.c:81: return NULL; // is not a usb device + ld de,0x0000 +l_get_usb_device_config_00109: +;source-doc/base-drv/usb_state.c:82: } + ret + SECTION IGNORE diff --git a/Source/HBIOS/ch376-native/base-drv/usb_state.c.s b/Source/HBIOS/ch376-native/base-drv/usb_state.c.s index b292e052..0f59f64d 100644 --- a/Source/HBIOS/ch376-native/base-drv/usb_state.c.s +++ b/Source/HBIOS/ch376-native/base-drv/usb_state.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/base-drv/./usb_state.c.asm -- not to be modify directly +; Generated from source-doc/base-drv/usb_state.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -48,7 +48,7 @@ _USB_MODULE_LEDS .EQU 0xff8a ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/base-drv/./usb_state.c:13: device_config *find_device_config(const usb_device_type requested_type) { +;source-doc/base-drv/usb_state.c:13: device_config *find_device_config(const usb_device_type requested_type) { ; --------------------------------- ; Function find_device_config ; --------------------------------- @@ -56,38 +56,38 @@ _find_device_config: push ix ld ix,0 add ix,sp -;source-doc/base-drv/./usb_state.c:14: _usb_state *const p = get_usb_work_area(); -;source-doc/base-drv/./usb_state.c:16: const device_config *p_config = first_device_config(p); +;source-doc/base-drv/usb_state.c:14: _usb_state *const p = get_usb_work_area(); +;source-doc/base-drv/usb_state.c:16: const device_config *p_config = first_device_config(p); ld hl,_x call _first_device_config -;source-doc/base-drv/./usb_state.c:17: while (p_config) { +;source-doc/base-drv/usb_state.c:17: while (p_config) { l_find_device_config_00103: ld a, d or e jr Z,l_find_device_config_00105 -;source-doc/base-drv/./usb_state.c:18: const uint8_t type = p_config->type; +;source-doc/base-drv/usb_state.c:18: const uint8_t type = p_config->type; ld l, e ld h, d ld a, (hl) and 0x0f ld c, a -;source-doc/base-drv/./usb_state.c:20: if (type == requested_type) +;source-doc/base-drv/usb_state.c:20: if (type == requested_type) ld a,(ix+4) sub c jr NZ,l_find_device_config_00102 -;source-doc/base-drv/./usb_state.c:21: return (device_config *)p_config; +;source-doc/base-drv/usb_state.c:21: return (device_config *)p_config; ex de, hl jr l_find_device_config_00106 l_find_device_config_00102: -;source-doc/base-drv/./usb_state.c:23: p_config = next_device_config(p, p_config); +;source-doc/base-drv/usb_state.c:23: p_config = next_device_config(p, p_config); ld hl,_x call _next_device_config jr l_find_device_config_00103 l_find_device_config_00105: -;source-doc/base-drv/./usb_state.c:26: return NULL; +;source-doc/base-drv/usb_state.c:26: return NULL; ld hl,0x0000 l_find_device_config_00106: -;source-doc/base-drv/./usb_state.c:27: } +;source-doc/base-drv/usb_state.c:27: } pop ix ret _device_config_sizes: @@ -98,41 +98,41 @@ _device_config_sizes: DEFB +0x06 DEFB 0x00 DEFB 0x00 -;source-doc/base-drv/./usb_state.c:30: device_config *find_first_free(void) { +;source-doc/base-drv/usb_state.c:30: device_config *find_first_free(void) { ; --------------------------------- ; Function find_first_free ; --------------------------------- _find_first_free: -;source-doc/base-drv/./usb_state.c:31: _usb_state *const boot_state = get_usb_work_area(); -;source-doc/base-drv/./usb_state.c:34: device_config *p = first_device_config(boot_state); +;source-doc/base-drv/usb_state.c:31: _usb_state *const boot_state = get_usb_work_area(); +;source-doc/base-drv/usb_state.c:34: device_config *p = first_device_config(boot_state); ld hl,_x call _first_device_config -;source-doc/base-drv/./usb_state.c:35: while (p) { +;source-doc/base-drv/usb_state.c:35: while (p) { l_find_first_free_00103: ld a, d or e jr Z,l_find_first_free_00105 -;source-doc/base-drv/./usb_state.c:36: if (p->type == 0) +;source-doc/base-drv/usb_state.c:36: if (p->type == 0) ld l, e ld h, d ld a, (hl) and 0x0f jr NZ,l_find_first_free_00102 -;source-doc/base-drv/./usb_state.c:37: return p; +;source-doc/base-drv/usb_state.c:37: return p; ex de, hl jr l_find_first_free_00106 l_find_first_free_00102: -;source-doc/base-drv/./usb_state.c:39: p = next_device_config(boot_state, p); +;source-doc/base-drv/usb_state.c:39: p = next_device_config(boot_state, p); ld hl,_x call _next_device_config jr l_find_first_free_00103 l_find_first_free_00105: -;source-doc/base-drv/./usb_state.c:42: return NULL; +;source-doc/base-drv/usb_state.c:42: return NULL; ld hl,0x0000 l_find_first_free_00106: -;source-doc/base-drv/./usb_state.c:43: } +;source-doc/base-drv/usb_state.c:43: } ret -;source-doc/base-drv/./usb_state.c:45: device_config *first_device_config(const _usb_state *const p) __sdcccall(1) { return (device_config *)&p->device_configs[0]; } +;source-doc/base-drv/usb_state.c:45: device_config *first_device_config(const _usb_state *const p) __sdcccall(1) { return (device_config *)&p->device_configs[0]; } ; --------------------------------- ; Function first_device_config ; --------------------------------- @@ -141,24 +141,24 @@ _first_device_config: inc de inc de ret -;source-doc/base-drv/./usb_state.c:47: device_config *next_device_config(const _usb_state *const usb_state, const device_config *const p) __sdcccall(1) { +;source-doc/base-drv/usb_state.c:47: device_config *next_device_config(const _usb_state *const usb_state, const device_config *const p) __sdcccall(1) { ; --------------------------------- ; Function next_device_config ; --------------------------------- _next_device_config: ld c, l ld b, h -;source-doc/base-drv/./usb_state.c:48: if (p->type == 0) +;source-doc/base-drv/usb_state.c:48: if (p->type == 0) ld l, e ld h, d ld a, (hl) and 0x0f jr NZ,l_next_device_config_00102 -;source-doc/base-drv/./usb_state.c:49: return NULL; +;source-doc/base-drv/usb_state.c:49: return NULL; ld de,0x0000 jr l_next_device_config_00105 l_next_device_config_00102: -;source-doc/base-drv/./usb_state.c:51: const uint8_t size = device_config_sizes[p->type]; +;source-doc/base-drv/usb_state.c:51: const uint8_t size = device_config_sizes[p->type]; ld l, e ld h, d ld a, (hl) @@ -169,12 +169,12 @@ l_next_device_config_00102: adc a, +((_device_config_sizes) / 256) ld h, a ld l, (hl) -;source-doc/base-drv/./usb_state.c:58: const uint8_t *_p = (uint8_t *)p; -;source-doc/base-drv/./usb_state.c:59: device_config *const result = (device_config *)(_p + size); +;source-doc/base-drv/usb_state.c:58: const uint8_t *_p = (uint8_t *)p; +;source-doc/base-drv/usb_state.c:59: device_config *const result = (device_config *)(_p + size); ld h,0x00 add hl, de ex de, hl -;source-doc/base-drv/./usb_state.c:61: if (result >= (device_config *)&usb_state->device_configs_end) +;source-doc/base-drv/usb_state.c:61: if (result >= (device_config *)&usb_state->device_configs_end) ld hl,0x0062 add hl, bc ld a, e @@ -182,20 +182,20 @@ l_next_device_config_00102: ld a, d sbc a, h ret C -;source-doc/base-drv/./usb_state.c:62: return NULL; +;source-doc/base-drv/usb_state.c:62: return NULL; ld de,0x0000 -;source-doc/base-drv/./usb_state.c:64: return result; +;source-doc/base-drv/usb_state.c:64: return result; l_next_device_config_00105: -;source-doc/base-drv/./usb_state.c:65: } +;source-doc/base-drv/usb_state.c:65: } ret -;source-doc/base-drv/./usb_state.c:68: device_config *get_usb_device_config(const uint8_t device_index) __sdcccall(1) { +;source-doc/base-drv/usb_state.c:68: device_config *get_usb_device_config(const uint8_t device_index) __sdcccall(1) { ; --------------------------------- ; Function get_usb_device_config ; --------------------------------- _get_usb_device_config: ld c, a -;source-doc/base-drv/./usb_state.c:69: const _usb_state *const usb_state = get_usb_work_area(); -;source-doc/base-drv/./usb_state.c:73: for (device_config *p = first_device_config(usb_state); p; p = next_device_config(usb_state, p)) { +;source-doc/base-drv/usb_state.c:69: const _usb_state *const usb_state = get_usb_work_area(); +;source-doc/base-drv/usb_state.c:73: for (device_config *p = first_device_config(usb_state); p; p = next_device_config(usb_state, p)) { push bc ld hl,_x call _first_device_config @@ -205,29 +205,29 @@ l_get_usb_device_config_00107: ld a, d or e jr Z,l_get_usb_device_config_00105 -;source-doc/base-drv/./usb_state.c:74: if (p->type != USB_NOT_SUPPORTED) { +;source-doc/base-drv/usb_state.c:74: if (p->type != USB_NOT_SUPPORTED) { ld l, e ld h, d ld a, (hl) and 0x0f jr Z,l_get_usb_device_config_00108 -;source-doc/base-drv/./usb_state.c:75: if (counter == device_index) +;source-doc/base-drv/usb_state.c:75: if (counter == device_index) ld a, c sub b -;source-doc/base-drv/./usb_state.c:76: return p; +;source-doc/base-drv/usb_state.c:76: return p; jr Z,l_get_usb_device_config_00109 -;source-doc/base-drv/./usb_state.c:77: counter++; +;source-doc/base-drv/usb_state.c:77: counter++; inc b l_get_usb_device_config_00108: -;source-doc/base-drv/./usb_state.c:73: for (device_config *p = first_device_config(usb_state); p; p = next_device_config(usb_state, p)) { +;source-doc/base-drv/usb_state.c:73: for (device_config *p = first_device_config(usb_state); p; p = next_device_config(usb_state, p)) { push bc ld hl,_x call _next_device_config pop bc jr l_get_usb_device_config_00107 l_get_usb_device_config_00105: -;source-doc/base-drv/./usb_state.c:81: return NULL; // is not a usb device +;source-doc/base-drv/usb_state.c:81: return NULL; // is not a usb device ld de,0x0000 l_get_usb_device_config_00109: -;source-doc/base-drv/./usb_state.c:82: } +;source-doc/base-drv/usb_state.c:82: } ret diff --git a/Source/HBIOS/ch376-native/base-drv/work-area.c.asm b/Source/HBIOS/ch376-native/base-drv/work-area.c.asm new file mode 100644 index 00000000..0f2e36fc --- /dev/null +++ b/Source/HBIOS/ch376-native/base-drv/work-area.c.asm @@ -0,0 +1,520 @@ +;-------------------------------------------------------- +; File Created by SDCC : free open source ISO C Compiler +; Version 4.4.0 #14648 (Linux) +;-------------------------------------------------------- +; Processed by Z88DK +;-------------------------------------------------------- + + EXTERN __divschar + EXTERN __divschar_callee + EXTERN __divsint + EXTERN __divsint_callee + EXTERN __divslong + EXTERN __divslong_callee + EXTERN __divslonglong + EXTERN __divslonglong_callee + EXTERN __divsuchar + EXTERN __divsuchar_callee + EXTERN __divuchar + EXTERN __divuchar_callee + EXTERN __divuint + EXTERN __divuint_callee + EXTERN __divulong + EXTERN __divulong_callee + EXTERN __divulonglong + EXTERN __divulonglong_callee + EXTERN __divuschar + EXTERN __divuschar_callee + EXTERN __modschar + EXTERN __modschar_callee + EXTERN __modsint + EXTERN __modsint_callee + EXTERN __modslong + EXTERN __modslong_callee + EXTERN __modslonglong + EXTERN __modslonglong_callee + EXTERN __modsuchar + EXTERN __modsuchar_callee + EXTERN __moduchar + EXTERN __moduchar_callee + EXTERN __moduint + EXTERN __moduint_callee + EXTERN __modulong + EXTERN __modulong_callee + EXTERN __modulonglong + EXTERN __modulonglong_callee + EXTERN __moduschar + EXTERN __moduschar_callee + EXTERN __mulint + EXTERN __mulint_callee + EXTERN __mullong + EXTERN __mullong_callee + EXTERN __mullonglong + EXTERN __mullonglong_callee + EXTERN __mulschar + EXTERN __mulschar_callee + EXTERN __mulsuchar + EXTERN __mulsuchar_callee + EXTERN __muluchar + EXTERN __muluchar_callee + EXTERN __muluschar + EXTERN __muluschar_callee + EXTERN __rlslonglong + EXTERN __rlslonglong_callee + EXTERN __rlulonglong + EXTERN __rlulonglong_callee + EXTERN __rrslonglong + EXTERN __rrslonglong_callee + EXTERN __rrulonglong + EXTERN __rrulonglong_callee + EXTERN ___mulsint2slong + EXTERN ___mulsint2slong_callee + EXTERN ___muluint2ulong + EXTERN ___muluint2ulong_callee + EXTERN ___sdcc_call_hl + EXTERN ___sdcc_call_iy + EXTERN ___sdcc_enter_ix + EXTERN banked_call + EXTERN _banked_ret + EXTERN ___fs2schar + EXTERN ___fs2schar_callee + EXTERN ___fs2sint + EXTERN ___fs2sint_callee + EXTERN ___fs2slong + EXTERN ___fs2slong_callee + EXTERN ___fs2slonglong + EXTERN ___fs2slonglong_callee + EXTERN ___fs2uchar + EXTERN ___fs2uchar_callee + EXTERN ___fs2uint + EXTERN ___fs2uint_callee + EXTERN ___fs2ulong + EXTERN ___fs2ulong_callee + EXTERN ___fs2ulonglong + EXTERN ___fs2ulonglong_callee + EXTERN ___fsadd + EXTERN ___fsadd_callee + EXTERN ___fsdiv + EXTERN ___fsdiv_callee + EXTERN ___fseq + EXTERN ___fseq_callee + EXTERN ___fsgt + EXTERN ___fsgt_callee + EXTERN ___fslt + EXTERN ___fslt_callee + EXTERN ___fsmul + EXTERN ___fsmul_callee + EXTERN ___fsneq + EXTERN ___fsneq_callee + EXTERN ___fssub + EXTERN ___fssub_callee + EXTERN ___schar2fs + EXTERN ___schar2fs_callee + EXTERN ___sint2fs + EXTERN ___sint2fs_callee + EXTERN ___slong2fs + EXTERN ___slong2fs_callee + EXTERN ___slonglong2fs + EXTERN ___slonglong2fs_callee + EXTERN ___uchar2fs + EXTERN ___uchar2fs_callee + EXTERN ___uint2fs + EXTERN ___uint2fs_callee + EXTERN ___ulong2fs + EXTERN ___ulong2fs_callee + EXTERN ___ulonglong2fs + EXTERN ___ulonglong2fs_callee + EXTERN ____sdcc_2_copy_src_mhl_dst_deix + EXTERN ____sdcc_2_copy_src_mhl_dst_bcix + EXTERN ____sdcc_4_copy_src_mhl_dst_deix + EXTERN ____sdcc_4_copy_src_mhl_dst_bcix + EXTERN ____sdcc_4_copy_src_mhl_dst_mbc + EXTERN ____sdcc_4_ldi_nosave_bc + EXTERN ____sdcc_4_ldi_save_bc + EXTERN ____sdcc_4_push_hlix + EXTERN ____sdcc_4_push_mhl + EXTERN ____sdcc_lib_setmem_hl + EXTERN ____sdcc_ll_add_de_bc_hl + EXTERN ____sdcc_ll_add_de_bc_hlix + EXTERN ____sdcc_ll_add_de_hlix_bc + EXTERN ____sdcc_ll_add_de_hlix_bcix + EXTERN ____sdcc_ll_add_deix_bc_hl + EXTERN ____sdcc_ll_add_deix_hlix + EXTERN ____sdcc_ll_add_hlix_bc_deix + EXTERN ____sdcc_ll_add_hlix_deix_bc + EXTERN ____sdcc_ll_add_hlix_deix_bcix + EXTERN ____sdcc_ll_asr_hlix_a + EXTERN ____sdcc_ll_asr_mbc_a + EXTERN ____sdcc_ll_copy_src_de_dst_hlix + EXTERN ____sdcc_ll_copy_src_de_dst_hlsp + EXTERN ____sdcc_ll_copy_src_deix_dst_hl + EXTERN ____sdcc_ll_copy_src_deix_dst_hlix + EXTERN ____sdcc_ll_copy_src_deixm_dst_hlsp + EXTERN ____sdcc_ll_copy_src_desp_dst_hlsp + EXTERN ____sdcc_ll_copy_src_hl_dst_de + EXTERN ____sdcc_ll_copy_src_hlsp_dst_de + EXTERN ____sdcc_ll_copy_src_hlsp_dst_deixm + EXTERN ____sdcc_ll_lsl_hlix_a + EXTERN ____sdcc_ll_lsl_mbc_a + EXTERN ____sdcc_ll_lsr_hlix_a + EXTERN ____sdcc_ll_lsr_mbc_a + EXTERN ____sdcc_ll_push_hlix + EXTERN ____sdcc_ll_push_mhl + EXTERN ____sdcc_ll_sub_de_bc_hl + EXTERN ____sdcc_ll_sub_de_bc_hlix + EXTERN ____sdcc_ll_sub_de_hlix_bc + EXTERN ____sdcc_ll_sub_de_hlix_bcix + EXTERN ____sdcc_ll_sub_deix_bc_hl + EXTERN ____sdcc_ll_sub_deix_hlix + EXTERN ____sdcc_ll_sub_hlix_bc_deix + EXTERN ____sdcc_ll_sub_hlix_deix_bc + EXTERN ____sdcc_ll_sub_hlix_deix_bcix + EXTERN ____sdcc_load_debc_deix + EXTERN ____sdcc_load_dehl_deix + EXTERN ____sdcc_load_debc_mhl + EXTERN ____sdcc_load_hlde_mhl + EXTERN ____sdcc_store_dehl_bcix + EXTERN ____sdcc_store_debc_hlix + EXTERN ____sdcc_store_debc_mhl + EXTERN ____sdcc_cpu_pop_ei + EXTERN ____sdcc_cpu_pop_ei_jp + EXTERN ____sdcc_cpu_push_di + EXTERN ____sdcc_outi + EXTERN ____sdcc_outi_128 + EXTERN ____sdcc_outi_256 + EXTERN ____sdcc_ldi + EXTERN ____sdcc_ldi_128 + EXTERN ____sdcc_ldi_256 + EXTERN ____sdcc_4_copy_srcd_hlix_dst_deix + EXTERN ____sdcc_4_and_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_or_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_or_src_dehl_dst_bcix + EXTERN ____sdcc_4_xor_src_dehl_dst_bcix + EXTERN ____sdcc_4_and_src_dehl_dst_bcix + EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_or_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_cpl_src_mhl_dst_debc + EXTERN ____sdcc_4_xor_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_or_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_debc_hlix_dst_debc + EXTERN ____sdcc_4_or_src_debc_hlix_dst_debc + EXTERN ____sdcc_4_xor_src_debc_hlix_dst_debc + +;-------------------------------------------------------- +; Public variables in this module +;-------------------------------------------------------- + GLOBAL _x +;-------------------------------------------------------- +; Externals used +;-------------------------------------------------------- + GLOBAL _get_usb_device_config + GLOBAL _find_device_config + GLOBAL _next_device_config + GLOBAL _first_device_config + GLOBAL _find_first_free + GLOBAL _usbtrn_clear_endpoint_halt + GLOBAL _usbtrn_set_address + GLOBAL _usbtrn_set_configuration + GLOBAL _usbtrn_gfull_cfg_desc + GLOBAL _usbtrn_get_config_descriptor + GLOBAL _usbtrn_get_descriptor2 + GLOBAL _usbtrn_get_descriptor + GLOBAL _usbdev_dat_in_trnsfer_0 + GLOBAL _usbdev_dat_in_trnsfer + GLOBAL _usbdev_bulk_in_transfer + GLOBAL _usbdev_blk_out_trnsfer + GLOBAL _usbdev_control_transfer + GLOBAL _usb_data_out_transfer + GLOBAL _usb_data_in_transfer_n + GLOBAL _usb_data_in_transfer + GLOBAL _usb_control_transfer + GLOBAL _ch_issue_token_in_ep0 + GLOBAL _ch_issue_token_out_ep0 + GLOBAL _ch_issue_token_setup + GLOBAL _ch_data_out_transfer + GLOBAL _ch_data_in_transfer_n + GLOBAL _ch_data_in_transfer + GLOBAL _ch_control_transfer_set_config + GLOBAL _ch_control_transfer_set_address + GLOBAL _ch_control_transfer_request_descriptor + GLOBAL _ch_set_usb_address + GLOBAL _ch_write_data + GLOBAL _ch_cmd_get_ic_version + GLOBAL _ch_cmd_set_usb_mode + GLOBAL _ch_probe + GLOBAL _ch_cmd_reset_all + GLOBAL _ch_read_data + GLOBAL _ch_very_short_wait_int_and_get_status + GLOBAL _ch_short_wait_int_and_get_status + GLOBAL _ch_long_wait_int_and_get_status + GLOBAL _ch_get_status + GLOBAL _ch_command + GLOBAL _delay_medium + GLOBAL _delay_short + GLOBAL _delay_20ms + GLOBAL _printf + GLOBAL _delay + GLOBAL _ulltoa_callee + GLOBAL _ulltoa + GLOBAL _strtoull_callee + GLOBAL _strtoull + GLOBAL _strtoll_callee + GLOBAL _strtoll + GLOBAL _lltoa_callee + GLOBAL _lltoa + GLOBAL _llabs_callee + GLOBAL _llabs + GLOBAL __lldivu__callee + GLOBAL __lldivu_ + GLOBAL __lldiv__callee + GLOBAL __lldiv_ + GLOBAL _atoll_callee + GLOBAL _atoll + GLOBAL _realloc_unlocked_callee + GLOBAL _realloc_unlocked + GLOBAL _malloc_unlocked_fastcall + GLOBAL _malloc_unlocked + GLOBAL _free_unlocked_fastcall + GLOBAL _free_unlocked + GLOBAL _calloc_unlocked_callee + GLOBAL _calloc_unlocked + GLOBAL _aligned_alloc_unlocked_callee + GLOBAL _aligned_alloc_unlocked + GLOBAL _realloc_callee + GLOBAL _realloc + GLOBAL _malloc_fastcall + GLOBAL _malloc + GLOBAL _free_fastcall + GLOBAL _free + GLOBAL _calloc_callee + GLOBAL _calloc + GLOBAL _aligned_alloc_callee + GLOBAL _aligned_alloc + GLOBAL _utoa_callee + GLOBAL _utoa + GLOBAL _ultoa_callee + GLOBAL _ultoa + GLOBAL _system_fastcall + GLOBAL _system + GLOBAL _strtoul_callee + GLOBAL _strtoul + GLOBAL _strtol_callee + GLOBAL _strtol + GLOBAL _strtof_callee + GLOBAL _strtof + GLOBAL _strtod_callee + GLOBAL _strtod + GLOBAL _srand_fastcall + GLOBAL _srand + GLOBAL _rand + GLOBAL _quick_exit_fastcall + GLOBAL _quick_exit + GLOBAL _qsort_callee + GLOBAL _qsort + GLOBAL _ltoa_callee + GLOBAL _ltoa + GLOBAL _labs_fastcall + GLOBAL _labs + GLOBAL _itoa_callee + GLOBAL _itoa + GLOBAL _ftoh_callee + GLOBAL _ftoh + GLOBAL _ftog_callee + GLOBAL _ftog + GLOBAL _ftoe_callee + GLOBAL _ftoe + GLOBAL _ftoa_callee + GLOBAL _ftoa + GLOBAL _exit_fastcall + GLOBAL _exit + GLOBAL _dtoh_callee + GLOBAL _dtoh + GLOBAL _dtog_callee + GLOBAL _dtog + GLOBAL _dtoe_callee + GLOBAL _dtoe + GLOBAL _dtoa_callee + GLOBAL _dtoa + GLOBAL _bsearch_callee + GLOBAL _bsearch + GLOBAL _atol_fastcall + GLOBAL _atol + GLOBAL _atoi_fastcall + GLOBAL _atoi + GLOBAL _atof_fastcall + GLOBAL _atof + GLOBAL _atexit_fastcall + GLOBAL _atexit + GLOBAL _at_quick_exit_fastcall + GLOBAL _at_quick_exit + GLOBAL _abs_fastcall + GLOBAL _abs + GLOBAL _abort + GLOBAL __strtou__callee + GLOBAL __strtou_ + GLOBAL __strtoi__callee + GLOBAL __strtoi_ + GLOBAL __random_uniform_xor_8__fastcall + GLOBAL __random_uniform_xor_8_ + GLOBAL __random_uniform_xor_32__fastcall + GLOBAL __random_uniform_xor_32_ + GLOBAL __random_uniform_cmwc_8__fastcall + GLOBAL __random_uniform_cmwc_8_ + GLOBAL __shellsort__callee + GLOBAL __shellsort_ + GLOBAL __quicksort__callee + GLOBAL __quicksort_ + GLOBAL __insertion_sort__callee + GLOBAL __insertion_sort_ + GLOBAL __ldivu__callee + GLOBAL __ldivu_ + GLOBAL __ldiv__callee + GLOBAL __ldiv_ + GLOBAL __divu__callee + GLOBAL __divu_ + GLOBAL __div__callee + GLOBAL __div_ + GLOBAL _result +;-------------------------------------------------------- +; special function registers +;-------------------------------------------------------- +defc _CH376_DATA_PORT = 0xff88 +defc _CH376_COMMAND_PORT = 0xff89 +defc _USB_MODULE_LEDS = 0xff8a +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + SECTION bss_compiler +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + +IF 0 + +; .area _INITIALIZED removed by z88dk + +_x: + DEFS 99 + +ENDIF + +;-------------------------------------------------------- +; absolute external ram data +;-------------------------------------------------------- + SECTION IGNORE +;-------------------------------------------------------- +; global & static initialisations +;-------------------------------------------------------- + SECTION code_crt_init +;-------------------------------------------------------- +; Home +;-------------------------------------------------------- + SECTION IGNORE +;-------------------------------------------------------- +; code +;-------------------------------------------------------- + SECTION data_compiler +_x: + DEFB 0x00 + DEFB +0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB 0x00 + DEFB +0x00 + SECTION IGNORE diff --git a/Source/HBIOS/ch376-native/base-drv/work-area.c.s b/Source/HBIOS/ch376-native/base-drv/work-area.c.s index 23f946c7..6f872426 100644 --- a/Source/HBIOS/ch376-native/base-drv/work-area.c.s +++ b/Source/HBIOS/ch376-native/base-drv/work-area.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/base-drv/./work-area.c.asm -- not to be modify directly +; Generated from source-doc/base-drv/work-area.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- diff --git a/Source/HBIOS/ch376-native/build-docker.sh b/Source/HBIOS/ch376-native/build-docker.sh deleted file mode 100644 index e69de29b..00000000 diff --git a/Source/HBIOS/ch376-native/cruntime.asm b/Source/HBIOS/ch376-native/cruntime.asm index 85904a82..9eb4231d 100644 --- a/Source/HBIOS/ch376-native/cruntime.asm +++ b/Source/HBIOS/ch376-native/cruntime.asm @@ -20,21 +20,20 @@ _memset_callee: dec bc ld a, b or c - ret Z + ret z push hl ldir pop hl ret - _memcpy_callee: - pop af - pop bc - pop hl - pop de - push af + pop af + pop bc + pop hl + pop de + push af ; enter : bc = size_t n @@ -48,99 +47,18 @@ _memcpy_callee: ; ; uses : af, bc, de, hl - ld a,b - or c - jr Z,zero_n + ld a, b + or c + jr z, zero_n asm0_memcpy: - push de - ldir - pop hl - or a - ret + push de + ldir + pop hl + or a + ret zero_n: push de pop hl - ret - - -; ; =============================================================== -; ; Stefano Bodrato -; ; aralbrec: accommodate nmos z80 bug -; ; =============================================================== -; ; -; ; void z80_push_di(void) -; ; -; ; Save the current ei/di status on the stack and disable ints. -; ; -; ; =============================================================== - -; ____sdcc_cpu_push_di: - -; ; exit : stack = ei_di_status -; ; -; ; uses : af - -; ex (sp),hl -; push hl - -; ld a,i - -; di - -; push af -; pop hl ; hl = ei_di status - -; pop af ; af = ret -; ex (sp),hl ; restore hl, push ei_di_status - -; push af - -; ret - - -; ; =============================================================== -; ; Stefano Bodrato -; ; =============================================================== -; ; -; ; void z80_pop_ei(void) -; ; -; ; Pop the ei_di_status from the stack and restore the di/ei -; ; state to what it was previously when a push was called. -; ; -; ; The "ei" in the function name has no bearing on what the -; ; function does; the name is meant to balance "z80_push_di". -; ; -; ; =============================================================== - -; ____sdcc_cpu_pop_ei: - -; ; enter : stack = ei_di_status, ret -; ; -; ; uses : af - -; ex (sp),hl -; pop af ; af = old hl - -; ex (sp),hl ; hl = ei_di_status -; push af - -; ex (sp),hl ; hl restored - -; ____sdcc_cpu_pop_ei_jp: -; ; enter : stack = ret, ei_di_status -; ; -; ; uses : af - -; pop af ; af = ei_di_status - -; jp PO, di_state - -; ei_state: -; ei -; ret - -; di_state: -; di -; ret + ret diff --git a/Source/HBIOS/ch376-native/keyboard.s b/Source/HBIOS/ch376-native/keyboard.s index cc9a7b76..1925a521 100644 --- a/Source/HBIOS/ch376-native/keyboard.s +++ b/Source/HBIOS/ch376-native/keyboard.s @@ -1,4 +1,4 @@ ; Generated File -- not to be modify directly -#include "ch376-native/keyboard/kyb-init.c.s" #include "ch376-native/keyboard/class_hid.c.s" #include "ch376-native/keyboard/class_hid_keyboard.c.s" +#include "ch376-native/keyboard/kyb-init.c.s" diff --git a/Source/HBIOS/ch376-native/keyboard/class_hid.c.s b/Source/HBIOS/ch376-native/keyboard/class_hid.c.s index 73072f3e..06fc1a0e 100644 --- a/Source/HBIOS/ch376-native/keyboard/class_hid.c.s +++ b/Source/HBIOS/ch376-native/keyboard/class_hid.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/keyboard/./class_hid.c.asm -- not to be modify directly +; Generated from source-doc/keyboard/class_hid.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -48,7 +48,7 @@ _USB_MODULE_LEDS .EQU 0xff8a ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/keyboard/./class_hid.c:6: usb_error hid_set_protocol(const device_config_keyboard *const dev, const uint8_t protocol) __sdcccall(1) { +;source-doc/keyboard/class_hid.c:6: usb_error hid_set_protocol(const device_config_keyboard *const dev, const uint8_t protocol) __sdcccall(1) { ; --------------------------------- ; Function hid_set_protocol ; --------------------------------- @@ -60,27 +60,25 @@ _hid_set_protocol: push af push af push af - ex de, hl -;source-doc/keyboard/./class_hid.c:8: cmd = cmd_hid_set; - push de - ex de, hl +;source-doc/keyboard/class_hid.c:8: cmd = cmd_hid_set; + push hl ld hl,2 add hl, sp ex de, hl - ld hl,_cmd_hid_set ld bc,0x0008 + ld hl,_cmd_hid_set ldir pop de -;source-doc/keyboard/./class_hid.c:10: cmd.bRequest = HID_SET_PROTOCOL; +;source-doc/keyboard/class_hid.c:10: cmd.bRequest = HID_SET_PROTOCOL; ld (ix-7),0x0b -;source-doc/keyboard/./class_hid.c:11: cmd.bValue[0] = protocol; +;source-doc/keyboard/class_hid.c:11: cmd.bValue[0] = protocol; ld a,(ix+4) ld (ix-6),a -;source-doc/keyboard/./class_hid.c:13: return usb_control_transfer(&cmd, NULL, dev->address, dev->max_packet_size); +;source-doc/keyboard/class_hid.c:13: return usb_control_transfer(&cmd, NULL, dev->address, dev->max_packet_size); ld l, e ld h, d inc hl - ld c, (hl) + ld b, (hl) ex de, hl ld a, (hl) rlca @@ -88,11 +86,8 @@ _hid_set_protocol: rlca rlca and 0x0f - ld h, c - push hl - inc sp - push af - inc sp + ld c,a + push bc ld hl,0x0000 push hl ld hl,4 @@ -103,7 +98,7 @@ _hid_set_protocol: pop af pop af ld a, l -;source-doc/keyboard/./class_hid.c:14: } +;source-doc/keyboard/class_hid.c:14: } ld sp, ix pop ix pop hl @@ -117,7 +112,7 @@ _cmd_hid_set: DEFB +0x00 DEFB +0x00 DEFW +0x0000 -;source-doc/keyboard/./class_hid.c:16: usb_error hid_set_idle(const device_config_keyboard *const dev, const uint8_t duration) __sdcccall(1) { +;source-doc/keyboard/class_hid.c:16: usb_error hid_set_idle(const device_config_keyboard *const dev, const uint8_t duration) __sdcccall(1) { ; --------------------------------- ; Function hid_set_idle ; --------------------------------- @@ -129,27 +124,25 @@ _hid_set_idle: push af push af push af - ex de, hl -;source-doc/keyboard/./class_hid.c:18: cmd = cmd_hid_set; - push de - ex de, hl +;source-doc/keyboard/class_hid.c:18: cmd = cmd_hid_set; + push hl ld hl,2 add hl, sp ex de, hl - ld hl,_cmd_hid_set ld bc,0x0008 + ld hl,_cmd_hid_set ldir pop de -;source-doc/keyboard/./class_hid.c:20: cmd.bRequest = HID_SET_IDLE; +;source-doc/keyboard/class_hid.c:20: cmd.bRequest = HID_SET_IDLE; ld (ix-7),0x0a -;source-doc/keyboard/./class_hid.c:21: cmd.bValue[0] = duration; +;source-doc/keyboard/class_hid.c:21: cmd.bValue[0] = duration; ld a,(ix+4) ld (ix-6),a -;source-doc/keyboard/./class_hid.c:23: return usb_control_transfer(&cmd, NULL, dev->address, dev->max_packet_size); +;source-doc/keyboard/class_hid.c:23: return usb_control_transfer(&cmd, NULL, dev->address, dev->max_packet_size); ld l, e ld h, d inc hl - ld c, (hl) + ld b, (hl) ex de, hl ld a, (hl) rlca @@ -157,11 +150,8 @@ _hid_set_idle: rlca rlca and 0x0f - ld h, c - push hl - inc sp - push af - inc sp + ld c,a + push bc ld hl,0x0000 push hl ld hl,4 @@ -172,13 +162,13 @@ _hid_set_idle: pop af pop af ld a, l -;source-doc/keyboard/./class_hid.c:24: } +;source-doc/keyboard/class_hid.c:24: } ld sp, ix pop ix pop hl inc sp jp (hl) -;source-doc/keyboard/./class_hid.c:26: usb_error hid_get_input_report(const device_config_keyboard *const dev, uint8_t const *report) __sdcccall(1) { +;source-doc/keyboard/class_hid.c:26: usb_error hid_get_input_report(const device_config_keyboard *const dev, uint8_t const *report) __sdcccall(1) { ; --------------------------------- ; Function hid_get_input_report ; --------------------------------- @@ -193,31 +183,32 @@ _hid_get_input_report: ld sp, hl ld l, c ld h, b -;source-doc/keyboard/./class_hid.c:28: cmd = cmd_hid_set; +;source-doc/keyboard/class_hid.c:28: cmd = cmd_hid_set; push de push hl ex de, hl ld hl,4 add hl, sp ex de, hl - ld hl,_cmd_hid_set ld bc,0x0008 + ld hl,_cmd_hid_set ldir pop bc pop de -;source-doc/keyboard/./class_hid.c:30: cmd.bmRequestType = 0xA1; +;source-doc/keyboard/class_hid.c:30: cmd.bmRequestType = 0xA1; ld (ix-9),0xa1 -;source-doc/keyboard/./class_hid.c:31: cmd.bValue[0] = 1; - ld (ix-7),0x01 -;source-doc/keyboard/./class_hid.c:32: cmd.bValue[1] = 1; - ld (ix-6),0x01 -;source-doc/keyboard/./class_hid.c:33: cmd.bRequest = HID_GET_REPORT; - ld (ix-8),0x01 -;source-doc/keyboard/./class_hid.c:34: cmd.wLength = 8; +;source-doc/keyboard/class_hid.c:31: cmd.bValue[0] = 1; +;source-doc/keyboard/class_hid.c:32: cmd.bValue[1] = 1; +;source-doc/keyboard/class_hid.c:33: cmd.bRequest = HID_GET_REPORT; + ld a,0x01 + ld (ix-7),a + ld (ix-6),a + ld (ix-8),a +;source-doc/keyboard/class_hid.c:34: cmd.wLength = 8; ld (ix-3),0x08 xor a ld (ix-2),a -;source-doc/keyboard/./class_hid.c:36: return usb_control_transfer(&cmd, report, dev->address, dev->max_packet_size); +;source-doc/keyboard/class_hid.c:36: return usb_control_transfer(&cmd, report, dev->address, dev->max_packet_size); ld l, c ld h, b inc hl @@ -232,10 +223,8 @@ _hid_get_input_report: rlca and 0x0f ld h,(ix-1) + ld l,a push hl - inc sp - push af - inc sp push de ld hl,4 add hl, sp @@ -245,7 +234,7 @@ _hid_get_input_report: pop af pop af ld a, l -;source-doc/keyboard/./class_hid.c:37: } +;source-doc/keyboard/class_hid.c:37: } ld sp, ix pop ix ret diff --git a/Source/HBIOS/ch376-native/keyboard/class_hid_keyboard.c.s b/Source/HBIOS/ch376-native/keyboard/class_hid_keyboard.c.s index 84695f4c..c9530ea6 100644 --- a/Source/HBIOS/ch376-native/keyboard/class_hid_keyboard.c.s +++ b/Source/HBIOS/ch376-native/keyboard/class_hid_keyboard.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/keyboard/./class_hid_keyboard.c.asm -- not to be modify directly +; Generated from source-doc/keyboard/class_hid_keyboard.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -49,39 +49,39 @@ _scancodes_table: ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/keyboard/./class_hid_keyboard.c:335: char scancode_to_char(const uint8_t modifier_keys, const uint8_t code) __sdcccall(1) { +;source-doc/keyboard/class_hid_keyboard.c:335: char scancode_to_char(const uint8_t modifier_keys, const uint8_t code) __sdcccall(1) { ; --------------------------------- ; Function scancode_to_char ; --------------------------------- _scancode_to_char: ld c, a - ld e, l -;source-doc/keyboard/./class_hid_keyboard.c:336: if (code >= 0x80) - ld a, e +;source-doc/keyboard/class_hid_keyboard.c:336: if (code >= 0x80) + ld a,l + ld e,l sub 0x80 jr C,l_scancode_to_char_00102 -;source-doc/keyboard/./class_hid_keyboard.c:337: return 0; +;source-doc/keyboard/class_hid_keyboard.c:337: return 0; xor a jr l_scancode_to_char_00105 l_scancode_to_char_00102: -;source-doc/keyboard/./class_hid_keyboard.c:339: if (modifier_keys & (KEY_MOD_LSHIFT | KEY_MOD_RSHIFT)) +;source-doc/keyboard/class_hid_keyboard.c:339: if (modifier_keys & (KEY_MOD_LSHIFT | KEY_MOD_RSHIFT)) ld a, c and 0x22 jr Z,l_scancode_to_char_00104 -;source-doc/keyboard/./class_hid_keyboard.c:340: return scancodes_shift_table[code]; - ld hl,_scancodes_shift_table +;source-doc/keyboard/class_hid_keyboard.c:340: return scancodes_shift_table[code]; ld d,0x00 + ld hl,_scancodes_shift_table add hl, de ld a, (hl) jr l_scancode_to_char_00105 l_scancode_to_char_00104: -;source-doc/keyboard/./class_hid_keyboard.c:342: return scancodes_table[code]; - ld hl,_scancodes_table +;source-doc/keyboard/class_hid_keyboard.c:342: return scancodes_table[code]; ld d,0x00 + ld hl,_scancodes_table add hl, de ld a, (hl) l_scancode_to_char_00105: -;source-doc/keyboard/./class_hid_keyboard.c:343: } +;source-doc/keyboard/class_hid_keyboard.c:343: } ret _scancodes_shift_table: DEFB +0x00 diff --git a/Source/HBIOS/ch376-native/keyboard/kyb-init.c.s b/Source/HBIOS/ch376-native/keyboard/kyb-init.c.s index 86a694de..d877b11f 100644 --- a/Source/HBIOS/ch376-native/keyboard/kyb-init.c.s +++ b/Source/HBIOS/ch376-native/keyboard/kyb-init.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/keyboard/./kyb-init.c.asm -- not to be modify directly +; Generated from source-doc/keyboard/kyb-init.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -60,81 +60,77 @@ _report: ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/keyboard/./kyb-init.c:11: void keyboard_init(void) { +;source-doc/keyboard/kyb-init.c:11: void keyboard_init(void) { ; --------------------------------- ; Function keyboard_init ; --------------------------------- _keyboard_init: -;source-doc/keyboard/./kyb-init.c:13: uint8_t index = 1; +;source-doc/keyboard/kyb-init.c:13: uint8_t index = 1; ld c,0x01 -;source-doc/keyboard/./kyb-init.c:14: keyboard_config = NULL; - xor a - ld hl,_keyboard_config - ld (hl), a - inc hl - ld (hl), a -;source-doc/keyboard/./kyb-init.c:16: do { +;source-doc/keyboard/kyb-init.c:14: keyboard_config = NULL; + ld hl,0x0000 + ld (_keyboard_config),hl +;source-doc/keyboard/kyb-init.c:16: do { ld b,0x01 l_keyboard_init_00105: -;source-doc/keyboard/./kyb-init.c:17: keyboard_config = (device_config_keyboard *)get_usb_device_config(index); +;source-doc/keyboard/kyb-init.c:17: keyboard_config = (device_config_keyboard *)get_usb_device_config(index); push bc ld a, b call _get_usb_device_config ex de, hl pop bc ld (_keyboard_config), hl -;source-doc/keyboard/./kyb-init.c:19: if (keyboard_config == NULL) - ld hl,_keyboard_config + 1 - ld a, (hl) - dec hl - or (hl) +;source-doc/keyboard/kyb-init.c:19: if (keyboard_config == NULL) + ld hl,(_keyboard_config) + ld a,h + or l jr Z,l_keyboard_init_00107 -;source-doc/keyboard/./kyb-init.c:22: const usb_device_type t = keyboard_config->type; +;source-doc/keyboard/kyb-init.c:22: const usb_device_type t = keyboard_config->type; ld hl, (_keyboard_config) ld a, (hl) and 0x0f -;source-doc/keyboard/./kyb-init.c:24: if (t == USB_IS_KEYBOARD) { +;source-doc/keyboard/kyb-init.c:24: if (t == USB_IS_KEYBOARD) { sub 0x04 jr NZ,l_keyboard_init_00106 -;source-doc/keyboard/./kyb-init.c:25: print_string("\r\nUSB: KEYBOARD @ $"); +;source-doc/keyboard/kyb-init.c:25: print_string("\r\nUSB: KEYBOARD @ $"); push bc ld hl,kyb_init_str_0 call _print_string pop bc -;source-doc/keyboard/./kyb-init.c:26: print_uint16(index); +;source-doc/keyboard/kyb-init.c:26: print_uint16(index); ld h,0x00 ld l, c call _print_uint16 -;source-doc/keyboard/./kyb-init.c:27: print_string(" $"); +;source-doc/keyboard/kyb-init.c:27: print_string(" $"); ld hl,kyb_init_str_1 call _print_string -;source-doc/keyboard/./kyb-init.c:29: hid_set_protocol(keyboard_config, 1); +;source-doc/keyboard/kyb-init.c:29: hid_set_protocol(keyboard_config, 1); ld a,0x01 push af inc sp ld hl, (_keyboard_config) call _hid_set_protocol -;source-doc/keyboard/./kyb-init.c:30: hid_set_idle(keyboard_config, 0x80); +;source-doc/keyboard/kyb-init.c:30: hid_set_idle(keyboard_config, 0x80); ld a,0x80 push af inc sp ld hl, (_keyboard_config) call _hid_set_idle -;source-doc/keyboard/./kyb-init.c:31: return; +;source-doc/keyboard/kyb-init.c:31: return; jr l_keyboard_init_00108 l_keyboard_init_00106: -;source-doc/keyboard/./kyb-init.c:33: } while (++index != MAX_NUMBER_OF_DEVICES + 1); +;source-doc/keyboard/kyb-init.c:33: } while (++index != MAX_NUMBER_OF_DEVICES + 1); inc b ld a,b - ld c,a + ld c,b sub 0x07 jr NZ,l_keyboard_init_00105 l_keyboard_init_00107: -;source-doc/keyboard/./kyb-init.c:35: print_string("\r\nUSB: KEYBOARD: NOT FOUND$"); +;source-doc/keyboard/kyb-init.c:35: print_string("\r\nUSB: KEYBOARD: NOT FOUND$"); ld hl,kyb_init_str_2 jp _print_string l_keyboard_init_00108: -;source-doc/keyboard/./kyb-init.c:36: } +;source-doc/keyboard/kyb-init.c:36: } ret kyb_init_str_0: DEFB 0x0d @@ -149,7 +145,7 @@ kyb_init_str_2: DEFB 0x0a DEFM "USB: KEYBOARD: NOT FOUND$" DEFB 0x00 -;source-doc/keyboard/./kyb-init.c:48: void keyboard_buf_put(const uint8_t modifier_keys, const uint8_t key_code) { +;source-doc/keyboard/kyb-init.c:48: void keyboard_buf_put(const uint8_t modifier_keys, const uint8_t key_code) { ; --------------------------------- ; Function keyboard_buf_put ; --------------------------------- @@ -157,35 +153,33 @@ _keyboard_buf_put: push ix ld ix,0 add ix,sp -;source-doc/keyboard/./kyb-init.c:49: if (key_code >= 0x80 || key_code == 0) +;source-doc/keyboard/kyb-init.c:49: if (key_code >= 0x80 || key_code == 0) ld a,(ix+5) sub 0x80 jr NC,l_keyboard_buf_put_00106 ld a,(ix+5) or a -;source-doc/keyboard/./kyb-init.c:50: return; // ignore ??? +;source-doc/keyboard/kyb-init.c:50: return; // ignore ??? jr Z,l_keyboard_buf_put_00106 -;source-doc/keyboard/./kyb-init.c:52: uint8_t next_write_index = (write_index + 1) & KEYBOARD_BUFFER_SIZE_MASK; +;source-doc/keyboard/kyb-init.c:52: uint8_t next_write_index = (write_index + 1) & KEYBOARD_BUFFER_SIZE_MASK; ld a,(_write_index) inc a and 0x07 - ld b, a -;source-doc/keyboard/./kyb-init.c:53: if (next_write_index != read_index) { // Check if buffer is not full + ld c, a +;source-doc/keyboard/kyb-init.c:53: if (next_write_index != read_index) { // Check if buffer is not full ld a,(_read_index) - sub b + sub c jr Z,l_keyboard_buf_put_00106 -;source-doc/keyboard/./kyb-init.c:54: buffer[write_index].modifier_keys = modifier_keys; +;source-doc/keyboard/kyb-init.c:54: buffer[write_index].modifier_keys = modifier_keys; ld de,_buffer+0 - ld hl,_write_index - ld l, (hl) + ld hl,(_write_index) ld h,0x00 add hl, hl add hl, de ld a,(ix+4) ld (hl), a -;source-doc/keyboard/./kyb-init.c:55: buffer[write_index].key_code = key_code; - ld hl,_write_index - ld l, (hl) +;source-doc/keyboard/kyb-init.c:55: buffer[write_index].key_code = key_code; + ld hl,(_write_index) ld h,0x00 add hl, hl add hl, de @@ -193,30 +187,30 @@ _keyboard_buf_put: inc de ld a,(ix+5) ld (de), a -;source-doc/keyboard/./kyb-init.c:56: write_index = next_write_index; +;source-doc/keyboard/kyb-init.c:56: write_index = next_write_index; ld hl,_write_index - ld (hl), b + ld (hl), c l_keyboard_buf_put_00106: -;source-doc/keyboard/./kyb-init.c:58: } +;source-doc/keyboard/kyb-init.c:58: } pop ix ret -;source-doc/keyboard/./kyb-init.c:60: uint8_t keyboard_buf_size() __sdcccall(1) { +;source-doc/keyboard/kyb-init.c:60: uint8_t keyboard_buf_size() __sdcccall(1) { ; --------------------------------- ; Function keyboard_buf_size ; --------------------------------- _keyboard_buf_size: -;source-doc/keyboard/./kyb-init.c:61: if (write_index >= read_index) +;source-doc/keyboard/kyb-init.c:61: if (write_index >= read_index) ld a,(_write_index) ld hl,_read_index sub (hl) jr C,l_keyboard_buf_size_00102 -;source-doc/keyboard/./kyb-init.c:62: return write_index - read_index; +;source-doc/keyboard/kyb-init.c:62: return write_index - read_index; ld a,(_write_index) ld hl,_read_index sub (hl) jr l_keyboard_buf_size_00103 l_keyboard_buf_size_00102: -;source-doc/keyboard/./kyb-init.c:64: return KEYBOARD_BUFFER_SIZE - read_index + write_index; +;source-doc/keyboard/kyb-init.c:64: return KEYBOARD_BUFFER_SIZE - read_index + write_index; ld hl,_read_index ld c, (hl) ld a,0x08 @@ -225,9 +219,9 @@ l_keyboard_buf_size_00102: ld c, (hl) add a, c l_keyboard_buf_size_00103: -;source-doc/keyboard/./kyb-init.c:65: } +;source-doc/keyboard/kyb-init.c:65: } ret -;source-doc/keyboard/./kyb-init.c:67: uint32_t keyboard_buf_get_next() { +;source-doc/keyboard/kyb-init.c:67: uint32_t keyboard_buf_get_next() { ; --------------------------------- ; Function keyboard_buf_get_next ; --------------------------------- @@ -237,83 +231,84 @@ _keyboard_buf_get_next: add ix,sp push af push af -;source-doc/keyboard/./kyb-init.c:68: if (write_index == read_index) // Check if buffer is empty +;source-doc/keyboard/kyb-init.c:68: if (write_index == read_index) // Check if buffer is empty ld a,(_write_index) ld hl,_read_index sub (hl) jr NZ,l_keyboard_buf_get_next_00102 -;source-doc/keyboard/./kyb-init.c:69: return 255 << 8; +;source-doc/keyboard/kyb-init.c:69: return 255 << 8; ld hl,0xff00 ld e, h ld d, h jr l_keyboard_buf_get_next_00103 l_keyboard_buf_get_next_00102: -;source-doc/keyboard/./kyb-init.c:71: const uint8_t modifier_key = buffer[read_index].modifier_keys; +;source-doc/keyboard/kyb-init.c:71: const uint8_t modifier_key = buffer[read_index].modifier_keys; ld bc,_buffer+0 - ld hl,_read_index - ld l, (hl) + ld hl,(_read_index) ld h,0x00 add hl, hl add hl, bc - ld d, (hl) -;source-doc/keyboard/./kyb-init.c:72: const uint8_t key_code = buffer[read_index].key_code; + ld b, (hl) +;source-doc/keyboard/kyb-init.c:72: const uint8_t key_code = buffer[read_index].key_code; inc hl - ld e, (hl) -;source-doc/keyboard/./kyb-init.c:73: read_index = (read_index + 1) & KEYBOARD_BUFFER_SIZE_MASK; + ld c, (hl) +;source-doc/keyboard/kyb-init.c:73: read_index = (read_index + 1) & KEYBOARD_BUFFER_SIZE_MASK; ld hl,_read_index ld a, (hl) inc a and 0x07 ld (hl), a -;source-doc/keyboard/./kyb-init.c:74: const unsigned char c = scancode_to_char(modifier_key, key_code); - push de - ld l, e - ld a, d +;source-doc/keyboard/kyb-init.c:74: const unsigned char c = scancode_to_char(modifier_key, key_code); + push bc + ld l, c + ld a, b call _scancode_to_char - pop de -;source-doc/keyboard/./kyb-init.c:76: return (uint32_t)modifier_key << 24 | (uint32_t)c << 16 | key_code; - ld (ix-1),d - ld (ix-4),0x00 - ld (ix-3),0x00 - ld (ix-2),0x00 - ld l, a - ld a,(ix-1) - ld (ix-4),e - ld (ix-3),0x00 - ld (ix-2),0x00 - ld (ix-1),0x00 - pop de - push de - ld h, a - ex de, hl + ld e, a + pop bc +;source-doc/keyboard/kyb-init.c:76: return (uint32_t)modifier_key << 24 | (uint32_t)c << 16 | key_code; + xor a + ld (ix-1),b + xor a + ld (ix-4),a + ld (ix-3),a + ld (ix-2),a + xor a + ld d,(ix-1) + ld (ix-4),c + xor a + ld (ix-3),a + ld (ix-2),a + ld (ix-1),a + pop hl + push hl l_keyboard_buf_get_next_00103: -;source-doc/keyboard/./kyb-init.c:77: } +;source-doc/keyboard/kyb-init.c:77: } ld sp, ix pop ix ret -;source-doc/keyboard/./kyb-init.c:79: void keyboard_buf_flush() { +;source-doc/keyboard/kyb-init.c:79: void keyboard_buf_flush() { ; --------------------------------- ; Function keyboard_buf_flush ; --------------------------------- _keyboard_buf_flush: -;source-doc/keyboard/./kyb-init.c:80: write_index = 0; +;source-doc/keyboard/kyb-init.c:80: write_index = 0; ld hl,_write_index ld (hl),0x00 -;source-doc/keyboard/./kyb-init.c:81: read_index = 0; +;source-doc/keyboard/kyb-init.c:81: read_index = 0; ld hl,_read_index ld (hl),0x00 -;source-doc/keyboard/./kyb-init.c:82: } +;source-doc/keyboard/kyb-init.c:82: } ret -;source-doc/keyboard/./kyb-init.c:88: void keyboard_tick(void) { +;source-doc/keyboard/kyb-init.c:88: void keyboard_tick(void) { ; --------------------------------- ; Function keyboard_tick ; --------------------------------- _keyboard_tick: -;source-doc/keyboard/./kyb-init.c:89: if (is_in_critical_section()) +;source-doc/keyboard/kyb-init.c:89: if (is_in_critical_section()) ld hl,_in_critical_usb_section ld a, (hl) or a -;source-doc/keyboard/./kyb-init.c:90: return; +;source-doc/keyboard/kyb-init.c:90: return; ret NZ ;././source-doc/base-drv//ch376.h:163: ch_command(CH_CMD_WRITE_VAR8); ld l,0x0b @@ -326,7 +321,7 @@ _keyboard_tick: ld a,0x1f ld bc,_CH376_DATA_PORT out (c),a -;source-doc/keyboard/./kyb-init.c:93: result = usbdev_dat_in_trnsfer_0((device_config *)keyboard_config, (uint8_t *)report, 8); +;source-doc/keyboard/kyb-init.c:93: result = usbdev_dat_in_trnsfer_0((device_config *)keyboard_config, (uint8_t *)report, 8); ld bc,_report ld hl, (_keyboard_config) ld a,0x08 @@ -351,22 +346,20 @@ _keyboard_tick: ld a,0xdf ld bc,_CH376_DATA_PORT out (c),a -;source-doc/keyboard/./kyb-init.c:95: if (result == 0) +;source-doc/keyboard/kyb-init.c:95: if (result == 0) ld hl,_result ld a, (hl) or a ret NZ -;source-doc/keyboard/./kyb-init.c:96: keyboard_buf_put(report.bModifierKeys, report.keyCode[0]); +;source-doc/keyboard/kyb-init.c:96: keyboard_buf_put(report.bModifierKeys, report.keyCode[0]); ld a, (_report + 2) - ld hl,_report + 0 - ld b, (hl) - push af - inc sp + ld hl,_report + ld c, (hl) + ld b,a push bc - inc sp call _keyboard_buf_put pop af -;source-doc/keyboard/./kyb-init.c:97: } +;source-doc/keyboard/kyb-init.c:97: } ret _keyboard_config: DEFW +0x0000 diff --git a/Source/HBIOS/ch376-native/readme.md b/Source/HBIOS/ch376-native/readme.md new file mode 100644 index 00000000..8fbb46fb --- /dev/null +++ b/Source/HBIOS/ch376-native/readme.md @@ -0,0 +1,60 @@ +# Native CH376 Driver + +The native CH376 HBIOS driver is written in c, using z88dk's zcc compiler. + +The build process, is a 3 stage process. + +1. Compile all the C code to assembly files (.asm) +2. Translate the produced .asm files syntax to compile with the RomWBW assembler (.s) +3. Assemble the driver .s files as per the standard HBIOS build process + +The original C code and produced/translated .s files are all committed units in the repo. But it is +expected, that only the c files are to be modified/updated. + +The .s files are checked in, to builders to not require the C compiler tool chain (z88dk) to be installed. + +The c compiling/translating process is also only support on linux, as the script to translate the .asm files +to .s files is a linux bash script. (Although the script can be easily run within Windows's Sub-system for linux) + +## Compiling the C code + +To compile the c code, to update the .s files: + +Within the `Source/HBIOS/ch376-native` directly: + +``` +make +``` + +The make script will search for z88dk's `zcc` compiler, if not found, will attempt to use a docker wrapper. +It will not work if z88dk or docker is not installed. + +## USB Native Driver systems + +The usb driver is divided into a few sub-system, which can be individually enabled within the standard HBIOS config files. + +### base-drv + +The `base-drv` system contains the core code to discover, enumerate, and communicate to USB devices. + +It also includes the driver code for enumerate and operating USB devices on USB hubs. + +### scsi-drv + +The `scsi-drv` system can be enabled with the HBIOS config `CHSCSIENABLE` + +When activated, access to most USB mass storage devices (thumb drives, magnetic usb drives) is enabled. + +### ufi-drv + +The `ufi-drv` system can be enabled with the HBIOS config `CHUFIENABLE` + +When activated, access to 3.5" Floppy USB devices will be enabled. + +### keyboard + +The `keyboard` system can be enabled with the HBIOS config `USBKYBENABLE` + +When activated, usb keyboards can be used as input devices. + + diff --git a/Source/HBIOS/ch376-native/root.md b/Source/HBIOS/ch376-native/root.md deleted file mode 100644 index e69de29b..00000000 diff --git a/Source/HBIOS/ch376-native/scsi-drv.s b/Source/HBIOS/ch376-native/scsi-drv.s index 65cee345..d43a4464 100644 --- a/Source/HBIOS/ch376-native/scsi-drv.s +++ b/Source/HBIOS/ch376-native/scsi-drv.s @@ -1,3 +1,3 @@ ; Generated File -- not to be modify directly -#include "ch376-native/scsi-drv/scsi-init.c.s" #include "ch376-native/scsi-drv/class_scsi.c.s" +#include "ch376-native/scsi-drv/scsi-init.c.s" diff --git a/Source/HBIOS/ch376-native/scsi-drv/class_scsi.c.s b/Source/HBIOS/ch376-native/scsi-drv/class_scsi.c.s index ede7d8ac..b921d313 100644 --- a/Source/HBIOS/ch376-native/scsi-drv/class_scsi.c.s +++ b/Source/HBIOS/ch376-native/scsi-drv/class_scsi.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/scsi-drv/./class_scsi.c.asm -- not to be modify directly +; Generated from source-doc/scsi-drv/class_scsi.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -62,7 +62,7 @@ _cbw: ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/scsi-drv/./class_scsi.c:12: usb_error do_scsi_cmd(device_config_storage *const dev, +;source-doc/scsi-drv/class_scsi.c:12: usb_error do_scsi_cmd(device_config_storage *const dev, ; --------------------------------- ; Function do_scsi_cmd ; --------------------------------- @@ -70,19 +70,16 @@ _do_scsi_cmd: push ix ld ix,0 add ix,sp - ld hl, -8 + ld hl, -6 add hl, sp ld sp, hl -;source-doc/scsi-drv/./class_scsi.c:17: cbw->dCBWTag[0] = next_tag++; +;source-doc/scsi-drv/class_scsi.c:17: cbw->dCBWTag[0] = next_tag++; ld c,(ix+6) ld b,(ix+7) ld hl,0x0004 add hl, bc ex (sp), hl - ld hl,_next_tag - ld e, (hl) - inc hl - ld d, (hl) + ld de,(_next_tag) ld hl, (_next_tag) inc hl ld (_next_tag), hl @@ -91,33 +88,31 @@ _do_scsi_cmd: ld (hl), e inc hl ld (hl), d -;source-doc/scsi-drv/./class_scsi.c:19: if (!send) +;source-doc/scsi-drv/class_scsi.c:19: if (!send) bit 0,(ix+10) jr NZ,l_do_scsi_cmd_00102 -;source-doc/scsi-drv/./class_scsi.c:20: cbw->bmCBWFlags = 0x80; +;source-doc/scsi-drv/class_scsi.c:20: cbw->bmCBWFlags = 0x80; ld hl,0x000c add hl, bc ld (hl),0x80 l_do_scsi_cmd_00102: -;source-doc/scsi-drv/./class_scsi.c:22: critical_begin(); +;source-doc/scsi-drv/class_scsi.c:22: critical_begin(); push bc call _critical_begin pop bc -;source-doc/scsi-drv/./class_scsi.c:25: &dev->endpoints[ENDPOINT_BULK_OUT])); +;source-doc/scsi-drv/class_scsi.c:25: &dev->endpoints[ENDPOINT_BULK_OUT])); ld a,(ix+4) - ld (ix-6),a + ld (ix-4),a ld a,(ix+5) - ld (ix-5),a - ld a,(ix-6) + ld (ix-3),a + ld a,(ix-4) add a,0x03 - ld (ix-4),a - ld a,(ix-5) + ld (ix-2),a + ld a,(ix-3) adc a,0x00 - ld (ix-3),a - pop de - pop hl - push hl - push de + ld (ix-1),a + ld l,(ix-4) + ld h,(ix-3) ld a, (hl) rlca rlca @@ -127,8 +122,8 @@ l_do_scsi_cmd_00102: ld e,(ix+6) ld d,(ix+7) push bc - ld l,(ix-4) - ld h,(ix-3) + ld l,(ix-2) + ld h,(ix-1) push hl push af inc sp @@ -146,7 +141,7 @@ l_do_scsi_cmd_00102: ld a,(_result) or a jp NZ, l_do_scsi_cmd_00120 -;source-doc/scsi-drv/./class_scsi.c:27: if (cbw->dCBWDataTransferLength != 0) { +;source-doc/scsi-drv/class_scsi.c:27: if (cbw->dCBWDataTransferLength != 0) { ld hl,8 add hl, bc ld e, (hl) @@ -155,29 +150,26 @@ l_do_scsi_cmd_00102: inc hl ld c, (hl) inc hl - ld b, (hl) -;source-doc/scsi-drv/./class_scsi.c:30: &dev->endpoints[ENDPOINT_BULK_IN])); - ld a,(ix-6) - add a,0x06 - ld (ix-2),a - ld a,(ix-5) - adc a,0x00 - ld (ix-1),a -;source-doc/scsi-drv/./class_scsi.c:27: if (cbw->dCBWDataTransferLength != 0) { - ld a, b + ld a, (hl) or c or d or e jr Z,l_do_scsi_cmd_00113 -;source-doc/scsi-drv/./class_scsi.c:30: &dev->endpoints[ENDPOINT_BULK_IN])); +;source-doc/scsi-drv/class_scsi.c:30: &dev->endpoints[ENDPOINT_BULK_IN])); ld c,(ix+8) ld b,(ix+9) -;source-doc/scsi-drv/./class_scsi.c:28: if (!send) { +;source-doc/scsi-drv/class_scsi.c:28: if (!send) { bit 0,(ix+10) jr NZ,l_do_scsi_cmd_00110 -;source-doc/scsi-drv/./class_scsi.c:30: &dev->endpoints[ENDPOINT_BULK_IN])); - ld l,(ix-6) - ld h,(ix-5) +;source-doc/scsi-drv/class_scsi.c:30: &dev->endpoints[ENDPOINT_BULK_IN])); + ld a,(ix-4) + add a,0x06 + ld (ix-2),a + ld a,(ix-3) + adc a,0x00 + ld (ix-1),a + ld l,(ix-4) + ld h,(ix-3) ld a, (hl) rlca rlca @@ -203,17 +195,17 @@ l_do_scsi_cmd_00102: jr Z,l_do_scsi_cmd_00113 jp l_do_scsi_cmd_00120 l_do_scsi_cmd_00110: -;source-doc/scsi-drv/./class_scsi.c:34: &dev->endpoints[ENDPOINT_BULK_OUT])); - ld l,(ix-6) - ld h,(ix-5) +;source-doc/scsi-drv/class_scsi.c:34: &dev->endpoints[ENDPOINT_BULK_OUT])); + ld l,(ix-4) + ld h,(ix-3) ld a, (hl) rlca rlca rlca rlca and 0x0f - ld l,(ix-4) - ld h,(ix-3) + ld l,(ix-2) + ld h,(ix-1) push hl push af inc sp @@ -230,11 +222,15 @@ l_do_scsi_cmd_00110: or a jr NZ,l_do_scsi_cmd_00120 l_do_scsi_cmd_00113: -;source-doc/scsi-drv/./class_scsi.c:39: usb_data_in_transfer((uint8_t *)&csw, sizeof(_scsi_command_status_wrapper), dev->address, &dev->endpoints[ENDPOINT_BULK_IN])); - pop de - pop hl - push hl - push de +;source-doc/scsi-drv/class_scsi.c:39: usb_data_in_transfer((uint8_t *)&csw, sizeof(_scsi_command_status_wrapper), dev->address, &dev->endpoints[ENDPOINT_BULK_IN])); + ld a,(ix-4) + add a,0x06 + ld e, a + ld a,(ix-3) + adc a,0x00 + ld d, a + ld l,(ix-4) + ld h,(ix-3) ld a, (hl) rlca rlca @@ -242,9 +238,7 @@ l_do_scsi_cmd_00113: rlca and 0x0f ld b, a - ld l,(ix-2) - ld h,(ix-1) - push hl + push de push bc inc sp ld hl,0x000d @@ -261,40 +255,39 @@ l_do_scsi_cmd_00113: ld a,(_result) or a jr NZ,l_do_scsi_cmd_00120 -;source-doc/scsi-drv/./class_scsi.c:41: if (csw.bCSWStatus != 0 && csw.dCSWTag[0] != cbw->dCBWTag[0]) +;source-doc/scsi-drv/class_scsi.c:41: if (csw.bCSWStatus != 0 && csw.dCSWTag[0] != cbw->dCBWTag[0]) ld a, (_csw + 12) or a jr Z,l_do_scsi_cmd_00117 ld bc, (_csw + 4) pop hl + ld a,(hl) push hl - ld a, (hl) inc hl ld h, (hl) ld l, a - cp a - sbc hl, bc + xor a + sbc hl,bc jr Z,l_do_scsi_cmd_00117 -;source-doc/scsi-drv/./class_scsi.c:42: result = USB_ERR_FAIL; +;source-doc/scsi-drv/class_scsi.c:42: result = USB_ERR_FAIL; ld hl,_result ld (hl),0x0e jr l_do_scsi_cmd_00120 l_do_scsi_cmd_00117: -;source-doc/scsi-drv/./class_scsi.c:44: result = USB_ERR_OK; +;source-doc/scsi-drv/class_scsi.c:44: result = USB_ERR_OK; ld hl,_result ld (hl),0x00 -;source-doc/scsi-drv/./class_scsi.c:46: done: +;source-doc/scsi-drv/class_scsi.c:46: done: l_do_scsi_cmd_00120: -;source-doc/scsi-drv/./class_scsi.c:47: critical_end(); +;source-doc/scsi-drv/class_scsi.c:47: critical_end(); call _critical_end -;source-doc/scsi-drv/./class_scsi.c:48: return result; - ld hl,_result - ld l, (hl) -;source-doc/scsi-drv/./class_scsi.c:49: } +;source-doc/scsi-drv/class_scsi.c:48: return result; + ld hl,(_result) +;source-doc/scsi-drv/class_scsi.c:49: } ld sp, ix pop ix ret -;source-doc/scsi-drv/./class_scsi.c:53: usb_error get_scsi_read_capacity(device_config_storage *const dev, scsi_read_capacity_result *cap_result) { +;source-doc/scsi-drv/class_scsi.c:53: usb_error get_scsi_read_capacity(device_config_storage *const dev, scsi_read_capacity_result *cap_result) { ; --------------------------------- ; Function get_scsi_read_capacity ; --------------------------------- @@ -305,31 +298,31 @@ _get_scsi_read_capacity: ld hl, -27 add hl, sp ld sp, hl -;source-doc/scsi-drv/./class_scsi.c:55: cbw_scsi.cbw = scsi_command_block_wrapper; +;source-doc/scsi-drv/class_scsi.c:55: cbw_scsi.cbw = scsi_command_block_wrapper; ld hl,0 add hl, sp ex de, hl - ld hl,_scsi_command_block_wrapper ld bc,0x000f + ld hl,_scsi_command_block_wrapper ldir -;source-doc/scsi-drv/./class_scsi.c:56: cbw_scsi.read_capacity = scsi_read_capacity; +;source-doc/scsi-drv/class_scsi.c:56: cbw_scsi.read_capacity = scsi_read_capacity; ld hl,15 add hl, sp ex de, hl - ld hl,_scsi_read_capacity ld bc,0x000c + ld hl,_scsi_read_capacity ldir -;source-doc/scsi-drv/./class_scsi.c:58: cbw_scsi.cbw.bCBWLUN = 0; +;source-doc/scsi-drv/class_scsi.c:58: cbw_scsi.cbw.bCBWLUN = 0; ld (ix-14),0x00 -;source-doc/scsi-drv/./class_scsi.c:59: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_read_capacity); +;source-doc/scsi-drv/class_scsi.c:59: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_read_capacity); ld (ix-13),0x0c -;source-doc/scsi-drv/./class_scsi.c:60: cbw_scsi.cbw.dCBWDataTransferLength = sizeof(scsi_read_capacity_result); +;source-doc/scsi-drv/class_scsi.c:60: cbw_scsi.cbw.dCBWDataTransferLength = sizeof(scsi_read_capacity_result); ld (ix-19),0x08 xor a ld (ix-18),a ld (ix-17),a ld (ix-16),a -;source-doc/scsi-drv/./class_scsi.c:62: return do_scsi_cmd(dev, &cbw_scsi.cbw, cap_result, false); +;source-doc/scsi-drv/class_scsi.c:62: return do_scsi_cmd(dev, &cbw_scsi.cbw, cap_result, false); ld c,(ix+6) ld b,(ix+7) xor a @@ -343,11 +336,11 @@ _get_scsi_read_capacity: ld h,(ix+5) push hl call _do_scsi_cmd -;source-doc/scsi-drv/./class_scsi.c:63: } +;source-doc/scsi-drv/class_scsi.c:63: } ld sp,ix pop ix ret -;source-doc/scsi-drv/./class_scsi.c:67: usb_error scsi_inquiry(device_config_storage *const dev, scsi_inquiry_result *inq_result) { +;source-doc/scsi-drv/class_scsi.c:67: usb_error scsi_inquiry(device_config_storage *const dev, scsi_inquiry_result *inq_result) { ; --------------------------------- ; Function scsi_inquiry ; --------------------------------- @@ -358,31 +351,31 @@ _scsi_inquiry: ld hl, -27 add hl, sp ld sp, hl -;source-doc/scsi-drv/./class_scsi.c:69: cbw_scsi.cbw = scsi_command_block_wrapper; +;source-doc/scsi-drv/class_scsi.c:69: cbw_scsi.cbw = scsi_command_block_wrapper; ld hl,0 add hl, sp ex de, hl - ld hl,_scsi_command_block_wrapper ld bc,0x000f + ld hl,_scsi_command_block_wrapper ldir -;source-doc/scsi-drv/./class_scsi.c:70: cbw_scsi.inquiry = scsi_packet_inquiry; +;source-doc/scsi-drv/class_scsi.c:70: cbw_scsi.inquiry = scsi_packet_inquiry; ld hl,15 add hl, sp ex de, hl - ld hl,_scsi_packet_inquiry ld bc,0x000c + ld hl,_scsi_packet_inquiry ldir -;source-doc/scsi-drv/./class_scsi.c:72: cbw_scsi.cbw.bCBWLUN = 0; +;source-doc/scsi-drv/class_scsi.c:72: cbw_scsi.cbw.bCBWLUN = 0; ld (ix-14),0x00 -;source-doc/scsi-drv/./class_scsi.c:73: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_packet_inquiry); +;source-doc/scsi-drv/class_scsi.c:73: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_packet_inquiry); ld (ix-13),0x0c -;source-doc/scsi-drv/./class_scsi.c:74: cbw_scsi.cbw.dCBWDataTransferLength = 0x24; +;source-doc/scsi-drv/class_scsi.c:74: cbw_scsi.cbw.dCBWDataTransferLength = 0x24; ld (ix-19),0x24 xor a ld (ix-18),a ld (ix-17),a ld (ix-16),a -;source-doc/scsi-drv/./class_scsi.c:76: return do_scsi_cmd(dev, &cbw_scsi.cbw, inq_result, false); +;source-doc/scsi-drv/class_scsi.c:76: return do_scsi_cmd(dev, &cbw_scsi.cbw, inq_result, false); ld c,(ix+6) ld b,(ix+7) xor a @@ -396,11 +389,11 @@ _scsi_inquiry: ld h,(ix+5) push hl call _do_scsi_cmd -;source-doc/scsi-drv/./class_scsi.c:77: } +;source-doc/scsi-drv/class_scsi.c:77: } ld sp,ix pop ix ret -;source-doc/scsi-drv/./class_scsi.c:79: usb_error scsi_test(device_config_storage *const dev) { +;source-doc/scsi-drv/class_scsi.c:79: usb_error scsi_test(device_config_storage *const dev) { ; --------------------------------- ; Function scsi_test ; --------------------------------- @@ -411,38 +404,40 @@ _scsi_test: ld hl, -27 add hl, sp ld sp, hl -;source-doc/scsi-drv/./class_scsi.c:81: cbw_scsi.cbw = scsi_command_block_wrapper; +;source-doc/scsi-drv/class_scsi.c:81: cbw_scsi.cbw = scsi_command_block_wrapper; ld hl,0 add hl, sp ex de, hl - ld hl,_scsi_command_block_wrapper ld bc,0x000f + ld hl,_scsi_command_block_wrapper ldir -;source-doc/scsi-drv/./class_scsi.c:82: memset(&cbw_scsi.test, 0, sizeof(_scsi_packet_test)); +;source-doc/scsi-drv/class_scsi.c:82: memset(&cbw_scsi.test, 0, sizeof(_scsi_packet_test)); ld hl,15 add hl, sp - ld b,0x0c + ld b,0x06 l_scsi_test_00103: - ld (hl),0x00 + xor a + ld (hl), a + inc hl + ld (hl), a inc hl djnz l_scsi_test_00103 -;source-doc/scsi-drv/./class_scsi.c:84: cbw_scsi.cbw.bCBWLUN = 0; +;source-doc/scsi-drv/class_scsi.c:84: cbw_scsi.cbw.bCBWLUN = 0; ld (ix-14),0x00 -;source-doc/scsi-drv/./class_scsi.c:85: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_packet_test); +;source-doc/scsi-drv/class_scsi.c:85: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_packet_test); ld (ix-13),0x0c -;source-doc/scsi-drv/./class_scsi.c:86: cbw_scsi.cbw.dCBWDataTransferLength = 0; +;source-doc/scsi-drv/class_scsi.c:86: cbw_scsi.cbw.dCBWDataTransferLength = 0; ld hl,8 add hl, sp - ex de, hl xor a - ld (de), a - inc de - ld (de), a - inc de - ld (de), a - inc de - ld (de), a -;source-doc/scsi-drv/./class_scsi.c:88: return do_scsi_cmd(dev, &cbw_scsi.cbw, 0, false); + ld (hl),a + inc hl + ld (hl),a + inc hl + ld (hl),a + inc hl + ld (hl),a +;source-doc/scsi-drv/class_scsi.c:88: return do_scsi_cmd(dev, &cbw_scsi.cbw, 0, false); xor a push af inc sp @@ -455,11 +450,11 @@ l_scsi_test_00103: ld h,(ix+5) push hl call _do_scsi_cmd -;source-doc/scsi-drv/./class_scsi.c:89: } +;source-doc/scsi-drv/class_scsi.c:89: } ld sp,ix pop ix ret -;source-doc/scsi-drv/./class_scsi.c:93: usb_error scsi_request_sense(device_config_storage *const dev, scsi_sense_result *const sens_result) { +;source-doc/scsi-drv/class_scsi.c:93: usb_error scsi_request_sense(device_config_storage *const dev, scsi_sense_result *const sens_result) { ; --------------------------------- ; Function scsi_request_sense ; --------------------------------- @@ -470,31 +465,31 @@ _scsi_request_sense: ld hl, -27 add hl, sp ld sp, hl -;source-doc/scsi-drv/./class_scsi.c:95: cbw_scsi.cbw = scsi_command_block_wrapper; +;source-doc/scsi-drv/class_scsi.c:95: cbw_scsi.cbw = scsi_command_block_wrapper; ld hl,0 add hl, sp ex de, hl - ld hl,_scsi_command_block_wrapper ld bc,0x000f + ld hl,_scsi_command_block_wrapper ldir -;source-doc/scsi-drv/./class_scsi.c:96: cbw_scsi.request_sense = scsi_packet_request_sense; +;source-doc/scsi-drv/class_scsi.c:96: cbw_scsi.request_sense = scsi_packet_request_sense; ld hl,15 add hl, sp ex de, hl - ld hl,_scsi_packet_request_sense ld bc,0x000c + ld hl,_scsi_packet_request_sense ldir -;source-doc/scsi-drv/./class_scsi.c:98: cbw_scsi.cbw.bCBWLUN = 0; +;source-doc/scsi-drv/class_scsi.c:98: cbw_scsi.cbw.bCBWLUN = 0; ld (ix-14),0x00 -;source-doc/scsi-drv/./class_scsi.c:99: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_packet_request_sense); +;source-doc/scsi-drv/class_scsi.c:99: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_packet_request_sense); ld (ix-13),0x0c -;source-doc/scsi-drv/./class_scsi.c:100: cbw_scsi.cbw.dCBWDataTransferLength = sizeof(scsi_sense_result); +;source-doc/scsi-drv/class_scsi.c:100: cbw_scsi.cbw.dCBWDataTransferLength = sizeof(scsi_sense_result); ld (ix-19),0x12 xor a ld (ix-18),a ld (ix-17),a ld (ix-16),a -;source-doc/scsi-drv/./class_scsi.c:102: return do_scsi_cmd(dev, &cbw_scsi.cbw, sens_result, false); +;source-doc/scsi-drv/class_scsi.c:102: return do_scsi_cmd(dev, &cbw_scsi.cbw, sens_result, false); ld c,(ix+6) ld b,(ix+7) xor a @@ -508,11 +503,11 @@ _scsi_request_sense: ld h,(ix+5) push hl call _do_scsi_cmd -;source-doc/scsi-drv/./class_scsi.c:103: } +;source-doc/scsi-drv/class_scsi.c:103: } ld sp,ix pop ix ret -;source-doc/scsi-drv/./class_scsi.c:105: usb_error scsi_sense_init(device_config_storage *const dev) { +;source-doc/scsi-drv/class_scsi.c:105: usb_error scsi_sense_init(device_config_storage *const dev) { ; --------------------------------- ; Function scsi_sense_init ; --------------------------------- @@ -523,9 +518,9 @@ _scsi_sense_init: ld hl, -18 add hl, sp ld sp, hl -;source-doc/scsi-drv/./class_scsi.c:109: critical_begin(); +;source-doc/scsi-drv/class_scsi.c:109: critical_begin(); call _critical_begin -;source-doc/scsi-drv/./class_scsi.c:110: while ((result = scsi_test(dev)) && --counter > 0) +;source-doc/scsi-drv/class_scsi.c:110: while ((result = scsi_test(dev)) && --counter > 0) ld c,0x03 l_scsi_sense_init_00102: push bc @@ -541,10 +536,10 @@ l_scsi_sense_init_00102: jr Z,l_scsi_sense_init_00104 dec c jr Z,l_scsi_sense_init_00104 -;source-doc/scsi-drv/./class_scsi.c:111: scsi_request_sense(dev, &response); - push bc - ld hl,2 +;source-doc/scsi-drv/class_scsi.c:111: scsi_request_sense(dev, &response); + ld hl,0 add hl, sp + push bc push hl ld l,(ix+4) ld h,(ix+5) @@ -555,16 +550,15 @@ l_scsi_sense_init_00102: pop bc jr l_scsi_sense_init_00102 l_scsi_sense_init_00104: -;source-doc/scsi-drv/./class_scsi.c:112: critical_end(); +;source-doc/scsi-drv/class_scsi.c:112: critical_end(); call _critical_end -;source-doc/scsi-drv/./class_scsi.c:114: return result; - ld hl,_result - ld l, (hl) -;source-doc/scsi-drv/./class_scsi.c:115: } +;source-doc/scsi-drv/class_scsi.c:114: return result; + ld hl,(_result) +;source-doc/scsi-drv/class_scsi.c:115: } ld sp, ix pop ix ret -;source-doc/scsi-drv/./class_scsi.c:119: usb_error scsi_read(device_config_storage *const dev, uint8_t *const buffer) { +;source-doc/scsi-drv/class_scsi.c:119: usb_error scsi_read(device_config_storage *const dev, uint8_t *const buffer) { ; --------------------------------- ; Function scsi_read ; --------------------------------- @@ -573,70 +567,67 @@ _scsi_read: ld ix,0 add ix,sp push af -;source-doc/scsi-drv/./class_scsi.c:120: memset(&cbw, 0, sizeof(cbw_scsi_read_write)); +;source-doc/scsi-drv/class_scsi.c:120: memset(&cbw, 0, sizeof(cbw_scsi_read_write)); ld hl,_cbw - ld b,0x1b -l_scsi_read_00112: ld (hl),0x00 - inc hl - djnz l_scsi_read_00112 -;source-doc/scsi-drv/./class_scsi.c:121: cbw.cbw = scsi_command_block_wrapper; + ld e, l + ld d, h + inc de + ld bc,0x001a + ldir +;source-doc/scsi-drv/class_scsi.c:121: cbw.cbw = scsi_command_block_wrapper; ld de,_cbw - ld hl,_scsi_command_block_wrapper ld bc,0x000f + ld hl,_scsi_command_block_wrapper ldir -;source-doc/scsi-drv/./class_scsi.c:123: cbw.cbw.bCBWLUN = 0; +;source-doc/scsi-drv/class_scsi.c:123: cbw.cbw.bCBWLUN = 0; ld hl,_cbw + 13 ld (hl),0x00 -;source-doc/scsi-drv/./class_scsi.c:124: cbw.cbw.bCBWCBLength = sizeof(_scsi_packet_read_write); +;source-doc/scsi-drv/class_scsi.c:124: cbw.cbw.bCBWCBLength = sizeof(_scsi_packet_read_write); ld hl,_cbw + 14 ld (hl),0x0c -;source-doc/scsi-drv/./class_scsi.c:125: cbw.cbw.dCBWDataTransferLength = 512; +;source-doc/scsi-drv/class_scsi.c:125: cbw.cbw.dCBWDataTransferLength = 512; ld hl,0x0200 - ld ((_cbw + 8)), hl + ld (_cbw + 8),hl ld h, l - ld ((_cbw + 8)+2), hl -;source-doc/scsi-drv/./class_scsi.c:127: cbw.scsi_cmd.operation_code = 0x28; // read operation + ld (_cbw + 8 + 2),hl +;source-doc/scsi-drv/class_scsi.c:127: cbw.scsi_cmd.operation_code = 0x28; // read operation ld hl,_cbw + 15 ld (hl),0x28 -;source-doc/scsi-drv/./class_scsi.c:128: cbw.scsi_cmd.transfer_len[1] = 1; +;source-doc/scsi-drv/class_scsi.c:128: cbw.scsi_cmd.transfer_len[1] = 1; ld hl,_cbw + 23 ld (hl),0x01 -;source-doc/scsi-drv/./class_scsi.c:129: cbw.scsi_cmd.lba[0] = dev->current_lba >> 24; +;source-doc/scsi-drv/class_scsi.c:129: cbw.scsi_cmd.lba[0] = dev->current_lba >> 24; ld c,(ix+4) ld b,(ix+5) ld hl,0x000c add hl, bc - ex (sp), hl - pop hl + pop af push hl inc hl inc hl inc hl ld a, (hl) ld ((_cbw + 17)),a -;source-doc/scsi-drv/./class_scsi.c:130: cbw.scsi_cmd.lba[1] = dev->current_lba >> 16; +;source-doc/scsi-drv/class_scsi.c:130: cbw.scsi_cmd.lba[1] = dev->current_lba >> 16; pop hl push hl inc hl inc hl - inc hl - dec hl ld a, (hl) ld ((_cbw + 18)),a -;source-doc/scsi-drv/./class_scsi.c:131: cbw.scsi_cmd.lba[2] = dev->current_lba >> 8; +;source-doc/scsi-drv/class_scsi.c:131: cbw.scsi_cmd.lba[2] = dev->current_lba >> 8; pop hl push hl inc hl - ld d, (hl) - ld hl, +(_cbw + 19) - ld (hl), d -;source-doc/scsi-drv/./class_scsi.c:132: cbw.scsi_cmd.lba[3] = dev->current_lba; + ld a,(hl) + ld ((_cbw + 19)),a +;source-doc/scsi-drv/class_scsi.c:132: cbw.scsi_cmd.lba[3] = dev->current_lba; pop hl + ld a,(hl) push hl - ld a, (hl) ld ((_cbw + 20)),a -;source-doc/scsi-drv/./class_scsi.c:134: result = do_scsi_cmd(dev, &cbw.cbw, buffer, false); +;source-doc/scsi-drv/class_scsi.c:134: result = do_scsi_cmd(dev, &cbw.cbw, buffer, false); ld e,(ix+6) ld d,(ix+7) xor a @@ -653,14 +644,14 @@ l_scsi_read_00112: inc sp ld a, l ld (_result), a -;source-doc/scsi-drv/./class_scsi.c:136: if (result == USB_ERR_OK) +;source-doc/scsi-drv/class_scsi.c:136: if (result == USB_ERR_OK) ld a,(_result) or a jr NZ,l_scsi_read_00102 -;source-doc/scsi-drv/./class_scsi.c:137: dev->current_lba++; +;source-doc/scsi-drv/class_scsi.c:137: dev->current_lba++; pop hl + ld c,(hl) push hl - ld c, (hl) inc hl ld b, (hl) inc hl @@ -668,11 +659,11 @@ l_scsi_read_00112: inc hl ld d, (hl) inc c - jr NZ,l_scsi_read_00114 + jr NZ,l_scsi_read_00112 inc b - jr NZ,l_scsi_read_00114 + jr NZ,l_scsi_read_00112 inc de -l_scsi_read_00114: +l_scsi_read_00112: pop hl push hl ld (hl), c @@ -683,14 +674,13 @@ l_scsi_read_00114: inc hl ld (hl), d l_scsi_read_00102: -;source-doc/scsi-drv/./class_scsi.c:138: return result; - ld hl,_result - ld l, (hl) -;source-doc/scsi-drv/./class_scsi.c:139: } +;source-doc/scsi-drv/class_scsi.c:138: return result; + ld hl,(_result) +;source-doc/scsi-drv/class_scsi.c:139: } ld sp, ix pop ix ret -;source-doc/scsi-drv/./class_scsi.c:141: usb_error scsi_write(device_config_storage *const dev, uint8_t *const buffer) { +;source-doc/scsi-drv/class_scsi.c:141: usb_error scsi_write(device_config_storage *const dev, uint8_t *const buffer) { ; --------------------------------- ; Function scsi_write ; --------------------------------- @@ -699,70 +689,67 @@ _scsi_write: ld ix,0 add ix,sp push af -;source-doc/scsi-drv/./class_scsi.c:142: memset(&cbw, 0, sizeof(cbw_scsi_read_write)); +;source-doc/scsi-drv/class_scsi.c:142: memset(&cbw, 0, sizeof(cbw_scsi_read_write)); ld hl,_cbw - ld b,0x1b -l_scsi_write_00112: ld (hl),0x00 - inc hl - djnz l_scsi_write_00112 -;source-doc/scsi-drv/./class_scsi.c:143: cbw.cbw = scsi_command_block_wrapper; + ld e, l + ld d, h + inc de + ld bc,0x001a + ldir +;source-doc/scsi-drv/class_scsi.c:143: cbw.cbw = scsi_command_block_wrapper; ld de,_cbw - ld hl,_scsi_command_block_wrapper ld bc,0x000f + ld hl,_scsi_command_block_wrapper ldir -;source-doc/scsi-drv/./class_scsi.c:145: cbw.cbw.bCBWLUN = 0; +;source-doc/scsi-drv/class_scsi.c:145: cbw.cbw.bCBWLUN = 0; ld hl,_cbw + 13 ld (hl),0x00 -;source-doc/scsi-drv/./class_scsi.c:146: cbw.cbw.bCBWCBLength = sizeof(_scsi_packet_read_write); +;source-doc/scsi-drv/class_scsi.c:146: cbw.cbw.bCBWCBLength = sizeof(_scsi_packet_read_write); ld hl,_cbw + 14 ld (hl),0x0c -;source-doc/scsi-drv/./class_scsi.c:147: cbw.cbw.dCBWDataTransferLength = 512; +;source-doc/scsi-drv/class_scsi.c:147: cbw.cbw.dCBWDataTransferLength = 512; ld hl,0x0200 - ld ((_cbw + 8)), hl + ld (_cbw + 8),hl ld h, l - ld ((_cbw + 8)+2), hl -;source-doc/scsi-drv/./class_scsi.c:149: cbw.scsi_cmd.operation_code = 0x2A; // write operation + ld (_cbw + 8 + 2),hl +;source-doc/scsi-drv/class_scsi.c:149: cbw.scsi_cmd.operation_code = 0x2A; // write operation ld hl,_cbw + 15 ld (hl),0x2a -;source-doc/scsi-drv/./class_scsi.c:150: cbw.scsi_cmd.transfer_len[1] = 1; +;source-doc/scsi-drv/class_scsi.c:150: cbw.scsi_cmd.transfer_len[1] = 1; ld hl,_cbw + 23 ld (hl),0x01 -;source-doc/scsi-drv/./class_scsi.c:151: cbw.scsi_cmd.lba[0] = dev->current_lba >> 24; +;source-doc/scsi-drv/class_scsi.c:151: cbw.scsi_cmd.lba[0] = dev->current_lba >> 24; ld c,(ix+4) ld b,(ix+5) ld hl,0x000c add hl, bc - ex (sp), hl - pop hl + pop af push hl inc hl inc hl inc hl ld a, (hl) ld ((_cbw + 17)),a -;source-doc/scsi-drv/./class_scsi.c:152: cbw.scsi_cmd.lba[1] = dev->current_lba >> 16; +;source-doc/scsi-drv/class_scsi.c:152: cbw.scsi_cmd.lba[1] = dev->current_lba >> 16; pop hl push hl inc hl inc hl - inc hl - dec hl ld a, (hl) ld ((_cbw + 18)),a -;source-doc/scsi-drv/./class_scsi.c:153: cbw.scsi_cmd.lba[2] = dev->current_lba >> 8; +;source-doc/scsi-drv/class_scsi.c:153: cbw.scsi_cmd.lba[2] = dev->current_lba >> 8; pop hl push hl inc hl - ld d, (hl) - ld hl, +(_cbw + 19) - ld (hl), d -;source-doc/scsi-drv/./class_scsi.c:154: cbw.scsi_cmd.lba[3] = dev->current_lba; + ld a,(hl) + ld ((_cbw + 19)),a +;source-doc/scsi-drv/class_scsi.c:154: cbw.scsi_cmd.lba[3] = dev->current_lba; pop hl + ld a,(hl) push hl - ld a, (hl) ld ((_cbw + 20)),a -;source-doc/scsi-drv/./class_scsi.c:156: result = do_scsi_cmd(dev, &cbw.cbw, buffer, true); +;source-doc/scsi-drv/class_scsi.c:156: result = do_scsi_cmd(dev, &cbw.cbw, buffer, true); ld e,(ix+6) ld d,(ix+7) ld a,0x01 @@ -779,14 +766,14 @@ l_scsi_write_00112: inc sp ld a, l ld (_result), a -;source-doc/scsi-drv/./class_scsi.c:158: if (result == USB_ERR_OK) +;source-doc/scsi-drv/class_scsi.c:158: if (result == USB_ERR_OK) ld a,(_result) or a jr NZ,l_scsi_write_00102 -;source-doc/scsi-drv/./class_scsi.c:159: dev->current_lba++; +;source-doc/scsi-drv/class_scsi.c:159: dev->current_lba++; pop hl + ld c,(hl) push hl - ld c, (hl) inc hl ld b, (hl) inc hl @@ -794,11 +781,11 @@ l_scsi_write_00112: inc hl ld d, (hl) inc c - jr NZ,l_scsi_write_00114 + jr NZ,l_scsi_write_00112 inc b - jr NZ,l_scsi_write_00114 + jr NZ,l_scsi_write_00112 inc de -l_scsi_write_00114: +l_scsi_write_00112: pop hl push hl ld (hl), c @@ -809,14 +796,13 @@ l_scsi_write_00114: inc hl ld (hl), d l_scsi_write_00102: -;source-doc/scsi-drv/./class_scsi.c:160: return result; - ld hl,_result - ld l, (hl) -;source-doc/scsi-drv/./class_scsi.c:161: } +;source-doc/scsi-drv/class_scsi.c:160: return result; + ld hl,(_result) +;source-doc/scsi-drv/class_scsi.c:161: } ld sp, ix pop ix ret -;source-doc/scsi-drv/./class_scsi.c:163: usb_error scsi_eject(device_config_storage *const dev) { +;source-doc/scsi-drv/class_scsi.c:163: usb_error scsi_eject(device_config_storage *const dev) { ; --------------------------------- ; Function scsi_eject ; --------------------------------- @@ -827,44 +813,46 @@ _scsi_eject: ld hl, -21 add hl, sp ld sp, hl -;source-doc/scsi-drv/./class_scsi.c:165: cbw_scsi.cbw = scsi_command_block_wrapper; +;source-doc/scsi-drv/class_scsi.c:165: cbw_scsi.cbw = scsi_command_block_wrapper; ld hl,0 add hl, sp ex de, hl - ld hl,_scsi_command_block_wrapper ld bc,0x000f + ld hl,_scsi_command_block_wrapper ldir -;source-doc/scsi-drv/./class_scsi.c:167: memset(&cbw_scsi.eject, 0, sizeof(_scsi_packet_eject)); +;source-doc/scsi-drv/class_scsi.c:167: memset(&cbw_scsi.eject, 0, sizeof(_scsi_packet_eject)); ld hl,15 add hl, sp - ld b,0x06 + ld b,0x03 l_scsi_eject_00103: - ld (hl),0x00 + xor a + ld (hl), a + inc hl + ld (hl), a inc hl djnz l_scsi_eject_00103 -;source-doc/scsi-drv/./class_scsi.c:169: cbw_scsi.eject.operation_code = 0x1B; +;source-doc/scsi-drv/class_scsi.c:169: cbw_scsi.eject.operation_code = 0x1B; ld (ix-6),0x1b -;source-doc/scsi-drv/./class_scsi.c:170: cbw_scsi.eject.loej = 1; +;source-doc/scsi-drv/class_scsi.c:170: cbw_scsi.eject.loej = 1; ld hl,19 add hl, sp set 1, (hl) -;source-doc/scsi-drv/./class_scsi.c:172: cbw_scsi.cbw.bCBWLUN = 0; +;source-doc/scsi-drv/class_scsi.c:172: cbw_scsi.cbw.bCBWLUN = 0; ld (ix-8),0x00 -;source-doc/scsi-drv/./class_scsi.c:173: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_packet_eject); +;source-doc/scsi-drv/class_scsi.c:173: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_packet_eject); ld (ix-7),0x06 -;source-doc/scsi-drv/./class_scsi.c:174: cbw_scsi.cbw.dCBWDataTransferLength = 0; +;source-doc/scsi-drv/class_scsi.c:174: cbw_scsi.cbw.dCBWDataTransferLength = 0; ld hl,8 add hl, sp - ex de, hl xor a - ld (de), a - inc de - ld (de), a - inc de - ld (de), a - inc de - ld (de), a -;source-doc/scsi-drv/./class_scsi.c:176: return do_scsi_cmd(dev, &cbw_scsi.cbw, 0, false); + ld (hl),a + inc hl + ld (hl),a + inc hl + ld (hl),a + inc hl + ld (hl),a +;source-doc/scsi-drv/class_scsi.c:176: return do_scsi_cmd(dev, &cbw_scsi.cbw, 0, false); xor a push af inc sp @@ -877,7 +865,7 @@ l_scsi_eject_00103: ld h,(ix+5) push hl call _do_scsi_cmd -;source-doc/scsi-drv/./class_scsi.c:177: } +;source-doc/scsi-drv/class_scsi.c:177: } ld sp,ix pop ix ret diff --git a/Source/HBIOS/ch376-native/scsi-drv/scsi-init.c.s b/Source/HBIOS/ch376-native/scsi-drv/scsi-init.c.s index ca652a68..2009fae2 100644 --- a/Source/HBIOS/ch376-native/scsi-drv/scsi-init.c.s +++ b/Source/HBIOS/ch376-native/scsi-drv/scsi-init.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/scsi-drv/./scsi-init.c.asm -- not to be modify directly +; Generated from source-doc/scsi-drv/scsi-init.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -48,7 +48,7 @@ _USB_MODULE_LEDS .EQU 0xff8a ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/scsi-drv/./scsi-init.c:13: void chscsi_init(void) { +;source-doc/scsi-drv/scsi-init.c:13: void chscsi_init(void) { ; --------------------------------- ; Function chscsi_init ; --------------------------------- @@ -57,30 +57,30 @@ _chscsi_init: ld ix,0 add ix,sp dec sp -;source-doc/scsi-drv/./scsi-init.c:15: do { +;source-doc/scsi-drv/scsi-init.c:15: do { ld (ix-1),0x01 l_chscsi_init_00105: -;source-doc/scsi-drv/./scsi-init.c:16: device_config_storage *const storage_device = (device_config_storage *)get_usb_device_config(index); +;source-doc/scsi-drv/scsi-init.c:16: device_config_storage *const storage_device = (device_config_storage *)get_usb_device_config(index); ld a,(ix-1) call _get_usb_device_config -;source-doc/scsi-drv/./scsi-init.c:18: if (storage_device == NULL) +;source-doc/scsi-drv/scsi-init.c:18: if (storage_device == NULL) ld a, d or e jr Z,l_chscsi_init_00108 -;source-doc/scsi-drv/./scsi-init.c:21: const usb_device_type t = storage_device->type; +;source-doc/scsi-drv/scsi-init.c:21: const usb_device_type t = storage_device->type; ld l, e ld h, d ld a, (hl) and 0x0f -;source-doc/scsi-drv/./scsi-init.c:23: if (t == USB_IS_MASS_STORAGE) { +;source-doc/scsi-drv/scsi-init.c:23: if (t == USB_IS_MASS_STORAGE) { sub 0x02 jr NZ,l_chscsi_init_00106 -;source-doc/scsi-drv/./scsi-init.c:24: print_string("\r\nUSB: MASS STORAGE @ $"); +;source-doc/scsi-drv/scsi-init.c:24: print_string("\r\nUSB: MASS STORAGE @ $"); push de ld hl,scsi_init_str_0 call _print_string pop de -;source-doc/scsi-drv/./scsi-init.c:25: print_uint16(index); +;source-doc/scsi-drv/scsi-init.c:25: print_uint16(index); ld l,(ix-1) ld h,0x00 push de @@ -88,23 +88,23 @@ l_chscsi_init_00105: ld hl,scsi_init_str_1 call _print_string pop de -;source-doc/scsi-drv/./scsi-init.c:28: scsi_sense_init(storage_device); +;source-doc/scsi-drv/scsi-init.c:28: scsi_sense_init(storage_device); push de push de call _scsi_sense_init pop af pop de -;source-doc/scsi-drv/./scsi-init.c:29: dio_add_entry(ch_scsi_fntbl, storage_device); +;source-doc/scsi-drv/scsi-init.c:29: dio_add_entry(ch_scsi_fntbl, storage_device); ld hl,_ch_scsi_fntbl call _dio_add_entry l_chscsi_init_00106: -;source-doc/scsi-drv/./scsi-init.c:32: } while (++index != MAX_NUMBER_OF_DEVICES + 1); +;source-doc/scsi-drv/scsi-init.c:32: } while (++index != MAX_NUMBER_OF_DEVICES + 1); inc (ix-1) ld a,(ix-1) sub 0x07 jr NZ,l_chscsi_init_00105 l_chscsi_init_00108: -;source-doc/scsi-drv/./scsi-init.c:33: } +;source-doc/scsi-drv/scsi-init.c:33: } inc sp pop ix ret diff --git a/Source/HBIOS/ch376-native/source-doc/depends.d b/Source/HBIOS/ch376-native/source-doc/depends.d deleted file mode 100644 index 084400b5..00000000 --- a/Source/HBIOS/ch376-native/source-doc/depends.d +++ /dev/null @@ -1,30 +0,0 @@ - -./base-drv/dev_transfers.c: base-drv/dev_transfers.c ././source-doc/base-drv/dev_transfers.h ././source-doc/base-drv/ch376.h ././source-doc/base-drv/ch376inc.h ././source-doc/base-drv/delay.h ././source-doc/base-drv/transfers.h ././source-doc/base-drv/protocol.h -./base-drv/critical-section.c: base-drv/critical-section.c ././source-doc/base-drv/critical-section.h -./base-drv/enumerate.c: base-drv/enumerate.c ././source-doc/base-drv/enumerate.h ././source-doc/base-drv/ch376.h ././source-doc/base-drv/ch376inc.h ././source-doc/base-drv/delay.h ././source-doc/base-drv/protocol.h ././source-doc/base-drv/dev_transfers.h ././source-doc/base-drv/transfers.h ././source-doc/base-drv/usb_state.h ././source-doc/base-drv/enumerate_hub.h ././source-doc/base-drv/enumerate_storage.h ././source-doc/base-drv/work-area.h ././source-doc/base-drv/print.h -./base-drv/usb_state.c: base-drv/usb_state.c ././source-doc/base-drv/usb_state.h ././source-doc/base-drv/ch376.h ././source-doc/base-drv/ch376inc.h ././source-doc/base-drv/delay.h ././source-doc/base-drv/protocol.h ././source-doc/base-drv/dev_transfers.h ././source-doc/base-drv/transfers.h ././source-doc/base-drv/work-area.h -./base-drv/class_hub.c: base-drv/class_hub.c ././source-doc/base-drv/class_hub.h ././source-doc/base-drv/ch376.h ././source-doc/base-drv/ch376inc.h ././source-doc/base-drv/delay.h ././source-doc/base-drv/protocol.h ././source-doc/base-drv/dev_transfers.h ././source-doc/base-drv/transfers.h ././source-doc/base-drv/usb_state.h -./base-drv/enumerate_storage.c: base-drv/enumerate_storage.c ././source-doc/base-drv/enumerate_storage.h ././source-doc/base-drv/protocol.h ././source-doc/base-drv/ch376.h ././source-doc/base-drv/ch376inc.h ././source-doc/base-drv/delay.h ././source-doc/base-drv/dev_transfers.h ././source-doc/base-drv/transfers.h -./base-drv/enumerate_hub.c: base-drv/enumerate_hub.c ././source-doc/base-drv/enumerate_hub.h ././source-doc/base-drv/enumerate.h ././source-doc/base-drv/ch376.h ././source-doc/base-drv/ch376inc.h ././source-doc/base-drv/delay.h ././source-doc/base-drv/protocol.h ././source-doc/base-drv/dev_transfers.h ././source-doc/base-drv/transfers.h ././source-doc/base-drv/usb_state.h ././source-doc/base-drv/class_hub.h ././source-doc/base-drv/work-area.h -./base-drv/usb-base-drv.c: base-drv/usb-base-drv.c ././source-doc/base-drv/usb-base-drv.h ././source-doc/base-drv//ch376inc.h ././source-doc/base-drv//delay.h -./base-drv/transfers.c: base-drv/transfers.c ././source-doc/base-drv/transfers.h ././source-doc/base-drv/ch376.h ././source-doc/base-drv/ch376inc.h ././source-doc/base-drv/delay.h ././source-doc/base-drv/z80.h ././source-doc/base-drv/ez80-helpers.h ././source-doc/base-drv/print.h -./base-drv/ch376.c: base-drv/ch376.c ././source-doc/base-drv/ch376.h ././source-doc/base-drv/ch376inc.h ././source-doc/base-drv/delay.h ././source-doc/base-drv/ez80-helpers.h ././source-doc/base-drv/print.h -./base-drv/protocol.c: base-drv/protocol.c ././source-doc/base-drv/protocol.h ././source-doc/base-drv/ch376.h ././source-doc/base-drv/ch376inc.h ././source-doc/base-drv/delay.h ././source-doc/base-drv/dev_transfers.h ././source-doc/base-drv/transfers.h ././source-doc/base-drv/ez80-helpers.h ././source-doc/base-drv/print.h -./base-drv/work-area.c: base-drv/work-area.c ././source-doc/base-drv/usb_state.h ././source-doc/base-drv/ch376.h ././source-doc/base-drv/ch376inc.h ././source-doc/base-drv/delay.h ././source-doc/base-drv/protocol.h ././source-doc/base-drv/dev_transfers.h ././source-doc/base-drv/transfers.h -./base-drv/usb-init.c: base-drv/usb-init.c ././source-doc/base-drv/ch376.h ././source-doc/base-drv/ch376inc.h ././source-doc/base-drv/delay.h ././source-doc/base-drv/enumerate.h ././source-doc/base-drv/protocol.h ././source-doc/base-drv/dev_transfers.h ././source-doc/base-drv/transfers.h ././source-doc/base-drv/usb_state.h ././source-doc/base-drv/print.h ././source-doc/base-drv/work-area.h ././source-doc/base-drv/z80.h -./ufi-drv/ufi-init.c: ufi-drv/ufi-init.c ././source-doc/ufi-drv/class_ufi.h ././source-doc/base-drv//transfers.h ././source-doc/ufi-drv/usb_cbi.h -./ufi-drv/usb_cbi.c: ufi-drv/usb_cbi.c ././source-doc/ufi-drv/usb_cbi.h -./ufi-drv/class_ufi.c: ufi-drv/class_ufi.c ././source-doc/ufi-drv/class_ufi.h ././source-doc/base-drv//transfers.h ././source-doc/ufi-drv/usb_cbi.h -./keyboard/kyb-init.c: keyboard/kyb-init.c ././source-doc/keyboard/class_hid.h ././source-doc/base-drv//transfers.h ././source-doc/keyboard/class_hid_keyboard.h -./keyboard/class_hid.c: keyboard/class_hid.c ././source-doc/keyboard/class_hid.h ././source-doc/base-drv//transfers.h -./keyboard/class_hid_keyboard.c: keyboard/class_hid_keyboard.c ././source-doc/keyboard/class_hid_keyboard.h -./scsi-drv/scsi-init.c: scsi-drv/scsi-init.c ././source-doc/scsi-drv/class_scsi.h ././source-doc/base-drv//ch376inc.h ././source-doc/base-drv//delay.h ././source-doc/base-drv//transfers.h -./scsi-drv/class_scsi.c: scsi-drv/class_scsi.c ././source-doc/scsi-drv/class_scsi.h ././source-doc/base-drv//ch376inc.h ././source-doc/base-drv//delay.h ././source-doc/base-drv//transfers.h -## -./base-drv.s: base-drv/./dev_transfers.c.s base-drv/./critical-section.c.s base-drv/./enumerate.c.s base-drv/./usb_state.c.s base-drv/./class_hub.c.s base-drv/./enumerate_storage.c.s base-drv/./enumerate_hub.c.s base-drv/./usb-base-drv.c.s base-drv/./transfers.c.s base-drv/./ch376.c.s base-drv/./protocol.c.s base-drv/./work-area.c.s base-drv/./usb-init.c.s -## -./scsi-drv.s: scsi-drv/./scsi-init.c.s scsi-drv/./class_scsi.c.s -## -./ufi-drv.s: ufi-drv/./ufi-init.c.s ufi-drv/./usb_cbi.c.s ufi-drv/./class_ufi.c.s -## -./keyboard.s: keyboard/./kyb-init.c.s keyboard/./class_hid.c.s keyboard/./class_hid_keyboard.c.s diff --git a/Source/HBIOS/ch376-native/ufi-drv.s b/Source/HBIOS/ch376-native/ufi-drv.s index 5ed7edf6..d900a14a 100644 --- a/Source/HBIOS/ch376-native/ufi-drv.s +++ b/Source/HBIOS/ch376-native/ufi-drv.s @@ -1,4 +1,4 @@ ; Generated File -- not to be modify directly +#include "ch376-native/ufi-drv/class_ufi.c.s" #include "ch376-native/ufi-drv/ufi-init.c.s" #include "ch376-native/ufi-drv/usb_cbi.c.s" -#include "ch376-native/ufi-drv/class_ufi.c.s" diff --git a/Source/HBIOS/ch376-native/ufi-drv/class_ufi.c.s b/Source/HBIOS/ch376-native/ufi-drv/class_ufi.c.s index 4f118b63..702a6eb0 100644 --- a/Source/HBIOS/ch376-native/ufi-drv/class_ufi.c.s +++ b/Source/HBIOS/ch376-native/ufi-drv/class_ufi.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/ufi-drv/./class_ufi.c.asm -- not to be modify directly +; Generated from source-doc/ufi-drv/class_ufi.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -48,7 +48,7 @@ _USB_MODULE_LEDS .EQU 0xff8a ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/ufi-drv/./class_ufi.c:14: uint8_t wait_for_device_ready(device_config *const storage_device, uint8_t timeout_counter) { +;source-doc/ufi-drv/class_ufi.c:14: uint8_t wait_for_device_ready(device_config *const storage_device, uint8_t timeout_counter) { ; --------------------------------- ; Function wait_for_device_ready ; --------------------------------- @@ -59,18 +59,21 @@ _wait_for_device_ready: ld hl, -18 add hl, sp ld sp, hl -;source-doc/ufi-drv/./class_ufi.c:18: do { +;source-doc/ufi-drv/class_ufi.c:18: do { ld c,(ix+6) l_wait_for_device_ready_00105: -;source-doc/ufi-drv/./class_ufi.c:19: memset(&sense, 0, sizeof(sense)); +;source-doc/ufi-drv/class_ufi.c:19: memset(&sense, 0, sizeof(sense)); ld hl,0 add hl, sp - ld b,0x12 + ld b,0x09 l_wait_for_device_ready_00132: - ld (hl),0x00 + xor a + ld (hl), a + inc hl + ld (hl), a inc hl djnz l_wait_for_device_ready_00132 -;source-doc/ufi-drv/./class_ufi.c:20: result = ufi_test_unit_ready(storage_device, &sense); +;source-doc/ufi-drv/class_ufi.c:20: result = ufi_test_unit_ready(storage_device, &sense); push bc ld hl,2 add hl, sp @@ -84,11 +87,11 @@ l_wait_for_device_ready_00132: ld a, l pop bc ld b, a -;source-doc/ufi-drv/./class_ufi.c:22: if ((result == USB_ERR_OK && sense.sense_key == 0) || timeout_counter-- == 0) - ld hl,0+1+1 - add hl,sp +;source-doc/ufi-drv/class_ufi.c:22: if ((result == USB_ERR_OK && sense.sense_key == 0) || timeout_counter-- == 0) or a jr NZ,l_wait_for_device_ready_00104 + ld hl,2 + add hl, sp ld a, (hl) and 0x0f jr Z,l_wait_for_device_ready_00107 @@ -97,19 +100,21 @@ l_wait_for_device_ready_00104: dec c or a jr Z,l_wait_for_device_ready_00107 -;source-doc/ufi-drv/./class_ufi.c:25: delay_medium(); +;source-doc/ufi-drv/class_ufi.c:25: delay_medium(); push bc call _delay_medium pop bc -;source-doc/ufi-drv/./class_ufi.c:27: } while (true); +;source-doc/ufi-drv/class_ufi.c:27: } while (true); jr l_wait_for_device_ready_00105 l_wait_for_device_ready_00107: -;source-doc/ufi-drv/./class_ufi.c:29: return result | sense.sense_key; +;source-doc/ufi-drv/class_ufi.c:29: return result | sense.sense_key; + ld hl,2 + add hl, sp ld a, (hl) and 0x0f or b ld l, a -;source-doc/ufi-drv/./class_ufi.c:30: } +;source-doc/ufi-drv/class_ufi.c:30: } ld sp, ix pop ix ret @@ -178,7 +183,7 @@ __ufi_cmd_send_diagnostic: DEFB +0x00 DEFB +0x00 DEFB +0x00 -;source-doc/ufi-drv/./class_ufi.c:32: usb_error ufi_test_unit_ready(device_config *const storage_device, ufi_request_sense_response const *response) { +;source-doc/ufi-drv/class_ufi.c:32: usb_error ufi_test_unit_ready(device_config *const storage_device, ufi_request_sense_response const *response) { ; --------------------------------- ; Function ufi_test_unit_ready ; --------------------------------- @@ -189,18 +194,20 @@ _ufi_test_unit_ready: ld hl, -24 add hl, sp ld sp, hl -;source-doc/ufi-drv/./class_ufi.c:35: memset(&ufi_cmd_request_test_unit_ready, 0, sizeof(ufi_test_unit_ready_command)); +;source-doc/ufi-drv/class_ufi.c:35: memset(&ufi_cmd_request_test_unit_ready, 0, sizeof(ufi_test_unit_ready_command)); ld hl,0 add hl, sp - ex de, hl - ld l, e - ld h, d - ld b,0x0c + ld e,l + ld d,h + ld b,0x06 l_ufi_test_unit_ready_00104: - ld (hl),0x00 + xor a + ld (hl), a + inc hl + ld (hl), a inc hl djnz l_ufi_test_unit_ready_00104 -;source-doc/ufi-drv/./class_ufi.c:37: usb_execute_cbi(storage_device, (uint8_t *)&ufi_cmd_request_test_unit_ready, false, 0, NULL, NULL); +;source-doc/ufi-drv/class_ufi.c:37: usb_execute_cbi(storage_device, (uint8_t *)&ufi_cmd_request_test_unit_ready, false, 0, NULL, NULL); ld hl,0x0000 push hl push hl @@ -216,22 +223,20 @@ l_ufi_test_unit_ready_00104: ld hl,11 add hl, sp ld sp, hl -;source-doc/ufi-drv/./class_ufi.c:40: ufi_cmd_request_sense = _ufi_cmd_request_sense; +;source-doc/ufi-drv/class_ufi.c:40: ufi_cmd_request_sense = _ufi_cmd_request_sense; ld hl,12 add hl, sp - ld c, l - ld b, h - ld e, c - ld d, b - push bc - ld hl,__ufi_cmd_request_sense + ld e,l + ld d,h + push hl ld bc,0x000c + ld hl,__ufi_cmd_request_sense ldir pop bc -;source-doc/ufi-drv/./class_ufi.c:43: (uint8_t *)response, NULL); +;source-doc/ufi-drv/class_ufi.c:43: (uint8_t *)response, NULL); ld e,(ix+6) ld d,(ix+7) -;source-doc/ufi-drv/./class_ufi.c:42: result = usb_execute_cbi(storage_device, (uint8_t *)&ufi_cmd_request_sense, false, sizeof(ufi_request_sense_response), +;source-doc/ufi-drv/class_ufi.c:42: result = usb_execute_cbi(storage_device, (uint8_t *)&ufi_cmd_request_sense, false, sizeof(ufi_request_sense_response), ld hl,0x0000 push hl push de @@ -245,12 +250,12 @@ l_ufi_test_unit_ready_00104: ld h,(ix+5) push hl call _usb_execute_cbi -;source-doc/ufi-drv/./class_ufi.c:46: return result; -;source-doc/ufi-drv/./class_ufi.c:47: } +;source-doc/ufi-drv/class_ufi.c:46: return result; +;source-doc/ufi-drv/class_ufi.c:47: } ld sp,ix pop ix ret -;source-doc/ufi-drv/./class_ufi.c:49: usb_error ufi_request_sense(device_config *const storage_device, ufi_request_sense_response const *response) { +;source-doc/ufi-drv/class_ufi.c:49: usb_error ufi_request_sense(device_config *const storage_device, ufi_request_sense_response const *response) { ; --------------------------------- ; Function ufi_request_sense ; --------------------------------- @@ -261,19 +266,17 @@ _ufi_request_sense: ld hl, -12 add hl, sp ld sp, hl -;source-doc/ufi-drv/./class_ufi.c:51: ufi_cmd_request_sense = _ufi_cmd_request_sense; +;source-doc/ufi-drv/class_ufi.c:51: ufi_cmd_request_sense = _ufi_cmd_request_sense; ld hl,0 add hl, sp - ld c, l - ld b, h - ld e, c - ld d, b - push bc - ld hl,__ufi_cmd_request_sense + ld e,l + ld d,h + push hl ld bc,0x000c + ld hl,__ufi_cmd_request_sense ldir pop bc -;source-doc/ufi-drv/./class_ufi.c:53: usb_error result = usb_execute_cbi(storage_device, (uint8_t *)&ufi_cmd_request_sense, false, sizeof(ufi_request_sense_response), +;source-doc/ufi-drv/class_ufi.c:53: usb_error result = usb_execute_cbi(storage_device, (uint8_t *)&ufi_cmd_request_sense, false, sizeof(ufi_request_sense_response), ld e,(ix+6) ld d,(ix+7) ld hl,0x0000 @@ -289,12 +292,12 @@ _ufi_request_sense: ld h,(ix+5) push hl call _usb_execute_cbi -;source-doc/ufi-drv/./class_ufi.c:58: return result; -;source-doc/ufi-drv/./class_ufi.c:59: } +;source-doc/ufi-drv/class_ufi.c:58: return result; +;source-doc/ufi-drv/class_ufi.c:59: } ld sp,ix pop ix ret -;source-doc/ufi-drv/./class_ufi.c:61: usb_error ufi_read_frmt_caps(device_config *const storage_device, ufi_format_capacities_response const *response) { +;source-doc/ufi-drv/class_ufi.c:61: usb_error ufi_read_frmt_caps(device_config *const storage_device, ufi_format_capacities_response const *response) { ; --------------------------------- ; Function ufi_read_frmt_caps ; --------------------------------- @@ -305,14 +308,14 @@ _ufi_read_frmt_caps: ld hl, -24 add hl, sp ld sp, hl -;source-doc/ufi-drv/./class_ufi.c:65: ufi_cmd_read_format_capacities = _ufi_cmd_read_format_capacities; +;source-doc/ufi-drv/class_ufi.c:65: ufi_cmd_read_format_capacities = _ufi_cmd_read_format_capacities; ld hl,0 add hl, sp ex de, hl - ld hl,__ufi_cmd_read_format_capacitie ld bc,0x000c + ld hl,__ufi_cmd_read_format_capacitie ldir -;source-doc/ufi-drv/./class_ufi.c:66: result = usb_execute_cbi(storage_device, (uint8_t *)&ufi_cmd_read_format_capacities, false, 12, (uint8_t *)response, NULL); +;source-doc/ufi-drv/class_ufi.c:66: result = usb_execute_cbi(storage_device, (uint8_t *)&ufi_cmd_read_format_capacities, false, 12, (uint8_t *)response, NULL); ld c,(ix+6) ld b,(ix+7) push bc @@ -339,24 +342,24 @@ _ufi_read_frmt_caps: inc sp ld e, l pop bc -;source-doc/ufi-drv/./class_ufi.c:69: CHECK(result); +;source-doc/ufi-drv/class_ufi.c:69: CHECK(result); ld a,e - ld d,a + ld l,a or a jr NZ,l_ufi_read_frmt_caps_00103 -;source-doc/ufi-drv/./class_ufi.c:71: const uint8_t available_length = response->capacity_list_length; +;source-doc/ufi-drv/class_ufi.c:71: const uint8_t available_length = response->capacity_list_length; ld e,(ix+6) ld d,(ix+7) ld hl,3 add hl, de ld e, (hl) -;source-doc/ufi-drv/./class_ufi.c:73: const uint8_t max_length = +;source-doc/ufi-drv/class_ufi.c:73: const uint8_t max_length = ld a,0x24 sub e jr NC,l_ufi_read_frmt_caps_00106 ld e,0x24 l_ufi_read_frmt_caps_00106: -;source-doc/ufi-drv/./class_ufi.c:77: memcpy(&cmd, &ufi_cmd_read_format_capacities, sizeof(cmd)); +;source-doc/ufi-drv/class_ufi.c:77: memcpy(&cmd, &ufi_cmd_read_format_capacities, sizeof(cmd)); push de push bc ex de, hl @@ -369,11 +372,11 @@ l_ufi_read_frmt_caps_00106: ldir pop bc pop de -;source-doc/ufi-drv/./class_ufi.c:78: cmd.allocation_length[1] = max_length; +;source-doc/ufi-drv/class_ufi.c:78: cmd.allocation_length[1] = max_length; ld (ix-4),e -;source-doc/ufi-drv/./class_ufi.c:80: result = usb_execute_cbi(storage_device, (uint8_t *)&cmd, false, max_length, (uint8_t *)response, NULL); - ld d,0x00 +;source-doc/ufi-drv/class_ufi.c:80: result = usb_execute_cbi(storage_device, (uint8_t *)&cmd, false, max_length, (uint8_t *)response, NULL); ld hl,0x0000 + ld d,l push hl push bc push de @@ -393,16 +396,14 @@ l_ufi_read_frmt_caps_00106: pop af pop af inc sp - ld d, l -;source-doc/ufi-drv/./class_ufi.c:84: done: +;source-doc/ufi-drv/class_ufi.c:84: done: l_ufi_read_frmt_caps_00103: -;source-doc/ufi-drv/./class_ufi.c:85: return result; - ld l, d -;source-doc/ufi-drv/./class_ufi.c:86: } +;source-doc/ufi-drv/class_ufi.c:85: return result; +;source-doc/ufi-drv/class_ufi.c:86: } ld sp, ix pop ix ret -;source-doc/ufi-drv/./class_ufi.c:88: usb_error ufi_inquiry(device_config *const storage_device, ufi_inquiry_response const *response) { +;source-doc/ufi-drv/class_ufi.c:88: usb_error ufi_inquiry(device_config *const storage_device, ufi_inquiry_response const *response) { ; --------------------------------- ; Function ufi_inquiry ; --------------------------------- @@ -413,19 +414,17 @@ _ufi_inquiry: ld hl, -12 add hl, sp ld sp, hl -;source-doc/ufi-drv/./class_ufi.c:90: ufi_cmd_inquiry = _ufi_cmd_inquiry; +;source-doc/ufi-drv/class_ufi.c:90: ufi_cmd_inquiry = _ufi_cmd_inquiry; ld hl,0 add hl, sp - ld c, l - ld b, h - ld e, c - ld d, b - push bc - ld hl,__ufi_cmd_inquiry + ld e,l + ld d,h + push hl ld bc,0x000c + ld hl,__ufi_cmd_inquiry ldir pop bc -;source-doc/ufi-drv/./class_ufi.c:92: usb_error result = +;source-doc/ufi-drv/class_ufi.c:92: usb_error result = ld e,(ix+6) ld d,(ix+7) ld hl,0x0000 @@ -441,12 +440,12 @@ _ufi_inquiry: ld h,(ix+5) push hl call _usb_execute_cbi -;source-doc/ufi-drv/./class_ufi.c:97: return result; -;source-doc/ufi-drv/./class_ufi.c:98: } +;source-doc/ufi-drv/class_ufi.c:97: return result; +;source-doc/ufi-drv/class_ufi.c:98: } ld sp,ix pop ix ret -;source-doc/ufi-drv/./class_ufi.c:100: usb_error ufi_read_write_sector(device_config *const storage_device, +;source-doc/ufi-drv/class_ufi.c:100: usb_error ufi_read_write_sector(device_config *const storage_device, ; --------------------------------- ; Function ufi_read_write_sector ; --------------------------------- @@ -457,15 +456,22 @@ _ufi_read_write_sector: ld hl, -12 add hl, sp ld sp, hl -;source-doc/ufi-drv/./class_ufi.c:107: memset(&cmd, 0, sizeof(cmd)); +;source-doc/ufi-drv/class_ufi.c:107: memset(&cmd, 0, sizeof(cmd)); ld hl,0 add hl, sp - ld b,0x0c + ld e,l + ld d,h + ld b,0x06 l_ufi_read_write_sector_00113: - ld (hl),0x00 + xor a + ld (hl), a + inc hl + ld (hl), a inc hl djnz l_ufi_read_write_sector_00113 -;source-doc/ufi-drv/./class_ufi.c:108: cmd.operation_code = send ? 0x2A : 0x28; +;source-doc/ufi-drv/class_ufi.c:108: cmd.operation_code = send ? 0x2A : 0x28; + ld c, e + ld b, d bit 0,(ix+6) jr Z,l_ufi_read_write_sector_00104 ld a,0x2a @@ -473,18 +479,17 @@ l_ufi_read_write_sector_00113: l_ufi_read_write_sector_00104: ld a,0x28 l_ufi_read_write_sector_00105: - ld (ix-12),a -;source-doc/ufi-drv/./class_ufi.c:109: cmd.lba[2] = sector_number >> 8; + ld (bc), a +;source-doc/ufi-drv/class_ufi.c:109: cmd.lba[2] = sector_number >> 8; ld a,(ix+8) ld (ix-8),a -;source-doc/ufi-drv/./class_ufi.c:110: cmd.lba[3] = sector_number & 0xFF; +;source-doc/ufi-drv/class_ufi.c:110: cmd.lba[3] = sector_number & 0xFF; ld a,(ix+7) ld (ix-7),a -;source-doc/ufi-drv/./class_ufi.c:111: cmd.transfer_length[1] = sector_count; +;source-doc/ufi-drv/class_ufi.c:111: cmd.transfer_length[1] = sector_count; +;source-doc/ufi-drv/class_ufi.c:113: usb_error result = usb_execute_cbi(storage_device, (uint8_t *)&cmd, send, 512 * sector_count, (uint8_t *)buffer, sense_codes); ld a,(ix+9) ld (ix-4),a -;source-doc/ufi-drv/./class_ufi.c:113: usb_error result = usb_execute_cbi(storage_device, (uint8_t *)&cmd, send, 512 * sector_count, (uint8_t *)buffer, sense_codes); - ld a,(ix+9) add a, a ld c,0x00 ld l,(ix+12) @@ -498,19 +503,17 @@ l_ufi_read_write_sector_00105: ld a,(ix+6) push af inc sp - ld hl,7 - add hl, sp - push hl + push de ld l,(ix+4) ld h,(ix+5) push hl call _usb_execute_cbi -;source-doc/ufi-drv/./class_ufi.c:117: return result; -;source-doc/ufi-drv/./class_ufi.c:118: } +;source-doc/ufi-drv/class_ufi.c:117: return result; +;source-doc/ufi-drv/class_ufi.c:118: } ld sp,ix pop ix ret -;source-doc/ufi-drv/./class_ufi.c:127: usb_error ufi_format(device_config *const storage_device, +;source-doc/ufi-drv/class_ufi.c:127: usb_error ufi_format(device_config *const storage_device, ; --------------------------------- ; Function ufi_format ; --------------------------------- @@ -521,33 +524,36 @@ _ufi_format: ld hl, -26 add hl, sp ld sp, hl -;source-doc/ufi-drv/./class_ufi.c:134: memset(¶meter_list, 0, sizeof(parameter_list)); +;source-doc/ufi-drv/class_ufi.c:134: memset(¶meter_list, 0, sizeof(parameter_list)); ld hl,2 add hl, sp push hl - ld b,0x0c + ld b,0x06 l_ufi_format_00104: - ld (hl),0x00 + xor a + ld (hl), a + inc hl + ld (hl), a inc hl djnz l_ufi_format_00104 pop bc -;source-doc/ufi-drv/./class_ufi.c:137: cmd = _ufi_cmd_format; +;source-doc/ufi-drv/class_ufi.c:137: cmd = _ufi_cmd_format; ld hl,14 add hl, sp ex de, hl push bc - ld hl,__ufi_cmd_format ld bc,0x000c + ld hl,__ufi_cmd_format ldir pop bc -;source-doc/ufi-drv/./class_ufi.c:140: cmd.track_number = track_number; +;source-doc/ufi-drv/class_ufi.c:140: cmd.track_number = track_number; ld a,(ix+7) ld (ix-10),a -;source-doc/ufi-drv/./class_ufi.c:141: cmd.interleave[1] = 0; +;source-doc/ufi-drv/class_ufi.c:141: cmd.interleave[1] = 0; ld (ix-8),0x00 -;source-doc/ufi-drv/./class_ufi.c:142: cmd.parameter_list_length[1] = sizeof(parameter_list); +;source-doc/ufi-drv/class_ufi.c:142: cmd.parameter_list_length[1] = sizeof(parameter_list); ld (ix-4),0x0c -;source-doc/ufi-drv/./class_ufi.c:144: parameter_list.defect_list_header.side = side; +;source-doc/ufi-drv/class_ufi.c:144: parameter_list.defect_list_header.side = side; ld e, c ld d, b inc de @@ -558,49 +564,46 @@ l_ufi_format_00104: and 0xfe or l ld (de), a -;source-doc/ufi-drv/./class_ufi.c:145: parameter_list.defect_list_header.immediate = 0; +;source-doc/ufi-drv/class_ufi.c:145: parameter_list.defect_list_header.immediate = 0; ld l, e ld h, d res 1, (hl) -;source-doc/ufi-drv/./class_ufi.c:146: parameter_list.defect_list_header.reserved2 = 0; +;source-doc/ufi-drv/class_ufi.c:146: parameter_list.defect_list_header.reserved2 = 0; ld l, e ld h, d ld a, (hl) and 0xf3 ld (hl), a -;source-doc/ufi-drv/./class_ufi.c:147: parameter_list.defect_list_header.single_track = 1; +;source-doc/ufi-drv/class_ufi.c:147: parameter_list.defect_list_header.single_track = 1; ld l, e ld h, d set 4, (hl) -;source-doc/ufi-drv/./class_ufi.c:148: parameter_list.defect_list_header.dcrt = 1; +;source-doc/ufi-drv/class_ufi.c:148: parameter_list.defect_list_header.dcrt = 1; ld l, e ld h, d set 5, (hl) -;source-doc/ufi-drv/./class_ufi.c:149: parameter_list.defect_list_header.extend = 0; +;source-doc/ufi-drv/class_ufi.c:149: parameter_list.defect_list_header.extend = 0; ld l, e ld h, d res 6, (hl) -;source-doc/ufi-drv/./class_ufi.c:150: parameter_list.defect_list_header.fov = 1; +;source-doc/ufi-drv/class_ufi.c:150: parameter_list.defect_list_header.fov = 1; ex de, hl set 7, (hl) -;source-doc/ufi-drv/./class_ufi.c:151: parameter_list.defect_list_header.defect_list_length_msb = 0; +;source-doc/ufi-drv/class_ufi.c:151: parameter_list.defect_list_header.defect_list_length_msb = 0; ld (ix-22),0x00 -;source-doc/ufi-drv/./class_ufi.c:152: parameter_list.defect_list_header.defect_list_length_lsb = 8; +;source-doc/ufi-drv/class_ufi.c:152: parameter_list.defect_list_header.defect_list_length_lsb = 8; ld (ix-21),0x08 -;source-doc/ufi-drv/./class_ufi.c:153: memcpy(¶meter_list.format_descriptor, (void *)format, sizeof(ufi_format_capacity_descriptor)); +;source-doc/ufi-drv/class_ufi.c:153: memcpy(¶meter_list.format_descriptor, (void *)format, sizeof(ufi_format_capacity_descriptor)); ld e,(ix+8) ld d,(ix+9) push bc - ld l, e - ld h, d - ex de, hl ld hl,8 add hl, sp ex de, hl ld bc,0x0008 ldir pop bc -;source-doc/ufi-drv/./class_ufi.c:155: usb_error result = usb_execute_cbi(storage_device, (uint8_t *)&cmd, true, sizeof(parameter_list), (uint8_t *)¶meter_list, +;source-doc/ufi-drv/class_ufi.c:155: usb_error result = usb_execute_cbi(storage_device, (uint8_t *)&cmd, true, sizeof(parameter_list), (uint8_t *)¶meter_list, ld hl,0 add hl, sp push hl @@ -617,12 +620,12 @@ l_ufi_format_00104: ld h,(ix+5) push hl call _usb_execute_cbi -;source-doc/ufi-drv/./class_ufi.c:162: return result; -;source-doc/ufi-drv/./class_ufi.c:163: } +;source-doc/ufi-drv/class_ufi.c:162: return result; +;source-doc/ufi-drv/class_ufi.c:163: } ld sp,ix pop ix ret -;source-doc/ufi-drv/./class_ufi.c:165: usb_error ufi_send_diagnostics(device_config *const storage_device) { +;source-doc/ufi-drv/class_ufi.c:165: usb_error ufi_send_diagnostics(device_config *const storage_device) { ; --------------------------------- ; Function ufi_send_diagnostics ; --------------------------------- @@ -633,19 +636,17 @@ _ufi_send_diagnostics: ld hl, -12 add hl, sp ld sp, hl -;source-doc/ufi-drv/./class_ufi.c:168: ufi_cmd_send_diagnostic = _ufi_cmd_send_diagnostic; +;source-doc/ufi-drv/class_ufi.c:168: ufi_cmd_send_diagnostic = _ufi_cmd_send_diagnostic; ld hl,0 add hl, sp - ld c, l - ld b, h - ld e, c - ld d, b - push bc - ld hl,__ufi_cmd_send_diagnostic + ld e,l + ld d,h + push hl ld bc,0x000c + ld hl,__ufi_cmd_send_diagnostic ldir pop bc -;source-doc/ufi-drv/./class_ufi.c:170: return usb_execute_cbi(storage_device, (uint8_t *)&ufi_cmd_send_diagnostic, true, 0, NULL, NULL); +;source-doc/ufi-drv/class_ufi.c:170: return usb_execute_cbi(storage_device, (uint8_t *)&ufi_cmd_send_diagnostic, true, 0, NULL, NULL); ld hl,0x0000 push hl push hl @@ -658,11 +659,11 @@ _ufi_send_diagnostics: ld h,(ix+5) push hl call _usb_execute_cbi -;source-doc/ufi-drv/./class_ufi.c:171: } +;source-doc/ufi-drv/class_ufi.c:171: } ld sp,ix pop ix ret -;source-doc/ufi-drv/./class_ufi.c:173: uint32_t convert_from_msb_first(const uint8_t *const buffer) { +;source-doc/ufi-drv/class_ufi.c:173: uint32_t convert_from_msb_first(const uint8_t *const buffer) { ; --------------------------------- ; Function convert_from_msb_first ; --------------------------------- @@ -672,40 +673,40 @@ _convert_from_msb_first: add ix,sp push af push af -;source-doc/ufi-drv/./class_ufi.c:175: uint8_t *p_output = ((uint8_t *)&result); +;source-doc/ufi-drv/class_ufi.c:175: uint8_t *p_output = ((uint8_t *)&result); ld hl,0 add hl, sp ex de, hl -;source-doc/ufi-drv/./class_ufi.c:176: const uint8_t *p_input = buffer + 3; +;source-doc/ufi-drv/class_ufi.c:176: const uint8_t *p_input = buffer + 3; ld c,(ix+4) ld b,(ix+5) inc bc inc bc inc bc -;source-doc/ufi-drv/./class_ufi.c:178: *p_output++ = *p_input--; +;source-doc/ufi-drv/class_ufi.c:178: *p_output++ = *p_input--; ld a, (bc) dec bc ld (de), a inc de -;source-doc/ufi-drv/./class_ufi.c:179: *p_output++ = *p_input--; +;source-doc/ufi-drv/class_ufi.c:179: *p_output++ = *p_input--; ld a, (bc) dec bc ld (de), a inc de -;source-doc/ufi-drv/./class_ufi.c:180: *p_output++ = *p_input--; +;source-doc/ufi-drv/class_ufi.c:180: *p_output++ = *p_input--; ld a, (bc) ld (de), a inc de -;source-doc/ufi-drv/./class_ufi.c:181: *p_output = *p_input--; +;source-doc/ufi-drv/class_ufi.c:181: *p_output = *p_input--; dec bc ld a, (bc) ld (de), a -;source-doc/ufi-drv/./class_ufi.c:183: return result; +;source-doc/ufi-drv/class_ufi.c:183: return result; pop hl push hl ld e,(ix-2) ld d,(ix-1) -;source-doc/ufi-drv/./class_ufi.c:184: } +;source-doc/ufi-drv/class_ufi.c:184: } ld sp, ix pop ix ret diff --git a/Source/HBIOS/ch376-native/ufi-drv/ufi-init.c.s b/Source/HBIOS/ch376-native/ufi-drv/ufi-init.c.s index 13311dc6..a3f39762 100644 --- a/Source/HBIOS/ch376-native/ufi-drv/ufi-init.c.s +++ b/Source/HBIOS/ch376-native/ufi-drv/ufi-init.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/ufi-drv/./ufi-init.c.asm -- not to be modify directly +; Generated from source-doc/ufi-drv/ufi-init.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -48,7 +48,7 @@ _USB_MODULE_LEDS .EQU 0xff8a ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/ufi-drv/./ufi-init.c:11: void chufi_init(void) { +;source-doc/ufi-drv/ufi-init.c:11: void chufi_init(void) { ; --------------------------------- ; Function chufi_init ; --------------------------------- @@ -57,30 +57,30 @@ _chufi_init: ld ix,0 add ix,sp dec sp -;source-doc/ufi-drv/./ufi-init.c:14: do { +;source-doc/ufi-drv/ufi-init.c:14: do { ld (ix-1),0x01 l_chufi_init_00105: -;source-doc/ufi-drv/./ufi-init.c:15: device_config_storage *const storage_device = (device_config_storage *)get_usb_device_config(index); +;source-doc/ufi-drv/ufi-init.c:15: device_config_storage *const storage_device = (device_config_storage *)get_usb_device_config(index); ld a,(ix-1) call _get_usb_device_config -;source-doc/ufi-drv/./ufi-init.c:17: if (storage_device == NULL) +;source-doc/ufi-drv/ufi-init.c:17: if (storage_device == NULL) ld a, d or e jr Z,l_chufi_init_00108 -;source-doc/ufi-drv/./ufi-init.c:20: const usb_device_type t = storage_device->type; +;source-doc/ufi-drv/ufi-init.c:20: const usb_device_type t = storage_device->type; ld l, e ld h, d ld a, (hl) and 0x0f -;source-doc/ufi-drv/./ufi-init.c:22: if (t == USB_IS_FLOPPY) { +;source-doc/ufi-drv/ufi-init.c:22: if (t == USB_IS_FLOPPY) { dec a jr NZ,l_chufi_init_00106 -;source-doc/ufi-drv/./ufi-init.c:23: print_string("\r\nUSB: FLOPPY @ $"); +;source-doc/ufi-drv/ufi-init.c:23: print_string("\r\nUSB: FLOPPY @ $"); push de ld hl,ufi_init_str_0 call _print_string pop de -;source-doc/ufi-drv/./ufi-init.c:24: print_uint16(index); +;source-doc/ufi-drv/ufi-init.c:24: print_uint16(index); ld l,(ix-1) ld h,0x00 push de @@ -88,17 +88,17 @@ l_chufi_init_00105: ld hl,ufi_init_str_1 call _print_string pop de -;source-doc/ufi-drv/./ufi-init.c:26: dio_add_entry(ch_ufi_fntbl, storage_device); +;source-doc/ufi-drv/ufi-init.c:26: dio_add_entry(ch_ufi_fntbl, storage_device); ld hl,_ch_ufi_fntbl call _dio_add_entry l_chufi_init_00106: -;source-doc/ufi-drv/./ufi-init.c:29: } while (++index != MAX_NUMBER_OF_DEVICES + 1); +;source-doc/ufi-drv/ufi-init.c:29: } while (++index != MAX_NUMBER_OF_DEVICES + 1); inc (ix-1) ld a,(ix-1) sub 0x07 jr NZ,l_chufi_init_00105 l_chufi_init_00108: -;source-doc/ufi-drv/./ufi-init.c:30: } +;source-doc/ufi-drv/ufi-init.c:30: } inc sp pop ix ret @@ -110,7 +110,7 @@ ufi_init_str_0: ufi_init_str_1: DEFM " $" DEFB 0x00 -;source-doc/ufi-drv/./ufi-init.c:32: uint32_t chufi_get_cap(device_config *const dev) { +;source-doc/ufi-drv/ufi-init.c:32: uint32_t chufi_get_cap(device_config *const dev) { ; --------------------------------- ; Function chufi_get_cap ; --------------------------------- @@ -121,15 +121,18 @@ _chufi_get_cap: ld hl, -72 add hl, sp ld sp, hl -;source-doc/ufi-drv/./ufi-init.c:34: memset(&response, 0, sizeof(ufi_format_capacities_response)); +;source-doc/ufi-drv/ufi-init.c:34: memset(&response, 0, sizeof(ufi_format_capacities_response)); ld hl,0 add hl, sp - ld b,0x24 + ld b,0x12 l_chufi_get_cap_00112: - ld (hl),0x00 + xor a + ld (hl), a + inc hl + ld (hl), a inc hl djnz l_chufi_get_cap_00112 -;source-doc/ufi-drv/./ufi-init.c:36: wait_for_device_ready(dev, 25); +;source-doc/ufi-drv/ufi-init.c:36: wait_for_device_ready(dev, 25); ld a,0x19 push af inc sp @@ -139,7 +142,7 @@ l_chufi_get_cap_00112: call _wait_for_device_ready pop af inc sp -;source-doc/ufi-drv/./ufi-init.c:40: ufi_inquiry(dev, &inquiry); +;source-doc/ufi-drv/ufi-init.c:40: ufi_inquiry(dev, &inquiry); ld hl,36 add hl, sp push hl @@ -148,7 +151,7 @@ l_chufi_get_cap_00112: push hl call _ufi_inquiry pop af -;source-doc/ufi-drv/./ufi-init.c:42: wait_for_device_ready(dev, 15); +;source-doc/ufi-drv/ufi-init.c:42: wait_for_device_ready(dev, 15); ld h,0x0f ex (sp),hl inc sp @@ -158,7 +161,7 @@ l_chufi_get_cap_00112: call _wait_for_device_ready pop af inc sp -;source-doc/ufi-drv/./ufi-init.c:44: const usb_error result = ufi_read_frmt_caps(dev, &response); +;source-doc/ufi-drv/ufi-init.c:44: const usb_error result = ufi_read_frmt_caps(dev, &response); ld hl,0 add hl, sp push hl @@ -169,27 +172,27 @@ l_chufi_get_cap_00112: pop af pop af ld a, l -;source-doc/ufi-drv/./ufi-init.c:45: if (result != USB_ERR_OK) +;source-doc/ufi-drv/ufi-init.c:45: if (result != USB_ERR_OK) or a jr Z,l_chufi_get_cap_00102 -;source-doc/ufi-drv/./ufi-init.c:46: return 0; +;source-doc/ufi-drv/ufi-init.c:46: return 0; ld hl,0x0000 ld e, l ld d, l jr l_chufi_get_cap_00103 l_chufi_get_cap_00102: -;source-doc/ufi-drv/./ufi-init.c:48: return convert_from_msb_first(response.descriptors[0].number_of_blocks); +;source-doc/ufi-drv/ufi-init.c:48: return convert_from_msb_first(response.descriptors[0].number_of_blocks); ld hl,4 add hl, sp push hl call _convert_from_msb_first pop af l_chufi_get_cap_00103: -;source-doc/ufi-drv/./ufi-init.c:49: } +;source-doc/ufi-drv/ufi-init.c:49: } ld sp, ix pop ix ret -;source-doc/ufi-drv/./ufi-init.c:51: uint8_t chufi_read(device_config_storage *const dev, uint8_t *const buffer) { +;source-doc/ufi-drv/ufi-init.c:51: uint8_t chufi_read(device_config_storage *const dev, uint8_t *const buffer) { ; --------------------------------- ; Function chufi_read ; --------------------------------- @@ -200,7 +203,7 @@ _chufi_read: ld hl, -20 add hl, sp ld sp, hl -;source-doc/ufi-drv/./ufi-init.c:53: if (wait_for_device_ready((device_config *)dev, 20) != 0) +;source-doc/ufi-drv/ufi-init.c:53: if (wait_for_device_ready((device_config *)dev, 20) != 0) ld c,(ix+4) ld b,(ix+5) push bc @@ -211,23 +214,22 @@ _chufi_read: call _wait_for_device_ready pop af inc sp - ld e, l + ld a, l pop bc - ld a, e or a jr Z,l_chufi_read_00102 -;source-doc/ufi-drv/./ufi-init.c:54: return -1; // Not READY! +;source-doc/ufi-drv/ufi-init.c:54: return -1; // Not READY! ld l,0xff jr l_chufi_read_00109 l_chufi_read_00102: -;source-doc/ufi-drv/./ufi-init.c:59: memset(&sense_codes, 0, sizeof(sense_codes)); +;source-doc/ufi-drv/ufi-init.c:59: memset(&sense_codes, 0, sizeof(sense_codes)); ld hl,0 add hl, sp xor a ld (hl), a inc hl ld (hl), a -;source-doc/ufi-drv/./ufi-init.c:61: if (ufi_read_write_sector((device_config *)dev, false, dev->current_lba, 1, buffer, (uint8_t *)&sense_codes) != USB_ERR_OK) +;source-doc/ufi-drv/ufi-init.c:61: if (ufi_read_write_sector((device_config *)dev, false, dev->current_lba, 1, buffer, (uint8_t *)&sense_codes) != USB_ERR_OK) ld e,(ix+4) ld d,(ix+5) ld hl,12 @@ -260,21 +262,24 @@ l_chufi_read_00102: pop bc or a jr Z,l_chufi_read_00104 -;source-doc/ufi-drv/./ufi-init.c:62: return -1; // general error +;source-doc/ufi-drv/ufi-init.c:62: return -1; // general error ld l,0xff jr l_chufi_read_00109 l_chufi_read_00104: -;source-doc/ufi-drv/./ufi-init.c:65: memset(&response, 0, sizeof(response)); +;source-doc/ufi-drv/ufi-init.c:65: memset(&response, 0, sizeof(response)); push bc ld hl,4 add hl, sp - ld b,0x12 + ld b,0x09 l_chufi_read_00139: - ld (hl),0x00 + xor a + ld (hl), a + inc hl + ld (hl), a inc hl djnz l_chufi_read_00139 pop bc -;source-doc/ufi-drv/./ufi-init.c:67: if ((result = ufi_request_sense((device_config *)dev, &response)) != USB_ERR_OK) +;source-doc/ufi-drv/ufi-init.c:67: if ((result = ufi_request_sense((device_config *)dev, &response)) != USB_ERR_OK) ld hl,2 add hl, sp push hl @@ -285,29 +290,29 @@ l_chufi_read_00139: ld a, l or a jr Z,l_chufi_read_00106 -;source-doc/ufi-drv/./ufi-init.c:68: return -1; // error +;source-doc/ufi-drv/ufi-init.c:68: return -1; // error ld l,0xff jr l_chufi_read_00109 l_chufi_read_00106: -;source-doc/ufi-drv/./ufi-init.c:72: const uint8_t sense_key = response.sense_key; +;source-doc/ufi-drv/ufi-init.c:72: const uint8_t sense_key = response.sense_key; ld hl,4 add hl, sp ld a, (hl) -;source-doc/ufi-drv/./ufi-init.c:74: if (sense_key != 0) +;source-doc/ufi-drv/ufi-init.c:74: if (sense_key != 0) and 0x0f jr Z,l_chufi_read_00108 -;source-doc/ufi-drv/./ufi-init.c:75: return -1; +;source-doc/ufi-drv/ufi-init.c:75: return -1; ld l,0xff jr l_chufi_read_00109 l_chufi_read_00108: -;source-doc/ufi-drv/./ufi-init.c:77: return USB_ERR_OK; +;source-doc/ufi-drv/ufi-init.c:77: return USB_ERR_OK; ld l,0x00 l_chufi_read_00109: -;source-doc/ufi-drv/./ufi-init.c:78: } +;source-doc/ufi-drv/ufi-init.c:78: } ld sp, ix pop ix ret -;source-doc/ufi-drv/./ufi-init.c:80: usb_error chufi_write(device_config_storage *const dev, uint8_t *const buffer) { +;source-doc/ufi-drv/ufi-init.c:80: usb_error chufi_write(device_config_storage *const dev, uint8_t *const buffer) { ; --------------------------------- ; Function chufi_write ; --------------------------------- @@ -318,7 +323,7 @@ _chufi_write: ld hl, -20 add hl, sp ld sp, hl -;source-doc/ufi-drv/./ufi-init.c:82: if (wait_for_device_ready((device_config *)dev, 20) != 0) +;source-doc/ufi-drv/ufi-init.c:82: if (wait_for_device_ready((device_config *)dev, 20) != 0) ld c,(ix+4) ld b,(ix+5) push bc @@ -329,23 +334,22 @@ _chufi_write: call _wait_for_device_ready pop af inc sp - ld e, l + ld a, l pop bc - ld a, e or a jr Z,l_chufi_write_00102 -;source-doc/ufi-drv/./ufi-init.c:83: return -1; // Not READY! +;source-doc/ufi-drv/ufi-init.c:83: return -1; // Not READY! ld l,0xff jr l_chufi_write_00109 l_chufi_write_00102: -;source-doc/ufi-drv/./ufi-init.c:87: memset(&sense_codes, 0, sizeof(sense_codes)); +;source-doc/ufi-drv/ufi-init.c:87: memset(&sense_codes, 0, sizeof(sense_codes)); ld hl,0 add hl, sp xor a ld (hl), a inc hl ld (hl), a -;source-doc/ufi-drv/./ufi-init.c:88: if ((ufi_read_write_sector((device_config *)dev, true, dev->current_lba, 1, buffer, (uint8_t *)&sense_codes)) != USB_ERR_OK) { +;source-doc/ufi-drv/ufi-init.c:88: if ((ufi_read_write_sector((device_config *)dev, true, dev->current_lba, 1, buffer, (uint8_t *)&sense_codes)) != USB_ERR_OK) { ld e,(ix+4) ld d,(ix+5) ld hl,12 @@ -378,21 +382,24 @@ l_chufi_write_00102: pop bc or a jr Z,l_chufi_write_00104 -;source-doc/ufi-drv/./ufi-init.c:89: return -1; +;source-doc/ufi-drv/ufi-init.c:89: return -1; ld l,0xff jr l_chufi_write_00109 l_chufi_write_00104: -;source-doc/ufi-drv/./ufi-init.c:93: memset(&response, 0, sizeof(response)); +;source-doc/ufi-drv/ufi-init.c:93: memset(&response, 0, sizeof(response)); push bc ld hl,4 add hl, sp - ld b,0x12 + ld b,0x09 l_chufi_write_00139: - ld (hl),0x00 + xor a + ld (hl), a + inc hl + ld (hl), a inc hl djnz l_chufi_write_00139 pop bc -;source-doc/ufi-drv/./ufi-init.c:95: if ((ufi_request_sense((device_config *)dev, &response)) != USB_ERR_OK) { +;source-doc/ufi-drv/ufi-init.c:95: if ((ufi_request_sense((device_config *)dev, &response)) != USB_ERR_OK) { ld hl,2 add hl, sp push hl @@ -403,25 +410,25 @@ l_chufi_write_00139: ld a, l or a jr Z,l_chufi_write_00106 -;source-doc/ufi-drv/./ufi-init.c:96: return -1; +;source-doc/ufi-drv/ufi-init.c:96: return -1; ld l,0xff jr l_chufi_write_00109 l_chufi_write_00106: -;source-doc/ufi-drv/./ufi-init.c:101: const uint8_t sense_key = response.sense_key; +;source-doc/ufi-drv/ufi-init.c:101: const uint8_t sense_key = response.sense_key; ld hl,4 add hl, sp ld a, (hl) -;source-doc/ufi-drv/./ufi-init.c:103: if (sense_key != 0) +;source-doc/ufi-drv/ufi-init.c:103: if (sense_key != 0) and 0x0f jr Z,l_chufi_write_00108 -;source-doc/ufi-drv/./ufi-init.c:104: return -1; +;source-doc/ufi-drv/ufi-init.c:104: return -1; ld l,0xff jr l_chufi_write_00109 l_chufi_write_00108: -;source-doc/ufi-drv/./ufi-init.c:106: return USB_ERR_OK; +;source-doc/ufi-drv/ufi-init.c:106: return USB_ERR_OK; ld l,0x00 l_chufi_write_00109: -;source-doc/ufi-drv/./ufi-init.c:107: } +;source-doc/ufi-drv/ufi-init.c:107: } ld sp, ix pop ix ret diff --git a/Source/HBIOS/ch376-native/ufi-drv/usb_cbi.c.asm b/Source/HBIOS/ch376-native/ufi-drv/usb_cbi.c.asm new file mode 100644 index 00000000..f0aa966b --- /dev/null +++ b/Source/HBIOS/ch376-native/ufi-drv/usb_cbi.c.asm @@ -0,0 +1,599 @@ +;-------------------------------------------------------- +; File Created by SDCC : free open source ISO C Compiler +; Version 4.4.0 #14648 (Linux) +;-------------------------------------------------------- +; Processed by Z88DK +;-------------------------------------------------------- + + EXTERN __divschar + EXTERN __divschar_callee + EXTERN __divsint + EXTERN __divsint_callee + EXTERN __divslong + EXTERN __divslong_callee + EXTERN __divslonglong + EXTERN __divslonglong_callee + EXTERN __divsuchar + EXTERN __divsuchar_callee + EXTERN __divuchar + EXTERN __divuchar_callee + EXTERN __divuint + EXTERN __divuint_callee + EXTERN __divulong + EXTERN __divulong_callee + EXTERN __divulonglong + EXTERN __divulonglong_callee + EXTERN __divuschar + EXTERN __divuschar_callee + EXTERN __modschar + EXTERN __modschar_callee + EXTERN __modsint + EXTERN __modsint_callee + EXTERN __modslong + EXTERN __modslong_callee + EXTERN __modslonglong + EXTERN __modslonglong_callee + EXTERN __modsuchar + EXTERN __modsuchar_callee + EXTERN __moduchar + EXTERN __moduchar_callee + EXTERN __moduint + EXTERN __moduint_callee + EXTERN __modulong + EXTERN __modulong_callee + EXTERN __modulonglong + EXTERN __modulonglong_callee + EXTERN __moduschar + EXTERN __moduschar_callee + EXTERN __mulint + EXTERN __mulint_callee + EXTERN __mullong + EXTERN __mullong_callee + EXTERN __mullonglong + EXTERN __mullonglong_callee + EXTERN __mulschar + EXTERN __mulschar_callee + EXTERN __mulsuchar + EXTERN __mulsuchar_callee + EXTERN __muluchar + EXTERN __muluchar_callee + EXTERN __muluschar + EXTERN __muluschar_callee + EXTERN __rlslonglong + EXTERN __rlslonglong_callee + EXTERN __rlulonglong + EXTERN __rlulonglong_callee + EXTERN __rrslonglong + EXTERN __rrslonglong_callee + EXTERN __rrulonglong + EXTERN __rrulonglong_callee + EXTERN ___mulsint2slong + EXTERN ___mulsint2slong_callee + EXTERN ___muluint2ulong + EXTERN ___muluint2ulong_callee + EXTERN ___sdcc_call_hl + EXTERN ___sdcc_call_iy + EXTERN ___sdcc_enter_ix + EXTERN banked_call + EXTERN _banked_ret + EXTERN ___fs2schar + EXTERN ___fs2schar_callee + EXTERN ___fs2sint + EXTERN ___fs2sint_callee + EXTERN ___fs2slong + EXTERN ___fs2slong_callee + EXTERN ___fs2slonglong + EXTERN ___fs2slonglong_callee + EXTERN ___fs2uchar + EXTERN ___fs2uchar_callee + EXTERN ___fs2uint + EXTERN ___fs2uint_callee + EXTERN ___fs2ulong + EXTERN ___fs2ulong_callee + EXTERN ___fs2ulonglong + EXTERN ___fs2ulonglong_callee + EXTERN ___fsadd + EXTERN ___fsadd_callee + EXTERN ___fsdiv + EXTERN ___fsdiv_callee + EXTERN ___fseq + EXTERN ___fseq_callee + EXTERN ___fsgt + EXTERN ___fsgt_callee + EXTERN ___fslt + EXTERN ___fslt_callee + EXTERN ___fsmul + EXTERN ___fsmul_callee + EXTERN ___fsneq + EXTERN ___fsneq_callee + EXTERN ___fssub + EXTERN ___fssub_callee + EXTERN ___schar2fs + EXTERN ___schar2fs_callee + EXTERN ___sint2fs + EXTERN ___sint2fs_callee + EXTERN ___slong2fs + EXTERN ___slong2fs_callee + EXTERN ___slonglong2fs + EXTERN ___slonglong2fs_callee + EXTERN ___uchar2fs + EXTERN ___uchar2fs_callee + EXTERN ___uint2fs + EXTERN ___uint2fs_callee + EXTERN ___ulong2fs + EXTERN ___ulong2fs_callee + EXTERN ___ulonglong2fs + EXTERN ___ulonglong2fs_callee + EXTERN ____sdcc_2_copy_src_mhl_dst_deix + EXTERN ____sdcc_2_copy_src_mhl_dst_bcix + EXTERN ____sdcc_4_copy_src_mhl_dst_deix + EXTERN ____sdcc_4_copy_src_mhl_dst_bcix + EXTERN ____sdcc_4_copy_src_mhl_dst_mbc + EXTERN ____sdcc_4_ldi_nosave_bc + EXTERN ____sdcc_4_ldi_save_bc + EXTERN ____sdcc_4_push_hlix + EXTERN ____sdcc_4_push_mhl + EXTERN ____sdcc_lib_setmem_hl + EXTERN ____sdcc_ll_add_de_bc_hl + EXTERN ____sdcc_ll_add_de_bc_hlix + EXTERN ____sdcc_ll_add_de_hlix_bc + EXTERN ____sdcc_ll_add_de_hlix_bcix + EXTERN ____sdcc_ll_add_deix_bc_hl + EXTERN ____sdcc_ll_add_deix_hlix + EXTERN ____sdcc_ll_add_hlix_bc_deix + EXTERN ____sdcc_ll_add_hlix_deix_bc + EXTERN ____sdcc_ll_add_hlix_deix_bcix + EXTERN ____sdcc_ll_asr_hlix_a + EXTERN ____sdcc_ll_asr_mbc_a + EXTERN ____sdcc_ll_copy_src_de_dst_hlix + EXTERN ____sdcc_ll_copy_src_de_dst_hlsp + EXTERN ____sdcc_ll_copy_src_deix_dst_hl + EXTERN ____sdcc_ll_copy_src_deix_dst_hlix + EXTERN ____sdcc_ll_copy_src_deixm_dst_hlsp + EXTERN ____sdcc_ll_copy_src_desp_dst_hlsp + EXTERN ____sdcc_ll_copy_src_hl_dst_de + EXTERN ____sdcc_ll_copy_src_hlsp_dst_de + EXTERN ____sdcc_ll_copy_src_hlsp_dst_deixm + EXTERN ____sdcc_ll_lsl_hlix_a + EXTERN ____sdcc_ll_lsl_mbc_a + EXTERN ____sdcc_ll_lsr_hlix_a + EXTERN ____sdcc_ll_lsr_mbc_a + EXTERN ____sdcc_ll_push_hlix + EXTERN ____sdcc_ll_push_mhl + EXTERN ____sdcc_ll_sub_de_bc_hl + EXTERN ____sdcc_ll_sub_de_bc_hlix + EXTERN ____sdcc_ll_sub_de_hlix_bc + EXTERN ____sdcc_ll_sub_de_hlix_bcix + EXTERN ____sdcc_ll_sub_deix_bc_hl + EXTERN ____sdcc_ll_sub_deix_hlix + EXTERN ____sdcc_ll_sub_hlix_bc_deix + EXTERN ____sdcc_ll_sub_hlix_deix_bc + EXTERN ____sdcc_ll_sub_hlix_deix_bcix + EXTERN ____sdcc_load_debc_deix + EXTERN ____sdcc_load_dehl_deix + EXTERN ____sdcc_load_debc_mhl + EXTERN ____sdcc_load_hlde_mhl + EXTERN ____sdcc_store_dehl_bcix + EXTERN ____sdcc_store_debc_hlix + EXTERN ____sdcc_store_debc_mhl + EXTERN ____sdcc_cpu_pop_ei + EXTERN ____sdcc_cpu_pop_ei_jp + EXTERN ____sdcc_cpu_push_di + EXTERN ____sdcc_outi + EXTERN ____sdcc_outi_128 + EXTERN ____sdcc_outi_256 + EXTERN ____sdcc_ldi + EXTERN ____sdcc_ldi_128 + EXTERN ____sdcc_ldi_256 + EXTERN ____sdcc_4_copy_srcd_hlix_dst_deix + EXTERN ____sdcc_4_and_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_or_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_deix + EXTERN ____sdcc_4_or_src_dehl_dst_bcix + EXTERN ____sdcc_4_xor_src_dehl_dst_bcix + EXTERN ____sdcc_4_and_src_dehl_dst_bcix + EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_or_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_mbc_mhl_dst_debc + EXTERN ____sdcc_4_cpl_src_mhl_dst_debc + EXTERN ____sdcc_4_xor_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_or_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_debc_mhl_dst_debc + EXTERN ____sdcc_4_and_src_debc_hlix_dst_debc + EXTERN ____sdcc_4_or_src_debc_hlix_dst_debc + EXTERN ____sdcc_4_xor_src_debc_hlix_dst_debc + +;-------------------------------------------------------- +; Public variables in this module +;-------------------------------------------------------- + GLOBAL _cbi2_adsc + GLOBAL _usb_execute_cbi +;-------------------------------------------------------- +; Externals used +;-------------------------------------------------------- + GLOBAL _critical_end + GLOBAL _critical_begin + GLOBAL _usbtrn_clear_endpoint_halt + GLOBAL _usbtrn_set_address + GLOBAL _usbtrn_set_configuration + GLOBAL _usbtrn_gfull_cfg_desc + GLOBAL _usbtrn_get_config_descriptor + GLOBAL _usbtrn_get_descriptor2 + GLOBAL _usbtrn_get_descriptor + GLOBAL _usbdev_dat_in_trnsfer_0 + GLOBAL _usbdev_dat_in_trnsfer + GLOBAL _usbdev_bulk_in_transfer + GLOBAL _usbdev_blk_out_trnsfer + GLOBAL _usbdev_control_transfer + GLOBAL _usb_data_out_transfer + GLOBAL _usb_data_in_transfer_n + GLOBAL _usb_data_in_transfer + GLOBAL _usb_control_transfer + GLOBAL _ch_issue_token_in_ep0 + GLOBAL _ch_issue_token_out_ep0 + GLOBAL _ch_issue_token_setup + GLOBAL _ch_data_out_transfer + GLOBAL _ch_data_in_transfer_n + GLOBAL _ch_data_in_transfer + GLOBAL _ch_control_transfer_set_config + GLOBAL _ch_control_transfer_set_address + GLOBAL _ch_control_transfer_request_descriptor + GLOBAL _ch_set_usb_address + GLOBAL _ch_write_data + GLOBAL _ch_cmd_get_ic_version + GLOBAL _ch_cmd_set_usb_mode + GLOBAL _ch_probe + GLOBAL _ch_cmd_reset_all + GLOBAL _ch_read_data + GLOBAL _ch_very_short_wait_int_and_get_status + GLOBAL _ch_short_wait_int_and_get_status + GLOBAL _ch_long_wait_int_and_get_status + GLOBAL _ch_get_status + GLOBAL _ch_command + GLOBAL _delay_medium + GLOBAL _delay_short + GLOBAL _delay_20ms + GLOBAL _printf + GLOBAL _delay + GLOBAL _ulltoa_callee + GLOBAL _ulltoa + GLOBAL _strtoull_callee + GLOBAL _strtoull + GLOBAL _strtoll_callee + GLOBAL _strtoll + GLOBAL _lltoa_callee + GLOBAL _lltoa + GLOBAL _llabs_callee + GLOBAL _llabs + GLOBAL __lldivu__callee + GLOBAL __lldivu_ + GLOBAL __lldiv__callee + GLOBAL __lldiv_ + GLOBAL _atoll_callee + GLOBAL _atoll + GLOBAL _realloc_unlocked_callee + GLOBAL _realloc_unlocked + GLOBAL _malloc_unlocked_fastcall + GLOBAL _malloc_unlocked + GLOBAL _free_unlocked_fastcall + GLOBAL _free_unlocked + GLOBAL _calloc_unlocked_callee + GLOBAL _calloc_unlocked + GLOBAL _aligned_alloc_unlocked_callee + GLOBAL _aligned_alloc_unlocked + GLOBAL _realloc_callee + GLOBAL _realloc + GLOBAL _malloc_fastcall + GLOBAL _malloc + GLOBAL _free_fastcall + GLOBAL _free + GLOBAL _calloc_callee + GLOBAL _calloc + GLOBAL _aligned_alloc_callee + GLOBAL _aligned_alloc + GLOBAL _utoa_callee + GLOBAL _utoa + GLOBAL _ultoa_callee + GLOBAL _ultoa + GLOBAL _system_fastcall + GLOBAL _system + GLOBAL _strtoul_callee + GLOBAL _strtoul + GLOBAL _strtol_callee + GLOBAL _strtol + GLOBAL _strtof_callee + GLOBAL _strtof + GLOBAL _strtod_callee + GLOBAL _strtod + GLOBAL _srand_fastcall + GLOBAL _srand + GLOBAL _rand + GLOBAL _quick_exit_fastcall + GLOBAL _quick_exit + GLOBAL _qsort_callee + GLOBAL _qsort + GLOBAL _ltoa_callee + GLOBAL _ltoa + GLOBAL _labs_fastcall + GLOBAL _labs + GLOBAL _itoa_callee + GLOBAL _itoa + GLOBAL _ftoh_callee + GLOBAL _ftoh + GLOBAL _ftog_callee + GLOBAL _ftog + GLOBAL _ftoe_callee + GLOBAL _ftoe + GLOBAL _ftoa_callee + GLOBAL _ftoa + GLOBAL _exit_fastcall + GLOBAL _exit + GLOBAL _dtoh_callee + GLOBAL _dtoh + GLOBAL _dtog_callee + GLOBAL _dtog + GLOBAL _dtoe_callee + GLOBAL _dtoe + GLOBAL _dtoa_callee + GLOBAL _dtoa + GLOBAL _bsearch_callee + GLOBAL _bsearch + GLOBAL _atol_fastcall + GLOBAL _atol + GLOBAL _atoi_fastcall + GLOBAL _atoi + GLOBAL _atof_fastcall + GLOBAL _atof + GLOBAL _atexit_fastcall + GLOBAL _atexit + GLOBAL _at_quick_exit_fastcall + GLOBAL _at_quick_exit + GLOBAL _abs_fastcall + GLOBAL _abs + GLOBAL _abort + GLOBAL __strtou__callee + GLOBAL __strtou_ + GLOBAL __strtoi__callee + GLOBAL __strtoi_ + GLOBAL __random_uniform_xor_8__fastcall + GLOBAL __random_uniform_xor_8_ + GLOBAL __random_uniform_xor_32__fastcall + GLOBAL __random_uniform_xor_32_ + GLOBAL __random_uniform_cmwc_8__fastcall + GLOBAL __random_uniform_cmwc_8_ + GLOBAL __shellsort__callee + GLOBAL __shellsort_ + GLOBAL __quicksort__callee + GLOBAL __quicksort_ + GLOBAL __insertion_sort__callee + GLOBAL __insertion_sort_ + GLOBAL __ldivu__callee + GLOBAL __ldivu_ + GLOBAL __ldiv__callee + GLOBAL __ldiv_ + GLOBAL __divu__callee + GLOBAL __divu_ + GLOBAL __div__callee + GLOBAL __div_ + GLOBAL _in_critical_usb_section + GLOBAL _result +;-------------------------------------------------------- +; special function registers +;-------------------------------------------------------- +defc _CH376_DATA_PORT = 0xff88 +defc _CH376_COMMAND_PORT = 0xff89 +defc _USB_MODULE_LEDS = 0xff8a +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + SECTION bss_compiler +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + +IF 0 + +; .area _INITIALIZED removed by z88dk + +_cbi2_adsc: + DEFS 8 + +ENDIF + +;-------------------------------------------------------- +; absolute external ram data +;-------------------------------------------------------- + SECTION IGNORE +;-------------------------------------------------------- +; global & static initialisations +;-------------------------------------------------------- + SECTION code_crt_init +;-------------------------------------------------------- +; Home +;-------------------------------------------------------- + SECTION IGNORE +;-------------------------------------------------------- +; code +;-------------------------------------------------------- + SECTION code_compiler +;source-doc/ufi-drv/usb_cbi.c:10: usb_error usb_execute_cbi(device_config *const storage_device, +; --------------------------------- +; Function usb_execute_cbi +; --------------------------------- +_usb_execute_cbi: + push ix + ld ix,0 + add ix,sp + ld hl, -8 + add hl, sp + ld sp, hl +;source-doc/ufi-drv/usb_cbi.c:17: const uint8_t interface_number = storage_device->interface_number; + ld l,(ix+4) + ld h,(ix+5) + ld c,l + ld b,h + inc hl + inc hl + ld e, (hl) +;source-doc/ufi-drv/usb_cbi.c:20: adsc = cbi2_adsc; + push de + push bc + ex de, hl + ld hl,4 + add hl, sp + ex de, hl + ld bc,0x0008 + ld hl,_cbi2_adsc + ldir + pop bc + pop de +;source-doc/ufi-drv/usb_cbi.c:21: adsc.bIndex[0] = interface_number; + ld (ix-4),e +;source-doc/ufi-drv/usb_cbi.c:23: critical_begin(); + push bc + call _critical_begin + pop bc +;source-doc/ufi-drv/usb_cbi.c:25: result = usbdev_control_transfer(storage_device, &adsc, (uint8_t *const)cmd); + ld l,(ix+6) + ld h,(ix+7) + push hl + ld hl,2 + add hl, sp + push hl + push bc + call _usbdev_control_transfer + pop af + pop af + pop af + ld a, l + ld (_result), a +;source-doc/ufi-drv/usb_cbi.c:27: if (result == USB_ERR_STALL) { + ld a,(_result) + sub a,0x02 + jr NZ,l_usb_execute_cbi_00104 +;source-doc/ufi-drv/usb_cbi.c:28: if (sense_codes != NULL) + ld a,(ix+14) + or a,(ix+13) + jr Z,l_usb_execute_cbi_00102 +;source-doc/ufi-drv/usb_cbi.c:29: usbdev_dat_in_trnsfer(storage_device, sense_codes, 2, ENDPOINT_INTERRUPT_IN); + ld a,0x02 + push af + inc sp + ld hl,0x0002 + push hl + ld l,(ix+13) + ld h,(ix+14) + push hl + ld l,(ix+4) + ld h,(ix+5) + push hl + call _usbdev_dat_in_trnsfer + ld hl,7 + add hl, sp + ld sp, hl +l_usb_execute_cbi_00102: +;source-doc/ufi-drv/usb_cbi.c:31: result = USB_ERR_STALL; + ld hl,_result + ld (hl),0x02 +;source-doc/ufi-drv/usb_cbi.c:32: goto done; + jp l_usb_execute_cbi_00116 +l_usb_execute_cbi_00104: +;source-doc/ufi-drv/usb_cbi.c:35: if (result != USB_ERR_OK) { + ld a,(_result) + or a, a + jp NZ, l_usb_execute_cbi_00116 +;source-doc/ufi-drv/usb_cbi.c:40: if (send) { + bit 0,(ix+8) + jr Z,l_usb_execute_cbi_00112 +;source-doc/ufi-drv/usb_cbi.c:41: result = usbdev_blk_out_trnsfer(storage_device, buffer, buffer_size); + ld l,(ix+9) + ld h,(ix+10) + push hl + ld l,(ix+11) + ld h,(ix+12) + push hl + ld l,(ix+4) + ld h,(ix+5) + push hl + call _usbdev_blk_out_trnsfer + pop af + pop af + pop af + ld a, l + ld (_result), a +;source-doc/ufi-drv/usb_cbi.c:43: if (result != USB_ERR_OK) { + ld a,(_result) + or a, a + jr Z,l_usb_execute_cbi_00113 +;source-doc/ufi-drv/usb_cbi.c:45: goto done; + jr l_usb_execute_cbi_00116 +l_usb_execute_cbi_00112: +;source-doc/ufi-drv/usb_cbi.c:48: result = usbdev_dat_in_trnsfer(storage_device, buffer, buffer_size, ENDPOINT_BULK_IN); + ld a,0x01 + push af + inc sp + ld l,(ix+9) + ld h,(ix+10) + push hl + ld l,(ix+11) + ld h,(ix+12) + push hl + ld l,(ix+4) + ld h,(ix+5) + push hl + call _usbdev_dat_in_trnsfer + pop af + pop af + pop af + inc sp + ld a, l + ld (_result), a +;source-doc/ufi-drv/usb_cbi.c:50: if (result != USB_ERR_OK) { + ld a,(_result) + or a, a + jr NZ,l_usb_execute_cbi_00116 +;source-doc/ufi-drv/usb_cbi.c:52: goto done; +l_usb_execute_cbi_00113: +;source-doc/ufi-drv/usb_cbi.c:56: if (sense_codes != NULL) { + ld a,(ix+14) + or a,(ix+13) + jr Z,l_usb_execute_cbi_00116 +;source-doc/ufi-drv/usb_cbi.c:57: result = usbdev_dat_in_trnsfer(storage_device, sense_codes, 2, ENDPOINT_INTERRUPT_IN); + ld a,0x02 + push af + inc sp + ld hl,0x0002 + push hl + ld l,(ix+13) + ld h,(ix+14) + push hl + ld l,(ix+4) + ld h,(ix+5) + push hl + call _usbdev_dat_in_trnsfer + pop af + pop af + pop af + inc sp + ld a, l + ld (_result), a +;source-doc/ufi-drv/usb_cbi.c:65: done: +l_usb_execute_cbi_00116: +;source-doc/ufi-drv/usb_cbi.c:66: critical_end(); + call _critical_end +;source-doc/ufi-drv/usb_cbi.c:68: return result; + ld hl,(_result) +;source-doc/ufi-drv/usb_cbi.c:69: } + ld sp, ix + pop ix + ret + SECTION data_compiler +_cbi2_adsc: + DEFB +0x21 + DEFB +0x00 + DEFB +0x00 + DEFB +0x00 + DEFB +0xff + DEFB +0x00 + DEFW +0x000c + SECTION IGNORE diff --git a/Source/HBIOS/ch376-native/ufi-drv/usb_cbi.c.s b/Source/HBIOS/ch376-native/ufi-drv/usb_cbi.c.s index c9e23468..79d7c299 100644 --- a/Source/HBIOS/ch376-native/ufi-drv/usb_cbi.c.s +++ b/Source/HBIOS/ch376-native/ufi-drv/usb_cbi.c.s @@ -1,5 +1,5 @@ ; -; Generated from source-doc/ufi-drv/./usb_cbi.c.asm -- not to be modify directly +; Generated from source-doc/ufi-drv/usb_cbi.c.asm -- not to be modify directly ; ; ;-------------------------------------------------------- @@ -50,7 +50,7 @@ _cbi2_adsc: ;-------------------------------------------------------- ; code ;-------------------------------------------------------- -;source-doc/ufi-drv/./usb_cbi.c:10: usb_error usb_execute_cbi(device_config *const storage_device, +;source-doc/ufi-drv/usb_cbi.c:10: usb_error usb_execute_cbi(device_config *const storage_device, ; --------------------------------- ; Function usb_execute_cbi ; --------------------------------- @@ -61,33 +61,33 @@ _usb_execute_cbi: ld hl, -8 add hl, sp ld sp, hl -;source-doc/ufi-drv/./usb_cbi.c:17: const uint8_t interface_number = storage_device->interface_number; - ld c,(ix+4) - ld b,(ix+5) - ld l, c - ld h, b +;source-doc/ufi-drv/usb_cbi.c:17: const uint8_t interface_number = storage_device->interface_number; + ld l,(ix+4) + ld h,(ix+5) + ld c,l + ld b,h inc hl inc hl ld e, (hl) -;source-doc/ufi-drv/./usb_cbi.c:20: adsc = cbi2_adsc; +;source-doc/ufi-drv/usb_cbi.c:20: adsc = cbi2_adsc; push de push bc ex de, hl ld hl,4 add hl, sp ex de, hl - ld hl,_cbi2_adsc ld bc,0x0008 + ld hl,_cbi2_adsc ldir pop bc pop de -;source-doc/ufi-drv/./usb_cbi.c:21: adsc.bIndex[0] = interface_number; +;source-doc/ufi-drv/usb_cbi.c:21: adsc.bIndex[0] = interface_number; ld (ix-4),e -;source-doc/ufi-drv/./usb_cbi.c:23: critical_begin(); +;source-doc/ufi-drv/usb_cbi.c:23: critical_begin(); push bc call _critical_begin pop bc -;source-doc/ufi-drv/./usb_cbi.c:25: result = usbdev_control_transfer(storage_device, &adsc, (uint8_t *const)cmd); +;source-doc/ufi-drv/usb_cbi.c:25: result = usbdev_control_transfer(storage_device, &adsc, (uint8_t *const)cmd); ld l,(ix+6) ld h,(ix+7) push hl @@ -101,15 +101,15 @@ _usb_execute_cbi: pop af ld a, l ld (_result), a -;source-doc/ufi-drv/./usb_cbi.c:27: if (result == USB_ERR_STALL) { +;source-doc/ufi-drv/usb_cbi.c:27: if (result == USB_ERR_STALL) { ld a,(_result) sub 0x02 jr NZ,l_usb_execute_cbi_00104 -;source-doc/ufi-drv/./usb_cbi.c:28: if (sense_codes != NULL) +;source-doc/ufi-drv/usb_cbi.c:28: if (sense_codes != NULL) ld a,(ix+14) or (ix+13) jr Z,l_usb_execute_cbi_00102 -;source-doc/ufi-drv/./usb_cbi.c:29: usbdev_dat_in_trnsfer(storage_device, sense_codes, 2, ENDPOINT_INTERRUPT_IN); +;source-doc/ufi-drv/usb_cbi.c:29: usbdev_dat_in_trnsfer(storage_device, sense_codes, 2, ENDPOINT_INTERRUPT_IN); ld a,0x02 push af inc sp @@ -122,25 +122,24 @@ _usb_execute_cbi: ld h,(ix+5) push hl call _usbdev_dat_in_trnsfer - pop af - pop af - pop af - inc sp + ld hl,7 + add hl, sp + ld sp, hl l_usb_execute_cbi_00102: -;source-doc/ufi-drv/./usb_cbi.c:31: result = USB_ERR_STALL; +;source-doc/ufi-drv/usb_cbi.c:31: result = USB_ERR_STALL; ld hl,_result ld (hl),0x02 -;source-doc/ufi-drv/./usb_cbi.c:32: goto done; +;source-doc/ufi-drv/usb_cbi.c:32: goto done; jp l_usb_execute_cbi_00116 l_usb_execute_cbi_00104: -;source-doc/ufi-drv/./usb_cbi.c:35: if (result != USB_ERR_OK) { +;source-doc/ufi-drv/usb_cbi.c:35: if (result != USB_ERR_OK) { ld a,(_result) or a jp NZ, l_usb_execute_cbi_00116 -;source-doc/ufi-drv/./usb_cbi.c:40: if (send) { +;source-doc/ufi-drv/usb_cbi.c:40: if (send) { bit 0,(ix+8) jr Z,l_usb_execute_cbi_00112 -;source-doc/ufi-drv/./usb_cbi.c:41: result = usbdev_blk_out_trnsfer(storage_device, buffer, buffer_size); +;source-doc/ufi-drv/usb_cbi.c:41: result = usbdev_blk_out_trnsfer(storage_device, buffer, buffer_size); ld l,(ix+9) ld h,(ix+10) push hl @@ -156,14 +155,14 @@ l_usb_execute_cbi_00104: pop af ld a, l ld (_result), a -;source-doc/ufi-drv/./usb_cbi.c:43: if (result != USB_ERR_OK) { +;source-doc/ufi-drv/usb_cbi.c:43: if (result != USB_ERR_OK) { ld a,(_result) or a jr Z,l_usb_execute_cbi_00113 -;source-doc/ufi-drv/./usb_cbi.c:45: goto done; +;source-doc/ufi-drv/usb_cbi.c:45: goto done; jr l_usb_execute_cbi_00116 l_usb_execute_cbi_00112: -;source-doc/ufi-drv/./usb_cbi.c:48: result = usbdev_dat_in_trnsfer(storage_device, buffer, buffer_size, ENDPOINT_BULK_IN); +;source-doc/ufi-drv/usb_cbi.c:48: result = usbdev_dat_in_trnsfer(storage_device, buffer, buffer_size, ENDPOINT_BULK_IN); ld a,0x01 push af inc sp @@ -183,17 +182,17 @@ l_usb_execute_cbi_00112: inc sp ld a, l ld (_result), a -;source-doc/ufi-drv/./usb_cbi.c:50: if (result != USB_ERR_OK) { +;source-doc/ufi-drv/usb_cbi.c:50: if (result != USB_ERR_OK) { ld a,(_result) or a jr NZ,l_usb_execute_cbi_00116 -;source-doc/ufi-drv/./usb_cbi.c:52: goto done; +;source-doc/ufi-drv/usb_cbi.c:52: goto done; l_usb_execute_cbi_00113: -;source-doc/ufi-drv/./usb_cbi.c:56: if (sense_codes != NULL) { +;source-doc/ufi-drv/usb_cbi.c:56: if (sense_codes != NULL) { ld a,(ix+14) or (ix+13) jr Z,l_usb_execute_cbi_00116 -;source-doc/ufi-drv/./usb_cbi.c:57: result = usbdev_dat_in_trnsfer(storage_device, sense_codes, 2, ENDPOINT_INTERRUPT_IN); +;source-doc/ufi-drv/usb_cbi.c:57: result = usbdev_dat_in_trnsfer(storage_device, sense_codes, 2, ENDPOINT_INTERRUPT_IN); ld a,0x02 push af inc sp @@ -212,14 +211,13 @@ l_usb_execute_cbi_00113: inc sp ld a, l ld (_result), a -;source-doc/ufi-drv/./usb_cbi.c:65: done: +;source-doc/ufi-drv/usb_cbi.c:65: done: l_usb_execute_cbi_00116: -;source-doc/ufi-drv/./usb_cbi.c:66: critical_end(); +;source-doc/ufi-drv/usb_cbi.c:66: critical_end(); call _critical_end -;source-doc/ufi-drv/./usb_cbi.c:68: return result; - ld hl,_result - ld l, (hl) -;source-doc/ufi-drv/./usb_cbi.c:69: } +;source-doc/ufi-drv/usb_cbi.c:68: return result; + ld hl,(_result) +;source-doc/ufi-drv/usb_cbi.c:69: } ld sp, ix pop ix ret diff --git a/Source/HBIOS/util.asm b/Source/HBIOS/util.asm index d9983fd8..6d1ee813 100644 --- a/Source/HBIOS/util.asm +++ b/Source/HBIOS/util.asm @@ -578,17 +578,6 @@ DELAY1: ; | ; --- LOOP = ((CPUSCL * 16) - 5) TS ------------+ | DEC A ; 4TS | | #IF (BIOS == BIOS_WBW) ; | | - #IF (CPUFAM == CPU_EZ80) ; | | - OR A ; +?TS FOR EZ80 | | - OR A ; +?TS FOR EZ80 | | - OR A ; +?TS FOR EZ80 | | - OR A ; +?TS FOR EZ80 | | - OR A ; +?TS FOR EZ80 | | - OR A ; +?TS FOR EZ80 | | - OR A ; +?TS FOR EZ80 | | - OR A ; +?TS FOR EZ80 | | - OR A ; +?TS FOR EZ80 | | - #ENDIF ; | | #IF (CPUFAM == CPU_Z180) ; | | OR A ; +4TS FOR Z180 | | #ENDIF ; | |