merge the latest codes

This commit is contained in:
wlyu
2022-01-24 18:38:03 +08:00
1002 changed files with 317082 additions and 292 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
SRC_FILES := test_main.c
SRC_FILES := test_main.c test_fpu.c
ifeq ($(CONFIG_KERNEL_TEST_SEM),y)
SRC_FILES += test_sem.c
@@ -2,12 +2,18 @@
#include <stdint.h>
/* parameters for sram peripheral */
/* stm32f4 Bank3:0X68000000 */
#define SRAM_BANK_ADDR ((uint32_t)0X68000000)
// /* stm32f4 Bank3:0X68000000 */
// #define SRAM_BANK_ADDR ((uint32_t)0X68000000)
/* OK-1052 semc:0X80000000 */
#define SRAM_BANK_ADDR ((uint32_t)0X80000000)
/* data width: 8, 16, 32 */
#define SRAM_DATA_WIDTH 16
// /* sram size */
// #define SRAM_SIZE ((uint32_t)0x00100000)
/* sram size */
#define SRAM_SIZE ((uint32_t)0x00100000)
#define SRAM_SIZE ((uint32_t)0x2000000)
int sram_test(void)
{
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file test_fpu.c
* @brief support to test touch function
* @version 1.0
* @author AIIT XUOS Lab
* @date 2022-01-11
*/
#include <xiuos.h>
void FpuTest(void)
{
float i = 8.25;
KPrintf("float i = 8.25 ['i %s 8' && 'i %s 9']\n",i > 8 ? ">" : "<",i < 9 ? "<" : ">");
float add = i + 5.1;
KPrintf("float add(13.35) = i + 5.1 ['add %s 13' && 'add %s 14']\n",add > 13 ? ">" : "<",add < 14 ? "<" : ">");
float sub = i - 5.1;
KPrintf("float sub(3.15) = i - 5.1 ['sub %s 3' && 'sub %s 4']\n",sub > 3 ? ">" : "<",sub < 4 ? "<" : ">");
float mul = i * 5.1;
KPrintf("float mul(42.075) = i * 5.1 ['mul %s 42' && 'mul %s 43']\n",mul > 42 ? ">" : "<",mul < 43 ? "<" : ">");
float div = i / 5.1;
KPrintf("float div(1.617) = i / 5.1 ['div %s 1' && 'div %s 2']\n",div > 1 ? ">" : "<",div < 2 ? "<" : ">");
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),FpuTest, FpuTest, Close AC task );
@@ -93,7 +93,7 @@ int EnableLcd(const char *bus_name, const char *driver_name, const char *device_
*/
void TestLcd(void)
{
EnableLcd(LCD_BUS_NAME_1,LCD_DRV_NAME_1,LCD_1_DEVICE_NAME_0);
EnableLcd(LCD_BUS_NAME,LCD_DRV_NAME,LCD_DEVICE_NAME);
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),TestLcd, TestLcd, Test LCD );
@@ -66,11 +66,13 @@ static void TestSerialRecvTask(void *parameter)
read_param.buffer = &recv_data;
read_param.read_length = 0;
KPrintf("ready to read data\n");
BusDevReadData(bus_device, &read_param);
for (i = 0; i < read_param.read_length; i ++) {
KPrintf("TestSerialRecvTask i %d char 0x%x\n", i, recv_data);
}
KPrintf("send data %c\n", recv_data);
write_param.buffer = &recv_data;
write_param.size = 1;
BusDevWriteData(bus_device, &write_param);
@@ -141,7 +143,8 @@ static int SerialBusCheck(const char *bus_name, const char *driver_name, const c
bus->match(bus_driver, bus_device);
/*step 3: open bus_device, configure struct SerialDevParam if necessary*/
serial_dev_param->serial_set_mode = SIGN_OPER_INT_RX;
serial_dev_param->serial_set_mode = 0;
serial_dev_param->serial_work_mode = SIGN_OPER_DMA_RX;//SIGN_OPER_INT_RX;
serial_dev_param->serial_stream_mode = SIGN_OPER_STREAM;
BusDevOpen(bus_device);
KPrintf("BusDevOpen done\n");
+22 -18
View File
@@ -349,11 +349,11 @@ static void* BigMemMalloc(struct DynamicBuddyMemory *dynamic_buddy, x_size_t siz
}
/* best-fit method */
for (node = dynamic_buddy->mm_freenode_list[ndx].next;
(ndx < MEM_LINKNRS ) && (node->size < allocsize);
node = node->next) {
ndx++;
};
for (node = dynamic_buddy->mm_freenode_list[ndx].next;
(ndx < MEM_LINKNRS ) && (node->size < allocsize);
node = node->next) {
ndx++;
};
/* get the best-fit freeNode */
if (node && (node->size >= allocsize)) {
struct DynamicFreeNode *remainder;
@@ -1167,7 +1167,7 @@ void MemoryInfo(uint32 *total_memory, uint32 *used_memory, uint32 *max_used_memo
#ifdef TOOL_SHELL
#include <shell.h>
void ShowBuddy(void);
void ShowBuddy();
void ShowMemory(void);
/**
* This function will list the statistic information about memory.
@@ -1206,21 +1206,23 @@ void ShowBuddy(void)
lock = CriticalAreaLock();
KPrintf("\n\033[41;1mlist memory information\033[0m\n", __func__);
for(int level = 0; level < MEM_LINKNRS; level++) {
KPrintf("\n %s level [%d],memory size[2^%d] \n",__func__, level,level +6);
KPrintf("%s level [%d],memory size[2^%d] \n",__func__, level,level +6);
for (debug = &ByteManager.dynamic_buddy_manager.mm_freenode_list[level]; ; ) {
if(debug->size > 0)
KPrintf(" [current node %x,next node %x, size %u, flag %x]\n",debug, debug->next,debug->size,debug->flag);
else
KPrintf(" [listhead node %x,next node %x]\n",debug, debug->next);
if(debug->next)
{
debug = debug->next;
if(debug->size == 0)
if(debug->size > 0)
KPrintf(" [current node %x,next node %x, size %u, flag %x]\n",debug, debug->next,debug->size,debug->flag);
else
KPrintf(" \n");
}
if(debug->size == 0 || NONE == debug->next)
break;
};
}
KPrintf("\nlist memory information\n\n");
KPrintf("\n\033[41;1mlist extern memory information\033[0m\n");
#ifdef MEM_EXTERN_SRAM
for(i = 0; i < EXTSRAM_MAX_NUM; i++) {
if(NONE != ExtByteManager[i].done){
@@ -1228,14 +1230,16 @@ void ShowBuddy(void)
for(int lev = 0; lev < MEM_LINKNRS; lev++) {
KPrintf("\n %s level [%d],memory size[2^%d] \n",__func__, lev,lev +6);
for (debug = & ExtByteManager[i].dynamic_buddy_manager.mm_freenode_list[lev]; ; ) {
if(debug->size > 0)
KPrintf(" [current node %x,next node %x, size %u, flag %x]\n",debug, debug->next,debug->size,debug->flag);
else
KPrintf(" [listhead node %x,next node %x]\n",debug, debug->next);
if(debug->next)
{
debug = debug->next;
if(debug->size == 0)
if(debug->size > 0)
KPrintf(" [current node %x,next node %x, size %u, flag %x]\n",debug, debug->next,debug->size,debug->flag);
else
KPrintf(" \n");
}
if(debug->size == 0 || NONE == debug->next)
break;
}
}