初始提交
This commit is contained in:
62
dtest/bee_nfc_test/Makefile
Executable file
62
dtest/bee_nfc_test/Makefile
Executable file
@@ -0,0 +1,62 @@
|
||||
# OUTPUT type
|
||||
# 1 - .out
|
||||
# 2 - .a
|
||||
# 3 - .so
|
||||
OUTPUT_TYPE = 1
|
||||
OUTPUT_NAME = nfc_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
|
||||
|
||||
# predefined macro
|
||||
PRE_MARCO +=
|
||||
|
||||
LD_SCRIPT = link_soc.lds
|
||||
#LD_SCRIPT = link_iram.lds
|
||||
|
||||
ifeq ($(gcc),arm)
|
||||
ADD_LIB = cm3
|
||||
ADD_LIBDIR = $(TOPDIR)/startup/cm3
|
||||
else
|
||||
ADD_LIB = riscv
|
||||
ifeq ($(target), kunlun2)
|
||||
ADD_LIBDIR = $(TOPDIR)/startup/riscv2
|
||||
else
|
||||
ifeq ($(target), bee)
|
||||
ADD_LIBDIR = $(TOPDIR)/startup/riscv3
|
||||
else
|
||||
ADD_LIBDIR = $(TOPDIR)/startup/riscv
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# 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)
|
||||
|
182
dtest/bee_nfc_test/bee_nfc_test.c
Executable file
182
dtest/bee_nfc_test/bee_nfc_test.c
Executable file
@@ -0,0 +1,182 @@
|
||||
|
||||
#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 "iot_system_api.h"
|
||||
#include "iot_config.h"
|
||||
|
||||
#include "iot_system.h"
|
||||
|
||||
|
||||
#include "platform.h"
|
||||
#include "encoding.h"
|
||||
|
||||
#include "bits.h"
|
||||
|
||||
#include "os_utils.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void nfc_write_access_write(uint8_t cmd, uint8_t addr, uint8_t val);
|
||||
|
||||
extern uint8_t nfc_write_access_read();
|
||||
|
||||
static int32_t iot__platform_init()
|
||||
{
|
||||
/*platform intialization*/
|
||||
platform_init();
|
||||
|
||||
//resource initializations;
|
||||
dbg_uart_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void user_task_1(){
|
||||
int i=0;
|
||||
while(1)
|
||||
{
|
||||
nfc_write_access_write(2, 0x01, 0x0f);
|
||||
|
||||
i=0;
|
||||
|
||||
while(i<0x3f){
|
||||
iot_printf("%02x 0x%02x, ",i, nfc_write_access_read(i));
|
||||
i++;
|
||||
if((i&0xf)==0)
|
||||
iot_printf("\r\n");
|
||||
}
|
||||
////////////////////////////////////////////
|
||||
nfc_write_access_write(2, 0x11, 0xff);
|
||||
nfc_write_access_write(2, 0x14, 0xff);
|
||||
nfc_write_access_write(2, 0x17, 0xff);
|
||||
nfc_write_access_write(2, 0x19, 0xff);
|
||||
nfc_write_access_write(2, 0x27, 0xff);
|
||||
nfc_write_access_write(2, 0x2c, 0xff);
|
||||
nfc_write_access_write(2, 0x32, 0xff);
|
||||
nfc_write_access_write(2, 0x34, 0xff);
|
||||
//////////////////////////////////////////////////
|
||||
i=0;
|
||||
iot_printf("\r\nREAD aft wr:\r\n");
|
||||
while(i<0x3f){
|
||||
iot_printf("%02x 0x%02x, ",i, nfc_write_access_read(i));
|
||||
i++;
|
||||
if((i&0xf)==0)
|
||||
iot_printf("\r\n");
|
||||
}
|
||||
iot_printf("\r\n");
|
||||
nfc_write_access_write(2, 0x01, 0x0f);
|
||||
os_delay(10);
|
||||
i=25;
|
||||
while(i)
|
||||
{
|
||||
nfc_write_access_write(2, 0x09, 0x00);
|
||||
i--;
|
||||
}
|
||||
os_delay(10);
|
||||
nfc_write_access_write(2, 0x01, 0x01);
|
||||
os_delay(10);
|
||||
nfc_write_access_write(2, 0x36, 0x09);
|
||||
os_delay(10);
|
||||
nfc_write_access_write(2, 0x09, 0x00);
|
||||
os_delay(10);
|
||||
nfc_write_access_write(2, 0x01, 0x03);
|
||||
|
||||
os_delay(10);
|
||||
|
||||
i=64;
|
||||
while(i)
|
||||
{
|
||||
iot_printf("0x%x ",nfc_write_access_read(0x09));
|
||||
i--;
|
||||
}
|
||||
iot_printf("\r\n+++++++++++++++++++++++++\r\n");
|
||||
|
||||
////////////////////////////////////////////
|
||||
iot_printf("NFC TX:\r\n");
|
||||
nfc_write_access_write(2, 0x01, 0x0f);
|
||||
os_delay(10);
|
||||
/*data*/
|
||||
nfc_write_access_write(2, 0x09, 0x00);
|
||||
nfc_write_access_write(2, 0x09, 0xd3);
|
||||
nfc_write_access_write(2, 0x09, 0x0f);
|
||||
nfc_write_access_write(2, 0x09, 0xaa);
|
||||
nfc_write_access_write(2, 0x09, 0x33);
|
||||
/*analog*/
|
||||
nfc_write_access_write(2, 0x12, 0x00);
|
||||
nfc_write_access_write(2, 0x14, 0x83);
|
||||
nfc_write_access_write(2, 0x16, 0x10);
|
||||
nfc_write_access_write(2, 0x27, 0xf0);
|
||||
nfc_write_access_write(2, 0x28, 0x3f);
|
||||
nfc_write_access_write(2, 0x29, 0x00);
|
||||
nfc_write_access_write(2, 0x01, 0x04);
|
||||
}
|
||||
}
|
||||
|
||||
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