From ae52f5280e23e6227dc68a70f03fc7f364040f06 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Fri, 3 Jun 2011 17:55:09 +0800 Subject: updated contents after removing obsolete stuff --- README | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README b/README index 0e5ca38..4660b1e 100644 --- a/README +++ b/README @@ -9,14 +9,8 @@ Contents The various folders contents are as follows: Debugger: GDB client driver for NXT (need to be embedded in firmware code) Host: GDB Server for PC Host -nxt-python-fantom: Local fork of nxt-python to support pyFantom -Obsolete -======== -FantomModule: pyFantom - Python Wrapper for Fantom Driver on Mac OSX (used by nxt-python) [abandoned for now, use pyfantom instead] - - -LICENCES +LICENSES ======== The armdebug code is dual-licensed. Please see COPYING for more details. Other projects included in this repository have their respective licenses. -- cgit v1.2.3 From fe2d495cfa5dbaa5720d5a99f996b6ccd30c2801 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Fri, 3 Jun 2011 17:55:26 +0800 Subject: removed obsolete code --- FantomModule/FantomModule.cpp | 305 ---------- FantomModule/FantomModule.h | 60 -- .../FantomModule.xcodeproj/project.pbxproj | 295 --------- FantomModule/FantomModulePriv.h | 19 - FantomModule/FantomModuleProj.xcconfig | 6 - FantomModule/FantomModuleTarget.xcconfig | 11 - FantomModule/FantomModule_Prefix.pch | 6 - FantomModule/fantom/iFile.h | 280 --------- FantomModule/fantom/iFileIterator.h | 133 ---- FantomModule/fantom/iModule.h | 154 ----- FantomModule/fantom/iModuleIterator.h | 123 ---- FantomModule/fantom/iNXT.h | 666 --------------------- FantomModule/fantom/iNXTIterator.h | 120 ---- FantomModule/fantom/platform.h | 94 --- FantomModule/fantom/tStatus.h | 458 -------------- .../include/labview/macosx/advanceFileIterator.vi | Bin 52507 -> 0 bytes .../labview/macosx/advanceModuleIterator.vi | Bin 49641 -> 0 bytes .../include/labview/macosx/advanceNXTIterator.vi | Bin 49658 -> 0 bytes .../labview/macosx/bluetoothFactoryReset.vi | Bin 44169 -> 0 bytes FantomModule/include/labview/macosx/bootSamba.vi | Bin 30013 -> 0 bytes FantomModule/include/labview/macosx/closeFile.vi | Bin 42973 -> 0 bytes FantomModule/include/labview/macosx/createFile.vi | Bin 53398 -> 0 bytes .../include/labview/macosx/createFileIterator.vi | Bin 59566 -> 0 bytes .../include/labview/macosx/createModule.vi | Bin 60580 -> 0 bytes .../include/labview/macosx/createModuleIterator.vi | Bin 59588 -> 0 bytes FantomModule/include/labview/macosx/createNXT.vi | Bin 77937 -> 0 bytes .../include/labview/macosx/createNXTIterator.vi | Bin 61697 -> 0 bytes FantomModule/include/labview/macosx/destroyFile.vi | Bin 44491 -> 0 bytes .../include/labview/macosx/destroyFileIterator.vi | Bin 44715 -> 0 bytes .../include/labview/macosx/destroyModule.vi | Bin 44733 -> 0 bytes .../labview/macosx/destroyModuleIterator.vi | Bin 44657 -> 0 bytes FantomModule/include/labview/macosx/destroyNXT.vi | Bin 54226 -> 0 bytes .../include/labview/macosx/destroyNXTIterator.vi | Bin 44090 -> 0 bytes .../include/labview/macosx/downloadFirmware.vi | Bin 51788 -> 0 bytes .../include/labview/macosx/eraseUserFlash.vi | Bin 53218 -> 0 bytes .../macosx/findDeviceInFirmwareDownloadMode.vi | Bin 33424 -> 0 bytes FantomModule/include/labview/macosx/findNXT.vi | Bin 57487 -> 0 bytes .../include/labview/macosx/getAvailableSize.vi | Bin 46052 -> 0 bytes .../include/labview/macosx/getDeviceInfo.vi | Bin 77397 -> 0 bytes FantomModule/include/labview/macosx/getFile.vi | Bin 46879 -> 0 bytes FantomModule/include/labview/macosx/getFileName.vi | Bin 57503 -> 0 bytes FantomModule/include/labview/macosx/getFileSize.vi | Bin 49827 -> 0 bytes .../labview/macosx/getFileSizeFromIterator.vi | Bin 46119 -> 0 bytes .../labview/macosx/getFilenameFromIterator.vi | Bin 50359 -> 0 bytes .../include/labview/macosx/getFirmwareVersion.vi | Bin 54438 -> 0 bytes .../include/labview/macosx/getIOMapSize.vi | Bin 47320 -> 0 bytes FantomModule/include/labview/macosx/getModule.vi | Bin 45677 -> 0 bytes FantomModule/include/labview/macosx/getModuleID.vi | Bin 47455 -> 0 bytes .../include/labview/macosx/getModuleName.vi | Bin 51125 -> 0 bytes .../labview/macosx/getModuleNameFromIterator.vi | Bin 50373 -> 0 bytes .../include/labview/macosx/getModuleSize.vi | Bin 47365 -> 0 bytes .../include/labview/macosx/getNXTFromIterator.vi | Bin 45554 -> 0 bytes .../include/labview/macosx/getResourceString.vi | Bin 50629 -> 0 bytes .../labview/macosx/getStringFromNXTIterator.vi | Bin 50832 -> 0 bytes FantomModule/include/labview/macosx/isPaired.vi | Bin 33180 -> 0 bytes FantomModule/include/labview/macosx/nakedRead.vi | Bin 56833 -> 0 bytes FantomModule/include/labview/macosx/nakedWrite.vi | Bin 53942 -> 0 bytes FantomModule/include/labview/macosx/nxt.ctl | Bin 12924 -> 0 bytes FantomModule/include/labview/macosx/openForRead.vi | Bin 46847 -> 0 bytes .../include/labview/macosx/openForWrite.vi | Bin 61344 -> 0 bytes .../include/labview/macosx/pairBluetooth.vi | Bin 37997 -> 0 bytes .../include/labview/macosx/pollAvailableLength.vi | Bin 48927 -> 0 bytes FantomModule/include/labview/macosx/read.vi | Bin 57324 -> 0 bytes .../include/labview/macosx/readBufferData.vi | Bin 60250 -> 0 bytes FantomModule/include/labview/macosx/readIOMap.vi | Bin 56653 -> 0 bytes FantomModule/include/labview/macosx/remove.vi | Bin 46762 -> 0 bytes .../include/labview/macosx/sendDirectCommand.vi | Bin 62289 -> 0 bytes FantomModule/include/labview/macosx/setNXTName.vi | Bin 46126 -> 0 bytes .../include/labview/macosx/unpairBluetooth.vi | Bin 28927 -> 0 bytes FantomModule/include/labview/macosx/write.vi | Bin 53525 -> 0 bytes FantomModule/include/labview/macosx/writeIOMap.vi | Bin 54282 -> 0 bytes .../include/labview/win32/advanceFileIterator.vi | Bin 50807 -> 0 bytes .../include/labview/win32/advanceModuleIterator.vi | Bin 47697 -> 0 bytes .../include/labview/win32/advanceNXTIterator.vi | Bin 47430 -> 0 bytes .../include/labview/win32/bluetoothFactoryReset.vi | Bin 42289 -> 0 bytes FantomModule/include/labview/win32/bootSamba.vi | Bin 28245 -> 0 bytes FantomModule/include/labview/win32/closeFile.vi | Bin 41293 -> 0 bytes FantomModule/include/labview/win32/createFile.vi | Bin 51566 -> 0 bytes .../include/labview/win32/createFileIterator.vi | Bin 57766 -> 0 bytes FantomModule/include/labview/win32/createModule.vi | Bin 58556 -> 0 bytes .../include/labview/win32/createModuleIterator.vi | Bin 57524 -> 0 bytes FantomModule/include/labview/win32/createNXT.vi | Bin 75773 -> 0 bytes .../include/labview/win32/createNXTIterator.vi | Bin 59605 -> 0 bytes FantomModule/include/labview/win32/destroyFile.vi | Bin 42775 -> 0 bytes .../include/labview/win32/destroyFileIterator.vi | Bin 43063 -> 0 bytes .../include/labview/win32/destroyModule.vi | Bin 43017 -> 0 bytes .../include/labview/win32/destroyModuleIterator.vi | Bin 42989 -> 0 bytes FantomModule/include/labview/win32/destroyNXT.vi | Bin 52394 -> 0 bytes .../include/labview/win32/destroyNXTIterator.vi | Bin 42110 -> 0 bytes .../include/labview/win32/downloadFirmware.vi | Bin 49704 -> 0 bytes .../include/labview/win32/eraseUserFlash.vi | Bin 50750 -> 0 bytes .../win32/findDeviceInFirmwareDownloadMode.vi | Bin 31524 -> 0 bytes FantomModule/include/labview/win32/findNXT.vi | Bin 55779 -> 0 bytes .../include/labview/win32/getAvailableSize.vi | Bin 43996 -> 0 bytes .../include/labview/win32/getDeviceInfo.vi | Bin 73869 -> 0 bytes FantomModule/include/labview/win32/getFile.vi | Bin 45059 -> 0 bytes FantomModule/include/labview/win32/getFileName.vi | Bin 55387 -> 0 bytes FantomModule/include/labview/win32/getFileSize.vi | Bin 47899 -> 0 bytes .../labview/win32/getFileSizeFromIterator.vi | Bin 44047 -> 0 bytes .../labview/win32/getFilenameFromIterator.vi | Bin 48447 -> 0 bytes .../include/labview/win32/getFirmwareVersion.vi | Bin 52298 -> 0 bytes FantomModule/include/labview/win32/getIOMapSize.vi | Bin 45256 -> 0 bytes FantomModule/include/labview/win32/getModule.vi | Bin 43873 -> 0 bytes FantomModule/include/labview/win32/getModuleID.vi | Bin 45675 -> 0 bytes .../include/labview/win32/getModuleName.vi | Bin 49113 -> 0 bytes .../labview/win32/getModuleNameFromIterator.vi | Bin 48477 -> 0 bytes .../include/labview/win32/getModuleSize.vi | Bin 45533 -> 0 bytes .../include/labview/win32/getNXTFromIterator.vi | Bin 43762 -> 0 bytes .../include/labview/win32/getResourceString.vi | Bin 48689 -> 0 bytes .../labview/win32/getStringFromNXTIterator.vi | Bin 48664 -> 0 bytes FantomModule/include/labview/win32/isPaired.vi | Bin 31428 -> 0 bytes FantomModule/include/labview/win32/nakedRead.vi | Bin 55097 -> 0 bytes FantomModule/include/labview/win32/nakedWrite.vi | Bin 51866 -> 0 bytes FantomModule/include/labview/win32/nxt.ctl | Bin 12692 -> 0 bytes FantomModule/include/labview/win32/openForRead.vi | Bin 44755 -> 0 bytes FantomModule/include/labview/win32/openForWrite.vi | Bin 58108 -> 0 bytes .../include/labview/win32/pairBluetooth.vi | Bin 35997 -> 0 bytes .../include/labview/win32/pollAvailableLength.vi | Bin 46951 -> 0 bytes FantomModule/include/labview/win32/read.vi | Bin 55444 -> 0 bytes .../include/labview/win32/readBufferData.vi | Bin 58354 -> 0 bytes FantomModule/include/labview/win32/readIOMap.vi | Bin 54409 -> 0 bytes FantomModule/include/labview/win32/remove.vi | Bin 45010 -> 0 bytes .../include/labview/win32/sendDirectCommand.vi | Bin 60249 -> 0 bytes FantomModule/include/labview/win32/setNXTName.vi | Bin 44182 -> 0 bytes .../include/labview/win32/unpairBluetooth.vi | Bin 27139 -> 0 bytes FantomModule/include/labview/win32/write.vi | Bin 51589 -> 0 bytes FantomModule/include/labview/win32/writeIOMap.vi | Bin 52014 -> 0 bytes FantomModule/pyfantom/__init__.py | 0 FantomModule/setup.py | 40 -- FantomModule/visatype.h | 155 ----- 130 files changed, 2925 deletions(-) delete mode 100644 FantomModule/FantomModule.cpp delete mode 100644 FantomModule/FantomModule.h delete mode 100644 FantomModule/FantomModule.xcodeproj/project.pbxproj delete mode 100644 FantomModule/FantomModulePriv.h delete mode 100644 FantomModule/FantomModuleProj.xcconfig delete mode 100644 FantomModule/FantomModuleTarget.xcconfig delete mode 100644 FantomModule/FantomModule_Prefix.pch delete mode 100644 FantomModule/fantom/iFile.h delete mode 100644 FantomModule/fantom/iFileIterator.h delete mode 100644 FantomModule/fantom/iModule.h delete mode 100644 FantomModule/fantom/iModuleIterator.h delete mode 100644 FantomModule/fantom/iNXT.h delete mode 100644 FantomModule/fantom/iNXTIterator.h delete mode 100644 FantomModule/fantom/platform.h delete mode 100644 FantomModule/fantom/tStatus.h delete mode 100644 FantomModule/include/labview/macosx/advanceFileIterator.vi delete mode 100644 FantomModule/include/labview/macosx/advanceModuleIterator.vi delete mode 100644 FantomModule/include/labview/macosx/advanceNXTIterator.vi delete mode 100644 FantomModule/include/labview/macosx/bluetoothFactoryReset.vi delete mode 100644 FantomModule/include/labview/macosx/bootSamba.vi delete mode 100644 FantomModule/include/labview/macosx/closeFile.vi delete mode 100644 FantomModule/include/labview/macosx/createFile.vi delete mode 100644 FantomModule/include/labview/macosx/createFileIterator.vi delete mode 100644 FantomModule/include/labview/macosx/createModule.vi delete mode 100644 FantomModule/include/labview/macosx/createModuleIterator.vi delete mode 100644 FantomModule/include/labview/macosx/createNXT.vi delete mode 100644 FantomModule/include/labview/macosx/createNXTIterator.vi delete mode 100644 FantomModule/include/labview/macosx/destroyFile.vi delete mode 100644 FantomModule/include/labview/macosx/destroyFileIterator.vi delete mode 100644 FantomModule/include/labview/macosx/destroyModule.vi delete mode 100644 FantomModule/include/labview/macosx/destroyModuleIterator.vi delete mode 100644 FantomModule/include/labview/macosx/destroyNXT.vi delete mode 100644 FantomModule/include/labview/macosx/destroyNXTIterator.vi delete mode 100644 FantomModule/include/labview/macosx/downloadFirmware.vi delete mode 100644 FantomModule/include/labview/macosx/eraseUserFlash.vi delete mode 100644 FantomModule/include/labview/macosx/findDeviceInFirmwareDownloadMode.vi delete mode 100644 FantomModule/include/labview/macosx/findNXT.vi delete mode 100644 FantomModule/include/labview/macosx/getAvailableSize.vi delete mode 100644 FantomModule/include/labview/macosx/getDeviceInfo.vi delete mode 100644 FantomModule/include/labview/macosx/getFile.vi delete mode 100644 FantomModule/include/labview/macosx/getFileName.vi delete mode 100644 FantomModule/include/labview/macosx/getFileSize.vi delete mode 100644 FantomModule/include/labview/macosx/getFileSizeFromIterator.vi delete mode 100644 FantomModule/include/labview/macosx/getFilenameFromIterator.vi delete mode 100644 FantomModule/include/labview/macosx/getFirmwareVersion.vi delete mode 100644 FantomModule/include/labview/macosx/getIOMapSize.vi delete mode 100644 FantomModule/include/labview/macosx/getModule.vi delete mode 100644 FantomModule/include/labview/macosx/getModuleID.vi delete mode 100644 FantomModule/include/labview/macosx/getModuleName.vi delete mode 100644 FantomModule/include/labview/macosx/getModuleNameFromIterator.vi delete mode 100644 FantomModule/include/labview/macosx/getModuleSize.vi delete mode 100644 FantomModule/include/labview/macosx/getNXTFromIterator.vi delete mode 100644 FantomModule/include/labview/macosx/getResourceString.vi delete mode 100644 FantomModule/include/labview/macosx/getStringFromNXTIterator.vi delete mode 100644 FantomModule/include/labview/macosx/isPaired.vi delete mode 100644 FantomModule/include/labview/macosx/nakedRead.vi delete mode 100644 FantomModule/include/labview/macosx/nakedWrite.vi delete mode 100644 FantomModule/include/labview/macosx/nxt.ctl delete mode 100644 FantomModule/include/labview/macosx/openForRead.vi delete mode 100644 FantomModule/include/labview/macosx/openForWrite.vi delete mode 100644 FantomModule/include/labview/macosx/pairBluetooth.vi delete mode 100644 FantomModule/include/labview/macosx/pollAvailableLength.vi delete mode 100644 FantomModule/include/labview/macosx/read.vi delete mode 100644 FantomModule/include/labview/macosx/readBufferData.vi delete mode 100644 FantomModule/include/labview/macosx/readIOMap.vi delete mode 100644 FantomModule/include/labview/macosx/remove.vi delete mode 100644 FantomModule/include/labview/macosx/sendDirectCommand.vi delete mode 100644 FantomModule/include/labview/macosx/setNXTName.vi delete mode 100644 FantomModule/include/labview/macosx/unpairBluetooth.vi delete mode 100644 FantomModule/include/labview/macosx/write.vi delete mode 100644 FantomModule/include/labview/macosx/writeIOMap.vi delete mode 100644 FantomModule/include/labview/win32/advanceFileIterator.vi delete mode 100644 FantomModule/include/labview/win32/advanceModuleIterator.vi delete mode 100644 FantomModule/include/labview/win32/advanceNXTIterator.vi delete mode 100644 FantomModule/include/labview/win32/bluetoothFactoryReset.vi delete mode 100644 FantomModule/include/labview/win32/bootSamba.vi delete mode 100644 FantomModule/include/labview/win32/closeFile.vi delete mode 100644 FantomModule/include/labview/win32/createFile.vi delete mode 100644 FantomModule/include/labview/win32/createFileIterator.vi delete mode 100644 FantomModule/include/labview/win32/createModule.vi delete mode 100644 FantomModule/include/labview/win32/createModuleIterator.vi delete mode 100644 FantomModule/include/labview/win32/createNXT.vi delete mode 100644 FantomModule/include/labview/win32/createNXTIterator.vi delete mode 100644 FantomModule/include/labview/win32/destroyFile.vi delete mode 100644 FantomModule/include/labview/win32/destroyFileIterator.vi delete mode 100644 FantomModule/include/labview/win32/destroyModule.vi delete mode 100644 FantomModule/include/labview/win32/destroyModuleIterator.vi delete mode 100644 FantomModule/include/labview/win32/destroyNXT.vi delete mode 100644 FantomModule/include/labview/win32/destroyNXTIterator.vi delete mode 100644 FantomModule/include/labview/win32/downloadFirmware.vi delete mode 100644 FantomModule/include/labview/win32/eraseUserFlash.vi delete mode 100644 FantomModule/include/labview/win32/findDeviceInFirmwareDownloadMode.vi delete mode 100644 FantomModule/include/labview/win32/findNXT.vi delete mode 100644 FantomModule/include/labview/win32/getAvailableSize.vi delete mode 100644 FantomModule/include/labview/win32/getDeviceInfo.vi delete mode 100644 FantomModule/include/labview/win32/getFile.vi delete mode 100644 FantomModule/include/labview/win32/getFileName.vi delete mode 100644 FantomModule/include/labview/win32/getFileSize.vi delete mode 100644 FantomModule/include/labview/win32/getFileSizeFromIterator.vi delete mode 100644 FantomModule/include/labview/win32/getFilenameFromIterator.vi delete mode 100644 FantomModule/include/labview/win32/getFirmwareVersion.vi delete mode 100644 FantomModule/include/labview/win32/getIOMapSize.vi delete mode 100644 FantomModule/include/labview/win32/getModule.vi delete mode 100644 FantomModule/include/labview/win32/getModuleID.vi delete mode 100644 FantomModule/include/labview/win32/getModuleName.vi delete mode 100644 FantomModule/include/labview/win32/getModuleNameFromIterator.vi delete mode 100644 FantomModule/include/labview/win32/getModuleSize.vi delete mode 100644 FantomModule/include/labview/win32/getNXTFromIterator.vi delete mode 100644 FantomModule/include/labview/win32/getResourceString.vi delete mode 100644 FantomModule/include/labview/win32/getStringFromNXTIterator.vi delete mode 100644 FantomModule/include/labview/win32/isPaired.vi delete mode 100644 FantomModule/include/labview/win32/nakedRead.vi delete mode 100644 FantomModule/include/labview/win32/nakedWrite.vi delete mode 100644 FantomModule/include/labview/win32/nxt.ctl delete mode 100644 FantomModule/include/labview/win32/openForRead.vi delete mode 100644 FantomModule/include/labview/win32/openForWrite.vi delete mode 100644 FantomModule/include/labview/win32/pairBluetooth.vi delete mode 100644 FantomModule/include/labview/win32/pollAvailableLength.vi delete mode 100644 FantomModule/include/labview/win32/read.vi delete mode 100644 FantomModule/include/labview/win32/readBufferData.vi delete mode 100644 FantomModule/include/labview/win32/readIOMap.vi delete mode 100644 FantomModule/include/labview/win32/remove.vi delete mode 100644 FantomModule/include/labview/win32/sendDirectCommand.vi delete mode 100644 FantomModule/include/labview/win32/setNXTName.vi delete mode 100644 FantomModule/include/labview/win32/unpairBluetooth.vi delete mode 100644 FantomModule/include/labview/win32/write.vi delete mode 100644 FantomModule/include/labview/win32/writeIOMap.vi delete mode 100644 FantomModule/pyfantom/__init__.py delete mode 100644 FantomModule/setup.py delete mode 100644 FantomModule/visatype.h diff --git a/FantomModule/FantomModule.cpp b/FantomModule/FantomModule.cpp deleted file mode 100644 index b3380f1..0000000 --- a/FantomModule/FantomModule.cpp +++ /dev/null @@ -1,305 +0,0 @@ -/* - * FantomModule.cp - * FantomModule - * - * Created by tcmac on 01/03/2011. - * Copyright 2011 TC Wan. All rights reserved. - * - * Based on code from Fantom Driver 1.0.2f0 Example - * © Copyright 2006, National Instruments Corporation. - * All rights reserved. Originated: 10 March 2006 - * - */ - -#include -#include -#include "FantomModule.h" -#include "FantomModulePriv.h" - -static PyMethodDef FantomMethods[] = { - {"finddevices", fantom_finddevices, METH_VARARGS, - "Discover NXT Devices (BT Discovery)"}, - {"find_bricks", fantom_find_bricks, METH_VARARGS, - "Find and Create NXT Devices (USB)"}, - {"socket", fantom_socket, METH_VARARGS, - "Create a Socket for a NXT Brick"}, - {"connect", fantom_connect, METH_VARARGS, - "Connect the Socket to a NXT Brick"}, - {"send", fantom_send, METH_VARARGS, - "Send Data via the Socket to a NXT Brick"}, - {"recv", fantom_recv, METH_VARARGS, - "Receive Data via the Socket from a NXT Brick"}, - {"close", fantom_close, METH_VARARGS, - "Close the Socket to a NXT Brick"}, - {NULL, NULL, 0, NULL} /* Sentinel */ -}; - -extern "C" PyMODINIT_FUNC -initfantom(void) -{ - (void) Py_InitModule("fantom", FantomMethods); -} - -extern "C" PyObject *fantom_finddevices(PyObject *py_self, PyObject *py_args) -{ - - PyObject *list = FantomModule::finddevices(py_self,py_args); - - return list; // of resource names -} - -extern "C" PyObject *fantom_find_bricks(PyObject *py_self, PyObject *py_args) -{ - - PyObject *list = FantomModule::find_bricks(py_self,py_args); - - return list; // of FantomModule objects -} - -extern "C" PyObject *fantom_socket(PyObject *py_self, PyObject *py_args) -{ - - ViChar newPasskey[FANTOM_PASSKEY_LEN] = FANTOM_NXT_PASSKEY; // Default Passkey - - // FIXME: Retrieve PyObject's proto setting - const char *proto; - if (!PyArg_ParseTuple(py_args, "s", &proto)) - return NULL; - ViBoolean enableBT = strcmp(proto, FANTOM_BT) ? true : false; - - // Get new passkey from Python args if specified - - // Create a FantomModule object, which has not been connected to an actual NXT yet - FantomModule *fantomObject; - fantomObject = new FantomModule; - - fantomObject->socket(enableBT, newPasskey); // Internal object setup - - // FIXME: Convert fantomObject to PyObject and return. - -} - -extern "C" PyObject *fantom_connect(PyObject *py_self, PyObject *py_args) -{ - FantomModule *fantomObject; - // FIXME: Retrieve FantomObject from PyObject variable - ViChar resourceName[FANTOM_NXTNAME_LEN]; - ViBoolean success; - - success = fantomObject->connect(resourceName); -} - -extern "C" PyObject *fantom_send(PyObject *py_self, PyObject *py_args) -{ - FantomModule *fantomObject; - // FIXME: Retrieve FantomObject from PyObject variable - - ViByte bufferPtr[FANTOM_DATA_BUFLEN]; - ViUInt32 numberOfBytes; - ViUInt32 bytesSent; - - bytesSent = fantomObject->send(bufferPtr,numberOfBytes); -} - -extern "C" PyObject *fantom_recv(PyObject *py_self, PyObject *py_args) -{ - FantomModule *fantomObject; - // FIXME: Retrieve FantomObject from PyObject variable - - ViByte bufferPtr[FANTOM_DATA_BUFLEN]; - ViUInt32 numberOfBytes; - ViUInt32 bytesReceived; - - bytesReceived = fantomObject->recv(bufferPtr,numberOfBytes); -} - -extern "C" PyObject *fantom_close(PyObject *py_self, PyObject *py_args) -{ - FantomModule *fantomObject; - // FIXME: Retrieve FantomObject from PyObject variable - - ViBoolean success = fantomObject->close(); - delete fantomObject; - - // Return success/failure -} - - -// Static method called directly from C -PyObject *FantomModule::finddevices(PyObject *py_self, PyObject *py_args) -{ - const char *proto; - if (!PyArg_ParseTuple(py_args, "s", &proto)) - return NULL; - - ViBoolean useBT = strcmp(proto, FANTOM_BT) ? true : false; - - PyObject *list = NULL; - - nFANTOM100::iNXTIterator* nxtIteratorPtr; - nFANTOM100::tStatus status; - - // Create an NXT iterator object which is used to find all accessible NXT devices. - nxtIteratorPtr = nFANTOM100::iNXT::createNXTIterator(useBT, (useBT ? FANTOM_BT_TIMEOUTSEC : 0), status); - - // Creating the NXT iterator object could fail, better check status before dereferencing a - // potentially NULL pointer. - while (status.isNotFatal()) - { - ViChar nxtName[FANTOM_NXTNAME_LEN]; - nxtIteratorPtr->getName(nxtName, status); - - std::cout << "Found: " << nxtName << std::endl; - - if (status.isNotFatal()) - { - // Split nxtName into NXT ID (h) and NXT Name (n) - // return as [(h,n),...] - // FIXME: Append to Python list - /* - return Py_BuildValue("i", sts); - */ - } - nxtIteratorPtr->advance(status); - - } - // Destroy the NXT iterator object which we no longer need - nFANTOM100::iNXT::destroyNXTIterator( nxtIteratorPtr ); - return list; - -} - -// Static method called directly from C -PyObject *FantomModule::find_bricks(PyObject *py_self, PyObject *py_args) -{ - const char *host, *name; - if (!PyArg_ParseTuple(py_args, "ss", &host, &name)) - return NULL; - - ViBoolean useBT = false; - - PyObject *list = NULL; - - - nFANTOM100::iNXTIterator* nxtIteratorPtr; - nFANTOM100::tStatus status; - - // Create an NXT iterator object which is used to find all accessible NXT devices. - nxtIteratorPtr = nFANTOM100::iNXT::createNXTIterator(useBT, (useBT ? FANTOM_BT_TIMEOUTSEC : 0), status); - - // Creating the NXT iterator object could fail, better check status before dereferencing a - // potentially NULL pointer. - while (status.isNotFatal()) - { - ViChar nxtName[FANTOM_NXTNAME_LEN]; - nFANTOM100::iNXT* aNXT = NULL; - - nxtIteratorPtr->getName(nxtName, status); - std::cout << "Found: " << nxtName << std::endl; - aNXT = nxtIteratorPtr->getNXT(status); - if (status.isNotFatal()) - { - FantomModule *aFantomObject = new FantomModule; - aFantomObject->nxtPtr = aNXT; - aFantomObject->status.assign(status); - if (strlcpy(aFantomObject->pairedResourceName, nxtName, FANTOM_NXTNAME_LEN) >= FANTOM_NXTNAME_LEN) - { - // Exceeded Name Length - std::cout << "NXTName Length Exceeded: " << nxtName << std::endl; - delete aFantomObject; - } - else - { - // FIXME: Append to Python list - /* - return Py_BuildValue("i", sts); - */ - } - - } - nxtIteratorPtr->advance(status); - - } - // Destroy the NXT iterator object which we no longer need - nFANTOM100::iNXT::destroyNXTIterator( nxtIteratorPtr ); - return list; - -} - -ViBoolean FantomModule::socket(ViBoolean enableBT, ViConstString BTkey) -{ - // Internal class object setup - nxtPtr = NULL; - useBT = enableBT; - if (strlcpy(passkey, BTkey, FANTOM_PASSKEY_LEN) >= FANTOM_PASSKEY_LEN) - return false; - return true; - -} - -ViBoolean FantomModule::connect(ViConstString resourceName) -{ - // If a NXT is found over BT, the computer and the NXT must be paired before an NXT object can be - // created. This can be done programatically using the iNXT::pairBluetooth method. - // FIXME: Retrieve resource String - - - if (useBT and !nFANTOM100::iNXT::isPaired((ViConstString)resourceName,status)) - nFANTOM100::iNXT::pairBluetooth((ViConstString) resourceName, (ViConstString) passkey, (ViChar *) pairedResourceName, status); - - if (status.isNotFatal()) - { - nxtPtr = nFANTOM100::iNXT::createNXT((ViConstString) resourceName, status, false); - } -} - -ViUInt32 FantomModule::send(const ViByte *bufferPtr, ViUInt32 numberOfBytes) -{ - nFANTOM100::tStatus status; - - return nxtPtr->write(bufferPtr, numberOfBytes, status); -} - -ViUInt32 FantomModule::recv(ViByte *bufferPtr, ViUInt32 numberOfBytes) -{ - nFANTOM100::tStatus status; - - return nxtPtr->read(bufferPtr, numberOfBytes, status); -} - -ViBoolean FantomModule::close() -{ - - const char *proto; - useBT = strcmp(proto, FANTOM_BT) ? true : false; - if (useBT and nFANTOM100::iNXT::isPaired((ViConstString)pairedResourceName,status)) - nFANTOM100::iNXT::unpairBluetooth((ViConstString) pairedResourceName, status); // No Effect on Mac OSX - - if (nxtPtr) - nFANTOM100::iNXT::destroyNXT(nxtPtr); - nxtPtr = NULL; - - return true; -} - -FantomModule::~FantomModule() -{ - if (nxtPtr) - nFANTOM100::iNXT::destroyNXT(nxtPtr); - nxtPtr = NULL; - -} - -// Skeleton functions from Xcode -void FantomModule::HelloWorld(const char * s) -{ - FantomModulePriv *theObj = new FantomModulePriv; - theObj->HelloWorldPriv(s); - delete theObj; -}; - -void FantomModulePriv::HelloWorldPriv(const char * s) -{ - std::cout << s << std::endl; -}; - diff --git a/FantomModule/FantomModule.h b/FantomModule/FantomModule.h deleted file mode 100644 index e2d99cb..0000000 --- a/FantomModule/FantomModule.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * FantomModule.h - * FantomModule - * - * Created by tcmac on 01/03/2011. - * Copyright 2011 __MyCompanyName__. All rights reserved. - * - */ - -#ifndef FantomModule_ -#define FantomModule_ - -#include "Python.h" -#include "fantom/iNXT.h" -#include "fantom/iNXTIterator.h" -#include "fantom/tStatus.h" - -#define FANTOM_BT "BT" -#define FANTOM_USB "USB" -#define FANTOM_BT_TIMEOUTSEC 5 -#define FANTOM_NXTNAME_LEN 256 -#define FANTOM_PASSKEY_LEN 256 -#define FANTOM_DATA_BUFLEN 256 -#define FANTOM_NXT_PASSKEY "1234" - -/* The classes below are exported */ -#pragma GCC visibility push(default) - -extern "C" PyMODINIT_FUNC initfantom(void); - -extern "C" PyObject *fantom_finddevices(PyObject *py_self, PyObject *py_args); // BT Discovery function -extern "C" PyObject *fantom_find_bricks(PyObject *py_self, PyObject *py_args); // USB function -extern "C" PyObject *fantom_socket(PyObject *py_self, PyObject *py_args); -extern "C" PyObject *fantom_connect(PyObject *py_self, PyObject *py_args); -extern "C" PyObject *fantom_send(PyObject *py_self, PyObject *py_args); -extern "C" PyObject *fantom_recv(PyObject *py_self, PyObject *py_args); -extern "C" PyObject *fantom_close(PyObject *py_self, PyObject *py_args); - -class FantomModule -{ - nFANTOM100::iNXT* nxtPtr; - nFANTOM100::tStatus status; - ViBoolean useBT; - ViChar passkey[FANTOM_PASSKEY_LEN]; - ViChar pairedResourceName[FANTOM_NXTNAME_LEN]; - - public: - static PyObject *finddevices(PyObject *py_self, PyObject *py_args); - static PyObject *find_bricks(PyObject *py_self, PyObject *py_args); - ViBoolean socket(ViBoolean enableBT, ViConstString BTkey); - ViBoolean connect(ViConstString resourceName); - ViUInt32 send(const ViByte *bufferPtr, ViUInt32 numberOfBytes); - ViUInt32 recv(ViByte *bufferPtr, ViUInt32 numberOfBytes); - ViBoolean close(); - ~FantomModule(); - void HelloWorld(const char *); -}; - -#pragma GCC visibility pop -#endif diff --git a/FantomModule/FantomModule.xcodeproj/project.pbxproj b/FantomModule/FantomModule.xcodeproj/project.pbxproj deleted file mode 100644 index f4a5ec8..0000000 --- a/FantomModule/FantomModule.xcodeproj/project.pbxproj +++ /dev/null @@ -1,295 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 45; - objects = { - -/* Begin PBXBuildFile section */ - 43B531D2131C92690016BF14 /* Python in Frameworks */ = {isa = PBXBuildFile; fileRef = 43B531D1131C92690016BF14 /* Python */; }; - 43B531F2131C962E0016BF14 /* iFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 43B531EA131C962E0016BF14 /* iFile.h */; }; - 43B531F3131C962E0016BF14 /* iFileIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 43B531EB131C962E0016BF14 /* iFileIterator.h */; }; - 43B531F4131C962E0016BF14 /* iModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 43B531EC131C962E0016BF14 /* iModule.h */; }; - 43B531F5131C962E0016BF14 /* iModuleIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 43B531ED131C962E0016BF14 /* iModuleIterator.h */; }; - 43B531F6131C962E0016BF14 /* iNXT.h in Headers */ = {isa = PBXBuildFile; fileRef = 43B531EE131C962E0016BF14 /* iNXT.h */; }; - 43B531F7131C962E0016BF14 /* iNXTIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 43B531EF131C962E0016BF14 /* iNXTIterator.h */; }; - 43B531F8131C962E0016BF14 /* platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 43B531F0131C962E0016BF14 /* platform.h */; }; - 43B531F9131C962E0016BF14 /* tStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 43B531F1131C962E0016BF14 /* tStatus.h */; }; - 43B531FB131C963A0016BF14 /* visatype.h in Headers */ = {isa = PBXBuildFile; fileRef = 43B531FA131C963A0016BF14 /* visatype.h */; }; - 43B5320A131C975B0016BF14 /* Fantom in Frameworks */ = {isa = PBXBuildFile; fileRef = 43B53209131C975B0016BF14 /* Fantom */; }; - 50149BDA09E781A5002DEE6A /* FantomModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 50149BD909E781A5002DEE6A /* FantomModule.h */; }; - 5073E0CB09E734E500EC74B6 /* FantomModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5073E0C409E734A800EC74B6 /* FantomModule.cpp */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 32BAE0B70371A74B00C91783 /* FantomModule_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FantomModule_Prefix.pch; sourceTree = ""; }; - 43B531D1131C92690016BF14 /* Python */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = Python; path = /System/Library/Frameworks/Python.framework/Python; sourceTree = ""; }; - 43B531EA131C962E0016BF14 /* iFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iFile.h; sourceTree = ""; }; - 43B531EB131C962E0016BF14 /* iFileIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iFileIterator.h; sourceTree = ""; }; - 43B531EC131C962E0016BF14 /* iModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iModule.h; sourceTree = ""; }; - 43B531ED131C962E0016BF14 /* iModuleIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iModuleIterator.h; sourceTree = ""; }; - 43B531EE131C962E0016BF14 /* iNXT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iNXT.h; sourceTree = ""; }; - 43B531EF131C962E0016BF14 /* iNXTIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iNXTIterator.h; sourceTree = ""; }; - 43B531F0131C962E0016BF14 /* platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = platform.h; sourceTree = ""; }; - 43B531F1131C962E0016BF14 /* tStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tStatus.h; sourceTree = ""; }; - 43B531FA131C963A0016BF14 /* visatype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = visatype.h; sourceTree = ""; }; - 43B53209131C975B0016BF14 /* Fantom */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = Fantom; path = /Library/Frameworks/Fantom.framework/Fantom; sourceTree = ""; }; - 43DB2163131CBF18001443AF /* setup.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = setup.py; sourceTree = ""; }; - 50149BD909E781A5002DEE6A /* FantomModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FantomModule.h; sourceTree = ""; }; - 5073E0C409E734A800EC74B6 /* FantomModule.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FantomModule.cpp; sourceTree = ""; }; - 5073E0C609E734A800EC74B6 /* FantomModuleProj.xcconfig */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xcconfig; path = FantomModuleProj.xcconfig; sourceTree = ""; }; - 5073E0C709E734A800EC74B6 /* FantomModuleTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xcconfig; path = FantomModuleTarget.xcconfig; sourceTree = ""; }; - 50B2938909F016FC00694E55 /* FantomModulePriv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FantomModulePriv.h; sourceTree = ""; }; - D2AAC09D05546B4700DB518D /* libFantomModule.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libFantomModule.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - D2AAC09B05546B4700DB518D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 43B531D2131C92690016BF14 /* Python in Frameworks */, - 43B5320A131C975B0016BF14 /* Fantom in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 034768DDFF38A45A11DB9C8B /* Products */ = { - isa = PBXGroup; - children = ( - D2AAC09D05546B4700DB518D /* libFantomModule.dylib */, - ); - name = Products; - sourceTree = ""; - }; - 0867D691FE84028FC02AAC07 /* FantomModule */ = { - isa = PBXGroup; - children = ( - 43B531FA131C963A0016BF14 /* visatype.h */, - 43B531E9131C962E0016BF14 /* fantom */, - 5073E0CA09E734BC00EC74B6 /* Configuration Files */, - 08FB77ACFE841707C02AAC07 /* Source */, - 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, - 034768DDFF38A45A11DB9C8B /* Products */, - 43DB2163131CBF18001443AF /* setup.py */, - ); - name = FantomModule; - sourceTree = ""; - }; - 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { - isa = PBXGroup; - children = ( - 43B53209131C975B0016BF14 /* Fantom */, - 43B531D1131C92690016BF14 /* Python */, - ); - name = "External Frameworks and Libraries"; - sourceTree = ""; - }; - 08FB77ACFE841707C02AAC07 /* Source */ = { - isa = PBXGroup; - children = ( - 32BAE0B70371A74B00C91783 /* FantomModule_Prefix.pch */, - 50149BD909E781A5002DEE6A /* FantomModule.h */, - 50B2938909F016FC00694E55 /* FantomModulePriv.h */, - 5073E0C409E734A800EC74B6 /* FantomModule.cpp */, - ); - name = Source; - sourceTree = ""; - }; - 43B531E9131C962E0016BF14 /* fantom */ = { - isa = PBXGroup; - children = ( - 43B531EA131C962E0016BF14 /* iFile.h */, - 43B531EB131C962E0016BF14 /* iFileIterator.h */, - 43B531EC131C962E0016BF14 /* iModule.h */, - 43B531ED131C962E0016BF14 /* iModuleIterator.h */, - 43B531EE131C962E0016BF14 /* iNXT.h */, - 43B531EF131C962E0016BF14 /* iNXTIterator.h */, - 43B531F0131C962E0016BF14 /* platform.h */, - 43B531F1131C962E0016BF14 /* tStatus.h */, - ); - path = fantom; - sourceTree = ""; - }; - 5073E0CA09E734BC00EC74B6 /* Configuration Files */ = { - isa = PBXGroup; - children = ( - 5073E0C609E734A800EC74B6 /* FantomModuleProj.xcconfig */, - 5073E0C709E734A800EC74B6 /* FantomModuleTarget.xcconfig */, - ); - name = "Configuration Files"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - D2AAC09905546B4700DB518D /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 50149BDA09E781A5002DEE6A /* FantomModule.h in Headers */, - 43B531F2131C962E0016BF14 /* iFile.h in Headers */, - 43B531F3131C962E0016BF14 /* iFileIterator.h in Headers */, - 43B531F4131C962E0016BF14 /* iModule.h in Headers */, - 43B531F5131C962E0016BF14 /* iModuleIterator.h in Headers */, - 43B531F6131C962E0016BF14 /* iNXT.h in Headers */, - 43B531F7131C962E0016BF14 /* iNXTIterator.h in Headers */, - 43B531F8131C962E0016BF14 /* platform.h in Headers */, - 43B531F9131C962E0016BF14 /* tStatus.h in Headers */, - 43B531FB131C963A0016BF14 /* visatype.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - D2AAC09C05546B4700DB518D /* FantomModule */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1DEB916008733D950010E9CD /* Build configuration list for PBXNativeTarget "FantomModule" */; - buildPhases = ( - D2AAC09905546B4700DB518D /* Headers */, - D2AAC09B05546B4700DB518D /* Frameworks */, - D2AAC09A05546B4700DB518D /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = FantomModule; - productName = libFantomModule; - productReference = D2AAC09D05546B4700DB518D /* libFantomModule.dylib */; - productType = "com.apple.product-type.library.dynamic"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 0867D690FE84028FC02AAC07 /* Project object */ = { - isa = PBXProject; - buildConfigurationList = 1DEB916408733D950010E9CD /* Build configuration list for PBXProject "FantomModule" */; - compatibilityVersion = "Xcode 3.1"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 0867D691FE84028FC02AAC07 /* FantomModule */; - productRefGroup = 034768DDFF38A45A11DB9C8B /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - D2AAC09C05546B4700DB518D /* FantomModule */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - D2AAC09A05546B4700DB518D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 5073E0CB09E734E500EC74B6 /* FantomModule.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 1DEB916108733D950010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 5073E0C709E734A800EC74B6 /* FantomModuleTarget.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = FantomModule_Prefix.pch; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/Python.framework\"", - "\"$(LOCAL_LIBRARY_DIR)/Frameworks/Fantom.framework\"", - ); - }; - name = Debug; - }; - 1DEB916208733D950010E9CD /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 5073E0C709E734A800EC74B6 /* FantomModuleTarget.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = FantomModule_Prefix.pch; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/Python.framework\"", - "\"$(LOCAL_LIBRARY_DIR)/Frameworks/Fantom.framework\"", - ); - STRIP_INSTALLED_PRODUCT = YES; - STRIP_STYLE = "non-global"; - }; - name = Release; - }; - 1DEB916508733D950010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 5073E0C609E734A800EC74B6 /* FantomModuleProj.xcconfig */; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = /usr/include/python2.6/; - ONLY_ACTIVE_ARCH = YES; - PREBINDING = NO; - SDKROOT = macosx10.6; - }; - name = Debug; - }; - 1DEB916608733D950010E9CD /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 5073E0C609E734A800EC74B6 /* FantomModuleProj.xcconfig */; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - PREBINDING = NO; - SDKROOT = macosx10.6; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1DEB916008733D950010E9CD /* Build configuration list for PBXNativeTarget "FantomModule" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB916108733D950010E9CD /* Debug */, - 1DEB916208733D950010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 1DEB916408733D950010E9CD /* Build configuration list for PBXProject "FantomModule" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB916508733D950010E9CD /* Debug */, - 1DEB916608733D950010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 0867D690FE84028FC02AAC07 /* Project object */; -} diff --git a/FantomModule/FantomModulePriv.h b/FantomModule/FantomModulePriv.h deleted file mode 100644 index 54e0775..0000000 --- a/FantomModule/FantomModulePriv.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * FantomModulePriv.h - * FantomModule - * - * Created by tcmac on 01/03/2011. - * Copyright 2011 __MyCompanyName__. All rights reserved. - * - */ - -/* The classes below are not exported */ -#pragma GCC visibility push(hidden) - -class FantomModulePriv -{ - public: - void HelloWorldPriv(const char *); -}; - -#pragma GCC visibility pop diff --git a/FantomModule/FantomModuleProj.xcconfig b/FantomModule/FantomModuleProj.xcconfig deleted file mode 100644 index 363b2d1..0000000 --- a/FantomModule/FantomModuleProj.xcconfig +++ /dev/null @@ -1,6 +0,0 @@ - PREBINDING = NO; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - GCC_MODEL_TUNING = G5; - GCC_INCREASE_PRECOMPILED_HEADER_SHARING = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; diff --git a/FantomModule/FantomModuleTarget.xcconfig b/FantomModule/FantomModuleTarget.xcconfig deleted file mode 100644 index 63f1a7e..0000000 --- a/FantomModule/FantomModuleTarget.xcconfig +++ /dev/null @@ -1,11 +0,0 @@ - PRODUCT_NAME = libFantomModule; - INSTALL_PATH = /usr/local/lib; - MACH_O_TYPE = mh_dylib; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = FantomModule_Prefix.pch; - GCC_ENABLE_CPP_EXCEPTIONS = YES; - GCC_ENABLE_CPP_RTTI = YES; - STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = Dynamic; - GCC_SYMBOLS_PRIVATE_EXTERN = YES; diff --git a/FantomModule/FantomModule_Prefix.pch b/FantomModule/FantomModule_Prefix.pch deleted file mode 100644 index 031204e..0000000 --- a/FantomModule/FantomModule_Prefix.pch +++ /dev/null @@ -1,6 +0,0 @@ -// -// Prefix header for all source files of the 'FantomModule' target in the 'FantomModule' project. -// - - -#include diff --git a/FantomModule/fantom/iFile.h b/FantomModule/fantom/iFile.h deleted file mode 100644 index d9884f9..0000000 --- a/FantomModule/fantom/iFile.h +++ /dev/null @@ -1,280 +0,0 @@ -/*! - \file iFile.h - \brief Interface for a file on a LEGO MINDSTORMS NXT. -*/ -/* - © Copyright 2005-2006, - National Instruments Corporation. - All rights reserved. - - File: iFile.h - Originated: 12 May 2005 -*/ - -#ifndef ___fantom_iFile_h___ -#define ___fantom_iFile_h___ - -// includes... - -#ifndef ___fantom_platform_h___ - #include "platform.h" -#endif - -#ifndef ___fantom_tStatus_h___ - #include "tStatus.h" -#endif - - -// defines... - - -namespace nFANTOM100 -{ - // forward declarations... - - // typedefs... - - // classes... - - /*! - \class iFile - \brief Interface to a file on a LEGO MINDSTORMS NXT. - */ - class iFile - { - friend class tNXT; - - // methods - protected: - - //! Destructor - virtual ~iFile() = 0; - - public: - - //! Retrieves the name of this file. - /*! - \param fileName Populated with the name of this file. The file name character array - must be able to accomodate a NULL-terminated, 15.3 formatted module name. That - is, it must have a capacity of 20 bytes. - */ - virtual void getName( ViChar fileName[] ) const = 0; - - //! Retrieves the total size of this file in bytes. - /*! - The returned size is undefined if the specified status is fatal. - - \param status Status chaining object. - \return The total size of this file in bytes. - */ - virtual ViUInt32 getSize( tStatus& status ) = 0; - - //! Retrieves the remaining available size, in bytes, in this file. - /*! - This number is only helpful for data logging files, which can contain variable - amounts of data. - The returned size is undefined if the specified status is fatal. - - \param status Status chaining object. - \return The remaining available size, in bytes, in this file. - */ - virtual ViUInt32 getAvailableSize( tStatus& status ) = 0; - - - //! Opens this file for reading. - /*! - Opens, for reading, the file that corresponds to this object on the associated NXT. - The file is not opened if the specified status is fatal. - - \param status Status chaining object. - */ - virtual void openForRead( tStatus& status ) = 0; - - - //! Open this file for writing. - /*! - Opens, for writing, the file that corresponds to this object on the associated NXT. - If this file doesn't exist on the NXT, it is created. If this file does exist on - the NXT, an error is generated. - The file is not opened if the specified status is fatal. - - \param sizeInBytes Size of the data, in bytes, that will be written to this file. - \param status Status chaining object. - */ - virtual void openForWrite( ViUInt32 sizeInBytes, tStatus& status ) = 0; - - - //! Open this file for linear (contiguous) writing. - /*! - Opens, for linear (contiguous) writing, the file that corresponds to this object on - the associated NXT. If this file doesn't exist on the NXT, it is created. If this - file does exist on the NXT, an error is generated. - The file is not opened if the specified status is fatal. - - \param sizeInBytes Size of the data, in bytes, that will be written to the file. - \param status Status chaining object. - */ - virtual void openForLinearWrite( ViUInt32 sizeInBytes, tStatus& status ) = 0; - - - //! Open this data file for writing. - /*! - Opens, for writing, the data file that corresponds to this object on the associated - NXT. This data file differs from normal files in that a data file can be closed - before the entire file has been written. If this file doesn't exist on the NXT, - it is created. If this file does exist on the NXT, an error is generated. - The file is not opened if the specified status is fatal. - - \param sizeInBytes Size of the data, in bytes, that may be written to the file. - \param status Status chaining object. - */ - virtual void openForDataWrite( ViUInt32 sizeInBytes, tStatus& status ) = 0; - - - //! Open this data file for appending additional data. - /*! - Opens, for appending additional data, the data file that corresponds to this object - on the associated NXT. If this file doesn't exist on the NXT, the behavior is - undefined. If this file does exist on the NXT, the data that is written is - appended to the end of the exiting data. - The file is not opened if the specified status is fatal. - - \param status Status chaining object. - */ - virtual void openForDataAppend( tStatus& status ) = 0; - - - //! Closes this file. - /*! - Closes the file that corresponds to this object on the associated NXT. - The file is not closed if the specified status is fatal. - - \param status Status chaining object. - */ - virtual void close( tStatus& status ) = 0; - - - //! Reads from this file - /*! - Reads the specified number of bytes from this file into the specified buffer. No data - is read if the specified status is fatal. The ownership of the buffer is not - transferred to this file object. - - \param bufferPtr A pointer to the buffer that will be populated with the data that is - read. The capacity of the specified buffer must be at least the specified number - of bytes. - \param numberOfBytes Number of bytes to read. - \param status Status chaining object. - \return The number of bytes actually read from this file. - - \pre This file must have been opened for reading with the iFile::openForRead method. - \post The specified buffer may be deallocated. - */ - virtual ViUInt32 read( ViPBuf bufferPtr, ViUInt32 numberOfBytes, tStatus& status ) = 0; - - - //! Writes to this file - /*! - Writes the specified number of bytes from the specified buffer to this file. No data - is written if the specified status is fatal. The ownership of the buffer is not - transferred to this file object. - - \param bufferPtr A pointer to the buffer that contains the data that will be written. - The capacity of the specified buffer must be at least the specified number of - bytes. - \param numberOfBytes Number of bytes to write to this file. - \param status Status chaining object. - \return The number of bytes actually written to this file. - - \pre This file must have previously been opened for writing. - \post The specified buffer may be deallocated. - */ - virtual ViUInt32 write( const ViByte bufferPtr[], ViUInt32 numberOfBytes, - tStatus& status ) = 0; - - - //! Removes this file - /*! - Removes the file that corresponds to this object on the associated NXT. - The file is not removed if the specified status is fatal. - - \param status Status chaining object. - */ - virtual void remove( tStatus& status ) = 0; - - }; - - - // constants... - const ViUInt8 kProtocolFilenameLength = 19; // 15 basename + 1 dot + 3 extension = 19 - -} // namespace nFANTOM100 - - - // declarations for globally-scoped globals... - - // typedefs... - typedef ViObject nFANTOM100_iFile; - - // prototypes... - extern "C" - { - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_getName( - nFANTOM100_iFile filePtr, - ViChar fileName[], - ViStatus* status ); - - nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iFile_getSize( - nFANTOM100_iFile filePtr, - ViStatus* status ); - - nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iFile_getAvailableSize( - nFANTOM100_iFile filePtr, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_openForRead( - nFANTOM100_iFile filePtr, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_openForWrite( - nFANTOM100_iFile filePtr, - ViUInt32 sizeInBytes, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_openForLinearWrite( - nFANTOM100_iFile filePtr, - ViUInt32 sizeInBytes, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_openForDataWrite( - nFANTOM100_iFile filePtr, - ViUInt32 sizeInBytes, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_openForDataAppend( - nFANTOM100_iFile filePtr, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_close( - nFANTOM100_iFile filePtr, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_read( - nFANTOM100_iFile filePtr, - ViPBuf bufferPtr, - ViUInt32 numberOfBytes, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_write( - nFANTOM100_iFile filePtr, - const ViByte bufferPtr[], - ViUInt32 numberOfBytes, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_remove( - nFANTOM100_iFile filePtr, - ViStatus* status ); - - } - -#endif // ___fantom_iFile_h___ diff --git a/FantomModule/fantom/iFileIterator.h b/FantomModule/fantom/iFileIterator.h deleted file mode 100644 index 5803be8..0000000 --- a/FantomModule/fantom/iFileIterator.h +++ /dev/null @@ -1,133 +0,0 @@ -/*! - \file iFileIterator.h - \brief Interface for an iterator for files on a LEGO MINDSTORMS NXT. -*/ -/* - © Copyright 2005-2006, - National Instruments Corporation. - All rights reserved. - - File: iFileIterator.h - Originated: 12 May 2005 -*/ - -#ifndef ___fantom_iFileIterator_h___ -#define ___fantom_iFileIterator_h___ - - -// includes... - -#ifndef ___fantom_platform_h___ - #include "platform.h" -#endif - -#ifndef ___fantom_iFile_h___ - #include "iFile.h" -#endif - -#ifndef ___fantom_tStatus_h___ - #include "tStatus.h" -#endif - - -// defines... - - -namespace nFANTOM100 -{ - // forward declarations... - - // typedefs... - - // classes... - - /*! - \class iFileIterator - \brief Interface to an iterator for files on a LEGO MINDSTORMS NXT. - */ - class iFileIterator - { - friend class tNXT; - - // methods - protected: - - //! Destructor - virtual ~iFileIterator() = 0; - - public: - - //! Creates a file object for the file referenced by this iterator. - /*! - Creates file object for the file referenced by this iterator. An object is not - created if the specified status is fatal or if this iterator refers to the end of - the list. The returned file object should be destroyed using the - iNXT::destroyFile method. - - \param status Status chaining object. - \return A pointer to the iFile object that was created. - */ - virtual iFile* getFile( tStatus& status ) = 0; - - //! Advances this iterator. - /*! - Advances this iterator to the next file that matches the previously specified file - name pattern. If no more files match, this iterator is advanced to the end of the - list. - The iterator is not advanced if the specified status is fatal. - If this iterator is already at the end of the list, a fatal status will be generated. - - \param status Status chaining object. - */ - virtual void advance( tStatus& status ) = 0; - - //! Retrieves the name of the file to which this iterator refers. - /*! - \param fileName Populated with the name of the file to which this iterator refers. - The file name character array must be able to accomodate a NULL-terminated, 15.3 - formatted file name. This is, it must have a capacity of 20 bytes. - \param status Status chaining object. - */ - virtual void getName( ViChar fileName[], tStatus& status ) = 0; - - //! Retrieves the total size, in bytes, of the file to which this iterator refers. - /*! - \param status Status chaining object. - \return The total size of the file in bytes. - */ - virtual ViUInt32 getSize( tStatus& status ) = 0; - - }; - - - // constants... - -} // namespace nFANTOM100 - - - // declarations for globally-scoped globals... - - // typedefs - typedef ViObject nFANTOM100_iFileIterator; - - extern "C" - { - nFANTOM100_kExport nFANTOM100_iFile _VI_FUNCC nFANTOM100_iFileIterator_getFile( - nFANTOM100_iFileIterator iteratorPtr, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFileIterator_advance( - nFANTOM100_iFileIterator iteratorPtr, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFileIterator_getName( - nFANTOM100_iFileIterator iteratorPtr, - ViChar filename[], - ViStatus* status ); - - nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iFileIterator_getSize( - nFANTOM100_iFileIterator iteratorPtr, - ViStatus* status ); - } - -#endif // ___fantom_iFileIterator_h___ diff --git a/FantomModule/fantom/iModule.h b/FantomModule/fantom/iModule.h deleted file mode 100644 index 1f03849..0000000 --- a/FantomModule/fantom/iModule.h +++ /dev/null @@ -1,154 +0,0 @@ -/*! - \file iModule.h - \brief Interface for a firmware module on a LEGO MINDSTORMS NXT. -*/ -/* - © Copyright 2005-2006, - National Instruments Corporation. - All rights reserved. - - File: iModule.h - Originated: 8 Aug 2005 -*/ - -#ifndef ___fantom_iModule_h___ -#define ___fantom_iModule_h___ - -#ifndef ___fantom_platform_h___ - #include "platform.h" -#endif - -#ifndef ___fantom_tStatus_h___ - #include "tStatus.h" -#endif - - -// defines... - - -namespace nFANTOM100 -{ - - /*! - \class iModule - \brief Interface to a firmware module on a LEGO MINDSTORMS NXT. - */ - class iModule - { - friend class tNXT; - - // methods - protected: - - //! Destructor - virtual ~iModule() = 0; - - public: - - //! Retrieves the name of this module. - /*! - \param moduleName Populated with the name of this module. The module name character - array must be able to accomodate a NULL-terminated, 15.3 formatted module name. - That is, it must have a capacity of 20 bytes. - */ - virtual void getName( ViChar moduleName[] ) const = 0; - - //! Retrieves the internal module ID of this module. - /*! - \return The internal module ID of this module. - */ - virtual ViUInt32 getModuleID( void ) const = 0; - - //! Retrieves the size in bytes of this module. - /*! - \return The size in bytes of this module. - */ - virtual ViUInt32 getModuleSize( void ) const = 0; - - //! Retrieves the size in bytes of the I/O map associated with this module. - /*! - \return The size in bytes of the I/O map associated with this module. - */ - virtual ViUInt32 getModuleIOMapSize( void ) const = 0; - - //! Reads a portion of this module's I/O map. - /*! - Reads the data located at [I/O map address] + [specified offset in bytes] into the - specified data buffer. The read will attempt to copy the specified number of - bytes. No read occurs if the specified status is fatal. The ownership of data - buffer is not transferred to this module object. - - \param offsetInBytes The index of the byte in the I/O map at which to start the read. - \param numberOfBytes The number of bytes that should be read from the I/O map. - \param dataBufferPtr A pointer to the data buffer that will be populated with the - data that is read. The capacity of the specified data buffer must be at least the - specified number of bytes. - \param status Status chaining object. - \return The number of bytes actually read from the I/O map. - - \post The specified data buffer may be deallocated. - */ - virtual ViUInt32 readIOMap( ViUInt32 offsetInBytes, ViUInt32 numberOfBytes, - ViPBuf dataBufferPtr, tStatus& status ) = 0; - - //! Writes a portion of this module's I/O map. - /*! - Writes the specified data into this module's I/O map. The write starts at [I/O map - address] + [specified offset in bytes] and stops after the specified number of - bytes have been written. No write occurs if the specified status is fatal. The - ownership of data buffer is not transferred to this module object. - - \param offsetInBytes The index of the byte in the I/O map at which to start the write. - \param numberOfBytes The number of bytes to write into the I/O map. - \param dataBufferPtr A pointer to the data buffer that contains the data that will be - written. The capacity of the specified data buffer must be at least the specified - number of bytes. - \param status Status chaining object. - \return The number of bytes actually written into the I/O map. - - \post The specified data buffer may be deallocated. - */ - virtual ViUInt32 writeIOMap( ViUInt32 offsetInBytes, ViUInt32 numberOfBytes, - const ViByte dataBufferPtr[], tStatus& status ) = 0; - - }; - -}; // nFANTOM100 - -typedef ViObject nFANTOM100_iModule; - -extern "C" -{ - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iModule_getName( - nFANTOM100_iModule modulePtr, - ViChar moduleName[], - ViStatus* status ); - - nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iModule_getModuleID( - nFANTOM100_iModule modulePtr, - ViStatus* status ); - - nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iModule_getModuleSize( - nFANTOM100_iModule modulePtr, - ViStatus* status ); - - nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iModule_getIOMapSize( - nFANTOM100_iModule modulePtr, - ViStatus* status ); - - nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iModule_readIOMap( - nFANTOM100_iModule modulePtr, - ViUInt32 offset, - ViUInt32 numberBytesToRead, - ViPBuf dataBuffer, - ViStatus* status ); - - nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iModule_writeIOMap( - nFANTOM100_iModule modulePtr, - ViUInt32 offset, - ViUInt32 numberBytesToWrite, - const ViByte dataBuffer[], - ViStatus* status ); -} - -#endif // ___fantom_iModule_h___ diff --git a/FantomModule/fantom/iModuleIterator.h b/FantomModule/fantom/iModuleIterator.h deleted file mode 100644 index 402bf1a..0000000 --- a/FantomModule/fantom/iModuleIterator.h +++ /dev/null @@ -1,123 +0,0 @@ -/*! - \file iModuleIterator.h - \brief Interface for an iterator for firmware modules on a LEGO MINDSTORMS NXT. -*/ -/* - © Copyright 2005-2006, - National Instruments Corporation. - All rights reserved. - - File: iModuleIterator.h - Originated: 8 Aug 2005 -*/ - -#ifndef ___fantom_iModuleIterator_h___ -#define ___fantom_iModuleIterator_h___ - - -// includes... - -#ifndef ___fantom_platform_h___ - #include "platform.h" -#endif - -#ifndef ___fantom_iModule_h___ - #include "iModule.h" -#endif - -#ifndef ___fantom_tStatus_h___ - #include "tStatus.h" -#endif - - -// defines... - - -namespace nFANTOM100 -{ - // forward declarations... - - // typedefs... - - // classes... - - /*! - \class iModuleIterator - \brief Interface to an iterator for firmware modules on a LEGO MINDSTORMS NXT. - */ - class iModuleIterator - { - friend class tNXT; - - // methods - protected: - - //! Destructor - virtual ~iModuleIterator() = 0; - - public: - - //! Creates a module object for the module referenced by this iterator. - /*! - Creates a module object for the module referenced by this iterator. An object is not - created if the specified status is fatal or if this iterator refers to the end of - the list. The returned module object should be destroyed using the - iNXT::destroyModule method. - - \param status Status chaining object. - \return A pointer to the iModule object that was created. - */ - virtual iModule* getModule( tStatus& status ) = 0; - - //! Advances this iterator. - /*! - Advances this iterator to the next module that matches the previously specified - module name pattern. If no more modules match, this iterator is advanced to the - end of the list. - The iterator is not advanced if the specified status is fatal. - If this iterator is already at the end of the list, a fatal status will be generated. - - \param status Status chaining object. - */ - virtual void advance( tStatus& status ) = 0; - - //! Retrieves the name of the module to which this iterator refers. - /*! - \param moduleName Populated with the name of the module to which this iterator - refers. The module name character array must be able to accomodate a - NULL-terminated, 15.3 formatted module name. This is, it must have a capacity of - 20 bytes. - \param status Status chaining object. - */ - virtual void getName( ViChar moduleName[], tStatus& status ) = 0; - - }; - - - // constants... - -} // namespace nFANTOM100 - - - // declarations for globally-scoped globals... - - // typedefs - typedef ViObject nFANTOM100_iModuleIterator; - - extern "C" - { - nFANTOM100_kExport nFANTOM100_iModule _VI_FUNCC nFANTOM100_iModuleIterator_getModule( - nFANTOM100_iModuleIterator iteratorPtr, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iModuleIterator_advance( - nFANTOM100_iModuleIterator iteratorPtr, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iModuleIterator_getName( - nFANTOM100_iModuleIterator iteratorPtr, - ViChar moduleName[], - ViStatus* status ); - } - -#endif // ___fantom_iModuleIterator_h___ diff --git a/FantomModule/fantom/iNXT.h b/FantomModule/fantom/iNXT.h deleted file mode 100644 index ba61db8..0000000 --- a/FantomModule/fantom/iNXT.h +++ /dev/null @@ -1,666 +0,0 @@ -/*! - \file iNXT.h - \brief Interface for a LEGO MINDSTORMS NXT and declaration of its factory. -*/ -/* - © Copyright 2005-2006, - National Instruments Corporation. - All rights reserved. - - File: iNXT.h - Originated: 12 May 2005 -*/ - -#ifndef ___fantom_iNXT_h___ -#define ___fantom_iNXT_h___ - - -// includes... - -#ifndef ___fantom_platform_h___ - #include "platform.h" -#endif - -#ifndef ___fantom_iFile_h___ - #include "iFile.h" -#endif - -#ifndef ___fantom_iFileIterator_h___ - #include "iFileIterator.h" -#endif - -#ifndef ___fantom_iModule_h___ - #include "iModule.h" -#endif - -#ifndef ___fantom_iModuleIterator_h___ - #include "iModuleIterator.h" -#endif - -#ifndef ___fantom_iNXTIterator_h___ - #include "iNXTIterator.h" -#endif - -#ifndef ___fantom_tStatus_h___ - #include "tStatus.h" -#endif - -// defines... - - -namespace nFANTOM100 -{ - // forward declarations... - - // typedefs... - - // classes... - - /*! - \class iNXT - \brief Interface to a LEGO MINDSTORMS NXT. - */ - class iNXT - { - // methods - protected: - - //! Destructor - virtual ~iNXT() = 0; - - public: - - //! Enumeration of buffer types on the NXT - enum tBuffer - { - // The buffer associated with the standard port. - kBufferStandard, - - // The buffer associated with the high-speed port. - kBufferHighSpeed - }; - - //! Creates a file object for the file with the specified name on this NXT. - /*! - Invoking this method does not actually create a file on the NXT. Rather, this method - creates a file object which may be used to open a file on this NXT, for reading or - writing, or may be used to delete a file on the NXT. - A file is not created if the specified status is fatal. - The returned file object should be destroyed using the iNXT::destroyFile method. - - \param fileName Name of the file. The file name must conform to the 15.3 naming - convention and be NULL-terminated. - \param status Status chaining object. - \return A pointer to the iFile object that was created. - */ - virtual iFile* createFile( ViConstString fileName, tStatus& status ) = 0; - - - //! Destroys the specified file object. - /*! - Invoking this method does not actually delete a file on the NXT. Rather, this method - destroys a file object which may have been used to open a file on this NXT for - reading or writing, or may have been used to delete a file on the NXT. - - \param filePtr Pointer to the file object to destroy. - */ - virtual void destroyFile( iFile* filePtr ) = 0; - - - //! Creates an iterator to the files on this NXT. - /*! - The iterator traverses those files on this NXT that match the specified file name - pattern. - The iterator is not created if the specified status is fatal. - The returned file iterator object should be destroyed using the - iNXT::destroyFileIterator method. - - \param fileNamePattern The file name pattern against which to match when iterating - over the files on this NXT. The file name pattern may contain wildcards. The - wildcards may be used in the following manner: *.* (all files on this NXT); - fileBaseName.* (all files on this NXT with the specified base name regardless of - extension); *.fileExtension (all files on this NXT with the specified extension, - regardless of basename); fileBaseName.fileExtension (the file on this NXT with the - specified base name and extension). - \param status Status chaining object. - \return A pointer to the iFileIterator object that was created. - */ - virtual iFileIterator* createFileIterator( ViConstString fileNamePattern, - tStatus& status ) = 0; - - - //! Destroys the specified file iterator. - /*! - \param fileIteratorPtr A pointer to the file iterator to destroy. - */ - virtual void destroyFileIterator( iFileIterator* fileIteratorPtr ) = 0; - - //! Creates a module object for the module with the specified name on this NXT. - /*! - Invoking this method does not actually create a module on the NXT. Rather, this - method creates a module object which may be used to access an I/O map on this NXT. - A module is not created if the specified status is fatal. - The returned module object should be destroyed using the iNXT::destroyModule method. - - \param moduleName The name of the module. The module name must conform to the 15.3 - naming convention and be NULL-terminated. - \param moduleID The NXT-internal ID of the module. - \param moduleSizeInBytes The number of bytes the module occupies. - \param ioMapSizeInBytes The number of bytes the module's I/O map occupies. - \param status Status chaining object. - \return A pointer to the iModule object that was created. - */ - virtual iModule* createModule( ViConstString moduleName, ViUInt32 moduleID, - ViUInt32 moduleSizeInBytes, ViUInt32 ioMapSizeInBytes, tStatus& status ) = 0; - - //! Destroys the specified module object. - /*! - Invoking this method does not actually delete a module on this NXT. Rather, this - method destroys a module object which may have been used to access an I/O map on - this NXT. - - \param modulePtr Pointer to the module object to destroy. - */ - virtual void destroyModule( iModule* modulePtr ) = 0; - - - //! Creates an iterator to the modules on this NXT. - /*! - The iterator traverses those modules on this NXT that match the specified module name - pattern. - The iterator is not created if the specified status is fatal. - The returned module iterator object should be destroyed using the - iNXT::destroyModuleIterator method. - - \param moduleNamePattern The module name pattern against which to match. The module - name pattern may contain wildcards. Since extensions are implicit in the case of - modules, a wildcard may only be used for the module name, as in "*.mod". - \param status Status chaining object. - \return A pointer to an iModuleIterator object that was created. - */ - virtual iModuleIterator* createModuleIterator( ViConstString moduleNamePattern, - tStatus& status ) = 0; - - - //! Destroys the specified module iterator. - /*! - \param moduleIteratorPtr A pointer to the module iterator object to destroy. - */ - virtual void destroyModuleIterator( iModuleIterator* moduleIteratorPtr ) = 0; - - //! Retrieves the firmware version of this NXT. - /*! - Returns the protocol and firmware versions installed on this NXT. - The current version of this driver supports a protocol major version number of 1 and a - firmware major version number of 1. If either of these major version numbers is a - value other than 1, the driver will not attempt to communicate to the NXT. - The returned versions are undefined if the specified status is fatal. - - \param protocolVersionMajorRef Reference to parameter that will be populated with the - major protocol version. - \param protocolVersionMinorRef Reference to parameter that will be populated with the - minor protocol version. - \param firmwareVersionMajorRef Reference to parameter that will be populated with the - major firmware verison. - \param firmwareVersionMinorRef Reference to parameter that will be populated with the - minor firmware verison. - \param status Status chaining object. - */ - virtual void getFirmwareVersion( ViUInt8& protocolVersionMajorRef, - ViUInt8& protocolVersionMinorRef, ViUInt8& firmwareVersionMajorRef, - ViUInt8& firmwareVersionMinorRef, tStatus& status ) = 0; - - - //! Sends the specified direct command to this NXT. - /*! - For more information on direct commands, refer to the LEGO MINDSTORMS NXT Direct - commands document. - The command is not sent if the specified status is fatal. - The command buffer must be non-NULL and the command buffer size in bytes must be - non-zero. - If require response is set to true, the response buffer must be non-NULL and the - response buffer size in bytes must be non-zero. - If require response is set to false, the response buffer must be NULL and the - response buffer size in bytes must be zero. - Both of the buffer size parameters must be small enough to fit in one packet for - whichever bus the NXT is connected over (USB or Bluetooth). This means the - maximum length for a direct command over USB is 63 bytes; over Bluetooth, 65,533 - bytes. - If any of these requirements are violated, VI_ERROR_USER_BUF will be returned. - - \param requireResponse Boolean flag indicating if a response is required. - \param commandBufferPtr Buffer containing the direct command to send to the NXT. - \param commandBufferSizeInBytes Number of bytes in the command buffer. - \param responseBufferPtr Buffer that will be populated with the response to the direct - command. - \param responseBufferSizeInBytes Capacity of the response buffer in bytes. - \param status Status chaining object. - \return Number of bytes written to the response buffer. - */ - virtual ViUInt32 sendDirectCommand( ViBoolean requireResponse, const ViByte commandBufferPtr[], - ViUInt32 commandBufferSizeInBytes, ViPBuf responseBufferPtr, - ViUInt32 responseBufferSizeInBytes, tStatus& status ) = 0; - - //! Downloads firmware to this NXT. - /*! - The NXT must already be in firmware-download mode. - - \param firmwareBufferPtr The buffer containing the new firmware binary image. - \param firmwareBufferSizeInBytes The number of bytes in the new firmware image. - \param status Status chaining object. - */ - virtual void downloadFirmware( const ViByte firmwareBufferPtr[], - ViUInt32 firmwareBufferSizeInBytes, tStatus& status ) = 0; - - - //! Writes, in a generic fashion, to this NXT. - /*! - Writes a command directly to this NXT. In general, this method isn't used and, - instead, the sendDirectCommand and other more specific methods are invoked when - communication to the NXT. - The write doesn not occur if the specified status is fatal. - - \param bufferPtr A pointer to the buffer that contains the command that will be - written. - \param numberOfBytes Size of the buffer. - \param status Status chaining object. - \return The number of bytes actually written to the NXT. - */ - virtual ViUInt32 write( const ViByte bufferPtr[], ViUInt32 numberOfBytes, - tStatus& status ) = 0; - - //! Reads, in a generic fashion, from this NXT. - /*! - Reads a response directly from this NXT. In general, this method isn't used and, - instead, the sendDirectCommand and other more specific methods are invoked when - communication to the NXT. - The command is not sent if the specified status is fatal. - - \param bufferPtr A pointer to the buffer that will be populated with the response. - \param numberOfBytes Number of bytes expected to be read from this NXT. - \param status Status chaining object. - \return The number of bytes actually read from this NXT. - */ - virtual ViUInt32 read ( ViPBuf bufferPtr, ViUInt32 numberOfBytes, tStatus& status ) = 0; - - //! Reboots this NXT into firmware-download mode. - /*! - This is required before invoking the downloadFirmware method. - The reboot does not occur is the specified status is fatal. - - \param status Status chaining object. - */ - virtual void bootIntoFirmwareDownloadMode( tStatus& status ) = 0; - - //! Sets the name of this NXT. - /*! - The specified name will be displayed on the NXT, show up during Bluetooth scans, and - returned when the getDeviceInfo method is called. - - \param newName The name for the NXT. The name can be at most 15 characters. However, - the NXT can only display 8 characters. The string must be NULL terminated. - \param status Status chaining object. - */ - virtual void setName( ViConstString newName, tStatus& status ) = 0; - - //! Retrieves basic information about this NXT. - /*! - Retrieves the name of this NXT, its Bluetooth address, the Bluetooth signal strength, - and the number of bytes available. - Information retrieval is not done if specified status is fatal. - - \param name Populated with the name of this NXT. The name character array must be - able to accomodate a NULL-terminated 15 character name. That is, it must have a - capacity of 16 bytes. - \param bluetoothAddress Populated with this NXT's Bluetooth address. The bluetooth - address array must have a capacity of six bytes. - \param signalStrength Populated with strength of the signal for this NXT's four - Bluetooth conenctions. The signal strength array must have a capacity of four - bytes. - \param availableFlash Populated with the amount of memory in bytes that is not - occupied by firmware or user files. - \param status Status chaining object. - */ - virtual void getDeviceInfo( ViChar name[], ViByte bluetoothAddress[], - ViUInt8 signalStrength[], ViUInt32 &availableFlash, tStatus& status ) = 0; - - //! Erases all files from this NXT, leaving only the firmware. - /*! - All programs, sounds, and data logs are erased. - The erasure does not occur if specified status is fatal. - - \param status Status chaining object. - */ - virtual void eraseUserFlash( tStatus& status ) = 0; - - //! Polls the data buffer on this NXT for the number of bytes available to be read. - /* - The data buffer is not polled if the specified status is fatal. - - \param bufferSelector The buffer from which to read. - \param status Status chaining object. - \return The number of bytes in the buffer available to be read. - */ - virtual ViUInt32 pollAvailableLength( tBuffer bufferSelector, tStatus& status ) = 0; - - //! Reads data from the data buffer on this NXT. - /*! - Data is not read if the specified status is fatal. - - \param dataBuffer Populated with the data that is read from the specified buffer. - \param bufferSelector The buffer from which to read. - \param numberOfBytesToRead The number of bytes to read from the data buffer. - \param status Status chaining object. - \return The number of bytes actually read from the data buffer. - */ - virtual ViUInt32 readBufferData( ViPBuf dataBuffer, tBuffer bufferSelector, - ViUInt32 numberOfBytesToRead, tStatus& status ) = 0; - - //! Retrieves the resource string for this NXT's session. - /* - An example resource string could look like the one of the following: - BTH::LEGOBrick::00:16:53:04:05:06::5 - BTH::LEGOBrick::00:16:53:04:05:06::1 - BTH::Brick2::00:16:53:44:FF:66 - USB0::0x0694::0x0002::0016535127BA::RAW - - \param resourceString Populated with the resource string. The resource string must - have a capacity of 256 bytes. - \param status Status chaining object. - */ - virtual void getResourceString( ViChar resourceString[], tStatus& status ) = 0; - - //! Resets the Bluetooth module on this NXT to its factory settings. - /* - \param status Status chaining object. - */ - virtual void bluetoothFactoryReset( tStatus& status ) = 0; - - //! Creates an NXT object - /*! - Creates an NXT object representing the specified NXT. - The NXT object is not created if the specified status is fatal. - The returned NXT object should be destroyed using the iNXT::destroyNXT method. - - \param resourceString A string identifying which resource should be opened. A list - of possible strings can be obtained using an iNXTIterator (refer to the - createNXTIterator method). - \param status Status chaining object. - \param checkFirmwareVersion A boolean flag that specifies whether version validation - should occur (defaults to true). - \return A pointer to the iNXT object that was created. - */ - nFANTOM100_kExport static iNXT* _VI_FUNCC createNXT( ViConstString resourceString, - tStatus& status, ViBoolean checkFirmwareVersion = true ); - - //! Destroys an NXT object - /*! - \param nxtPtr A pointer to the NXT object to destroy; may be NULL - */ - nFANTOM100_kExport static void _VI_FUNCC destroyNXT( iNXT* nxtPtr ); - - //! Creates an NXT iterator. - /*! - The NXT iterator can be used to find all NXTs that are connected (USB) or in range - (Bluetooth). - The NXT iterator is not created if the specified status is fatal. - The returned NXT iterator object should be destroyed using the - iNXT::destroyNXTIterator method. - - \param searchBluetooth A boolean flag that specifies if the iterator should traverse - NXTs via Bluetooth. - \param bluetoothSearchTimeoutInSeconds The minimum number of seconds that should be - spent waiting for Bluetooth devices to respond. - \param status Status chaining object. - \return A pointer to the iNXTIterator object that was created. - */ - nFANTOM100_kExport static iNXTIterator* _VI_FUNCC createNXTIterator( - ViBoolean searchBluetooth, ViUInt32 bluetoothSearchTimeoutInSeconds, - tStatus& status ); - - //! Destroys an NXT iterator object. - /* - \param iterPtr A pointer to the iNXTIterator object to destroy. - */ - nFANTOM100_kExport static void _VI_FUNCC destroyNXTIterator( iNXTIterator* iterPtr ); - - //! Pairs with an NXT via Bluetooth. - /*! - Programmatically pairs the specified NXT to this computer and, on Windows, creates a - virtual serial port to use for communication with that NXT. However, clients - should not depend on the creation of this virtual serial port. - The pairing is not done if the specified status is fatal. - - \param resourceName The resource string that specifies the NXT with which to pair. - \param passkey A string containing the passkey the computer should exchange with the - device. The passkey cannot be longer than 15 characters and must be - NULL-terminated. - \param pairedResourceName A Bluetooth resource string representing the paired device. - On Windows, the specified resourceName is suffixed with the COM port; On Mac OS X, - the RFCOMM channel identifier. The resource string must have a capacity of 256 - bytes. - \param status Status chaining object. - */ - nFANTOM100_kExport static void _VI_FUNCC pairBluetooth( ViConstString resourceName, - ViConstString passkey, ViChar pairedResourceName[], tStatus& status ); - - //! Unpairs with an NXT via Bluetooth. - /*! - Programmatically destroys the Bluetooth pairing that was previously established - between this computer and the specified NXT. On Mac OS X, this method has no - effect and doesn't generate a fatal status. - The unpairing is not done if the specified status is fatal. - - \param resourceName The resource string that specifies the NXT with which to unpair. - \param status Status chaining object. - */ - nFANTOM100_kExport static void _VI_FUNCC unpairBluetooth( ViConstString resourceName, - tStatus& status ); - - //! Determines if the NXT associated with the specified resource string is paired. - /*! - The determination is not done if the specified status is fatal. - - \param resourceName A resource string that specifies the NXT for which to check its - pairing status. - \param status Status chaining object. - \return VI_TRUE if the NXT is paired with this computer (or if it is connected via - USB); VI_FALSE otherwise. - */ - nFANTOM100_kExport static ViBoolean _VI_FUNCC isPaired( ViConstString resourceName, - tStatus& status ); - - //! Finds the NXT that is currently in firmware-download mode. - /*! - Note that only a single NXT may be in firmware-download mode at a time. - - \param resourceName Populated with the resource string. The resource string must - have a capacity of 256 bytes. - \param status Status chaining object. - */ - nFANTOM100_kExport static void findDeviceInFirmwareDownloadMode( ViChar resourceName[], - tStatus& status ); - - - private: - - }; - - // constants... - -} // namespace nFANTOM100 - - - // declarations for globally-scoped globals... - - // typedefs... - typedef ViObject nFANTOM100_iNXT; - - // prototypes... - extern "C" - { - - nFANTOM100_kExport nFANTOM100_iNXTIterator _VI_FUNCC nFANTOM100_createNXTIterator( - ViBoolean searchBluetooth, - ViUInt32 bluetoothSearchTimeoutInSeconds, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_destroyNXTIterator( - nFANTOM100_iNXTIterator iterPtr, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_pairBluetooth( - ViConstString resourceName, - ViConstString passkey, - ViChar pairedResourceName[], - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_unpairBluetooth( - ViConstString resourceName, - ViStatus* status ); - - nFANTOM100_kExport ViBoolean _VI_FUNCC nFANTOM100_isPaired( - ViConstString resourceName, - ViStatus* status ); - - nFANTOM100_kExport nFANTOM100_iNXT _VI_FUNCC nFANTOM100_createNXT( - ViConstString resourceString, - ViStatus* status, - ViBoolean checkFirmwareVersion ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_destroyNXT( - nFANTOM100_iNXT nxtPtr, - ViStatus* status ); - - nFANTOM100_kExport nFANTOM100_iFile _VI_FUNCC nFANTOM100_iNXT_createFile( - nFANTOM100_iNXT nxtPtr, - ViConstString fileName, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_destroyFile( - nFANTOM100_iNXT nxtPtr, - nFANTOM100_iFile filePtr, - ViStatus* status ); - - nFANTOM100_kExport nFANTOM100_iFileIterator _VI_FUNCC nFANTOM100_iNXT_createFileIterator( - nFANTOM100_iNXT nxtPtr, - ViConstString fileNamePattern, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_destroyFileIterator( - nFANTOM100_iNXT nxtPtr, - nFANTOM100_iFileIterator fileIteratorPtr, - ViStatus* status ); - - nFANTOM100_kExport nFANTOM100_iModule _VI_FUNCC nFANTOM100_iNXT_createModule( - nFANTOM100_iNXT nxtPtr, - ViConstString moduleName, - ViUInt32 moduleID, - ViUInt32 moduleSize, - ViUInt32 ioMapSizeInBytes, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_destroyModule( - nFANTOM100_iNXT nxtPtr, - nFANTOM100_iModule modulePtr, - ViStatus* status ); - - nFANTOM100_kExport nFANTOM100_iModuleIterator _VI_FUNCC nFANTOM100_iNXT_createModuleIterator( - nFANTOM100_iNXT nxtPtr, - ViConstString moduleNamePattern, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_destroyModuleIterator( - nFANTOM100_iNXT nxtPtr, - nFANTOM100_iModuleIterator moduleIteratorPtr, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_getFirmwareVersion( - nFANTOM100_iNXT nxtPtr, - ViUInt8* protocolVersionMajorPtr, - ViUInt8* protocolVersionMinorPtr, - ViUInt8* firmwareVersionMajorPtr, - ViUInt8* firmwareVersionMinorPtr, - ViStatus* status ); - - nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iNXT_sendDirectCommand( - nFANTOM100_iNXT nxtPtr, - ViBoolean requireResponse, - const ViByte commandBufferPtr[], - ViUInt32 commandBufferSizeInBytes, - ViPBuf responseBufferPtr, - ViUInt32 responseBufferSizeInBytes, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_findDeviceInFirmwareDownloadMode( - ViChar resourceString[], - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_downloadFirmware( - nFANTOM100_iNXT nxtPtr, - const ViByte firmwareBufferPtr[], - ViUInt32 firmwareBufferSize, - ViStatus* status ); - - nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iNXT_write( - nFANTOM100_iNXT nxtPtr, - const ViByte bufferPtr[], - ViUInt32 numberOfBytes, - ViStatus* status ); - - nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iNXT_read( - nFANTOM100_iNXT nxtPtr, - ViPBuf bufferPtr, - ViUInt32 numberOfBytes, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_bootIntoFirmwareDownloadMode( - ViConstString resouceName, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_setName( - nFANTOM100_iNXT nxtPtr, - ViConstString newName, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_getDeviceInfo( - nFANTOM100_iNXT nxtPtr, - ViChar name[], - ViByte bluetoothAddress[], - ViUInt8 signalStrength[], - ViUInt32* availableFlash, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_eraseUserFlash( - nFANTOM100_iNXT nxtPtr, - ViStatus* status ); - - nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iNXT_pollAvailableLength( - nFANTOM100_iNXT nxtPtr, - ViUInt32 bufferIndex, - ViStatus* status ); - - nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iNXT_readBufferData( - nFANTOM100_iNXT nxtPtr, - ViPBuf dataBuffer, - ViUInt32 bufferIndex, - ViUInt32 numberOfBytesToRead, - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_getResourceString( - nFANTOM100_iNXT nxtPtr, - ViChar resourceString[], - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_bluetoothFactoryReset( - nFANTOM100_iNXT nxtPtr, - ViStatus* status ); - - - } // extern "C" - - -// inline functions and function macros... - - -#endif // ___fantom_iNXT_h___ diff --git a/FantomModule/fantom/iNXTIterator.h b/FantomModule/fantom/iNXTIterator.h deleted file mode 100644 index 6f43537..0000000 --- a/FantomModule/fantom/iNXTIterator.h +++ /dev/null @@ -1,120 +0,0 @@ -/*! - \file iNXTIterator.h - \brief Interface used for searching for LEGO MINDSTORMS NXTs. -*/ -/* - © Copyright 2005-2006, - National Instruments Corporation. - All rights reserved. - - File: iNXTIterator.h - Originated: 17 Oct 2005 -*/ - -#ifndef ___fantom_iNXTIterator_h___ -#define ___fantom_iNXTIterator_h___ - - -// includes... - -#ifndef ___fantom_platform_h___ - #include "platform.h" -#endif - -#ifndef ___fantom_tStatus_h___ - #include "tStatus.h" -#endif - - -// defines... - - -namespace nFANTOM100 -{ - // forward declarations... - class iNXT; - - // typedefs... - - // classes... - - /*! - \class iNXTIterator - \brief Interface to an iterator for LEGO MINDSTORMS NXTs. - */ - class iNXTIterator - { - friend class iNXT; - - // methods - protected: - - //! Destructor - virtual ~iNXTIterator() = 0; - - public: - - //! Retrieves the name of the NXT to which this iterator refers. - /* - \param resourceName Populated with the name of the NXT to which this iterator - currently refers. The resource name character array must have a capacity of 256 - bytes. - \param status Status chaining object. - */ - virtual void getName( ViChar resourceName[], tStatus& status ) const = 0; - - //! Advances this iterator. - /*! - Advances this iterator to the next NXT that was found. If no more NXTs are found, - this iterator is advanced to the end of the list. - The iterator is not advanced if the specified status is fatal. - If this iterator is already at the end of the list, a fatal status will be generated. - - \param status Status chaining object. - */ - virtual void advance( tStatus& status ) = 0; - - //! Creates an NXT object for the NXT referenced by this iterator. - /* - Creates an NXT object for the NXT referenced by this iterator. An object is not - created if the specified status is fatal or if this iterator refers to the end of - the list. The returned iNXT object should be destroyed using the iNXT::destroyNXT - method. - - \param status Status chaining object. - \return A pointer to the iNXT object that was created. - */ - virtual iNXT* getNXT( tStatus& status ) = 0; - }; - - - // constants... - -} // namespace nFANTOM100 - - - // declarations for globally-scoped globals... - - // typedefs - typedef ViObject nFANTOM100_iNXTIterator; - - // we must duplicate this typedef for the getNXT C wrapper - typedef ViObject nFANTOM100_iNXT; - - extern "C" - { - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXTIterator_getName( - nFANTOM100_iNXTIterator iteratorPtr, - ViChar resourceName[], - ViStatus* status ); - - nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXTIterator_advance( - nFANTOM100_iNXTIterator iteratorPtr, - ViStatus* status ); - - nFANTOM100_kExport nFANTOM100_iNXT _VI_FUNCC nFANTOM100_iNXTIterator_getNXT( - nFANTOM100_iNXTIterator iteratorPtr, - ViStatus* status ); - } - -#endif // ___fantom_iNXTIterator_h___ diff --git a/FantomModule/fantom/platform.h b/FantomModule/fantom/platform.h deleted file mode 100644 index 7455796..0000000 --- a/FantomModule/fantom/platform.h +++ /dev/null @@ -1,94 +0,0 @@ -/*! - \file platform.h - \brief This file contains platform-related defines. -*/ -/* - © Copyright 2005, - National Instruments Corporation. - All rights reserved. - - File: platform.h - Originated: 23 June 2005 -*/ - - -#ifndef ___fantom_platform_h___ -#define ___fantom_platform_h___ - -#ifndef __VISATYPE_HEADER__ - #include "visatype.h" -#endif - - -#define nFANTOM100_kOSMacOSX 0 -#define nFANTOM100_kOSWin32 0 - -#define nFANTOM100_kProcessorI386 0 -#define nFANTOM100_kProcessorPPC 0 - -#define nFANTOM100_kCompilerMSVC 0 -#define nFANTOM100_kCompilerApple 0 - - -#if (( defined( __GNUG__ ) || defined( __GNUC__ )) && defined( __APPLE__ )) - - #undef nFANTOM100_kOSMacOSX - #define nFANTOM100_kOSMacOSX 1 - - #undef nFANTOM100_kCompilerApple - #define nFANTOM100_kCompilerApple ( __GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__ ) - - #if ( defined( __ppc__ )) - #undef nFANTOM100_kProcessorPPC - #define nFANTOM100_kProcessorPPC 1 - - #define nFANTOM100_kBigEndian 1 - #define nFANTOM100_kLittleEndian 0 - #elif ( defined( __i386__ )) - #undef nFANTOM100_kProcessorI386 - #define nFANTOM100_kProcessorI386 1 - - #define nFANTOM100_kBigEndian 0 - #define nFANTOM100_kLittleEndian 1 - #else - #error Unknown processor. - #endif - - #ifdef nFANTOM100_kExportSymbols - #define nFANTOM100_kExport __attribute__ ((section ("__TEXT,__export"))) - #else - #define nFANTOM100_kExport - #endif - - -#elif ( defined( _MSC_VER ) && ( defined( _M_IX86 ) || defined( _M_I86 ))) - - #undef nFANTOM100_kOSWin32 - #define nFANTOM100_kOSWin32 1 - - #undef nFANTOM100_kCompilerMSVC - #define nFANTOM100_kCompilerMSVC _MSC_VER - - #undef nFANTOM100_kProcessorI386 - #define nFANTOM100_kProcessorI386 1 - - #ifdef nFANTOM100_kExportSymbols - #define nFANTOM100_kExport __declspec(dllexport) - #else - #define nFANTOM100_kExport __declspec(dllimport) - #endif - - #define nFANTOM100_kBigEndian 0 - #define nFANTOM100_kLittleEndian 1 - -#else - - #error Unknown platform. - -#endif - - -#endif // ___fantom_platform_h___ - diff --git a/FantomModule/fantom/tStatus.h b/FantomModule/fantom/tStatus.h deleted file mode 100644 index 7622c63..0000000 --- a/FantomModule/fantom/tStatus.h +++ /dev/null @@ -1,458 +0,0 @@ -/*! - \file tStatus.h - \brief Status code class -*/ -/* - © Copyright 2005-2006, - National Instruments Corporation. - All rights reserved. - - File: tStatus.h - Originated: 10 March 2005 -*/ - -#ifndef ___fantom_tStatus_h___ -#define ___fantom_tStatus_h___ - -// includes ... - -#ifndef ___fantom_platform_h___ - #include "platform.h" -#endif - -#include - - -// defines... - -#define nFANTOM_mLocation __FILE__, __LINE__ - -#define nFANTOM_ForceToWarning(s) (((s) >= 0 ) ? (s) : -(s)) -#define nFANTOM_ForceToFatal(s) (((s) <= 0 ) ? (s) : -(s)) - -/*! - \brief The namespace for Fantom 1.0. -*/ -namespace nFANTOM100 -{ - // forward declarations... - - // typedefs... - - // classes... - const ViInt32 kStatusOffset = -142000; // 0xFFFDD550 - const ViStatus kStatusSuccess = VI_SUCCESS; - - /*! - \brief Enumeration of Fantom-specific status codes. NI-VISA status codes may also be - returned. These are documented in the NI-VISA Programmer Reference Manual which is - available from . - */ - enum tFANTOMStatus - { - kStatusFirst = (kStatusOffset + 0), - - //! Error: Bluetooth pairing operation failed. - //! Warning: You have already paired with that Bluetooth device. - kStatusPairingFailed = (kStatusOffset + -5), // 0x54B - - //! Error: Bluetooth search failed. - kStatusBluetoothSearchFailed = (kStatusOffset + -6), // 0x54A - - //! Error: System library not found. - kStatusSystemLibraryNotFound = (kStatusOffset + -7), // 0x549 - - //! Error: Bluetooth unpairing operation failed. - kStatusUnpairingFailed = (kStatusOffset + -8), // 0x548 - - //! Error: Invalid filename specified. - kStatusInvalidFilename = (kStatusOffset + -9), // 0x547 - - //! Error: Invalid iterator dereference. (No object to get.) - kStatusInvalidIteratorDereference = (kStatusOffset + -10), // 0x546 - - //! Error: Resource locking operation failed. - kStatusLockOperationFailed = (kStatusOffset + -11), // 0x545 - - //! Error: Could not determine the requested size. - kStatusSizeUnknown = (kStatusOffset + -12), // 0x544 - - //! Error: Cannot open two objects at once. - kStatusDuplicateOpen = (kStatusOffset + -13), // 0x543 - - //! Error: File is empty. - //! Warning: The requested file is empty. - kStatusEmptyFile = (kStatusOffset + -14), // 0x542 - - //! Error: Firmware download failed. - kStatusFirmwareDownloadFailed = (kStatusOffset + -15), // 0x541 - - //! Error: Could not locate virtual serial port. - kStatusPortNotFound = (kStatusOffset + -16), // 0x540 - - //! Error: No more items found. - kStatusNoMoreItemsFound = (kStatusOffset + -17), // 0x53F - - //! Error: Too many unconfigured devices. - kStatusTooManyUnconfiguredDevices = (kStatusOffset + -18), // 0x53E - - //! Error: Command mismatch in firmware response. - kStatusCommandMismatch = (kStatusOffset + -19), // 0x53D - - //! Error: Illegal operation. - kStatusIllegalOperation = (kStatusOffset + -20), // 0x53C - - //! Error: Could not update local Bluetooth cache with new name. - //! Warning: Could not update local Bluetooth cache with new name. - kStatusBluetoothCacheUpdateFailed = (kStatusOffset + -21), // 0x53B - - //! Error: Selected device is not an NXT. - kStatusNonNXTDeviceSelected = (kStatusOffset + -22), // 0x53A - - //! Error: Communication error. Retry the operation. - kStatusRetryConnection = (kStatusOffset + -23), // 0x539 - - //! Error: Could not connect to NXT. Turn the NXT off and then back on before continuing. - kStatusPowerCycleNXT = (kStatusOffset + -24), // 0x538 - - //! Error: This feature is not yet implemented. - kStatusFeatureNotImplemented = (kStatusOffset + -99), // 0x4ED - - //! Error: Firmware reported an illegal handle. - kStatusFWIllegalHandle = (kStatusOffset + -189), // 0x493 - - //! Error: Firmware reported an illegal file name. - kStatusFWIllegalFileName = (kStatusOffset + -190), // 0x492 - - //! Error: Firmware reported an out of bounds reference. - kStatusFWOutOfBounds = (kStatusOffset + -191), // 0x491 - - //! Error: Firmware could not find module. - kStatusFWModuleNotFound = (kStatusOffset + -192), // 0x490 - - //! Error: Firmware reported that the file already exists. - kStatusFWFileExists = (kStatusOffset + -193), // 0x48F - - //! Error: Firmware reported that the file is full. - kStatusFWFileIsFull = (kStatusOffset + -194), // 0x48E - - //! Error: Firmware reported the append operation is not possible. - kStatusFWAppendNotPossible = (kStatusOffset + -195), // 0x48D - - //! Error: Firmware has no write buffers available. - kStatusFWNoWriteBuffers = (kStatusOffset + -196), // 0x48C - - //! Error: Firmware reported that file is busy. - kStatusFWFileIsBusy = (kStatusOffset + -197), // 0x48B - - //! Error: Firmware reported the undefined error. - kStatusFWUndefinedError = (kStatusOffset + -198), // 0x48A - - //! Error: Firmware reported that no linear space is available. - kStatusFWNoLinearSpace = (kStatusOffset + -199), // 0x489 - - //! Error: Firmware reported that handle has already been closed. - kStatusFWHandleAlreadyClosed = (kStatusOffset + -200), // 0x488 - - //! Error: Firmware could not find file. - kStatusFWFileNotFound = (kStatusOffset + -201), // 0x487 - - //! Error: Firmware reported that the requested file is not linear. - kStatusFWNotLinearFile = (kStatusOffset + -202), // 0x486 - - //! Error: Firmware reached the end of the file. - kStatusFWEndOfFile = (kStatusOffset + -203), // 0x485 - - //! Error: Firmware expected an end of file. - kStatusFWEndOfFileExpected = (kStatusOffset + -204), // 0x484 - - //! Error: Firmware cannot handle more files. - kStatusFWNoMoreFiles = (kStatusOffset + -205), // 0x483 - - //! Error: Firmware reported the NXT is out of space. - kStatusFWNoSpace = (kStatusOffset + -206), // 0x482 - - //! Error: Firmware could not create a handle. - kStatusFWNoMoreHandles = (kStatusOffset + -207), // 0x481 - - //! Error: Firmware reported an unknown error code. - kStatusFWUnknownErrorCode = (kStatusOffset + -208), // 0x480 - - kStatusLast = (kStatusOffset + -999) - }; - - /*! - \brief Class that contains a status code and the file name and line number where that - status code was generated. - */ - class tStatus - { - public: - - // methods - - //! constructor - /*! - Creates a tStatus object intialized to success. - - \post The status code is set to VI_SUCCESS. - */ - inline tStatus( void ) : - _code( VI_SUCCESS ), - _lineNumber( 0 ) - { - _fileName[0] = '\0'; - } - - - //! copy constructor - /*! - Copies the code, line number, and file name from the specified tStatus object. - - \param status The status object to copy. - */ - inline tStatus( const tStatus& status ) : - _code( status._code ), - _lineNumber( status._lineNumber ) - { - ::strcpy( _fileName, "" ); - ::strncat( _fileName, status._fileName, kMaxFileNameLength - 1 ); - } - - - //! constructor with code, filename, and line number - /*! - Creates a tStatus object initialized to the specified code, file name, and line number. - Note that the nFANTOM_mLocation macro can be used to pass the fileName and lineNumber - parameters. - - \param code A status code. - \param fileName The name of the file in which the status code was generated. - \param lineNumber The line number in the file at which the status code was generated. - */ - inline tStatus( ViStatus code, const char* fileName, ViUInt32 lineNumber ) : - _code( code ), - _lineNumber( lineNumber ) - { - ::strcpy( _fileName, "" ); - ::strncat( _fileName, reinterpret_cast( fileName ), kMaxFileNameLength - 1 ); - } - - - //! destructor - inline ~tStatus() - { - } - - - //! Returns the status code for this status object. - /*! - \return The status code for this status object. - */ - inline ViStatus getCode( void ) const - { - return _code; - } - - - //! Returns the file name in which the status code, for this status object, was generated. - /*! - \return The file name in which the status code, for this status object, was generated. - */ - inline const char* getFileName( void ) const - { - return _fileName; - } - - - //! Returns the line number at which the status code, for this status object, was - // generated. - /*! - \return The line number at which the status code, for this status object, was - generated. - */ - inline ViUInt32 getLineNumber( void ) const - { - return _lineNumber; - } - - - //! Sets the status code, file name, and line number for this status object, if - // appropriate. - /*! - Stores the specified status code, file name, and line number in this status object if - this status object contains a successful status code or if this status object - contains a warning status code and the specified status code is fatal. A fatal - status code is denoted by a negative value. A successful status code is denoted - by VI_SUCCESS. - - \param code A status code. - \param fileName The name of the file in which the status code was generated. - \param lineNumber The line number in the file at which the status code was generated. - */ - inline void setCode( ViStatus code, const char* fileName, ViUInt32 lineNumber ) - { - if(( isSuccess() && code != VI_SUCCESS ) || ( isNotFatal() && code < VI_SUCCESS )) - { - _code = code; - _lineNumber = lineNumber; - ::strcpy( _fileName, "" ); - ::strncat( _fileName, fileName, kMaxFileNameLength - 1 ); - } - } - - - //! Assigns the specified status object to this status object, if appropriate. - /*! - Stores the status code, file name, and line number of the specified status object in - this status object if this status object contains a successful status code or if - this status object contains a warning status code and the status code of the - speciied status object is fatal. A fatal status code is denoted by a negative - value. A successful status code is denoted by VI_SUCCESS. - - \param status The status object to assign. - */ - inline void assign( const tStatus& status ) - { - setCode( status.getCode(), status.getFileName(), status.getLineNumber()); - } - - - //! Clears the status code for this status object. - /*! - \post status The code is set to VI_SUCCESS. - */ - inline void clear( void ) - { - _code = VI_SUCCESS; - _lineNumber = 0; - _fileName[0] = '\0'; - } - - - //! Returns true if this status object contains a status code that is fatal. - /*! - A status code with a negative value is considered fatal. - - \return true if this status object contains a status code that is - fatal; false otherwise. - */ - inline bool isFatal( void ) const - { - return ( _code < VI_SUCCESS ); - } - - //! Returns true if this status object contains a status code that is not fatal. - /*! - Any status code with a non-negative (including zero) value is considered non-fatal. - - \return true if this status object contains a non-fatal status code; - false otherwise. - */ - inline bool isNotFatal( void ) const - { - return !isFatal(); - } - - - //! Returns true if this status object contains a status code that is a warning. - /*! - A status code with a non-zero, positive value is considered a warning. - - \return true if this status object contains a status code that is a warning; false - otherwise. - */ - inline bool isWarning( void ) const - { - return ( _code > VI_SUCCESS ); - } - - - //! Returns true if this status object contains the status code for success. - /*! - A value of VI_SUCCESS represents success. - - \return true if this status object contains the status code for success; false - otherwise. - */ - inline bool isSuccess( void ) const - { - return ( _code == VI_SUCCESS ); - } - - private: - - // declared private to prevent assignment - tStatus& operator=(const tStatus& rhs); - - enum - { - kMaxFileNameLength = 101 - }; - - ViStatus _code; - ViChar _fileName[ kMaxFileNameLength ]; - ViUInt32 _lineNumber; - }; - - - // declarations for globally-scoped globals... - inline ViStatus convertStatus( ViUInt8 firmwareStatus ) - { - ViStatus status; - switch (firmwareStatus) - { - // each of these cases corresponds to a unique status code returned by the firmware - case 0x00 : status = kStatusSuccess; - break; - case 0x81 : status = kStatusFWNoMoreHandles; // No more available handles - break; - case 0x82 : status = kStatusFWNoSpace; // No space - break; - case 0x83 : status = kStatusFWNoMoreFiles; // No more files - break; - case 0x84 : status = kStatusFWEndOfFileExpected; // End of file expected - break; - case 0x85 : status = kStatusFWEndOfFile; // End of file reached - break; - case 0x86 : status = kStatusFWNotLinearFile; // Not a linear file - break; - case 0x87 : status = kStatusFWFileNotFound; // File not found - break; - case 0x88 : status = kStatusFWHandleAlreadyClosed; // Handle is already closed - break; - case 0x89 : status = kStatusFWNoLinearSpace; // No linear space available - break; - case 0x8A : status = kStatusFWUndefinedError; // Undefined error - break; - case 0x8B : status = kStatusFWFileIsBusy; // File is busy - break; - case 0x8C : status = kStatusFWNoWriteBuffers; // No write buffers available - break; - case 0x8D : status = kStatusFWAppendNotPossible; // Append not possible - break; - case 0x8E : status = kStatusFWFileIsFull; // File is full - break; - case 0x8F : status = kStatusFWFileExists; // File already exists - break; - case 0x90 : status = kStatusFWModuleNotFound; // Module not found - break; - case 0x91 : status = kStatusFWOutOfBounds; // Out of module I/O map boundary - break; - case 0x92 : status = kStatusFWIllegalFileName; // Illegal file name - break; - case 0x93 : status = kStatusFWIllegalHandle; // Illegal handle - break; - default : - status = kStatusFWUnknownErrorCode; - } - return status; - } - - // prototypes... - -} // namespace nFANTOM100 - -// inline functions and function macros... - -#endif // ___fantom_tStatus_h___ diff --git a/FantomModule/include/labview/macosx/advanceFileIterator.vi b/FantomModule/include/labview/macosx/advanceFileIterator.vi deleted file mode 100644 index 427df5b..0000000 Binary files a/FantomModule/include/labview/macosx/advanceFileIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/advanceModuleIterator.vi b/FantomModule/include/labview/macosx/advanceModuleIterator.vi deleted file mode 100644 index 46617f5..0000000 Binary files a/FantomModule/include/labview/macosx/advanceModuleIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/advanceNXTIterator.vi b/FantomModule/include/labview/macosx/advanceNXTIterator.vi deleted file mode 100644 index e223afd..0000000 Binary files a/FantomModule/include/labview/macosx/advanceNXTIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/bluetoothFactoryReset.vi b/FantomModule/include/labview/macosx/bluetoothFactoryReset.vi deleted file mode 100644 index d821675..0000000 Binary files a/FantomModule/include/labview/macosx/bluetoothFactoryReset.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/bootSamba.vi b/FantomModule/include/labview/macosx/bootSamba.vi deleted file mode 100644 index a1bf225..0000000 Binary files a/FantomModule/include/labview/macosx/bootSamba.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/closeFile.vi b/FantomModule/include/labview/macosx/closeFile.vi deleted file mode 100644 index f5b1e12..0000000 Binary files a/FantomModule/include/labview/macosx/closeFile.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/createFile.vi b/FantomModule/include/labview/macosx/createFile.vi deleted file mode 100644 index b3442ac..0000000 Binary files a/FantomModule/include/labview/macosx/createFile.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/createFileIterator.vi b/FantomModule/include/labview/macosx/createFileIterator.vi deleted file mode 100644 index 4ad1d34..0000000 Binary files a/FantomModule/include/labview/macosx/createFileIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/createModule.vi b/FantomModule/include/labview/macosx/createModule.vi deleted file mode 100644 index bd1f3e8..0000000 Binary files a/FantomModule/include/labview/macosx/createModule.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/createModuleIterator.vi b/FantomModule/include/labview/macosx/createModuleIterator.vi deleted file mode 100644 index 051e858..0000000 Binary files a/FantomModule/include/labview/macosx/createModuleIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/createNXT.vi b/FantomModule/include/labview/macosx/createNXT.vi deleted file mode 100644 index bb38bb8..0000000 Binary files a/FantomModule/include/labview/macosx/createNXT.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/createNXTIterator.vi b/FantomModule/include/labview/macosx/createNXTIterator.vi deleted file mode 100644 index 2827435..0000000 Binary files a/FantomModule/include/labview/macosx/createNXTIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/destroyFile.vi b/FantomModule/include/labview/macosx/destroyFile.vi deleted file mode 100644 index a57aea3..0000000 Binary files a/FantomModule/include/labview/macosx/destroyFile.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/destroyFileIterator.vi b/FantomModule/include/labview/macosx/destroyFileIterator.vi deleted file mode 100644 index 0010789..0000000 Binary files a/FantomModule/include/labview/macosx/destroyFileIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/destroyModule.vi b/FantomModule/include/labview/macosx/destroyModule.vi deleted file mode 100644 index 66af71f..0000000 Binary files a/FantomModule/include/labview/macosx/destroyModule.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/destroyModuleIterator.vi b/FantomModule/include/labview/macosx/destroyModuleIterator.vi deleted file mode 100644 index c0a4b9a..0000000 Binary files a/FantomModule/include/labview/macosx/destroyModuleIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/destroyNXT.vi b/FantomModule/include/labview/macosx/destroyNXT.vi deleted file mode 100644 index 3065055..0000000 Binary files a/FantomModule/include/labview/macosx/destroyNXT.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/destroyNXTIterator.vi b/FantomModule/include/labview/macosx/destroyNXTIterator.vi deleted file mode 100644 index f763b9a..0000000 Binary files a/FantomModule/include/labview/macosx/destroyNXTIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/downloadFirmware.vi b/FantomModule/include/labview/macosx/downloadFirmware.vi deleted file mode 100644 index d0c082b..0000000 Binary files a/FantomModule/include/labview/macosx/downloadFirmware.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/eraseUserFlash.vi b/FantomModule/include/labview/macosx/eraseUserFlash.vi deleted file mode 100644 index 4961a39..0000000 Binary files a/FantomModule/include/labview/macosx/eraseUserFlash.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/findDeviceInFirmwareDownloadMode.vi b/FantomModule/include/labview/macosx/findDeviceInFirmwareDownloadMode.vi deleted file mode 100644 index 44bfc91..0000000 Binary files a/FantomModule/include/labview/macosx/findDeviceInFirmwareDownloadMode.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/findNXT.vi b/FantomModule/include/labview/macosx/findNXT.vi deleted file mode 100644 index 78b9034..0000000 Binary files a/FantomModule/include/labview/macosx/findNXT.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/getAvailableSize.vi b/FantomModule/include/labview/macosx/getAvailableSize.vi deleted file mode 100644 index c6f2be6..0000000 Binary files a/FantomModule/include/labview/macosx/getAvailableSize.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/getDeviceInfo.vi b/FantomModule/include/labview/macosx/getDeviceInfo.vi deleted file mode 100644 index 1fbc025..0000000 Binary files a/FantomModule/include/labview/macosx/getDeviceInfo.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/getFile.vi b/FantomModule/include/labview/macosx/getFile.vi deleted file mode 100644 index 6a31965..0000000 Binary files a/FantomModule/include/labview/macosx/getFile.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/getFileName.vi b/FantomModule/include/labview/macosx/getFileName.vi deleted file mode 100644 index b5d7724..0000000 Binary files a/FantomModule/include/labview/macosx/getFileName.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/getFileSize.vi b/FantomModule/include/labview/macosx/getFileSize.vi deleted file mode 100644 index d0d18dc..0000000 Binary files a/FantomModule/include/labview/macosx/getFileSize.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/getFileSizeFromIterator.vi b/FantomModule/include/labview/macosx/getFileSizeFromIterator.vi deleted file mode 100644 index b9ee459..0000000 Binary files a/FantomModule/include/labview/macosx/getFileSizeFromIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/getFilenameFromIterator.vi b/FantomModule/include/labview/macosx/getFilenameFromIterator.vi deleted file mode 100644 index f389374..0000000 Binary files a/FantomModule/include/labview/macosx/getFilenameFromIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/getFirmwareVersion.vi b/FantomModule/include/labview/macosx/getFirmwareVersion.vi deleted file mode 100644 index d31e7b1..0000000 Binary files a/FantomModule/include/labview/macosx/getFirmwareVersion.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/getIOMapSize.vi b/FantomModule/include/labview/macosx/getIOMapSize.vi deleted file mode 100644 index b85503e..0000000 Binary files a/FantomModule/include/labview/macosx/getIOMapSize.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/getModule.vi b/FantomModule/include/labview/macosx/getModule.vi deleted file mode 100644 index c7aa164..0000000 Binary files a/FantomModule/include/labview/macosx/getModule.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/getModuleID.vi b/FantomModule/include/labview/macosx/getModuleID.vi deleted file mode 100644 index c361683..0000000 Binary files a/FantomModule/include/labview/macosx/getModuleID.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/getModuleName.vi b/FantomModule/include/labview/macosx/getModuleName.vi deleted file mode 100644 index 1e677ac..0000000 Binary files a/FantomModule/include/labview/macosx/getModuleName.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/getModuleNameFromIterator.vi b/FantomModule/include/labview/macosx/getModuleNameFromIterator.vi deleted file mode 100644 index f398170..0000000 Binary files a/FantomModule/include/labview/macosx/getModuleNameFromIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/getModuleSize.vi b/FantomModule/include/labview/macosx/getModuleSize.vi deleted file mode 100644 index 504956b..0000000 Binary files a/FantomModule/include/labview/macosx/getModuleSize.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/getNXTFromIterator.vi b/FantomModule/include/labview/macosx/getNXTFromIterator.vi deleted file mode 100644 index 8301df2..0000000 Binary files a/FantomModule/include/labview/macosx/getNXTFromIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/getResourceString.vi b/FantomModule/include/labview/macosx/getResourceString.vi deleted file mode 100644 index 55f8fe7..0000000 Binary files a/FantomModule/include/labview/macosx/getResourceString.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/getStringFromNXTIterator.vi b/FantomModule/include/labview/macosx/getStringFromNXTIterator.vi deleted file mode 100644 index 9f97c2a..0000000 Binary files a/FantomModule/include/labview/macosx/getStringFromNXTIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/isPaired.vi b/FantomModule/include/labview/macosx/isPaired.vi deleted file mode 100644 index a2f9602..0000000 Binary files a/FantomModule/include/labview/macosx/isPaired.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/nakedRead.vi b/FantomModule/include/labview/macosx/nakedRead.vi deleted file mode 100644 index 00a43de..0000000 Binary files a/FantomModule/include/labview/macosx/nakedRead.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/nakedWrite.vi b/FantomModule/include/labview/macosx/nakedWrite.vi deleted file mode 100644 index 01bd8e1..0000000 Binary files a/FantomModule/include/labview/macosx/nakedWrite.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/nxt.ctl b/FantomModule/include/labview/macosx/nxt.ctl deleted file mode 100644 index 2f06605..0000000 Binary files a/FantomModule/include/labview/macosx/nxt.ctl and /dev/null differ diff --git a/FantomModule/include/labview/macosx/openForRead.vi b/FantomModule/include/labview/macosx/openForRead.vi deleted file mode 100644 index 74dd60b..0000000 Binary files a/FantomModule/include/labview/macosx/openForRead.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/openForWrite.vi b/FantomModule/include/labview/macosx/openForWrite.vi deleted file mode 100644 index 180bd70..0000000 Binary files a/FantomModule/include/labview/macosx/openForWrite.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/pairBluetooth.vi b/FantomModule/include/labview/macosx/pairBluetooth.vi deleted file mode 100644 index 1845031..0000000 Binary files a/FantomModule/include/labview/macosx/pairBluetooth.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/pollAvailableLength.vi b/FantomModule/include/labview/macosx/pollAvailableLength.vi deleted file mode 100644 index 0b74f5d..0000000 Binary files a/FantomModule/include/labview/macosx/pollAvailableLength.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/read.vi b/FantomModule/include/labview/macosx/read.vi deleted file mode 100644 index 9cf87a4..0000000 Binary files a/FantomModule/include/labview/macosx/read.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/readBufferData.vi b/FantomModule/include/labview/macosx/readBufferData.vi deleted file mode 100644 index 1ebef92..0000000 Binary files a/FantomModule/include/labview/macosx/readBufferData.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/readIOMap.vi b/FantomModule/include/labview/macosx/readIOMap.vi deleted file mode 100644 index be244b0..0000000 Binary files a/FantomModule/include/labview/macosx/readIOMap.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/remove.vi b/FantomModule/include/labview/macosx/remove.vi deleted file mode 100644 index 4216b11..0000000 Binary files a/FantomModule/include/labview/macosx/remove.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/sendDirectCommand.vi b/FantomModule/include/labview/macosx/sendDirectCommand.vi deleted file mode 100644 index c7694ca..0000000 Binary files a/FantomModule/include/labview/macosx/sendDirectCommand.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/setNXTName.vi b/FantomModule/include/labview/macosx/setNXTName.vi deleted file mode 100644 index 19339d2..0000000 Binary files a/FantomModule/include/labview/macosx/setNXTName.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/unpairBluetooth.vi b/FantomModule/include/labview/macosx/unpairBluetooth.vi deleted file mode 100644 index c2e3b7c..0000000 Binary files a/FantomModule/include/labview/macosx/unpairBluetooth.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/write.vi b/FantomModule/include/labview/macosx/write.vi deleted file mode 100644 index 9f556a0..0000000 Binary files a/FantomModule/include/labview/macosx/write.vi and /dev/null differ diff --git a/FantomModule/include/labview/macosx/writeIOMap.vi b/FantomModule/include/labview/macosx/writeIOMap.vi deleted file mode 100644 index dda451b..0000000 Binary files a/FantomModule/include/labview/macosx/writeIOMap.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/advanceFileIterator.vi b/FantomModule/include/labview/win32/advanceFileIterator.vi deleted file mode 100644 index 19fc124..0000000 Binary files a/FantomModule/include/labview/win32/advanceFileIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/advanceModuleIterator.vi b/FantomModule/include/labview/win32/advanceModuleIterator.vi deleted file mode 100644 index b9879c7..0000000 Binary files a/FantomModule/include/labview/win32/advanceModuleIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/advanceNXTIterator.vi b/FantomModule/include/labview/win32/advanceNXTIterator.vi deleted file mode 100644 index a0fe1f1..0000000 Binary files a/FantomModule/include/labview/win32/advanceNXTIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/bluetoothFactoryReset.vi b/FantomModule/include/labview/win32/bluetoothFactoryReset.vi deleted file mode 100644 index 0f9c6a8..0000000 Binary files a/FantomModule/include/labview/win32/bluetoothFactoryReset.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/bootSamba.vi b/FantomModule/include/labview/win32/bootSamba.vi deleted file mode 100644 index 397a119..0000000 Binary files a/FantomModule/include/labview/win32/bootSamba.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/closeFile.vi b/FantomModule/include/labview/win32/closeFile.vi deleted file mode 100644 index 3e893e7..0000000 Binary files a/FantomModule/include/labview/win32/closeFile.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/createFile.vi b/FantomModule/include/labview/win32/createFile.vi deleted file mode 100644 index 1445f12..0000000 Binary files a/FantomModule/include/labview/win32/createFile.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/createFileIterator.vi b/FantomModule/include/labview/win32/createFileIterator.vi deleted file mode 100644 index 5554f4b..0000000 Binary files a/FantomModule/include/labview/win32/createFileIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/createModule.vi b/FantomModule/include/labview/win32/createModule.vi deleted file mode 100644 index b640ae7..0000000 Binary files a/FantomModule/include/labview/win32/createModule.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/createModuleIterator.vi b/FantomModule/include/labview/win32/createModuleIterator.vi deleted file mode 100644 index fd79dba..0000000 Binary files a/FantomModule/include/labview/win32/createModuleIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/createNXT.vi b/FantomModule/include/labview/win32/createNXT.vi deleted file mode 100644 index 47b3243..0000000 Binary files a/FantomModule/include/labview/win32/createNXT.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/createNXTIterator.vi b/FantomModule/include/labview/win32/createNXTIterator.vi deleted file mode 100644 index c6f8f24..0000000 Binary files a/FantomModule/include/labview/win32/createNXTIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/destroyFile.vi b/FantomModule/include/labview/win32/destroyFile.vi deleted file mode 100644 index c71a99a..0000000 Binary files a/FantomModule/include/labview/win32/destroyFile.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/destroyFileIterator.vi b/FantomModule/include/labview/win32/destroyFileIterator.vi deleted file mode 100644 index 783c4f4..0000000 Binary files a/FantomModule/include/labview/win32/destroyFileIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/destroyModule.vi b/FantomModule/include/labview/win32/destroyModule.vi deleted file mode 100644 index 0cf7fb7..0000000 Binary files a/FantomModule/include/labview/win32/destroyModule.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/destroyModuleIterator.vi b/FantomModule/include/labview/win32/destroyModuleIterator.vi deleted file mode 100644 index 5e40e7e..0000000 Binary files a/FantomModule/include/labview/win32/destroyModuleIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/destroyNXT.vi b/FantomModule/include/labview/win32/destroyNXT.vi deleted file mode 100644 index 42409c3..0000000 Binary files a/FantomModule/include/labview/win32/destroyNXT.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/destroyNXTIterator.vi b/FantomModule/include/labview/win32/destroyNXTIterator.vi deleted file mode 100644 index b9a9113..0000000 Binary files a/FantomModule/include/labview/win32/destroyNXTIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/downloadFirmware.vi b/FantomModule/include/labview/win32/downloadFirmware.vi deleted file mode 100644 index cf95da4..0000000 Binary files a/FantomModule/include/labview/win32/downloadFirmware.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/eraseUserFlash.vi b/FantomModule/include/labview/win32/eraseUserFlash.vi deleted file mode 100644 index d3c9154..0000000 Binary files a/FantomModule/include/labview/win32/eraseUserFlash.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/findDeviceInFirmwareDownloadMode.vi b/FantomModule/include/labview/win32/findDeviceInFirmwareDownloadMode.vi deleted file mode 100644 index 4a0b7c6..0000000 Binary files a/FantomModule/include/labview/win32/findDeviceInFirmwareDownloadMode.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/findNXT.vi b/FantomModule/include/labview/win32/findNXT.vi deleted file mode 100644 index 747c8cd..0000000 Binary files a/FantomModule/include/labview/win32/findNXT.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/getAvailableSize.vi b/FantomModule/include/labview/win32/getAvailableSize.vi deleted file mode 100644 index b511b2d..0000000 Binary files a/FantomModule/include/labview/win32/getAvailableSize.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/getDeviceInfo.vi b/FantomModule/include/labview/win32/getDeviceInfo.vi deleted file mode 100644 index 835046a..0000000 Binary files a/FantomModule/include/labview/win32/getDeviceInfo.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/getFile.vi b/FantomModule/include/labview/win32/getFile.vi deleted file mode 100644 index 2931da1..0000000 Binary files a/FantomModule/include/labview/win32/getFile.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/getFileName.vi b/FantomModule/include/labview/win32/getFileName.vi deleted file mode 100644 index 40ec334..0000000 Binary files a/FantomModule/include/labview/win32/getFileName.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/getFileSize.vi b/FantomModule/include/labview/win32/getFileSize.vi deleted file mode 100644 index 3ba069e..0000000 Binary files a/FantomModule/include/labview/win32/getFileSize.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/getFileSizeFromIterator.vi b/FantomModule/include/labview/win32/getFileSizeFromIterator.vi deleted file mode 100644 index 9228800..0000000 Binary files a/FantomModule/include/labview/win32/getFileSizeFromIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/getFilenameFromIterator.vi b/FantomModule/include/labview/win32/getFilenameFromIterator.vi deleted file mode 100644 index bbbf882..0000000 Binary files a/FantomModule/include/labview/win32/getFilenameFromIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/getFirmwareVersion.vi b/FantomModule/include/labview/win32/getFirmwareVersion.vi deleted file mode 100644 index 38760ac..0000000 Binary files a/FantomModule/include/labview/win32/getFirmwareVersion.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/getIOMapSize.vi b/FantomModule/include/labview/win32/getIOMapSize.vi deleted file mode 100644 index adf1396..0000000 Binary files a/FantomModule/include/labview/win32/getIOMapSize.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/getModule.vi b/FantomModule/include/labview/win32/getModule.vi deleted file mode 100644 index eeff3c8..0000000 Binary files a/FantomModule/include/labview/win32/getModule.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/getModuleID.vi b/FantomModule/include/labview/win32/getModuleID.vi deleted file mode 100644 index 2250164..0000000 Binary files a/FantomModule/include/labview/win32/getModuleID.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/getModuleName.vi b/FantomModule/include/labview/win32/getModuleName.vi deleted file mode 100644 index b0620c8..0000000 Binary files a/FantomModule/include/labview/win32/getModuleName.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/getModuleNameFromIterator.vi b/FantomModule/include/labview/win32/getModuleNameFromIterator.vi deleted file mode 100644 index f0e31ce..0000000 Binary files a/FantomModule/include/labview/win32/getModuleNameFromIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/getModuleSize.vi b/FantomModule/include/labview/win32/getModuleSize.vi deleted file mode 100644 index 1b2a5f6..0000000 Binary files a/FantomModule/include/labview/win32/getModuleSize.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/getNXTFromIterator.vi b/FantomModule/include/labview/win32/getNXTFromIterator.vi deleted file mode 100644 index 8acd597..0000000 Binary files a/FantomModule/include/labview/win32/getNXTFromIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/getResourceString.vi b/FantomModule/include/labview/win32/getResourceString.vi deleted file mode 100644 index c0d019a..0000000 Binary files a/FantomModule/include/labview/win32/getResourceString.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/getStringFromNXTIterator.vi b/FantomModule/include/labview/win32/getStringFromNXTIterator.vi deleted file mode 100644 index 8dee827..0000000 Binary files a/FantomModule/include/labview/win32/getStringFromNXTIterator.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/isPaired.vi b/FantomModule/include/labview/win32/isPaired.vi deleted file mode 100644 index 1c73992..0000000 Binary files a/FantomModule/include/labview/win32/isPaired.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/nakedRead.vi b/FantomModule/include/labview/win32/nakedRead.vi deleted file mode 100644 index 9c40980..0000000 Binary files a/FantomModule/include/labview/win32/nakedRead.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/nakedWrite.vi b/FantomModule/include/labview/win32/nakedWrite.vi deleted file mode 100644 index f2f875a..0000000 Binary files a/FantomModule/include/labview/win32/nakedWrite.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/nxt.ctl b/FantomModule/include/labview/win32/nxt.ctl deleted file mode 100644 index 6016dd1..0000000 Binary files a/FantomModule/include/labview/win32/nxt.ctl and /dev/null differ diff --git a/FantomModule/include/labview/win32/openForRead.vi b/FantomModule/include/labview/win32/openForRead.vi deleted file mode 100644 index 48d08e5..0000000 Binary files a/FantomModule/include/labview/win32/openForRead.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/openForWrite.vi b/FantomModule/include/labview/win32/openForWrite.vi deleted file mode 100644 index e5d83c8..0000000 Binary files a/FantomModule/include/labview/win32/openForWrite.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/pairBluetooth.vi b/FantomModule/include/labview/win32/pairBluetooth.vi deleted file mode 100644 index 52fb06a..0000000 Binary files a/FantomModule/include/labview/win32/pairBluetooth.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/pollAvailableLength.vi b/FantomModule/include/labview/win32/pollAvailableLength.vi deleted file mode 100644 index 6d05f67..0000000 Binary files a/FantomModule/include/labview/win32/pollAvailableLength.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/read.vi b/FantomModule/include/labview/win32/read.vi deleted file mode 100644 index c20cab9..0000000 Binary files a/FantomModule/include/labview/win32/read.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/readBufferData.vi b/FantomModule/include/labview/win32/readBufferData.vi deleted file mode 100644 index 6b621d8..0000000 Binary files a/FantomModule/include/labview/win32/readBufferData.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/readIOMap.vi b/FantomModule/include/labview/win32/readIOMap.vi deleted file mode 100644 index 9d89134..0000000 Binary files a/FantomModule/include/labview/win32/readIOMap.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/remove.vi b/FantomModule/include/labview/win32/remove.vi deleted file mode 100644 index 9870267..0000000 Binary files a/FantomModule/include/labview/win32/remove.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/sendDirectCommand.vi b/FantomModule/include/labview/win32/sendDirectCommand.vi deleted file mode 100644 index dba13c6..0000000 Binary files a/FantomModule/include/labview/win32/sendDirectCommand.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/setNXTName.vi b/FantomModule/include/labview/win32/setNXTName.vi deleted file mode 100644 index 65aa4ac..0000000 Binary files a/FantomModule/include/labview/win32/setNXTName.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/unpairBluetooth.vi b/FantomModule/include/labview/win32/unpairBluetooth.vi deleted file mode 100644 index 9389c36..0000000 Binary files a/FantomModule/include/labview/win32/unpairBluetooth.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/write.vi b/FantomModule/include/labview/win32/write.vi deleted file mode 100644 index d6f95d9..0000000 Binary files a/FantomModule/include/labview/win32/write.vi and /dev/null differ diff --git a/FantomModule/include/labview/win32/writeIOMap.vi b/FantomModule/include/labview/win32/writeIOMap.vi deleted file mode 100644 index 621546c..0000000 Binary files a/FantomModule/include/labview/win32/writeIOMap.vi and /dev/null differ diff --git a/FantomModule/pyfantom/__init__.py b/FantomModule/pyfantom/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/FantomModule/setup.py b/FantomModule/setup.py deleted file mode 100644 index e713d2f..0000000 --- a/FantomModule/setup.py +++ /dev/null @@ -1,40 +0,0 @@ -from distutils.core import setup, Extension -import sys -import os - -def getextensions(): - mac_ext = Extension("FantomModule", - define_macros=[('PYFANTOM_DEBUG', '0')], # set to '1' to print debug messges - include_dirs=['.'], - extra_compile_args=["-Wno-strict-prototypes"], - extra_link_args=["-framework Fantom"], - sources=["FantomModule.cpp"] - ) - return [mac_ext] - -# Must specify i386 arch via environment variable since Fantom libraries are i386 only -# Order of gcc flags is important, it can't be specified via Extension() module -os.environ['ARCHFLAGS'] = '-arch i386' - -# install the main library -setup(name="pyfantom", - version="0.1", - author="Tat-Chee Wan", - author_email="tcwan@cs.usm.my", - url="", - description="Python Extension to call Fantom Driver", - long_description="Python Wrapper for Fantom Driver on Mac OS X.", - license="GPL", - packages=["pyfantom"], - ext_modules=getextensions(), - classifiers = [ "Development Status :: 3 - Alpha", - "Intended Audience :: Developers", - # Need to confirm Fantom / NI-VISA license compatibility - # "License :: OSI Approved :: GNU General Public License (GPL)", - # "License :: OSI Approved :: GNU General Public License v2", - "Programming Language :: C++", - "Topic :: Software Development :: Libraries", - "Topic :: System :: Networking", - "Topic :: Communications", - "Operating System :: MacOS :: MacOS X" ] - ) diff --git a/FantomModule/visatype.h b/FantomModule/visatype.h deleted file mode 100644 index a667ff1..0000000 --- a/FantomModule/visatype.h +++ /dev/null @@ -1,155 +0,0 @@ -/*---------------------------------------------------------------------------*/ -/* Distributed by VXIplug&play Systems Alliance */ -/* */ -/* Do not modify the contents of this file. */ -/*---------------------------------------------------------------------------*/ -/* */ -/* Title : VISATYPE.H */ -/* Date : 08-01-98 */ -/* Purpose : Fundamental VISA data types and macro definitions */ -/* */ -/*---------------------------------------------------------------------------*/ - -#ifndef __VISATYPE_HEADER__ -#define __VISATYPE_HEADER__ - -#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)) && !defined(_NI_mswin16_) -#define _VI_FAR -#define _VI_FUNC __stdcall -#define _VI_FUNCC __cdecl -#define _VI_FUNCH __stdcall -#define _VI_SIGNED signed -#elif defined(_CVI_) && defined(_NI_i386_) -#define _VI_FAR -#define _VI_FUNC _pascal -#define _VI_FUNCC -#define _VI_FUNCH _pascal -#define _VI_SIGNED signed -#elif (defined(_WINDOWS) || defined(_Windows)) && !defined(_NI_mswin16_) -#define _VI_FAR _far -#define _VI_FUNC _far _pascal _export -#define _VI_FUNCC _far _cdecl _export -#define _VI_FUNCH _far _pascal -#define _VI_SIGNED signed -#elif (defined(hpux) || defined(__hpux)) && (defined(__cplusplus) || defined(__cplusplus__)) -#define _VI_FAR -#define _VI_FUNC -#define _VI_FUNCC -#define _VI_FUNCH -#define _VI_SIGNED -#else -#define _VI_FAR -#define _VI_FUNC -#define _VI_FUNCC -#define _VI_FUNCH -#define _VI_SIGNED signed -#endif - -#define _VI_ERROR (-2147483647L-1) /* 0x80000000 */ -#define _VI_PTR _VI_FAR * - -/*- VISA Types --------------------------------------------------------------*/ - -typedef unsigned long ViUInt32; -typedef ViUInt32 _VI_PTR ViPUInt32; -typedef ViUInt32 _VI_PTR ViAUInt32; - -typedef _VI_SIGNED long ViInt32; -typedef ViInt32 _VI_PTR ViPInt32; -typedef ViInt32 _VI_PTR ViAInt32; - -typedef unsigned short ViUInt16; -typedef ViUInt16 _VI_PTR ViPUInt16; -typedef ViUInt16 _VI_PTR ViAUInt16; - -typedef _VI_SIGNED short ViInt16; -typedef ViInt16 _VI_PTR ViPInt16; -typedef ViInt16 _VI_PTR ViAInt16; - -typedef unsigned char ViUInt8; -typedef ViUInt8 _VI_PTR ViPUInt8; -typedef ViUInt8 _VI_PTR ViAUInt8; - -typedef _VI_SIGNED char ViInt8; -typedef ViInt8 _VI_PTR ViPInt8; -typedef ViInt8 _VI_PTR ViAInt8; - -typedef char ViChar; -typedef ViChar _VI_PTR ViPChar; -typedef ViChar _VI_PTR ViAChar; - -typedef unsigned char ViByte; -typedef ViByte _VI_PTR ViPByte; -typedef ViByte _VI_PTR ViAByte; - -typedef void _VI_PTR ViAddr; -typedef ViAddr _VI_PTR ViPAddr; -typedef ViAddr _VI_PTR ViAAddr; - -typedef float ViReal32; -typedef ViReal32 _VI_PTR ViPReal32; -typedef ViReal32 _VI_PTR ViAReal32; - -typedef double ViReal64; -typedef ViReal64 _VI_PTR ViPReal64; -typedef ViReal64 _VI_PTR ViAReal64; - -typedef ViPByte ViBuf; -typedef ViPByte ViPBuf; -typedef ViPByte _VI_PTR ViABuf; - -typedef ViPChar ViString; -typedef ViPChar ViPString; -typedef ViPChar _VI_PTR ViAString; - -typedef ViString ViRsrc; -typedef ViString ViPRsrc; -typedef ViString _VI_PTR ViARsrc; - -typedef ViUInt16 ViBoolean; -typedef ViBoolean _VI_PTR ViPBoolean; -typedef ViBoolean _VI_PTR ViABoolean; - -typedef ViInt32 ViStatus; -typedef ViStatus _VI_PTR ViPStatus; -typedef ViStatus _VI_PTR ViAStatus; - -typedef ViUInt32 ViVersion; -typedef ViVersion _VI_PTR ViPVersion; -typedef ViVersion _VI_PTR ViAVersion; - -typedef ViUInt32 ViObject; -typedef ViObject _VI_PTR ViPObject; -typedef ViObject _VI_PTR ViAObject; - -typedef ViObject ViSession; -typedef ViSession _VI_PTR ViPSession; -typedef ViSession _VI_PTR ViASession; - -typedef ViUInt32 ViAttr; - -#ifndef _VI_CONST_STRING_DEFINED -typedef const ViChar * ViConstString; -#define _VI_CONST_STRING_DEFINED -#endif - -/*- Completion and Error Codes ----------------------------------------------*/ - -#define VI_SUCCESS (0L) - -/*- Other VISA Definitions --------------------------------------------------*/ - -#define VI_NULL (0) - -#define VI_TRUE (1) -#define VI_FALSE (0) - -/*- Backward Compatibility Macros -------------------------------------------*/ - -#define VISAFN _VI_FUNC -#define ViPtr _VI_PTR - -#endif - -/*- The End -----------------------------------------------------------------*/ - -- cgit v1.2.3 From 19591a1ffbeefa552f0d4b868f42f6b4920690ae Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Sat, 4 Jun 2011 16:59:15 +0800 Subject: work in progress to integrate fantom message filtering for nxos Filter Fantom Messages in NxOS usb_isr(). --- Debugger/debug_comm.S | 2 +- Debugger/debug_stub.S | 26 +++++++++++++++++--------- Debugger/debug_stub.h | 2 +- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Debugger/debug_comm.S b/Debugger/debug_comm.S index 821d0c8..3c8e334 100644 --- a/Debugger/debug_comm.S +++ b/Debugger/debug_comm.S @@ -582,7 +582,7 @@ _dbg__comm_readbuf_reset: stmfd sp!, {lr} ldr r0, =debug_InCommBuf mov r1, #USB_BUFSIZE - ldr r2, =nx_usb_read + ldr r2, =nx_usb_fantom_read mov lr, pc bx r2 ldr r1, =debug_nxtMsgLength diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S index 4e26da3..3b1ada9 100644 --- a/Debugger/debug_stub.S +++ b/Debugger/debug_stub.S @@ -480,7 +480,7 @@ debug_armComplexCCTable: .global nxos__handleDebug /* nxos__handleDebug * Prepare to switch to Debug Mode - * int nxos__handleDebug(unsigned char *msg, comm_chan_t channel, long len, void *isrRetAddr); + * int nxos__handleDebug(unsigned char *msg, comm_chan_t channel, long len); * * This routine is called from NxOS Fantom library to setup * Single Step Breakpoint and copy Incoming Message to @@ -490,11 +490,18 @@ debug_armComplexCCTable: * If we're already in Debugger Mode, return False (0) */ nxos__handleDebug: - push {r4, lr} - /* When called, NxOS is in ISR servicing mode (MODE_IRQ) */ - /* R0-R3 has received message related parameters */ - mov r4, r3 /* Keep isrRetAddr in R4 */ + push {r4, r5, lr} + /* When called, NxOS is in Supervisor mode (MODE_SVC), called from nx__irq_handler() + * The IRQ Stack contains the LR and SPSR from the topmost interrupted task + * (NxOS supports nested IRQs) + */ + /* R0-R2 has received message related parameters */ +@@@@@@ + /* Switch to IRQ mode get SPSR to find out how we were called */ + msr cpsr_c, #(MODE_IRQ | IRQ_FIQ_MASK) mrs r3, spsr /* Copy SPSR to r3 */ +@@@@@ FIXME: is this safe? + msr cpsr_c, #(MODE_SVC) /* Return to SVC mode, restore interrupts */ and r3, r3, #CPSR_MODE /* Get previous mode */ teq r3, #MODE_ABT /* Are we in Abort (Debug) mode? */ moveq r0, #FALSE @@ -504,15 +511,16 @@ _nxos_switch2debug: bl dbg__copyNxtDebugMsg /* setup Debugger Message Buffers, validate input, CPSR returned in R0 */ /* Retrieve ISR Return Address */ - mrs r3, spsr /* Copy SPSR to r3 */ - tst r3, #CPSR_THUMB /* Check for Thumb Mode */ - sub r1, r4, #4 /* R3 (isrRetAddr) has PC + 4, need to setup Single Step Breakpoint at PC */ + ldr r3, =__irq_stack__ + ldmedb r3, {r4,r5} /* R4: SPSR, R5: LR */ + tst r4, #CPSR_THUMB /* Check for Thumb Mode */ + mov r1, r5 /* R5 has interrupted instruction address, setup Single Step Breakpoint for it */ orrne r1, r1, #1 /* Configure for Thumb Single Step Breakpoint */ bl _dbg__install_singlestep /* Setup Single Step, next instruction address returned in r1 */ bl _dbg__activate_singlestep mov r0, #TRUE /* We're going to switch to Debug Mode */ exit_nxos__handleDebug: - pop {r4, lr} + pop {r4, r5, lr} mov r1, lr /* Safe code: Thumb mode can't access lr */ bx r1 /* In case we have Interworking from different caller mode */ #endif diff --git a/Debugger/debug_stub.h b/Debugger/debug_stub.h index c5cbeee..4915007 100644 --- a/Debugger/debug_stub.h +++ b/Debugger/debug_stub.h @@ -71,7 +71,7 @@ ENUM_END(comm_chan_t) * !0 if mode switch will happen * Used by NxOS only */ -FUNCDEF int nxos__handleDebug(unsigned char *msg, comm_chan_t channel, long len, void *isrRetAddr); +FUNCDEF int nxos__handleDebug(unsigned char *msg, comm_chan_t channel, long len); #endif #ifndef __NXOS__ -- cgit v1.2.3 From 72f5fe6f092a168d836510a12c5cc9161db867ab Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Sun, 5 Jun 2011 09:16:46 +0800 Subject: use fantom_init to reset incoming message buffer --- Debugger/debug_comm.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Debugger/debug_comm.S b/Debugger/debug_comm.S index 3c8e334..298155b 100644 --- a/Debugger/debug_comm.S +++ b/Debugger/debug_comm.S @@ -582,7 +582,7 @@ _dbg__comm_readbuf_reset: stmfd sp!, {lr} ldr r0, =debug_InCommBuf mov r1, #USB_BUFSIZE - ldr r2, =nx_usb_fantom_read + ldr r2, =fantom_init mov lr, pc bx r2 ldr r1, =debug_nxtMsgLength -- cgit v1.2.3 From 174f4827d5f3f0ad51435efa3c13304c5b47924d Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Mon, 6 Jun 2011 11:02:31 +0800 Subject: work in progress, cleanup nxos support code Zero copy fantom message handling, don't reset fantom_message buffer until message has been examined. --- Debugger/debug_comm.S | 12 ++++++++---- Debugger/debug_stub.S | 30 ++++++++++++++++++------------ 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/Debugger/debug_comm.S b/Debugger/debug_comm.S index 298155b..d96fa22 100644 --- a/Debugger/debug_comm.S +++ b/Debugger/debug_comm.S @@ -577,24 +577,26 @@ dbg__comm_init: str r0, [r1, #NXTCOMMCHANNEL_OFFSET] /* Clear NXT Channel on INIT */ ldmfd sp!, {pc} -_dbg__comm_readbuf_reset: #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 */ bx lr -#endif .global dbg__copyNxtDebugMsg /* dbg__copyNxtDebugMsg @@ -616,6 +618,7 @@ dbg__copyNxtDebugMsg: */ _dbg_memcpy r1, r0, r2, r3 /* r3: scratch register */ bx lr +#endif /* _dbg_reset_msgTxBuf_AppendPtr * Internal variable to reset pointers. @@ -638,7 +641,7 @@ _dbg_reset_msgTxBuf_AppendPtr: _dbg__commHasMsg: stmfd sp!, {lr} #ifdef __NXOS__ - ldr r2, =nx_usb_data_read + 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 */ @@ -662,7 +665,8 @@ _dbg__commHasMsg: b _exit_dbg__commHasMsg invalid_CommMsg: - mov r0, #0 + bl _dbg__comm_readbuf_reset /* Next Comm telegram transaction */ + mov r0, #0 _exit_dbg__commHasMsg: ldmfd sp!, {pc} diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S index 3b1ada9..b102dc1 100644 --- a/Debugger/debug_stub.S +++ b/Debugger/debug_stub.S @@ -483,8 +483,15 @@ debug_armComplexCCTable: * int nxos__handleDebug(unsigned char *msg, comm_chan_t channel, long len); * * This routine is called from NxOS Fantom library to setup - * Single Step Breakpoint and copy Incoming Message to - * Debugger Message Buffers in preparation for Debugger invocation. + * Single Step Breakpoint in preparation for Debugger invocation if we're in + * normal execution mode. + * + * It returns to complete the IRQ handling normally, after which the single + * step breakpoint will be triggered, and the incoming GDB message will then + * be processed in the dbg__bkpt_waitCMD() loop. + * + * If we're in Debugger Mode already, then just return and let the + * dbg__bkpt_waitCMD() loop handle it normally. * * If we're operating in normal NxOS mode, return True (!0) * If we're already in Debugger Mode, return False (0) @@ -492,40 +499,39 @@ debug_armComplexCCTable: nxos__handleDebug: push {r4, r5, lr} /* When called, NxOS is in Supervisor mode (MODE_SVC), called from nx__irq_handler() + * via fantom_filter_packet(). + * * The IRQ Stack contains the LR and SPSR from the topmost interrupted task * (NxOS supports nested IRQs) */ /* R0-R2 has received message related parameters */ -@@@@@@ + /* Switch to IRQ mode get SPSR to find out how we were called */ - msr cpsr_c, #(MODE_IRQ | IRQ_FIQ_MASK) + msr cpsr_c, #(MODE_IRQ | CPSR_FIQ | CPSR_IRQ) mrs r3, spsr /* Copy SPSR to r3 */ -@@@@@ FIXME: is this safe? - msr cpsr_c, #(MODE_SVC) /* Return to SVC mode, restore interrupts */ + msr cpsr_c, #(MODE_SVC) /* Return to SVC mode, restore interrupts */ and r3, r3, #CPSR_MODE /* Get previous mode */ teq r3, #MODE_ABT /* Are we in Abort (Debug) mode? */ moveq r0, #FALSE beq exit_nxos__handleDebug /* Yes, return False */ _nxos_switch2debug: - bl dbg__copyNxtDebugMsg /* setup Debugger Message Buffers, validate input, CPSR returned in R0 */ - /* Retrieve ISR Return Address */ ldr r3, =__irq_stack__ - ldmedb r3, {r4,r5} /* R4: SPSR, R5: LR */ + ldmdb r3, {r4,r5} /* R4: SPSR, R5: LR */ tst r4, #CPSR_THUMB /* Check for Thumb Mode */ mov r1, r5 /* R5 has interrupted instruction address, setup Single Step Breakpoint for it */ orrne r1, r1, #1 /* Configure for Thumb Single Step Breakpoint */ bl _dbg__install_singlestep /* Setup Single Step, next instruction address returned in r1 */ bl _dbg__activate_singlestep - mov r0, #TRUE /* We're going to switch to Debug Mode */ + mov r0, #TRUE /* We're going to switch to Debug Mode (via Single Step Breakpoint) */ exit_nxos__handleDebug: pop {r4, r5, lr} mov r1, lr /* Safe code: Thumb mode can't access lr */ bx r1 /* In case we have Interworking from different caller mode */ -#endif -#ifndef __NXOS__ +#else + /**************************************************************************** * * GDB Debugger Invocation Routine for NXT Firmware -- cgit v1.2.3 From 9ac83aa9bc7071a9dc997b841f1d325e5949da82 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Wed, 8 Jun 2011 12:56:30 +0800 Subject: update python paths for nxt-python with fantom support --- Host/nxt-gdb-server.py | 4 ++-- Host/pyenv-nxt-gdb-server | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Host/nxt-gdb-server.py b/Host/nxt-gdb-server.py index a4ea2ad..1a87793 100755 --- a/Host/nxt-gdb-server.py +++ b/Host/nxt-gdb-server.py @@ -20,7 +20,7 @@ import socket import optparse import select #import usb -import nxt.pyfantom +import pyfantom import struct CTRLC = chr(3) @@ -134,7 +134,7 @@ class NXTGDBServer: s.bind (('', self.port)) s.listen (1) # Open connection to the NXT brick. - brick = nxt.locator.find_one_brick () + brick = nxt.locator.find_one_brick (method=nxt.Method(usb=False, bluetooth=False, fantomusb=True, fantombt=False)) brick.sock.debug = DEBUG print "Waiting for GDB connection on port %s..." % self.port while True: diff --git a/Host/pyenv-nxt-gdb-server b/Host/pyenv-nxt-gdb-server index 12dac80..b98c2d8 100755 --- a/Host/pyenv-nxt-gdb-server +++ b/Host/pyenv-nxt-gdb-server @@ -1,3 +1,3 @@ #!/bin/sh -export PYTHONPATH=~/gitrepo/armdebug/nxt-python-fantom +export PYTHONPATH=~/svnrepo/nxt-python:~/gitrepo/pyfantom arch -i386 /usr/bin/python2.6 ~/gitrepo/armdebug/Host/nxt-gdb-server.py -- cgit v1.2.3 From bace9cc5636552fe67216fab77a6536ee0edc90f Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Wed, 8 Jun 2011 12:57:26 +0800 Subject: fix bug in activate_one_breakpoint where it is clearing the breakpoint instruction --- Debugger/debug_stub.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S index b102dc1..9c69ce7 100644 --- a/Debugger/debug_stub.S +++ b/Debugger/debug_stub.S @@ -2908,7 +2908,7 @@ _nx_is_arm_bp: teq r2, r3 /* check that the two instructions are identical */ bne _dbg__breakpoint_invalid_arm ldr r2, =BKPT32_INSTR /* ARM BKPT instruction */ - and r2, r2, r0 /* Merge Breakpoint index */ + orr r2, r2, r0 /* Merge Breakpoint index */ str r2, [r1] /* Store it into memory location */ _dbg__breakpoint_invalid_arm: bx lr @@ -2918,7 +2918,7 @@ _nx_is_thumb_bp: teq r2, r3 /* check that the two instructions are identical */ bne _dbg__breakpoint_invalid_thumb ldr r2, =BKPT16_INSTR /* Thumb BKPT instruction */ - and r2, r2, r0 /* Merge Breakpoint index */ + orr r2, r2, r0 /* Merge Breakpoint index */ strh r2, [r1] /* Store it into memory location */ _dbg__breakpoint_invalid_thumb: bx lr -- cgit v1.2.3 From 1846d7661b7c8c0eeeee4f8de837f5e5d158043d Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Wed, 8 Jun 2011 13:44:47 +0800 Subject: removed extraneous call to restore_single_step --- Debugger/debug_stub.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S index 9c69ce7..d374cbe 100644 --- a/Debugger/debug_stub.S +++ b/Debugger/debug_stub.S @@ -662,8 +662,8 @@ dbg__arm_bkpt_handler: /* b _process_normal_breakpoint */ _process_normal_breakpoint: - bl _dbg__restore_breakpoints - bl _dbg__restore_singlestep + bl _dbg__restore_breakpoints /* includes restoring single step */ +/* bl _dbg__restore_singlestep */ bl _dbg__clear_singlestep bl _dbg__flush_icache b dbg__bkpt_waitCMD -- cgit v1.2.3 From f5e933a0d0912f25dc342a4f658f3910d34aef24 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Mon, 13 Jun 2011 08:53:18 +0800 Subject: disable interrupts when switching from undef handler to debugger NxOS has nested interrupts support. Prevent accidental retriggering of UNDEF handler while processing an existing breakpoint by disabling interrupts until the breakpoint has been restored and the debugger is really ready to handle debug messages. --- Debugger/debug_stub.S | 2 ++ Debugger/undef_handler.S | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S index d374cbe..aaf1c85 100644 --- a/Debugger/debug_stub.S +++ b/Debugger/debug_stub.S @@ -720,6 +720,8 @@ dbg__bkpt_offset_outofrange: dbg__bkpt_waitCMD: /* We enter this code section when a Breakpoint Triggers */ _dbg_setmode TRUE /* Debug Mode = True */ + msr cpsr_c, #(MODE_ABT) /* Re-enable Interrupts */ + _dbg_getstate r0 cmp r0, #DBG_CONFIGURED blo dbg__bkpt_waitCMD_cont /* Not configured yet, don't send Breakpoint Signal Response */ diff --git a/Debugger/undef_handler.S b/Debugger/undef_handler.S index f185fbd..11d3cbc 100644 --- a/Debugger/undef_handler.S +++ b/Debugger/undef_handler.S @@ -100,8 +100,8 @@ _is_arm: ldr r2, =dbg__arm_bkpt_handler /* handle BKPT, BKPT index in r0 */ _exit_undef_handler: and r0, r1, r0 /* Keep index value */ - msr cpsr_c, #(MODE_ABT) /* Configure Abort Mode */ - mov pc, r2 /* Invoke Debugger State (Supervisor Mode) */ + msr cpsr_c, #(MODE_ABT | CPSR_FIQ | CPSR_IRQ) /* Switch to Abort Mode, Disable Interrupts */ + mov pc, r2 /* Invoke Debugger */ .global resume_execution -- cgit v1.2.3 From 20d54ca27076e7b253dcf97a26fadf131e3c0acd Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Mon, 13 Jun 2011 15:18:05 +0800 Subject: fix comment for thumb breakpoint macro --- Debugger/debug_stub.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Debugger/debug_stub.h b/Debugger/debug_stub.h index 4915007..f75b95b 100644 --- a/Debugger/debug_stub.h +++ b/Debugger/debug_stub.h @@ -138,7 +138,7 @@ static inline void dbg_breakpoint_thumb(void) { asm volatile (".hword 0xBE7F" /* .word (BKPT32_INSTR | BKPT32_MANUAL_BKPT) .endm -/* dbg__bkpt_arm +/* dbg__bkpt_thumb * GDB breakpoint() for Thumb mode */ .macro dbg__bkpt_thumb -- cgit v1.2.3 From 13a5de61eb0044105f9ba77397579e9886b406d6 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Mon, 13 Jun 2011 15:20:09 +0800 Subject: commented out redundant instruction in breakpoint processing logic --- Debugger/debug_stub.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S index aaf1c85..b7c1253 100644 --- a/Debugger/debug_stub.S +++ b/Debugger/debug_stub.S @@ -621,7 +621,7 @@ _dbg__flush_icache: */ dbg__thumb_bkpt_handler: /* On entry, r0 contains breakpoint index value */ - mov r4, #BKPT16_AUTO_BKPT + /* mov r4, #BKPT16_AUTO_BKPT Redundant?! */ and r4, r0, #BKPT16_AUTO_BKPT /* keep AUTO flag value in r4 */ bic r0, r0, #BKPT16_AUTO_BKPT /* mask out AUTO flag */ _dbg_setcurrbkpt_index r0 /* keep current breakpoint index in memory */ @@ -644,7 +644,7 @@ dbg__thumb_bkpt_handler: */ dbg__arm_bkpt_handler: /* On entry, r0 contains breakpoint index value */ - mov r4, #BKPT32_AUTO_BKPT + /* mov r4, #BKPT32_AUTO_BKPT Redundant?! */ and r4, r0, #BKPT32_AUTO_BKPT /* keep AUTO flag value in r4 */ bic r0, r0, #BKPT32_AUTO_BKPT /* mask out AUTO flag */ _dbg_setcurrbkpt_index r0 /* keep current breakpoint index in memory */ -- cgit v1.2.3 From cda5e33778749ea8e4a720af66b66fba7ee912ae Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Tue, 14 Jun 2011 13:40:52 +0800 Subject: moved hex conversion routines to its own source file --- Debugger/debug_comm.S | 434 ------------------------------------------- Debugger/debug_hexutils.S | 457 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 457 insertions(+), 434 deletions(-) create mode 100644 Debugger/debug_hexutils.S diff --git a/Debugger/debug_comm.S b/Debugger/debug_comm.S index d96fa22..baab7b7 100644 --- a/Debugger/debug_comm.S +++ b/Debugger/debug_comm.S @@ -61,443 +61,9 @@ debug_nxtCommChannel: nxt_commcmd_header: .byte NXT_GDBMSG_TELEGRAMTYPE, 0x00, 0x00 /* padded to 3 bytes */ -hex2char_lut: - .ascii "0123456789ABCDEF" - -/* Macros - */ - - -/* _hex2char_lut - * Internal routine to intialize the LUT address pointer - */ - .macro _hex2char_lut addrptr - ldr \addrptr, =hex2char_lut - .endm - -/* _hex2char_cont - * Internal routine that assumes that the LUT has been loaded. - * This macro accepts a byte sized hex value as a parameter register(7:0) and returns the - * ASCII equivalent in in the same register(7:0) - * The second parameter is the LUT address pointer register to use (assumed to be initialized) - * WARNING: Assumes that the value in register is sanity checked before invoking macro - */ - .macro _hex2char_cont reg, addrptr - ldrb \reg, [\addrptr, \reg] - .endm - -/* _hex2char - * This macro accepts a byte sized hex value as a parameter register(7:0) and returns the - * ASCII equivalent in in the same register(7:0) - * The second parameter is the LUT address pointer register to use (register content is destroyed) - * WARNING: Assumes that the value in register is sanity checked before invoking macro - */ - .macro _hex2char reg, addrptr - _hex2char_lut \addrptr - _hex2char_cont \reg, \addrptr - .endm - -/* _char2hex - * This macro accepts an ASCII char as a parameter register(7:0) and returns the - * equivalent byte sized hex value in in the same register(7:0) - * WARNING: Assumes that the char in register is a valid hex char before invoking macro - */ - .macro _char2hex reg - cmp \reg, #'A' /* If Alpha */ - bichs \reg, \reg, #ASCII_LOWER2UPPER_MASK /* Convert to Uppercase */ - subhs \reg, \reg, #7 /* Adjustment to allow for subtraction with 0x30 */ - sub \reg, \reg, #0x30 /* get final hex value */ - .endm - - .code 32 .text .align 4 - - -/* Utility Routines - * GDB requires command parameters to be specified as Big Endian values. - * However, the read/write register command expect the register contents to be specified in target byte order. - * Hence we need both versions of multibyte conversion routines for word sized values. - */ - -/* hex2char - * This routine accepts a byte sized hex value in R0(7:0) and returns the - * ASCII equivalent in R0(7:0) - */ - .global hex2char - -hex2char: - stmfd sp!, {r1,lr} - and r0, #NIBBLE0 /* make sure that input is sane */ - _hex2char r0, r1 - ldmfd sp!, {r1,pc} - -/* char2hex - * This routine accepts an ASCII character in R0(7:0) and returns the - * equivalent byte sized hex value in R0(7:0). - * It accepts lowercase and uppercase ASCII Hex char inputs. - * Invalid inputs return -1 as the value -* On entry: - * R0: ASCII character - * On exit: - * R0: Hex value - */ - .global char2hex - -char2hex: - and r0, r0, #BYTE0 /* make sure that input is sane */ - cmp r0, #'0' - blo char2hex_error - cmp r0, #'9' - bls perform_char2hex - cmp r0, #'A' - blo char2hex_error - cmp r0, #'F' - bls perform_char2hex - cmp r0, #'a' - blo char2hex_error - cmp r0, #'f' - bhi char2hex_error - /* Validated Hex Char */ -perform_char2hex: - _char2hex r0 /* Return hex value in R0 */ - bx lr - -char2hex_error: - mov r0, #-1 /* Set Return value to Error value */ - bx lr - -/* byte2ascii_cont - * (Shared routine, does not perform sanity checks) - * On entry: - * R0: ASCII buffer pointer - * R1[7:0]: byte value - * On exit: - * R0: Address of next empty char slot in buffer - * R1: Destroyed - * - * This routine accepts an ASCII buffer pointer in R0 and a byte value in R1, - * and stores the ASCII equivalent byte value in the buffer pointed to by R0. - * Note: On return, R0 points to next empty char slot in buffer - */ -byte2ascii_cont: - stmfd sp!, {r2,r3,r4, lr} - lsl r2, r1, #24 /* Keep copy of input byte value R1[7:0], shifted to MSB R2[31:24] */ - mov r4, #2 /* Loop counter */ - _hex2char_lut r3 /* initialize LUT pointer */ -1: ror r2, r2, #28 /* Rotate MSNibble R2[31:28] into LSNibble position R2[3:0] */ - and r1, r2, #NIBBLE0 /* Mask out everything else, store Nibble in R1 */ - _hex2char_cont r1, r3 /* Convert nibble to ASCII char */ - strb r1, [r0], #1 - subs r4, r4, #1 /* decrement loop counter */ - bne 1b - ldmfd sp!, {r2,r3,r4, pc} - -/* byte2ascii - * On entry: - * R0: ASCII buffer pointer - * R1[7:0]: Byte value - * On exit: - * R0: Address of next empty char slot in buffer - * R1: Original Address of Buffer - * - * This routine accepts an ASCII buffer pointer in R0 and a byte value in R1, - * and stores the ASCII equivalent byte value in the buffer pointed to by R0. - * Note: On return, R0 points to the next empty char slot in buffer - */ - .global byte2ascii - -byte2ascii: - stmfd sp!, {r0, lr} /* Keep ASCII buffer pointer */ - and r1, #BYTE0 /* sanitize input */ - bl byte2ascii_cont - ldmfd sp!, {r1, pc} /* return original string pointer in R1 */ - -/* halfword2ascii_be - * Big Endian version of halfword2ascii conversion routine - * On entry: - * R0: ASCII buffer pointer - * R1[15:0]: Halfword value - * On exit: - * R0: Address of next empty char slot in buffer - * R1: Original Address of Buffer - * - * This routine accepts an ASCII buffer pointer in R0 and a halfword value in R1, - * and stores the ASCII equivalent halfword value in the buffer pointed to by R0. - * Note: On return, R0 points to the next empty char slot in buffer - */ - .global halfword2ascii_be -halfword2ascii_be: - stmfd sp!, {r0,r2,r3, lr} /* Keep ASCII buffer pointer */ - mov r3, #2 /* Loop Counter */ - mov r2, r1, lsl #16 /* copy of input halfword value R1[15:0], shifted to MSH R2[31:16] */ - b _conv_byte2ascii_be /* goto Byte conversion loop */ - -/* halfword2ascii_le - * Little Endian version of halfword2ascii conversion routine - * On entry: - * R0: ASCII buffer pointer - * R1[15:0]: Halfword value - * On exit: - * R0: Address of next empty char slot in buffer - * R1: Original Address of Buffer - * - * This routine accepts an ASCII buffer pointer in R0 and a halfword value in R1, - * and stores the ASCII equivalent halfword value in the buffer pointed to by R0. - * Note: On return, R0 points to the next empty char slot in buffer - */ - .global halfword2ascii_le -halfword2ascii_le: - stmfd sp!, {r0,r2,r3, lr} /* Keep ASCII buffer pointer */ - mov r3, #2 /* Loop Counter */ - b _conv_byte2ascii_le /* goto Byte conversion loop */ - - -/* word2ascii_be - * Big Endian version of word2ascii conversion routine - * On entry: - * R0: ASCII buffer pointer - * R1[31:0]: Word value - * On exit: - * R0: Address of next empty char slot in buffer - * R1: Original Address of Buffer - * - * This routine accepts an ASCII buffer pointer in R0 and a word value in R1, - * and stores the ASCII equivalent word value in the buffer pointed to by R0. - * Note: On return, R0 points to the next empty char slot in buffer - */ - .global word2ascii_be -word2ascii_be: - stmfd sp!, {r0,r2,r3, lr} /* Keep ASCII buffer pointer */ - mov r2, r1 /* copy of input word value R1[31:0] */ - mov r3, #4 /* Loop Counter */ - - /* Fall through to byte coversion loop */ - - -/* Big Endian Multibyte Convert: Rotate then convert */ -_conv_byte2ascii_be: - ror r2, r2, #24 /* Rotate MSB R2[31:24] into LSB position R2[7:0] */ - and r1, r2, #BYTE0 /* Copy byte value in R2[7:0] into R1 */ - bl byte2ascii_cont /* R0: next ASCII buffer location pointer, R1: destroyed */ - subs r3, r3, #1 - bne _conv_byte2ascii_be - ldmfd sp!, {r1,r2,r3, pc} - -/* word2ascii_le - * Little Endian version of word2ascii conversion routine - * On entry: - * R0: ASCII buffer pointer - * R1[31:0]: Word value - * On exit: - * R0: Address of next empty char slot in buffer - * R1: Original Address of Buffer - * - * This routine accepts an ASCII buffer pointer in R0 and a word value in R1, - * and stores the ASCII equivalent word value in the buffer pointed to by R0. - * Note: On return, R0 points to the next empty char slot in buffer - */ - .global word2ascii_le -word2ascii_le: - stmfd sp!, {r0,r2,r3, lr} /* Keep ASCII buffer pointer */ - mov r2, r1 /* copy of input word value R1[31:0] */ - mov r3, #4 /* Loop Counter */ - - /* Fall through to byte coversion loop */ - -/* Little Endian Multibyte Convert: Convert then rotate */ -_conv_byte2ascii_le: - and r1, r2, #BYTE0 /* Copy byte value in R2[7:0] into R1 */ - bl byte2ascii_cont /* R0: next ASCII buffer location pointer, R1: destroyed */ - ror r2, r2, #8 /* Rotate LSB+1 R2[15:8] into LSB position R2[7:0] */ - subs r3, r3, #1 - bne _conv_byte2ascii_le - ldmfd sp!, {r1,r2,r3, pc} - - -/* ascii2hex_varlen_be - * Big Endian version of ascii2hex_varlen conversion routine - * (There is no Little Endian Version) - * On entry: - * R0: ASCII buffer pointer - * On exit: - * R0: Hex value - * R1: Address of next char slot in buffer - * - * This routine accepts an ASCII buffer pointer in R0, - * and returns the hex value in R0 for up to 8 Hex characters. - * Note: On return, R1 points to the ASCII buffer location after the hex value chars. - */ - .global ascii2hex_varlen_be - -ascii2hex_varlen_be: - stmfd sp!, {r2,r3, lr} - mov r3, #CMD_REG_REGPARAMLEN /* Set max count to 8 (Max Register size) */ - mov r1, r0 /* Use R1 as ASCII buffer pointer */ - mov r2, #0 /* Initialize Cummulative Results */ -2: ldrb r0, [r1] /* Load ASCII char for Hex Value */ - bl char2hex /* on return, hex value in R0, -1 for error */ - cmp r0, #-1 - beq _exit_ascii2hex_varlen - orr r2, r0, r2, lsl #4 /* combined byte value */ - subs r3, r3, #1 /* Decrement Counter */ - add r1, r1, #1 /* Go to next char slot */ - bne 2b -_exit_ascii2hex_varlen: - mov r0, r2 /* Return results in R0 */ - ldmfd sp!, {r2,r3, pc} - - -/* ascii2byte - * On entry: - * R0: ASCII buffer pointer - * On exit: - * R0[7:0]: Byte value - * R1: Address of next char slot in buffer - * - * This routine accepts an ASCII buffer pointer in R0, - * and returns the byte value in R0[7:0]. - * Note: On return, R1 points to the ASCII buffer location after the current 2 chars. - * WARNING: This routine assumes that the input buffer was sanitized and contains valid Hex chars, - * otherwise it will return invalid results. - */ - .global ascii2byte - -ascii2byte: - stmfd sp!, {r2, lr} - mov r1, r0 /* Use R1 as ASCII buffer pointer */ - ldrb r0, [r1], #1 /* Load ASCII char for MSN */ - bl char2hex /* on return, hex value in R0, -1 for error (ignored) */ - mov r2, r0, lsl #4 /* Intermediate Results register */ - ldrb r0, [r1], #1 /* Load ASCII char for LSN */ - bl char2hex /* on return, hex value in R0, -1 for error (ignored) */ - orr r0, r2, r0 /* combined byte value */ - ldmfd sp!, {r2, pc} - -/* ascii2halfword_be - * Big Endian version of ascii2halfword conversion routine - * On entry: - * R0: ASCII buffer pointer - * On exit: - * R0[15:0]: Halfword value - * R1: Address of next char slot in buffer - * - * This routine accepts an ASCII buffer pointer in R0, - * and returns the Halfword value in R0[15:0]. - * Note: On return, R1 points to the ASCII buffer location after the current 4 chars. - * WARNING: This routine assumes that the input buffer was sanitized and contains valid Hex chars, - * otherwise it will return invalid results. - */ - .global ascii2halfword_be - -ascii2halfword_be: - stmfd sp!, {r2,r3, lr} - mov r3, #2 /* Loop counter */ - b _conv_ascii2byte_be - -/* ascii2halfword_le - * Little Endian version of ascii2halfword conversion routine - * On entry: - * R0: ASCII buffer pointer - * On exit: - * R0[15:0]: Halfword value - * R1: Address of next char slot in buffer - * - * This routine accepts an ASCII buffer pointer in R0, - * and returns the Halfword value in R0[15:0]. - * Note: On return, R1 points to the ASCII buffer location after the current 4 chars. - * WARNING: This routine assumes that the input buffer was sanitized and contains valid Hex chars, - * otherwise it will return invalid results. - */ - .global ascii2halfword_le - -ascii2halfword_le: - stmfd sp!, {r2,r3, lr} - mov r3, #2 /* Loop counter */ - b _conv_ascii2byte_le - - -/* ascii2word_be - * Big Endian version of ascii2word conversion routine - * On entry: - * R0: ASCII buffer pointer - * On exit: - * R0[31:0]: Word value - * R1: Address of next char slot in buffer - * - * This routine accepts an ASCII buffer pointer in R0, - * and returns the word value in R0[31:0]. - * Note: On return, R1 points to the ASCII buffer location after the current 8 chars. - * WARNING: This routine assumes that the input buffer was sanitized and contains valid Hex chars, - * otherwise it will return invalid results. - */ - .global ascii2word_be - -ascii2word_be: - stmfd sp!, {r2,r3, lr} - mov r3, #4 /* Loop counter */ - - /* Fall through to byte coversion loop */ - -_conv_ascii2byte_be: - teq r0, #0 - beq _exit_conv_ascii2byte_be /* exit if NULL pointer in R0 */ - mov r2, #0 /* Initialize Cummulative value */ -2: bl ascii2byte - orr r2, r0, r2, lsl #8 /* Merge current byte with cummulative value */ - mov r0, r1 /* Copy next char pointer to R0 for next byte */ - subs r3, r3, #1 - bne 2b - mov r0, r2 /* Copy it to R0 as return value */ - -_exit_conv_ascii2byte_be: - ldmfd sp!, {r2,r3, pc} /* return hex value in R0 */ - -/* ascii2word_le - * Litle Endian version of ascii2word conversion routine - * On entry: - * R0: ASCII buffer pointer - * On exit: - * R0[31:0]: Word value - * R1: Address of next char slot in buffer - * - * This routine accepts an ASCII buffer pointer in R0, - * and returns the word value in R0[31:0]. - * Note: On return, R1 points to the ASCII buffer location after the current 8 chars. - * WARNING: This routine assumes that the input buffer was sanitized and contains valid Hex chars, - * otherwise it will return invalid results. - */ - .global ascii2word_le - -ascii2word_le: - stmfd sp!, {r2,r3, lr} - mov r3, #4 /* Loop counter */ - - /* Fall through to byte coversion loop */ - -_conv_ascii2byte_le: - teq r0, #0 - beq _exit_conv_ascii2byte_le /* exit if NULL pointer in R0 */ - push {r3} /* Need to keep couter for final value adjustment */ - mov r2, #0 /* Initialize Cummulative value */ -2: bl ascii2byte - orr r2, r0, r2, ror #8 /* Merge current byte with cummulative value */ - mov r0, r1 /* Copy next char pointer to R0 for next byte */ - subs r3, r3, #1 - bne 2b - /* Cummulative value done, need to rotate it into the correct position for return value */ - pop {r3} /* retrieve counter */ - rsb r3, r3, #5 /* 5 - count */ - lsl r3, r3, #3 /* [(5-count) x 8] bits to rotate */ - mov r0, r2, ror r3 /* Copy it to R0 as return value */ - -_exit_conv_ascii2byte_le: - ldmfd sp!, {r2,r3, pc} /* return hex value in R0 */ - - - - /* Debugger Communications Routines * It does not make sense to pass information from the Debugger Module to the Comm. link one character * at a time, especially if we're not using a native serial interface (e.g., EIA-232). Consequently diff --git a/Debugger/debug_hexutils.S b/Debugger/debug_hexutils.S new file mode 100644 index 0000000..d54445b --- /dev/null +++ b/Debugger/debug_hexutils.S @@ -0,0 +1,457 @@ +/** @file debug_hexutils.S + * @brief GDB hexadecimal conversion utility routines + * + */ + +/* 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 + * + */ + + +#define __ASSEMBLY__ + +#include "debug_internals.h" + +.data +.align 4 + +hex2char_lut: + .ascii "0123456789ABCDEF" + +/* Macros + */ + + +/* _hex2char_lut + * Internal routine to intialize the LUT address pointer + */ + .macro _hex2char_lut addrptr + ldr \addrptr, =hex2char_lut + .endm + +/* _hex2char_cont + * Internal routine that assumes that the LUT has been loaded. + * This macro accepts a byte sized hex value as a parameter register(7:0) and returns the + * ASCII equivalent in in the same register(7:0) + * The second parameter is the LUT address pointer register to use (assumed to be initialized) + * WARNING: Assumes that the value in register is sanity checked before invoking macro + */ + .macro _hex2char_cont reg, addrptr + ldrb \reg, [\addrptr, \reg] + .endm + +/* _hex2char + * This macro accepts a byte sized hex value as a parameter register(7:0) and returns the + * ASCII equivalent in in the same register(7:0) + * The second parameter is the LUT address pointer register to use (register content is destroyed) + * WARNING: Assumes that the value in register is sanity checked before invoking macro + */ + .macro _hex2char reg, addrptr + _hex2char_lut \addrptr + _hex2char_cont \reg, \addrptr + .endm + +/* _char2hex + * This macro accepts an ASCII char as a parameter register(7:0) and returns the + * equivalent byte sized hex value in in the same register(7:0) + * WARNING: Assumes that the char in register is a valid hex char before invoking macro + */ + .macro _char2hex reg + cmp \reg, #'A' /* If Alpha */ + bichs \reg, \reg, #ASCII_LOWER2UPPER_MASK /* Convert to Uppercase */ + subhs \reg, \reg, #7 /* Adjustment to allow for subtraction with 0x30 */ + sub \reg, \reg, #0x30 /* get final hex value */ + .endm + + +.code 32 +.text +.align 4 + + +/* Utility Routines + * GDB requires command parameters to be specified as Big Endian values. + * However, the read/write register command expect the register contents to be specified in target byte order. + * Hence we need both versions of multibyte conversion routines for word sized values. + */ + +/* hex2char + * This routine accepts a byte sized hex value in R0(7:0) and returns the + * ASCII equivalent in R0(7:0) + */ + .global hex2char + +hex2char: + stmfd sp!, {r1,lr} + and r0, #NIBBLE0 /* make sure that input is sane */ + _hex2char r0, r1 + ldmfd sp!, {r1,pc} + +/* char2hex + * This routine accepts an ASCII character in R0(7:0) and returns the + * equivalent byte sized hex value in R0(7:0). + * It accepts lowercase and uppercase ASCII Hex char inputs. + * Invalid inputs return -1 as the value +* On entry: + * R0: ASCII character + * On exit: + * R0: Hex value + */ + .global char2hex + +char2hex: + and r0, r0, #BYTE0 /* make sure that input is sane */ + cmp r0, #'0' + blo char2hex_error + cmp r0, #'9' + bls perform_char2hex + cmp r0, #'A' + blo char2hex_error + cmp r0, #'F' + bls perform_char2hex + cmp r0, #'a' + blo char2hex_error + cmp r0, #'f' + bhi char2hex_error + /* Validated Hex Char */ +perform_char2hex: + _char2hex r0 /* Return hex value in R0 */ + bx lr + +char2hex_error: + mov r0, #-1 /* Set Return value to Error value */ + bx lr + +/* byte2ascii_cont + * (Shared routine, does not perform sanity checks) + * On entry: + * R0: ASCII buffer pointer + * R1[7:0]: byte value + * On exit: + * R0: Address of next empty char slot in buffer + * R1: Destroyed + * + * This routine accepts an ASCII buffer pointer in R0 and a byte value in R1, + * and stores the ASCII equivalent byte value in the buffer pointed to by R0. + * Note: On return, R0 points to next empty char slot in buffer + */ +byte2ascii_cont: + stmfd sp!, {r2,r3,r4, lr} + lsl r2, r1, #24 /* Keep copy of input byte value R1[7:0], shifted to MSB R2[31:24] */ + mov r4, #2 /* Loop counter */ + _hex2char_lut r3 /* initialize LUT pointer */ +1: ror r2, r2, #28 /* Rotate MSNibble R2[31:28] into LSNibble position R2[3:0] */ + and r1, r2, #NIBBLE0 /* Mask out everything else, store Nibble in R1 */ + _hex2char_cont r1, r3 /* Convert nibble to ASCII char */ + strb r1, [r0], #1 + subs r4, r4, #1 /* decrement loop counter */ + bne 1b + ldmfd sp!, {r2,r3,r4, pc} + +/* byte2ascii + * On entry: + * R0: ASCII buffer pointer + * R1[7:0]: Byte value + * On exit: + * R0: Address of next empty char slot in buffer + * R1: Original Address of Buffer + * + * This routine accepts an ASCII buffer pointer in R0 and a byte value in R1, + * and stores the ASCII equivalent byte value in the buffer pointed to by R0. + * Note: On return, R0 points to the next empty char slot in buffer + */ + .global byte2ascii + +byte2ascii: + stmfd sp!, {r0, lr} /* Keep ASCII buffer pointer */ + and r1, #BYTE0 /* sanitize input */ + bl byte2ascii_cont + ldmfd sp!, {r1, pc} /* return original string pointer in R1 */ + +/* halfword2ascii_be + * Big Endian version of halfword2ascii conversion routine + * On entry: + * R0: ASCII buffer pointer + * R1[15:0]: Halfword value + * On exit: + * R0: Address of next empty char slot in buffer + * R1: Original Address of Buffer + * + * This routine accepts an ASCII buffer pointer in R0 and a halfword value in R1, + * and stores the ASCII equivalent halfword value in the buffer pointed to by R0. + * Note: On return, R0 points to the next empty char slot in buffer + */ + .global halfword2ascii_be +halfword2ascii_be: + stmfd sp!, {r0,r2,r3, lr} /* Keep ASCII buffer pointer */ + mov r3, #2 /* Loop Counter */ + mov r2, r1, lsl #16 /* copy of input halfword value R1[15:0], shifted to MSH R2[31:16] */ + b _conv_byte2ascii_be /* goto Byte conversion loop */ + +/* halfword2ascii_le + * Little Endian version of halfword2ascii conversion routine + * On entry: + * R0: ASCII buffer pointer + * R1[15:0]: Halfword value + * On exit: + * R0: Address of next empty char slot in buffer + * R1: Original Address of Buffer + * + * This routine accepts an ASCII buffer pointer in R0 and a halfword value in R1, + * and stores the ASCII equivalent halfword value in the buffer pointed to by R0. + * Note: On return, R0 points to the next empty char slot in buffer + */ + .global halfword2ascii_le +halfword2ascii_le: + stmfd sp!, {r0,r2,r3, lr} /* Keep ASCII buffer pointer */ + mov r3, #2 /* Loop Counter */ + b _conv_byte2ascii_le /* goto Byte conversion loop */ + + +/* word2ascii_be + * Big Endian version of word2ascii conversion routine + * On entry: + * R0: ASCII buffer pointer + * R1[31:0]: Word value + * On exit: + * R0: Address of next empty char slot in buffer + * R1: Original Address of Buffer + * + * This routine accepts an ASCII buffer pointer in R0 and a word value in R1, + * and stores the ASCII equivalent word value in the buffer pointed to by R0. + * Note: On return, R0 points to the next empty char slot in buffer + */ + .global word2ascii_be +word2ascii_be: + stmfd sp!, {r0,r2,r3, lr} /* Keep ASCII buffer pointer */ + mov r2, r1 /* copy of input word value R1[31:0] */ + mov r3, #4 /* Loop Counter */ + + /* Fall through to byte coversion loop */ + + +/* Big Endian Multibyte Convert: Rotate then convert */ +_conv_byte2ascii_be: + ror r2, r2, #24 /* Rotate MSB R2[31:24] into LSB position R2[7:0] */ + and r1, r2, #BYTE0 /* Copy byte value in R2[7:0] into R1 */ + bl byte2ascii_cont /* R0: next ASCII buffer location pointer, R1: destroyed */ + subs r3, r3, #1 + bne _conv_byte2ascii_be + ldmfd sp!, {r1,r2,r3, pc} + +/* word2ascii_le + * Little Endian version of word2ascii conversion routine + * On entry: + * R0: ASCII buffer pointer + * R1[31:0]: Word value + * On exit: + * R0: Address of next empty char slot in buffer + * R1: Original Address of Buffer + * + * This routine accepts an ASCII buffer pointer in R0 and a word value in R1, + * and stores the ASCII equivalent word value in the buffer pointed to by R0. + * Note: On return, R0 points to the next empty char slot in buffer + */ + .global word2ascii_le +word2ascii_le: + stmfd sp!, {r0,r2,r3, lr} /* Keep ASCII buffer pointer */ + mov r2, r1 /* copy of input word value R1[31:0] */ + mov r3, #4 /* Loop Counter */ + + /* Fall through to byte coversion loop */ + +/* Little Endian Multibyte Convert: Convert then rotate */ +_conv_byte2ascii_le: + and r1, r2, #BYTE0 /* Copy byte value in R2[7:0] into R1 */ + bl byte2ascii_cont /* R0: next ASCII buffer location pointer, R1: destroyed */ + ror r2, r2, #8 /* Rotate LSB+1 R2[15:8] into LSB position R2[7:0] */ + subs r3, r3, #1 + bne _conv_byte2ascii_le + ldmfd sp!, {r1,r2,r3, pc} + + +/* ascii2hex_varlen_be + * Big Endian version of ascii2hex_varlen conversion routine + * (There is no Little Endian Version) + * On entry: + * R0: ASCII buffer pointer + * On exit: + * R0: Hex value + * R1: Address of next char slot in buffer + * + * This routine accepts an ASCII buffer pointer in R0, + * and returns the hex value in R0 for up to 8 Hex characters. + * Note: On return, R1 points to the ASCII buffer location after the hex value chars. + */ + .global ascii2hex_varlen_be + +ascii2hex_varlen_be: + stmfd sp!, {r2,r3, lr} + mov r3, #CMD_REG_REGPARAMLEN /* Set max count to 8 (Max Register size) */ + mov r1, r0 /* Use R1 as ASCII buffer pointer */ + mov r2, #0 /* Initialize Cummulative Results */ +2: ldrb r0, [r1] /* Load ASCII char for Hex Value */ + bl char2hex /* on return, hex value in R0, -1 for error */ + cmp r0, #-1 + beq _exit_ascii2hex_varlen + orr r2, r0, r2, lsl #4 /* combined byte value */ + subs r3, r3, #1 /* Decrement Counter */ + add r1, r1, #1 /* Go to next char slot */ + bne 2b +_exit_ascii2hex_varlen: + mov r0, r2 /* Return results in R0 */ + ldmfd sp!, {r2,r3, pc} + + +/* ascii2byte + * On entry: + * R0: ASCII buffer pointer + * On exit: + * R0[7:0]: Byte value + * R1: Address of next char slot in buffer + * + * This routine accepts an ASCII buffer pointer in R0, + * and returns the byte value in R0[7:0]. + * Note: On return, R1 points to the ASCII buffer location after the current 2 chars. + * WARNING: This routine assumes that the input buffer was sanitized and contains valid Hex chars, + * otherwise it will return invalid results. + */ + .global ascii2byte + +ascii2byte: + stmfd sp!, {r2, lr} + mov r1, r0 /* Use R1 as ASCII buffer pointer */ + ldrb r0, [r1], #1 /* Load ASCII char for MSN */ + bl char2hex /* on return, hex value in R0, -1 for error (ignored) */ + mov r2, r0, lsl #4 /* Intermediate Results register */ + ldrb r0, [r1], #1 /* Load ASCII char for LSN */ + bl char2hex /* on return, hex value in R0, -1 for error (ignored) */ + orr r0, r2, r0 /* combined byte value */ + ldmfd sp!, {r2, pc} + +/* ascii2halfword_be + * Big Endian version of ascii2halfword conversion routine + * On entry: + * R0: ASCII buffer pointer + * On exit: + * R0[15:0]: Halfword value + * R1: Address of next char slot in buffer + * + * This routine accepts an ASCII buffer pointer in R0, + * and returns the Halfword value in R0[15:0]. + * Note: On return, R1 points to the ASCII buffer location after the current 4 chars. + * WARNING: This routine assumes that the input buffer was sanitized and contains valid Hex chars, + * otherwise it will return invalid results. + */ + .global ascii2halfword_be + +ascii2halfword_be: + stmfd sp!, {r2,r3, lr} + mov r3, #2 /* Loop counter */ + b _conv_ascii2byte_be + +/* ascii2halfword_le + * Little Endian version of ascii2halfword conversion routine + * On entry: + * R0: ASCII buffer pointer + * On exit: + * R0[15:0]: Halfword value + * R1: Address of next char slot in buffer + * + * This routine accepts an ASCII buffer pointer in R0, + * and returns the Halfword value in R0[15:0]. + * Note: On return, R1 points to the ASCII buffer location after the current 4 chars. + * WARNING: This routine assumes that the input buffer was sanitized and contains valid Hex chars, + * otherwise it will return invalid results. + */ + .global ascii2halfword_le + +ascii2halfword_le: + stmfd sp!, {r2,r3, lr} + mov r3, #2 /* Loop counter */ + b _conv_ascii2byte_le + + +/* ascii2word_be + * Big Endian version of ascii2word conversion routine + * On entry: + * R0: ASCII buffer pointer + * On exit: + * R0[31:0]: Word value + * R1: Address of next char slot in buffer + * + * This routine accepts an ASCII buffer pointer in R0, + * and returns the word value in R0[31:0]. + * Note: On return, R1 points to the ASCII buffer location after the current 8 chars. + * WARNING: This routine assumes that the input buffer was sanitized and contains valid Hex chars, + * otherwise it will return invalid results. + */ + .global ascii2word_be + +ascii2word_be: + stmfd sp!, {r2,r3, lr} + mov r3, #4 /* Loop counter */ + + /* Fall through to byte coversion loop */ + +_conv_ascii2byte_be: + teq r0, #0 + beq _exit_conv_ascii2byte_be /* exit if NULL pointer in R0 */ + mov r2, #0 /* Initialize Cummulative value */ +2: bl ascii2byte + orr r2, r0, r2, lsl #8 /* Merge current byte with cummulative value */ + mov r0, r1 /* Copy next char pointer to R0 for next byte */ + subs r3, r3, #1 + bne 2b + mov r0, r2 /* Copy it to R0 as return value */ + +_exit_conv_ascii2byte_be: + ldmfd sp!, {r2,r3, pc} /* return hex value in R0 */ + +/* ascii2word_le + * Litle Endian version of ascii2word conversion routine + * On entry: + * R0: ASCII buffer pointer + * On exit: + * R0[31:0]: Word value + * R1: Address of next char slot in buffer + * + * This routine accepts an ASCII buffer pointer in R0, + * and returns the word value in R0[31:0]. + * Note: On return, R1 points to the ASCII buffer location after the current 8 chars. + * WARNING: This routine assumes that the input buffer was sanitized and contains valid Hex chars, + * otherwise it will return invalid results. + */ + .global ascii2word_le + +ascii2word_le: + stmfd sp!, {r2,r3, lr} + mov r3, #4 /* Loop counter */ + + /* Fall through to byte coversion loop */ + +_conv_ascii2byte_le: + teq r0, #0 + beq _exit_conv_ascii2byte_le /* exit if NULL pointer in R0 */ + push {r3} /* Need to keep couter for final value adjustment */ + mov r2, #0 /* Initialize Cummulative value */ +2: bl ascii2byte + orr r2, r0, r2, ror #8 /* Merge current byte with cummulative value */ + mov r0, r1 /* Copy next char pointer to R0 for next byte */ + subs r3, r3, #1 + bne 2b + /* Cummulative value done, need to rotate it into the correct position for return value */ + pop {r3} /* retrieve counter */ + rsb r3, r3, #5 /* 5 - count */ + lsl r3, r3, #3 /* [(5-count) x 8] bits to rotate */ + mov r0, r2, ror r3 /* Copy it to R0 as return value */ + +_exit_conv_ascii2byte_le: + ldmfd sp!, {r2,r3, pc} /* return hex value in R0 */ + -- cgit v1.2.3 From fa8394892071007624e8eab04152eba477cdf706 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Wed, 15 Jun 2011 08:24:44 +0800 Subject: split platform specific code from generic debug code Move platform specific routines from debug_stub.S into debug_runlooptasks.S --- Debugger/debug_runlooptasks.S | 125 +++++++++++++++++++++++++++++++++++++++++- Debugger/debug_stub.S | 107 ------------------------------------ 2 files changed, 124 insertions(+), 108 deletions(-) diff --git a/Debugger/debug_runlooptasks.S b/Debugger/debug_runlooptasks.S index fd17412..bf636f7 100644 --- a/Debugger/debug_runlooptasks.S +++ b/Debugger/debug_runlooptasks.S @@ -1,4 +1,4 @@ -/** @file debug_runloop.S +/** @file debug_runlooptasks.S * @brief GDB Server platform Run Loop * */ @@ -13,6 +13,11 @@ * */ +/* + * This file contains platform specific code. + * This include ABORT Run Loop operation, as well as + * Debugger Interfacing code to the platform code. + */ /* * The Debugger has to implement a Run Loop in ABORT mode @@ -65,6 +70,11 @@ */ #define __ASSEMBLY__ +#include "debug_internals.h" +#include "debug_macros.h" + + .code 32 + .align 4 .global dbg__runloopTasks @@ -85,3 +95,116 @@ dbg__runloopTasks: /* OSWatchdogWrite is a NULL function in the NXT Firmware?! */ pop {pc} #endif + + +#ifdef __NXOS__ +/**************************************************************************** + * + * GDB Debugger Invocation Routine for NxOS + * + ****************************************************************************/ + .code 32 + .align 4 + + .extern _dbg__install_singlestep + .extern _dbg__activate_singlestep + .global nxos__handleDebug +/* nxos__handleDebug + * Prepare to switch to Debug Mode + * int nxos__handleDebug(unsigned char *msg, comm_chan_t channel, long len); + * + * This routine is called from NxOS Fantom library to setup + * Single Step Breakpoint in preparation for Debugger invocation if we're in + * normal execution mode. + * + * It returns to complete the IRQ handling normally, after which the single + * step breakpoint will be triggered, and the incoming GDB message will then + * be processed in the dbg__bkpt_waitCMD() loop. + * + * If we're in Debugger Mode already, then just return and let the + * dbg__bkpt_waitCMD() loop handle it normally. + * + * If we're operating in normal NxOS mode, return True (!0) + * If we're already in Debugger Mode, return False (0) + */ +nxos__handleDebug: + push {r4, r5, lr} + /* When called, NxOS is in Supervisor mode (MODE_SVC), called from nx__irq_handler() + * via fantom_filter_packet(). + * + * The IRQ Stack contains the LR and SPSR from the topmost interrupted task + * (NxOS supports nested IRQs) + */ + /* R0-R2 has received message related parameters */ + + /* Switch to IRQ mode get SPSR to find out how we were called */ + msr cpsr_c, #(MODE_IRQ | CPSR_FIQ | CPSR_IRQ) + mrs r3, spsr /* Copy SPSR to r3 */ + msr cpsr_c, #(MODE_SVC) /* Return to SVC mode, restore interrupts */ + and r3, r3, #CPSR_MODE /* Get previous mode */ + teq r3, #MODE_ABT /* Are we in Abort (Debug) mode? */ + moveq r0, #FALSE + beq exit_nxos__handleDebug /* Yes, return False */ + +_nxos_switch2debug: + /* Retrieve ISR Return Address */ + ldr r3, =__irq_stack__ + ldmdb r3, {r4,r5} /* R4: SPSR, R5: LR */ + tst r4, #CPSR_THUMB /* Check for Thumb Mode */ + mov r1, r5 /* R5 has interrupted instruction address, setup Single Step Breakpoint for it */ + orrne r1, r1, #1 /* Configure for Thumb Single Step Breakpoint */ + bl _dbg__install_singlestep /* Setup Single Step, next instruction address returned in r1 */ + bl _dbg__activate_singlestep + mov r0, #TRUE /* We're going to switch to Debug Mode (via Single Step Breakpoint) */ +exit_nxos__handleDebug: + pop {r4, r5, lr} + mov r1, lr /* Safe code: Thumb mode can't access lr */ + bx r1 /* In case we have Interworking from different caller mode */ + +#else + +/**************************************************************************** + * + * GDB Debugger Invocation Routine for NXT Firmware + * + ****************************************************************************/ + .code 16 + .align 2 + + .extern dbg__copyNxtDebugMsg + .global cCommHandleDebug + .thumb_func +/* cCommHandleDebug + * Switch Mode to Debugger. + * Used by NXT Firmware only + * + * UWORD cCommHandleDebug(UBYTE *pInBuf, UBYTE CmdBit, UWORD MsgLength); + * + * This routine is called from cCommInterprete either in normal operation mode (SVC) + * or else when we're in debug mode (ABORT) which uses the cCommCtrl() routine to handle + * I/O with the Host. + * + * On entry, the message is copied from the NXT buffer into our own buffers. + * + * If this is accessed from normal operation mode, we need to switch mode to + * ABORT mode to handle the incoming message using a Manual Breakpoint instruction. + * When DEBUG is exited, the execution resumes from the instruction following the Breakpoint. + */ +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 */ + _dbg_getmode r0 /* Get Debug Mode */ + cmp r0, #(TRUE & BYTE0) /* Confine it to Byte size */ + + /* If Debug Mode is TRUE, this means that we're already running the Debugger */ + beq _cCommHandleDebug_cont + /* Else, we're in normal operation mode (SVC), or other mode (??!) and need to force a switch to Debug mode */ + dbg__bkpt_thumb +_cCommHandleDebug_cont: + mov r0, #0 /* FIXME: Return Status */ + pop {r1} /* Can't Pop LR directly */ + bx r1 /* Safe code: actually we should be able to Pop PC since the caller is Thumb Mode */ + + .ltorg +#endif diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S index b7c1253..119b939 100644 --- a/Debugger/debug_stub.S +++ b/Debugger/debug_stub.S @@ -469,113 +469,6 @@ debug_armComplexCCTable: /* FIXME: The Debugger Stack Frame is probably not 100% consistent with the order that GDB expects in the g/G messages. CSPR is probably located above R15 */ -#ifdef __NXOS__ -/**************************************************************************** - * - * GDB Debugger Invocation Routine for NxOS - * - ****************************************************************************/ - .code 32 - .align 4 - .global nxos__handleDebug -/* nxos__handleDebug - * Prepare to switch to Debug Mode - * int nxos__handleDebug(unsigned char *msg, comm_chan_t channel, long len); - * - * This routine is called from NxOS Fantom library to setup - * Single Step Breakpoint in preparation for Debugger invocation if we're in - * normal execution mode. - * - * It returns to complete the IRQ handling normally, after which the single - * step breakpoint will be triggered, and the incoming GDB message will then - * be processed in the dbg__bkpt_waitCMD() loop. - * - * If we're in Debugger Mode already, then just return and let the - * dbg__bkpt_waitCMD() loop handle it normally. - * - * If we're operating in normal NxOS mode, return True (!0) - * If we're already in Debugger Mode, return False (0) - */ -nxos__handleDebug: - push {r4, r5, lr} - /* When called, NxOS is in Supervisor mode (MODE_SVC), called from nx__irq_handler() - * via fantom_filter_packet(). - * - * The IRQ Stack contains the LR and SPSR from the topmost interrupted task - * (NxOS supports nested IRQs) - */ - /* R0-R2 has received message related parameters */ - - /* Switch to IRQ mode get SPSR to find out how we were called */ - msr cpsr_c, #(MODE_IRQ | CPSR_FIQ | CPSR_IRQ) - mrs r3, spsr /* Copy SPSR to r3 */ - msr cpsr_c, #(MODE_SVC) /* Return to SVC mode, restore interrupts */ - and r3, r3, #CPSR_MODE /* Get previous mode */ - teq r3, #MODE_ABT /* Are we in Abort (Debug) mode? */ - moveq r0, #FALSE - beq exit_nxos__handleDebug /* Yes, return False */ - -_nxos_switch2debug: - /* Retrieve ISR Return Address */ - ldr r3, =__irq_stack__ - ldmdb r3, {r4,r5} /* R4: SPSR, R5: LR */ - tst r4, #CPSR_THUMB /* Check for Thumb Mode */ - mov r1, r5 /* R5 has interrupted instruction address, setup Single Step Breakpoint for it */ - orrne r1, r1, #1 /* Configure for Thumb Single Step Breakpoint */ - bl _dbg__install_singlestep /* Setup Single Step, next instruction address returned in r1 */ - bl _dbg__activate_singlestep - mov r0, #TRUE /* We're going to switch to Debug Mode (via Single Step Breakpoint) */ -exit_nxos__handleDebug: - pop {r4, r5, lr} - mov r1, lr /* Safe code: Thumb mode can't access lr */ - bx r1 /* In case we have Interworking from different caller mode */ - -#else - -/**************************************************************************** - * - * GDB Debugger Invocation Routine for NXT Firmware - * - ****************************************************************************/ - .code 16 - .align 2 - .global cCommHandleDebug - .thumb_func -/* cCommHandleDebug - * Switch Mode to Debugger. - * Used by NXT Firmware only - * - * UWORD cCommHandleDebug(UBYTE *pInBuf, UBYTE CmdBit, UWORD MsgLength); - * - * This routine is called from cCommInterprete either in normal operation mode (SVC) - * or else when we're in debug mode (ABORT) which uses the cCommCtrl() routine to handle - * I/O with the Host. - * - * On entry, the message is copied from the NXT buffer into our own buffers. - * - * If this is accessed from normal operation mode, we need to switch mode to - * ABORT mode to handle the incoming message using a Manual Breakpoint instruction. - * When DEBUG is exited, the execution resumes from the instruction following the Breakpoint. - */ -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 */ - _dbg_getmode r0 /* Get Debug Mode */ - cmp r0, #(TRUE & BYTE0) /* Confine it to Byte size */ - - /* If Debug Mode is TRUE, this means that we're already running the Debugger */ - beq _cCommHandleDebug_cont - /* Else, we're in normal operation mode (SVC), or other mode (??!) and need to force a switch to Debug mode */ - dbg__bkpt_thumb -_cCommHandleDebug_cont: - mov r0, #0 /* FIXME: Return Status */ - pop {r1} /* Can't Pop LR directly */ - bx r1 /* Safe code: actually we should be able to Pop PC since the caller is Thumb Mode */ - - .ltorg -#endif - /**************************************************************************** * * GDB Debugger Init and Breakpoint Handler Routines -- cgit v1.2.3 From ea1cbb6e4bdf599f971747c66bbbffe3a44bc9a0 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Wed, 15 Jun 2011 14:06:22 +0800 Subject: use irq_stack_frame_address to access top level interrupted instruction info --- Debugger/debug_runlooptasks.S | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/Debugger/debug_runlooptasks.S b/Debugger/debug_runlooptasks.S index bf636f7..2adb400 100644 --- a/Debugger/debug_runlooptasks.S +++ b/Debugger/debug_runlooptasks.S @@ -15,8 +15,8 @@ /* * This file contains platform specific code. - * This include ABORT Run Loop operation, as well as - * Debugger Interfacing code to the platform code. + * This include ABORT Mode Debugger Run Loop operation, + * as well as Debugger Interfacing code to the platform code. */ /* @@ -53,11 +53,10 @@ * ^-------v v-------^ * * The Platform will invoke dbg__bkpt_init() after hardware and system initialization, - * before entering the Platform Run Loop. This switches processing over to the - * Debugger Run Loop which will wait for the GDB command to Go/Step/Cont before - * returning control to the Platform Run Loop. + * before entering the Platform Run Loop. This configures the Debugger, but does not + * invoke the Debugger Run Loop unless a Manual Breakpoint is found in the platform code. * - * Subsequently, Debugger Run Loop will be triggered by Breakpoints, or + * Subsequently, the Debugger Run Loop will be triggered by Breakpoints, or * when the communications subsystem receives a GDB Command. * * The Debugger Run Loop is actually dbg__bkpt_waitCMD(), this file contains @@ -79,13 +78,21 @@ #ifdef __NXOS__ -/* NxOS Run Loop */ +/**************************************************************************** + * + * NxOS Run Loop + * + ****************************************************************************/ dbg__runloopTasks: /* Currently, there's nothing that needs to be done in the NxOS Run Loop */ bx lr #else -/* NXT Firmware Run Loop */ +/**************************************************************************** + * + * NXT Firmware Run Loop + * + ****************************************************************************/ .extern cCommCtrl dbg__runloopTasks: @@ -148,7 +155,7 @@ nxos__handleDebug: _nxos_switch2debug: /* Retrieve ISR Return Address */ - ldr r3, =__irq_stack__ + ldr r3, =irq_stack_frame_address ldmdb r3, {r4,r5} /* R4: SPSR, R5: LR */ tst r4, #CPSR_THUMB /* Check for Thumb Mode */ mov r1, r5 /* R5 has interrupted instruction address, setup Single Step Breakpoint for it */ -- cgit v1.2.3 From 0ff55afdf60779aca4874ebe1f6d01b910c732c2 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Wed, 15 Jun 2011 15:33:04 +0800 Subject: referenced external variable --- Debugger/debug_runlooptasks.S | 1 + 1 file changed, 1 insertion(+) diff --git a/Debugger/debug_runlooptasks.S b/Debugger/debug_runlooptasks.S index 2adb400..2b2ae19 100644 --- a/Debugger/debug_runlooptasks.S +++ b/Debugger/debug_runlooptasks.S @@ -115,6 +115,7 @@ dbg__runloopTasks: .extern _dbg__install_singlestep .extern _dbg__activate_singlestep + .extern irq_stack_frame_address .global nxos__handleDebug /* nxos__handleDebug * Prepare to switch to Debug Mode -- cgit v1.2.3 From 3ea54a710b9c1ed68461284b62e7b0db4163e04c Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Wed, 15 Jun 2011 15:36:27 +0800 Subject: made routines global due to refactoring --- Debugger/debug_stub.S | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S index 119b939..eb064fc 100644 --- a/Debugger/debug_stub.S +++ b/Debugger/debug_stub.S @@ -1190,7 +1190,7 @@ _dbg__cont_is_normal_breakpoint: mov r2, #DBGSTACK_NEXTINSTR_INDEX /* The Next Instruction Pointer for Resume is in index 0 of the Debug Stack */ _setdbgregisterfromindex r2, r0, r1 /* Set Register contents in R0, using index in R2, and scratch register R1 */ bl _dbg_following_instruction_addr /* following instruction address returned in r1 */ - bl _dbg__install_singlestep /* Setup Single Step, next instruction address returned in r1 */ + bl dbg__install_singlestep /* Setup Single Step, next instruction address returned in r1 */ _dbg_getcurrbkpt_index r0 /* load current breakpoint index in memory */ bl _dbg__activate_autobreakpoint /* pass next instruction address in r1 */ b _dbg__switch2undefmode_withAck @@ -1256,8 +1256,8 @@ _dbg__step_is_manual_bkpt: _dbg__step_is_manual_bkpt_or_address_specified: bl _dbg_following_instruction_addr /* following instruction address returned in r1 */ - bl _dbg__install_singlestep /* Setup Single Step, next instruction address returned in r1 */ - bl _dbg__activate_singlestep + bl dbg__install_singlestep /* Setup Single Step, next instruction address returned in r1 */ + bl dbg__activate_singlestep b _dbg__switch2undefmode_withAck @@ -2709,12 +2709,13 @@ _dbg__clear_breakpoints: blo 3b ldmfd sp!, {pc} -/* _dbg__install_singlestep + .global dbg__install_singlestep +/* dbg__install_singlestep * Install the Single Step Breakpoint * On entry: * R1: Instruction Address (31 bits, b0 = THUMB flag) */ -_dbg__install_singlestep: +dbg__install_singlestep: mov r0, #0 /* b _dbg__install_one_breakpoint */ @@ -2775,10 +2776,11 @@ _dbg__restore_breakpoints: ldr r5, =_dbg__restore_one_breakpoint b __dbg__iterate_breakpoint_array -/* _dbg__activate_singlestep + .global dbg__activate_singlestep +/* dbg__activate_singlestep * Activate the single step breakpoint to memory */ -_dbg__activate_singlestep: +dbg__activate_singlestep: mov r0, #0 /* single step breakpoint index */ _index2bkptindex_addr r0, r1 /* Calculate Single Step Breakpoint Entry Address */ ldm r1, {r1, r2} /* r1: Breakpoint Address, r2: Breakpoint Instruction */ -- cgit v1.2.3 From b809e51ec64151923772477644b1e4997eb5d8b8 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Wed, 15 Jun 2011 15:37:28 +0800 Subject: renamed routines due to refactoring --- Debugger/debug_runlooptasks.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Debugger/debug_runlooptasks.S b/Debugger/debug_runlooptasks.S index 2b2ae19..9ca0c7d 100644 --- a/Debugger/debug_runlooptasks.S +++ b/Debugger/debug_runlooptasks.S @@ -113,8 +113,8 @@ dbg__runloopTasks: .code 32 .align 4 - .extern _dbg__install_singlestep - .extern _dbg__activate_singlestep + .extern dbg__install_singlestep + .extern dbg__activate_singlestep .extern irq_stack_frame_address .global nxos__handleDebug /* nxos__handleDebug @@ -161,8 +161,8 @@ _nxos_switch2debug: tst r4, #CPSR_THUMB /* Check for Thumb Mode */ mov r1, r5 /* R5 has interrupted instruction address, setup Single Step Breakpoint for it */ orrne r1, r1, #1 /* Configure for Thumb Single Step Breakpoint */ - bl _dbg__install_singlestep /* Setup Single Step, next instruction address returned in r1 */ - bl _dbg__activate_singlestep + bl dbg__install_singlestep /* Setup Single Step, next instruction address returned in r1 */ + bl dbg__activate_singlestep mov r0, #TRUE /* We're going to switch to Debug Mode (via Single Step Breakpoint) */ exit_nxos__handleDebug: pop {r4, r5, lr} -- cgit v1.2.3 From 549a1a6ae4e1e5493644d1499d4f35ce77f4a5f4 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Thu, 16 Jun 2011 09:15:01 +0800 Subject: revamped nxos debugger invocation interface --- Debugger/debug_comm.S | 3 ++- Debugger/debug_runlooptasks.S | 44 ++++++++++++++++++++++++------------------- Debugger/debug_stub.h | 2 +- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/Debugger/debug_comm.S b/Debugger/debug_comm.S index baab7b7..d0ea045 100644 --- a/Debugger/debug_comm.S +++ b/Debugger/debug_comm.S @@ -46,10 +46,11 @@ debug_msgTxBuf_AppendPtr: debug_segmentRxNum: /* Current Rx Segment Number */ .word 0x0 -/* Incoming Message Length and Comm Channel is now common to both NxOS and NXT Firmware */ debug_nxtMsgLength: /* NXT Firmware Received Message Length */ .word 0x0 +/* Comm Channel is now common to both NxOS and NXT Firmware */ + .global debug_nxtCommChannel debug_nxtCommChannel: .word 0x0 diff --git a/Debugger/debug_runlooptasks.S b/Debugger/debug_runlooptasks.S index 9ca0c7d..a9e0fcd 100644 --- a/Debugger/debug_runlooptasks.S +++ b/Debugger/debug_runlooptasks.S @@ -119,7 +119,7 @@ dbg__runloopTasks: .global nxos__handleDebug /* nxos__handleDebug * Prepare to switch to Debug Mode - * int nxos__handleDebug(unsigned char *msg, comm_chan_t channel, long len); + * int nxos__handleDebug(comm_chan_t channel); * * This routine is called from NxOS Fantom library to setup * Single Step Breakpoint in preparation for Debugger invocation if we're in @@ -136,37 +136,43 @@ dbg__runloopTasks: * If we're already in Debugger Mode, return False (0) */ nxos__handleDebug: - push {r4, r5, lr} - /* When called, NxOS is in Supervisor mode (MODE_SVC), called from nx__irq_handler() - * via fantom_filter_packet(). + push {lr} + /* This routine is called from nx__irq_handler() via fantom_filter_packet(). + * The operating mode should already have been configured by the IRQ interrupt handler. * - * The IRQ Stack contains the LR and SPSR from the topmost interrupted task - * (NxOS supports nested IRQs) + * 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) */ - /* R0-R2 has received message related parameters */ - /* Switch to IRQ mode get SPSR to find out how we were called */ - msr cpsr_c, #(MODE_IRQ | CPSR_FIQ | CPSR_IRQ) - mrs r3, spsr /* Copy SPSR to r3 */ - msr cpsr_c, #(MODE_SVC) /* Return to SVC mode, restore interrupts */ - and r3, r3, #CPSR_MODE /* Get previous mode */ + ldr r3, =debug_nxtCommChannel + str r0, [r3] /* Keep track of which communications link was used (USB/Bluetooth) */ + + /* Check our current operating mode */ + 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? */ - moveq r0, #FALSE beq exit_nxos__handleDebug /* Yes, return False */ -_nxos_switch2debug: /* Retrieve ISR Return Address */ ldr r3, =irq_stack_frame_address - ldmdb r3, {r4,r5} /* R4: SPSR, R5: LR */ - tst r4, #CPSR_THUMB /* Check for Thumb Mode */ - mov r1, r5 /* R5 has interrupted instruction address, setup Single Step Breakpoint for it */ + ldr r3, [r3] /* Get Interrupt Stack Pointer */ + teq r3, #0 + beq exit_nxos__handleDebug /* NULL Interrupt Stack Frame Pointer, exit (status: False) */ + +nxos_switch2debug: + /* Since the Interrupt Stack Frame Pointer points to the top of the stack frame, + * we'll have to use Load Empty Ascending Stack (LDMEA == LDMDB) to access the variables + */ + ldmdb r3, {r1,r2} /* R1: LR, R2: SPSR */ + tst r2, #CPSR_THUMB /* Check for Thumb Mode */ orrne r1, r1, #1 /* Configure for Thumb Single Step Breakpoint */ bl dbg__install_singlestep /* Setup Single Step, next instruction address returned in r1 */ bl dbg__activate_singlestep mov r0, #TRUE /* We're going to switch to Debug Mode (via Single Step Breakpoint) */ + exit_nxos__handleDebug: - pop {r4, r5, lr} - mov r1, lr /* Safe code: Thumb mode can't access lr */ + pop {r1} bx r1 /* In case we have Interworking from different caller mode */ #else diff --git a/Debugger/debug_stub.h b/Debugger/debug_stub.h index f75b95b..a4cbdda 100644 --- a/Debugger/debug_stub.h +++ b/Debugger/debug_stub.h @@ -71,7 +71,7 @@ ENUM_END(comm_chan_t) * !0 if mode switch will happen * Used by NxOS only */ -FUNCDEF int nxos__handleDebug(unsigned char *msg, comm_chan_t channel, long len); +FUNCDEF int nxos__handleDebug(comm_chan_t channel); #endif #ifndef __NXOS__ -- cgit v1.2.3 From 517c98db287a2f66ef0df365b4a3c054e9c87cba Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Thu, 16 Jun 2011 15:36:28 +0800 Subject: fix condition check in _dbg__sendCommMsg due to c vs. armdebug encoding True is encoded as #1 by C Compiler, while ARMDEBUG uses #0xFFFFFFFF. Changed logic test to avoid this problem. --- Debugger/debug_comm.S | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Debugger/debug_comm.S b/Debugger/debug_comm.S index d0ea045..a3600a2 100644 --- a/Debugger/debug_comm.S +++ b/Debugger/debug_comm.S @@ -408,9 +408,11 @@ _dbg__sendCommMsg: 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 if USB is ready */ - cmp r0, #TRUE - bne _exit_dbg__sendCommMsg + 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 */ -- cgit v1.2.3 From ad497e188b490981211ecf61edf12a92d32a233b Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Fri, 17 Jun 2011 09:12:26 +0800 Subject: fix return status check for nx_usb_data_written The C return value for True is not identical to that used by ARMDEBUG. Check for False instead. --- Debugger/debug_comm.S | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Debugger/debug_comm.S b/Debugger/debug_comm.S index a3600a2..1789cb1 100644 --- a/Debugger/debug_comm.S +++ b/Debugger/debug_comm.S @@ -420,9 +420,11 @@ _dbg__sendCommMsg: bl nx_usb_write 1: bl nx_usb_data_written /* R0 = True if data has been sent */ - cmp r0, #TRUE + teq r0, #0 /* FALSE == #0; + We can't check for True condition since values + used by C-Compiler & ARMDEBUG are different */ /* FIXME: implement timeout */ - bne 1b /* Busy Wait Loop */ + beq 1b /* Busy Wait Loop */ #else ldr r0, =debug_nxtCommChannel ldr r0, [r0] /* Get Channel Enum */ -- cgit v1.2.3 From 3bd42c4969f92d991605c89d4cb3112cc7c5e917 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Sat, 18 Jun 2011 16:13:35 +0800 Subject: preliminary kill command support When GDB Kill command received, reboot the brick. Conditionalize Step command support based on compiler flags. --- Debugger/debug_internals.h | 2 ++ Debugger/debug_runlooptasks.S | 22 +++++++++++++++++++++- Debugger/debug_stub.S | 29 +++++++++++++++++++++++++++-- 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/Debugger/debug_internals.h b/Debugger/debug_internals.h index 82c0e38..9dc2bad 100644 --- a/Debugger/debug_internals.h +++ b/Debugger/debug_internals.h @@ -88,6 +88,8 @@ #define CMD_REG_SETONE_MINPARAMLEN (2 + CMD_REG_REGPARAMLEN) #define CMD_REG_SETONE_MAXPARAMLEN (3 + CMD_REG_REGPARAMLEN) #define CMD_REG_SETALL_PARAMLEN (CMD_REG_NUMREGS*CMD_REG_REGPARAMLEN) +#define CMD_KILL_PARAMLEN 0 + /*@}*/ /** @name Debug Memory Command Constants. diff --git a/Debugger/debug_runlooptasks.S b/Debugger/debug_runlooptasks.S index a9e0fcd..a80c46a 100644 --- a/Debugger/debug_runlooptasks.S +++ b/Debugger/debug_runlooptasks.S @@ -75,7 +75,7 @@ .code 32 .align 4 .global dbg__runloopTasks - + .global dbg__reboot #ifdef __NXOS__ /**************************************************************************** @@ -103,6 +103,26 @@ dbg__runloopTasks: pop {pc} #endif +#ifdef __NXOS__ + .extern nx_core_reset +/**************************************************************************** + * + * NxOS Reboot Routine + * + ****************************************************************************/ + dbg__reboot: + b nx_core_reset /* Reboot Brick, won't return */ + +#else +/**************************************************************************** + * + * NXT Firmware Reboot Routine + * + ****************************************************************************/ +dbg__reboot: + bx lr +#endif + #ifdef __NXOS__ /**************************************************************************** diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S index eb064fc..fc4f368 100644 --- a/Debugger/debug_stub.S +++ b/Debugger/debug_stub.S @@ -242,8 +242,13 @@ debug_cmdJumpTable: .word _dbg__cmd_ReadMem /* 'm' */ .word _dbg__cmd_WriteMem /* 'M' */ .word _dbg__cmd_Continue /* 'c' */ +#ifdef __NXOS__ + .word _dbg__cmd_Step /* 's' */ +#else + /* NXT Firmware does not support Stepping */ .word _dbg__nop /* 's' */ - .word _dbg__nop /* 'k' */ +#endif + .word _dbg__cmd_Kill /* 'k' */ .word _dbg__cmd_RemoveBreakpoint /* 'z' */ .word _dbg__cmd_InsertBreakpoint /* 'Z' */ .word _dbg__cmd_Status /* '?' */ @@ -1203,7 +1208,7 @@ _dbg__cont_is_manual_bkpt_or_address_specified: * Step User Program Execution Command Handler * Setup breakpoints before resuming execution of program. * - * If Address is specified, update the next instruction address to specified address + * If Address is specified, update the next instruction address to specified address * * If this is a Normal Breakpoint, then we need to install a Step Breakpoint at next instruction address * and resume from current (Breakpoint) exception address @@ -1260,6 +1265,26 @@ _dbg__step_is_manual_bkpt_or_address_specified: bl dbg__activate_singlestep b _dbg__switch2undefmode_withAck +/* _dbg__cmd_Kill + * Kill User Program Execution Command Handler + * Kill Program, this is accomplished by rebooting the Brick + * + * On entry: + * r0: parameter buffer pointer (contents after '$' and '') + * (No Parameters) + * On exit: + * r0-r7: destroyed + * Note: This routine does not return to caller. Instead it calls + * the relevant system routine to reboot the Brick + */ +_dbg__cmd_Kill: + stmfd sp!, {lr} /* In case unexpected parameters were received */ + bl __dbg__cmdParamLen + teq r1, #CMD_KILL_PARAMLEN /* Check for correct length */ + bne __dbg__procCmdParamError /* Unexpected input, report error */ + + bl __dbg__procAckOnly /* send Ack to keep GDB server happy */ + b dbg__reboot /* _dbg__proc_brkpt_params * Process Breakpoint Parameters -- cgit v1.2.3 From 2342c9ee61f0c19af069b3a9b8f20fc4784ee59e Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Sat, 18 Jun 2011 16:31:07 +0800 Subject: added detach command support Detach acts in the same way as Continue (without arguments). --- Debugger/debug_internals.h | 1 + Debugger/debug_stub.S | 26 ++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Debugger/debug_internals.h b/Debugger/debug_internals.h index 9dc2bad..c7f5d16 100644 --- a/Debugger/debug_internals.h +++ b/Debugger/debug_internals.h @@ -89,6 +89,7 @@ #define CMD_REG_SETONE_MAXPARAMLEN (3 + CMD_REG_REGPARAMLEN) #define CMD_REG_SETALL_PARAMLEN (CMD_REG_NUMREGS*CMD_REG_REGPARAMLEN) #define CMD_KILL_PARAMLEN 0 +#define CMD_DETACH_PARAMLEN 0 /*@}*/ diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S index fc4f368..3f1b53e 100644 --- a/Debugger/debug_stub.S +++ b/Debugger/debug_stub.S @@ -227,7 +227,7 @@ debug_OkResponse: /* The CmdIndexTable and CmdJumpTable must be kept in sync */ debug_cmdIndexTable: - .byte 'g','G','p','P','m','M','c','s','k','z','Z','?','q','Q',0 + .byte 'g','G','p','P','m','M','c','s','k','z','Z','?','q','Q','D',0 /* Command Handlers * On entry: @@ -254,6 +254,7 @@ debug_cmdJumpTable: .word _dbg__cmd_Status /* '?' */ .word _dbg__cmd_Query /* 'q' */ .word _dbg__nop /* 'Q' */ + .word _dbg__cmd_Detach /* 'D' */ .word 0 /* Rm Shifted Shift Type Jump Table @@ -1147,6 +1148,27 @@ _dbg__cmd_WriteMem: bne 1b b __dbg__procCmdOk +/* _dbg__cmd_Detach + * Detach User Program Execution Command Handler + * Treat this as being equivalent to 'Continue' without any arguments + * + * On entry: + * r0: parameter buffer pointer (contents after '$' and '') + * (No Parameters) + * On exit: + * r0-r7: destroyed + * Note: This routine does not return to caller. Instead it switches + * operating mode to UNDEF and returns to previously active program + */ +_dbg__cmd_Detach: + stmfd sp!, {lr} /* In case unexpected parameters were received */ + bl __dbg__cmdParamLen + teq r1, #CMD_DETACH_PARAMLEN /* Check for correct length */ + bne __dbg__procCmdParamError /* Unexpected input, report error */ + + pop sp!, {lr} /* Cleanup stack, since we won't return to the Debugger Run Loop */ + b _dbg__cont_check_breakpoint_type /* Continue from current PC */ + /* _dbg__cmd_Continue * Continue User Program Execution Command Handler * Setup breakpoints before resuming execution of program. @@ -1284,7 +1306,7 @@ _dbg__cmd_Kill: bne __dbg__procCmdParamError /* Unexpected input, report error */ bl __dbg__procAckOnly /* send Ack to keep GDB server happy */ - b dbg__reboot + b dbg__reboot /* Goodbye.... */ /* _dbg__proc_brkpt_params * Process Breakpoint Parameters -- cgit v1.2.3 From 5d8b151c7cccc2c5613195ea7b47b93085af2773 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Sat, 18 Jun 2011 16:35:01 +0800 Subject: updated comments for detach command --- Debugger/debug_stub.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S index 3f1b53e..eb39c0d 100644 --- a/Debugger/debug_stub.S +++ b/Debugger/debug_stub.S @@ -79,6 +79,8 @@ * MAA..AA,LLLL:bb..bb * Write LLLL bytes at address AA.AA OK or ENN * + * D Detach (equivalent to continue Ack Only + * at current address) * c Resume at current address SNN ( signal NN) * cAA..AA Continue at address AA..AA SNN * -- cgit v1.2.3 From 44e908e0ecec156b921649f26c57f31b37aa0a6f Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Sat, 18 Jun 2011 16:36:17 +0800 Subject: fix silly syntax error for pop instruction --- Debugger/debug_stub.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S index eb39c0d..c938f13 100644 --- a/Debugger/debug_stub.S +++ b/Debugger/debug_stub.S @@ -1168,7 +1168,7 @@ _dbg__cmd_Detach: teq r1, #CMD_DETACH_PARAMLEN /* Check for correct length */ bne __dbg__procCmdParamError /* Unexpected input, report error */ - pop sp!, {lr} /* Cleanup stack, since we won't return to the Debugger Run Loop */ + ldmfd sp!, {lr} /* Cleanup stack, since we won't return to the Debugger Run Loop */ b _dbg__cont_check_breakpoint_type /* Continue from current PC */ /* _dbg__cmd_Continue -- cgit v1.2.3 From d73200726545f93e292514f9186883be93bcbac4 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Sat, 18 Jun 2011 16:44:12 +0800 Subject: rearrange parsing order of detach command --- Debugger/debug_stub.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S index c938f13..f472a78 100644 --- a/Debugger/debug_stub.S +++ b/Debugger/debug_stub.S @@ -229,7 +229,7 @@ debug_OkResponse: /* The CmdIndexTable and CmdJumpTable must be kept in sync */ debug_cmdIndexTable: - .byte 'g','G','p','P','m','M','c','s','k','z','Z','?','q','Q','D',0 + .byte 'g','G','p','P','m','M','D','c','s','k','z','Z','?','q','Q',0 /* Command Handlers * On entry: @@ -243,6 +243,7 @@ debug_cmdJumpTable: .word _dbg__cmd_SetOneReg /* 'P' */ .word _dbg__cmd_ReadMem /* 'm' */ .word _dbg__cmd_WriteMem /* 'M' */ + .word _dbg__cmd_Detach /* 'D' */ .word _dbg__cmd_Continue /* 'c' */ #ifdef __NXOS__ .word _dbg__cmd_Step /* 's' */ @@ -256,7 +257,6 @@ debug_cmdJumpTable: .word _dbg__cmd_Status /* '?' */ .word _dbg__cmd_Query /* 'q' */ .word _dbg__nop /* 'Q' */ - .word _dbg__cmd_Detach /* 'D' */ .word 0 /* Rm Shifted Shift Type Jump Table -- cgit v1.2.3 From de2bd1e3247d3b435a94223666d0d092c2785f31 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Mon, 20 Jun 2011 09:25:05 +0800 Subject: include header file for nxt firmware support --- Debugger/debug_runlooptasks.S | 1 + 1 file changed, 1 insertion(+) diff --git a/Debugger/debug_runlooptasks.S b/Debugger/debug_runlooptasks.S index a80c46a..304ad47 100644 --- a/Debugger/debug_runlooptasks.S +++ b/Debugger/debug_runlooptasks.S @@ -71,6 +71,7 @@ #include "debug_internals.h" #include "debug_macros.h" +#include "debug.stub.h" .code 32 .align 4 -- cgit v1.2.3 From 5cb8fa6648f7f21d1e99535c8a3d06c789f0f221 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Mon, 20 Jun 2011 09:26:03 +0800 Subject: fix typo error in header filename --- Debugger/debug_runlooptasks.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Debugger/debug_runlooptasks.S b/Debugger/debug_runlooptasks.S index 304ad47..48b7e5a 100644 --- a/Debugger/debug_runlooptasks.S +++ b/Debugger/debug_runlooptasks.S @@ -71,7 +71,7 @@ #include "debug_internals.h" #include "debug_macros.h" -#include "debug.stub.h" +#include "debug_stub.h" .code 32 .align 4 -- cgit v1.2.3 From 4814854ff7149f3b9dae2d5f1bf49d2bdeeaed6d Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Mon, 20 Jun 2011 09:35:43 +0800 Subject: declared variables and functions as globals for inter-module access --- Debugger/debug_comm.S | 16 ++++++++++++++++ Debugger/debug_stub.S | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/Debugger/debug_comm.S b/Debugger/debug_comm.S index 1789cb1..570fedc 100644 --- a/Debugger/debug_comm.S +++ b/Debugger/debug_comm.S @@ -22,6 +22,22 @@ #include "debug_internals.h" #include "debug_comm.h" + /* Hexutils function references */ + .extern hex2char + .extern char2hex + .extern byte2ascii + .extern halfword2ascii_be + .extern halfword2ascii_le + .extern word2ascii_be + .extern word2ascii_le + .extern ascii2hex_varlen_be + .extern ascii2byte + .extern ascii2halfword_be + .extern ascii2halfword_le + .extern ascii2word_be + .extern ascii2word_le + + .bss .align 4 diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S index f472a78..b987d7c 100644 --- a/Debugger/debug_stub.S +++ b/Debugger/debug_stub.S @@ -144,6 +144,21 @@ #include "debug_internals.h" #include "debug_macros.h" + /* Hexutils function references */ + .extern hex2char + .extern char2hex + .extern byte2ascii + .extern halfword2ascii_be + .extern halfword2ascii_le + .extern word2ascii_be + .extern word2ascii_le + .extern ascii2hex_varlen_be + .extern ascii2byte + .extern ascii2halfword_be + .extern ascii2halfword_le + .extern ascii2word_be + .extern ascii2word_le + /* Macro definitions */ /* _check_msgseparator @@ -198,6 +213,12 @@ debug_InMsgBuf: debug_OutMsgBuf: .space MSGBUF_SIZE,0 + /* Make Debugger State accessible from other modules */ + .global debug_state + .global debug_mode + .global debug_bkpt_type + .global debug_curr_breakpoint + debug_state: .byte 0x0 /* dbg_state_t variable */ debug_mode: -- cgit v1.2.3