1
/*
2
* \brief Hardware-resource access
3
* \author Christian Helmuth
4
* \date 2008-10-21
5
*/
6
7
/*
8
* Copyright (C) 2008-2013 Genode Labs GmbH
9
*
10
* This file is part of the Genode OS framework, which is distributed
11
* under the terms of the GNU General Public License version 2.
12
*/
13
14
#
ifndef _INCLUDE__DDE_KIT__RESOURCES_H_
15
#
define _INCLUDE__DDE_KIT__RESOURCES_H_
16
17
#
include <dde_kit/types.h>
18
19
/**
20
* Allocate I/O port range (x86)
21
*
22
* \param start first port of range
23
* \param size size of port range
24
*
25
* \return 0 on success, -1 otherwise
26
*/
27
int
dde_kit_request_io(
dde_kit_addr_t
start
,
dde_kit_size_t
size
,
28
unsigned
short
bar
,
dde_kit_uint8_t
bus
,
29
dde_kit_uint8_t
dev
,
dde_kit_uint8_t
func
)
;
30
31
/**
32
* Free I/O port range (x86)
33
*
34
* \param start first port of range
35
* \param size size of port range
36
*
37
* \return 0 on success, -1 otherwise
38
*/
39
int
dde_kit_release_io(
dde_kit_addr_t
start
,
dde_kit_size_t
size
)
;
40
41
/**
42
* Read I/O port (byte)
43
*
44
* \param port port to read
45
*
46
* \return value read from port
47
*/
48
unsigned
char
dde_kit_inb(
dde_kit_addr_t
port
)
;
49
50
/**
51
* Read I/O port (2-byte)
52
*
53
* \param port port to read
54
*
55
* \return value read from port
56
*/
57
unsigned
short
dde_kit_inw(
dde_kit_addr_t
port
)
;
58
59
/**
60
* Read I/O port (4-byte)
61
*
62
* \param port port to read
63
*
64
* \return value read from port
65
*/
66
unsigned
long
dde_kit_inl(
dde_kit_addr_t
port
)
;
67
68
/**
69
* Write I/O port (byte)
70
*
71
* \param port port to write
72
* \param val value to write
73
*/
74
void
dde_kit_outb(
dde_kit_addr_t
port
,
unsigned
char
val
)
;
75
76
/**
77
* Write I/O port (2-byte)
78
*
79
* \param port port to write
80
* \param val value to write
81
*/
82
void
dde_kit_outw(
dde_kit_addr_t
port
,
unsigned
short
val
)
;
83
84
/**
85
* Write I/O port (4-byte)
86
*
87
* \param port port to write
88
* \param val value to write
89
*/
90
void
dde_kit_outl(
dde_kit_addr_t
port
,
unsigned
long
val
)
;
91
92
/**
93
* Allocate MMIO range
94
*
95
* \param start begin of MMIO range
96
* \param size size of MMIO range
97
* \param wc if !0 request write-combined memory mapping
98
*
99
* \retval vaddr virtual start address mapped range
100
* \return 0 on success, -1 otherwise
101
*/
102
int
dde_kit_request_mem(
dde_kit_addr_t
start
,
dde_kit_size_t
size
,
103
int
wc
,
dde_kit_addr_t *
vaddr
)
;
104
105
/**
106
* Free MMIO range
107
*
108
* \param start begin of MMIO range
109
* \param size size of MMIO range
110
*
111
* \return 0 on success, -1 otherwise
112
*/
113
int
dde_kit_release_mem(
dde_kit_addr_t
start
,
dde_kit_size_t
size
)
;
114
115
#
endif /* _INCLUDE__DDE_KIT__RESOURCES_H_ */