Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
81cdf0c6
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
1 年多 前同步成功
通知
460
Star
414
Fork
55
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel Liteos A
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
81cdf0c6
编写于
4月 19, 2021
作者:
O
openharmony_ci
提交者:
Gitee
4月 19, 2021
浏览文件
操作
浏览文件
下载
差异文件
!156 代码优化
Merge pull request !156 from Caoruihong/ioremap
上级
2da9dfe6
1ea9610f
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
49 addition
and
285 deletion
+49
-285
arch/arm/arm/include/arm.h
arch/arm/arm/include/arm.h
+0
-4
arch/arm/arm/include/hal_timer.h
arch/arm/arm/include/hal_timer.h
+0
-1
arch/arm/arm/include/los_hw_cpu.h
arch/arm/arm/include/los_hw_cpu.h
+1
-0
arch/arm/arm/src/arm_generic_timer.c
arch/arm/arm/src/arm_generic_timer.c
+1
-1
arch/arm/arm/src/los_hw.c
arch/arm/arm/src/los_hw.c
+3
-18
arch/arm/include/los_exc.h
arch/arm/include/los_exc.h
+1
-1
arch/arm/include/los_hw.h
arch/arm/include/los_hw.h
+0
-128
compat/posix/src/time.c
compat/posix/src/time.c
+3
-3
drivers/char/random/src/random.c
drivers/char/random/src/random.c
+1
-1
kernel/base/core/los_task.c
kernel/base/core/los_task.c
+1
-1
kernel/base/include/los_vm_iomap.h
kernel/base/include/los_vm_iomap.h
+0
-5
kernel/base/vm/los_vm_iomap.c
kernel/base/vm/los_vm_iomap.c
+0
-108
kernel/extended/vdso/src/los_vdso.c
kernel/extended/vdso/src/los_vdso.c
+2
-2
kernel/include/los_base.h
kernel/include/los_base.h
+12
-12
kernel/include/los_toolchain.h
kernel/include/los_toolchain.h
+24
-0
未找到文件。
arch/arm/arm/include/arm.h
浏览文件 @
81cdf0c6
...
...
@@ -36,10 +36,6 @@
#define CPSR_MODE_USR 0x10
#define CPSR_MODE_MASK 0x1f
#define DSB __asm__ volatile("dsb" ::: "memory")
#define ISB __asm__ volatile("isb" ::: "memory")
#define DMB __asm__ volatile("dmb" ::: "memory")
STATIC
INLINE
UINT32
OsArmReadSctlr
(
VOID
)
{
UINT32
val
;
...
...
arch/arm/arm/include/hal_timer.h
浏览文件 @
81cdf0c6
...
...
@@ -45,7 +45,6 @@ extern VOID HalClockIrqClear(VOID);
extern
VOID
HalClockInit
(
VOID
);
extern
UINT64
HalClockGetCycles
(
VOID
);
extern
VOID
HalDelayUs
(
UINT32
usecs
);
extern
UINT64
hi_sched_clock
(
VOID
);
extern
UINT32
HalClockGetTickTimerCycles
(
VOID
);
extern
VOID
HalClockTickTimerReload
(
UINT64
cycles
);
...
...
arch/arm/arm/include/los_hw_cpu.h
浏览文件 @
81cdf0c6
...
...
@@ -51,6 +51,7 @@ extern "C" {
#define DSB __asm__ volatile("dsb" ::: "memory")
#define DMB __asm__ volatile("dmb" ::: "memory")
#define ISB __asm__ volatile("isb" ::: "memory")
#define WFI __asm__ volatile("wfi" ::: "memory")
#define BARRIER __asm__ volatile("":::"memory")
#define ARM_SYSREG_READ(REG) \
...
...
arch/arm/arm/src/arm_generic_timer.c
浏览文件 @
81cdf0c6
...
...
@@ -162,7 +162,7 @@ VOID HalDelayUs(UINT32 usecs)
}
}
UINT64
hi_sched_clock
(
VOID
)
DEPRECATED
UINT64
hi_sched_clock
(
VOID
)
{
return
LOS_CurrNanosec
();
}
...
...
arch/arm/arm/src/los_hw.c
浏览文件 @
81cdf0c6
...
...
@@ -143,32 +143,17 @@ LITE_OS_SEC_TEXT_INIT VOID OsUserTaskStackInit(TaskContext *context, TSK_ENTRY_F
context
->
PC
=
(
UINTPTR
)
taskEntry
;
}
VOID
Sev
(
VOID
)
{
__asm__
__volatile__
(
"sev"
:
:
:
"memory"
);
}
VOID
Wfe
(
VOID
)
{
__asm__
__volatile__
(
"wfe"
:
:
:
"memory"
);
}
VOID
Wfi
(
VOID
)
{
__asm__
__volatile__
(
"wfi"
:
:
:
"memory"
);
}
VOID
Dmb
(
VOID
)
DEPRECATED
VOID
Dmb
(
VOID
)
{
__asm__
__volatile__
(
"dmb"
:
:
:
"memory"
);
}
VOID
Dsb
(
VOID
)
DEPRECATED
VOID
Dsb
(
VOID
)
{
__asm__
__volatile__
(
"dsb"
:
:
:
"memory"
);
}
VOID
Isb
(
VOID
)
DEPRECATED
VOID
Isb
(
VOID
)
{
__asm__
__volatile__
(
"isb"
:
:
:
"memory"
);
}
...
...
arch/arm/include/los_exc.h
浏览文件 @
81cdf0c6
...
...
@@ -183,7 +183,7 @@ extern UINT32 LOS_ExcRegHook(EXC_PROC_FUNC excHook);
* los_exc.h: the header file that contains the API declaration.
* @see None.
*/
VOID
LOS_Panic
(
const
CHAR
*
fmt
,
...)
__attribute__
((
noreturn
))
;
VOID
LOS_Panic
(
const
CHAR
*
fmt
,
...)
NORETURN
;
/**
* @ingroup los_exc
...
...
arch/arm/include/los_hw.h
浏览文件 @
81cdf0c6
...
...
@@ -77,134 +77,6 @@ extern UINT64 g_cpuMap[];
#define CPU_MAP_GET(cpuid) g_cpuMap[(cpuid)]
#define CPU_MAP_SET(cpuid, hwid) g_cpuMap[(cpuid)] = (hwid)
/**
* @ingroup los_hw
* @brief Set Event.
*
* @par Description:
* <ul>
* <li>This API is used to send an event to all cores within a muti-processor system.</li>
* </ul>
* @attention
* <ul>
* <li>This API is not implemented.</li>
* </ul>
*
* @param None.
*
* @retval #None.
*
* @par Dependency:
* los_hw.h: the header file that contains the API declaration.
* @see wfe.
*/
extern
VOID
Sev
(
VOID
);
/**
* @ingroup los_hw
* @brief Wait for event.
*
* @par Description:
* <ul>
* <li>This API is used to suspend execution until events occurs if the event register is not set.</li>
* </ul>
* @attention
* <ul>
* <li>This API is not implemented.</li>
* </ul>
*
* @param None.
*
* @retval #None.
*
* @par Dependency:
* los_hw.h: the header file that contains the API declaration.
* @see sev.
*/
extern
VOID
Wfe
(
VOID
);
/**
* @ingroup los_hw
* @brief Wait for interrupt.
*
* @par Description:
* <ul>
* <li>This API is used to suspend execution until interrupt or a debug request occurs.</li>
* </ul>
* @attention None.
*
* @param None.
*
* @retval #None.
*
* @par Dependency:
* los_hw.h: the header file that contains the API declaration.
* @see None.
*/
extern
VOID
Wfi
(
VOID
);
/**
* @ingroup los_hw
* @brief Data Memory Barrier.
*
* @par Description:
* <ul>
* <li>This API is used as a memory barrier</li>
* </ul>
* @attention None.
*
* @param None.
*
* @retval #None.
*
* @par Dependency:
* los_hw.h: the header file that contains the API declaration.
* @see None.
*/
extern
VOID
Dmb
(
VOID
);
/**
* @ingroup los_hw
* @brief Data Synchronization Barrier.
*
* @par Description:
* <ul>
* <li>This API is used as a special kind of memory barrier</li>
* </ul>
* @attention None.
*
* @param None.
*
* @retval #None.
*
* @par Dependency:
* los_hw.h: the header file that contains the API declaration.
* @see None.
*/
extern
VOID
Dsb
(
VOID
);
/**
* @ingroup los_hw
* @brief Instruction Synchronization Barrier.
*
* @par Description:
* <ul>
* <li>This API is used to flush the pipeline in the processor,
* so that all instructions following the ISB are fetched from cache or memory,
* after the instruction has been completed.</li>
* </ul>
* @attention None.
*
* @param None.
*
* @retval #None.
*
* @par Dependency:
* los_hw.h: the header file that contains the API declaration.
* @see None.
*/
extern
VOID
Isb
(
VOID
);
/**
* @ingroup los_hw
* @brief Invalidate instruction cache.
...
...
compat/posix/src/time.c
浏览文件 @
81cdf0c6
...
...
@@ -280,7 +280,7 @@ STATIC VOID OsGetHwTime(struct timespec64 *hwTime)
{
UINT64
nowNsec
;
nowNsec
=
hi_sched_clock
();
nowNsec
=
LOS_CurrNanosec
();
hwTime
->
tv_sec
=
nowNsec
/
OS_SYS_NS_PER_SECOND
;
hwTime
->
tv_nsec
=
nowNsec
-
hwTime
->
tv_sec
*
OS_SYS_NS_PER_SECOND
;
}
...
...
@@ -865,8 +865,8 @@ clock_t clock(VOID)
clock_t
clockMsec
;
UINT64
nowNsec
;
nowNsec
=
hi_sched_clock
();
clockMsec
=
(
clock_t
)(
nowNsec
/
OS_SYS_NS_PER_MS
);
nowNsec
=
LOS_CurrNanosec
();
clockMsec
=
(
clock_t
)(
nowNsec
/
(
OS_SYS_NS_PER_SECOND
/
CLOCKS_PER_SEC
)
);
return
clockMsec
;
}
...
...
drivers/char/random/src/random.c
浏览文件 @
81cdf0c6
...
...
@@ -58,7 +58,7 @@ static unsigned long g_seed = 1;
int
RanOpen
(
struct
file
*
filep
)
{
g_seed
=
(
unsigned
long
)(
hi_sched_clock
()
&
0xffffffff
);
g_seed
=
(
unsigned
long
)(
LOS_CurrNanosec
()
&
0xffffffff
);
return
0
;
}
...
...
kernel/base/core/los_task.c
浏览文件 @
81cdf0c6
...
...
@@ -117,7 +117,7 @@ VOID OsSetMainTask()
LITE_OS_SEC_TEXT
WEAK
VOID
OsIdleTask
(
VOID
)
{
while
(
1
)
{
W
fi
()
;
W
FI
;
}
}
...
...
kernel/base/include/los_vm_iomap.h
浏览文件 @
81cdf0c6
...
...
@@ -46,11 +46,6 @@ enum DmaMemType {
DMA_NOCACHE
};
#define IS_PERIPH_ADDR(addr) \
(((addr) >= U32_C(PERIPH_PMM_BASE)) && ((addr) <= U32_C(PERIPH_PMM_BASE) + U32_C(PERIPH_PMM_SIZE)))
#define IS_MEMORY_ADDR(addr) \
(((addr) >= U32_C(DDR_MEM_ADDR)) && ((addr) <= U32_C(DDR_MEM_ADDR) + U32_C(DDR_MEM_SIZE)))
/* thread safety */
VOID
*
LOS_DmaMemAlloc
(
DMA_ADDR_T
*
dmaAddr
,
size_t
size
,
size_t
align
,
enum
DmaMemType
type
);
VOID
LOS_DmaMemFree
(
VOID
*
vaddr
);
...
...
kernel/base/vm/los_vm_iomap.c
浏览文件 @
81cdf0c6
...
...
@@ -43,114 +43,6 @@ extern "C" {
#endif
/* __cplusplus */
#endif
/* __cplusplus */
VOID
*
ioremap
(
PADDR_T
paddr
,
unsigned
long
size
)
{
if
(
IS_PERIPH_ADDR
(
paddr
)
&&
IS_PERIPH_ADDR
(
paddr
+
size
))
{
return
(
VOID
*
)(
UINTPTR
)
IO_DEVICE_ADDR
(
paddr
);
}
VM_ERR
(
"ioremap failed invalid addr or size %p %d"
,
paddr
,
size
);
return
(
VOID
*
)(
UINTPTR
)
paddr
;
}
VOID
iounmap
(
VOID
*
vaddr
)
{}
VOID
*
ioremap_nocache
(
PADDR_T
paddr
,
unsigned
long
size
)
{
if
(
IS_PERIPH_ADDR
(
paddr
)
&&
IS_PERIPH_ADDR
(
paddr
+
size
))
{
return
(
VOID
*
)(
UINTPTR
)
IO_UNCACHED_ADDR
(
paddr
);
}
if
(
IS_MEMORY_ADDR
(
paddr
)
&&
IS_MEMORY_ADDR
(
paddr
+
size
))
{
return
(
VOID
*
)(
UINTPTR
)
MEM_UNCACHED_ADDR
(
paddr
);
}
VM_ERR
(
"ioremap_nocache failed invalid addr or size %p %d"
,
paddr
,
size
);
return
(
VOID
*
)(
UINTPTR
)
paddr
;
}
VOID
*
ioremap_cached
(
PADDR_T
paddr
,
unsigned
long
size
)
{
if
(
IS_PERIPH_ADDR
(
paddr
)
&&
IS_PERIPH_ADDR
(
paddr
+
size
))
{
return
(
VOID
*
)(
UINTPTR
)
IO_CACHED_ADDR
(
paddr
);
}
if
(
IS_MEMORY_ADDR
(
paddr
)
&&
IS_MEMORY_ADDR
(
paddr
+
size
))
{
return
(
VOID
*
)(
UINTPTR
)
MEM_CACHED_ADDR
(
paddr
);
}
VM_ERR
(
"ioremap_cached failed invalid addr or size %p %d"
,
paddr
,
size
);
return
(
VOID
*
)(
UINTPTR
)
paddr
;
}
#ifdef LOSCFG_KERNEL_VM
int
remap_pfn_range
(
VADDR_T
vaddr
,
unsigned
long
pfn
,
unsigned
long
size
,
unsigned
long
prot
)
{
STATUS_T
status
=
LOS_OK
;
int
ret
;
LosVmMapRegion
*
region
=
NULL
;
unsigned
long
vpos
;
unsigned
long
end
;
unsigned
long
paddr
=
pfn
<<
PAGE_SHIFT
;
LosVmSpace
*
space
=
LOS_SpaceGet
(
vaddr
);
if
(
size
==
0
)
{
VM_ERR
(
"invalid map size %u"
,
size
);
return
LOS_ERRNO_VM_INVALID_ARGS
;
}
size
=
ROUNDUP
(
size
,
PAGE_SIZE
);
if
(
!
IS_PAGE_ALIGNED
(
vaddr
)
||
pfn
==
0
)
{
VM_ERR
(
"invalid map map vaddr %x or pfn %x"
,
vaddr
,
pfn
);
return
LOS_ERRNO_VM_INVALID_ARGS
;
}
if
(
space
==
NULL
)
{
VM_ERR
(
"aspace not exists"
);
return
LOS_ERRNO_VM_NOT_FOUND
;
}
(
VOID
)
LOS_MuxAcquire
(
&
space
->
regionMux
);
region
=
LOS_RegionFind
(
space
,
vaddr
);
if
(
region
==
NULL
)
{
VM_ERR
(
"region not exists"
);
status
=
LOS_ERRNO_VM_NOT_FOUND
;
goto
OUT
;
}
end
=
vaddr
+
size
;
if
(
region
->
range
.
base
+
region
->
range
.
size
<
end
)
{
VM_ERR
(
"out of range:base=%x size=%d vaddr=%x len=%u"
,
region
->
range
.
base
,
region
->
range
.
size
,
vaddr
,
size
);
status
=
LOS_ERRNO_VM_INVALID_ARGS
;
goto
OUT
;
}
/* check */
for
(
vpos
=
vaddr
;
vpos
<
end
;
vpos
+=
PAGE_SIZE
)
{
status
=
LOS_ArchMmuQuery
(
&
space
->
archMmu
,
(
VADDR_T
)
vpos
,
NULL
,
NULL
);
if
(
status
==
LOS_OK
)
{
VM_ERR
(
"remap_pfn_range, address mapping already exist"
);
status
=
LOS_ERRNO_VM_INVALID_ARGS
;
goto
OUT
;
}
}
/* map all */
ret
=
LOS_ArchMmuMap
(
&
space
->
archMmu
,
vaddr
,
paddr
,
size
>>
PAGE_SHIFT
,
prot
);
if
(
ret
<=
0
)
{
VM_ERR
(
"ioremap LOS_ArchMmuMap failed err = %d"
,
ret
);
goto
OUT
;
}
status
=
LOS_OK
;
OUT:
(
VOID
)
LOS_MuxRelease
(
&
space
->
regionMux
);
return
status
;
}
#endif
VOID
*
LOS_DmaMemAlloc
(
DMA_ADDR_T
*
dmaAddr
,
size_t
size
,
size_t
align
,
enum
DmaMemType
type
)
{
VOID
*
kVaddr
=
NULL
;
...
...
kernel/extended/vdso/src/los_vdso.c
浏览文件 @
81cdf0c6
...
...
@@ -108,12 +108,12 @@ LOCK_RELEASE:
STATIC
VOID
OsLockVdso
(
VdsoDataPage
*
vdsoDataPage
)
{
vdsoDataPage
->
lockCount
=
1
;
D
mb
()
;
D
MB
;
}
STATIC
VOID
OsUnlockVdso
(
VdsoDataPage
*
vdsoDataPage
)
{
D
mb
()
;
D
MB
;
vdsoDataPage
->
lockCount
=
0
;
}
...
...
kernel/include/los_base.h
浏览文件 @
81cdf0c6
...
...
@@ -93,73 +93,73 @@ extern VOID PrintExcInfo(const CHAR *fmt, ...);
* @ingroup los_base
* Read a UINT8 value from addr and stroed in value.
*/
#define READ_UINT8(value, addr) ({ (value) = *((volatile UINT8 *)((UINTPTR)(addr))); D
sb()
; })
#define READ_UINT8(value, addr) ({ (value) = *((volatile UINT8 *)((UINTPTR)(addr))); D
SB
; })
/**
* @ingroup los_base
* Read a UINT16 value from addr and stroed in addr.
*/
#define READ_UINT16(value, addr) ({ (value) = *((volatile UINT16 *)((UINTPTR)(addr))); D
sb()
; })
#define READ_UINT16(value, addr) ({ (value) = *((volatile UINT16 *)((UINTPTR)(addr))); D
SB
; })
/**
* @ingroup los_base
* Read a UINT32 value from addr and stroed in value.
*/
#define READ_UINT32(value, addr) ({ (value) = *((volatile UINT32 *)((UINTPTR)(addr))); D
sb()
; })
#define READ_UINT32(value, addr) ({ (value) = *((volatile UINT32 *)((UINTPTR)(addr))); D
SB
; })
/**
* @ingroup los_base
* Read a UINT64 value from addr and stroed in value.
*/
#define READ_UINT64(value, addr) ({ (value) = *((volatile UINT64 *)((UINTPTR)(addr))); D
sb()
; })
#define READ_UINT64(value, addr) ({ (value) = *((volatile UINT64 *)((UINTPTR)(addr))); D
SB
; })
/**
* @ingroup los_base
* Write a UINT8 value to addr.
*/
#define WRITE_UINT8(value, addr) ({ D
sb()
; *((volatile UINT8 *)((UINTPTR)(addr))) = (value); })
#define WRITE_UINT8(value, addr) ({ D
SB
; *((volatile UINT8 *)((UINTPTR)(addr))) = (value); })
/**
* @ingroup los_base
* Write a UINT16 value to addr.
*/
#define WRITE_UINT16(value, addr) ({ D
sb()
; *((volatile UINT16 *)((UINTPTR)(addr))) = (value); })
#define WRITE_UINT16(value, addr) ({ D
SB
; *((volatile UINT16 *)((UINTPTR)(addr))) = (value); })
/**
* @ingroup los_base
* Write a UINT32 value to addr.
*/
#define WRITE_UINT32(value, addr) ({ D
sb()
; *((volatile UINT32 *)((UINTPTR)(addr))) = (value); })
#define WRITE_UINT32(value, addr) ({ D
SB
; *((volatile UINT32 *)((UINTPTR)(addr))) = (value); })
/**
* @ingroup los_base
* Write a UINT64 addr to addr.
*/
#define WRITE_UINT64(value, addr) ({ D
sb()
; *((volatile UINT64 *)((UINTPTR)(addr))) = (value); })
#define WRITE_UINT64(value, addr) ({ D
SB
; *((volatile UINT64 *)((UINTPTR)(addr))) = (value); })
/**
* @ingroup los_base
* Get a UINT8 value from addr.
*/
#define GET_UINT8(addr) ({ UINT8 r = *((volatile UINT8 *)((UINTPTR)(addr))); D
sb()
; r; })
#define GET_UINT8(addr) ({ UINT8 r = *((volatile UINT8 *)((UINTPTR)(addr))); D
SB
; r; })
/**
* @ingroup los_base
* Get a UINT16 value from addr.
*/
#define GET_UINT16(addr) ({ UINT16 r = *((volatile UINT16 *)((UINTPTR)(addr))); D
sb()
; r; })
#define GET_UINT16(addr) ({ UINT16 r = *((volatile UINT16 *)((UINTPTR)(addr))); D
SB
; r; })
/**
* @ingroup los_base
* Get a UINT32 value from addr.
*/
#define GET_UINT32(addr) ({ UINT32 r = *((volatile UINT32 *)((UINTPTR)(addr))); D
sb()
; r; })
#define GET_UINT32(addr) ({ UINT32 r = *((volatile UINT32 *)((UINTPTR)(addr))); D
SB
; r; })
/**
* @ingroup los_base
* Get a UINT64 value from addr.
*/
#define GET_UINT64(addr) ({ UINT64 r = *((volatile UINT64 *)((UINTPTR)(addr)));
Dsb()
; r; })
#define GET_UINT64(addr) ({ UINT64 r = *((volatile UINT64 *)((UINTPTR)(addr)));
l
; r; })
#ifdef LOSCFG_DEBUG_VERSION
#define LOS_ASSERT(judge) do { \
...
...
kernel/include/los_toolchain.h
浏览文件 @
81cdf0c6
...
...
@@ -73,6 +73,14 @@ extern "C" {
#define CLZ(value) (__clz(value))
#endif
#ifndef NORETURN
#define NORETURN __declspec(noreturn)
#endif
#ifndef DEPRECATED
#define DEPRECATED __attribute__((deprecated))
#endif
/* for IAR Compiler */
#elif defined ( __ICCARM__ )
...
...
@@ -104,6 +112,14 @@ extern "C" {
#define CTZ(value) (__UNDEFINED(value))
#endif
#ifndef NORETURN
#define NORETURN __attribute__ ((__noreturn__))
#endif
#ifndef DEPRECATED
#define DEPRECATED __attribute__((deprecated))
#endif
/* for GNU Compiler */
#elif defined ( __GNUC__ )
...
...
@@ -135,6 +151,14 @@ extern "C" {
#define CTZ(value) (__builtin_ctz(value))
#endif
#ifndef NORETURN
#define NORETURN __attribute__ ((__noreturn__))
#endif
#ifndef DEPRECATED
#define DEPRECATED __attribute__((deprecated))
#endif
#else
#error Unknown compiler.
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录