forked from len0rd/rockbox
hwstub: add delay functions, and plain binary/sb file generation
Change-Id: Idbedb9277b355edcd93975ec5a268428c7b89633
This commit is contained in:
parent
acf3af4ae3
commit
3b6d2ac28a
5 changed files with 37 additions and 4 deletions
|
@ -14,9 +14,10 @@ OBJ=$(SRC:.c=.o)
|
||||||
OBJ:=$(OBJ:.S=.o)
|
OBJ:=$(OBJ:.S=.o)
|
||||||
OBJ_EXCEPT_CRT0=$(filter-out $(BUILD_DIR)/crt0.o,$(OBJ))
|
OBJ_EXCEPT_CRT0=$(filter-out $(BUILD_DIR)/crt0.o,$(OBJ))
|
||||||
EXEC_ELF=$(BUILD_DIR)/hwstub.elf
|
EXEC_ELF=$(BUILD_DIR)/hwstub.elf
|
||||||
|
EXEC_BIN=$(BUILD_DIR)/hwstub.bin
|
||||||
DEPS=$(foreach obj,$(OBJ),$(obj).d)
|
DEPS=$(foreach obj,$(OBJ),$(obj).d)
|
||||||
|
|
||||||
EXEC=$(EXEC_ELF)
|
EXEC+=$(EXEC_ELF) $(EXEC_BIN)
|
||||||
|
|
||||||
SILENT?=@
|
SILENT?=@
|
||||||
PRINTS=$(SILENT)$(call info,$(1))
|
PRINTS=$(SILENT)$(call info,$(1))
|
||||||
|
@ -45,5 +46,9 @@ $(EXEC_ELF): $(OBJ) $(TMP_LDS)
|
||||||
$(call PRINTS,LD $(@F))
|
$(call PRINTS,LD $(@F))
|
||||||
$(SILENT)$(LD) $(LDFLAGS) -o $@ $(OBJ_EXCEPT_CRT0)
|
$(SILENT)$(LD) $(LDFLAGS) -o $@ $(OBJ_EXCEPT_CRT0)
|
||||||
|
|
||||||
|
$(EXEC_BIN): $(EXEC_ELF)
|
||||||
|
$(call PRINTS,OC $(@F))
|
||||||
|
$(SILENT)$(OC) -O binary $< $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(SILENT)rm -rf $(OBJ) $(DEPS) $(EXEC) $(TMP_LDS) $(TMP_MAP)
|
$(SILENT)rm -rf $(OBJ) $(DEPS) $(EXEC) $(TMP_LDS) $(TMP_MAP)
|
||||||
|
|
|
@ -5,10 +5,16 @@ CC=arm-elf-eabi-gcc
|
||||||
LD=arm-elf-eabi-gcc
|
LD=arm-elf-eabi-gcc
|
||||||
AS=arm-elf-eabi-gcc
|
AS=arm-elf-eabi-gcc
|
||||||
OC=arm-elf-eabi-objcopy
|
OC=arm-elf-eabi-objcopy
|
||||||
|
SBTOELF=$(CURDIR)/../../../imxtools/sbtools/elftosb
|
||||||
DEFINES=
|
DEFINES=
|
||||||
INCLUDES=-I$(CURDIR)
|
INCLUDES=-I$(CURDIR)
|
||||||
GCCOPTS=-mcpu=arm926ej-s
|
GCCOPTS=-mcpu=arm926ej-s
|
||||||
BUILD_DIR=$(CURDIR)/build/
|
BUILD_DIR=$(CURDIR)/build/
|
||||||
ROOT_DIR=$(CURDIR)/..
|
ROOT_DIR=$(CURDIR)/..
|
||||||
|
EXEC=$(BUILD_DIR)/hwstub.sb
|
||||||
|
|
||||||
include ../hwstub.make
|
include ../hwstub.make
|
||||||
|
|
||||||
|
$(BUILD_DIR)/hwstub.sb: $(EXEC_BIN)
|
||||||
|
$(call PRINTS,SBTOELF $(@F))
|
||||||
|
$(SILENT)$(SBTOELF) -z -c hwstub.db -o $@ $<
|
|
@ -273,3 +273,18 @@ void target_exit(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void target_udelay(int us)
|
||||||
|
{
|
||||||
|
uint32_t cur = HW_DIGCTL_MICROSECONDS;
|
||||||
|
uint32_t end = cur + us;
|
||||||
|
if(cur < end)
|
||||||
|
while(HW_DIGCTL_MICROSECONDS < end) {}
|
||||||
|
else
|
||||||
|
while(HW_DIGCTL_MICROSECONDS >= cur) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
void target_mdelay(int ms)
|
||||||
|
{
|
||||||
|
return target_udelay(ms * 1000);
|
||||||
|
}
|
||||||
|
|
|
@ -31,5 +31,9 @@ void target_exit(void);
|
||||||
int target_get_info(int info, void **buffer);
|
int target_get_info(int info, void **buffer);
|
||||||
/* set atexit action or return -1 on error */
|
/* set atexit action or return -1 on error */
|
||||||
int target_atexit(int action);
|
int target_atexit(int action);
|
||||||
|
/* Wait a very short time (us<=1000) */
|
||||||
|
void target_udelay(int us);
|
||||||
|
/* Wait for a short time (ms <= 1000) */
|
||||||
|
void target_mdelay(int ms);
|
||||||
|
|
||||||
#endif /* __TARGET_H__ */
|
#endif /* __TARGET_H__ */
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "usb_drv.h"
|
#include "usb_drv.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
#include "target.h"
|
||||||
|
|
||||||
#define MAX_PKT_SIZE 1024
|
#define MAX_PKT_SIZE 1024
|
||||||
#define MAX_PKT_SIZE_EP0 64
|
#define MAX_PKT_SIZE_EP0 64
|
||||||
|
@ -323,6 +324,8 @@ void usb_drv_init(void)
|
||||||
/* we don't know if USB was connected or not. In USB recovery mode it will
|
/* we don't know if USB was connected or not. In USB recovery mode it will
|
||||||
* but in other cases it might not be. In doubt, disconnect */
|
* but in other cases it might not be. In doubt, disconnect */
|
||||||
REG_USBCMD &= ~USBCMD_RUN;
|
REG_USBCMD &= ~USBCMD_RUN;
|
||||||
|
/* wait a short time for the host to realise */
|
||||||
|
target_mdelay(50);
|
||||||
/* reset the controller */
|
/* reset the controller */
|
||||||
REG_USBCMD |= USBCMD_CTRL_RESET;
|
REG_USBCMD |= USBCMD_CTRL_RESET;
|
||||||
while(REG_USBCMD & USBCMD_CTRL_RESET);
|
while(REG_USBCMD & USBCMD_CTRL_RESET);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue