skyeye_defs.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #ifndef CORE_ARM_SKYEYE_DEFS_H_
  2. #define CORE_ARM_SKYEYE_DEFS_H_
  3. #include "common.h"
  4. #define MODE32
  5. typedef struct
  6. {
  7. const char *cpu_arch_name; /*cpu architecture version name.e.g. armv4t */
  8. const char *cpu_name; /*cpu name. e.g. arm7tdmi or arm720t */
  9. u32 cpu_val; /*CPU value; also call MMU ID or processor id;see
  10. ARM Architecture Reference Manual B2-6 */
  11. u32 cpu_mask; /*cpu_val's mask. */
  12. u32 cachetype; /*this cpu has what kind of cache */
  13. } cpu_config_t;
  14. typedef struct conf_object_s{
  15. char* objname;
  16. void* obj;
  17. char* class_name;
  18. }conf_object_t;
  19. typedef enum{
  20. /* No exception */
  21. No_exp = 0,
  22. /* Memory allocation exception */
  23. Malloc_exp,
  24. /* File open exception */
  25. File_open_exp,
  26. /* DLL open exception */
  27. Dll_open_exp,
  28. /* Invalid argument exception */
  29. Invarg_exp,
  30. /* Invalid module exception */
  31. Invmod_exp,
  32. /* wrong format exception for config file parsing */
  33. Conf_format_exp,
  34. /* some reference excess the predefiend range. Such as the index out of array range */
  35. Excess_range_exp,
  36. /* Can not find the desirable result */
  37. Not_found_exp,
  38. /* Unknown exception */
  39. Unknown_exp
  40. }exception_t;
  41. typedef enum {
  42. Align = 0,
  43. UnAlign
  44. }align_t;
  45. typedef enum {
  46. Little_endian = 0,
  47. Big_endian
  48. }endian_t;
  49. //typedef int exception_t;
  50. typedef enum{
  51. Phys_addr = 0,
  52. Virt_addr
  53. }addr_type_t;
  54. typedef exception_t(*read_byte_t)(conf_object_t* target, u32 addr, void *buf, size_t count);
  55. typedef exception_t(*write_byte_t)(conf_object_t* target, u32 addr, const void *buf, size_t count);
  56. typedef struct memory_space{
  57. conf_object_t* conf_obj;
  58. read_byte_t read;
  59. write_byte_t write;
  60. }memory_space_intf;
  61. /*
  62. * a running instance for a specific archteciture.
  63. */
  64. typedef struct generic_arch_s
  65. {
  66. char* arch_name;
  67. void (*init) (void);
  68. void (*reset) (void);
  69. void (*step_once) (void);
  70. void (*set_pc)(u32 addr);
  71. u32 (*get_pc)(void);
  72. u32 (*get_step)(void);
  73. //chy 2004-04-15
  74. //int (*ICE_write_byte) (u32 addr, uint8_t v);
  75. //int (*ICE_read_byte)(u32 addr, uint8_t *pv);
  76. u32 (*get_regval_by_id)(int id);
  77. u32 (*get_regnum)(void);
  78. char* (*get_regname_by_id)(int id);
  79. exception_t (*set_regval_by_id)(int id, u32 value);
  80. /*
  81. * read a data by virtual address.
  82. */
  83. exception_t (*mmu_read)(short size, u32 addr, u32 * value);
  84. /*
  85. * write a data by a virtual address.
  86. */
  87. exception_t (*mmu_write)(short size, u32 addr, u32 value);
  88. /**
  89. * get a signal from external
  90. */
  91. //exception_t (*signal)(interrupt_signal_t* signal);
  92. endian_t endianess;
  93. align_t alignment;
  94. } generic_arch_t;
  95. #endif