Merge branch 'wang_weigen_master' of https://git.trustie.net/xuos/xiuos into xiuos_connection

This commit is contained in:
Liu_Weichao
2021-12-01 10:28:26 +08:00
187 changed files with 41251 additions and 273 deletions
@@ -11,6 +11,7 @@ CONFIG_RTT_DIR="../../rt-thread"
# RT-Thread Kernel
#
CONFIG_RT_NAME_MAX=8
# CONFIG_RT_USING_BIG_ENDIAN is not set
# CONFIG_RT_USING_ARCH_DATA_TYPE is not set
# CONFIG_RT_USING_SMP is not set
CONFIG_RT_ALIGN_SIZE=4
@@ -515,6 +516,7 @@ CONFIG_USING_KPU_POSTPROCESSING=y
# CONFIG_USING_YOLOV2 is not set
# CONFIG_USING_KNOWING_FILTER is not set
# CONFIG_USING_OTA_MODEL is not set
# CONFIG_USING_IMAGE_PROCESSING is not set
# CONFIG_SUPPORT_CONTROL_FRAMEWORK is not set
#
@@ -265,8 +265,8 @@
#define BSP_USING_SPI1
#define BSP_USING_SPI2
#define BSP_USING_I2C1
#define BSP_I2C1_SCL_PIN 54
#define BSP_I2C1_SDA_PIN 55
#define BSP_I2C1_SCL_PIN 55
#define BSP_I2C1_SDA_PIN 54
#define BSP_USING_DCMI
#define BSP_USING_EXT_FMC_IO
#define BSP_USING_FMC
@@ -1188,12 +1188,12 @@ void rt_stm32407_atk_miniexpolre()
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE(); //
GPIO_Initure.Pin=GPIO_PIN_6;
GPIO_Initure.Mode=GPIO_MODE_OUTPUT_PP;
GPIO_Initure.Mode=GPIO_MODE_OUTPUT_OD;
GPIO_Initure.Pull=GPIO_PULLUP;
GPIO_Initure.Speed=GPIO_SPEED_FREQ_VERY_HIGH;
HAL_GPIO_Init(GPIOD,&GPIO_Initure);
GPIO_Initure.Pin=GPIO_PIN_7;
GPIO_Initure.Mode=GPIO_MODE_OUTPUT_OD;
GPIO_Initure.Mode=GPIO_MODE_OUTPUT_PP;
GPIO_Initure.Pull=GPIO_PULLUP;
GPIO_Initure.Speed=GPIO_SPEED_FREQ_VERY_HIGH;
HAL_GPIO_Init(GPIOD,&GPIO_Initure);
@@ -51,6 +51,12 @@ menu "aiit-arm32-board feature"
endif
endmenu
menu "config board peripheral"
config MOUNT_SDCARD
bool "mount cd card"
default n
select BSP_USING_SDIO
endmenu
endmenu
endmenu
@@ -150,6 +150,24 @@ struct InitSequenceDesc _board_init[] =
{ " NONE ",NONE },
};
#if defined(FS_VFS) && defined(MOUNT_SDCARD)
#include <iot-vfs.h>
/**
* @description: Mount SD card
* @return 0
*/
int MountSDCard(void)
{
if (MountFilesystem(SDIO_BUS_NAME, SDIO_DEVICE_NAME, SDIO_DRIVER_NAME, FSTYPE_FATFS, "/") == 0)
DBG("sd card mount to '/'");
else
SYS_WARN("sd card mount to '/' failed!");
return 0;
}
#endif
void InitBoardHardware()
{
int i = 0;
@@ -53,6 +53,13 @@ menu "aiit-riscv64-board feature"
endif
endmenu
menu "config board peripheral"
config MOUNT_SDCARD
bool "mount cd card"
default n
select BSP_USING_SDIO
endmenu
endmenu
config __STACKSIZE__
@@ -64,6 +64,28 @@ extern int HwRtcInit(void);
extern int HwTouchBusInit(void);
extern int HwCh376Init(void);
#if defined(FS_VFS) && defined(MOUNT_SDCARD)
#include <iot-vfs.h>
/**
* @description: Mount SD card
* @return 0
*/
/**
* @description: Mount SD card
* @return 0
*/
int MountSDCard(void)
{
if (MountFilesystem(SDIO_BUS_NAME, SDIO_DEVICE_NAME, SDIO_DRIVER_NAME, FSTYPE_CH376, "/") == 0)
DBG("sd card mount to '/'");
else
SYS_WARN("sd card mount to '/' failed!");
return 0;
}
#endif
void init_bss(void)
{
unsigned int *dst;
+9
View File
@@ -58,6 +58,15 @@ menu "kd233 feature"
endmenu
menu "config board peripheral"
config MOUNT_SDCARD
bool "mount cd card"
default n
select BSP_USING_SPI
select BSP_USING_SPI1
select RESOURCES_SPI_SD
endmenu
endmenu
config __STACKSIZE__
+26
View File
@@ -62,6 +62,32 @@ extern int HwWdtInit(void);
extern int HwLcdInit(void);
extern int HwTimerInit(void);
#if defined(FS_VFS) && defined (MOUNT_SDCARD)
#include <iot-vfs.h>
#include <sd_spi.h>
extern SpiSdDeviceType SpiSdInit(struct Bus *bus, const char *dev_name, const char *drv_name, const char *sd_name);
/**
* @description: Mount SD card
* @return 0
*/
int MountSDCard(void)
{
struct Bus *spi_bus;
spi_bus = BusFind(SPI_BUS_NAME_1);
if (NONE == SpiSdInit(spi_bus, SPI_1_DEVICE_NAME_0, SPI_1_DRV_NAME, SPI_SD_NAME)) {
KPrintf("MountSDCard SpiSdInit error!\n");
return 0;
}
if (EOK == MountFilesystem(SPI_BUS_NAME_1, SPI_SD_NAME, SPI_1_DRV_NAME, FSTYPE_FATFS, "/"))
KPrintf("SPI SD card fatfs mounted\n");
return 0;
}
#endif
void InitBss(void)
{
unsigned int *dst;
@@ -45,7 +45,6 @@ extern int RtcNtpSyncInit(void);
extern int MountSDCard(void);
extern int DfsMountTable(void);
extern int userShellInit(void);
extern int Stm32SdcardMount(void);
extern int STM32USBHostRegister(void);
extern int WorkSysWorkQueueInit(void);
@@ -159,6 +159,7 @@ int32 KTaskCreate(const char *name,
void KTaskQuit(void);
#ifdef SEPARATE_COMPILE
int UTaskSearch(void);
int32 UTaskCreate(const char *name,
void (*entry)(void *parameter),
void *parameter,
@@ -33,6 +33,7 @@ enum KernelServiceEnum
KS_USER_TASK_CREATE ,
KS_USER_TASK_STARTUP ,
KS_USER_TASK_DELETE,
KS_USER_TASK_SEARCH,
KS_USER_TASK_EXECEXIT,
KS_USER_TASK_CORE_COMBINE,
KS_USER_TASK_CORE_UNCOMBINE,
@@ -25,6 +25,8 @@
#include <xs_sem.h>
#include <xs_memory.h>
#include <xs_mutex.h>
#include <xs_event.h>
#include <xs_msg.h>
#ifdef FS_VFS
#include <iot-vfs_posix.h>
@@ -118,6 +120,11 @@ uintptr_t KsTaskDelete(uint32_t knum,uintptr_t *param, uint8_t num)
return (uintptr_t)ret;
}
uintptr_t KsUserTaskSerach(uint32_t knum,uintptr_t *param, uint8_t num )
{
return (uintptr_t)UTaskSearch();
}
extern void KTaskQuit(void);
uintptr_t KsTaskQuit(uint32_t knum,uintptr_t *param, uint8_t num )
{
@@ -565,6 +572,7 @@ struct KernelService g_service_table[256] __attribute__ ((section (".g_service_
[KS_USER_TASK_CREATE] = { KsTaskCreate, 5 },
[KS_USER_TASK_STARTUP] = { KsStartupTask, 1 },
[KS_USER_TASK_DELETE] = { KsTaskDelete, 1 },
[KS_USER_TASK_SEARCH] = { KsUserTaskSerach, 0 },
[KS_USER_TASK_EXECEXIT] = { KsTaskQuit, 0 },
[KS_USER_TASK_CORE_COMBINE] = { KsTaskCoreCombine, 2 },
[KS_USER_TASK_CORE_UNCOMBINE] = { KsTaskCoreUnCombine, 1 },
+33 -10
View File
@@ -350,11 +350,12 @@ static void* BigMemMalloc(struct DynamicBuddyMemory *dynamic_buddy, x_size_t siz
/* best-fit method */
for (node = dynamic_buddy->mm_freenode_list[ndx].next;
node && (node->size < allocsize);
(ndx < MEM_LINKNRS ) && (node->size < allocsize);
node = node->next) {
ndx++;
};
/* get the best-fit freeNode */
if (node && (node->size > allocsize)) {
if (node && (node->size >= allocsize)) {
struct DynamicFreeNode *remainder;
struct DynamicFreeNode *next;
uint32 remaining;
@@ -1197,25 +1198,47 @@ SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHE
*/
void ShowBuddy(void)
{
int i = 0;
int lock = 0;
struct DynamicFreeNode *debug = NONE;
lock = CriticalAreaLock();
KPrintf("\n\033[41;1mlist memory information\033[0m\n", __func__);
for (debug = ByteManager.dynamic_buddy_manager.mm_freenode_list[0].next;
debug;debug = debug->next){
KPrintf("%s,current is %x,next is %x, size %u, flag %x\n",__func__, debug, debug->next,debug->size,debug->flag);
};
for(int level = 0; level < MEM_LINKNRS; level++) {
KPrintf("\n %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)
break;
};
}
KPrintf("\nlist memory information\n\n");
#ifdef MEM_EXTERN_SRAM
for(i = 0; i < EXTSRAM_MAX_NUM; i++) {
if(NONE != ExtByteManager[i].done){
KPrintf("\nlist extern sram[%d] memory information\n\n",i);
for (debug = ExtByteManager[i].dynamic_buddy_manager.mm_freenode_list[0].next;
debug;debug = debug->next){
KPrintf("%s,current is %x,next is %x, size %u, flag %x\n",__func__, debug, debug->next,debug->size,debug->flag);
};
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)
break;
}
}
}
}
+3 -6
View File
@@ -104,11 +104,11 @@ struct InitSequenceDesc components_init[] =
};
struct InitSequenceDesc env_init[] =
{
#ifdef ARCH_RISCV
#if defined (RESOURCES_SPI_SD)|| defined(RESOURCES_SDIO )
#ifdef MOUNT_SDCARD
{ "MountSDCard", MountSDCard },
#endif
#endif
#ifdef FS_VFS_MNTTABLE
{ "DfsMountTable", DfsMountTable },
#endif
@@ -119,9 +119,6 @@ struct InitSequenceDesc env_init[] =
};
struct InitSequenceDesc communication_init[] =
{
// #ifdef BSP_USING_SDIO
// { "Stm32SdcardMount",Stm32SdcardMount },
// #endif
#ifdef BSP_USING_USBH
{ "STM32USBHostRegister", STM32USBHostRegister },
{ "hw usb", Stm32HwUsbInit },
+30
View File
@@ -1052,6 +1052,36 @@ x_err_t KTaskWakeup(int32 id)
#ifdef SEPARATE_COMPILE
/**
* find the first user task in manage list.
*
* @param
*
* @note in interrupt status,this function is not permitted to call.
*/
int UTaskSearch(void)
{
x_base lock = 0;
KTaskDescriptorType temp_task = NONE;
struct SysDoubleLinklistNode *node = NONE;
lock = CriticalAreaLock();
DOUBLE_LINKLIST_FOR_EACH(node,&xiaoshan_task_head)
{
temp_task = SYS_DOUBLE_LINKLIST_ENTRY(node, struct TaskDescriptor, link);
if (1 == temp_task->task_dync_sched_member.isolation_flag)
{
CriticalAreaUnLock(lock);
return temp_task->id.id;
}
}
CriticalAreaUnLock(lock);
return -1;
}
/**
*
* This function init a user task in dynamic way .