Isaku Yamahata | 3299397 | 2009-07-02 19:32:06 +0900 | [diff] [blame] | 1 | /* |
| 2 | * defines ioport related functions |
| 3 | * |
| 4 | * Copyright (c) 2003 Fabrice Bellard |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | /************************************************************************** |
| 22 | * IO ports API |
| 23 | */ |
| 24 | |
| 25 | #ifndef IOPORT_H |
| 26 | #define IOPORT_H |
| 27 | |
| 28 | #include "qemu-common.h" |
| 29 | |
| 30 | #define MAX_IOPORTS (64 * 1024) |
Isaku Yamahata | d56dd6c | 2009-07-02 19:32:07 +0900 | [diff] [blame^] | 31 | #define IOPORTS_MASK (MAX_IOPORTS - 1) |
Isaku Yamahata | 3299397 | 2009-07-02 19:32:06 +0900 | [diff] [blame] | 32 | |
| 33 | /* These should really be in isa.h, but are here to make pc.h happy. */ |
| 34 | typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data); |
| 35 | typedef uint32_t (IOPortReadFunc)(void *opaque, uint32_t address); |
| 36 | |
| 37 | int register_ioport_read(int start, int length, int size, |
| 38 | IOPortReadFunc *func, void *opaque); |
| 39 | int register_ioport_write(int start, int length, int size, |
| 40 | IOPortWriteFunc *func, void *opaque); |
| 41 | void isa_unassign_ioport(int start, int length); |
| 42 | |
| 43 | |
| 44 | /* NOTE: as these functions may be even used when there is an isa |
| 45 | brige on non x86 targets, we always defined them */ |
| 46 | #if !defined(NO_CPU_IO_DEFS) && defined(NEED_CPU_H) |
| 47 | void cpu_outb(CPUState *env, int addr, int val); |
| 48 | void cpu_outw(CPUState *env, int addr, int val); |
| 49 | void cpu_outl(CPUState *env, int addr, int val); |
| 50 | int cpu_inb(CPUState *env, int addr); |
| 51 | int cpu_inw(CPUState *env, int addr); |
| 52 | int cpu_inl(CPUState *env, int addr); |
| 53 | #endif |
| 54 | |
| 55 | #endif /* IOPORT_H */ |