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

Function rt_varea_map_range

components/mm/mm_aspace.c:1374–1402  ·  view source on GitHub ↗

* @note Caller should take care of synchronization of its varea among all the map/unmap operation */

Source from the content-addressed store, hash-verified

1372 * @note Caller should take care of synchronization of its varea among all the map/unmap operation
1373 */
1374int rt_varea_map_range(rt_varea_t varea, void *vaddr, void *paddr, rt_size_t length)
1375{
1376 int err;
1377 if (!varea || !vaddr || !paddr || !length ||
1378 !ALIGNED(vaddr) || !ALIGNED(paddr) || !(ALIGNED(length)))
1379 {
1380 LOG_W("%s(%p,%p,%p,%lx): invalid input", __func__, varea, vaddr, paddr, length);
1381 err = -RT_EINVAL;
1382 }
1383 else if (_not_in_range(MMF_MAP_FIXED, vaddr, length,
1384 varea->start, varea->size))
1385 {
1386 LOG_W("%s(%p,%lx): not in range of varea(%p,%lx)", __func__,
1387 vaddr, length, varea->start, varea->size);
1388 err = -RT_EINVAL;
1389 }
1390 else
1391 {
1392 err = _do_named_map(
1393 varea->aspace,
1394 varea,
1395 vaddr,
1396 length,
1397 MM_PA_TO_OFF(paddr),
1398 varea->attr
1399 );
1400 }
1401 return err;
1402}
1403
1404/**
1405 * @note Caller should take care of synchronization of its varea among all the map/unmap operation

Callers 4

on_shm_page_faultFunction · 0.85
dfs_aspace_mmapFunction · 0.85
test_varea_map_rangeFunction · 0.85
test_varea_unmap_rangeFunction · 0.85

Calls 2

_not_in_rangeFunction · 0.85
_do_named_mapFunction · 0.85

Tested by 2

test_varea_map_rangeFunction · 0.68
test_varea_unmap_rangeFunction · 0.68