Compare commits
16 Commits
weekly_202
...
weekly_202
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10fd031b09 | ||
|
|
25a1eb522d | ||
|
|
382872d998 | ||
|
|
93f616b64e | ||
|
|
570f2785bd | ||
|
|
3900785b8f | ||
|
|
d50c106304 | ||
|
|
697a0cbdeb | ||
|
|
b9c9936270 | ||
|
|
852114d9d2 | ||
|
|
68cd62733f | ||
|
|
ce5357eee1 | ||
|
|
dcda9dcfa3 | ||
|
|
4a9d1f0c51 | ||
|
|
4c4784e33d | ||
|
|
2f7f6f0cbb |
@@ -42,10 +42,6 @@ extern "C" {
|
||||
|
||||
STATIC INLINE INT32 ArchAtomicRead(const Atomic *v)
|
||||
{
|
||||
UINT32 intSave;
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
LOS_IntRestore(intSave);
|
||||
return *v;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,11 +63,11 @@ STATIC INLINE VOID ArchAtomicSet(Atomic *v, INT32 setVal)
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
|
||||
__asm__ __volatile__("1:ldrex %0, [%2]\n"
|
||||
" strex %0, %3, [%2]\n"
|
||||
__asm__ __volatile__("1:ldrex %0, [%1]\n"
|
||||
" strex %0, %2, [%1]\n"
|
||||
" teq %0, #0\n"
|
||||
" beq 1b"
|
||||
: "=&r"(status), "+m"(*v)
|
||||
" bne 1b"
|
||||
: "=&r"(status)
|
||||
: "r"(v), "r"(setVal)
|
||||
: "cc");
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
@@ -63,11 +63,11 @@ STATIC INLINE VOID ArchAtomicSet(Atomic *v, INT32 setVal)
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
|
||||
__asm__ __volatile__("1:ldrex %0, [%2]\n"
|
||||
" strex %0, %3, [%2]\n"
|
||||
__asm__ __volatile__("1:ldrex %0, [%1]\n"
|
||||
" strex %0, %2, [%1]\n"
|
||||
" teq %0, #0\n"
|
||||
" beq 1b"
|
||||
: "=&r"(status), "+m"(*v)
|
||||
" bne 1b"
|
||||
: "=&r"(status)
|
||||
: "r"(v), "r"(setVal)
|
||||
: "cc");
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
@@ -63,11 +63,11 @@ STATIC INLINE VOID ArchAtomicSet(Atomic *v, INT32 setVal)
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
|
||||
__asm__ __volatile__("1:ldrex %0, [%2]\n"
|
||||
" strex %0, %3, [%2]\n"
|
||||
__asm__ __volatile__("1:ldrex %0, [%1]\n"
|
||||
" strex %0, %2, [%1]\n"
|
||||
" teq %0, #0\n"
|
||||
" beq 1b"
|
||||
: "=&r"(status), "+m"(*v)
|
||||
" bne 1b"
|
||||
: "=&r"(status)
|
||||
: "r"(v), "r"(setVal)
|
||||
: "cc");
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
@@ -63,11 +63,11 @@ STATIC INLINE VOID ArchAtomicSet(Atomic *v, INT32 setVal)
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
|
||||
__asm__ __volatile__("1:ldrex %0, [%2]\n"
|
||||
" strex %0, %3, [%2]\n"
|
||||
__asm__ __volatile__("1:ldrex %0, [%1]\n"
|
||||
" strex %0, %2, [%1]\n"
|
||||
" teq %0, #0\n"
|
||||
" beq 1b"
|
||||
: "=&r"(status), "+m"(*v)
|
||||
" bne 1b"
|
||||
: "=&r"(status)
|
||||
: "r"(v), "r"(setVal)
|
||||
: "cc");
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
@@ -63,11 +63,11 @@ STATIC INLINE VOID ArchAtomicSet(Atomic *v, INT32 setVal)
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
|
||||
__asm__ __volatile__("1:ldrex %0, [%2]\n"
|
||||
" strex %0, %3, [%2]\n"
|
||||
__asm__ __volatile__("1:ldrex %0, [%1]\n"
|
||||
" strex %0, %2, [%1]\n"
|
||||
" teq %0, #0\n"
|
||||
" beq 1b"
|
||||
: "=&r"(status), "+m"(*v)
|
||||
" bne 1b"
|
||||
: "=&r"(status)
|
||||
: "r"(v), "r"(setVal)
|
||||
: "cc");
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
@@ -63,11 +63,11 @@ STATIC INLINE VOID ArchAtomicSet(Atomic *v, INT32 setVal)
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
|
||||
__asm__ __volatile__("1:ldrex %0, [%2]\n"
|
||||
" strex %0, %3, [%2]\n"
|
||||
__asm__ __volatile__("1:ldrex %0, [%1]\n"
|
||||
" strex %0, %2, [%1]\n"
|
||||
" teq %0, #0\n"
|
||||
" beq 1b"
|
||||
: "=&r"(status), "+m"(*v)
|
||||
" bne 1b"
|
||||
: "=&r"(status)
|
||||
: "r"(v), "r"(setVal)
|
||||
: "cc");
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
@@ -63,11 +63,11 @@ STATIC INLINE VOID ArchAtomicSet(Atomic *v, INT32 setVal)
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
|
||||
__asm__ __volatile__("1:ldrex %0, [%2]\n"
|
||||
" strex %0, %3, [%2]\n"
|
||||
__asm__ __volatile__("1:ldrex %0, [%1]\n"
|
||||
" strex %0, %2, [%1]\n"
|
||||
" teq %0, #0\n"
|
||||
" beq 1b"
|
||||
: "=&r"(status), "+m"(*v)
|
||||
" bne 1b"
|
||||
: "=&r"(status)
|
||||
: "r"(v), "r"(setVal)
|
||||
: "cc");
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
@@ -63,11 +63,11 @@ STATIC INLINE VOID ArchAtomicSet(Atomic *v, INT32 setVal)
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
|
||||
__asm__ __volatile__("1:ldrex %0, [%2]\n"
|
||||
" strex %0, %3, [%2]\n"
|
||||
__asm__ __volatile__("1:ldrex %0, [%1]\n"
|
||||
" strex %0, %2, [%1]\n"
|
||||
" teq %0, #0\n"
|
||||
" beq 1b"
|
||||
: "=&r"(status), "+m"(*v)
|
||||
" bne 1b"
|
||||
: "=&r"(status)
|
||||
: "r"(v), "r"(setVal)
|
||||
: "cc");
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
@@ -63,11 +63,11 @@ STATIC INLINE VOID ArchAtomicSet(Atomic *v, INT32 setVal)
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
|
||||
__asm__ __volatile__("1:ldrex %0, [%2]\n"
|
||||
" strex %0, %3, [%2]\n"
|
||||
__asm__ __volatile__("1:ldrex %0, [%1]\n"
|
||||
" strex %0, %2, [%1]\n"
|
||||
" teq %0, #0\n"
|
||||
" beq 1b"
|
||||
: "=&r"(status), "+m"(*v)
|
||||
" bne 1b"
|
||||
: "=&r"(status)
|
||||
: "r"(v), "r"(setVal)
|
||||
: "cc");
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
@@ -60,9 +60,9 @@ STATIC INLINE VOID ArchAtomicSet(Atomic *v, INT32 setVal)
|
||||
UINT32 intSave;
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
__asm__ __volatile__("stw %0, (%1, 0)"
|
||||
: "=&r"(setVal)
|
||||
: "r"(v)
|
||||
__asm__ __volatile__("stw %1, (%0, 0)"
|
||||
:
|
||||
: "r"(v), "r"(setVal)
|
||||
: "cc");
|
||||
LOS_IntRestore(intSave);
|
||||
}
|
||||
|
||||
@@ -142,6 +142,11 @@ extern "C" {
|
||||
#else
|
||||
#define CONTEXT_SIZE 112
|
||||
#endif
|
||||
#define LEVEL1_TINRERRUPT_CAUSE 4
|
||||
#define ALLOC_CAUSE 5
|
||||
#define LOWBIT_CALLNMODE 30
|
||||
#define HIGHBIT_CALLNMODE 31
|
||||
#define PS_OWB_SHIFT 8
|
||||
#define EXCCAUSE_LEVEL1INTERRUPT 4
|
||||
#define XTENSA_LOGREG_NUM 16
|
||||
#define INDEX_OF_SP 1
|
||||
|
||||
@@ -98,9 +98,6 @@ NMIExceptionHandler:
|
||||
.literal_position
|
||||
DoubleExceptionHandler:
|
||||
|
||||
movi a0, INT_MASK | USER_VECTOR_MODE | WOE_ENABLE
|
||||
wsr a0, PS
|
||||
rsr a2, EXCCAUSE
|
||||
call0 UserException
|
||||
|
||||
.end literal_prefix
|
||||
@@ -145,11 +142,18 @@ UserExceptionHandler:
|
||||
UserException:
|
||||
|
||||
rsr a0, EXCCAUSE
|
||||
beqi a0, 4, InterruptEntry1
|
||||
beqi a0, LEVEL1_TINRERRUPT_CAUSE, InterruptEntry1
|
||||
beqi a0, ALLOC_CAUSE, AllocHandel
|
||||
call0 HandleEntry
|
||||
1:
|
||||
j 1b
|
||||
|
||||
.section .iram,"ax"
|
||||
.type AllocHandel,@function
|
||||
.align 4
|
||||
AllocHandel:
|
||||
call0 AllocHandelEntry
|
||||
|
||||
.section .iram,"ax"
|
||||
.type InterruptEntry1,@function
|
||||
.align 4
|
||||
@@ -361,6 +365,36 @@ UnderFlowGroup3:
|
||||
l32i a4, a4, 0
|
||||
rfwu
|
||||
|
||||
.section .userVector,"ax"
|
||||
.type AllocHandelEntry,@function
|
||||
.align 4
|
||||
AllocHandelEntry:
|
||||
|
||||
addi a1, a1, -(CONTEXT_OFF_A4 - CONTEXT_OFF_A0)
|
||||
s32i a2, a1, (CONTEXT_OFF_A2 - CONTEXT_OFF_A0)
|
||||
s32i a3, a1, (CONTEXT_OFF_A3 - CONTEXT_OFF_A0)
|
||||
|
||||
rsr a0, PS
|
||||
rsr a2, WINDOWBASE
|
||||
extui a3, a0, PS_OWB_SHIFT, WINDOWBASEBITS
|
||||
xor a3, a3, a2
|
||||
slli a3, a3, PS_OWB_SHIFT
|
||||
xor a0, a0, a3
|
||||
wsr a0, PS
|
||||
rsr a0, EXCSAVE1
|
||||
|
||||
l32i a2, a1, (CONTEXT_OFF_A2 - CONTEXT_OFF_A0)
|
||||
l32i a3, a1, (CONTEXT_OFF_A3 - CONTEXT_OFF_A0)
|
||||
addi a1, a1, (CONTEXT_OFF_A4 - CONTEXT_OFF_A0)
|
||||
rsync
|
||||
|
||||
rotw -1
|
||||
bbci a4, HIGHBIT_CALLNMODE, UnderFlowGroup1
|
||||
rotw -1
|
||||
bbci a8, LOWBIT_CALLNMODE, UnderFlowGroup2
|
||||
rotw -1
|
||||
j UnderFlowGroup3
|
||||
|
||||
.global EnableExceptionInterface
|
||||
.section .iram,"ax"
|
||||
.type EnableExceptionInterface,@function
|
||||
|
||||
@@ -44,7 +44,7 @@ INT32 OsShellCmdHelp(INT32 argc, const CHAR **argv)
|
||||
(VOID)argv;
|
||||
if (argc > 0) {
|
||||
PRINTK("\nUsage: help\n");
|
||||
return OS_ERROR;
|
||||
return (INT32)OS_ERROR;
|
||||
}
|
||||
|
||||
PRINTK("*******************shell commands:*************************\n");
|
||||
|
||||
@@ -52,7 +52,7 @@ INT32 OsShellCmdDumpTask(INT32 argc, const CHAR **argv)
|
||||
return OsShellCmdTskInfoGet((UINT32)taskId);
|
||||
} else {
|
||||
PRINTK("\nUsage: task\n");
|
||||
return OS_ERROR;
|
||||
return (INT32)OS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -386,7 +386,7 @@ STATIC INT32 OsShellCmdDoCp(const CHAR *srcFilePath, const CHAR *dstFileName)
|
||||
CHAR *dstFilePath = NULL;
|
||||
CHAR *buf = NULL;
|
||||
const CHAR *filename = NULL;
|
||||
size_t rdSize, wrSize;
|
||||
ssize_t rdSize, wrSize;
|
||||
INT32 srcFd = -1;
|
||||
INT32 dstFd = -1;
|
||||
struct stat statBuf;
|
||||
@@ -646,7 +646,7 @@ STATIC INT32 OsWildcardDeleteFileOrDir(const CHAR *fullpath, wildcard_type mark)
|
||||
ret = rmdir(fullpath);
|
||||
break;
|
||||
default:
|
||||
return VFS_ERROR;
|
||||
return (INT32)VFS_ERROR;
|
||||
}
|
||||
if (ret == -1) {
|
||||
PRINTK("%s ", fullpath);
|
||||
@@ -787,7 +787,7 @@ STATIC INT32 OsWildcardExtractDirectory(CHAR *fullpath, VOID *dst, wildcard_type
|
||||
return ret;
|
||||
closedir_out:
|
||||
(VOID)closedir(d);
|
||||
return VFS_ERROR;
|
||||
return (INT32)VFS_ERROR;
|
||||
}
|
||||
|
||||
INT32 OsShellCmdCp(INT32 argc, const CHAR **argv)
|
||||
@@ -873,7 +873,7 @@ errout_with_path:
|
||||
free(drcFullPath);
|
||||
errout_with_srcpath:
|
||||
free(srcFullPath);
|
||||
return VFS_ERROR;
|
||||
return (INT32)VFS_ERROR;
|
||||
}
|
||||
|
||||
STATIC INLINE VOID PrintRmUsage(VOID)
|
||||
|
||||
@@ -36,6 +36,7 @@ kernel_module(module_name) {
|
||||
"porting/src/fs.c",
|
||||
"porting/src/malloc.c",
|
||||
"porting/src/other_adapt.c",
|
||||
"porting/src/pthread.c",
|
||||
"porting/src/time.c",
|
||||
]
|
||||
|
||||
|
||||
82
kal/libc/newlib/porting/include/net/ethernet.h
Normal file
82
kal/libc/newlib/porting/include/net/ethernet.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (c) 2022-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:
|
||||
*
|
||||
* 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_NET_ETHERNET_H
|
||||
#define _ADAPT_NET_ETHERNET_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/if_ether.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ETHERTYPE_PUP 0x0200
|
||||
#define ETHERTYPE_SPRITE 0x0500
|
||||
#define ETHERTYPE_IP 0x0800
|
||||
#define ETHERTYPE_ARP 0x0806
|
||||
#define ETHERTYPE_REVARP 0x8035
|
||||
#define ETHERTYPE_AT 0x809B
|
||||
#define ETHERTYPE_AARP 0x80F3
|
||||
#define ETHERTYPE_VLAN 0x8100
|
||||
#define ETHERTYPE_IPX 0x8137
|
||||
#define ETHERTYPE_IPV6 0x86dd
|
||||
|
||||
#define ETHER_ADDR_LEN ETH_ALEN
|
||||
#define ETHER_TYPE_LEN ETH_TLEN
|
||||
#define ETHER_CRC_LEN 4
|
||||
#define ETHER_HDR_LEN ETH_HLEN
|
||||
#define ETHER_MIN_LEN (ETH_ZLEN + ETHER_CRC_LEN)
|
||||
#define ETHER_MAX_LEN (ETH_FRAME_LEN + ETHER_CRC_LEN)
|
||||
|
||||
#define ETHER_IS_VALID_LEN(foo) ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
|
||||
|
||||
#define ETHERTYPE_TRAIL 0x1000
|
||||
#define ETHERTYPE_NTRAILER 16
|
||||
|
||||
#define ETHERMTU ETH_DATA_LEN
|
||||
#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
|
||||
|
||||
struct ether_addr {
|
||||
uint8_t ether_addr_octet[ETH_ALEN];
|
||||
};
|
||||
|
||||
struct ether_header {
|
||||
uint8_t ether_dhost[ETH_ALEN];
|
||||
uint8_t ether_shost[ETH_ALEN];
|
||||
uint16_t ether_type;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_ADAPT_NET_ETHERNET_H */
|
||||
99
kal/libc/newlib/porting/include/net/if_arp.h
Normal file
99
kal/libc/newlib/porting/include/net/if_arp.h
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright (c) 2022-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:
|
||||
*
|
||||
* 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_NET_IF_ARP_H
|
||||
#define _ADAPT_NET_IF_ARP_H
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAX_ADDR_LEN 7
|
||||
|
||||
#define ARPOP_REQUEST 1
|
||||
#define ARPOP_REPLY 2
|
||||
#define ARPOP_RREQUEST 3
|
||||
#define ARPOP_RREPLY 4
|
||||
#define ARPOP_InREQUEST 8
|
||||
#define ARPOP_InREPLY 9
|
||||
#define ARPOP_NAK 10
|
||||
|
||||
#define ATF_INUSE 0x01
|
||||
#define ATF_COM 0x02
|
||||
#define ATF_PERM 0x04
|
||||
#define ATF_PUBL 0x08
|
||||
#define ATF_USETRAILERS 0x10
|
||||
|
||||
#define ARPD_UPDATE 0x01
|
||||
#define ARPD_LOOKUP 0x02
|
||||
#define ARPD_FLUSH 0x03
|
||||
|
||||
struct arphdr {
|
||||
uint16_t ar_hrd;
|
||||
uint16_t ar_pro;
|
||||
uint8_t ar_hln;
|
||||
uint8_t ar_pln;
|
||||
uint16_t ar_op;
|
||||
};
|
||||
|
||||
#define ARP_DEV_LEN 16
|
||||
struct arpreq {
|
||||
struct sockaddr arp_pa;
|
||||
struct sockaddr arp_ha;
|
||||
int arp_flags;
|
||||
struct sockaddr arp_netmask;
|
||||
char arp_dev[ARP_DEV_LEN];
|
||||
};
|
||||
|
||||
struct arpreq_old {
|
||||
struct sockaddr arp_pa;
|
||||
struct sockaddr arp_ha;
|
||||
int arp_flags;
|
||||
struct sockaddr arp_netmask;
|
||||
};
|
||||
|
||||
struct arpd_request {
|
||||
unsigned short req;
|
||||
uint32_t ip;
|
||||
unsigned long dev;
|
||||
unsigned long stamp;
|
||||
unsigned long updated;
|
||||
unsigned char ha[MAX_ADDR_LEN];
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_ADAPT_NET_IF_ARP_H */
|
||||
79
kal/libc/newlib/porting/include/netinet/if_ether.h
Normal file
79
kal/libc/newlib/porting/include/netinet/if_ether.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2022-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:
|
||||
*
|
||||
* 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_NETINET_IF_ETHER_H
|
||||
#define _ADAPT_NETINET_IF_ETHER_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define ETH_ALEN 6
|
||||
#define ETH_TLEN 2
|
||||
#define ETH_HLEN 14
|
||||
#define ETH_ZLEN 60
|
||||
#define ETH_DATA_LEN 1500
|
||||
#define ETH_FRAME_LEN 1514
|
||||
#define ETH_FCS_LEN 4
|
||||
#define ETH_MIN_MTU 68
|
||||
#define ETH_MAX_MTU 0xFFFFU
|
||||
|
||||
struct ethhdr {
|
||||
uint8_t h_dest[ETH_ALEN];
|
||||
uint8_t h_source[ETH_ALEN];
|
||||
uint16_t h_proto;
|
||||
};
|
||||
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if_arp.h>
|
||||
|
||||
struct ether_arp {
|
||||
struct arphdr ea_hdr;
|
||||
uint8_t arp_sha[ETH_ALEN];
|
||||
uint8_t arp_spa[4];
|
||||
uint8_t arp_tha[ETH_ALEN];
|
||||
uint8_t arp_tpa[4];
|
||||
};
|
||||
|
||||
#define arp_hrd ea_hdr.ar_hrd
|
||||
#define arp_pro ea_hdr.ar_pro
|
||||
#define arp_hln ea_hdr.ar_hln
|
||||
#define arp_pln ea_hdr.ar_pln
|
||||
#define arp_op ea_hdr.ar_op
|
||||
|
||||
#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \
|
||||
do { \
|
||||
(enaddr)[0] = 0x01; \
|
||||
(enaddr)[1] = 0x00; \
|
||||
(enaddr)[2] = 0x5e; \
|
||||
(enaddr)[3] = ((uint8_t *)(ipaddr))[1] & 0x7f; \
|
||||
(enaddr)[4] = ((uint8_t *)(ipaddr))[2]; \
|
||||
(enaddr)[5] = ((uint8_t *)(ipaddr))[3]; \
|
||||
} while (0)
|
||||
|
||||
#endif /* !_ADAPT_NETINET_IF_ETHER_H */
|
||||
50
kal/libc/newlib/porting/include/sys/uio.h
Normal file
50
kal/libc/newlib/porting/include/sys/uio.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2022-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:
|
||||
*
|
||||
* 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_UIO_H
|
||||
#define _ADAPT_SYS_UIO_H
|
||||
|
||||
#include <sys/features.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define UIO_MAXIOV 1024
|
||||
|
||||
ssize_t readv(int, const struct iovec *, int);
|
||||
ssize_t writev(int, const struct iovec *, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
36
kal/libc/newlib/porting/src/pthread.c
Normal file
36
kal/libc/newlib/porting/src/pthread.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2022-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:
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
int pthread_equal(pthread_t __t1, pthread_t __t2)
|
||||
{
|
||||
return (int)(__t1 == __t2);
|
||||
}
|
||||
@@ -38,6 +38,8 @@
|
||||
#include "los_config.h"
|
||||
#include "los_task.h"
|
||||
|
||||
#define PTHREAD_DEFAULT_NAME "pthread"
|
||||
#define PTHREAD_DEFAULT_NAME_LEN 8
|
||||
#define PTHREAD_NAMELEN 16
|
||||
#define PTHREAD_KEY_UNUSED 0
|
||||
#define PTHREAD_KEY_USED 1
|
||||
@@ -113,6 +115,12 @@ static int PthreadCreateAttrInit(const pthread_attr_t *attr, void *(*startRoutin
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
errno_t error = memcpy_s(pthreadData->name, PTHREAD_NAMELEN, PTHREAD_DEFAULT_NAME, PTHREAD_DEFAULT_NAME_LEN);
|
||||
if (error != EOK) {
|
||||
free(pthreadData);
|
||||
return error;
|
||||
}
|
||||
|
||||
pthreadData->startRoutine = startRoutine;
|
||||
pthreadData->param = arg;
|
||||
pthreadData->key = NULL;
|
||||
@@ -142,9 +150,6 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* set pthread default name */
|
||||
(void)sprintf_s(taskInitParam.pcName, PTHREAD_NAMELEN, "pthread%u", taskID);
|
||||
|
||||
if (LOS_TaskCreateOnly(&taskID, &taskInitParam) != LOS_OK) {
|
||||
free((VOID *)(UINTPTR)taskInitParam.uwArg);
|
||||
return EINVAL;
|
||||
@@ -258,9 +263,9 @@ void pthread_exit(void *retVal)
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
LOS_ListDelete(&pthreadData->threadList);
|
||||
tcb->taskName = PTHREAD_DEFAULT_NAME;
|
||||
LOS_IntRestore(intSave);
|
||||
free(pthreadData);
|
||||
|
||||
(void)LOS_TaskDelete(tcb->taskID);
|
||||
}
|
||||
|
||||
@@ -279,6 +284,11 @@ int pthread_setname_np(pthread_t thread, const char *name)
|
||||
|
||||
taskCB = OS_TCB_FROM_TID((UINT32)thread);
|
||||
intSave = LOS_IntLock();
|
||||
if (taskCB->taskStatus & OS_TASK_STATUS_EXIT) {
|
||||
LOS_IntRestore(intSave);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (taskCB->taskEntry == PthreadEntry) {
|
||||
(void)strcpy_s(taskName, PTHREAD_NAMELEN, name);
|
||||
} else {
|
||||
|
||||
@@ -38,8 +38,11 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#if defined(__XTENSA_LX6__) || defined(__CSKY_V2__) // system ram is low, reduce memory usage
|
||||
#define ICUNIT_CASE_SIZE 200
|
||||
#else
|
||||
#define ICUNIT_CASE_SIZE 1500
|
||||
#endif
|
||||
#define ICUNIT_SUIT_SIZE 200
|
||||
|
||||
|
||||
|
||||
@@ -224,6 +224,8 @@ extern EVENT_CB_S g_exampleEvent;
|
||||
|
||||
#ifdef __RISC_V__
|
||||
#define OS_TSK_TEST_STACK_SIZE 0x9000
|
||||
#elif __XTENSA_LX6__
|
||||
#define OS_TSK_TEST_STACK_SIZE 0x800
|
||||
#else
|
||||
#define OS_TSK_TEST_STACK_SIZE 0x1000
|
||||
#endif
|
||||
@@ -285,12 +287,20 @@ extern UINT32 TaskUsedCountGet(VOID);
|
||||
#define HWI_NUM_TEST1 34
|
||||
#define HWI_NUM_TEST2 35
|
||||
#define HWI_NUM_TEST3 36
|
||||
#define LOS_KERNEL_MULTI_HWI_TEST 1 // default enable multiple hwi number test case
|
||||
#elif __CSKY_V2__
|
||||
#define HWI_NUM_TEST 31 // csky_v2 only suppport one software interrupt number
|
||||
#define LOS_KERNEL_MULTI_HWI_TEST 0 // csky_v2 not support multiple hwi number test case
|
||||
#elif __XTENSA_LX6__
|
||||
#define HWI_NUM_TEST 7 // xtensa_lx6 only suppport one software interrupt number
|
||||
#define LOS_KERNEL_MULTI_HWI_TEST 0 // xtensa_lx6 not support multiple hwi number test case
|
||||
#else
|
||||
#define HWI_NUM_TEST HWI_NUM_INT7
|
||||
#define HWI_NUM_TEST0 HWI_NUM_INT1
|
||||
#define HWI_NUM_TEST HWI_NUM_INT7
|
||||
#define HWI_NUM_TEST1 HWI_NUM_INT11
|
||||
#define HWI_NUM_TEST2 HWI_NUM_INT12
|
||||
#define HWI_NUM_TEST3 HWI_NUM_INT14
|
||||
#define LOS_KERNEL_MULTI_HWI_TEST 1 // default enable multiple hwi number test case
|
||||
#endif
|
||||
|
||||
#define LOSCFG_BASE_IPC_QUEUE_CONFIG LOSCFG_BASE_IPC_QUEUE_LIMIT
|
||||
|
||||
@@ -39,6 +39,8 @@ static_library("test_atomic") {
|
||||
"it_los_atomic_007.c",
|
||||
"it_los_atomic_008.c",
|
||||
"it_los_atomic_009.c",
|
||||
"it_los_atomic_010.c",
|
||||
"it_los_atomic_011.c",
|
||||
]
|
||||
include_dirs = [ "." ]
|
||||
configs += [ "//kernel/liteos_m/testsuites:include" ]
|
||||
|
||||
@@ -52,6 +52,8 @@ VOID ItSuiteLosAtomic(VOID)
|
||||
ItLosAtomic007();
|
||||
ItLosAtomic008();
|
||||
ItLosAtomic009();
|
||||
ItLosAtomic010();
|
||||
ItLosAtomic011();
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -56,6 +56,22 @@ static UINT32 TestCase(VOID)
|
||||
ICUNIT_ASSERT_EQUAL(value, ret, value);
|
||||
ICUNIT_ASSERT_EQUAL(value, 0x7ffffffe, value);
|
||||
|
||||
value = -1;
|
||||
LOS_AtomicInc(&value);
|
||||
ICUNIT_ASSERT_EQUAL(value, 0, value);
|
||||
|
||||
value = 0x7ffffffe;
|
||||
LOS_AtomicInc(&value);
|
||||
ICUNIT_ASSERT_EQUAL(value, 0x7fffffff, value);
|
||||
|
||||
value = 0;
|
||||
LOS_AtomicDec(&value);
|
||||
ICUNIT_ASSERT_EQUAL(value, -1, value);
|
||||
|
||||
value = 0x7fffffff;
|
||||
LOS_AtomicDec(&value);
|
||||
ICUNIT_ASSERT_EQUAL(value, 0x7ffffffe, value);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
|
||||
87
testsuites/sample/kernel/atomic/it_los_atomic_010.c
Normal file
87
testsuites/sample/kernel/atomic/it_los_atomic_010.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-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.
|
||||
*/
|
||||
|
||||
|
||||
#include "it_los_atomic.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define TEST_LOOP 10
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
INT64 i;
|
||||
|
||||
for (i = 0; i < TEST_LOOP; ++i) {
|
||||
LOS_Atomic64Inc(&g_testAtomicID05);
|
||||
}
|
||||
|
||||
++g_testCount;
|
||||
}
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
g_testAtomicID05 = 0;
|
||||
g_testCount = 0;
|
||||
|
||||
TSK_INIT_PARAM_S stTask1 = {0};
|
||||
stTask1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
stTask1.pcName = "Atomic_010";
|
||||
stTask1.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
|
||||
stTask1.usTaskPrio = TASK_PRIO_TEST - 2; // TASK_PRIO_TEST - 2 has higher priority than TASK_PRIO_TEST
|
||||
stTask1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &stTask1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
LOS_TaskDelay(20); // delay 20 ticks.
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
ICUNIT_GOTO_EQUAL(g_testAtomicID05, TEST_LOOP, g_testAtomicID05, EXIT);
|
||||
EXIT:
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosAtomic010(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("ItLosAtomic010", TestCase, TEST_LOS, TEST_ATO, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
256
testsuites/sample/kernel/atomic/it_los_atomic_011.c
Normal file
256
testsuites/sample/kernel/atomic/it_los_atomic_011.c
Normal file
@@ -0,0 +1,256 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-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.
|
||||
*/
|
||||
|
||||
|
||||
#include "it_los_atomic.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
Atomic atomicTestCounter = 0;
|
||||
INT32 readCounter = 0;
|
||||
INT32 atomicRet = 0;
|
||||
|
||||
Atomic64 atomic64TestCounter = 0;
|
||||
INT64 read64Counter = 0;
|
||||
INT64 atomic64Ret = 0;
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 0, g_testCount);
|
||||
|
||||
atomicTestCounter = 0x88888888;
|
||||
LOS_AtomicSet(&atomicTestCounter, 0x88888888);
|
||||
atomicRet = LOS_AtomicAdd(&atomicTestCounter, 0x33333333);
|
||||
ICUNIT_ASSERT_EQUAL(atomicRet, 0xbbbbbbbb, atomicRet);
|
||||
readCounter = LOS_AtomicRead(&atomicTestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(readCounter, 0xbbbbbbbb, readCounter);
|
||||
|
||||
LOS_AtomicSet(&atomicTestCounter, 0xaaaaaaaa);
|
||||
atomicRet = LOS_AtomicAdd(&atomicTestCounter, 0x77777777);
|
||||
ICUNIT_ASSERT_EQUAL(atomicRet, 0x22222221, atomicRet);
|
||||
readCounter = LOS_AtomicRead(&atomicTestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(readCounter, 0x22222221, readCounter);
|
||||
|
||||
LOS_AtomicSet(&atomicTestCounter, 0xdddddddd);
|
||||
atomicRet = LOS_AtomicSub(&atomicTestCounter, 0x99999999);
|
||||
ICUNIT_ASSERT_EQUAL(atomicRet, 0x44444444, atomicRet);
|
||||
readCounter = LOS_AtomicRead(&atomicTestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(readCounter, 0x44444444, readCounter);
|
||||
|
||||
LOS_AtomicSet(&atomicTestCounter, 0x88888888);
|
||||
atomicRet = LOS_AtomicSub(&atomicTestCounter, 0xdddddddd);
|
||||
ICUNIT_ASSERT_EQUAL(atomicRet, 0xaaaaaaab, atomicRet);
|
||||
readCounter = LOS_AtomicRead(&atomicTestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(readCounter, 0xaaaaaaab, readCounter);
|
||||
|
||||
LOS_AtomicSet(&atomicTestCounter, 0x11111111);
|
||||
LOS_AtomicInc(&atomicTestCounter);
|
||||
readCounter = LOS_AtomicRead(&atomicTestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(readCounter, 0x11111112, readCounter);
|
||||
|
||||
LOS_AtomicSet(&atomicTestCounter, 0xffffffff);
|
||||
LOS_AtomicInc(&atomicTestCounter);
|
||||
readCounter = LOS_AtomicRead(&atomicTestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(readCounter, 0x00000000, readCounter);
|
||||
|
||||
LOS_AtomicSet(&atomicTestCounter, 0x88888888);
|
||||
atomicRet = LOS_AtomicIncRet(&atomicTestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(atomicRet, 0x88888889, atomicRet);
|
||||
|
||||
LOS_AtomicSet(&atomicTestCounter, 0xffffffff);
|
||||
atomicRet = LOS_AtomicIncRet(&atomicTestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(atomicRet, 0x00000000, atomicRet);
|
||||
readCounter = LOS_AtomicRead(&atomicTestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(readCounter, 0x00000000, readCounter);
|
||||
|
||||
LOS_AtomicSet(&atomicTestCounter, 0x66666666);
|
||||
LOS_AtomicDec(&atomicTestCounter);
|
||||
readCounter = LOS_AtomicRead(&atomicTestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(readCounter, 0x66666665, readCounter);
|
||||
|
||||
LOS_AtomicSet(&atomicTestCounter, 0x00000000);
|
||||
LOS_AtomicDec(&atomicTestCounter);
|
||||
readCounter = LOS_AtomicRead(&atomicTestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(readCounter, 0xffffffff, readCounter);
|
||||
|
||||
LOS_AtomicSet(&atomicTestCounter, 0x88888888);
|
||||
atomicRet = LOS_AtomicDecRet(&atomicTestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(atomicRet, 0x88888887, atomicRet);
|
||||
readCounter = LOS_AtomicRead(&atomicTestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(readCounter, 0x88888887, readCounter);
|
||||
|
||||
LOS_AtomicSet(&atomicTestCounter, 0x00000000);
|
||||
atomicRet = LOS_AtomicDecRet(&atomicTestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(atomicRet, 0xffffffff, atomicRet);
|
||||
readCounter = LOS_AtomicRead(&atomicTestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(readCounter, 0xffffffff, readCounter);
|
||||
|
||||
LOS_Atomic64Set(&atomic64TestCounter, 0x5aaaaaaa88888888);
|
||||
atomic64Ret = LOS_Atomic64Add(&atomic64TestCounter, 0x0000000033333333);
|
||||
ICUNIT_ASSERT_EQUAL(atomic64Ret, 0x5aaaaaaabbbbbbbb, atomic64Ret);
|
||||
read64Counter = LOS_Atomic64Read(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(read64Counter, 0x5aaaaaaabbbbbbbb, read64Counter);
|
||||
|
||||
LOS_Atomic64Set(&atomic64TestCounter, 0x5aaaaaaa88888888);
|
||||
atomic64Ret = LOS_Atomic64Add(&atomic64TestCounter, 0x0000123456789abc);
|
||||
ICUNIT_ASSERT_EQUAL(atomic64Ret, 0x5aaabcdedf012344, atomic64Ret);
|
||||
read64Counter = LOS_Atomic64Read(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(read64Counter, 0x5aaabcdedf012344, read64Counter);
|
||||
|
||||
LOS_Atomic64Set(&atomic64TestCounter, 0xaaaaaaaa88888888);
|
||||
atomic64Ret = LOS_Atomic64Add(&atomic64TestCounter, 0x88888888aaaaaaaa);
|
||||
ICUNIT_ASSERT_EQUAL(atomic64Ret, 0x3333333333333332, atomic64Ret);
|
||||
read64Counter = LOS_Atomic64Read(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(read64Counter, 0x3333333333333332, read64Counter);
|
||||
|
||||
LOS_Atomic64Set(&atomic64TestCounter, 0x5aaaaaaa88888888);
|
||||
atomic64Ret = LOS_Atomic64Sub(&atomic64TestCounter, 0x0000000033333333);
|
||||
ICUNIT_ASSERT_EQUAL(atomic64Ret, 0x5aaaaaaa55555555, atomic64Ret);
|
||||
read64Counter = LOS_Atomic64Read(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(read64Counter, 0x5aaaaaaa55555555, read64Counter);
|
||||
|
||||
LOS_Atomic64Set(&atomic64TestCounter, 0x5aaaaaaa88888888);
|
||||
atomic64Ret = LOS_Atomic64Sub(&atomic64TestCounter, 0x00001234cba98765);
|
||||
ICUNIT_ASSERT_EQUAL(atomic64Ret, 0x5aaa9875bcdf0123, atomic64Ret);
|
||||
read64Counter = LOS_Atomic64Read(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(read64Counter, 0x5aaa9875bcdf0123, read64Counter);
|
||||
|
||||
LOS_Atomic64Set(&atomic64TestCounter, 0x5aaaaaaa88888888);
|
||||
atomic64Ret = LOS_Atomic64Sub(&atomic64TestCounter, 0x60001234cba98765);
|
||||
ICUNIT_ASSERT_EQUAL(atomic64Ret, 0xfaaa9875bcdf0123, atomic64Ret);
|
||||
read64Counter = LOS_Atomic64Read(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(read64Counter, 0xfaaa9875bcdf0123, read64Counter);
|
||||
|
||||
LOS_Atomic64Set(&atomic64TestCounter, 0x5aaaaaaa88888888);
|
||||
LOS_Atomic64Inc(&atomic64TestCounter);
|
||||
read64Counter = LOS_Atomic64Read(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(read64Counter, 0x5aaaaaaa88888889, read64Counter);
|
||||
|
||||
LOS_Atomic64Set(&atomic64TestCounter, 0x5aaaaaaaffffffff);
|
||||
LOS_Atomic64Inc(&atomic64TestCounter);
|
||||
read64Counter = LOS_Atomic64Read(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(read64Counter, 0x5aaaaaab00000000, read64Counter);
|
||||
|
||||
LOS_Atomic64Set(&atomic64TestCounter, 0xffffffffffffffff);
|
||||
LOS_Atomic64Inc(&atomic64TestCounter);
|
||||
read64Counter = LOS_Atomic64Read(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(read64Counter, 0x0000000000000000, read64Counter);
|
||||
|
||||
LOS_Atomic64Set(&atomic64TestCounter, 0x5aaaaaaa88888888);
|
||||
atomic64Ret = LOS_Atomic64IncRet(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(atomic64Ret, 0x5aaaaaaa88888889, atomic64Ret);
|
||||
read64Counter = LOS_Atomic64Read(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(read64Counter, 0x5aaaaaaa88888889, read64Counter);
|
||||
|
||||
LOS_Atomic64Set(&atomic64TestCounter, 0x5aaaaaaaffffffff);
|
||||
atomic64Ret = LOS_Atomic64IncRet(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(atomic64Ret, 0x5aaaaaab00000000, atomic64Ret);
|
||||
read64Counter = LOS_Atomic64Read(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(read64Counter, 0x5aaaaaab00000000, read64Counter);
|
||||
|
||||
LOS_Atomic64Set(&atomic64TestCounter, 0xffffffffffffffff);
|
||||
atomic64Ret = LOS_Atomic64IncRet(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(atomic64Ret, 0x0000000000000000, atomic64Ret);
|
||||
read64Counter = LOS_Atomic64Read(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(read64Counter, 0x0000000000000000, read64Counter);
|
||||
|
||||
LOS_Atomic64Set(&atomic64TestCounter, 0x5aaaaaaa88888888);
|
||||
LOS_Atomic64Dec(&atomic64TestCounter);
|
||||
read64Counter = LOS_Atomic64Read(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(read64Counter, 0x5aaaaaaa88888887, read64Counter);
|
||||
|
||||
LOS_Atomic64Set(&atomic64TestCounter, 0x5aaaaaaa00000000);
|
||||
LOS_Atomic64Dec(&atomic64TestCounter);
|
||||
read64Counter = LOS_Atomic64Read(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(read64Counter, 0x5aaaaaa9ffffffff, read64Counter);
|
||||
|
||||
LOS_Atomic64Set(&atomic64TestCounter, 0x0000000000000000);
|
||||
LOS_Atomic64Dec(&atomic64TestCounter);
|
||||
read64Counter = LOS_Atomic64Read(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(read64Counter, 0xffffffffffffffff, read64Counter);
|
||||
|
||||
LOS_Atomic64Set(&atomic64TestCounter, 0x5aaaaaaa88888888);
|
||||
atomic64Ret = LOS_Atomic64DecRet(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(atomic64Ret, 0x5aaaaaaa88888887, atomic64Ret);
|
||||
read64Counter = LOS_Atomic64Read(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(read64Counter, 0x5aaaaaaa88888887, read64Counter);
|
||||
|
||||
LOS_Atomic64Set(&atomic64TestCounter, 0x5aaaaaaa00000000);
|
||||
atomic64Ret = LOS_Atomic64DecRet(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(atomic64Ret, 0x5aaaaaa9ffffffff, atomic64Ret);
|
||||
read64Counter = LOS_Atomic64Read(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(read64Counter, 0x5aaaaaa9ffffffff, read64Counter);
|
||||
|
||||
LOS_Atomic64Set(&atomic64TestCounter, 0x0000000000000000);
|
||||
atomic64Ret = LOS_Atomic64DecRet(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(atomic64Ret, 0xffffffffffffffff, atomic64Ret);
|
||||
read64Counter = LOS_Atomic64Read(&atomic64TestCounter);
|
||||
ICUNIT_ASSERT_EQUAL(read64Counter, 0xffffffffffffffff, read64Counter);
|
||||
|
||||
++g_testCount;
|
||||
}
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
g_testCount = 0;
|
||||
|
||||
TSK_INIT_PARAM_S stTask1 = {0};
|
||||
stTask1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
stTask1.pcName = "Atomic_011";
|
||||
stTask1.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
|
||||
stTask1.usTaskPrio = TASK_PRIO_TEST - 2; // TASK_PRIO_TEST - 2 has higher priority than TASK_PRIO_TEST
|
||||
stTask1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &stTask1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
LOS_TaskDelay(20); // delay 20 ticks.
|
||||
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||
EXIT:
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID ItLosAtomic011(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("ItLosAtomic011", TestCase, TEST_LOS, TEST_ATO, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -35,18 +35,11 @@ VOID ItSuiteLosHwi()
|
||||
{
|
||||
ItLosHwi001();
|
||||
ItLosHwi002();
|
||||
ItLosHwi003();
|
||||
ItLosHwi004();
|
||||
ItLosHwi005();
|
||||
ItLosHwi006();
|
||||
ItLosHwi007();
|
||||
ItLosHwi008();
|
||||
ItLosHwi009();
|
||||
ItLosHwi010();
|
||||
ItLosHwi011();
|
||||
ItLosHwi012();
|
||||
ItLosHwi013();
|
||||
ItLosHwi014();
|
||||
ItLosHwi015();
|
||||
ItLosHwi016();
|
||||
ItLosHwi017();
|
||||
@@ -61,11 +54,20 @@ VOID ItSuiteLosHwi()
|
||||
ItLosHwi026();
|
||||
#endif
|
||||
ItLosHwi027();
|
||||
ItLosHwi028();
|
||||
ItLosHwi029();
|
||||
ItLosHwi030();
|
||||
ItLosHwi031();
|
||||
ItLosHwi034();
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
ItLosHwi003();
|
||||
ItLosHwi005();
|
||||
ItLosHwi009();
|
||||
ItLosHwi011();
|
||||
ItLosHwi012();
|
||||
ItLosHwi013();
|
||||
ItLosHwi014();
|
||||
ItLosHwi028();
|
||||
ItLosHwi029();
|
||||
ItLosHwi032();
|
||||
ItLosHwi033();
|
||||
ItLosHwi034();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -51,18 +51,11 @@ extern "C" {
|
||||
|
||||
extern VOID ItLosHwi001(VOID);
|
||||
extern VOID ItLosHwi002(VOID);
|
||||
extern VOID ItLosHwi003(VOID);
|
||||
extern VOID ItLosHwi004(VOID);
|
||||
extern VOID ItLosHwi005(VOID);
|
||||
extern VOID ItLosHwi006(VOID);
|
||||
extern VOID ItLosHwi007(VOID);
|
||||
extern VOID ItLosHwi008(VOID);
|
||||
extern VOID ItLosHwi009(VOID);
|
||||
extern VOID ItLosHwi010(VOID);
|
||||
extern VOID ItLosHwi011(VOID);
|
||||
extern VOID ItLosHwi012(VOID);
|
||||
extern VOID ItLosHwi013(VOID);
|
||||
extern VOID ItLosHwi014(VOID);
|
||||
extern VOID ItLosHwi015(VOID);
|
||||
extern VOID ItLosHwi016(VOID);
|
||||
extern VOID ItLosHwi017(VOID);
|
||||
@@ -76,15 +69,25 @@ extern VOID ItLosHwi024(VOID);
|
||||
extern VOID ItLosHwi025(VOID);
|
||||
extern VOID ItLosHwi026(VOID);
|
||||
extern VOID ItLosHwi027(VOID);
|
||||
extern VOID ItLosHwi028(VOID);
|
||||
extern VOID ItLosHwi029(VOID);
|
||||
extern VOID ItLosHwi030(VOID);
|
||||
extern VOID ItLosHwi031(VOID);
|
||||
extern VOID ItLosHwi032(VOID);
|
||||
extern VOID ItLosHwi033(VOID);
|
||||
extern VOID ItLosHwi034(VOID);
|
||||
extern VOID LltLosHwi035(VOID);
|
||||
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
extern VOID ItLosHwi003(VOID);
|
||||
extern VOID ItLosHwi005(VOID);
|
||||
extern VOID ItLosHwi009(VOID);
|
||||
extern VOID ItLosHwi011(VOID);
|
||||
extern VOID ItLosHwi012(VOID);
|
||||
extern VOID ItLosHwi013(VOID);
|
||||
extern VOID ItLosHwi014(VOID);
|
||||
extern VOID ItLosHwi028(VOID);
|
||||
extern VOID ItLosHwi029(VOID);
|
||||
extern VOID ItLosHwi032(VOID);
|
||||
extern VOID ItLosHwi033(VOID);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
@@ -30,8 +30,9 @@
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
@@ -82,3 +83,4 @@ VOID ItLosHwi003(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi003", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -41,7 +41,7 @@ static VOID HwiF01(VOID)
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
|
||||
@@ -30,8 +30,9 @@
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#ifdef __RISC_V__
|
||||
#define HWI_NUM_INT0 HWI_NUM_TEST2
|
||||
@@ -84,3 +85,4 @@ VOID ItLosHwi005(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi005", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL0, TEST_FUNCTION);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -30,8 +30,9 @@
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
static VOID HwiF03(VOID)
|
||||
{
|
||||
@@ -104,3 +105,4 @@ VOID ItLosHwi009(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi009", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -30,8 +30,9 @@
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
static VOID HwiF03(VOID)
|
||||
{
|
||||
@@ -117,3 +118,4 @@ VOID ItLosHwi011(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi011", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -30,8 +30,9 @@
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
static VOID HwiF03(VOID)
|
||||
{
|
||||
@@ -117,3 +118,4 @@ VOID ItLosHwi012(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi012", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -30,8 +30,9 @@
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
static VOID HwiF03(VOID)
|
||||
{
|
||||
@@ -116,3 +117,4 @@ VOID ItLosHwi013(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi013", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -30,8 +30,9 @@
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
static VOID HwiF03(VOID)
|
||||
{
|
||||
@@ -106,3 +107,4 @@ VOID ItLosHwi014(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi014", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -84,7 +84,7 @@ static VOID HwiF01(VOID)
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
@@ -97,7 +97,6 @@ static UINT32 Testcase(VOID)
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // Compare wiht the expected value 2.
|
||||
|
||||
EXIT:
|
||||
TestHwiDelete(HWI_NUM_TEST3);
|
||||
TestHwiDelete(HWI_NUM_TEST);
|
||||
|
||||
return LOS_OK;
|
||||
|
||||
@@ -67,7 +67,7 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
TSK_INIT_PARAM_S task;
|
||||
|
||||
@@ -76,7 +76,7 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
TSK_INIT_PARAM_S task;
|
||||
|
||||
@@ -94,7 +94,7 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
TSK_INIT_PARAM_S task;
|
||||
|
||||
@@ -86,7 +86,7 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
TSK_INIT_PARAM_S task;
|
||||
|
||||
@@ -80,7 +80,7 @@ static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 semCount = 1;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
TSK_INIT_PARAM_S task;
|
||||
|
||||
@@ -43,7 +43,7 @@ static UINT32 Testcase(VOID)
|
||||
UINT32 ret;
|
||||
UINT32 index;
|
||||
UINT32 loop;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
|
||||
@@ -30,8 +30,9 @@
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
static VOID HwiF03(VOID)
|
||||
{
|
||||
@@ -55,7 +56,7 @@ static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 loop;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
UINT32 intSave1;
|
||||
@@ -121,3 +122,4 @@ VOID ItLosHwi028(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi028", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL3, TEST_PRESSURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -30,8 +30,9 @@
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
static VOID HwiF03(VOID)
|
||||
{
|
||||
@@ -108,3 +109,4 @@ VOID ItLosHwi029(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi029", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL3, TEST_PRESSURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -30,8 +30,9 @@
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
static int g_uwIndex;
|
||||
#ifdef __RISC_V__
|
||||
@@ -60,7 +61,7 @@ static VOID HwiF01(VOID)
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
@@ -96,3 +97,4 @@ VOID ItLosHwi032(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi032", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL3, TEST_PRESSURE);
|
||||
}
|
||||
#endif
|
||||
@@ -30,8 +30,9 @@
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
#include "it_los_hwi.h"
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
@@ -48,7 +49,7 @@ static UINT32 Testcase(VOID)
|
||||
UINT32 ret;
|
||||
UINT32 index;
|
||||
UINT32 loop;
|
||||
HWI_PRIOR_T hwiPrio = 7;
|
||||
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
|
||||
HWI_MODE_T mode = 0;
|
||||
HWI_ARG_T arg = 0;
|
||||
|
||||
@@ -72,4 +73,5 @@ VOID ItLosHwi033(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosHwi033", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL3, TEST_PRESSURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ static UINT32 Testcase(VOID)
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task.usTaskPrio = (TASK_PRIO_TEST - 1); // 1, set new task priority, it is higher than the current task.
|
||||
task.pcName = "VMuteB2_1";
|
||||
task.uwStackSize = 0x900;
|
||||
task.uwStackSize = LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE;
|
||||
task.uwResved = 0;
|
||||
|
||||
ret = LOS_MuxCreate(&g_mutexTest);
|
||||
@@ -94,7 +94,7 @@ static UINT32 Testcase(VOID)
|
||||
task2.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
|
||||
task2.usTaskPrio = (TASK_PRIO_TEST - 2); // 2, set new task priority, it is higher than the current task.
|
||||
task2.pcName = "VMuteB2_2";
|
||||
task2.uwStackSize = 0x900;
|
||||
task2.uwStackSize = LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE;
|
||||
task2.uwResved = 0;
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID02, &task2);
|
||||
|
||||
@@ -30,8 +30,9 @@
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_mux.h"
|
||||
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
#include "It_los_mux.h"
|
||||
|
||||
static VOID HwiF02(void)
|
||||
{
|
||||
@@ -94,4 +95,5 @@ VOID ItLosMux020(void)
|
||||
{
|
||||
TEST_ADD_CASE("ItLosMux020", Testcase, TEST_LOS, TEST_MUX, TEST_LEVEL2, TEST_FUNCTION);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -72,9 +72,11 @@ VOID ItSuiteLosMux(void)
|
||||
ItLosMux017();
|
||||
ItLosMux019();
|
||||
#ifndef __RISC_V__
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
ItLosMux020();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,6 @@ VOID ItLosMux016(void);
|
||||
VOID ItLosMux017(void);
|
||||
VOID ItLosMux018(void);
|
||||
VOID ItLosMux019(void);
|
||||
VOID ItLosMux020(void);
|
||||
VOID ItLosMux021(void);
|
||||
VOID ItLosMux022(void);
|
||||
VOID ItLosMux023(void);
|
||||
@@ -78,6 +77,9 @@ VOID ItLosMux034(void);
|
||||
|
||||
VOID ItSuiteLosMux(void);
|
||||
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
VOID ItLosMux020(void);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
@@ -156,7 +156,9 @@ VOID ItSuiteLosQueue(VOID)
|
||||
#if (LOS_KERNEL_HWI_TEST == 1)
|
||||
ItLosQueue044();
|
||||
ItLosQueue045();
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
ItLosQueue046();
|
||||
#endif
|
||||
ItLosQueue047();
|
||||
ItLosQueue048();
|
||||
ItLosQueue050();
|
||||
|
||||
@@ -94,7 +94,6 @@ extern VOID ItLosQueue042(VOID);
|
||||
extern VOID ItLosQueue043(VOID);
|
||||
extern VOID ItLosQueue044(VOID);
|
||||
extern VOID ItLosQueue045(VOID);
|
||||
extern VOID ItLosQueue046(VOID);
|
||||
extern VOID ItLosQueue047(VOID);
|
||||
extern VOID ItLosQueue048(VOID);
|
||||
extern VOID ItLosQueue050(VOID);
|
||||
@@ -185,6 +184,10 @@ extern VOID ItLosQueueHead040(VOID);
|
||||
extern VOID ItLosQueueHead041(VOID);
|
||||
extern VOID ItLosQueueHead042(VOID);
|
||||
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
extern VOID ItLosQueue046(VOID);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
|
||||
@@ -29,8 +29,10 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "It_los_queue.h"
|
||||
#include "osTest.h"
|
||||
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
#include "It_los_queue.h"
|
||||
|
||||
static VOID HwiF01(VOID)
|
||||
{
|
||||
@@ -103,4 +105,5 @@ VOID ItLosQueue046(VOID)
|
||||
{
|
||||
TEST_ADD_CASE("ItLosQueue046", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL1, TEST_FUNCTION);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ static_library("test_swtmr") {
|
||||
"It_los_swtmr_076.c",
|
||||
"It_los_swtmr_077.c",
|
||||
"It_los_swtmr_078.c",
|
||||
"It_los_swtmr_079.c",
|
||||
"It_los_swtmr_Align_001.c",
|
||||
"It_los_swtmr_Align_002.c",
|
||||
"It_los_swtmr_Align_003.c",
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "It_los_swtmr.h"
|
||||
|
||||
|
||||
#ifdef __RISC_V__
|
||||
#if defined(__RISC_V__) || defined(__XTENSA_LX6__) || defined(__CSKY_V2__)
|
||||
#define HWI_NUM_INT31 HWI_NUM_TEST
|
||||
#define HWI_NUM_INT14 HWI_NUM_TEST
|
||||
#endif
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "It_los_swtmr.h"
|
||||
|
||||
|
||||
#ifdef __RISC_V__
|
||||
#if defined(__RISC_V__) || defined(__XTENSA_LX6__) || defined(__CSKY_V2__)
|
||||
#define HWI_NUM_INT31 HWI_NUM_TEST
|
||||
#define HWI_NUM_INT14 HWI_NUM_TEST
|
||||
#endif
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "It_los_swtmr.h"
|
||||
|
||||
|
||||
#ifdef __RISC_V__
|
||||
#if defined(__RISC_V__) || defined(__XTENSA_LX6__) || defined(__CSKY_V2__)
|
||||
#define HWI_NUM_INT11 HWI_NUM_TEST
|
||||
#endif
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "It_los_swtmr.h"
|
||||
|
||||
|
||||
#ifdef __RISC_V__
|
||||
#if defined(__RISC_V__) || defined(__XTENSA_LX6__) || defined(__CSKY_V2__)
|
||||
#define HWI_NUM_INT12 HWI_NUM_TEST
|
||||
#endif
|
||||
|
||||
|
||||
@@ -79,8 +79,8 @@ static UINT32 Testcase(VOID)
|
||||
ret = LOS_SwtmrTimeGet(g_swtmrId1, &tick);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
// 2, assert that uwTick is equal to this.
|
||||
ICUNIT_GOTO_EQUAL(tick, 2, tick, EXIT);
|
||||
// 1, assert that uwTick is equal to this.
|
||||
ICUNIT_GOTO_EQUAL(tick, 1, tick, EXIT);
|
||||
|
||||
// 2, Here, assert that g_testCount is equal to this .
|
||||
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT);
|
||||
|
||||
@@ -68,7 +68,7 @@ static UINT32 Testcase(VOID)
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
id2 = swtmrId1;
|
||||
ICUNIT_GOTO_EQUAL(id1, id2, id2, EXIT);
|
||||
ICUNIT_GOTO_NOT_EQUAL(id1, id2, id2, EXIT);
|
||||
|
||||
ret = LOS_SwtmrDelete(id2);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
@@ -61,7 +61,7 @@ static VOID TaskF01(VOID)
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1 = { 0 };
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
|
||||
task1.uwStackSize = 0x400; // Set reasonable stack space
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST; // Set reasonable stack space
|
||||
task1.pcName = "Tsk080B";
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 1;
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
@@ -95,7 +95,7 @@ static UINT32 TestCase(VOID)
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1 = { 0 };
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.uwStackSize = 0x400; // Set reasonable stack space
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST; // Set reasonable stack space
|
||||
task1.pcName = "Tsk080A";
|
||||
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task.
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
@@ -55,15 +55,13 @@ static UINT32 TestCase(VOID)
|
||||
task1.uwStackSize = LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE + 0x100;
|
||||
|
||||
if (LOSCFG_BASE_CORE_SWTMR == 1) {
|
||||
startIndex = 3; // 3, init the index according to LOSCFG_BASE_CORE_SWTMR.
|
||||
pro = 1;
|
||||
} else {
|
||||
startIndex = 0;
|
||||
pro = 0;
|
||||
}
|
||||
startIndex = TaskUsedCountGet() + 1;
|
||||
|
||||
g_testCount = 0;
|
||||
g_index = startIndex;
|
||||
|
||||
LOS_TaskLock();
|
||||
|
||||
|
||||
@@ -30,8 +30,9 @@
|
||||
*/
|
||||
|
||||
#include "osTest.h"
|
||||
#include "It_los_task.h"
|
||||
|
||||
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
|
||||
#include "It_los_task.h"
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
@@ -146,4 +147,5 @@ VOID ItLosTask084(VOID) // IT_Layer_ModuleORFeature_No
|
||||
{
|
||||
TEST_ADD_CASE("ItLosTask084", TestCase, TEST_LOS, TEST_TASK, TEST_LEVEL2, TEST_PRESSURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -56,15 +56,13 @@ static VOID HwiF01(VOID)
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
|
||||
if (LOSCFG_BASE_CORE_SWTMR == 1) {
|
||||
startIndex = 3; // 3, init the index according to LOSCFG_BASE_CORE_SWTMR.
|
||||
pro = 1;
|
||||
} else {
|
||||
startIndex = 0;
|
||||
pro = 0;
|
||||
}
|
||||
startIndex = TaskUsedCountGet() + 1;
|
||||
|
||||
g_testCount = 0;
|
||||
g_index = startIndex;
|
||||
|
||||
for (g_index = startIndex; g_index < LOSCFG_BASE_CORE_TSK_LIMIT + 1; pro++, g_testCount++, g_index++) {
|
||||
task1.usTaskPrio = pro;
|
||||
|
||||
@@ -245,7 +245,7 @@ UINT32 los_TestInit(VOID)
|
||||
return ret;
|
||||
}
|
||||
|
||||
UINT32 LosAppInit()
|
||||
UINT32 LosAppInit(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
@@ -299,7 +299,11 @@ UINT64 LosCpuCycleGet(VOID)
|
||||
#define HWI_BIT 2
|
||||
VOID TestHwiTrigger(UINT32 hwiNum)
|
||||
{
|
||||
#if defined(__CSKY_V2__) || defined(__XTENSA_LX6__)
|
||||
HalIrqPending(hwiNum);
|
||||
#else
|
||||
*(volatile UINT32 *)(OS_NVIC_SETPEND + ((hwiNum >> HWI_SHIFT_NUM) << HWI_BIT)) = 1 << (hwiNum & 0x1F);
|
||||
#endif
|
||||
}
|
||||
|
||||
VOID TestHwiUnTrigger(UINT32 hwiNum)
|
||||
|
||||
@@ -418,6 +418,108 @@ static inline UINT32 LOS_Align(UINT32 addr, UINT32 boundary)
|
||||
#define UNUSED(X) (void)X
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
static inline void maybe_release_fence(int model)
|
||||
{
|
||||
switch (model) {
|
||||
case __ATOMIC_RELEASE:
|
||||
__atomic_thread_fence (__ATOMIC_RELEASE);
|
||||
break;
|
||||
case __ATOMIC_ACQ_REL:
|
||||
__atomic_thread_fence (__ATOMIC_ACQ_REL);
|
||||
break;
|
||||
case __ATOMIC_SEQ_CST:
|
||||
__atomic_thread_fence (__ATOMIC_SEQ_CST);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void maybe_acquire_fence(int model)
|
||||
{
|
||||
switch (model) {
|
||||
case __ATOMIC_ACQUIRE:
|
||||
__atomic_thread_fence (__ATOMIC_ACQUIRE);
|
||||
break;
|
||||
case __ATOMIC_ACQ_REL:
|
||||
__atomic_thread_fence (__ATOMIC_ACQ_REL);
|
||||
break;
|
||||
case __ATOMIC_SEQ_CST:
|
||||
__atomic_thread_fence (__ATOMIC_SEQ_CST);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#define __LIBATOMIC_N_LOCKS (1 << 4) /* 4, 1<<4 locks num */
|
||||
static inline BOOL *__libatomic_flag_for_address(void *addr)
|
||||
{
|
||||
static BOOL flag_table[__LIBATOMIC_N_LOCKS] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
UINTPTR p = (UINTPTR)(UINTPTR *)addr;
|
||||
p += (p >> 2) + (p << 4); /* 2, 4, hash data */
|
||||
p += (p >> 7) + (p << 5); /* 7, 5, hash data */
|
||||
p += (p >> 17) + (p << 13); /* 17, 13, hash data */
|
||||
|
||||
if (sizeof(void *) > 4) { /* 4, sizeof int in 32bit system */
|
||||
p += (p >> 31); /* 31, for hash high bits data */
|
||||
}
|
||||
|
||||
p &= (__LIBATOMIC_N_LOCKS - 1);
|
||||
return flag_table + p;
|
||||
}
|
||||
|
||||
static inline void get_lock(void *addr, int model)
|
||||
{
|
||||
BOOL *lock_ptr = __libatomic_flag_for_address (addr);
|
||||
|
||||
maybe_release_fence (model);
|
||||
while (__atomic_test_and_set (lock_ptr, __ATOMIC_ACQUIRE) == 1) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void free_lock(void *addr, int model)
|
||||
{
|
||||
BOOL *lock_ptr = __libatomic_flag_for_address (addr);
|
||||
|
||||
__atomic_clear (lock_ptr, __ATOMIC_RELEASE);
|
||||
maybe_acquire_fence (model);
|
||||
}
|
||||
|
||||
static inline UINT64 __atomic_load_8(const volatile void *mem, int model)
|
||||
{
|
||||
UINT64 ret;
|
||||
|
||||
void *memP = (void *)mem;
|
||||
get_lock (memP, model);
|
||||
ret = *(UINT64 *)mem;
|
||||
free_lock (memP, model);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void __atomic_store_8(volatile void *mem, UINT64 val, int model)
|
||||
{
|
||||
void *memP = (void *)mem;
|
||||
get_lock (memP, model);
|
||||
*(UINT64 *)mem = val;
|
||||
free_lock (memP, model);
|
||||
}
|
||||
|
||||
static inline UINT64 __atomic_exchange_8(volatile void *mem, UINT64 val, int model)
|
||||
{
|
||||
UINT64 ret;
|
||||
|
||||
void *memP = (void *)mem;
|
||||
get_lock (memP, model);
|
||||
ret = *(UINT64 *)mem;
|
||||
*(UINT64 *)mem = val;
|
||||
free_lock (memP, model);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user