Compare commits
103 Commits
OpenHarmon
...
weekly_202
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e268ef95a9 | ||
|
|
296a546bcd | ||
|
|
a7135e252d | ||
|
|
e76dd685c2 | ||
|
|
54a5365a25 | ||
|
|
2d1160fdc4 | ||
|
|
f3d606b6dd | ||
|
|
392e4c2cec | ||
|
|
b334658723 | ||
|
|
2b1f2d554e | ||
|
|
2cf290bb7c | ||
|
|
8fc9852e34 | ||
|
|
816d03f5c1 | ||
|
|
61877ec97a | ||
|
|
0f952132c0 | ||
|
|
f94d3ee119 | ||
|
|
784429d0dc | ||
|
|
1a764df92a | ||
|
|
cf50cde1b7 | ||
|
|
bfef7bfb2e | ||
|
|
5bae8b58c6 | ||
|
|
044cf59583 | ||
|
|
0adbafb9c2 | ||
|
|
3398937b1b | ||
|
|
3c010b4717 | ||
|
|
c237ff63fa | ||
|
|
3508110f6d | ||
|
|
ffa868a81c | ||
|
|
7d391c9bbf | ||
|
|
e4a1c18d40 | ||
|
|
83790f4f9b | ||
|
|
6377f98e9e | ||
|
|
b8f8ab5a36 | ||
|
|
a0b776a709 | ||
|
|
f5f18ca669 | ||
|
|
5756d45e84 | ||
|
|
8a25f31aa4 | ||
|
|
f7cc6ff14e | ||
|
|
bf9e0c9e2b | ||
|
|
e9de74a94a | ||
|
|
b38f135242 | ||
|
|
0cb50baa55 | ||
|
|
565049f1eb | ||
|
|
9add4b4b92 | ||
|
|
5992506c75 | ||
|
|
d4db5a5a75 | ||
|
|
fe8b68826a | ||
|
|
99640e9977 | ||
|
|
0dc3c7ae9e | ||
|
|
699bb81fc3 | ||
|
|
f2c4b59773 | ||
|
|
b656553c5c | ||
|
|
7653bd8da1 | ||
|
|
1275ecbc8a | ||
|
|
ebc57397f0 | ||
|
|
cce6365f4f | ||
|
|
04f391d814 | ||
|
|
14e64fc89b | ||
|
|
2ce5ce9397 | ||
|
|
eb40e4a068 | ||
|
|
dc5feb9e19 | ||
|
|
7a61f8d836 | ||
|
|
330760dbb3 | ||
|
|
2739a00c55 | ||
|
|
7f14b060d4 | ||
|
|
8be6e129fc | ||
|
|
f465c15d7a | ||
|
|
0af2577498 | ||
|
|
238ff396b8 | ||
|
|
5917c4b01b | ||
|
|
5c4edb9b1a | ||
|
|
ce176e77e6 | ||
|
|
8ef012bdad | ||
|
|
933efffba7 | ||
|
|
ae692bfbc4 | ||
|
|
ab46b9c836 | ||
|
|
b83d17039e | ||
|
|
08404f3252 | ||
|
|
8b19c3cbe4 | ||
|
|
192a2a6e61 | ||
|
|
2ec2c369e7 | ||
|
|
f2b280bdbd | ||
|
|
c09b3a8774 | ||
|
|
04cded2f0a | ||
|
|
ddfb363675 | ||
|
|
d0c50a4af0 | ||
|
|
6affe19d5a | ||
|
|
a36d5d9058 | ||
|
|
63bf098b0f | ||
|
|
252052f024 | ||
|
|
8c46636052 | ||
|
|
6ff615b9ca | ||
|
|
732a346399 | ||
|
|
2931dc6013 | ||
|
|
df30bc4e0a | ||
|
|
1599669290 | ||
|
|
d8104f6290 | ||
|
|
3a190a1a1b | ||
|
|
e1f986305b | ||
|
|
0c8b7d2a1b | ||
|
|
62eb96dd8d | ||
|
|
009d2503fb | ||
|
|
f7d79148b7 |
@@ -43,7 +43,7 @@ module_group("arch") {
|
||||
"$board_cpu" == "ck804ef") {
|
||||
modules += [ "csky" ]
|
||||
} else if ("$board_cpu" == "") {
|
||||
if ("$board_arch" == "rv32imac" || "$board_arch" == "rv32imafdc") {
|
||||
if ("$board_arch" != string_replace("$board_arch", "rv32i", "")) {
|
||||
modules += [ "risc-v" ]
|
||||
} else if ("$board" == "esp32") {
|
||||
modules += [ "xtensa" ]
|
||||
|
||||
@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
|
||||
{
|
||||
LOS_IntLock();
|
||||
(VOID)LOS_IntLock();
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
|
||||
{
|
||||
LOS_IntLock();
|
||||
(VOID)LOS_IntLock();
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
|
||||
{
|
||||
LOS_IntLock();
|
||||
(VOID)LOS_IntLock();
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
|
||||
{
|
||||
LOS_IntLock();
|
||||
(VOID)LOS_IntLock();
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
|
||||
|
||||
STATIC UINT64 SysTickCycleGet(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
|
||||
@@ -51,6 +51,7 @@ VOID HalSecureSVCHandler(UINT32 svcID, UINTPTR arg)
|
||||
HalSecureContextLoad(g_secureContext);
|
||||
break;
|
||||
case OS_SVC_FREE_SECURE_CONTEXT:
|
||||
LOS_ASSERT(g_secureContext != NULL);
|
||||
HalSecureContextFree(g_secureContext);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
|
||||
{
|
||||
LOS_IntLock();
|
||||
(VOID)LOS_IntLock();
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
|
||||
{
|
||||
LOS_IntLock();
|
||||
(VOID)LOS_IntLock();
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ VOID HalSecureSVCHandler(UINT32 svcID, UINTPTR arg)
|
||||
HalSecureContextLoad(g_secureContext);
|
||||
break;
|
||||
case OS_SVC_FREE_SECURE_CONTEXT:
|
||||
LOS_ASSERT(g_secureContext != NULL);
|
||||
HalSecureContextFree(g_secureContext);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -63,5 +63,3 @@ extern VOID HalSecureContextSaveAsm(OsSecureContext *secureContext);
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
|
||||
{
|
||||
LOS_IntLock();
|
||||
(VOID)LOS_IntLock();
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
|
||||
{
|
||||
LOS_IntLock();
|
||||
(VOID)LOS_IntLock();
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
|
||||
{
|
||||
LOS_IntLock();
|
||||
(VOID)LOS_IntLock();
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
|
||||
{
|
||||
LOS_IntLock();
|
||||
(VOID)LOS_IntLock();
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
|
||||
|
||||
STATIC UINT64 SysTickCycleGet(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
|
||||
@@ -51,6 +51,7 @@ VOID HalSecureSVCHandler(UINT32 svcID, UINTPTR arg)
|
||||
HalSecureContextLoad(g_secureContext);
|
||||
break;
|
||||
case OS_SVC_FREE_SECURE_CONTEXT:
|
||||
LOS_ASSERT(g_secureContext != NULL);
|
||||
HalSecureContextFree(g_secureContext);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
|
||||
{
|
||||
LOS_IntLock();
|
||||
(VOID)LOS_IntLock();
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
|
||||
{
|
||||
LOS_IntLock();
|
||||
(VOID)LOS_IntLock();
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ VOID HalSecureSVCHandler(UINT32 svcID, UINTPTR arg)
|
||||
HalSecureContextLoad(g_secureContext);
|
||||
break;
|
||||
case OS_SVC_FREE_SECURE_CONTEXT:
|
||||
LOS_ASSERT(g_secureContext != NULL);
|
||||
HalSecureContextFree(g_secureContext);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -63,5 +63,3 @@ extern VOID HalSecureContextSaveAsm(OsSecureContext *secureContext);
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
|
||||
{
|
||||
LOS_IntLock();
|
||||
(VOID)LOS_IntLock();
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
|
||||
{
|
||||
LOS_IntLock();
|
||||
(VOID)LOS_IntLock();
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
|
||||
{
|
||||
LOS_IntLock();
|
||||
(VOID)LOS_IntLock();
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -612,7 +612,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
|
||||
HalHwiHandleReInit((UINT32)&g_hwiForm);
|
||||
|
||||
HalSetVbr((UINT32)&g_hwiForm);
|
||||
for (int i = 0; i < BYTES_OF_128_INT; i++) {
|
||||
for (i = 0; i < BYTES_OF_128_INT; i++) {
|
||||
VIC_REG->IABR[i] = 0x0;
|
||||
VIC_REG->ICPR[i] = MASK_32_BITS;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -107,13 +107,16 @@ UINT32 ArchIntUnLock(VOID);
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>The hardware interrupt module is usable only when the configuration item for hardware interrupt tailoring is enabled.</li>
|
||||
* <li>Hardware interrupt number value range: [OS_USER_HWI_MIN,OS_USER_HWI_MAX]. The value range applicable for a Cortex-A7 platform is [32,95].</li>
|
||||
* <li>The hardware interrupt module is usable only when the configuration item for hardware
|
||||
* interrupt tailoring is enabled.</li>
|
||||
* <li>Hardware interrupt number value range: [OS_USER_HWI_MIN,OS_USER_HWI_MAX]. The value range
|
||||
* applicable for a Cortex-A7 platform is [32,95].</li>
|
||||
* <li>OS_HWI_MAX_NUM specifies the maximum number of interrupts that can be created.</li>
|
||||
* <li>Before executing an interrupt on a platform, refer to the chip manual of the platform.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param hwiNum [IN] Type#HWI_HANDLE_T: hardware interrupt number. The value range applicable for a Cortex-A7 platform is [32,95].
|
||||
* @param hwiNum [IN] Type#HWI_HANDLE_T: hardware interrupt number. The value range applicable
|
||||
* for a Cortex-A7 platform is [32,95].
|
||||
* @param irqParam [IN] Type #HwiIrqParam *. ID of hardware interrupt which will base on
|
||||
* when delete the hardware interrupt.
|
||||
* @retval #OS_ERRNO_HWI_NUM_INVALID 0x02000900: Invalid interrupt number.
|
||||
@@ -133,13 +136,16 @@ UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam);
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>The hardware interrupt module is usable only when the configuration item for hardware interrupt tailoring is enabled.</li>
|
||||
* <li>Hardware interrupt number value range: [OS_USER_HWI_MIN,OS_USER_HWI_MAX]. The value range applicable for a Cortex-A7 platform is [32,95].</li>
|
||||
* <li>The hardware interrupt module is usable only when the configuration item for hardware
|
||||
* interrupt tailoring is enabled.</li>
|
||||
* <li>Hardware interrupt number value range: [OS_USER_HWI_MIN,OS_USER_HWI_MAX]. The value range
|
||||
* applicable for a Cortex-A7 platform is [32,95].</li>
|
||||
* <li>OS_HWI_MAX_NUM specifies the maximum number of interrupts that can be created.</li>
|
||||
* <li>Before executing an interrupt on a platform, refer to the chip manual of the platform.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param hwiNum [IN] Type#HWI_HANDLE_T: hardware interrupt number. The value range applicable for a Cortex-A7 platform is [32,95].
|
||||
* @param hwiNum [IN] Type#HWI_HANDLE_T: hardware interrupt number. The value range applicable for a
|
||||
* Cortex-A7 platform is [32,95].
|
||||
* @param hwiPrio [IN] Type#HWI_PRIOR_T: hardware interrupt priority. Ignore this parameter temporarily.
|
||||
* @param mode [IN] Type#HWI_MODE_T: hardware interrupt mode. Ignore this parameter temporarily.
|
||||
* @param handler [IN] Type#HWI_PROC_FUNC: interrupt handler used when a hardware interrupt is triggered.
|
||||
@@ -149,7 +155,8 @@ UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam);
|
||||
* @retval #OS_ERRNO_HWI_PROC_FUNC_NULL 0x02000901: Null hardware interrupt handling function.
|
||||
* @retval #OS_ERRNO_HWI_NUM_INVALID 0x02000900: Invalid interrupt number.
|
||||
* @retval #OS_ERRNO_HWI_NO_MEMORY 0x02000903: Insufficient memory for hardware interrupt creation.
|
||||
* @retval #OS_ERRNO_HWI_ALREADY_CREATED 0x02000904: The interrupt handler being created has already been created.
|
||||
* @retval #OS_ERRNO_HWI_ALREADY_CREATED 0x02000904: The interrupt handler being created has
|
||||
* already been created.
|
||||
* @retval #LOS_OK 0 : The interrupt is successfully created.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_interrupt.h: the header file that contains the API declaration.</li></ul>
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "los_config.h"
|
||||
#include "los_interrupt.h"
|
||||
#include "los_arch_context.h"
|
||||
#include "los_error.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
@@ -103,7 +103,7 @@ LITE_OS_SEC_TEXT_INIT VOID ArchInit(VOID)
|
||||
|
||||
LITE_OS_SEC_TEXT_MINOR VOID ArchSysExit(VOID)
|
||||
{
|
||||
LOS_IntLock();
|
||||
(VOID)LOS_IntLock();
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -209,7 +209,6 @@ LITE_OS_SEC_TEXT_MINOR VOID OsTskCycleEnd(VOID)
|
||||
}
|
||||
|
||||
cpuCycle = LOS_SysCycleGet();
|
||||
|
||||
if (cpuCycle < g_cpup[taskID].startTime) {
|
||||
cpuCycle += g_cyclesPerTick;
|
||||
}
|
||||
@@ -625,7 +624,6 @@ LITE_OS_SEC_TEXT_MINOR VOID OsCpupIrqEnd(UINT32 intNum)
|
||||
}
|
||||
|
||||
cpuCycle = LOS_SysCycleGet();
|
||||
|
||||
if (cpuCycle < g_irqCpup[intNum].startTime) {
|
||||
cpuCycle += g_cyclesPerTick;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -250,7 +250,8 @@ extern UINT32 LOS_SysCpuUsage(VOID);
|
||||
* This API is used to obtain the historical CPU usage.
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>This API can be called only after the CPU usage is initialized. Otherwise, the CPU usage fails to be obtained.</li>
|
||||
* <li>This API can be called only after the CPU usage is initialized. Otherwise, the CPU usage fails
|
||||
* to be obtained.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param mode [IN] UINT16. Task mode. The parameter value 0 indicates that the CPU usage within 10s will be
|
||||
@@ -273,7 +274,8 @@ extern UINT32 LOS_HistorySysCpuUsage(UINT16 mode);
|
||||
* This API is used to obtain the CPU usage of a task specified by a passed-in task ID.
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>This API can be called only after the CPU usage is initialized. Otherwise, the CPU usage fails to be obtained.</li>
|
||||
* <li>This API can be called only after the CPU usage is initialized. Otherwise, the CPU usage fails
|
||||
* to be obtained.</li>
|
||||
* <li>The passed-in task ID must be valid and the task specified by the task ID must be created. Otherwise,
|
||||
* the CPU usage fails to be obtained.</li>
|
||||
* </ul>
|
||||
@@ -327,7 +329,8 @@ extern UINT32 LOS_HistoryTaskCpuUsage(UINT32 taskID, UINT16 mode);
|
||||
* This API is used to obtain the CPU usage of all tasks according to maximum number of threads.
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>This API can be called only after the CPU usage is initialized. Otherwise, the CPU usage fails to be obtained.</li>
|
||||
* <li>This API can be called only after the CPU usage is initialized. Otherwise, the CPU usage fails
|
||||
* to be obtained.</li>
|
||||
* <li>The input parameter pointer must not be NULL, Otherwise, the CPU usage fails to be obtained.</li>
|
||||
* </ul>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -41,12 +41,6 @@
|
||||
#include "los_debug.h"
|
||||
#include "los_mux.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if (LOSCFG_DYNLINK == 1)
|
||||
|
||||
#if defined(__ICCARM__) || defined(__CC_ARM)
|
||||
@@ -279,7 +273,7 @@ STATIC DynSharedObj *OsLoadInit(const CHAR *fileName, VOID *pool)
|
||||
goto ERR2;
|
||||
}
|
||||
|
||||
strcpy(dso->buf, fileName);
|
||||
(void)strcpy_s(dso->buf, nameLen + 1, fileName);
|
||||
dso->fileName = dso->buf;
|
||||
dso->ref = 1;
|
||||
dso->pool = (pool ? pool : OS_SYS_MEM_ADDR);
|
||||
@@ -867,7 +861,7 @@ STATIC VOID OsDoFini(DynSharedObj *dso)
|
||||
--func;
|
||||
finiFunc = (INIT_FINI_FUNC)(*func);
|
||||
finiFunc();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (initFiniTab->fini.func != 0) {
|
||||
@@ -929,10 +923,3 @@ INT32 LOS_DynlinkInit(VOID)
|
||||
}
|
||||
|
||||
#endif /* LOSCFG_DYNLINK */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -129,8 +129,8 @@ typedef struct {
|
||||
} DynSharedObj;
|
||||
|
||||
typedef struct {
|
||||
CHAR *name;
|
||||
UINTPTR addr;
|
||||
CHAR *name;
|
||||
UINTPTR addr;
|
||||
} SymInfo;
|
||||
|
||||
#define SYM_EXPORT(func) \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -54,13 +54,15 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_BASE_CORE_EXC_TSK_SWITCH == 1)
|
||||
#define MAX_SWITCH_INFO_SIZE (INFO_TYPE_AND_SIZE + (sizeof(UINT32) + sizeof(CHAR) * LOS_TASK_NAMELEN) * OS_TASK_SWITCH_INFO_COUNT)
|
||||
#define MAX_SWITCH_INFO_SIZE (INFO_TYPE_AND_SIZE + (sizeof(UINT32) + sizeof(CHAR) * LOS_TASK_NAMELEN) \
|
||||
* OS_TASK_SWITCH_INFO_COUNT)
|
||||
#else
|
||||
#define MAX_SWITCH_INFO_SIZE (0)
|
||||
#endif
|
||||
|
||||
|
||||
#define MAX_MEM_INFO_SIZE (INFO_TYPE_AND_SIZE + sizeof(MemInfoCB) * OS_SYS_MEM_NUM)
|
||||
#define MAX_EXC_MEM_SIZE (INFO_TYPE_AND_SIZE + MAX_SCENE_INFO_SIZE + MAX_TSK_INFO_SIZE + MAX_QUEUE_INFO_SIZE + MAX_INT_INFO_SIZE + MAX_SWITCH_INFO_SIZE + MAX_MEM_INFO_SIZE)
|
||||
#define MAX_EXC_MEM_SIZE (INFO_TYPE_AND_SIZE + MAX_SCENE_INFO_SIZE + MAX_TSK_INFO_SIZE + MAX_QUEUE_INFO_SIZE \
|
||||
+ MAX_INT_INFO_SIZE + MAX_SWITCH_INFO_SIZE + MAX_MEM_INFO_SIZE)
|
||||
|
||||
typedef enum {
|
||||
OS_EXC_TYPE_CONTEXT = 0,
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#define _GNU_SOURCE 1
|
||||
#include "lfs_adapter.h"
|
||||
#include "los_config.h"
|
||||
#include "los_fs.h"
|
||||
#include "vfs_files.h"
|
||||
#include "vfs_operations.h"
|
||||
#include "vfs_partition.h"
|
||||
@@ -39,8 +40,75 @@
|
||||
#include "vfs_mount.h"
|
||||
#include "securec.h"
|
||||
|
||||
struct dirent g_nameValue;
|
||||
static pthread_mutex_t g_FslocalMutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static pthread_mutex_t g_fsLocalMutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static struct PartitionCfg g_partitionCfg;
|
||||
static struct DeviceDesc *g_lfsDevice = NULL;
|
||||
|
||||
static uint32_t LfsGetStartAddr(int partition)
|
||||
{
|
||||
if (g_lfsDevice == NULL) {
|
||||
struct DeviceDesc *device = NULL;
|
||||
for (device = getDeviceList(); device != NULL; device = device->dNext) {
|
||||
if (strcmp(device->dFsType, "littlefs") == 0) {
|
||||
g_lfsDevice = device;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((g_lfsDevice == NULL) || (partition >= g_lfsDevice->dPartNum)) {
|
||||
return INVALID_DEVICE_ADDR;
|
||||
}
|
||||
|
||||
return (uint32_t)g_lfsDevice->dAddrArray[partition];
|
||||
}
|
||||
|
||||
WEAK int littlefs_block_read(const struct lfs_config *c, lfs_block_t block,
|
||||
lfs_off_t off, void *dst, lfs_size_t size)
|
||||
{
|
||||
UINT32 addr = c->block_size * block + off;
|
||||
UINT32 startaddr = LfsGetStartAddr((int)c->context);
|
||||
if (startaddr == INVALID_DEVICE_ADDR) {
|
||||
return -1;
|
||||
}
|
||||
addr += startaddr;
|
||||
|
||||
return (g_partitionCfg.readFunc)((int)c->context, &addr, dst, size);
|
||||
}
|
||||
|
||||
WEAK int littlefs_block_write(const struct lfs_config *c, lfs_block_t block,
|
||||
lfs_off_t off, const void *dst, lfs_size_t size)
|
||||
{
|
||||
UINT32 addr = c->block_size * block + off;
|
||||
UINT32 startaddr = LfsGetStartAddr((int)c->context);
|
||||
if (startaddr == INVALID_DEVICE_ADDR) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
addr += startaddr;
|
||||
|
||||
return (g_partitionCfg.writeFunc)((int)c->context, &addr, dst, size);
|
||||
}
|
||||
|
||||
WEAK int littlefs_block_erase(const struct lfs_config *c, lfs_block_t block)
|
||||
{
|
||||
UINT32 addr = c->block_size * block;
|
||||
UINT32 startaddr = LfsGetStartAddr((int)c->context);
|
||||
if (startaddr == INVALID_DEVICE_ADDR) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
addr += startaddr;
|
||||
|
||||
return (g_partitionCfg.eraseFunc)((int)c->context, addr, c->block_size);
|
||||
}
|
||||
|
||||
WEAK int littlefs_block_sync(const struct lfs_config *c)
|
||||
{
|
||||
(void)c;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ConvertFlagToLfsOpenFlag (int oflags)
|
||||
{
|
||||
@@ -82,10 +150,33 @@ static int LittlefsErrno(int result)
|
||||
return (result < 0) ? -result : result;
|
||||
}
|
||||
|
||||
void LfsConfigAdapter(struct PartitionCfg *pCfg, struct lfs_config *lfsCfg)
|
||||
{
|
||||
lfsCfg->context = (void *)pCfg->partNo;
|
||||
|
||||
lfsCfg->read_size = pCfg->readSize;
|
||||
lfsCfg->prog_size = pCfg->writeSize;
|
||||
lfsCfg->cache_size = pCfg->cacheSize;
|
||||
lfsCfg->block_cycles = pCfg->blockCycles;
|
||||
lfsCfg->lookahead_size = pCfg->lookaheadSize;
|
||||
lfsCfg->block_size = pCfg->blockSize;
|
||||
lfsCfg->block_count = pCfg->blockCount;
|
||||
|
||||
lfsCfg->read = littlefs_block_read;
|
||||
lfsCfg->prog = littlefs_block_write;
|
||||
lfsCfg->erase = littlefs_block_erase;
|
||||
lfsCfg->sync = littlefs_block_sync;
|
||||
|
||||
g_partitionCfg.readFunc = pCfg->readFunc;
|
||||
g_partitionCfg.writeFunc = pCfg->writeFunc;
|
||||
g_partitionCfg.eraseFunc = pCfg->eraseFunc;
|
||||
}
|
||||
|
||||
int LfsMount(struct MountPoint *mp, unsigned long mountflags, const void *data)
|
||||
{
|
||||
int ret;
|
||||
lfs_t *mountHdl = NULL;
|
||||
struct lfs_config *cfg = NULL;
|
||||
|
||||
if ((mp == NULL) || (mp->mPath == NULL) || (data == NULL)) {
|
||||
errno = EFAULT;
|
||||
@@ -93,23 +184,25 @@ int LfsMount(struct MountPoint *mp, unsigned long mountflags, const void *data)
|
||||
goto errout;
|
||||
}
|
||||
|
||||
mountHdl = (lfs_t *)malloc(sizeof(lfs_t));
|
||||
mountHdl = (lfs_t *)malloc(sizeof(lfs_t) + sizeof(struct lfs_config));
|
||||
if (mountHdl == NULL) {
|
||||
errno = ENODEV;
|
||||
ret = (int)LOS_NOK;
|
||||
goto errout;
|
||||
}
|
||||
(void)memset_s(mountHdl, sizeof(lfs_t), 0, sizeof(lfs_t));
|
||||
(void)memset_s(mountHdl, sizeof(lfs_t) + sizeof(struct lfs_config), 0, sizeof(lfs_t) + sizeof(struct lfs_config));
|
||||
mp->mData = (void *)mountHdl;
|
||||
cfg = (void *)((UINTPTR)mountHdl + sizeof(lfs_t));
|
||||
|
||||
ret = lfs_mount((lfs_t *)mp->mData, (struct lfs_config *)data);
|
||||
LfsConfigAdapter((struct PartitionCfg *)data, cfg);
|
||||
|
||||
ret = lfs_mount((lfs_t *)mp->mData, cfg);
|
||||
if (ret != 0) {
|
||||
ret = lfs_format((lfs_t *)mp->mData, (struct lfs_config*)data);
|
||||
ret = lfs_format((lfs_t *)mp->mData, cfg);
|
||||
if (ret == 0) {
|
||||
ret = lfs_mount((lfs_t *)mp->mData, (struct lfs_config*)data);
|
||||
ret = lfs_mount((lfs_t *)mp->mData, cfg);
|
||||
}
|
||||
}
|
||||
|
||||
if (ret != 0) {
|
||||
free(mountHdl);
|
||||
errno = LittlefsErrno(ret);
|
||||
@@ -278,7 +371,7 @@ int LfsReaddir(struct Dir *dir, struct dirent *dent)
|
||||
|
||||
ret = lfs_dir_read(lfs, dirInfo, &lfsInfo);
|
||||
if (ret == TRUE) {
|
||||
pthread_mutex_lock(&g_FslocalMutex);
|
||||
pthread_mutex_lock(&g_fsLocalMutex);
|
||||
(void)strncpy_s(dent->d_name, sizeof(dent->d_name), lfsInfo.name, strlen(lfsInfo.name) + 1);
|
||||
if (lfsInfo.type == LFS_TYPE_DIR) {
|
||||
dent->d_type = DT_DIR;
|
||||
@@ -287,7 +380,7 @@ int LfsReaddir(struct Dir *dir, struct dirent *dent)
|
||||
}
|
||||
|
||||
dent->d_reclen = lfsInfo.size;
|
||||
pthread_mutex_unlock(&g_FslocalMutex);
|
||||
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
@@ -467,9 +560,9 @@ int LfsClose(struct File *file)
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&g_FslocalMutex);
|
||||
pthread_mutex_lock(&g_fsLocalMutex);
|
||||
ret = lfs_file_close((lfs_t *)mp->mData, lfsHandle);
|
||||
pthread_mutex_unlock(&g_FslocalMutex);
|
||||
pthread_mutex_unlock(&g_fsLocalMutex);
|
||||
|
||||
if (ret != 0) {
|
||||
errno = LittlefsErrno(ret);
|
||||
@@ -559,6 +652,24 @@ int LfsSync(struct File *file)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LfsFormat(const char *partName, void *privData)
|
||||
{
|
||||
int ret;
|
||||
lfs_t lfs = {0};
|
||||
struct lfs_config cfg = {0};
|
||||
|
||||
(void)partName;
|
||||
|
||||
LfsConfigAdapter((struct PartitionCfg *)privData, &cfg);
|
||||
|
||||
ret = lfs_format(&lfs, &cfg);
|
||||
if (ret != 0) {
|
||||
errno = LittlefsErrno(ret);
|
||||
ret = (int)LOS_NOK;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct MountOps g_lfsMnt = {
|
||||
.mount = LfsMount,
|
||||
.umount = LfsUmount,
|
||||
@@ -587,7 +698,7 @@ static struct FileOps g_lfsFops = {
|
||||
|
||||
static struct FsManagement g_lfsMgt = {
|
||||
.fdisk = NULL,
|
||||
.format = NULL,
|
||||
.format = LfsFormat,
|
||||
};
|
||||
|
||||
void LfsInit(void)
|
||||
|
||||
@@ -45,6 +45,6 @@
|
||||
#include "pthread.h"
|
||||
|
||||
#define INVALID_FD (-1)
|
||||
|
||||
#define INVALID_DEVICE_ADDR ((uint32_t)-1)
|
||||
void LfsInit(void);
|
||||
#endif /* _LFS_ADAPTER_H_ */
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "sys/stat.h"
|
||||
#include "sys/uio.h"
|
||||
#include "unistd.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
@@ -80,8 +81,31 @@ int LOS_Ftruncate(int fd, off_t length);
|
||||
int LOS_FsUmount(const char *target);
|
||||
int LOS_FsUmount2(const char *target, int flag);
|
||||
int LOS_FsMount(const char *source, const char *target,
|
||||
const char *fsType, unsigned long mountflags,
|
||||
const void *data);
|
||||
const char *fsType, unsigned long mountflags,
|
||||
const void *data);
|
||||
|
||||
int OsFcntl(int fd, int cmd, va_list ap);
|
||||
int OsIoctl(int fd, int req, va_list ap);
|
||||
|
||||
struct PartitionCfg {
|
||||
/* partition low-level read func */
|
||||
int (*readFunc)(int partition, UINT32 *offset, void *buf, UINT32 size);
|
||||
/* partition low-level write func */
|
||||
int (*writeFunc)(int partition, UINT32 *offset, const void *buf, UINT32 size);
|
||||
/* partition low-level erase func */
|
||||
int (*eraseFunc)(int partition, UINT32 offset, UINT32 size);
|
||||
|
||||
int readSize; /* size of a block read */
|
||||
int writeSize; /* size of a block write */
|
||||
int blockSize; /* size of an erasable block */
|
||||
int blockCount; /* number of partition blocks */
|
||||
int cacheSize; /* size of block caches */
|
||||
|
||||
int partNo; /* partition number */
|
||||
int lookaheadSize; /* lookahead size */
|
||||
int blockCycles; /* block cycles */
|
||||
};
|
||||
|
||||
/*
|
||||
* @brief Divide the device into partitions.
|
||||
*
|
||||
@@ -93,6 +117,7 @@ int LOS_FsMount(const char *source, const char *target,
|
||||
* @param lengthArray List of partition size. For example:
|
||||
* [0x10000000, 0x2000000], 256M and 512M partitions will be created and
|
||||
* left all will not allocated.
|
||||
* @param addrArray List of partition start addr, partition num same as lengthArray
|
||||
* @param partNum Length of 'lengthArray'.
|
||||
*
|
||||
* @return Return LOS_NOK if error. Return LOS_OK if success.
|
||||
@@ -103,8 +128,8 @@ int LOS_FsMount(const char *source, const char *target,
|
||||
* The name is a combination of: 'deviceName'+'p'+'partitionId',
|
||||
* such as "emmc0p0", "emmc0p1", "emmc0p2"...
|
||||
*/
|
||||
int LOS_DiskPartition(const char *dev, const char *fsType, int *lengthArray,
|
||||
int partnum);
|
||||
int LOS_DiskPartition(const char *dev, const char *fsType, int *lengthArray, int *addrArray,
|
||||
int partNum);
|
||||
|
||||
/*
|
||||
* @brief Format a partition.
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
static struct File g_files[NR_OPEN_DEFAULT];
|
||||
|
||||
int FileToFd(struct File *file)
|
||||
int FileToFd(const struct File *file)
|
||||
{
|
||||
if (file == NULL) {
|
||||
return (int)LOS_NOK;
|
||||
|
||||
@@ -89,7 +89,7 @@ struct Dir {
|
||||
void *dData;
|
||||
};
|
||||
|
||||
int FileToFd(struct File *file);
|
||||
int FileToFd(const struct File *file);
|
||||
struct File *FdToFile(int fd);
|
||||
struct File *VfsFileGet(void);
|
||||
struct File *VfsFileGetSpec(int fd);
|
||||
|
||||
@@ -582,17 +582,13 @@ static int VfsRename(const char *old, const char *new)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int VfsIoctl(int fd, int func, ...)
|
||||
static int VfsIoctl(int fd, int func, va_list ap)
|
||||
{
|
||||
va_list ap;
|
||||
unsigned long arg;
|
||||
struct File *file = NULL;
|
||||
int ret = (int)LOS_NOK;
|
||||
|
||||
va_start(ap, func);
|
||||
arg = va_arg(ap, unsigned long);
|
||||
va_end(ap);
|
||||
|
||||
file = VfsAttachFileReady(fd);
|
||||
if (file == NULL) {
|
||||
return ret;
|
||||
@@ -709,8 +705,6 @@ static struct dirent *VfsReaddir(DIR *d)
|
||||
(dir->dMp->mFs->fsFops->readdir != NULL)) {
|
||||
if (dir->dMp->mFs->fsFops->readdir(dir, &dir->dDent) == 0) {
|
||||
ret = &dir->dDent;
|
||||
} else {
|
||||
VFS_ERRNO_SET(EBADF);
|
||||
}
|
||||
} else {
|
||||
VFS_ERRNO_SET(ENOTSUP);
|
||||
@@ -908,8 +902,13 @@ static int MapToPosixRet(int ret)
|
||||
/* POSIX interface */
|
||||
int LOS_Open(const char *path, int flags, ...)
|
||||
{
|
||||
if (path == NULL) {
|
||||
errno = EINVAL;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
#ifdef LOSCFG_RANDOM_DEV
|
||||
unsigned flagMask = O_RDONLY | O_WRONLY | O_RDWR | O_APPEND | O_CREAT | O_LARGEFILE | O_TRUNC | O_EXCL | O_DIRECTORY;
|
||||
unsigned flagMask = O_RDONLY | O_WRONLY | O_RDWR | O_APPEND | O_CREAT | O_LARGEFILE \
|
||||
| O_TRUNC | O_EXCL | O_DIRECTORY;
|
||||
if ((unsigned)flags & ~flagMask) {
|
||||
errno = EINVAL;
|
||||
return (int)LOS_NOK;
|
||||
@@ -957,7 +956,7 @@ int LOS_Open(const char *path, int flags, ...)
|
||||
FREE_AND_SET_NULL(canonicalPath);
|
||||
#endif
|
||||
#if (LOSCFG_POSIX_PIPE_API == 1)
|
||||
if ((path != NULL) && !strncmp(path, PIPE_DEV_PATH, strlen(PIPE_DEV_PATH))) {
|
||||
if (!strncmp(path, PIPE_DEV_PATH, strlen(PIPE_DEV_PATH))) {
|
||||
return PipeOpen(path, flags, PIPE_DEV_FD);
|
||||
}
|
||||
#endif
|
||||
@@ -1144,29 +1143,25 @@ int LOS_Fstat(int fd, struct stat *buf)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LOS_Fcntl(int fd, int cmd, ...)
|
||||
int OsFcntl(int fd, int cmd, va_list ap)
|
||||
{
|
||||
struct File *filep = NULL;
|
||||
va_list ap;
|
||||
int ret;
|
||||
va_start(ap, cmd);
|
||||
|
||||
if (fd < CONFIG_NFILE_DESCRIPTORS) {
|
||||
filep = VfsAttachFileReady(fd);
|
||||
ret = VfsVfcntl(filep, cmd, ap);
|
||||
VfsDetachFile(filep);
|
||||
} else {
|
||||
#ifndef LOSCFG_NET_LWIP_SACK
|
||||
ret = -EBADF;
|
||||
#ifdef LOSCFG_NET_LWIP_SACK
|
||||
#else
|
||||
int arg = va_arg(ap, int);
|
||||
ret = lwip_fcntl(fd, (long)cmd, arg);
|
||||
va_end(ap);
|
||||
return ret;
|
||||
#endif /* LOSCFG_NET_LWIP_SACK */
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
|
||||
if (ret < 0) {
|
||||
VFS_ERRNO_SET(-ret);
|
||||
ret = (int)LOS_NOK;
|
||||
@@ -1174,21 +1169,41 @@ int LOS_Fcntl(int fd, int cmd, ...)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LOS_Ioctl(int fd, int req, ...)
|
||||
int LOS_Fcntl(int fd, int cmd, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
va_start(ap, cmd);
|
||||
ret = OsFcntl(fd, cmd, ap);
|
||||
va_end(ap);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int OsIoctl(int fd, int req, va_list ap)
|
||||
{
|
||||
int ret;
|
||||
va_list ap;
|
||||
va_start(ap, req);
|
||||
|
||||
if (fd < CONFIG_NFILE_DESCRIPTORS) {
|
||||
ret = VfsIoctl(fd, req, ap);
|
||||
} else {
|
||||
#ifndef LOSCFG_NET_LWIP_SACK
|
||||
ret = -EBADF;
|
||||
#ifdef LOSCFG_NET_LWIP_SACK
|
||||
#else
|
||||
UINTPTR arg = va_arg(ap, UINTPTR);
|
||||
ret = lwip_ioctl(fd, (long)req, (void *)arg);
|
||||
#endif /* LOSCFG_NET_LWIP_SACK */
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LOS_Ioctl(int fd, int req, ...)
|
||||
{
|
||||
int ret;
|
||||
va_list ap;
|
||||
va_start(ap, req);
|
||||
ret = OsIoctl(fd, req, ap);
|
||||
va_end(ap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. *
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
@@ -54,7 +55,7 @@ struct FsMap *VfsFsMapGet(const char *fsType)
|
||||
}
|
||||
|
||||
int OsFsRegister(const char *fsType, struct MountOps *fsMops,
|
||||
struct FileOps *fsFops, struct FsManagement *fsMgt)
|
||||
struct FileOps *fsFops, struct FsManagement *fsMgt)
|
||||
{
|
||||
if ((fsMops == NULL) || (fsFops == NULL)) {
|
||||
return (int)LOS_NOK;
|
||||
|
||||
@@ -57,7 +57,7 @@ struct FsMap {
|
||||
};
|
||||
|
||||
int OsFsRegister(const char *fsType, struct MountOps *fsMops,
|
||||
struct FileOps *fsFops, struct FsManagement *fsMgt);
|
||||
struct FileOps *fsFops, struct FsManagement *fsMgt);
|
||||
struct FsMap *VfsFsMapGet(const char *fsType);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -122,14 +122,45 @@ struct MountPoint *VfsMpFind(const char *path, const char **pathInMp)
|
||||
return bestMp;
|
||||
}
|
||||
|
||||
STATIC struct MountPoint *MountPointInit(const char *target, const char *fsType, unsigned long mountflags)
|
||||
{
|
||||
struct MountPoint *mp = NULL;
|
||||
const char *pathInMp = NULL;
|
||||
struct FsMap *mFs = NULL;
|
||||
|
||||
/* find mp by target, to see if it was mounted */
|
||||
mp = VfsMpFind(target, &pathInMp);
|
||||
if (mp != NULL && pathInMp != NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Find fsMap coresponding to the fsType */
|
||||
mFs = VfsFsMapGet(fsType);
|
||||
if ((mFs == NULL) || (mFs->fsMops == NULL) || (mFs->fsMops->mount == NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mp = (struct MountPoint *)malloc(sizeof(struct MountPoint));
|
||||
if (mp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mp->mFs = mFs;
|
||||
mp->mDev = NULL;
|
||||
mp->mRefs = 0;
|
||||
mp->mWriteEnable = (mountflags & MS_RDONLY) ? FALSE : TRUE;
|
||||
mp->mFs->fsRefs++;
|
||||
mp->mNext = g_mountPoints;
|
||||
|
||||
return mp;
|
||||
}
|
||||
|
||||
int LOS_FsMount(const char *source, const char *target,
|
||||
const char *fsType, unsigned long mountflags,
|
||||
const void *data)
|
||||
const char *fsType, unsigned long mountflags,
|
||||
const void *data)
|
||||
{
|
||||
int ret;
|
||||
struct MountPoint *mp = NULL;
|
||||
struct FsMap *mFs = NULL;
|
||||
const char *pathInMp = NULL;
|
||||
|
||||
/* target must begin with '/', for example /system, /data, etc. */
|
||||
if ((target == NULL) || (target[0] != '/')) {
|
||||
@@ -137,29 +168,19 @@ int LOS_FsMount(const char *source, const char *target,
|
||||
}
|
||||
|
||||
(void)VfsLock();
|
||||
/* find mp by target, to see if it was mounted */
|
||||
mp = VfsMpFind(target, &pathInMp);
|
||||
if (mp != NULL && pathInMp != NULL) {
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* Find fsMap coresponding to the fsType */
|
||||
mFs = VfsFsMapGet(fsType);
|
||||
if ((mFs == NULL) || (mFs->fsMops == NULL) || (mFs->fsMops->mount == NULL)) {
|
||||
goto errout;
|
||||
}
|
||||
|
||||
mp = (struct MountPoint *)malloc(sizeof(struct MountPoint));
|
||||
mp = MountPointInit(target, fsType, mountflags);
|
||||
if (mp == NULL) {
|
||||
goto errout;
|
||||
VfsUnlock();
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
mp->mFs = mFs;
|
||||
mp->mDev = NULL;
|
||||
if (source != NULL) {
|
||||
mp->mDev = strdup(source);
|
||||
if (mp->mDev == NULL) {
|
||||
goto errout;
|
||||
free(mp);
|
||||
VfsUnlock();
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,10 +195,7 @@ int LOS_FsMount(const char *source, const char *target,
|
||||
PRINT_ERR("mount failed, target %s.\n", target);
|
||||
goto errout;
|
||||
}
|
||||
mp->mRefs = 0;
|
||||
mp->mWriteEnable = (mountflags & MS_RDONLY) ? FALSE : TRUE;
|
||||
mp->mFs->fsRefs++;
|
||||
mp->mNext = g_mountPoints;
|
||||
|
||||
g_mountPoints = mp;
|
||||
VfsUnlock();
|
||||
return LOS_OK;
|
||||
@@ -233,7 +251,7 @@ errout:
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
static void CloseFdsInMp(struct MountPoint *mp)
|
||||
static void CloseFdsInMp(const struct MountPoint *mp)
|
||||
{
|
||||
for (int fd = 0; fd < NR_OPEN_DEFAULT; fd++) {
|
||||
struct File *f = FdToFile(fd);
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
|
||||
static struct DeviceDesc *g_deviceList = NULL;
|
||||
|
||||
int GetPartIdByPartName(const char *partName)
|
||||
{
|
||||
if (partName == NULL) {
|
||||
@@ -45,7 +47,7 @@ int GetPartIdByPartName(const char *partName)
|
||||
|
||||
/* the character next to p is the partId */
|
||||
char *p = strrchr(partName, 'p');
|
||||
if (p + 1 != NULL) {
|
||||
if (p != NULL) {
|
||||
return atoi(p + 1);
|
||||
}
|
||||
|
||||
@@ -67,16 +69,86 @@ int GetDevIdByDevName(const char *dev)
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
int LOS_DiskPartition(const char *dev, const char *fsType, int *lengthArray,
|
||||
int partnum)
|
||||
struct DeviceDesc *getDeviceList(VOID)
|
||||
{
|
||||
return g_deviceList;
|
||||
}
|
||||
|
||||
static int AddDevice(const char *dev, const char *fsType, int *lengthArray, int *addrArray,
|
||||
int partNum)
|
||||
{
|
||||
struct DeviceDesc *prev = NULL;
|
||||
for (prev = g_deviceList; prev != NULL; prev = prev->dNext) {
|
||||
if (strcmp(prev->dDev, dev) == 0) {
|
||||
errno = -EEXIST;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
}
|
||||
|
||||
if (addrArray == NULL) {
|
||||
errno = -EFAULT;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
prev = (struct DeviceDesc *)malloc(sizeof(struct DeviceDesc));
|
||||
if (prev == NULL) {
|
||||
errno = -ENOMEM;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
prev->dDev = strdup(dev);
|
||||
prev->dFsType = strdup(fsType);
|
||||
prev->dAddrArray = (int *)malloc(partNum * sizeof(int));
|
||||
if (prev->dDev == NULL || prev->dFsType == NULL || prev->dAddrArray == NULL) {
|
||||
goto errout;
|
||||
}
|
||||
(void)memcpy_s(prev->dAddrArray, partNum * sizeof(int), addrArray, partNum * sizeof(int));
|
||||
|
||||
if (lengthArray != NULL) {
|
||||
prev->dLengthArray = (int *)malloc(partNum * sizeof(int));
|
||||
if (prev->dLengthArray == NULL) {
|
||||
goto errout;
|
||||
}
|
||||
(void)memcpy_s(prev->dLengthArray, partNum * sizeof(int), lengthArray, partNum * sizeof(int));
|
||||
}
|
||||
|
||||
prev->dNext = g_deviceList;
|
||||
prev->dPartNum = partNum;
|
||||
g_deviceList = prev;
|
||||
return LOS_OK;
|
||||
errout:
|
||||
if (prev->dDev != NULL) {
|
||||
free((void *)prev->dDev);
|
||||
}
|
||||
if (prev->dFsType != NULL) {
|
||||
free((void *)prev->dFsType);
|
||||
}
|
||||
if (prev->dAddrArray != NULL) {
|
||||
free((void *)prev->dAddrArray);
|
||||
}
|
||||
if (prev->dLengthArray != NULL) {
|
||||
free((void *)prev->dLengthArray);
|
||||
}
|
||||
|
||||
free(prev);
|
||||
errno = -ENOMEM;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
|
||||
int LOS_DiskPartition(const char *dev, const char *fsType, int *lengthArray, int *addrArray,
|
||||
int partNum)
|
||||
{
|
||||
int ret = (int)LOS_NOK;
|
||||
struct FsMap *fMap = VfsFsMapGet(fsType);
|
||||
if ((fMap != NULL) && (fMap->fsMgt != NULL) &&
|
||||
(fMap->fsMgt->fdisk != NULL)) {
|
||||
ret = fMap->fsMgt->fdisk(dev, lengthArray, partnum);
|
||||
ret = fMap->fsMgt->fdisk(dev, lengthArray, partNum);
|
||||
if (ret == (int)LOS_NOK) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = AddDevice(dev, fsType, lengthArray, addrArray, partNum);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -100,5 +172,6 @@ int LOS_PartitionFormat(const char *partName, char *fsType, void *data)
|
||||
(fMap->fsMgt->format != NULL)) {
|
||||
ret = fMap->fsMgt->format(partName, data);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#ifndef _VFS_PARTITION_H_
|
||||
#define _VFS_PARTITION_H_
|
||||
|
||||
#include "los_compiler.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
@@ -41,6 +43,19 @@ extern "C" {
|
||||
|
||||
int GetPartIdByPartName(const char *partName);
|
||||
int GetDevIdByDevName(const char *dev);
|
||||
struct DeviceDesc *getDeviceList(void);
|
||||
|
||||
struct DeviceDesc {
|
||||
struct FsMap *dFs; /* file system info */
|
||||
struct DeviceDesc *dNext; /* point to next mount point */
|
||||
const char *dPath; /* target path, /system, /usr, etc. */
|
||||
const char *dDev; /* device, "emmc0p0", "emmc0p1", etc. */
|
||||
void *dData; /* specific file system handle */
|
||||
const char *dFsType; /* file system type */
|
||||
int *dLengthArray; /* point to device partitions length array */
|
||||
int *dAddrArray; /* point to device partitions address array */
|
||||
int dPartNum; /* number of device partitions */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -191,7 +191,7 @@ VOID LOS_LmkOpsNodeInfoShow(VOID)
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
LOS_DL_LIST_FOR_EACH_ENTRY(opsNode, &g_losLmkOps.lmkOpsList, LosLmkOpsNode, node) {
|
||||
PRINTK("Priority: %-4u Free:0x%-8x Restore:0x%-8x\n", opsNode->priority,
|
||||
PRINTK("Priority: %-4u Free:0x%-8x Restore:0x%-8x\n", opsNode->priority,
|
||||
(UINT32)(UINTPTR)opsNode->freeMem, (UINT32)(UINTPTR)opsNode->restoreTask);
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -199,7 +199,7 @@ UINT32 LOS_LmkTasksRestore(VOID);
|
||||
* @brief Kill the tasks to release the used memory.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to kill the tasks to release the used memory when low memory killer is triggered.
|
||||
* This API is used to kill the tasks to release the used memory when low memory killer is triggered.
|
||||
*
|
||||
* @attention None.
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -56,7 +56,7 @@ void *memcpy(void *dest, const void *src, size_t len)
|
||||
}
|
||||
|
||||
#undef strcat
|
||||
char *strcat (char *s, const char *append)
|
||||
char *strcat(char *s, const char *append)
|
||||
{
|
||||
if ((s == NULL) || (append == NULL)) {
|
||||
return NULL;
|
||||
|
||||
@@ -182,18 +182,18 @@ VOID LOS_LmsCheckPoolDel(const VOID *pool)
|
||||
LmsMemListNode *delNode = OsLmsGetPoolNode(pool);
|
||||
if (delNode == NULL) {
|
||||
PRINT_ERR("[LMS]pool %p is not on lms checklist !\n", pool);
|
||||
goto REALEASE;
|
||||
goto RELEASE;
|
||||
}
|
||||
delNode->used = LMS_POOL_UNUSED;
|
||||
LOS_ListDelete(&(delNode->node));
|
||||
|
||||
REALEASE:
|
||||
RELEASE:
|
||||
LMS_UNLOCK(intSave);
|
||||
}
|
||||
|
||||
VOID OsLmsInit(VOID)
|
||||
{
|
||||
memset(g_lmsCheckPoolArray, 0, sizeof(g_lmsCheckPoolArray));
|
||||
(VOID)memset(g_lmsCheckPoolArray, 0, sizeof(g_lmsCheckPoolArray));
|
||||
LOS_ListInit(&g_lmsCheckPoolList);
|
||||
static LmsHook hook = {
|
||||
.init = LOS_LmsCheckPoolAdd,
|
||||
@@ -284,7 +284,7 @@ VOID OsLmsSetShadowValue(LmsMemListNode *node, UINTPTR startAddr, UINTPTR endAdd
|
||||
}
|
||||
|
||||
if (shadowEnd + 1 > shadowStart) {
|
||||
memset((VOID *)shadowStart, value & LMS_SHADOW_MASK_U8, shadowEnd + 1 - shadowStart);
|
||||
(VOID)memset((VOID *)shadowStart, value & LMS_SHADOW_MASK_U8, shadowEnd + 1 - shadowStart);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -339,7 +339,7 @@ VOID OsLmsLosMallocMark(const VOID *curNodeStart, const VOID *nextNodeStart, UIN
|
||||
}
|
||||
|
||||
OsLmsSetShadowValue(node, curNodeStartAddr, curNodeStartAddr + nodeHeadSize, LMS_SHADOW_REDZONE_U8);
|
||||
OsLmsSetShadowValue(node, curNodeStartAddr + nodeHeadSize, nextNodeStartAddr, LMS_SHADOW_ACCESSABLE_U8);
|
||||
OsLmsSetShadowValue(node, curNodeStartAddr + nodeHeadSize, nextNodeStartAddr, LMS_SHADOW_ACCESSIBLE_U8);
|
||||
OsLmsSetShadowValue(node, nextNodeStartAddr, nextNodeStartAddr + nodeHeadSize, LMS_SHADOW_REDZONE_U8);
|
||||
LMS_UNLOCK(intSave);
|
||||
}
|
||||
@@ -357,7 +357,7 @@ VOID OsLmsCheckValid(UINTPTR checkAddr, BOOL isFreeCheck)
|
||||
|
||||
OsLmsGetShadowValue(node, checkAddr, &shadowValue);
|
||||
LMS_UNLOCK(intSave);
|
||||
if ((shadowValue == LMS_SHADOW_ACCESSABLE) || ((isFreeCheck) && (shadowValue == LMS_SHADOW_PAINT))) {
|
||||
if ((shadowValue == LMS_SHADOW_ACCESSIBLE) || ((isFreeCheck) && (shadowValue == LMS_SHADOW_PAINT))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ VOID OsLmsLosFreeMark(const VOID *curNodeStart, const VOID *nextNodeStart, UINT3
|
||||
UINTPTR nextNodeStartAddr = (UINTPTR)nextNodeStart;
|
||||
|
||||
OsLmsGetShadowValue(node, curNodeStartAddr + nodeHeadSize, &shadowValue);
|
||||
if ((shadowValue != LMS_SHADOW_ACCESSABLE) && (shadowValue != LMS_SHADOW_PAINT)) {
|
||||
if ((shadowValue != LMS_SHADOW_ACCESSIBLE) && (shadowValue != LMS_SHADOW_PAINT)) {
|
||||
LMS_UNLOCK(intSave);
|
||||
OsLmsReportError(curNodeStartAddr + nodeHeadSize, MEM_REGION_SIZE_1, FREE_ERRORMODE);
|
||||
return;
|
||||
@@ -421,7 +421,7 @@ VOID LOS_LmsAddrDisableProtect(UINTPTR addrStart, UINTPTR addrEnd)
|
||||
LMS_LOCK(intSave);
|
||||
LmsMemListNode *node = OsLmsGetPoolNodeFromAddr(addrStart);
|
||||
if (node != NULL) {
|
||||
OsLmsSetShadowValue(node, addrStart, addrEnd, LMS_SHADOW_ACCESSABLE_U8);
|
||||
OsLmsSetShadowValue(node, addrStart, addrEnd, LMS_SHADOW_ACCESSIBLE_U8);
|
||||
}
|
||||
LMS_UNLOCK(intSave);
|
||||
}
|
||||
@@ -440,7 +440,7 @@ STATIC UINT32 OsLmsCheckAddr(UINTPTR addr)
|
||||
LmsMemListNode *node = OsLmsGetPoolNodeFromAddr(addr);
|
||||
if (node == NULL) {
|
||||
LMS_UNLOCK(intSave);
|
||||
return LMS_SHADOW_ACCESSABLE_U8;
|
||||
return LMS_SHADOW_ACCESSIBLE_U8;
|
||||
}
|
||||
|
||||
OsLmsGetShadowValue(node, addr, &shadowValue);
|
||||
@@ -556,7 +556,7 @@ STATIC VOID OsLmsGetErrorInfo(UINTPTR addr, UINT32 size, LmsAddrInfo *info)
|
||||
{
|
||||
LmsMemListNode *node = OsLmsGetPoolNodeFromAddr(addr);
|
||||
OsLmsGetShadowInfo(node, addr, info);
|
||||
if (info->shadowValue != LMS_SHADOW_ACCESSABLE_U8) {
|
||||
if (info->shadowValue != LMS_SHADOW_ACCESSIBLE_U8) {
|
||||
return;
|
||||
} else {
|
||||
OsLmsGetShadowInfo(node, addr + size - 1, info);
|
||||
@@ -572,7 +572,7 @@ STATIC VOID OsLmsPrintErrInfo(LmsAddrInfo *info, UINT32 errMod)
|
||||
case LMS_SHADOW_REDZONE:
|
||||
PRINT_ERR("Heap buffer overflow error detected\n");
|
||||
break;
|
||||
case LMS_SHADOW_ACCESSABLE:
|
||||
case LMS_SHADOW_ACCESSIBLE:
|
||||
PRINT_ERR("No error\n");
|
||||
break;
|
||||
default:
|
||||
@@ -609,7 +609,7 @@ VOID OsLmsReportError(UINTPTR p, UINT32 size, UINT32 errMod)
|
||||
|
||||
LMS_LOCK(intSave);
|
||||
g_checkDepth += 1;
|
||||
memset(&info, 0, sizeof(LmsAddrInfo));
|
||||
(VOID)memset(&info, 0, sizeof(LmsAddrInfo));
|
||||
|
||||
PRINT_ERR("***** Kernel Address Sanitizer Error Detected Start *****\n");
|
||||
|
||||
@@ -628,7 +628,7 @@ VOID OsLmsReportError(UINTPTR p, UINT32 size, UINT32 errMod)
|
||||
#if (LOSCFG_LMS_STORE_CHECK == 1)
|
||||
VOID __asan_store1_noabort(UINTPTR p)
|
||||
{
|
||||
if (OsLmsCheckAddr(p) != LMS_SHADOW_ACCESSABLE_U8) {
|
||||
if (OsLmsCheckAddr(p) != LMS_SHADOW_ACCESSIBLE_U8) {
|
||||
OsLmsReportError(p, MEM_REGION_SIZE_1, STORE_ERRMODE);
|
||||
}
|
||||
}
|
||||
@@ -704,7 +704,7 @@ VOID __asan_storeN_noabort(UINTPTR p, UINT32 size)
|
||||
#if (LOSCFG_LMS_LOAD_CHECK == 1)
|
||||
VOID __asan_load1_noabort(UINTPTR p)
|
||||
{
|
||||
if (OsLmsCheckAddr(p) != LMS_SHADOW_ACCESSABLE_U8) {
|
||||
if (OsLmsCheckAddr(p) != LMS_SHADOW_ACCESSIBLE_U8) {
|
||||
OsLmsReportError(p, MEM_REGION_SIZE_1, LOAD_ERRMODE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,13 +59,13 @@ extern "C" {
|
||||
#define LMS_POOL_RESIZE(size) ((size) / (LMS_SHADOW_U8_REFER_BYTES + 1) * LMS_SHADOW_U8_REFER_BYTES)
|
||||
#define LMS_ADDR_ALIGN(p) (((UINTPTR)(p) + sizeof(UINTPTR) - 1) & ~((UINTPTR)(sizeof(UINTPTR) - 1)))
|
||||
|
||||
#define LMS_SHADOW_ACCESSABLE 0x00
|
||||
#define LMS_SHADOW_ACCESSIBLE 0x00
|
||||
#define LMS_SHADOW_AFTERFREE 0x03
|
||||
#define LMS_SHADOW_REDZONE 0x02
|
||||
#define LMS_SHADOW_PAINT 0x01
|
||||
#define LMS_SHADOW_MASK 0x03
|
||||
|
||||
#define LMS_SHADOW_ACCESSABLE_U8 0x00
|
||||
#define LMS_SHADOW_ACCESSIBLE_U8 0x00
|
||||
#define LMS_SHADOW_AFTERFREE_U8 0xFF
|
||||
#define LMS_SHADOW_REDZONE_U8 0xAA
|
||||
#define LMS_SHADOW_MASK_U8 0xFF
|
||||
|
||||
@@ -34,7 +34,7 @@ module_switch = defined(LOSCFG_NET_LWIP_SACK)
|
||||
module_name = "lwip"
|
||||
kernel_module(module_name) {
|
||||
sources = LWIP_PORTING_FILES + LWIPNOAPPSFILES - [ "$LWIPDIR/api/sockets.c" ]
|
||||
include_dirs = [ "//utils/native/lite/include" ]
|
||||
include_dirs = [ "//commonlibrary/utils_lite/include" ]
|
||||
}
|
||||
|
||||
config("public") {
|
||||
|
||||
@@ -240,4 +240,7 @@
|
||||
#define LWIP_SOCKET_OFFSET CONFIG_NFILE_DESCRIPTORS
|
||||
#endif
|
||||
|
||||
#define LWIP_SOCKET_IOCTL 0
|
||||
#define LWIP_SOCKET_FCNTL 0
|
||||
|
||||
#endif /* _LWIP_PORTING_LWIPOPTS_H_ */
|
||||
|
||||
@@ -469,8 +469,9 @@ LWIP_STATIC int OsPingFunc(u32_t *parg)
|
||||
}
|
||||
intrvl -= 1000; /* 1000: 1000ms = 1s */
|
||||
sys_msleep(1000); /* 1000: 1000ms = 1s */
|
||||
if (ping_kill == 1)
|
||||
if (ping_kill == 1) {
|
||||
break;
|
||||
}
|
||||
} while (intrvl > 0);
|
||||
succ_cnt++;
|
||||
break;
|
||||
@@ -528,7 +529,7 @@ u32_t OsShellPing(int argc, const char **argv)
|
||||
{
|
||||
int ret;
|
||||
u32_t i = 0;
|
||||
u32_t count = 0;
|
||||
u32_t count;
|
||||
int count_set = 0;
|
||||
u32_t interval = 1000; /* default ping interval */
|
||||
u32_t data_len = 48; /* default data length */
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
#include <stdlib.h>
|
||||
#include "lwip/tcpip.h"
|
||||
#include "ohos_init.h"
|
||||
void TcpIpPortingInit()
|
||||
|
||||
void TcpIpPortingInit(void)
|
||||
{
|
||||
tcpip_init(NULL, NULL);
|
||||
}
|
||||
|
||||
@@ -211,6 +211,7 @@ int close(int fd)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LWIP_SOCKET_IOCTL
|
||||
#ifdef LWIP_SOCKET_IOCTL_FUNC
|
||||
int ioctl(int fd, int req, ...)
|
||||
{
|
||||
@@ -222,7 +223,9 @@ int ioctl(int fd, int req, ...)
|
||||
return lwip_ioctl(fd, (long)req, (void *)arg);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LWIP_SOCKET_FCNTL
|
||||
#ifdef LWIP_SOCKET_FCNTL_FUNC
|
||||
int fcntl(int fd, int cmd, ...)
|
||||
{
|
||||
@@ -234,6 +237,7 @@ int fcntl(int fd, int cmd, ...)
|
||||
return lwip_fcntl(fd, cmd, val);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LWIP_SOCKET_SELECT
|
||||
#ifdef LWIP_SOCKET_SELECT_FUNC
|
||||
|
||||
@@ -130,7 +130,7 @@ STATIC BOOL OsPmTickTimerStop(LosPmCB *pm)
|
||||
LosPmTickTimer *tickTimer = pm->tickTimer;
|
||||
|
||||
if ((tickTimer == NULL) || (tickTimer->tickLock == NULL) ||
|
||||
(pm->pmMode == LOS_SYS_NORMAL_SLEEP)) {
|
||||
(pm->sysMode == LOS_SYS_NORMAL_SLEEP)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -264,6 +264,7 @@ STATIC UINT32 OsPmSuspendSleep(LosPmCB *pm)
|
||||
|
||||
if (pm->sysctrl->suspendCheck != NULL) {
|
||||
pm->sysctrl->suspendCheck(mode);
|
||||
pm->sysMode = pm->pmMode;
|
||||
}
|
||||
|
||||
tickTimerStop = OsPmTickTimerStop(pm);
|
||||
|
||||
@@ -67,7 +67,7 @@ int SysUserTaskCreate(unsigned long entry, unsigned long userArea, unsigned long
|
||||
|
||||
int SysSchedSetScheduler(unsigned int tid, int policy, int priority)
|
||||
{
|
||||
if ((tid <= 0) || (tid > LOSCFG_BASE_CORE_TSK_LIMIT)) {
|
||||
if ((tid == 0) || (tid > LOSCFG_BASE_CORE_TSK_LIMIT)) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ int *SysSchedGetArea(unsigned int tid)
|
||||
unsigned int intSave;
|
||||
int *area = NULL;
|
||||
|
||||
if ((tid <= 0) || (tid > LOSCFG_BASE_CORE_TSK_LIMIT)) {
|
||||
if ((tid == 0) || (tid > LOSCFG_BASE_CORE_TSK_LIMIT)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -263,7 +263,7 @@ SYSCALL_HAND_DEF(__NR_get_thread_area, SysGetThreadArea, char *, ARG_NUM_0)
|
||||
// SYSCALL_HAND_DEF(__NR_pthread_set_detach, SysUserThreadSetDetach, int, ARG_NUM_1)
|
||||
// SYSCALL_HAND_DEF(__NR_pthread_join, SysThreadJoin, int, ARG_NUM_1)
|
||||
// SYSCALL_HAND_DEF(__NR_pthread_deatch, SysUserThreadDetach, int, ARG_NUM_1)
|
||||
SYSCALL_HAND_DEF(__NR_creat_user_thread, SysUserTaskCreate, unsigned int, ARG_NUM_4)
|
||||
SYSCALL_HAND_DEF(__NR_create_user_thread, SysUserTaskCreate, unsigned int, ARG_NUM_4)
|
||||
// SYSCALL_HAND_DEF(__NR_getrusage, SysGetrusage, int, ARG_NUM_2)
|
||||
// SYSCALL_HAND_DEF(__NR_sysconf, SysSysconf, long, ARG_NUM_1)
|
||||
// SYSCALL_HAND_DEF(__NR_ugetrlimit, SysUgetrlimit, int, ARG_NUM_2)
|
||||
|
||||
@@ -43,6 +43,10 @@
|
||||
#include "los_debugtools.h"
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_KERNEL_TRACE == 1)
|
||||
#include "los_trace_pri.h"
|
||||
#endif
|
||||
|
||||
#define SHELL_INIT_MAGIC_FLAG 0xABABABAB
|
||||
|
||||
STATIC CmdModInfo cmdInfo;
|
||||
@@ -75,6 +79,13 @@ CmdItem g_shellcmdAll[] = {
|
||||
{CMD_TYPE_EX, "st", 1, (CmdCallBackFunc)OsShellCmdSchedTrace},
|
||||
#endif
|
||||
{CMD_TYPE_EX, "help", 0, (CmdCallBackFunc)OsShellCmdHelp},
|
||||
#if (LOSCFG_KERNEL_TRACE == 1)
|
||||
{CMD_TYPE_EX, "trace_start", 0, (CmdCallBackFunc)LOS_TraceStart},
|
||||
{CMD_TYPE_EX, "trace_stop", 0, (CmdCallBackFunc)LOS_TraceStop},
|
||||
{CMD_TYPE_EX, "trace_mask", 1, (CmdCallBackFunc)OsShellCmdTraceSetMask},
|
||||
{CMD_TYPE_EX, "trace_reset", 0, (CmdCallBackFunc)LOS_TraceReset},
|
||||
{CMD_TYPE_EX, "trace_dump", 1, (CmdCallBackFunc)OsShellCmdTraceDump},
|
||||
#endif
|
||||
};
|
||||
|
||||
CmdModInfo *OsCmdInfoGet(VOID)
|
||||
|
||||
@@ -82,7 +82,6 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdFree(INT32 argc, const CHAR *argv[])
|
||||
#if (LOSCFG_MEM_WATERLINE == 1)
|
||||
LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdWaterLine(INT32 argc, const CHAR *argv[])
|
||||
{
|
||||
UINT32 ret;
|
||||
LOS_MEM_POOL_STATUS poolStatus;
|
||||
|
||||
if (argc > 1) {
|
||||
|
||||
@@ -544,11 +544,6 @@ STATIC INT32 OsShellCmdDoRmdir(const CHAR *pathname)
|
||||
}
|
||||
if (strcmp(dirent->d_name, "..") && strcmp(dirent->d_name, ".")) {
|
||||
size_t fullPathBufSize = strlen(pathname) + strlen(dirent->d_name) + SEPARATOR_EOF_LEN;
|
||||
if (fullPathBufSize <= 0) {
|
||||
PRINTK("buffer size is invalid!\n");
|
||||
(VOID)closedir(d);
|
||||
return -1;
|
||||
}
|
||||
fullpath = (CHAR *)malloc(fullPathBufSize);
|
||||
if (fullpath == NULL) {
|
||||
PRINTK("malloc failure!\n");
|
||||
|
||||
@@ -64,3 +64,11 @@ kernel_module(module_name) {
|
||||
include_dirs += [ "pipeline/serial" ]
|
||||
}
|
||||
}
|
||||
|
||||
config("public") {
|
||||
include_dirs = [
|
||||
".",
|
||||
"cnv",
|
||||
"pipeline",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -39,12 +39,6 @@
|
||||
#include "los_swtmr.h"
|
||||
#include "los_hook.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
STATIC VOID LOS_TraceMemInit(VOID *pool, UINT32 size)
|
||||
{
|
||||
LOS_TRACE(MEM_INFO_REQ, pool);
|
||||
@@ -264,9 +258,3 @@ VOID OsTraceCnvInit(VOID)
|
||||
LOS_HookReg(LOS_HOOK_TYPE_SWTMR_START, LOS_TraceSwtmrStart);
|
||||
LOS_HookReg(LOS_HOOK_TYPE_SWTMR_STOP, LOS_TraceSwtmrStop);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -45,12 +45,6 @@
|
||||
#include "shell.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if (LOSCFG_KERNEL_TRACE == 1)
|
||||
LITE_OS_SEC_BSS STATIC UINT32 g_traceEventCount;
|
||||
LITE_OS_SEC_BSS STATIC volatile enum TraceState g_traceState = TRACE_UNINIT;
|
||||
@@ -417,18 +411,6 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdTraceDump(INT32 argc, const CHAR **argv)
|
||||
LOS_TraceRecordDump(toClient);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
SHELLCMD_ENTRY(tracestart_shellcmd, CMD_TYPE_EX, "trace_start", 0, (CmdCallBackFunc)LOS_TraceStart);
|
||||
SHELLCMD_ENTRY(tracestop_shellcmd, CMD_TYPE_EX, "trace_stop", 0, (CmdCallBackFunc)LOS_TraceStop);
|
||||
SHELLCMD_ENTRY(tracesetmask_shellcmd, CMD_TYPE_EX, "trace_mask", 1, (CmdCallBackFunc)OsShellCmdTraceSetMask);
|
||||
SHELLCMD_ENTRY(tracereset_shellcmd, CMD_TYPE_EX, "trace_reset", 0, (CmdCallBackFunc)LOS_TraceReset);
|
||||
SHELLCMD_ENTRY(tracedump_shellcmd, CMD_TYPE_EX, "trace_dump", 1, (CmdCallBackFunc)OsShellCmdTraceDump);
|
||||
#endif
|
||||
|
||||
#endif /* LOSCFG_KERNEL_TRACE == 1 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -152,6 +152,11 @@ extern VOID OsTraceRecordDump(BOOL toClient);
|
||||
#define OsTraceNotifyStop()
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_SHELL == 1)
|
||||
extern UINT32 OsShellCmdTraceSetMask(INT32 argc, const CHAR **argv);
|
||||
extern UINT32 OsShellCmdTraceDump(INT32 argc, const CHAR **argv);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
|
||||
@@ -32,12 +32,6 @@
|
||||
#include "trace_pipeline_serial.h"
|
||||
#include "trace_pipeline.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if (LOSCFG_TRACE_CONTROL_AGENT == 1)
|
||||
UINT32 SerialPipelineInit(VOID)
|
||||
{
|
||||
@@ -93,9 +87,3 @@ UINT32 OsTracePipelineInit(VOID)
|
||||
OsTracePipelineReg(&g_serialOps);
|
||||
return g_serialOps.init();
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -33,12 +33,6 @@
|
||||
#include "trace_tlv.h"
|
||||
#include "los_trace_pri.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if (LOSCFG_KERNEL_SMP == 1)
|
||||
LITE_OS_SEC_BSS SPIN_LOCK_INIT(g_pipeSpin);
|
||||
#define PIPE_LOCK(state) LOS_SpinLockSave(&g_pipeSpin, &(state))
|
||||
@@ -154,9 +148,3 @@ UINT32 OsTraceDataWait(VOID)
|
||||
{
|
||||
return g_tracePipelineOps->wait();
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -32,12 +32,6 @@
|
||||
#include "trace_tlv.h"
|
||||
#include "securec.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define CRC_WIDTH 8
|
||||
#define CRC_POLY 0x1021
|
||||
#define CRC_TOPBIT 0x8000
|
||||
@@ -114,9 +108,3 @@ UINT32 OsTraceDataEncode(UINT8 type, const TlvTable *table, UINT8 *src, UINT8 *d
|
||||
head->crc = crc;
|
||||
return len + sizeof(TraceMsgTlvHead);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -31,12 +31,8 @@
|
||||
|
||||
#include "los_trace_pri.h"
|
||||
#include "trace_pipeline.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#include "los_memory.h"
|
||||
#include "securec.h"
|
||||
|
||||
#if (LOSCFG_RECORDER_MODE_OFFLINE == 1)
|
||||
#define BITS_NUM_FOR_TASK_ID 16
|
||||
@@ -257,9 +253,3 @@ OfflineHead *OsTraceRecordGet(VOID)
|
||||
}
|
||||
|
||||
#endif /* LOSCFG_RECORDER_MODE_OFFLINE == 1 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -32,12 +32,6 @@
|
||||
#include "los_trace_pri.h"
|
||||
#include "trace_pipeline.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if (LOSCFG_RECORDER_MODE_ONLINE == 1)
|
||||
UINT32 OsTraceGetMaskTid(UINT32 taskId)
|
||||
{
|
||||
@@ -105,9 +99,3 @@ OfflineHead *OsTraceRecordGet(VOID)
|
||||
}
|
||||
|
||||
#endif /* LOSCFG_RECORDER_MODE_ONLINE == 1 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -86,10 +86,6 @@ optimize_config_cflags = []
|
||||
optimize_config_asmflags = []
|
||||
|
||||
if (defined(LOSCFG_COMPILE_DEBUG)) {
|
||||
optimize_config_cflags += [
|
||||
"-g",
|
||||
"-gdwarf-2",
|
||||
]
|
||||
optimize_config_cflags += [ "-On" ]
|
||||
} else {
|
||||
if (defined(LOSCFG_COMPILE_OPTIMIZE)) {
|
||||
@@ -118,12 +114,14 @@ kconfig_config_cflags += [
|
||||
warn_config_cflags = []
|
||||
warn_config_asmflags = []
|
||||
|
||||
warn_config_cflags += [
|
||||
"--warnings_affect_exit_code",
|
||||
"--warnings_are_errors",
|
||||
"--warn_about_c_style_casts",
|
||||
"--warn_about_incomplete_constructors",
|
||||
]
|
||||
if (!defined(LOSCFG_TEST)) {
|
||||
warn_config_cflags += [
|
||||
"--warnings_affect_exit_code",
|
||||
"--warnings_are_errors",
|
||||
"--warn_about_c_style_casts",
|
||||
"--warn_about_incomplete_constructors",
|
||||
]
|
||||
}
|
||||
|
||||
#
|
||||
# dialect_config
|
||||
|
||||
@@ -978,21 +978,17 @@ osStatus_t osEventFlagsDelete(osEventFlagsId_t ef_id)
|
||||
{
|
||||
PEVENT_CB_S pstEventCB = (PEVENT_CB_S)ef_id;
|
||||
UINT32 intSave;
|
||||
osStatus_t ret;
|
||||
osStatus_t ret = osOK;
|
||||
if (OS_INT_ACTIVE) {
|
||||
return osErrorISR;
|
||||
}
|
||||
intSave = LOS_IntLock();
|
||||
if (LOS_EventDestroy(pstEventCB) == LOS_OK) {
|
||||
ret = osOK;
|
||||
} else {
|
||||
if (LOS_EventDestroy(pstEventCB) != LOS_OK) {
|
||||
ret = osErrorParameter;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
if (LOS_MemFree(m_aucSysMem0, (void *)pstEventCB) == LOS_OK) {
|
||||
ret = osOK;
|
||||
} else {
|
||||
if (LOS_MemFree(m_aucSysMem0, (void *)pstEventCB) != LOS_OK) {
|
||||
ret = osErrorParameter;
|
||||
}
|
||||
|
||||
@@ -1238,14 +1234,40 @@ osMessageQueueId_t osMessageQueueNew(uint32_t msg_count, uint32_t msg_size, cons
|
||||
{
|
||||
UINT32 queueId;
|
||||
UINT32 ret;
|
||||
UNUSED(attr);
|
||||
osMessageQueueId_t handle;
|
||||
const char *queueName = NULL;
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
UINT32 queueSize = 0;
|
||||
UINT8 *staticMem = NULL;
|
||||
#endif
|
||||
|
||||
if ((msg_count == 0) || (msg_size == 0) || OS_INT_ACTIVE) {
|
||||
return (osMessageQueueId_t)NULL;
|
||||
}
|
||||
|
||||
ret = LOS_QueueCreate((char *)NULL, (UINT16)msg_count, &queueId, 0, (UINT16)msg_size);
|
||||
if (attr != NULL) {
|
||||
queueName = attr->name;
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
queueSize = attr->mq_size;
|
||||
staticMem = attr->mq_mem;
|
||||
if (((queueSize == 0) && (staticMem != NULL)) || ((queueSize != 0) && (staticMem == NULL))) {
|
||||
return (osMessageQueueId_t)NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
if (staticMem != NULL) {
|
||||
ret = LOS_QueueCreateStatic((const CHAR *)queueName, (UINT16)msg_count, &queueId, \
|
||||
(UINT8 *)staticMem, 0, (UINT16)queueSize / msg_count);
|
||||
} else {
|
||||
ret = LOS_QueueCreate((const CHAR *)queueName, (UINT16)msg_count, &queueId, 0, (UINT16)msg_size);
|
||||
}
|
||||
#else
|
||||
ret = LOS_QueueCreate((const CHAR *)queueName, (UINT16)msg_count, &queueId, 0, (UINT16)msg_size);
|
||||
#endif
|
||||
|
||||
if (ret == LOS_OK) {
|
||||
handle = (osMessageQueueId_t)(GET_QUEUE_HANDLE(queueId));
|
||||
} else {
|
||||
@@ -1373,8 +1395,13 @@ osStatus_t osMessageQueueDelete(osMessageQueueId_t mq_id)
|
||||
|
||||
const char *osMessageQueueGetName(osMessageQueueId_t mq_id)
|
||||
{
|
||||
UNUSED(mq_id);
|
||||
return NULL;
|
||||
if (mq_id == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LosQueueCB *pstQueue = (LosQueueCB *)mq_id;
|
||||
|
||||
return (const char *)pstQueue->queueName;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -28,22 +28,20 @@
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include "los_config.h"
|
||||
#include "stdarg.h"
|
||||
#include "dirent.h"
|
||||
#include "sys/mount.h"
|
||||
#include "sys/statfs.h"
|
||||
#include "sys/stat.h"
|
||||
#include "unistd.h"
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/statfs.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef LOSCFG_LIBC_MUSL_FS
|
||||
#include "los_fs.h"
|
||||
#else
|
||||
#include "sys/stat.h"
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_LIBC_MUSL_FS
|
||||
int mount(const char *source, const char *target,
|
||||
const char *filesystemtype, unsigned long mountflags,
|
||||
const void *data)
|
||||
@@ -161,6 +159,45 @@ ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset)
|
||||
return LOS_Pwrite(fd, buf, nbyte, offset);
|
||||
}
|
||||
|
||||
int access(const char *path, int mode)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (stat(path, &st) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if ((st.st_mode & S_IFDIR) || (st.st_mode & S_IFREG)) {
|
||||
return 0;
|
||||
}
|
||||
if ((mode & W_OK) && !(st.st_mode & S_IWRITE)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fcntl(int fd, int cmd, ...)
|
||||
{
|
||||
int ret;
|
||||
va_list vaList;
|
||||
|
||||
va_start(vaList, cmd);
|
||||
ret = OsFcntl(fd, cmd, vaList);
|
||||
va_end(vaList);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ioctl(int fd, int req, ...)
|
||||
{
|
||||
int ret;
|
||||
va_list vaList;
|
||||
|
||||
va_start(vaList, req);
|
||||
ret = OsIoctl(fd, req, vaList);
|
||||
va_end(vaList);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#else /* #ifdef LOSCFG_FS_VFS */
|
||||
|
||||
int mount(const char *source, const char *target,
|
||||
@@ -275,4 +312,18 @@ ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int access(const char *path, int mode)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int fcntl(int fd, int cmd, ...)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ioctl(int fd, int req, ...)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -175,7 +175,8 @@ int gethostbyname2_r(const char * __restrict name, int af, struct hostent * __re
|
||||
int * __restrict h_errnop);
|
||||
struct hostent *gethostbyname2(const char *name, int af);
|
||||
int gethostbyaddr_r(const void * __restrict addr, __socklen_t len, int type, struct hostent * __restrict result_buf, \
|
||||
char * __restrict buf, size_t buflen, struct hostent ** __restrict result, int * __restrict h_errnop);
|
||||
char * __restrict buf, size_t buflen, struct hostent ** __restrict result, \
|
||||
int * __restrict h_errnop);
|
||||
int getservbyport_r(int port, const char * __restrict proto, struct servent * __restrict result_buf, \
|
||||
char * __restrict buf, size_t buflen, struct servent ** __restrict result);
|
||||
int getservbyname_r(const char *name, const char *proto, struct servent *result_buf, char *buf, size_t buflen, \
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 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 specific prior written
|
||||
* permission.
|
||||
*
|
||||
* 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 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, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 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,
|
||||
* 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 OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _ADAPT_SYS_STAT_H
|
||||
#define _ADAPT_SYS_STAT_H
|
||||
|
||||
#include <sys/features.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define S_IFMT 0170000
|
||||
|
||||
#define S_IFDIR 0040000
|
||||
#define S_IFCHR 0020000
|
||||
#define S_IFBLK 0060000
|
||||
#define S_IFREG 0100000
|
||||
#define S_IFIFO 0010000
|
||||
#define S_IFLNK 0120000
|
||||
#define S_IFSOCK 0140000
|
||||
|
||||
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
||||
#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
|
||||
#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
|
||||
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
|
||||
#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
|
||||
#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
|
||||
#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
|
||||
|
||||
#ifndef S_IRUSR
|
||||
#define S_ISUID 04000
|
||||
#define S_ISGID 02000
|
||||
#define S_ISVTX 01000
|
||||
#define S_IRUSR 0400
|
||||
#define S_IWUSR 0200
|
||||
#define S_IXUSR 0100
|
||||
#define S_IRWXU 0700
|
||||
#define S_IRGRP 0040
|
||||
#define S_IWGRP 0020
|
||||
#define S_IXGRP 0010
|
||||
#define S_IRWXG 0070
|
||||
#define S_IROTH 0004
|
||||
#define S_IWOTH 0002
|
||||
#define S_IXOTH 0001
|
||||
#define S_IRWXO 0007
|
||||
#endif
|
||||
|
||||
#define st_atime st_atim.tv_sec
|
||||
#define st_mtime st_mtim.tv_sec
|
||||
#define st_ctime st_ctim.tv_sec
|
||||
|
||||
struct stat {
|
||||
dev_t st_dev;
|
||||
int __st_dev_padding;
|
||||
long __st_ino_truncated;
|
||||
mode_t st_mode;
|
||||
nlink_t st_nlink;
|
||||
uid_t st_uid;
|
||||
gid_t st_gid;
|
||||
dev_t st_rdev;
|
||||
int __st_rdev_padding;
|
||||
off_t st_size;
|
||||
blksize_t st_blksize;
|
||||
blkcnt_t st_blocks;
|
||||
struct {
|
||||
long tv_sec;
|
||||
long tv_nsec;
|
||||
} __st_atim32, __st_mtim32, __st_ctim32;
|
||||
ino_t st_ino;
|
||||
struct timespec st_atim;
|
||||
struct timespec st_mtim;
|
||||
struct timespec st_ctim;
|
||||
};
|
||||
|
||||
int stat(const char *__restrict, struct stat *__restrict);
|
||||
int fstat(int, struct stat *);
|
||||
int mkdir(const char *, mode_t);
|
||||
|
||||
#if defined(_GNU_SOURCE)
|
||||
#define stat64 stat
|
||||
#define fstat64 fstat
|
||||
#define blkcnt64_t blkcnt_t
|
||||
#define fsblkcnt64_t fsblkcnt_t
|
||||
#define fsfilcnt64_t fsfilcnt_t
|
||||
#define ino64_t ino_t
|
||||
#define off64_t off_t
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_ADAPT_SYS_STAT_H */
|
||||
@@ -27,16 +27,17 @@
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include "los_config.h"
|
||||
#include "stdio.h"
|
||||
#include "stdarg.h"
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef LOSCFG_LIBC_NEWLIB_FS
|
||||
#include "los_fs.h"
|
||||
#else
|
||||
#include "sys/stat.h"
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_LIBC_NEWLIB_FS
|
||||
@@ -147,13 +148,25 @@ int ftruncate(int fd, off_t length)
|
||||
return LOS_Ftruncate(fd, length);
|
||||
}
|
||||
|
||||
int fcntl(int fd, int cmd, ...)
|
||||
{
|
||||
int ret;
|
||||
va_list vaList;
|
||||
|
||||
va_start(vaList, cmd);
|
||||
ret = OsFcntl(fd, cmd, vaList);
|
||||
va_end(vaList);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ioctl(int fd, int req, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, req);
|
||||
int ret;
|
||||
ret = LOS_Ioctl(fd, req, ap);
|
||||
va_end(ap);
|
||||
va_list vaList;
|
||||
|
||||
va_start(vaList, req);
|
||||
ret = OsIoctl(fd, req, vaList);
|
||||
va_end(vaList);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -167,6 +180,33 @@ ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset)
|
||||
return LOS_Pwrite(fd, buf, nbyte, offset);
|
||||
}
|
||||
|
||||
int access(const char *path, int mode)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (stat(path, &st) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if ((st.st_mode & S_IFDIR) || (st.st_mode & S_IFREG)) {
|
||||
return 0;
|
||||
}
|
||||
if ((mode & W_OK) && !(st.st_mode & S_IWRITE)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int remove(const char *filename)
|
||||
{
|
||||
int ret = unlink(filename);
|
||||
if (ret == -EISDIR) {
|
||||
ret = rmdir(filename);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#else /* #ifdef LOSCFG_FS_VFS */
|
||||
|
||||
int _open(const char *path, int oflag, ...)
|
||||
@@ -209,4 +249,23 @@ int _stat(const char *path, struct stat *buf)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int access(const char *path, int mode)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int remove(const char *filename)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int fcntl(int fd, int cmd, ...)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ioctl(int fd, int req, ...)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
0
kal/posix/include/rtc_time_hook.h
Executable file → Normal file
0
kal/posix/include/rtc_time_hook.h
Executable file → Normal file
@@ -175,7 +175,7 @@ STATIC INLINE INT32 PollTimedWait(struct pollfd *fds, nfds_t nfds, struct PollTa
|
||||
}
|
||||
} else if (left <= 0) {
|
||||
break;
|
||||
} else if (left > 0) {
|
||||
} else {
|
||||
clock_gettime(CLOCK_REALTIME, &curTime);
|
||||
last = (INT32)((curTime.tv_sec - startTime.tv_sec) * OS_SYS_MS_PER_SECOND +
|
||||
(curTime.tv_nsec - startTime.tv_nsec) / (OS_SYS_NS_PER_SECOND / OS_SYS_MS_PER_SECOND));
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <securec.h>
|
||||
#include <limits.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "los_config.h"
|
||||
#include "los_task.h"
|
||||
#include "los_debug.h"
|
||||
|
||||
@@ -42,12 +42,6 @@
|
||||
#include "los_event.h"
|
||||
#include "los_mux.h"
|
||||
|
||||
typedef struct {
|
||||
volatile INT32 *realValue;
|
||||
INT32 value;
|
||||
UINT32 clearEvent;
|
||||
} EventCond;
|
||||
|
||||
#define INLINE inline
|
||||
|
||||
#define BROADCAST_EVENT 1
|
||||
|
||||
@@ -501,7 +501,7 @@ time_t time(time_t *timer)
|
||||
{
|
||||
UINT64 usec = 0;
|
||||
time_t sec;
|
||||
INT32 rtcRet = 0;
|
||||
INT32 rtcRet;
|
||||
|
||||
if (g_rtcTimeFunc.RtcGetTimeHook != NULL) {
|
||||
rtcRet = g_rtcTimeFunc.RtcGetTimeHook(&usec);
|
||||
|
||||
@@ -350,6 +350,14 @@ extern "C" {
|
||||
#define LOSCFG_BASE_IPC_QUEUE_LIMIT 6
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* Maximum supported number of static queues rather than the number of usable queues
|
||||
*/
|
||||
#ifndef LOSCFG_BASE_IPC_STATIC_QUEUE_LIMIT
|
||||
#define LOSCFG_BASE_IPC_STATIC_QUEUE_LIMIT 3
|
||||
#endif
|
||||
|
||||
|
||||
/* =============================================================================
|
||||
Software timer module configuration
|
||||
@@ -452,7 +460,7 @@ extern UINT8 *m_aucSysMem0;
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* Configuration module tailoring of more mempry pool checking
|
||||
* Configuration module tailoring of more memory pool checking
|
||||
*/
|
||||
#ifndef LOSCFG_MEM_MUL_POOL
|
||||
#define LOSCFG_MEM_MUL_POOL 1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -200,7 +200,8 @@ extern UINT32 LOS_EventInit(PEVENT_CB_S eventCB);
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to check whether an event expected by the user occurs according to the event ID, event mask,
|
||||
* and event reading mode, and process the event based on the event reading mode. The event ID must point to valid memory.
|
||||
* and event reading mode, and process the event based on the event reading mode. The event ID must point to
|
||||
* valid memory.
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>When the mode is LOS_WAITMODE_CLR, the eventID is passed-out.</li>
|
||||
@@ -225,7 +226,8 @@ extern UINT32 LOS_EventPoll(UINT32 *eventID, UINT32 eventMask, UINT32 mode);
|
||||
* @brief Read an event.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to block or schedule a task that reads an event of which the event control block, event mask, reading mode,
|
||||
* This API is used to block or schedule a task that reads an event of which the event control block, event mask,
|
||||
* reading mode,
|
||||
* and timeout information are specified.
|
||||
* </ul>
|
||||
* @attention
|
||||
@@ -234,13 +236,15 @@ extern UINT32 LOS_EventPoll(UINT32 *eventID, UINT32 eventMask, UINT32 mode);
|
||||
* the event mask is forbidden to be used.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param eventCB [IN/OUT] Pointer to the event control block to be checked. This parameter must point to valid memory.
|
||||
* @param eventCB [IN/OUT] Pointer to the event control block to be checked. This parameter must point to
|
||||
* valid memory.
|
||||
* @param eventMask [IN] Mask of the event expected to occur by the user, indicating the event obtained after
|
||||
* it is logically processed that matches the ID pointed to by eventID.
|
||||
* @param mode [IN] Event reading mode.
|
||||
* @param timeOut [IN] Timeout interval of event reading (unit: Tick).
|
||||
*
|
||||
* @retval #LOS_ERRNO_EVENT_SETBIT_INVALID Bit 25 of the event mask cannot be set because it is set to an error number.
|
||||
* @retval #LOS_ERRNO_EVENT_SETBIT_INVALID Bit 25 of the event mask cannot be set because
|
||||
* it is set to an error number.
|
||||
* @retval #LOS_ERRNO_EVENT_EVENTMASK_INVALID The passed-in event reading mode is incorrect.
|
||||
* @retval #LOS_ERRNO_EVENT_READ_IN_INTERRUPT The event is being read during an interrupt.
|
||||
* @retval #LOS_ERRNO_EVENT_FLAGS_INVALID The event mode is invalid.
|
||||
|
||||
@@ -156,9 +156,9 @@ typedef struct {
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to initialize multiple non-continuous memory regions. If the starting address of a pool is specified,
|
||||
* the memory regions will be linked to the pool as free nodes. Otherwise, the first memory region will be initialized as a
|
||||
* new pool, and the rest regions will be linked as free nodes to the new pool.</li>
|
||||
* <li>This API is used to initialize multiple non-continuous memory regions. If the starting address of a pool is
|
||||
* specified, the memory regions will be linked to the pool as free nodes. Otherwise, the first memory region will
|
||||
* be initialized as a * new pool, and the rest regions will be linked as free nodes to the new pool.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @attention
|
||||
|
||||
@@ -113,7 +113,7 @@ extern "C" {
|
||||
*
|
||||
* Value: 0x02001d06
|
||||
*
|
||||
* Solution: Check whether the task scheduling is disabled, or set uwtimeout to 0, which means that the
|
||||
* Solution: Check whether the task scheduling is disabled, or set timeout to 0, which means that the
|
||||
* thread will not wait for the mutex to become available.
|
||||
*/
|
||||
#define LOS_ERRNO_MUX_PEND_IN_LOCK LOS_ERRNO_OS_ERROR(LOS_MOD_MUX, 0x06)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -344,7 +344,8 @@ extern "C" {
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* In struct QueueInfo, the length of each waitReadTask/waitWriteTask/waitMemTask array depends on the value
|
||||
* LOSCFG_BASE_CORE_TSK_LIMIT. The type of each array element is UINT32, which means that each element could mark 32(=2^5) tasks.
|
||||
* LOSCFG_BASE_CORE_TSK_LIMIT. The type of each array element is UINT32, which means that each element could
|
||||
* mark 32(=2^5) tasks.
|
||||
* OS_WAIT_TASK_ARRAY_LEN is used to calculate the array length.
|
||||
* OS_WAIT_TASK_ID_TO_ARRAY_IDX is used to transfer task ID to array index.
|
||||
* OS_WAIT_TASK_ARRAY_ELEMENT_MASK is the mask for each element.
|
||||
@@ -380,7 +381,7 @@ typedef struct tagQueueInfo {
|
||||
* <ul>
|
||||
* <li>There are LOSCFG_BASE_IPC_QUEUE_LIMIT queues available, change it's value when necessary.</li>
|
||||
* </ul>
|
||||
* @param queueName [IN] Message queue name. Reserved parameter, not used for now.
|
||||
* @param queueName [IN] Message queue name.
|
||||
* @param len [IN] Queue length. The value range is [1,0xffff].
|
||||
* @param queueID [OUT] ID of the queue control structure that is successfully created.
|
||||
* @param flags [IN] Queue mode. Reserved parameter, not used for now.
|
||||
@@ -403,6 +404,41 @@ extern UINT32 LOS_QueueCreate(const CHAR *queueName,
|
||||
UINT32 flags,
|
||||
UINT16 maxMsgSize);
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* @brief Create a static message queue.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to create a message queue using static memory for data storage.
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>There are LOSCFG_BASE_IPC_QUEUE_LIMIT queues available, change it's value when necessary.</li>
|
||||
* </ul>
|
||||
* @param queueName [IN] Message queue name.
|
||||
* @param len [IN] Queue length. The value range is [1,0xffff].
|
||||
* @param queueID [OUT] ID of the queue control structure that is successfully created.
|
||||
* @param staticMem [IN] Pointer to a static memory for the message queue data.
|
||||
* @param flags [IN] Queue mode. Reserved parameter, not used for now.
|
||||
* @param maxMsgSize [IN] Node size. The value range is [1,0xffff-4].
|
||||
*
|
||||
* @retval #LOS_OK The message queue is successfully created.
|
||||
* @retval #LOS_ERRNO_QUEUE_CB_UNAVAILABLE The upper limit of the number of created queues is exceeded.
|
||||
* @retval #LOS_ERRNO_QUEUE_CREATE_NO_MEMORY Insufficient memory for queue creation.
|
||||
* @retval #LOS_ERRNO_QUEUE_CREAT_PTR_NULL Null pointer, queueID is NULL.
|
||||
* @retval #LOS_ERRNO_QUEUE_PARA_ISZERO The queue length or message node size passed in during queue
|
||||
* creation is 0.
|
||||
* @retval #LOS_ERRNO_QUEUE_SIZE_TOO_BIG The parameter maxMsgSize is larger than 0xffff - 4.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_queue.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_QueueDelete
|
||||
*/
|
||||
extern UINT32 LOS_QueueCreateStatic(const CHAR *queueName,
|
||||
UINT16 len,
|
||||
UINT32 *queueID,
|
||||
UINT8 *staticMem,
|
||||
UINT32 flags,
|
||||
UINT16 maxMsgSize);
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* @brief Read a queue.
|
||||
@@ -775,6 +811,7 @@ typedef enum {
|
||||
*/
|
||||
typedef struct {
|
||||
UINT8 *queue; /**< Pointer to a queue handle */
|
||||
UINT8 *queueName; /**< Queue name */
|
||||
UINT16 queueState; /**< Queue state */
|
||||
UINT16 queueLen; /**< Queue length */
|
||||
UINT16 queueSize; /**< Node size */
|
||||
@@ -787,6 +824,9 @@ typedef struct {
|
||||
LOS_DL_LIST memList; /**< Pointer to the memory linked list */
|
||||
} LosQueueCB;
|
||||
|
||||
|
||||
extern LosQueueCB *OsGetQueueHandle(UINT32 queueID);
|
||||
|
||||
/* queue state */
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
@@ -822,14 +862,24 @@ extern LosQueueCB *g_allQueue;
|
||||
* @ingroup los_queue
|
||||
* Obtain a handle of the queue that has a specified ID.
|
||||
*/
|
||||
#define GET_QUEUE_HANDLE(QueueID) (((LosQueueCB *)g_allQueue) + (QueueID))
|
||||
#define GET_QUEUE_HANDLE(QueueID) OsGetQueueHandle(QueueID)
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* Obtain the head node in a queue doubly linked list.
|
||||
* Obtain the head node in a queue doubly linked list.
|
||||
*/
|
||||
#define GET_QUEUE_LIST(ptr) LOS_DL_LIST_ENTRY(ptr, LosQueueCB, readWriteList[OS_QUEUE_WRITE])
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* Maximum number of queues
|
||||
*/
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
#define OS_ALL_IPC_QUEUE_LIMIT LOSCFG_BASE_IPC_QUEUE_LIMIT + LOSCFG_BASE_IPC_STATIC_QUEUE_LIMIT
|
||||
#else
|
||||
#define OS_ALL_IPC_QUEUE_LIMIT LOSCFG_BASE_IPC_QUEUE_LIMIT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* @brief Alloc a stationary memory for a mail.
|
||||
|
||||
@@ -457,7 +457,7 @@ typedef struct tagTskInitParam {
|
||||
TSK_ENTRY_FUNC pfnTaskEntry; /**< Task entrance function */
|
||||
UINT16 usTaskPrio; /**< Task priority */
|
||||
UINT32 uwArg; /**< Task parameters */
|
||||
UINTPTR stackAddr; /**< Task satck memory */
|
||||
UINTPTR stackAddr; /**< Task stack memory */
|
||||
UINT32 uwStackSize; /**< Task stack size */
|
||||
CHAR *pcName; /**< Task name */
|
||||
UINT32 uwResved; /**< Reserved */
|
||||
@@ -746,7 +746,7 @@ extern UINT32 LOS_TaskSuspend(UINT32 taskID);
|
||||
* <li>The idle task and swtmr task cannot be deleted.</li>
|
||||
* <li>If delete current task maybe cause unexpected error.</li>
|
||||
* <li>If a task get a mutex is deleted or automatically deleted before release this mutex, other tasks pended
|
||||
* this mutex maybe never be shchduled.</li>
|
||||
* this mutex maybe never be scheduled.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param taskID [IN] Type #UINT32 Task ID. The task id value is obtained from task creation.
|
||||
|
||||
@@ -91,6 +91,10 @@
|
||||
#include "vfs_operations.h"
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_KERNEL_TRACE == 1)
|
||||
#include "los_trace_pri.h"
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
Function : LOS_Reboot
|
||||
Description : system exception, die in here, wait for watchdog.
|
||||
@@ -241,7 +245,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
|
||||
}
|
||||
|
||||
#if (LOSCFG_KERNEL_TRACE == 1)
|
||||
ret = OsTraceInit(LOSCFG_TRACE_BUFFER_SIZE);
|
||||
ret = OsTraceInit();
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("OsTraceInit error\n");
|
||||
return ret;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -47,6 +47,11 @@
|
||||
LITE_OS_SEC_BSS LosQueueCB *g_allQueue = NULL ;
|
||||
LITE_OS_SEC_BSS LOS_DL_LIST g_freeQueueList;
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
LITE_OS_SEC_BSS LosQueueCB *g_staticQueue = NULL ;
|
||||
LITE_OS_SEC_BSS LOS_DL_LIST g_freeStaticQueueList;
|
||||
#endif
|
||||
|
||||
/**************************************************************************
|
||||
Function : OsQueueInit
|
||||
Description : queue initial
|
||||
@@ -59,7 +64,11 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsQueueInit(VOID)
|
||||
LosQueueCB *queueNode = NULL;
|
||||
UINT16 index;
|
||||
|
||||
if (LOSCFG_BASE_IPC_QUEUE_LIMIT == 0) {
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
LosQueueCB *queueNodeStatic = NULL;
|
||||
#endif
|
||||
|
||||
if (OS_ALL_IPC_QUEUE_LIMIT == 0) {
|
||||
return LOS_ERRNO_QUEUE_MAXNUM_ZERO;
|
||||
}
|
||||
|
||||
@@ -78,24 +87,33 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsQueueInit(VOID)
|
||||
LOS_ListTailInsert(&g_freeQueueList, &queueNode->readWriteList[OS_QUEUE_WRITE]);
|
||||
}
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
g_staticQueue = (LosQueueCB *)LOS_MemAlloc(m_aucSysMem0, LOSCFG_BASE_IPC_STATIC_QUEUE_LIMIT * sizeof(LosQueueCB));
|
||||
if (g_staticQueue == NULL) {
|
||||
return LOS_ERRNO_QUEUE_NO_MEMORY;
|
||||
}
|
||||
|
||||
(VOID)memset_s(g_staticQueue, LOSCFG_BASE_IPC_STATIC_QUEUE_LIMIT * sizeof(LosQueueCB),
|
||||
0, LOSCFG_BASE_IPC_STATIC_QUEUE_LIMIT * sizeof(LosQueueCB));
|
||||
|
||||
LOS_ListInit(&g_freeStaticQueueList);
|
||||
for (index = 0; index < LOSCFG_BASE_IPC_STATIC_QUEUE_LIMIT; index++) {
|
||||
queueNodeStatic = ((LosQueueCB *)g_staticQueue) + index;
|
||||
queueNodeStatic->queueID = index + LOSCFG_BASE_IPC_QUEUE_LIMIT;
|
||||
LOS_ListTailInsert(&g_freeStaticQueueList, &queueNodeStatic->readWriteList[OS_QUEUE_WRITE]);
|
||||
}
|
||||
#endif
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
Function : LOS_QueueCreate
|
||||
Description : Create a queue
|
||||
Input : queueName --- Queue name, less than 4 characters
|
||||
: len --- Queue length
|
||||
: flags --- Queue type, FIFO or PRIO
|
||||
: maxMsgSize --- Maximum message size in byte
|
||||
Output : queueID --- Queue ID
|
||||
Return : LOS_OK on success or error code on failure
|
||||
*****************************************************************************/
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 LOS_QueueCreate(const CHAR *queueName,
|
||||
UINT16 len,
|
||||
UINT32 *queueID,
|
||||
UINT32 flags,
|
||||
UINT16 maxMsgSize)
|
||||
|
||||
static UINT32 OsQueueCreate(const CHAR *queueName,
|
||||
UINT16 len,
|
||||
UINT32 *queueID,
|
||||
UINT8 *staticMem,
|
||||
UINT32 flags,
|
||||
UINT16 maxMsgSize)
|
||||
{
|
||||
LosQueueCB *queueCB = NULL;
|
||||
UINT32 intSave;
|
||||
@@ -103,7 +121,6 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_QueueCreate(const CHAR *queueName,
|
||||
UINT8 *queue = NULL;
|
||||
UINT16 msgSize;
|
||||
|
||||
(VOID)queueName;
|
||||
(VOID)flags;
|
||||
|
||||
if (queueID == NULL) {
|
||||
@@ -124,6 +141,32 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_QueueCreate(const CHAR *queueName,
|
||||
if ((UINT32_MAX / msgSize) < len) {
|
||||
return LOS_ERRNO_QUEUE_SIZE_TOO_BIG;
|
||||
}
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
if (staticMem != NULL) {
|
||||
queue = staticMem;
|
||||
intSave = LOS_IntLock();
|
||||
|
||||
if (LOS_ListEmpty(&g_freeStaticQueueList)) {
|
||||
LOS_IntRestore(intSave);
|
||||
return LOS_ERRNO_QUEUE_CB_UNAVAILABLE;
|
||||
}
|
||||
unusedQueue = LOS_DL_LIST_FIRST(&(g_freeStaticQueueList));
|
||||
} else {
|
||||
queue = (UINT8 *)LOS_MemAlloc(m_aucSysMem0, (UINT32)len * msgSize);
|
||||
if (queue == NULL) {
|
||||
return LOS_ERRNO_QUEUE_CREATE_NO_MEMORY;
|
||||
}
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
if (LOS_ListEmpty(&g_freeQueueList)) {
|
||||
LOS_IntRestore(intSave);
|
||||
(VOID)LOS_MemFree(m_aucSysMem0, queue);
|
||||
return LOS_ERRNO_QUEUE_CB_UNAVAILABLE;
|
||||
}
|
||||
unusedQueue = LOS_DL_LIST_FIRST(&(g_freeQueueList));
|
||||
}
|
||||
#else
|
||||
queue = (UINT8 *)LOS_MemAlloc(m_aucSysMem0, (UINT32)len * msgSize);
|
||||
if (queue == NULL) {
|
||||
return LOS_ERRNO_QUEUE_CREATE_NO_MEMORY;
|
||||
@@ -135,10 +178,12 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_QueueCreate(const CHAR *queueName,
|
||||
(VOID)LOS_MemFree(m_aucSysMem0, queue);
|
||||
return LOS_ERRNO_QUEUE_CB_UNAVAILABLE;
|
||||
}
|
||||
|
||||
unusedQueue = LOS_DL_LIST_FIRST(&(g_freeQueueList));
|
||||
#endif
|
||||
|
||||
LOS_ListDelete(unusedQueue);
|
||||
queueCB = (GET_QUEUE_LIST(unusedQueue));
|
||||
queueCB->queueName = (UINT8 *)queueName; // The name can be null
|
||||
queueCB->queueLen = len;
|
||||
queueCB->queueSize = msgSize;
|
||||
queueCB->queue = queue;
|
||||
@@ -159,10 +204,62 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_QueueCreate(const CHAR *queueName,
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
Function : LOS_QueueCreateStatic
|
||||
Description : Create a queue use static menory
|
||||
Input : queueName --- Queue name, less than 4 characters
|
||||
: len --- Queue length
|
||||
: queueMem --- Queue static memory for data storage
|
||||
: flags --- Queue type, FIFO or PRIO
|
||||
: maxMsgSize --- Maximum message size in byte
|
||||
Output : queueID --- Queue ID
|
||||
Return : LOS_OK on success or error code on failure
|
||||
*****************************************************************************/
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 LOS_QueueCreateStatic(const CHAR *queueName,
|
||||
UINT16 len,
|
||||
UINT32 *queueID,
|
||||
UINT8 *staticMem,
|
||||
UINT32 flags,
|
||||
UINT16 maxMsgSize)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
(VOID)flags;
|
||||
|
||||
ret = OsQueueCreate(queueName, len, queueID, staticMem, 0, maxMsgSize);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
Function : LOS_QueueCreate
|
||||
Description : Create a queue
|
||||
Input : queueName --- Queue name, less than 4 characters
|
||||
: len --- Queue length
|
||||
: flags --- Queue type, FIFO or PRIO
|
||||
: maxMsgSize --- Maximum message size in byte
|
||||
Output : queueID --- Queue ID
|
||||
Return : LOS_OK on success or error code on failure
|
||||
*****************************************************************************/
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 LOS_QueueCreate(const CHAR *queueName,
|
||||
UINT16 len,
|
||||
UINT32 *queueID,
|
||||
UINT32 flags,
|
||||
UINT16 maxMsgSize)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
(VOID)flags;
|
||||
|
||||
ret = OsQueueCreate(queueName, len, queueID, NULL, 0, maxMsgSize);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static INLINE LITE_OS_SEC_TEXT UINT32 OsQueueReadParameterCheck(UINT32 queueID, VOID *bufferAddr,
|
||||
UINT32 *bufferSize, UINT32 timeOut)
|
||||
{
|
||||
if (queueID >= LOSCFG_BASE_IPC_QUEUE_LIMIT) {
|
||||
if (queueID >= OS_ALL_IPC_QUEUE_LIMIT) {
|
||||
return LOS_ERRNO_QUEUE_INVALID;
|
||||
}
|
||||
if ((bufferAddr == NULL) || (bufferSize == NULL)) {
|
||||
@@ -184,7 +281,7 @@ static INLINE LITE_OS_SEC_TEXT UINT32 OsQueueReadParameterCheck(UINT32 queueID,
|
||||
static INLINE LITE_OS_SEC_TEXT UINT32 OsQueueWriteParameterCheck(UINT32 queueID, VOID *bufferAddr,
|
||||
UINT32 *bufferSize, UINT32 timeOut)
|
||||
{
|
||||
if (queueID >= LOSCFG_BASE_IPC_QUEUE_LIMIT) {
|
||||
if (queueID >= OS_ALL_IPC_QUEUE_LIMIT) {
|
||||
return LOS_ERRNO_QUEUE_INVALID;
|
||||
}
|
||||
|
||||
@@ -325,7 +422,6 @@ UINT32 OsQueueOperate(UINT32 queueID, UINT32 operateType, VOID *bufferAddr, UINT
|
||||
|
||||
OsQueueBufferOperate(queueCB, operateType, bufferAddr, bufferSize);
|
||||
|
||||
|
||||
if (!LOS_ListEmpty(&queueCB->readWriteList[readWriteTmp])) {
|
||||
resumedTask = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&queueCB->readWriteList[readWriteTmp]));
|
||||
OsSchedTaskWake(resumedTask);
|
||||
@@ -459,7 +555,7 @@ LITE_OS_SEC_TEXT VOID *OsQueueMailAlloc(UINT32 queueID, VOID *mailPool, UINT32 t
|
||||
LosQueueCB *queueCB = (LosQueueCB *)NULL;
|
||||
LosTaskCB *runTsk = (LosTaskCB *)NULL;
|
||||
|
||||
if (queueID >= LOSCFG_BASE_IPC_QUEUE_LIMIT) {
|
||||
if (queueID >= OS_ALL_IPC_QUEUE_LIMIT) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -523,7 +619,7 @@ LITE_OS_SEC_TEXT UINT32 OsQueueMailFree(UINT32 queueID, VOID *mailPool, VOID *ma
|
||||
LosQueueCB *queueCB = (LosQueueCB *)NULL;
|
||||
LosTaskCB *resumedTask = (LosTaskCB *)NULL;
|
||||
|
||||
if (queueID >= LOSCFG_BASE_IPC_QUEUE_LIMIT) {
|
||||
if (queueID >= OS_ALL_IPC_QUEUE_LIMIT) {
|
||||
return LOS_ERRNO_QUEUE_MAIL_HANDLE_INVALID;
|
||||
}
|
||||
|
||||
@@ -573,7 +669,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_QueueDelete(UINT32 queueID)
|
||||
UINT32 intSave;
|
||||
UINT32 ret;
|
||||
|
||||
if (queueID >= LOSCFG_BASE_IPC_QUEUE_LIMIT) {
|
||||
if (queueID >= OS_ALL_IPC_QUEUE_LIMIT) {
|
||||
return LOS_ERRNO_QUEUE_NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -607,7 +703,16 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_QueueDelete(UINT32 queueID)
|
||||
|
||||
queue = queueCB->queue;
|
||||
queueCB->queue = (UINT8 *)NULL;
|
||||
queueCB->queueName = (UINT8 *)NULL;
|
||||
queueCB->queueState = OS_QUEUE_UNUSED;
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
if (queueID >= LOSCFG_BASE_IPC_QUEUE_LIMIT && queueID < OS_ALL_IPC_QUEUE_LIMIT) {
|
||||
LOS_ListAdd(&g_freeStaticQueueList, &queueCB->readWriteList[OS_QUEUE_WRITE]);
|
||||
LOS_IntRestore(intSave);
|
||||
return LOS_OK;
|
||||
}
|
||||
#endif
|
||||
LOS_ListAdd(&g_freeQueueList, &queueCB->readWriteList[OS_QUEUE_WRITE]);
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
@@ -632,7 +737,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_QueueInfoGet(UINT32 queueID, QUEUE_INFO_S *que
|
||||
return LOS_ERRNO_QUEUE_PTR_NULL;
|
||||
}
|
||||
|
||||
if (queueID >= LOSCFG_BASE_IPC_QUEUE_LIMIT) {
|
||||
if (queueID >= OS_ALL_IPC_QUEUE_LIMIT) {
|
||||
return LOS_ERRNO_QUEUE_INVALID;
|
||||
}
|
||||
|
||||
@@ -673,5 +778,16 @@ QUEUE_END:
|
||||
return ret;
|
||||
}
|
||||
|
||||
LosQueueCB *OsGetQueueHandle(UINT32 queueID)
|
||||
{
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
if (queueID >= LOSCFG_BASE_IPC_QUEUE_LIMIT && queueID < OS_ALL_IPC_QUEUE_LIMIT) {
|
||||
return (((LosQueueCB *)g_staticQueue) + (queueID - LOSCFG_BASE_IPC_QUEUE_LIMIT));
|
||||
}
|
||||
#endif
|
||||
|
||||
return (((LosQueueCB *)g_allQueue) + (queueID));
|
||||
}
|
||||
|
||||
#endif /* (LOSCFG_BASE_IPC_QUEUE == 1) */
|
||||
|
||||
|
||||
@@ -42,12 +42,6 @@
|
||||
#include "los_debugtools.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define OS_PRIORITY_QUEUE_NUM 32
|
||||
#define PRIQUEUE_PRIOR0_BIT 0x80000000U
|
||||
#define OS_TICK_RESPONSE_TIME_MAX LOSCFG_BASE_CORE_TICK_RESPONSE_MAX
|
||||
@@ -628,9 +622,3 @@ VOID LOS_Schedule(VOID)
|
||||
ArchTaskSchedule();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -33,12 +33,6 @@
|
||||
#include "los_sched.h"
|
||||
#include "los_debug.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
|
||||
SortLinkAttribute g_taskSortLink;
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
@@ -175,9 +169,3 @@ UINT64 OsSortLinkGetNextExpireTime(const SortLinkAttribute *sortLinkHead)
|
||||
SortLinkList *listSorted = LOS_DL_LIST_ENTRY(head->pstNext, SortLinkList, sortLinkNode);
|
||||
return OsSortLinkGetTargetExpireTime(OsGetCurrSchedTimeCycle(), listSorted);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -101,7 +101,6 @@ LITE_OS_SEC_TEXT VOID OsSwtmrTask(VOID)
|
||||
tick = LOS_TickCountGet();
|
||||
swtmrHandle.handler(swtmrHandle.arg);
|
||||
tick = LOS_TickCountGet() - tick;
|
||||
|
||||
if (tick >= SWTMR_MAX_RUNNING_TICKS) {
|
||||
PRINT_WARN("timer_handler(%p) cost too many ms(%d)\n",
|
||||
swtmrHandle.handler,
|
||||
|
||||
@@ -598,7 +598,7 @@ STATIC INLINE VOID OsLmsReallocMergeNodeMark(struct OsMemNodeHead *node)
|
||||
}
|
||||
|
||||
g_lms->simpleMark((UINTPTR)node + OS_MEM_NODE_HEAD_SIZE, (UINTPTR)OS_MEM_NEXT_NODE(node),
|
||||
LMS_SHADOW_ACCESSABLE_U8);
|
||||
LMS_SHADOW_ACCESSIBLE_U8);
|
||||
}
|
||||
|
||||
STATIC INLINE VOID OsLmsReallocSplitNodeMark(struct OsMemNodeHead *node)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -340,6 +340,7 @@ typedef struct tagHwiHandleForm {
|
||||
#define TEST_HwiCreate(ID, prio, mode, Func, irqParam) LOS_HwiCreate(ID, prio, mode, Func, irqParam)
|
||||
#define uart_printf_func printf
|
||||
|
||||
extern VOID ItSuiteLosAtomic(void);
|
||||
extern VOID ItSuiteLosTask(void);
|
||||
extern VOID ItSuiteLosQueue(void);
|
||||
extern VOID ItSuiteLosMux(void);
|
||||
|
||||
@@ -43,6 +43,10 @@
|
||||
#define Level1 0
|
||||
#define LITE_TEST_CASE(module, function, flag) static int function(void)
|
||||
|
||||
#define STATCI_BUFF_SIZE 32
|
||||
#define READ_BUFFER_SIZIE 7
|
||||
#define QUEUE_WAIT_TIMEOUT 3
|
||||
|
||||
static VOID CmsisStackFunc01(void)
|
||||
{
|
||||
g_testCount++;
|
||||
@@ -77,8 +81,389 @@ EXIT:
|
||||
return LOS_OK;
|
||||
};
|
||||
|
||||
void CmsisFuncTestSuite(void)
|
||||
/**
|
||||
* @tc.name: TestCmsis007
|
||||
* @tc.desc: set and get queue name
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issueI5LBE8
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisFuncTestSuite, TestCmsis007, Function | MediumTest | Level1)
|
||||
{
|
||||
ADD_TEST_CASE(TestCmsis001);
|
||||
osMessageQueueId_t msgQueueId;
|
||||
osMessageQueueAttr_t attr = {0};
|
||||
CHAR staticBuff[STATCI_BUFF_SIZE] = {0};
|
||||
CHAR strbuff[] = "hello world";
|
||||
CHAR *name = NULL;
|
||||
INT32 ret;
|
||||
|
||||
attr.name = "q1";
|
||||
/* dynamic test */
|
||||
msgQueueId = osMessageQueueNew(1, strlen(strbuff), &attr);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(msgQueueId, NULL, msgQueueId);
|
||||
|
||||
name = (CHAR *)osMessageQueueGetName(msgQueueId);
|
||||
ret = strcmp(name, "q1");
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
|
||||
|
||||
ret = osMessageQueueDelete(msgQueueId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
name = (CHAR *)osMessageQueueGetName(msgQueueId);
|
||||
ICUNIT_ASSERT_EQUAL(name, NULL, name);
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
attr.mq_mem = staticBuff;
|
||||
attr.mq_size = STATCI_BUFF_SIZE;
|
||||
msgQueueId = osMessageQueueNew(1, STATCI_BUFF_SIZE, &attr);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(msgQueueId, NULL, msgQueueId);
|
||||
|
||||
name = osMessageQueueGetName(msgQueueId);
|
||||
ret = strcmp(name, "q1");
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
|
||||
|
||||
ret = osMessageQueueDelete(msgQueueId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
name = osMessageQueueGetName(msgQueueId);
|
||||
ICUNIT_ASSERT_EQUAL(name, NULL, name);
|
||||
#endif
|
||||
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
ret = osMessageQueueDelete(msgQueueId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
static osMessageQueueId_t g_msgQueueId1;
|
||||
static osMessageQueueId_t g_msgQueueId2;
|
||||
|
||||
static osThreadId_t threadId1;
|
||||
static osThreadId_t threadId2;
|
||||
|
||||
static CHAR g_strbuff1[] = "hello";
|
||||
static CHAR g_strbuff2[] = "world";
|
||||
static CHAR g_staticBuff[STATCI_BUFF_SIZE] = {0};
|
||||
|
||||
static VOID CmsisQueueTestThread1(VOID)
|
||||
{
|
||||
CHAR data[READ_BUFFER_SIZIE] = {0};
|
||||
INT32 ret;
|
||||
osStatus_t status;
|
||||
|
||||
ret = osMessageQueuePut(g_msgQueueId1, &g_strbuff1, 0U, 0U);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
status = osMessageQueueGet(g_msgQueueId2, &data, NULL, QUEUE_WAIT_TIMEOUT);
|
||||
ICUNIT_ASSERT_EQUAL(status, osOK, status);
|
||||
|
||||
ret = strcmp(data, "world");
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
}
|
||||
|
||||
static VOID CmsisQueueTestThread2(VOID)
|
||||
{
|
||||
CHAR data[READ_BUFFER_SIZIE] = {0};
|
||||
INT32 ret;
|
||||
osStatus_t status;
|
||||
|
||||
status = osMessageQueueGet(g_msgQueueId1, &data, NULL, QUEUE_WAIT_TIMEOUT);
|
||||
ICUNIT_ASSERT_EQUAL(status, osOK, status);
|
||||
|
||||
ret = strcmp(data, "hello");
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
|
||||
ret = osMessageQueuePut(g_msgQueueId2, &g_strbuff2, 0U, 0U);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
}
|
||||
|
||||
static INT32 ThreadReadWriteTest(VOID)
|
||||
{
|
||||
osMessageQueueAttr_t attr = {0};
|
||||
INT32 ret;
|
||||
|
||||
g_msgQueueId1 = osMessageQueueNew(1, strlen(g_strbuff1), NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_msgQueueId1, NULL, g_msgQueueId1);
|
||||
|
||||
attr.mq_mem = g_staticBuff;
|
||||
attr.mq_size = strlen(g_strbuff2) + 1;
|
||||
g_msgQueueId2 = osMessageQueueNew(1, strlen(g_strbuff2), &attr);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_msgQueueId2, NULL, g_msgQueueId2);
|
||||
|
||||
threadId1 = osThreadNew(CmsisQueueTestThread1, NULL, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(threadId1, NULL, threadId1);
|
||||
|
||||
threadId2 = osThreadNew(CmsisQueueTestThread2, NULL, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(threadId2, NULL, threadId2);
|
||||
|
||||
osThreadJoin(threadId1);
|
||||
|
||||
ret = strcmp(g_staticBuff, "world");
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
|
||||
ret = osMessageQueueDelete(g_msgQueueId1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
ret = osMessageQueueDelete(g_msgQueueId2);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TestCmsis006
|
||||
* @tc.desc: mix read write
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issueI5LBE8
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisFuncTestSuite, TestCmsis006, Function | MediumTest | Level1)
|
||||
{
|
||||
INT32 ret;
|
||||
|
||||
ret = ThreadReadWriteTest();
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @tc.name: TestCmsis005
|
||||
* @tc.desc: read-write exception
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issueI5LBE8
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisFuncTestSuite, TestCmsis005, Function | MediumTest | Level1)
|
||||
{
|
||||
osMessageQueueId_t msgQueueId;
|
||||
osMessageQueueAttr_t attr = {0};
|
||||
CHAR staticBuff[STATCI_BUFF_SIZE] = {0};
|
||||
CHAR strbuff[] = "hello world";
|
||||
CHAR data[STATCI_BUFF_SIZE] = {0};
|
||||
INT32 ret;
|
||||
|
||||
ret = osMessageQueuePut(NULL, &strbuff, 0U, 0U);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorParameter, ret);
|
||||
|
||||
ret = osMessageQueueGet(NULL, &data, NULL, 0U);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorParameter, ret);
|
||||
|
||||
/* dynmic test */
|
||||
msgQueueId = osMessageQueueNew(1, strlen(strbuff), NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(msgQueueId, NULL, msgQueueId);
|
||||
|
||||
ret = osMessageQueuePut(msgQueueId, NULL, 0U, 0U);
|
||||
ICUNIT_GOTO_EQUAL(ret, osErrorParameter, ret, EXIT);
|
||||
|
||||
ret = osMessageQueueGet(msgQueueId, NULL, NULL, 0U);
|
||||
ICUNIT_GOTO_EQUAL(ret, osErrorParameter, ret, EXIT);
|
||||
|
||||
ret = osMessageQueueDelete(msgQueueId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
ret = osMessageQueuePut(msgQueueId, &strbuff, 0U, 0U);
|
||||
ICUNIT_GOTO_EQUAL(ret, osErrorParameter, ret, EXIT);
|
||||
|
||||
ret = osMessageQueueGet(msgQueueId, &data, NULL, 0U);
|
||||
ICUNIT_GOTO_EQUAL(ret, osErrorParameter, ret, EXIT);
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
/* static test */
|
||||
attr.mq_mem = staticBuff;
|
||||
attr.mq_size = STATCI_BUFF_SIZE;
|
||||
msgQueueId = osMessageQueueNew(1, STATCI_BUFF_SIZE, &attr);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(msgQueueId, NULL, msgQueueId);
|
||||
|
||||
ret = osMessageQueuePut(msgQueueId, NULL, 0U, 0U);
|
||||
ICUNIT_GOTO_EQUAL(ret, osErrorParameter, ret, EXIT);
|
||||
|
||||
ret = osMessageQueueGet(msgQueueId, NULL, NULL, 0U);
|
||||
ICUNIT_GOTO_EQUAL(ret, osErrorParameter, ret, EXIT);
|
||||
|
||||
ret = osMessageQueueDelete(msgQueueId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
ret = osMessageQueuePut(msgQueueId, &strbuff, 0U, 0U);
|
||||
ICUNIT_GOTO_EQUAL(ret, osErrorParameter, ret, EXIT);
|
||||
|
||||
ret = osMessageQueueGet(msgQueueId, &data, NULL, 0U);
|
||||
ICUNIT_GOTO_EQUAL(ret, osErrorParameter, ret, EXIT);
|
||||
#endif
|
||||
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
ret = osMessageQueueDelete(msgQueueId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TestCmsis004
|
||||
* @tc.desc: read write test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issueI5LBE8
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisFuncTestSuite, TestCmsis004, Function | MediumTest | Level1)
|
||||
{
|
||||
osMessageQueueId_t msgQueueId;
|
||||
osMessageQueueAttr_t attr = {0};
|
||||
CHAR staticBuff[STATCI_BUFF_SIZE] = {0};
|
||||
CHAR strbuff[] = "hello world";
|
||||
CHAR data[STATCI_BUFF_SIZE] = {0};
|
||||
INT32 ret;
|
||||
|
||||
/* dynamic test */
|
||||
msgQueueId = osMessageQueueNew(1, strlen(strbuff), NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(msgQueueId, NULL, msgQueueId);
|
||||
|
||||
ret = osMessageQueuePut(msgQueueId, &strbuff, 0U, 0U);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
ret = osMessageQueueGet(msgQueueId, &data, NULL, 0U);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
ret = strcmp(data, strbuff);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
|
||||
ret = osMessageQueueDelete(msgQueueId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
/* static test */
|
||||
attr.mq_mem = staticBuff;
|
||||
attr.mq_size = strlen(strbuff) + 1;
|
||||
msgQueueId = osMessageQueueNew(1, strlen(strbuff), &attr);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(msgQueueId, NULL, msgQueueId);
|
||||
|
||||
ret = osMessageQueuePut(msgQueueId, &strbuff, 0U, 0U);
|
||||
ICUNIT_GOTO_EQUAL(ret, osOK, ret, EXIT);
|
||||
|
||||
ret = osMessageQueueGet(msgQueueId, &data, NULL, 0U);
|
||||
ICUNIT_GOTO_EQUAL(ret, osOK, ret, EXIT);
|
||||
|
||||
ret = strcmp(data, strbuff);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
|
||||
|
||||
ret = strcmp(staticBuff, strbuff);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
|
||||
|
||||
ret = osMessageQueueDelete(msgQueueId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
#endif
|
||||
return LOS_OK;
|
||||
|
||||
EXIT:
|
||||
ret = osMessageQueueDelete(msgQueueId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TestCmsis003
|
||||
* @tc.desc: create exception parameters test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issueI5LBE8
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisFuncTestSuite, TestCmsis003, Function | MediumTest | Level1)
|
||||
{
|
||||
osMessageQueueId_t msgQueueId;
|
||||
osMessageQueueAttr_t attr = {0};
|
||||
CHAR staticBuff[STATCI_BUFF_SIZE] = {0};
|
||||
CHAR strbuff[] = "hello world";
|
||||
|
||||
/* dynmic test */
|
||||
msgQueueId = osMessageQueueNew(0, strlen(strbuff), NULL);
|
||||
ICUNIT_ASSERT_EQUAL(msgQueueId, NULL, msgQueueId);
|
||||
|
||||
msgQueueId = osMessageQueueNew(1, 0xFFFFFFFF, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(msgQueueId, NULL, msgQueueId);
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
/* static test */
|
||||
attr.mq_mem = staticBuff;
|
||||
attr.mq_size = STATCI_BUFF_SIZE;
|
||||
msgQueueId = osMessageQueueNew(0, strlen(strbuff), &attr);
|
||||
ICUNIT_ASSERT_EQUAL(msgQueueId, NULL, msgQueueId);
|
||||
|
||||
msgQueueId = osMessageQueueNew(0xFFFFFFFF, strlen(strbuff), &attr);
|
||||
ICUNIT_ASSERT_EQUAL(msgQueueId, NULL, msgQueueId);
|
||||
|
||||
attr.mq_mem = staticBuff;
|
||||
attr.mq_size = 0;
|
||||
msgQueueId = osMessageQueueNew(1, strlen(strbuff), &attr);
|
||||
ICUNIT_ASSERT_EQUAL(msgQueueId, NULL, msgQueueId);
|
||||
|
||||
attr.mq_mem = NULL;
|
||||
attr.mq_size = STATCI_BUFF_SIZE;
|
||||
msgQueueId = osMessageQueueNew(1, strlen(strbuff), &attr);
|
||||
ICUNIT_ASSERT_EQUAL(msgQueueId, NULL, msgQueueId);
|
||||
#endif
|
||||
|
||||
return LOS_OK;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.name: TestCmsis002
|
||||
* @tc.desc: create and delete test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issueI5LBE8
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisFuncTestSuite, TestCmsis002, Function | MediumTest | Level1)
|
||||
{
|
||||
osMessageQueueId_t msgQueueId;
|
||||
osMessageQueueAttr_t attr = {0};
|
||||
CHAR staticBuff[STATCI_BUFF_SIZE] = {0};
|
||||
CHAR strbuff[] = "hello world";
|
||||
INT32 ret;
|
||||
|
||||
/* dynamic test */
|
||||
msgQueueId = osMessageQueueNew(1, strlen(strbuff), NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(msgQueueId, NULL, msgQueueId);
|
||||
|
||||
ret = osMessageQueueDelete(msgQueueId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
ret = osMessageQueueDelete(msgQueueId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorParameter, ret);
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
/* static test */
|
||||
attr.mq_mem = staticBuff;
|
||||
attr.mq_size = STATCI_BUFF_SIZE;
|
||||
msgQueueId = osMessageQueueNew(1, STATCI_BUFF_SIZE, &attr);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(msgQueueId, NULL, msgQueueId);
|
||||
|
||||
ret = osMessageQueueDelete(msgQueueId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
ret = osMessageQueueDelete(msgQueueId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorParameter, ret);
|
||||
#endif
|
||||
|
||||
return LOS_OK;
|
||||
};
|
||||
|
||||
|
||||
void CmsisFuncTestSuite(void)
|
||||
{
|
||||
PRINTF("***********************BEGIN CMSIS TEST**********************\n");
|
||||
|
||||
ADD_TEST_CASE(TestCmsis001);
|
||||
ADD_TEST_CASE(TestCmsis002);
|
||||
ADD_TEST_CASE(TestCmsis003);
|
||||
ADD_TEST_CASE(TestCmsis004);
|
||||
ADD_TEST_CASE(TestCmsis005);
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
ADD_TEST_CASE(TestCmsis006);
|
||||
#endif
|
||||
|
||||
ADD_TEST_CASE(TestCmsis007);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,12 +32,6 @@
|
||||
|
||||
#include "it_los_atomic.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
Atomic g_testAtomicID03 = 0;
|
||||
Atomic64 g_testAtomicID05 = 0;
|
||||
|
||||
@@ -55,9 +49,3 @@ VOID ItSuiteLosAtomic(VOID)
|
||||
ItLosAtomic010();
|
||||
ItLosAtomic011();
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
@@ -56,6 +56,8 @@ extern VOID ItLosAtomic006(VOID);
|
||||
extern VOID ItLosAtomic007(VOID);
|
||||
extern VOID ItLosAtomic008(VOID);
|
||||
extern VOID ItLosAtomic009(VOID);
|
||||
extern VOID ItLosAtomic010(VOID);
|
||||
extern VOID ItLosAtomic011(VOID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
@@ -32,12 +32,6 @@
|
||||
|
||||
#include "it_los_atomic.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
{
|
||||
volatile INT32 value = 0;
|
||||
@@ -100,9 +94,3 @@ VOID ItLosAtomic001(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("ItLosAtomic001", TestCase, TEST_LOS, TEST_ATO, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -32,12 +32,6 @@
|
||||
|
||||
#include "it_los_atomic.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
{
|
||||
volatile INT32 value = 0;
|
||||
@@ -92,9 +86,3 @@ VOID ItLosAtomic002(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("ItLosAtomic002", TestCase, TEST_LOS, TEST_ATO, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -32,12 +32,6 @@
|
||||
|
||||
#include "it_los_atomic.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
{
|
||||
volatile INT32 value = 0;
|
||||
@@ -106,9 +100,3 @@ VOID ItLosAtomic003(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("ItLosAtomic003", TestCase, TEST_LOS, TEST_ATO, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -32,12 +32,6 @@
|
||||
|
||||
#include "it_los_atomic.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
INT32 i;
|
||||
@@ -104,9 +98,3 @@ VOID ItLosAtomic004(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("ItLosAtomic004", TestCase, TEST_LOS, TEST_ATO, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user