fix: 内源代码检视问题
【背景】内源代码检视问题 【修改方案】 1,按检视意见,进行资源泄露等问题的修改 【影响】 对现有的产品编译不会有影响。 re #I4WV56 Signed-off-by: wangchen <wangchen64@huawei.com>
This commit is contained in:
parent
7e284239b3
commit
43baa4fdc4
|
@ -179,7 +179,6 @@ exc_entry:
|
||||||
csrr a0, mcause
|
csrr a0, mcause
|
||||||
mv a1, sp
|
mv a1, sp
|
||||||
/*
|
/*
|
||||||
* TODO: Call the exception handler function
|
|
||||||
* By default, the function template is provided in
|
* By default, the function template is provided in
|
||||||
* system_Device.c, you can adjust it as you want
|
* system_Device.c, you can adjust it as you want
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -336,19 +336,19 @@ int LfsMount(const char *source, const char *target, const char *fileSystemType,
|
||||||
if (target == NULL || fileSystemType == NULL || data == NULL) {
|
if (target == NULL || fileSystemType == NULL || data == NULL) {
|
||||||
errno = EFAULT;
|
errno = EFAULT;
|
||||||
ret = VFS_ERROR;
|
ret = VFS_ERROR;
|
||||||
goto errout;
|
goto ERROUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(fileSystemType, "littlefs") != 0) {
|
if (strcmp(fileSystemType, "littlefs") != 0) {
|
||||||
errno = ENODEV;
|
errno = ENODEV;
|
||||||
ret = VFS_ERROR;
|
ret = VFS_ERROR;
|
||||||
goto errout;
|
goto ERROUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CheckPathIsMounted(target, &fileOpInfo)) {
|
if (CheckPathIsMounted(target, &fileOpInfo)) {
|
||||||
errno = EBUSY;
|
errno = EBUSY;
|
||||||
ret = VFS_ERROR;
|
ret = VFS_ERROR;
|
||||||
goto errout;
|
goto ERROUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// select free mount resource
|
// select free mount resource
|
||||||
|
@ -356,7 +356,7 @@ int LfsMount(const char *source, const char *target, const char *fileSystemType,
|
||||||
if (fileOpInfo == NULL) {
|
if (fileOpInfo == NULL) {
|
||||||
errno = ENODEV;
|
errno = ENODEV;
|
||||||
ret = VFS_ERROR;
|
ret = VFS_ERROR;
|
||||||
goto errout;
|
goto ERROUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = lfs_mount(&(fileOpInfo->lfsInfo), (struct lfs_config*)data);
|
ret = lfs_mount(&(fileOpInfo->lfsInfo), (struct lfs_config*)data);
|
||||||
|
@ -372,7 +372,7 @@ int LfsMount(const char *source, const char *target, const char *fileSystemType,
|
||||||
ret = VFS_ERROR;
|
ret = VFS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
errout:
|
ERROUT:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,23 +483,23 @@ DIR *LfsOpendir(const char *dirName)
|
||||||
|
|
||||||
if (dirName == NULL) {
|
if (dirName == NULL) {
|
||||||
errno = EFAULT;
|
errno = EFAULT;
|
||||||
goto errout;
|
goto ERROUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CheckPathIsMounted(dirName, &fileOpInfo) == FALSE || fileOpInfo == NULL) {
|
if (CheckPathIsMounted(dirName, &fileOpInfo) == FALSE || fileOpInfo == NULL) {
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
goto errout;
|
goto ERROUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CheckDirIsOpen(dirName)) {
|
if (CheckDirIsOpen(dirName)) {
|
||||||
errno = EBUSY;
|
errno = EBUSY;
|
||||||
goto errout;
|
goto ERROUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileDirInfo *dirInfo = GetFreeDir(dirName);
|
FileDirInfo *dirInfo = GetFreeDir(dirName);
|
||||||
if (dirInfo == NULL) {
|
if (dirInfo == NULL) {
|
||||||
errno = ENFILE;
|
errno = ENFILE;
|
||||||
goto errout;
|
goto ERROUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = lfs_dir_open(&(fileOpInfo->lfsInfo), (lfs_dir_t *)(&(dirInfo->dir)), dirName);
|
ret = lfs_dir_open(&(fileOpInfo->lfsInfo), (lfs_dir_t *)(&(dirInfo->dir)), dirName);
|
||||||
|
@ -507,14 +507,14 @@ DIR *LfsOpendir(const char *dirName)
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
FreeDirInfo(dirName);
|
FreeDirInfo(dirName);
|
||||||
errno = LittlefsErrno(ret);
|
errno = LittlefsErrno(ret);
|
||||||
goto errout;
|
goto ERROUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
dirInfo->lfsHandle = &(fileOpInfo->lfsInfo);
|
dirInfo->lfsHandle = &(fileOpInfo->lfsInfo);
|
||||||
|
|
||||||
return (DIR *)dirInfo;
|
return (DIR *)dirInfo;
|
||||||
|
|
||||||
errout:
|
ERROUT:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,23 +584,23 @@ int LfsOpen(const char *pathName, int openFlag, ...)
|
||||||
|
|
||||||
if (pathName == NULL) {
|
if (pathName == NULL) {
|
||||||
errno = EFAULT;
|
errno = EFAULT;
|
||||||
goto errout;
|
goto ERROUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CheckPathIsMounted(pathName, &fileOpInfo) == FALSE || fileOpInfo == NULL) {
|
if (CheckPathIsMounted(pathName, &fileOpInfo) == FALSE || fileOpInfo == NULL) {
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
goto errout;
|
goto ERROUT;
|
||||||
}
|
}
|
||||||
// if file is already open, return invalid fd
|
// if file is already open, return invalid fd
|
||||||
if (CheckFileIsOpen(pathName)) {
|
if (CheckFileIsOpen(pathName)) {
|
||||||
errno = EBUSY;
|
errno = EBUSY;
|
||||||
goto errout;
|
goto ERROUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
LittleFsHandleStruct *fsHandle = LfsAllocFd(pathName, &fd);
|
LittleFsHandleStruct *fsHandle = LfsAllocFd(pathName, &fd);
|
||||||
if (fd == INVALID_FD) {
|
if (fd == INVALID_FD) {
|
||||||
errno = ENFILE;
|
errno = ENFILE;
|
||||||
goto errout;
|
goto ERROUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lfsOpenFlag = ConvertFlagToLfsOpenFlag(openFlag);
|
int lfsOpenFlag = ConvertFlagToLfsOpenFlag(openFlag);
|
||||||
|
@ -608,13 +608,13 @@ int LfsOpen(const char *pathName, int openFlag, ...)
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
LfsFreeFd(fd);
|
LfsFreeFd(fd);
|
||||||
errno = LittlefsErrno(err);
|
errno = LittlefsErrno(err);
|
||||||
goto errout;
|
goto ERROUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_handle[fd].lfsHandle = &(fileOpInfo->lfsInfo);
|
g_handle[fd].lfsHandle = &(fileOpInfo->lfsInfo);
|
||||||
return fd;
|
return fd;
|
||||||
|
|
||||||
errout:
|
ERROUT:
|
||||||
return INVALID_FD;
|
return INVALID_FD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -182,11 +182,12 @@ VOID LOS_LmsCheckPoolDel(const VOID *pool)
|
||||||
LmsMemListNode *delNode = OsLmsGetPoolNode(pool);
|
LmsMemListNode *delNode = OsLmsGetPoolNode(pool);
|
||||||
if (delNode == NULL) {
|
if (delNode == NULL) {
|
||||||
PRINT_ERR("[LMS]pool %p is not on lms checklist !\n", pool);
|
PRINT_ERR("[LMS]pool %p is not on lms checklist !\n", pool);
|
||||||
goto Release;
|
goto REALEASE;
|
||||||
}
|
}
|
||||||
delNode->used = LMS_POOL_UNUSED;
|
delNode->used = LMS_POOL_UNUSED;
|
||||||
LOS_ListDelete(&(delNode->node));
|
LOS_ListDelete(&(delNode->node));
|
||||||
Release:
|
|
||||||
|
REALEASE:
|
||||||
LMS_UNLOCK(intSave);
|
LMS_UNLOCK(intSave);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -605,6 +605,8 @@ u32_t OsShellPing(int argc, const char **argv)
|
||||||
PRINTK("Ping cmd failed due some errors\n");
|
PRINTK("Ping cmd failed due some errors\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(parg);
|
||||||
|
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
ping_error:
|
ping_error:
|
||||||
lwip_ping_usage();
|
lwip_ping_usage();
|
||||||
|
|
|
@ -1634,7 +1634,7 @@ uint32_t osMemoryPoolGetSpace(osMemoryPoolId_t mp_id)
|
||||||
if ((mp->status & MEM_POOL_VALID) != MEM_POOL_VALID) {
|
if ((mp->status & MEM_POOL_VALID) != MEM_POOL_VALID) {
|
||||||
space = 0;
|
space = 0;
|
||||||
} else {
|
} else {
|
||||||
space = mp->poolInfo.uwBlkCnt - mp->poolInfo.uwBlkCnt;
|
space = mp->poolInfo.uwBlkNum - mp->poolInfo.uwBlkCnt;
|
||||||
}
|
}
|
||||||
LOS_IntRestore(intSave);
|
LOS_IntRestore(intSave);
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,6 @@ exc_entry:
|
||||||
csrr a0, mcause
|
csrr a0, mcause
|
||||||
mv a1, sp
|
mv a1, sp
|
||||||
/*
|
/*
|
||||||
* TODO: Call the exception handler function
|
|
||||||
* By default, the function template is provided in
|
* By default, the function template is provided in
|
||||||
* system_Device.c, you can adjust it as you want
|
* system_Device.c, you can adjust it as you want
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -30,8 +30,6 @@
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Define clocks
|
Define clocks
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
/* ToDo: add here your necessary defines for device initialization
|
|
||||||
following is an example for different system frequencies */
|
|
||||||
#ifndef SYSTEM_CLOCK
|
#ifndef SYSTEM_CLOCK
|
||||||
#define SYSTEM_CLOCK (80000000UL)
|
#define SYSTEM_CLOCK (80000000UL)
|
||||||
#endif
|
#endif
|
||||||
|
@ -71,9 +69,6 @@
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
System Core Clock Variable
|
System Core Clock Variable
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
/* ToDo: initialize SystemCoreClock with the system core clock frequency value
|
|
||||||
achieved after system intitialization.
|
|
||||||
This means system core clock frequency after call to SystemInit() */
|
|
||||||
/**
|
/**
|
||||||
* \brief Variable to hold the system core clock value
|
* \brief Variable to hold the system core clock value
|
||||||
* \details
|
* \details
|
||||||
|
@ -101,9 +96,7 @@ uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Clock Frequency (Core Clock)
|
||||||
*/
|
*/
|
||||||
void SystemCoreClockUpdate(void) /* Get Core Clock Frequency */
|
void SystemCoreClockUpdate(void) /* Get Core Clock Frequency */
|
||||||
{
|
{
|
||||||
/* ToDo: add code to calculate the system frequency based upon the current
|
/* Note: This function can be used to retrieve the system core clock frequeny
|
||||||
* register settings.
|
|
||||||
* Note: This function can be used to retrieve the system core clock frequeny
|
|
||||||
* after user changed register settings.
|
* after user changed register settings.
|
||||||
*/
|
*/
|
||||||
SystemCoreClock = SYSTEM_CLOCK;
|
SystemCoreClock = SYSTEM_CLOCK;
|
||||||
|
@ -119,8 +112,7 @@ void SystemCoreClockUpdate(void) /* Get Core Clock Frequency */
|
||||||
*/
|
*/
|
||||||
void SystemInit(void)
|
void SystemInit(void)
|
||||||
{
|
{
|
||||||
/* ToDo: add code to initialize the system
|
/* Warn: do not use global variables because this function is called before
|
||||||
* Warn: do not use global variables because this function is called before
|
|
||||||
* reaching pre-main. RW section maybe overwritten afterwards.
|
* reaching pre-main. RW section maybe overwritten afterwards.
|
||||||
*/
|
*/
|
||||||
SystemCoreClock = SYSTEM_CLOCK;
|
SystemCoreClock = SYSTEM_CLOCK;
|
||||||
|
@ -164,7 +156,6 @@ typedef void (*EXC_HANDLER)(unsigned long mcause, unsigned long sp);
|
||||||
*/
|
*/
|
||||||
static void system_default_exception_handler(unsigned long mcause, unsigned long sp)
|
static void system_default_exception_handler(unsigned long mcause, unsigned long sp)
|
||||||
{
|
{
|
||||||
/* TODO: Uncomment this if you have implement printf function */
|
|
||||||
printf("MCAUSE : 0x%lx\r\n", mcause);
|
printf("MCAUSE : 0x%lx\r\n", mcause);
|
||||||
printf("MDCAUSE: 0x%lx\r\n", __RV_CSR_READ(CSR_MDCAUSE));
|
printf("MDCAUSE: 0x%lx\r\n", __RV_CSR_READ(CSR_MDCAUSE));
|
||||||
printf("MEPC : 0x%lx\r\n", __RV_CSR_READ(CSR_MEPC));
|
printf("MEPC : 0x%lx\r\n", __RV_CSR_READ(CSR_MEPC));
|
||||||
|
@ -276,7 +267,6 @@ void SystemBannerPrint(void)
|
||||||
void ECLIC_Init(void)
|
void ECLIC_Init(void)
|
||||||
{
|
{
|
||||||
/* Global Configuration about MTH and NLBits.
|
/* Global Configuration about MTH and NLBits.
|
||||||
* TODO: Please adapt it according to your system requirement.
|
|
||||||
* This function is called in _init function */
|
* This function is called in _init function */
|
||||||
ECLIC_SetMth(0);
|
ECLIC_SetMth(0);
|
||||||
ECLIC_SetCfgNlbits(__ECLIC_INTCTLBITS);
|
ECLIC_SetCfgNlbits(__ECLIC_INTCTLBITS);
|
||||||
|
@ -333,7 +323,6 @@ int32_t ECLIC_Register_IRQ(IRQn_Type IRQn, uint8_t shv, ECLIC_TRIGGER_Type trig_
|
||||||
*/
|
*/
|
||||||
void _premain_init(void)
|
void _premain_init(void)
|
||||||
{
|
{
|
||||||
/* TODO: Add your own initialization code here, called before main */
|
|
||||||
/* __ICACHE_PRESENT and __DCACHE_PRESENT are defined in demosoc.h */
|
/* __ICACHE_PRESENT and __DCACHE_PRESENT are defined in demosoc.h */
|
||||||
#if defined(__ICACHE_PRESENT) && __ICACHE_PRESENT == 1
|
#if defined(__ICACHE_PRESENT) && __ICACHE_PRESENT == 1
|
||||||
EnableICache();
|
EnableICache();
|
||||||
|
@ -363,7 +352,6 @@ void _premain_init(void)
|
||||||
*/
|
*/
|
||||||
void _postmain_fini(int status)
|
void _postmain_fini(int status)
|
||||||
{
|
{
|
||||||
/* TODO: Add your own finishing code here, called after main */
|
|
||||||
#ifdef SIMULATION_XLSPIKE
|
#ifdef SIMULATION_XLSPIKE
|
||||||
extern void xlspike_exit(int status);
|
extern void xlspike_exit(int status);
|
||||||
xlspike_exit(status);
|
xlspike_exit(status);
|
||||||
|
|
|
@ -8,27 +8,27 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2019, GigaDevice Semiconductor Inc.
|
Copyright (c) 2019, GigaDevice Semiconductor Inc.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
are permitted provided that the following conditions are met:
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright notice, this
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
list of conditions and the following disclaimer.
|
list of conditions and the following disclaimer.
|
||||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
this list of conditions and the following disclaimer in the documentation
|
this list of conditions and the following disclaimer in the documentation
|
||||||
and/or other materials provided with the distribution.
|
and/or other materials provided with the distribution.
|
||||||
3. Neither the name of the copyright holder nor the names of its contributors
|
3. Neither the name of the copyright holder nor the names of its contributors
|
||||||
may be used to endorse or promote products derived from this software without
|
may be used to endorse or promote products derived from this software without
|
||||||
specific prior written permission.
|
specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
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,
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
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
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
OF SUCH DAMAGE.
|
OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#include "gd32vf103_libopt.h"
|
#include "gd32vf103_libopt.h"
|
||||||
|
@ -80,7 +80,6 @@ uint32_t USBD_OTG_EP1OUT_ISR_Handler (usb_core_driver *udev)
|
||||||
{
|
{
|
||||||
oeplen = udev->regs.er_out[1]->DOEPLEN;
|
oeplen = udev->regs.er_out[1]->DOEPLEN;
|
||||||
|
|
||||||
/* ToDo : handle more than one single MPS size packet */
|
|
||||||
udev->dev.transc_out[1].xfer_count = udev->dev.transc_out[1].usb_transc - \
|
udev->dev.transc_out[1].xfer_count = udev->dev.transc_out[1].usb_transc - \
|
||||||
oeplen & DEPLEN_TLEN;
|
oeplen & DEPLEN_TLEN;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +181,7 @@ void usbd_isr (usb_core_driver *udev)
|
||||||
/* start of frame interrupt */
|
/* start of frame interrupt */
|
||||||
if (intr & GINTF_SOF) {
|
if (intr & GINTF_SOF) {
|
||||||
if (udev->dev.class_core->SOF) {
|
if (udev->dev.class_core->SOF) {
|
||||||
udev->dev.class_core->SOF(udev);
|
udev->dev.class_core->SOF(udev);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0U != setupc_flag) {
|
if (0U != setupc_flag) {
|
||||||
|
|
|
@ -169,7 +169,6 @@ exc_entry:
|
||||||
csrr a0, mcause
|
csrr a0, mcause
|
||||||
mv a1, sp
|
mv a1, sp
|
||||||
/*
|
/*
|
||||||
* TODO: Call the exception handler function
|
|
||||||
* By default, the function template is provided in
|
* By default, the function template is provided in
|
||||||
* system_Device.c, you can adjust it as you want
|
* system_Device.c, you can adjust it as you want
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -31,8 +31,6 @@
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Define clocks
|
Define clocks
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
/* ToDo: add here your necessary defines for device initialization
|
|
||||||
following is an example for different system frequencies */
|
|
||||||
#ifndef SYSTEM_CLOCK
|
#ifndef SYSTEM_CLOCK
|
||||||
#define SYSTEM_CLOCK __SYSTEM_CLOCK_108M_PLL_HXTAL
|
#define SYSTEM_CLOCK __SYSTEM_CLOCK_108M_PLL_HXTAL
|
||||||
#endif
|
#endif
|
||||||
|
@ -66,9 +64,6 @@
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
System Core Clock Variable
|
System Core Clock Variable
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
/* ToDo: initialize SystemCoreClock with the system core clock frequency value
|
|
||||||
achieved after system intitialization.
|
|
||||||
This means system core clock frequency after call to SystemInit() */
|
|
||||||
/**
|
/**
|
||||||
* \brief Variable to hold the system core clock value
|
* \brief Variable to hold the system core clock value
|
||||||
* \details
|
* \details
|
||||||
|
@ -200,9 +195,7 @@ static void system_clock_config(void)
|
||||||
*/
|
*/
|
||||||
void SystemCoreClockUpdate (void) /* Get Core Clock Frequency */
|
void SystemCoreClockUpdate (void) /* Get Core Clock Frequency */
|
||||||
{
|
{
|
||||||
/* ToDo: add code to calculate the system frequency based upon the current
|
/* Note: This function can be used to retrieve the system core clock
|
||||||
* register settings.
|
|
||||||
* Note: This function can be used to retrieve the system core clock
|
|
||||||
* frequeny after user changed register settings.
|
* frequeny after user changed register settings.
|
||||||
*/
|
*/
|
||||||
uint32_t scss;
|
uint32_t scss;
|
||||||
|
@ -288,8 +281,7 @@ void SystemCoreClockUpdate (void) /* Get Core Clock Frequency */
|
||||||
*/
|
*/
|
||||||
void SystemInit (void)
|
void SystemInit (void)
|
||||||
{
|
{
|
||||||
/* ToDo: add code to initialize the system
|
/* Warn: do not use global variables because this function is called before
|
||||||
* Warn: do not use global variables because this function is called before
|
|
||||||
* reaching pre-main. RW section maybe overwritten afterwards.
|
* reaching pre-main. RW section maybe overwritten afterwards.
|
||||||
*/
|
*/
|
||||||
/* reset the RCC clock configuration to the default reset state */
|
/* reset the RCC clock configuration to the default reset state */
|
||||||
|
@ -359,7 +351,6 @@ typedef void (*EXC_HANDLER) (unsigned long mcause, unsigned long sp);
|
||||||
*/
|
*/
|
||||||
static void system_default_exception_handler(unsigned long mcause, unsigned long sp)
|
static void system_default_exception_handler(unsigned long mcause, unsigned long sp)
|
||||||
{
|
{
|
||||||
/* TODO: Uncomment this if you have implement printf function */
|
|
||||||
printf("MCAUSE: 0x%lx\r\n", mcause);
|
printf("MCAUSE: 0x%lx\r\n", mcause);
|
||||||
printf("MEPC : 0x%lx\r\n", __RV_CSR_READ(CSR_MEPC));
|
printf("MEPC : 0x%lx\r\n", __RV_CSR_READ(CSR_MEPC));
|
||||||
printf("MTVAL : 0x%lx\r\n", __RV_CSR_READ(CSR_MBADADDR));
|
printf("MTVAL : 0x%lx\r\n", __RV_CSR_READ(CSR_MBADADDR));
|
||||||
|
@ -435,7 +426,7 @@ uint32_t core_exception_handler(unsigned long mcause, unsigned long sp)
|
||||||
PRINTK("----------------All Task infomation ------------\r\n");
|
PRINTK("----------------All Task infomation ------------\r\n");
|
||||||
HalDisplayTaskInfo();
|
HalDisplayTaskInfo();
|
||||||
PRINTK("---------------exc handler infomation -----------\r\n");
|
PRINTK("---------------exc handler infomation -----------\r\n");
|
||||||
|
|
||||||
if ((EXCn < MAX_SYSTEM_EXCEPTION_NUM) && (EXCn >= 0)) {
|
if ((EXCn < MAX_SYSTEM_EXCEPTION_NUM) && (EXCn >= 0)) {
|
||||||
exc_handler = (EXC_HANDLER)SystemExceptionHandlers[EXCn];
|
exc_handler = (EXC_HANDLER)SystemExceptionHandlers[EXCn];
|
||||||
} else if (EXCn == NMI_EXCn) {
|
} else if (EXCn == NMI_EXCn) {
|
||||||
|
@ -471,7 +462,6 @@ void SystemBannerPrint(void)
|
||||||
*/
|
*/
|
||||||
void ECLIC_Init(void)
|
void ECLIC_Init(void)
|
||||||
{
|
{
|
||||||
/* TODO: Add your own initialization code here. This function will be called by main */
|
|
||||||
ECLIC_SetMth(0);
|
ECLIC_SetMth(0);
|
||||||
ECLIC_SetCfgNlbits(__ECLIC_INTCTLBITS);
|
ECLIC_SetCfgNlbits(__ECLIC_INTCTLBITS);
|
||||||
}
|
}
|
||||||
|
@ -527,7 +517,6 @@ int32_t ECLIC_Register_IRQ(IRQn_Type IRQn, uint8_t shv, ECLIC_TRIGGER_Type trig_
|
||||||
*/
|
*/
|
||||||
void _premain_init(void)
|
void _premain_init(void)
|
||||||
{
|
{
|
||||||
/* TODO: Add your own initialization code here, called before main */
|
|
||||||
SystemCoreClock = get_cpu_freq();
|
SystemCoreClock = get_cpu_freq();
|
||||||
/* configure USART */
|
/* configure USART */
|
||||||
gd_com_init(SOC_DEBUG_UART);
|
gd_com_init(SOC_DEBUG_UART);
|
||||||
|
@ -550,7 +539,6 @@ void _premain_init(void)
|
||||||
*/
|
*/
|
||||||
void _postmain_fini(int status)
|
void _postmain_fini(int status)
|
||||||
{
|
{
|
||||||
/* TODO: Add your own finishing code here, called after main */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -52,7 +52,6 @@ static UINT32 TestCase(VOID)
|
||||||
ICUNIT_GOTO_EQUAL(1, 0, 0, EXIT);
|
ICUNIT_GOTO_EQUAL(1, 0, 0, EXIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
size = size;
|
|
||||||
p0 = LOS_MemAlloc(g_memPool, size);
|
p0 = LOS_MemAlloc(g_memPool, size);
|
||||||
ICUNIT_GOTO_EQUAL(p0, NULL, p0, EXIT);
|
ICUNIT_GOTO_EQUAL(p0, NULL, p0, EXIT);
|
||||||
|
|
||||||
|
|
|
@ -33,21 +33,23 @@
|
||||||
#include "It_los_mem.h"
|
#include "It_los_mem.h"
|
||||||
|
|
||||||
#if (LOSCFG_MEM_MUL_REGIONS == 1)
|
#if (LOSCFG_MEM_MUL_REGIONS == 1)
|
||||||
|
#define TC_POOL_SIZE_1 0x200
|
||||||
|
#define TC_POOL_SIZE_2 0x400
|
||||||
|
#define TC_GAP_SIZE 0x10
|
||||||
|
|
||||||
// simulate two non-continuous memory regions
|
// simulate two non-continuous memory regions
|
||||||
STATIC UINT8 g_memPool_TC46_01[0x200];
|
STATIC UINT8 g_memPool_TC46_01[TC_POOL_SIZE_1];
|
||||||
STATIC UINT8 g_memGap_TC46[0x10];
|
STATIC UINT8 g_memGap_TC46[TC_GAP_SIZE];
|
||||||
STATIC UINT8 g_memPool_TC46_02[0x400];
|
STATIC UINT8 g_memPool_TC46_02[TC_POOL_SIZE_2];
|
||||||
|
|
||||||
static UINT32 TestCase(VOID)
|
static UINT32 TestCase(VOID)
|
||||||
{
|
{
|
||||||
UINT32 ret;
|
UINT32 ret;
|
||||||
void *p = NULL;
|
void *p = NULL;
|
||||||
LosMemRegion memRegions[] =
|
LosMemRegion memRegions[] = {
|
||||||
{
|
{g_memPool_TC46_01, TC_POOL_SIZE_1},
|
||||||
{g_memPool_TC46_01, 0x200},
|
{g_memPool_TC46_02, TC_POOL_SIZE_2}
|
||||||
{g_memPool_TC46_02, 0x400}
|
};
|
||||||
};
|
|
||||||
|
|
||||||
// Initialize the LOS_MemRegionsAdd
|
// Initialize the LOS_MemRegionsAdd
|
||||||
ret = LOS_MemRegionsAdd(m_aucSysMem0, memRegions, sizeof(memRegions) / sizeof(memRegions[0]));
|
ret = LOS_MemRegionsAdd(m_aucSysMem0, memRegions, sizeof(memRegions) / sizeof(memRegions[0]));
|
||||||
|
@ -56,8 +58,8 @@ static UINT32 TestCase(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// p points to the start address of the gap node between g_memPool_TC46_01 and g_memPool_TC46_02
|
// p points to the start address of the gap node between g_memPool_TC46_01 and g_memPool_TC46_02
|
||||||
p = g_memPool_TC46_01 + 0x200;
|
p = g_memPool_TC46_01 + TC_POOL_SIZE_1;
|
||||||
(void)memset_s(g_memGap_TC46, 0x10, 1, 0x10);
|
(void)memset_s(g_memGap_TC46, TC_GAP_SIZE, 1, TC_GAP_SIZE);
|
||||||
|
|
||||||
ret = LOS_MemFree(m_aucSysMem0, p);
|
ret = LOS_MemFree(m_aucSysMem0, p);
|
||||||
ICUNIT_GOTO_EQUAL(ret, LOS_NOK, ret, EXIT);
|
ICUNIT_GOTO_EQUAL(ret, LOS_NOK, ret, EXIT);
|
||||||
|
@ -76,6 +78,3 @@ VOID ItLosMem046(void)
|
||||||
{
|
{
|
||||||
TEST_ADD_CASE("ItLosMem046", TestCase, TEST_LOS, TEST_MEM, TEST_LEVEL1, TEST_FUNCTION);
|
TEST_ADD_CASE("ItLosMem046", TestCase, TEST_LOS, TEST_MEM, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -680,7 +680,7 @@ LITE_TEST_CASE(PthreadFuncTestSuite, testPthread009, Function | MediumTest | Lev
|
||||||
|
|
||||||
ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
|
ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||||
|
|
||||||
for (i = 0; i < TEST_THREAD_COUNT; i++) {
|
for (i = 0; i < TEST_THREAD_COUNT; i++) {
|
||||||
ret = pthread_create(&thread[i], &attr, pthread_prio_f01, TEST_THREAD_COUNT - i);
|
ret = pthread_create(&thread[i], &attr, pthread_prio_f01, TEST_THREAD_COUNT - i);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||||
|
@ -731,7 +731,7 @@ LITE_TEST_CASE(PthreadFuncTestSuite, testPthread010, Function | MediumTest | Lev
|
||||||
|
|
||||||
ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
|
ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||||
|
|
||||||
for (i = 0; i < TEST_THREAD_COUNT; i++) {
|
for (i = 0; i < TEST_THREAD_COUNT; i++) {
|
||||||
ret = pthread_once(&onceControl, pthread_once_f01);
|
ret = pthread_once(&onceControl, pthread_once_f01);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||||
|
@ -779,7 +779,7 @@ LITE_TEST_CASE(PthreadFuncTestSuite, testPthread011, Function | MediumTest | Lev
|
||||||
|
|
||||||
ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
|
ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||||
|
|
||||||
ret = pthread_create(&thread, &attr, pthread_cancel_f01, NULL);
|
ret = pthread_create(&thread, &attr, pthread_cancel_f01, NULL);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||||
|
|
||||||
|
@ -842,7 +842,7 @@ LITE_TEST_CASE(PthreadFuncTestSuite, testPthread012, Function | MediumTest | Lev
|
||||||
|
|
||||||
ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
|
ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||||
|
|
||||||
ret = pthread_create(&thread, &attr, pthread_testcancel_f01, NULL);
|
ret = pthread_create(&thread, &attr, pthread_testcancel_f01, NULL);
|
||||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||||
|
|
||||||
|
@ -965,8 +965,7 @@ LITE_TEST_CASE(PthreadFuncTestSuite, testPthread016, Function | MediumTest | Lev
|
||||||
int ret;
|
int ret;
|
||||||
pthread_mutexattr_init(&mutex_attr);
|
pthread_mutexattr_init(&mutex_attr);
|
||||||
ret = pthread_mutexattr_settype(NULL, PTHREAD_MUTEX_ERRORCHECK);
|
ret = pthread_mutexattr_settype(NULL, PTHREAD_MUTEX_ERRORCHECK);
|
||||||
if (ret == 0)
|
if (ret == 0) {
|
||||||
{
|
|
||||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||||
}
|
}
|
||||||
pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_ERRORCHECK);
|
pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_ERRORCHECK);
|
||||||
|
|
Loading…
Reference in New Issue