初始提交

This commit is contained in:
2024-09-28 14:24:04 +08:00
commit c756587541
5564 changed files with 2413077 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
# OUTPUT type
# 1 - .out
# 2 - .a
# 3 - .so
OUTPUT_TYPE = 1
OUTPUT_NAME = gpio_mtx_test
SUB_DIRS = $(TOPDIR)/common/os_shim/dtestos
# .h files dir
ADD_INCLUDE += $(TOPDIR)/inc/io_lib $(TOPDIR)/inc/driver $(TOPDIR)/driver/inc
# predefined macro
PRE_MARCO +=
LD_SCRIPT = link_soc.lds
ifeq ($(gcc),arm)
ADD_LIB = cm3
ADD_LIBDIR = $(TOPDIR)/startup/cm3
else
ifeq ($(target), kunlun2)
ADD_LIB = riscv
ADD_LIBDIR =$(TOPDIR)/startup/riscv2
ADD_INCLUDE += $(TOPDIR)/driver/src/hw2/inc
else
ADD_LIB = riscv
ADD_LIBDIR =$(TOPDIR)/startup/riscv
ADD_INCLUDE += $(TOPDIR)/driver/src/hw/inc
endif
endif
# lib dir
ADD_LIBDIR += $(TOPDIR)/driver $(TOPDIR)/common/io_lib
# lib need to ld together
ADD_LIB += driver io_lib
#####################################################
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)

View File

@@ -0,0 +1,90 @@
/****************************************************************************
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
be copied by any method or incorporated into another program without
the express written consent of Aerospace C.Power. This Information or any portion
thereof remains the property of Aerospace C.Power. The Information contained herein
is believed to be accurate and Aerospace C.Power assumes no responsibility or
liability for its use in any way and conveys no license or title under
any patent or copyright and makes no representation or warranty that this
Information is free from patent or copyright infringement.
****************************************************************************/
#include "os_types.h"
#include "dbg_io.h"
#include "iot_diag.h"
#include "iot_io.h"
#include "uart.h"
#include "gpio_mtx.h"
#define TEST_UART_PORT 1
int32_t test_uart1_getc(void)
{
int32_t c;
c = g_uart_ctrl.getc(TEST_UART_PORT);
if (c == -6) {
return -1;
}
return c;
}
int32_t test_uart0_getc(void)
{
int32_t c;
c = g_uart_ctrl.getc(0);
if (c == -6) {
return -1;
}
return c;
}
void test_uart1_putc(const char c)
{
g_uart_ctrl.try_putc(TEST_UART_PORT, c);
}
void test_uart1_init()
{
g_uart_ctrl.init(TEST_UART_PORT);
//g_uart_ctrl.config(1, 2400, 8, 1, 0);
}
int main(void)
{
dbg_uart_init();
test_uart1_init();
iot_printf("hello world.\n");
iot_printf("hello world.\n");
iot_printf("hello world.\n");
iot_printf("hello world.\n");
uint32_t c;
char buf[10] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'};
int i;
int j = 0;
char get;
while(1) {
for (i=0; i< 10; i++) {
test_uart1_putc(buf[i]);
c = test_uart1_getc();
if (c != -1) {
for(j=0;j<10000;j++);
get = (char)c;
iot_printf("get data: %c\n", get);
}
c = test_uart0_getc();
if (c != -1) {
for(j=0;j<10000;j++);
get = (char)c;
iot_printf("get0 data: %c\n", get);
}
for(j=0;j<1000000;j++);
}
}
return 0;
}