mirror of
https://github.com/Ai-Thinker-Open/Ai-Thinker-Open_RTL8710BX_ALIOS_SDK.git
synced 2026-07-15 14:35:38 +00:00
rel_1.6.0 init
This commit is contained in:
commit
27b3e2883d
19359 changed files with 8093121 additions and 0 deletions
47
Living_SDK/board/asr5501/Config.in
Normal file
47
Living_SDK/board/asr5501/Config.in
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
config AOS_BOARD_ASR5501
|
||||
bool "ASR5501"
|
||||
select AOS_MCU_ASR5501
|
||||
select AOS_COMP_KERNEL_INIT
|
||||
select AOS_COMP_LWIP if AOS_NETWORK_SAL
|
||||
select AOS_COMP_NETMGR
|
||||
help
|
||||
|
||||
if AOS_BOARD_ASR5501
|
||||
# Configurations for board asr5501
|
||||
|
||||
config DEBUG_CONFIG_PANIC
|
||||
bool "Enable debug panic feature"
|
||||
default y
|
||||
help
|
||||
set to y if you want to enable panic debug feature when system crash happened,
|
||||
default y
|
||||
|
||||
config DEBUG_CONFIG_BACKTRACE
|
||||
bool "Enable stack backtrace feature"
|
||||
default y
|
||||
help
|
||||
set to y if you want to enable stack backtrace feature when system crash happened,
|
||||
default y
|
||||
|
||||
# "BSP SUPPORT FEATURE"
|
||||
config BSP_SUPPORT_UART
|
||||
bool
|
||||
default y
|
||||
|
||||
config BSP_SUPPORT_GPIO
|
||||
bool
|
||||
default y
|
||||
|
||||
config BSP_SUPPORT_FLASH
|
||||
bool
|
||||
default y
|
||||
|
||||
config BSP_SUPPORT_I2C
|
||||
bool
|
||||
default y
|
||||
|
||||
config BSP_SUPPORT_WIFI
|
||||
bool
|
||||
default y
|
||||
|
||||
endif
|
||||
43
Living_SDK/board/asr5501/README.md
Normal file
43
Living_SDK/board/asr5501/README.md
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
## Overview
|
||||
This is a board demo for consulting, not a true realization.
|
||||
## Feature of Board
|
||||
|
||||
## Directories
|
||||
```sh
|
||||
aaboard_demo # configuration files for board aaboard_demo
|
||||
=============================================================================================================
|
||||
Dir\File Description Necessary for kernel run
|
||||
=============================================================================================================
|
||||
|-- drivers # board peripheral driver N
|
||||
|-- config
|
||||
| |-- board.h # board config file, define for user, such as uart port num Y
|
||||
| |-- k_config.c # user's kernel hook and mm memory region define Y
|
||||
| |-- k_config.h # kernel config file .h Y
|
||||
| |-- partition_conf.c # board flash config file N
|
||||
|-- startup
|
||||
| |-- board.c # board_init implement Y
|
||||
| |-- startup.c # main entry file Y
|
||||
| |-- startup_gcc.s # board startup assember for gcc Y
|
||||
| |-- startup_iar.s # board startup assember for iar Y
|
||||
| |-- startup_keil.s # board startup assember for keil Y
|
||||
|-- aaboard_demo.icf # linkscript file for iar Y
|
||||
|-- aaboard_demo.ld # linkscript file for gcc Y
|
||||
|-- aaboard_demo.sct # linkscript file for sct Y
|
||||
|-- aos.mk # board makefile Y
|
||||
|-- Config.in # menuconfig component config Y
|
||||
|-- ucube.py # config for CI autorun app N
|
||||
```
|
||||
|
||||
## Board Hardware Resources
|
||||
|
||||
## Pin Mapping
|
||||
|
||||
## Driver Support
|
||||
|
||||
## Programming
|
||||
|
||||
## Debugging
|
||||
|
||||
## Update log
|
||||
|
||||
## Reference
|
||||
50
Living_SDK/board/asr5501/asr5501.mk
Executable file
50
Living_SDK/board/asr5501/asr5501.mk
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
NAME := board_asr5501
|
||||
|
||||
MODULE := ASR5501
|
||||
HOST_ARCH := Cortex-M4
|
||||
HOST_MCU_FAMILY := asr5501
|
||||
SUPPORT_BINS := no
|
||||
|
||||
define get-os-version
|
||||
"AOS-R"-$(CURRENT_TIME)
|
||||
endef
|
||||
|
||||
CONFIG_SYSINFO_OS_VERSION := $(call get-os-version)
|
||||
|
||||
$(NAME)_SOURCES := config/partition_conf.c \
|
||||
config/k_config.c \
|
||||
startup/startup.c \
|
||||
startup/startup_cm4.S \
|
||||
startup/board.c
|
||||
|
||||
GLOBAL_INCLUDES += . \
|
||||
./config \
|
||||
./drivers/include \
|
||||
./drivers/include/lwip_if \
|
||||
|
||||
$(NAME)_CFLAGS += -DLEGA_CM4 -DALIOS_SUPPORT -DWIFI_DEVICE -D_SPI_FLASH_ENABLE_ -DDCDC_PFMMODE_CLOSE -DCFG_MIMO_UF
|
||||
$(NAME)_CFLAGS += -DCFG_BATX=1 -DCFG_BARX=1 -DCFG_REORD_BUF=4 -DCFG_SPC=4 -DCFG_TXDESC0=4 -DCFG_TXDESC1=4 -DCFG_TXDESC2=4 -DCFG_TXDESC3=4 -DCFG_TXDESC4=4 -DCFG_CMON -DCFG_MDM_VER_V21 -DCFG_SOFTAP_SUPPORT -DCFG_SNIFFER_SUPPORT -DCFG_DBG=2 -D__FPU_PRESENT=1 -DDX_CC_TEE -DHASH_SHA_512_SUPPORTED -DCC_HW_VERSION=0xF0 -DDLLI_MAX_BUFF_SIZE=0x10000 -DSSI_CONFIG_TRNG_MODE=0
|
||||
|
||||
#default a0v2 config
|
||||
ifeq ($(buildsoc),a0v1)
|
||||
$(NAME)_CFLAGS += -DLEGA_A0V1
|
||||
GLOBAL_LDS_FILES += $(SOURCE_ROOT)/board/asr5501/gcc.ld
|
||||
else
|
||||
$(NAME)_CFLAGS += -DLEGA_A0V2
|
||||
GLOBAL_LDS_FILES += $(SOURCE_ROOT)/board/asr5501/gcc_a0v2.ld
|
||||
endif
|
||||
|
||||
CONFIG_SYSINFO_PRODUCT_MODEL := ALI_AOS_LEGAWIFI
|
||||
CONFIG_SYSINFO_DEVICE_NAME := 5501A0V240A
|
||||
|
||||
GLOBAL_DEFINES += STDIO_UART=1
|
||||
|
||||
GLOBAL_CFLAGS += -DSYSINFO_PRODUCT_MODEL=\"$(CONFIG_SYSINFO_PRODUCT_MODEL)\"
|
||||
GLOBAL_CFLAGS += -DSYSINFO_DEVICE_NAME=\"$(CONFIG_SYSINFO_DEVICE_NAME)\"
|
||||
GLOBAL_CFLAGS += -DLEGA_CM4
|
||||
GLOBAL_CFLAGS += -DAWSS_REGISTRAR_LOWPOWER_EN
|
||||
|
||||
EXTRA_TARGET_MAKEFILES += $(SOURCE_ROOT)/platform/mcu/$(HOST_MCU_FAMILY)/gen_ota_bin.mk
|
||||
|
||||
#GLOBAL_DEFINES += CONFIG_SOCKET_ACCESS_CONTROL
|
||||
GLOBAL_CFLAGS += -DCONFIG_TCP_SOCKET_ACCESS_CONTROL
|
||||
BIN
Living_SDK/board/asr5501/config/ASR550x.FLM
Normal file
BIN
Living_SDK/board/asr5501/config/ASR550x.FLM
Normal file
Binary file not shown.
21
Living_SDK/board/asr5501/config/board.h
Normal file
21
Living_SDK/board/asr5501/config/board.h
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef __BOARD_H__
|
||||
#define __BOARD_H__
|
||||
|
||||
#include "hal/hal.h"
|
||||
|
||||
|
||||
extern hal_logic_partition_t hal_partitions[];
|
||||
extern void flash_partition_init(void);
|
||||
|
||||
typedef enum {
|
||||
PORT_UART_STD,
|
||||
PORT_UART_AT,
|
||||
PORT_UART_RS485,
|
||||
PORT_UART_SCANNER,
|
||||
PORT_UART_LORA,
|
||||
PORT_UART_TEMP,
|
||||
PORT_UART_SIZE,
|
||||
PORT_UART_INVALID = 255
|
||||
}PORT_UART_TYPE;
|
||||
|
||||
#endif //__BOARD_H__
|
||||
232
Living_SDK/board/asr5501/config/k_config.c
Normal file
232
Living_SDK/board/asr5501/config/k_config.c
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
/*
|
||||
* Copyright (C) 2015-2017 Alibaba Group Holding Limited
|
||||
*/
|
||||
|
||||
#include <k_api.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#if (RHINO_CONFIG_HW_COUNT > 0)
|
||||
void soc_hw_timer_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
hr_timer_t soc_hr_hw_cnt_get(void)
|
||||
{
|
||||
return 0;
|
||||
//return *(volatile uint64_t *)0xc0000120;
|
||||
}
|
||||
|
||||
lr_timer_t soc_lr_hw_cnt_get(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* RHINO_CONFIG_HW_COUNT */
|
||||
|
||||
#if (RHINO_CONFIG_INTRPT_GUARD > 0)
|
||||
void soc_intrpt_guard(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (RHINO_CONFIG_INTRPT_STACK_REMAIN_GET > 0)
|
||||
size_t soc_intrpt_stack_remain_get(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (RHINO_CONFIG_INTRPT_STACK_OVF_CHECK > 0)
|
||||
void soc_intrpt_stack_ovf_check(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (RHINO_CONFIG_MM_TLF > 0)
|
||||
|
||||
#if defined (__CC_ARM) /* Keil / armcc */
|
||||
#define HEAP_BUFFER_SIZE 1024*120
|
||||
uint8_t g_heap_buf[HEAP_BUFFER_SIZE];
|
||||
k_mm_region_t g_mm_region[] = {{g_heap_buf, HEAP_BUFFER_SIZE}};
|
||||
#elif defined (__ICCARM__)/* IAR */
|
||||
#define HEAP_BUFFER_SIZE 1024*120
|
||||
uint8_t g_heap_buf[HEAP_BUFFER_SIZE];
|
||||
k_mm_region_t g_mm_region[] = {{g_heap_buf, HEAP_BUFFER_SIZE}};
|
||||
#else /* GCC */
|
||||
extern void *heap_start;
|
||||
extern void *heap_end;
|
||||
extern void *heap_len;
|
||||
/* heap_start and heap_len is set by linkscript(*.ld) */
|
||||
k_mm_region_t g_mm_region[] = {{(uint8_t*)&heap_start,(size_t)&heap_len}};
|
||||
#endif
|
||||
|
||||
int g_region_num = sizeof(g_mm_region)/sizeof(k_mm_region_t);
|
||||
|
||||
#endif
|
||||
|
||||
#if (RHINO_CONFIG_MM_LEAKCHECK > 0 )
|
||||
|
||||
extern int __bss_start__, __bss_end__, _sdata, _edata;
|
||||
|
||||
void aos_mm_leak_region_init(void)
|
||||
{
|
||||
#if (RHINO_CONFIG_MM_DEBUG > 0)
|
||||
krhino_mm_leak_region_init(&__bss_start__, &__bss_end__);
|
||||
krhino_mm_leak_region_init(&_sdata, &_edata);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if (RHINO_CONFIG_TASK_STACK_CUR_CHECK > 0)
|
||||
size_t soc_get_cur_sp()
|
||||
{
|
||||
size_t sp = 0;
|
||||
#if defined (__GNUC__)&&!defined(__CC_ARM)
|
||||
asm volatile(
|
||||
"mov %0,sp\n"
|
||||
:"=r"(sp));
|
||||
#endif
|
||||
return sp;
|
||||
}
|
||||
static void soc_print_stack()
|
||||
{
|
||||
void *cur, *end, *start;
|
||||
int stack_size;
|
||||
int i=0;
|
||||
int *p;
|
||||
ktask_t * cur_task;
|
||||
|
||||
cur_task = krhino_cur_task_get();
|
||||
start = cur_task->task_stack_base;
|
||||
stack_size = cur_task->stack_size;
|
||||
end = start + stack_size*4;
|
||||
cur = (void *)soc_get_cur_sp();
|
||||
p = (int*)cur;
|
||||
while(p < (int*)end) {
|
||||
if(i%4==0) {
|
||||
printf("\r\n%08lx:",(uint32_t)p);
|
||||
}
|
||||
printf("%08x ", *p);
|
||||
i++;
|
||||
p++;
|
||||
}
|
||||
printf("=============,task_name:%s,start:%x,stack:%x,cur:%x\r\n", cur_task->task_name, (unsigned int)start, stack_size, (unsigned int)cur);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
void soc_err_proc(kstat_t err)
|
||||
{
|
||||
(void)err;
|
||||
|
||||
#if (RHINO_CONFIG_TASK_STACK_CUR_CHECK > 0)
|
||||
soc_print_stack();
|
||||
#endif
|
||||
assert(0);
|
||||
}
|
||||
|
||||
#if (RHINO_CONFIG_USER_HOOK > 0)
|
||||
|
||||
/**
|
||||
* This function will provide init hook
|
||||
*/
|
||||
void krhino_init_hook(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will provide system start hook
|
||||
*/
|
||||
void krhino_start_hook(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function will provide task create hook
|
||||
* @param[in] task pointer to the task
|
||||
*/
|
||||
void krhino_task_create_hook(ktask_t *task)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function will provide task delete hook
|
||||
* @param[in] task pointer to the task
|
||||
*/
|
||||
void krhino_task_del_hook(ktask_t *task, res_free_t *arg)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function will provide task abort hook
|
||||
* @param[in] task pointer to the task
|
||||
*/
|
||||
void krhino_task_abort_hook(ktask_t *task)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function will provide task switch hook
|
||||
*/
|
||||
void krhino_task_switch_hook(ktask_t *orgin, ktask_t *dest)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function will provide system tick hook
|
||||
*/
|
||||
void krhino_tick_hook(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will provide idle pre hook
|
||||
*/
|
||||
void krhino_idle_pre_hook(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will provide idle hook
|
||||
*/
|
||||
void krhino_idle_hook(void)
|
||||
{
|
||||
extern void pmu_idle_hook(void);
|
||||
pmu_idle_hook();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will provide krhino_mm_alloc hook
|
||||
*/
|
||||
void krhino_mm_alloc_hook(void *mem, size_t size)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if (RHINO_CONFIG_TRACE == 0)
|
||||
void trace_start(void)
|
||||
{
|
||||
printf("trace config close!!!\r\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
krhino_err_proc_t g_err_proc = soc_err_proc;
|
||||
|
||||
150
Living_SDK/board/asr5501/config/k_config.h
Normal file
150
Living_SDK/board/asr5501/config/k_config.h
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
/*
|
||||
* Copyright (C) 2015-2017 Alibaba Group Holding Limited
|
||||
*/
|
||||
|
||||
#ifndef K_CONFIG_H
|
||||
#define K_CONFIG_H
|
||||
|
||||
/* kernel feature conf */
|
||||
#ifndef RHINO_CONFIG_SEM
|
||||
#define RHINO_CONFIG_SEM 1
|
||||
#endif
|
||||
#ifndef RHINO_CONFIG_QUEUE
|
||||
#define RHINO_CONFIG_QUEUE 1
|
||||
#endif
|
||||
#ifndef RHINO_CONFIG_TASK_SEM
|
||||
#define RHINO_CONFIG_TASK_SEM 0
|
||||
#endif
|
||||
#ifndef RHINO_CONFIG_EVENT_FLAG
|
||||
#define RHINO_CONFIG_EVENT_FLAG 0
|
||||
#endif
|
||||
#ifndef RHINO_CONFIG_TIMER
|
||||
#define RHINO_CONFIG_TIMER 1
|
||||
#endif
|
||||
#ifndef RHINO_CONFIG_BUF_QUEUE
|
||||
#define RHINO_CONFIG_BUF_QUEUE 1
|
||||
#endif
|
||||
#ifndef RHINO_CONFIG_MM_BLK
|
||||
#define RHINO_CONFIG_MM_BLK 1
|
||||
#endif
|
||||
#ifndef RHINO_CONFIG_MM_DEBUG
|
||||
#define RHINO_CONFIG_MM_DEBUG 1
|
||||
#endif
|
||||
#ifndef RHINO_CONFIG_MM_TLF
|
||||
#define RHINO_CONFIG_MM_TLF 1
|
||||
#endif
|
||||
|
||||
/* kernel task conf */
|
||||
#ifndef RHINO_CONFIG_TASK_SUSPEND
|
||||
#define RHINO_CONFIG_TASK_SUSPEND 1
|
||||
#endif
|
||||
#ifndef RHINO_CONFIG_TASK_INFO
|
||||
#define RHINO_CONFIG_TASK_INFO 1
|
||||
#endif
|
||||
#ifndef RHINO_CONFIG_TASK_DEL
|
||||
#define RHINO_CONFIG_TASK_DEL 1
|
||||
#endif
|
||||
#ifndef RHINO_CONFIG_TASK_WAIT_ABORT
|
||||
#define RHINO_CONFIG_TASK_WAIT_ABORT 1
|
||||
#endif
|
||||
#ifndef RHINO_CONFIG_TASK_STACK_OVF_CHECK
|
||||
#define RHINO_CONFIG_TASK_STACK_OVF_CHECK 1
|
||||
#endif
|
||||
#ifndef RHINO_CONFIG_SCHED_RR
|
||||
#define RHINO_CONFIG_SCHED_RR 1
|
||||
#endif
|
||||
#ifndef RHINO_CONFIG_TIME_SLICE_DEFAULT
|
||||
#define RHINO_CONFIG_TIME_SLICE_DEFAULT 50
|
||||
#endif
|
||||
#ifndef RHINO_CONFIG_PRI_MAX
|
||||
#define RHINO_CONFIG_PRI_MAX 62
|
||||
#endif
|
||||
#ifndef RHINO_CONFIG_USER_PRI_MAX
|
||||
#define RHINO_CONFIG_USER_PRI_MAX (RHINO_CONFIG_PRI_MAX - 2)
|
||||
#endif
|
||||
|
||||
/* kernel workqueue conf */
|
||||
#ifndef RHINO_CONFIG_WORKQUEUE
|
||||
#define RHINO_CONFIG_WORKQUEUE 0
|
||||
#endif
|
||||
|
||||
/* kernel mm_region conf */
|
||||
#ifndef RHINO_CONFIG_MM_REGION_MUTEX
|
||||
#define RHINO_CONFIG_MM_REGION_MUTEX 0
|
||||
#endif
|
||||
|
||||
/* kernel timer&tick conf */
|
||||
#ifndef RHINO_CONFIG_TICKS_PER_SECOND
|
||||
#define RHINO_CONFIG_TICKS_PER_SECOND 1000
|
||||
#endif
|
||||
|
||||
/*must reserve enough stack size for timer cb will consume*/
|
||||
#ifndef RHINO_CONFIG_TIMER_TASK_STACK_SIZE
|
||||
#define RHINO_CONFIG_TIMER_TASK_STACK_SIZE 512
|
||||
#endif
|
||||
#ifndef RHINO_CONFIG_TIMER_TASK_PRI
|
||||
#define RHINO_CONFIG_TIMER_TASK_PRI 5
|
||||
#endif
|
||||
|
||||
#ifndef RHINO_CONFIG_INTRPT_STACK_OVF_CHECK
|
||||
#define RHINO_CONFIG_INTRPT_STACK_OVF_CHECK 0
|
||||
#endif
|
||||
/* kernel dyn alloc conf */
|
||||
#ifndef RHINO_CONFIG_KOBJ_DYN_ALLOC
|
||||
#define RHINO_CONFIG_KOBJ_DYN_ALLOC 1
|
||||
#endif
|
||||
|
||||
#if (RHINO_CONFIG_KOBJ_DYN_ALLOC > 0)
|
||||
#ifndef RHINO_CONFIG_K_DYN_TASK_STACK
|
||||
#define RHINO_CONFIG_K_DYN_TASK_STACK 128
|
||||
#endif
|
||||
#ifndef RHINO_CONFIG_K_DYN_MEM_TASK_PRI
|
||||
#define RHINO_CONFIG_K_DYN_MEM_TASK_PRI 6
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* kernel idle conf */
|
||||
#ifndef RHINO_CONFIG_IDLE_TASK_STACK_SIZE
|
||||
#define RHINO_CONFIG_IDLE_TASK_STACK_SIZE 200
|
||||
#endif
|
||||
|
||||
/* kernel hook conf */
|
||||
#ifndef RHINO_CONFIG_USER_HOOK
|
||||
#define RHINO_CONFIG_USER_HOOK 0
|
||||
#endif
|
||||
|
||||
/* kernel stats conf */
|
||||
#ifndef RHINO_CONFIG_SYSTEM_STATS
|
||||
#define RHINO_CONFIG_SYSTEM_STATS 1
|
||||
#endif
|
||||
#ifndef RHINO_CONFIG_TASK_STACK_CUR_CHECK
|
||||
#define RHINO_CONFIG_TASK_STACK_CUR_CHECK 1
|
||||
#endif
|
||||
|
||||
#ifndef RHINO_CONFIG_CPU_NUM
|
||||
#define RHINO_CONFIG_CPU_NUM 1
|
||||
#endif
|
||||
|
||||
/* lowpower conf */
|
||||
#ifndef WIFI_CONFIG_SUPPORT_LOWPOWER
|
||||
#define WIFI_CONFIG_SUPPORT_LOWPOWER 0
|
||||
#endif
|
||||
|
||||
#ifndef WIFI_CONFIG_LISTENSET_BINIT
|
||||
#define WIFI_CONFIG_LISTENSET_BINIT 0
|
||||
#endif
|
||||
|
||||
#ifndef WIFI_CONFIG_LISTEN_INTERVAL
|
||||
#define WIFI_CONFIG_LISTEN_INTERVAL 1
|
||||
#endif
|
||||
|
||||
#ifndef WIFI_CONFIG_RECEIVE_DTIM
|
||||
#define WIFI_CONFIG_RECEIVE_DTIM 1
|
||||
#endif
|
||||
|
||||
#ifndef RHINO_CONFIG_GCC_RETADDR
|
||||
#define RHINO_CONFIG_GCC_RETADDR 1
|
||||
#endif
|
||||
|
||||
#endif /* K_CONFIG_H */
|
||||
|
||||
47
Living_SDK/board/asr5501/config/partition_conf.c
Normal file
47
Living_SDK/board/asr5501/config/partition_conf.c
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
#include <aos/aos.h>
|
||||
#include "hal/soc/soc.h"
|
||||
#include "lega_flash.h"
|
||||
|
||||
/* Logic partition on flash devices */
|
||||
hal_logic_partition_t hal_partitions[HAL_PARTITION_MAX];
|
||||
extern const lega_logic_partition_t lega_partitions[];
|
||||
|
||||
void flash_partition_init(void)
|
||||
{
|
||||
hal_partitions[HAL_PARTITION_BOOTLOADER].partition_owner = lega_partitions[PARTITION_BOOTLOADER].partition_owner;
|
||||
hal_partitions[HAL_PARTITION_BOOTLOADER].partition_description = lega_partitions[PARTITION_BOOTLOADER].partition_description;
|
||||
hal_partitions[HAL_PARTITION_BOOTLOADER].partition_start_addr = lega_partitions[PARTITION_BOOTLOADER].partition_start_addr;
|
||||
hal_partitions[HAL_PARTITION_BOOTLOADER].partition_length = lega_partitions[PARTITION_BOOTLOADER].partition_length;
|
||||
hal_partitions[HAL_PARTITION_BOOTLOADER].partition_options = lega_partitions[PARTITION_BOOTLOADER].partition_options ;
|
||||
|
||||
hal_partitions[HAL_PARTITION_PARAMETER_1].partition_owner = lega_partitions[PARTITION_PARAMETER_1].partition_owner;
|
||||
hal_partitions[HAL_PARTITION_PARAMETER_1].partition_description = lega_partitions[PARTITION_PARAMETER_1].partition_description;
|
||||
hal_partitions[HAL_PARTITION_PARAMETER_1].partition_start_addr = lega_partitions[PARTITION_PARAMETER_1].partition_start_addr;
|
||||
hal_partitions[HAL_PARTITION_PARAMETER_1].partition_length = lega_partitions[PARTITION_PARAMETER_1].partition_length;
|
||||
hal_partitions[HAL_PARTITION_PARAMETER_1].partition_options = lega_partitions[PARTITION_PARAMETER_1].partition_options ;
|
||||
|
||||
hal_partitions[HAL_PARTITION_PARAMETER_2].partition_owner = lega_partitions[PARTITION_PARAMETER_2].partition_owner ;
|
||||
hal_partitions[HAL_PARTITION_PARAMETER_2].partition_description = lega_partitions[PARTITION_PARAMETER_2].partition_description;
|
||||
hal_partitions[HAL_PARTITION_PARAMETER_2].partition_start_addr = lega_partitions[PARTITION_PARAMETER_2].partition_start_addr;
|
||||
hal_partitions[HAL_PARTITION_PARAMETER_2].partition_length = lega_partitions[PARTITION_PARAMETER_2].partition_length;
|
||||
hal_partitions[HAL_PARTITION_PARAMETER_2].partition_options = lega_partitions[PARTITION_PARAMETER_2].partition_options;
|
||||
|
||||
hal_partitions[HAL_PARTITION_PARAMETER_3].partition_owner = lega_partitions[PARTITION_PARAMETER_3].partition_owner ;
|
||||
hal_partitions[HAL_PARTITION_PARAMETER_3].partition_description = lega_partitions[PARTITION_PARAMETER_3].partition_description;
|
||||
hal_partitions[HAL_PARTITION_PARAMETER_3].partition_start_addr = lega_partitions[PARTITION_PARAMETER_3].partition_start_addr;
|
||||
hal_partitions[HAL_PARTITION_PARAMETER_3].partition_length = lega_partitions[PARTITION_PARAMETER_3].partition_length;
|
||||
hal_partitions[HAL_PARTITION_PARAMETER_3].partition_options = lega_partitions[PARTITION_PARAMETER_3].partition_options;
|
||||
|
||||
hal_partitions[HAL_PARTITION_APPLICATION].partition_owner = lega_partitions[PARTITION_APPLICATION].partition_owner;
|
||||
hal_partitions[HAL_PARTITION_APPLICATION].partition_description = lega_partitions[PARTITION_APPLICATION].partition_description;
|
||||
hal_partitions[HAL_PARTITION_APPLICATION].partition_start_addr = lega_partitions[PARTITION_APPLICATION].partition_start_addr;
|
||||
hal_partitions[HAL_PARTITION_APPLICATION].partition_length = lega_partitions[PARTITION_APPLICATION].partition_length;
|
||||
hal_partitions[HAL_PARTITION_APPLICATION].partition_options = lega_partitions[PARTITION_APPLICATION].partition_options;
|
||||
|
||||
hal_partitions[HAL_PARTITION_OTA_TEMP].partition_owner = lega_partitions[PARTITION_OTA_TEMP].partition_owner;
|
||||
hal_partitions[HAL_PARTITION_OTA_TEMP].partition_description = lega_partitions[PARTITION_OTA_TEMP].partition_description;
|
||||
hal_partitions[HAL_PARTITION_OTA_TEMP].partition_start_addr = lega_partitions[PARTITION_OTA_TEMP].partition_start_addr;
|
||||
hal_partitions[HAL_PARTITION_OTA_TEMP].partition_length = lega_partitions[PARTITION_OTA_TEMP].partition_length;
|
||||
hal_partitions[HAL_PARTITION_OTA_TEMP].partition_options = lega_partitions[PARTITION_OTA_TEMP].partition_options;
|
||||
}
|
||||
|
||||
13
Living_SDK/board/asr5501/config/ram.ini
Normal file
13
Living_SDK/board/asr5501/config/ram.ini
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
FUNC void Setup (void) {
|
||||
|
||||
SP = _RDWORD(0x10040000); // Setup Stack Pointer
|
||||
PC = _RDWORD(0x10040004); // Setup Program Counter
|
||||
_WDWORD(0xE000ED08, 0x10040000); // Setup Vector Table Offset Register
|
||||
|
||||
}
|
||||
|
||||
load ./Objects/linkkitapp@asr5501.elf incremental
|
||||
|
||||
Setup(); // Setup for Running
|
||||
|
||||
g, main
|
||||
617
Living_SDK/board/asr5501/drivers/include/lega_rhino.h
Normal file
617
Living_SDK/board/asr5501/drivers/include/lega_rhino.h
Normal file
|
|
@ -0,0 +1,617 @@
|
|||
/*
|
||||
* Copyright (C) 2015-2018 ASR Group Holding Limited
|
||||
*/
|
||||
#ifndef __LEGARTOS_H__
|
||||
#define __LEGARTOS_H__
|
||||
#include <k_api.h>
|
||||
#include <ctype.h>
|
||||
#include "port.h"
|
||||
|
||||
#define LEGA_NEVER_TIMEOUT (0xFFFFFFFF)
|
||||
#define LEGA_WAIT_FOREVER (0xFFFFFFFF)
|
||||
#define LEGA_NO_WAIT (0)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNoErr=0,
|
||||
kGeneralErr,
|
||||
kTimeoutErr,
|
||||
}OSStatus;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FALSE=0,
|
||||
TRUE=1,
|
||||
}OSBool;
|
||||
|
||||
typedef void * lega_semaphore_t;
|
||||
typedef void * lega_mutex_t;
|
||||
typedef void * lega_thread_t;
|
||||
typedef void * lega_queue_t;
|
||||
//typedef void * lega_event_t;// LEGA OS event: lega_semaphore_t, lega_mutex_t or lega_queue_t
|
||||
typedef void (*timer_handler_t)( void* arg );
|
||||
//typedef OSStatus (*event_handler_t)( void* arg );
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void * handle;
|
||||
timer_handler_t function;
|
||||
void * arg;
|
||||
}lega_timer_t;
|
||||
|
||||
typedef uint32_t lega_thread_arg_t;
|
||||
typedef void (*lega_thread_function_t)( lega_thread_arg_t arg );
|
||||
|
||||
|
||||
/** @defgroup LEGA_RTOS_Thread LEGA RTOS Thread Management Functions
|
||||
* @brief Provide thread creation, delete, suspend, resume, and other RTOS management API
|
||||
* @verbatim
|
||||
* LEGA thread priority table
|
||||
*
|
||||
* +----------+-----------------+
|
||||
* | Priority | Thread |
|
||||
* |----------|-----------------|
|
||||
* | 0 | LEGA | Highest priority
|
||||
* | 1 | Network |
|
||||
* | 2 | |
|
||||
* | 3 | Network worker |
|
||||
* | 4 | |
|
||||
* | 5 | Default Library |
|
||||
* | | Default worker |
|
||||
* | 6 | |
|
||||
* | 7 | Application |
|
||||
* | 8 | |
|
||||
* | 9 | Idle | Lowest priority
|
||||
* +----------+-----------------+
|
||||
* @endverbatim
|
||||
* @{
|
||||
*/
|
||||
OSBool lega_rtos_is_in_interrupt_context(void);
|
||||
|
||||
|
||||
/** @brief Creates and starts a new thread
|
||||
*
|
||||
* @param thread : Pointer to variable that will receive the thread handle (can be null)
|
||||
* @param priority : A priority number.
|
||||
* @param name : a text name for the thread (can be null)
|
||||
* @param function : the main thread function
|
||||
* @param stack_size : stack size for this thread
|
||||
* @param arg : argument which will be passed to thread function
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_create_thread( lega_thread_t* thread, uint8_t priority, const char* name, lega_thread_function_t function, uint32_t stack_size, lega_thread_arg_t arg );
|
||||
|
||||
/** @brief Deletes a terminated thread
|
||||
*
|
||||
* @param thread : the handle of the thread to delete, , NULL is the current thread
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_delete_thread( lega_thread_t* thread );
|
||||
|
||||
|
||||
|
||||
|
||||
/** @defgroup LEGA_RTOS_SEM LEGA RTOS Semaphore Functions
|
||||
* @brief Provide management APIs for semaphore such as init,set,get and dinit.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Initialises a counting semaphore and set count to 0
|
||||
*
|
||||
* @param semaphore : a pointer to the semaphore handle to be initialised
|
||||
* @param count : the max count number of this semaphore
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_init_semaphore( lega_semaphore_t* semaphore, int count );
|
||||
|
||||
|
||||
/** @brief Set (post/put/increment) a semaphore
|
||||
*
|
||||
* @param semaphore : a pointer to the semaphore handle to be set
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_set_semaphore( lega_semaphore_t* semaphore );
|
||||
|
||||
|
||||
/** @brief Get (wait/decrement) a semaphore
|
||||
*
|
||||
* @Details Attempts to get (wait/decrement) a semaphore. If semaphore is at zero already,
|
||||
* then the calling thread will be suspended until another thread sets the
|
||||
* semaphore with @ref lega_rtos_set_semaphore
|
||||
*
|
||||
* @param semaphore : a pointer to the semaphore handle
|
||||
* @param timeout_ms: the number of milliseconds to wait before returning
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_get_semaphore( lega_semaphore_t* semaphore, uint32_t timeout_ms );
|
||||
|
||||
|
||||
/** @brief De-initialise a semaphore
|
||||
*
|
||||
* @Details Deletes a semaphore created with @ref lega_rtos_init_semaphore
|
||||
*
|
||||
* @param semaphore : a pointer to the semaphore handle
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_deinit_semaphore( lega_semaphore_t* semaphore );
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#define lega_rtos_declare_critical() CPSR_ALLOC()
|
||||
/** @brief Enter a critical session, all interrupts are disabled
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
#define lega_rtos_enter_critical() RHINO_CRITICAL_ENTER()
|
||||
//void lega_rtos_enter_critical( void );
|
||||
|
||||
/** @brief Exit a critical session, all interrupts are enabled
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
#define lega_rtos_exit_critical() RHINO_CRITICAL_EXIT()
|
||||
//void lega_rtos_exit_critical( void );
|
||||
|
||||
/** @defgroup LEGA_RTOS_MUTEX LEGA RTOS Mutex Functions
|
||||
* @brief Provide management APIs for Mutex such as init,lock,unlock and dinit.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Initialises a mutex
|
||||
*
|
||||
* @Details A mutex is different to a semaphore in that a thread that already holds
|
||||
* the lock on the mutex can request the lock again (nested) without causing
|
||||
* it to be suspended.
|
||||
*
|
||||
* @param mutex : a pointer to the mutex handle to be initialised
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_init_mutex( lega_mutex_t* mutex );
|
||||
|
||||
|
||||
/** @brief Obtains the lock on a mutex
|
||||
*
|
||||
* @Details Attempts to obtain the lock on a mutex. If the lock is already held
|
||||
* by another thead, the calling thread will be suspended until the mutex
|
||||
* lock is released by the other thread.
|
||||
*
|
||||
* @param mutex : a pointer to the mutex handle to be locked
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_lock_mutex( lega_mutex_t* mutex, uint32_t timeout_ms );
|
||||
|
||||
|
||||
/** @brief Releases the lock on a mutex
|
||||
*
|
||||
* @Details Releases a currently held lock on a mutex. If another thread
|
||||
* is waiting on the mutex lock, then it will be resumed.
|
||||
*
|
||||
* @param mutex : a pointer to the mutex handle to be unlocked
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_unlock_mutex( lega_mutex_t* mutex );
|
||||
|
||||
|
||||
/** @brief De-initialise a mutex
|
||||
*
|
||||
* @Details Deletes a mutex created with @ref lega_rtos_init_mutex
|
||||
*
|
||||
* @param mutex : a pointer to the mutex handle
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_deinit_mutex( lega_mutex_t* mutex );
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup LEGA_RTOS_QUEUE LEGA RTOS FIFO Queue Functions
|
||||
* @brief Provide management APIs for FIFO such as init,push,pop and dinit.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Initialises a FIFO queue
|
||||
*
|
||||
* @param queue : a pointer to the queue handle to be initialised
|
||||
* @param name : a text string name for the queue (NULL is allowed)
|
||||
* @param message_size : size in bytes of objects that will be held in the queue
|
||||
* @param number_of_messages : depth of the queue - i.e. max number of objects in the queue
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_init_queue( lega_queue_t* queue, const char* name, uint32_t message_size, uint32_t number_of_messages );
|
||||
|
||||
|
||||
/** @brief Pushes an object onto a queue
|
||||
*
|
||||
* @param queue : a pointer to the queue handle
|
||||
* @param message : the object to be added to the queue. Size is assumed to be
|
||||
* the size specified in @ref lega_rtos_init_queue
|
||||
* @param timeout_ms: the number of milliseconds to wait before returning
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error or timeout occurred
|
||||
*/
|
||||
OSStatus lega_rtos_push_to_queue( lega_queue_t* queue, void* message, uint32_t timeout_ms );
|
||||
|
||||
|
||||
/** @brief Pops an object off a queue
|
||||
*
|
||||
* @param queue : a pointer to the queue handle
|
||||
* @param message : pointer to a buffer that will receive the object being
|
||||
* popped off the queue. Size is assumed to be
|
||||
* the size specified in @ref lega_rtos_init_queue , hence
|
||||
* you must ensure the buffer is long enough or memory
|
||||
* corruption will result
|
||||
* @param timeout_ms: the number of milliseconds to wait before returning
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error or timeout occurred
|
||||
*/
|
||||
OSStatus lega_rtos_pop_from_queue( lega_queue_t* queue, void* message, uint32_t timeout_ms );
|
||||
|
||||
|
||||
/** @brief De-initialise a queue created with @ref lega_rtos_init_queue
|
||||
*
|
||||
* @param queue : a pointer to the queue handle
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_deinit_queue( lega_queue_t* queue );
|
||||
|
||||
|
||||
/** @brief Check if a queue is empty
|
||||
*
|
||||
* @param queue : a pointer to the queue handle
|
||||
*
|
||||
* @return true : queue is empty.
|
||||
* @return false : queue is not empty.
|
||||
*/
|
||||
OSBool lega_rtos_is_queue_empty( lega_queue_t* queue );
|
||||
|
||||
|
||||
/** @brief Check if a queue is full
|
||||
*
|
||||
* @param queue : a pointer to the queue handle
|
||||
*
|
||||
* @return true : queue is empty.
|
||||
* @return false : queue is not empty.
|
||||
*/
|
||||
OSBool lega_rtos_is_queue_full( lega_queue_t* queue );
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup LEGA_RTOS_TIMER LEGA RTOS Timer Functions
|
||||
* @brief Provide management APIs for timer such as init,start,stop,reload and dinit.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Initialize a RTOS timer
|
||||
*
|
||||
* @note Timer does not start running until @ref lega_start_timer is called
|
||||
*
|
||||
* @param timer : a pointer to the timer handle to be initialised
|
||||
* @param time_ms : Timer period in milliseconds
|
||||
* @param function : the callback handler function that is called each time the
|
||||
* timer expires
|
||||
* @param arg : an argument that will be passed to the callback function
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_init_timer( lega_timer_t* timer, uint32_t time_ms, timer_handler_t function, void* arg );
|
||||
|
||||
|
||||
/** @brief Starts a RTOS timer running
|
||||
*
|
||||
* @note Timer must have been previously initialised with @ref lega_rtos_init_timer
|
||||
*
|
||||
* @param timer : a pointer to the timer handle to start
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_start_timer( lega_timer_t* timer );
|
||||
|
||||
|
||||
/** @brief Stops a running RTOS timer
|
||||
*
|
||||
* @note Timer must have been previously started with @ref lega_rtos_init_timer
|
||||
*
|
||||
* @param timer : a pointer to the timer handle to stop
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_stop_timer( lega_timer_t* timer );
|
||||
|
||||
|
||||
/** @brief Reloads a RTOS timer that has expired
|
||||
*
|
||||
* @note This is usually called in the timer callback handler, to
|
||||
* reschedule the timer for the next period.
|
||||
*
|
||||
* @param timer : a pointer to the timer handle to reload
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_reload_timer( lega_timer_t* timer );
|
||||
|
||||
|
||||
/** @brief De-initialise a RTOS timer
|
||||
*
|
||||
* @note Deletes a RTOS timer created with @ref lega_rtos_init_timer
|
||||
*
|
||||
* @param timer : a pointer to the RTOS timer handle
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_deinit_timer( lega_timer_t* timer );
|
||||
|
||||
|
||||
/** @brief Check if an RTOS timer is running
|
||||
*
|
||||
* @param timer : a pointer to the RTOS timer handle
|
||||
*
|
||||
* @return true : if running.
|
||||
* @return false : if not running
|
||||
*/
|
||||
OSBool lega_rtos_is_timer_running( lega_timer_t* timer );
|
||||
|
||||
/**
|
||||
* @brief Gets time in miiliseconds since RTOS start
|
||||
*
|
||||
* @note: Since this is only 32 bits, it will roll over every 49 days, 17 hours.
|
||||
*
|
||||
* @returns Time in milliseconds since RTOS started.
|
||||
*/
|
||||
uint32_t lega_rtos_get_time(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @brief Suspend current thread for a specific time
|
||||
*
|
||||
* @param num_ms : A time interval (Unit: millisecond)
|
||||
*
|
||||
* @return kNoErr.
|
||||
*/
|
||||
OSStatus lega_rtos_delay_milliseconds( uint32_t num_ms );
|
||||
|
||||
#define lega_rtos_malloc(s) _lega_rtos_malloc(s,__FUNCTION__,__LINE__)
|
||||
void *_lega_rtos_malloc(uint32_t xWantedSize,const char * function,uint32_t line);
|
||||
void lega_rtos_free(void *mem);
|
||||
|
||||
void lega_system_reset();
|
||||
|
||||
#if 0
|
||||
/** @brief Creates a worker thread
|
||||
*
|
||||
* Creates a worker thread
|
||||
* A worker thread is a thread in whose context timed and asynchronous events
|
||||
* execute.
|
||||
*
|
||||
* @param worker_thread : a pointer to the worker thread to be created
|
||||
* @param priority : thread priority
|
||||
* @param stack_size : thread's stack size in number of bytes
|
||||
* @param event_queue_size : number of events can be pushed into the queue
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_create_worker_thread( lega_worker_thread_t* worker_thread, uint8_t priority, uint32_t stack_size, uint32_t event_queue_size );
|
||||
|
||||
|
||||
/** @brief Deletes a worker thread
|
||||
*
|
||||
* @param worker_thread : a pointer to the worker thread to be created
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_delete_worker_thread( lega_worker_thread_t* worker_thread );
|
||||
|
||||
|
||||
/** @brief Suspend a thread
|
||||
*
|
||||
* @param thread : the handle of the thread to suspend, NULL is the current thread
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
void lega_rtos_suspend_thread(lega_thread_t* thread);
|
||||
|
||||
|
||||
|
||||
/** @brief Suspend all other thread
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void lega_rtos_suspend_all_thread(void);
|
||||
|
||||
|
||||
/** @brief Rresume all other thread
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
long lega_rtos_resume_all_thread(void);
|
||||
|
||||
|
||||
/** @brief Sleeps until another thread has terminated
|
||||
*
|
||||
* @Details Causes the current thread to sleep until the specified other thread
|
||||
* has terminated. If the processor is heavily loaded with higher priority
|
||||
* tasks, this thread may not wake until significantly after the thread termination.
|
||||
*
|
||||
* @param thread : the handle of the other thread which will terminate
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_thread_join( lega_thread_t* thread );
|
||||
|
||||
|
||||
/** @brief Forcibly wakes another thread
|
||||
*
|
||||
* @Details Causes the specified thread to wake from suspension. This will usually
|
||||
* cause an error or timeout in that thread, since the task it was waiting on
|
||||
* is not complete.
|
||||
*
|
||||
* @param thread : the handle of the other thread which will be woken
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_thread_force_awake( lega_thread_t* thread );
|
||||
|
||||
|
||||
/** @brief Checks if a thread is the current thread
|
||||
*
|
||||
* @Details Checks if a specified thread is the currently running thread
|
||||
*
|
||||
* @param thread : the handle of the other thread against which the current thread
|
||||
* will be compared
|
||||
*
|
||||
* @return true : specified thread is the current thread
|
||||
* @return false : specified thread is not currently running
|
||||
*/
|
||||
OSBool lega_rtos_is_current_thread( lega_thread_t* thread );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** @brief Print Thread status into buffer
|
||||
*
|
||||
* @param buffer, point to buffer to store thread status
|
||||
* @param length, length of the buffer
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
OSStatus lega_rtos_print_thread_status( char* buffer, int length );
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** @defgroup LEGA_RTOS_EVENT LEGA RTOS Event Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Sends an asynchronous event to the associated worker thread
|
||||
*
|
||||
* @param worker_thread :the worker thread in which context the callback should execute from
|
||||
* @param function : the callback function to be called from the worker thread
|
||||
* @param arg : the argument to be passed to the callback function
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_send_asynchronous_event( lega_worker_thread_t* worker_thread, event_handler_t function, void* arg );
|
||||
|
||||
/** Requests a function be called at a regular interval
|
||||
*
|
||||
* This function registers a function that will be called at a regular
|
||||
* interval. Since this is based on the RTOS time-slice scheduling, the
|
||||
* accuracy is not high, and is affected by processor load.
|
||||
*
|
||||
* @param event_object : pointer to a event handle which will be initialised
|
||||
* @param worker_thread : pointer to the worker thread in whose context the
|
||||
* callback function runs on
|
||||
* @param function : the callback function that is to be called regularly
|
||||
* @param time_ms : the time period between function calls in milliseconds
|
||||
* @param arg : an argument that will be supplied to the function when
|
||||
* it is called
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_register_timed_event( lega_timed_event_t* event_object, lega_worker_thread_t* worker_thread, event_handler_t function, uint32_t time_ms, void* arg );
|
||||
|
||||
|
||||
/** Removes a request for a regular function execution
|
||||
*
|
||||
* This function de-registers a function that has previously been set-up
|
||||
* with @ref lega_rtos_register_timed_event.
|
||||
*
|
||||
* @param event_object : the event handle used with @ref lega_rtos_register_timed_event
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus lega_rtos_deregister_timed_event( lega_timed_event_t* event_object );
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
int SetTimer(unsigned long ms, void (*psysTimerHandler)(void));
|
||||
int SetTimer_uniq(unsigned long ms, void (*psysTimerHandler)(void));
|
||||
int UnSetTimer(void (*psysTimerHandler)(void));
|
||||
|
||||
/** @brief Initialize an endpoint for a RTOS event, a file descriptor
|
||||
* will be created, can be used for select
|
||||
*
|
||||
* @param event_handle : lega_semaphore_t, lega_mutex_t or lega_queue_t
|
||||
*
|
||||
* @retval On success, a file descriptor for RTOS event is returned.
|
||||
* On error, -1 is returned.
|
||||
*/
|
||||
int lega_rtos_init_event_fd(lega_event_t event_handle);
|
||||
|
||||
/** @brief De-initialise an endpoint created from a RTOS event
|
||||
*
|
||||
* @param fd : file descriptor for RTOS event
|
||||
*
|
||||
* @retval 0 for success. On error, -1 is returned.
|
||||
*/
|
||||
int lega_rtos_deinit_event_fd(int fd);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif
|
||||
#endif //__LEGARTOS_H__
|
||||
452
Living_SDK/board/asr5501/drivers/include/lega_wlan_api.h
Normal file
452
Living_SDK/board/asr5501/drivers/include/lega_wlan_api.h
Normal file
|
|
@ -0,0 +1,452 @@
|
|||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file lega_wifi_api.h
|
||||
*
|
||||
* @brief WiFi API.
|
||||
*
|
||||
* Copyright (C) ASR
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
#ifndef _LEGA_WIFI_API_H_
|
||||
#define _LEGA_WIFI_API_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "lega_cm4.h"
|
||||
|
||||
/**
|
||||
* @brief wlan network interface enumeration definition.
|
||||
*/
|
||||
typedef enum {
|
||||
SOFTAP, /*Act as an access point, and other station can connect, 4 stations Max*/
|
||||
STA, /*Act as a station which can connect to an access point*/
|
||||
} lega_wlan_type_e;
|
||||
|
||||
enum {
|
||||
WLAN_DHCP_DISABLE = 0,
|
||||
WLAN_DHCP_CLIENT,
|
||||
WLAN_DHCP_SERVER,
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
EVENT_STATION_UP = 1, /*used in station mode,
|
||||
indicate station associated in open mode or 4-way-handshake done in WPA/WPA2*/
|
||||
EVENT_STATION_DOWN, /*used in station mode, indicate station deauthed*/
|
||||
EVENT_AP_UP, /*used in softap mode, indicate softap enabled*/
|
||||
EVENT_AP_DOWN, /*used in softap mode, indicate softap disabled*/
|
||||
} lega_wifi_event_e;
|
||||
typedef enum {
|
||||
CONNECT_SUCC,
|
||||
CONNECT_SCAN_FAIL,
|
||||
CONNECT_CONN_FAIL,
|
||||
} lega_start_adv_results_e;
|
||||
|
||||
/**
|
||||
* @brief Scan result using normal scan.
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t is_scan_adv;
|
||||
char ap_num; /**< The number of access points found in scanning. */
|
||||
struct {
|
||||
char ssid[32+1]; /*ssid max len:32. +1 is for '\0'. when ssidlen is 32 */
|
||||
char ap_power; /**< Signal strength, min:0, max:100. */
|
||||
char bssid[6]; /* The BSSID of an access point. */
|
||||
char channel; /* The RF frequency, 1-13 */
|
||||
uint8_t security; /* Security type, @ref wlan_sec_type_t */
|
||||
} * ap_list;
|
||||
} lega_wlan_scan_result_t;
|
||||
|
||||
typedef enum {
|
||||
WLAN_SECURITY_OPEN, //NONE
|
||||
WLAN_SECURITY_WEP, //WEP
|
||||
WLAN_SECURITY_WPA, //WPA
|
||||
WLAN_SECURITY_WPA2, //WPA2
|
||||
WLAN_SECURITY_AUTO, //WPA or WPA2
|
||||
WLAN_SECURITY_MAX,
|
||||
} lega_wlan_security_e;
|
||||
|
||||
/*used in event callback of station mode, indicate softap informatino which is connected*/
|
||||
typedef struct {
|
||||
int rssi; /* rssi */
|
||||
char ssid[32+1]; /* ssid max len:32. +1 is for '\0' when ssidlen is 32 */
|
||||
char pwd[64+1]; /* pwd max len:64. +1 is for '\0' when pwdlen is 64 */
|
||||
char bssid[6]; /* BSSID of the wlan needs to be connected.*/
|
||||
char ssid_len; /*ssid length*/
|
||||
char pwd_len; /*password length*/
|
||||
char channel; /* wifi channel 0-13.*/
|
||||
char security; /*refer to lega_wlan_security_e*/
|
||||
} lega_wlan_ap_info_adv_t;
|
||||
|
||||
/*only used in station mode*/
|
||||
typedef struct {
|
||||
char dhcp; /* no use currently */
|
||||
char macaddr[16]; /* mac address on the target wlan interface, ASCII*/
|
||||
char ip[16]; /* Local IP address on the target wlan interface, ASCII*/
|
||||
char gate[16]; /* Router IP address on the target wlan interface, ASCII */
|
||||
char mask[16]; /* Netmask on the target wlan interface, ASCII*/
|
||||
char dns[16]; /* no use currently , ASCII*/
|
||||
char broadcastip[16]; /* no use currently , ASCII*/
|
||||
} lega_wlan_ip_stat_t;
|
||||
|
||||
/*only used in station mode*/
|
||||
typedef struct {
|
||||
int is_connected; /* The link to wlan is established or not, 0: disconnected, 1: connected. */
|
||||
int wifi_strength; /* Signal strength of the current connected AP */
|
||||
char ssid[32+1]; /* ssid max len:32. +1 is for '\0'. when ssidlen is 32 */
|
||||
char bssid[6]; /* BSSID of the current connected wlan */
|
||||
int channel; /* Channel of the current connected wlan */
|
||||
} lega_wlan_link_stat_t;
|
||||
|
||||
/*used in open cmd of hal_wifi_module_t*/
|
||||
typedef struct {
|
||||
char wifi_mode; /* refer to hal_wifi_type_t*/
|
||||
char security; /* security mode */
|
||||
char wifi_ssid[32]; /* in station mode, indicate SSID of the wlan needs to be connected.
|
||||
in softap mode, indicate softap SSID*/
|
||||
char wifi_key[64]; /* in station mode, indicate Security key of the wlan needs to be connected,
|
||||
in softap mode, indicate softap password.(ignored in an open system.) */
|
||||
char local_ip_addr[16]; /* used in softap mode to config ip for dut */
|
||||
char net_mask[16]; /* used in softap mode to config gateway for dut */
|
||||
char gateway_ip_addr[16]; /* used in softap mode to config netmask for dut */
|
||||
char dns_server_ip_addr[16]; /* no use currently */
|
||||
char dhcp_mode; /* no use currently */
|
||||
char channel; /* softap channel in softap mode; connect channel in sta mode*/
|
||||
char mac_addr[6]; /* connect bssid in sta mode*/
|
||||
char reserved[32]; /* no use currently */
|
||||
int wifi_retry_interval; /* no use currently */
|
||||
int interval; /* used in softap mode to config beacon listen interval */
|
||||
int hide; /* used in softap mode to config hidden SSID */
|
||||
} lega_wlan_init_type_t;
|
||||
|
||||
/** @brief wifi init functin, user should call it before use any wifi cmd
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_init(void);
|
||||
|
||||
/** @brief wifi deinit functin, call it when donot use wifi any more to free resources
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_deinit(void);
|
||||
|
||||
/** @brief used in station and softap mode, open wifi cmd
|
||||
*
|
||||
* @param init_info : refer to lega_wlan_init_type_t
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_open(lega_wlan_init_type_t* init_info);
|
||||
|
||||
/** @brief used in station and softap mode, close wifi cmd
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_close(void);
|
||||
|
||||
/** @brief used in station mode, scan cmd
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_start_scan(void);
|
||||
|
||||
/** @brief used in station mode, scan cmd
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_start_scan_adv(void);
|
||||
|
||||
/** @brief used in station mode, scan cmd
|
||||
*
|
||||
* @param ssid : target ssid to scan
|
||||
* @param is_scan_advance :scan to get bssid, channel and security
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_start_scan_active(const char *ssid, uint8_t is_scan_advance);
|
||||
|
||||
/** @brief used in station and softap mode, get mac address(in hex mode) of WIFI device
|
||||
*
|
||||
* @param mac_addr : pointer to get the mac address
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_get_mac_address(uint8_t *mac_addr);
|
||||
|
||||
/** @brief used in station and softap mode, set mac address for WIFI device
|
||||
*
|
||||
* @param mac_addr : src mac address pointer to set
|
||||
*
|
||||
*/
|
||||
void lega_wlan_set_mac_address(uint8_t *mac_addr);
|
||||
|
||||
|
||||
/** @brief used in station mode, get the ip information
|
||||
*
|
||||
* @param void
|
||||
* @return NULL : error occurred.
|
||||
* @return pointer : ip status got.
|
||||
*/
|
||||
lega_wlan_ip_stat_t * lega_wlan_get_ip_status(void);
|
||||
|
||||
|
||||
/** @brief used in station mode, get link status information
|
||||
*
|
||||
* @param link_status : refer to lega_wlan_link_stat_t
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_get_link_status(lega_wlan_link_stat_t *link_status);
|
||||
|
||||
/** @brief used in station mode, get the associated ap information
|
||||
*
|
||||
* @param void
|
||||
* @return NULL : error occurred.
|
||||
* @return pointer : associated ap info got.
|
||||
*/
|
||||
lega_wlan_ap_info_adv_t *lega_wlan_get_associated_apinfo(void);
|
||||
|
||||
/*used in sniffer mode, open sniffer mode
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_start_monitor(void);
|
||||
|
||||
/*used in sniffer mode, close sniffer mode
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_stop_monitor(void);
|
||||
|
||||
/** @brief used in sniffer mode, set the sniffer channel, should call this cmd after call start_monitor cmd
|
||||
*
|
||||
* @param channel : WIFI channel(1-13)
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_monitor_set_channel(int channel);
|
||||
|
||||
/** @brief used to get current channel both in sta and ap mode
|
||||
*
|
||||
* @return 1-14 : channel number.
|
||||
* @return 0 : no valid channel
|
||||
*/
|
||||
int lega_wlan_get_channel(void);
|
||||
|
||||
/** @brief used in sta mode, set the ps bc mc and listen interval, called before connect to ap.
|
||||
*
|
||||
* @param listen_bc_mc : true or false
|
||||
* @param listen_interval :1, 3, 10
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_set_ps_options(uint8_t listen_bc_mc, uint16_t listen_interval);
|
||||
|
||||
/** @brief used in sta mode, set ps mode on/off
|
||||
*
|
||||
* @param ps_on : true or false
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_set_ps_mode(uint8_t ps_on);
|
||||
|
||||
/*when use monitor mode, user should register this type of callback function to get the received MPDU*/
|
||||
typedef void (*monitor_cb_t)(uint8_t*data, int len, int rssi);
|
||||
|
||||
/*when use monitor-ap mode, user should register this type of callback function */
|
||||
typedef void (*monitor_ap_cb_t)();
|
||||
|
||||
/** @brief used in sniffer mode, callback function to get received MPDU, should register before start_monitor
|
||||
*
|
||||
* @param fn : refer to monitor_data_cb_t
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_register_monitor_cb(monitor_cb_t fn);
|
||||
|
||||
/** @brief used in sniffer-ap mode, callback function for application
|
||||
*
|
||||
* @param fn : refer to monitor_ap_cb_t
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_register_monitor_ap_cb(monitor_ap_cb_t fn);
|
||||
|
||||
/* start adv callback function, notify the connect results*/
|
||||
typedef void (*start_adv_cb_t)(lega_start_adv_results_e status);
|
||||
|
||||
/** @brief used in sta mode, callback function to notify the connecting results
|
||||
*
|
||||
* @param fn : refer to start_adv_cb_t
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_register_start_adv_cb(start_adv_cb_t fn);
|
||||
|
||||
|
||||
/** @brief used in station mode or sniffer mode, call this cmd to send a MPDU constructed by user
|
||||
*
|
||||
* @param buf : mac header pointer of the MPDU
|
||||
* @param len : length of the MPDU
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_send_raw_frame(uint8_t *buf, int len);
|
||||
|
||||
/*enable WIFI stack log, will be output by uart
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_start_debug_mode(void);
|
||||
|
||||
/*disable WIFI stack log
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_stop_debug_mode(void);
|
||||
|
||||
/*
|
||||
* The event callback function called at specific wifi events occurred by wifi stack.
|
||||
* user should register these callback if want to use the informatin.
|
||||
*
|
||||
* @note For HAL implementors, these callbacks must be
|
||||
* called under normal task context, not from interrupt.
|
||||
*/
|
||||
typedef void (*lega_wlan_cb_ip_got)(lega_wlan_ip_stat_t *ip_status);
|
||||
/** @brief used in station mode, WIFI stack call this cb when get ip
|
||||
*
|
||||
* @param fn : cb function type, refer to lega_wlan_ip_stat_t
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_ip_got_cb_register(lega_wlan_cb_ip_got fn);
|
||||
|
||||
typedef void (*lega_wlan_cb_stat_chg)(lega_wifi_event_e wlan_event);
|
||||
/** @brief used in station and softap mode,
|
||||
* WIFI stack call this cb when status change, refer to lega_wifi_event_e
|
||||
*
|
||||
* @param fn : cb function type
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_stat_chg_cb_register(lega_wlan_cb_stat_chg fn);
|
||||
|
||||
typedef void (*lega_wlan_cb_scan_compeleted)(lega_wlan_scan_result_t *result);
|
||||
/** @brief used in station mode,
|
||||
* WIFI stack call this cb when scan complete
|
||||
*
|
||||
* @param fn : cb function type
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_scan_compeleted_cb_register(lega_wlan_cb_scan_compeleted fn);
|
||||
|
||||
typedef void (*lega_wlan_cb_associated_ap)(lega_wlan_ap_info_adv_t *ap_info);
|
||||
/** @brief used in station mode,
|
||||
* WIFI stack call this cb when associated with an AP, and tell the AP information
|
||||
*
|
||||
* @param fn : cb function type
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_associated_ap_cb_register(lega_wlan_cb_associated_ap fn);
|
||||
|
||||
/** @brief calibration RCO clock for RTC
|
||||
*
|
||||
*/
|
||||
void lega_drv_rco_cal(void);
|
||||
|
||||
/** @brief config to close DCDC PFM mode
|
||||
*
|
||||
*/
|
||||
void lega_drv_close_dcdc_pfm(void);
|
||||
|
||||
/** @brief config to support smartconfig in MIMO scenario
|
||||
*
|
||||
*/
|
||||
void lega_wlan_smartconfig_mimo_enable(void);
|
||||
|
||||
/** @brief set country code to update country code, different country may have different channel list
|
||||
* called after hal_wifi_init
|
||||
*/
|
||||
void lega_wlan_set_country_code(char *country);
|
||||
|
||||
/** @brief start monitor and ap coexist mode
|
||||
*
|
||||
* @param init_info : refer to lega_wlan_init_type_t
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_start_monitor_ap(lega_wlan_init_type_t* init_info);
|
||||
|
||||
/** @brief stop monitor and ap coexist mode
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_stop_monitor_ap();
|
||||
|
||||
/** @brief get current temperature (C degree)
|
||||
* called after hal_wifi_init
|
||||
*
|
||||
* @param p_temp : input param to get temperature, memory managed by caller
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int16_t lega_rf_get_temperature(int16_t *p_temp);
|
||||
|
||||
/* temperature get callback function, notify the current temperature*/
|
||||
typedef void (*temperature_get_cb_t)(int16_t temperature);
|
||||
|
||||
/** @brief set the timer to get temperature (in second)
|
||||
* called after hal_wifi_init
|
||||
*
|
||||
* @param timer_in_sec : the timer in second
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_set_temperature_get_timer(uint64_t timer_in_sec);
|
||||
|
||||
/** @brief register the temperature get callback function
|
||||
* called after hal_wifi_init
|
||||
*
|
||||
* @param func : the function will called to notify the temperature.
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_register_temperature_get_cb(temperature_get_cb_t func);
|
||||
|
||||
/* efuse info update callback function, pass customer efuse info to ASR*/
|
||||
typedef void (*efuse_info_update_cb_t)(efuse_info_t *efuse_info);
|
||||
|
||||
/** @brief register the efuse info update callback function if efuse layout not same as ASR
|
||||
* called before hal_wifi_init
|
||||
*
|
||||
* @param func : the function will be called to pass customer efuse info to ASR.
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_register_efuse_info_update_cb(efuse_info_update_cb_t func);
|
||||
|
||||
#endif //_LEGA_WIFI_API_H_
|
||||
64
Living_SDK/board/asr5501/drivers/include/lega_wlan_api_aos.h
Normal file
64
Living_SDK/board/asr5501/drivers/include/lega_wlan_api_aos.h
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
#ifndef _LEGA_WIFI_API_AOS_H_
|
||||
#define _LEGA_WIFI_API_AOS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "lega_wlan_api.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WLAN_EVENT_SCAN_COMPLETED,
|
||||
WLAN_EVENT_ASSOCIATED,
|
||||
WLAN_EVENT_CONNECTED,
|
||||
WLAN_EVENT_IP_GOT,
|
||||
WLAN_EVENT_DISCONNECTED,
|
||||
WLAN_EVENT_AP_UP,
|
||||
WLAN_EVENT_AP_DOWN,
|
||||
WLAN_EVENT_MAX,
|
||||
}lega_wlan_event_e;
|
||||
|
||||
/**
|
||||
* @brief Input network precise paras in lega_wlan_start_adv function.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
lega_wlan_ap_info_adv_t ap_info; /**< @ref apinfo_adv_t. */
|
||||
char key[64]; /**< Security key or PMK of the wlan. */
|
||||
int key_len; /**< The length of the key. */
|
||||
char local_ip_addr[16]; /**< Static IP configuration, Local IP address. */
|
||||
char net_mask[16]; /**< Static IP configuration, Netmask. */
|
||||
char gateway_ip_addr[16]; /**< Static IP configuration, Router IP address. */
|
||||
char dns_server_ip_addr[16]; /**< Static IP configuration, DNS server IP address. */
|
||||
char dhcp_mode; /**< DHCP mode, @ref DHCP_Disable, @ref DHCP_Client and @ref DHCP_Server. */
|
||||
char reserved[32];
|
||||
int wifi_retry_interval; /**< Retry interval if an error is occured when connecting an access point,
|
||||
time unit is millisecond. */
|
||||
} lega_wlan_init_info_adv_st;
|
||||
|
||||
/** @brief used in station and softap mode, get mac address(in char mode) of WIFI device
|
||||
*
|
||||
* @param mac_addr : pointer to get the mac address
|
||||
*
|
||||
* @return 0 : on success.
|
||||
* @return other : error occurred
|
||||
*/
|
||||
int lega_wlan_get_mac_address_inchar(char *puc_mac);
|
||||
|
||||
int lega_wlan_suspend_sta(void);
|
||||
int lega_wlan_suspend_ap(void);
|
||||
int lega_wlan_suspend(void);
|
||||
void lega_wlan_register_mgmt_monitor_cb(monitor_cb_t fn);
|
||||
|
||||
/*Wifi event callback interface
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
extern void wifi_event_cb(lega_wlan_event_e evt, void* info);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_LEGA_WIFI_API_AOS_H_
|
||||
|
||||
108
Living_SDK/board/asr5501/drivers/include/lwip_if/arch/cc.h
Normal file
108
Living_SDK/board/asr5501/drivers/include/lwip_if/arch/cc.h
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef __CC_H__
|
||||
#define __CC_H__
|
||||
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include <sys/time.h>
|
||||
|
||||
#define LWIP_MAILBOX_QUEUE 1
|
||||
#define LWIP_TIMEVAL_PRIVATE 0
|
||||
#define LWIP_NO_INTTYPES_H 1
|
||||
|
||||
#if LWIP_NO_INTTYPES_H
|
||||
#define X8_F "02x"
|
||||
#define U16_F "u"
|
||||
#define S16_F "d"
|
||||
#define X16_F "x"
|
||||
#define U32_F "u"
|
||||
#define S32_F "d"
|
||||
#define X32_F "x"
|
||||
#define SZT_F U32_F
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* define compiler specific symbols */
|
||||
#if defined (__ICCARM__)
|
||||
|
||||
#define PACK_STRUCT_BEGIN
|
||||
#define PACK_STRUCT_STRUCT
|
||||
#define PACK_STRUCT_END
|
||||
#define PACK_STRUCT_FIELD(x) x
|
||||
#define PACK_STRUCT_USE_INCLUDES
|
||||
|
||||
#elif defined (__CC_ARM)
|
||||
|
||||
#define PACK_STRUCT_BEGIN __packed
|
||||
#define PACK_STRUCT_STRUCT
|
||||
#define PACK_STRUCT_END
|
||||
#define PACK_STRUCT_FIELD(x) x
|
||||
|
||||
#elif defined (__GNUC__)
|
||||
|
||||
#define PACK_STRUCT_BEGIN
|
||||
#define PACK_STRUCT_STRUCT __attribute__ ((packed))
|
||||
#define PACK_STRUCT_END
|
||||
#define PACK_STRUCT_FIELD(x) x
|
||||
|
||||
#elif defined (__TASKING__)
|
||||
|
||||
#define PACK_STRUCT_BEGIN
|
||||
#define PACK_STRUCT_STRUCT
|
||||
#define PACK_STRUCT_END
|
||||
#define PACK_STRUCT_FIELD(x) x
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef LWIP_PLATFORM_ASSERT
|
||||
#define LWIP_PLATFORM_ASSERT(x) \
|
||||
do \
|
||||
{ printf("Assertion \"%s\" failed at line %d in %s\n", x, __LINE__, __FILE__); \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#ifndef LWIP_PLATFORM_DIAG
|
||||
#define LWIP_PLATFORM_DIAG(x) do {printf x ;} while(0)
|
||||
#endif
|
||||
|
||||
// cup byte order
|
||||
#ifndef BYTE_ORDER
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#define LWIP_RAND() ((u32_t)rand())
|
||||
|
||||
#endif /* __CC_H__ */
|
||||
322
Living_SDK/board/asr5501/drivers/include/lwip_if/lwipopts.h
Normal file
322
Living_SDK/board/asr5501/drivers/include/lwip_if/lwipopts.h
Normal file
|
|
@ -0,0 +1,322 @@
|
|||
/**
|
||||
* @file
|
||||
*
|
||||
* lwIP Options Configuration
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef LWIP_LWIPOPTS_H
|
||||
#define LWIP_LWIPOPTS_H
|
||||
|
||||
#include "lwip/arch.h"
|
||||
#define LWIP_NETIF_API 1
|
||||
|
||||
#define LWIP_PRIVATE_FD_SET
|
||||
/**
|
||||
* Include user defined options first. Anything not defined in these files
|
||||
* will be set to standard values. Override anything you dont like!
|
||||
*/
|
||||
|
||||
#define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS 1
|
||||
/*
|
||||
-------------- NO SYS --------------
|
||||
*/
|
||||
#define NO_SYS 0
|
||||
#define SYS_LIGHTWEIGHT_PROT (NO_SYS == 0)
|
||||
|
||||
#ifndef LWIP_NETIF_API
|
||||
#define LWIP_NETIF_API 1
|
||||
#endif
|
||||
/*
|
||||
---------- Memory options ----------
|
||||
*/
|
||||
#define MEM_ALIGNMENT 4
|
||||
#define MEM_SIZE (3*1024) //(10*1024)
|
||||
|
||||
#define MEM_LIBC_MALLOC 1
|
||||
#if MEM_LIBC_MALLOC
|
||||
#include <aos/kernel.h>
|
||||
#define mem_clib_malloc aos_malloc
|
||||
#define mem_clib_free aos_free
|
||||
#define mem_clib_calloc(n, m) aos_zalloc( (n) * (m) )
|
||||
#endif
|
||||
|
||||
#define MEMP_MEM_MALLOC 1
|
||||
#define MEMP_OVERFLOW_CHECK 1
|
||||
|
||||
|
||||
/*
|
||||
---------- Internal Memory Pool Sizes ----------
|
||||
*/
|
||||
#define MEMP_NUM_PBUF 8
|
||||
#define MEMP_NUM_RAW_PCB 8
|
||||
#define MEMP_NUM_UDP_PCB 8
|
||||
#define MEMP_NUM_TCP_PCB 8
|
||||
#define MEMP_NUM_TCP_PCB_LISTEN 8
|
||||
#define MEMP_NUM_TCP_SEG 12
|
||||
#define MEMP_NUM_REASSDATA 4
|
||||
#define MEMP_NUM_FRAG_PBUF 8
|
||||
#define MEMP_NUM_ARP_QUEUE 8
|
||||
#define MEMP_NUM_NETBUF 8
|
||||
#define MEMP_NUM_NETCONN 10
|
||||
#define MEMP_NUM_TCPIP_MSG_API 8
|
||||
#define MEMP_NUM_TCPIP_MSG_INPKT 12
|
||||
#define PBUF_POOL_SIZE 10
|
||||
|
||||
/*
|
||||
---------- ARP options ----------
|
||||
*/
|
||||
#define LWIP_ARP 1
|
||||
|
||||
/*
|
||||
---------- IP options ----------
|
||||
*/
|
||||
#define LWIP_IPV4 1
|
||||
#define LWIP_IPV6 0
|
||||
#define IP_FORWARD 0
|
||||
#define IP_OPTIONS_ALLOWED 1
|
||||
#define IP_REASSEMBLY 0
|
||||
#define IP_FRAG 0
|
||||
#define IP_REASS_MAXAGE 3
|
||||
#define IP_REASS_MAX_PBUFS 4
|
||||
#define IP_FRAG_USES_STATIC_BUF 0
|
||||
#define IP_DEFAULT_TTL 255
|
||||
|
||||
/*
|
||||
---------- ICMP options ----------
|
||||
*/
|
||||
#define LWIP_ICMP 1
|
||||
#define LWIP_ICMP6 1
|
||||
#define CHECKSUM_CHECK_ICMP6 0
|
||||
#define LWIP_MULTICAST_PING 1
|
||||
|
||||
/*
|
||||
---------- RAW options ----------
|
||||
*/
|
||||
#define LWIP_RAW 1
|
||||
|
||||
/*
|
||||
---------- DHCP options ----------
|
||||
*/
|
||||
#define LWIP_DHCP 1
|
||||
#define LWIP_NETIF_STATUS_CALLBACK 1
|
||||
#define DHCP_DOES_ARP_CHECK 0
|
||||
|
||||
/*
|
||||
---------- AUTOIP options ----------
|
||||
*/
|
||||
#define LWIP_AUTOIP 0
|
||||
|
||||
/*
|
||||
---------- SNMP options ----------
|
||||
*/
|
||||
#define LWIP_SNMP 0
|
||||
|
||||
/*
|
||||
---------- IGMP options ----------
|
||||
*/
|
||||
#define LWIP_IGMP 1
|
||||
|
||||
/*
|
||||
---------- DNS options -----------
|
||||
*/
|
||||
#define LWIP_DNS 1
|
||||
|
||||
/*
|
||||
---------- UDP options ----------
|
||||
*/
|
||||
#define LWIP_UDP 1
|
||||
|
||||
/*
|
||||
---------- TCP options ----------
|
||||
*/
|
||||
#define LWIP_TCP 1
|
||||
#define LWIP_LISTEN_BACKLOG 0
|
||||
#define TCP_MSS 1460 //1792
|
||||
#define TCP_WND (2 * TCP_MSS)
|
||||
#define TCP_SND_BUF (4 * TCP_MSS)
|
||||
#define TCP_MAXRTX 12
|
||||
#define TCP_SYNMAXRTX 12
|
||||
|
||||
/*
|
||||
---------- Pbuf options ----------
|
||||
*/
|
||||
#define PBUF_LINK_HLEN 16
|
||||
|
||||
//#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_HLEN)
|
||||
#define PBUF_POOL_BUFSIZE 512 //1500
|
||||
|
||||
/*
|
||||
---------- Network Interfaces options ----------
|
||||
*/
|
||||
#ifdef CHECKSUM_BY_HARDWARE
|
||||
/* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
|
||||
#define CHECKSUM_GEN_IP 0
|
||||
/* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
|
||||
#define CHECKSUM_GEN_UDP 0
|
||||
/* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
|
||||
#define CHECKSUM_GEN_TCP 0
|
||||
/* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
|
||||
#define CHECKSUM_CHECK_IP 0
|
||||
/* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
|
||||
#define CHECKSUM_CHECK_UDP 0
|
||||
/* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
|
||||
#define CHECKSUM_CHECK_TCP 0
|
||||
#define CHECKSUM_GEN_ICMP 0
|
||||
#else
|
||||
/* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
|
||||
#define CHECKSUM_GEN_IP 1
|
||||
/* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
|
||||
#define CHECKSUM_GEN_UDP 1
|
||||
/* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
|
||||
#define CHECKSUM_GEN_TCP 1
|
||||
/* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
|
||||
#define CHECKSUM_CHECK_IP 1
|
||||
/* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
|
||||
#define CHECKSUM_CHECK_UDP 1
|
||||
/* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
|
||||
#define CHECKSUM_CHECK_TCP 1
|
||||
#endif
|
||||
/*
|
||||
---------- LOOPIF options ----------
|
||||
*/
|
||||
#define LWIP_NETIF_LOOPBACK 1
|
||||
#define LWIP_HAVE_LOOPIF 1
|
||||
#define LWIP_NETIF_LOOPBACK_MULTITHREADING 1
|
||||
#define LWIP_LOOPBACK_MAX_PBUFS 8
|
||||
|
||||
/*
|
||||
---------- Thread options ----------
|
||||
*/
|
||||
#define TCPIP_MBOX_SIZE 60
|
||||
#define DEFAULT_ACCEPTMBOX_SIZE 10
|
||||
#define DEFAULT_RAW_RECVMBOX_SIZE 10
|
||||
#define DEFAULT_UDP_RECVMBOX_SIZE 20
|
||||
#define DEFAULT_TCP_RECVMBOX_SIZE 10
|
||||
|
||||
#define LWIP_TCPIP_CORE_LOCKING 0
|
||||
#define LWIP_TCPIP_CORE_LOCKING_INPUT 0
|
||||
|
||||
#define ETHIF_IN_TASK_STACKSIZE 512 /* unit 4 byte */
|
||||
#define ETHIF_IN_TASK_PRIO 10
|
||||
#define TCPIP_THREAD_STACKSIZE 2048//10240/* unit 4 byte */
|
||||
#define TCPIP_THREAD_PRIO 4//0
|
||||
|
||||
/*
|
||||
---------- Sequential layer options ----------
|
||||
*/
|
||||
|
||||
#define LWIP_NETCONN 8
|
||||
|
||||
/*
|
||||
---------- Socket options ----------
|
||||
*/
|
||||
#define LWIP_SOCKET 1
|
||||
#define LWIP_COMPAT_SOCKETS 1
|
||||
#define LWIP_POSIX_SOCKETS_IO_NAMES 1
|
||||
#if !defined(FD_SET) && defined(RHINO_CONFIG_VFS_DEV_NODES)
|
||||
#define LWIP_SOCKET_OFFSET RHINO_CONFIG_VFS_DEV_NODES
|
||||
#endif
|
||||
#define LWIP_SO_SNDTIMEO 1
|
||||
#define LWIP_SO_RCVTIMEO 1
|
||||
#define SO_REUSE 1
|
||||
|
||||
/*
|
||||
---------- Statistics options ----------
|
||||
*/
|
||||
#define LWIP_STATS 1
|
||||
#define LWIP_STATS_DISPLAY 1
|
||||
|
||||
/*
|
||||
---------- Checksum options ----------
|
||||
*/
|
||||
|
||||
/*
|
||||
---------- IPv6 options ---------------
|
||||
*/
|
||||
|
||||
/*
|
||||
---------- Hook options ---------------
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_AOS_MESH
|
||||
#define LWIP_DECLARE_HOOK \
|
||||
struct netif *lwip_hook_ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest); \
|
||||
int lwip_hook_mesh_is_mcast_subscribed(const ip6_addr_t *dest);
|
||||
#define LWIP_HOOK_IP6_ROUTE(src, dest) lwip_hook_ip6_route(src, dest)
|
||||
#define LWIP_HOOK_MESH_IS_MCAST_SUBSCRIBED(dest) lwip_hook_mesh_is_mcast_subscribed(dest)
|
||||
#endif
|
||||
|
||||
/*
|
||||
---------- Debugging options ----------
|
||||
*/
|
||||
//#define LWIP_DEBUG 1
|
||||
|
||||
#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL
|
||||
#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
|
||||
|
||||
#define MEM_DEBUG LWIP_DBG_OFF
|
||||
#define MEMP_DEBUG LWIP_DBG_OFF
|
||||
#define PBUF_DEBUG LWIP_DBG_OFF
|
||||
#define API_LIB_DEBUG LWIP_DBG_ON
|
||||
#define API_MSG_DEBUG LWIP_DBG_ON
|
||||
#define TCPIP_DEBUG LWIP_DBG_OFF
|
||||
#define NETIF_DEBUG LWIP_DBG_OFF
|
||||
#define SOCKETS_DEBUG LWIP_DBG_ON
|
||||
#define IP_DEBUG LWIP_DBG_OFF
|
||||
#define IP_REASS_DEBUG LWIP_DBG_OFF
|
||||
#define RAW_DEBUG LWIP_DBG_OFF
|
||||
#define ICMP_DEBUG LWIP_DBG_OFF
|
||||
#define UDP_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_INPUT_DEBUG LWIP_DBG_ON
|
||||
#define TCP_OUTPUT_DEBUG LWIP_DBG_ON
|
||||
#define TCP_RTO_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_CWND_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_WND_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_FR_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_QLEN_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_RST_DEBUG LWIP_DBG_OFF
|
||||
|
||||
/*
|
||||
---------- Performance tracking options ----------
|
||||
*/
|
||||
|
||||
/*
|
||||
---------- PPP options ----------
|
||||
*/
|
||||
#define PPP_SUPPORT 0
|
||||
|
||||
#define LWIP_NETCONN_SEM_PER_THREAD 1
|
||||
|
||||
#endif /* LWIP_LWIPOPTS_H */
|
||||
23
Living_SDK/board/asr5501/drivers/include/system_version.h
Normal file
23
Living_SDK/board/asr5501/drivers/include/system_version.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file system_version.h
|
||||
*
|
||||
* @brief lega version info provide
|
||||
*
|
||||
* Copyright (C) ASR
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __SYSTEM_VERSION_H__
|
||||
#define __SYSTEM_VERSION_H__
|
||||
|
||||
/**
|
||||
* Get wifi version.
|
||||
*
|
||||
* @return wifi version success, 0 failure.
|
||||
*/
|
||||
const char *lega_get_wifi_version(void);
|
||||
|
||||
#endif //__SYSTEM_VERSION_H__
|
||||
165
Living_SDK/board/asr5501/gcc.ld
Normal file
165
Living_SDK/board/asr5501/gcc.ld
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
/*
|
||||
*****************************************************************************
|
||||
*/
|
||||
|
||||
/* Entry Point */
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
/* Highest address of the user mode stack */
|
||||
_estack = 0x08040000; /* end of RAM */
|
||||
|
||||
/* Generate a link error if heap and stack don't fit into RAM */
|
||||
_Min_Heap_Size = 0x10000; /* required amount of heap */
|
||||
_Min_Stack_Size = 0x2000; /* required amount of stack */
|
||||
|
||||
/* Specify the memory areas */
|
||||
MEMORY
|
||||
{
|
||||
FLASH (xr) : ORIGIN = 0x00040000, LENGTH = 1024K
|
||||
RAM(rw) : ORIGIN = 0x08000000, LENGTH = 256K
|
||||
SHARED_MEMORY(rw) : ORIGIN = 0x60000000, LENGTH = 128K
|
||||
}
|
||||
|
||||
/* Define output sections */
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
/* The startup code goes first into FLASH */
|
||||
.isr_vector :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.isr_vector)) /* Startup code */
|
||||
. = 0xA0;
|
||||
} >FLASH
|
||||
|
||||
.app_version_sec :
|
||||
{
|
||||
KEEP(*(app_version_sec))
|
||||
. = ALIGN(0x10);
|
||||
} >FLASH
|
||||
|
||||
/* The program code and other data goes into FLASH */
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.text) /* .text sections (code) */
|
||||
*(.text*) /* .text* sections (code) */
|
||||
*(.eh_frame)
|
||||
|
||||
KEEP (*(.init))
|
||||
KEEP (*(.fini))
|
||||
|
||||
. = ALIGN(4);
|
||||
_etext = .; /* define a global symbols at end of code */
|
||||
} >FLASH
|
||||
|
||||
/* Constant data goes into FLASH */
|
||||
.rodata :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.rodata) /* .rodata sections (constants, strings, etc.) */
|
||||
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
||||
. = ALIGN(4);
|
||||
} >FLASH
|
||||
|
||||
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
|
||||
.ARM : {
|
||||
__exidx_start = .;
|
||||
*(.ARM.exidx*)
|
||||
__exidx_end = .;
|
||||
} >FLASH
|
||||
|
||||
.preinit_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP (*(.preinit_array*))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
} >FLASH
|
||||
|
||||
.init_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array*))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
} >FLASH
|
||||
|
||||
.fini_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
KEEP (*(.fini_array*))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
} >FLASH
|
||||
|
||||
/* used by the startup to initialize data */
|
||||
_sidata = LOADADDR(.data);
|
||||
|
||||
/* Initialized data sections goes into RAM, load LMA copy after code */
|
||||
.data :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sdata = .; /* create a global symbol at data start */
|
||||
*(.data) /* .data sections */
|
||||
*(.data*) /* .data* sections */
|
||||
. = ALIGN(4);
|
||||
*(seg_flash_driver);
|
||||
. = ALIGN(4);
|
||||
_edata = .; /* define a global symbol at data end */
|
||||
} >RAM AT>FLASH
|
||||
|
||||
/* shared RAM */
|
||||
SHAREDRAM ORIGIN(SHARED_MEMORY):
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*ipc_shared.o(COMMON)
|
||||
*hal_desc.o(COMMON)
|
||||
*txl_buffer_shared.o(COMMON)
|
||||
*txl_frame_shared.o(COMMON)
|
||||
*scan_shared.o(COMMON)
|
||||
*scanu_shared.o(COMMON)
|
||||
. = ALIGN(4);
|
||||
} >SHARED_MEMORY AT>FLASH
|
||||
|
||||
/* Uninitialized data section */
|
||||
. = ALIGN(4);
|
||||
.bss :
|
||||
{
|
||||
/* This is used by the startup in order to initialize the .bss secion */
|
||||
_sbss = .; /* define a global symbol at bss start */
|
||||
__bss_start__ = _sbss;
|
||||
*(.bss)
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
|
||||
. = ALIGN(4);
|
||||
_ebss = .; /* define a global symbol at bss end */
|
||||
__bss_end__ = _ebss;
|
||||
} >RAM
|
||||
|
||||
/* Remove information from the standard libraries */
|
||||
/DISCARD/ :
|
||||
{
|
||||
libc.a ( * )
|
||||
libm.a ( * )
|
||||
libgcc.a ( * )
|
||||
}
|
||||
|
||||
/* User_heap_stack section, used to check that there is enough RAM left */
|
||||
. = ALIGN(8);
|
||||
PROVIDE ( end = . );
|
||||
PROVIDE ( _end = . );
|
||||
|
||||
/* system stack */
|
||||
PROVIDE (_stack_base = _estack - _Min_Stack_Size); /* _estack is top of stack*/
|
||||
ASSERT ((_stack_base > end), "Error: No room left for the stack")
|
||||
/* _estack is top of stack*/
|
||||
|
||||
/* left ram for heap */
|
||||
PROVIDE (heap_start = _end);
|
||||
PROVIDE (heap_end = _stack_base);
|
||||
PROVIDE (heap_len = heap_end - heap_start);
|
||||
ASSERT ((heap_len > _Min_Heap_Size), "Error: No room left for the heap")
|
||||
|
||||
.ARM.attributes 0 : { *(.ARM.attributes) }
|
||||
}
|
||||
163
Living_SDK/board/asr5501/gcc_a0v2.ld
Normal file
163
Living_SDK/board/asr5501/gcc_a0v2.ld
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
*****************************************************************************
|
||||
*/
|
||||
|
||||
/* Entry Point */
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
/* Highest address of the user mode stack */
|
||||
_estack = 0x08038000; /* end of RAM */
|
||||
|
||||
/* Generate a link error if heap and stack don't fit into RAM */
|
||||
_Min_Heap_Size = 0x10000; /* required amount of heap */
|
||||
_Min_Stack_Size = 0x2000; /* required amount of stack */
|
||||
|
||||
/* Specify the memory areas */
|
||||
MEMORY
|
||||
{
|
||||
FLASH (xr) : ORIGIN = 0x10040000, LENGTH = 768K
|
||||
RAM(rw) : ORIGIN = 0x08000000, LENGTH = 224K
|
||||
SHARED_MEMORY(rw) : ORIGIN = 0x60000000, LENGTH = 32K
|
||||
}
|
||||
|
||||
/* Define output sections */
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
/* The startup code goes first into FLASH */
|
||||
.isr_vector :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.isr_vector)) /* Startup code */
|
||||
. = 0x100;
|
||||
} >FLASH
|
||||
|
||||
.app_version_sec :
|
||||
{
|
||||
KEEP(*(app_version_sec))
|
||||
. = ALIGN(0x10);
|
||||
} >FLASH
|
||||
|
||||
/* The program code and other data goes into FLASH */
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.text) /* .text sections (code) */
|
||||
*(.text*) /* .text* sections (code) */
|
||||
*(.eh_frame)
|
||||
|
||||
KEEP (*(.init))
|
||||
KEEP (*(.fini))
|
||||
|
||||
. = ALIGN(4);
|
||||
_etext = .; /* define a global symbols at end of code */
|
||||
} >FLASH
|
||||
|
||||
/* Constant data goes into FLASH */
|
||||
.rodata :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.rodata) /* .rodata sections (constants, strings, etc.) */
|
||||
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
||||
. = ALIGN(4);
|
||||
} >FLASH
|
||||
|
||||
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
|
||||
.ARM : {
|
||||
__exidx_start = .;
|
||||
*(.ARM.exidx*)
|
||||
__exidx_end = .;
|
||||
} >FLASH
|
||||
|
||||
.preinit_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP (*(.preinit_array*))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
} >FLASH
|
||||
|
||||
.init_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array*))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
} >FLASH
|
||||
|
||||
.fini_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
KEEP (*(.fini_array*))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
} >FLASH
|
||||
|
||||
/* used by the startup to initialize data */
|
||||
_sidata = LOADADDR(.data);
|
||||
|
||||
/* Initialized data sections goes into RAM, load LMA copy after code */
|
||||
.data :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sdata = .; /* create a global symbol at data start */
|
||||
*(.data) /* .data sections */
|
||||
*(.data*) /* .data* sections */
|
||||
. = ALIGN(4);
|
||||
*(seg_flash_driver);
|
||||
. = ALIGN(4);
|
||||
_edata = .; /* define a global symbol at data end */
|
||||
} >RAM AT>FLASH
|
||||
|
||||
/* shared RAM */
|
||||
/* shared RAM */
|
||||
sharemem(NOLOAD):
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_shmem_s = .;
|
||||
*(SHAREDRAM)
|
||||
. = ALIGN(4);
|
||||
_shmem_e = .;
|
||||
} >SHARED_MEMORY
|
||||
|
||||
/* Uninitialized data section */
|
||||
. = ALIGN(4);
|
||||
.bss :
|
||||
{
|
||||
/* This is used by the startup in order to initialize the .bss secion */
|
||||
_sbss = .; /* define a global symbol at bss start */
|
||||
__bss_start__ = _sbss;
|
||||
*(.bss)
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
|
||||
. = ALIGN(4);
|
||||
_ebss = .; /* define a global symbol at bss end */
|
||||
__bss_end__ = _ebss;
|
||||
} >RAM
|
||||
|
||||
/* Remove information from the standard libraries */
|
||||
/DISCARD/ :
|
||||
{
|
||||
libc.a ( * )
|
||||
libm.a ( * )
|
||||
libgcc.a ( * )
|
||||
}
|
||||
|
||||
/* User_heap_stack section, used to check that there is enough RAM left */
|
||||
. = ALIGN(8);
|
||||
PROVIDE ( end = . );
|
||||
PROVIDE ( _end = . );
|
||||
|
||||
/* system stack */
|
||||
PROVIDE (_stack_base = _estack - _Min_Stack_Size); /* _estack is top of stack*/
|
||||
ASSERT ((_stack_base > end), "Error: No room left for the stack")
|
||||
/* _estack is top of stack*/
|
||||
|
||||
/* left ram for heap */
|
||||
PROVIDE (heap_start = _end);
|
||||
PROVIDE (heap_end = _stack_base);
|
||||
PROVIDE (heap_len = heap_end - heap_start);
|
||||
ASSERT ((heap_len > _Min_Heap_Size), "Error: No room left for the heap")
|
||||
|
||||
.ARM.attributes 0 : { *(.ARM.attributes) }
|
||||
}
|
||||
174
Living_SDK/board/asr5501/startup/board.c
Normal file
174
Living_SDK/board/asr5501/startup/board.c
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
#include <stdio.h>
|
||||
#include "board.h"
|
||||
#include "lega_cm4.h"
|
||||
#include "lega_common.h"
|
||||
#include "systick_delay.h"
|
||||
#include "lega_uart.h"
|
||||
#include "lega_wdg.h"
|
||||
#include "lega_flash.h"
|
||||
#include "lega_common.h"
|
||||
#include "lega_wlan_api.h"
|
||||
|
||||
|
||||
#define SYS_APP_VERSION_SEG __attribute__((section("app_version_sec")))
|
||||
SYS_APP_VERSION_SEG const char app_version[] = SYSINFO_APP_VERSION;
|
||||
|
||||
extern hal_wifi_module_t sim_aos_wifi_lega;
|
||||
extern void NVIC_init();
|
||||
extern int soc_pre_init(void);
|
||||
|
||||
#ifdef ALIOS_SUPPORT
|
||||
extern void ota_roll_back_pro(void);
|
||||
#endif
|
||||
|
||||
static void wifi_common_init()
|
||||
{
|
||||
printf("start------wifi_hal\r\n");
|
||||
hal_wifi_register_module(&sim_aos_wifi_lega);
|
||||
hal_wifi_init();
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************
|
||||
* init IRQ, set priority and enable IRQ
|
||||
*
|
||||
**********************************************************/
|
||||
void NVIC_init()
|
||||
{
|
||||
//set irq priority, default set configLIBRARY_NORMAL_INTERRUPT_PRIORITY
|
||||
NVIC_SetPriority(UART0_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
NVIC_SetPriority(UART1_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
NVIC_SetPriority(UART2_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
NVIC_SetPriority(CEVA_RW_IP_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
NVIC_SetPriority(D_APLL_UNLOCK_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
NVIC_SetPriority(D_SX_UNLOCK_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
NVIC_SetPriority(SLEEP_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
NVIC_SetPriority(WDG_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
NVIC_SetPriority(FLASH_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
NVIC_SetPriority(GPIO_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
NVIC_SetPriority(TIMER_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
NVIC_SetPriority(CRYPTOCELL310_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
NVIC_SetPriority(DMA_CTRL_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
NVIC_SetPriority(SPI0_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
NVIC_SetPriority(SPI1_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
NVIC_SetPriority(SPI2_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
NVIC_SetPriority(I2C0_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
NVIC_SetPriority(I2C1_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
NVIC_SetPriority(SDIO_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
NVIC_SetPriority(PLF_WAKEUP_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY);
|
||||
}
|
||||
|
||||
#ifdef ALIOS_SUPPORT
|
||||
uart_dev_t uart_0;
|
||||
void hal_uart1_callback_handler(char ch);
|
||||
#endif
|
||||
|
||||
void uart_init(void)
|
||||
{
|
||||
#ifdef ALIOS_SUPPORT
|
||||
//uart_0.port=LEGA_UART1_INDEX;
|
||||
uart_0.port = PORT_UART_STD; /*logic port*/
|
||||
#ifdef HIGHFREQ_MCU160_SUPPORT
|
||||
uart_0.config.baud_rate=UART_BAUDRATE_1000000;
|
||||
#else
|
||||
uart_0.config.baud_rate=UART_BAUDRATE_115200;
|
||||
#endif
|
||||
uart_0.config.data_width = DATA_8BIT;
|
||||
uart_0.config.flow_control = FLOW_CTRL_DISABLED;
|
||||
uart_0.config.parity = PARITY_NO;
|
||||
uart_0.config.stop_bits = STOP_1BIT;
|
||||
//uart_0.priv = (void *)(hal_uart1_callback_handler);
|
||||
hal_uart_init(&uart_0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HIGHFREQ_MCU160_SUPPORT
|
||||
//all peripheral reinit code should place here
|
||||
void peripheral_reinit(void)
|
||||
{
|
||||
uart_init();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SYSTEM_RECOVERY
|
||||
lega_wdg_dev_t lega_wdg;
|
||||
void wdg_init(void)
|
||||
{
|
||||
lega_wdg.port = 0;
|
||||
lega_wdg.config.timeout = WDG_TIMEOUT_MS;
|
||||
lega_wdg_init(&lega_wdg);
|
||||
}
|
||||
#endif
|
||||
/***********************************************************
|
||||
* init device, such as irq, system clock, uart
|
||||
**********************************************************/
|
||||
|
||||
uint32_t system_bus_clk = SYSTEM_BUS_CLOCK_INIT;
|
||||
uint32_t system_core_clk = SYSTEM_CORE_CLOCK_INIT;
|
||||
|
||||
void lega_devInit()
|
||||
{
|
||||
#ifdef _SPI_FLASH_ENABLE_
|
||||
lega_flash_init();
|
||||
#endif
|
||||
|
||||
#ifdef ALIOS_SUPPORT
|
||||
ota_roll_back_pro();
|
||||
#endif
|
||||
|
||||
#ifdef SYSTEM_RECOVERY
|
||||
wdg_init();
|
||||
#endif
|
||||
|
||||
NVIC_init();
|
||||
|
||||
#ifdef DCDC_PFMMODE_CLOSE
|
||||
lega_drv_close_dcdc_pfm();
|
||||
#endif
|
||||
|
||||
lega_drv_rco_cal();
|
||||
|
||||
SysTick_Config(SYSTEM_CORE_CLOCK/RHINO_CONFIG_TICKS_PER_SECOND);
|
||||
|
||||
//init uart
|
||||
uart_init();
|
||||
|
||||
#ifdef CFG_MIMO_UF
|
||||
//config to support smartconfig in MIMO scenario
|
||||
//lega_wlan_smartconfig_mimo_enable();
|
||||
#endif
|
||||
|
||||
#ifdef ALIOS_SUPPORT
|
||||
hw_start_hal();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
* after task run use board_sys_init to init board
|
||||
**************************************************/
|
||||
int board_after_init(void)
|
||||
{
|
||||
lega_devInit();
|
||||
|
||||
//hw_start_hal();
|
||||
//NVIC_init();
|
||||
|
||||
tcpip_init( NULL, NULL );
|
||||
wifi_common_init();
|
||||
//init_uwifi();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
* before task run use board_sys_init to init board
|
||||
**************************************************/
|
||||
void board_init(void)
|
||||
{
|
||||
#ifdef LEGA_A0V1
|
||||
// Clear RFA Only Mode
|
||||
REG_PMU_CTRL &= ~ENABLE_RFA_DEBUG;
|
||||
REG_WR(SYS_REG_BASE_FLASH_CLK, 0x01); //26MHz flash,default 13MHz
|
||||
#endif
|
||||
flash_partition_init();
|
||||
}
|
||||
82
Living_SDK/board/asr5501/startup/startup.c
Normal file
82
Living_SDK/board/asr5501/startup/startup.c
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
|
||||
*/
|
||||
#include "aos/init.h"
|
||||
#include "board.h"
|
||||
#include <k_api.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "lega_cm4.h"
|
||||
#include "systick_delay.h"
|
||||
/*
|
||||
main task stask size(byte)
|
||||
*/
|
||||
#define OS_MAIN_TASK_STACK (4096/4)
|
||||
#define OS_MAIN_TASK_PRI 32
|
||||
|
||||
/* For user config
|
||||
kinit.argc = 0;
|
||||
kinit.argv = NULL;
|
||||
kinit.cli_enable = 1;
|
||||
*/
|
||||
static kinit_t kinit = {0, NULL, 1};
|
||||
static ktask_t *g_main_task;
|
||||
|
||||
extern void board_init(void);
|
||||
|
||||
static void sys_init(void)
|
||||
{
|
||||
board_after_init();
|
||||
|
||||
/*aos components init including middleware and protocol and so on !*/
|
||||
aos_kernel_init(&kinit);
|
||||
}
|
||||
|
||||
void HCLK_SW_IRQHandler(void)
|
||||
{
|
||||
SYS_CRM_CLR_HCLK_REC = 0x1;
|
||||
}
|
||||
|
||||
void delay_nop(unsigned int dly)
|
||||
{
|
||||
volatile unsigned int i;
|
||||
for(i=dly; i>0; i--)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void ahb_sync_brid_open(void)
|
||||
{
|
||||
unsigned int is_using_sync_down = (REG_AHB_BUS_CTRL & (0x1<<1));
|
||||
if(!is_using_sync_down)
|
||||
{
|
||||
REG_AHB_BUS_CTRL |= (0x1<<1); //0x40000A90 bit1 sw_use_hsync
|
||||
|
||||
__enable_irq();
|
||||
NVIC_EnableIRQ(24);
|
||||
__asm volatile("DSB");
|
||||
__asm volatile("WFI");
|
||||
__asm volatile("ISB");
|
||||
|
||||
delay_nop(50);
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
ahb_sync_brid_open();
|
||||
lega_flash_alg_cache_flush();
|
||||
|
||||
board_init();
|
||||
/*kernel init, malloc can use after this!*/
|
||||
krhino_init();
|
||||
|
||||
/*main task to run */
|
||||
krhino_task_dyn_create(&g_main_task, "main_task", 0, OS_MAIN_TASK_PRI, 0, OS_MAIN_TASK_STACK, (task_entry_t)sys_init, 1);
|
||||
|
||||
/*kernel start schedule!*/
|
||||
krhino_start();
|
||||
|
||||
/*never run here*/
|
||||
return 0;
|
||||
}
|
||||
244
Living_SDK/board/asr5501/startup/startup_cm4.S
Normal file
244
Living_SDK/board/asr5501/startup/startup_cm4.S
Normal file
|
|
@ -0,0 +1,244 @@
|
|||
|
||||
/************************** startup_cm4.s **********************************************/
|
||||
.syntax unified
|
||||
.cpu cortex-m4
|
||||
.fpu softvfp
|
||||
.thumb
|
||||
|
||||
.global g_pfnVectors
|
||||
.global Default_Handler
|
||||
|
||||
/* start address for the initialization values of the .data section.
|
||||
defined in linker script */
|
||||
.word _sidata
|
||||
/* start address for the .data section. defined in linker script */
|
||||
.word _sdata
|
||||
/* end address for the .data section. defined in linker script */
|
||||
.word _edata
|
||||
/* start address for the .bss section. defined in linker script */
|
||||
.word _sbss
|
||||
/* end address for the .bss section. defined in linker script */
|
||||
.word _ebss
|
||||
/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
|
||||
|
||||
/**
|
||||
* @brief This is the code that gets called when the processor first
|
||||
* starts execution following a reset event. Only the absolutely
|
||||
* necessary set is performed, after which the application
|
||||
* supplied main() routine is called.
|
||||
* @param None
|
||||
* @retval : None
|
||||
*/
|
||||
|
||||
.section .text.Reset_Handler
|
||||
.weak Reset_Handler
|
||||
.type Reset_Handler, %function
|
||||
Reset_Handler:
|
||||
ldr sp, =_estack /* set stack pointer */
|
||||
|
||||
/* Copy the data segment initializers from flash to SRAM */
|
||||
movs r1, #0
|
||||
b LoopCopyDataInit
|
||||
|
||||
CopyDataInit:
|
||||
ldr r3, =_sidata
|
||||
ldr r3, [r3, r1]
|
||||
str r3, [r0, r1]
|
||||
adds r1, r1, #4
|
||||
|
||||
LoopCopyDataInit:
|
||||
ldr r0, =_sdata
|
||||
ldr r3, =_edata
|
||||
adds r2, r0, r1
|
||||
cmp r2, r3
|
||||
bcc CopyDataInit
|
||||
ldr r2, =_sbss
|
||||
b LoopFillZerobss
|
||||
/* Zero fill the bss segment. */
|
||||
FillZerobss:
|
||||
movs r3, #0
|
||||
str r3, [r2], #4
|
||||
|
||||
LoopFillZerobss:
|
||||
ldr r3, = _ebss
|
||||
cmp r2, r3
|
||||
bcc FillZerobss
|
||||
|
||||
/* Call the clock system intitialization function.*/
|
||||
bl SystemInit
|
||||
/* Call static constructors */
|
||||
/* bl __libc_init_array */
|
||||
/* Call the application's entry point.*/
|
||||
bl main
|
||||
bx lr
|
||||
.size Reset_Handler, .-Reset_Handler
|
||||
|
||||
/**
|
||||
* @brief This is the code that gets called when the processor receives an
|
||||
* unexpected interrupt. This simply enters an infinite loop, preserving
|
||||
* the system state for examination by a debugger.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
.section .text.Default_Handler,"ax",%progbits
|
||||
Default_Handler:
|
||||
Infinite_Loop:
|
||||
b Infinite_Loop
|
||||
.size Default_Handler, .-Default_Handler
|
||||
/******************************************************************************
|
||||
*
|
||||
* The minimal vector table for a Cortex M3. Note that the proper constructs
|
||||
* must be placed on this to ensure that it ends up at physical address
|
||||
* 0x0000.0000.
|
||||
*
|
||||
*******************************************************************************/
|
||||
.section .isr_vector,"a",%progbits
|
||||
.type g_pfnVectors, %object
|
||||
.size g_pfnVectors, .-g_pfnVectors
|
||||
|
||||
|
||||
g_pfnVectors:
|
||||
.word _estack
|
||||
.word Reset_Handler
|
||||
.word NMI_Handler
|
||||
.word HardFault_Handler
|
||||
.word MemManage_Handler
|
||||
.word BusFault_Handler
|
||||
.word UsageFault_Handler
|
||||
.word 0
|
||||
.word 0
|
||||
.word 0
|
||||
.word 0
|
||||
.word SVC_Handler
|
||||
.word DebugMon_Handler
|
||||
.word 0
|
||||
.word PendSV_Handler
|
||||
.word SysTick_Handler
|
||||
|
||||
/* External Interrupts */
|
||||
.word intc_irq /* intc_irq CEVA RW IP Interrupt */
|
||||
.word SLEEP_IRQHandler /* Sleep Wake-Up Interrupt */
|
||||
.word WDG_IRQHandler /* Window WatchDog */
|
||||
.word FLASH_IRQHandler /* FLASH */
|
||||
.word GPIO_IRQHandler /* GPIO */
|
||||
.word TIMER_IRQHandler /* Timer interrupt */
|
||||
.word CRYPTOCELL310_IRQHandler /* CryptoCell 310 Interrupt */
|
||||
.word DMA_CTRL_IRQHandler /* Generic DMA Ctrl Interrupt */
|
||||
.word UART0_IRQHandler /* UART0 Interrupt */
|
||||
.word UART1_IRQHandler /* UART1 Interrupt */
|
||||
.word UART2_IRQHandler /* UART2 Interrupt */
|
||||
.word SPI0_IRQHandler /* SPI0 */
|
||||
.word SPI1_IRQHandler /* SPI1 */
|
||||
.word SPI2_IRQHandler /* SPI2 */
|
||||
.word I2C0_IRQHandler /* I2C0 */
|
||||
.word I2C1_IRQHandler /* I2C1 */
|
||||
.word SDIO_IRQHandler /* SDIO Combined Interrupt */
|
||||
.word D_APLL_UNLOCK_IRQHandler /* RF added: D_APLL_UNLOCK */
|
||||
.word D_SX_UNLOCK_IRQHandler /* RF added: D_SX_UNLOCK */
|
||||
.word 0x00000000
|
||||
.word 0x00000000
|
||||
.word 0x00000000
|
||||
.word 0x00000000
|
||||
.word PLATFORM_WAKEUP_IRQHandler /*!< WiFi SOC Wake-Up Interrupt */
|
||||
.word HCLK_SW_IRQHandler
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Provide weak aliases for each Exception handler to the Default_Handler.
|
||||
* As they are weak aliases, any function with the same name will override
|
||||
* this definition.
|
||||
*
|
||||
*******************************************************************************/
|
||||
.weak NMI_Handler
|
||||
.thumb_set NMI_Handler,Default_Handler
|
||||
|
||||
.weak HardFault_Handler
|
||||
.thumb_set HardFault_Handler,Default_Handler
|
||||
|
||||
.weak MemManage_Handler
|
||||
.thumb_set MemManage_Handler,Default_Handler
|
||||
|
||||
.weak BusFault_Handler
|
||||
.thumb_set BusFault_Handler,Default_Handler
|
||||
|
||||
.weak UsageFault_Handler
|
||||
.thumb_set UsageFault_Handler,Default_Handler
|
||||
|
||||
.weak SVC_Handler
|
||||
.thumb_set SVC_Handler,Default_Handler
|
||||
|
||||
.weak DebugMon_Handler
|
||||
.thumb_set DebugMon_Handler,Default_Handler
|
||||
|
||||
.weak PendSV_Handler
|
||||
.thumb_set PendSV_Handler,Default_Handler
|
||||
|
||||
.weak SysTick_Handler
|
||||
.thumb_set SysTick_Handler,Default_Handler
|
||||
|
||||
.weak intc_irq
|
||||
.thumb_set intc_irq,Default_Handler
|
||||
|
||||
.weak SLEEP_IRQHandler
|
||||
.thumb_set SLEEP_IRQHandler,Default_Handler
|
||||
|
||||
.weak WDG_IRQHandler
|
||||
.thumb_set WDG_IRQHandler,Default_Handler
|
||||
|
||||
.weak FLASH_IRQHandler
|
||||
.thumb_set FLASH_IRQHandler,Default_Handler
|
||||
|
||||
.weak GPIO_IRQHandler
|
||||
.thumb_set GPIO_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIMER_IRQHandler
|
||||
.thumb_set TIMER_IRQHandler,Default_Handler
|
||||
|
||||
.weak CRYPTOCELL310_IRQHandler
|
||||
.thumb_set CRYPTOCELL310_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA_CTRL_IRQHandler
|
||||
.thumb_set DMA_CTRL_IRQHandler,Default_Handler
|
||||
|
||||
.weak UART0_IRQHandler
|
||||
.thumb_set UART0_IRQHandler,Default_Handler
|
||||
|
||||
.weak UART1_IRQHandler
|
||||
.thumb_set UART1_IRQHandler,Default_Handler
|
||||
|
||||
.weak UART2_IRQHandler
|
||||
.thumb_set UART2_IRQHandler,Default_Handler
|
||||
|
||||
.weak SPI0_IRQHandler
|
||||
.thumb_set SPI0_IRQHandler,Default_Handler
|
||||
|
||||
.weak SPI1_IRQHandler
|
||||
.thumb_set SPI1_IRQHandler,Default_Handler
|
||||
|
||||
.weak SPI2_IRQHandler
|
||||
.thumb_set SPI2_IRQHandler,Default_Handler
|
||||
|
||||
.weak I2C0_IRQHandler
|
||||
.thumb_set I2C0_IRQHandler,Default_Handler
|
||||
|
||||
.weak I2C1_IRQHandler
|
||||
.thumb_set I2C1_IRQHandler,Default_Handler
|
||||
|
||||
.weak SDIO_IRQHandler
|
||||
.thumb_set SDIO_IRQHandler,Default_Handler
|
||||
|
||||
.weak D_APLL_UNLOCK_IRQHandler
|
||||
.thumb_set D_APLL_UNLOCK_IRQHandler,Default_Handler
|
||||
|
||||
.weak D_SX_UNLOCK_IRQHandler
|
||||
.thumb_set D_SX_UNLOCK_IRQHandler,Default_Handler
|
||||
|
||||
.weak PLATFORM_WAKEUP_IRQHandler
|
||||
.thumb_set PLATFORM_WAKEUP_IRQHandler,Default_Handler
|
||||
|
||||
.weak HCLK_SW_IRQHandler
|
||||
.thumb_set HCLK_SW_IRQHandler,Default_Handler
|
||||
|
||||
|
||||
/*****************END OF FILE*********************/
|
||||
1
Living_SDK/board/asr5501/ucube.py
Executable file
1
Living_SDK/board/asr5501/ucube.py
Executable file
|
|
@ -0,0 +1 @@
|
|||
linux_only_targets="living_platform linkkit_gateway smart_outlet smart_outlet_meter smart_led_bulb smart_led_strip"
|
||||
Loading…
Add table
Add a link
Reference in a new issue