Statistics
| Branch: | Revision:

root / ioport.h @ a74cdab4

History | View | Annotate | Download (1.9 kB)

1 32993977 Isaku Yamahata
/*
2 32993977 Isaku Yamahata
 * defines ioport related functions
3 32993977 Isaku Yamahata
 *
4 32993977 Isaku Yamahata
 *  Copyright (c) 2003 Fabrice Bellard
5 32993977 Isaku Yamahata
 *
6 32993977 Isaku Yamahata
 * This library is free software; you can redistribute it and/or
7 32993977 Isaku Yamahata
 * modify it under the terms of the GNU Lesser General Public
8 32993977 Isaku Yamahata
 * License as published by the Free Software Foundation; either
9 32993977 Isaku Yamahata
 * version 2 of the License, or (at your option) any later version.
10 32993977 Isaku Yamahata
 *
11 32993977 Isaku Yamahata
 * This library is distributed in the hope that it will be useful,
12 32993977 Isaku Yamahata
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 32993977 Isaku Yamahata
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 32993977 Isaku Yamahata
 * Lesser General Public License for more details.
15 32993977 Isaku Yamahata
 *
16 32993977 Isaku Yamahata
 * You should have received a copy of the GNU Lesser General Public
17 8167ee88 Blue Swirl
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 32993977 Isaku Yamahata
 */
19 32993977 Isaku Yamahata
20 32993977 Isaku Yamahata
/**************************************************************************
21 32993977 Isaku Yamahata
 * IO ports API
22 32993977 Isaku Yamahata
 */
23 32993977 Isaku Yamahata
24 32993977 Isaku Yamahata
#ifndef IOPORT_H
25 32993977 Isaku Yamahata
#define IOPORT_H
26 32993977 Isaku Yamahata
27 32993977 Isaku Yamahata
#include "qemu-common.h"
28 acd1c812 Avi Kivity
#include "iorange.h"
29 32993977 Isaku Yamahata
30 c227f099 Anthony Liguori
typedef uint32_t pio_addr_t;
31 07323531 Isaku Yamahata
#define FMT_pioaddr     PRIx32
32 07323531 Isaku Yamahata
33 32993977 Isaku Yamahata
#define MAX_IOPORTS     (64 * 1024)
34 d56dd6cf Isaku Yamahata
#define IOPORTS_MASK    (MAX_IOPORTS - 1)
35 32993977 Isaku Yamahata
36 32993977 Isaku Yamahata
/* These should really be in isa.h, but are here to make pc.h happy.  */
37 32993977 Isaku Yamahata
typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data);
38 32993977 Isaku Yamahata
typedef uint32_t (IOPortReadFunc)(void *opaque, uint32_t address);
39 32993977 Isaku Yamahata
40 acd1c812 Avi Kivity
void ioport_register(IORange *iorange);
41 c227f099 Anthony Liguori
int register_ioport_read(pio_addr_t start, int length, int size,
42 32993977 Isaku Yamahata
                         IOPortReadFunc *func, void *opaque);
43 c227f099 Anthony Liguori
int register_ioport_write(pio_addr_t start, int length, int size,
44 32993977 Isaku Yamahata
                          IOPortWriteFunc *func, void *opaque);
45 c227f099 Anthony Liguori
void isa_unassign_ioport(pio_addr_t start, int length);
46 32993977 Isaku Yamahata
47 32993977 Isaku Yamahata
48 c227f099 Anthony Liguori
void cpu_outb(pio_addr_t addr, uint8_t val);
49 c227f099 Anthony Liguori
void cpu_outw(pio_addr_t addr, uint16_t val);
50 c227f099 Anthony Liguori
void cpu_outl(pio_addr_t addr, uint32_t val);
51 c227f099 Anthony Liguori
uint8_t cpu_inb(pio_addr_t addr);
52 c227f099 Anthony Liguori
uint16_t cpu_inw(pio_addr_t addr);
53 c227f099 Anthony Liguori
uint32_t cpu_inl(pio_addr_t addr);
54 32993977 Isaku Yamahata
55 32993977 Isaku Yamahata
#endif /* IOPORT_H */