!248 同步master到beta2.2

Merge pull request !248 from lnlan/to_beta2.2
This commit is contained in:
openharmony_ci 2021-08-04 08:53:22 +00:00 committed by Gitee
commit d0e0bb5934
24 changed files with 63 additions and 70 deletions

View File

@ -331,7 +331,7 @@ ssize_t read(int fd, void *buf, size_t nbyte)
errno = EINVAL;
return FS_FAILURE;
}
if (nbyte > 1024) {
if (nbyte > 1024) { /* 1024, max random_size */
nbyte = 1024; /* hks_generate_random: random_size must <= 1024 */
}
struct hks_blob key = {HKS_BLOB_TYPE_RAW, (uint8_t *)buf, nbyte};

View File

@ -41,7 +41,7 @@ struct FileOpInfo g_fsOp[LOSCFG_LFS_MAX_MOUNT_SIZE] = {0};
static LittleFsHandleStruct g_handle[LITTLE_FS_MAX_OPEN_FILES] = {0};
struct dirent g_nameValue;
static pthread_mutex_t g_FslocalMutex = PTHREAD_MUTEX_INITIALIZER;
static const char *g_littlefsMntName[LOSCFG_LFS_MAX_MOUNT_SIZE] = {"/a","/b","/c"};
static const char *g_littlefsMntName[LOSCFG_LFS_MAX_MOUNT_SIZE] = {"/a", "/b", "/c"};
LittleFsHandleStruct *LfsAllocFd(const char *fileName, int *fd)
{

View File

@ -242,7 +242,7 @@ static void getifaddrs_internal(struct getifaddrs_arg *arg)
if_storage = new_ifaddrs_storage();
if (if_storage == NULL) {
lwip_freeifaddrs(
*(arg->ifap)); /* ifap is assigned to NULL in getifaddrs, so garbage value will not be there */
*(arg->ifap)); /* ifap is assigned to NULL in getifaddrs, so garbage value will not be there */
arg->ret = ENOMEM;
goto RETURN;
}

View File

@ -47,11 +47,9 @@
#include "lwip/icmp.h"
#include "los_config.h"
#include <string.h>
#include "lwip/api_shell.h"
#include "shcmd.h"
#include "shell.h"
#include "los_timer_pri.h"
#include "los_debug.h"
#include "los_task.h"
@ -104,10 +102,10 @@ int print_netif(struct netif *netif, char *print_buf, unsigned int buf_len)
if (buf_len < 1) {
goto out;
}
if(netif->link_layer_type == LOOPBACK_IF){
ret = snprintf_s(tmp, buf_len, (buf_len-1), "%s\t", netif->name);
if (netif->link_layer_type == LOOPBACK_IF) {
ret = snprintf_s(tmp, buf_len, (buf_len - 1), "%s\t", netif->name);
} else {
ret = snprintf_s(tmp, buf_len, (buf_len-1), "%s%u\t", netif->name, netif->num);
ret = snprintf_s(tmp, buf_len, (buf_len - 1), "%s%u\t", netif->name, netif->num);
}
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
@ -317,8 +315,7 @@ static int ping_kill = 0;
static void lwip_ping_usage(void)
{
PRINTK("Usage:"\
"\n ping [ip]\n"
PRINTK("Usage:\n ping [ip]\n");
}
LWIP_STATIC int OsPingFunc(u32_t *parg)
@ -332,11 +329,11 @@ LWIP_STATIC int OsPingFunc(u32_t *parg)
u32_t iecho_len;
s16_t ip_hlen;
u32_t forever;
u32_t i = 0;
u32_t i;
u32_t succ_cnt = 0;
u32_t failed_cnt = 0;
struct timespec start, end;
long timout_ms = 0;
long timout_ms;
struct pollfd pfd;
long rtt;
int ret = 0;

View File

@ -190,7 +190,7 @@ LITE_OS_SEC_TEXT_MINOR VOID OsCmdAscendingInsert(CmdItemNode *cmd)
}
for (cmdItem = LOS_DL_LIST_ENTRY((&cmdInfo.cmdList.list)->pstPrev, CmdItemNode, list);
&cmdItem->list != &(cmdInfo.cmdList.list);) {
&cmdItem->list != &(cmdInfo.cmdList.list); ) {
cmdNext = LOS_DL_LIST_ENTRY(cmdItem->list.pstPrev, CmdItemNode, list);
if (&cmdNext->list != &(cmdInfo.cmdList.list)) {
if ((strncmp(cmdItem->cmd->cmdKey, cmd->cmd->cmdKey, strlen(cmd->cmd->cmdKey)) >= 0) &&

View File

@ -64,7 +64,7 @@ char *GetCmdName(const char *cmdline, unsigned int len)
{
unsigned int loop;
const char *tmpStr = NULL;
bool quotes = FALSE;
BOOL quotes = FALSE;
char *cmdName = NULL;
if (cmdline == NULL) {
return NULL;
@ -78,7 +78,7 @@ char *GetCmdName(const char *cmdline, unsigned int len)
/* Scan the 'cmdline' string for command */
/* Notice: Command string must not have any special name */
for (tmpStr = cmdline, loop = 0; (*tmpStr != '\0') && (loop < len);) {
for (tmpStr = cmdline, loop = 0; (*tmpStr != '\0') && (loop < len); ) {
/* If reach a double quotes, switch the quotes matching status */
if (*tmpStr == '\"') {
SWITCH_QUOTES_STATUS(quotes);
@ -114,12 +114,10 @@ int ShellCmdExec(const char *msgName, const char *cmdString)
}
uintRet = ShellMsgTypeGet(&cmdParsed, msgName);
if (uintRet != LOS_OK) {
PRINTK("%s:command not found\n", msgName);
return -EFAULT;
} else {
(void)OsCmdExec(&cmdParsed, (char *)cmdString);
}
return 0;

View File

@ -88,11 +88,11 @@ static char *StrNormalizePath(char *fullpath)
while (*src != '\0') {
if (*src == '.') {
if (*(src + 1) == '/') {
src += 2;
src += 2; /* 2, sizeof "./" */
continue;
} else if (*(src + 1) == '.') {
if ((*(src + 2) == '/') || (*(src + 2) == '\0')) {
src += 2;
if ((*(src + 2) == '/') || (*(src + 2) == '\0')) { /* 2, 2, offset to check */
src += 2; /* 2, sizeof offset */
} else {
while ((*src != '\0') && (*src != '/')) {
*dest++ = *src++;
@ -174,7 +174,7 @@ static char *VfsNotAbsolutePath(const char *directory, const char *filename, cha
/* 2: The position of the path character: / and the end character /0 */
if ((namelen > 1) && (filename[0] == '.') && (filename[1] == '/')) {
filename += 2;
filename += 2; /* 2, sizeof "./" */
}
fullpath = (char *)malloc(strlen(directory) + namelen + 2);
@ -184,8 +184,7 @@ static char *VfsNotAbsolutePath(const char *directory, const char *filename, cha
return (char *)NULL;
}
/* join path and file name */
/* 2, sizeof "./", join path and file name */
ret = snprintf_s(fullpath, strlen(directory) + namelen + 2, strlen(directory) + namelen + 1,
"%s/%s", directory, filename);
if (ret < 0) {
@ -213,7 +212,6 @@ static char *VfsNormalizeFullpath(const char *directory, const char *filename, c
/* it's a absolute path, use it directly */
fullpath = strdup(filename); /* copy string */
if (fullpath == NULL) {
*pathname = NULL;
SetErrno(ENOMEM);
@ -246,8 +244,7 @@ int VfsNormalizePath(const char *directory, const char *filename, char **pathnam
return -EINVAL;
}
/* 2: The position of the path character: / and the end character /0 */
/* 2, The position of the path character: / and the end character /0 */
if ((filename[0] != '/') && (strlen(directory) + namelen + 2 > TEMP_PATH_MAX)) {
return -ENAMETOOLONG;
}

2
config.gni Normal file → Executable file
View File

@ -33,7 +33,7 @@ declare_args() {
enable_ohos_kernel_liteos_m_exchook = true
enable_ohos_kernel_liteos_m_kal = true
enable_ohos_kernel_liteos_m_fs = true
enable_ohos_kernel_liteos_m_shell = false
enable_ohos_kernel_liteos_m_shell = true
enable_ohos_kernel_liteos_m_backtrace = true
enable_ohos_kernel_liteos_m_test = false
enable_ohos_kernel_liteos_m_pm = true

View File

@ -50,10 +50,10 @@ extern "C" {
* @version 1.0
*/
typedef enum {
/** The timer is not allowed to wake up the RTOS. */
osTimerRousesIgnore = 0,
/** The timer is allowed to wake up the RTOS. */
osTimerRousesAllow = 1
/** The timer is not allowed to wake up the RTOS. */
osTimerRousesIgnore = 0,
/** The timer is allowed to wake up the RTOS. */
osTimerRousesAllow = 1
} osTimerRouses_t;
/**
@ -61,10 +61,10 @@ typedef enum {
*
*/
typedef enum {
/** The timer ignores alignment. */
osTimerAlignIgnore = 0,
/** The timer allows alignment. */
osTimerAlignAllow = 1
/** The timer ignores alignment. */
osTimerAlignIgnore = 0,
/** The timer allows alignment. */
osTimerAlignAllow = 1
} osTimerAlign_t;
osTimerId_t osTimerExtNew (osTimerFunc_t func, osTimerType_t type, void *argument, const osTimerAttr_t *attr,

View File

@ -231,3 +231,23 @@ int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stackSize)
return 0;
}
int sched_get_priority_min(int policy)
{
if (policy != SCHED_RR) {
errno = EINVAL;
return -1;
}
return LOS_TASK_PRIORITY_LOWEST;
}
int sched_get_priority_max(int policy)
{
if (policy != SCHED_RR) {
errno = EINVAL;
return -1;
}
return LOS_TASK_PRIORITY_HIGHEST;
}

View File

@ -42,6 +42,7 @@
#include "los_swtmr.h"
#include "los_tick.h"
#include "los_context.h"
#include "los_interrupt.h"
/* accumulative time delta from discontinuous modify */
STATIC struct timespec g_accDeltaFromSet;

View File

@ -61,7 +61,7 @@ static_library("kernel") {
} else if ("$board_cpu" == "cortex-m7") {
deps = [ "arch/arm/cortex-m7/gcc/:arch" ]
} else if ("$board_cpu" == "cortex-m33") {
deps = [ "arch/arm/cortex-m33/gcc/:arch" ]
deps = [ "arch/arm/cortex-m33/gcc/TZ:arch" ]
} else if ("$board_cpu" == "") {
if ("$board_arch" == "rv32imac" || "$board_arch" == "rv32imafdc") {
deps = [ "arch/risc-v/riscv32/gcc:arch" ]

View File

@ -545,7 +545,7 @@ VOID HalExcHardFault(VOID);
VOID HalExcMemFault(VOID);
VOID HalExcBusFault(VOID);
VOID HalExcUsageFault(VOID);
VOID HalExcSvcCall(VOID);
VOID HalSVCHandler(VOID);
VOID HalHwiInit();

View File

@ -41,7 +41,7 @@
.global HalExcMemFault
.global HalExcBusFault
.global HalExcUsageFault
.global HalExcSvcCall
.global HalSVCHandler
.extern HalExcHandleEntry
.extern g_uwExcTbl
@ -148,9 +148,9 @@ osHFExcCommonBMU:
B osExcDispatch
.fnend
.type HalExcSvcCall, %function
.global HalExcSvcCall
HalExcSvcCall:
.type HalSVCHandler, %function
.global HalSVCHandler
HalSVCHandler:
.fnstart
.cantunwind
TST LR, #0x4

View File

@ -497,7 +497,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler;

View File

@ -41,6 +41,8 @@ static_library("arch") {
]
include_dirs = [
"./non_secure",
"./secure",
"../../../../../../kernel/arch/include",
"../../../../../../kernel/arch/include",
"../../../../../../kernel/include",

View File

@ -545,7 +545,7 @@ VOID HalExcHardFault(VOID);
VOID HalExcMemFault(VOID);
VOID HalExcBusFault(VOID);
VOID HalExcUsageFault(VOID);
VOID HalExcSvcCall(VOID);
VOID HalSVCHandler(VOID);
VOID HalHwiInit();

View File

@ -48,8 +48,6 @@
.type HalStartFirstTask, %function
.global HalStartFirstTask
HalStartFirstTask:
.fnstart
.cantunwind
MOV R0, #2
MSR CONTROL, R0
@ -77,7 +75,6 @@ __DisabledFPU1:
MSR PSP, R12
CPSIE I
BX R3
.fnend
.type HalIntLock, %function
.global HalIntLock

View File

@ -41,7 +41,6 @@
.global HalExcMemFault
.global HalExcBusFault
.global HalExcUsageFault
.global HalExcSvcCall
.extern HalExcHandleEntry
.extern g_uwExcTbl
@ -148,21 +147,6 @@ osHFExcCommonBMU:
B osExcDispatch
.fnend
.type HalExcSvcCall, %function
.global HalExcSvcCall
HalExcSvcCall:
.fnstart
.cantunwind
TST LR, #0x4
ITE EQ
MRSEQ R0, MSP
MRSNE R0, PSP
LDR R1, [R0,#24]
LDRB R0, [R1,#-2]
MOV R1, #0
B osExcDispatch
.fnend
.type HalExcBusFault, %function
.global HalExcBusFault
HalExcBusFault:

View File

@ -497,7 +497,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler;

View File

@ -63,5 +63,3 @@ extern VOID HalSecureContextSaveAsm(OsSecureContext *secureContext);
#endif /* __cplusplus */
#endif

View File

@ -94,7 +94,7 @@ HalSecureContextSaveAsm:
MOV R0, #0
MSR PSPLIM, R0 /* No PSPLIM for the current task. */
MSR PSP, R0 /* No secure stack for the current task. */
.fnend
__ThreadMode:
BX LR
.fnend

View File

@ -29,7 +29,6 @@
extern VOID HalHwiInit(VOID);
#define INITIAL_MSTATUS ( MSTATUS_MPP | MSTATUS_MPIE | MSTATUS_FS_INITIAL)
#define ALIGN_DOWN(size, align) ((size) & ~((align) - 1))
#ifdef __cplusplus

View File

@ -71,13 +71,13 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
{
if (hwiNum > SOC_INT_MAX){
if (hwiNum > SOC_INT_MAX) {
return OS_ERRNO_HWI_NUM_INVALID;
}
if (mode > ECLIC_VECTOR_INTERRUPT){
if (mode > ECLIC_VECTOR_INTERRUPT) {
return OS_ERRNO_HWI_MODE_INVALID;
}
if (arg > ECLIC_NEGTIVE_EDGE_TRIGGER){
if (arg > ECLIC_NEGTIVE_EDGE_TRIGGER) {
return OS_ERRNO_HWI_ARG_INVALID;
}