初始提交
This commit is contained in:
49
dtest/bee_usb_test/Makefile
Executable file
49
dtest/bee_usb_test/Makefile
Executable file
@@ -0,0 +1,49 @@
|
||||
# OUTPUT type
|
||||
# 1 - .out
|
||||
# 2 - .a
|
||||
# 3 - .so
|
||||
OUTPUT_TYPE = 1
|
||||
OUTPUT_NAME = usb_test
|
||||
|
||||
SUB_DIRS = $(TOPDIR)/common/os_shim/freertos
|
||||
|
||||
# .h files dir
|
||||
ADD_INCLUDE += $(TOPDIR)/inc/io_lib $(TOPDIR)/inc/driver $(TOPDIR)/inc/os_shim $(TOPDIR)/startup/riscv2/inc $(TOPDIR)/driver/inc
|
||||
|
||||
# predefined macro
|
||||
PRE_MARCO +=
|
||||
|
||||
LD_SCRIPT = link_soc.lds
|
||||
#LD_SCRIPT = link_iram.lds
|
||||
|
||||
ADD_LIB = riscv
|
||||
ADD_LIBDIR = $(TOPDIR)/startup/riscv3
|
||||
|
||||
# lib dir
|
||||
ADD_LIBDIR += $(TOPDIR)/driver $(TOPDIR)/common $(TOPDIR)/os
|
||||
# lib need to ld together
|
||||
ADD_LIB += os driver common
|
||||
|
||||
#####################################################
|
||||
|
||||
ifdef TOPDIR
|
||||
include $(TOPDIR)/build/makefile.cfg
|
||||
else
|
||||
include $(CURDIR)/build/makefile.cfg
|
||||
TOPDIR = $(CURDIR)
|
||||
export TOPDIR
|
||||
endif
|
||||
|
||||
dump:
|
||||
$(OBJDUMP) -D -S -l $(OUTPUT_FULL_NAME) > $(OUTPUT_FULL_NAME).dump
|
||||
|
||||
# display the obj files and output name
|
||||
debug:
|
||||
@echo TOPDIR=$(TOPDIR)
|
||||
@echo OUTPUT_LIB=$(OUTPUT_FULL_NAME)
|
||||
@echo DEPS=$(DEPS)
|
||||
@echo OBJECTS=$(OBJECTS)
|
||||
@echo SRCS=$(SRCS)
|
||||
@echo OBJECTS folder=$(foreach dirname, $(SUB_DIRS), $(addprefix $(BIN_DIR)/, $(dirname)))
|
||||
@echo output_name=$(OUTPUT_FULL_NAME)
|
||||
|
132
dtest/bee_usb_test/bee_usb_test.c
Normal file
132
dtest/bee_usb_test/bee_usb_test.c
Normal file
@@ -0,0 +1,132 @@
|
||||
|
||||
#include "os_types.h"
|
||||
#include "os_task.h"
|
||||
#include "os_mem.h"
|
||||
|
||||
#include "dbg_io.h"
|
||||
#include "iot_diag.h"
|
||||
#include "iot_io.h"
|
||||
#include "cpu.h"
|
||||
|
||||
|
||||
//#include <stdlib.h>
|
||||
#include "iot_system_api.h"
|
||||
#include "iot_config.h"
|
||||
|
||||
|
||||
|
||||
|
||||
//#include "iot_gptmr.h"
|
||||
#include "iot_system.h"
|
||||
//#include "os_mem.h"
|
||||
//#include "cpu.h"
|
||||
//#include "os_task.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "encoding.h"
|
||||
|
||||
//#include "sec_glb.h"
|
||||
//#include "ahb.h"
|
||||
//#include "intc.h"
|
||||
|
||||
#include "bits.h"
|
||||
|
||||
#include "os_utils.h"
|
||||
#include "usb_dev.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static int32_t iot__platform_init()
|
||||
{
|
||||
/*platform intialization*/
|
||||
platform_init();
|
||||
|
||||
//resource initializations;
|
||||
// system_clock_init();
|
||||
|
||||
// system_uart_init();
|
||||
|
||||
dbg_uart_init();
|
||||
|
||||
// dbg_uart_stage1_init();
|
||||
|
||||
// iot_led_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void user_task_1(){
|
||||
|
||||
UsbDevOpen(1);
|
||||
|
||||
while(1)
|
||||
{
|
||||
iot_printf("user_task_1..CPU:%d..\n",cpu_get_mhartid());
|
||||
|
||||
os_delay(10000);
|
||||
}
|
||||
|
||||
UsbDevStop();
|
||||
}
|
||||
|
||||
int32_t iot__task_init()
|
||||
{
|
||||
os_task_h handle;
|
||||
|
||||
handle = os_create_task(user_task_1, NULL, 9);
|
||||
|
||||
//create the tasks;
|
||||
if(handle != NULL) {
|
||||
iot_printf("task 1 init successfully...\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int32_t iot__module_init(void)
|
||||
{
|
||||
//platform intialization;
|
||||
iot__platform_init();
|
||||
|
||||
//create all the tasks;
|
||||
iot__task_init();
|
||||
|
||||
iot_printf("starting...\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t iot__task_start()
|
||||
{
|
||||
//start the tasks;
|
||||
os_start_kernel();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t iot__module_start(void)
|
||||
{
|
||||
int32_t res = 0;
|
||||
|
||||
res = iot__task_start();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
//module init;
|
||||
iot__module_init();
|
||||
|
||||
//module start;
|
||||
iot__module_start();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user