Statistics
| Branch: | Revision:

root / ioport.h @ 5bc89ef6

History | View | Annotate | Download (2.1 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 32993977 Isaku Yamahata
29 07323531 Isaku Yamahata
typedef uint32_t pio_addr_t;
30 07323531 Isaku Yamahata
#define FMT_pioaddr     PRIx32
31 07323531 Isaku Yamahata
32 32993977 Isaku Yamahata
#define MAX_IOPORTS     (64 * 1024)
33 d56dd6cf Isaku Yamahata
#define IOPORTS_MASK    (MAX_IOPORTS - 1)
34 32993977 Isaku Yamahata
35 32993977 Isaku Yamahata
/* These should really be in isa.h, but are here to make pc.h happy.  */
36 32993977 Isaku Yamahata
typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data);
37 32993977 Isaku Yamahata
typedef uint32_t (IOPortReadFunc)(void *opaque, uint32_t address);
38 32993977 Isaku Yamahata
39 07323531 Isaku Yamahata
int register_ioport_read(pio_addr_t start, int length, int size,
40 32993977 Isaku Yamahata
                         IOPortReadFunc *func, void *opaque);
41 07323531 Isaku Yamahata
int register_ioport_write(pio_addr_t start, int length, int size,
42 32993977 Isaku Yamahata
                          IOPortWriteFunc *func, void *opaque);
43 07323531 Isaku Yamahata
void isa_unassign_ioport(pio_addr_t start, int length);
44 32993977 Isaku Yamahata
45 32993977 Isaku Yamahata
46 32993977 Isaku Yamahata
/* NOTE: as these functions may be even used when there is an isa
47 32993977 Isaku Yamahata
   brige on non x86 targets, we always defined them */
48 32993977 Isaku Yamahata
#if !defined(NO_CPU_IO_DEFS) && defined(NEED_CPU_H)
49 07323531 Isaku Yamahata
void cpu_outb(CPUState *env, pio_addr_t addr, uint8_t val);
50 07323531 Isaku Yamahata
void cpu_outw(CPUState *env, pio_addr_t addr, uint16_t val);
51 07323531 Isaku Yamahata
void cpu_outl(CPUState *env, pio_addr_t addr, uint32_t val);
52 07323531 Isaku Yamahata
uint8_t cpu_inb(CPUState *env, pio_addr_t addr);
53 07323531 Isaku Yamahata
uint16_t cpu_inw(CPUState *env, pio_addr_t addr);
54 07323531 Isaku Yamahata
uint32_t cpu_inl(CPUState *env, pio_addr_t addr);
55 32993977 Isaku Yamahata
#endif
56 32993977 Isaku Yamahata
57 32993977 Isaku Yamahata
#endif /* IOPORT_H */