2 * Call simulator hook. This is the part running in the
8 #include <arch-v32/hwregs/reg_map.h>
9 #include <arch-v32/hwregs/intr_vect_defs.h>
11 #define HOOK_TRIG_ADDR 0xb7000000 /* hook cvlog model reg address */
12 #define HOOK_MEM_BASE_ADDR 0xa0000000 /* csp4 (shared mem) base addr */
14 #define HOOK_DATA(offset) ((unsigned *)HOOK_MEM_BASE_ADDR)[offset]
15 #define VHOOK_DATA(offset) ((volatile unsigned *)HOOK_MEM_BASE_ADDR)[offset]
16 #define HOOK_TRIG(funcid) \
18 *((unsigned *) HOOK_TRIG_ADDR) = funcid; \
20 #define HOOK_DATA_BYTE(offset) ((unsigned char *)HOOK_MEM_BASE_ADDR)[offset]
22 int hook_call(unsigned id, unsigned pcnt, ...)
34 /* Have to make hook_print_str a special case since we call with a
35 * parameter of byte type. Should perhaps be a separate
38 if (id == hook_print_str) {
45 str = (char *)va_arg(ap, unsigned);
47 for (i = 0; i != pcnt; i++)
48 HOOK_DATA_BYTE(8 + i) = str[i];
50 HOOK_DATA_BYTE(8 + i) = 0; /* null byte */
53 for (i = 1; i <= pcnt; i++)
54 HOOK_DATA(i) = va_arg(ap, unsigned);
58 /* read from mem to make sure data has propagated to memory before
60 ret = *((volatile unsigned *)HOOK_MEM_BASE_ADDR);
65 /* wait for call to finish */
66 while (VHOOK_DATA(0) > 0) ;
68 /* extract return value */
78 unsigned hook_buf(unsigned i)
80 return (HOOK_DATA(i));
83 void print_str(const char *str)
86 /* find null at end of string */
87 for (i = 1; str[i]; i++) ;
88 hook_call(hook_print_str, i, str);
91 void CPU_KICK_DOG(void)
93 (void)hook_call(hook_kick_dog, 0);
96 void CPU_WATCHDOG_TIMEOUT(unsigned t)
98 (void)hook_call(hook_dog_timeout, 1, t);