From 5235e4350447ce9486770bd5486d696dd05fd0a5 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Tue, 21 Jun 2011 13:58:49 +0800 Subject: moved platform specific code from debug_comm to debug_runlooptasks Reimplement debugger message handling code Moved platform specific code from debug_comm.S to debug_runlooptasks.S --- Debugger/debug_comm.S | 111 +++---------------------------------- Debugger/debug_runlooptasks.S | 126 +++++++++++++++++++++++++++++++++++++----- Debugger/debug_stub.h | 8 +-- 3 files changed, 125 insertions(+), 120 deletions(-) diff --git a/Debugger/debug_comm.S b/Debugger/debug_comm.S index 570fedc..ca07420 100644 --- a/Debugger/debug_comm.S +++ b/Debugger/debug_comm.S @@ -13,15 +13,14 @@ * */ - -/* #define __NXOS__ */ /* Defined externally in SConstruct */ - #define __ASSEMBLY__ #include "debug_macros.h" #include "debug_stub.h" #include "debug_internals.h" #include "debug_comm.h" + .extern dbg__sendCommMsg + /* Hexutils function references */ .extern hex2char .extern char2hex @@ -62,10 +61,10 @@ debug_msgTxBuf_AppendPtr: debug_segmentRxNum: /* Current Rx Segment Number */ .word 0x0 -debug_nxtMsgLength: /* NXT Firmware Received Message Length */ +/* Comm Channel and NXT Received Message Length is now common to both NxOS and NXT Firmware */ +debug_nxtMsgLength: .word 0x0 -/* Comm Channel is now common to both NxOS and NXT Firmware */ .global debug_nxtCommChannel debug_nxtCommChannel: .word 0x0 @@ -160,30 +159,17 @@ dbg__comm_init: str r0, [r1, #NXTCOMMCHANNEL_OFFSET] /* Clear NXT Channel on INIT */ ldmfd sp!, {pc} -#ifdef __NXOS__ -_dbg__comm_readbuf_reset: - stmfd sp!, {lr} - ldr r0, =debug_InCommBuf - mov r1, #USB_BUFSIZE - ldr r2, =fantom_init - mov lr, pc - bx r2 -#if 0 - ldr r1, =debug_nxtMsgLength - mov r0, #0 - str r0, [r1] /* Clear NxOS Received Message Length */ -#endif - ldmfd sp!, {pc} -#else + _dbg__comm_readbuf_reset: ldr r1, =debug_nxtMsgLength mov r0, #0 - str r0, [r1] /* Clear NXT Received Message Length */ + str r0, [r1] /* Clear Received Comm Message Length */ bx lr .global dbg__copyNxtDebugMsg /* dbg__copyNxtDebugMsg - * Copy NXT Firmware Debug Message to our own Buffers, indicate Msg Received status. + * Copy NXT Debug Message to our own Buffers, indicate Msg Received status. + * Note: This routine is now used by both NXT Firmware and NxOS * On Entry: * R0: NXT Input Buf Pointer * R1: NXT Communications Channel Enum (CmdBit) @@ -196,12 +182,8 @@ dbg__copyNxtDebugMsg: str r1, [r3, #NXTCOMMCHANNEL_OFFSET] str r2, [r3] ldr r1, =debug_InCommBuf -/* FIXME: We can probably save some cycles and buffer space by using the - * NXT comms buffer specified in R0 directly without copying to internal buffers - */ _dbg_memcpy r1, r0, r2, r3 /* r3: scratch register */ bx lr -#endif /* _dbg_reset_msgTxBuf_AppendPtr * Internal variable to reset pointers. @@ -223,15 +205,8 @@ _dbg_reset_msgTxBuf_AppendPtr: */ _dbg__commHasMsg: stmfd sp!, {lr} -#ifdef __NXOS__ - ldr r2, =nx_usb_fantom_data_read - mov lr,pc - bx r2 /* Number of bytes read in R0 */ - /* Note: The return value in R0 is the Comm Buffer Size, includes NXT Direct Command Header */ -#else ldr r0, =debug_nxtMsgLength ldr r0, [r0] /* R0 contains the Comm Buffer Size, including the NXT Direct Command Header */ -#endif ldr r2, =debug_InCommBuf ldrb r1, [r2, #NXT_MSG_TELEGRAMTYPE_OFFSET] @@ -412,74 +387,6 @@ exit_dbg__getDebugMsg: mov r1, r5 /* Return GDB Message Buffer Pointer in R1 */ ldmfd sp!, {r4,r5,pc} -/* _dbg__sendCommMsg - * Internal send routine (interfaces with drivers). - * On entry: - * R0: Total Message Buffer length - * On exit: - R0: Tx Status (TRUE if data sent) - */ -_dbg__sendCommMsg: - stmfd sp!, {r4, lr} - mov r4, r0 /* Keep Comm Buffer length in R4 */ -#ifdef __NXOS__ - /* Check USB bus status, transmit message if possible */ - bl nx_usb_is_connected /* R0 = TRUE (#1) if USB is ready */ - teq r0, #0 /* FALSE == #0; - We can't check for True condition since values - used by C-Compiler & ARMDEBUG are different */ - beq _dbg__sendCommMsgFailed - - /* Actual transmission (blocking) */ - ldr r0, =debug_OutCommBuf /* data pointer parameter */ - mov r1, r4 /* Comm buffer length */ - bl nx_usb_write - -1: bl nx_usb_data_written /* R0 = True if data has been sent */ - teq r0, #0 /* FALSE == #0; - We can't check for True condition since values - used by C-Compiler & ARMDEBUG are different */ - /* FIXME: implement timeout */ - beq 1b /* Busy Wait Loop */ -#else - ldr r0, =debug_nxtCommChannel - ldr r0, [r0] /* Get Channel Enum */ - teq r0, #BT_CMD_READY - beq _dbg__sendBTMsg - teq r0, #USB_CMD_READY - beq _dbg__sendUSBMsg - b _dbg__sendCommMsgFailed /* Channel Enum Doesn't Match, shouldn't happen? */ - -_dbg__sendBTMsg: - /* NXT BT routines do not have any configuration checks */ - ldr r0, =debug_OutCommBuf /* data pointer parameter */ - mov r1, r4 /* BT Bytes to Send */ - mov r2, r4 /* BT Message Size */ - bl dBtSendMsg /* Send it via Bluetooth (complete message) */ - mov r0, #TRUE /* Always flag Success */ - b _exit_dbg__sendCommMsg - -_dbg__sendUSBMsg: - /* Check USB bus status, transmit message if possible */ - bl dUsbIsConfigured /* R0: UByte status, TRUE / FALSE */ - teq r0, #nxt_UBYTE_TRUE - bne _dbg__sendCommMsgFailed - - /* Actual transmission (blocking) */ - ldr r0, =debug_OutCommBuf /* data pointer parameter */ - mov r1, r4 /* Comm buffer length */ - bl dUsbWrite /* call NXT Firmware USB driver, return 0: done, !0: remaining chars */ - teq r0, #0 /* Tx done if returned length is 0 */ - moveq r0, #TRUE /* Convert NXT firmware return value to our Status (TRUE/FALSE) */ - beq _exit_dbg__sendCommMsg -#endif - -_dbg__sendCommMsgFailed: - mov r0, #FALSE - -_exit_dbg__sendCommMsg: - ldmfd sp!, {r4, pc} - /* _copy_msg_to_commbuf * Internal Comm buffer copy routine, handles segment fragmentation. @@ -518,7 +425,7 @@ _copy_msg_to_commbuf: mov r5, r2 /* Updated Tx Append Pointer, keep in R5 for now */ add r0, r4, #NXT_GDBMSG_START /* Total Comm Buffer Size for Tx (NXT_GDBMSG_START offset = header size) */ - bl _dbg__sendCommMsg /* Common interface routine to commnuncations drivers */ + bl dbg__sendCommMsg /* Common interface routine to commnuncations drivers */ cmp r0, #TRUE ldrne r5, [r6, #TXAPPENDPTR_OFFSET] /* Tx failed, Retrieve Original Tx Append Pointer */ streq r5, [r6, #TXAPPENDPTR_OFFSET] /* Tx succeeded, Update Tx Append Pointer to new position */ diff --git a/Debugger/debug_runlooptasks.S b/Debugger/debug_runlooptasks.S index f00e99d..e081f29 100644 --- a/Debugger/debug_runlooptasks.S +++ b/Debugger/debug_runlooptasks.S @@ -69,6 +69,8 @@ */ #define __ASSEMBLY__ +#define REBOOT_POWERDOWN + #include "debug_internals.h" #include "debug_macros.h" #include "debug_stub.h" @@ -77,6 +79,7 @@ .align 4 .global dbg__runloopTasks .global dbg__reboot + .global dbg__sendCommMsg #ifdef __NXOS__ /**************************************************************************** @@ -138,15 +141,13 @@ dbg__reboot: /* We implement the powerdown sequence for now */ -#if 1 +#ifdef REBOOT_POWERDOWN /* Powerdown sequence */ ldr r0, =((POWERDOWN >> 8) & 0xFF) ldr r1, =dIOCtrlSetPower mov lr,pc bx r1 -#endif - -#if 0 +#else /* Reboot sequence: this forces SAMBA mode??!! */ ldr r0, =((BOOT >> 8) & 0xFF) ldr r1, =dIOCtrlSetPower @@ -168,6 +169,107 @@ _dbg__reboot_wait: #endif +#ifdef __NXOS__ + .extern nx_usb_is_connected + .extern nx_usb_write + .extern nx_usb_data_written +/**************************************************************************** + * + * NxOS Communications Driver Interface Routine + * + ****************************************************************************/ +/* dbg__sendCommMsg + * Internal send routine (interfaces with drivers). + * On entry: + * R0: Total Message Buffer length + * On exit: + R0: Tx Status (TRUE if data sent) + */ +dbg__sendCommMsg: + stmfd sp!, {r4, lr} + mov r4, r0 /* Keep Comm Buffer length in R4 */ + /* Check USB bus status, transmit message if possible */ + bl nx_usb_is_connected /* R0 = TRUE (#1) if USB is ready */ + teq r0, #0 /* FALSE == #0; + We can't check for True condition since values + used by C-Compiler & ARMDEBUG are different */ + beq dbg__sendCommMsgFailed + + /* Actual transmission (blocking) */ + ldr r0, =debug_OutCommBuf /* data pointer parameter */ + mov r1, r4 /* Comm buffer length */ + bl nx_usb_write + +1: bl nx_usb_data_written /* R0 = True if data has been sent */ + teq r0, #0 /* FALSE == #0; + We can't check for True condition since values + used by C-Compiler & ARMDEBUG are different */ + /* FIXME: implement timeout */ + beq 1b /* Busy Wait Loop */ +dbg__sendCommMsgFailed: + mov r0, #FALSE + +exit_dbg__sendCommMsg: + ldmfd sp!, {r4, pc} + + +#else + .extern dBtSendMsg + .extern dUsbIsConfigured + .extern dUsbWrite +/**************************************************************************** + * + * NXT Firmware Communications Driver Interface Routine + * + ****************************************************************************/ +/* dbg__sendCommMsg + * Internal send routine (interfaces with drivers). + * On entry: + * R0: Total Message Buffer length + * On exit: + R0: Tx Status (TRUE if data sent) + */ +dbg__sendCommMsg: + stmfd sp!, {r4, lr} + mov r4, r0 /* Keep Comm Buffer length in R4 */ + ldr r0, =debug_nxtCommChannel + ldr r0, [r0] /* Get Channel Enum */ + teq r0, #BT_CMD_READY + beq dbg__sendBTMsg + teq r0, #USB_CMD_READY + beq dbg__sendUSBMsg + b dbg__sendCommMsgFailed /* Channel Enum Doesn't Match, shouldn't happen? */ + +dbg__sendBTMsg: + /* NXT BT routines do not have any configuration checks */ + ldr r0, =debug_OutCommBuf /* data pointer parameter */ + mov r1, r4 /* BT Bytes to Send */ + mov r2, r4 /* BT Message Size */ + bl dBtSendMsg /* Send it via Bluetooth (complete message) */ + mov r0, #TRUE /* Always flag Success */ + b exit_dbg__sendCommMsg + +dbg__sendUSBMsg: + /* Check USB bus status, transmit message if possible */ + bl dUsbIsConfigured /* R0: UByte status, TRUE / FALSE */ + teq r0, #nxt_UBYTE_TRUE + bne dbg__sendCommMsgFailed + + /* Actual transmission (blocking) */ + ldr r0, =debug_OutCommBuf /* data pointer parameter */ + mov r1, r4 /* Comm buffer length */ + bl dUsbWrite /* call NXT Firmware USB driver, return 0: done, !0: remaining chars */ + teq r0, #0 /* Tx done if returned length is 0 */ + moveq r0, #TRUE /* Convert NXT firmware return value to our Status (TRUE/FALSE) */ + beq exit_dbg__sendCommMsg +dbg__sendCommMsgFailed: + mov r0, #FALSE + +exit_dbg__sendCommMsg: + ldmfd sp!, {r4, pc} +#endif + + #ifdef __NXOS__ /**************************************************************************** * @@ -183,7 +285,7 @@ _dbg__reboot_wait: .global nxos__handleDebug /* nxos__handleDebug * Prepare to switch to Debug Mode - * int nxos__handleDebug(comm_chan_t channel); + * int nxos__handleDebug(U8 *buffer, comm_chan_t channel, U32 length); * * This routine is called from NxOS Fantom library to setup * Single Step Breakpoint in preparation for Debugger invocation if we're in @@ -207,15 +309,11 @@ nxos__handleDebug: * The IRQ Stack Frame Pointer will contains the LR and SPSR from the topmost interrupted task * if it is non-zero (NxOS supports nested IRQs) */ - - ldr r3, =debug_nxtCommChannel - str r0, [r3] /* Keep track of which communications link was used (USB/Bluetooth) */ - - /* Check our current operating mode */ + bl dbg__copyNxtDebugMsg /* Copy to Debugger Message Buffer, Remember Comm Channel */ mov r0, #FALSE /* Setup Default Return value (False) */ - mrs r3, cpsr /* Copy CPSR to r3 */ - and r3, r3, #CPSR_MODE /* Get current mode */ - teq r3, #MODE_ABT /* Are we in Abort (Debug) mode? */ + _dbg_getmode r1 /* Get Debug Mode */ + cmp r1, #(TRUE & BYTE0) /* Confine it to Byte size */ + /* If Debug Mode is TRUE, this means that we're already running the Debugger */ beq exit_nxos__handleDebug /* Yes, return False */ /* Retrieve ISR Return Address */ @@ -271,7 +369,7 @@ exit_nxos__handleDebug: cCommHandleDebug: /* Arg Registers are not preserved since this is invoked explicitly */ push {lr} /* store arg registers */ - bl dbg__copyNxtDebugMsg /* setup Debugger Message Buffers, validate input, CPSR returned in R0 */ + bl dbg__copyNxtDebugMsg /* Copy to Debugger Message Buffer, Remember Comm Channel */ _dbg_getmode r0 /* Get Debug Mode */ cmp r0, #(TRUE & BYTE0) /* Confine it to Byte size */ diff --git a/Debugger/debug_stub.h b/Debugger/debug_stub.h index a4cbdda..11b348e 100644 --- a/Debugger/debug_stub.h +++ b/Debugger/debug_stub.h @@ -71,13 +71,13 @@ ENUM_END(comm_chan_t) * !0 if mode switch will happen * Used by NxOS only */ -FUNCDEF int nxos__handleDebug(comm_chan_t channel); -#endif - -#ifndef __NXOS__ +/* Note: This platform specific routine is found in debug_runlooptasks.S */ +FUNCDEF int nxos__handleDebug(U8 *buffer, comm_chan_t channel, U32 length); +#else /** Switch Mode to Debugger. * Used by NXT Firmware only */ +/* Note: This platform specific routine is found in debug_runlooptasks.S */ FUNCDEF UWORD cCommHandleDebug(UBYTE *pInBuf, UBYTE CmdBit, UWORD MsgLength); #endif -- cgit v1.2.3 From c36e356f2dfde4cbea8effc31f16fcb42e9293d1 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Tue, 21 Jun 2011 14:12:31 +0800 Subject: exported debug_outcommbuf and debug_incommbuf symbols debug_runlooptasks.S need to access some symbols, so export them --- Debugger/debug_comm.S | 2 ++ Debugger/debug_runlooptasks.S | 1 + 2 files changed, 3 insertions(+) diff --git a/Debugger/debug_comm.S b/Debugger/debug_comm.S index ca07420..c605221 100644 --- a/Debugger/debug_comm.S +++ b/Debugger/debug_comm.S @@ -40,6 +40,8 @@ .bss .align 4 + .global debug_InCommBuf + .global debug_OutCommBuf debug_InCommBuf: .space USB_BUFSIZE,0 debug_OutCommBuf: diff --git a/Debugger/debug_runlooptasks.S b/Debugger/debug_runlooptasks.S index e081f29..4115ad6 100644 --- a/Debugger/debug_runlooptasks.S +++ b/Debugger/debug_runlooptasks.S @@ -170,6 +170,7 @@ _dbg__reboot_wait: #ifdef __NXOS__ + .extern debug_OutCommBuf .extern nx_usb_is_connected .extern nx_usb_write .extern nx_usb_data_written -- cgit v1.2.3 From f9b1af8d3ccd6f6b862c483aeb8a4dd577d9c8ba Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Wed, 22 Jun 2011 07:37:33 +0800 Subject: added message overrun protection --- Debugger/debug_comm.S | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Debugger/debug_comm.S b/Debugger/debug_comm.S index c605221..d0ea213 100644 --- a/Debugger/debug_comm.S +++ b/Debugger/debug_comm.S @@ -71,7 +71,12 @@ debug_nxtMsgLength: debug_nxtCommChannel: .word 0x0 + .global debug_nxtCommOverrun +debug_nxtCommOverrun: + .word 0x0 + .equ NXTCOMMCHANNEL_OFFSET, (debug_nxtCommChannel - debug_nxtMsgLength) + .equ NXTCOMMOVERRUN_OFFSET, (debug_nxtCommOverrun - debug_nxtMsgLength) .data .align 4 @@ -181,10 +186,20 @@ _dbg__comm_readbuf_reset: */ dbg__copyNxtDebugMsg: ldr r3, =debug_nxtMsgLength - str r1, [r3, #NXTCOMMCHANNEL_OFFSET] + str r1, [r3, #NXTCOMMCHANNEL_OFFSET] /* save Communications Channel first */ + ldr r1, [r3] /* Check if there's an unread message in the buffer */ + cmp r1, #0 + beq cont_dbg__copyNxtDebugMsg /* No unread message, so continue */ +exit_dbg__NxtDebugMsgOverrun: + ldr r1, [r3, #NXTCOMMOVERRUN_OFFSET] + add r1, r1, #1 + str r1, [r3, #NXTCOMMOVERRUN_OFFSET] /* update message overrun stats */ + b exit_dbg__copyNxtDebugMsg +cont_dbg__copyNxtDebugMsg: str r2, [r3] ldr r1, =debug_InCommBuf _dbg_memcpy r1, r0, r2, r3 /* r3: scratch register */ +exit_dbg__copyNxtDebugMsg: bx lr /* _dbg_reset_msgTxBuf_AppendPtr -- cgit v1.2.3 From abedf371a610485c3de77af2a05e2699627ff358 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Wed, 22 Jun 2011 07:48:01 +0800 Subject: more refactoring, moved platform specific includes to debug_runlooptasks.h --- Debugger/debug_comm.S | 1 - Debugger/debug_comm.h | 53 -------------------------------------- Debugger/debug_runlooptasks.S | 15 +---------- Debugger/debug_runlooptasks.h | 60 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 68 deletions(-) delete mode 100644 Debugger/debug_comm.h create mode 100644 Debugger/debug_runlooptasks.h diff --git a/Debugger/debug_comm.S b/Debugger/debug_comm.S index d0ea213..e237999 100644 --- a/Debugger/debug_comm.S +++ b/Debugger/debug_comm.S @@ -17,7 +17,6 @@ #include "debug_macros.h" #include "debug_stub.h" #include "debug_internals.h" -#include "debug_comm.h" .extern dbg__sendCommMsg diff --git a/Debugger/debug_comm.h b/Debugger/debug_comm.h deleted file mode 100644 index 7553240..0000000 --- a/Debugger/debug_comm.h +++ /dev/null @@ -1,53 +0,0 @@ -/** @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 - .extern dUsbWrite - .extern dUsbRead - .extern dUsbIsConfigured - .extern dBtSendMsg - .equ nxt_UBYTE_TRUE, 1 - .equ nxt_UBYTE_FALSE, 0 - .equ USB_CMD_READY, 0x01 /* From c_comm.iom */ - .equ BT_CMD_READY, 0x02 /* From c_comm.iom */ - -#endif - -#endif diff --git a/Debugger/debug_runlooptasks.S b/Debugger/debug_runlooptasks.S index 4115ad6..75c477c 100644 --- a/Debugger/debug_runlooptasks.S +++ b/Debugger/debug_runlooptasks.S @@ -70,6 +70,7 @@ #define __ASSEMBLY__ #define REBOOT_POWERDOWN +#include "debug_runlooptasks.h" #include "debug_internals.h" #include "debug_macros.h" @@ -97,8 +98,6 @@ dbg__runloopTasks: * NXT Firmware Run Loop * ****************************************************************************/ - .extern cCommCtrl - dbg__runloopTasks: push {lr} /* FIXME: Add necessary cXXXCtrl calls here */ @@ -108,7 +107,6 @@ dbg__runloopTasks: #endif #ifdef __NXOS__ - .extern nx_core_reset /**************************************************************************** * * NxOS Reboot Routine @@ -118,11 +116,6 @@ dbg__runloopTasks: b nx_core_reset /* Reboot Brick, won't return */ #else - .extern dIOCtrlSetPower - .extern dIOCtrlSetPwm - .extern dIOCtrlTransfer - .equ BOOT, 0xA55A - .equ POWERDOWN, 0x5A00 /**************************************************************************** * * NXT Firmware Reboot Routine @@ -171,9 +164,6 @@ _dbg__reboot_wait: #ifdef __NXOS__ .extern debug_OutCommBuf - .extern nx_usb_is_connected - .extern nx_usb_write - .extern nx_usb_data_written /**************************************************************************** * * NxOS Communications Driver Interface Routine @@ -215,9 +205,6 @@ exit_dbg__sendCommMsg: #else - .extern dBtSendMsg - .extern dUsbIsConfigured - .extern dUsbWrite /**************************************************************************** * * NXT Firmware Communications Driver Interface Routine diff --git a/Debugger/debug_runlooptasks.h b/Debugger/debug_runlooptasks.h new file mode 100644 index 0000000..360e0d1 --- /dev/null +++ b/Debugger/debug_runlooptasks.h @@ -0,0 +1,60 @@ +/** @file debug_runlooptasks.h + * @brief Shared C/ASM header file for debugger communications + * + */ + +/* Copyright (C) 2007-2011 the NxOS developers + * + * Module Developed by: TC Wan + * + * See AUTHORS for a full list of the developers. + * + * See COPYING for redistribution license + * + */ + +#ifndef __DEBUG_RUNLOOPTASKS_H__ +#define __DEBUG_RUNLOOPTASKS_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 + .extern nx_core_reset + +#else /* NXT Firmware */ + + .extern cCommInit + .extern cCommCtrl + .extern cCommExit + .extern dUsbWrite + .extern dUsbRead + .extern dUsbIsConfigured + .extern dBtSendMsg + .equ nxt_UBYTE_TRUE, 1 + .equ nxt_UBYTE_FALSE, 0 + .equ USB_CMD_READY, 0x01 /* From c_comm.iom */ + .equ BT_CMD_READY, 0x02 /* From c_comm.iom */ + + .extern dIOCtrlSetPower + .extern dIOCtrlSetPwm + .extern dIOCtrlTransfer + .equ BOOT, 0xA55A /* from c_ioctrl.iom */ + .equ POWERDOWN, 0x5A00 /* from c_ioctrl.iom */ + +#endif + +#endif -- cgit v1.2.3