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

Function lwp_map_user_phy

components/lwp/lwp_user_mm.c:337–384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335}
336
337void *lwp_map_user_phy(struct rt_lwp *lwp, void *map_va, void *map_pa,
338 size_t map_size, int cached)
339{
340 int err;
341 char *va;
342 size_t offset = 0;
343
344 if (!map_size)
345 {
346 return 0;
347 }
348 if (map_va)
349 {
350 if (((size_t)map_va & ARCH_PAGE_MASK) !=
351 ((size_t)map_pa & ARCH_PAGE_MASK))
352 {
353 return 0;
354 }
355 }
356 offset = (size_t)map_pa & ARCH_PAGE_MASK;
357 map_size += (offset + ARCH_PAGE_SIZE - 1);
358 map_size &= ~ARCH_PAGE_MASK;
359 map_pa = (void *)((size_t)map_pa & ~ARCH_PAGE_MASK);
360
361 struct rt_mm_va_hint hint = {.flags = 0,
362 .limit_range_size = lwp->aspace->size,
363 .limit_start = lwp->aspace->start,
364 .prefer = map_va,
365 .map_size = map_size};
366 if (map_va != RT_NULL)
367 hint.flags |= MMF_MAP_FIXED;
368
369 rt_size_t attr = cached ? MMU_MAP_U_RWCB : MMU_MAP_U_RW;
370
371 err =
372 rt_aspace_map_phy(lwp->aspace, &hint, attr, MM_PA_TO_OFF(map_pa), (void **)&va);
373 if (err != RT_EOK)
374 {
375 va = RT_NULL;
376 LOG_W("%s", __func__);
377 }
378 else
379 {
380 va += offset;
381 }
382
383 return va;
384}
385
386rt_base_t lwp_brk(void *addr)
387{

Callers 11

__setup_additional_pagesFunction · 0.85
fb_controlFunction · 0.85
dfs_tmpfs_ioctlFunction · 0.85
dfs_tmpfs_ioctlFunction · 0.85
drv_uart.cFile · 0.85
imx6ull_elcd_controlFunction · 0.85
hdmi_fb_controlFunction · 0.85
drv_mouse_controlFunction · 0.85
rt_lcd_controlFunction · 0.85
fb_controlFunction · 0.85
drv_clcd_controlFunction · 0.85

Calls 1

rt_aspace_map_phyFunction · 0.85

Tested by

no test coverage detected