mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-22 19:44:24 +08:00
Prepare some api for DM (#7894)
Signed-off-by: GuEe-GUI <GuEe-GUI@github.com>
This commit is contained in:
@@ -23,30 +23,20 @@ typedef union {
|
||||
} rt_hw_spinlock_t;
|
||||
#endif
|
||||
|
||||
rt_inline void rt_hw_isb(void)
|
||||
{
|
||||
__asm__ volatile ("isb":::"memory");
|
||||
}
|
||||
#define rt_hw_barrier(cmd, ...) \
|
||||
__asm__ volatile (RT_STRINGIFY(cmd) " "RT_STRINGIFY(__VA_ARGS__):::"memory")
|
||||
|
||||
rt_inline void rt_hw_dmb(void)
|
||||
{
|
||||
__asm__ volatile ("dmb ish":::"memory");
|
||||
}
|
||||
#define rt_hw_isb() rt_hw_barrier(isb)
|
||||
#define rt_hw_dmb() rt_hw_barrier(dmb, ish)
|
||||
#define rt_hw_wmb() rt_hw_barrier(dmb, ishst)
|
||||
#define rt_hw_rmb() rt_hw_barrier(dmb, ishld)
|
||||
#define rt_hw_dsb() rt_hw_barrier(dsb, ish)
|
||||
|
||||
rt_inline void rt_hw_wmb(void)
|
||||
{
|
||||
__asm__ volatile ("dmb ishst":::"memory");
|
||||
}
|
||||
#define rt_hw_wfi() rt_hw_barrier(wfi)
|
||||
#define rt_hw_wfe() rt_hw_barrier(wfe)
|
||||
#define rt_hw_sev() rt_hw_barrier(sev)
|
||||
|
||||
rt_inline void rt_hw_rmb(void)
|
||||
{
|
||||
__asm__ volatile ("dmb ishld":::"memory");
|
||||
}
|
||||
|
||||
rt_inline void rt_hw_dsb(void)
|
||||
{
|
||||
__asm__ volatile ("dsb ish":::"memory");
|
||||
}
|
||||
#define rt_hw_cpu_relax() rt_hw_barrier(yield)
|
||||
|
||||
void _thread_start(void);
|
||||
#endif /*CPUPORT_H__*/
|
||||
|
||||
@@ -590,6 +590,31 @@ static int _map_single_page_2M(unsigned long *lv0_tbl, unsigned long va,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *rt_ioremap_early(void *paddr, size_t size)
|
||||
{
|
||||
size_t count;
|
||||
static void *tbl = RT_NULL;
|
||||
|
||||
if (!size)
|
||||
{
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
if (!tbl)
|
||||
{
|
||||
tbl = rt_hw_mmu_tbl_get();
|
||||
}
|
||||
|
||||
count = (size + ARCH_SECTION_MASK) >> ARCH_SECTION_SHIFT;
|
||||
|
||||
while (count --> 0)
|
||||
{
|
||||
_map_single_page_2M(tbl, (unsigned long)paddr, (unsigned long)paddr, MMU_MAP_K_DEVICE);
|
||||
}
|
||||
|
||||
return paddr;
|
||||
}
|
||||
|
||||
static int _init_map_2M(unsigned long *lv0_tbl, unsigned long va,
|
||||
unsigned long pa, unsigned long count,
|
||||
unsigned long attr)
|
||||
|
||||
Reference in New Issue
Block a user