cpu8051.h
1 /* 2 * cpu8051.h 3 * 4 * Copyright (C) 1999 Jonathan St-André 5 * Copyright (C) 1999 Hugo Villeneuve <hugo@hugovil.com> 6 * 7 * This file is released under the GPLv2 8 */ 9 10 #ifndef CPU8051_H 11 #define CPU8051_H 1 12 13 #include <stdint.h> 14 15 /* Maximum number of BreakPoints */ 16 #define MAXBP 32 17 18 #define INTERRUPT_0 (0) 19 #define INTERRUPT_1 (1) 20 #define INTERRUPT_2 (2) 21 #define INTERRUPT_3 (3) 22 #define INTERRUPT_4 (4) 23 #define INTERRUPT_5 (5) 24 #define INTERRUPT_MASK(n) (1 << n) 25 26 #define INTERRUPT_PRIORITY_HIGH (1) 27 #define INTERRUPT_PRIORITY_LOW (0) 28 29 struct cpu8051_t { 30 unsigned int pc; /* Program counter */ 31 unsigned long clock; 32 int active_priority; 33 int bp_count; 34 unsigned int bp[MAXBP]; /* List of breakpoints */ 35 }; 36 37 /* Exported variables */ 38 #undef _SCOPE_ 39 #ifdef CPU8051_M 40 # define _SCOPE_ /**/ 41 #else 42 # define _SCOPE_ extern 43 #endif 44 45 _SCOPE_ struct cpu8051_t cpu8051; 46 47 int 48 breakpoint_is_defined(unsigned int address); 49 50 void 51 breakpoints_show(void); 52 53 void 54 breakpoint_set(unsigned int address); 55 56 void 57 breakpoint_clr(unsigned int address); 58 59 void 60 breakpoints_clr_all(void); 61 62 void 63 breakpoint_toggle(unsigned int address); 64 65 void 66 cpu8051_init(void); 67 68 int 69 cpu8051_exec(void); 70 71 int 72 cpu8051_run(int instr_count, int (*interface_stop)(void)); 73 74 void 75 cpu8051_reset(void); 76 77 int 78 cpu8051_disasm_mnemonic(unsigned char opcode, char *buf); 79 80 void 81 cpu8051_disasm_args(unsigned int address, char *buf); 82 83 int 84 cpu8051_disasm(unsigned int address, char *text); 85 86 #endif /* CPU8051_H */