import RT-Thread@9217865c without bsp, libcpu and components/net
This commit is contained in:
commit
e2376a3709
1414 changed files with 390370 additions and 0 deletions
49
components/vmm/vmm_iomap.c
Normal file
49
components/vmm/vmm_iomap.c
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* VMM IO map table
|
||||
*
|
||||
* COPYRIGHT (C) 2011-2021, Real-Thread Information Technology Ltd
|
||||
* All rights reserved
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2013-06-15 Bernard the first verion
|
||||
*/
|
||||
#include <rtthread.h>
|
||||
#include "vmm.h"
|
||||
|
||||
static struct vmm_iomap _vmm_iomap[RT_VMM_IOMAP_MAXNR];
|
||||
|
||||
void vmm_iomap_init(struct vmm_iomap *iomap)
|
||||
{
|
||||
rt_memcpy(_vmm_iomap, iomap, sizeof(_vmm_iomap));
|
||||
}
|
||||
|
||||
/* find virtual address according to name */
|
||||
unsigned long vmm_find_iomap(const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(_vmm_iomap); i++)
|
||||
{
|
||||
if (rt_strcmp(_vmm_iomap[i].name, name) == 0)
|
||||
return (unsigned long)_vmm_iomap[i].va;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* find virtual address according to physcal address */
|
||||
unsigned long vmm_find_iomap_by_pa(unsigned long pa)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(_vmm_iomap); i++)
|
||||
{
|
||||
if (_vmm_iomap[i].pa == pa)
|
||||
return (unsigned long)_vmm_iomap[i].va;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue