Initial commit

This commit is contained in:
ChesterTseng 2017-10-15 14:36:37 +08:00
commit 6f665866d6
3358 changed files with 1106791 additions and 0 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<workspace>
<project>
<path>$WS_DIR$\Project.ewp</path>
</project>
<batchBuild/>
</workspace>

View file

@ -0,0 +1,227 @@
/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Specials-*/
//define symbol __ICFEDIT_intvec_start__ = 0x00000000;
include "main.icf";
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
define symbol __ICFEDIT_region_ROM_end__ = 0x000FFFFF;
define symbol __ICFEDIT_region_TCM_start__ = 0x1FFF0000;
define symbol __ICFEDIT_region_TCM_end__ = 0x1FFFFFFF;
define symbol __ICFEDIT_region_ROM_USED_RAM_start__ = 0x10000000;
define symbol __ICFEDIT_region_ROM_USED_RAM_end__ = 0x10005FFF;
//define symbol __ICFEDIT_region_RECY_RAM_start__ = 0x10002090;
//define symbol __ICFEDIT_region_RECY_RAM_end__ = 0x100037FF;
if( !isdefinedsymbol( __ICFEDIT_region_BD_RAM_start__ ) ) {
define symbol __ICFEDIT_region_BD_RAM_start__ = 0x10006000;
}
if( !isdefinedsymbol( __ICFEDIT_region_BD_RAM_end__ ) ) {
define symbol __ICFEDIT_region_BD_RAM_end__ = 0x1006FFFF;
}
define symbol __ICFEDIT_region_SDRAM_RAM_start__ = 0x30000000;
define symbol __ICFEDIT_region_SDRAM_RAM_end__ = 0x301FFFFF;
/*-Sizes-*/
/*define symbol __ICFEDIT_size_cstack__ = 0x400;*/
/*define symbol __ICFEDIT_size_heap__ = 0x800;*/
/**** End of ICF editor section. ###ICF###*/
define memory mem with size = 4G;
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
define region TCM_region = mem:[from __ICFEDIT_region_TCM_start__ to __ICFEDIT_region_TCM_end__];
define region ROM_USED_RAM_region = mem:[from __ICFEDIT_region_ROM_USED_RAM_start__ to __ICFEDIT_region_ROM_USED_RAM_end__];
//define region RECY_RAM_region = mem:[from __ICFEDIT_region_RECY_RAM_start__ to __ICFEDIT_region_RECY_RAM_end__];
define region BD_RAM_region = mem:[from __ICFEDIT_region_BD_RAM_start__ to __ICFEDIT_region_BD_RAM_end__];
define region SDRAM_RAM_region = mem:[from __ICFEDIT_region_SDRAM_RAM_start__ to __ICFEDIT_region_SDRAM_RAM_end__];
/*define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };*/
/*define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };*/
//initialize by copy { readwrite };
//initialize by copy with packing = none { section __DLIB_PERTHREAD }; // Required in a multi-threaded application
//do not initialize { section * };
//place at address mem:__ICFEDIT_intvec_start__ { readonly section .vectors_table };
/*place in RAM_region { readwrite, block CSTACK, block HEAP };*/
//place in TCM_region { readwrite };
/****************************************
* ROM Section config *
****************************************/
keep { section .rom };
place at start of ROM_region { section .rom };
/****************************************
* BD RAM Section config *
****************************************/
keep { section .ram_dedecated_vector_table* };
define block .vector_table with fixed order{section .ram_dedecated_vector_table*};
keep { section .ram_user_define_irq_table* };
define block .user_vector_table with fixed order{section .ram_user_define_irq_table*};
keep { section .ram_user_define_data_table* };
define block .user_data_table with fixed order{section .ram_user_define_data_table*};
define block .rom.bss with fixed order{ section .hal.ram.bss* object hal_misc.o,
section .hal.ram.bss* object hal_pinmux.o,
section .hal.ram.bss* object diag.o,
section .hal.ram.bss* object rtl8195a_ssi_rom.o,
section .hal.ram.bss* object rtl8195a_gpio.o,
section .hal.ram.bss*,
section .timer2_7_vector_table.data*,
section .infra.ram.bss*,
section .mon.ram.bss*,
section .wlan_ram_map* object rom_wlan_ram_map.o,
section .wlan_ram_map*,
section .libc.ram.bss*,
};
keep { section .start.ram.data* };
define block .ram.start.table with fixed order{ section .start.ram.data* };
keep { section .image1.validate.rodata* };
keep { section .infra.ram.data* };
keep { section .timer.ram.data* };
keep { section .hal.ram.data* };
define block .ram_image1.data with fixed order{ section .image1.validate.rodata*,
section .infra.ram.data*,
section .timer.ram.data*,
section .cutb.ram.data*,
section .hal.ram.data* object rom.o, // for standard libaray __impure_data_ptr
section .cutc.ram.data*,
section .hal.ram.data*
};
define block .ram_image1.bss with fixed order{ //section .hal.flash.data*,
section .hal.sdrc.data*
};
define block .ram_image1.text with fixed order{ section .hal.ram.text*,
section .hal.sdrc.text*,
//section .text* object startup.o,
section .infra.ram.text*,
};
define block IMAGE1 with fixed order { section LOADER };
define block IMAGE1_DBG with fixed order { block .ram.start.table, block .ram_image1.data, block .ram_image1.bss, block .ram_image1.text };
place at start of ROM_USED_RAM_region {
block .vector_table,
block .user_vector_table,
block .user_data_table,
block .rom.bss,
block IMAGE1
};
keep { section .image2.ram.data* };
define block .image2.start.table1 with fixed order{ section .image2.ram.data* };
keep { section .image2.validate.rodata*, section .custom.validate.rodata* };
define block .image2.start.table2 with fixed order{ section .image2.validate.rodata*, section .custom.validate.rodata* };
define block SHT$$PREINIT_ARRAY { preinit_array };
define block SHT$$INIT_ARRAY { init_array };
define block CPP_INIT with alignment = 8, fixed order {
block SHT$$PREINIT_ARRAY,
block SHT$$INIT_ARRAY
};
define block FPB_REMAP with alignment = 256,fixed order {
section .fpb.remap*
};
define block .ram_image2.text with fixed order{ section .infra.ram.start*,
section .rodata*,
block CPP_INIT,
section .mon.ram.text*,
section .hal.flash.text*,
section .hal.gpio.text*,
section .text* object main.o,
section .text*,
section .wlan.text,
section .wps.text,
section CODE,
section .otg.rom.text,
section Veneer object startup.o,
section __DLIB_PERTHREAD,
section .iar.dynexit*,
//section .mdns.text
};
define block .ram.data with fixed order{ readwrite, readonly,
section .data*,
section .wlan.data,
section .wps.data,
section DATA,
section .ram.otg.data.a,
section .iar.init_table,
//section .mdns.data
};
define block IMAGE2 with fixed order { block .image2.start.table1, block .image2.start.table2, block .ram_image2.text, block .ram.data };
define block .ram.bss with fixed order{ section .bss*,
section .ssl_ram_map,
section .hal.flash.data*,
section .hal.gpio.data*,
section COMMON,
section .bdsram.data*,
section .bss* object heap_4.o
};
define block .bf_data with fixed order{ section .bfsram.data* };
define block .heap with fixed order{ section .heap* };
define block .stack_dummy with fixed order { section .stack };
place at start of BD_RAM_region {
block IMAGE2,
//block IMAGE1_DBG,
block .ram.bss,
//block .bf_data,
};
//place at address mem:0x10052b00 { readwrite,
place at end of BD_RAM_region {
block .bf_data,
};
define block SDRAM with fixed order{ section .sdram.text*,
section .sdram.data*,
section .mdns.text*,
section .mdns.data*,
block FPB_REMAP
};
define block SDRBSS with fixed order{
section .sdram.bss*
};
place at start of SDRAM_RAM_region {
block SDRAM,
block SDRBSS,
//block IMAGE1_DBG
};
/* TCM placement */
define overlay TCM_overlay {
section .tcm.heap,
section .bss object mem.o,
section .bss object memp.o,
block .heap,
block .stack_dummy
};
/* dummy code placement */
define overlay TCM_overlay { block IMAGE1_DBG };
place at start of TCM_region { overlay TCM_overlay };
define exported symbol __rom_bss_start__ = 0x10000300; // use in rom
define exported symbol __rom_bss_end__ = 0x10000bc8; // use in rom
define exported symbol __ram_start_table_start__= 0x10000bc8; // use in rom
define exported symbol __image1_validate_code__= 0x10000bdc; // needed by ram code
define exported symbol _rtl_impure_ptr = 0x10001c60; // for standard library
define exported symbol __sdio_rom_bss_start__ = 0x1006D000;
define exported symbol __sdio_rom_bss_end__ = 0x1006fa10;

View file

@ -0,0 +1,37 @@
all: ram_all
OS := $(shell uname)
.PHONY: toolchain
toolchain:
ifeq ($(OS),Linux)
if [ ! -d ../../../tools/arm-none-eabi-gcc/4_8-2014q3 ] ; then tar -jxf ../../../tools/arm-none-eabi-gcc/gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2 -C ../../../tools/arm-none-eabi-gcc/ ; mv ../../../tools/arm-none-eabi-gcc/gcc-arm-none-eabi-4_8-2014q3 ../../../tools/arm-none-eabi-gcc/4_8-2014q3 ; fi
else
if [ ! -d ../../../tools/arm-none-eabi-gcc/4_8-2014q3 ] ; then tar -xf ../../../tools/arm-none-eabi-gcc/4_8-2014q3.tar -C ../../../tools/arm-none-eabi-gcc/ ; fi
endif
.PHONY: ram_all
ram_all: toolchain
@$(MAKE) -f application.mk
.PHONY: mp
mp: toolchain
@$(MAKE) -f application.mk mp
.PHONY: clean
clean:
@$(MAKE) -f application.mk clean
.PHONY: flash debug ramdebug setup
setup:
@$(MAKE) -f application.mk $(MAKECMDGOALS)
flash: toolchain
@$(MAKE) -f application.mk flashburn
debug: toolchain
@$(MAKE) -f application.mk debug
ramdebug: toolchain
@$(MAKE) -f application.mk ramdebug

View file

@ -0,0 +1,660 @@
# Initialize tool chain
# -------------------------------------------------------------------
ARM_GCC_TOOLCHAIN = ../../../tools/arm-none-eabi-gcc/4_8-2014q3/bin/
AMEBA_TOOLDIR = ../../../component/soc/realtek/8195a/misc/iar_utility/common/tools/
FLASH_TOOLDIR = ../../../component/soc/realtek/8195a/misc/gcc_utility/
CROSS_COMPILE = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-
# Compilation tools
AR = $(CROSS_COMPILE)ar
CC = $(CROSS_COMPILE)gcc
AS = $(CROSS_COMPILE)as
NM = $(CROSS_COMPILE)nm
LD = $(CROSS_COMPILE)gcc
GDB = $(CROSS_COMPILE)gdb
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
OS := $(shell uname)
ifeq ($(findstring CYGWIN, $(OS)), CYGWIN)
PICK = $(AMEBA_TOOLDIR)pick.exe
PAD = $(AMEBA_TOOLDIR)padding.exe
CHKSUM = $(AMEBA_TOOLDIR)checksum.exe
else
PICK = $(AMEBA_TOOLDIR)pick
PAD = $(AMEBA_TOOLDIR)padding
CHKSUM = $(AMEBA_TOOLDIR)checksum
endif
# Initialize target name and target object files
# -------------------------------------------------------------------
all: application manipulate_images
mp: application manipulate_images
TARGET=application
OBJ_DIR=$(TARGET)/Debug/obj
BIN_DIR=$(TARGET)/Debug/bin
# Include folder list
# -------------------------------------------------------------------
INCLUDES =
INCLUDES += -I../inc
INCLUDES += -I../../../component/soc/realtek/common/bsp
INCLUDES += -I../../../component/os/freertos
INCLUDES += -I../../../component/os/freertos/freertos_v8.1.2/Source/include
INCLUDES += -I../../../component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM3
INCLUDES += -I../../../component/os/os_dep/include
INCLUDES += -I../../../component/soc/realtek/8195a/misc/driver
INCLUDES += -I../../../component/soc/realtek/8195a/misc/os
INCLUDES += -I../../../component/common/api/network/include
INCLUDES += -I../../../component/common/api
INCLUDES += -I../../../component/common/api/platform
INCLUDES += -I../../../component/common/api/wifi
INCLUDES += -I../../../component/common/api/wifi/rtw_wpa_supplicant/src
INCLUDES += -I../../../component/common/application
INCLUDES += -I../../../component/common/application/iotdemokit
INCLUDES += -I../../../component/common/application/google
INCLUDES += -I../../../component/common/media/framework
INCLUDES += -I../../../component/common/example
INCLUDES += -I../../../component/common/example/wlan_fast_connect
INCLUDES += -I../../../component/common/mbed/api
INCLUDES += -I../../../component/common/mbed/hal
INCLUDES += -I../../../component/common/mbed/hal_ext
INCLUDES += -I../../../component/common/mbed/targets/hal/rtl8195a
INCLUDES += -I../../../component/common/file_system
INCLUDES += -I../../../component/common/network
INCLUDES += -I../../../component/common/network/lwip/lwip_v1.4.1/port/realtek/freertos
INCLUDES += -I../../../component/common/network/lwip/lwip_v1.4.1/src/include
INCLUDES += -I../../../component/common/network/lwip/lwip_v1.4.1/src/include/lwip
INCLUDES += -I../../../component/common/network/lwip/lwip_v1.4.1/src/include/ipv4
INCLUDES += -I../../../component/common/network/lwip/lwip_v1.4.1/port/realtek
INCLUDES += -I../../../component/common/test
INCLUDES += -I../../../component/soc/realtek/8195a/cmsis
INCLUDES += -I../../../component/soc/realtek/8195a/cmsis/device
INCLUDES += -I../../../component/soc/realtek/8195a/fwlib
INCLUDES += -I../../../component/soc/realtek/8195a/fwlib/rtl8195a
INCLUDES += -I../../../component/soc/realtek/8195a/misc/platform
INCLUDES += -I../../../component/soc/realtek/8195a/misc/rtl_std_lib/include
INCLUDES += -I../../../component/common/drivers/wlan/realtek/include
INCLUDES += -I../../../component/common/drivers/wlan/realtek/src/osdep
INCLUDES += -I../../../component/common/drivers/wlan/realtek/src/hci
INCLUDES += -I../../../component/common/drivers/wlan/realtek/src/hal
INCLUDES += -I../../../component/common/drivers/wlan/realtek/src/hal/OUTSRC
INCLUDES += -I../../../component/soc/realtek/8195a/fwlib/ram_lib/wlan/realtek/wlan_ram_map/rom
INCLUDES += -I../../../component/common/network/ssl/polarssl-1.3.8/include
INCLUDES += -I../../../component/common/network/ssl/mbedtls-2.4.0/include
INCLUDES += -I../../../component/common/network/ssl/ssl_ram_map/rom
INCLUDES += -I../../../component/common/utilities
INCLUDES += -I../../../component/soc/realtek/8195a/misc/rtl_std_lib/include
INCLUDES += -I../../../component/common/application/apple/WACServer/External/Curve25519
INCLUDES += -I../../../component/common/application/apple/WACServer/External/GladmanAES
INCLUDES += -I../../../component/soc/realtek/8195a/fwlib/ram_lib/usb_otg/include
INCLUDES += -I../../../component/common/video/v4l2/inc
INCLUDES += -I../../../component/common/media/rtp_codec
INCLUDES += -I../../../component/common/drivers/usb_class/host/uvc/inc
INCLUDES += -I../../../component/common/drivers/usb_class/device
INCLUDES += -I../../../component/common/drivers/usb_class/device/class
INCLUDES += -I../../../component/common/file_system/fatfs
INCLUDES += -I../../../component/common/file_system/fatfs/r0.10c/include
INCLUDES += -I../../../component/common/drivers/sdio/realtek/sdio_host/inc
INCLUDES += -I../../../component/common/audio
INCLUDES += -I../../../component/common/drivers/i2s
INCLUDES += -I../../../component/common/application/xmodem
INCLUDES += -I../../../component/common/application/mqtt/MQTTClient
# Source file list
# -------------------------------------------------------------------
SRC_C =
DRAM_C =
#cmsis
SRC_C += ../../../component/soc/realtek/8195a/cmsis/device/system_8195a.c
#console
SRC_C += ../../../component/common/api/at_cmd/atcmd_cloud.c
SRC_C += ../../../component/common/api/at_cmd/atcmd_ethernet.c
SRC_C += ../../../component/common/api/at_cmd/atcmd_lwip.c
SRC_C += ../../../component/common/api/at_cmd/atcmd_sys.c
SRC_C += ../../../component/common/api/at_cmd/atcmd_wifi.c
SRC_C += ../../../component/common/api/at_cmd/log_service.c
SRC_C += ../../../component/soc/realtek/8195a/misc/driver/low_level_io.c
SRC_C += ../../../component/soc/realtek/8195a/misc/driver/rtl_consol.c
#network - api
SRC_C += ../../../component/common/api/wifi/rtw_wpa_supplicant/src/crypto/tls_polarssl.c
SRC_C += ../../../component/common/api/wifi/rtw_wpa_supplicant/wpa_supplicant/wifi_eap_config.c
SRC_C += ../../../component/common/api/wifi/rtw_wpa_supplicant/wpa_supplicant/wifi_p2p_config.c
SRC_C += ../../../component/common/api/wifi/rtw_wpa_supplicant/wpa_supplicant/wifi_wps_config.c
SRC_C += ../../../component/common/api/wifi/wifi_conf.c
SRC_C += ../../../component/common/api/wifi/wifi_ind.c
SRC_C += ../../../component/common/api/wifi/wifi_promisc.c
SRC_C += ../../../component/common/api/wifi/wifi_simple_config.c
SRC_C += ../../../component/common/api/wifi/wifi_util.c
SRC_C += ../../../component/common/api/lwip_netconf.c
#network - app
SRC_C += ../../../component/common/application/mqtt/MQTTClient/MQTTClient.c
SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTConnectClient.c
SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTConnectServer.c
SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTDeserializePublish.c
SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTFormat.c
SRC_C += ../../../component/common/application/mqtt/MQTTClient/MQTTFreertos.c
SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTPacket.c
SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTSerializePublish.c
SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTSubscribeClient.c
SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTSubscribeServer.c
SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTUnsubscribeClient.c
SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTUnsubscribeServer.c
SRC_C += ../../../component/soc/realtek/8195a/misc/platform/ota_8195a.c
SRC_C += ../../../component/common/api/network/src/ping_test.c
SRC_C += ../../../component/common/utilities/ssl_client.c
SRC_C += ../../../component/common/utilities/ssl_client_ext.c
SRC_C += ../../../component/common/utilities/tcptest.c
SRC_C += ../../../component/common/application/uart_adapter/uart_adapter.c
SRC_C += ../../../component/common/api/network/src/wlan_network.c
#network - lwip
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/api/api_lib.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/api/api_msg.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/api/err.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/api/netbuf.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/api/netdb.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/api/netifapi.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/api/sockets.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/api/tcpip.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/autoip.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/icmp.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/igmp.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/inet.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/inet_chksum.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/ip.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/ip_addr.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/ip_frag.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/def.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/dhcp.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/dns.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/init.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/lwip_timers.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/mem.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/memp.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/netif.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/pbuf.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/raw.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/stats.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/sys.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/tcp.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/tcp_in.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/tcp_out.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/core/udp.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/src/netif/etharp.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/port/realtek/freertos/ethernetif.c
SRC_C += ../../../component/common/drivers/wlan/realtek/src/osdep/lwip_intf.c
SRC_C += ../../../component/common/network/lwip/lwip_v1.4.1/port/realtek/freertos/sys_arch.c
SRC_C += ../../../component/common/network/dhcp/dhcps.c
SRC_C += ../../../component/common/network/sntp/sntp.c
#network - httpc
SRC_C += ../../../component/common/network/httpc/httpc_tls.c
#network - httpd
SRC_C += ../../../component/common/network/httpd/httpd_tls.c
#network - mdns
SRC_C += ../../../component/common/network/mDNS/mDNSPlatform.c
#network - wsclient
SRC_C += ../../../component/common/network/websocket/wsclient_tls.c
#os - freertos
SRC_C += ../../../component/os/freertos/freertos_v8.1.2/Source/portable/MemMang/heap_5.c
SRC_C += ../../../component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM3/port.c
SRC_C += ../../../component/os/freertos/cmsis_os.c
SRC_C += ../../../component/os/freertos/freertos_v8.1.2/Source/croutine.c
SRC_C += ../../../component/os/freertos/freertos_v8.1.2/Source/event_groups.c
SRC_C += ../../../component/os/freertos/freertos_v8.1.2/Source/list.c
SRC_C += ../../../component/os/freertos/freertos_v8.1.2/Source/queue.c
SRC_C += ../../../component/os/freertos/freertos_v8.1.2/Source/tasks.c
SRC_C += ../../../component/os/freertos/freertos_v8.1.2/Source/timers.c
#os - osdep
SRC_C += ../../../component/os/os_dep/device_lock.c
SRC_C += ../../../component/os/freertos/freertos_service.c
SRC_C += ../../../component/soc/realtek/8195a/misc/os/mailbox.c
SRC_C += ../../../component/soc/realtek/8195a/misc/os/osdep_api.c
SRC_C += ../../../component/os/os_dep/osdep_service.c
SRC_C += ../../../component/os/os_dep/tcm_heap.c
#peripheral - api
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/analogin_api.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/dma_api.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/efuse_api.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/ethernet_api.c
SRC_C += ../../../component/common/drivers/ethernet_mii/ethernet_mii.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/flash_api.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/gpio_api.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/gpio_irq_api.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/i2c_api.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/i2s_api.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/log_uart_api.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/nfc_api.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/pinmap.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/pinmap_common.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/port_api.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/pwmout_api.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/rtc_api.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/serial_api.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/sleep.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/spdio_api.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/spi_api.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/sys_api.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/timer_api.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/us_ticker.c
SRC_C += ../../../component/common/mbed/common/us_ticker_api.c
SRC_C += ../../../component/common/mbed/common/wait_api.c
SRC_C += ../../../component/common/mbed/targets/hal/rtl8195a/wdt_api.c
#peripheral - hal
SRC_C += ../../../component/soc/realtek/8195a/fwlib/src/hal_32k.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/src/hal_adc.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/src/hal_gdma.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/src/hal_gpio.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/src/hal_i2c.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/src/hal_i2s.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/src/hal_mii.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/src/hal_nfc.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/src/hal_pcm.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/src/hal_pwm.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/src/hal_sdr_controller.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/src/hal_ssi.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/src/hal_timer.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/src/hal_uart.c
#peripheral - rtl8195a
SRC_C += ../../../component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_adc.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_gdma.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_gpio.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_i2c.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_i2s.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_mii.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_nfc.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_pwm.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_ssi.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_timer.c
SRC_C += ../../../component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_uart.c
#peripheral - wlan
#all:SRC_C += ../../../component/common/drivers/wlan/realtek/src/core/option/rtw_opt_skbuf.c
#SDRAM
DRAM_C += ../../../component/common/api/platform/stdlib_patch.c
#SDRAM - polarssl
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/aes.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/aesni.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/arc4.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/asn1parse.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/asn1write.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/base64.c
SRC_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/bignum.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/blowfish.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/camellia.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/ccm.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/certs.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/cipher.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/cipher_wrap.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/ctr_drbg.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/debug.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/des.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/dhm.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/ecp.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/ecp_curves.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/ecdh.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/ecdsa.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/entropy.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/entropy_poll.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/error.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/gcm.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/havege.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/hmac_drbg.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/md.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/md_wrap.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/md2.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/md4.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/md5.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/memory_buffer_alloc.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/net.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/oid.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/padlock.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/pbkdf2.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/pem.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/pkcs5.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/pkcs11.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/pkcs12.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/pk.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/pk_wrap.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/pkparse.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/pkwrite.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/platform.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/ripemd160.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/rsa.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/sha1.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/sha256.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/sha512.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/ssl_cache.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/ssl_ciphersuites.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/ssl_cli.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/ssl_srv.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/ssl_tls.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/threading.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/timing.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/version.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/version_features.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/x509.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/x509_crt.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/x509_crl.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/x509_csr.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/x509_create.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/x509write_crt.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/x509write_csr.c
DRAM_C += ../../../component/common/network/ssl/polarssl-1.3.8/library/xtea.c
#SDRAM - mbedtls
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/aes.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/aesni.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/arc4.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/asn1parse.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/asn1write.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/base64.c
#SRC_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/bignum.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/blowfish.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/camellia.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/ccm.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/certs.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/cipher.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/cipher_wrap.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/ctr_drbg.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/debug.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/des.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/dhm.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/ecp.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/ecp_curves.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/ecdh.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/ecdsa.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/entropy.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/entropy_poll.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/error.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/gcm.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/havege.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/hmac_drbg.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/md.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/md_wrap.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/md2.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/md4.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/md5.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/memory_buffer_alloc.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/net_sockets.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/oid.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/padlock.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/pem.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/pkcs5.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/pkcs11.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/pkcs12.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/pk.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/pk_wrap.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/pkparse.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/pkwrite.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/platform.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/ripemd160.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/rsa.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/sha1.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/sha256.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/sha512.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/ssl_cache.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/ssl_ciphersuites.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/ssl_cli.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/ssl_srv.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/ssl_tls.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/threading.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/timing.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/version.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/version_features.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/x509.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/x509_crt.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/x509_crl.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/x509_csr.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/x509_create.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/x509write_crt.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/x509write_csr.c
#DRAM_C += ../../../component/common/network/ssl/mbedtls-2.4.0/library/xtea.c
#SDRAM - ssl_ram_map
DRAM_C += ../../../component/common/network/ssl/ssl_ram_map/rom/rom_ssl_ram_map.c
DRAM_C += ../../../component/common/network/ssl/ssl_ram_map/ssl_ram_map.c
#utilities
SRC_C += ../../../component/common/utilities/cJSON.c
SRC_C += ../../../component/common/utilities/http_client.c
SRC_C += ../../../component/common/utilities/uart_socket.c
SRC_C += ../../../component/common/utilities/webserver.c
SRC_C += ../../../component/common/utilities/xml.c
#utilities - example
SRC_C += ../../../component/common/example/mqtt/example_mqtt.c
SRC_C += ../../../component/common/example/bcast/example_bcast.c
SRC_C += ../../../component/common/example/eap/example_eap.c
SRC_C += ../../../component/common/example/example_entry.c
SRC_C += ../../../component/common/example/dct/example_dct.c
SRC_C += ../../../component/common/example/get_beacon_frame/example_get_beacon_frame.c
SRC_C += ../../../component/common/example/high_load_memory_use/example_high_load_memory_use.c
SRC_C += ../../../component/common/example/http_client/example_http_client.c
SRC_C += ../../../component/common/example/http_download/example_http_download.c
SRC_C += ../../../component/common/example/httpc/example_httpc.c
SRC_C += ../../../component/common/example/httpd/example_httpd.c
SRC_C += ../../../component/common/example/mcast/example_mcast.c
SRC_C += ../../../component/common/example/mdns/example_mdns.c
SRC_C += ../../../component/common/example/nonblock_connect/example_nonblock_connect.c
SRC_C += ../../../component/common/example/sntp_showtime/example_sntp_showtime.c
SRC_C += ../../../component/common/example/socket_select/example_socket_select.c
SRC_C += ../../../component/common/example/socket_tcp_trx/example_socket_tcp_trx_1.c
SRC_C += ../../../component/common/example/socket_tcp_trx/example_socket_tcp_trx_2.c
SRC_C += ../../../component/common/example/ssl_download/example_ssl_download.c
SRC_C += ../../../component/common/example/ssl_server/example_ssl_server.c
SRC_C += ../../../component/common/example/tcp_keepalive/example_tcp_keepalive.c
SRC_C += ../../../component/common/example/uart_atcmd/example_uart_atcmd.c
#SRC_C += ../../../component/common/example/uart_firmware_update/example_uart_update.c
SRC_C += ../../../component/common/example/wlan_fast_connect/example_wlan_fast_connect.c
SRC_C += ../../../component/common/example/wlan_scenario/example_wlan_scenario.c
SRC_C += ../../../component/common/example/websocket/example_wsclient.c
SRC_C += ../../../component/common/example/xml/example_xml.c
#utilities - xmodme update
SRC_C += ../../../component/common/application/xmodem/uart_fw_update.c
#user
SRC_C += ../src/main.c
# Generate obj list
# -------------------------------------------------------------------
SRC_O = $(patsubst %.c,%.o,$(SRC_C))
DRAM_O = $(patsubst %.c,%.o,$(DRAM_C))
SRC_C_LIST = $(notdir $(SRC_C)) $(notdir $(DRAM_C))
OBJ_LIST = $(addprefix $(OBJ_DIR)/,$(patsubst %.c,%.o,$(SRC_C_LIST)))
DEPENDENCY_LIST = $(addprefix $(OBJ_DIR)/,$(patsubst %.c,%.d,$(SRC_C_LIST)))
# Compile options
# -------------------------------------------------------------------
CFLAGS =
CFLAGS += -DM3 -DCONFIG_PLATFORM_8195A -DGCC_ARMCM3
CFLAGS += -mcpu=cortex-m3 -mthumb -g2 -w -O2 -Wno-pointer-sign -fno-common -fmessage-length=0 -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-short-enums -DF_CPU=166000000L -std=gnu99 -fsigned-char
LFLAGS =
LFLAGS += -mcpu=cortex-m3 -mthumb -g --specs=nano.specs -nostartfiles -Wl,-Map=$(BIN_DIR)/application.map -Os -Wl,--gc-sections -Wl,--cref -Wl,--entry=Reset_Handler -Wl,--no-enum-size-warning -Wl,--no-wchar-size-warning
LFLAGS += -Wl,-wrap,malloc -Wl,-wrap,free -Wl,-wrap,realloc
LIBFLAGS =
all: LIBFLAGS += -L../../../component/soc/realtek/8195a/misc/bsp/lib/common/GCC/ -l_platform -l_wlan -l_http -l_dct -l_wps -l_rtlstd -l_websocket -l_xmodem -lm -lc -lnosys -lgcc
mp: LIBFLAGS += -L../../../component/soc/realtek/8195a/misc/bsp/lib/common/GCC/ -l_platform -l_wlan_mp -l_p2p -l_wps -l_rtlstd -l_dct -l_websocket -l_xmodem -lm -lc -lnosys -lgcc
RAMALL_BIN =
OTA_BIN =
all: RAMALL_BIN = ram_all.bin
all: OTA_BIN = ota.bin
mp: RAMALL_BIN = ram_all_mp.bin
mp: OTA_BIN = ota_mp.bin
# Compile
# -------------------------------------------------------------------
.PHONY: application
application: prerequirement build_info $(SRC_O) $(DRAM_O)
$(LD) $(LFLAGS) -o $(BIN_DIR)/$(TARGET).axf $(OBJ_LIST) $(OBJ_DIR)/ram_1.r.o $(LIBFLAGS) -T./rlx8195A-symbol-v02-img2.ld
$(OBJDUMP) -d $(BIN_DIR)/$(TARGET).axf > $(BIN_DIR)/$(TARGET).asm
# Manipulate Image
# -------------------------------------------------------------------
.PHONY: manipulate_images
manipulate_images:
@echo ===========================================================
@echo Image manipulating
@echo ===========================================================
$(NM) $(BIN_DIR)/$(TARGET).axf | sort > $(BIN_DIR)/$(TARGET).nmap
$(OBJCOPY) -j .image2.start.table -j .ram_image2.text -j .ram_image2.rodata -j .ram.data -Obinary $(BIN_DIR)/$(TARGET).axf $(BIN_DIR)/ram_2.bin
$(OBJCOPY) -j .sdr_text -j .sdr_rodata -j .sdr_data -Obinary $(BIN_DIR)/$(TARGET).axf $(BIN_DIR)/sdram.bin
cp ../../../component/soc/realtek/8195a/misc/bsp/image/ram_1.p.bin $(BIN_DIR)/ram_1.p.bin
chmod 777 $(BIN_DIR)/ram_1.p.bin
chmod +rx $(PICK) $(CHKSUM) $(PAD)
$(PICK) 0x`grep __ram_image2_text_start__ $(BIN_DIR)/$(TARGET).nmap | gawk '{print $$1}'` 0x`grep __ram_image2_text_end__ $(BIN_DIR)/$(TARGET).nmap | gawk '{print $$1}'` $(BIN_DIR)/ram_2.bin $(BIN_DIR)/ram_2.p.bin body+reset_offset+sig
$(PICK) 0x`grep __ram_image2_text_start__ $(BIN_DIR)/$(TARGET).nmap | gawk '{print $$1}'` 0x`grep __ram_image2_text_end__ $(BIN_DIR)/$(TARGET).nmap | gawk '{print $$1}'` $(BIN_DIR)/ram_2.bin $(BIN_DIR)/ram_2.ns.bin body+reset_offset
$(PICK) 0x`grep __sdram_data_start__ $(BIN_DIR)/$(TARGET).nmap | gawk '{print $$1}'` 0x`grep __sdram_data_end__ $(BIN_DIR)/$(TARGET).nmap | gawk '{print $$1}'` $(BIN_DIR)/sdram.bin $(BIN_DIR)/ram_3.p.bin body+reset_offset
$(PAD) 44k 0xFF $(BIN_DIR)/ram_1.p.bin
cat $(BIN_DIR)/ram_1.p.bin > $(BIN_DIR)/$(RAMALL_BIN)
chmod 777 $(BIN_DIR)/$(RAMALL_BIN)
cat $(BIN_DIR)/ram_2.p.bin >> $(BIN_DIR)/$(RAMALL_BIN)
if [ -s $(BIN_DIR)/sdram.bin ]; then cat $(BIN_DIR)/ram_3.p.bin >> $(BIN_DIR)/$(RAMALL_BIN); fi
cat $(BIN_DIR)/ram_2.ns.bin > $(BIN_DIR)/$(OTA_BIN)
chmod 777 $(BIN_DIR)/$(OTA_BIN)
if [ -s $(BIN_DIR)/sdram.bin ]; then cat $(BIN_DIR)/ram_3.p.bin >> $(BIN_DIR)/$(OTA_BIN); fi
$(CHKSUM) $(BIN_DIR)/$(OTA_BIN) || true
rm $(BIN_DIR)/ram_*.p.bin $(BIN_DIR)/ram_*.ns.bin
# Generate build info
# -------------------------------------------------------------------
.PHONY: build_info
build_info:
@echo \#define UTS_VERSION \"`date +%Y/%m/%d-%T`\" > .ver
@echo \#define RTL8195AFW_COMPILE_TIME \"`date +%Y/%m/%d-%T`\" >> .ver
@echo \#define RTL8195AFW_COMPILE_DATE \"`date +%Y%m%d`\" >> .ver
@echo \#define RTL8195AFW_COMPILE_BY \"`id -u -n`\" >> .ver
@echo \#define RTL8195AFW_COMPILE_HOST \"`$(HOSTNAME_APP)`\" >> .ver
@if [ -x /bin/dnsdomainname ]; then \
echo \#define RTL8195AFW_COMPILE_DOMAIN \"`dnsdomainname`\"; \
elif [ -x /bin/domainname ]; then \
echo \#define RTL8195AFW_COMPILE_DOMAIN \"`domainname`\"; \
else \
echo \#define RTL8195AFW_COMPILE_DOMAIN ; \
fi >> .ver
@echo \#define RTL195AFW_COMPILER \"gcc `$(CC) $(CFLAGS) -dumpversion | tr --delete '\r'`\" >> .ver
@mv -f .ver ../inc/$@.h
.PHONY: prerequirement
prerequirement:
@echo ===========================================================
@echo Build $(TARGET)
@echo ===========================================================
mkdir -p $(OBJ_DIR)
mkdir -p $(BIN_DIR)
cp ../../../component/soc/realtek/8195a/misc/bsp/image/ram_1.r.bin $(OBJ_DIR)/ram_1.r.bin
chmod 777 $(OBJ_DIR)/ram_1.r.bin
$(OBJCOPY) --rename-section .data=.loader.data,contents,alloc,load,readonly,data -I binary -O elf32-littlearm -B arm $(OBJ_DIR)/ram_1.r.bin $(OBJ_DIR)/ram_1.r.o
$(SRC_O): %.o : %.c
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
$(CC) $(CFLAGS) $(INCLUDES) -c $< -MM -MT $@ -MF $(OBJ_DIR)/$(notdir $(patsubst %.o,%.d,$@))
cp $@ $(OBJ_DIR)/$(notdir $@)
chmod 777 $(OBJ_DIR)/$(notdir $@)
$(DRAM_O): %.o : %.c
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
$(OBJCOPY) --prefix-alloc-sections .sdram $@
$(CC) $(CFLAGS) $(INCLUDES) -c $< -MM -MT $@ -MF $(OBJ_DIR)/$(notdir $(patsubst %.o,%.d,$@))
cp $@ $(OBJ_DIR)/$(notdir $@)
chmod 777 $(OBJ_DIR)/$(notdir $@)
-include $(DEPENDENCY_LIST)
# Generate build info
# -------------------------------------------------------------------
#ifeq (setup,$(firstword $(MAKECMDGOALS)))
# # use the rest as arguments for "run"
# RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
# # ...and turn them into do-nothing targets
# $(eval $(RUN_ARGS):;@:)
#endif
.PHONY: setup
setup:
@echo "----------------"
@echo Setup $(GDB_SERVER)
@echo "----------------"
ifeq ($(GDB_SERVER), openocd)
cp -p $(FLASH_TOOLDIR)/rtl_gdb_debug_openocd.txt $(FLASH_TOOLDIR)/rtl_gdb_debug.txt
cp -p $(FLASH_TOOLDIR)/rtl_gdb_ramdebug_openocd.txt $(FLASH_TOOLDIR)/rtl_gdb_ramdebug.txt
cp -p $(FLASH_TOOLDIR)/rtl_gdb_flash_write_openocd.txt $(FLASH_TOOLDIR)/rtl_gdb_flash_write.txt
else
cp -p $(FLASH_TOOLDIR)/rtl_gdb_debug_jlink.txt $(FLASH_TOOLDIR)/rtl_gdb_debug.txt
cp -p $(FLASH_TOOLDIR)/rtl_gdb_ramdebug_jlink.txt $(FLASH_TOOLDIR)/rtl_gdb_ramdebug.txt
cp -p $(FLASH_TOOLDIR)/rtl_gdb_flash_write_jlink.txt $(FLASH_TOOLDIR)/rtl_gdb_flash_write.txt
endif
.PHONY: flashburn
flashburn:
@if [ ! -f $(FLASH_TOOLDIR)/rtl_gdb_flash_write.txt ] ; then echo Please do \"make setup GDB_SERVER=[jlink or openocd]\" first; echo && false ; fi
ifeq ($(findstring CYGWIN, $(OS)), CYGWIN)
$(FLASH_TOOLDIR)/Check_Jtag.sh
endif
cp $(FLASH_TOOLDIR)/target_NORMALB.axf $(FLASH_TOOLDIR)/target_NORMAL.axf
chmod 777 $(FLASH_TOOLDIR)/target_NORMAL.axf
chmod +rx $(FLASH_TOOLDIR)/SetupGDB_NORMAL.sh
$(FLASH_TOOLDIR)/SetupGDB_NORMAL.sh
$(GDB) -x $(FLASH_TOOLDIR)/rtl_gdb_flash_write.txt
.PHONY: debug
debug:
@if [ ! -f $(FLASH_TOOLDIR)/rtl_gdb_debug.txt ] ; then echo Please do \"make setup GDB_SERVER=[jlink or openocd]\" first; echo && false ; fi
ifeq ($(findstring CYGWIN, $(OS)), CYGWIN)
$(FLASH_TOOLDIR)/Check_Jtag.sh
cmd /c start $(GDB) -x $(FLASH_TOOLDIR)/rtl_gdb_debug.txt
else
$(GDB) -x $(FLASH_TOOLDIR)/rtl_gdb_debug.txt
endif
.PHONY: ramdebug
ramdebug:
@if [ ! -f $(FLASH_TOOLDIR)/rtl_gdb_ramdebug.txt ] ; then echo Please do \"make setup GDB_SERVER=[jlink or openocd]\" first; echo && false ; fi
ifeq ($(findstring CYGWIN, $(OS)), CYGWIN)
$(FLASH_TOOLDIR)/Check_Jtag.sh
cmd /c start $(GDB) -x $(FLASH_TOOLDIR)/rtl_gdb_ramdebug.txt
else
$(GDB) -x $(FLASH_TOOLDIR)/rtl_gdb_ramdebug.txt
endif
.PHONY: clean
clean:
rm -rf $(TARGET)
rm -f $(SRC_O) $(DRAM_O)
rm -f $(patsubst %.o,%.d,$(SRC_O)) $(patsubst %.o,%.d,$(DRAM_O))

View file

@ -0,0 +1,238 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.debug.233562530">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.debug.233562530" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}.axf" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser" id="cdt.managedbuild.config.gnu.cross.exe.debug.233562530" name="Debug" parent="cdt.managedbuild.config.gnu.cross.exe.debug" postannouncebuildStep="" postbuildStep="${workspace_loc:/${ProjName}}\..\..\..\..\..\component\soc\realtek\8195a\misc\gcc_utility\eclipse\postbuild_eclipse_win.bat" preannouncebuildStep="" prebuildStep="${workspace_loc:/${ProjName}}\..\..\..\..\..\component\soc\realtek\8195a\misc\gcc_utility\eclipse\prebuild_eclipse_win.bat">
<folderInfo id="cdt.managedbuild.config.gnu.cross.exe.debug.233562530." name="/" resourcePath="">
<toolChain errorParsers="" id="cdt.managedbuild.toolchain.gnu.cross.exe.debug.1169350624" name="Cross GCC" nonInternalBuilderId="cdt.managedbuild.builder.gnu.cross" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.debug">
<option id="cdt.managedbuild.option.gnu.cross.prefix.1597317785" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix" value="arm-none-eabi-" valueType="string"/>
<option id="cdt.managedbuild.option.gnu.cross.path.1973235689" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path" value="..\..\..\..\..\..\tools\arm-none-eabi-gcc\4_8-2014q3\bin" valueType="string"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.2045180611" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
<builder autoBuildTarget="all" buildPath="${workspace_loc:/application}/Debug" cleanBuildTarget="clean" enableAutoBuild="false" enableCleanBuild="true" enabledIncrementalBuild="true" id="cdt.managedbuild.builder.gnu.cross.656200880" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="false" superClass="cdt.managedbuild.builder.gnu.cross"/>
<tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GCCErrorParser" id="cdt.managedbuild.tool.gnu.cross.c.compiler.904693797" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.934720631" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.c.optimization.level.more" valueType="enumerated"/>
<option id="gnu.c.compiler.option.debugging.level.329395419" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.default" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.1112230155" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;..\..\..\..\inc&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\soc\realtek\common\bsp&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\os\freertos&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\os\freertos\freertos_v8.1.2\Source\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\os\freertos\freertos_v8.1.2\Source\portable\GCC\ARM_CM3&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\os\os_dep\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\soc\realtek\8195a\misc\driver&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\soc\realtek\8195a\misc\os&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\api\network\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\api&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\api\platform&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\api\wifi&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\api\wifi\rtw_wpa_supplicant\src&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\application&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\application\iotdemokit&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\application\google&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\media\framework&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\example&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\example\wlan_fast_connect&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\mbed\api&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\mbed\hal&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\mbed\hal_ext&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\mbed\targets\hal\rtl8195a&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\network&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\network\lwip\lwip_v1.4.1\port\realtek\freertos&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\network\lwip\lwip_v1.4.1\src\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\network\lwip\lwip_v1.4.1\src\include\lwip&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\network\lwip\lwip_v1.4.1\src\include\ipv4&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\network\lwip\lwip_v1.4.1\port\realtek&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\test&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\soc\realtek\8195a\cmsis&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\soc\realtek\8195a\cmsis\device&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\soc\realtek\8195a\fwlib&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\soc\realtek\8195a\fwlib\rtl8195a&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\soc\realtek\8195a\misc\platform&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\soc\realtek\8195a\misc\rtl_std_lib\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\drivers\wlan\realtek\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\drivers\wlan\realtek\src\osdep&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\drivers\wlan\realtek\src\hci&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\drivers\wlan\realtek\src\hal&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\drivers\wlan\realtek\src\hal\OUTSRC&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\soc\realtek\8195a\fwlib\ram_lib\wlan\realtek\wlan_ram_map\rom&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\network\ssl\polarssl-1.3.8\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\network\ssl\mbedtls-2.4.0\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\network\ssl\ssl_ram_map\rom&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\utilities&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\soc\realtek\8195a\misc\rtl_std_lib\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\application\apple\WACServer\External\Curve25519&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\application\apple\WACServer\External\GladmanAES&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\soc\realtek\8195a\fwlib\ram_lib\usb_otg\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\video\v4l2\inc&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\media\rtp_codec&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\drivers\usb_class\host\uvc\inc&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\drivers\usb_class\device&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\drivers\usb_class\device\class&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\file_system\fatfs&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\file_system\fatfs\r0.10c\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\drivers\sdio\realtek\sdio_host\inc&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\audio&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\drivers\i2s&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\application\xmodem&quot;"/>
<listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\component\common\application\mqtt\MQTTClient&quot;"/>
</option>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.306601635" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="GCC_ARMCM3"/>
<listOptionValue builtIn="false" value="M3"/>
<listOptionValue builtIn="false" value="CONFIG_PLATFORM_8195A"/>
<listOptionValue builtIn="false" value="F_CPU=166000000L"/>
</option>
<option id="gnu.c.compiler.option.dialect.std.1073489747" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>
<option id="gnu.c.compiler.option.misc.other.2024681205" name="Other flags" superClass="gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-Wno-pointer-sign -fno-common -fmessage-length=0 -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-short-enums -fsigned-char " valueType="string"/>
<option id="gnu.c.compiler.option.warnings.allwarn.174723009" name="All warnings (-Wall)" superClass="gnu.c.compiler.option.warnings.allwarn" useByScannerDiscovery="false" value="false" valueType="boolean"/>
<option id="gnu.c.compiler.option.dialect.flags.1987751713" name="Other dialect flags" superClass="gnu.c.compiler.option.dialect.flags" useByScannerDiscovery="true" value="-c -mcpu=cortex-m3 -mthumb -std=gnu99" valueType="string"/>
<option id="gnu.c.compiler.option.include.files.1343946597" name="Include files (-include)" superClass="gnu.c.compiler.option.include.files" useByScannerDiscovery="false"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1509243327" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1630876312" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
<option id="gnu.cpp.compiler.option.optimization.level.213766757" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.debugging.level.1719565643" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
</tool>
<tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GLDErrorParser" id="cdt.managedbuild.tool.gnu.cross.c.linker.71526270" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker">
<option id="gnu.c.link.option.nostart.448966127" name="Do not use standard start files (-nostartfiles)" superClass="gnu.c.link.option.nostart" value="true" valueType="boolean"/>
<option id="gnu.c.link.option.ldflags.933014143" name="Linker flags" superClass="gnu.c.link.option.ldflags" value="-mcpu=cortex-m3 -mthumb --specs=nano.specs -Wl,-Map=application.map -Wl,--gc-sections -Wl,--cref -Wl,--entry=Reset_Handler -Wl,--no-enum-size-warning -Wl,--no-wchar-size-warning -Wl,-wrap,malloc -Wl,-wrap,free -Wl,-wrap,realloc ram_1.r.o -T./rlx8195A-symbol-v02-img2.ld" valueType="string"/>
<option id="gnu.c.link.option.other.1009721268" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other"/>
<option id="gnu.c.link.option.userobjs.14403344" name="Other objects" superClass="gnu.c.link.option.userobjs"/>
<option id="gnu.c.link.option.nostdlibs.477235517" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
<option id="gnu.c.link.option.nodeflibs.939985885" name="Do not use default libraries (-nodefaultlibs)" superClass="gnu.c.link.option.nodeflibs" value="true" valueType="boolean"/>
<option id="gnu.c.link.option.paths.2128692220" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}\..\..\..\..\..\component\soc\realtek\8195a\misc\bsp\lib\common\GCC&quot;"/>
</option>
<option id="gnu.c.link.option.libs.177373024" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="_websocket"/>
<listOptionValue builtIn="false" value="_wlan"/>
<listOptionValue builtIn="false" value="_http"/>
<listOptionValue builtIn="false" value="_wps"/>
<listOptionValue builtIn="false" value="_xmodem"/>
<listOptionValue builtIn="false" value="_platform"/>
<listOptionValue builtIn="false" value="_rtlstd"/>
<listOptionValue builtIn="false" value="m"/>
<listOptionValue builtIn="false" value="c"/>
<listOptionValue builtIn="false" value="nosys"/>
<listOptionValue builtIn="false" value="gcc"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1500522007" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1487592415" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker"/>
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.1005577243" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
<tool command="as" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.tool.gnu.cross.assembler.1786675029" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.581239999" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<folderInfo id="cdt.managedbuild.config.gnu.cross.exe.debug.233562530.546134864" name="/" resourcePath="SDRAM">
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.debug.1058008574" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.debug" unusedChildren="">
<option id="cdt.managedbuild.option.gnu.cross.prefix.1597317785.1721857623" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix.1597317785"/>
<option id="cdt.managedbuild.option.gnu.cross.path.1973235689.1970837964" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path.1973235689"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
<tool commandLinePattern="../../../../../../component/soc/realtek/8195a/misc/gcc_utility/eclipse/compile_dram_eclipse_win.bat ${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.cross.c.compiler.822931958" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler.904693797">
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1363728118" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1557117870" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1630876312"/>
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.382249377" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker.71526270"/>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1770661931" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker.1487592415"/>
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.1908859001" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver.1005577243"/>
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.350135863" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler.1786675029">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1411086864" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="utilities/example/example_wifi_manager.c|utilities/example/example_uart_update.c|utilities/example/example_media_ss.c|utilities/example/example_media_ms.c|utilities/example/example_mqtt.c|network/ssl/mbedtls|SDRAM/ssl/mbedtls|lib|peripheral/wlan/rtw_opt_skbuf.c|network/api/wifi/rtw_wowlan" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.release.1939953489">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.release.1939953489" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.release.1939953489" name="Release" parent="cdt.managedbuild.config.gnu.cross.exe.release">
<folderInfo id="cdt.managedbuild.config.gnu.cross.exe.release.1939953489." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.release.1548075892" name="Cross GCC" nonInternalBuilderId="cdt.managedbuild.builder.gnu.cross" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.release">
<option id="cdt.managedbuild.option.gnu.cross.prefix.904613979" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix" value="arm-none-eabi-" valueType="string"/>
<option id="cdt.managedbuild.option.gnu.cross.path.1307965995" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path" value="PROJ_LOC\..\..\..\..\..\..\..\tools\arm-none-eabi-gcc\4_8-2014q3\bin" valueType="string"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.607588685" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
<builder autoBuildTarget="all" buildPath="${workspace_loc:/application}/Release" cleanBuildTarget="clean" id="org.eclipse.cdt.build.core.internal.builder.1644497881" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="org.eclipse.cdt.build.core.internal.builder"/>
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.1799599761" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.856178341" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option id="gnu.c.compiler.option.debugging.level.910220163" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1494998038" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1615056733" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
<option id="gnu.cpp.compiler.option.optimization.level.912343351" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.debugging.level.543952949" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.1024518509" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker">
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1986375720" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1443953464" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker"/>
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.2058838566" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.124350375" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1842111070" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="peripheral/wlan/rtw_opt_skbuf.c|network/api/wifi/rtw_wowlan" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="application.cdt.managedbuild.target.gnu.cross.exe.2144517394" name="Executable" projectType="cdt.managedbuild.target.gnu.cross.exe"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.1939953489;cdt.managedbuild.config.gnu.cross.exe.release.1939953489.;cdt.managedbuild.tool.gnu.cross.c.compiler.1799599761;cdt.managedbuild.tool.gnu.c.compiler.input.1494998038">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.233562530;cdt.managedbuild.config.gnu.cross.exe.debug.233562530.;cdt.managedbuild.tool.gnu.cross.c.compiler.904693797;cdt.managedbuild.tool.gnu.c.compiler.input.1509243327">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/application"/>
</configuration>
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/application"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cproject>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.cdt.debug.gdbjtag.launchConfigurationType">
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.connection" value="gdb:%7C%20openocd%20--pipe#"/>
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.delay" value="3"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageFileName" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageOffset" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value="set verbose off&#13;&#10;&#10;set complaints 0&#13;&#10;&#10;set confirm off&#13;&#10;&#10;set exec-done-display off&#13;&#10;&#10;show exec-done-display&#13;&#10;&#10;set trace-commands off&#13;&#10;&#10;&#10;set debug displaced off&#13;&#10;&#10;set debug expression 0&#13;&#10;&#10;set debug frame 0&#13;&#10;&#10;set debug infrun 0&#13;&#10;&#10;set debug observer 0&#13;&#10;&#10;set debug overload 0&#13;&#10;&#10;set debugvarobj 0&#13;&#10;&#10;set pagination off&#10;&#13;&#10;set print address off&#13;&#10;&#10;set print symbol-filename off&#13;&#10;&#10;set print symbol off&#10;&#13;&#10;set print pretty off&#13;&#10;&#10;set print object off&#13;&#10;&#10;&#10;set debug parser off&#13;&#10;&#10;set debug remote 0&#13;&#10;monitor reset 1&#13;&#10;monitor sleep 20&#13;&#10;&#10;monitor clrbp&#13;&#10;monitor MemU32 0x40000014=0x00000021&#13;&#10;&#10;monitor sleep 10&#10;&#13;&#10;monitor MemU32 0x40000304=0x1fc00002&#9;&#13;&#10;monitor sleep 10&#13;&#10;&#10;monitor MemU32 0x40000250=0x00000400&#13;&#10;&#10;monitor sleep 10&#13;&#10;&#10;monitor MemU32 0x40000340=0x00000000&#13;&#10;&#10;monitor sleep 10&#13;&#10;&#10;monitor MemU32 0x40000230=0x0000dcc4&#13;&#10;&#10;monitor sleep 10&#13;&#10;&#10;monitor MemU32 0x40000210=0x00011117&#13;&#10;&#10;monitor sleep 10&#10;&#13;&#10;monitor MemU32 0x40000210=0x00011157&#10;&#13;&#10;monitor sleep 10&#13;&#10;&#10;monitor MemU32 0x400002c0=0x00110011&#10;&#13;&#10;monitor sleep 10&#13;&#10;&#10;monitor MemU32 0x40000320=0xffffffff&#13;&#10;&#10;monitor sleep 10&#13;&#10;monitor MemU32 0x40000040=0x00fcc702&#13;&#10;&#10;monitor sleep 10&#13;&#10;&#10;monitor MemU32 0x40000040&#10;&#13;&#10;monitor MemU32 0x40005224=0x00000001&#10;&#13;&#10;monitor sleep 10&#13;&#10;&#10;monitor MemU32 0x40005004=0x00000208&#13;&#10;&#10;monitor sleep 10&#13;&#10;&#10;monitor MemU32 0x40005008=0xffffd000&#13;&#10;&#10;monitor sleep 13&#10;&#13;&#10;monitor MemU32 0x40005020=0x00000022&#10;&#13;&#10;monitor sleep 13&#10;&#13;&#10;monitor MemU32 0x40005010=0x09006201&#13;&#10;&#10;monitor sleep 13&#13;&#10;&#10;monitor MemU32 0x40005014=0x00002611&#13;&#10;&#10;monitor sleep 13&#13;&#10;&#10;monitor MemU32 0x40005018=0x00068413&#13;&#10;&#10;monitor sleep 13&#13;&#10;&#10;monitor MemU32 0x4000501c=0x00000042&#13;&#10;&#10;monitor sleep 13&#10;&#13;&#10;monitor MemU32 0x4000500c=0x700&#13;&#10;&#10;monitor sleep 20&#10;&#13;&#10;monitor MemU32 0x40005000=0x1&#13;&#10;&#10;monitor sleep 100&#10;&#13;&#10;monitor MemU32 0x40005000&#13;&#10;&#10;monitor MemU32 0x4000500c=0x600&#13;&#10;&#10;monitor sleep 30&#13;&#10;&#10;&#10;monitor MemU32 0x40005008=0x00000000&#9;&#10;&#13;&#10;monitor sleep 3&#13;&#10;&#10;monitor MemU32 0x40000300=0x0006005e&#9;&#13;&#10;&#10;monitor sleep 3"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDevice" value="Generic TCP/IP"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadImage" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadSymbols" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="2331"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value="monitor MemU32 0x40000210=0x8011157&#13;&#10;continue"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsFileName" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsOffset" value=""/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForImage" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForSymbols" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForImage" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForSymbols" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useRemoteTarget" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.mi.core.DEBUG_NAME" value="${workspace_loc:/application}\..\..\..\..\..\tools\arm-none-eabi-gcc\4_8-2014q3\bin\arm-none-eabi-gdb.exe"/>
<stringAttribute key="org.eclipse.cdt.debug.mi.core.commandFactory" value="Standard (Windows)"/>
<stringAttribute key="org.eclipse.cdt.debug.mi.core.protocol" value="mi"/>
<booleanAttribute key="org.eclipse.cdt.debug.mi.core.verboseMode" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="${workspace_loc:/application}\..\..\..\..\..\tools\arm-none-eabi-gcc\4_8-2014q3\bin\arm-none-eabi-gdb.exe"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug\application.axf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="application"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.config.gnu.cross.exe.debug.233562530"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/application"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<mapAttribute key="org.eclipse.debug.core.preferred_launchers"/>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;&#13;&#10;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
</launchConfiguration>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
</listAttribute>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/application}\..\..\..\..\..\component\soc\realtek\8195a\misc\gcc_utility\eclipse\SetupGDB_NORMAL.bat"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="jlink"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/application}"/>
</launchConfiguration>

View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.cdt.debug.gdbjtag.launchConfigurationType">
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.connection" value="gdb:%7C%20openocd%20--pipe#"/>
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.delay" value="3"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageFileName" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageOffset" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value="set verbose off&#13;&#10;set complaints 0&#13;&#10;set confirm off&#13;&#10;set exec-done-display off&#13;&#10;show exec-done-display&#13;&#10;set trace-commands off&#13;&#10;set debug displaced off &#13;&#10;set debug expression 0&#13;&#10;set debug frame 0&#13;&#10;set debug infrun 0&#13;&#10;set debug observer 0&#13;&#10;set debug overload 0&#13;&#10;set debugvarobj 0&#13;&#10;set pagination off&#13;&#10;set print address off&#13;&#10;set print symbol-filename off&#13;&#10;set print symbol off&#13;&#10;set print pretty off&#13;&#10;set print object off&#13;&#10;set debug parser off&#13;&#10;set debug remote 0&#13;&#10;monitor reset init&#13;&#10;monitor sleep 20&#13;&#10;monitor halt"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDevice" value="Generic TCP/IP"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadImage" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadSymbols" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="3333"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value="set {int}0x40000210=0x8011157&#13;&#10;continue"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsFileName" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsOffset" value=""/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForImage" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForSymbols" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForImage" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForSymbols" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useRemoteTarget" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.mi.core.DEBUG_NAME" value="${workspace_loc:/application}\..\..\..\..\..\tools\arm-none-eabi-gcc\4_8-2014q3\bin\arm-none-eabi-gdb.exe"/>
<stringAttribute key="org.eclipse.cdt.debug.mi.core.commandFactory" value="Standard (Windows)"/>
<stringAttribute key="org.eclipse.cdt.debug.mi.core.protocol" value="mi"/>
<booleanAttribute key="org.eclipse.cdt.debug.mi.core.verboseMode" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="${workspace_loc:/application}\..\..\..\..\..\tools\arm-none-eabi-gcc\4_8-2014q3\bin\arm-none-eabi-gdb.exe"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug\application.axf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="application"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.config.gnu.cross.exe.debug.233562530"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/application"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<mapAttribute key="org.eclipse.debug.core.preferred_launchers"/>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;&gt;&#13;&#10;&lt;gdbmemoryBlockExpression address=&quot;268449904&quot; label=&quot;pxCurrentTCB&quot;/&gt;&#13;&#10;&lt;/memoryBlockExpressionList&gt;&#13;&#10;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
</launchConfiguration>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
</listAttribute>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/application}\..\..\..\..\..\component\soc\realtek\8195a\misc\gcc_utility\eclipse\SetupGDB_NORMAL.bat"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="openocd"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/application}"/>
</launchConfiguration>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<configuration id="cdt.managedbuild.config.gnu.cross.exe.debug.233562530" name="Debug">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
</extension>
</configuration>
<configuration id="cdt.managedbuild.config.gnu.cross.exe.release.1939953489" name="Release">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
</extension>
</configuration>
</project>

View file

@ -0,0 +1,72 @@
eclipse.preferences.version=1
org.eclipse.cdt.codan.checkers.errnoreturn=Info
org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
org.eclipse.cdt.codan.checkers.errreturnvalue=Warning
org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.checkers.nocommentinside=-Error
org.eclipse.cdt.codan.checkers.nocommentinside.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.checkers.nolinecomment=-Error
org.eclipse.cdt.codan.checkers.nolinecomment.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.checkers.noreturn=Error
org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Info
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Info
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false}
org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning
org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},unknown\=>false,exceptions\=>()}
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning
org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},skip\=>true}
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=-Warning
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error
org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error
org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Info
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Info
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>()}
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Info
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},paramNot\=>false}
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Info
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},else\=>false,afterelse\=>false}
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=-Warning
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Info
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Info
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Info
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>("@(\#)","$Id")}
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=-Warning
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
useParentScope=false

View file

@ -0,0 +1,3 @@
eclipse.preferences.version=1
environment/project/cdt.managedbuild.config.gnu.cross.exe.debug.233562530/append=true
environment/project/cdt.managedbuild.config.gnu.cross.exe.debug.233562530/appendContributed=true

View file

@ -0,0 +1,21 @@
eclipse.preferences.version=1
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.233562530/CPATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.233562530/CPATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.233562530/C_INCLUDE_PATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.233562530/C_INCLUDE_PATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.233562530/append=true
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.233562530/appendContributed=true
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.release.1939953489/CPATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.release.1939953489/CPATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.release.1939953489/C_INCLUDE_PATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.release.1939953489/C_INCLUDE_PATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.release.1939953489/append=true
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.release.1939953489/appendContributed=true
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.cross.exe.debug.233562530/LIBRARY_PATH/delimiter=;
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.cross.exe.debug.233562530/LIBRARY_PATH/operation=remove
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.cross.exe.debug.233562530/append=true
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.cross.exe.debug.233562530/appendContributed=true
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.cross.exe.release.1939953489/LIBRARY_PATH/delimiter=;
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.cross.exe.release.1939953489/LIBRARY_PATH/operation=remove
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.cross.exe.release.1939953489/append=true
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.cross.exe.release.1939953489/appendContributed=true

View file

@ -0,0 +1,645 @@
SECTIONS
{
__vectors_table = 0x0;
Reset_Handler = 0x101;
NMI_Handler = 0x109;
HardFault_Handler = 0x10d;
MemManage_Handler = 0x121;
BusFault_Handler = 0x125;
UsageFault_Handler = 0x129;
HalLogUartInit = 0x201;
HalSerialGetcRtl8195a = 0x309;
HalSerialGetIsrEnRegRtl8195a = 0x329;
HalSerialSetIrqEnRegRtl8195a = 0x335;
HalCpuClkConfig = 0x341;
HalGetCpuClk = 0x355;
HalRomInfo = 0x39d;
HalGetRomInfo = 0x3b5;
HalResetVsr = 0x3c5;
HalDelayUs = 0x899;
HalNMIHandler = 0x8e1;
HalHardFaultHandler = 0x911;
HalMemManageHandler = 0xc09;
HalBusFaultHandler = 0xc39;
HalUsageFaultHandler = 0xc69;
HalUart0PinCtrlRtl8195A = 0xcfd;
HalUart1PinCtrlRtl8195A = 0xdc9;
HalUart2PinCtrlRtl8195A = 0xe9d;
HalSPI0PinCtrlRtl8195A = 0xf75;
HalSPI1PinCtrlRtl8195A = 0x1015;
HalSPI2PinCtrlRtl8195A = 0x10e5;
HalSPI0MCSPinCtrlRtl8195A = 0x11b5;
HalI2C0PinCtrlRtl8195A = 0x1275;
HalI2C1PinCtrlRtl8195A = 0x1381;
HalI2C2PinCtrlRtl8195A = 0x1459;
HalI2C3PinCtrlRtl8195A = 0x1529;
HalI2S0PinCtrlRtl8195A = 0x1639;
HalI2S1PinCtrlRtl8195A = 0x176d;
HalPCM0PinCtrlRtl8195A = 0x1845;
HalPCM1PinCtrlRtl8195A = 0x1949;
HalSDIODPinCtrlRtl8195A = 0x1a1d;
HalSDIOHPinCtrlRtl8195A = 0x1a6d;
HalMIIPinCtrlRtl8195A = 0x1ab9;
HalWLLEDPinCtrlRtl8195A = 0x1b51;
HalWLANT0PinCtrlRtl8195A = 0x1c0d;
HalWLANT1PinCtrlRtl8195A = 0x1c61;
HalWLBTCOEXPinCtrlRtl8195A = 0x1cb5;
HalWLBTCMDPinCtrlRtl8195A = 0x1d05;
HalNFCPinCtrlRtl8195A = 0x1d59;
HalPWM0PinCtrlRtl8195A = 0x1da9;
HalPWM1PinCtrlRtl8195A = 0x1ead;
HalPWM2PinCtrlRtl8195A = 0x1fb5;
HalPWM3PinCtrlRtl8195A = 0x20b1;
HalETE0PinCtrlRtl8195A = 0x21b9;
HalETE1PinCtrlRtl8195A = 0x22c1;
HalETE2PinCtrlRtl8195A = 0x23c9;
HalETE3PinCtrlRtl8195A = 0x24d1;
HalEGTIMPinCtrlRtl8195A = 0x25d9;
HalSPIFlashPinCtrlRtl8195A = 0x2679;
HalSDRPinCtrlRtl8195A = 0x2725;
HalJTAGPinCtrlRtl8195A = 0x280d;
HalTRACEPinCtrlRtl8195A = 0x2861;
HalLOGUartPinCtrlRtl8195A = 0x28b9;
HalLOGUartIRPinCtrlRtl8195A = 0x291d;
HalSICPinCtrlRtl8195A = 0x2981;
HalEEPROMPinCtrlRtl8195A = 0x29d9;
HalDEBUGPinCtrlRtl8195A = 0x2a31;
HalPinCtrlRtl8195A = 0x2b39;
SpicRxCmdRtl8195A = 0x2e5d;
SpicWaitBusyDoneRtl8195A = 0x2ea5;
SpicGetFlashStatusRtl8195A = 0x2eb5;
SpicWaitWipDoneRtl8195A = 0x2f55;
SpicTxCmdRtl8195A = 0x2f6d;
SpicSetFlashStatusRtl8195A = 0x2fc1;
SpicCmpDataForCalibrationRtl8195A = 0x3049;
SpicLoadInitParaFromClockRtl8195A = 0x3081;
SpicInitRtl8195A = 0x30e5;
SpicEraseFlashRtl8195A = 0x31bd;
SpiFlashApp = 0x3279;
HalPeripheralIntrHandle = 0x33b5;
HalSysOnIntrHandle = 0x3439;
HalWdgIntrHandle = 0x3485;
HalTimer0IntrHandle = 0x34d5;
HalTimer1IntrHandle = 0x3525;
HalI2C3IntrHandle = 0x3575;
HalTimer2To7IntrHandle = 0x35c5;
HalSpi0IntrHandle = 0x3615;
HalGpioIntrHandle = 0x3665;
HalUart0IntrHandle = 0x36b5;
HalSpiFlashIntrHandle = 0x3705;
HalUsbOtgIntrHandle = 0x3755;
HalSdioHostIntrHandle = 0x37a5;
HalI2s0OrPcm0IntrHandle = 0x37f5;
HalI2s1OrPcm1IntrHandle = 0x3845;
HalWlDmaIntrHandle = 0x3895;
HalWlProtocolIntrHandle = 0x38e5;
HalCryptoIntrHandle = 0x3935;
HalGmacIntrHandle = 0x3985;
HalGdma0Ch0IntrHandle = 0x39d5;
HalGdma0Ch1IntrHandle = 0x3a25;
HalGdma0Ch2IntrHandle = 0x3a75;
HalGdma0Ch3IntrHandle = 0x3ac5;
HalGdma0Ch4IntrHandle = 0x3b15;
HalGdma0Ch5IntrHandle = 0x3b65;
HalGdma1Ch0IntrHandle = 0x3bb5;
HalGdma1Ch1IntrHandle = 0x3c05;
HalGdma1Ch2IntrHandle = 0x3c55;
HalGdma1Ch3IntrHandle = 0x3ca5;
HalGdma1Ch4IntrHandle = 0x3cf5;
HalGdma1Ch5IntrHandle = 0x3d45;
HalSdioDeviceIntrHandle = 0x3d95;
VectorTableInitRtl8195A = 0x3de5;
VectorTableInitForOSRtl8195A = 0x4019;
VectorIrqRegisterRtl8195A = 0x4029;
VectorIrqUnRegisterRtl8195A = 0x4091;
VectorIrqEnRtl8195A = 0x40f1;
VectorIrqDisRtl8195A = 0x418d;
_UartRxDmaIrqHandle = 0x422d;
HalRuartPutCRtl8195a = 0x4281;
HalRuartGetCRtl8195a = 0x429d;
HalRuartRTSCtrlRtl8195a = 0x42bd;
HalRuartGetDebugValueRtl8195a = 0x42e1;
HalRuartGetIMRRtl8195a = 0x43e1;
HalRuartSetIMRRtl8195a = 0x442d;
_UartIrqHandle = 0x4465;
HalRuartDmaInitRtl8195a = 0x4681;
HalRuartIntDisableRtl8195a = 0x4845;
HalRuartDeInitRtl8195a = 0x4855;
HalRuartIntEnableRtl8195a = 0x4985;
_UartTxDmaIrqHandle = 0x4995;
HalRuartRegIrqRtl8195a = 0x49d1;
HalRuartAdapterLoadDefRtl8195a = 0x4a4d;
HalRuartTxGdmaLoadDefRtl8195a = 0x4add;
HalRuartRxGdmaLoadDefRtl8195a = 0x4bc9;
RuartLock = 0x4cc9;
RuartUnLock = 0x4ced;
HalRuartIntSendRtl8195a = 0x4d09;
HalRuartDmaSendRtl8195a = 0x4e35;
HalRuartStopSendRtl8195a = 0x4f89;
HalRuartIntRecvRtl8195a = 0x504d;
HalRuartDmaRecvRtl8195a = 0x51ad;
HalRuartStopRecvRtl8195a = 0x52cd;
RuartIsTimeout = 0x5385;
HalRuartSendRtl8195a = 0x53b1;
HalRuartRecvRtl8195a = 0x5599;
RuartResetRxFifoRtl8195a = 0x5751;
HalRuartResetRxFifoRtl8195a = 0x5775;
HalRuartInitRtl8195a = 0x5829;
HalGdmaOnOffRtl8195a = 0x5df1;
HalGdmaChIsrEnAndDisRtl8195a = 0x5e0d;
HalGdmaChEnRtl8195a = 0x5e51;
HalGdmaChDisRtl8195a = 0x5e6d;
HalGdamChInitRtl8195a = 0x5e91;
HalGdmaChSetingRtl8195a = 0x5ebd;
HalGdmaChBlockSetingRtl8195a = 0x000060dd;
HalGdmaChIsrCleanRtl8195a = 0x6419;
HalGdmaChCleanAutoSrcRtl8195a = 0x64a1;
HalGdmaChCleanAutoDstRtl8195a = 0x6501;
HalEFUSEPowerSwitch8195AROM = 0x6561;
HALEFUSEOneByteReadROM = 0x65f9;
HALEFUSEOneByteWriteROM = 0x6699;
__rtl_memcmpb_v1_00 = 0x681d;
__rtl_random_v1_00 = 0x6861;
__rtl_align_to_be32_v1_00 = 0x6881;
__rtl_memsetw_v1_00 = 0x6899;
__rtl_memsetb_v1_00 = 0x68ad;
__rtl_memcpyw_v1_00 = 0x68bd;
__rtl_memcpyb_v1_00 = 0x68dd;
__rtl_memDump_v1_00 = 0x68f5;
__rtl_AES_set_encrypt_key = 0x6901;
__rtl_cryptoEngine_AES_set_decrypt_key = 0x6c11;
__rtl_cryptoEngine_set_security_mode_v1_00 = 0x6c95;
__rtl_cryptoEngine_init_v1_00 = 0x6ea9;
__rtl_cryptoEngine_exit_v1_00 = 0x7055;
__rtl_cryptoEngine_reset_v1_00 = 0x70b1;
__rtl_cryptoEngine_v1_00 = 0x70ed;
__rtl_crypto_cipher_init_v1_00 = 0x7c69;
__rtl_crypto_cipher_encrypt_v1_00 = 0x7c89;
__rtl_crypto_cipher_decrypt_v1_00 = 0x7cad;
HalSsiPinmuxEnableRtl8195a = 0x7cd5;
HalSsiEnableRtl8195a = 0x7e45;
HalSsiDisableRtl8195a = 0x7ef9;
HalSsiLoadSettingRtl8195a = 0x7fad;
HalSsiSetInterruptMaskRtl8195a = 0x8521;
HalSsiGetInterruptMaskRtl8195a = 0x85c9;
HalSsiSetSclkPolarityRtl8195a = 0x863d;
HalSsiSetSclkPhaseRtl8195a = 0x8715;
HalSsiWriteRtl8195a = 0x87e9;
HalSsiSetDeviceRoleRtl8195a = 0x8861;
HalSsiSetRxFifoThresholdLevelRtl8195a = 0x88c9;
HalSsiSetTxFifoThresholdLevelRtl8195a = 0x8941;
HalSsiReadRtl8195a = 0x89b9;
HalSsiGetRxFifoLevelRtl8195a = 0x8a2d;
HalSsiGetTxFifoLevelRtl8195a = 0x8aa5;
HalSsiGetStatusRtl8195a = 0x8b1d;
HalSsiWriteableRtl8195a = 0x8b91;
HalSsiReadableRtl8195a = 0x8c09;
HalSsiBusyRtl8195a = 0x8c81;
HalSsiReadInterruptRtl8195a = 0x8cf9;
HalSsiWriteInterruptRtl8195a = 0x8efd;
HalSsiSetSlaveEnableRegisterRtl8195a = 0x9009;
HalSsiGetInterruptStatusRtl8195a = 0x90d9;
HalSsiInterruptEnableRtl8195a = 0x914d;
HalSsiInterruptDisableRtl8195a = 0x9299;
HalSsiGetRawInterruptStatusRtl8195a = 0x93e9;
HalSsiGetSlaveEnableRegisterRtl8195a = 0x945d;
HalSsiInitRtl8195a = 0x94d1;
_SsiReadInterrupt = 0x9ba5;
_SsiWriteInterrupt = 0x9db1;
_SsiIrqHandle = 0x9eb1;
HalI2CWrite32 = 0xa061;
HalI2CRead32 = 0xa09d;
HalI2CDeInit8195a = 0xa0dd;
HalI2CSendRtl8195a = 0xa1f1;
HalI2CReceiveRtl8195a = 0xa25d;
HalI2CEnableRtl8195a = 0xa271;
HalI2CIntrCtrl8195a = 0xa389;
HalI2CReadRegRtl8195a = 0xa3a1;
HalI2CWriteRegRtl8195a = 0xa3b1;
HalI2CSetCLKRtl8195a = 0xa3c5;
HalI2CMassSendRtl8195a = 0xa6e9;
HalI2CClrIntrRtl8195a = 0xa749;
HalI2CClrAllIntrRtl8195a = 0xa761;
HalI2CInit8195a = 0xa775;
HalI2CDMACtrl8195a = 0xaa31;
RtkI2CIoCtrl = 0xaa61;
RtkI2CPowerCtrl = 0xaa65;
HalI2COpInit = 0xaa69;
I2CIsTimeout = 0xac65;
I2CTXGDMAISRHandle = 0xb435;
I2CRXGDMAISRHandle = 0xb4c1;
RtkI2CIrqInit = 0xb54d;
RtkI2CIrqDeInit = 0xb611;
RtkI2CPinMuxInit = 0xb675;
RtkI2CPinMuxDeInit = 0xb7c9;
RtkI2CDMAInit = 0xb955;
RtkI2CInit = 0xbc95;
RtkI2CDMADeInit = 0xbdad;
RtkI2CDeInit = 0xbe4d;
RtkI2CSendUserAddr = 0xbee5;
RtkI2CSend = 0xc07d;
RtkI2CLoadDefault = 0xce51;
RtkSalI2COpInit = 0xcf21;
HalI2SWrite32 = 0xcf65;
HalI2SRead32 = 0xcf85;
HalI2SDeInitRtl8195a = 0xcfa9;
HalI2STxRtl8195a = 0xcfc9;
HalI2SRxRtl8195a = 0xd011;
HalI2SEnableRtl8195a = 0xd05d;
HalI2SIntrCtrlRtl8195a = 0xd0b1;
HalI2SReadRegRtl8195a = 0xd0d1;
HalI2SClrIntrRtl8195a = 0xd0dd;
HalI2SClrAllIntrRtl8195a = 0xd0fd;
HalI2SInitRtl8195a = 0xd11d;
GPIO_GetIPPinName_8195a = 0xd2e5;
GPIO_GetChipPinName_8195a = 0xd331;
GPIO_PullCtrl_8195a = 0xd39d;
GPIO_FuncOn_8195a = 0xd421;
GPIO_FuncOff_8195a = 0xd481;
GPIO_Int_Mask_8195a = 0xd4e9;
GPIO_Int_SetType_8195a = 0xd511;
HAL_GPIO_IrqHandler_8195a = 0xd5fd;
HAL_GPIO_MbedIrqHandler_8195a = 0xd645;
HAL_GPIO_UserIrqHandler_8195a = 0xd6a1;
HAL_GPIO_IntCtrl_8195a = 0xd6cd;
HAL_GPIO_Init_8195a = 0xd805;
HAL_GPIO_DeInit_8195a = 0xdac1;
HAL_GPIO_ReadPin_8195a = 0xdbd1;
HAL_GPIO_WritePin_8195a = 0xdc91;
HAL_GPIO_RegIrq_8195a = 0xddad;
HAL_GPIO_UnRegIrq_8195a = 0xddf5;
HAL_GPIO_UserRegIrq_8195a = 0xde15;
HAL_GPIO_UserUnRegIrq_8195a = 0xdef9;
HAL_GPIO_MaskIrq_8195a = 0xdfc1;
HAL_GPIO_UnMaskIrq_8195a = 0xe061;
HAL_GPIO_IntDebounce_8195a = 0xe101;
HAL_GPIO_GetIPPinName_8195a = 0xe1c1;
HAL_GPIO_PullCtrl_8195a = 0xe1c9;
DumpForOneBytes = 0xe259;
CmdRomHelp = 0xe419;
CmdWriteWord = 0xe491;
CmdDumpHelfWord = 0xe505;
CmdDumpWord = 0xe5f1;
CmdDumpByte = 0xe6f5;
CmdSpiFlashTool = 0xe751;
GetRomCmdNum = 0xe7a9;
CmdWriteByte = 0xe7ad;
Isspace = 0xe7ed;
Strtoul = 0xe801;
ArrayInitialize = 0xe8b1;
GetArgc = 0xe8c9;
GetArgv = 0xe8f9;
UartLogCmdExecute = 0xe95d;
UartLogShowBackSpace = 0xe9fd;
UartLogRecallOldCmd = 0xea39;
UartLogHistoryCmd = 0xea71;
UartLogCmdChk = 0xeadd;
UartLogIrqHandle = 0xebf5;
RtlConsolInit = 0xecc5;
RtlConsolTaskRom = 0xed49;
RtlExitConsol = 0xed79;
RtlConsolRom = 0xedcd;
HalTimerOpInit = 0xee0d;
HalTimerIrq2To7Handle = 0xee59;
HalGetTimerIdRtl8195a = 0xef09;
HalTimerInitRtl8195a = 0xef3d;
HalTimerDisRtl8195a = 0xf069;
HalTimerEnRtl8195a = 0xf089;
HalTimerReadCountRtl8195a = 0xf0a9;
HalTimerIrqClearRtl8195a = 0xf0bd;
HalTimerDumpRegRtl8195a = 0xf0d1;
VSprintf = 0xf129;
DiagPrintf = 0xf39d;
DiagSPrintf = 0xf3b9;
DiagSnPrintf = 0xf3d1;
prvDiagPrintf = 0xf3ed;
prvDiagSPrintf = 0xf40d;
_memcmp = 0xf429;
_memcpy = 0xf465;
_memset = 0xf511;
Rand = 0xf585;
_strncpy = 0xf60d;
_strcpy = 0xf629;
prvStrCpy = 0xf639;
_strlen = 0xf651;
_strnlen = 0xf669;
prvStrLen = 0xf699;
_strcmp = 0xf6b1;
_strncmp = 0xf6d1;
prvStrCmp = 0xf719;
StrUpr = 0xf749;
prvAtoi = 0xf769;
prvStrStr = 0xf7bd;
_strsep = 0xf7d5;
skip_spaces = 0xf815;
skip_atoi = 0xf831;
_parse_integer_fixup_radix = 0xf869;
_parse_integer = 0xf8bd;
simple_strtoull = 0xf915;
simple_strtoll = 0xf945;
simple_strtoul = 0xf965;
simple_strtol = 0xf96d;
_vsscanf = 0xf985;
_sscanf = 0xff71;
div_u64 = 0xff91;
div_s64 = 0xff99;
div_u64_rem = 0xffa1;
div_s64_rem = 0xffb1;
_strpbrk = 0xffc1;
_strchr = 0xffed;
aes_set_key = 0x10005;
aes_encrypt = 0x103d1;
aes_decrypt = 0x114a5;
AES_WRAP = 0x125c9;
AES_UnWRAP = 0x12701;
crc32_get = 0x12861;
arc4_byte = 0x12895;
rt_arc4_init = 0x128bd;
rt_arc4_crypt = 0x12901;
rt_md5_init = 0x131c1;
rt_md5_append = 0x131f5;
rt_md5_final = 0x1327d;
rt_md5_hmac = 0x132d5;
rtw_get_bit_value_from_ieee_value = 0x13449;
rtw_is_cckrates_included = 0x13475;
rtw_is_cckratesonly_included = 0x134b5;
rtw_check_network_type = 0x134dd;
rtw_set_fixed_ie = 0x1350d;
rtw_set_ie = 0x1352d;
rtw_get_ie = 0x1355d;
rtw_set_supported_rate = 0x13591;
rtw_get_rateset_len = 0x13611;
rtw_get_wpa_ie = 0x1362d;
rtw_get_wpa2_ie = 0x136c9;
rtw_get_wpa_cipher_suite = 0x13701;
rtw_get_wpa2_cipher_suite = 0x13769;
rtw_parse_wpa_ie = 0x137d1;
rtw_parse_wpa2_ie = 0x138ad;
rtw_get_sec_ie = 0x13965;
rtw_get_wps_ie = 0x13a15;
rtw_get_wps_attr = 0x13a99;
rtw_get_wps_attr_content = 0x13b49;
rtw_ieee802_11_parse_elems = 0x13b91;
str_2char2num = 0x13d9d;
key_2char2num = 0x13db9;
convert_ip_addr = 0x13dd1;
rom_psk_PasswordHash = 0x13e9d;
rom_psk_CalcGTK = 0x13ed5;
rom_psk_CalcPTK = 0x13f69;
wep_80211_encrypt = 0x14295;
wep_80211_decrypt = 0x142f5;
tkip_micappendbyte = 0x14389;
rtw_secmicsetkey = 0x143d9;
rtw_secmicappend = 0x14419;
rtw_secgetmic = 0x14435;
rtw_seccalctkipmic = 0x1449d;
tkip_phase1 = 0x145a5;
tkip_phase2 = 0x14725;
tkip_80211_encrypt = 0x14941;
tkip_80211_decrypt = 0x149d5;
aes1_encrypt = 0x14a8d;
aesccmp_construct_mic_iv = 0x14c65;
aesccmp_construct_mic_header1 = 0x14ccd;
aesccmp_construct_mic_header2 = 0x14d21;
aesccmp_construct_ctr_preload = 0x14db5;
aes_80211_encrypt = 0x14e29;
aes_80211_decrypt = 0x151ad;
_sha1_process_message_block = 0x155b9;
_sha1_pad_message = 0x15749;
rt_sha1_init = 0x157e5;
rt_sha1_update = 0x15831;
rt_sha1_finish = 0x158a9;
rt_hmac_sha1 = 0x15909;
rom_aes_128_cbc_encrypt = 0x15a65;
rom_aes_128_cbc_decrypt = 0x15ae1;
rom_rijndaelKeySetupEnc = 0x15b5d;
rom_aes_decrypt_init = 0x15c39;
rom_aes_internal_decrypt = 0x15d15;
rom_aes_decrypt_deinit = 0x16071;
rom_aes_encrypt_init = 0x16085;
rom_aes_internal_encrypt = 0x1609d;
rom_aes_encrypt_deinit = 0x16451;
bignum_init = 0x17b35;
bignum_deinit = 0x17b61;
bignum_get_unsigned_bin_len = 0x17b81;
bignum_get_unsigned_bin = 0x17b85;
bignum_set_unsigned_bin = 0x17c21;
bignum_cmp = 0x17cd1;
bignum_cmp_d = 0x17cd5;
bignum_add = 0x17cfd;
bignum_sub = 0x17d0d;
bignum_mul = 0x17d1d;
bignum_exptmod = 0x17d2d;
WPS_realloc = 0x17d51;
os_zalloc = 0x17d99;
rom_hmac_sha256_vector = 0x17dc1;
rom_hmac_sha256 = 0x17ebd;
rom_sha256_vector = 0x18009;
phy_CalculateBitShift = 0x18221;
PHY_SetBBReg_8195A = 0x18239;
PHY_QueryBBReg_8195A = 0x18279;
ROM_odm_QueryRxPwrPercentage = 0x1829d;
ROM_odm_EVMdbToPercentage = 0x182bd;
ROM_odm_SignalScaleMapping_8195A = 0x182e5;
ROM_odm_FalseAlarmCounterStatistics = 0x183cd;
ROM_odm_SetEDCCAThreshold = 0x18721;
ROM_odm_SetTRxMux = 0x18749;
ROM_odm_SetCrystalCap = 0x18771;
ROM_odm_GetDefaultCrytaltalCap = 0x187d5;
ROM_ODM_CfoTrackingReset = 0x187e9;
ROM_odm_CfoTrackingFlow = 0x18811;
curve25519_donna = 0x1965d;
aes_test_alignment_detection = 0x1a391;
aes_mode_reset = 0x1a3ed;
aes_ecb_encrypt = 0x1a3f9;
aes_ecb_decrypt = 0x1a431;
aes_cbc_encrypt = 0x1a469;
aes_cbc_decrypt = 0x1a579;
aes_cfb_encrypt = 0x1a701;
aes_cfb_decrypt = 0x1a9e5;
aes_ofb_crypt = 0x1acc9;
aes_ctr_crypt = 0x1af7d;
aes_encrypt_key128 = 0x1b289;
aes_encrypt_key192 = 0x1b2a5;
aes_encrypt_key256 = 0x1b2c1;
aes_encrypt_key = 0x1b2e1;
aes_decrypt_key128 = 0x1b351;
aes_decrypt_key192 = 0x1b36d;
aes_decrypt_key256 = 0x1b389;
aes_decrypt_key = 0x1b3a9;
aes_init = 0x1b419;
CRYPTO_chacha_20 = 0x1b41d;
CRYPTO_poly1305_init = 0x1bc25;
CRYPTO_poly1305_update = 0x1bd09;
CRYPTO_poly1305_finish = 0x1bd8d;
rom_sha512_starts = 0x1ceb5;
rom_sha512_update = 0x1d009;
rom_sha512_finish = 0x1d011;
rom_sha512 = 0x1d261;
rom_sha512_hmac_starts = 0x1d299;
rom_sha512_hmac_update = 0x1d35d;
rom_sha512_hmac_finish = 0x1d365;
rom_sha512_hmac_reset = 0x1d3b5;
rom_sha512_hmac = 0x1d3d1;
rom_sha512_hkdf = 0x1d40d;
rom_ed25519_gen_keypair = 0x1d501;
rom_ed25519_gen_signature = 0x1d505;
rom_ed25519_verify_signature = 0x1d51d;
rom_ed25519_crypto_sign_seed_keypair = 0x1d521;
rom_ed25519_crypto_sign_detached = 0x1d579;
rom_ed25519_crypto_sign_verify_detached = 0x1d655;
rom_ed25519_ge_double_scalarmult_vartime = 0x1f86d;
rom_ed25519_ge_frombytes_negate_vartime = 0x1fc35;
rom_ed25519_ge_p3_tobytes = 0x207d5;
rom_ed25519_ge_scalarmult_base = 0x20821;
rom_ed25519_ge_tobytes = 0x209e1;
rom_ed25519_sc_muladd = 0x20a2d;
rom_ed25519_sc_reduce = 0x2603d;
__rtl_memchr_v1_00 = 0x28a4d;
__rtl_memcmp_v1_00 = 0x28ae1;
__rtl_memcpy_v1_00 = 0x28b49;
__rtl_memmove_v1_00 = 0x28bed;
__rtl_memset_v1_00 = 0x28cb5;
__rtl_strcat_v1_00 = 0x28d49;
__rtl_strchr_v1_00 = 0x28d91;
__rtl_strcmp_v1_00 = 0x28e55;
__rtl_strcpy_v1_00 = 0x28ec9;
__rtl_strlen_v1_00 = 0x28f15;
__rtl_strncat_v1_00 = 0x28f69;
__rtl_strncmp_v1_00 = 0x28fc5;
__rtl_strncpy_v1_00 = 0x2907d;
__rtl_strstr_v1_00 = 0x293cd;
__rtl_strsep_v1_00 = 0x2960d;
__rtl_strtok_v1_00 = 0x29619;
__rtl__strtok_r_v1_00 = 0x2962d;
__rtl_strtok_r_v1_00 = 0x29691;
__rtl_close_v1_00 = 0x29699;
__rtl_fstat_v1_00 = 0x296ad;
__rtl_isatty_v1_00 = 0x296c1;
__rtl_lseek_v1_00 = 0x296d5;
__rtl_open_v1_00 = 0x296e9;
__rtl_read_v1_00 = 0x296fd;
__rtl_write_v1_00 = 0x29711;
__rtl_sbrk_v1_00 = 0x29725;
__rtl_ltoa_v1_00 = 0x297bd;
__rtl_ultoa_v1_00 = 0x29855;
__rtl_dtoi_v1_00 = 0x298c5;
__rtl_dtoi64_v1_00 = 0x29945;
__rtl_dtoui_v1_00 = 0x299dd;
__rtl_ftol_v1_00 = 0x299e5;
__rtl_itof_v1_00 = 0x29a51;
__rtl_itod_v1_00 = 0x29ae9;
__rtl_i64tod_v1_00 = 0x29b79;
__rtl_uitod_v1_00 = 0x29c55;
__rtl_ftod_v1_00 = 0x29d2d;
__rtl_dtof_v1_00 = 0x29de9;
__rtl_uitof_v1_00 = 0x29e89;
__rtl_fadd_v1_00 = 0x29f65;
__rtl_fsub_v1_00 = 0x2a261;
__rtl_fmul_v1_00 = 0x2a559;
__rtl_fdiv_v1_00 = 0x2a695;
__rtl_dadd_v1_00 = 0x2a825;
__rtl_dsub_v1_00 = 0x2aed9;
__rtl_dmul_v1_00 = 0x2b555;
__rtl_ddiv_v1_00 = 0x2b8ad;
__rtl_dcmpeq_v1_00 = 0x2be4d;
__rtl_dcmplt_v1_00 = 0x2bebd;
__rtl_dcmpgt_v1_00 = 0x2bf51;
__rtl_dcmple_v1_00 = 0x2c049;
__rtl_fcmplt_v1_00 = 0x2c139;
__rtl_fcmpgt_v1_00 = 0x2c195;
__rtl_cos_f32_v1_00 = 0x2c229;
__rtl_sin_f32_v1_00 = 0x2c435;
__rtl_fabs_v1_00 = 0x2c639;
__rtl_fabsf_v1_00 = 0x2c641;
__rtl_dtoa_r_v1_00 = 0x2c77d;
__rom_mallocr_init_v1_00 = 0x2d7d1;
__rtl_free_r_v1_00 = 0x2d841;
__rtl_malloc_r_v1_00 = 0x2da31;
__rtl_realloc_r_v1_00 = 0x2df55;
__rtl_memalign_r_v1_00 = 0x2e331;
__rtl_valloc_r_v1_00 = 0x2e421;
__rtl_pvalloc_r_v1_00 = 0x2e42d;
__rtl_calloc_r_v1_00 = 0x2e441;
__rtl_cfree_r_v1_00 = 0x2e4a9;
__rtl_Balloc_v1_00 = 0x2e515;
__rtl_Bfree_v1_00 = 0x2e571;
__rtl_i2b_v1_00 = 0x2e585;
__rtl_multadd_v1_00 = 0x2e599;
__rtl_mult_v1_00 = 0x2e629;
__rtl_pow5mult_v1_00 = 0x2e769;
__rtl_hi0bits_v1_00 = 0x2e809;
__rtl_d2b_v1_00 = 0x2e845;
__rtl_lshift_v1_00 = 0x2e901;
__rtl_cmp_v1_00 = 0x2e9bd;
__rtl_diff_v1_00 = 0x2ea01;
__rtl_sread_v1_00 = 0x2eae9;
__rtl_seofread_v1_00 = 0x2eb39;
__rtl_swrite_v1_00 = 0x2eb3d;
__rtl_sseek_v1_00 = 0x2ebc1;
__rtl_sclose_v1_00 = 0x2ec11;
__rtl_sbrk_r_v1_00 = 0x2ec41;
__rtl_fflush_r_v1_00 = 0x2ef8d;
__rtl_vfprintf_r_v1_00 = 0x2f661;
__rtl_fpclassifyd = 0x30c15;
CpkClkTbl = 0x30c68;
ROM_IMG1_VALID_PATTEN = 0x30c80;
SpicCalibrationPattern = 0x30c88;
SpicInitCPUCLK = 0x30c98;
BAUDRATE = 0x30ca8;
OVSR = 0x30d1c;
DIV = 0x30d90;
OVSR_ADJ = 0x30e04;
__AES_rcon = 0x30e78;
__AES_Te4 = 0x30ea0;
I2CDmaChNo = 0x312a0;
UartLogRomCmdTable = 0x316a0;
_HalRuartOp = 0x31700;
_HalGdmaOp = 0x31760;
RTW_WPA_OUI_TYPE = 0x3540c;
WPA_CIPHER_SUITE_NONE = 0x35410;
WPA_CIPHER_SUITE_WEP40 = 0x35414;
WPA_CIPHER_SUITE_TKIP = 0x35418;
WPA_CIPHER_SUITE_CCMP = 0x3541c;
WPA_CIPHER_SUITE_WEP104 = 0x35420;
RSN_CIPHER_SUITE_NONE = 0x35424;
RSN_CIPHER_SUITE_WEP40 = 0x35428;
RSN_CIPHER_SUITE_TKIP = 0x3542c;
RSN_CIPHER_SUITE_CCMP = 0x35430;
RSN_CIPHER_SUITE_WEP104 = 0x35434;
RSN_AUTH_KEY_MGMT_PSK_OVER_802_1X = 0x35444;
RSN_AUTH_KEY_MGMT_UNSPEC_802_1X = 0x35448;
RSN_VERSION_BSD = 0x3544c;
rom_wps_Te0 = 0x35988;
rom_wps_rcons = 0x35d88;
rom_wps_Td4s = 0x35d94;
rom_wps_Td0 = 0x35e94;
NewVectorTable = 0x10000000;
UserIrqFunTable = 0x10000100;
UserIrqDataTable = 0x10000200;
__rom_bss_start__ = 0x10000300;
CfgSysDebugWarn = 0x10000300;
CfgSysDebugInfo = 0x10000304;
CfgSysDebugErr = 0x10000308;
ConfigDebugWarn = 0x1000030c;
ConfigDebugInfo = 0x10000310;
ConfigDebugErr = 0x10000314;
HalTimerOp = 0x10000318;
GPIOState = 0x10000334;
gTimerRecord = 0x1000034c;
SSI_DBG_CONFIG = 0x10000350;
_pHAL_Gpio_Adapter = 0x10000354;
Timer2To7VectorTable = 0x10000358;
pUartLogCtl = 0x10000384;
UartLogBuf = 0x10000388;
UartLogCtl = 0x10000408;
UartLogHistoryBuf = 0x10000430;
ArgvArray = 0x100006ac;
rom_wlan_ram_map = 0x100006d4;
FalseAlmCnt = 0x100006e0;
ROMInfo = 0x10000720;
DM_CfoTrack = 0x10000738;
rom_libgloss_ram_map = 0x10000760;
__rtl_errno = 0x10000bc4;
_rtl_impure_ptr = 0x10001c60;
}

View file

@ -0,0 +1,243 @@
ENTRY(Reset_Handler)
INCLUDE "export-rom_v02.txt"
MEMORY
{
TCM (rwx) : ORIGIN = 0x1FFF0000, LENGTH = 65536
ROM_USED_RAM (rwx) : ORIGIN = 0x10000bc8, LENGTH = 21560
//RECY_RAM (rwx) : ORIGIN = 0x10002100, LENGTH = 16128
BD_RAM (rwx) : ORIGIN = 0x10006000, LENGTH = 434176
RECY_RAM (rwx) : ORIGIN = 0x10002100, LENGTH = 7936
//BD_RAM (rwx) : ORIGIN = 0x10004000, LENGTH = 442368
SDRAM_RAM (rwx) : ORIGIN = 0x30000000, LENGTH = 2M
}
SECTIONS
{
__rom_bss_start__ = 0x10000300;
__rom_bss_end__ = 0x10000bc8;
/*
.ram.start.table :
{
__ram_image1_text_start__ = .;
__ram_start_table_start__ = .;
KEEP(*(SORT(.start.ram.data*)))
__ram_start_table_end__ = .;
} > ROM_USED_RAM
*/
/* Add . to assign the start address of the section, *
* to prevent the change of the start address by ld doing section alignment */
/* these 4 sections is used by ROM global variable */
/* Don't move them and never add RAM code variable to these sections */
/*
.ram_image1.text . :
{
__image1_validate_code__ = .;
KEEP(*(.image1.validate.rodata*))
KEEP(*(.infra.ram.data*))
KEEP(*(.timer.ram.data*))
KEEP(*(.cutb.ram.data*))
KEEP(*(.cutc.ram.data*))
KEEP(*(.hal.ram.data*))
__image1_bss_start__ = .;
__image1_bss_end__ = .;
__ram_image1_data_end__ = .;
*(.hal.ram.text*)
*(.infra.ram.text*)
__ram_image1_text_end__ = .;
} > ROM_USED_RAM
*/
/*
.tcm :
{
__tcm_start__ = .;
*(.tcm.heap)
*mem.o (.bss)
*memp.o (.bss)
__tcm_end__ = .;
} > TCM
*/
.bootloader :
{
KEEP(*(.loader.data*))
} > ROM_USED_RAM
OVERLAY 0x1FFF0000:
{
.valid
{
*mem.o (.bss*)
*memp.o (.bss*)
*(.tcm.heap)
}
.dummy
{
__ram_image1_text_start__ = .;
__ram_start_table_start__ = .;
KEEP(*(SORT(.start.ram.data*)))
__ram_start_table_end__ = .;
__image1_validate_code__ = .;
KEEP(*(.image1.validate.rodata*))
KEEP(*(.infra.ram.data*))
KEEP(*(.timer.ram.data*))
KEEP(*(.cutb.ram.data*))
KEEP(*(.cutc.ram.data*))
KEEP(*(.hal.ram.data*))
__image1_bss_start__ = .;
.ram_image1.bss$$Base = .;
__image1_bss_end__ = .;
.ram_image1.bss$$Limit = .;
__ram_image1_data_end__ = .;
*(.hal.ram.text*)
*(.infra.ram.text*)
}
} > TCM
.image2.start.table :
{
__ram_image2_text_start__ = .;
__image2_entry_func__ = .;
.image2.start.table1$$Base = .;
KEEP(*(SORT(.image2.ram.data*)))
__image2_validate_code__ = .;
KEEP(*(.image2.validate.rodata*))
KEEP(*(.custom.validate.rodata*))
} > BD_RAM
.ram_image2.text :
{
KEEP(*(.infra.ram.start*))
*(.mon.ram.text*)
*(.hal.flash.text*)
*(.hal.sdrc.text*)
*(.hal.gpio.text*)
*(.fwu.text*)
*(.text*)
} > BD_RAM
.ram_image2.rodata :
{
*(.rodata*)
*(.fwu.rodata*)
} > BD_RAM
.ram.data :
{
__data_start__ = .;
*(.data*)
. = ALIGN(4);
__data_end__ = .;
__ram_image2_text_end__ = .;
} > BD_RAM
.ram.bss :
{
__bss_start__ = .;
.ram.bss$$Base = .;
*(.hal.flash.data*)
*(.hal.sdrc.data*)
*(.hal.gpio.data*)
*(.fwu.data*)
*(.bss*)
*(COMMON)
*(.bdsram.data*)
__bss_end__ = .;
.ram.bss$$Limit = .;
} > BD_RAM
.bf_data :
{
__buffer_data_start__ = .;
*(.bfsram.data*)
__buffer_data_end__ = .;
} > BD_RAM
.bf_data2 :
{
__buffer_data_start2__ = .;
__buffer_data_end2__ = .;
} > RECY_RAM
.sdr_text :
{
__sdram_data_start__ = .;
*(.sdram.text*)
*(.p2p.text*)
*(.wps.text*)
*(.websocket.text*)
} > SDRAM_RAM
.sdr_rodata :
{
*(.sdram.rodata*)
*(.p2p.rodata*)
*(.wps.rodata*)
*(.websocket.rodata*)
} > SDRAM_RAM
.sdr_data :
{
*(.sdram.data*)
*(.p2p.data*)
*(.wps.data*)
*(.websocket.data*)
. = ALIGN(256);
*(.fpb.remap*)
. = ALIGN(4);
__sdram_data_end__ = .;
} > SDRAM_RAM
.sdr_bss :
{
__sdram_bss_start__ = .;
*(.sdram.bss*)
*(.p2p.bss*)
*(.wps.bss*)
*(.websocket.bss*)
__sdram_bss_end__ = .;
} > SDRAM_RAM
.heap :
{
__end__ = .;
end = __end__;
*(.heap*)
__HeapLimit = .;
} > BD_RAM
/* .stack_dummy section doesn't contains any symbols. It is only
* used for linker to calculate size of stack sections, and assign
* values to stack symbols later */
.stack_dummy :
{
*(.stack)
} > BD_RAM
/* Set stack top to end of RAM, and stack limit move down by
* size of stack_dummy section */
__StackTop = ORIGIN(BD_RAM) + LENGTH(BD_RAM);
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
PROVIDE(__stack = __StackTop);
/* Check if data + heap + stack exceeds RAM limit */
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
}

View file

@ -0,0 +1,2 @@
taskkill /F /IM openocd.exe
openocd -f interface\cmsis-dap.cfg -f ..\..\..\component\soc\realtek\8195a\misc\gcc_utility\openocd\ameba1.cfg

View file

@ -0,0 +1,21 @@
#!/bin/sh
OS=`uname | cut -c 1-6`
PID=`ps aux | grep openocd | gawk '{print $1}'`
if [ ! -z "$PID" -a "$PID" != " " ]; then
echo Found openocd running, Kill it
kill $PID
else
if [ $OS == CYGWIN ]; then
echo Try to search windows process
PID=`ps --windows | grep openocd | gawk '{print $1}'`
if [ -n PID ]; then
echo Found openocd running, Kill it
taskkill /F /pid $PID
fi
fi
fi
openocd -f interface/cmsis-dap.cfg -f ../../../component/soc/realtek/8195a/misc/gcc_utility/openocd/ameba1.cfg

View file

@ -0,0 +1,23 @@
Example Description
This example describes how to use ADC.
1.Prepare a DC power supply to provide a adjustable voltage.
2.Connect anode to HDK board A3, and cathode to GND
3.Run the main function.
4.Will see result like below
AD1:00008049 = 1644 mv, AD2:00002a75 = 17 mv, AD3:00002a94 = 20 mv
NOTE:
1. For 8195AM EVB, A0 and A1 are hardware connected. A2 is also available.
For 8711AM EVB, A0 and A1 are not available. Only A2 is avaliable.
2. ADC need calibration to get correct voltage value by modifing OFFSET and GAIN_DIV.

View file

@ -0,0 +1,88 @@
/*
* Routines to access hardware
*
* Copyright (c) 2013 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "device.h"
#include "analogin_api.h"
#include <sys_api.h>
#define ADC_CALIBRATION 0
#define MBED_ADC_EXAMPLE_PIN_1 AD_1 // no pin out
#define MBED_ADC_EXAMPLE_PIN_2 AD_2 // HDK, A1
#define MBED_ADC_EXAMPLE_PIN_3 AD_3 // HDK, A2
#if defined (__ICCARM__)
analogin_t adc0;
analogin_t adc1;
analogin_t adc2;
#else
volatile analogin_t adc0;
volatile analogin_t adc1;
volatile analogin_t adc2;
#endif
void adc_delay(void)
{
int i;
for(i=0;i<1600000;i++)
asm(" nop");
}
uint16_t adcdat0 = 0;
uint16_t adcdat1 = 0;
uint16_t adcdat2 = 0;
int32_t v_mv0;
int32_t v_mv1;
int32_t v_mv2;
/*
* OFFSET: value of measuring at 0.000v, value(0.000v)
* GAIN_DIV: value(1.000v)-value(0.000v) or value(2.000v)-value(1.000v) or value(3.000v)-value(2.000v)
*
* MSB 12bit of value is valid, need to truncate LSB 4bit (0xABCD -> 0xABC). OFFSET and GAIN_DIV are truncated values.
*/
#define OFFSET 0x298
#define GAIN_DIV 0x34C
#define AD2MV(ad,offset,gain) (((ad/16)-offset)*1000/gain)
VOID
main (
VOID
)
{
uint16_t offset, gain;
analogin_init(&adc0, MBED_ADC_EXAMPLE_PIN_1); // no pinout on HDK board
analogin_init(&adc1, MBED_ADC_EXAMPLE_PIN_2);
analogin_init(&adc2, MBED_ADC_EXAMPLE_PIN_3);
#if ADC_CALIBRATION
sys_adc_calibration(0, &offset, &gain);
printf("ADC:offset = 0x%x, gain = 0x%x\n", offset, gain);
if((offset==0xFFFF) || (gain==0xFFFF))
#endif
{
offset = OFFSET;
gain = GAIN_DIV;
printf("ADC:offset = 0x%x, gain = 0x%x\n", offset, gain);
}
for (;;){
adcdat0 = analogin_read_u16(&adc0);
adcdat1 = analogin_read_u16(&adc1);
adcdat2 = analogin_read_u16(&adc2);
v_mv0 = AD2MV(adcdat0, offset, gain);
v_mv1 = AD2MV(adcdat1, offset, gain);
v_mv2 = AD2MV(adcdat2, offset, gain);
printf("AD0:%x = %d mv, AD1:%x = %d mv, AD2:%x = %d mv\n", adcdat0, v_mv0, adcdat1, v_mv1, adcdat2, v_mv2);
adc_delay();
}
analogin_deinit(&adc0);
analogin_deinit(&adc1);
analogin_deinit(&adc2);
}

View file

@ -0,0 +1,8 @@
Example Description
This example describes how to use CRYPTO function, it is based on cutomer requirement modified.
Using mutex_lock to protect HW crypto engine from multiple access concurrently.
use Arduino board to test, and it will show at console

View file

@ -0,0 +1,467 @@
/*
* Routines to access hardware
*
* Copyright (c) 2013 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "FreeRTOS.h"
#include "task.h"
#include "device.h"
#include "serial_api.h"
#include "hal_crypto.h"
#include "main.h"
#include "diag.h"
#include <polarssl/aes.h>
#include "device_lock.h"
#define STACKSIZE 2048
//static const u8 plaintext[] = "The quick brown fox jumps over the lazy dog";
//static const u8 md5_digest[] = "\x9e\x10\x7d\x9d\x37\x2b\xb6\x82"
// "\x6b\xd8\x1d\x35\x42\xa4\x19\xd6";
//static const u8 md5_key[] = "key";
static const char plaintext[] = "12345678901234567890123456789012345678901234567890123456789012" \
"345678901234567890";
static const char md5_digest[] = { 0x57, 0xED, 0xF4, 0xA2, 0x2B, 0xE3, 0xC9, 0x55,
0xAC, 0x49, 0xDA, 0x2E, 0x21, 0x07, 0xB6, 0x7A };
static const u8 md5_key[] = "key";
static unsigned char md5_test_buf[16][128] =
{
{ "" },
{ "a" },
{ "abc" },
{ "message digest" },
{ "abcdefghijklmnopqrstuvwxyz" },
{ "The quick brown fox jumps over the lazy dog" },
{ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" },
{ "12345678901234567890123456789012345678901234567890123456789012" \
"345678901234567890" },
{ "" },
{ "a" },
{ "abc" },
{ "message digest" },
{ "abcdefghijklmnopqrstuvwxyz" },
{ "The quick brown fox jumps over the lazy dog" },
{ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" },
{ "12345678901234567890123456789012345678901234567890123456789012" \
"345678901234567890" }
};
static const int md5_test_buflen[16] =
{
0, 1, 3, 14, 26, 43, 62, 80, 0, 1, 3, 14, 26, 43, 62, 80
};
static const unsigned char md5_test_sum[16][16] =
{
{ 0xD4, 0x1D, 0x8C, 0xD9, 0x8F, 0x00, 0xB2, 0x04,
0xE9, 0x80, 0x09, 0x98, 0xEC, 0xF8, 0x42, 0x7E },
{ 0x0C, 0xC1, 0x75, 0xB9, 0xC0, 0xF1, 0xB6, 0xA8,
0x31, 0xC3, 0x99, 0xE2, 0x69, 0x77, 0x26, 0x61 },
{ 0x90, 0x01, 0x50, 0x98, 0x3C, 0xD2, 0x4F, 0xB0,
0xD6, 0x96, 0x3F, 0x7D, 0x28, 0xE1, 0x7F, 0x72 },
{ 0xF9, 0x6B, 0x69, 0x7D, 0x7C, 0xB7, 0x93, 0x8D,
0x52, 0x5A, 0x2F, 0x31, 0xAA, 0xF1, 0x61, 0xD0 },
{ 0xC3, 0xFC, 0xD3, 0xD7, 0x61, 0x92, 0xE4, 0x00,
0x7D, 0xFB, 0x49, 0x6C, 0xCA, 0x67, 0xE1, 0x3B },
{"\x9e\x10\x7d\x9d\x37\x2b\xb6\x82"
"\x6b\xd8\x1d\x35\x42\xa4\x19\xd6"},
{ 0xD1, 0x74, 0xAB, 0x98, 0xD2, 0x77, 0xD9, 0xF5,
0xA5, 0x61, 0x1C, 0x2C, 0x9F, 0x41, 0x9D, 0x9F },
{ 0x57, 0xED, 0xF4, 0xA2, 0x2B, 0xE3, 0xC9, 0x55,
0xAC, 0x49, 0xDA, 0x2E, 0x21, 0x07, 0xB6, 0x7A },
{ 0xD4, 0x1D, 0x8C, 0xD9, 0x8F, 0x00, 0xB2, 0x04,
0xE9, 0x80, 0x09, 0x98, 0xEC, 0xF8, 0x42, 0x7E },
{ 0x0C, 0xC1, 0x75, 0xB9, 0xC0, 0xF1, 0xB6, 0xA8,
0x31, 0xC3, 0x99, 0xE2, 0x69, 0x77, 0x26, 0x61 },
{ 0x90, 0x01, 0x50, 0x98, 0x3C, 0xD2, 0x4F, 0xB0,
0xD6, 0x96, 0x3F, 0x7D, 0x28, 0xE1, 0x7F, 0x72 },
{ 0xF9, 0x6B, 0x69, 0x7D, 0x7C, 0xB7, 0x93, 0x8D,
0x52, 0x5A, 0x2F, 0x31, 0xAA, 0xF1, 0x61, 0xD0 },
{ 0xC3, 0xFC, 0xD3, 0xD7, 0x61, 0x92, 0xE4, 0x00,
0x7D, 0xFB, 0x49, 0x6C, 0xCA, 0x67, 0xE1, 0x3B },
{"\x9e\x10\x7d\x9d\x37\x2b\xb6\x82"
"\x6b\xd8\x1d\x35\x42\xa4\x19\xd6"},
{ 0xD1, 0x74, 0xAB, 0x98, 0xD2, 0x77, 0xD9, 0xF5,
0xA5, 0x61, 0x1C, 0x2C, 0x9F, 0x41, 0x9D, 0x9F },
{ 0x57, 0xED, 0xF4, 0xA2, 0x2B, 0xE3, 0xC9, 0x55,
0xAC, 0x49, 0xDA, 0x2E, 0x21, 0x07, 0xB6, 0x7A },
};
u8 digest[64];
u8 cipher_result[2048];
u8 test_result[1024];
serial_t sobj;
/*
*
*
* This test_md5 function is used to test hardware md5 functoinality
*/
void test_md5(void)
{
int i;
int ret;
u8 md5sum[16];
DiagPrintf("MD5 test\r\n");
// Use mutex lock to protect HW crypto engine from multiple access concurrently.
device_mutex_lock(RT_DEV_LOCK_CRYPTO);
ret = rtl_crypto_md5(plaintext, strlen(plaintext), (unsigned char *)&digest); // the length of MD5's digest is 16 bytes.
// Release mutex lock when left critical section.
device_mutex_unlock(RT_DEV_LOCK_CRYPTO);
if ( rtl_memcmpb(digest, md5_digest, 16) == 0 ) {
DiagPrintf("MD5 test result is correct, ret=%d\r\n", ret);
} else {
DiagPrintf("MD5 test result is WRONG!!, ret=%d\r\n", ret);
}
for( i = 0; i < 16; i++ )
{
DiagPrintf( " MD5 test #%d: ", i + 1 );
// Use mutex lock to protect HW crypto engine from multiple access concurrently.
device_mutex_lock(RT_DEV_LOCK_CRYPTO);
ret = rtl_crypto_md5(md5_test_buf[i], md5_test_buflen[i], md5sum); // the length of MD5's digest is 16 bytes.
// Release mutex lock when left critical section.
device_mutex_unlock(RT_DEV_LOCK_CRYPTO);
DiagPrintf(" MD5 ret=%d\n", ret);
if( rtl_memcmpb( md5sum, md5_test_sum[i], 16 ) != 0 )
{
DiagPrintf( "failed\n" );
memset(md5sum,0,16);
}
else{
DiagPrintf( "passed\n" );
memset(md5sum,0,16);}
}
}
//
// vector : AES CBC 128 bit :
// http://www.inconteam.com/software-development/41-encryption/55-aes-test-vectors#aes-cbc-128
//
//#ifdef __ICCARM__
//#pragma data_alignment = 4
//#elif defined (__GNUC__)
//__attribute__ ((aligned (4)))
//#endif
static const unsigned char aes_test_key[16] =
{
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
} ;
//#ifdef __ICCARM__
//#pragma data_alignment = 4
//#elif defined (__GNUC__)
//__attribute__ ((aligned (4)))
//#endif
static const unsigned char aes_test_iv_1[16] =
{
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
};
static const unsigned char aes_test_buf[16] =
{
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
};
static const unsigned char aes_test_ecb_buf[160] =
{
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a
};
static const unsigned char aes_test_res_128[16] =
{
0x76, 0x49, 0xab, 0xac, 0x81, 0x19, 0xb2, 0x46,
0xce, 0xe9, 0x8e, 0x9b, 0x12, 0xe9, 0x19, 0x7d
};
static const unsigned char aes_test_ecb_res_128[160] =
{
0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60,
0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97,
0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60,
0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97,
0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60,
0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97,
0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60,
0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97,
0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60,
0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97,
0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60,
0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97,
0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60,
0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97,
0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60,
0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97,
0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60,
0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97,
0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60,
0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97
};
/*
*
* THis test_aes_cbc function is use to directly test hardware aes cbc crypto functionality
*
*/
int test_aes_cbc(void)
{
const u8 *key, *pIv;
u32 keylen= 0;
u32 ivlen = 0;
u8 *message;
u32 msglen;
u8 *pResult;
int ret;
DiagPrintf("AES CBC test\r\n");
key = aes_test_key;
keylen = 16;
pIv = aes_test_iv_1;
ivlen = 16;
pResult = cipher_result;
message = (unsigned char *)aes_test_buf;
msglen = sizeof(aes_test_buf);
// Use mutex lock to protect HW crypto engine from multiple access concurrently.
// The critical section for encrypt/decrypt should include init function.
device_mutex_lock(RT_DEV_LOCK_CRYPTO);
ret = rtl_crypto_aes_cbc_init(key,keylen);
if ( ret != 0 ) {
DiagPrintf("AES CBC init failed\r\n");
return ret;
}
ret = rtl_crypto_aes_cbc_encrypt(message, msglen, pIv, ivlen, pResult);
if ( ret != 0 ) {
DiagPrintf("AES CBC encrypt failed\r\n");
return ret;
}
if ( rtl_memcmpb(aes_test_res_128, pResult, msglen) == 0 ) {
DiagPrintf("AES CBC encrypt result success\r\n");
} else {
DiagPrintf("AES CBC encrypt result failed\r\n");
}
message = pResult;
ret = rtl_crypto_aes_cbc_decrypt(message, msglen, pIv, ivlen, pResult);
// Release mutex lock when left critical section.
device_mutex_unlock(RT_DEV_LOCK_CRYPTO);
if ( ret != 0 ) {
DiagPrintf("AES CBC decrypt failed, ret=%d\r\n", ret);
return ret;
}
if ( rtl_memcmpb(aes_test_buf, pResult, msglen) == 0 ) {
DiagPrintf("AES CBC decrypt result success\r\n");
} else {
DiagPrintf("AES CBC decrypt result failed\r\n");
}
return 0;
}
/*
*
* THis test_aes_ecb function is use to directly test hardware ecb cbc crypto functionality
*
* The input parameter for ecb need to confirm iv is null and ivlen is 0
*/
int test_aes_ecb(void)
{
const u8 *key, *pIv;
u32 keylen= 0;
u32 ivlen = 0;
u8 *message;
u32 msglen;
u8 *pResult;
int ret;
DiagPrintf("AES ECB test\r\n");
key = aes_test_key;
keylen = 16;
pIv = NULL;
ivlen = 0;
pResult = cipher_result;
message = (unsigned char *)aes_test_ecb_buf;
msglen = sizeof(aes_test_buf);
//for(int i=0;i<msglen;i++)
//printf("\r\n first message[%d] = %p,",i,message[i]);
// Use mutex lock to protect HW crypto engine from multiple access concurrently.
// The critical section for encrypt/decrypt should include init function.
device_mutex_lock(RT_DEV_LOCK_CRYPTO);
ret = rtl_crypto_aes_ecb_init(key,keylen);
if ( ret != 0 ) {
DiagPrintf("AES ECB init failed\r\n");
return ret;
}
ret = rtl_crypto_aes_ecb_encrypt(message, msglen, pIv, ivlen, pResult);
if ( ret != 0 ) {
DiagPrintf("AES ECB encrypt failed\r\n");
return ret;
}
if ( rtl_memcmpb(aes_test_ecb_res_128, pResult, msglen) == 0 )
{
DiagPrintf("AES ECB encrypt result success\r\n");
}
else {
DiagPrintf("AES ECB encrypt result failed\r\n");
}
message = pResult;
//for(int i=0;i<msglen;i++)
//printf("\r\n second message[%d] = %p,",i,message[i]);
ret = rtl_crypto_aes_ecb_decrypt(message, msglen, pIv, ivlen, pResult);
// Release mutex lock when left critical section.
device_mutex_unlock(RT_DEV_LOCK_CRYPTO);
if ( ret != 0 ) {
DiagPrintf("AES ECB decrypt failed, ret=%d\r\n", ret);
return ret;
}
if ( rtl_memcmpb(aes_test_ecb_buf, pResult, msglen) == 0 )
{
DiagPrintf("AES ECB decrypt result success\r\n");
}
else {
DiagPrintf("AES ECB decrypt result failed\r\n");
}
//for(int i=0;i<msglen;i++)
//printf("\r\n last message[%d] = %p,",i,message[i]);
return 0;
}
static void test_md5_thread(void *param){
test_md5();
vTaskDelete(NULL);
}
static void test_aes_cbc_thread(void *param){
test_aes_cbc();
vTaskDelete(NULL);
}
static void test_aes_ecb_thread(void *param){
test_aes_ecb();
vTaskDelete(NULL);
}
void main(void)
{
// sample text
char rc;
//
int ret;
int loop=0;
u32 keylen= 0;
u32 ivlen = 0;
u8 *pResult;
u8 *message;
u32 *ResultLen;
u32 msglen = 0;
const u8 *key, *pIv;
key = aes_test_key;
keylen = 16;
pIv = aes_test_iv_1;
ivlen = 16;
//
message = (unsigned char *)aes_test_buf;
msglen = sizeof(aes_test_buf);
DiagPrintf("CRYPTO API Demo...\r\n");
if ( rtl_cryptoEngine_init() != 0 ) {
DiagPrintf("crypto engine init failed\r\n");
}
else
printf("init success\n");
pResult = test_result;
// test_md5();
// test_aes_cbc();
// test_aes_ecb();
//aes_test(); //added api combined aes_cbc setkey and cryption into one function
/* Note that it should be protected by device_mutex_lock() if using HW crypto */
if(xTaskCreate(test_md5_thread, "test_md5_thread", STACKSIZE, NULL, tskIDLE_PRIORITY + 1, NULL) != pdPASS)
printf("\n\r%s xTaskCreate failed", __FUNCTION__);
if(xTaskCreate(test_aes_cbc_thread, "test_aes_cbc_thread", STACKSIZE, NULL, tskIDLE_PRIORITY + 1, NULL) != pdPASS)
printf("\n\r%s xTaskCreate failed", __FUNCTION__);
if(xTaskCreate(test_aes_ecb_thread, "test_aes_ecb_thread", STACKSIZE, NULL, tskIDLE_PRIORITY + 1, NULL) != pdPASS)
printf("\n\r%s xTaskCreate failed", __FUNCTION__);
/* Enable Schedule, Start Kernel */
#if defined(CONFIG_KERNEL) && !TASK_SCHEDULER_DISABLED
#ifdef PLATFORM_FREERTOS
vTaskStartScheduler();
#endif
#else
RtlConsolTaskRom(NULL);
#endif
}

View file

@ -0,0 +1,10 @@
Example Description
This example describes how to read/write efuse in MTP.
MTP block has 32 bytes.
Requirement Components:
None

View file

@ -0,0 +1,72 @@
#include "FreeRTOS.h"
#include "task.h"
#include "diag.h"
#include "hal_efuse.h"
#include "efuse_api.h"
#include "osdep_service.h"
#include "device_lock.h"
#define MTP_MAX_LEN 32 // The MTP max length is 32 bytes
static void efuse_mtp_task(void *param)
{
int ret;
u8 i, buf[MTP_MAX_LEN];
DBG_8195A("\nefuse MTP block: Test Start\n");
// read MTP content
_memset(buf, 0xFF, MTP_MAX_LEN);
device_mutex_lock(RT_DEV_LOCK_EFUSE);
efuse_mtp_read(buf);
device_mutex_unlock(RT_DEV_LOCK_EFUSE);
for(i=0; i<MTP_MAX_LEN; i+=8){
DBG_8195A("[%d]\t%02X %02X %02X %02X %02X %02X %02X %02X\n",
i, buf[i], buf[i+1], buf[i+2], buf[i+3], buf[i+4], buf[i+5], buf[i+6], buf[i+7]);
}
// write MTP content
_memset(buf, 0xFF, MTP_MAX_LEN);
if(0){ // fill your data
for(i=0; i<MTP_MAX_LEN; i++)
buf[i] = i;
}
if(0){ // write
device_mutex_lock(RT_DEV_LOCK_EFUSE);
ret = efuse_mtp_write(buf, MTP_MAX_LEN);
device_mutex_unlock(RT_DEV_LOCK_EFUSE);
if(ret < 0){
DBG_8195A("efuse MTP block: write length error\n");
goto exit;
}
DBG_8195A("\nWrite Done\n");
DBG_8195A("Remain %d\n", efuse_get_remaining_length());
}
DBG_8195A("\n");
// read MTP content
_memset(buf, 0xFF, MTP_MAX_LEN);
device_mutex_lock(RT_DEV_LOCK_EFUSE);
efuse_mtp_read(buf);
device_mutex_unlock(RT_DEV_LOCK_EFUSE);
for(i=0; i<MTP_MAX_LEN; i+=8){
DBG_8195A("[%d]\t%02X %02X %02X %02X %02X %02X %02X %02X\n",
i, buf[i], buf[i+1], buf[i+2], buf[i+3], buf[i+4], buf[i+5], buf[i+6], buf[i+7]);
}
DBG_8195A("efuse MTP block: Test Done\n");
vTaskDelete(NULL);
exit:
DBG_8195A("efuse MTP block: Test Fail!\n");
vTaskDelete(NULL);
}
void main(void)
{
if(xTaskCreate(efuse_mtp_task, ((const char*)"efuse_mtp_task"), 512, NULL, tskIDLE_PRIORITY + 1, NULL) != pdPASS)
printf("\n\r%s xTaskCreate(efuse_mtp_task) failed", __FUNCTION__);
/*Enable Schedule, Start Kernel*/
if(rtw_get_scheduler_state() == OS_SCHEDULER_NOT_STARTED)
vTaskStartScheduler();
else
vTaskDelete(NULL);
}

View file

@ -0,0 +1,10 @@
Example Description
This example describes how to read/write efuse in OTP.
OTP block has 32 bytes.
Requirement Components:
None

View file

@ -0,0 +1,81 @@
#include "FreeRTOS.h"
#include "task.h"
#include "diag.h"
#include "hal_efuse.h"
#include "efuse_api.h"
#include "osdep_service.h"
#include "device_lock.h"
//======================================================
// OTP : one time programming
//======================================================
#define OTP_MAX_LEN 32 // The OTP max length is 32 bytes
static void efuse_otp_task(void *param)
{
int ret;
u8 i, buf[OTP_MAX_LEN];
DBG_8195A("\nefuse OTP block: Test Start\n");
// read OTP content
device_mutex_lock(RT_DEV_LOCK_EFUSE);
ret = efuse_otp_read(0, OTP_MAX_LEN, buf);
device_mutex_unlock(RT_DEV_LOCK_EFUSE);
if(ret < 0){
DBG_8195A("efuse OTP block: read address and length error\n");
goto exit;
}
for(i=0; i<OTP_MAX_LEN; i+=8){
DBG_8195A("[%d]\t%02X %02X %02X %02X %02X %02X %02X %02X\n",
i, buf[i], buf[i+1], buf[i+2], buf[i+3], buf[i+4], buf[i+5], buf[i+6], buf[i+7]);
}
// write OTP content
_memset(buf, 0xFF, OTP_MAX_LEN);
if(0){ // fill your data
for(i=0; i<OTP_MAX_LEN; i++)
buf[i] = i;
}
if(0){ // write
device_mutex_lock(RT_DEV_LOCK_EFUSE);
ret = efuse_otp_write(0, OTP_MAX_LEN, buf);
device_mutex_unlock(RT_DEV_LOCK_EFUSE);
if(ret < 0){
DBG_8195A("efuse OTP block: write address and length error\n");
goto exit;
}
DBG_8195A("\nWrite Done.\n");
}
DBG_8195A("\n");
// read OTP content
device_mutex_lock(RT_DEV_LOCK_EFUSE);
ret = efuse_otp_read(0, OTP_MAX_LEN, buf);
device_mutex_unlock(RT_DEV_LOCK_EFUSE);
if(ret < 0){
DBG_8195A("efuse OTP block: read address and length error\n");
goto exit;
}
for(i=0; i<OTP_MAX_LEN; i+=8){
DBG_8195A("[%d]\t%02X %02X %02X %02X %02X %02X %02X %02X\n",
i, buf[i], buf[i+1], buf[i+2], buf[i+3], buf[i+4], buf[i+5], buf[i+6], buf[i+7]);
}
DBG_8195A("efuse OTP block: Test Done\n");
vTaskDelete(NULL);
exit:
DBG_8195A("efuse OTP block: Test Fail!\n");
vTaskDelete(NULL);
}
void main(void)
{
if(xTaskCreate(efuse_otp_task, ((const char*)"efuse_otp_task"), 512, NULL, tskIDLE_PRIORITY + 1, NULL) != pdPASS)
printf("\n\r%s xTaskCreate(efuse_otp_task) failed", __FUNCTION__);
/*Enable Schedule, Start Kernel*/
if(rtw_get_scheduler_state() == OS_SCHEDULER_NOT_STARTED)
vTaskStartScheduler();
else
vTaskDelete(NULL);
}

View file

@ -0,0 +1,44 @@
#include "FreeRTOS.h"
#include "task.h"
#include "diag.h"
#include "main.h"
#include "ethernet_api.h"
#include <example_entry.h>
extern void console_init(void);
/**
* @brief Main program.
* @param None
* @retval None
*/
void main(void)
{
if ( rtl_cryptoEngine_init() != 0 ) {
DiagPrintf("crypto engine init failed\r\n");
}
/* Initialize log uart and at command service */
console_init();
/* pre-processor of application example */
pre_example_entry();
/* wlan intialization */
#if defined(CONFIG_WIFI_NORMAL) && defined(CONFIG_NETWORK)
wlan_network();
#endif
ethernet_mii_init();// init ethernet driver
/* Execute application example */
example_entry();
/*Enable Schedule, Start Kernel*/
#if defined(CONFIG_KERNEL) && !TASK_SCHEDULER_DISABLED
#ifdef PLATFORM_FREERTOS
vTaskStartScheduler();
#endif
#else
RtlConsolTaskRom(NULL);
#endif
}

View file

@ -0,0 +1,8 @@
Example Description
This example read a specific flash offset, modify it and re-read again.
Requirement Components:
None

View file

@ -0,0 +1,119 @@
#include "FreeRTOS.h"
#include "task.h"
#include "diag.h"
#include "objects.h"
#include "flash_api.h"
#include "osdep_service.h"
#include "device_lock.h"
#include "main.h"
// Decide starting flash address for storing application data
// User should pick address carefully to avoid corrupting image section
#define FLASH_APP_BASE 0xFF000
static void flash_test_task(void *param)
{
flash_t flash;
uint32_t address = FLASH_APP_BASE;
#if 1
uint32_t val32_to_write = 0x13572468;
uint32_t val32_to_read;
int loop = 0;
int result = 0;
for(loop = 0; loop < 10; loop++)
{
device_mutex_lock(RT_DEV_LOCK_FLASH);
flash_read_word(&flash, address, &val32_to_read);
DBG_8195A("Read Data 0x%x\n", val32_to_read);
flash_erase_sector(&flash, address);
flash_write_word(&flash, address, val32_to_write);
flash_read_word(&flash, address, &val32_to_read);
device_mutex_unlock(RT_DEV_LOCK_FLASH);
DBG_8195A("Read Data 0x%x\n", val32_to_read);
// verify result
result = (val32_to_write == val32_to_read) ? 1 : 0;
//printf("\r\nResult is %s\r\n", (result) ? "success" : "fail");
DBG_8195A("\r\nResult is %s\r\n", (result) ? "success" : "fail");
result = 0;
}
#else
int VERIFY_SIZE = 256;
int SECTOR_SIZE = 16;
uint8_t writedata[VERIFY_SIZE];
uint8_t readdata[VERIFY_SIZE];
uint8_t verifydata = 0;
int loop = 0;
int index = 0;
int sectorindex = 0;
int result = 0;
int resultsector = 0;
int testloop = 0;
for(testloop = 0; testloop < 1; testloop++){
address = FLASH_APP_BASE;
for(sectorindex = 0; sectorindex < 4080; sectorindex++){
result = 0;
//address += SECTOR_SIZE;
device_mutex_lock(RT_DEV_LOCK_FLASH);
flash_erase_sector(&flash, address);
device_mutex_unlock(RT_DEV_LOCK_FLASH);
//DBG_8195A("Address = %x \n", address);
for(loop = 0; loop < SECTOR_SIZE; loop++){
for(index = 0; index < VERIFY_SIZE; index++)
{
writedata[index] = verifydata + index;
}
device_mutex_lock(RT_DEV_LOCK_FLASH);
flash_stream_write(&flash, address, VERIFY_SIZE, &writedata);
flash_stream_read(&flash, address, VERIFY_SIZE, &readdata);
device_mutex_unlock(RT_DEV_LOCK_FLASH);
for(index = 0; index < VERIFY_SIZE; index++)
{
//DBG_8195A("Address = %x, Writedata = %x, Readdata = %x \n",address,writedata[index],readdata[index]);
if(readdata[index] != writedata[index]){
DBG_8195A("Error: Loop = %d, Address = %x, Writedata = %x, Readdata = %x \n",testloop,address,writedata[index],readdata[index]);
}
else{
result++;
//DBG_8195A(ANSI_COLOR_BLUE"Correct: Loop = %d, Address = %x, Writedata = %x, Readdata = %x \n"ANSI_COLOR_RESET,testloop,address,writedata[index],readdata[index]);
}
}
address += VERIFY_SIZE;
}
if(result == VERIFY_SIZE * SECTOR_SIZE){
//DBG_8195A("Sector %d Success \n", sectorindex);
resultsector++;
}
}
if(resultsector == 4079){
DBG_8195A("Test Loop %d Success \n", testloop);
}
resultsector = 0;
verifydata++;
}
//DBG_8195A("%d Sector Success \n", resultsector);
DBG_8195A("Test Done");
#endif
vTaskDelete(NULL);
}
void main(void)
{
if(xTaskCreate(flash_test_task, ((const char*)"flash_test_task"), 1024, NULL, tskIDLE_PRIORITY + 1, NULL) != pdPASS)
printf("\n\r%s xTaskCreate(flash_test_task) failed", __FUNCTION__);
/*Enable Schedule, Start Kernel*/
if(rtw_get_scheduler_state() == OS_SCHEDULER_NOT_STARTED)
vTaskStartScheduler();
else
vTaskDelete(NULL);
}

View file

@ -0,0 +1,168 @@
/*
* Routines to access hardware
*
* Copyright (c) 2015 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "device.h"
#include "diag.h"
#include "main.h"
#include "dma_api.h"
#if 1
//Multi-Block Example Demo
#define DMA_CPY_LEN 176
#define DMA_BLOCK_LENGTH 22
#define DMA_SRC_OFFSET 0
#define DMA_DST_OFFSET 0
#define BLOCK_NUM 8
gdma_t gdma;
uint8_t TestBuf1[DMA_CPY_LEN];
uint8_t TestBuf2[DMA_CPY_LEN];
volatile uint8_t dma_done;
struct BlockInfo{
u32 SrcAddr;
u32 DstAddr;
u32 BlockLength;
u32 SrcOffset;
u32 DstOffset;
};
void dma_done_handler(uint32_t id) {
DiagPrintf("DMA Copy Done!!\r\n");
dma_done = 1;
}
int main(void) {
int i = 0,err = 0;
struct BlockInfo block_info[BLOCK_NUM];
//Set how many blocks we want to transfer (16 at most)
gdma.gdma_obj.BlockNum = BLOCK_NUM;
//Initialize DMA multi-block mode setting
dma_memcpy_aggr_init(&gdma, dma_done_handler, (uint32_t) &gdma);
_memset(TestBuf1, 0,DMA_CPY_LEN);
for(i = 0; i < DMA_CPY_LEN; i++){
TestBuf1[i] = DMA_CPY_LEN - 1 - i;
}
_memset(TestBuf2, 0,DMA_CPY_LEN);
dma_done = 0;
for(i = 0; i < BLOCK_NUM; i++){
//User can decide the relation between SrcOffset/DstOffset,SrcAddr/DstAddr and Block length
// For example :
//block_info[i].SrcOffset = 0;
//block_info[i].DstOffset = 4;
//block_info[i].SrcAddr = &TestBuf1[ i * DMA_BLOCK_LENGTH] ;//SRC
//block_info[i].DstAddr = &TestBuf2[0] + (DMA_BLOCK_LENGTH + block_info[i].DstOffset )*i;//Dest
//block_info[i].BlockLength = DMA_BLOCK_LENGTH;
block_info[i].SrcOffset = 0;
block_info[i].DstOffset = 0;
block_info[i].SrcAddr = (uint32_t) &TestBuf1[ i * DMA_BLOCK_LENGTH] ;//SRC
block_info[i].DstAddr = (uint32_t) &TestBuf2[ i * DMA_BLOCK_LENGTH] ;//Dest
block_info[i].BlockLength = DMA_BLOCK_LENGTH;
//DiagPrintf("block_info[%d].SrcAddr = %x\r\n",i, block_info[i].SrcAddr);
//DiagPrintf("block_info[%d].DstAddr = %x\r\n",i, block_info[i].DstAddr);
//DiagPrintf("block_info[%d].BlockLength = %x\r\n",i, block_info[i].BlockLength);
//DiagPrintf("block_info[%d].SrcOffset = %x\r\n",i, block_info[i].SrcOffset);
//DiagPrintf("block_info[%d].DstOffset = %x\r\n",i, block_info[i].DstOffset);
}
dma_memcpy_aggr(&gdma, (PHAL_GDMA_BLOCK) &block_info);
while (dma_done == 0);
err = 0;
for (i=0;i<DMA_CPY_LEN;i++) {
//DiagPrintf("dma_done = %x\r\n", dma_done);
//DiagPrintf("TestBuf2[%d] = %x\r\n",i, TestBuf2[i]);
if (TestBuf2[i+DMA_DST_OFFSET] != TestBuf1[i+DMA_SRC_OFFSET]) {
DiagPrintf("DMA Copy Memory Compare Err, %d %x %x\r\n", i, TestBuf1[i+DMA_SRC_OFFSET], TestBuf2[i+DMA_DST_OFFSET]);
DiagPrintf("DMA done = %x\r\n", dma_done);
err = 1;
break;
}
}
if (!err) {
DiagPrintf("DMA Copy Memory Compare OK!! %x\r\n", TestBuf2[DMA_DST_OFFSET+DMA_CPY_LEN - 1]);
}
HalGdmaMemCpyDeInit(&(gdma.gdma_obj));
while(1){
asm volatile ("nop\n\t");//If run in non-os environment,it needs to add nop operation
asm volatile ("nop\n\t");
asm volatile ("nop\n\t");
asm volatile ("nop\n\t");
}
return 0;
}
#else
//Single-Block Example Demo
#define DMA_CPY_LEN 256
#define DMA_SRC_OFFSET 0
#define DMA_DST_OFFSET 0
gdma_t gdma;
uint8_t TestBuf1[512];
uint8_t TestBuf2[512];
volatile uint8_t dma_done;
void dma_done_handler(uint32_t id) {
DiagPrintf("DMA Copy Done!!\r\n");
dma_done = 1;
}
int main(void) {
int i;
int err;
dma_memcpy_init(&gdma, dma_done_handler, (uint32_t)&gdma);
for (i=0;i< 512;i++) {
TestBuf1[i] = i;
}
_memset(TestBuf2, 0xff, 512);
dma_done = 0;
dma_memcpy(&gdma, TestBuf2+DMA_DST_OFFSET, TestBuf1+DMA_SRC_OFFSET, DMA_CPY_LEN);
while (dma_done == 0);
err = 0;
for (i=0;i<DMA_CPY_LEN;i++) {
if (TestBuf2[i+DMA_DST_OFFSET] != TestBuf1[i+DMA_SRC_OFFSET]) {
DiagPrintf("DMA Copy Memory Compare Err, %d %x %x\r\n", i, TestBuf1[i+DMA_SRC_OFFSET], TestBuf2[i+DMA_DST_OFFSET]);
err = 1;
break;
}
}
if (!err) {
DiagPrintf("DMA Copy Memory Compare OK!! %x\r\n", TestBuf2[DMA_DST_OFFSET+DMA_CPY_LEN]);
}
HalGdmaMemCpyDeInit(&(gdma.gdma_obj));
while(1){
asm volatile ("nop\n\t");//If run in non-os environment,it needs to add nop operation
asm volatile ("nop\n\t");
asm volatile ("nop\n\t");
asm volatile ("nop\n\t");
}
return 0;
}
#endif

View file

@ -0,0 +1,14 @@
Example Description
This example describes how to use GPIO read/write by mbed api.
Requirement Components:
a LED
a push button
Pin name PC_4 and PC_5 map to GPIOC_4 and GPIOC_5:
- PC_4 as input with internal pull-high, connect a push button to this pin and ground.
- PC_5 as output, connect a LED to this pin and ground.
In this example, the LED is on when the push button is pressed.

View file

@ -0,0 +1,49 @@
/*
* Routines to access hardware
*
* Copyright (c) 2013 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "device.h"
#include "gpio_api.h" // mbed
#include "main.h"
#define GPIO_LED_PIN PC_5
#define GPIO_PUSHBT_PIN PC_4
/**
* @brief Main program.
* @param None
* @retval None
*/
//int main_app(IN u16 argc, IN u8 *argv[])
void main(void)
{
gpio_t gpio_led;
gpio_t gpio_btn;
// Init LED control pin
gpio_init(&gpio_led, GPIO_LED_PIN);
gpio_dir(&gpio_led, PIN_OUTPUT); // Direction: Output
gpio_mode(&gpio_led, PullNone); // No pull
// Initial Push Button pin
gpio_init(&gpio_btn, GPIO_PUSHBT_PIN);
gpio_dir(&gpio_btn, PIN_INPUT); // Direction: Input
gpio_mode(&gpio_btn, PullUp); // Pull-High
while(1){
if (gpio_read(&gpio_btn)) {
// turn off LED
gpio_write(&gpio_led, 0);
}
else {
// turn on LED
gpio_write(&gpio_led, 1);
}
}
}

View file

@ -0,0 +1,13 @@
Example Description
This example describes how to use GPIO read/write by mbed api.
Requirement Components:
a LED
a push button
Pin name PC_4 and PC_5 map to GPIOC_4 and GPIOC_5:
- PC_4 as input with internal pull-high, connect a push button to this pin and ground.
- PC_5 as output, connect a LED to this pin and ground.
In this example, push the button to trigger interrupt to turn on/off the LED.

View file

@ -0,0 +1,59 @@
/*
* Routines to access hardware
*
* Copyright (c) 2013 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "device.h"
#include "gpio_api.h" // mbed
#include "gpio_irq_api.h" // mbed
#include "diag.h"
#include "main.h"
#define GPIO_LED_PIN PC_5
#define GPIO_IRQ_PIN PC_4
int led_ctrl;
gpio_t gpio_led;
extern u32 ConfigDebugWarn;
void gpio_demo_irq_handler (uint32_t id, gpio_irq_event event)
{
gpio_t *gpio_led;
DBG_GPIO_WARN("%s==>\n", __FUNCTION__);
gpio_led = (gpio_t *)id;
led_ctrl = !led_ctrl;
gpio_write(gpio_led, led_ctrl);
}
/**
* @brief Main program.
* @param None
* @retval None
*/
void main(void)
{
gpio_irq_t gpio_btn;
// Init LED control pin
gpio_init(&gpio_led, GPIO_LED_PIN);
gpio_dir(&gpio_led, PIN_OUTPUT); // Direction: Output
gpio_mode(&gpio_led, PullNone); // No pull
// Initial Push Button pin as interrupt source
gpio_irq_init(&gpio_btn, GPIO_IRQ_PIN, gpio_demo_irq_handler, (uint32_t)(&gpio_led));
gpio_irq_set(&gpio_btn, IRQ_FALL, 1); // Falling Edge Trigger
gpio_irq_enable(&gpio_btn);
led_ctrl = 1;
gpio_write(&gpio_led, led_ctrl);
while(1);
}

View file

@ -0,0 +1,14 @@
Example Description
This example describes how to disable JTAG module and use GPIO pin to blink led.
Requirement Components:
a LED
a push button
PC_4 as input with internal pull-high, connect a push button to this pin and ground.
If button is not pressed while device boot up, then jtag module is turned off.
If button is pressed while device boot up, then we don't turn off jtag module.
PE_0 as output, connect a LED to this pin and ground.
If jatg module is turned off, then we blink led.

View file

@ -0,0 +1,56 @@
/*
* Routines to access hardware
*
* Copyright (c) 2013 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "device.h"
#include "gpio_api.h" // mbed
#include "sys_api.h" // for sys_jtag_off()
#include "main.h"
#define GPIO_JTAG_ENABLE_PIN PC_4
#define GPIO_LED_PIN PE_0
void main(void)
{
int i;
gpio_t gpio_jtag_enable;
gpio_t gpio_led;
gpio_init(&gpio_jtag_enable, GPIO_JTAG_ENABLE_PIN);
gpio_dir(&gpio_jtag_enable, PIN_INPUT);
gpio_mode(&gpio_jtag_enable, PullUp);
if (gpio_read(&gpio_jtag_enable) == 0)
{
// JTAG enable pin is disabled
sys_jtag_off();
printf("jtag off\r\n");
// Now you can use jtag pin for other gpio usage
// ex. use PE_0 to blink led
gpio_init(&gpio_led, GPIO_LED_PIN);
gpio_dir(&gpio_led, PIN_OUTPUT); // Direction: Output
gpio_mode(&gpio_led, PullNone); // No pull
while(1)
{
gpio_write(&gpio_led, 1);
for (i=0; i<10000000; i++) asm(" nop"); // simple delay
gpio_write(&gpio_led, 0);
for (i=0; i<10000000; i++) asm(" nop"); // simple delay
}
}
else
{
// JTAG enable pin is enabled
printf("jtag on\r\n");
}
for (;;);
}

View file

@ -0,0 +1,21 @@
Example Description
This example describes how to implement high/low level trigger on 1 gpio pin.
Pin name PC_4 and PC_5 map to GPIOC_4 and GPIOC_5:
Connect PC_4 and PC_5
- PC_4 as gpio input high/low level trigger.
- PC_5 as gpio output
In this example, PC_5 is signal source that change level to high and low periodically.
PC_4 setup to listen low level events in initial.
When PC_4 catch low level events, it disable the irq to avoid receiving duplicate events.
(NOTE: the level events will keep invoked if level keeps in same level)
Then PC_4 is configured to listen high level events and enable irq.
As PC_4 catches high level events, it changes back to listen low level events.
Thus PC_4 can handle both high/low level events.
In this example, you will see log that prints high/low level event periodically.

View file

@ -0,0 +1,73 @@
/*
* Routines to access hardware
*
* Copyright (c) 2015 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "device.h"
#include "gpio_irq_api.h" // mbed
#include "gpio_irq_ex_api.h"
#include "diag.h"
#include "main.h"
#define GPIO_IRQ_LEVEL_PIN PC_4
#define GPIO_SIGNAL_SOURCE PC_5
gpio_irq_t gpio_level;
int current_level = IRQ_LOW;
void gpio_level_irq_handler (uint32_t id, gpio_irq_event event)
{
uint32_t *level = (uint32_t *) id;
// Disable level irq because the irq will keep triggered when it keeps in same level.
gpio_irq_disable(&gpio_level);
// make some software de-bounce here if the signal source is not stable.
if (*level == IRQ_LOW )
{
printf("low level event\r\n");
// Change to listen to high level event
*level = IRQ_HIGH;
gpio_irq_set(&gpio_level, IRQ_HIGH, 1);
gpio_irq_enable(&gpio_level);
}
else if (*level == IRQ_HIGH)
{
printf("high level event\r\n");
// Change to listen to low level event
*level = IRQ_LOW;
gpio_irq_set(&gpio_level, IRQ_LOW, 1);
gpio_irq_enable(&gpio_level);
}
}
void main(void)
{
int i;
// configure level trigger handler
gpio_irq_init(&gpio_level, GPIO_IRQ_LEVEL_PIN, gpio_level_irq_handler, (uint32_t)(&current_level));
gpio_irq_set(&gpio_level, IRQ_LOW, 1);
gpio_irq_enable(&gpio_level);
// configure gpio as signal source for high/low level trigger
gpio_t gpio_src;
gpio_init(&gpio_src, GPIO_SIGNAL_SOURCE);
gpio_dir(&gpio_src, PIN_OUTPUT); // Direction: Output
gpio_mode(&gpio_src, PullNone);
while(1) {
gpio_write(&gpio_src, 1);
for (i=0; i<20000000; i++) asm("nop");
gpio_write(&gpio_src, 0);
for (i=0; i<20000000; i++) asm("nop");
}
}

View file

@ -0,0 +1,13 @@
Example Description
This example describes how to use GPIO read/write in a light weight way.
Requirement Components:
a LED
a push button
Pin name PC_4 and PC_5 map to GPIOC_4 and GPIOC_5:
- PC_4 as input with internal pull-high, connect a push button to this pin and ground.
- PC_5 as output, connect a LED to this pin and ground.
In this example, the LED is on when the push button is pressed.

View file

@ -0,0 +1,77 @@
/*
* Routines to access hardware
*
* Copyright (c) 2013 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "device.h"
#include "gpio_api.h" // mbed
#include "main.h"
#define GPIO_LED_PIN PC_5
#define GPIO_PUSHBT_PIN PC_4
/* You can improve time cost of gpio write by import source code of
* function "gpio_direct_write" based on your needs.
* In this example, enable CACHE_WRITE_ACTION as demonstration.
*/
#define CACHE_WRITE_ACTION (0)
#if defined(CACHE_WRITE_ACTION) && (CACHE_WRITE_ACTION == 1)
const u8 _GPIO_SWPORT_DR_TBL[] = {
GPIO_PORTA_DR,
GPIO_PORTB_DR,
GPIO_PORTC_DR
};
#endif
void main(void)
{
gpio_t gpio_led;
gpio_t gpio_btn;
// Init LED control pin
gpio_init(&gpio_led, GPIO_LED_PIN);
gpio_dir(&gpio_led, PIN_OUTPUT); // Direction: Output
gpio_mode(&gpio_led, PullNone); // No pull
// Initial Push Button pin
gpio_init(&gpio_btn, GPIO_PUSHBT_PIN);
gpio_dir(&gpio_btn, PIN_INPUT); // Direction: Input
gpio_mode(&gpio_btn, PullUp); // Pull-High
#if defined(CACHE_WRITE_ACTION) && (CACHE_WRITE_ACTION == 1)
u8 port_num = HAL_GPIO_GET_PORT_BY_NAME(gpio_led.hal_pin.pin_name);;
u8 pin_num = HAL_GPIO_GET_PIN_BY_NAME(gpio_led.hal_pin.pin_name);;
u8 dr_tbl = _GPIO_SWPORT_DR_TBL[port_num];
u32 RegValue;
#endif
while(1){
#if defined(CACHE_WRITE_ACTION) && (CACHE_WRITE_ACTION == 1)
if (gpio_read(&gpio_btn)) {
// turn off LED
RegValue = HAL_READ32(GPIO_REG_BASE, dr_tbl);
RegValue &= ~(1 << pin_num);
HAL_WRITE32(GPIO_REG_BASE, dr_tbl, RegValue);
} else {
// turn on LED
RegValue = HAL_READ32(GPIO_REG_BASE, dr_tbl);
RegValue |= (1<< pin_num);
HAL_WRITE32(GPIO_REG_BASE, dr_tbl, RegValue);
}
#else
if (gpio_read(&gpio_btn)) {
// turn off LED
gpio_direct_write(&gpio_led, 0);
} else {
// turn on LED
gpio_direct_write(&gpio_led, 1);
}
#endif
}
}

View file

@ -0,0 +1,11 @@
Example Description
This example describes how to use microseconds api to generate pulse
Requirement Components:
logical analyser or oscilloscope
Pin name PC_0 GPIOC_0:
- PC_0 as output, connect a logical analyser or oscilloscope
In this example, PC_0 will generate a pulse with width from 1us to 200us periodically.

View file

@ -0,0 +1,158 @@
#include "FreeRTOS.h"
#include "task.h"
#include "diag.h"
#include "main.h"
#include <stdint.h>
#include <example_entry.h>
#include "rtl8195a.h"
#include "gpio_api.h"
extern void console_init(void);
#define GPIO_OUTPUT_PIN PC_0
#ifndef portNVIC_SYSTICK_CURRENT_VALUE_REG
#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile uint32_t * ) 0xe000e018 ) )
#endif
#define portOutputRegister(P) ( (volatile uint32_t *)( 0x40001000 + (P) * 0x0C ) )
void delay( uint32_t ms );
void delayMicroseconds(uint32_t us);
uint32_t millis( void );
uint32_t micros( void );
void delay( uint32_t ms ) {
vTaskDelay(ms);
}
/*
* This API implemented from a busy loop with CPU assembly "nop" (no operation).
* The accuracy is mostly less than 0.5us. The parameter inside is corrected from
* logical analysier. You can try to make it more precisely by changing parameters
* inside.
**/
void delayMicroseconds( uint32_t us ) {
int i, j;
uint32_t t0, tn;
if ( us > 100) {
t0 = micros();
do {
tn = micros();
} while ( tn >= t0 && tn < (t0 + us - 1) );
} else {
for (i=0; i<us; i++) {
for (j=0; j<27; j++) {
asm("nop");
}
}
}
}
uint32_t millis( void ) {
return (__get_IPSR() == 0) ? xTaskGetTickCount() : xTaskGetTickCountFromISR();
}
/*
* This API return current system time in unit of microseconds.
* It comebines 2 parts: milliseconds and microseconds.
* Millisecond is retrieved from system tick.
* Microsecond is retrieved from Cortex-M3 CPU clock register.
* The microsecond part assumes that CPU clock frequency is 166MHz.
* Please note that calling this API would cost around 1~2 microseconds.
**/
uint32_t micros( void ) {
uint32_t tick1, tick2;
uint32_t us;
if (__get_IPSR() == 0) {
tick1 = xTaskGetTickCount();
us = portNVIC_SYSTICK_CURRENT_VALUE_REG;
tick2 = xTaskGetTickCount();
} else {
tick1 = xTaskGetTickCountFromISR();
us = portNVIC_SYSTICK_CURRENT_VALUE_REG;
tick2 = xTaskGetTickCountFromISR();
}
if (tick1 == tick2) {
return tick1 * 1000 - us / 167;
} else if( (us / 167) < 500 ) {
return tick1 * 1000 - us / 167;
} else {
return tick1 * 1000;
}
}
/*
* This thread demonstrate how to use microseconds delay.
* In this thread we configure a gpio as output pin and generate pulses with interval from 1us to 200us.
* Then delay 2s and repeat again. You can check this signal on logical analyser or oscilloscope with
* microsecond precision.
*
* INPORTANT NOTICE:
* The delayMicroseconds API uses CPU clock resource. It means it cannot be interrupted otherwise it
* would be out of precision. We disable interrupt before using this API, and then enable interrupt
* after that. Thus it sutibles to situation (Ex. IR) that only occupy a short period of time. And
* it's not recommended to apply on microseconds lelvel PWM.
*/
static void delay_demo_thread(void *param) {
gpio_t gpio_out;
uint32_t port, mask;
uint32_t delay_interval;
gpio_init(&gpio_out, GPIO_OUTPUT_PIN);
gpio_dir(&gpio_out, PIN_OUTPUT);
gpio_mode(&gpio_out, PullNone);
gpio_write(&gpio_out, 0);
port = gpio_out.hal_port_num;
mask = 1 << (gpio_out.hal_pin_num);
while (1) {
taskDISABLE_INTERRUPTS();
for (delay_interval = 1; delay_interval <=200; delay_interval++) {
*portOutputRegister( port ) |= mask;
delayMicroseconds( delay_interval );
*portOutputRegister( port ) &= ~mask;
delayMicroseconds( delay_interval );
}
taskENABLE_INTERRUPTS();
delay(2000);
}
}
/**
* @brief Main program.
* @param None
* @retval None
*/
void main(void)
{
/* Initialize log uart and at command service */
console_init();
/* pre-processor of application example */
pre_example_entry();
/* wlan intialization */
#if defined(CONFIG_WIFI_NORMAL) && defined(CONFIG_NETWORK)
wlan_network();
#endif
/* Execute application example */
example_entry();
if(xTaskCreate(delay_demo_thread, ((const char*)"delay_demo_thread"), 1024, NULL, tskIDLE_PRIORITY+1 , NULL) != pdPASS)
printf("\n\r%s xTaskCreate(delay_demo_thread) failed", __FUNCTION__);
/*Enable Schedule, Start Kernel*/
#if defined(CONFIG_KERNEL) && !TASK_SCHEDULER_DISABLED
#ifdef PLATFORM_FREERTOS
vTaskStartScheduler();
#endif
#else
RtlConsolTaskRom(NULL);
#endif
}

View file

@ -0,0 +1,9 @@
Example Description
This example describes how to use GPIO Port read/write by mbed api.
Requirement Components:
8 LEDs
2 bords

View file

@ -0,0 +1,96 @@
/*
* Routines to access hardware
*
* Copyright (c) 2013 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "device.h"
#include "port_api.h" // mbed
#include "PortNames.h" // mbed
#include "main.h"
#define PORT_OUTPUT_TEST 1 //1: output test, 0: input test
#define LED_PATTERN_NUM 12
port_t port0;
const uint8_t led_pattern[LED_PATTERN_NUM]={0x81, 0x42, 0x24, 0x18, 0x00, 0x88, 0x44, 0x22, 0x11, 0xff, 0x00};
const uint8_t My_Port_Def[] = {
PA_6, PA_7, PA_5, PD_4,
PD_5, PA_4, PA_3, PA_2,
0xFF // must end with 0xFF
};
extern void wait_ms(u32);
/**
* @brief Main program.
* @param None
* @retval None
*/
#if PORT_OUTPUT_TEST
void main(void)
{
int i;
unsigned int pin_mask;
port_mode(&port0, PullNone);
// Assign pins to this port
port0.pin_def = (uint8_t *)My_Port_Def;
pin_mask = 0xFF; // each bit map to 1 pin: 0: pin disable, 1: pin enable
port_init(&port0, PortA, pin_mask, PIN_OUTPUT);
while(1){
for (i=0;i<LED_PATTERN_NUM;i++) {
port_write(&port0, led_pattern[i]);
wait_ms(200);
}
}
}
#else
void main(void)
{
int i;
unsigned int pin_mask;
int value_new, value_tmp, value_old;
int stable;
port_mode(&port0, PullNone);
// Assign pins to this port
port0.pin_def = My_Port_Def;
pin_mask = 0xFF; // each bit map to 1 pin: 0: pin disable, 1: pin enable
port_init(&port0, PortA, pin_mask, PIN_INPUT);
value_old = port_read(&port0);
while(1){
// De-bonse
value_new = port_read(&port0);
stable = 0;
while (stable < 3){
value_tmp = port_read(&port0);
if (value_new != value_tmp) {
value_new = value_tmp;
stable = 0;
}
else {
stable++;
}
}
if (value_old != value_new) {
DBG_8195A("0x%x\r\n", value_new);
value_old = value_new;
}
wait_ms(50);
}
}
#endif

View file

@ -0,0 +1,13 @@
Example Description
This example describes how to use GPIO read/write mbed api to generate a pulse and to measure the pulse width.
Requirement Components:
a wire
Pin name PC_4 and PC_5 map to GPIOC_4 and GPIOC_5:
- PC_4 as the interrupt GPIO pin with no pull (High-Z).
- PC_5 as output to generate a pulse.
- Use a wire to connect PC_4 and PC_5
In this example, the UART consol will print out the measured width (in us) of the pulse which generated by PC_5.

View file

@ -0,0 +1,73 @@
/*
* Routines to access hardware
*
* Copyright (c) 2013 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "device.h"
#include "gpio_api.h" // mbed
#include "gpio_irq_api.h" // mbed
#include "diag.h"
#include "us_ticker_api.h"
#include "main.h"
#define GPIO_OUT_PIN PC_5
#define GPIO_IRQ_PIN PC_4
gpio_t gpio_out;
gpio_irq_t gpio_irq;
volatile char irq_rise;
void gpio_demo_irq_handler (uint32_t id, gpio_irq_event event)
{
static unsigned int rise_time;
static unsigned int fall_time;
if (irq_rise) {
rise_time = us_ticker_read();
// Changed as Falling Edge Trigger
gpio_irq_set_event(&gpio_irq, IRQ_FALL);
irq_rise = 0;
} else {
fall_time = us_ticker_read();
// Changed as Rising Edge Trigger
gpio_irq_set_event(&gpio_irq, IRQ_RISE);
irq_rise = 1;
DBG_8195A("%d\n", (fall_time-rise_time));
}
}
/**
* @brief Main program.
* @param None
* @retval None
*/
void main(void)
{
// Init LED control pin
gpio_init(&gpio_out, GPIO_OUT_PIN);
gpio_dir(&gpio_out, PIN_OUTPUT); // Direction: Output
gpio_mode(&gpio_out, PullNone); // No pull
gpio_write(&gpio_out, 0);
// Initial Push Button pin as interrupt source
gpio_irq_init(&gpio_irq, GPIO_IRQ_PIN, gpio_demo_irq_handler, (uint32_t)(&gpio_irq));
gpio_irq_set(&gpio_irq, IRQ_RISE, 1); // Falling Edge Trigger
irq_rise = 1;
gpio_irq_pull_ctrl(&gpio_irq, PullNone);
gpio_irq_enable(&gpio_irq);
while(1) {
wait_ms(500);
gpio_write(&gpio_out, 1);
wait_us(1000);
gpio_write(&gpio_out, 0);
}
}

View file

@ -0,0 +1,48 @@
Example Description
This example describes how to communicate with Ameba gspi interface.
How to build:
1. copy src\main.c to project\realtek_ameba1_va0_example\src
2. include lib\lib_sdiod.a for build, then re-build the project
This example source code(mian.c) contain both GSPI slave code and SPI master code, you can use "CONFIG_GPSI_SLAVE" to chose which dirver to run.
"#define CONFIG_GPSI_SLAVE 1" for GSPI Slave(NOTE: lib_sdiod.a is need for released SDK)
"#define CONFIG_GPSI_SLAVE 0" for SPI master
Requirement Components:
2 Ameba DEV_3V0
Ameba (A): Assign as SPI master
SCK: PC_1(D13)
CS: PB_2(D15)
MOSI: PC_2(D11)
MISO: PC_3(D12)
INT: PB_4(D8)
Ameba (B): Assign as GSPI slave
SPI_IN: PA_4(D5)
SPI_OUT:PA_2(D7)
SPI_CLK:PA_3(D6)
SPI_CS: PA_1(D16)
SPI_INT:PA_5(D2)
Setup:connect A and B as given
A: B:
SCK --- SPI_CLK
CS --- SPI_CS
MOSI--- SPI_OUT
MISO--- SPI_IN
INT --- SPI_INT
V3.3--- V3.3
GND --- GND
Behavior:
A send 2048 bytes to B and B will send whatever recived abck to A

View file

@ -0,0 +1,862 @@
/*
* Routines to access hardware
*
* Copyright (c) 2015 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#include "device.h"
#include "rtl8195a_gspi.h"
#include "spi_api.h"
#include "spi_ex_api.h"
#include "gpio_api.h"
#include "gpio_irq_api.h"
#include "osdep_service.h"
#define CONFIG_GSPI_SLAVE 0
#define CONFIG_USE_INTERRUPT 1
#define PACK_SIZE 2048
#if !CONFIG_GSPI_SLAVE
/*host endian configuration
little-endian (1)
big-endan (0)
*/
#define CONFIG_HOST_ENDIAN 1
// SPI0
#define SPI0_MOSI PC_2
#define SPI0_MISO PC_3
#define SPI0_SCLK PC_1
#define SPI0_CS PC_0 // This pin is redundant
#if CONFIG_USE_INTERRUPT
#define GPIO_INT PB_4 // gspi external interrupt
#endif
#define GPIO_CS PB_2
#define SPI0_FREQUENCY 20000000
static spi_t spi0_master;
static gpio_irq_t gpio_int;
static gpio_t gpio_cs;
typedef enum {
READ_REG = 0,
WRITE_REG
}_reg_ops;
// GSPI configuration (big endian recommended)
#define GSPI_CONFIG SPI_BIG_ENDIAN_32
// SPI master configuration
#define SPI_BITS 8 // Ameba SPI support 8bits and 16bits mode
struct spi_more_data {
unsigned long more_data;
unsigned long len;
};
#define SLAVE_SELECT() gpio_write(&gpio_cs, 0)
#define SLAVE_DESELECT() gpio_write(&gpio_cs, 1)
#define SPI_DUMMY 0xFF
// spi interrupt semaphore
_sema pspiIrqSemaphore;
// spi bus busy
_mutex SPIbusbusy;
volatile bool txDone = FALSE;
volatile bool rxDone = FALSE;
volatile bool txbusIdle = FALSE;
#define AGG_SIZE 5000
#define MAX_DUMMY_LEN 3
#define BUFFER_LEN 4+24+PACK_SIZE+8+MAX_DUMMY_LEN // GSPI_CMD + TX_DEC + DATA + GSPI_STATUS
unsigned char TX_DATA[PACK_SIZE];
unsigned char RX_DATA[AGG_SIZE+100]; // extra 100 byte for SDIO header
unsigned char TX_BUFFER[BUFFER_LEN];
unsigned char RX_BUFFER[BUFFER_LEN];
#endif
#define TASK_STACK_SIZE 2048
#define TASK_PRIORITY (tskIDLE_PRIORITY + 1)
#if CONFIG_GSPI_SLAVE
#include "spdio_api.h"
struct spdio_t spdio_dev;
#define SPDIO_TX_BD_NUM 6 // n*2, must be rounded to 2
#define SPDIO_RX_BD_NUM 6 //
#define SPDIO_RX_BUFSZ PACK_SIZE+64 //n*64, must be rounded to 64, extra 64 for TX descriptor
#define CONFIG_RX_BUFFER_REUSE 1
/*
* param: pdata, package
*/
char ex_gspi_tx(u8 *pdata, u16 size, u8 type){
static int rx_cnt = 0;
// LOOPBACK
printf("receive package, size = %d (cnt = %d) heap=%d\n", size, ++rx_cnt, xPortGetFreeHeapSize());
struct spdio_buf_t *tx_buf = (struct spdio_buf_t *)rtw_malloc(sizeof(struct spdio_buf_t));
if(!tx_buf)
return FAIL;
tx_buf->buf_allocated = (u32)rtw_malloc(size + SPDIO_DMA_ALIGN_4);
if(!tx_buf->buf_allocated)
{
rtw_mfree((u8 *)tx_buf, sizeof(struct spdio_buf_t));
return FAIL;
}
tx_buf->size_allocated = size + SPDIO_DMA_ALIGN_4;
tx_buf->buf_addr = (u32)N_BYTE_ALIGMENT((u32)(tx_buf->buf_allocated), SPDIO_DMA_ALIGN_4);
//printf("buf_addr = %x\n", tx_buf->buf_addr);
// copy data
memcpy((void*)tx_buf->buf_addr, pdata, size);
tx_buf->buf_size = size;
tx_buf->type = SPDIO_RX_DATA_USER; // you can define your own data type in spdio_rx_data_t and spdio_tx_data_t
// loopback
spdio_tx(&spdio_dev, tx_buf);
return SUCCESS;
}
/*spdio rx done callback (HOST->Device), manage your package and buffer*/
char ex_gspi_rx_done_cb(void *priv, void *pbuf, u8 *pdata, u16 size, u8 type){
struct spdio_t *obj = (struct spdio_t *)priv;
struct spdio_buf_t* rx_buf = (struct spdio_buf_t*)pbuf;
//2 handle package received
ex_gspi_tx(pdata, size, type);
#if !CONFIG_RX_BUFFER_REUSE
// manage rx_buf here
rtw_mfree((char *)rx_buf->buf_allocated, rx_buf->size_allocated);
//2 assign new buffer to RX
rx_buf->buf_allocated = (u32)rtw_malloc(obj->rx_bd_bufsz + SPDIO_DMA_ALIGN_4);
rx_buf->size_allocated = obj->rx_bd_bufsz + SPDIO_DMA_ALIGN_4;
// this buffer must be 4 byte alignment
rx_buf->buf_addr = (u32)N_BYTE_ALIGMENT((u32)(rx_buf->buf_allocated), SPDIO_DMA_ALIGN_4);
#endif
return SUCCESS;
}
/*spdio tx done callback(Device->HOST), manage buffer*/
// this API will be called after package have been read by HOST
char ex_gspi_tx_done_cb(void *priv, void *pbuf){
struct spdio_buf_t* tx_buf = (struct spdio_buf_t*)pbuf;
rtw_mfree((u8 *)tx_buf->buf_allocated, tx_buf->size_allocated);
rtw_mfree((u8 *)tx_buf, sizeof(struct spdio_buf_t));
return SUCCESS;
}
#else
int spi_transfer(uint8_t* buf, uint32_t buf_len)
{
int i = 0;
int ret = 0;
rtw_mutex_get(&SPIbusbusy);
SLAVE_SELECT();
txbusIdle = FALSE; // ensure TX done
rxDone = FALSE; // ensure RX done
if(spi_master_write_read_stream(&spi0_master, buf, buf, buf_len)!=0x00){
ret = -1;
}else{
ret = 0;
while((!txbusIdle) || (!rxDone)){
wait_us(20);
if (++i > 2000) {
DBG_8195A("SPI write and read Timeout...\r\n");
ret = -1;
break;
}
}
}
/* Chip Select Pull High */
SLAVE_DESELECT();
rtw_mutex_put(&SPIbusbusy);
return ret;
}
static int addr_convert(u32 addr)
{
u32 domain_id = 0 ;
u32 temp_addr = addr&0xffff0000;
switch (temp_addr) {
case SPI_LOCAL_OFFSET:
domain_id = SPI_LOCAL_DOMAIN;
break;
case SPI_TX_FIFO_OFFSET:
domain_id = SPI_TXFIFO_DOMAIN;
break;
case SPI_RX_FIFO_OFFSET:
domain_id = SPI_RXFIFO_DOMAIN;
break;
default:
break;
}
return domain_id;
}
static inline u32 DWORD_endian_reverse(u32 src, _gspi_conf_t gspi_conf)
{
u32 temp = 0;
switch(gspi_conf){
#if CONFIG_HOST_ENDIAN /*host little-endian*/
case SPI_LITTLE_ENDIAN_16:
temp = (((src&0x000000ff)<<8)|((src&0x0000ff00)>>8)|
((src&0x00ff0000)<<8)|((src&0xff000000)>>8));
break;
case SPI_LITTLE_ENDIAN_32:
temp = (((src&0x000000ff)<<24)|((src&0x0000ff00)<<8)|
((src&0x00ff0000)>>8)|((src&0xff000000)>>24));
break;
case SPI_BIG_ENDIAN_16:
case SPI_BIG_ENDIAN_32:
temp = src;
break;
#else /*host big-endian*/
case SPI_LITTLE_ENDIAN_16:
temp = (((src&0x0000ffff)<<16)|((src&0xffff0000)>>16);
break;
case SPI_LITTLE_ENDIAN_32:
temp = src;
break;
case SPI_BIG_ENDIAN_16:
case SPI_BIG_ENDIAN_32:
temp = (((src&0x000000ff)<<24)|((src&0x0000ff00)<<8)|
((src&0x00ff0000)>>8)|((src&0xff000000)>>24));
break;
#endif
}
return temp;
}
/*
* src buffer bit reorder
*/
static void buf_endian_reverse(u8* src, u32 len, u8* dummy_bytes, _gspi_conf_t gspi_conf)
{
u32 *buf = (u32*)src;
u16 count = len/4;
u16 remain = len%4;
int i = 0;
if(remain)
count ++;
for(i = 0;i < count; i++){
buf[i] = DWORD_endian_reverse(buf[i], gspi_conf);
}
if(remain)
*dummy_bytes = 4 - remain;
}
int gspi_read_write_reg(_reg_ops ops_type, u32 addr, char * buf, int len,_gspi_conf_t gspi_conf)
{
int fun = 1, domain_id = 0x0; //LOCAL
unsigned int cmd = 0 ;
int byte_en = 0 ;//,i = 0 ;
int ret = 0;
unsigned char status[GSPI_STATUS_LEN] = {0};
unsigned int data_tmp = 0;
u32 spi_buf[4] = {0};
if (len!=1 && len!=2 && len != 4) {
return -1;
}
domain_id = addr_convert(addr);
addr &= 0x7fff;
len &= 0xff;
if (ops_type == WRITE_REG) //write register
{
int remainder = addr % 4;
u32 val32 = *(u32 *)buf;
switch(len) {
case 1:
byte_en = (0x1 << remainder);
data_tmp = (val32& 0xff)<< (remainder*8);
break;
case 2:
byte_en = (0x3 << remainder);
data_tmp = (val32 & 0xffff)<< (remainder*8);
break;
case 4:
byte_en = 0xf;
data_tmp = val32 & 0xffffffff;
break;
default:
byte_en = 0xf;
data_tmp = val32 & 0xffffffff;
break;
}
}
else //read register
{
switch(len) {
case 1:
byte_en = 0x1;
break;
case 2:
byte_en = 0x3;
break;
case 4:
byte_en = 0xf;
break;
default:
byte_en = 0xf;
break;
}
if(domain_id == SPI_LOCAL_DOMAIN)
byte_en = 0;
}
cmd = FILL_SPI_CMD(byte_en, addr, domain_id, fun, ops_type);
//4 command segment bytes reorder
cmd = DWORD_endian_reverse(cmd, gspi_conf);
if ((ops_type == READ_REG)&& (domain_id!= SPI_RXFIFO_DOMAIN)) {
u32 read_data = 0;
_memset(spi_buf, 0x00, sizeof(spi_buf));
//SPI_OUT:32bit cmd
//SPI_IN:64bits status+ XXbits data
spi_buf[0] = cmd;
spi_buf[1] = 0;
spi_buf[2] = 0;
spi_buf[3] = 0;
spi_transfer((u8*)spi_buf, sizeof(spi_buf));
memcpy(status, (u8 *) &spi_buf[1], GSPI_STATUS_LEN);
read_data = spi_buf[3];
*(u32*)buf = DWORD_endian_reverse(read_data, gspi_conf);
}
else if (ops_type == WRITE_REG ) {
//4 data segment bytes reorder
data_tmp = DWORD_endian_reverse(data_tmp, gspi_conf);
//SPI_OUT:32bits cmd+ XXbits data
//SPI_IN:64bits status
spi_buf[0] = cmd;
spi_buf[1] = data_tmp;
spi_buf[2] = 0;
spi_buf[3] = 0;
spi_transfer((u8*)spi_buf, sizeof(spi_buf));
memcpy(status, (u8 *) &spi_buf[2], GSPI_STATUS_LEN);
}
// translate status
return ret;
}
u8 gspi_read8(u32 addr, s32 *err)
{
u32 ret = 0;
int val32 = 0 , remainder = 0 ;
s32 _err = 0;
_err = gspi_read_write_reg(READ_REG, addr&0xFFFFFFFC, (char *)&ret, 4, GSPI_CONFIG);
remainder = addr % 4;
val32 = ret;
val32 = (val32& (0xff<< (remainder<<3)))>>(remainder<<3);
if (err)
*err = _err;
return (u8)val32;
}
u16 gspi_read16(u32 addr, s32 *err)
{
u32 ret = 0;
int val32 = 0 , remainder = 0 ;
s32 _err = 0;
_err = gspi_read_write_reg(READ_REG, addr&0xFFFFFFFC,(char *)&ret, 4, GSPI_CONFIG);
remainder = addr % 4;
val32 = ret;
val32 = (val32& (0xffff<< (remainder<<3)))>>(remainder<<3);
if (err)
*err = _err;
return (u16)val32;
}
u32 gspi_read32(u32 addr, s32 *err)
{
unsigned int ret = 0;
s32 _err = 0;
_err = gspi_read_write_reg(READ_REG, addr&0xFFFFFFFC,(char *)&ret,4 ,GSPI_CONFIG);
if (err)
*err = _err;
return ret;
}
s32 gspi_write8(u32 addr, u8 buf, s32 *err)
{
int ret = 0;
ret = gspi_read_write_reg(WRITE_REG, addr, (char *)&buf,1, GSPI_CONFIG);
if (err)
*err = ret;
return ret;
}
s32 gspi_write16(u32 addr, u16 buf, s32 *err)
{
int ret = 0;
ret = gspi_read_write_reg(WRITE_REG,addr,(char *)&buf,2, GSPI_CONFIG);
if (err)
*err = ret;
return ret;
}
s32 gspi_write32(u32 addr, u32 buf, s32 *err)
{
int ret = 0;
ret = gspi_read_write_reg(WRITE_REG, addr,(char *)&buf,4, GSPI_CONFIG);
if (err)
*err = ret;
return ret;
}
int gspi_read_rx_fifo(u8 *buf, u32 len, struct spi_more_data * pmore_data,_gspi_conf_t gspi_conf)
{
int fun = 1;
u32 cmd = 0;
u8* spi_buf = (u8 *) (buf);
u8* spi_data = spi_buf + GSPI_CMD_LEN;
u8* spi_status = spi_data + len;
int spi_buf_len = GSPI_CMD_LEN + N_BYTE_ALIGMENT(len, 4) + GSPI_STATUS_LEN;
u8 dummy_bytes = 0;
cmd = FILL_SPI_CMD(len, ((len&0xff00) >>8), SPI_RXFIFO_DOMAIN, fun, (unsigned int)0);
//4 command segment bytes reorder
cmd = DWORD_endian_reverse(cmd, gspi_conf);
memcpy(spi_buf, (u8 *)&cmd, GSPI_CMD_LEN);
//4 clean data segment
memset(spi_data,0x00, len);
//4 clean status segment
memset(spi_status, 0x00, GSPI_STATUS_LEN);
spi_transfer((u8 *) spi_buf, spi_buf_len);
// data segement reorder
buf_endian_reverse(spi_data, len, &dummy_bytes, gspi_conf);
// status segment reorder
spi_status += dummy_bytes;
buf_endian_reverse(spi_status, GSPI_STATUS_LEN, &dummy_bytes, gspi_conf);
pmore_data->more_data = GET_STATUS_HISR(spi_status) & SPI_HIMR_RX_REQUEST_MSK;
pmore_data->len = GET_STATUS_RXQ_REQ_LEN(spi_status);
return 0;
}
static int gspi_write_tx_fifo(u8 *buf, u32 len, _gspi_conf_t gspi_conf)
{
int fun = 1; //TX_HIQ_FIFO
unsigned int cmd = 0;
u8 *spi_buf = (u8 *) (buf);
u8* spi_data = spi_buf + GSPI_CMD_LEN;
u8* spi_status;// = buf + len
u32 spi_buf_len = 0;
u32 NumOfFreeSpace;
u8 wait_num = 0;
u8 dummy_bytes = 0;
NumOfFreeSpace = gspi_read32(LOCAL_REG_FREE_TX_SPACE, NULL);
while (NumOfFreeSpace * (PACK_SIZE+SIZE_TX_DESC) < len) {
if((++wait_num) >= 4){
DBG_8195A("%s(): wait_num is >= 4\n", __FUNCTION__);
return -1;
}
RtlUdelayOS(100); //delay 100us
NumOfFreeSpace = gspi_read32(LOCAL_REG_FREE_TX_SPACE, NULL);
}
cmd = FILL_SPI_CMD(len, ((len&0xff00) >>8), SPI_TXFIFO_DOMAIN, fun, (unsigned int)1);
//4 command segment bytes reorder
cmd = DWORD_endian_reverse(cmd, gspi_conf);
memcpy(spi_buf, (u8 *)&cmd, GSPI_CMD_LEN);
//4 data segment bytes reorder
buf_endian_reverse(spi_data, len, &dummy_bytes, gspi_conf);
//4 status segment
spi_status = spi_data + len + dummy_bytes;
memset(spi_status, 0x00, GSPI_STATUS_LEN);
spi_buf_len = GSPI_CMD_LEN + len + dummy_bytes + GSPI_STATUS_LEN;
spi_transfer((u8 *) spi_buf, spi_buf_len);
// parse status infomation
// GET_STATUS_HISR(status)
// GET_STATUS_FREE_TX(status)
// GET_STATUS_RXQ_REQ_LEN(status)
// GET_STATUS_TX_SEQ(status)
return 0;
}
static int gspi_write_page(u8 *buf, u32 len, u8 agg_cnt){
int res;
u32 tot_len = SIZE_TX_DESC + len;
PGSPI_TX_DESC ptxdesc;
// clean GSPI command and tx descriptor area
memset(TX_BUFFER, 0, GSPI_CMD_LEN+SIZE_TX_DESC);
ptxdesc = (PGSPI_TX_DESC)(TX_BUFFER + GSPI_CMD_LEN); // reserve 4 byte for GSPI cmd
ptxdesc->txpktsize = len;
ptxdesc->offset = SIZE_TX_DESC;
ptxdesc->bus_agg_num = agg_cnt;
ptxdesc->type = GSPI_CMD_TX;
memcpy(TX_BUFFER+GSPI_CMD_LEN+SIZE_TX_DESC, buf, len);
res = gspi_write_tx_fifo(TX_BUFFER, tot_len, GSPI_CONFIG);
return res;
}
int gspi_configuration(_gspi_conf_t gspi_conf){
u8 conf = gspi_conf;
u8 retry_t = 0;
retry:
/*GSPI default mode: SPI_LITTLE_ENDIAN_32*/
gspi_read_write_reg(WRITE_REG, SPI_LOCAL_OFFSET|SPI_REG_SPI_CFG,(char *)&conf,1 ,SPI_LITTLE_ENDIAN_32);
// read gspi config
conf = 0xff;
conf = gspi_read8(SPI_LOCAL_OFFSET|SPI_REG_SPI_CFG, NULL);
if(conf != gspi_conf){
if(++ retry_t <= 3)
goto retry;
DBG_8195A("%s: config fail@ 0x%x\n", __FUNCTION__, conf);
return 1;
}
char *s;
switch (conf) {
case SPI_LITTLE_ENDIAN_16:
s = "LITTLE_ENDIAN|WORD_LEN_16"; break;
case SPI_LITTLE_ENDIAN_32:
s = "LITTLE_ENDIAN|WORD_LEN_32"; break;
case SPI_BIG_ENDIAN_16:
s = "BIG_ENDIAN|WORD_LEN_16"; break;
case SPI_BIG_ENDIAN_32:
s = "BIG_ENDIAN|WORD_LEN_32"; break;
default:
s = "UNKNOW CONFIGURATION"; break;
};
DBG_8195A("%s: Current configuration:%s\n", __FUNCTION__, s);
return 0;
}
#if CONFIG_USE_INTERRUPT
void spi_interrupt_thread(){
u32 spi_hisr;
u32 spi_himr;
u32 rx_cnt = 0;
while(1){
if (rtw_down_sema(&pspiIrqSemaphore) == _FAIL){
DBG_8195A("%s, Take Semaphore Fail\n", __FUNCTION__);
goto exit;
}
spi_himr = gspi_read32(SPI_LOCAL_OFFSET | SPI_REG_HIMR, NULL);
spi_hisr = gspi_read32(SPI_LOCAL_OFFSET | SPI_REG_HISR, NULL);
if (spi_hisr & spi_himr){
if(spi_hisr & SPI_HISR_RX_REQUEST) {
u8* rx_buf = NULL;
u8* payload = NULL;
u32 rx_len = 0;
u8 rx_len_rdy = 0;
PGSPI_RX_DESC prxdesc;
struct spi_more_data more_data = {0};
// clean RX buffer
memset(RX_DATA, 0, AGG_SIZE + 100);
rx_buf = RX_DATA;
do {
//validate RX_LEN_RDY before reading RX0_REQ_LEN
if(rx_len==0){
rx_len_rdy = gspi_read8(SPI_LOCAL_OFFSET|(SPI_REG_RX0_REQ_LEN + 3), NULL);
if(rx_len_rdy & BIT7){
rx_len = (gspi_read32(SPI_LOCAL_OFFSET | SPI_REG_RX0_REQ_LEN, NULL)) &0xffffff;
}
}
if (rx_len >(PACK_SIZE+SIZE_RX_DESC))
rx_len = PACK_SIZE+SIZE_RX_DESC;
if(rx_len){
memset(RX_BUFFER, 0, BUFFER_LEN);
gspi_read_rx_fifo(RX_BUFFER, rx_len, &more_data,GSPI_CONFIG);
memcpy(rx_buf, RX_BUFFER+GSPI_CMD_LEN, rx_len);
prxdesc = (PGSPI_RX_DESC)rx_buf;
DBG_8195A("Receive Data lenth = %d (cnt = %d)\n",prxdesc->pkt_len, ++rx_cnt);
payload = rx_buf + prxdesc->offset;
rx_buf += rx_len;
rx_len = 0;
}else{
break;
}
}while(1);
}
}
// query other interrupt here
}
exit:
vTaskDelete(NULL);
}
#endif
// external GSPI interrupt handler
void gspi_irq_handler (uint32_t id, gpio_irq_event event)
{
//DBG_8195A("gspi_irq_handler....\n");
if(!pspiIrqSemaphore)
return;
rtw_up_sema_from_isr(&pspiIrqSemaphore);
}
// SPI master interrupt callback if use interrupt mode
void spi_tx_rx_intr_callback(void *pdata, SpiIrq event){
switch(event){
case SpiRxIrq:
rxDone = TRUE;
break;
case SpiTxIrq:
txDone = TRUE;
break;
default:
DBG_8195A("unknown interrput evnent!\n");
}
}
void spi_tx_bus_idle_callback(void *pdata, SpiIrq event){
txbusIdle = TRUE;
}
void spi_init_intr(){
#if CONFIG_USE_INTERRUPT
// init gspi external interrupt
gpio_irq_init(&gpio_int, GPIO_INT, gspi_irq_handler, NULL);
gpio_irq_set(&gpio_int, INT_FALLING, 1); // Falling Edge Trigger
gpio_irq_enable(&gpio_int);
#endif
// init spi master tx/rx done interrupt
spi_irq_hook(&spi0_master, (spi_irq_handler)spi_tx_rx_intr_callback, NULL);
// init spi master tx bus idle interrupt
spi_bus_tx_done_irq_hook(&spi0_master, (spi_irq_handler)spi_tx_bus_idle_callback, NULL);
}
void spi_init_master(){
// init spi master
spi_init(&spi0_master, SPI0_MOSI, SPI0_MISO, SPI0_SCLK, SPI0_CS);
spi_format(&spi0_master, SPI_BITS, 0, 0);
spi_frequency(&spi0_master, SPI0_FREQUENCY);
printf("spi master frequency %d Hz\n",SPI0_FREQUENCY);
gpio_init(&gpio_cs, GPIO_CS);
gpio_mode(&gpio_cs, PullDown);
gpio_dir(&gpio_cs, PIN_OUTPUT);
SLAVE_DESELECT(); // deselect slave
}
#endif
void gspi_demo(void)
{
#if CONFIG_GSPI_SLAVE
int i;
DBG_8195A("Init GSPI slave....\n");
spdio_dev.priv = NULL;
spdio_dev.rx_bd_num = SPDIO_RX_BD_NUM;
spdio_dev.tx_bd_num = SPDIO_TX_BD_NUM;
spdio_dev.rx_bd_bufsz = SPDIO_RX_BUFSZ;
spdio_dev.rx_buf = (struct spdio_buf_t *)rtw_malloc(SPDIO_RX_BD_NUM*sizeof(struct spdio_buf_t));
for(i=0;i<SPDIO_RX_BD_NUM;i++){
spdio_dev.rx_buf[i].buf_allocated = (u32)rtw_malloc(SPDIO_RX_BUFSZ + SPDIO_DMA_ALIGN_4);
if(!spdio_dev.rx_buf[i].buf_allocated){
printf("malloc failed for spdio buffer!\n");
return;
}
spdio_dev.rx_buf[i].size_allocated = SPDIO_RX_BUFSZ + SPDIO_DMA_ALIGN_4;
// this buffer must be 4 byte alignment
spdio_dev.rx_buf[i].buf_addr = (u32)N_BYTE_ALIGMENT((u32)(spdio_dev.rx_buf[i].buf_allocated), SPDIO_DMA_ALIGN_4);
}
spdio_dev.rx_done_cb = ex_gspi_rx_done_cb;
spdio_dev.tx_done_cb = ex_gspi_tx_done_cb;
DBG_INFO_MSG_OFF(_DBG_SDIO_);
DBG_WARN_MSG_OFF(_DBG_SDIO_);
DBG_ERR_MSG_ON(_DBG_SDIO_);
spdio_init(&spdio_dev);
#else
DBG_8195A("Init SPI master....\n");
u32 spi_himr = 0;
u32 spi_hisr = 0;
u32 spi_ictlr = 0;
u32 rx_agg_ctrl = 0;
s8 res = 0;
int test_loop = 1000;
//1 SPI host init
spi_init_master();
spi_init_intr();
rtw_init_sema(&pspiIrqSemaphore, 0);
// used for sync SPI bus, SPI bus shold not be interrupt
rtw_mutex_init(&SPIbusbusy);
if( xTaskCreate( (TaskFunction_t)spi_interrupt_thread, "SPI INTERRUPT", (TASK_STACK_SIZE/4), NULL, TASK_PRIORITY+2, NULL) != pdPASS) {
DBG_8195A("Cannot create SPI INTERRUPT task\n\r");
goto err;
}
//1 GSPI slave configuration
res = gspi_configuration(GSPI_CONFIG);
if(res){
DBG_8195A("gspi configure error....\n");
while(1);
}
// INT_CTRL-clean INT control register
spi_ictlr = 0;
gspi_write32(SPI_LOCAL_OFFSET |SPI_REG_INT_CTRL, spi_ictlr, NULL);
// HISR - clean interrupt status register
gspi_write32(SPI_LOCAL_OFFSET |SPI_REG_HISR, 0xFFFFFFFF, NULL);
// HIMR - turn all off
gspi_write32(SPI_LOCAL_OFFSET |SPI_REG_HIMR, SPI_HIMR_DISABLED, NULL);
// Set intterrupt mask
spi_himr = (u32)(SPI_HISR_RX_REQUEST|SPI_HISR_CPWM1_INT);
// Write and enable interrupt
gspi_write32(SPI_LOCAL_OFFSET | SPI_REG_HIMR, spi_himr, NULL);
#if 1
// set RX AGG control register
rx_agg_ctrl = 0;
gspi_write32(SPI_LOCAL_OFFSET | SPI_REG_RX_AGG_CTL, rx_agg_ctrl, NULL);
#endif
// prepare test data (0x00-0xFF, 0x00-0xFF......)
for(int i=0;i<PACK_SIZE;i++)
memset(TX_DATA+i, i%256, 1);
do{
res = gspi_write_page(TX_DATA, PACK_SIZE, 1);
if(res) {
DBG_8195A("spi_write_page: Error!");
// handle error msg here
}
rtw_mdelay_os(10);
}while(--test_loop);
#if !CONFIG_USE_INTERRUPT
#endif
#endif
err:
//
// spi_free(&spi0_master);
/* Kill init thread after all init tasks done */
vTaskDelete(NULL);
}
void main(void)
{
// create demo Task
if( xTaskCreate( (TaskFunction_t)gspi_demo, "GSPI DEMO", (TASK_STACK_SIZE/4), NULL, TASK_PRIORITY, NULL) != pdPASS) {
DBG_8195A("Cannot create demo task\n\r");
}
#if defined(CONFIG_KERNEL) && !TASK_SCHEDULER_DISABLED
#ifdef PLATFORM_FREERTOS
vTaskStartScheduler();
#endif
#else
#error !!!Need FREERTOS!!!
#endif
}

View file

@ -0,0 +1,83 @@
/*
* This example should work accompany by other examples
* 1. project\realtek_ameba1_va0_example\example_sources\gspi
* 2. project\realtek_ameba1_va0_example\example_sources\gspi_fw_loader
*/
Example Description
This example describes how to download encrypted firmware to slave and do loopback test.
copy "src/main.c" to cover the original ones under the default project path.
Requirement Components:
2 Ameba DEV_3V0
Ameba 8195AM(A): Assign as SPI master
SCK: PC_1(D13)
CS: PB_2(D15)
MOSI: PC_2(D11)
MISO: PC_3(D12)
INT: PB_4(D8)
Ameba 8711AF/AN(B): Assign as GSPI slave (must be configured as boot from SDIO)
SPI_IN: PA_4(D5)
SPI_OUT:PA_2(D7)
SPI_CLK:PA_3(D6)
SPI_CS: PA_1(D16)
SPI_INT:PA_5(D2)
Build bin files:
In order to run this demo, at least three **.bin should be generated seperately with diffrent example sources.
1. project\realtek_ameba1_va0_example\example_sources\gspi_fw_downloader\src\main.c
(A) Ram_all.bin : Host firmware downloader
Use #define OAT_CIPHER_TYPE to config the encryption status of firmware to be download (ota.bin)
#define OTA_CIPHER_TYPE 0 // NONE encryption (defualt)
#define OTA_CIPHER_TYPE 1 // AES_128_CBC encryption
2. project\realtek_ameba1_va0_example\example_sources\gspi_fw_loader\src\main.c
(B) Ram_all.bin : Slave firmware loader
2. project\realtek_ameba1_va0_example\example_sources\gspi\src\main.c
(c) Ota.bin: Slave test firmware. generated by config #define CONFIG_GPSI_SLAVE 1
(D) Ota.e.bin: Encypted ota.bin
Encrypte ota.bin according to configuration(OTA_CIPHER_TYPE) when generate firmware (A).
If(#define OTA_CIPHER_TYPE 1), use EncryptTools (encrypt.bat) to generate ota.e.bin.
Demo setup:
Use ImageTool.exe to load firmware (B) and (C)or(D) to host end flash at customized image erea.
(Highly Recommended: Erase the whole flash first)
#if (#define OTA_CIPHER_TYPE 0)
1. load (C) to address 0xB1000 // #define OTA_ADDR 0x000B1000 in main.c
#else(#define OTA_CIPHER_TYPE 1)
1. load (D) to address 0xB1000 // #define OTA_ADDR 0x000B1000 in main.c
#endif
2. load (B) to address 0x91000 // #define RAM_ALL_ADDR 0x00091000 in main.c
3. Download (A) to host as usual method.
connect Ameba A and B as given
A: B:
SCK --- SPI_CLK
CS --- SPI_CS
MOSI--- SPI_OUT
MISO--- SPI_IN
INT --- SPI_INT
V3.3--- V3.3
GND --- GND
Behavior:
1. Slave end boot from SDIO, waiting master end download firmware (ram_all.bin + ota.bin or ota.e.bin)
2. Master end download firmware to slave end, and wait slave firmware ready
3. Master begin to do loopback test.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,85 @@
/*
* This example should work accompany by other examples
* 1. project\realtek_ameba1_va0_example\example_sources\gspi
* 2. project\realtek_ameba1_va0_example\example_sources\gspi_fw_downloader
*/
Example Description
This example describes how to download encrypted firmware to slave and do loopback test.
How to build:
1. copy src\main.c to project\realtek_ameba1_va0_example\src
2. include lib\lib_sdiod.a for build, then re-build the project
Requirement Components:
2 Ameba DEV_3V0
Ameba 8195AM(A): Assign as SPI master
SCK: PC_1(D13)
CS: PB_2(D15)
MOSI: PC_2(D11)
MISO: PC_3(D12)
INT: PB_4(D8)
Ameba 8711AF/AN(B): Assign as GSPI slave (must be configured as boot from SDIO)
SPI_IN: PA_4(D5)
SPI_OUT:PA_2(D7)
SPI_CLK:PA_3(D6)
SPI_CS: PA_1(D16)
SPI_INT:PA_5(D2)
Build bin files:
In order to run this demo, at least three **.bin should be generated seperately with diffrent example sources.
1. project\realtek_ameba1_va0_example\example_sources\gspi_fw_downloader\src\main.c
(A) Ram_all.bin : Host firmware downloader
Use #define OAT_CIPHER_TYPE to config the encryption status of firmware to be download (ota.bin)
#define OTA_CIPHER_TYPE 0 // NONE encryption (defualt)
#define OTA_CIPHER_TYPE 1 // AES_128_CBC encryption
2. project\realtek_ameba1_va0_example\example_sources\gspi_fw_loader\src\main.c
(B) Ram_all.bin : Slave firmware loader
2. project\realtek_ameba1_va0_example\example_sources\gspi\src\main.c
(c) Ota.bin: Slave test firmware. generated by config #define CONFIG_GPSI_SLAVE 1
(D) Ota.e.bin: Encypted ota.bin
Encrypte ota.bin according to configuration(OTA_CIPHER_TYPE) when generate firmware (A).
If(#define OTA_CIPHER_TYPE 1), use EncryptTools (encrypt.bat) to generate ota.e.bin.
Demo setup:
Use ImageTool.exe to load firmware (B) and (C)or(D) to host end flash at customized image erea.
(Highly Recommended: Erase the whole flash first)
#if (#define OTA_CIPHER_TYPE 0)
1. load (C) to address 0xB1000 // #define OTA_ADDR 0x000B1000 in main.c
#else(#define OTA_CIPHER_TYPE 1)
1. load (D) to address 0xB1000 // #define OTA_ADDR 0x000B1000 in main.c
#endif
2. load (B) to address 0x91000 // #define RAM_ALL_ADDR 0x00091000 in main.c
3. Download (A) to host as usual method.
connect Ameba A and B as given
A: B:
SCK --- SPI_CLK
CS --- SPI_CS
MOSI--- SPI_OUT
MISO--- SPI_IN
INT --- SPI_INT
V3.3--- V3.3
GND --- GND
Behavior:
1. Slave end boot from SDIO, waiting master end download firmware (ram_all.bin + ota.bin or ota.e.bin)
2. Master end download firmware to slave end, and wait slave firmware ready
3. Master begin to do loopback test.

View file

@ -0,0 +1,270 @@
/*
* Routines to access hardware
*
* Copyright (c) 2015 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "rtl8195a.h"
#include "build_info.h"
#ifdef PLATFORM_FREERTOS
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#endif
#include "hal_crypto.h"
/* debug message */
#define FW_DL_DEBUG 0
#if FW_DL_DEBUG
#define FW_INFO(fmt, args...) DBG_8195A("\n\r%s: " fmt, __FUNCTION__, ## args)
#define FW_ERR(fmt, args...) DBG_8195A("\n\r%s: " fmt, __FUNCTION__, ## args)
#else
#define FW_INFO(fmt, args...)
#define FW_ERR(fmt, args...) DBG_8195A("\n\r%s: " fmt, __FUNCTION__, ## args)
#endif
/* compulsive: define fw_loader start address on SRAM
* One can adjust the address to avoid image overlap
*/
#define __ICFEDIT_region_BD_RAM_start__ 0x10060000
// GPSI slave configuration
#define OTA_INFO_region 0x1006FFC0
#define DECIPHER_BLOCK_SIZE (16*1000) //define deciphering block size, must be multiple of 16
// should not over 16000 = 16*1000
/* decryption buffer */
u8 cache_buf[DECIPHER_BLOCK_SIZE+4];
u8 key_buf[16+4]; // for Crypto engine alignment
u8 iv_buf[16+4];
u8 iv_tmp[16];
static const u8 aes_cbc_slave_key[16] =
{
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
} ;
u8 aes_cbc_slave_iv[16] =
{
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
};
// This structure must be cared byte-ordering
//
typedef struct _OTA_INFO
{
u32 crypto_type; // encyption type
u8 info[32]; // encyption infomation (eg. aes_key)
u32 size;
u32 startaddr;
}OTA_INFO, *POTA_INFO;
int aes_cbc_decryption(u8* aes_key,
u8 aes_key_len,
u8* aes_iv,
u8 aes_iv_len,
const u8 *input,
u8 *output,
u32 act_len)
{
u8 *key_buf_aligned;
u8 *iv_buf_aligned;
u8 *output_buf, *output_buf_aligned;
int result = 0;
u32 cipher_len = 0;
if(act_len%16)
cipher_len = act_len + (16-act_len%16);
else
cipher_len = act_len;
if(cipher_len%16)
return -1;
if(cipher_len > 0){
key_buf_aligned = (u8 *) (((u32) key_buf + 4) / 4 * 4);
iv_buf_aligned = (u8 *) (((u32) iv_buf + 4) / 4 * 4);
output_buf = cache_buf;
if(output_buf == NULL){
FW_ERR("Not enough space for cipher text.\n");
return -2;
}
output_buf_aligned = (u8 *) (((u32) output_buf + 4) / 4 * 4);
memcpy(iv_buf_aligned, aes_iv, aes_iv_len);
memset(output_buf_aligned, 0, cipher_len);
memcpy(key_buf_aligned, aes_key, aes_key_len);
result = rtl_crypto_aes_cbc_init(key_buf_aligned, aes_key_len);
if(result == 0){
memcpy(iv_tmp, (input + cipher_len - aes_iv_len), aes_iv_len);
result = rtl_crypto_aes_cbc_decrypt(input, cipher_len, iv_buf_aligned, aes_iv_len, output_buf_aligned);
if(result == 0){
memcpy(aes_iv, iv_tmp, aes_iv_len);
memcpy(output, output_buf_aligned, act_len);
}else{
FW_ERR("[%s]rtl_crypto_aes_cbc_decrypt fail.(status = %d)\n",__FUNCTION__,result);
}
}
else{
FW_ERR("[s%]rtl_crypto_aes_cbc_init fail.(status = %d)\n",__FUNCTION__,result);
}
}
if(result == 0)
return 0;
return -1;
}
// GPSI fw loader
void fw_loader(void){
u8* pbuf = (u8*)OTA_INFO_region;
u8 local_key[16];
u8 remote_key[16]; // key from host
u8 local_iv[16];
u8 remote_iv[16]; // iv from host
u8 aes_key[16];
u8 aes_iv[16];
POTA_INFO ota_info = NULL;
u32 OTA_LoadAddr = 0;
u32 OTA_Len = 0;
u32 OTA_crypt = 0;
u8* otg_img = NULL;
u8* __ota_entry_func__ = NULL;
u8* __ota_validate_code__ = NULL;
u32 ciphered_block_num = 0;
u32 ciphered_remain = 0;
FW_INFO("===== Enter FW Loader Image ====\n");
ota_info = (POTA_INFO)pbuf;
/* local_key should be read from efuse */
memcpy(local_key, aes_cbc_slave_key, sizeof(aes_cbc_slave_key));
memcpy(local_iv, aes_cbc_slave_iv, sizeof(aes_cbc_slave_iv));
/* Load OTA info from cache */
OTA_crypt = ota_info->crypto_type;
OTA_Len = ota_info->size;
OTA_LoadAddr= ota_info->startaddr;
__ota_entry_func__ = (u8*)OTA_LoadAddr;
__ota_validate_code__ = __ota_entry_func__ + 4;
otg_img = __ota_entry_func__; // ota ciphertext start address
if(!__ota_entry_func__){
while (1) {
FW_ERR(" Wrong ota entry pointer ...\n");
RtlConsolRom(10000);
}
}
switch(OTA_crypt){
case 0:
FW_INFO("OTA encrytion: NONE\n");
break;
case 1:
FW_INFO("OTA encrytion: AES_128_CBC\n");
memcpy(remote_key, &(ota_info->info[0]), 16);
memcpy(remote_iv, &(ota_info->info[16]), 16);
/* generate deciphering key and iv */
for(int i=0;i<sizeof(aes_key);i++){
aes_key[i] = local_key[i]^remote_key[i];
}
memcpy(aes_iv, local_iv, sizeof(local_iv));
if(OTA_LoadAddr != 0){
int index;
int offset;
int result;
/* OTA decryption */
ciphered_block_num = OTA_Len/DECIPHER_BLOCK_SIZE;
ciphered_remain = OTA_Len%DECIPHER_BLOCK_SIZE;
FW_INFO("Deciphering Start ...\n");
if ( rtl_cryptoEngine_init() != 0 ) {
while (1) {
FW_ERR("cryptoEngine init Fail ...\n");
RtlConsolRom(10000);
}
}
for(index =0;index<ciphered_block_num;index++){
offset = index*DECIPHER_BLOCK_SIZE;
result = aes_cbc_decryption(aes_key, 16,aes_iv, 16, otg_img+offset, otg_img+offset, DECIPHER_BLOCK_SIZE);
if(result != 0){
FW_ERR("Deciphering OTA block (index=%d,length=%d) Fail\n",index, DECIPHER_BLOCK_SIZE);
while (1) {
FW_ERR("Deciphering fail...\n");
RtlConsolRom(10000);
}
}
}
if(ciphered_remain){
offset = index*DECIPHER_BLOCK_SIZE;
result = aes_cbc_decryption(aes_key, 16, aes_iv, 16, otg_img+offset, otg_img+offset, ciphered_remain);
if(result != 0){
FW_ERR("Deciphering OTA remain(length=%d) Fail\n", ciphered_remain);
while (1) {
FW_ERR("Deciphering fail...\n");
RtlConsolRom(10000);
}
}
}
}
FW_INFO("OTA deciphering DONE.\n");
break;
/* other encrytion method */
default:
FW_ERR("OTA encrytion: UNKOWN\n");
break;
}
FW_INFO("===== Enter OTA Image ====\n");
PRAM_START_FUNCTION OTAEntryFun=(PRAM_START_FUNCTION)__ota_entry_func__;
// Unregister irq handler that has been registered in InfraStart() of fwloader.
// These irq handler will be properly registered in InfraStart() of user's image2
IRQ_HANDLE SysHandle;
SysHandle.IrqNum = SYSTEM_ON_IRQ;
InterruptUnRegister(&SysHandle);
//3 Jump to OTA Image
FW_INFO("InfraStart: %p, Img2 Sign %s \n", OTAEntryFun, (char*)__ota_validate_code__);
if (_strcmp((char *)__ota_validate_code__, "RTKWin")) {
while (1) {
FW_ERR("Invalid Image2 Signature\n");
RtlConsolRom(10000);
}
}
OTAEntryFun->RamStartFun();
}
void main(void)
{
//2 Firmware Loader
fw_loader();
while(1);
}

View file

@ -0,0 +1,17 @@
Example Description
This example describes how to use general timer.
Requirement Components:
2 LED
Connect the two LED to port PC_0 and PC_1 respectivly.
Behavior:
The two LED will blink at different frequence.
Two timers are intialized in this example
(1) Periodic timer
(2) One shut timer

View file

@ -0,0 +1,71 @@
/*
* Routines to access hardware
*
* Copyright (c) 2013 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "device.h"
#include "gpio_api.h" // mbed
#include "timer_api.h"
#include "main.h"
#define GPIO_LED_PIN1 PC_0
#define GPIO_LED_PIN2 PC_1
/**
* @brief Main program.
* @param None
* @retval None
*/
//int main_app(IN u16 argc, IN u8 *argv[])
gtimer_t my_timer1;
gtimer_t my_timer2;
gpio_t gpio_led1;
gpio_t gpio_led2;
volatile uint32_t time2_expired=0;
void timer1_timeout_handler(uint32_t id)
{
gpio_t *gpio_led = (gpio_t *)id;
gpio_write(gpio_led, !gpio_read(gpio_led));
}
void timer2_timeout_handler(uint32_t id)
{
time2_expired = 1;
}
void main(void)
{
// Init LED control pin
gpio_init(&gpio_led1, GPIO_LED_PIN1);
gpio_dir(&gpio_led1, PIN_OUTPUT); // Direction: Output
gpio_mode(&gpio_led1, PullNone); // No pull
gpio_init(&gpio_led2, GPIO_LED_PIN2);
gpio_dir(&gpio_led2, PIN_OUTPUT); // Direction: Output
gpio_mode(&gpio_led2, PullNone); // No pull
// Initial a periodical timer
gtimer_init(&my_timer1, TIMER0);
gtimer_start_periodical(&my_timer1, 1000000, (void*)timer1_timeout_handler, (uint32_t)&gpio_led1);
// Initial a one-shout timer and re-trigger it in while loop
gtimer_init(&my_timer2, TIMER1);
time2_expired = 0;
gtimer_start_one_shout(&my_timer2, 500000, (void*)timer2_timeout_handler, NULL);
while(1){
if (time2_expired) {
gpio_write(&gpio_led2, !gpio_read(&gpio_led2));
time2_expired = 0;
gtimer_start_one_shout(&my_timer2, 500000, (void*)timer2_timeout_handler, NULL);
}
}
}

View file

@ -0,0 +1,9 @@
Example Description
This example describes how to use general timer API to implement a software RTC.
Behavior:
This example will print the time message to the log UART every 1 sec.

View file

@ -0,0 +1,126 @@
/*
* Routines to access hardware
*
* Copyright (c) 2013 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "device.h"
#include <time.h>
#include "timer_api.h"
#include "main.h"
#define SW_RTC_TIMER_ID TIMER4
static gtimer_t sw_rtc;
static volatile struct tm rtc_timeinfo;
const static u8 dim[14] = {
31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28 };
static inline bool is_leap_year(unsigned int year)
{
return (!(year % 4) && (year % 100)) || !(year % 400);
}
static u8 days_in_month (u8 month, u8 year)
{
u8 ret = dim [ month - 1 ];
if (ret == 0)
ret = is_leap_year (year) ? 29 : 28;
return ret;
}
static void sw_rtc_tick_handler(uint32_t id)
{
if(++rtc_timeinfo.tm_sec > 59) { // Increment seconds, check for overflow
rtc_timeinfo.tm_sec = 0; // Reset seconds
if(++rtc_timeinfo.tm_min > 59) { // Increment minutes, check for overflow
rtc_timeinfo.tm_min = 0; // Reset minutes
if(++rtc_timeinfo.tm_hour > 23) { // Increment hours, check for overflow
rtc_timeinfo.tm_hour = 0; // Reset hours
++rtc_timeinfo.tm_yday; // Increment day of year
if(++rtc_timeinfo.tm_wday > 6) // Increment day of week, check for overflow
rtc_timeinfo.tm_wday = 0; // Reset day of week
// Increment day of month, check for overflow
if(++rtc_timeinfo.tm_mday >
days_in_month(rtc_timeinfo.tm_mon, rtc_timeinfo.tm_year)) {
rtc_timeinfo.tm_mday = 1; // Reset day of month
if(++rtc_timeinfo.tm_mon > 11) { // Increment month, check for overflow
rtc_timeinfo.tm_mon = 0; // Reset month
rtc_timeinfo.tm_yday = 0; // Reset day of year
++rtc_timeinfo.tm_year; // Increment year
} // - year
} // - month
} // - day
} // - hour
}
}
static void rtc_init(void)
{
// Initial a periodical timer
gtimer_init(&sw_rtc, SW_RTC_TIMER_ID);
// Tick every 1 sec
gtimer_start_periodical(&sw_rtc, 1000000, (void*)sw_rtc_tick_handler, (uint32_t)&sw_rtc);
}
static void rtc_deinit(void)
{
gtimer_stop(&sw_rtc);
gtimer_deinit(&sw_rtc);
}
static void rtc_set_time(uint32_t year, uint8_t mon, uint8_t mday, uint8_t wday,
uint8_t hour, uint8_t min, uint8_t sec)
{
int i;
gtimer_stop(&sw_rtc);
rtc_timeinfo.tm_sec = sec;
rtc_timeinfo.tm_min = min;
rtc_timeinfo.tm_hour = hour;
rtc_timeinfo.tm_mday = mday-1;
rtc_timeinfo.tm_wday = wday-1;
rtc_timeinfo.tm_yday = 0;
for (i=0;i<(mon-1);i++) {
rtc_timeinfo.tm_yday += days_in_month(i,year);
}
rtc_timeinfo.tm_yday += (mday-1);
rtc_timeinfo.tm_mon = mon-1;
rtc_timeinfo.tm_year = year;
gtimer_start(&sw_rtc);
}
static void rtc_read_time(struct tm *timeinfo)
{
_memcpy((void*)timeinfo, (void*)&rtc_timeinfo, sizeof(struct tm));
timeinfo->tm_mon++;
timeinfo->tm_mday++;
timeinfo->tm_wday++;
timeinfo->tm_yday++;
}
void main(void)
{
struct tm timeinfo;
rtc_init();
// Give RTC a initial value: 2015/4/15 (Wed) 12:00:00
rtc_set_time(2015, 4, 15, 3, 12, 0, 0);
while (1) {
rtc_read_time(&timeinfo);
DBG_8195A("%d-%d-%d[%d] %d:%d:%d\r\n", timeinfo.tm_year, timeinfo.tm_mon, timeinfo.tm_mday,
timeinfo.tm_wday, timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec);
wait_ms(1000);
}
rtc_deinit();
}

View file

@ -0,0 +1,13 @@
Example Description
This example describes how to use i2c by using mbed api
work with arduino extended board, which has SHTC1 temperature and humidity
sensor
Connect
- I2C3 SDA (PB_3) to extended board's SDA
- I2C3 SCL (PB_2) to extended board's SCL

View file

@ -0,0 +1,209 @@
#include "device.h"
#include "PinNames.h"
#include "basic_types.h"
#include "diag.h"
#include "osdep_api.h"
#include "i2c_api.h"
#include "pinmap.h"
#include "rtl_lib.h"
#define NO_ERROR 0x00
#define ACK_ERROR 0x01
#define CHECKSUM_ERROR 0x02
#define NULL_ERROR 0x03
#define MBED_I2C_MTR_SDA PD_4
#define MBED_I2C_MTR_SCL PD_5
#define MBED_I2C_SLAVE_ADDR0 0x70
#define POLYNOMIAL 0x131 // P(x) = x^8 + x^5 + x^4 + 1 = 100110001
#define MBED_I2C_BUS_CLK 100000 //hz
#define I2C_DATA_MAX_LENGTH 16
uint8_t i2cdata_write[I2C_DATA_MAX_LENGTH];
uint8_t i2cdata_read[I2C_DATA_MAX_LENGTH];
int i2cdata_read_pos;
volatile i2c_t i2cmaster;
// Sensor Commands
#define READ_ID 0xEFC8 // command: read ID register
#define SOFT_RESET 0x805D // soft resetSample Code for SHTC1
#define MEAS_T_RH_POLLING 0x7866 // meas. read T first, clock stretching disabled
#define MEAS_T_RH_CLOCKSTR 0x7CA2 // meas. read T first, clock stretching enabled
#define MEAS_RH_T_POLLING 0x58E0 // meas. read RH first, clock stretching disabled
#define MEAS_RH_T_CLOCKSTR 0x5C24 // meas. read RH first, clock stretching enabled
static int SHTC1_GetID(uint16_t *id);
static void SHTC1_WriteCommand(uint16_t cmd);
static int SHTC1_Read2BytesAndCrc(uint16_t *data);
static int SHTC1_CheckCrc(uint8_t data[], uint8_t nbrOfBytes, uint8_t checksum);
static float SHTC1_CalcTemperature(uint16_t rawValue);
static float SHTC1_CalcHumidity(uint16_t rawValue);
int SHTC1_Init(uint16_t *pID)
{
int error = NO_ERROR;
DiagPrintf("SHTC1_Init \r\n");
i2c_init((i2c_t*)&i2cmaster, MBED_I2C_MTR_SDA ,MBED_I2C_MTR_SCL);
i2c_frequency((i2c_t*)&i2cmaster,MBED_I2C_BUS_CLK);
if (pID == NULL ) return NULL_ERROR;
error = SHTC1_GetID(pID);
return error;
}
static int SHTC1_GetID(uint16_t *id)
{
int error = NO_ERROR;
uint8_t bytes[2];
uint8_t checksum;
SHTC1_WriteCommand(READ_ID);
i2c_read((i2c_t*)&i2cmaster, MBED_I2C_SLAVE_ADDR0, (char*)&i2cdata_read[0], 3, 1);
i2cdata_read_pos = 0;
error = SHTC1_Read2BytesAndCrc(id);
return error;
}
static int SHTC1_Read2BytesAndCrc(uint16_t *data)
{
int error;
int readed;
uint8_t bytes[2];
uint8_t checksum;
bytes[0] = i2cdata_read[i2cdata_read_pos++];
bytes[1] = i2cdata_read[i2cdata_read_pos++];
checksum = i2cdata_read[i2cdata_read_pos++];
error = SHTC1_CheckCrc(bytes, 2, checksum);
*data = (bytes[0] << 8) | bytes[1];
return error;
}
static int SHTC1_CheckCrc(uint8_t data[], uint8_t nbrOfBytes, uint8_t checksum)
{
uint8_t bit; // bit mask
uint8_t crc = 0xFF; // calculated checksum
uint8_t byteCtr; // byte counter
// calculates 8-Bit checksum with given polynomial
for(byteCtr = 0; byteCtr < nbrOfBytes; byteCtr++)
{
crc ^= (data[byteCtr]);
for(bit = 8; bit > 0; --bit)
{
if(crc & 0x80) crc = (crc << 1) ^ POLYNOMIAL;
else crc = (crc << 1);
}
}
// verify checksum
if(crc != checksum) return CHECKSUM_ERROR;
else return NO_ERROR;
}
static void SHTC1_WriteCommand(uint16_t cmd)
{
int writebytes;
i2cdata_write[0] = (uint8_t)(cmd >>8);
i2cdata_write[1] = (uint8_t)(cmd&0xFF);
i2c_write((i2c_t*)&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdata_write[0], 2, 1);
}
static float SHTC1_CalcTemperature(uint16_t rawValue)
{
return 175.0 * (float)rawValue / 65536.0 - 45.0;
}
static float SHTC1_CalcHumidity(uint16_t rawValue)
{
return 100.0 * (float)rawValue / 65536.0;
}
int SHTC1_GetTempAndHumi(float *temp, float *humi)
{
int error;
uint16_t rawValueTemp;
uint16_t rawValueHumi;
SHTC1_WriteCommand(MEAS_T_RH_CLOCKSTR);
//Wire1.requestFrom(I2C_ADR_SHTC1, 6);
i2c_read((i2c_t*)&i2cmaster, MBED_I2C_SLAVE_ADDR0, (char*)&i2cdata_read[0], 6, 1);
i2cdata_read_pos = 0;
error = NO_ERROR;
error |= SHTC1_Read2BytesAndCrc(&rawValueTemp);
error |= SHTC1_Read2BytesAndCrc(&rawValueHumi);
//diag_printf("raw temp=0x%x, raw humidity=0x%x, error=%d\n",
// rawValueTemp, rawValueHumi, error);
if ( error == NO_ERROR ) {
*temp = SHTC1_CalcTemperature(rawValueTemp);
*humi = SHTC1_CalcHumidity(rawValueHumi);
}
return error;
}
void main(void)
{
gpio_t gpio_led;
int led_status;
int i2clocalcnt;
int error;
uint16_t shtc1_id;
float temperature = 1.123f;
float humidity = 2.456f;
DBG_8195A("sleep 10 sec. to wait for UART console\n");
RtlMsleepOS(10000);
DBG_8195A("start i2c example - SHTC1\n");
error = SHTC1_Init(&shtc1_id);
if ( error == NO_ERROR ) {
DiagPrintf("SHTC1 init ok, id=0x%x\r\n", shtc1_id);
} else {
DiagPrintf("SHTC1 init FAILED! \r\n");
for(;;);
}
while(1){
error = SHTC1_GetTempAndHumi(&temperature, &humidity);
rtl_printf("temp=%f, humidity=%f, error=%d\n",
temperature, humidity, error);
RtlMsleepOS(1000);
}
}

View file

@ -0,0 +1,14 @@
Example Description
This example describes how to use i2c by using mbed api
1.Connect LOG-UART connector to PC
2.Connect
- I2C3 SDA (PB_3) to I2C1 SDA (PC_4) pin,
- I2C3 SCL (PB_2) to I2C1 SCL (PC_5) pin.
3.Run the main function.
4.Get the Master and Slave Data.

View file

@ -0,0 +1,98 @@
/*
* Routines to access hardware
*
* Copyright (c) 2013 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "PinNames.h"
#include "basic_types.h"
#include "diag.h"
#include <osdep_api.h>
#include "i2c_api.h"
#include "pinmap.h"
#include "ex_api.h"
#define I2C_MASTER_DEVICE
#define I2C_SLAVE_DEVICE
#define MBED_I2C_MTR_SDA PB_3
#define MBED_I2C_MTR_SCL PB_2
#define MBED_I2C_SLV_SDA PC_4
#define MBED_I2C_SLV_SCL PC_5
#define MBED_I2C_SLAVE_ADDR0 0xAA
#define MBED_I2C_BUS_CLK 100000 //hz
#define I2C_DATA_LENGTH 125
char i2cdatasrc[I2C_DATA_LENGTH];
char i2cdatadst[I2C_DATA_LENGTH];
#if defined (__ICCARM__)
i2c_t i2cmaster;
i2c_t i2cslave;
#else
volatile i2c_t i2cmaster;
volatile i2c_t i2cslave;
#endif
void i2c_callback(void *userdata)
{
int i2clocalcnt;
int result = 0;
DBG_8195A("show slave received data>>>\n");
for (i2clocalcnt = 0; i2clocalcnt < I2C_DATA_LENGTH; i2clocalcnt+=2) {
DBG_8195A("i2c data: %02x \t %02x\n",i2cdatadst[i2clocalcnt],i2cdatadst[i2clocalcnt+1]);
}
// verify result
result = 1;
for (i2clocalcnt = 0; i2clocalcnt < I2C_DATA_LENGTH; i2clocalcnt++) {
if (i2cdatasrc[i2clocalcnt] != i2cdatadst[i2clocalcnt]) {
result = 0;
break;
}
}
DBG_8195A("\r\nResult is %s\r\n", (result) ? "success" : "fail");
}
void main(void)
{
int i2clocalcnt;
int result = 0;
// prepare for transmission
_memset(&i2cdatasrc[0], 0x00, I2C_DATA_LENGTH);
_memset(&i2cdatadst[0], 0x00, I2C_DATA_LENGTH);
for (i2clocalcnt=0; i2clocalcnt < I2C_DATA_LENGTH; i2clocalcnt++){
i2cdatasrc[i2clocalcnt] = i2clocalcnt+1;
}
#ifdef I2C_SLAVE_DEVICE
i2c_init(&i2cslave, MBED_I2C_SLV_SDA ,MBED_I2C_SLV_SCL);
i2c_frequency(&i2cslave,MBED_I2C_BUS_CLK);
i2c_slave_address(&i2cslave, 0, MBED_I2C_SLAVE_ADDR0, 0xFF);
i2c_slave_mode(&i2cslave, 1);
i2c_set_user_callback(&i2cslave, I2C_RX_COMPLETE, i2c_callback);
DBG_8195A("slave read\n");
i2c_slave_read(&i2cslave, &i2cdatadst[0], I2C_DATA_LENGTH);
#endif
#ifdef I2C_MASTER_DEVICE
i2c_init(&i2cmaster, MBED_I2C_MTR_SDA ,MBED_I2C_MTR_SCL);
i2c_frequency(&i2cmaster,MBED_I2C_BUS_CLK);
DBG_8195A("master write...\n");
i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdatasrc[0], I2C_DATA_LENGTH, 1);
#endif
while(1){;}
}

View file

@ -0,0 +1,7 @@
Example Description
this example is use to measure atmos
work with arduino extended board, which has pressure sensor
the terminal will feedback real pressure value which is represented in Pa

View file

@ -0,0 +1,183 @@
#include "device.h"
#include "PinNames.h"
#include "basic_types.h"
#include "diag.h"
#include "osdep_api.h"
#include "i2c_api.h"
#include "pinmap.h"
//#include "rtl_lib.h"
#include "main.h"
#define MBED_I2C_MTR_SDA PB_3
#define MBED_I2C_MTR_SCL PB_2
#define MBED_I2C_INTB PA_5
#define MBED_I2C_SLAVE_ADDR0 0x5D
#define MBED_I2C_BUS_CLK 40000 //hz
#define I2C_DATA_MAX_LENGTH 20
#define malloc pvPortMalloc
#define free vPortFree
uint8_t i2cdata_write[I2C_DATA_MAX_LENGTH];
uint8_t i2cdata_read[I2C_DATA_MAX_LENGTH];
uint16_t cmd;
i2c_t i2cmaster;
int count = 0;
//sensor command
#define SENSOR_START 0x20A0
#define FIFO 0x2E41
#define REBOOT 0x2110
#define READ 0x2101
#define BYPASS 0x2E00
char i2cdatasrc[9] = {0x27, 0x28, 0x29, 0x2A};
//char i2cdatasrc[7] = {0x40, 0x48, 0x50, 0x27, 0x28, 0x29, 0x2A};
static void ePL_WriteCommand(uint16_t cmd)
{
i2cdata_write[0] = (uint8_t)(cmd >>8);
i2cdata_write[1] = (uint8_t)(cmd&0xFF);
i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdata_write[0], 2, 1);
}
/*
struct node
{
int info;
struct node *ptr;
}*front,*rear,*temp,*front1;
*/
//int frontelement();
//void enq(int data);
//void deq();
/*
void enq(int data)
{
if (rear == NULL)
{
rear = (struct node *)malloc(1*sizeof(struct node));
if(rear == NULL)
{
printf("\n\rmalloc rear failed!\n");
return;
}
rear->ptr = NULL;
rear->info = data;
front = rear;
//printf("front info: %d\n", front->info);
}
else
{
temp=(struct node *)malloc(1*sizeof(struct node));
rear->ptr = temp;
temp->info = data;
temp->ptr = NULL;
rear = temp;
//printf("rear info: %d\n", rear->info);
}
count++;
}
void deq()
{
front1 = front;
//printf("front info before deq: %d\n", front->info);
if (front1 == NULL)
{
printf("Error: Trying to display elements from empty queue\n");
return;
}
else
{
if (front1->ptr != NULL)
{
front1 = front1->ptr;
//printf("\nDequed value : %d\n", front->info);
free(front);
front = front1;
}
else
{
//printf("\nDequed value : %d\n", front->info);
free(front);
front = NULL;
rear = NULL;
}
count--;
}
}
*/
void main(void)
{
int result;
int i, data;
int temprature;
int flag = 0;
int sum = 0;
int average = 0;
struct node *output;
char intertupt;
DiagPrintf("Sensor_Init \r\n");
//for(i=0; i<16; i++)
//printf("ouput before: %d\n", i2cdata_read[i]);
i2c_init(&i2cmaster, MBED_I2C_MTR_SDA ,MBED_I2C_MTR_SCL);
i2c_frequency(&i2cmaster,MBED_I2C_BUS_CLK);
ePL_WriteCommand(SENSOR_START);
ePL_WriteCommand(REBOOT);
//ePL_WriteCommand(BYPASS);
while(1){
//i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdatasrc[3], 1, 1);
//i2c_read(&i2cmaster, MBED_I2C_SLAVE_ADDR0, (char*)&i2cdata_read[3], 2, 1);
//printf("Status Reg: %d\n", i2cdata_read[3]);
i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdatasrc[1], 1, 1);
i2c_read(&i2cmaster, MBED_I2C_SLAVE_ADDR0, (char*)&i2cdata_read[1], 2, 1);
//printf("--------pressure output LSB: %d\n", i2cdata_read[4]);
i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdatasrc[2], 1, 1);
i2c_read(&i2cmaster, MBED_I2C_SLAVE_ADDR0, (char*)&i2cdata_read[2], 2, 1);
//printf("--------pressure output MID: %d\n", i2cdata_read[5]);
i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdatasrc[3], 1, 1);
i2c_read(&i2cmaster, MBED_I2C_SLAVE_ADDR0, (char*)&i2cdata_read[3], 2, 1);
//printf("--------pressure output MSB: %d\n", i2cdata_read[6]);
Mdelay(2000);
data = (i2cdata_read[3]*256*256*100+i2cdata_read[2]*256*100+i2cdata_read[1]*100)/4128;
printf("pressure: %dPa\n", data);
/*
if(count == 20)
{
deq();
}
enq(data);
output = front;
sum = front->info;
while(output->ptr != NULL)
{
output = output->ptr;
sum = sum + output->info;
}
//printf("------count = %d---------\n", count);
average = sum / count;
//printf("---final output: %d---\n", average);
*/
}
Mdelay(1000);
}

View file

@ -0,0 +1,15 @@
Example Description
This example describes how to use i2c by using mbed api
1.Connect LOG-UART connector to PC
2.Connect board 1 and board 2
board 1 board 2
- I2C3 SDA (PB_3) to I2C1 SDA (PC_4) pin,
- I2C3 SCL (PB_2) to I2C1 SCL (PC_5) pin.
3.Run the main function.
4.Get the Master and Slave Data.

View file

@ -0,0 +1,327 @@
/*
* Routines to access hardware
*
* Copyright (c) 2013 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "PinNames.h"
#include "basic_types.h"
#include "diag.h"
#include <osdep_api.h>
#include "i2c_api.h"
#include "pinmap.h"
#include "ex_api.h"
#define MBED_I2C_MTR_SDA PB_3
#define MBED_I2C_MTR_SCL PB_2
#define MBED_I2C_SLV_SDA PC_4
#define MBED_I2C_SLV_SCL PC_5
#define MBED_I2C_SLAVE_ADDR0 0xAA
#define MBED_I2C_BUS_CLK 100000 //hz
#define I2C_DATA_LENGTH 127
char i2cdatasrc[I2C_DATA_LENGTH];
char i2cdatadst[I2C_DATA_LENGTH];
char i2cdatardsrc[I2C_DATA_LENGTH];
char i2cdatarddst[I2C_DATA_LENGTH];
#define I2C_MASTER_DEVICE
#ifndef I2C_MASTER_DEVICE
#define I2C_SLAVE_DEVICE
#endif
// RESTART verification
#undef I2C_RESTART_DEMO
// Slave
// RX
#define CLEAR_SLV_RXC_FLAG (slaveRXC = 0)
#define SET_SLV_RXC_FLAG (slaveRXC = 1)
#define WAIT_SLV_RXC while(slaveRXC == 0){;}
// Tx
#define CLEAR_SLV_TXC_FLAG (slaveTXC = 0)
#define SET_SLV_TXC_FLAG (slaveTXC = 1)
#define WAIT_SLV_TXC while(slaveTXC == 0){;}
// Read Request
#define CLEAR_SLV_RD_REQ_FLAG (slaveRdReq = 0)
#define SET_SLV_RD_REQ_FLAG (slaveRdReq = 1)
#define WAIT_SLV_RD_REQ while(slaveRdReq == 0){;}
// Master
// Rx
#define CLEAR_MST_RXC_FLAG (masterRXC = 0)
#define SET_MST_RXC_FLAG (masterRXC = 1)
#define WAIT_MST_RXC while(masterRXC == 0){;}
// Tx
#define CLEAR_MST_TXC_FLAG (masterTXC = 0)
#define SET_MST_TXC_FLAG (masterTXC = 1)
#define WAIT_MST_TXC while(masterTXC == 0){;}
#if defined (__ICCARM__)
i2c_t i2cmaster;
i2c_t i2cslave;
#else
volatile i2c_t i2cmaster;
volatile i2c_t i2cslave;
#endif
volatile int masterTXC;
volatile int masterRXC;
volatile int slaveTXC;
volatile int slaveRXC;
volatile int slaveRdReq;
void i2c_slave_rxc_callback(void *userdata)
{
int i2clocalcnt;
int result = 0;
i2c_enable_control(&i2cslave, 0);
for (i2clocalcnt = 0; i2clocalcnt < I2C_DATA_LENGTH; i2clocalcnt+=2) {
// DBG_8195A("i2c data: %02x \t %02x\n",i2cdatadst[i2clocalcnt],i2cdatadst[i2clocalcnt+1]);
}
//HalDelayUs(5000);
// verify result
result = 1;
#if !defined(I2C_RESTART_DEMO)
for (i2clocalcnt = 0; i2clocalcnt < I2C_DATA_LENGTH; i2clocalcnt++) {
if (i2cdatasrc[i2clocalcnt] != i2cdatadst[i2clocalcnt]) {
result = 0;
break;
}
}
#else
if (i2cdatasrc[0] == i2cdatadst[0]) {
if (i2cdatasrc[0] != i2cdatadst[0]) {
result = 0;
}
} else if (i2cdatasrc[1] == i2cdatadst[0]) {
for (i2clocalcnt = 1; i2clocalcnt < I2C_DATA_LENGTH; i2clocalcnt++) {
if (i2cdatasrc[i2clocalcnt] != i2cdatadst[i2clocalcnt -1]) {
DBG_8195A("idx:%d, src:%x, dst:%x\n", i2clocalcnt, i2cdatasrc[i2clocalcnt], i2cdatadst[i2clocalcnt]);
for (i2clocalcnt = 0; i2clocalcnt < I2C_DATA_LENGTH; i2clocalcnt+=2) {
DBG_8195A("i2c data: %02x \t %02x\n",i2cdatadst[i2clocalcnt],i2cdatadst[i2clocalcnt+1]);
}
result = 0;
break;
}
}
} else {
for (i2clocalcnt = 0; i2clocalcnt < I2C_DATA_LENGTH; i2clocalcnt++) {
if (i2cdatasrc[i2clocalcnt] != i2cdatadst[i2clocalcnt]) {
DBG_8195A("idx:%d, src:%x, dst:%x\n", i2clocalcnt, i2cdatasrc[i2clocalcnt], i2cdatadst[i2clocalcnt]);
result = 0;
break;
}
}
}
#endif
DBG_8195A("\r\nSlave receive: Result is %s\r\n", (result) ? "success" : "fail");
_memset(&i2cdatadst[0], 0x00, I2C_DATA_LENGTH);
SET_SLV_RXC_FLAG;
i2c_enable_control(&i2cslave, 1);
}
void i2c_master_rxc_callback(void *userdata)
{
int i2clocalcnt;
int result = 0;
//DBG_8195A("show master received data>>>\n");
for (i2clocalcnt = 0; i2clocalcnt < I2C_DATA_LENGTH; i2clocalcnt+=2) {
//DBG_8195A("i2c data: %02x \t %02x\n",i2cdatarddst[i2clocalcnt],i2cdatarddst[i2clocalcnt+1]);
}
// verify result
result = 1;
for (i2clocalcnt = 0; i2clocalcnt < I2C_DATA_LENGTH; i2clocalcnt++) {
if (i2cdatarddst[i2clocalcnt] != i2cdatardsrc[i2clocalcnt]) {
result = 0;
break;
}
}
DBG_8195A("\r\nMaster receive: Result is %s\r\n", (result) ? "success" : "fail");
}
void i2c_slave_txc_callback(void *userdata)
{
SET_SLV_TXC_FLAG;
}
void i2c_master_txc_callback(void *userdata)
{
SET_MST_TXC_FLAG;
}
void i2c_master_err_callback(void *userdata)
{
DBG_8195A("ERR:%x\n", i2cmaster.SalI2CHndPriv.SalI2CHndPriv.ErrType);
}
void i2c_slave_rd_req_callback(void *userdata) {
DBG_8195A("rd req\n");
SET_SLV_RD_REQ_FLAG;
}
void demo_i2c_master_enable(void)
{
_memset(&i2cmaster, 0x00, sizeof(i2c_t));
i2c_init(&i2cmaster, MBED_I2C_MTR_SDA ,MBED_I2C_MTR_SCL);
i2c_frequency(&i2cmaster,MBED_I2C_BUS_CLK);
i2c_set_user_callback(&i2cmaster, I2C_RX_COMPLETE, i2c_master_rxc_callback);
i2c_set_user_callback(&i2cmaster, I2C_TX_COMPLETE, i2c_master_txc_callback);
i2c_set_user_callback(&i2cmaster, I2C_ERR_OCCURRED, i2c_master_err_callback);
#ifdef I2C_RESTART_DEMO
i2c_restart_enable(&i2cmaster);
#endif
}
void demo_i2c_slave_enable(void)
{
_memset(&i2cslave, 0x00, sizeof(i2c_t));
i2c_init(&i2cslave, MBED_I2C_SLV_SDA ,MBED_I2C_SLV_SCL);
i2c_frequency(&i2cslave,MBED_I2C_BUS_CLK);
i2c_slave_address(&i2cslave, 0, MBED_I2C_SLAVE_ADDR0, 0xFF);
i2c_slave_mode(&i2cslave, 1);
i2c_set_user_callback(&i2cslave, I2C_RX_COMPLETE, i2c_slave_rxc_callback);
i2c_set_user_callback(&i2cslave, I2C_TX_COMPLETE, i2c_slave_txc_callback);
i2c_set_user_callback(&i2cslave, I2C_RD_REQ_COMMAND, i2c_slave_rd_req_callback);
}
void demo_i2c_master_write_1byte(void)
{
DBG_8195A("Mst-W\n");
CLEAR_MST_TXC_FLAG;
i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdatasrc[0], 1, 0);
WAIT_MST_TXC;
DBG_8195A("Mst-W is complete and STOP bit is NOT sent.\n");
}
void demo_i2c_master_write_n_1byte(void)
{
DBG_8195A("Mst-W\n");
CLEAR_MST_TXC_FLAG;
i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdatasrc[1], (I2C_DATA_LENGTH-1), 1);
//wait for master TXC
WAIT_MST_TXC;
}
void demo_i2c_master_write(void)
{
DBG_8195A("Mst-W\n");
CLEAR_MST_TXC_FLAG;
i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdatasrc[0], I2C_DATA_LENGTH, 1);
//wait for master TXC
WAIT_MST_TXC;
}
void demo_i2c_master_read(void)
{
DBG_8195A("Mst-R\n");
DBG_8195A("Mst-R need to wait Slv-W complete.\n");
CLEAR_MST_RXC_FLAG;
i2c_read(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdatarddst[0], I2C_DATA_LENGTH, 1);
WAIT_MST_RXC;
}
void demo_i2c_slave_read(void)
{
DBG_8195A("Slv-R\n");
CLEAR_SLV_RXC_FLAG;
i2c_slave_read(&i2cslave, &i2cdatadst[0], I2C_DATA_LENGTH);
WAIT_SLV_RXC;
}
void demo_i2c_slave_read_1byte(void)
{
DBG_8195A("Slv-R\n");
CLEAR_SLV_RXC_FLAG;
i2c_slave_read(&i2cslave, &i2cdatadst[0], 1);
WAIT_SLV_RXC;
}
void demo_i2c_slave_write(void)
{
DBG_8195A("Slv-W\n");
CLEAR_SLV_RD_REQ_FLAG;
i2c_slave_set_for_rd_req(&i2cslave, 1);
WAIT_SLV_RD_REQ;
CLEAR_SLV_TXC_FLAG;
i2c_slave_write(&i2cslave, &i2cdatardsrc[0], I2C_DATA_LENGTH);
WAIT_SLV_TXC;
}
void main(void)
{
int i2clocalcnt;
DBG_8195A("Slave address: 0x%x\n", MBED_I2C_SLAVE_ADDR0);
#ifdef I2C_RESTART_DEMO
DBG_8195A("Enable restart\n");
#endif
// prepare for transmission
_memset(&i2cdatasrc[0], 0x00, I2C_DATA_LENGTH);
_memset(&i2cdatadst[0], 0x00, I2C_DATA_LENGTH);
_memset(&i2cdatardsrc[0], 0x00, I2C_DATA_LENGTH);
_memset(&i2cdatarddst[0], 0x00, I2C_DATA_LENGTH);
for (i2clocalcnt=0; i2clocalcnt < I2C_DATA_LENGTH; i2clocalcnt++){
i2cdatasrc[i2clocalcnt] = i2clocalcnt+0x2;
}
for (i2clocalcnt=0; i2clocalcnt < I2C_DATA_LENGTH; i2clocalcnt++){
i2cdatardsrc[i2clocalcnt] = i2clocalcnt+1;
}
//================================================================
// ------- Dual board -------
#ifdef I2C_MASTER_DEVICE
demo_i2c_master_enable();
// Master write - Slave read
#ifdef I2C_RESTART_DEMO
demo_i2c_master_write_1byte();
demo_i2c_master_write_n_1byte(); // n-1 bytes
#else
demo_i2c_master_write();
#endif
// Master read - Slave write
#ifdef I2C_RESTART_DEMO
demo_i2c_master_write_1byte();
#endif
demo_i2c_master_read();
#endif // #ifdef I2C_MASTER_DEVICE
#ifdef I2C_SLAVE_DEVICE
demo_i2c_slave_enable();
i2c_slave_set_for_data_nak(&i2cslave, 1);
HalDelayUs(5000);
i2c_slave_set_for_data_nak(&i2cslave, 0);
// Master write - Slave read
demo_i2c_slave_read();
// Master read - Slave write
#ifdef I2C_RESTART_DEMO
demo_i2c_slave_read_1byte();
#endif
demo_i2c_slave_write();
#endif // #ifdef I2C_SLAVE_DEVICE
while(1){;}
}

View file

@ -0,0 +1,77 @@
/*******************************************************************************
HRM.h - Definition header
*******************************************************************************/
#ifndef HRM_H
#define HRM_H
#include <stdint.h>
//------------------------------------------------------
#define HR_SAMPLE_RATE 25// Hz
#define HR_INTEG_MIN HR_INTEG_40
#define HR_INTEG_BASE HR_INTEG_250
#define HR_INTEG_MAX HR_INTEG_250
#define HR_TH_HIGH 63000
#define HR_TH_LOW 30000
//------------------------------------------------------
// HRM I2C address & register sub-addresses
#define HR_SLAVE_ADDRESS 0x82
#define HR_FILTER_1 0<<5
#define HR_FILTER_2 1<<5
#define HR_FILTER_4 2<<5
#define HR_FILTER_8 3<<5
#define HR_FILTER_16 4<<5
#define HR_FILTER_32 5<<5
#define HR_FILTER_64 6<<5
#define HR_FILTER_128 7<<5
#define HR_MODE_HR 1<<4
#define HR_MODE_HRS 9<<4
#define HR_GAIN_MID 1
#define HR_GAIN_LOW 3
#define HR_INTEG_20 5
#define HR_INTEG_25 6
#define HR_INTEG_30 7
#define HR_INTEG_40 8
#define HR_INTEG_55 9
#define HR_INTEG_70 10
#define HR_INTEG_90 11
#define HR_INTEG_110 12
#define HR_INTEG_150 13
#define HR_INTEG_200 14
#define HR_INTEG_250 15
#define HR_INTEG_350 16
#define HR_INTEG_450 17
#define HR_INTEG_550 18
#define HR_OSR_64 0<<2
#define HR_OSR_256 1<<2
#define HR_OSR_1024 2<<2
#define HR_OSR_2048 3<<2
#define HR_RESETN_RESET 0<<2
#define HR_RESETN_RUN 1<<2
#define HR_PDRIVE_70MA 0<<4
#define HR_PDRIVE_35MA 1<<4
#define HR_PDRIVE_200MA 2<<4
#define HR_PDRIVE_100MA 3<<4
#define HR_INT_FRAME 1<<2
#define HR_INT_DISABLED 2<<2
#define HR_IR_DISABLE 0<<7
#define HR_IR_ENABLE 1<<7
//------------------------------------------------------
// Declarations
void init_hrm(void);
uint16_t read_hrm(void);
#endif /* HRM_H */

View file

@ -0,0 +1,39 @@
/*
* heart_interface.h
*
* Created on: 2014/4/29
* Author: 01004
*/
#ifndef HEART_INTERFACE_H_
#define HEART_INTERFACE_H_
#define MIN_HEART_RATE 48
#define MAX_HEART_RATE 180
extern int g_heartrate;
typedef void (*hr_callback)(int);
/*
* If there is no g-sensor, fill x, y, z in 0.
*/
void add_PPG_XYZ(int ppg, short xx, short yy, short zz);
/*
* A callback to handle heartrate events.
*/
void register_callback(hr_callback callback);
/*
* Ex: report_period = 25.
* it means report a heart rate every 25 samples.
*/
void start(int report_period);
void reset(void);
void stop(void);
#endif /* HEART_INTERFACE_H_ */

View file

@ -0,0 +1,16 @@
Example Description
this example is use to measure heart rate of human
Requirement Components:
extend board
work with arduino extended board, which has heart rate sensor
during the measurement, user has to lie his pulp on the sensor and do not rock the sensor
the test code will return back the heart rate
Build code
1. Please be sure to copy inc\heart_interface.h, inc\HRM_2197.h
2. Include hr_library.a in IAR project. Add hr_library.a into folder "lib" in IAR project.

View file

@ -0,0 +1,162 @@
/*******************************************************************************
* HRM.c - Eminent Heart Rate Module (HRM) routines via I2C
*******************************************************************************/
#include "HRM_2197.h"
#include <stdio.h>
#include <time.h>
//#include <windows.h>
#include "heart_interface.h"
#include "device.h"
#include "PinNames.h"
#include "basic_types.h"
#include "diag.h"
#include "osdep_api.h"
#include "i2c_api.h"
#include "pinmap.h"
//#include "rtl_lib.h"
#include "gpio_api.h" // mbed
#include "main.h"
#define MBED_I2C_SLAVE_ADDR0 0x41
#define HR_MODE 0x001b
#define LED_ENABLE 0x3081
#define FRAME_ENABLE 0x4804
#define CHIP_RESET 0x4000
#define CHIP_RUN 0x4004
#define DATA_LOCK 0x4005
#define DATA_UNLOCK 0x4004
#define I2C_DATA_MAX_LENGTH 20
#define CLOCK_SET 0x3800
#define MBED_I2C_MTR_SDA PB_3
#define MBED_I2C_MTR_SCL PB_2
#define MBED_I2C_INTB PA_5
#define MBED_I2C_BUS_CLK 100000 //hz
uint8_t i2cdata_write[I2C_DATA_MAX_LENGTH];
uint8_t i2cdata_read[I2C_DATA_MAX_LENGTH];
uint16_t cmd;
i2c_t i2cmaster;
uint8_t integ_time = HR_INTEG_MIN;
int integ_time_array[] = { 4, 6, 8, 10, 15, 20, 25, 30, 40, 55, 70, 90, 110, 150, 200, 250, 350, 450, 550 };
//Step1. define the callback to handle event of heart rate update
/*******************************************************************************
* report heart rate every 1 second
*******************************************************************************/
void on_heartrate_update(int heartrate) {
printf("heart rate %d\n", heartrate);
//fflush(stdout);
}
char i2cdatasrc[3] = {0x68, 0x90, 0x98};
static void ePL_WriteCommand(uint16_t cmd)
{
i2cdata_write[0] = (uint8_t)(cmd >>8);
i2cdata_write[1] = (uint8_t)(cmd&0xFF);
i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdata_write[0], 2, 1);
}
uint16_t read_hrm(void) {
uint32_t raw, normalized_raw;
int integ_time_changed = 0;
ePL_WriteCommand(DATA_LOCK);
i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdatasrc[1], 1, 1);
i2c_read(&i2cmaster, MBED_I2C_SLAVE_ADDR0, (char*)&i2cdata_read[1], 2, 1);
i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdatasrc[2], 1, 1);
i2c_read(&i2cmaster, MBED_I2C_SLAVE_ADDR0, (char*)&i2cdata_read[2], 2, 1);
raw = i2cdata_read[1];
raw |= (uint16_t) i2cdata_read[2] << 8;
normalized_raw = raw >> 4;
normalized_raw = normalized_raw * integ_time_array[HR_INTEG_BASE];
normalized_raw = normalized_raw / integ_time_array[integ_time];
if (raw > HR_TH_HIGH && integ_time > HR_INTEG_MIN) {
integ_time -= 1;
integ_time_changed = 1;
} else if (raw < HR_TH_LOW && integ_time < HR_INTEG_MAX) {
integ_time += 1;
integ_time_changed = 1;
}
if (integ_time_changed == 1) {
ePL_WriteCommand(((0x01<<3)<<8) | ( HR_FILTER_4 | integ_time));
ePL_WriteCommand(((0x08<<3)<<8) | ( HR_RESETN_RESET));
}
ePL_WriteCommand(((0x08<<3)<<8) | ( HR_RESETN_RUN));
return normalized_raw;
}
/*******************************************************************************
* main function to read data, input to library,
* and calculate heart rate
*******************************************************************************/
void main(void) {
int i, length;
int *data;
uint16_t result;
data = (int*) calloc(3000, sizeof(int));
//load_ppg_signal(data, &length); //Load Test Data From File
i2c_init(&i2cmaster, MBED_I2C_MTR_SDA ,MBED_I2C_MTR_SCL);
i2c_frequency(&i2cmaster,MBED_I2C_BUS_CLK);
//Step2. delegate the event of heart rate update
register_callback(on_heartrate_update);
//Step3. Set the data length of heart rate calculation= 2^9 = 512
ePL_WriteCommand(((0x00<<3)<<8) | ( HR_MODE_HRS | HR_OSR_1024 | HR_GAIN_MID));
ePL_WriteCommand(((0x01<<3)<<8) | ( HR_FILTER_4 | integ_time));
ePL_WriteCommand(((0x09<<3)<<8) | ( HR_PDRIVE_70MA));
ePL_WriteCommand(((0x06<<3)<<8) | ( HR_IR_ENABLE | HR_INT_FRAME));
ePL_WriteCommand(((0x08<<3)<<8) | ( HR_RESETN_RESET));
while(1) {
//Step4. Add ppg data continuously, and the Lib will return the Heart Rate 1 time/sec
result = read_hrm();
if(result>100)
add_PPG_XYZ(result, 0, 0, 0);
Mdelay(40); //Simulate the ppg input time interval = 40ms
}
//Step5. Stop
stop();
free(data);
}
/*******************************************************************************
* initialize ic parameters
*******************************************************************************/
/*******************************************************************************
* read rawdata
*******************************************************************************/

View file

@ -0,0 +1,11 @@
Example Description
This example describes how to use proximity sensor to detect lightness
Requirement Components:
extend board
work with arduino extended board, which has proximity sensor
when the proximity sensor is in ALS mode (detect lightness), it will keep polling lightness output.

View file

@ -0,0 +1,108 @@
#include "device.h"
#include "PinNames.h"
#include "basic_types.h"
#include "diag.h"
#include "osdep_api.h"
#include "i2c_api.h"
#include "pinmap.h"
//#include "rtl_lib.h"
#include "main.h"
#define MBED_I2C_MTR_SDA PB_3
#define MBED_I2C_MTR_SCL PB_2
#define MBED_I2C_INTB PA_5
#define MBED_I2C_SLAVE_ADDR0 0x49
#define MBED_I2C_BUS_CLK 100000 //hz
#define I2C_DATA_MAX_LENGTH 20
uint8_t i2cdata_write[I2C_DATA_MAX_LENGTH];
uint8_t i2cdata_read[I2C_DATA_MAX_LENGTH];
uint16_t cmd;
i2c_t i2cmaster;
//sensor command
#define WAKE_UP 0x1102
#define CHIP_REFRESH1 0xFD8E
#define CHIP_REFRESH2 0xFE22
#define CHIP_REFRESH3 0xFE02
#define CHIP_REFRESH4 0xFD00
#define PS_MODE 0x0002
#define ALS_MODE 0x0001
#define POWER_UP 0x1102
#define CHIP_RESET 0x1100
#define CHANGE_TIME 0x0851
#define SETTING_1 0x0F19
#define SETTING_2 0x0D10
#define INT 0x3022
char i2cdatasrc[5] = {0x1B, 0x15, 0x16, 0x80, 0x88};
static void ePL_WriteCommand(uint16_t cmd)
{
i2cdata_write[0] = (uint8_t)(cmd >>8);
i2cdata_write[1] = (uint8_t)(cmd&0xFF);
i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdata_write[0], 2, 1);
}
void main(void)
{
int result;
int i;
int light = 0;
int flag = 0;
char intertupt;
DiagPrintf("Sensor_Init \r\n");
i2c_init(&i2cmaster, MBED_I2C_MTR_SDA ,MBED_I2C_MTR_SCL);
i2c_frequency(&i2cmaster,MBED_I2C_BUS_CLK);
ePL_WriteCommand(WAKE_UP);
ePL_WriteCommand(CHIP_REFRESH1);
ePL_WriteCommand(CHIP_REFRESH2);
ePL_WriteCommand(CHIP_REFRESH3);
ePL_WriteCommand(CHIP_REFRESH4);
ePL_WriteCommand(ALS_MODE);
//ePL_WriteCommand(SETTING_1);
//ePL_WriteCommand(SETTING_2);
ePL_WriteCommand(CHIP_RESET);
ePL_WriteCommand(POWER_UP);
Mdelay(240);
while(1){
//ePL_WriteCommand(DATA_LOCK);
i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdatasrc[0], 1, 1);
i2c_read(&i2cmaster, MBED_I2C_SLAVE_ADDR0, (char*)&i2cdata_read[0], 2, 1);
i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdatasrc[1], 1, 1);
i2c_read(&i2cmaster, MBED_I2C_SLAVE_ADDR0, (char*)&i2cdata_read[1], 2, 1);
i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdatasrc[2], 1, 1);
i2c_read(&i2cmaster, MBED_I2C_SLAVE_ADDR0, (char*)&i2cdata_read[2], 2, 1);
// printf("ALS LOW: %d\n", i2cdata_read[1]);
//printf("ALS HIGH: %d\n", i2cdata_read[2]);
light = i2cdata_read[1] + i2cdata_read[2] * 256;
printf("lightness: %d\n", light);
//flag = (i2cdata_read[0] & 8)? 1:0;
//int ret = (i2cdata_read[0] & 4)? 1:0;
//printf("flag: %d\n", flag);
//printf("ret: %d\n", ret);
//ePL_WriteCommand(POWER_UP);
Mdelay(1000);
}
}

View file

@ -0,0 +1,12 @@
Example Description
This example describes how to use proximity sensor to detect distance
Requirement Components:
extend board
work with arduino extended board, which has proximity sensor
When the proximity sensor is in PS mode (detect distance), if the object is close to the sensor, a near message will print out. Otherwise a far message will print out.

View file

@ -0,0 +1,115 @@
#include "device.h"
#include "PinNames.h"
#include "basic_types.h"
#include "diag.h"
#include "osdep_api.h"
#include "i2c_api.h"
#include "pinmap.h"
//#include "rtl_lib.h"
#include "main.h"
#define MBED_I2C_MTR_SDA PB_3
#define MBED_I2C_MTR_SCL PB_2
#define MBED_I2C_INTB PA_5
#define MBED_I2C_SLAVE_ADDR0 0x49
#define MBED_I2C_BUS_CLK 100000 //hz
#define I2C_DATA_MAX_LENGTH 20
uint8_t i2cdata_write[I2C_DATA_MAX_LENGTH];
uint8_t i2cdata_read[I2C_DATA_MAX_LENGTH];
uint16_t cmd;
i2c_t i2cmaster;
//sensor command
#define WAKE_UP 0x1102
#define CHIP_REFRESH1 0xFD8E
#define CHIP_REFRESH2 0xFE22
#define CHIP_REFRESH3 0xFE02
#define CHIP_REFRESH4 0xFD00
#define PS_MODE 0x0002
#define ALS1_MODE 0x0072
#define ALS2_MODE 0x503E
#define ALS3_MODE 0x583E
#define POWER_UP 0x1102
#define CHIP_RESET 0x1100
#define CHANGE_TIME 0x0851
#define SETTING_1 0x0F19
#define SETTING_2 0x0D10
#define INT 0x3022
char i2cdatasrc[5] = {0x1B, 0x1E, 0x1F, 0x80, 0x88};
static void ePL_WriteCommand(uint16_t cmd)
{
i2cdata_write[0] = (uint8_t)(cmd >>8);
i2cdata_write[1] = (uint8_t)(cmd&0xFF);
i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdata_write[0], 2, 1);
}
void main(void)
{
int result;
int i;
int flag = 0;
char intertupt;
DiagPrintf("Sensor_Init \r\n");
i2c_init(&i2cmaster, MBED_I2C_MTR_SDA ,MBED_I2C_MTR_SCL);
i2c_frequency(&i2cmaster,MBED_I2C_BUS_CLK);
ePL_WriteCommand(WAKE_UP);
ePL_WriteCommand(CHIP_REFRESH1);
ePL_WriteCommand(CHIP_REFRESH2);
ePL_WriteCommand(CHIP_REFRESH3);
ePL_WriteCommand(CHIP_REFRESH4);
ePL_WriteCommand(PS_MODE);
ePL_WriteCommand(SETTING_1);
ePL_WriteCommand(SETTING_2);
ePL_WriteCommand(CHIP_RESET);
ePL_WriteCommand(POWER_UP);
Mdelay(240);
while(1){
//ePL_WriteCommand(DATA_LOCK);
i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdatasrc[0], 1, 1);
i2c_read(&i2cmaster, MBED_I2C_SLAVE_ADDR0, (char*)&i2cdata_read[0], 2, 1);
i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdatasrc[1], 1, 1);
i2c_read(&i2cmaster, MBED_I2C_SLAVE_ADDR0, (char*)&i2cdata_read[1], 2, 1);
i2c_write(&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdatasrc[2], 1, 1);
i2c_read(&i2cmaster, MBED_I2C_SLAVE_ADDR0, (char*)&i2cdata_read[2], 2, 1);
//printf("PS LOW: %d\n", i2cdata_read[1]);
//printf("PS HIGH: %d\n", i2cdata_read[2]);
flag = (i2cdata_read[0] & 8)? 1:0;
int ret = (i2cdata_read[0] & 4)? 1:0;
//printf("flag: %d\n", flag);
//printf("ret: %d\n", ret);
if(flag){
printf("the object is far\n");
}
else
{
printf("the object is near\n");
}
//ePL_WriteCommand(POWER_UP);
Mdelay(1000);
}
}

View file

@ -0,0 +1,10 @@
Example Description
This example describes how to use i2s by using mbed extend api
1.Plug ALC5651 shield to Ameba HDK
2.Run the main function.
3.Plug earphone to Green phone jack

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,331 @@
#include "FreeRTOS.h"
#include "task.h"
#include "diag.h"
#include "main.h"
#include "i2s_api.h"
/**
* @brief Main program.
* @param None
* @retval None
*/
#include "alc5651.h"
/*
extern void alc5651_init(void);
extern void alc5651_init_interface2(void);
extern void alc5651_reg_dump(void);
extern void alc5651_index_dump(void);
extern void alc5651_set_word_len(int len_idx);
*/
i2s_t i2s_obj;
#define I2S_DMA_PAGE_SIZE 768 // 2 ~ 4096
#define I2S_DMA_PAGE_NUM 4 // Vaild number is 2~4
u8 i2s_tx_buf[I2S_DMA_PAGE_SIZE*I2S_DMA_PAGE_NUM];
u8 i2s_rx_buf[I2S_DMA_PAGE_SIZE*I2S_DMA_PAGE_NUM];
#define SAMPLE_FILE
#define SAMPLE_FILE_RATE 44100
#define SAMPLE_FILE_CHNUM 2
#define I2S_SCLK_PIN PC_1
#define I2S_WS_PIN PC_0
#define I2S_SD_PIN PC_2
#if defined(SAMPLE_FILE)
// no sample
// SR_96KHZ,
// SR_7p35KHZ,
// SR_29p4KHZ,
// SR_88p2KHZ
#if SAMPLE_FILE_RATE==8000
#if SAMPLE_FILE_CHNUM==2
#include "birds_8000_2ch_16b.c"
#undef SAMPLE_FILE_RATE
#define SAMPLE_FILE_RATE SR_8KHZ
#endif
#elif SAMPLE_FILE_RATE==14700
#if SAMPLE_FILE_CHNUM==2
#include "birds_14700_2ch_16b.c"
#undef SAMPLE_FILE_RATE
#define SAMPLE_FILE_RATE SR_14p7KHZ
#endif
#elif SAMPLE_FILE_RATE==16000
#if SAMPLE_FILE_CHNUM==2
#include "birds_16000_2ch_16b.c"
#undef SAMPLE_FILE_RATE
#define SAMPLE_FILE_RATE SR_16KHZ
#endif
#elif SAMPLE_FILE_RATE==22050
#if SAMPLE_FILE_CHNUM==2
#include "birds_22050_2ch_16b.c"
#undef SAMPLE_FILE_RATE
#define SAMPLE_FILE_RATE SR_22p05KHZ
#endif
#elif SAMPLE_FILE_RATE==24000
#if SAMPLE_FILE_CHNUM==2
#include "birds_24000_2ch_16b.c"
#undef SAMPLE_FILE_RATE
#define SAMPLE_FILE_RATE SR_24KHZ
#endif
#elif SAMPLE_FILE_RATE==32000
#if SAMPLE_FILE_CHNUM==2
#include "birds_32000_2ch_16b.c"
#undef SAMPLE_FILE_RATE
#define SAMPLE_FILE_RATE SR_32KHZ
#endif
#elif SAMPLE_FILE_RATE==44100
#if SAMPLE_FILE_CHNUM==2
#include "birds_44100_2ch_16b.c"
#undef SAMPLE_FILE_RATE
#define SAMPLE_FILE_RATE SR_44p1KHZ
#endif
#elif SAMPLE_FILE_RATE==48000
#if SAMPLE_FILE_CHNUM==2
#include "birds_48000_2ch_16b.c"
#undef SAMPLE_FILE_RATE
#define SAMPLE_FILE_RATE SR_48KHZ
#endif
#endif
#if SAMPLE_FILE_CHNUM==2
#undef SAMPLE_FILE_CHNUM
#define SAMPLE_FILE_CHNUM CH_STEREO
#endif
int curr_cnt=0;
#else
short test_sine16[16]={0, 12539/4, 23170/4, 30273/4, 32767/4, 30273/4, 23170/4, 12539/4,
0, -12539/4, -23170/4, -30273/4, -32767/4, -30273/4, -23170/4, -12539/4};
int test_sine24[16]={0, 12539*256/4, 23170*256/4, 30273*256/4, 32767*256/4, 30273*256/4, 23170*256/4, 12539*256/4,
0, -12539*256/4, -23170*256/4, -30273*256/4, -32767*256/4, -30273*256/4, -23170*256/4, -12539*256/4};
extern void wait_ms(u32);
#include <math.h>
short remap_level_to_signed_16_bit(float val)
{
val*=32767;
if(val>32767) val=32767;
if(val<-32768) val=-32768;
return val;
}
void generate_freq_16bit(short *buffer, int count, float freq, float sampling_rate)
{
int pos; // sample number we're on
for (pos = 0; pos < count; pos++) {
float a = 2 * 3.14159f * freq * pos / sampling_rate;
// convert from [-1.0,1.0] to [-32767,32767]:
buffer[pos] = remap_level_to_signed_16_bit(a);
}
}
void gen_sound_sample16(short *buf, int buf_size, int channel_num)
{
int i;
for (i = 0 ; i < buf_size ; i+=channel_num){
buf[i] = test_sine16[(i/channel_num)%16];
if(channel_num>=2)
buf[i+1] = test_sine16[(i/channel_num)%16];
}
}
void gen_sound_sample24(int *buf, int buf_size, int channel_num)
{
int i;
for (i = 0 ; i < buf_size ; i+=channel_num){
buf[i] = test_sine24[(i/channel_num)%16]&0xFFFFFF;
if(channel_num>=2)
//buf[i+1] = test_sine24[(i/channel_num)%16]&0xFFFFFF;
buf[i+1] = test_sine24[(i/channel_num)%16]&0xFFFFFF;
}
}
#if 0
void test_delay(int sec)
{
for(int i=0;i<166*1000*100*sec;i++)
asm(" nop");
}
#endif
int test_rate_list[12] = {
SR_8KHZ,
SR_16KHZ,
SR_24KHZ,
SR_32KHZ,
SR_48KHZ,
SR_96KHZ,
SR_7p35KHZ,
SR_14p7KHZ,
SR_22p05KHZ,
SR_29p4KHZ,
SR_44p1KHZ,
SR_88p2KHZ
};
#endif
void test_tx_complete(void *data, char *pbuf)
{
int *ptx_buf;
i2s_t *obj = (i2s_t *)data;
static u32 count=0;
//DBG_8195A_I2S_LVL(VERI_I2S_LVL, "I2S%d %s\n",pI2SDemoHnd->DevNum,__func__);
count++;
if ((count&1023) == 1023)
{
DBG_8195A_I2S_LVL(VERI_I2S_LVL, ",\n");
}
ptx_buf = i2s_get_tx_page(obj);
//ptx_buf = (int*)pbuf;
#if defined(SAMPLE_FILE)
_memcpy((void*)ptx_buf, (void*)&sample[curr_cnt], I2S_DMA_PAGE_SIZE);
curr_cnt+=(I2S_DMA_PAGE_SIZE/sizeof(short));
if(curr_cnt >= sample_size*(obj->channel_num==CH_MONO?1:2)) {
curr_cnt = 0;
}
#else
if(obj->word_length == WL_16b){
gen_sound_sample16((short*)ptx_buf, I2S_DMA_PAGE_SIZE/sizeof(short), obj->channel_num==CH_MONO?1:2);
}else{
gen_sound_sample24((int*)ptx_buf, I2S_DMA_PAGE_SIZE/sizeof(int), obj->channel_num==CH_MONO?1:2);
}
#endif
i2s_send_page(obj, (uint32_t*)ptx_buf);
}
void test_rx_complete(void *data, char* pbuf)
{
i2s_t *obj = (i2s_t *)data;
int *ptx_buf;
static u32 count=0;
count++;
if ((count&1023) == 1023)
{
DBG_8195A_I2S_LVL(VERI_I2S_LVL, ".\n");
}
ptx_buf = i2s_get_tx_page(obj);
_memcpy((void*)ptx_buf, (void*)pbuf, I2S_DMA_PAGE_SIZE);
i2s_recv_page(obj); // submit a new page for receive
i2s_send_page(obj, (uint32_t*)ptx_buf); // loopback
}
void main(void)
{
int *ptx_buf;
int i,j;
alc5651_init();
alc5651_init_interface2(); // connect to ALC interface 2
// dump register
//alc5651_reg_dump();
//alc5651_index_dump();
// I2S init
i2s_obj.channel_num = CH_MONO;//CH_STEREO;
i2s_obj.sampling_rate = SR_44p1KHZ;
i2s_obj.word_length = WL_16b;
i2s_obj.direction = I2S_DIR_TXRX;
i2s_init(&i2s_obj, I2S_SCLK_PIN, I2S_WS_PIN, I2S_SD_PIN);
i2s_set_dma_buffer(&i2s_obj, (char*)i2s_tx_buf, (char*)i2s_rx_buf, \
I2S_DMA_PAGE_NUM, I2S_DMA_PAGE_SIZE);
i2s_tx_irq_handler(&i2s_obj, (i2s_irq_handler)test_tx_complete, (uint32_t)&i2s_obj);
i2s_rx_irq_handler(&i2s_obj, (i2s_irq_handler)test_rx_complete, (uint32_t)&i2s_obj);
#if defined(SAMPLE_FILE)
i2s_set_param(&i2s_obj,SAMPLE_FILE_CHNUM,SAMPLE_FILE_RATE,WL_16b);
for (i=0;i<I2S_DMA_PAGE_NUM;i++) {
ptx_buf = i2s_get_tx_page(&i2s_obj);
if (ptx_buf) {
_memcpy((void*)ptx_buf, (void*)&sample[curr_cnt], I2S_DMA_PAGE_SIZE);
i2s_send_page(&i2s_obj, (uint32_t*)ptx_buf);
curr_cnt+=(I2S_DMA_PAGE_SIZE/sizeof(short));
if(curr_cnt >= sample_size*(i2s_obj.channel_num==CH_MONO?1:2)) {
curr_cnt = 0;
}
}
}
#else
// output freq, @ sampling rate
// 6kHz @ 96kHz
// 3kHz @ 48kHz
// 2kHz @ 32kHz
// 1.5kHz @ 24kHz
// 1kHz @ 16kHz
// 500Hz @ 8kHz
// 5512.5 Hz @ 88200Hz
// 2756.25 Hz @ 44100Hz
// 1837.5 Hz @ 29400Hz
// 1378.125 Hz @ 22050Hz
// 459.375 Hz @ 7350Hz
// Stereo, 16bit
for(i=0;i<12;i++){
i2s_set_param(&i2s_obj,CH_STEREO,test_rate_list[i],WL_16b);
// Start with fill all pages of DMA buffer
for (j=0;j<I2S_DMA_PAGE_NUM;j++) {
ptx_buf = i2s_get_tx_page(&i2s_obj);
if (ptx_buf) {
gen_sound_sample16((short*)ptx_buf, I2S_DMA_PAGE_SIZE/sizeof(short), 2);
i2s_send_page(&i2s_obj, (uint32_t*)ptx_buf);
}
}
wait_ms(5000); // delay 5 sec.
}
// Mono, 16bit
for(i=0;i<12;i++){
i2s_set_param(&i2s_obj,CH_MONO,test_rate_list[i],WL_16b);
for (j=0;j<I2S_DMA_PAGE_NUM;j++) {
ptx_buf = i2s_get_tx_page(&i2s_obj);
if (ptx_buf) {
gen_sound_sample16((short*)ptx_buf, I2S_DMA_PAGE_SIZE/sizeof(short), 1);
i2s_send_page(&i2s_obj, (uint32_t*)ptx_buf);
}
}
wait_ms(5000); // delay 5 sec.
}
// i2s_deinit(&i2s_obj);
i2s_disable(&i2s_obj);
alc5651_set_word_len(2);
alc5651_reg_dump();
i2s_enable(&i2s_obj);
// Stereo, 24bit
for(i=0;i<12;i++){
i2s_set_param(&i2s_obj,CH_STEREO,test_rate_list[i],WL_24b);
for (j=0;j<I2S_DMA_PAGE_NUM;j++) {
ptx_buf = i2s_get_tx_page(&i2s_obj);
if (ptx_buf) {
gen_sound_sample24((int*)ptx_buf, I2S_DMA_PAGE_SIZE/sizeof(int), 2);
i2s_send_page(&i2s_obj, (uint32_t*)ptx_buf);
}
}
wait_ms(5000); // delay 5 sec.
}
// Not Support Mono, 24bit
i2s_deinit(&i2s_obj);
#endif
while(1){
asm volatile ("nop\n\t");//If run in non-os environment,it needs to add nop operation
asm volatile ("nop\n\t");
asm volatile ("nop\n\t");
asm volatile ("nop\n\t");
}
}

View file

@ -0,0 +1,15 @@
Example Description
This example describes how to use i2s by using mbed extend api
Use TXRX mode to archive software bypass mode
NOTE: RX need clock generated by TX. This mode can do TX/RX in the same time.
1.Plug ALC5651 shield to Ameba HDK
2.Run the main function.
3.Plug earphone to Green phone jack
4.Plug audio source to Red phone jack

View file

@ -0,0 +1,85 @@
/* This is software bypass example */
#include "FreeRTOS.h"
#include "task.h"
#include "diag.h"
#include "main.h"
#include "i2s_api.h"
/**
* @brief Main program.
* @param None
* @retval None
*/
#include "alc5651.h"
i2s_t i2s_obj;
#define I2S_DMA_PAGE_SIZE 768 // 2 ~ 4096
#define I2S_DMA_PAGE_NUM 4 // Vaild number is 2~4
u8 i2s_tx_buf[I2S_DMA_PAGE_SIZE*I2S_DMA_PAGE_NUM];
u8 i2s_rx_buf[I2S_DMA_PAGE_SIZE*I2S_DMA_PAGE_NUM];
#define I2S_SCLK_PIN PC_1
#define I2S_WS_PIN PC_0
#define I2S_SD_PIN PC_2
void test_tx_complete(void *data, char *pbuf)
{
return ;
}
void test_rx_complete(void *data, char* pbuf)
{
i2s_t *obj = (i2s_t *)data;
int *ptx_buf;
static u32 count=0;
count++;
if ((count&1023) == 1023)
{
DBG_8195A_I2S_LVL(VERI_I2S_LVL, ".\n");
}
ptx_buf = i2s_get_tx_page(obj);
_memcpy((void*)ptx_buf, (void*)pbuf, I2S_DMA_PAGE_SIZE);
i2s_send_page(obj, (uint32_t*)ptx_buf); // loopback
i2s_recv_page(obj); // submit a new page for receive
}
void main(void)
{
int *ptx_buf;
int i,j;
alc5651_init();
alc5651_init_interface2(); // connect to ALC interface 2
// dump register
//alc5651_reg_dump();
//alc5651_index_dump();
// I2S init
i2s_obj.channel_num = CH_STEREO;
i2s_obj.sampling_rate = SR_44p1KHZ;
i2s_obj.word_length = WL_16b;
i2s_obj.direction = I2S_DIR_TXRX;
i2s_init(&i2s_obj, I2S_SCLK_PIN, I2S_WS_PIN, I2S_SD_PIN);
i2s_set_dma_buffer(&i2s_obj, (char*)i2s_tx_buf, (char*)i2s_rx_buf, \
I2S_DMA_PAGE_NUM, I2S_DMA_PAGE_SIZE);
i2s_tx_irq_handler(&i2s_obj, (i2s_irq_handler)test_tx_complete, (uint32_t)&i2s_obj);
i2s_rx_irq_handler(&i2s_obj, (i2s_irq_handler)test_rx_complete, (uint32_t)&i2s_obj);
/* rx need clock, let tx out first */
i2s_send_page(&i2s_obj, (uint32_t*)i2s_get_tx_page(&i2s_obj));
i2s_recv_page(&i2s_obj);
while(1){
asm volatile ("nop\n\t");//If run in non-os environment,it needs to add nop operation
asm volatile ("nop\n\t");
asm volatile ("nop\n\t");
asm volatile ("nop\n\t");
}
}

View file

@ -0,0 +1,15 @@
Example Description
This example describes how to use i2s by using mbed extend api
Using TX only and RX only mode.
RX will fill buffer until full then switching to TX only mode to play buffer content.
1.Plug ALC5651 shield to Ameba HDK
2.Run the main function.
3.Plug earphone to Green phone jack
4.Plug audio source to Red phone jack

View file

@ -0,0 +1,99 @@
/* This is RX only and TX only example */
#include "FreeRTOS.h"
#include "task.h"
#include "diag.h"
#include "main.h"
#include "i2s_api.h"
/**
* @brief Main program.
* @param None
* @retval None
*/
#include "alc5651.h"
i2s_t i2s_obj;
#define I2S_DMA_PAGE_SIZE 768 // 2 ~ 4096
#define I2S_DMA_PAGE_NUM 4 // Vaild number is 2~4
u8 i2s_tx_buf[I2S_DMA_PAGE_SIZE*I2S_DMA_PAGE_NUM];
u8 i2s_rx_buf[I2S_DMA_PAGE_SIZE*I2S_DMA_PAGE_NUM];
#define RECV_PAGE_NUM 50
u8 recv_buf[I2S_DMA_PAGE_SIZE*RECV_PAGE_NUM];
#define I2S_SCLK_PIN PC_1
#define I2S_WS_PIN PC_0
#define I2S_SD_PIN PC_2
u32 count = 0;
void test_tx_complete(void *data, char *pbuf)
{
i2s_t *obj = (i2s_t *)data;
int *ptx_buf;
if(count < RECV_PAGE_NUM){
ptx_buf = i2s_get_tx_page(obj);
_memcpy((void*)ptx_buf, (void*)&recv_buf[I2S_DMA_PAGE_SIZE*count], I2S_DMA_PAGE_SIZE);
i2s_send_page(obj, (uint32_t*)ptx_buf);
count++;
}else{
count = 0;
i2s_set_direction(obj, I2S_DIR_RX);
i2s_recv_page(obj);
}
}
void test_rx_complete(void *data, char* pbuf)
{
i2s_t *obj = (i2s_t *)data;
int *ptx_buf;
if(count < RECV_PAGE_NUM){
_memcpy((void*)&recv_buf[I2S_DMA_PAGE_SIZE*count], (void*)pbuf, I2S_DMA_PAGE_SIZE);
count++;
i2s_recv_page(obj);
}else{
count = 1;
i2s_set_direction(obj, I2S_DIR_TX);
ptx_buf = i2s_get_tx_page(obj);
_memcpy((void*)ptx_buf, (void*)recv_buf, I2S_DMA_PAGE_SIZE);
i2s_send_page(obj, (uint32_t*)ptx_buf); // loopback
}
}
void main(void)
{
int *ptx_buf;
int i,j;
alc5651_init();
alc5651_init_interface2(); // connect to ALC interface 2
// dump register
//alc5651_reg_dump();
//alc5651_index_dump();
// I2S init
i2s_obj.channel_num = CH_MONO;
i2s_obj.sampling_rate = SR_16KHZ;
i2s_obj.word_length = WL_16b;
i2s_obj.direction = I2S_DIR_RX;
i2s_init(&i2s_obj, I2S_SCLK_PIN, I2S_WS_PIN, I2S_SD_PIN);
i2s_set_dma_buffer(&i2s_obj, (char*)i2s_tx_buf, (char*)i2s_rx_buf, \
I2S_DMA_PAGE_NUM, I2S_DMA_PAGE_SIZE);
i2s_tx_irq_handler(&i2s_obj, (i2s_irq_handler)test_tx_complete, (uint32_t)&i2s_obj);
i2s_rx_irq_handler(&i2s_obj, (i2s_irq_handler)test_rx_complete, (uint32_t)&i2s_obj);
i2s_recv_page(&i2s_obj);
while(1){
asm volatile ("nop\n\t");//If run in non-os environment,it needs to add nop operation
asm volatile ("nop\n\t");
asm volatile ("nop\n\t");
asm volatile ("nop\n\t");
}
}

View file

@ -0,0 +1,40 @@
/*
* Routines to access hardware
*
* Copyright (c) 2013 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "device.h"
#include "log_uart_api.h"
log_uart_t uobj;
void uart_send_string(log_uart_t *uobj, char *pstr)
{
unsigned int i=0;
while (*(pstr+i) != 0) {
log_uart_putc(uobj, *(pstr+i));
i++;
}
}
void main(void)
{
// sample text
char rc;
// Initial Log UART: BaudRate=115200, 8-bits, No Parity, 1 Stop bit
log_uart_init(&uobj, 115200, 8, ParityNone, 1);
uart_send_string(&uobj, "UART API Demo...\r\n");
uart_send_string(&uobj, "Hello World!!\r\n");
while(1){
uart_send_string(&uobj, "\r\n8195a$");
rc = log_uart_getc(&uobj);
log_uart_putc(&uobj, rc);
}
}

View file

@ -0,0 +1,46 @@
/*
* Routines to access hardware
*
* Copyright (c) 2013 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "device.h"
#include "log_uart_api.h"
char buf[100]="Hello World!!\r\n";;
log_uart_t uobj;
int uart_scan (char *buf)
{
int i;
for (i=0;i<100;i++) {
*(buf+i) = log_uart_getc(&uobj);
if ((*(buf+i) == 0x0A) || (*(buf+i) == 0x0D)) {
break;
}
}
return i;
}
void main(void)
{
int ret;
log_uart_init(&uobj, 38400, 8, ParityNone, 1);
log_uart_send(&uobj, buf, _strlen(buf), 100);
while (1) {
// ret = log_uart_recv(&uobj, buf, 100, 2000);
ret = uart_scan(buf);
log_uart_send(&uobj, buf, ret, 1000);
log_uart_putc(&uobj, 0x0A);
log_uart_putc(&uobj, 0x0D);
}
}

View file

@ -0,0 +1,81 @@
/*
* Routines to access hardware
*
* Copyright (c) 2013 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "device.h"
#include "log_uart_api.h"
#define BUF_SZ (1024*3)
extern void wait_ms(int ms);
char buf[BUF_SZ]="Hello World!!\r\n";;
volatile uint32_t tx_busy=0;
volatile uint32_t rx_busy=0;
log_uart_t uobj;
void uart_tx_done(uint32_t id)
{
log_uart_t *uobj = (void*)id;
tx_busy = 0;
}
void uart_rx_done(uint32_t id)
{
log_uart_t *uobj = (void*)id;
rx_busy = 0;
}
void main(void)
{
int ret;
int i;
int timeout;
log_uart_init(&uobj, 38400, 8, ParityNone, 1);
log_uart_tx_comp_handler(&uobj, (void*)uart_tx_done, (uint32_t) &uobj);
log_uart_rx_comp_handler(&uobj, (void*)uart_rx_done, (uint32_t) &uobj);
log_uart_send(&uobj, buf, _strlen(buf), 100);
while (1) {
rx_busy = 1;
log_uart_recv_stream(&uobj, buf, BUF_SZ);
timeout = 2000;
ret = BUF_SZ;
while (rx_busy) {
wait_ms(1);
timeout--;
if (timeout == 0) {
// return value is the bytes received
ret = log_uart_recv_stream_abort(&uobj);
rx_busy = 0;
}
}
if (ret > 0) {
buf[ret] = 0; // end of string
tx_busy = 1;
log_uart_send_stream(&uobj, buf, ret);
timeout = 2000;
while (tx_busy) {
wait_ms(1);
timeout--;
if (timeout == 0) {
tx_busy = 0;
// return value is the bytes transmitted
ret = log_uart_send_stream_abort(&uobj);
}
}
log_uart_putc(&uobj, 0x0d);
log_uart_putc(&uobj, 0x0a);
}
}
}

View file

@ -0,0 +1,28 @@
Example Description
This example describes how to use nfc interface.
Requirement Components:
1. nfc reader.
Ex. Smart phone which has NFC reader. In Android, you can use below app
NFC Tag reader
https://play.google.com/store/apps/details?id=com.nxp.taginfolite
NFC Tag reader & writer
https://play.google.com/store/apps/details?id=com.wakdev.wdnfc
NFC tag writer
https://play.google.com/store/apps/details?id=com.nxp.nfc.tagwriter
2. Connect NFC antenna.
By default the NFC antenna is provided but not connected.
You can choose your desired antenna and weld it on the board
Verification Steps:
(a) Open nfc reader app, Tap phone on NFC antenna, then the ndef message content is text "HELLO WORLD!"
(b) Open nfc writer app, write something to the tag. (Ex. text message "abcdefg")
It'll also dump raw data on the log.
(c) Open nfc reader app, tap phone on NFC antenna, and check if the conten is exactly the same as previous move.

View file

@ -0,0 +1,220 @@
/*
* Routines to access hardware
*
* Copyright (c) 2015 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "cmsis_os.h"
#include "diag.h"
#include "main.h"
#include "nfc_api.h"
#include "flash_api.h"
#define NFC_RESTORE_DEFAULT (0)
#define NFC_MAX_PAGE_NUM 36
nfctag_t nfctag;
unsigned int nfc_tag_content[NFC_MAX_PAGE_NUM];
unsigned char nfc_tag_dirty[NFC_MAX_PAGE_NUM];
#define RTK_NFC_UID 0x58
unsigned char nfc_default_uid[7] = {
RTK_NFC_UID, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
};
osThreadId nfc_tid = 0;
#define FLASH_APP_NFC_BASE 0x85000
flash_t flash_nfc;
void nfc_event_listener(void *arg, unsigned int event) {
switch(event) {
case NFC_EV_READER_PRESENT:
DiagPrintf("NFC_EV_READER_PRESENT\r\n");
break;
case NFC_EV_READ:
DiagPrintf("NFC_EV_READ\r\n");
break;
case NFC_EV_WRITE:
DiagPrintf("NFC_EV_WRITE\r\n");
break;
case NFC_EV_ERR:
DiagPrintf("NFC_EV_ERR\r\n");
break;
case NFC_EV_CACHE_READ:
DiagPrintf("NFC_EV_CACHE_READ\r\n");
break;
}
}
/**
* This callback function is called several times if tag is being written multiple pages.
* DO NOT put heavy task here otherwise it will block tag write and cause timeout failure.
**/
void nfc_write_listener(void *arg, unsigned int page, unsigned int pgdat) {
nfc_tag_content[page] = pgdat;
nfc_tag_dirty[page] = 1;
if (nfc_tid) {
osSignalSet(nfc_tid, NFC_EV_WRITE);
}
}
int is_valid_nfc_uid() {
int valid_content = 1;
unsigned char uid[7];
unsigned char bcc[2];
uid[0] = (unsigned char)((nfc_tag_content[0] & 0x000000FF) >> 0);
uid[1] = (unsigned char)((nfc_tag_content[0] & 0x0000FF00) >> 8);
uid[2] = (unsigned char)((nfc_tag_content[0] & 0x00FF0000) >> 16);
bcc[0] = (unsigned char)((nfc_tag_content[0] & 0xFF000000) >> 24);
uid[3] = (unsigned char)((nfc_tag_content[1] & 0x000000FF) >> 0);
uid[4] = (unsigned char)((nfc_tag_content[1] & 0x0000FF00) >> 8);
uid[5] = (unsigned char)((nfc_tag_content[1] & 0x00FF0000) >> 16);
uid[6] = (unsigned char)((nfc_tag_content[1] & 0xFF000000) >> 24);
bcc[1] = (unsigned char)((nfc_tag_content[2] & 0x000000FF) >> 0);
// verify Block Check Character
if (bcc[0] != (0x88 ^ uid[0] ^ uid[1] ^ uid[2])) {
valid_content = 0;
}
if (bcc[1] != (uid[3] ^ uid[4] ^ uid[5] ^ uid[6])) {
valid_content = 0;
}
return valid_content;
}
unsigned int generate_default_tag_content() {
unsigned int page_size = 0;
memset(nfc_tag_content, 0, NFC_MAX_PAGE_NUM * sizeof(unsigned int));
// calculate Block Check Character
unsigned char bcc[2];
bcc[0] = 0x88 ^ nfc_default_uid[0] ^ nfc_default_uid[1] ^ nfc_default_uid[2];
bcc[1] = nfc_default_uid[3] ^ nfc_default_uid[4] ^ nfc_default_uid[5] ^ nfc_default_uid[6];
// generate header
nfc_tag_content[page_size++] = ((unsigned int)nfc_default_uid[0]) << 0 |
((unsigned int)nfc_default_uid[1]) << 8 |
((unsigned int)nfc_default_uid[2]) << 16 |
((unsigned int) bcc[0]) << 24;
nfc_tag_content[page_size++] = ((unsigned int)nfc_default_uid[3]) << 0 |
((unsigned int)nfc_default_uid[4]) << 8 |
((unsigned int)nfc_default_uid[5]) << 16 |
((unsigned int)nfc_default_uid[6]) << 24;
nfc_tag_content[page_size++] = ((unsigned int) bcc[1]) << 0;
nfc_tag_content[page_size++] = 0x001211E1;
// Init tag content as NDEF will-known text message "HELLO WORLD!" in little endian
nfc_tag_content[page_size++] = 0x01d11303;
nfc_tag_content[page_size++] = 0x6502540f;
nfc_tag_content[page_size++] = 0x4c45486e;
nfc_tag_content[page_size++] = 0x57204f4c;
nfc_tag_content[page_size++] = 0x444c524f;
nfc_tag_content[page_size++] = 0x0000fe21;
return page_size;
}
void nfc_load_tag_content_from_flash() {
int i, address, page_size;
memset(nfc_tag_content, 0, NFC_MAX_PAGE_NUM * sizeof(unsigned int));
memset(nfc_tag_dirty, 0, NFC_MAX_PAGE_NUM);
for (i = 0, address = FLASH_APP_NFC_BASE; i < NFC_MAX_PAGE_NUM; i++, address+=4) {
flash_read_word(&flash_nfc, address, &nfc_tag_content[i]);
}
if (!is_valid_nfc_uid() || NFC_RESTORE_DEFAULT) {
DiagPrintf("Invalid tag content, restore to default value\r\n");
page_size = generate_default_tag_content();
// update to flash
flash_erase_sector(&flash_nfc, FLASH_APP_NFC_BASE);
for (i = 0, address = FLASH_APP_NFC_BASE; i < page_size; i++, address += 4) {
flash_write_word(&flash_nfc, address, nfc_tag_content[i]);
}
}
}
void nfc_store_tag_content() {
int i, address;
int modified_page_count;
// dump the modified tag content
modified_page_count = 0;
for (i = 4; i < NFC_MAX_PAGE_NUM && nfc_tag_dirty[i]; i++) {
modified_page_count++;
DiagPrintf("page:%02d data:%08x\r\n", i, nfc_tag_content[i]);
}
// update to cache from page 4
nfc_cache_write(&nfctag, &(nfc_tag_content[4]), 4, modified_page_count);
modified_page_count += 4; // we also need update tag header to flash which has size 4
flash_erase_sector(&flash_nfc, FLASH_APP_NFC_BASE);
for (i = 0, address = FLASH_APP_NFC_BASE; i < modified_page_count; i++, address += 4) {
flash_write_word(&flash_nfc, address, nfc_tag_content[i]);
}
}
void nfc_task(void const *arg) {
int i;
osEvent evt;
nfc_load_tag_content_from_flash();
nfc_init(&nfctag, nfc_tag_content);
nfc_event(&nfctag, nfc_event_listener, NULL, 0xFF);
nfc_write(&nfctag, nfc_write_listener, NULL);
osSignalClear(nfc_tid, NFC_EV_WRITE);
while(1) {
evt = osSignalWait (0, 0xFFFFFFFF); // wait for any signal with max timeout
if (evt.status == osEventSignal && (evt.value.signals & NFC_EV_WRITE)) {
osDelay(300);
nfc_store_tag_content();
memset(nfc_tag_dirty, 0, NFC_MAX_PAGE_NUM);
osSignalClear(nfc_tid, NFC_EV_WRITE);
}
}
}
/**
* @brief Main program.
* @param None
* @retval None
*/
void main(void)
{
osThreadDef(nfc_task, osPriorityRealtime, 1, 1024);
nfc_tid = osThreadCreate (osThread (nfc_task), NULL);
DBG_INFO_MSG_OFF(_DBG_SPI_FLASH_);
//3 3)Enable Schedule, Start Kernel
#if defined(CONFIG_KERNEL) && !TASK_SCHEDULER_DISABLED
#ifdef PLATFORM_FREERTOS
vTaskStartScheduler();
#endif
#else
RtlConsolTaskRom(NULL);
#endif
while(1);
}

View file

@ -0,0 +1,22 @@
Example Description
This example describes how to use deep sleep api.
Requirement Components:
a LED
a push button
Pin name PC_4 and PC_5 map to GPIOC_4 and GPIOC_5:
- PC_4 as input with internal pull-high, connect a push button to this pin and ground.
- PC_5 as output, connect a LED to this pin and ground.
In this example, LED is turned on after device initialize.
User push the button to turn off LED and trigger device enter deep sleep mode for 10s.
If user press any key before sleep timeout, the system will resume.
LED is turned on again after device initialize.
It can be easily measure power consumption in normal mode and deep sleep mode before/after push the putton.
NOTE: You will see device resume immediately at first time.
It's because the log uart is a wakeup source and it buffered a wakeup event when DAP is used.
The symptom won't appear if you use power source on R43 and only power on module.

View file

@ -0,0 +1,110 @@
/*
* Routines to access hardware
*
* Copyright (c) 2015 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "device.h"
#include "gpio_api.h" // mbed
#include "gpio_irq_api.h" // mbed
#include "sleep_ex_api.h"
#include "sys_api.h"
#include "diag.h"
#include "main.h"
#define GPIO_LED_PIN PC_5
#define GPIO_IRQ_PIN PC_4
// deep sleep can only be waked up by GPIOB_1 and GTimer
#define GPIO_WAKE_PIN PB_1
// NOTICE: The pull condition may differnet on your board
PinName pull_down_list[] = {
PA_0, PA_1, PA_2, PA_3, PA_4, PA_5, PA_6, PA_7,
PB_0, PB_3, PB_4, PB_5, PB_6, PB_7,
PC_0, PC_1, PC_2, PC_3, PC_4, PC_5, PC_6, PC_7, PC_8, PC_9,
PD_0, PD_1, PD_2, PD_3, PD_4, PD_5, PD_6, PD_7, PD_8, PD_9,
PE_0, PE_1, PE_2, PE_3, PE_4, PE_5, PE_6, PE_7, PE_8, PE_9, PE_A,
PF_1, PF_2, PF_3, PF_4, PF_5
};
// NOTICE: The pull condition may differnet on your board
PinName pull_up_list[] = {
PB_2,
PF_0,
PG_0, PG_1, PG_2, PG_3, PG_4, PG_5, PG_6, PG_7,
PH_0, PH_1, PH_2, PH_3, PH_4, PH_5, PH_6, PH_7,
PI_0, PI_1, PI_2, PI_3, PI_4, PI_5, PI_6, PI_7,
PJ_0, PJ_1, PJ_2, PJ_3, PJ_4, PJ_5, PJ_6,
PK_0, PK_1, PK_2, PK_3, PK_4, PK_5, PK_6
};
void gpio_pull_control()
{
int i;
gpio_t gpio_obj;
for (i=0; i < sizeof(pull_down_list) / sizeof(pull_down_list[0]); i++) {
gpio_init(&gpio_obj, pull_down_list[i]);
gpio_dir(&gpio_obj, PIN_INPUT);
gpio_mode(&gpio_obj, PullDown);
}
for (i=0; i < sizeof(pull_up_list) / sizeof(pull_up_list[0]); i++) {
gpio_init(&gpio_obj, pull_up_list[i]);
gpio_dir(&gpio_obj, PIN_INPUT);
gpio_mode(&gpio_obj, PullUp);
}
}
void gpio_demo_irq_handler (uint32_t id, gpio_irq_event event)
{
gpio_t *gpio_led;
gpio_led = (gpio_t *)id;
printf("Enter deep sleep...Wait 10s or give rising edge at PB_1 to wakeup system.\r\n\r\n");
// turn off led
gpio_write(gpio_led, 0);
// turn off log uart
sys_log_uart_off();
// initialize wakeup pin at PB_1
gpio_t gpio_wake;
gpio_init(&gpio_wake, GPIO_WAKE_PIN);
gpio_dir(&gpio_wake, PIN_INPUT);
gpio_mode(&gpio_wake, PullDown);
// Please note that the pull control is different in different board
// This example is a sample code for RTL Ameba Dev Board
gpio_pull_control();
// enter deep sleep
deepsleep_ex(DSLEEP_WAKEUP_BY_GPIO | DSLEEP_WAKEUP_BY_TIMER, 10000);
}
void main(void)
{
gpio_t gpio_led;
gpio_irq_t gpio_btn;
// Init LED control pin
gpio_init(&gpio_led, GPIO_LED_PIN);
gpio_dir(&gpio_led, PIN_OUTPUT); // Direction: Output
gpio_mode(&gpio_led, PullNone); // No pull
// Initial Push Button pin as interrupt source
gpio_irq_init(&gpio_btn, GPIO_IRQ_PIN, gpio_demo_irq_handler, (uint32_t)(&gpio_led));
gpio_irq_set(&gpio_btn, IRQ_FALL, 1); // Falling Edge Trigger
gpio_irq_enable(&gpio_btn);
// led on means system is in run mode
gpio_write(&gpio_led, 1);
printf("\r\nPush button at PC_4 to enter deep sleep\r\n");
while(1);
}

View file

@ -0,0 +1,18 @@
Example Description
This example describes how to use deep standby api.
Requirement Components:
a LED
a push button
Pin name PA_5 and PC_5 map to GPIOA_5 and GPIOC_5:
- PA_5 as input, connect a push button to this pin and 3v3.
- PC_5 as output, connect a LED to this pin and ground.
In this example, LED is turned on after device initialize.
User push the button to turn off LED and trigger device enter deep standby mode for 10s.
If user press button before sleep timeout, the system will resume.
LED is turned on again after device initialize.
It can be easily measure power consumption in normal mode and deep standby mode before/after push the putton.

View file

@ -0,0 +1,105 @@
/*
* Routines to access hardware
*
* Copyright (c) 2015 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "device.h"
#include "gpio_api.h" // mbed
#include "sleep_ex_api.h"
#include "diag.h"
#include "main.h"
#define GPIO_LED_PIN PC_5
#define GPIO_PUSHBT_PIN PA_5
// NOTICE: The pull condition may differnet on your board
PinName pull_down_list[] = {
PA_0, PA_1, PA_2, PA_3, PA_4, PA_5, PA_6, PA_7,
PB_0, PB_1, PB_3, PB_4, PB_5, PB_6, PB_7,
PC_0, PC_1, PC_2, PC_3, PC_4, PC_5, PC_6, PC_7, PC_8, PC_9,
PD_0, PD_1, PD_2, PD_3, PD_4, PD_5, PD_6, PD_7, PD_8, PD_9,
PE_0, PE_1, PE_2, PE_3, PE_4, PE_5, PE_6, PE_7, PE_8, PE_9, PE_A,
PF_1, PF_2, PF_3, PF_4, PF_5
};
// NOTICE: The pull condition may differnet on your board
PinName pull_up_list[] = {
PB_2,
PF_0,
PG_0, PG_1, PG_2, PG_3, PG_4, PG_5, PG_6, PG_7,
PH_0, PH_1, PH_2, PH_3, PH_4, PH_5, PH_6, PH_7,
PI_0, PI_1, PI_2, PI_3, PI_4, PI_5, PI_6, PI_7,
PJ_0, PJ_1, PJ_2, PJ_3, PJ_4, PJ_5, PJ_6,
PK_0, PK_1, PK_2, PK_3, PK_4, PK_5, PK_6
};
void gpio_pull_control()
{
int i;
gpio_t gpio_obj;
for (i=0; i < sizeof(pull_down_list) / sizeof(pull_down_list[0]); i++) {
gpio_init(&gpio_obj, pull_down_list[i]);
gpio_dir(&gpio_obj, PIN_INPUT);
gpio_mode(&gpio_obj, PullDown);
}
for (i=0; i < sizeof(pull_up_list) / sizeof(pull_up_list[0]); i++) {
gpio_init(&gpio_obj, pull_up_list[i]);
gpio_dir(&gpio_obj, PIN_INPUT);
gpio_mode(&gpio_obj, PullUp);
}
}
/**
* @brief Main program.
* @param None
* @retval None
*/
void main(void)
{
gpio_t gpio_led, gpio_btn;
int old_btn_state, new_btn_state;
DBG_INFO_MSG_OFF(_DBG_GPIO_);
// Init LED control pin
gpio_init(&gpio_led, GPIO_LED_PIN);
gpio_dir(&gpio_led, PIN_OUTPUT); // Direction: Output
gpio_mode(&gpio_led, PullNone); // No pull
// Initial Push Button pin
gpio_init(&gpio_btn, GPIO_PUSHBT_PIN);
gpio_dir(&gpio_btn, PIN_INPUT); // Direction: Input
gpio_mode(&gpio_btn, PullDown);
old_btn_state = new_btn_state = 0;
gpio_write(&gpio_led, 1);
DiagPrintf("Push button to sleep...\r\n");
while(1){
new_btn_state = gpio_read(&gpio_btn);
if (old_btn_state == 1 && new_btn_state == 0) {
gpio_write(&gpio_led, 0);
DiagPrintf("Sleep 8s... (Or wakeup by pushing button)\r\n");
//turn off log uart to avoid warning in gpio_pull_control()
sys_log_uart_off();
// Please note that the pull control is different in different board
// This example is a sample code for RTL Ameba Dev Board
gpio_pull_control();
standby_wakeup_event_add(STANDBY_WAKEUP_BY_STIMER, 8000, 0);
standby_wakeup_event_add(STANDBY_WAKEUP_BY_PA5, 0, 1);
deepstandby_ex();
DiagPrintf("This line should not be printed\r\n");
}
old_btn_state = new_btn_state;
}
}

View file

@ -0,0 +1,18 @@
Example Description
This example describes how to use sleep api.
Requirement Components:
a LED
a push button
Pin name PC_4 and PC_5 map to GPIOC_4 and GPIOC_5:
- PC_4 as input with internal pull-high, connect a push button to this pin and ground.
- PC_5 as output, connect a LED to this pin and ground.
In this example, LED is turned on after device initialize.
User push the button to turn off LED and trigger device enter sleep mode for 10s.
If user push button before sleep timeout, the system will resume.
LED is turned on again after system resume without restart PC.
It can be easily measure power consumption in normal mode and sleep mode before/after push the putton.

View file

@ -0,0 +1,86 @@
/*
* Routines to access hardware
*
* Copyright (c) 2015 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "device.h"
#include "gpio_api.h" // mbed
#include "gpio_irq_api.h" // mbed
#include "sleep_ex_api.h"
#include "sys_api.h"
#include "diag.h"
#include "main.h"
#define GPIO_LED_PIN PC_5
#define GPIO_IRQ_PIN PC_4
int led_ctrl = 0;
gpio_t gpio_led;
int put_to_sleep = 0;
void gpio_demo_irq_handler (uint32_t id, gpio_irq_event event)
{
gpio_t *gpio_led;
gpio_led = (gpio_t *)id;
if (led_ctrl == 1) {
led_ctrl = 0;
gpio_write(gpio_led, led_ctrl);
put_to_sleep = 1;
} else {
led_ctrl = 1;
gpio_write(gpio_led, led_ctrl);
}
}
/**
* @brief Main program.
* @param None
* @retval None
*/
void main(void)
{
gpio_irq_t gpio_btn;
int IsDramOn = 1;
DBG_INFO_MSG_OFF(_DBG_GPIO_);
// Init LED control pin
gpio_init(&gpio_led, GPIO_LED_PIN);
gpio_dir(&gpio_led, PIN_OUTPUT); // Direction: Output
gpio_mode(&gpio_led, PullNone); // No pull
// Initial Push Button pin as interrupt source
gpio_irq_init(&gpio_btn, GPIO_IRQ_PIN, gpio_demo_irq_handler, (uint32_t)(&gpio_led));
gpio_irq_set(&gpio_btn, IRQ_FALL, 1);
gpio_irq_enable(&gpio_btn);
led_ctrl = 1;
gpio_write(&gpio_led, led_ctrl);
DBG_8195A("Push button to enter sleep\r\n");
//system will hang when it tries to suspend SDRAM for 8711AF
if ( sys_is_sdram_power_on() == 0 ) {
IsDramOn = 0;
}
put_to_sleep = 0;
while(1) {
if (put_to_sleep) {
DBG_8195A("Sleep 8s or push button to resume system...\r\n");
sys_log_uart_off();
sleep_ex_selective(SLP_GPIO | SLEEP_WAKEUP_BY_STIMER, 8000, 0, IsDramOn); // sleep_ex can't be put in irq handler
sys_log_uart_on();
DBG_8195A("System resume\r\n");
put_to_sleep = 0;
led_ctrl = 1;
gpio_write(&gpio_led, led_ctrl);
}
}
}

View file

@ -0,0 +1,31 @@
Example Description
This example describes how to use freertos tickless with uart interruptable interface
Requirement Components:
USBtoTTL adapter
Connect to PC
- Connect Ground: connect to GND pin via USBtoTTL adapter
- Use UART1
GPIOA_0 as UART1_RX connect to TX of USBtoTTL adapter
GPIOA_4 as UART1_TX connect to RX of USBtoTTL adapter
We also need connect GPIOC_1 as gpio interrupt which parallel with log uart rx pin.
In this example, freertos will enter/leave tickless automatically.
User can type continuous "Enter" in uart or log uart to wake system if system is in tickless.
System is keep awake until user type a command via uart.
There are some features in this example:
(1) We replace tickless' sleep function with system sleep api which save more power.
(2) Freertos enter tickless if the wakelock bit map is 0.
It means there is no function require system keep awake.
By default there is WAKELOCK_OS keep system awake.
So we need release this WAKELOCK_OS enable tickless mode.
(3) We configure uart rx as gpio interrupt mode. This make uart can wake system.
NOTICE: If you don't want loss any data from treating UART signal as GPIO interrupt,
you can set FREERTOS_PMU_TICKLESS_PLL_RESERVED to 1 in "platform_opt.h".
It will reserved PLL clock in tickless and UART can receive the whole data.
But it also cost more power consumption.

View file

@ -0,0 +1,167 @@
#include "FreeRTOS.h"
#include "task.h"
#include "diag.h"
#include "main.h"
#include <example_entry.h>
#include "freertos_pmu.h"
#include "gpio_irq_api.h"
#include "serial_api.h"
// select uart tx/rx pin with gpio interrupt function
#define UART_TX PA_4
#define UART_RX PA_0
#define LOGUART_RX_WAKE PC_1
#define PMU_USER_DEVICE PMU_DEV_USER_BASE
serial_t mysobj;
volatile char rc = 0;
extern void wlan_netowrk(void);
extern void console_init(void);
char cmdbuf[128];
int cmdbuf_index = 0;
void uart_irq_callback(uint32_t id, SerialIrq event)
{
serial_t *sobj = (void*)id;
if(event == RxIrq) {
pmu_acquire_wakelock(BIT(PMU_USER_DEVICE));
rc = serial_getc(sobj);
if (rc == '\r' || rc == '\n') {
serial_putc(sobj, '\r');
serial_putc(sobj, '\n');
serial_putc(sobj, '#');
serial_putc(sobj, ' ');
if (cmdbuf_index != 0) {
/* NOTICE: If you don't want loss any data from treating UART signal as GPIO interrupt,
* you can set FREERTOS_PMU_TICKLESS_PLL_RESERVED to 1 in "platform_opt.h".
* It will reserved PLL clock in tickless and UART can receive the whole data.
* But it also cost more power consumption.
**/
// process command
printf("cmd(%d): %s\r\n", cmdbuf_index, cmdbuf);
// release wakelock and reset buf
cmdbuf_index = 0;
pmu_release_wakelock(BIT(PMU_USER_DEVICE));
}
}
if (!(rc == '\r' || rc == '\n' )) {
// receive command
serial_putc(sobj, rc);
cmdbuf[cmdbuf_index] = rc;
cmdbuf_index++;
cmdbuf[cmdbuf_index] = '\0';
}
}
}
void gpio_uart_rx_irq_callback(uint32_t id, gpio_irq_event event)
{
pmu_acquire_wakelock(BIT(PMU_USER_DEVICE));
}
void pre_sleep_process_callback(unsigned int expected_idle_time, void* param_ptr)
{
// For peripherals that need turned off before sleep, call disable or deinit peripheral here
}
void post_sleep_process_callback(unsigned int expected_idle_time, void* param_ptr)
{
// For peripherals that are turned off before sleep, call enable or init peripheral here
}
void config_uart()
{
// setup uart
serial_init(&mysobj, UART_TX, UART_RX);
serial_baud(&mysobj, 38400);
serial_format(&mysobj, 8, ParityNone, 1);
serial_irq_handler(&mysobj, uart_irq_callback, (uint32_t)&mysobj);
serial_irq_set(&mysobj, RxIrq, 1);
serial_irq_set(&mysobj, TxIrq, 1);
// config uart rx as gpio wakeup pin
gpio_irq_t gpio_rx_wake;
gpio_irq_init(&gpio_rx_wake, UART_RX, gpio_uart_rx_irq_callback, NULL);
gpio_irq_set(&gpio_rx_wake, IRQ_FALL, 1); // Falling Edge Trigger
gpio_irq_enable(&gpio_rx_wake);
}
void gpio_loguart_rx_irq_callback (uint32_t id, gpio_irq_event event)
{
/* PMU_LOGUART_DEVICE is also handled in log service.
* It is release after a complete command is sent.
**/
pmu_acquire_wakelock(BIT(PMU_LOGUART_DEVICE));
}
void config_loguart()
{
/* Log uart RX pin doesn't support gpio interrupt.
* To make log uart wake system, we can parallel log uart RX with another gpio interrupt pin.
*/
gpio_irq_t gpio_rx_wake;
gpio_irq_init(&gpio_rx_wake, LOGUART_RX_WAKE, gpio_loguart_rx_irq_callback, NULL);
gpio_irq_set(&gpio_rx_wake, IRQ_FALL, 1); // Falling Edge Trigger
gpio_irq_enable(&gpio_rx_wake);
}
/**
* @brief Main program.
* @param None
* @retval None
*/
void main(void)
{
if ( rtl_cryptoEngine_init() != 0 ) {
DiagPrintf("crypto engine init failed\r\n");
}
/* Initialize log uart and at command service */
console_init();
/* pre-processor of application example */
pre_example_entry();
/* wlan intialization */
#if defined(CONFIG_WIFI_NORMAL) && defined(CONFIG_NETWORK)
wlan_network();
#endif
// setup uart with capability of wakeup system
config_uart();
// setup log uart with capability of wakeup system
config_loguart();
// By default tickless is disabled because PMU_OS is locked.
// Release this wakelock to enable tickless
pmu_release_wakelock(BIT(PMU_OS));
// Register pre/post sleep callback. They are called when system automatically enter/leave sleep.
pmu_register_sleep_callback(BIT(PMU_USER_DEVICE), pre_sleep_process_callback, NULL, post_sleep_process_callback, NULL);
/* Execute application example */
example_entry();
/*Enable Schedule, Start Kernel*/
#if defined(CONFIG_KERNEL) && !TASK_SCHEDULER_DISABLED
#ifdef PLATFORM_FREERTOS
vTaskStartScheduler();
#endif
#else
RtlConsolTaskRom(NULL);
#endif
}

Some files were not shown because too many files have changed in this diff Show more