mirror of
https://gitee.com/Vancouver2017/luban-lite-t3e-pro.git
synced 2025-12-16 11:28:54 +00:00
V1.0.6
This commit is contained in:
@@ -505,6 +505,14 @@ int dfs_elm_ioctl(struct dfs_fd *file, int cmd, void *args)
|
||||
fd->fptr = fptr;
|
||||
return elm_result_to_dfs(result);
|
||||
}
|
||||
case RT_FIOFFASTSEEK:
|
||||
{
|
||||
FIL *fd;
|
||||
fd = (FIL *)(file->data);
|
||||
fd->cltbl = args;
|
||||
f_lseek(fd, CREATE_LINKMAP);
|
||||
return RT_EOK;
|
||||
}
|
||||
}
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ int dfs_file_ftruncate(struct dfs_fd *fd, off_t length);
|
||||
|
||||
/* 0x5254 is just a magic number to make these relatively unique ("RT") */
|
||||
#define RT_FIOFTRUNCATE 0x52540000U
|
||||
|
||||
#define RT_FIOFFASTSEEK 0x52540001U
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -143,6 +143,7 @@ rt_inline int _can_int_tx(struct rt_can_device *can, const struct rt_can_msg *da
|
||||
rt_base_t level;
|
||||
rt_uint32_t no;
|
||||
rt_uint32_t result;
|
||||
rt_err_t timeout = RT_EOK;
|
||||
struct rt_can_sndbxinx_list *tx_tosnd = RT_NULL;
|
||||
|
||||
rt_sem_take(&(tx_fifo->sem), RT_WAITING_FOREVER);
|
||||
@@ -165,7 +166,9 @@ rt_inline int _can_int_tx(struct rt_can_device *can, const struct rt_can_msg *da
|
||||
}
|
||||
|
||||
can->status.sndchange = 1;
|
||||
rt_completion_wait(&(tx_tosnd->completion), RT_WAITING_FOREVER);
|
||||
timeout = rt_completion_wait(&(tx_tosnd->completion), 100);
|
||||
if (timeout)
|
||||
return timeout;
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
result = tx_tosnd->result;
|
||||
|
||||
@@ -75,6 +75,11 @@ struct rt_mtd_nand_driver_ops {
|
||||
rt_err_t (*continuous_read)(struct rt_mtd_nand_device *device,
|
||||
rt_off_t page, rt_uint8_t *data,
|
||||
rt_uint32_t size);
|
||||
rt_err_t (*set_block_status)(struct rt_mtd_nand_device *device,
|
||||
rt_uint32_t block, rt_uint32_t block_pos,
|
||||
rt_uint32_t status);
|
||||
rt_uint32_t (*get_block_status)(struct rt_mtd_nand_device *device,
|
||||
rt_uint32_t block);
|
||||
};
|
||||
|
||||
rt_err_t rt_mtd_nand_register_device(const char *name,
|
||||
|
||||
@@ -95,6 +95,7 @@
|
||||
#define RT_SERIAL_232_SUSPEND_DATA 0x84
|
||||
#define RT_SERIAL_SW_FLOW_CTRL 0x85
|
||||
#define RT_SERIAL_SW_RECEIVE_ON_OFF 0x86
|
||||
#define RT_SERIAL_SET_BAUDRATE 0x87
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -125,7 +126,8 @@ typedef enum
|
||||
0, \
|
||||
0, \
|
||||
0, \
|
||||
0x0F \
|
||||
0x0F, \
|
||||
48000000 \
|
||||
}
|
||||
|
||||
struct serial_configure
|
||||
@@ -146,6 +148,7 @@ struct serial_configure
|
||||
rt_uint32_t flowctrl_cts_enable :1;
|
||||
rt_uint32_t flowctrl_rts_enable :1;
|
||||
rt_uint32_t uart_index :4;
|
||||
rt_uint32_t uart_freq;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -44,6 +44,7 @@ void rt_wqueue_add(rt_wqueue_t *queue, struct rt_wqueue_node *node);
|
||||
void rt_wqueue_remove(struct rt_wqueue_node *node);
|
||||
int rt_wqueue_wait(rt_wqueue_t *queue, int condition, int timeout);
|
||||
void rt_wqueue_wakeup(rt_wqueue_t *queue, void *key);
|
||||
void rt_wqueue_wakeup_all(rt_wqueue_t *queue, void *key);
|
||||
|
||||
#define DEFINE_WAIT_FUNC(name, function) \
|
||||
struct rt_wqueue_node name = { \
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
* to blocked thread.
|
||||
* 2022-01-24 THEWON let rt_wqueue_wait return thread->error when using signal
|
||||
*/
|
||||
#define DBG_TAG "ipc.waitqueue"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -108,6 +111,68 @@ void rt_wqueue_wakeup(rt_wqueue_t *queue, void *key)
|
||||
rt_schedule();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function will wake up all pending thread on the specified
|
||||
* waiting queue that meets the conditions.
|
||||
*
|
||||
* @param queue is a pointer to the wait queue.
|
||||
*
|
||||
* @param key is the wakeup conditions, but it is not effective now, because
|
||||
* default wakeup function always return 0.
|
||||
* If user wants to use it, user should define their own wakeup
|
||||
* function.
|
||||
*/
|
||||
void rt_wqueue_wakeup_all(rt_wqueue_t *queue, void *key)
|
||||
{
|
||||
rt_base_t level;
|
||||
int need_schedule = 0;
|
||||
|
||||
rt_list_t *queue_list;
|
||||
struct rt_list_node *node;
|
||||
struct rt_wqueue_node *entry;
|
||||
|
||||
queue_list = &(queue->waiting_list);
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
/* set wakeup flag in the queue */
|
||||
queue->flag = RT_WQ_FLAG_WAKEUP;
|
||||
|
||||
if (!(rt_list_isempty(queue_list)))
|
||||
{
|
||||
for (node = queue_list->next; node != queue_list; )
|
||||
{
|
||||
entry = rt_list_entry(node, struct rt_wqueue_node, list);
|
||||
if (entry->wakeup(entry, key) == 0)
|
||||
{
|
||||
/**
|
||||
* even though another thread may interrupt the thread and
|
||||
* wakeup it meanwhile, we can asuume that condition is ready
|
||||
*/
|
||||
entry->polling_thread->error = RT_EOK;
|
||||
if (!rt_thread_resume(entry->polling_thread))
|
||||
{
|
||||
need_schedule = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* wakeup happened too soon that waker hadn't slept */
|
||||
LOG_D("%s: Thread resume failed", __func__);
|
||||
}
|
||||
node = node->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
node = node->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
rt_hw_interrupt_enable(level);
|
||||
if (need_schedule)
|
||||
rt_schedule();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function will join a thread to the specified waiting queue, the thread will holds a wait or
|
||||
* timeout return on the specified wait queue.
|
||||
|
||||
@@ -117,6 +117,18 @@ static void pm_sleep(struct rt_pm *pm, uint8_t sleep_mode)
|
||||
_pm.ops->sleep(pm, sleep_mode);
|
||||
}
|
||||
|
||||
static rt_bool_t pm_check_device_wakeup_is_enabled(const struct rt_device *dev)
|
||||
{
|
||||
/* parameter check */
|
||||
RT_ASSERT(dev != RT_NULL);
|
||||
RT_ASSERT(rt_object_get_type(&dev->parent) == RT_Object_Class_Device);
|
||||
|
||||
if (dev->flag & RT_DEVICE_FLAG_WAKEUP)
|
||||
return RT_TRUE;
|
||||
else
|
||||
return RT_FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will suspend all registered devices
|
||||
*/
|
||||
@@ -126,6 +138,9 @@ static int _pm_device_suspend(rt_uint8_t mode)
|
||||
|
||||
for (index = 0; index < _pm.device_pm_number; index++)
|
||||
{
|
||||
if (pm_check_device_wakeup_is_enabled(_pm.device_pm[index].device))
|
||||
continue;
|
||||
|
||||
if (_pm.device_pm[index].ops->suspend != RT_NULL)
|
||||
{
|
||||
ret = _pm.device_pm[index].ops->suspend(_pm.device_pm[index].device, mode);
|
||||
@@ -136,6 +151,9 @@ static int _pm_device_suspend(rt_uint8_t mode)
|
||||
|
||||
for (index = 0; index < _pm.device_pm_late_number; index++)
|
||||
{
|
||||
if (pm_check_device_wakeup_is_enabled(_pm.device_pm_late[index].device))
|
||||
continue;
|
||||
|
||||
if (_pm.device_pm_late[index].ops->suspend_late != RT_NULL)
|
||||
{
|
||||
ret = _pm.device_pm_late[index].ops->suspend_late(_pm.device_pm_late[index].device, mode);
|
||||
@@ -144,6 +162,8 @@ static int _pm_device_suspend(rt_uint8_t mode)
|
||||
}
|
||||
}
|
||||
|
||||
rt_pm_disable_pin_irq_nonwakeup();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -169,6 +189,8 @@ static void _pm_device_resume(rt_uint8_t mode)
|
||||
_pm.device_pm[index].ops->resume(_pm.device_pm[index].device, mode);
|
||||
}
|
||||
}
|
||||
|
||||
rt_pm_resume_pin_irq();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -319,9 +341,7 @@ RT_WEAK rt_tick_t pm_timer_next_timeout_tick(rt_uint8_t mode)
|
||||
switch (mode)
|
||||
{
|
||||
case PM_SLEEP_MODE_LIGHT:
|
||||
return rt_timer_next_timeout_tick();
|
||||
case PM_SLEEP_MODE_DEEP:
|
||||
case PM_SLEEP_MODE_STANDBY:
|
||||
return rt_lptimer_next_timeout_tick();
|
||||
}
|
||||
|
||||
@@ -456,16 +476,9 @@ static void _pm_change_sleep_mode(struct rt_pm *pm)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef AIC_PM_POWER_DEFAULT_LIGHT_MODE
|
||||
rt_pm_exit_critical(level, pm->sleep_mode);
|
||||
#endif
|
||||
|
||||
/* enter lower power state */
|
||||
pm_sleep(pm, pm->sleep_mode);
|
||||
|
||||
#ifdef AIC_PM_POWER_DEFAULT_LIGHT_MODE
|
||||
level = rt_pm_enter_critical(pm->sleep_mode);
|
||||
#endif
|
||||
/* wake up from lower power state*/
|
||||
if (pm->timer_mask & (0x01 << pm->sleep_mode))
|
||||
{
|
||||
|
||||
@@ -301,7 +301,7 @@ static void date(int argc, char **argv)
|
||||
rt_err_t err;
|
||||
|
||||
tm_new.tm_year = atoi(argv[1]) - 1900;
|
||||
tm_new.tm_mon = atoi(argv[2]) - 1; /* .tm_min's range is [0-11] */
|
||||
tm_new.tm_mon = atoi(argv[2]) - 1; /* .tm_mon's range is [0-11] */
|
||||
tm_new.tm_mday = atoi(argv[3]);
|
||||
tm_new.tm_hour = atoi(argv[4]);
|
||||
tm_new.tm_min = atoi(argv[5]);
|
||||
@@ -311,7 +311,7 @@ static void date(int argc, char **argv)
|
||||
rt_kprintf("year is out of range [1900-]\n");
|
||||
return;
|
||||
}
|
||||
if (tm_new.tm_mon > 11) /* .tm_min's range is [0-11] */
|
||||
if (tm_new.tm_mon > 11) /* .tm_mon's range is [0-11] */
|
||||
{
|
||||
rt_kprintf("month is out of range [1-12]\n");
|
||||
return;
|
||||
|
||||
@@ -491,17 +491,25 @@ static struct mmcsd_blk_device * rt_mmcsd_create_blkdev(struct rt_mmcsd_card *ca
|
||||
{
|
||||
LOG_D("Try to mount %s\n", blk_dev->dev.parent.name);
|
||||
#ifdef AIC_AB_SYSTEM_INTERFACE
|
||||
char target[32] = { 0 };
|
||||
char ro_target[32] = { 0 };
|
||||
char rw_target[32] = { 0 };
|
||||
enum boot_device boot_dev = aic_get_boot_device();
|
||||
|
||||
if (boot_dev == BD_SDMC0) {
|
||||
if ((strcmp("mmc0p5", blk_dev->dev.parent.name) == 0) ||
|
||||
(strcmp("mmc0p6", blk_dev->dev.parent.name) == 0)) {
|
||||
aic_ota_status_update();
|
||||
aic_get_mmc_rodata_to_mount(target);
|
||||
|
||||
if (dfs_mount(target, "/rodata", "elm", 0, 0) == 0)
|
||||
LOG_I("mount fs[elm] device[%s] to /rodata ok.\n", target);
|
||||
//skip the spl/env partition
|
||||
if (strcmp("mmc0p0", blk_dev->dev.parent.name) != 0 &&
|
||||
strcmp("mmc0p1", blk_dev->dev.parent.name) != 0 &&
|
||||
strcmp("mmc0p2", blk_dev->dev.parent.name) != 0) {
|
||||
aic_get_rodata_to_mount(ro_target);
|
||||
aic_get_data_to_mount(rw_target);
|
||||
if (strcmp(ro_target, blk_dev->dev.parent.name) == 0) {
|
||||
if (dfs_mount(ro_target, "/rodata", "elm", 0, 0) == 0)
|
||||
LOG_I("mount fs[elm] device[%s] to /rodata ok.\n", ro_target);
|
||||
}
|
||||
if (strcmp(rw_target, blk_dev->dev.parent.name) == 0) {
|
||||
if (dfs_mount(rw_target, "/data", "elm", 0, 0) == 0)
|
||||
LOG_I("mount fs[elm] device[%s] to /data ok.\n", rw_target);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -542,10 +550,12 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card)
|
||||
rt_uint8_t status;
|
||||
rt_uint8_t *sector;
|
||||
|
||||
err = mmcsd_set_blksize(card);
|
||||
if(err)
|
||||
{
|
||||
return err;
|
||||
if (!(card->host->flags & MMCSD_SUP_HIGHSPEED_DDR)) {
|
||||
err = mmcsd_set_blksize(card);
|
||||
if(err)
|
||||
{
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_D("probe mmcsd block device!");
|
||||
|
||||
@@ -266,8 +266,10 @@ rt_int32_t sdio_io_rw_extended_block(struct rt_sdio_function *func,
|
||||
while (left_size > func->cur_blk_size)
|
||||
{
|
||||
blks = left_size / func->cur_blk_size;
|
||||
#ifndef AIC_WLAN_ASR
|
||||
if (blks > max_blks)
|
||||
blks = max_blks;
|
||||
#endif
|
||||
len = blks * func->cur_blk_size;
|
||||
|
||||
ret = sdio_io_rw_extended(func->card, rw, func->num,
|
||||
|
||||
@@ -126,6 +126,9 @@ static rt_size_t rt_touch_read(rt_device_t dev, rt_off_t pos, void *buf, rt_size
|
||||
{
|
||||
rt_touch_t touch;
|
||||
rt_size_t result = 0;
|
||||
rt_uint8_t index;
|
||||
rt_uint16_t temp = 0;
|
||||
struct rt_touch_data *read_data = RT_NULL;
|
||||
RT_ASSERT(dev != RT_NULL);
|
||||
touch = (rt_touch_t)dev;
|
||||
|
||||
@@ -136,6 +139,31 @@ static rt_size_t rt_touch_read(rt_device_t dev, rt_off_t pos, void *buf, rt_size
|
||||
|
||||
result = touch->ops->touch_readpoint(touch, buf, len);
|
||||
|
||||
read_data = (struct rt_touch_data *)buf;
|
||||
|
||||
for (index = 0; index < len; index++) {
|
||||
#ifdef AIC_TOUCH_X_FILP
|
||||
read_data[index].x_coordinate = (rt_int16_t)AIC_TOUCH_X_COORDINATE_RANGE -
|
||||
read_data[index].x_coordinate;
|
||||
#endif
|
||||
#ifdef AIC_TOUCH_Y_FILP
|
||||
read_data[index].y_coordinate = (rt_int16_t)AIC_TOUCH_Y_COORDINATE_RANGE -
|
||||
read_data[index].y_coordinate;
|
||||
#endif
|
||||
#ifdef AIC_TOUCH_90_DEGREE_ROTATION
|
||||
temp = read_data[index].x_coordinate;
|
||||
read_data[index].x_coordinate = (rt_int16_t)AIC_TOUCH_Y_COORDINATE_RANGE -
|
||||
read_data[index].y_coordinate;
|
||||
read_data[index].y_coordinate = temp;
|
||||
#endif
|
||||
#ifdef AIC_TOUCH_270_DEGREE_ROTATION
|
||||
temp = read_data[index].x_coordinate;
|
||||
read_data[index].x_coordinate = read_data[index].y_coordinate;
|
||||
read_data[index].y_coordinate = (rt_int16_t)AIC_TOUCH_X_COORDINATE_RANGE - temp;
|
||||
#endif
|
||||
(void)read_data;
|
||||
(void)temp;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -370,20 +370,28 @@ static rt_err_t rt_wlan_lwip_protocol_send(rt_device_t device, struct pbuf *p)
|
||||
|
||||
#ifdef RT_WLAN_PROT_LWIP_PBUF_FORCE
|
||||
{
|
||||
rt_wlan_prot_transfer_dev(wlan, p, p->tot_len);
|
||||
#ifdef AIC_WLAN_ASR
|
||||
return rt_wlan_prot_transfer_dev(wlan, p, p->tot_len);
|
||||
#else
|
||||
return RT_EOK;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
{
|
||||
rt_uint8_t *frame;
|
||||
int ret = RT_EOK;
|
||||
|
||||
/* sending data directly */
|
||||
if (p->len == p->tot_len)
|
||||
{
|
||||
frame = (rt_uint8_t *)p->payload;
|
||||
#ifdef AIC_WLAN_ASR
|
||||
ret = rt_wlan_prot_transfer_dev(wlan, frame, p->tot_len);
|
||||
#else
|
||||
rt_wlan_prot_transfer_dev(wlan, frame, p->tot_len);
|
||||
#endif
|
||||
LOG_D("F:%s L:%d run len:%d", __FUNCTION__, __LINE__, p->tot_len);
|
||||
return RT_EOK;
|
||||
return ret;
|
||||
}
|
||||
frame = rt_malloc(p->tot_len);
|
||||
if (frame == RT_NULL)
|
||||
@@ -394,10 +402,14 @@ static rt_err_t rt_wlan_lwip_protocol_send(rt_device_t device, struct pbuf *p)
|
||||
/*copy pbuf -> data dat*/
|
||||
pbuf_copy_partial(p, frame, p->tot_len, 0);
|
||||
/* send data */
|
||||
#ifdef AIC_WLAN_ASR
|
||||
ret = rt_wlan_prot_transfer_dev(wlan, frame, p->tot_len);
|
||||
#else
|
||||
rt_wlan_prot_transfer_dev(wlan, frame, p->tot_len);
|
||||
#endif
|
||||
LOG_D("F:%s L:%d run len:%d", __FUNCTION__, __LINE__, p->tot_len);
|
||||
rt_free(frame);
|
||||
return RT_EOK;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -49,6 +49,10 @@ if RT_USING_FAL
|
||||
config FAL_USING_NOR_FLASH_DEV_NAME
|
||||
string "The name of the device used by FAL"
|
||||
default "norflash0"
|
||||
config FAL_USING_NOR_FLASH_DEV_NAME1
|
||||
depends on AIC_SECONED_FLASH_NOR
|
||||
string "The name of the device1 used by FAL"
|
||||
default "norflash1"
|
||||
endif
|
||||
|
||||
config FAL_BLK_DEVICE_RDONLY
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
#ifndef FAL_USING_NOR_FLASH_DEV_NAME
|
||||
#define FAL_USING_NOR_FLASH_DEV_NAME "norflash0"
|
||||
#endif
|
||||
#ifndef FAL_USING_NOR_FLASH_DEV_NAME1
|
||||
#define FAL_USING_NOR_FLASH_DEV_NAME1 "norflash1"
|
||||
#endif
|
||||
|
||||
static int init(void);
|
||||
static int read(long offset, uint8_t *buf, size_t size);
|
||||
@@ -36,6 +39,81 @@ struct fal_flash_dev nor_flash0 =
|
||||
.write_gran = 1
|
||||
};
|
||||
|
||||
#if defined(AIC_QSPI1_DEVICE_SPINOR)
|
||||
static int init1(void);
|
||||
static int read1(long offset, uint8_t *buf, size_t size);
|
||||
static int write1(long offset, const uint8_t *buf, size_t size);
|
||||
static int erase1(long offset, size_t size);
|
||||
|
||||
static sfud_flash_t sfud_dev1 = NULL;
|
||||
struct fal_flash_dev nor_flash1 =
|
||||
{
|
||||
.name = FAL_USING_NOR_FLASH_DEV_NAME1,
|
||||
.addr = 0,
|
||||
.len = 16 * 1024 * 1024,
|
||||
.blk_size = 4096,
|
||||
.ops = {init1, read1, write1, erase1},
|
||||
.write_gran = 1
|
||||
};
|
||||
|
||||
static int init1(void)
|
||||
{
|
||||
|
||||
#ifdef RT_USING_SFUD
|
||||
/* RT-Thread RTOS platform */
|
||||
sfud_dev1 = rt_sfud_flash_find_by_dev_name(FAL_USING_NOR_FLASH_DEV_NAME1);
|
||||
#else
|
||||
/* bare metal platform */
|
||||
extern sfud_flash sfud_norflash1;
|
||||
sfud_dev1 = &sfud_norflash1;
|
||||
#endif
|
||||
|
||||
if (NULL == sfud_dev1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* update the flash chip information */
|
||||
nor_flash1.blk_size = sfud_dev1->chip.erase_gran;
|
||||
nor_flash1.len = sfud_dev1->chip.capacity;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int read1(long offset, uint8_t *buf, size_t size)
|
||||
{
|
||||
assert(sfud_dev1);
|
||||
assert(sfud_dev1->init_ok);
|
||||
sfud_read(sfud_dev1, nor_flash1.addr + offset, size, buf);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static int write1(long offset, const uint8_t *buf, size_t size)
|
||||
{
|
||||
assert(sfud_dev1);
|
||||
assert(sfud_dev1->init_ok);
|
||||
if (sfud_write(sfud_dev1, nor_flash1.addr + offset, size, buf) != SFUD_SUCCESS)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static int erase1(long offset, size_t size)
|
||||
{
|
||||
assert(sfud_dev1);
|
||||
assert(sfud_dev1->init_ok);
|
||||
if (sfud_erase(sfud_dev1, nor_flash0.addr + offset, size) != SFUD_SUCCESS)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int init(void)
|
||||
{
|
||||
|
||||
|
||||
@@ -154,7 +154,9 @@ int fal_partition_init(void)
|
||||
partition_table = aic_part;
|
||||
if (check_and_update_part_cache(partition_table, partition_table_len) == 0) {
|
||||
init_ok = 1;
|
||||
#if !defined(AIC_FLASH_NUM_TWO)
|
||||
return partition_table_len;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef FAL_PART_HAS_TABLE_CFG
|
||||
|
||||
@@ -487,14 +487,14 @@ static int cmd_mount(int argc, char **argv)
|
||||
struct dfs_filesystem *iter;
|
||||
|
||||
/* display the mount history */
|
||||
rt_kprintf("filesystem device mountpoint\n");
|
||||
rt_kprintf("---------- ------ ----------\n");
|
||||
rt_kprintf("filesystem device mountpoint\n");
|
||||
rt_kprintf("---------- ------------ ----------\n");
|
||||
for (iter = &filesystem_table[0];
|
||||
iter < &filesystem_table[DFS_FILESYSTEMS_MAX]; iter++)
|
||||
{
|
||||
if ((iter != NULL) && (iter->path != NULL))
|
||||
{
|
||||
rt_kprintf("%-10s %-6s %-s\n",
|
||||
rt_kprintf("%-10s %-12s %-s\n",
|
||||
iter->ops->name, iter->dev_id->parent.name, iter->path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,6 +106,9 @@ static char eth_tx_thread_stack[RT_LWIP_ETHTHREAD_STACKSIZE];
|
||||
#ifndef LWIP_NO_RX_THREAD
|
||||
static struct rt_mailbox eth_rx_thread_mb;
|
||||
static struct rt_thread eth_rx_thread;
|
||||
#ifdef AIC_WLAN_ASR
|
||||
static int eth_tx_result = 0;
|
||||
#endif
|
||||
#ifndef RT_LWIP_ETHTHREAD_MBOX_SIZE
|
||||
static char eth_rx_thread_mb_pool[48 * sizeof(rt_ubase_t)];
|
||||
static char eth_rx_thread_stack[1024];
|
||||
@@ -440,11 +443,23 @@ static err_t ethernetif_linkoutput(struct netif *netif, struct pbuf *p)
|
||||
msg.netif = netif;
|
||||
msg.buf = p;
|
||||
rt_completion_init(&msg.ack);
|
||||
if (rt_mb_send(ð_tx_thread_mb, (rt_ubase_t) &msg) == RT_EOK)
|
||||
#ifdef AIC_WLAN_ASR
|
||||
int ret = rt_mb_send(ð_tx_thread_mb, (rt_ubase_t) &msg);
|
||||
if (ret == RT_EOK)
|
||||
{
|
||||
/* waiting for ack */
|
||||
rt_completion_wait(&msg.ack, RT_WAITING_FOREVER);
|
||||
return eth_tx_result;
|
||||
} else {
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
if (rt_mb_send(ð_tx_thread_mb, (rt_ubase_t) &msg) == RT_EOK)
|
||||
{
|
||||
/* waiting for ack */
|
||||
rt_completion_wait(&msg.ack, RT_WAITING_FOREVER);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
struct eth_device* enetif;
|
||||
|
||||
@@ -706,14 +721,25 @@ static void eth_tx_thread_entry(void* parameter)
|
||||
RT_ASSERT(msg->netif != RT_NULL);
|
||||
RT_ASSERT(msg->buf != RT_NULL);
|
||||
|
||||
#ifdef AIC_WLAN_ASR
|
||||
eth_tx_result = ERR_MEM;
|
||||
#endif
|
||||
enetif = (struct eth_device*)msg->netif->state;
|
||||
if (enetif != RT_NULL)
|
||||
{
|
||||
/* call driver's interface */
|
||||
if (enetif->eth_tx(&(enetif->parent), msg->buf) != RT_EOK)
|
||||
#ifdef AIC_WLAN_ASR
|
||||
eth_tx_result = enetif->eth_tx(&(enetif->parent), msg->buf);
|
||||
if (eth_tx_result != RT_EOK)
|
||||
{
|
||||
/* transmit eth packet failed */
|
||||
}
|
||||
#else
|
||||
if (enetif->eth_tx(&(enetif->parent), msg->buf) != RT_EOK)
|
||||
{
|
||||
/* transmit eth packet failed */
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* send ACK */
|
||||
|
||||
@@ -383,12 +383,20 @@
|
||||
|
||||
/* TCP sender buffer space (pbufs). This must be at least = 2 *
|
||||
TCP_SND_BUF/TCP_MSS for things to work. */
|
||||
#ifdef AIC_WLAN_ASR
|
||||
#define TCP_SND_QUEUELEN (2 * TCP_SND_BUF/TCP_MSS)
|
||||
#else
|
||||
#define TCP_SND_QUEUELEN (4 * TCP_SND_BUF/TCP_MSS)
|
||||
#endif
|
||||
|
||||
/* TCP writable space (bytes). This must be less than or equal
|
||||
to TCP_SND_BUF. It is the amount of space which must be
|
||||
available in the tcp snd_buf for select to return writable */
|
||||
#ifdef AIC_WLAN_ASR
|
||||
#define TCP_SNDLOWAT LWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/7), (2*TCP_MSS)+1), (TCP_SND_BUF)-1)
|
||||
#else
|
||||
#define TCP_SNDLOWAT (TCP_SND_BUF/2)
|
||||
#endif
|
||||
#define TCP_SNDQUEUELOWAT TCP_SND_QUEUELEN/2
|
||||
|
||||
/* TCP receive window. */
|
||||
@@ -415,7 +423,11 @@
|
||||
#define TCPIP_THREAD_STACKSIZE 4096
|
||||
#endif
|
||||
#define TCPIP_THREAD_NAME "tcpip"
|
||||
#ifdef AIC_WLAN_ASR
|
||||
#define DEFAULT_TCP_RECVMBOX_SIZE 60
|
||||
#else
|
||||
#define DEFAULT_TCP_RECVMBOX_SIZE 10
|
||||
#endif
|
||||
|
||||
/* ---------- ARP options ---------- */
|
||||
#define LWIP_ARP 1
|
||||
|
||||
@@ -1002,6 +1002,7 @@ enum rt_device_class_type
|
||||
#define RT_DEVICE_FLAG_ACTIVATED 0x010 /**< device is activated */
|
||||
#define RT_DEVICE_FLAG_SUSPENDED 0x020 /**< device is suspended */
|
||||
#define RT_DEVICE_FLAG_STREAM 0x040 /**< stream mode */
|
||||
#define RT_DEVICE_FLAG_WAKEUP 0x080 /**< wakeup source*/
|
||||
|
||||
#define RT_DEVICE_FLAG_INT_RX 0x100 /**< INT mode on Rx */
|
||||
#define RT_DEVICE_FLAG_DMA_RX 0x200 /**< DMA mode on Rx */
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
#include "cpuport.h"
|
||||
|
||||
#define RISCV_RT_STACK_ALIGN16 (16)
|
||||
|
||||
#ifndef RT_USING_SMP
|
||||
volatile rt_ubase_t rt_interrupt_from_thread = 0;
|
||||
volatile rt_ubase_t rt_interrupt_to_thread = 0;
|
||||
@@ -114,7 +116,10 @@ rt_uint8_t *rt_hw_stack_init(void *tentry,
|
||||
int i;
|
||||
|
||||
stk = stack_addr + sizeof(rt_ubase_t);
|
||||
stk = (rt_uint8_t *)RT_ALIGN_DOWN((rt_ubase_t)stk, REGBYTES);
|
||||
|
||||
/*In the standard RISCV-V calling convention, the stack grows downward and
|
||||
the stack pointer is always keep 16-byte aligned*/
|
||||
stk = (rt_uint8_t *)RT_ALIGN_DOWN((rt_ubase_t)stk, RISCV_RT_STACK_ALIGN16);
|
||||
stk -= sizeof(struct rt_hw_stack_frame);
|
||||
|
||||
frame = (struct rt_hw_stack_frame *)stk;
|
||||
|
||||
@@ -224,7 +224,7 @@ PendSV_Handler:
|
||||
#endif
|
||||
|
||||
#ifdef ARCH_RISCV_DSP
|
||||
addi sp, sp, -33 * REGBYTES
|
||||
addi sp, sp, -34 * REGBYTES
|
||||
#else
|
||||
addi sp, sp, -32 * REGBYTES
|
||||
#endif
|
||||
@@ -328,7 +328,7 @@ PendSV_Handler:
|
||||
LOAD x31, 31 * REGBYTES(sp)
|
||||
|
||||
#ifdef ARCH_RISCV_DSP
|
||||
addi sp, sp, 33 * REGBYTES
|
||||
addi sp, sp, 34 * REGBYTES
|
||||
#else
|
||||
addi sp, sp, 32 * REGBYTES
|
||||
#endif
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <aic_core.h>
|
||||
#include "cpuport.h"
|
||||
|
||||
#define RISCV_RT_STACK_ALIGN16 (16)
|
||||
|
||||
#ifndef RT_USING_SMP
|
||||
volatile rt_ubase_t rt_interrupt_from_thread = 0;
|
||||
volatile rt_ubase_t rt_interrupt_to_thread = 0;
|
||||
@@ -57,6 +59,7 @@ struct rt_hw_stack_frame
|
||||
rt_ubase_t t6; /* x31 - t6 - temporary register 6 */
|
||||
#ifdef ARCH_RISCV_DSP
|
||||
rt_ubase_t vxsat; /* P-ext vxsat reg */
|
||||
rt_ubase_t reserve; /* for 8 bytes align */
|
||||
#endif
|
||||
#ifdef ARCH_RISCV_FPU
|
||||
rv_floatreg_t f0; /* f0 */
|
||||
@@ -114,7 +117,10 @@ rt_uint8_t *rt_hw_stack_init(void *tentry,
|
||||
int i;
|
||||
|
||||
stk = stack_addr + sizeof(rt_ubase_t);
|
||||
stk = (rt_uint8_t *)RT_ALIGN_DOWN((rt_ubase_t)stk, REGBYTES);
|
||||
|
||||
/*In the standard RISCV-V calling convention, the stack grows downward and
|
||||
the stack pointer is always keep 16-byte aligned*/
|
||||
stk = (rt_uint8_t *)RT_ALIGN_DOWN((rt_ubase_t)stk, RISCV_RT_STACK_ALIGN16);
|
||||
stk -= sizeof(struct rt_hw_stack_frame);
|
||||
|
||||
frame = (struct rt_hw_stack_frame *)stk;
|
||||
|
||||
@@ -457,4 +457,32 @@ rt_err_t rt_device_set_tx_complete(rt_device_t dev,
|
||||
}
|
||||
RTM_EXPORT(rt_device_set_tx_complete);
|
||||
|
||||
/**
|
||||
* @brief This function will enable or disable a device as a wakeup source.
|
||||
*
|
||||
* @param dev is the pointer of device driver structure.
|
||||
*
|
||||
* @param enable is the enable or disable cmd to device.
|
||||
*
|
||||
* @return RT_EOK
|
||||
*/
|
||||
rt_err_t rt_device_wakeup_enable(rt_device_t dev, rt_bool_t enable)
|
||||
{
|
||||
/* parameter check */
|
||||
RT_ASSERT(dev != RT_NULL);
|
||||
RT_ASSERT(rt_object_get_type(&dev->parent) == RT_Object_Class_Device);
|
||||
|
||||
if (enable)
|
||||
{
|
||||
dev->flag |= RT_DEVICE_FLAG_WAKEUP;
|
||||
}
|
||||
else
|
||||
{
|
||||
dev->flag &= ~RT_DEVICE_FLAG_WAKEUP;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_device_wakeup_enable);
|
||||
|
||||
#endif /* RT_USING_DEVICE */
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <rthw.h>
|
||||
#include <aic_core.h>
|
||||
#include <ctype.h>
|
||||
#include <boot_param.h>
|
||||
|
||||
#ifdef RT_USING_MODULE
|
||||
#include <dlmodule.h>
|
||||
@@ -648,6 +649,7 @@ void rt_show_banner(void)
|
||||
}
|
||||
RTM_EXPORT(rt_show_banner);
|
||||
|
||||
extern struct boot_args boot_arg;
|
||||
void rt_show_version(void)
|
||||
{
|
||||
char ver[] = PRJ_CHIP;
|
||||
@@ -655,6 +657,8 @@ void rt_show_version(void)
|
||||
ver[0] = toupper(ver[0]);
|
||||
rt_kprintf("Welcome to ArtInChip Luban-Lite %d.%d.%d [%s Inside]\n",
|
||||
LL_VERSION, LL_SUBVERSION, LL_REVISION, ver);
|
||||
if ((boot_arg.image_version[0] - '0') < 10)
|
||||
rt_kprintf("Image version: %s\n", boot_arg.image_version);
|
||||
rt_kprintf("Built on %s %s\n", __DATE__, __TIME__);
|
||||
}
|
||||
RTM_EXPORT(rt_show_version);
|
||||
@@ -733,7 +737,8 @@ static char *print_number(char *buf,
|
||||
#ifdef RT_PRINTF_PRECISION
|
||||
int precision,
|
||||
#endif /* RT_PRINTF_PRECISION */
|
||||
int type)
|
||||
int type,
|
||||
int qualifier)
|
||||
{
|
||||
char c, sign;
|
||||
#ifdef RT_KPRINTF_USING_LONGLONG
|
||||
@@ -759,15 +764,52 @@ static char *print_number(char *buf,
|
||||
sign = 0;
|
||||
if (type & SIGN)
|
||||
{
|
||||
if (num < 0)
|
||||
switch (qualifier)
|
||||
{
|
||||
sign = '-';
|
||||
num = -num;
|
||||
}
|
||||
else if (type & PLUS)
|
||||
sign = '+';
|
||||
else if (type & SPACE)
|
||||
sign = ' ';
|
||||
case 'h':
|
||||
if ((rt_int16_t)num < 0)
|
||||
{
|
||||
sign = '-';
|
||||
num = (rt_uint16_t)-num;
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef RT_KPRINTF_USING_LONGLONG
|
||||
case 'L':
|
||||
if ((long)num < 0)
|
||||
{
|
||||
sign = '-';
|
||||
num = (long long)-num;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case 'l':
|
||||
if ((long)num < 0)
|
||||
{
|
||||
sign = '-';
|
||||
num = (unsigned long)-num;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
if ((rt_int32_t)num < 0)
|
||||
{
|
||||
sign = '-';
|
||||
num = (rt_uint32_t)-num;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (sign != '-')
|
||||
{
|
||||
if (type & PLUS)
|
||||
{
|
||||
sign = '+';
|
||||
}
|
||||
else if (type & SPACE)
|
||||
{
|
||||
sign = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RT_PRINTF_SPECIAL
|
||||
@@ -1068,11 +1110,11 @@ RT_WEAK int rt_vsnprintf(char *buf, rt_size_t size, const char *fmt, va_list arg
|
||||
#ifdef RT_PRINTF_PRECISION
|
||||
str = print_number(str, end,
|
||||
(long)va_arg(args, void *),
|
||||
16, field_width, precision, flags);
|
||||
16, field_width, precision, flags, qualifier);
|
||||
#else
|
||||
str = print_number(str, end,
|
||||
(long)va_arg(args, void *),
|
||||
16, field_width, flags);
|
||||
16, field_width, flags, qualifier);
|
||||
#endif /* RT_PRINTF_PRECISION */
|
||||
continue;
|
||||
|
||||
@@ -1114,16 +1156,16 @@ RT_WEAK int rt_vsnprintf(char *buf, rt_size_t size, const char *fmt, va_list arg
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef RT_KPRINTF_USING_LONGLONG
|
||||
if (qualifier == 'L') num = va_arg(args, long long);
|
||||
else if (qualifier == 'l')
|
||||
#else
|
||||
if (qualifier == 'l')
|
||||
#endif /* RT_KPRINTF_USING_LONGLONG */
|
||||
if (qualifier == 'l')
|
||||
{
|
||||
num = va_arg(args, rt_uint32_t);
|
||||
if (flags & SIGN) num = (rt_int32_t)num;
|
||||
num = va_arg(args, unsigned long);
|
||||
}
|
||||
#ifdef RT_KPRINTF_USING_LONGLONG
|
||||
else if (qualifier == 'L')
|
||||
{
|
||||
num = va_arg(args, unsigned long long);
|
||||
}
|
||||
#endif /* RT_KPRINTF_USING_LONGLONG */
|
||||
else if (qualifier == 'h')
|
||||
{
|
||||
num = (rt_uint16_t)va_arg(args, rt_int32_t);
|
||||
@@ -1135,9 +1177,9 @@ RT_WEAK int rt_vsnprintf(char *buf, rt_size_t size, const char *fmt, va_list arg
|
||||
if (flags & SIGN) num = (rt_int32_t)num;
|
||||
}
|
||||
#ifdef RT_PRINTF_PRECISION
|
||||
str = print_number(str, end, num, base, field_width, precision, flags);
|
||||
str = print_number(str, end, num, base, field_width, precision, flags, qualifier);
|
||||
#else
|
||||
str = print_number(str, end, num, base, field_width, flags);
|
||||
str = print_number(str, end, num, base, field_width, flags, qualifier);
|
||||
#endif /* RT_PRINTF_PRECISION */
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env python2
|
||||
# -*- coding:utf-8 -*-
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Copyright (C) 2021-2023 ArtInChip Technology Co., Ltd
|
||||
# Copyright (C) 2021-2024 ArtInChip Technology Co., Ltd
|
||||
|
||||
import xml.etree.ElementTree as etree
|
||||
from xml.etree.ElementTree import SubElement
|
||||
@@ -346,7 +346,12 @@ def TargetEclipse(env, sdk=False, update=False):
|
||||
for f in glob.iglob(src_d + '/*'):
|
||||
des_f = os.path.basename(f)
|
||||
des_f = os.path.join(des_d, des_f)
|
||||
shutil.copy(f, des_f)
|
||||
if os.path.isdir(f):
|
||||
if os.path.exists(des_f):
|
||||
shutil.rmtree(des_f)
|
||||
shutil.copytree(f, des_f)
|
||||
else:
|
||||
shutil.copy(f, des_f)
|
||||
# copy 'bsp/artinchip/sys/chip/*.pbp'
|
||||
print('Copy .pbp file...')
|
||||
src_d = os.path.join(aic_root, 'bsp/artinchip/sys', prj_chip)
|
||||
|
||||
Reference in New Issue
Block a user