aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorJesper Nilsson <jesper.nilsson@axis.com>2008-01-25 17:28:10 +0100
committerJesper Nilsson <jesper.nilsson@axis.com>2008-02-08 11:06:35 +0100
commita474de0a02ee9093af96414a30f69d433201d002 (patch)
tree69687ead9f26b59b7489e2f6d225bbbc7738414a /arch
parent09160d7cc39ab1015d23428f3995cd49eacfaebf (diff)
CRIS v32: Update vcs_hook.c for ETRAX FS.
- Clean up some formatting and whitespace.
Diffstat (limited to 'arch')
-rw-r--r--arch/cris/arch-v32/mach-fs/vcs_hook.c128
-rw-r--r--arch/cris/arch-v32/mach-fs/vcs_hook.h8
2 files changed, 70 insertions, 66 deletions
diff --git a/arch/cris/arch-v32/mach-fs/vcs_hook.c b/arch/cris/arch-v32/mach-fs/vcs_hook.c
index 64d71c54c22..593b10f07ef 100644
--- a/arch/cris/arch-v32/mach-fs/vcs_hook.c
+++ b/arch/cris/arch-v32/mach-fs/vcs_hook.c
@@ -1,96 +1,100 @@
-// $Id: vcs_hook.c,v 1.2 2003/08/12 12:01:06 starvik Exp $
-//
-// Call simulator hook. This is the part running in the
-// simulated program.
-//
+/*
+ * Call simulator hook. This is the part running in the
+ * simulated program.
+ */
#include "vcs_hook.h"
#include <stdarg.h>
#include <asm/arch-v32/hwregs/reg_map.h>
#include <asm/arch-v32/hwregs/intr_vect_defs.h>
-#define HOOK_TRIG_ADDR 0xb7000000 /* hook cvlog model reg address */
-#define HOOK_MEM_BASE_ADDR 0xa0000000 /* csp4 (shared mem) base addr */
+#define HOOK_TRIG_ADDR 0xb7000000 /* hook cvlog model reg address */
+#define HOOK_MEM_BASE_ADDR 0xa0000000 /* csp4 (shared mem) base addr */
-#define HOOK_DATA(offset) ((unsigned*) HOOK_MEM_BASE_ADDR)[offset]
-#define VHOOK_DATA(offset) ((volatile unsigned*) HOOK_MEM_BASE_ADDR)[offset]
-#define HOOK_TRIG(funcid) do { *((unsigned *) HOOK_TRIG_ADDR) = funcid; } while(0)
-#define HOOK_DATA_BYTE(offset) ((unsigned char*) HOOK_MEM_BASE_ADDR)[offset]
+#define HOOK_DATA(offset) ((unsigned *)HOOK_MEM_BASE_ADDR)[offset]
+#define VHOOK_DATA(offset) ((volatile unsigned *)HOOK_MEM_BASE_ADDR)[offset]
+#define HOOK_TRIG(funcid) \
+ do { \
+ *((unsigned *) HOOK_TRIG_ADDR) = funcid; \
+ } while (0)
+#define HOOK_DATA_BYTE(offset) ((unsigned char *)HOOK_MEM_BASE_ADDR)[offset]
-
-// ------------------------------------------------------------------ hook_call
-int hook_call( unsigned id, unsigned pcnt, ...) {
- va_list ap;
- unsigned i;
- unsigned ret;
+int hook_call(unsigned id, unsigned pcnt, ...)
+{
+ va_list ap;
+ unsigned i;
+ unsigned ret;
#ifdef USING_SOS
- PREEMPT_OFF_SAVE();
+ PREEMPT_OFF_SAVE();
#endif
- // pass parameters
- HOOK_DATA(0) = id;
+ /* pass parameters */
+ HOOK_DATA(0) = id;
- /* Have to make hook_print_str a special case since we call with a
- parameter of byte type. Should perhaps be a separate
- hook_call. */
+ /* Have to make hook_print_str a special case since we call with a
+ * parameter of byte type. Should perhaps be a separate
+ * hook_call. */
- if (id == hook_print_str) {
- int i;
- char *str;
+ if (id == hook_print_str) {
+ int i;
+ char *str;
- HOOK_DATA(1) = pcnt;
+ HOOK_DATA(1) = pcnt;
- va_start(ap, pcnt);
- str = (char*)va_arg(ap,unsigned);
+ va_start(ap, pcnt);
+ str = (char *)va_arg(ap, unsigned);
- for (i=0; i!=pcnt; i++) {
- HOOK_DATA_BYTE(8+i) = str[i];
- }
- HOOK_DATA_BYTE(8+i) = 0; /* null byte */
- }
- else {
- va_start(ap, pcnt);
- for( i = 1; i <= pcnt; i++ ) HOOK_DATA(i) = va_arg(ap,unsigned);
- va_end(ap);
- }
+ for (i = 0; i != pcnt; i++)
+ HOOK_DATA_BYTE(8 + i) = str[i];
- // read from mem to make sure data has propagated to memory before trigging
- *((volatile unsigned*) HOOK_MEM_BASE_ADDR);
+ HOOK_DATA_BYTE(8 + i) = 0; /* null byte */
+ } else {
+ va_start(ap, pcnt);
+ for (i = 1; i <= pcnt; i++)
+ HOOK_DATA(i) = va_arg(ap, unsigned);
+ va_end(ap);
+ }
- // trigger hook
- HOOK_TRIG(id);
+ /* read from mem to make sure data has propagated to memory before
+ * trigging */
+ ret = *((volatile unsigned *)HOOK_MEM_BASE_ADDR);
- // wait for call to finish
- while( VHOOK_DATA(0) > 0 ) {}
+ /* trigger hook */
+ HOOK_TRIG(id);
- // extract return value
+ /* wait for call to finish */
+ while (VHOOK_DATA(0) > 0) ;
- ret = VHOOK_DATA(1);
+ /* extract return value */
+
+ ret = VHOOK_DATA(1);
#ifdef USING_SOS
- PREEMPT_RESTORE();
+ PREEMPT_RESTORE();
#endif
- return ret;
+ return ret;
}
-unsigned
-hook_buf(unsigned i)
+unsigned hook_buf(unsigned i)
{
- return (HOOK_DATA(i));
+ return (HOOK_DATA(i));
}
-void print_str( const char *str ) {
- int i;
- for (i=1; str[i]; i++); /* find null at end of string */
- hook_call(hook_print_str, i, str);
+void print_str(const char *str)
+{
+ int i;
+ /* find null at end of string */
+ for (i = 1; str[i]; i++) ;
+ hook_call(hook_print_str, i, str);
}
-// --------------------------------------------------------------- CPU_KICK_DOG
-void CPU_KICK_DOG(void) {
- (void) hook_call( hook_kick_dog, 0 );
+void CPU_KICK_DOG(void)
+{
+ (void)hook_call(hook_kick_dog, 0);
}
-// ------------------------------------------------------- CPU_WATCHDOG_TIMEOUT
-void CPU_WATCHDOG_TIMEOUT( unsigned t ) {
- (void) hook_call( hook_dog_timeout, 1, t );
+void CPU_WATCHDOG_TIMEOUT(unsigned t)
+{
+ (void)hook_call(hook_dog_timeout, 1, t);
}
+
diff --git a/arch/cris/arch-v32/mach-fs/vcs_hook.h b/arch/cris/arch-v32/mach-fs/vcs_hook.h
index 7d73709e3cc..c000b9fece4 100644
--- a/arch/cris/arch-v32/mach-fs/vcs_hook.h
+++ b/arch/cris/arch-v32/mach-fs/vcs_hook.h
@@ -1,11 +1,11 @@
-// $Id: vcs_hook.h,v 1.1 2003/08/12 12:01:06 starvik Exp $
-//
-// Call simulator hook functions
+/*
+ * Call simulator hook functions
+ */
#ifndef HOOK_H
#define HOOK_H
-int hook_call( unsigned id, unsigned pcnt, ...);
+int hook_call(unsigned id, unsigned pcnt, ...);
enum hook_ids {
hook_debug_on = 1,