MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_ioremap_early

Function rt_ioremap_early

libcpu/aarch64/common/mmu.c:702–734  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

700}
701
702void *rt_ioremap_early(void *paddr, size_t size)
703{
704 volatile size_t count;
705 rt_ubase_t base;
706 static void *tbl = RT_NULL;
707
708 if (!size)
709 {
710 return RT_NULL;
711 }
712
713 if (!tbl)
714 {
715 tbl = rt_hw_mmu_tbl_get();
716 }
717
718 /* get the total size required including overhead for alignment */
719 count = (size + ((rt_ubase_t)paddr & ARCH_SECTION_MASK)
720 + ARCH_SECTION_MASK) >> ARCH_SECTION_SHIFT;
721 base = (rt_ubase_t)paddr & (~ARCH_SECTION_MASK);
722
723 while (count --> 0)
724 {
725 if (_map_single_page_2M(tbl, base, base, MMU_MAP_K_DEVICE, RT_TRUE))
726 {
727 return RT_NULL;
728 }
729
730 base += ARCH_SECTION_SIZE;
731 }
732
733 return paddr;
734}
735
736static int _init_map_2M(unsigned long *lv0_tbl, unsigned long va,
737 unsigned long pa, unsigned long count,

Callers 1

rt_hw_common_setupFunction · 0.70

Calls 2

_map_single_page_2MFunction · 0.85
rt_hw_mmu_tbl_getFunction · 0.70

Tested by

no test coverage detected