2 * $Id: sh4.h 577 2008-01-01 05:08:38Z nkeynes $
4 * This file defines the public functions and definitions exported by the SH4
7 * Copyright (c) 2005 Nathan Keynes.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
21 #define lxdream_sh4_H 1
32 * SH4 is running normally
34 #define SH4_STATE_RUNNING 1
36 * SH4 is not executing instructions but all peripheral modules are still
39 #define SH4_STATE_SLEEP 2
41 * SH4 is not executing instructions, DMAC is halted, but all other peripheral
42 * modules are still running
44 #define SH4_STATE_DEEP_SLEEP 3
46 * SH4 is not executing instructions and all peripheral modules are also
47 * stopped. As close as you can get to powered-off without actually being
50 #define SH4_STATE_STANDBY 4
53 * sh4r.event_types flag indicating a pending IRQ
58 * sh4r.event_types flag indicating a pending event (from the event queue)
60 #define PENDING_EVENT 2
63 * SH4 register structure
65 struct sh4_registers {
67 uint32_t sr, pr, pc, fpscr;
68 uint32_t t, m, q, s; /* really boolean - 0 or 1 */
73 uint32_t gbr, ssr, spc, sgr, dbr, vbr;
75 uint32_t r_bank[8]; /* hidden banked registers */
76 int32_t store_queue[16]; /* technically 2 banks of 32 bytes */
78 uint32_t new_pc; /* Not a real register, but used to handle delay slots */
79 uint32_t event_pending; /* slice cycle time of the next pending event, or FFFFFFFF
80 when no events are pending */
81 uint32_t event_types; /* bit 0 = IRQ pending, bit 1 = general event pending */
82 int in_delay_slot; /* flag to indicate the current instruction is in
83 * a delay slot (certain rules apply) */
84 uint32_t slice_cycle; /* Current nanosecond within the timeslice */
85 int sh4_state; /* Current power-on state (one of the SH4_STATE_* values ) */
88 extern struct sh4_registers sh4r;
91 * Switch between translation and emulation execution modes. Note that this
92 * should only be used while the system is stopped. If the system was built
93 * without translation support, this method has no effect.
95 * @param use TRUE for translation mode, FALSE for emulation mode.
97 void sh4_set_use_xlat( gboolean use );
100 * Explicitly set the SH4 PC to the supplied value - this will be the next
101 * instruction executed. This should only be called while the system is stopped.
103 void sh4_set_pc( int pc );
106 * Execute (using the emulator) a single instruction (in other words, perform a
107 * single-step operation).
109 gboolean sh4_execute_instruction( void );
111 /* SH4 breakpoints */
112 void sh4_set_breakpoint( uint32_t pc, breakpoint_type_t type );
113 gboolean sh4_clear_breakpoint( uint32_t pc, breakpoint_type_t type );
114 int sh4_get_breakpoint( uint32_t pc );
119 #endif /* !lxdream_sh4_H */
.