From dedac1e444d0def4c124c989ed24ecb3b38c3cdd Mon Sep 17 00:00:00 2001 From: TC Wan Date: Mon, 27 Dec 2010 16:24:35 +0800 Subject: referenced c functions via a dummy header file Use .extern to reference C functions in NxOS or NXT Firmware --- Debugger/debug_comm.S | 12 ++++-------- Debugger/debug_comm.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 Debugger/debug_comm.h (limited to 'Debugger') diff --git a/Debugger/debug_comm.S b/Debugger/debug_comm.S index 872ddc6..1efc836 100644 --- a/Debugger/debug_comm.S +++ b/Debugger/debug_comm.S @@ -14,16 +14,12 @@ */ -#define __NXOS__ /* Temporarily hardcoded in file */ +/* #define __NXOS__ */ /* Defined externally in SConstruct */ #define __ASSEMBLY__ +#include "debug_macros.h" #include "debug_stub.h" - -#ifdef __NXOS__ -#include "usb.h" -#else -#include "c_comm.h" -#endif +#include "debug_comm.h" .bss .align 4 @@ -346,7 +342,7 @@ dbg__comm_init: _dbg__usbbuf_reset: stmfd sp!, {lr} ldr r0, =debug_InUSBBuf - ldr r1, #USB_BUFSIZE + mov r1, #USB_BUFSIZE ldr r2, =nx_usb_read bl r2 ldmfd sp!, {pc} diff --git a/Debugger/debug_comm.h b/Debugger/debug_comm.h new file mode 100644 index 0000000..e5747e3 --- /dev/null +++ b/Debugger/debug_comm.h @@ -0,0 +1,45 @@ +/** @file debug_comm.h + * @brief Shared C/ASM header file for debugger communications + * + */ + +/* Copyright (C) 2007-2010 the NxOS developers + * + * Module Developed by: TC Wan + * + * See AUTHORS for a full list of the developers. + * + * See COPYING for redistribution license + * + */ + +#ifndef __DEBUG_COMM_H__ +#define __DEBUG_COMM_H__ + +#include "_c_arm_macros.h" + +/* This is a place holder header file to allow for interfacing with C Routines in either + * NxOS or NXT Firmware. + * + * Since the header files from the original source trees were meant for C programs, we can't + * include them directly. Here we just use .extern to reference the routines. + */ + +#ifdef __NXOS__ + + .extern nx_usb_is_connected + .extern nx_usb_can_write + .extern nx_usb_write + .extern nx_usb_data_written + .extern nx_usb_read + .extern nx_usb_data_read + +#else /* NXT Firmware */ + + .extern cCommInit + .extern cCommCtrl + .extern cCommExit + +#endif + +#endif -- cgit v1.2.3