-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathriscos.c
38 lines (31 loc) · 892 Bytes
/
riscos.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "kernel.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "swis.h"
#include "types.h"
#include "bcm2835.h"
#include "riscos.h"
/* convert a logical address into a physical address */
OSERROR *riscos_log2phys(void *logical, PhysicalAddress *physical)
{
OSERROR *err;
PageBlock page;
page.logical=logical;
if ((err=_swix(OS_Memory,_INR(0,2),0 | OSMEMORY_SUPPLY_LOGICAL_ADDR | OSMEMORY_WANT_PHYSICAL_ADDR,
&page,1)))
return err;
printf("Physical address = %x, logical address = %p\n",page.physical,page.logical);
*physical = page.physical;
return NULL;
}
/* read the logical address of the IO controller */
OSERROR *riscos_readIObase(void **logical)
{
OSERROR *err;
if ((err=_swix(OS_Memory,_INR(0,2)|_OUT(3),13,PHYS_IOBASE,IO_SIZE,
logical)))
return err;
printf("IO base logical address = %p\n",*logical);
return NULL;
}