From 6c5075bc99ba07f46562f7f10db14e153d7a93ec Mon Sep 17 00:00:00 2001 From: jhansen Date: Mon, 26 Apr 2010 21:49:44 +0000 Subject: git-svn-id: https://mindboards.svn.sourceforge.net/svnroot/mindboards/lms_nbcnxc_128/trunk@6 c9361245-7fe8-9947-84e8-057757c4e366 --- AT91SAM7S256/Resource/MENUES/IconNos.txt | 8 +- AT91SAM7S256/Resource/MENUES/Icons.bmp | Bin 9086 -> 9278 bytes AT91SAM7S256/Resource/MENUES/Mainmenu.txt | 16 +- AT91SAM7S256/Resource/MENUES/Submenu04.txt | 18 +- AT91SAM7S256/Resource/TEXT/Ui.txt | 10 - AT91SAM7S256/SAM7S256/Lib/dl4tptinl8n.h | 2 +- AT91SAM7S256/SAM7S256/Lib/dl4tptinl8n.r79 | Bin 1149147 -> 1203693 bytes AT91SAM7S256/SAM7S256/Lib/dl4tptnnl8n.h | 9 + AT91SAM7S256/SAM7S256/Lib/dl4tptnnl8n.r79 | Bin 0 -> 1153133 bytes AT91SAM7S256/SAM7S256/Tools/LMS_ARM.dep | 4124 ++++++++++++++------ AT91SAM7S256/SAM7S256/Tools/LMS_ARM.ewd | 1261 +++++- AT91SAM7S256/SAM7S256/Tools/LMS_ARM.ewp | 1223 +++++- AT91SAM7S256/SAM7S256/Tools/at91SAM7S256_Remap.xcl | 4 + .../SAM7S256/Tools/settings/LMS_ARM.cspy.bat | 32 + AT91SAM7S256/SAM7S256/Tools/settings/LMS_ARM.dbgdt | 14 +- AT91SAM7S256/SAM7S256/Tools/settings/LMS_ARM.dni | 21 +- AT91SAM7S256/SAM7S256/Tools/settings/LMS_ARM.wsdt | 36 +- AT91SAM7S256/Source/BtTest.inc | 12 +- AT91SAM7S256/Source/Functions.inl | 45 +- AT91SAM7S256/Source/Ui.txt | 17 +- AT91SAM7S256/Source/c_cmd.c | 2722 ++++++++++--- AT91SAM7S256/Source/c_cmd.h | 71 +- AT91SAM7S256/Source/c_cmd.iom | 55 +- AT91SAM7S256/Source/c_cmd_alternate.c | 108 + AT91SAM7S256/Source/c_cmd_bytecodes.h | 76 +- AT91SAM7S256/Source/c_cmd_drawing.inc | 1713 ++++++-- AT91SAM7S256/Source/c_comm.c | 89 +- AT91SAM7S256/Source/c_comm.iom | 61 +- AT91SAM7S256/Source/c_display.c | 237 +- AT91SAM7S256/Source/c_display.iom | 72 +- AT91SAM7S256/Source/c_input.c | 284 +- AT91SAM7S256/Source/c_loader.c | 240 +- AT91SAM7S256/Source/c_loader.h | 3 + AT91SAM7S256/Source/c_loader.iom | 22 +- AT91SAM7S256/Source/c_lowspeed.c | 228 +- AT91SAM7S256/Source/c_lowspeed.iom | 15 +- AT91SAM7S256/Source/c_output.c | 152 +- AT91SAM7S256/Source/c_output.iom | 7 +- AT91SAM7S256/Source/c_ui.c | 46 +- AT91SAM7S256/Source/c_ui.h | 2 +- AT91SAM7S256/Source/c_ui.iom | 2 + AT91SAM7S256/Source/d_bt.c | 4 +- AT91SAM7S256/Source/d_bt.h | 2 +- AT91SAM7S256/Source/d_bt.r | 19 +- AT91SAM7S256/Source/d_button.r | 31 +- AT91SAM7S256/Source/d_display.c | 4 +- AT91SAM7S256/Source/d_display.h | 2 +- AT91SAM7S256/Source/d_display.r | 4 +- AT91SAM7S256/Source/d_display2.r | 388 ++ AT91SAM7S256/Source/d_hispeed.c | 24 +- AT91SAM7S256/Source/d_hispeed.h | 2 +- AT91SAM7S256/Source/d_hispeed.r | 25 +- AT91SAM7S256/Source/d_input.h | 2 + AT91SAM7S256/Source/d_input.r | 2 +- AT91SAM7S256/Source/d_loader.c | 70 +- AT91SAM7S256/Source/d_loader.h | 15 +- AT91SAM7S256/Source/d_lowspeed.c | 4 +- AT91SAM7S256/Source/d_lowspeed.h | 2 +- AT91SAM7S256/Source/d_lowspeed.r | 743 ++-- AT91SAM7S256/Source/d_output.c | 897 +++-- AT91SAM7S256/Source/d_output.h | 18 +- AT91SAM7S256/Source/d_output.r | 76 +- AT91SAM7S256/Source/modules.h | 3 +- 63 files changed, 11168 insertions(+), 4226 deletions(-) create mode 100644 AT91SAM7S256/SAM7S256/Lib/dl4tptnnl8n.h create mode 100644 AT91SAM7S256/SAM7S256/Lib/dl4tptnnl8n.r79 create mode 100644 AT91SAM7S256/SAM7S256/Tools/settings/LMS_ARM.cspy.bat create mode 100644 AT91SAM7S256/Source/c_cmd_alternate.c create mode 100644 AT91SAM7S256/Source/d_display2.r (limited to 'AT91SAM7S256') diff --git a/AT91SAM7S256/Resource/MENUES/IconNos.txt b/AT91SAM7S256/Resource/MENUES/IconNos.txt index 50d12bf..0937da3 100644 --- a/AT91SAM7S256/Resource/MENUES/IconNos.txt +++ b/AT91SAM7S256/Resource/MENUES/IconNos.txt @@ -15,9 +15,9 @@ Index Current file New file Comments 0C UltrasonicCm (SensorUltrasonicCm) 0D TempC (SensorTempC) 0E TempF (SensorTempF) -0F IicTempC -10 IicTempF -11 Color +0F +10 +11 12 Port1 Ports 13 Port2 14 Port3 @@ -94,3 +94,5 @@ Index Current file New file Comments 5B Invisibel (Invisible) 5C BTOn 5D BTOff +5E +5F \ No newline at end of file diff --git a/AT91SAM7S256/Resource/MENUES/Icons.bmp b/AT91SAM7S256/Resource/MENUES/Icons.bmp index c844c7b..795170d 100644 Binary files a/AT91SAM7S256/Resource/MENUES/Icons.bmp and b/AT91SAM7S256/Resource/MENUES/Icons.bmp differ diff --git a/AT91SAM7S256/Resource/MENUES/Mainmenu.txt b/AT91SAM7S256/Resource/MENUES/Mainmenu.txt index 33028ea..19394ee 100644 --- a/AT91SAM7S256/Resource/MENUES/Mainmenu.txt +++ b/AT91SAM7S256/Resource/MENUES/Mainmenu.txt @@ -8,13 +8,13 @@ Turn_off? Turn_off? 1 1 -00000011 00000021 00000031 00000041 00000051 00000061 00000071 -3B 3C 3D 3E 51 3F 40 -My_Files NXT_Program NXT_Datalog View Bluetooth Settings Try_Me -01040000 01040000 01840000 01040000 01040000 01040000 01040000 -0 0 A E 0 0 0 -0 0 0 0 0 0 0 -1 2 3 4 7 5 6 -1 1 1 1 2 1 1 +00000011 00000021 00000031 00000041 00000051 00000061 +3B 3C 3E 51 3F 40 +My_Files NXT_Program View Bluetooth Settings Try_Me +01040000 01040000 01040000 01040000 01040000 01040000 +0 0 0 0 0 0 +0 0 0 0 0 0 +1 2 4 7 5 6 +1 1 1 2 1 1 diff --git a/AT91SAM7S256/Resource/MENUES/Submenu04.txt b/AT91SAM7S256/Resource/MENUES/Submenu04.txt index 0f86f7c..917be20 100644 --- a/AT91SAM7S256/Resource/MENUES/Submenu04.txt +++ b/AT91SAM7S256/Resource/MENUES/Submenu04.txt @@ -1,14 +1,14 @@ -00000001 00000002 00000003 00000004 00000005 00000006 00000007 00000008 00000009 0000000A 0000000B 0000000C -02 03 04 05 0F 10 09 08 07 0B 0C 11 -Sound_dB Sound_dBA Reflected_light Ambient_light Temperature_`C Temperature_`F Motor_rotations Motor_degrees Touch Ultrasonic_inch Ultrasonic_cm Color -10000021 10000021 10000021 10000021 10000121 10000021 00000020 00000020 10000021 10000021 10000021 10000021 -E E E E E E E E E E E E -2 3 4 5 B C 8 7 6 9 A D -0 0 0 0 0 0 0 0 0 0 0 0 -1 1 1 1 1 1 1 1 1 1 1 1 +00000001 00000002 00000003 00000004 00000005 00000006 00000007 00000008 00000009 0000000A 0000000B 0000000C 0000000D +02 03 04 05 06 0D 0E 0A 09 08 07 0B 0C +Sound_dB Sound_dBA Reflected_light Ambient_light Light_Sensor* Temperature_`C* Temperature_`F* Rotation* Motor_rotations Motor_degrees Touch Ultrasonic_inch Ultrasonic_cm +10000121 10000021 10000021 10000021 10000021 10000021 10000021 10000021 00000020 00000020 10000021 10000021 10000021 +E E E E E E E E E E E E E +2 3 4 5 6 D E A 9 8 7 B C +0 0 0 0 0 0 0 0 0 0 0 0 0 +1 1 1 1 1 1 1 1 1 1 1 1 1 -00000011 00000021 00000031 00000041 00000017 00000027 00000037 00000018 00000028 00000038 +00000011 00000021 00000031 00000041 00000019 00000029 00000039 0000001A 0000002A 0000003A 12 13 14 15 16 17 18 16 17 18 Port_1 Port_2 Port_3 Port_4 Port_A Port_B Port_C Port_A Port_B Port_C 00000020 00000020 00000020 00000020 00000020 00000020 00000020 00000020 00000020 00000020 diff --git a/AT91SAM7S256/Resource/TEXT/Ui.txt b/AT91SAM7S256/Resource/TEXT/Ui.txt index b0ab7ea..98769e6 100644 --- a/AT91SAM7S256/Resource/TEXT/Ui.txt +++ b/AT91SAM7S256/Resource/TEXT/Ui.txt @@ -17,9 +17,6 @@ Memory full! File saved File exists overwrite! -Saved as -File exist -overwrite! File deleted Files deleted @@ -29,11 +26,6 @@ Done File error! Deleting all %s files! -Press Clear to -stop DataLogging -Port occupied! -H:MM:SS:00 -HH:MM:SS Sound Software NXT @@ -56,6 +48,4 @@ BT store is full error! BT unknown addr. error! -Memory is -full! Never diff --git a/AT91SAM7S256/SAM7S256/Lib/dl4tptinl8n.h b/AT91SAM7S256/SAM7S256/Lib/dl4tptinl8n.h index 008dce6..25c78b9 100644 --- a/AT91SAM7S256/SAM7S256/Lib/dl4tptinl8n.h +++ b/AT91SAM7S256/SAM7S256/Lib/dl4tptinl8n.h @@ -1,5 +1,5 @@ /* Customer-specific DLib configuration. */ -/* Copyright (C) 2003 IAR Systems. All rights reserved. */ +/* Copyright (C) 2003-2005 IAR Systems. All rights reserved. */ #ifndef _DLIB_CONFIG_H #define _DLIB_CONFIG_H diff --git a/AT91SAM7S256/SAM7S256/Lib/dl4tptinl8n.r79 b/AT91SAM7S256/SAM7S256/Lib/dl4tptinl8n.r79 index 8403996..556c330 100644 Binary files a/AT91SAM7S256/SAM7S256/Lib/dl4tptinl8n.r79 and b/AT91SAM7S256/SAM7S256/Lib/dl4tptinl8n.r79 differ diff --git a/AT91SAM7S256/SAM7S256/Lib/dl4tptnnl8n.h b/AT91SAM7S256/SAM7S256/Lib/dl4tptnnl8n.h new file mode 100644 index 0000000..25c78b9 --- /dev/null +++ b/AT91SAM7S256/SAM7S256/Lib/dl4tptnnl8n.h @@ -0,0 +1,9 @@ +/* Customer-specific DLib configuration. */ +/* Copyright (C) 2003-2005 IAR Systems. All rights reserved. */ + +#ifndef _DLIB_CONFIG_H +#define _DLIB_CONFIG_H + +/* No changes to the defaults. */ + +#endif /* _DLIB_CONFIG_H */ diff --git a/AT91SAM7S256/SAM7S256/Lib/dl4tptnnl8n.r79 b/AT91SAM7S256/SAM7S256/Lib/dl4tptnnl8n.r79 new file mode 100644 index 0000000..87742c6 Binary files /dev/null and b/AT91SAM7S256/SAM7S256/Lib/dl4tptnnl8n.r79 differ diff --git a/AT91SAM7S256/SAM7S256/Tools/LMS_ARM.dep b/AT91SAM7S256/SAM7S256/Tools/LMS_ARM.dep index 6f4e5e9..f63a772 100644 --- a/AT91SAM7S256/SAM7S256/Tools/LMS_ARM.dep +++ b/AT91SAM7S256/SAM7S256/Tools/LMS_ARM.dep @@ -1,169 +1,317 @@ - 1 + 2 + 2103580747 - Bin Output + Benchmark + + $PROJ_DIR$\..\..\Source\c_output.iom + $PROJ_DIR$\Benchmark\Obj\d_button.pbi + $TOOLKIT_DIR$\inc\xlocale.h + $PROJ_DIR$\..\..\Source\d_output.r + $PROJ_DIR$\..\..\Source\RCXintro_2.txt + $PROJ_DIR$\..\..\Source\c_display.c + $PROJ_DIR$\..\..\Source\Port.txt + $PROJ_DIR$\..\..\Source\RCXintro_5.txt + $PROJ_DIR$\..\..\Source\d_bt.r + $PROJ_DIR$\..\..\Source\c_display.h + $PROJ_DIR$\..\..\Source\Cursor.txt + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\..\..\Source\d_loader.r + $PROJ_DIR$\..\..\Source\c_comm.iom + $PROJ_DIR$\..\..\Source\RCXintro_14.txt + $PROJ_DIR$\..\..\Source\d_display.r + $PROJ_DIR$\..\..\Source\c_comm.c + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\Benchmark\Obj\d_input.pbi + $PROJ_DIR$\..\..\Source\d_sound.r + $PROJ_DIR$\Benchmark\Obj\d_sound.pbi + $PROJ_DIR$\Benchmark\Obj\c_comm.pbi + $PROJ_DIR$\..\..\Source\d_button.r + $PROJ_DIR$\..\..\Source\Devices.txt + $TOOLKIT_DIR$\inc\xlocaleuse.h + $PROJ_DIR$\..\..\Source\Info.txt + $PROJ_DIR$\..\..\Source\RCXintro_8.txt + $PROJ_DIR$\..\..\Source\Connections.txt + $PROJ_DIR$\..\..\Source\d_bt.h + $PROJ_DIR$\..\..\Source\d_sound.h + $TOOLKIT_DIR$\inc\stdlib.h + $PROJ_DIR$\Benchmark\Obj\c_ui.pbi + $PROJ_DIR$\..\..\Source\d_display.h + $PROJ_DIR$\Benchmark\Obj\c_input.r79 + $PROJ_DIR$\Benchmark\Obj\c_cmd.pbi + $PROJ_DIR$\..\..\Source\c_button.h + $PROJ_DIR$\Benchmark\Obj\c_button.pbi + $PROJ_DIR$\..\..\Source\d_usb.h + $PROJ_DIR$\..\..\Source\Mainmenu.rms + $PROJ_DIR$\Benchmark\Obj\d_display.pbi + $PROJ_DIR$\..\..\Source\RCXintro_6.txt + $TOOLKIT_DIR$\inc\ctype.h + $PROJ_DIR$\Benchmark\Exe\LMS_ARM.d79 + $PROJ_DIR$\..\..\Source\c_cmd.h + $PROJ_DIR$\Benchmark\Obj\c_button.r79 + $PROJ_DIR$\Benchmark\Obj\c_ui.r79 + $PROJ_DIR$\..\..\Source\d_input.h + $PROJ_DIR$\Benchmark\Obj\c_display.pbi + $PROJ_DIR$\Benchmark\Obj\d_usb.pbi + $PROJ_DIR$\..\..\Source\RCXintro_10.txt + $PROJ_DIR$\..\..\Source\d_ioctrl.r + $PROJ_DIR$\..\..\Source\RCXintro_3.txt + $TOOLKIT_DIR$\inc\stdbool.h + $PROJ_DIR$\..\Include\sam7s256.c + $TOOLKIT_DIR$\inc\xlocale_c.h + $PROJ_DIR$\..\..\Source\c_lowspeed.iom + $PROJ_DIR$\..\..\Source\Fail.txt + $PROJ_DIR$\..\Lib\dl4tptinl8n.h + $PROJ_DIR$\..\..\Source\Submenu05.rms + $PROJ_DIR$\..\..\Source\RCXintro_15.txt + $PROJ_DIR$\..\..\Source\Icons.txt + $PROJ_DIR$\..\..\Source\LowBattery.txt + $PROJ_DIR$\..\..\Source\Display.txt + $PROJ_DIR$\Benchmark\Obj\LMS_ARM.pbd + $PROJ_DIR$\..\..\Source\d_output.h + $PROJ_DIR$\..\..\Source\c_ui.iom + $PROJ_DIR$\..\..\Source\c_comm.h + $PROJ_DIR$\..\..\Source\d_lowspeed.h + $PROJ_DIR$\..\..\Source\c_loader.h + $PROJ_DIR$\..\..\Source\RCXintro_7.txt + $PROJ_DIR$\..\Include\ioat91sam7s256.h + $PROJ_DIR$\Benchmark\Obj\c_loader.r79 + $PROJ_DIR$\..\..\Source\c_lowspeed.h + $PROJ_DIR$\..\..\Source\c_sound.h + $PROJ_DIR$\Benchmark\Obj\d_hispeed.r79 + $PROJ_DIR$\..\..\Source\d_ioctrl.h + $PROJ_DIR$\Benchmark\Obj\d_timer.pbi + $PROJ_DIR$\..\..\Source\c_display.iom + $PROJ_DIR$\Benchmark\Obj\c_sound.r79 + $TOOLKIT_DIR$\inc\xtinfo.h + $PROJ_DIR$\..\..\Source\c_loader.iom + $PROJ_DIR$\..\..\Source\Test2.txt + $PROJ_DIR$\Benchmark\Obj\d_ioctrl.r79 + $PROJ_DIR$\Benchmark\Obj\d_lowspeed.pbi + $PROJ_DIR$\..\..\Source\RCXintro_4.txt + $PROJ_DIR$\..\..\Source\d_hispeed.r + $PROJ_DIR$\Benchmark\Obj\c_cmd.r79 + $PROJ_DIR$\Benchmark\Obj\d_bt.pbi + $PROJ_DIR$\..\..\Source\Submenu07.rms + $PROJ_DIR$\..\..\Source\d_lowspeed.r + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\..\..\Source\c_output.h + $PROJ_DIR$\..\..\Source\c_cmd_drawing.inc + $PROJ_DIR$\Benchmark\Obj\d_output.pbi + $PROJ_DIR$\..\..\Source\Submenu02.rms + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\..\Include\AT91SAM7S256_inc.h + $PROJ_DIR$\..\..\Source\c_ioctrl.h + $PROJ_DIR$\..\..\Source\RCXintro_1.txt + $PROJ_DIR$\..\..\Source\RCXintro_9.txt + $PROJ_DIR$\..\..\Source\c_input.h + $PROJ_DIR$\..\..\Source\d_input.r + $PROJ_DIR$\Benchmark\Obj\c_ioctrl.r79 + $PROJ_DIR$\..\..\Source\Font.txt + $PROJ_DIR$\Benchmark\Obj\c_comm.r79 + $PROJ_DIR$\..\..\Source\c_ui.h + $PROJ_DIR$\Benchmark\Obj\c_lowspeed.r79 + $PROJ_DIR$\..\..\Source\RCXintro_13.txt + $TOOLKIT_DIR$\inc\wchar.h + $PROJ_DIR$\Benchmark\Obj\d_hispeed.pbi + $PROJ_DIR$\..\..\Source\d_hispeed.h + $PROJ_DIR$\..\..\Source\m_sched.h + $PROJ_DIR$\Benchmark\Obj\c_sound.pbi + $PROJ_DIR$\Benchmark\Obj\c_loader.pbi + $TOOLKIT_DIR$\inc\time.h + $PROJ_DIR$\..\..\Source\Step.txt + $PROJ_DIR$\..\..\Source\RCXintro_16.txt + $PROJ_DIR$\Benchmark\Obj\d_button.r79 + $PROJ_DIR$\Benchmark\Obj\d_ioctrl.pbi + $PROJ_DIR$\Benchmark\Obj\c_input.pbi + $TOOLKIT_DIR$\inc\stdio.h + $PROJ_DIR$\..\..\Source\Ui.txt + $TOOLKIT_DIR$\inc\DLib_Product.h + $PROJ_DIR$\..\..\Source\d_loader.h + $PROJ_DIR$\..\..\Source\RCXintro_12.txt + $PROJ_DIR$\..\..\Source\c_cmd_bytecodes.h + $PROJ_DIR$\Benchmark\Obj\d_loader.pbi + $PROJ_DIR$\Benchmark\Obj\c_ioctrl.pbi + $PROJ_DIR$\Benchmark\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\Benchmark\Obj\d_timer.r79 + $PROJ_DIR$\..\..\Source\c_button.iom + $PROJ_DIR$\Benchmark\Obj\d_display.r79 + $PROJ_DIR$\..\..\Source\d_usb.r + $PROJ_DIR$\..\..\Source\Submenu06.rms + $TOOLKIT_DIR$\inc\xtls.h + $PROJ_DIR$\..\..\Source\c_cmd.iom + $PROJ_DIR$\..\..\Source\BtTest.inc + $PROJ_DIR$\Benchmark\Obj\c_lowspeed.pbi + $PROJ_DIR$\..\..\Source\c_ioctrl.iom + $PROJ_DIR$\..\..\Source\Running.txt + $PROJ_DIR$\Benchmark\Obj\c_output.pbi + $PROJ_DIR$\..\..\Source\c_input.iom + $PROJ_DIR$\Benchmark\Obj\d_usb.r79 + $PROJ_DIR$\Benchmark\Obj\d_loader.r79 + $PROJ_DIR$\Benchmark\Obj\m_sched.r79 + $PROJ_DIR$\..\..\Source\d_timer.h + $PROJ_DIR$\..\..\Source\Ok.txt + $PROJ_DIR$\Benchmark\Obj\c_display.r79 + $PROJ_DIR$\..\..\Source\modules.h + $PROJ_DIR$\Benchmark\Obj\d_bt.r79 + $PROJ_DIR$\Benchmark\Obj\Cstartup_SAM7.r79 + $PROJ_DIR$\Benchmark\Obj\d_sound.r79 + $PROJ_DIR$\Benchmark\Obj\d_lowspeed.r79 + $PROJ_DIR$\..\..\Source\Submenu04.rms + $PROJ_DIR$\..\..\Source\RCXintro_11.txt + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $PROJ_DIR$\..\..\Source\d_timer.r + $PROJ_DIR$\Benchmark\Obj\m_sched.pbi + $PROJ_DIR$\..\..\Source\Test1.txt + $PROJ_DIR$\..\..\Source\Status.txt + $PROJ_DIR$\..\..\Source\Submenu01.rms + $PROJ_DIR$\Benchmark\Obj\d_output.r79 + $PROJ_DIR$\Benchmark\Obj\c_output.r79 + $PROJ_DIR$\..\Include\sam7s256.h + $PROJ_DIR$\..\..\Source\Wait.txt + $PROJ_DIR$\..\..\Source\c_sound.iom + $PROJ_DIR$\..\..\Source\c_button.c + $PROJ_DIR$\..\..\Source\c_cmd.c + $PROJ_DIR$\..\..\Source\c_input.c + $PROJ_DIR$\..\..\Source\c_ioctrl.c + $PROJ_DIR$\..\..\Source\c_loader.c + $PROJ_DIR$\..\..\Source\c_lowspeed.c + $PROJ_DIR$\..\..\Source\c_output.c + $PROJ_DIR$\..\..\Source\c_sound.c + $PROJ_DIR$\..\..\Source\c_ui.c + $PROJ_DIR$\..\..\Source\d_bt.c + $PROJ_DIR$\..\Include\Cstartup.s79 + $PROJ_DIR$\..\Include\Cstartup_SAM7.c + $PROJ_DIR$\..\..\Source\d_button.c + $PROJ_DIR$\..\..\Source\d_display.c + $PROJ_DIR$\..\..\Source\d_hispeed.c + $PROJ_DIR$\..\..\Source\d_input.c + $PROJ_DIR$\..\..\Source\d_ioctrl.c + $PROJ_DIR$\..\..\Source\d_loader.c + $PROJ_DIR$\..\..\Source\d_lowspeed.c + $PROJ_DIR$\..\..\Source\d_output.c + $PROJ_DIR$\..\..\Source\d_sound.c + $PROJ_DIR$\..\..\Source\d_timer.c + $PROJ_DIR$\..\..\Source\d_usb.c + $PROJ_DIR$\..\..\Source\Functions.inl + $PROJ_DIR$\..\..\Source\m_sched.c + $TOOLKIT_DIR$\inc\xmtx.h + $TOOLKIT_DIR$\inc\string.h + $PROJ_DIR$\..\..\Source\stdconst.h + $PROJ_DIR$\..\Include\AT91SAM7S256.h + $PROJ_DIR$\Benchmark\Obj\d_input.r79 + $PROJ_DIR$\..\..\Source\d_button.h + $PROJ_DIR$\Benchmark\Obj\Cstartup.r79 + [ROOT_NODE] XLINK - $PROJ_DIR$\Bin Output\List\LMS_ARM.map - $PROJ_DIR$\Bin Output\Exe\LMS_ARM.d79 - $PROJ_DIR$\Bin Output\Exe\LMS_ARM.a79 - $PROJ_DIR$\..\Object\LMS_ARM.d79 + 42 - $PROJ_DIR$\Bin Output\Exe\LMS_ARM.d79 + $PROJ_DIR$\..\..\Source\c_display.c - XLINK - $PROJ_DIR$\Bin Output\List\LMS_ARM.map - $PROJ_DIR$\Bin Output\Exe\LMS_ARM.a79 + ICCARM + 147 + + + BICOMP + 47 - XLINK - $PROJ_DIR$\at91SAM7S256_Remap.xcl - $PROJ_DIR$\Bin Output\Obj\Cstartup.r79 - $PROJ_DIR$\Bin Output\Obj\Cstartup_SAM7.r79 - $PROJ_DIR$\Bin Output\Obj\c_button.r79 - $PROJ_DIR$\Bin Output\Obj\c_cmd.r79 - $PROJ_DIR$\Bin Output\Obj\c_comm.r79 - $PROJ_DIR$\Bin Output\Obj\c_display.r79 - $PROJ_DIR$\Bin Output\Obj\c_input.r79 - $PROJ_DIR$\Bin Output\Obj\c_ioctrl.r79 - $PROJ_DIR$\Bin Output\Obj\c_led.r79 - $PROJ_DIR$\Bin Output\Obj\c_loader.r79 - $PROJ_DIR$\Bin Output\Obj\c_lowspeed.r79 - $PROJ_DIR$\Bin Output\Obj\c_output.r79 - $PROJ_DIR$\Bin Output\Obj\c_sound.r79 - $PROJ_DIR$\Bin Output\Obj\c_ui.r79 - $PROJ_DIR$\Bin Output\Obj\d_bt.r79 - $PROJ_DIR$\Bin Output\Obj\d_button.r79 - $PROJ_DIR$\Bin Output\Obj\d_display.r79 - $PROJ_DIR$\Bin Output\Obj\d_hispeed.r79 - $PROJ_DIR$\Bin Output\Obj\d_input.r79 - $PROJ_DIR$\Bin Output\Obj\d_ioctrl.r79 - $PROJ_DIR$\Bin Output\Obj\d_led.r79 - $PROJ_DIR$\Bin Output\Obj\d_loader.r79 - $PROJ_DIR$\Bin Output\Obj\d_lowspeed.r79 - $PROJ_DIR$\Bin Output\Obj\d_output.r79 - $PROJ_DIR$\Bin Output\Obj\d_sound.r79 - $PROJ_DIR$\Bin Output\Obj\d_timer.r79 - $PROJ_DIR$\Bin Output\Obj\d_usb.r79 - $PROJ_DIR$\Bin Output\Obj\m_sched.r79 - $TOOLKIT_DIR$\lib\dl4tptinl8n.r79 + ICCARM + 192 11 155 57 122 90 95 17 193 148 77 9 32 + + + BICOMP + 192 11 155 122 90 95 17 193 148 77 9 32 - $PROJ_DIR$\..\..\Source\c_led.c + $PROJ_DIR$\..\..\Source\c_comm.c ICCARM - $PROJ_DIR$\..\Object\c_led.r79 + 104 + + + BICOMP + 21 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_led.iom - $PROJ_DIR$\..\..\Source\c_led.h - $PROJ_DIR$\..\..\Source\d_led.h + 193 148 13 80 138 65 135 77 66 37 110 28 192 11 155 57 122 90 95 17 41 2 134 191 30 24 54 79 114 108 + + + BICOMP + 193 148 13 80 138 65 135 77 66 37 110 28 192 11 155 122 90 95 17 41 2 134 191 30 24 54 79 114 108 - $PROJ_DIR$\..\..\Source\c_ui.c + $PROJ_DIR$\Benchmark\Obj\LMS_ARM.pbd + + + BILINK + 128 36 34 21 47 119 127 113 137 140 112 31 87 1 39 109 18 118 126 83 93 20 76 48 157 + + + + + $PROJ_DIR$\..\..\Source\c_button.c ICCARM - $PROJ_DIR$\..\Object\c_ui.r79 - - - - - ICCARM - $TOOLKIT_DIR$\inc\stdio.h - $TOOLKIT_DIR$\inc\yvals.h - $TOOLKIT_DIR$\inc\DLib_Defaults.h - $TOOLKIT_DIR$\lib\dl4tptinl8n.h - $TOOLKIT_DIR$\inc\DLib_Product.h - $TOOLKIT_DIR$\inc\xencoding_limits.h - $TOOLKIT_DIR$\inc\ysizet.h - $TOOLKIT_DIR$\inc\string.h - $TOOLKIT_DIR$\inc\ctype.h - $TOOLKIT_DIR$\inc\xlocale.h - $TOOLKIT_DIR$\inc\xtls.h - $TOOLKIT_DIR$\inc\xmtx.h - $TOOLKIT_DIR$\inc\stdlib.h - $TOOLKIT_DIR$\inc\xlocaleuse.h - $TOOLKIT_DIR$\inc\xlocale_c.h - $TOOLKIT_DIR$\inc\xtinfo.h - $TOOLKIT_DIR$\inc\time.h - $TOOLKIT_DIR$\inc\wchar.h - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_ui.iom - $PROJ_DIR$\..\..\Source\c_ui.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\c_loader.iom - $PROJ_DIR$\..\..\Source\c_display.iom - $PROJ_DIR$\..\..\Source\c_button.iom - $PROJ_DIR$\..\..\Source\c_sound.iom - $PROJ_DIR$\..\..\Source\c_input.iom - $PROJ_DIR$\..\..\Source\c_output.iom - $PROJ_DIR$\..\..\Source\c_ioctrl.iom - $PROJ_DIR$\..\..\Source\c_cmd.iom - $PROJ_DIR$\..\..\Source\c_comm.iom - $PROJ_DIR$\..\..\Source\Display.txt - $PROJ_DIR$\..\..\Source\LowBattery.txt - $PROJ_DIR$\..\..\Source\Startup.txt - $PROJ_DIR$\..\..\Source\Font.txt - $PROJ_DIR$\..\..\Source\Status.txt - $PROJ_DIR$\..\..\Source\Functions.inc - $PROJ_DIR$\..\..\Source\Test1.txt - $PROJ_DIR$\..\..\Source\Test2.txt - $PROJ_DIR$\..\..\Source\Running.txt - $PROJ_DIR$\..\..\Source\BtTest.inc - $PROJ_DIR$\..\..\Source\Mainmenu.rms - $PROJ_DIR$\..\..\Source\Submenu01.rms - $PROJ_DIR$\..\..\Source\Submenu02.rms - $PROJ_DIR$\..\..\Source\Submenu03.rms - $PROJ_DIR$\..\..\Source\Submenu04.rms - $PROJ_DIR$\..\..\Source\Submenu05.rms - $PROJ_DIR$\..\..\Source\Submenu06.rms - $PROJ_DIR$\..\..\Source\Submenu07.rms - $PROJ_DIR$\..\..\Source\Submenu10.rms - $PROJ_DIR$\..\..\Source\Submenu11.rms + 44 + + + BICOMP + 36 + + + + + ICCARM + 193 148 35 130 196 + + + BICOMP + 193 148 35 130 196 - $PROJ_DIR$\..\..\Source\c_display.c + $PROJ_DIR$\..\..\Source\c_cmd.c ICCARM - $PROJ_DIR$\..\Object\c_display.r79 + 86 + + + BICOMP + 34 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_display.iom - $PROJ_DIR$\..\..\Source\c_display.h - $PROJ_DIR$\..\..\Source\d_display.h + 193 148 135 0 141 80 65 165 130 77 13 55 43 125 145 120 11 155 57 122 90 95 17 192 30 92 + + + BICOMP + 193 148 135 0 141 80 65 165 130 77 13 55 43 125 145 120 11 155 122 90 95 17 192 30 92 @@ -172,18 +320,21 @@ ICCARM - $PROJ_DIR$\..\Object\c_input.r79 + 33 + + + BICOMP + 119 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_input.h - $PROJ_DIR$\..\..\Source\c_input.iom - $PROJ_DIR$\..\..\Source\d_input.h - $PROJ_DIR$\..\..\Source\c_output.iom + 193 148 100 141 46 0 + + + BICOMP + 193 148 100 141 46 0 @@ -192,17 +343,21 @@ ICCARM - $PROJ_DIR$\..\Object\c_ioctrl.r79 + 102 + + + BICOMP + 127 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_ioctrl.iom - $PROJ_DIR$\..\..\Source\c_ioctrl.h - $PROJ_DIR$\..\..\Source\d_ioctrl.h + 193 148 138 97 75 + + + BICOMP + 193 148 138 97 75 @@ -211,18 +366,21 @@ ICCARM - $PROJ_DIR$\..\Object\c_loader.r79 + 71 + + + BICOMP + 113 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_loader.iom - $PROJ_DIR$\..\..\Source\c_ioctrl.iom - $PROJ_DIR$\..\..\Source\d_loader.h - $PROJ_DIR$\..\..\Source\c_loader.h + 193 148 80 138 123 68 + + + BICOMP + 193 148 80 138 123 68 @@ -231,17 +389,21 @@ ICCARM - $PROJ_DIR$\..\Object\c_lowspeed.r79 + 106 + + + BICOMP + 137 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_lowspeed.iom - $PROJ_DIR$\..\..\Source\c_lowspeed.h - $PROJ_DIR$\..\..\Source\d_lowspeed.h + 193 148 55 141 72 67 + + + BICOMP + 193 148 55 141 72 67 @@ -250,25 +412,21 @@ ICCARM - $PROJ_DIR$\..\Object\c_output.r79 + 162 + + + BICOMP + 140 ICCARM - $TOOLKIT_DIR$\inc\stdio.h - $TOOLKIT_DIR$\inc\yvals.h - $TOOLKIT_DIR$\inc\DLib_Defaults.h - $TOOLKIT_DIR$\lib\dl4tptinl8n.h - $TOOLKIT_DIR$\inc\DLib_Product.h - $TOOLKIT_DIR$\inc\xencoding_limits.h - $TOOLKIT_DIR$\inc\ysizet.h - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_output.iom - $PROJ_DIR$\..\..\Source\c_output.h - $PROJ_DIR$\..\..\Source\d_output.h - $PROJ_DIR$\..\..\Source\c_display.iom + 120 11 155 57 122 90 95 17 52 193 148 0 91 64 77 + + + BICOMP + 120 11 155 122 90 95 17 52 193 148 0 91 64 77 @@ -277,26 +435,67 @@ ICCARM - $PROJ_DIR$\..\Object\c_sound.r79 + 78 + + + BICOMP + 112 + + + + + ICCARM + 30 11 155 57 122 90 95 17 192 193 148 165 80 73 29 + + + BICOMP + 30 11 155 122 90 95 17 192 193 148 165 80 73 29 + + + + + $PROJ_DIR$\..\..\Source\c_ui.c + + + ICCARM + 45 + + + BICOMP + 31 + + + + + ICCARM + 120 11 155 57 122 90 95 17 192 41 2 134 191 30 24 54 79 114 108 193 148 65 105 111 163 70 77 80 130 165 141 0 138 135 13 55 62 61 103 115 10 139 6 146 164 56 25 60 98 4 51 84 7 40 69 26 99 49 154 124 107 14 59 116 159 23 27 121 38 160 94 153 58 133 88 189 136 158 81 + + + BICOMP + 120 11 155 122 90 95 17 192 41 2 134 191 30 24 54 79 114 108 193 148 65 105 111 163 70 77 80 130 165 141 0 138 135 13 55 62 61 103 115 10 139 6 146 164 56 25 60 98 4 51 84 7 40 69 26 99 49 154 124 107 14 59 116 159 23 27 121 38 160 94 153 58 133 88 189 136 158 81 + + + + + $PROJ_DIR$\..\..\Source\d_bt.c + + + ICCARM + 149 + + + BICOMP + 87 ICCARM - $TOOLKIT_DIR$\inc\stdlib.h - $TOOLKIT_DIR$\inc\yvals.h - $TOOLKIT_DIR$\inc\DLib_Defaults.h - $TOOLKIT_DIR$\lib\dl4tptinl8n.h - $TOOLKIT_DIR$\inc\DLib_Product.h - $TOOLKIT_DIR$\inc\xencoding_limits.h - $TOOLKIT_DIR$\inc\ysizet.h - $TOOLKIT_DIR$\inc\string.h - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_sound.iom - $PROJ_DIR$\..\..\Source\c_loader.iom - $PROJ_DIR$\..\..\Source\c_sound.h - $PROJ_DIR$\..\..\Source\d_sound.h + 193 148 111 163 70 28 8 192 11 155 57 122 90 95 17 + + + BICOMP + 193 148 111 163 70 28 8 192 11 155 122 90 95 17 @@ -305,13 +504,13 @@ AARM - $PROJ_DIR$\..\Object\Cstartup.r79 + 197 AARM - $PROJ_DIR$\..\Include\AT91SAM7S256_inc.h + 96 @@ -320,299 +519,1775 @@ ICCARM - $PROJ_DIR$\..\Object\Cstartup_SAM7.r79 + 150 + + + BICOMP + 128 ICCARM - $PROJ_DIR$\..\Include\AT91SAM7S256.h + 194 + + + BICOMP + 194 - $PROJ_DIR$\..\..\Source\d_bt.c + $PROJ_DIR$\..\..\Source\d_button.c ICCARM - $PROJ_DIR$\..\Object\d_bt.r79 + 117 + + + BICOMP + 1 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_bt.h - $PROJ_DIR$\..\..\Source\d_bt.r + 193 111 163 70 196 22 + + + BICOMP + 193 111 163 70 196 22 - $PROJ_DIR$\..\..\Source\d_usb.c + $PROJ_DIR$\..\..\Source\d_display.c ICCARM - $PROJ_DIR$\..\Object\d_usb.r79 + 131 + + + BICOMP + 39 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_usb.h - $PROJ_DIR$\..\..\Source\d_usb.r + 193 111 163 70 32 15 + + + BICOMP + 193 111 163 70 192 11 155 122 90 95 17 32 15 - $PROJ_DIR$\..\..\Source\d_button.c + $PROJ_DIR$\..\..\Source\d_hispeed.c ICCARM - $PROJ_DIR$\..\Object\d_button.r79 + 74 + + + BICOMP + 109 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_button.h - $PROJ_DIR$\..\..\Source\d_button.r + 193 111 163 70 110 85 + + + BICOMP + 193 111 163 70 110 85 - $PROJ_DIR$\..\..\Source\d_display.c + $PROJ_DIR$\..\..\Source\d_input.c ICCARM - $PROJ_DIR$\..\Object\d_display.r79 + 195 + + + BICOMP + 18 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_display.h - $PROJ_DIR$\..\..\Source\d_display.r + 193 111 163 70 100 141 46 101 + + + BICOMP + 193 111 163 70 100 141 46 101 - $PROJ_DIR$\..\..\Source\d_hispeed.c + $PROJ_DIR$\..\..\Source\d_ioctrl.c + + + ICCARM + 82 + + + BICOMP + 118 + + + + + ICCARM + 192 11 155 57 122 90 95 17 193 111 163 70 75 50 + + + BICOMP + 192 11 155 122 90 95 17 193 111 163 70 75 50 + + + + + $PROJ_DIR$\..\..\Source\d_loader.c + + + ICCARM + 143 + + + BICOMP + 126 + + + + + ICCARM + 193 148 111 163 70 123 12 192 11 155 57 122 90 95 17 41 2 134 191 30 24 54 79 114 108 + + + BICOMP + 193 148 111 163 70 123 12 192 11 155 122 90 95 17 41 2 134 191 30 24 54 79 114 108 + + + + + $PROJ_DIR$\..\..\Source\d_lowspeed.c + + + ICCARM + 152 + + + BICOMP + 83 + + + + + ICCARM + 193 111 163 70 67 89 + + + BICOMP + 193 111 163 70 67 89 + + + + + $PROJ_DIR$\..\..\Source\d_output.c + + + ICCARM + 161 + + + BICOMP + 93 + + + + + ICCARM + 193 111 163 70 64 3 + + + BICOMP + 193 111 163 70 64 3 + + + + + $PROJ_DIR$\..\..\Source\d_sound.c + + + ICCARM + 151 + + + BICOMP + 20 + + + + + ICCARM + 193 111 163 70 29 19 + + + BICOMP + 193 111 163 70 29 19 + + + + + $PROJ_DIR$\..\..\Source\d_timer.c + + + ICCARM + 129 + + + BICOMP + 76 + + + + + ICCARM + 193 111 163 70 145 156 + + + BICOMP + 193 111 163 70 145 156 + + + + + $PROJ_DIR$\..\..\Source\d_usb.c + + + ICCARM + 142 + + + BICOMP + 48 + + + + + ICCARM + 193 111 163 70 37 132 + + + BICOMP + 193 111 163 70 37 132 + + + + + $PROJ_DIR$\..\..\Source\m_sched.c ICCARM - $PROJ_DIR$\..\Object\d_hispeed.r79 + 144 + + + BICOMP + 157 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_hispeed.h - $PROJ_DIR$\..\..\Source\d_hispeed.r + 193 148 111 163 70 53 66 100 141 35 130 68 73 9 72 91 43 125 135 97 105 + + + BICOMP + 193 148 111 163 70 53 66 100 141 35 130 68 73 9 72 91 43 125 135 97 105 + + + + + [MULTI_TOOL] + XLINK + + + [REBUILD_ALL] + + + + Bin Output + + $PROJ_DIR$\..\..\Source\c_output.iom + $TOOLKIT_DIR$\inc\xlocale.h + $PROJ_DIR$\..\..\Source\d_output.r + $PROJ_DIR$\..\..\Source\RCXintro_2.txt + $PROJ_DIR$\..\..\Source\c_display.c + $PROJ_DIR$\..\..\Source\Port.txt + $PROJ_DIR$\..\..\Source\RCXintro_5.txt + $PROJ_DIR$\..\..\Source\d_bt.r + $PROJ_DIR$\..\..\Source\c_display.h + $PROJ_DIR$\..\..\Source\Cursor.txt + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\..\..\Source\d_loader.r + $PROJ_DIR$\..\..\Source\c_comm.iom + $PROJ_DIR$\..\..\Source\RCXintro_14.txt + $PROJ_DIR$\..\..\Source\d_display.r + $PROJ_DIR$\..\..\Source\c_comm.c + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\..\..\Source\d_sound.r + $PROJ_DIR$\..\..\Source\d_button.r + $PROJ_DIR$\..\..\Source\Devices.txt + $TOOLKIT_DIR$\inc\xlocaleuse.h + $PROJ_DIR$\..\..\Source\Info.txt + $PROJ_DIR$\..\..\Source\RCXintro_8.txt + $PROJ_DIR$\..\..\Source\Connections.txt + $PROJ_DIR$\..\..\Source\d_bt.h + $PROJ_DIR$\..\..\Source\d_sound.h + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\..\Object\d_ioctrl.pbi + $TOOLKIT_DIR$\inc\stdlib.h + $PROJ_DIR$\..\..\Source\d_display.h + $PROJ_DIR$\..\..\Source\c_button.h + $PROJ_DIR$\..\..\Source\d_usb.h + $PROJ_DIR$\..\..\Source\Mainmenu.rms + $PROJ_DIR$\..\..\Source\RCXintro_6.txt + $TOOLKIT_DIR$\inc\ctype.h + $PROJ_DIR$\..\..\Source\c_cmd.h + $PROJ_DIR$\..\Object\c_cmd.pbi + $PROJ_DIR$\..\..\Source\d_input.h + $PROJ_DIR$\..\..\Source\RCXintro_10.txt + $PROJ_DIR$\..\..\Source\d_ioctrl.r + $PROJ_DIR$\..\..\Source\RCXintro_3.txt + $TOOLKIT_DIR$\inc\stdbool.h + $PROJ_DIR$\..\Include\sam7s256.c + $TOOLKIT_DIR$\inc\xlocale_c.h + $PROJ_DIR$\..\..\Source\c_lowspeed.iom + $PROJ_DIR$\..\..\Source\Fail.txt + $PROJ_DIR$\..\Lib\dl4tptinl8n.h + $PROJ_DIR$\..\..\Source\Submenu05.rms + $PROJ_DIR$\..\..\Source\RCXintro_15.txt + $PROJ_DIR$\..\..\Source\Icons.txt + $PROJ_DIR$\..\..\Source\LowBattery.txt + $PROJ_DIR$\..\..\Source\Display.txt + $PROJ_DIR$\..\..\Source\d_output.h + $PROJ_DIR$\..\..\Source\c_ui.iom + $PROJ_DIR$\..\..\Source\c_comm.h + $PROJ_DIR$\..\..\Source\d_lowspeed.h + $PROJ_DIR$\..\..\Source\c_loader.h + $PROJ_DIR$\..\..\Source\RCXintro_7.txt + $PROJ_DIR$\..\Include\ioat91sam7s256.h + $PROJ_DIR$\..\..\Source\c_lowspeed.h + $PROJ_DIR$\..\..\Source\c_sound.h + $PROJ_DIR$\..\..\Source\d_ioctrl.h + $PROJ_DIR$\..\..\Source\c_display.iom + $TOOLKIT_DIR$\inc\xtinfo.h + $PROJ_DIR$\..\..\Source\c_loader.iom + $PROJ_DIR$\..\..\Source\Test2.txt + $PROJ_DIR$\..\..\Source\RCXintro_4.txt + $PROJ_DIR$\..\..\Source\d_hispeed.r + $PROJ_DIR$\..\..\Source\Submenu07.rms + $PROJ_DIR$\..\..\Source\d_lowspeed.r + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\..\..\Source\c_output.h + $PROJ_DIR$\..\..\Source\c_cmd_drawing.inc + $PROJ_DIR$\..\..\Source\Submenu02.rms + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\..\Include\AT91SAM7S256_inc.h + $PROJ_DIR$\..\..\Source\c_ioctrl.h + $PROJ_DIR$\..\..\Source\RCXintro_1.txt + $PROJ_DIR$\..\..\Source\RCXintro_9.txt + $PROJ_DIR$\..\..\Source\c_input.h + $PROJ_DIR$\..\..\Source\d_input.r + $PROJ_DIR$\..\..\Source\Font.txt + $PROJ_DIR$\..\..\Source\c_ui.h + $PROJ_DIR$\..\..\Source\RCXintro_13.txt + $TOOLKIT_DIR$\inc\wchar.h + $PROJ_DIR$\..\..\Source\d_hispeed.h + $PROJ_DIR$\..\..\Source\m_sched.h + $TOOLKIT_DIR$\inc\time.h + $PROJ_DIR$\..\..\Source\Step.txt + $PROJ_DIR$\..\..\Source\RCXintro_16.txt + $TOOLKIT_DIR$\inc\stdio.h + $PROJ_DIR$\..\..\Source\Ui.txt + $TOOLKIT_DIR$\inc\DLib_Product.h + $PROJ_DIR$\..\..\Source\d_loader.h + $PROJ_DIR$\..\..\Source\RCXintro_12.txt + $PROJ_DIR$\..\..\Source\c_cmd_bytecodes.h + $PROJ_DIR$\..\..\Source\c_button.iom + $PROJ_DIR$\..\..\Source\d_usb.r + $PROJ_DIR$\..\..\Source\Submenu06.rms + $TOOLKIT_DIR$\inc\xtls.h + $PROJ_DIR$\..\..\Source\c_cmd.iom + $PROJ_DIR$\..\..\Source\BtTest.inc + $PROJ_DIR$\..\Object\d_sound.s + $PROJ_DIR$\..\Object\c_input.r79 + $PROJ_DIR$\..\Object\c_button.r79 + $PROJ_DIR$\..\Object\LMS_ARM.map + $PROJ_DIR$\..\Object\c_comm.s + $PROJ_DIR$\..\Object\d_sound.pbi + $PROJ_DIR$\..\Object\Cstartup_SAM7.pbi + $PROJ_DIR$\..\Object\c_display.pbi + $PROJ_DIR$\..\Object\d_timer.s + $PROJ_DIR$\..\Object\d_hispeed.pbi + $PROJ_DIR$\..\Object\d_ioctrl.s + $PROJ_DIR$\..\..\Source\c_led.iom + $PROJ_DIR$\..\Object\m_sched.r79 + $PROJ_DIR$\..\Object\d_loader.s + $PROJ_DIR$\..\Object\d_button.pbi + $PROJ_DIR$\..\Object\c_lowspeed.r79 + $PROJ_DIR$\..\Object\d_display.s + $PROJ_DIR$\..\Object\d_sound.r79 + $PROJ_DIR$\..\Object\c_comm.r79 + $PROJ_DIR$\..\Object\c_ui.r79 + $PROJ_DIR$\..\Object\d_button.r79 + $TOOLKIT_DIR$\inc\ymath.h + $PROJ_DIR$\..\Object\d_display.r79 + $PROJ_DIR$\..\Object\m_sched.s + $PROJ_DIR$\..\Object\d_output.pbi + $PROJ_DIR$\..\Object\Cstartup_SAM7.s + $PROJ_DIR$\..\Object\d_ioctrl.r79 + $PROJ_DIR$\..\Object\c_input.s + $PROJ_DIR$\..\Object\LMS_ARM.a79 + $PROJ_DIR$\..\Object\c_output.r79 + $PROJ_DIR$\..\Object\c_display.s + $PROJ_DIR$\..\Object\c_led.r79 + $PROJ_DIR$\..\Object\d_output.r79 + $PROJ_DIR$\..\Object\d_input.pbi + $PROJ_DIR$\..\Object\c_ioctrl.pbi + $PROJ_DIR$\..\Object\c_button.pbi + $PROJ_DIR$\..\Object\d_led.r79 + $PROJ_DIR$\..\Object\d_usb.s + $PROJ_DIR$\..\Object\c_sound.pbi + $PROJ_DIR$\..\Object\d_bt.pbi + $PROJ_DIR$\..\..\Source\d_sound_adpcm.r + $PROJ_DIR$\..\Object\d_lowspeed.r79 + $PROJ_DIR$\..\Object\d_timer.pbi + $PROJ_DIR$\..\Object\c_output.pbi + $PROJ_DIR$\..\..\Source\c_led.h + $PROJ_DIR$\..\..\Source\d_led.h + $PROJ_DIR$\..\Object\d_bt.s + $PROJ_DIR$\..\Object\d_usb.r79 + $PROJ_DIR$\..\Object\Cstartup.r79 + $PROJ_DIR$\..\Object\c_ui.pbi + $PROJ_DIR$\..\Object\d_input.s + $PROJ_DIR$\..\Object\d_display.pbi + $PROJ_DIR$\..\Object\c_ui.s + $PROJ_DIR$\..\Object\c_button.s + $PROJ_DIR$\..\Object\d_button.s + $PROJ_DIR$\..\Object\d_timer.r79 + $PROJ_DIR$\..\Object\c_input.pbi + $PROJ_DIR$\..\Object\c_sound.s + $PROJ_DIR$\..\..\Source\c_led.c + $PROJ_DIR$\..\Object\c_lowspeed.pbi + $PROJ_DIR$\..\..\Source\Submenu03.rms + $PROJ_DIR$\..\Object\c_lowspeed.s + $PROJ_DIR$\at91SAM7S256_Remap.xcl + $PROJ_DIR$\..\Object\c_loader.pbi + $PROJ_DIR$\..\Object\c_comm.pbi + $PROJ_DIR$\..\Object\d_loader.r79 + $PROJ_DIR$\..\Object\c_output.s + $PROJ_DIR$\..\Object\d_bt.r79 + $PROJ_DIR$\..\Object\Cstartup_SAM7.r79 + $PROJ_DIR$\..\Object\d_lowspeed.pbi + $PROJ_DIR$\..\Object\c_sound.r79 + $PROJ_DIR$\..\..\Source\d_led.c + $PROJ_DIR$\..\Object\m_sched.pbi + $PROJ_DIR$\..\Object\c_display.r79 + $PROJ_DIR$\..\Lib\dl4tptinl8n.r79 + $PROJ_DIR$\..\Object\c_cmd.s + $PROJ_DIR$\..\Object\c_loader.s + $PROJ_DIR$\..\Object\d_output.s + $PROJ_DIR$\..\Object\d_input.r79 + $PROJ_DIR$\..\Object\d_usb.pbi + $PROJ_DIR$\..\Object\d_hispeed.s + $PROJ_DIR$\..\Object\d_lowspeed.s + $PROJ_DIR$\..\Object\c_cmd.r79 + $PROJ_DIR$\..\..\Source\d_led.r + $TOOLKIT_DIR$\inc\limits.h + $PROJ_DIR$\..\Object\c_ioctrl.r79 + $PROJ_DIR$\..\Object\d_loader.pbi + $PROJ_DIR$\..\Object\d_hispeed.r79 + $PROJ_DIR$\..\Object\c_loader.r79 + $PROJ_DIR$\..\Object\c_ioctrl.s + $PROJ_DIR$\..\Object\LMS_ARM.pbd + $PROJ_DIR$\..\..\Source\c_ioctrl.iom + $PROJ_DIR$\..\..\Source\Running.txt + $PROJ_DIR$\..\..\Source\c_input.iom + $PROJ_DIR$\..\..\Source\d_timer.h + $PROJ_DIR$\..\..\Source\Ok.txt + $PROJ_DIR$\..\..\Source\modules.h + $PROJ_DIR$\..\..\Source\Submenu04.rms + $PROJ_DIR$\..\..\Source\RCXintro_11.txt + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $PROJ_DIR$\..\..\Source\d_timer.r + $PROJ_DIR$\..\..\Source\Test1.txt + $PROJ_DIR$\..\..\Source\Status.txt + $PROJ_DIR$\..\..\Source\Submenu01.rms + $PROJ_DIR$\..\Include\sam7s256.h + $PROJ_DIR$\..\..\Source\Wait.txt + $PROJ_DIR$\..\..\Source\c_sound.iom + $PROJ_DIR$\..\..\Source\c_button.c + $PROJ_DIR$\..\..\Source\c_cmd.c + $PROJ_DIR$\..\..\Source\c_input.c + $PROJ_DIR$\..\..\Source\c_ioctrl.c + $PROJ_DIR$\..\..\Source\c_loader.c + $PROJ_DIR$\..\..\Source\c_lowspeed.c + $PROJ_DIR$\..\..\Source\c_output.c + $PROJ_DIR$\..\..\Source\c_sound.c + $PROJ_DIR$\..\..\Source\c_ui.c + $PROJ_DIR$\..\..\Source\d_bt.c + $PROJ_DIR$\..\Include\Cstartup.s79 + $PROJ_DIR$\..\Include\Cstartup_SAM7.c + $PROJ_DIR$\..\..\Source\d_button.c + $PROJ_DIR$\..\..\Source\d_display.c + $PROJ_DIR$\..\..\Source\d_hispeed.c + $PROJ_DIR$\..\..\Source\d_input.c + $PROJ_DIR$\..\..\Source\d_ioctrl.c + $PROJ_DIR$\..\..\Source\d_loader.c + $PROJ_DIR$\..\..\Source\d_lowspeed.c + $PROJ_DIR$\..\..\Source\d_output.c + $PROJ_DIR$\..\..\Source\d_sound.c + $PROJ_DIR$\..\..\Source\d_timer.c + $PROJ_DIR$\..\..\Source\d_usb.c + $PROJ_DIR$\..\..\Source\Functions.inl + $PROJ_DIR$\..\..\Source\m_sched.c + $TOOLKIT_DIR$\inc\xmtx.h + $TOOLKIT_DIR$\inc\string.h + $PROJ_DIR$\..\..\Source\stdconst.h + $PROJ_DIR$\..\Include\AT91SAM7S256.h + $PROJ_DIR$\..\..\Source\d_button.h + $PROJ_DIR$\..\Object\LMS_ARM.d79 + + + [ROOT_NODE] + + + XLINK + 239 105 130 + + + + + $PROJ_DIR$\..\..\Source\c_display.c + + + ICCARM + 175 + + + BICOMP + 109 + + + + + ICCARM + 235 10 201 46 92 70 74 16 236 198 62 8 29 + + + BICOMP + 235 10 201 92 70 74 16 236 198 62 8 29 + + + + + $PROJ_DIR$\..\..\Source\c_comm.c + + + ICCARM + 120 + + + BICOMP + 166 + + + + + ICCARM + 236 198 12 64 193 53 100 62 54 31 85 24 235 10 201 46 92 70 74 16 34 1 99 234 28 20 43 63 87 84 + + + BICOMP + 236 198 12 64 193 53 100 62 54 31 85 24 235 10 201 92 70 74 16 34 1 99 234 28 20 43 63 87 84 + + + + + $PROJ_DIR$\..\Object\d_sound.s + + + AARM + 119 + + + + + $PROJ_DIR$\..\Object\c_comm.s + + + AARM + 120 + + + + + $PROJ_DIR$\..\Object\d_timer.s + + + AARM + 157 + + + + + $PROJ_DIR$\..\Object\d_ioctrl.s + + + AARM + 128 + + + + + $PROJ_DIR$\..\Object\d_loader.s + + + AARM + 167 + + + + + $PROJ_DIR$\..\Object\d_display.s + + + AARM + 124 + + + + + $PROJ_DIR$\..\Object\m_sched.s + + + AARM + 114 + + + + + $PROJ_DIR$\..\Object\Cstartup_SAM7.s + + + AARM + 170 + + + + + $PROJ_DIR$\..\Object\c_input.s + + + AARM + 103 + + + + + $PROJ_DIR$\..\Object\c_display.s + + + AARM + 175 + + + + + $PROJ_DIR$\..\Object\d_usb.s + + + AARM + 149 + + + + + $PROJ_DIR$\..\Object\d_bt.s + + + AARM + 169 + + + + + $PROJ_DIR$\..\Object\d_input.s + + + AARM + 180 + + + + + $PROJ_DIR$\..\Object\c_ui.s + + + AARM + 121 + + + + + $PROJ_DIR$\..\Object\c_button.s + + + AARM + 104 + + + + + $PROJ_DIR$\..\Object\d_button.s + + + AARM + 122 + + + + + $PROJ_DIR$\..\Object\c_sound.s + + + AARM + 172 + + + + + $PROJ_DIR$\..\..\Source\c_led.c + + + ICCARM + 133 + + + + + ICCARM + 236 198 113 146 147 + + + + + $PROJ_DIR$\..\Object\c_lowspeed.s + + + AARM + 117 + + + + + $PROJ_DIR$\..\Object\c_output.s + + + AARM + 131 + + + + + $PROJ_DIR$\..\..\Source\d_led.c + + + ICCARM + 138 + + + + + ICCARM + 236 86 206 58 147 185 + + + + + $PROJ_DIR$\..\Object\c_cmd.s + + + AARM + 184 + + + + + $PROJ_DIR$\..\Object\c_loader.s + + + AARM + 190 + + + + + $PROJ_DIR$\..\Object\d_output.s + + + AARM + 134 + + + + + $PROJ_DIR$\..\Object\d_hispeed.s + + + AARM + 189 + + + + + $PROJ_DIR$\..\Object\d_lowspeed.s + + + AARM + 143 + + + + + $PROJ_DIR$\..\Object\c_ioctrl.s + + + AARM + 187 + + + + + $PROJ_DIR$\..\Object\LMS_ARM.pbd + + + BILINK + 108 137 36 166 109 158 136 165 161 145 140 151 141 116 153 111 135 27 188 171 126 107 144 181 174 + + + + + $PROJ_DIR$\..\..\Source\c_button.c + + + ICCARM + 104 + + + BICOMP + 137 + + + + + ICCARM + 236 198 30 96 238 + + + BICOMP + 236 198 30 96 238 + + + + + $PROJ_DIR$\..\..\Source\c_cmd.c + + + ICCARM + 184 + + + BICOMP + 36 + + + + + ICCARM + 236 198 100 0 195 64 53 208 96 62 12 44 86 206 58 35 95 196 90 10 201 46 92 70 74 16 235 28 26 123 186 72 + + + BICOMP + 236 198 100 0 195 64 53 208 96 62 12 44 86 206 58 35 95 196 90 10 201 92 70 74 16 235 28 26 123 186 72 + + + + + $PROJ_DIR$\..\..\Source\c_input.c + + + ICCARM + 103 + + + BICOMP + 158 + + + + + ICCARM + 236 198 79 195 37 0 64 235 10 201 46 92 70 74 16 + + + BICOMP + 236 198 79 195 37 0 64 235 10 201 92 70 74 16 + + + + + $PROJ_DIR$\..\..\Source\c_ioctrl.c + + + ICCARM + 187 + + + BICOMP + 136 + + + + + ICCARM + 236 198 193 76 61 + + + BICOMP + 236 198 193 76 61 + + + + + $PROJ_DIR$\..\..\Source\c_loader.c + + + ICCARM + 190 + + + BICOMP + 165 + + + + + ICCARM + 236 198 64 193 93 56 235 10 201 46 92 70 74 16 + + + BICOMP + 236 198 64 193 93 56 235 10 201 92 70 74 16 + + + + + $PROJ_DIR$\..\..\Source\c_lowspeed.c + + + ICCARM + 117 + + + BICOMP + 161 + + + + + ICCARM + 236 198 44 195 59 55 + + + BICOMP + 236 198 44 195 59 55 + + + + + $PROJ_DIR$\..\..\Source\c_output.c + + + ICCARM + 131 + + + BICOMP + 145 + + + + + ICCARM + 90 10 201 46 92 70 74 16 41 236 198 0 71 52 62 + + + BICOMP + 90 10 201 92 70 74 16 41 236 198 0 71 52 62 + + + + + $PROJ_DIR$\..\..\Source\c_sound.c + + + ICCARM + 172 + + + BICOMP + 140 + + + + + ICCARM + 28 10 201 46 92 70 74 16 235 236 198 208 64 60 25 + + + BICOMP + 28 10 201 92 70 74 16 235 236 198 208 64 60 25 + + + + + $PROJ_DIR$\..\..\Source\c_ui.c + + + ICCARM + 121 + + + BICOMP + 151 + + + + + ICCARM + 90 10 201 46 92 70 74 16 235 34 1 99 234 28 20 43 63 87 84 236 198 53 82 86 206 58 62 64 96 208 195 0 193 100 12 44 51 50 81 88 9 194 5 197 207 45 21 49 77 3 40 66 6 33 57 22 78 38 200 94 83 13 48 89 204 19 23 91 32 205 73 162 199 47 98 68 232 101 203 65 + + + BICOMP + 90 10 201 92 70 74 16 235 34 1 99 234 28 20 43 63 87 84 236 198 53 82 86 206 58 62 64 96 208 195 0 193 100 12 44 51 50 81 88 9 194 5 197 207 45 21 49 77 3 40 66 6 33 57 22 78 38 200 94 83 13 48 89 204 19 23 91 32 205 73 162 199 47 98 68 232 101 203 65 + + + + + $PROJ_DIR$\..\..\Source\d_bt.c + + + ICCARM + 169 + + + BICOMP + 141 + + + + + ICCARM + 236 198 86 206 58 24 7 235 10 201 46 92 70 74 16 + + + BICOMP + 236 198 86 206 58 24 7 235 10 201 92 70 74 16 + + + + + $PROJ_DIR$\..\Include\Cstartup.s79 + + + AARM + 150 + + + + + AARM + 75 + + + + + $PROJ_DIR$\..\Include\Cstartup_SAM7.c + + + ICCARM + 170 + + + BICOMP + 108 + + + + + ICCARM + 237 + + + BICOMP + 237 + + + + + $PROJ_DIR$\..\..\Source\d_button.c + + + ICCARM + 122 + + + BICOMP + 116 + + + + + ICCARM + 236 86 206 58 238 18 + + + BICOMP + 236 86 206 58 238 18 + + + + + $PROJ_DIR$\..\..\Source\d_display.c + + + ICCARM + 124 + + + BICOMP + 153 + + + + + ICCARM + 236 86 206 58 29 14 + + + BICOMP + 236 86 206 58 29 14 + + + + + $PROJ_DIR$\..\..\Source\d_hispeed.c + + + ICCARM + 189 + + + BICOMP + 111 + + + + + ICCARM + 236 86 206 58 85 67 + + + BICOMP + 236 86 206 58 85 67 + + + + + $PROJ_DIR$\..\..\Source\d_input.c + + + ICCARM + 180 + + + BICOMP + 135 + + + + + ICCARM + 236 86 206 58 79 195 37 80 + + + BICOMP + 236 86 206 58 79 195 37 80 + + + + + $PROJ_DIR$\..\..\Source\d_ioctrl.c + + + ICCARM + 128 + + + BICOMP + 27 + + + + + ICCARM + 235 10 201 46 92 70 74 16 236 86 206 58 61 39 + + + BICOMP + 235 10 201 92 70 74 16 236 86 206 58 61 39 + + + + + $PROJ_DIR$\..\..\Source\d_loader.c + + + ICCARM + 167 + + + BICOMP + 188 + + + + + ICCARM + 236 198 86 206 58 93 11 235 10 201 46 92 70 74 16 34 1 99 234 28 20 43 63 87 84 + + + BICOMP + 236 198 86 206 58 93 11 235 10 201 92 70 74 16 34 1 99 234 28 20 43 63 87 84 + + + + + $PROJ_DIR$\..\..\Source\d_lowspeed.c + + + ICCARM + 143 + + + BICOMP + 171 + + + + + ICCARM + 236 86 206 58 55 69 + + + BICOMP + 236 86 206 58 55 69 + + + + + $PROJ_DIR$\..\..\Source\d_output.c + + + ICCARM + 134 + + + BICOMP + 126 + + + + + ICCARM + 236 86 206 58 52 2 + + + BICOMP + 236 86 206 58 52 2 + + + + + $PROJ_DIR$\..\..\Source\d_sound.c + + + ICCARM + 119 + + + BICOMP + 107 + + + + + ICCARM + 236 86 206 58 25 17 142 + + + BICOMP + 236 86 206 58 25 17 142 - $PROJ_DIR$\..\..\Source\d_input.c + $PROJ_DIR$\..\..\Source\d_timer.c ICCARM - $PROJ_DIR$\..\Object\d_input.r79 + 157 + + + BICOMP + 144 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\c_input.h - $PROJ_DIR$\..\..\Source\c_input.iom - $PROJ_DIR$\..\..\Source\d_input.h - $PROJ_DIR$\..\..\Source\d_input.r + 236 86 206 58 196 202 + + + BICOMP + 236 86 206 58 196 202 - $PROJ_DIR$\..\..\Source\c_button.c + $PROJ_DIR$\..\..\Source\d_usb.c ICCARM - $PROJ_DIR$\..\Object\c_button.r79 + 149 + + + BICOMP + 181 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_button.h - $PROJ_DIR$\..\..\Source\c_button.iom - $PROJ_DIR$\..\..\Source\d_button.h + 236 86 206 58 31 97 + + + BICOMP + 236 86 206 58 31 97 - $PROJ_DIR$\..\..\Source\d_ioctrl.c + $PROJ_DIR$\..\..\Source\m_sched.c ICCARM - $PROJ_DIR$\..\Object\d_ioctrl.r79 + 114 + + + BICOMP + 174 ICCARM - $TOOLKIT_DIR$\inc\string.h - $TOOLKIT_DIR$\inc\yvals.h - $TOOLKIT_DIR$\inc\DLib_Defaults.h - $TOOLKIT_DIR$\lib\dl4tptinl8n.h - $TOOLKIT_DIR$\inc\DLib_Product.h - $TOOLKIT_DIR$\inc\xencoding_limits.h - $TOOLKIT_DIR$\inc\ysizet.h - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_ioctrl.h - $PROJ_DIR$\..\..\Source\d_ioctrl.r + 236 198 86 206 58 42 54 79 195 30 96 56 60 8 59 71 35 95 100 76 82 + + + BICOMP + 236 198 86 206 58 42 54 79 195 30 96 56 60 8 59 71 35 95 100 76 82 - $PROJ_DIR$\..\..\Source\d_loader.c + $PROJ_DIR$\..\Object\LMS_ARM.d79 - ICCARM - $PROJ_DIR$\..\Object\d_loader.r79 + XLINK + 105 130 - ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_loader.h - $PROJ_DIR$\..\..\Source\d_loader.r - $TOOLKIT_DIR$\inc\string.h - $TOOLKIT_DIR$\inc\yvals.h - $TOOLKIT_DIR$\inc\DLib_Defaults.h - $TOOLKIT_DIR$\lib\dl4tptinl8n.h - $TOOLKIT_DIR$\inc\DLib_Product.h - $TOOLKIT_DIR$\inc\xencoding_limits.h - $TOOLKIT_DIR$\inc\ysizet.h - $TOOLKIT_DIR$\inc\ctype.h - $TOOLKIT_DIR$\inc\xlocale.h - $TOOLKIT_DIR$\inc\xtls.h - $TOOLKIT_DIR$\inc\xmtx.h - $TOOLKIT_DIR$\inc\stdlib.h - $TOOLKIT_DIR$\inc\xlocaleuse.h - $TOOLKIT_DIR$\inc\xlocale_c.h - $TOOLKIT_DIR$\inc\xtinfo.h - $TOOLKIT_DIR$\inc\time.h - $TOOLKIT_DIR$\inc\wchar.h + XLINK + 164 150 170 104 184 120 175 103 187 190 117 131 172 121 169 122 124 189 180 128 167 143 134 119 157 149 114 176 + + + Flash Debug + + $PROJ_DIR$\..\..\Source\c_output.iom + $TOOLKIT_DIR$\inc\xlocale.h + $PROJ_DIR$\..\..\Source\d_output.r + $PROJ_DIR$\..\..\Source\RCXintro_2.txt + $PROJ_DIR$\..\..\Source\c_display.c + $PROJ_DIR$\..\..\Source\Port.txt + $PROJ_DIR$\..\..\Source\RCXintro_5.txt + $PROJ_DIR$\..\..\Source\d_bt.r + $PROJ_DIR$\..\..\Source\c_display.h + $PROJ_DIR$\..\..\Source\Cursor.txt + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\..\..\Source\d_loader.r + $PROJ_DIR$\..\..\Source\c_comm.iom + $PROJ_DIR$\..\..\Source\RCXintro_14.txt + $PROJ_DIR$\..\..\Source\d_display.r + $PROJ_DIR$\..\..\Source\c_comm.c + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\..\..\Source\d_sound.r + $PROJ_DIR$\..\..\Source\d_button.r + $PROJ_DIR$\..\..\Source\Devices.txt + $TOOLKIT_DIR$\inc\xlocaleuse.h + $PROJ_DIR$\..\..\Source\Info.txt + $PROJ_DIR$\..\..\Source\RCXintro_8.txt + $PROJ_DIR$\..\..\Source\Connections.txt + $PROJ_DIR$\..\..\Source\d_bt.h + $PROJ_DIR$\..\..\Source\d_sound.h + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\..\Object\d_ioctrl.pbi + $TOOLKIT_DIR$\inc\stdlib.h + $PROJ_DIR$\..\..\Source\d_display.h + $PROJ_DIR$\..\..\Source\c_button.h + $PROJ_DIR$\..\..\Source\d_usb.h + $PROJ_DIR$\..\..\Source\Mainmenu.rms + $PROJ_DIR$\..\..\Source\RCXintro_6.txt + $TOOLKIT_DIR$\inc\ctype.h + $PROJ_DIR$\..\..\Source\c_cmd.h + $PROJ_DIR$\..\Object\c_cmd.pbi + $PROJ_DIR$\..\..\Source\d_input.h + $PROJ_DIR$\..\..\Source\RCXintro_10.txt + $PROJ_DIR$\..\..\Source\d_ioctrl.r + $PROJ_DIR$\..\..\Source\RCXintro_3.txt + $TOOLKIT_DIR$\inc\stdbool.h + $PROJ_DIR$\..\Include\sam7s256.c + $TOOLKIT_DIR$\inc\xlocale_c.h + $PROJ_DIR$\..\..\Source\c_lowspeed.iom + $PROJ_DIR$\..\..\Source\Fail.txt + $PROJ_DIR$\..\Lib\dl4tptinl8n.h + $PROJ_DIR$\..\..\Source\Submenu05.rms + $PROJ_DIR$\..\..\Source\RCXintro_15.txt + $PROJ_DIR$\..\..\Source\Icons.txt + $PROJ_DIR$\..\..\Source\LowBattery.txt + $PROJ_DIR$\..\..\Source\Display.txt + $PROJ_DIR$\..\..\Source\d_output.h + $PROJ_DIR$\..\..\Source\c_ui.iom + $PROJ_DIR$\..\..\Source\c_comm.h + $PROJ_DIR$\..\..\Source\d_lowspeed.h + $PROJ_DIR$\..\..\Source\c_loader.h + $PROJ_DIR$\..\..\Source\RCXintro_7.txt + $PROJ_DIR$\..\Include\ioat91sam7s256.h + $PROJ_DIR$\..\..\Source\c_lowspeed.h + $PROJ_DIR$\..\..\Source\c_sound.h + $PROJ_DIR$\..\..\Source\d_ioctrl.h + $PROJ_DIR$\..\..\Source\c_display.iom + $TOOLKIT_DIR$\inc\xtinfo.h + $PROJ_DIR$\..\..\Source\c_loader.iom + $PROJ_DIR$\..\..\Source\Test2.txt + $PROJ_DIR$\..\..\Source\RCXintro_4.txt + $PROJ_DIR$\..\..\Source\d_hispeed.r + $PROJ_DIR$\..\..\Source\Submenu07.rms + $PROJ_DIR$\..\..\Source\d_lowspeed.r + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\..\..\Source\c_output.h + $PROJ_DIR$\..\..\Source\c_cmd_drawing.inc + $PROJ_DIR$\..\..\Source\Submenu02.rms + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\..\Include\AT91SAM7S256_inc.h + $PROJ_DIR$\..\..\Source\c_ioctrl.h + $PROJ_DIR$\..\..\Source\RCXintro_1.txt + $PROJ_DIR$\..\..\Source\RCXintro_9.txt + $PROJ_DIR$\..\..\Source\c_input.h + $PROJ_DIR$\..\..\Source\d_input.r + $PROJ_DIR$\..\..\Source\Font.txt + $PROJ_DIR$\..\..\Source\c_ui.h + $PROJ_DIR$\..\..\Source\RCXintro_13.txt + $TOOLKIT_DIR$\inc\wchar.h + $PROJ_DIR$\..\..\Source\d_hispeed.h + $PROJ_DIR$\..\..\Source\m_sched.h + $TOOLKIT_DIR$\inc\time.h + $PROJ_DIR$\..\..\Source\Step.txt + $PROJ_DIR$\..\..\Source\RCXintro_16.txt + $TOOLKIT_DIR$\inc\stdio.h + $PROJ_DIR$\..\..\Source\Ui.txt + $TOOLKIT_DIR$\inc\DLib_Product.h + $PROJ_DIR$\..\..\Source\d_loader.h + $PROJ_DIR$\..\..\Source\RCXintro_12.txt + $PROJ_DIR$\..\..\Source\c_cmd_bytecodes.h + $PROJ_DIR$\..\..\Source\c_button.iom + $PROJ_DIR$\..\..\Source\d_usb.r + $PROJ_DIR$\..\..\Source\Submenu06.rms + $TOOLKIT_DIR$\inc\xtls.h + $PROJ_DIR$\..\..\Source\c_cmd.iom + $PROJ_DIR$\..\..\Source\BtTest.inc + $PROJ_DIR$\..\Object\c_input.r79 + $PROJ_DIR$\..\Object\c_button.r79 + $PROJ_DIR$\..\Object\LMS_ARM.map + $PROJ_DIR$\..\Object\d_sound.pbi + $PROJ_DIR$\..\Object\Cstartup_SAM7.pbi + $PROJ_DIR$\..\Object\c_display.pbi + $PROJ_DIR$\..\Object\d_hispeed.pbi + $PROJ_DIR$\..\..\Source\c_led.iom + $PROJ_DIR$\..\Object\m_sched.r79 + $PROJ_DIR$\..\Object\d_button.pbi + $PROJ_DIR$\..\Object\c_lowspeed.r79 + $PROJ_DIR$\..\Object\d_sound.r79 + $PROJ_DIR$\..\Object\c_comm.r79 + $PROJ_DIR$\..\Object\c_ui.r79 + $PROJ_DIR$\..\Object\d_button.r79 + $TOOLKIT_DIR$\inc\ymath.h + $PROJ_DIR$\..\Object\d_display.r79 + $PROJ_DIR$\..\Object\d_output.pbi + $PROJ_DIR$\..\Object\d_ioctrl.r79 + $PROJ_DIR$\..\Object\c_output.r79 + $PROJ_DIR$\..\Object\c_led.r79 + $PROJ_DIR$\..\Object\d_output.r79 + $PROJ_DIR$\..\Object\d_input.pbi + $PROJ_DIR$\..\Object\c_ioctrl.pbi + $PROJ_DIR$\..\Object\c_button.pbi + $PROJ_DIR$\..\Object\d_led.r79 + $PROJ_DIR$\..\Object\c_sound.pbi + $PROJ_DIR$\..\Object\d_bt.pbi + $PROJ_DIR$\..\..\Source\d_sound_adpcm.r + $PROJ_DIR$\..\Object\d_lowspeed.r79 + $PROJ_DIR$\..\Object\d_timer.pbi + $PROJ_DIR$\..\Object\c_output.pbi + $PROJ_DIR$\..\..\Source\c_led.h + $PROJ_DIR$\..\..\Source\d_led.h + $PROJ_DIR$\..\Object\d_usb.r79 + $PROJ_DIR$\..\Object\Cstartup.r79 + $PROJ_DIR$\..\Object\c_ui.pbi + $PROJ_DIR$\..\Object\d_display.pbi + $PROJ_DIR$\..\Object\d_timer.r79 + $PROJ_DIR$\..\Object\c_input.pbi + $PROJ_DIR$\..\..\Source\c_led.c + $PROJ_DIR$\..\Object\c_lowspeed.pbi + $PROJ_DIR$\..\..\Source\Submenu03.rms + $PROJ_DIR$\at91SAM7S256_Remap.xcl + $PROJ_DIR$\..\Object\c_loader.pbi + $PROJ_DIR$\..\Object\c_comm.pbi + $PROJ_DIR$\..\Object\d_loader.r79 + $PROJ_DIR$\..\Object\d_bt.r79 + $PROJ_DIR$\..\Object\Cstartup_SAM7.r79 + $PROJ_DIR$\..\Object\d_lowspeed.pbi + $PROJ_DIR$\..\Object\c_sound.r79 + $PROJ_DIR$\..\..\Source\d_led.c + $PROJ_DIR$\..\Object\m_sched.pbi + $PROJ_DIR$\..\Object\c_display.r79 + $PROJ_DIR$\..\Lib\dl4tptinl8n.r79 + $PROJ_DIR$\..\Object\d_input.r79 + $PROJ_DIR$\..\Object\d_usb.pbi + $PROJ_DIR$\..\Object\c_cmd.r79 + $PROJ_DIR$\..\..\Source\d_led.r + $TOOLKIT_DIR$\inc\limits.h + $PROJ_DIR$\..\Object\c_ioctrl.r79 + $PROJ_DIR$\..\Object\d_loader.pbi + $PROJ_DIR$\..\Object\d_hispeed.r79 + $PROJ_DIR$\..\Object\c_loader.r79 + $PROJ_DIR$\..\Object\LMS_ARM.pbd + $PROJ_DIR$\..\..\Source\c_sensor.iom + $PROJ_DIR$\SrcIAR\Cstartup_SAM7.c + $PROJ_DIR$\..\..\Source\c_bt.c + $PROJ_DIR$\..\..\Source\c_net.h + $PROJ_DIR$\..\..\Source\c_net.c + $PROJ_DIR$\..\..\Source\c_usb.iom + $PROJ_DIR$\..\..\Source\d_motor.h + $PROJ_DIR$\..\..\Source\c_hispeed.c + $PROJ_DIR$\..\..\Source\d_net.r + $PROJ_DIR$\..\Object\c_net.r79 + $PROJ_DIR$\..\src\main.c + $PROJ_DIR$\..\..\Source\d_motor.c + $PROJ_DIR$\..\..\Source\c_hispeed.iom + $PROJ_DIR$\..\..\Source\c_bt.h + $PROJ_DIR$\..\..\Source\d_motor.r + $PROJ_DIR$\..\Object\d_motor.r79 + $PROJ_DIR$\..\Object\LMS_ARM.sim + $PROJ_DIR$\..\..\Source\d_avrcomm.h + $PROJ_DIR$\..\..\Source\c_sensor.c + $PROJ_DIR$\..\..\include\lib_AT91SAM7S64.h + $PROJ_DIR$\..\Object\d_avrcomm.r79 + $PROJ_DIR$\..\Include\AT91SAM7S64.h + $PROJ_DIR$\..\Object\c_sensor.r79 + $PROJ_DIR$\..\Object\c_avrcomm.r79 + $PROJ_DIR$\..\Object\d_sensor.r79 + $PROJ_DIR$\..\..\Source\d_sensor.c + $PROJ_DIR$\..\..\Source\d_net.c + $PROJ_DIR$\..\..\Source\d_net.h + $PROJ_DIR$\..\..\Source\d_sensor.h + $PROJ_DIR$\..\Object\d_net.r79 + $PROJ_DIR$\..\Include\lib_AT91SAM7S64.h + $PROJ_DIR$\..\..\Source\c_usb.h + $PROJ_DIR$\..\..\Source\c_motor.h + $PROJ_DIR$\..\..\Source\main.c + $PROJ_DIR$\Flash_Debug\Obj\Cstartup.r79 + $PROJ_DIR$\..\..\Source\d_avrcomm.c + $PROJ_DIR$\..\..\Source\c_sensor.h + $PROJ_DIR$\SrcIAR\Board.h + $PROJ_DIR$\SrcIAR\Cstartup.s79 + $PROJ_DIR$\..\Object\main.r79 + $PROJ_DIR$\Flash_Debug\Obj\main.r79 + $PROJ_DIR$\..\Object\c_hispeed.r79 + $PROJ_DIR$\..\..\Source\d_avrcomm.r + $PROJ_DIR$\..\..\Source\c_motor.iom + $PROJ_DIR$\..\Include\Board.h + $PROJ_DIR$\..\Object\c_motor.r79 + $PROJ_DIR$\..\..\Source\c_motor.c + $PROJ_DIR$\..\..\Source\d_sensor.r + $PROJ_DIR$\..\..\include\AT91SAM7S64_inc.h + $PROJ_DIR$\..\..\Source\c_usb.c + $PROJ_DIR$\..\..\Source\c_bt.iom + $PROJ_DIR$\..\..\Source\c_hispeed.h + $PROJ_DIR$\..\..\Source\c_avrcomm.h + $PROJ_DIR$\..\..\Source\c_avrcomm.c + $PROJ_DIR$\..\Object\c_bt.r79 + $PROJ_DIR$\..\Object\c_usb.r79 + $PROJ_DIR$\Flash_Debug\Obj\Cstartup_SAM7.r79 + $PROJ_DIR$\..\Include\ioat91sam7s64.h + $PROJ_DIR$\..\..\include\AT91SAM7S64.h + $PROJ_DIR$\..\..\Source\c_ioctrl.iom + $PROJ_DIR$\..\..\Source\Running.txt + $PROJ_DIR$\..\..\Source\c_input.iom + $PROJ_DIR$\..\..\Source\d_timer.h + $PROJ_DIR$\..\..\Source\Ok.txt + $PROJ_DIR$\..\..\Source\modules.h + $PROJ_DIR$\..\..\Source\Submenu04.rms + $PROJ_DIR$\..\..\Source\RCXintro_11.txt + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $PROJ_DIR$\..\..\Source\d_timer.r + $PROJ_DIR$\..\..\Source\Test1.txt + $PROJ_DIR$\..\..\Source\Status.txt + $PROJ_DIR$\..\..\Source\Submenu01.rms + $PROJ_DIR$\..\Include\sam7s256.h + $PROJ_DIR$\..\..\Source\Wait.txt + $PROJ_DIR$\..\..\Source\c_sound.iom + $PROJ_DIR$\..\..\Source\c_button.c + $PROJ_DIR$\..\..\Source\c_cmd.c + $PROJ_DIR$\..\..\Source\c_input.c + $PROJ_DIR$\..\..\Source\c_ioctrl.c + $PROJ_DIR$\..\..\Source\c_loader.c + $PROJ_DIR$\..\..\Source\c_lowspeed.c + $PROJ_DIR$\..\..\Source\c_output.c + $PROJ_DIR$\..\..\Source\c_sound.c + $PROJ_DIR$\..\..\Source\c_ui.c + $PROJ_DIR$\..\..\Source\d_bt.c + $PROJ_DIR$\..\Include\Cstartup.s79 + $PROJ_DIR$\..\Include\Cstartup_SAM7.c + $PROJ_DIR$\..\..\Source\d_button.c + $PROJ_DIR$\..\..\Source\d_display.c + $PROJ_DIR$\..\..\Source\d_hispeed.c + $PROJ_DIR$\..\..\Source\d_input.c + $PROJ_DIR$\..\..\Source\d_ioctrl.c + $PROJ_DIR$\..\..\Source\d_loader.c + $PROJ_DIR$\..\..\Source\d_lowspeed.c + $PROJ_DIR$\..\..\Source\d_output.c + $PROJ_DIR$\..\..\Source\d_sound.c + $PROJ_DIR$\..\..\Source\d_timer.c + $PROJ_DIR$\..\..\Source\d_usb.c + $PROJ_DIR$\..\..\Source\Functions.inl + $PROJ_DIR$\..\..\Source\m_sched.c + $TOOLKIT_DIR$\inc\xmtx.h + $TOOLKIT_DIR$\inc\string.h + $PROJ_DIR$\..\..\Source\stdconst.h + $PROJ_DIR$\..\Include\AT91SAM7S256.h + $PROJ_DIR$\..\..\Source\d_button.h + $PROJ_DIR$\..\Object\LMS_ARM.d79 + - $PROJ_DIR$\..\..\Source\d_lowspeed.c + [ROOT_NODE] - ICCARM - $PROJ_DIR$\..\Object\d_lowspeed.r79 + XLINK + 104 183 272 - - - ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_lowspeed.h - $PROJ_DIR$\..\..\Source\d_lowspeed.r - - - $PROJ_DIR$\..\..\Source\d_output.c + $PROJ_DIR$\..\..\Source\c_display.c ICCARM - $PROJ_DIR$\..\Object\d_output.r79 + 155 + + + BICOMP + 107 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_output.h - $PROJ_DIR$\..\..\Source\d_output.r + 268 10 234 46 92 70 74 16 269 231 62 8 29 + + + BICOMP + 268 10 234 92 70 74 16 269 231 62 8 29 - $PROJ_DIR$\..\..\Source\d_sound.c + $PROJ_DIR$\..\..\Source\c_comm.c ICCARM - $PROJ_DIR$\..\Object\d_sound.r79 + 114 + + + BICOMP + 147 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_sound.h - $PROJ_DIR$\..\..\Source\d_sound.r + 269 231 12 64 226 53 100 62 54 31 85 24 268 10 234 46 92 70 74 16 34 1 99 267 28 20 43 63 87 84 + + + BICOMP + 269 231 12 64 226 53 100 62 54 31 85 24 268 10 234 92 70 74 16 34 1 99 267 28 20 43 63 87 84 - $PROJ_DIR$\..\..\Source\d_timer.c + $PROJ_DIR$\..\..\Source\c_led.c ICCARM - $PROJ_DIR$\..\Object\d_timer.r79 + 122 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_timer.h - $PROJ_DIR$\..\..\Source\d_timer.r + 269 231 109 134 135 @@ -621,1825 +2296,1788 @@ ICCARM - $PROJ_DIR$\..\Object\d_led.r79 + 127 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_led.h - $PROJ_DIR$\..\..\Source\d_led.r + 269 86 239 58 135 160 - $PROJ_DIR$\..\..\Source\m_sched.c - - - ICCARM - $PROJ_DIR$\..\Object\m_sched.r79 - - + $PROJ_DIR$\..\Object\LMS_ARM.pbd - ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\Include\sam7s256.c - $PROJ_DIR$\..\..\Source\c_comm.h - $PROJ_DIR$\..\..\Source\c_input.h - $PROJ_DIR$\..\..\Source\c_input.iom - $PROJ_DIR$\..\..\Source\c_button.h - $PROJ_DIR$\..\..\Source\c_button.iom - $PROJ_DIR$\..\..\Source\c_loader.h - $PROJ_DIR$\..\..\Source\c_sound.h - $PROJ_DIR$\..\..\Source\c_display.h - $PROJ_DIR$\..\..\Source\c_lowspeed.h - $PROJ_DIR$\..\..\Source\c_output.h - $PROJ_DIR$\..\..\Source\c_cmd.h - $PROJ_DIR$\..\..\Source\c_cmd.iom - $PROJ_DIR$\..\..\Source\c_ioctrl.h - $PROJ_DIR$\..\..\Source\c_led.h - $PROJ_DIR$\..\..\Source\c_ui.h + BILINK + 106 126 36 147 107 141 125 146 143 133 128 138 129 111 139 108 124 27 163 151 119 105 132 158 154 - $PROJ_DIR$\..\..\Source\c_cmd.c + $PROJ_DIR$\SrcIAR\Cstartup_SAM7.c ICCARM - $PROJ_DIR$\..\Object\c_cmd.r79 + 223 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_cmd.iom - $PROJ_DIR$\..\..\Source\c_led.iom - $PROJ_DIR$\..\..\Source\c_output.iom - $PROJ_DIR$\..\..\Source\c_input.iom - $PROJ_DIR$\..\..\Source\c_loader.iom - $PROJ_DIR$\..\..\Source\c_ui.iom - $PROJ_DIR$\..\..\Source\c_sound.iom - $PROJ_DIR$\..\..\Source\c_button.iom - $PROJ_DIR$\..\..\Source\c_display.iom - $PROJ_DIR$\..\..\Source\c_comm.iom - $PROJ_DIR$\..\..\Source\c_lowspeed.iom - $PROJ_DIR$\..\..\Source\c_cmd.h - $PROJ_DIR$\..\..\Source\c_cmd_bytecodes.h - $PROJ_DIR$\..\..\Source\d_timer.h - $TOOLKIT_DIR$\inc\stdio.h - $TOOLKIT_DIR$\inc\yvals.h - $TOOLKIT_DIR$\inc\DLib_Defaults.h - $TOOLKIT_DIR$\lib\dl4tptinl8n.h - $TOOLKIT_DIR$\inc\DLib_Product.h - $TOOLKIT_DIR$\inc\xencoding_limits.h - $TOOLKIT_DIR$\inc\ysizet.h - $TOOLKIT_DIR$\inc\string.h + 204 225 186 - $PROJ_DIR$\..\..\Source\c_comm.c + $PROJ_DIR$\..\..\Source\c_bt.c ICCARM - $PROJ_DIR$\..\Object\c_comm.r79 + 221 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_comm.iom - $PROJ_DIR$\..\..\Source\c_loader.iom - $PROJ_DIR$\..\..\Source\c_ioctrl.iom - $PROJ_DIR$\..\..\Source\c_comm.h - $PROJ_DIR$\..\..\Source\d_usb.h - $PROJ_DIR$\..\..\Source\d_hispeed.h - $PROJ_DIR$\..\..\Source\d_bt.h - $TOOLKIT_DIR$\inc\string.h - $TOOLKIT_DIR$\inc\yvals.h - $TOOLKIT_DIR$\inc\DLib_Defaults.h - $TOOLKIT_DIR$\lib\dl4tptinl8n.h - $TOOLKIT_DIR$\inc\DLib_Product.h - $TOOLKIT_DIR$\inc\xencoding_limits.h - $TOOLKIT_DIR$\inc\ysizet.h - $TOOLKIT_DIR$\inc\ctype.h - $TOOLKIT_DIR$\inc\xlocale.h - $TOOLKIT_DIR$\inc\xtls.h - $TOOLKIT_DIR$\inc\xmtx.h - $TOOLKIT_DIR$\inc\stdlib.h - $TOOLKIT_DIR$\inc\xlocaleuse.h - $TOOLKIT_DIR$\inc\xlocale_c.h - $TOOLKIT_DIR$\inc\xtinfo.h - $TOOLKIT_DIR$\inc\time.h - $TOOLKIT_DIR$\inc\wchar.h + 269 231 217 180 24 100 - - [MULTI_TOOL] - XLINK - - - [REBUILD_ALL] - - - - Flash Debug - - [ROOT_NODE] - - - XLINK - $PROJ_DIR$\..\Object\LMS_ARM.map - $PROJ_DIR$\..\Object\LMS_ARM.sim - $PROJ_DIR$\..\Object\LMS_ARM.d79 - - - - $PROJ_DIR$\..\Object\LMS_ARM.d79 + $PROJ_DIR$\..\..\Source\c_net.c - XLINK - $PROJ_DIR$\..\Object\LMS_ARM.map - $PROJ_DIR$\..\Object\LMS_ARM.sim + ICCARM + 176 - XLINK - $PROJ_DIR$\at91SAM7S256_Remap.xcl - $PROJ_DIR$\..\Object\Cstartup.r79 - $PROJ_DIR$\..\Object\Cstartup_SAM7.r79 - $PROJ_DIR$\..\Object\c_button.r79 - $PROJ_DIR$\..\Object\c_cmd.r79 - $PROJ_DIR$\..\Object\c_comm.r79 - $PROJ_DIR$\..\Object\c_display.r79 - $PROJ_DIR$\..\Object\c_input.r79 - $PROJ_DIR$\..\Object\c_ioctrl.r79 - $PROJ_DIR$\..\Object\c_loader.r79 - $PROJ_DIR$\..\Object\c_lowspeed.r79 - $PROJ_DIR$\..\Object\c_output.r79 - $PROJ_DIR$\..\Object\c_sound.r79 - $PROJ_DIR$\..\Object\c_ui.r79 - $PROJ_DIR$\..\Object\d_bt.r79 - $PROJ_DIR$\..\Object\d_button.r79 - $PROJ_DIR$\..\Object\d_display.r79 - $PROJ_DIR$\..\Object\d_hispeed.r79 - $PROJ_DIR$\..\Object\d_input.r79 - $PROJ_DIR$\..\Object\d_ioctrl.r79 - $PROJ_DIR$\..\Object\d_loader.r79 - $PROJ_DIR$\..\Object\d_lowspeed.r79 - $PROJ_DIR$\..\Object\d_output.r79 - $PROJ_DIR$\..\Object\d_sound.r79 - $PROJ_DIR$\..\Object\d_timer.r79 - $PROJ_DIR$\..\Object\d_usb.r79 - $PROJ_DIR$\..\Object\m_sched.r79 - $TOOLKIT_DIR$\lib\dl4tptinl8n.r79 + ICCARM + 269 170 194 - $PROJ_DIR$\..\..\Source\c_led.c + $PROJ_DIR$\..\..\Source\c_hispeed.c ICCARM - $PROJ_DIR$\..\Object\c_led.r79 + 208 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_led.iom - $PROJ_DIR$\..\..\Source\c_led.h - $PROJ_DIR$\..\..\Source\d_led.h - - - - - $PROJ_DIR$\..\..\Source\c_ui.c - - - ICCARM - $PROJ_DIR$\..\Object\c_ui.r79 - - - - - ICCARM - $TOOLKIT_DIR$\inc\stdio.h - $TOOLKIT_DIR$\inc\yvals.h - $TOOLKIT_DIR$\inc\DLib_Defaults.h - $TOOLKIT_DIR$\lib\dl4tptinl8n.h - $TOOLKIT_DIR$\inc\DLib_Product.h - $TOOLKIT_DIR$\inc\xencoding_limits.h - $TOOLKIT_DIR$\inc\ysizet.h - $TOOLKIT_DIR$\inc\string.h - $TOOLKIT_DIR$\inc\ctype.h - $TOOLKIT_DIR$\inc\xlocale.h - $TOOLKIT_DIR$\inc\xtls.h - $TOOLKIT_DIR$\inc\xmtx.h - $TOOLKIT_DIR$\inc\stdlib.h - $TOOLKIT_DIR$\inc\xlocaleuse.h - $TOOLKIT_DIR$\inc\xlocale_c.h - $TOOLKIT_DIR$\inc\xtinfo.h - $TOOLKIT_DIR$\inc\time.h - $TOOLKIT_DIR$\inc\wchar.h - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_ui.iom - $PROJ_DIR$\..\..\Source\c_ui.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\c_display.iom - $PROJ_DIR$\..\..\Source\c_loader.iom - $PROJ_DIR$\..\..\Source\c_button.iom - $PROJ_DIR$\..\..\Source\c_sound.iom - $PROJ_DIR$\..\..\Source\c_input.iom - $PROJ_DIR$\..\..\Source\c_output.iom - $PROJ_DIR$\..\..\Source\c_ioctrl.iom - $PROJ_DIR$\..\..\Source\c_cmd.iom - $PROJ_DIR$\..\..\Source\c_comm.iom - $PROJ_DIR$\..\..\Source\c_lowspeed.iom - $PROJ_DIR$\..\..\Source\Display.txt - $PROJ_DIR$\..\..\Source\LowBattery.txt - $PROJ_DIR$\..\..\Source\Font.txt - $PROJ_DIR$\..\..\Source\Step.txt - $PROJ_DIR$\..\..\Source\Cursor.txt - $PROJ_DIR$\..\..\Source\Incomming.txt - $PROJ_DIR$\..\..\Source\Running.txt - $PROJ_DIR$\..\..\Source\Port.txt - $PROJ_DIR$\..\..\Source\Ok.txt - $PROJ_DIR$\..\..\Source\RCXintro_1.txt - $PROJ_DIR$\..\..\Source\RCXintro_2.txt - $PROJ_DIR$\..\..\Source\RCXintro_3.txt - $PROJ_DIR$\..\..\Source\RCXintro_4.txt - $PROJ_DIR$\..\..\Source\RCXintro_5.txt - $PROJ_DIR$\..\..\Source\RCXintro_6.txt - $PROJ_DIR$\..\..\Source\RCXintro_7.txt - $PROJ_DIR$\..\..\Source\RCXintro_8.txt - $PROJ_DIR$\..\..\Source\RCXintro_9.txt - $PROJ_DIR$\..\..\Source\RCXintro_10.txt - $PROJ_DIR$\..\..\Source\RCXintro_11.txt - $PROJ_DIR$\..\..\Source\RCXintro_12.txt - $PROJ_DIR$\..\..\Source\RCXintro_13.txt - $PROJ_DIR$\..\..\Source\RCXintro_14.txt - $PROJ_DIR$\..\..\Source\RCXintro_15.txt - $PROJ_DIR$\..\..\Source\RCXintro_16.txt - $PROJ_DIR$\..\..\Source\Status.txt - $PROJ_DIR$\..\..\Source\Ui.txt - $PROJ_DIR$\..\..\Source\Mainmenu.rms - $PROJ_DIR$\..\..\Source\Submenu01.rms - $PROJ_DIR$\..\..\Source\Submenu02.rms - $PROJ_DIR$\..\..\Source\Submenu03.rms - $PROJ_DIR$\..\..\Source\Submenu04.rms - $PROJ_DIR$\..\..\Source\Submenu05.rms - $PROJ_DIR$\..\..\Source\Submenu06.rms - $PROJ_DIR$\..\..\Source\Submenu07.rms - $PROJ_DIR$\..\..\Source\Submenu10.rms - $PROJ_DIR$\..\..\Source\Functions.inl - $PROJ_DIR$\..\..\Source\BtTest.inc - $PROJ_DIR$\..\..\Source\Test1.txt - $PROJ_DIR$\..\..\Source\Test2.txt + 269 231 179 218 85 - $PROJ_DIR$\..\..\Source\c_display.c + $PROJ_DIR$\..\src\main.c ICCARM - $PROJ_DIR$\..\Object\c_display.r79 + 207 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_display.iom - $PROJ_DIR$\..\..\Source\c_display.h - $PROJ_DIR$\..\..\Source\d_display.h + 204 225 186 - $PROJ_DIR$\..\..\Source\c_input.c + $PROJ_DIR$\..\..\Source\d_motor.c ICCARM - $PROJ_DIR$\..\Object\c_input.r79 + 182 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_input.h - $PROJ_DIR$\..\..\Source\c_input.iom - $PROJ_DIR$\..\..\Source\d_input.h - $PROJ_DIR$\..\..\Source\c_output.iom + 269 86 239 224 173 181 - $PROJ_DIR$\..\..\Source\c_ioctrl.c + $PROJ_DIR$\..\..\Source\c_sensor.c ICCARM - $PROJ_DIR$\..\Object\c_ioctrl.r79 + 189 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_ioctrl.iom - $PROJ_DIR$\..\..\Source\c_ioctrl.h - $PROJ_DIR$\..\..\Source\d_ioctrl.h + 269 231 167 203 195 - $PROJ_DIR$\..\..\Source\c_loader.c + $PROJ_DIR$\..\..\Source\d_sensor.c ICCARM - $PROJ_DIR$\..\Object\c_loader.r79 + 191 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_loader.iom - $PROJ_DIR$\..\..\Source\c_ioctrl.iom - $PROJ_DIR$\..\..\Source\d_loader.h - $PROJ_DIR$\..\..\Source\c_loader.h + 269 86 239 224 195 214 - $PROJ_DIR$\..\..\Source\c_lowspeed.c + $PROJ_DIR$\..\..\Source\d_net.c ICCARM - $PROJ_DIR$\..\Object\c_lowspeed.r79 + 196 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_lowspeed.iom - $PROJ_DIR$\..\..\Source\c_input.iom - $PROJ_DIR$\..\..\Source\c_lowspeed.h - $PROJ_DIR$\..\..\Source\d_lowspeed.h + 269 86 239 224 194 175 - $PROJ_DIR$\..\..\Source\c_output.c + $PROJ_DIR$\..\..\Source\main.c ICCARM - $PROJ_DIR$\..\Object\c_output.r79 + 206 ICCARM - $TOOLKIT_DIR$\inc\stdio.h - $TOOLKIT_DIR$\inc\yvals.h - $TOOLKIT_DIR$\inc\DLib_Defaults.h - $TOOLKIT_DIR$\lib\dl4tptinl8n.h - $TOOLKIT_DIR$\inc\DLib_Product.h - $TOOLKIT_DIR$\inc\xencoding_limits.h - $TOOLKIT_DIR$\inc\ysizet.h - $TOOLKIT_DIR$\inc\stdbool.h - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_output.iom - $PROJ_DIR$\..\..\Source\c_output.h - $PROJ_DIR$\..\..\Source\d_output.h - $PROJ_DIR$\..\..\Source\c_display.iom + 211 188 197 - $PROJ_DIR$\..\..\Source\c_sound.c + $PROJ_DIR$\..\..\Source\d_avrcomm.c ICCARM - $PROJ_DIR$\..\Object\c_sound.r79 + 187 ICCARM - $TOOLKIT_DIR$\inc\stdlib.h - $TOOLKIT_DIR$\inc\yvals.h - $TOOLKIT_DIR$\inc\DLib_Defaults.h - $TOOLKIT_DIR$\lib\dl4tptinl8n.h - $TOOLKIT_DIR$\inc\DLib_Product.h - $TOOLKIT_DIR$\inc\xencoding_limits.h - $TOOLKIT_DIR$\inc\ysizet.h - $TOOLKIT_DIR$\inc\string.h - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_sound.iom - $PROJ_DIR$\..\..\Source\c_loader.iom - $PROJ_DIR$\..\..\Source\c_sound.h - $PROJ_DIR$\..\..\Source\d_sound.h + 269 86 239 224 184 209 - $PROJ_DIR$\..\Include\Cstartup.s79 + $PROJ_DIR$\SrcIAR\Cstartup.s79 AARM - $PROJ_DIR$\..\Object\Cstartup.r79 + 201 AARM - $PROJ_DIR$\..\Include\AT91SAM7S256_inc.h + 215 - $PROJ_DIR$\..\Include\Cstartup_SAM7.c + $PROJ_DIR$\..\..\Source\c_motor.c ICCARM - $PROJ_DIR$\..\Object\Cstartup_SAM7.r79 + 212 ICCARM - $PROJ_DIR$\..\Include\AT91SAM7S256.h + 269 231 210 199 173 - $PROJ_DIR$\..\..\Source\d_bt.c + $PROJ_DIR$\..\..\Source\c_usb.c ICCARM - $PROJ_DIR$\..\Object\d_bt.r79 + 222 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_bt.h - $PROJ_DIR$\..\..\Source\d_bt.r + 269 231 172 198 31 - $PROJ_DIR$\..\..\Source\d_usb.c + $PROJ_DIR$\..\..\Source\c_avrcomm.c ICCARM - $PROJ_DIR$\..\Object\d_usb.r79 + 190 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_usb.h - $PROJ_DIR$\..\..\Source\d_usb.r + 269 219 184 - $PROJ_DIR$\..\..\Source\d_button.c + $PROJ_DIR$\..\..\Source\c_button.c ICCARM - $PROJ_DIR$\..\Object\d_button.r79 + 103 + + + BICOMP + 126 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_button.h - $PROJ_DIR$\..\..\Source\d_button.r + 269 231 30 96 271 + + + BICOMP + 269 231 30 96 271 - $PROJ_DIR$\..\..\Source\d_display.c + $PROJ_DIR$\..\..\Source\c_cmd.c ICCARM - $PROJ_DIR$\..\Object\d_display.r79 + 159 + + + BICOMP + 36 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_display.h - $PROJ_DIR$\..\..\Source\d_display.r + 269 231 100 0 228 64 53 241 96 62 12 44 86 239 58 35 95 229 90 10 234 46 92 70 74 16 268 28 26 117 161 72 + + + BICOMP + 269 231 100 0 228 64 53 241 96 62 12 44 86 239 58 35 95 229 90 10 234 92 70 74 16 268 28 26 117 161 72 - $PROJ_DIR$\..\..\Source\d_hispeed.c + $PROJ_DIR$\..\..\Source\c_input.c ICCARM - $PROJ_DIR$\..\Object\d_hispeed.r79 + 102 + + + BICOMP + 141 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_hispeed.h - $PROJ_DIR$\..\..\Source\d_hispeed.r + 269 231 79 228 37 0 64 268 10 234 46 92 70 74 16 + + + BICOMP + 269 231 79 228 37 0 64 268 10 234 92 70 74 16 - $PROJ_DIR$\..\..\Source\d_input.c + $PROJ_DIR$\..\..\Source\c_ioctrl.c ICCARM - $PROJ_DIR$\..\Object\d_input.r79 + 162 + + + BICOMP + 125 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\c_input.h - $PROJ_DIR$\..\..\Source\c_input.iom - $PROJ_DIR$\..\..\Source\d_input.h - $PROJ_DIR$\..\..\Source\d_input.r + 269 231 226 76 61 + + + BICOMP + 269 231 226 76 61 - $PROJ_DIR$\..\..\Source\c_button.c + $PROJ_DIR$\..\..\Source\c_loader.c ICCARM - $PROJ_DIR$\..\Object\c_button.r79 + 165 + + + BICOMP + 146 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_button.h - $PROJ_DIR$\..\..\Source\c_button.iom - $PROJ_DIR$\..\..\Source\d_button.h + 269 231 64 226 93 56 268 10 234 46 92 70 74 16 + + + BICOMP + 269 231 64 226 93 56 268 10 234 92 70 74 16 - $PROJ_DIR$\..\..\Source\d_ioctrl.c + $PROJ_DIR$\..\..\Source\c_lowspeed.c ICCARM - $PROJ_DIR$\..\Object\d_ioctrl.r79 + 112 + + + BICOMP + 143 ICCARM - $TOOLKIT_DIR$\inc\string.h - $TOOLKIT_DIR$\inc\yvals.h - $TOOLKIT_DIR$\inc\DLib_Defaults.h - $TOOLKIT_DIR$\lib\dl4tptinl8n.h - $TOOLKIT_DIR$\inc\DLib_Product.h - $TOOLKIT_DIR$\inc\xencoding_limits.h - $TOOLKIT_DIR$\inc\ysizet.h - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_ioctrl.h - $PROJ_DIR$\..\..\Source\d_ioctrl.r + 269 231 44 228 59 55 + + + BICOMP + 269 231 44 228 59 55 - $PROJ_DIR$\..\..\Source\d_loader.c + $PROJ_DIR$\..\..\Source\c_output.c ICCARM - $PROJ_DIR$\..\Object\d_loader.r79 + 121 + + + BICOMP + 133 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_loader.h - $PROJ_DIR$\..\..\Source\d_loader.r - $TOOLKIT_DIR$\inc\string.h - $TOOLKIT_DIR$\inc\yvals.h - $TOOLKIT_DIR$\inc\DLib_Defaults.h - $TOOLKIT_DIR$\lib\dl4tptinl8n.h - $TOOLKIT_DIR$\inc\DLib_Product.h - $TOOLKIT_DIR$\inc\xencoding_limits.h - $TOOLKIT_DIR$\inc\ysizet.h - $TOOLKIT_DIR$\inc\ctype.h - $TOOLKIT_DIR$\inc\xlocale.h - $TOOLKIT_DIR$\inc\xtls.h - $TOOLKIT_DIR$\inc\xmtx.h - $TOOLKIT_DIR$\inc\stdlib.h - $TOOLKIT_DIR$\inc\xlocaleuse.h - $TOOLKIT_DIR$\inc\xlocale_c.h - $TOOLKIT_DIR$\inc\xtinfo.h - $TOOLKIT_DIR$\inc\time.h - $TOOLKIT_DIR$\inc\wchar.h + 90 10 234 46 92 70 74 16 41 269 231 0 71 52 62 + + + BICOMP + 90 10 234 92 70 74 16 41 269 231 0 71 52 62 - $PROJ_DIR$\..\..\Source\d_lowspeed.c + $PROJ_DIR$\..\..\Source\c_sound.c ICCARM - $PROJ_DIR$\..\Object\d_lowspeed.r79 + 152 + + + BICOMP + 128 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_lowspeed.h - $PROJ_DIR$\..\..\Source\d_lowspeed.r + 28 10 234 46 92 70 74 16 268 269 231 241 64 60 25 + + + BICOMP + 28 10 234 92 70 74 16 268 269 231 241 64 60 25 - $PROJ_DIR$\..\..\Source\d_output.c + $PROJ_DIR$\..\..\Source\c_ui.c ICCARM - $PROJ_DIR$\..\Object\d_output.r79 + 115 + + + BICOMP + 138 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_output.h - $PROJ_DIR$\..\..\Source\d_output.r + 90 10 234 46 92 70 74 16 268 34 1 99 267 28 20 43 63 87 84 269 231 53 82 86 239 58 62 64 96 241 228 0 226 100 12 44 51 50 81 88 9 227 5 230 240 45 21 49 77 3 40 66 6 33 57 22 78 38 233 94 83 13 48 89 237 19 23 91 32 238 73 144 232 47 98 68 265 101 236 65 + + + BICOMP + 90 10 234 92 70 74 16 268 34 1 99 267 28 20 43 63 87 84 269 231 53 82 86 239 58 62 64 96 241 228 0 226 100 12 44 51 50 81 88 9 227 5 230 240 45 21 49 77 3 40 66 6 33 57 22 78 38 233 94 83 13 48 89 237 19 23 91 32 238 73 144 232 47 98 68 265 101 236 65 - $PROJ_DIR$\..\..\Source\d_sound.c + $PROJ_DIR$\..\..\Source\d_bt.c ICCARM - $PROJ_DIR$\..\Object\d_sound.r79 + 149 + + + BICOMP + 129 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_sound.h - $PROJ_DIR$\..\..\Source\d_sound.r + 269 231 86 239 58 24 7 268 10 234 46 92 70 74 16 + + + BICOMP + 269 231 86 239 58 24 7 268 10 234 92 70 74 16 - $PROJ_DIR$\..\..\Source\d_timer.c + $PROJ_DIR$\..\Include\Cstartup.s79 - ICCARM - $PROJ_DIR$\..\Object\d_timer.r79 + AARM + 137 - ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_timer.h - $PROJ_DIR$\..\..\Source\d_timer.r + AARM + 75 - $PROJ_DIR$\..\..\Source\d_led.c + $PROJ_DIR$\..\Include\Cstartup_SAM7.c ICCARM - $PROJ_DIR$\..\Object\d_led.r79 + 150 + + + BICOMP + 106 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\..\Source\d_led.h - $PROJ_DIR$\..\..\Source\d_led.r + 270 + + + BICOMP + 270 - $PROJ_DIR$\..\..\Source\m_sched.c + $PROJ_DIR$\..\..\Source\d_button.c ICCARM - $PROJ_DIR$\..\Object\m_sched.r79 + 116 + + + BICOMP + 111 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s256.h - $PROJ_DIR$\..\Include\sam7s256.c - $PROJ_DIR$\..\..\Source\c_comm.h - $PROJ_DIR$\..\..\Source\c_input.h - $PROJ_DIR$\..\..\Source\c_input.iom - $PROJ_DIR$\..\..\Source\c_button.h - $PROJ_DIR$\..\..\Source\c_button.iom - $PROJ_DIR$\..\..\Source\c_loader.h - $PROJ_DIR$\..\..\Source\c_sound.h - $PROJ_DIR$\..\..\Source\c_display.h - $PROJ_DIR$\..\..\Source\c_lowspeed.h - $PROJ_DIR$\..\..\Source\c_output.h - $PROJ_DIR$\..\..\Source\c_cmd.h - $PROJ_DIR$\..\..\Source\c_cmd.iom - $PROJ_DIR$\..\..\Source\c_ioctrl.h - $PROJ_DIR$\..\..\Source\c_ui.h + 269 86 239 58 271 18 + + + BICOMP + 269 86 239 58 271 18 - $PROJ_DIR$\..\..\Source\c_cmd.c + $PROJ_DIR$\..\..\Source\d_display.c ICCARM - $PROJ_DIR$\..\Object\c_cmd.r79 + 118 + + + BICOMP + 139 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_cmd.iom - $PROJ_DIR$\..\..\Source\c_output.iom - $PROJ_DIR$\..\..\Source\c_input.iom - $PROJ_DIR$\..\..\Source\c_loader.iom - $PROJ_DIR$\..\..\Source\c_ui.iom - $PROJ_DIR$\..\..\Source\c_sound.iom - $PROJ_DIR$\..\..\Source\c_button.iom - $PROJ_DIR$\..\..\Source\c_display.iom - $PROJ_DIR$\..\..\Source\c_comm.iom - $PROJ_DIR$\..\..\Source\c_lowspeed.iom - $PROJ_DIR$\..\..\Source\c_cmd.h - $PROJ_DIR$\..\..\Source\c_cmd_bytecodes.h - $PROJ_DIR$\..\..\Source\d_timer.h - $TOOLKIT_DIR$\inc\stdio.h - $TOOLKIT_DIR$\inc\yvals.h - $TOOLKIT_DIR$\inc\DLib_Defaults.h - $TOOLKIT_DIR$\lib\dl4tptinl8n.h - $TOOLKIT_DIR$\inc\DLib_Product.h - $TOOLKIT_DIR$\inc\xencoding_limits.h - $TOOLKIT_DIR$\inc\ysizet.h - $TOOLKIT_DIR$\inc\string.h - $TOOLKIT_DIR$\inc\stdlib.h - $PROJ_DIR$\..\..\Source\c_cmd_drawing.inc + 269 86 239 58 29 14 + + + BICOMP + 269 86 239 58 29 14 - $PROJ_DIR$\..\src\main.c + $PROJ_DIR$\..\..\Source\d_hispeed.c ICCARM - $PROJ_DIR$\Flash_Debug\Obj\main.r79 + 164 + + + BICOMP + 108 ICCARM - $PROJ_DIR$\SrcIAR\Board.h - $PROJ_DIR$\..\..\include\AT91SAM7S64.h - $PROJ_DIR$\..\..\include\lib_AT91SAM7S64.h + 269 86 239 58 85 67 + + + BICOMP + 269 86 239 58 85 67 - $PROJ_DIR$\..\..\Source\c_avrcomm.c + $PROJ_DIR$\..\..\Source\d_input.c ICCARM - $PROJ_DIR$\..\Object\c_avrcomm.r79 + 157 + + + BICOMP + 124 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\c_avrcomm.h - $PROJ_DIR$\..\..\Source\d_avrcomm.h - - - - - $PROJ_DIR$\SrcIAR\Cstartup.s79 - - - AARM - $PROJ_DIR$\Flash_Debug\Obj\Cstartup.r79 + 269 86 239 58 79 228 37 80 - - - AARM - $PROJ_DIR$\..\..\include\AT91SAM7S64_inc.h + BICOMP + 269 86 239 58 79 228 37 80 - $PROJ_DIR$\..\..\Source\main.c + $PROJ_DIR$\..\..\Source\d_ioctrl.c ICCARM - $PROJ_DIR$\..\Object\main.r79 + 120 + + + BICOMP + 27 ICCARM - $PROJ_DIR$\..\Include\Board.h - $PROJ_DIR$\..\Include\AT91SAM7S64.h - $PROJ_DIR$\..\Include\lib_AT91SAM7S64.h + 268 10 234 46 92 70 74 16 269 86 239 58 61 39 + + + BICOMP + 268 10 234 92 70 74 16 269 86 239 58 61 39 - $PROJ_DIR$\..\..\Source\c_hispeed.c + $PROJ_DIR$\..\..\Source\d_loader.c ICCARM - $PROJ_DIR$\..\Object\c_hispeed.r79 + 148 + + + BICOMP + 163 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_hispeed.iom - $PROJ_DIR$\..\..\Source\c_hispeed.h - $PROJ_DIR$\..\..\Source\d_hispeed.h + 269 231 86 239 58 93 11 268 10 234 46 92 70 74 16 34 1 99 267 28 20 43 63 87 84 + + + BICOMP + 269 231 86 239 58 93 11 268 10 234 92 70 74 16 34 1 99 267 28 20 43 63 87 84 - $PROJ_DIR$\..\..\Source\d_net.c + $PROJ_DIR$\..\..\Source\d_lowspeed.c ICCARM - $PROJ_DIR$\..\Object\d_net.r79 + 131 + + + BICOMP + 151 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s64.h - $PROJ_DIR$\..\..\Source\d_net.h - $PROJ_DIR$\..\..\Source\d_net.r + 269 86 239 58 55 69 + + + BICOMP + 269 86 239 58 55 69 - $PROJ_DIR$\..\..\Source\d_avrcomm.c + $PROJ_DIR$\..\..\Source\d_output.c ICCARM - $PROJ_DIR$\..\Object\d_avrcomm.r79 + 123 + + + BICOMP + 119 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s64.h - $PROJ_DIR$\..\..\Source\d_avrcomm.h - $PROJ_DIR$\..\..\Source\d_avrcomm.r + 269 86 239 58 52 2 + + + BICOMP + 269 86 239 58 52 2 - $PROJ_DIR$\SrcIAR\Cstartup_SAM7.c + $PROJ_DIR$\..\..\Source\d_sound.c ICCARM - $PROJ_DIR$\Flash_Debug\Obj\Cstartup_SAM7.r79 + 113 + + + BICOMP + 105 ICCARM - $PROJ_DIR$\SrcIAR\Board.h - $PROJ_DIR$\..\..\include\AT91SAM7S64.h - $PROJ_DIR$\..\..\include\lib_AT91SAM7S64.h + 269 86 239 58 25 17 130 + + + BICOMP + 269 86 239 58 25 17 130 - $PROJ_DIR$\..\..\Source\c_bt.c + $PROJ_DIR$\..\..\Source\d_timer.c ICCARM - $PROJ_DIR$\..\Object\c_bt.r79 + 140 + + + BICOMP + 132 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_bt.iom - $PROJ_DIR$\..\..\Source\c_bt.h - $PROJ_DIR$\..\..\Source\d_bt.h - $PROJ_DIR$\..\..\Source\c_cmd.iom + 269 86 239 58 229 235 + + + BICOMP + 269 86 239 58 229 235 - $PROJ_DIR$\..\..\Source\c_usb.c + $PROJ_DIR$\..\..\Source\d_usb.c ICCARM - $PROJ_DIR$\..\Object\c_usb.r79 + 136 + + + BICOMP + 158 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_usb.iom - $PROJ_DIR$\..\..\Source\c_usb.h - $PROJ_DIR$\..\..\Source\d_usb.h + 269 86 239 58 31 97 + + + BICOMP + 269 86 239 58 31 97 - $PROJ_DIR$\..\..\Source\c_net.c + $PROJ_DIR$\..\..\Source\m_sched.c ICCARM - $PROJ_DIR$\..\Object\c_net.r79 + 110 + + + BICOMP + 154 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\c_net.h - $PROJ_DIR$\..\..\Source\d_net.h + 269 231 86 239 58 42 54 79 228 30 96 56 60 8 59 71 35 95 100 76 82 + + + BICOMP + 269 231 86 239 58 42 54 79 228 30 96 56 60 8 59 71 35 95 100 76 82 - $PROJ_DIR$\..\..\Source\c_motor.c + $PROJ_DIR$\..\Object\LMS_ARM.d79 - ICCARM - $PROJ_DIR$\..\Object\c_motor.r79 + XLINK + 104 183 - ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_motor.iom - $PROJ_DIR$\..\..\Source\c_motor.h - $PROJ_DIR$\..\..\Source\d_motor.h + XLINK + 145 137 150 103 159 114 155 102 162 165 112 121 152 115 149 116 118 164 157 120 148 131 123 113 140 136 110 156 + + + RAM_Debug + + $PROJ_DIR$\..\..\Source\c_output.iom + $TOOLKIT_DIR$\inc\xlocale.h + $PROJ_DIR$\..\..\Source\d_output.r + $PROJ_DIR$\..\..\Source\RCXintro_2.txt + $PROJ_DIR$\..\..\Source\c_display.c + $PROJ_DIR$\..\..\Source\Port.txt + $PROJ_DIR$\..\..\Source\RCXintro_5.txt + $PROJ_DIR$\..\..\Source\d_bt.r + $PROJ_DIR$\..\..\Source\c_display.h + $PROJ_DIR$\..\..\Source\Cursor.txt + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\..\..\Source\d_loader.r + $PROJ_DIR$\..\..\Source\c_comm.iom + $PROJ_DIR$\..\..\Source\RCXintro_14.txt + $PROJ_DIR$\..\..\Source\d_display.r + $PROJ_DIR$\..\..\Source\c_comm.c + $TOOLKIT_DIR$\inc\ysizet.h + $PROJ_DIR$\..\..\Source\d_sound.r + $PROJ_DIR$\..\..\Source\d_button.r + $PROJ_DIR$\..\..\Source\Devices.txt + $TOOLKIT_DIR$\inc\xlocaleuse.h + $PROJ_DIR$\..\..\Source\Info.txt + $PROJ_DIR$\..\..\Source\RCXintro_8.txt + $PROJ_DIR$\..\..\Source\Connections.txt + $PROJ_DIR$\..\..\Source\d_bt.h + $PROJ_DIR$\..\..\Source\d_sound.h + $TOOLKIT_DIR$\inc\math.h + $TOOLKIT_DIR$\inc\stdlib.h + $PROJ_DIR$\..\..\Source\d_display.h + $PROJ_DIR$\..\..\Source\c_button.h + $PROJ_DIR$\..\..\Source\d_usb.h + $PROJ_DIR$\..\..\Source\Mainmenu.rms + $PROJ_DIR$\..\..\Source\RCXintro_6.txt + $TOOLKIT_DIR$\inc\ctype.h + $PROJ_DIR$\..\..\Source\c_cmd.h + $PROJ_DIR$\..\..\Source\d_input.h + $PROJ_DIR$\..\..\Source\RCXintro_10.txt + $PROJ_DIR$\..\..\Source\d_ioctrl.r + $PROJ_DIR$\..\..\Source\RCXintro_3.txt + $TOOLKIT_DIR$\inc\stdbool.h + $PROJ_DIR$\..\Include\sam7s256.c + $TOOLKIT_DIR$\inc\xlocale_c.h + $PROJ_DIR$\..\..\Source\c_lowspeed.iom + $PROJ_DIR$\..\..\Source\Fail.txt + $PROJ_DIR$\..\..\Source\Submenu05.rms + $PROJ_DIR$\..\..\Source\RCXintro_15.txt + $PROJ_DIR$\..\..\Source\Icons.txt + $PROJ_DIR$\..\..\Source\LowBattery.txt + $PROJ_DIR$\..\..\Source\Display.txt + $PROJ_DIR$\..\..\Source\d_output.h + $PROJ_DIR$\..\..\Source\c_ui.iom + $PROJ_DIR$\..\..\Source\c_comm.h + $PROJ_DIR$\..\..\Source\d_lowspeed.h + $PROJ_DIR$\..\..\Source\c_loader.h + $PROJ_DIR$\..\..\Source\RCXintro_7.txt + $PROJ_DIR$\..\Include\ioat91sam7s256.h + $PROJ_DIR$\..\..\Source\c_lowspeed.h + $PROJ_DIR$\..\..\Source\c_sound.h + $PROJ_DIR$\..\..\Source\d_ioctrl.h + $PROJ_DIR$\..\..\Source\c_display.iom + $TOOLKIT_DIR$\inc\xtinfo.h + $PROJ_DIR$\..\..\Source\c_loader.iom + $PROJ_DIR$\..\..\Source\Test2.txt + $PROJ_DIR$\..\..\Source\RCXintro_4.txt + $PROJ_DIR$\..\..\Source\d_hispeed.r + $PROJ_DIR$\..\..\Source\Submenu07.rms + $PROJ_DIR$\..\..\Source\d_lowspeed.r + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\..\..\Source\c_output.h + $PROJ_DIR$\..\..\Source\c_cmd_drawing.inc + $PROJ_DIR$\..\..\Source\Submenu02.rms + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\..\Include\AT91SAM7S256_inc.h + $PROJ_DIR$\..\..\Source\c_ioctrl.h + $PROJ_DIR$\..\..\Source\RCXintro_1.txt + $PROJ_DIR$\..\..\Source\RCXintro_9.txt + $PROJ_DIR$\..\..\Source\c_input.h + $PROJ_DIR$\..\..\Source\d_input.r + $PROJ_DIR$\..\..\Source\Font.txt + $PROJ_DIR$\..\..\Source\c_ui.h + $PROJ_DIR$\..\..\Source\RCXintro_13.txt + $TOOLKIT_DIR$\inc\wchar.h + $PROJ_DIR$\..\..\Source\d_hispeed.h + $PROJ_DIR$\..\..\Source\m_sched.h + $TOOLKIT_DIR$\inc\time.h + $PROJ_DIR$\..\..\Source\Step.txt + $PROJ_DIR$\..\..\Source\RCXintro_16.txt + $TOOLKIT_DIR$\inc\stdio.h + $PROJ_DIR$\..\..\Source\Ui.txt + $TOOLKIT_DIR$\inc\DLib_Product.h + $PROJ_DIR$\..\..\Source\d_loader.h + $PROJ_DIR$\..\..\Source\RCXintro_12.txt + $PROJ_DIR$\..\..\Source\c_cmd_bytecodes.h + $PROJ_DIR$\..\..\Source\c_button.iom + $PROJ_DIR$\..\..\Source\d_usb.r + $PROJ_DIR$\..\..\Source\Submenu06.rms + $TOOLKIT_DIR$\inc\xtls.h + $PROJ_DIR$\..\..\Source\c_cmd.iom + $PROJ_DIR$\..\..\Source\BtTest.inc + $PROJ_DIR$\..\..\Source\c_led.iom + $TOOLKIT_DIR$\inc\ymath.h + $PROJ_DIR$\..\..\Source\d_sound_adpcm.r + $PROJ_DIR$\..\..\Source\c_led.h + $PROJ_DIR$\..\..\Source\d_led.h + $PROJ_DIR$\..\..\Source\c_led.c + $PROJ_DIR$\..\..\Source\Submenu03.rms + $PROJ_DIR$\..\..\Source\d_led.c + $PROJ_DIR$\..\..\Source\d_led.r + $TOOLKIT_DIR$\inc\limits.h + $PROJ_DIR$\..\..\Source\c_sensor.iom + $PROJ_DIR$\SrcIAR\Cstartup_SAM7.c + $PROJ_DIR$\..\..\Source\d_motor.h + $PROJ_DIR$\..\src\main.c + $PROJ_DIR$\..\..\Source\d_motor.c + $PROJ_DIR$\..\..\Source\d_motor.r + $PROJ_DIR$\..\..\Source\c_sensor.c + $PROJ_DIR$\..\..\Source\d_sensor.c + $PROJ_DIR$\..\..\Source\d_sensor.h + $PROJ_DIR$\..\..\Source\c_motor.h + $PROJ_DIR$\..\..\Source\main.c + $PROJ_DIR$\..\..\Source\c_sensor.h + $PROJ_DIR$\SrcIAR\Cstartup.s79 + $PROJ_DIR$\..\..\Source\c_motor.iom + $PROJ_DIR$\..\..\Source\c_motor.c + $PROJ_DIR$\..\..\Source\d_sensor.r + $PROJ_DIR$\..\Include\ioat91sam7s64.h + $PROJ_DIR$\RAM_Debug\Obj\d_button.pbi + $PROJ_DIR$\RAM_Debug\Obj\d_display.r79 + $PROJ_DIR$\RAM_Debug\Obj\c_input.pbi + $PROJ_DIR$\RAM_Debug\Obj\d_output.pbi + $PROJ_DIR$\RAM_Debug\Obj\c_output.r79 + $PROJ_DIR$\..\..\Source\c_ioctrl.iom + $PROJ_DIR$\..\..\Source\Running.txt + $PROJ_DIR$\..\..\Source\c_input.iom + $PROJ_DIR$\RAM_Debug\Obj\c_ioctrl.pbi + $PROJ_DIR$\RAM_Debug\Obj\c_cmd.r79 + $PROJ_DIR$\RAM_Debug\Obj\c_sound.r79 + $PROJ_DIR$\RAM_Debug\Obj\Cstartup_SAM7.pbi + $PROJ_DIR$\RAM_Debug\Obj\d_hispeed.pbi + $PROJ_DIR$\RAM_Debug\Obj\c_led.r79 + $PROJ_DIR$\RAM_Debug\Obj\d_loader.r79 + $PROJ_DIR$\RAM_Debug\Obj\c_motor.r79 + $PROJ_DIR$\..\..\Source\d_timer.h + $PROJ_DIR$\RAM_Debug\Obj\c_sensor.r79 + $PROJ_DIR$\RAM_Debug\Obj\d_display.pbi + $PROJ_DIR$\RAM_Debug\Obj\d_ioctrl.pbi + $PROJ_DIR$\RAM_Debug\Obj\c_ioctrl.r79 + $PROJ_DIR$\RAM_Debug\Obj\d_loader.pbi + $PROJ_DIR$\RAM_Debug\Obj\d_output.r79 + $PROJ_DIR$\RAM_Debug\Obj\c_button.pbi + $PROJ_DIR$\RAM_Debug\Obj\c_button.r79 + $PROJ_DIR$\..\..\Source\Ok.txt + $PROJ_DIR$\..\..\Source\modules.h + $PROJ_DIR$\RAM_Debug\Obj\c_input.r79 + $PROJ_DIR$\RAM_Debug\Obj\c_display.pbi + $PROJ_DIR$\RAM_Debug\Obj\c_sound.pbi + $PROJ_DIR$\RAM_Debug\Obj\d_timer.r79 + $PROJ_DIR$\RAM_Debug\Obj\c_loader.pbi + $PROJ_DIR$\RAM_Debug\Obj\c_loader.r79 + $PROJ_DIR$\RAM_Debug\Obj\c_comm.r79 + $PROJ_DIR$\RAM_Debug\Obj\d_button.r79 + $PROJ_DIR$\RAM_Debug\Obj\main.r79 + $PROJ_DIR$\RAM_Debug\Obj\d_sound.r79 + $PROJ_DIR$\RAM_Debug\Obj\d_bt.pbi + $PROJ_DIR$\RAM_Debug\Obj\c_ui.pbi + $PROJ_DIR$\RAM_Debug\Obj\d_ioctrl.r79 + $PROJ_DIR$\RAM_Debug\Obj\sam7s256.r79 + $PROJ_DIR$\RAM_Debug\Obj\d_lowspeed.r79 + $PROJ_DIR$\RAM_Debug\Obj\Cstartup.r79 + $PROJ_DIR$\RAM_Debug\Obj\d_input.pbi + $PROJ_DIR$\RAM_Debug\Obj\d_usb.r79 + $PROJ_DIR$\RAM_Debug\Obj\d_motor.r79 + $PROJ_DIR$\RAM_Debug\Obj\d_sound.pbi + $PROJ_DIR$\RAM_Debug\Obj\d_sensor.r79 + $PROJ_DIR$\RAM_Debug\Obj\d_led.r79 + $PROJ_DIR$\RAM_Debug\Obj\c_ui.r79 + $PROJ_DIR$\RAM_Debug\Exe\LMS_ARM.d79 + $PROJ_DIR$\RAM_Debug\Obj\d_input.r79 + $PROJ_DIR$\RAM_Debug\Obj\d_usb.pbi + $PROJ_DIR$\RAM_Debug\Obj\Cstartup_SAM7.r79 + $PROJ_DIR$\RAM_Debug\Obj\c_output.pbi + $PROJ_DIR$\RAM_Debug\Obj\LMS_ARM.pbd + $PROJ_DIR$\RAM_Debug\Obj\d_lowspeed.pbi + $PROJ_DIR$\RAM_Debug\Obj\c_display.r79 + $PROJ_DIR$\RAM_Debug\Obj\d_timer.pbi + $PROJ_DIR$\RAM_Debug\Obj\c_lowspeed.r79 + $PROJ_DIR$\RAM_Debug\Obj\c_lowspeed.pbi + $PROJ_DIR$\RAM_Debug\Obj\m_sched.pbi + $TOOLKIT_DIR$\lib\dl4tptinl8n.h + $PROJ_DIR$\RAM_Debug\Obj\d_hispeed.r79 + $PROJ_DIR$\RAM_Debug\Obj\d_bt.r79 + $PROJ_DIR$\..\..\Source\Submenu04.rms + $PROJ_DIR$\..\..\Source\RCXintro_11.txt + $PROJ_DIR$\RAM_Debug\Obj\c_comm.pbi + $PROJ_DIR$\RAM_Debug\Obj\c_cmd.pbi + $PROJ_DIR$\RAM_Debug\Obj\m_sched.r79 + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $PROJ_DIR$\..\..\Source\d_timer.r + $PROJ_DIR$\..\..\Source\Test1.txt + $PROJ_DIR$\..\..\Source\Status.txt + $PROJ_DIR$\..\..\Source\Submenu01.rms + $PROJ_DIR$\..\Include\sam7s256.h + $PROJ_DIR$\..\..\Source\Wait.txt + $PROJ_DIR$\..\..\Source\c_sound.iom + $PROJ_DIR$\..\..\Source\c_button.c + $PROJ_DIR$\..\..\Source\c_cmd.c + $PROJ_DIR$\..\..\Source\c_input.c + $PROJ_DIR$\..\..\Source\c_ioctrl.c + $PROJ_DIR$\..\..\Source\c_loader.c + $PROJ_DIR$\..\..\Source\c_lowspeed.c + $PROJ_DIR$\..\..\Source\c_output.c + $PROJ_DIR$\..\..\Source\c_sound.c + $PROJ_DIR$\..\..\Source\c_ui.c + $PROJ_DIR$\..\..\Source\d_bt.c + $PROJ_DIR$\..\Include\Cstartup.s79 + $PROJ_DIR$\..\Include\Cstartup_SAM7.c + $PROJ_DIR$\..\..\Source\d_button.c + $PROJ_DIR$\..\..\Source\d_display.c + $PROJ_DIR$\..\..\Source\d_hispeed.c + $PROJ_DIR$\..\..\Source\d_input.c + $PROJ_DIR$\..\..\Source\d_ioctrl.c + $PROJ_DIR$\..\..\Source\d_loader.c + $PROJ_DIR$\..\..\Source\d_lowspeed.c + $PROJ_DIR$\..\..\Source\d_output.c + $PROJ_DIR$\..\..\Source\d_sound.c + $PROJ_DIR$\..\..\Source\d_timer.c + $PROJ_DIR$\..\..\Source\d_usb.c + $PROJ_DIR$\..\..\Source\Functions.inl + $PROJ_DIR$\..\..\Source\m_sched.c + $TOOLKIT_DIR$\inc\xmtx.h + $TOOLKIT_DIR$\inc\string.h + $PROJ_DIR$\..\..\Source\stdconst.h + $PROJ_DIR$\..\Include\AT91SAM7S256.h + $PROJ_DIR$\..\..\Source\d_button.h + - $PROJ_DIR$\Flash_Debug\Exe\Basic.d79 - + [ROOT_NODE] + XLINK - $PROJ_DIR$\at91SAM7S64_NoRemap.xcl - $PROJ_DIR$\Flash_Debug\Obj\Cstartup.r79 - $PROJ_DIR$\Flash_Debug\Obj\Cstartup_SAM7.r79 - $PROJ_DIR$\Flash_Debug\Obj\main.r79 - $TOOLKIT_DIR$\lib\dl4tptinl8n.r79 + 176 - + - $PROJ_DIR$\..\..\Source\c_sensor.c + $PROJ_DIR$\..\..\Source\c_display.c ICCARM - $PROJ_DIR$\..\Object\c_sensor.r79 + 183 + + + BICOMP + 154 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_sensor.iom - $PROJ_DIR$\..\..\Source\c_sensor.h - $PROJ_DIR$\..\..\Source\d_sensor.h + 230 10 196 188 89 67 71 16 231 152 59 8 28 + + + BICOMP + 230 10 196 89 67 71 16 231 152 59 8 28 - $PROJ_DIR$\..\..\Source\d_motor.c + $PROJ_DIR$\..\..\Source\c_comm.c ICCARM - $PROJ_DIR$\..\Object\d_motor.r79 + 159 + + + BICOMP + 193 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s64.h - $PROJ_DIR$\..\..\Source\d_motor.h - $PROJ_DIR$\..\..\Source\d_motor.r + 231 152 12 61 131 50 97 59 51 30 82 24 230 10 196 188 89 67 71 16 33 1 96 229 27 20 41 60 84 81 + + + BICOMP + 231 152 12 61 131 50 97 59 51 30 82 24 230 10 196 89 67 71 16 33 1 96 229 27 20 41 60 84 81 - $PROJ_DIR$\..\..\Source\d_sensor.c + $PROJ_DIR$\..\Include\sam7s256.c ICCARM - $PROJ_DIR$\..\Object\d_sensor.r79 + 166 - + + + $PROJ_DIR$\..\..\Source\c_led.c + ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s64.h - $PROJ_DIR$\..\..\Source\d_sensor.h - $PROJ_DIR$\..\..\Source\d_sensor.r + 139 - - - - $PROJ_DIR$\Flash_Debug\Exe\LMS_ARM.d79 + - XLINK - $PROJ_DIR$\at91SAM7S64_NoRemap.xcl - $PROJ_DIR$\Flash_Debug\Obj\Cstartup.r79 - $PROJ_DIR$\Flash_Debug\Obj\Cstartup_SAM7.r79 - $PROJ_DIR$\Flash_Debug\Obj\main.r79 - $TOOLKIT_DIR$\lib\dl4tptinl8n.r79 + ICCARM + 231 152 99 102 103 - $PROJ_DIR$\..\..\Source\c_comm.c + $PROJ_DIR$\..\..\Source\d_led.c ICCARM - $PROJ_DIR$\..\Object\c_comm.r79 + 174 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_comm.iom - $PROJ_DIR$\..\..\Source\c_loader.iom - $PROJ_DIR$\..\..\Source\c_ioctrl.iom - $PROJ_DIR$\..\..\Source\c_ui.iom - $PROJ_DIR$\..\..\Source\c_cmd.iom - $PROJ_DIR$\..\..\Source\c_comm.h - $PROJ_DIR$\..\..\Source\d_usb.h - $PROJ_DIR$\..\..\Source\d_hispeed.h - $PROJ_DIR$\..\..\Source\d_bt.h - $TOOLKIT_DIR$\inc\string.h - $TOOLKIT_DIR$\inc\yvals.h - $TOOLKIT_DIR$\inc\DLib_Defaults.h - $TOOLKIT_DIR$\lib\dl4tptinl8n.h - $TOOLKIT_DIR$\inc\DLib_Product.h - $TOOLKIT_DIR$\inc\xencoding_limits.h - $TOOLKIT_DIR$\inc\ysizet.h - $TOOLKIT_DIR$\inc\ctype.h - $TOOLKIT_DIR$\inc\xlocale.h - $TOOLKIT_DIR$\inc\xtls.h - $TOOLKIT_DIR$\inc\xmtx.h - $TOOLKIT_DIR$\inc\stdlib.h - $TOOLKIT_DIR$\inc\xlocaleuse.h - $TOOLKIT_DIR$\inc\xlocale_c.h - $TOOLKIT_DIR$\inc\xtinfo.h - $TOOLKIT_DIR$\inc\time.h - $TOOLKIT_DIR$\inc\wchar.h + 231 83 201 125 103 107 - - - RAM_Debug - [ROOT_NODE] + $PROJ_DIR$\SrcIAR\Cstartup_SAM7.c - XLINK - $PROJ_DIR$\RAM_Debug\List\LMS_ARM.map - $PROJ_DIR$\RAM_Debug\Exe\LMS_ARM.d79 + ICCARM + 179 - $PROJ_DIR$\..\Include\sam7s256.c + $PROJ_DIR$\..\src\main.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\sam7s256.r79 + 161 - $PROJ_DIR$\..\..\Source\c_led.c + $PROJ_DIR$\..\..\Source\d_motor.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\c_led.r79 + 171 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_led.iom - $PROJ_DIR$\..\..\Source\c_led.h - $PROJ_DIR$\..\..\Source\d_led.h + 231 83 201 125 111 114 - $PROJ_DIR$\..\..\Source\c_display.c + $PROJ_DIR$\..\..\Source\c_sensor.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\c_display.r79 + 143 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_display.iom - $PROJ_DIR$\..\..\Source\c_display.h - $PROJ_DIR$\..\..\Source\d_display.h + 231 152 109 120 117 - $PROJ_DIR$\..\..\Source\c_ioctrl.c + $PROJ_DIR$\..\..\Source\d_sensor.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\c_ioctrl.r79 + 173 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_ioctrl.iom - $PROJ_DIR$\..\..\Source\c_ioctrl.h - $PROJ_DIR$\..\..\Source\d_ioctrl.h + 231 83 201 125 117 124 - $PROJ_DIR$\..\..\Source\c_loader.c + $PROJ_DIR$\..\..\Source\main.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\c_loader.r79 + 161 - + + + $PROJ_DIR$\SrcIAR\Cstartup.s79 + - ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_loader.iom - $PROJ_DIR$\..\..\Source\c_loader.h + AARM + 168 - + - $PROJ_DIR$\..\..\Source\c_lowspeed.c + $PROJ_DIR$\..\..\Source\c_motor.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\c_lowspeed.r79 + 141 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_lowspeed.iom - $PROJ_DIR$\..\..\Source\c_lowspeed.h - $PROJ_DIR$\..\..\Source\d_lowspeed.h + 231 152 122 118 111 - $PROJ_DIR$\..\..\Source\c_sound.c + $PROJ_DIR$\RAM_Debug\Obj\LMS_ARM.pbd + + + BILINK + 137 149 194 193 154 128 134 157 186 180 155 164 163 126 144 138 169 145 147 182 129 172 184 178 187 + + + + + $PROJ_DIR$\..\..\Source\c_button.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\c_sound.r79 + 150 + + + BICOMP + 149 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_sound.iom - $PROJ_DIR$\..\..\Source\c_sound.h - $PROJ_DIR$\..\..\Source\d_sound.h + 231 152 29 93 233 + + + BICOMP + 231 152 29 93 233 - $PROJ_DIR$\..\Include\Cstartup.s79 + $PROJ_DIR$\..\..\Source\c_cmd.c - AARM - $PROJ_DIR$\RAM_Debug\Obj\Cstartup.r79 + ICCARM + 135 + + + BICOMP + 194 - AARM - $PROJ_DIR$\..\Include\AT91SAM7S64_inc.h + ICCARM + 231 152 97 0 133 61 50 203 93 59 12 42 83 201 55 34 92 142 87 10 196 188 89 67 71 16 230 27 26 100 108 69 + + + BICOMP + 231 152 97 0 133 61 50 203 93 59 12 42 83 201 55 34 92 142 87 10 196 89 67 71 16 230 27 26 100 108 69 - $PROJ_DIR$\..\Include\Cstartup_SAM7.c + $PROJ_DIR$\..\..\Source\c_input.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\Cstartup_SAM7.r79 + 153 + + + BICOMP + 128 ICCARM - $PROJ_DIR$\..\Include\Board.h - $PROJ_DIR$\..\Include\AT91SAM7S64.h - $PROJ_DIR$\..\Include\lib_AT91SAM7S64.h + 231 152 76 133 35 0 61 230 10 196 188 89 67 71 16 + + + BICOMP + 231 152 76 133 35 0 61 230 10 196 89 67 71 16 - $PROJ_DIR$\..\..\Source\d_bt.c + $PROJ_DIR$\..\..\Source\c_ioctrl.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\d_bt.r79 + 146 + + + BICOMP + 134 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s64.h - $PROJ_DIR$\..\..\Source\d_bt.h - $PROJ_DIR$\..\..\Source\d_bt.r + 231 152 131 73 58 + + + BICOMP + 231 152 131 73 58 - $PROJ_DIR$\..\..\Source\d_usb.c + $PROJ_DIR$\..\..\Source\c_loader.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\d_usb.r79 + 158 + + + BICOMP + 157 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s64.h - $PROJ_DIR$\..\..\Source\d_usb.h - $PROJ_DIR$\..\..\Source\d_usb.r + 231 152 61 131 90 53 230 10 196 188 89 67 71 16 + + + BICOMP + 231 152 61 131 90 53 230 10 196 89 67 71 16 - $PROJ_DIR$\..\..\Source\d_button.c + $PROJ_DIR$\..\..\Source\c_lowspeed.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\d_button.r79 + 185 + + + BICOMP + 186 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s64.h - $PROJ_DIR$\..\..\Source\d_button.h - $PROJ_DIR$\..\..\Source\d_button.r + 231 152 42 133 56 52 + + + BICOMP + 231 152 42 133 56 52 - $PROJ_DIR$\..\..\Source\d_display.c + $PROJ_DIR$\..\..\Source\c_output.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\d_display.r79 + 130 + + + BICOMP + 180 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s64.h - $PROJ_DIR$\..\..\Source\d_display.h - $PROJ_DIR$\..\..\Source\d_display.r + 87 10 196 188 89 67 71 16 39 231 152 0 68 49 59 + + + BICOMP + 87 10 196 89 67 71 16 39 231 152 0 68 49 59 - $PROJ_DIR$\..\..\Source\d_hispeed.c + $PROJ_DIR$\..\..\Source\c_sound.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\d_hispeed.r79 + 136 + + + BICOMP + 155 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s64.h - $PROJ_DIR$\..\..\Source\d_hispeed.h - $PROJ_DIR$\..\..\Source\d_hispeed.r + 27 10 196 188 89 67 71 16 230 231 152 203 61 57 25 + + + BICOMP + 27 10 196 89 67 71 16 230 231 152 203 61 57 25 - $PROJ_DIR$\..\..\Source\c_button.c + $PROJ_DIR$\..\..\Source\c_ui.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\c_button.r79 + 175 + + + BICOMP + 164 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_button.h - $PROJ_DIR$\..\..\Source\c_button.iom - $PROJ_DIR$\..\..\Source\d_button.h + 87 10 196 188 89 67 71 16 230 33 1 96 229 27 20 41 60 84 81 231 152 50 79 83 201 55 59 61 93 203 133 0 131 97 12 42 48 47 78 85 9 132 5 151 202 43 21 46 74 3 38 63 6 32 54 22 75 36 192 91 80 13 45 86 199 19 23 88 31 200 70 105 191 44 95 65 227 98 198 62 + + + BICOMP + 87 10 196 89 67 71 16 230 33 1 96 229 27 20 41 60 84 81 231 152 50 79 83 201 55 59 61 93 203 133 0 131 97 12 42 48 47 78 85 9 132 5 151 202 43 21 46 74 3 38 63 6 32 54 22 75 36 192 91 80 13 45 86 199 19 23 88 31 200 70 105 191 44 95 65 227 98 198 62 - $PROJ_DIR$\..\..\Source\d_ioctrl.c + $PROJ_DIR$\..\..\Source\d_bt.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\d_ioctrl.r79 + 190 + + + BICOMP + 163 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s64.h - $PROJ_DIR$\..\..\Source\d_ioctrl.h - $PROJ_DIR$\..\..\Source\d_ioctrl.r + 231 152 83 201 55 24 7 230 10 196 188 89 67 71 16 + + + BICOMP + 231 152 83 201 55 24 7 230 10 196 89 67 71 16 - $PROJ_DIR$\..\..\Source\d_lowspeed.c + $PROJ_DIR$\..\Include\Cstartup.s79 - ICCARM - $PROJ_DIR$\RAM_Debug\Obj\d_lowspeed.r79 + AARM + 168 - ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s64.h - $PROJ_DIR$\..\..\Source\d_lowspeed.h - $PROJ_DIR$\..\..\Source\d_lowspeed.r + AARM + 72 - $PROJ_DIR$\..\..\Source\d_sound.c + $PROJ_DIR$\..\Include\Cstartup_SAM7.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\d_sound.r79 + 179 + + + BICOMP + 137 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s64.h - $PROJ_DIR$\..\..\Source\d_sound.h - $PROJ_DIR$\..\..\Source\d_sound.r + 232 + + + BICOMP + 232 - $PROJ_DIR$\..\..\Source\d_timer.c + $PROJ_DIR$\..\..\Source\d_button.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\d_timer.r79 + 160 + + + BICOMP + 126 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s64.h - $PROJ_DIR$\..\..\Source\d_timer.h - $PROJ_DIR$\..\..\Source\d_timer.r + 231 83 201 55 233 18 + + + BICOMP + 231 83 201 55 233 18 - $PROJ_DIR$\..\..\Source\d_led.c + $PROJ_DIR$\..\..\Source\d_display.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\d_led.r79 + 127 + + + BICOMP + 144 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s64.h - $PROJ_DIR$\..\..\Source\d_led.h - $PROJ_DIR$\..\..\Source\d_led.r + 231 83 201 55 28 14 + + + BICOMP + 231 83 201 55 28 14 - $PROJ_DIR$\..\..\Source\m_sched.c + $PROJ_DIR$\..\..\Source\d_hispeed.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\m_sched.r79 + 189 + + + BICOMP + 138 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s64.h - $PROJ_DIR$\..\Include\sam7s256.c - $PROJ_DIR$\..\..\Source\c_comm.h - $PROJ_DIR$\..\..\Source\c_sensor.h - $PROJ_DIR$\..\..\Source\c_button.h - $PROJ_DIR$\..\..\Source\c_loader.h - $PROJ_DIR$\..\..\Source\c_sound.h - $PROJ_DIR$\..\..\Source\c_display.h - $PROJ_DIR$\..\..\Source\c_lowspeed.h - $PROJ_DIR$\..\..\Source\c_motor.h - $PROJ_DIR$\..\..\Source\c_cmd.h - $PROJ_DIR$\..\..\Source\c_cmd.iom - $PROJ_DIR$\..\..\Source\c_ioctrl.h - $PROJ_DIR$\..\..\Source\c_led.h + 231 83 201 55 82 64 + + + BICOMP + 231 83 201 55 82 64 - $PROJ_DIR$\..\..\Source\c_cmd.c + $PROJ_DIR$\..\..\Source\d_input.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\c_cmd.r79 + 177 + + + BICOMP + 169 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_cmd.iom - $PROJ_DIR$\..\..\Source\c_led.iom - $PROJ_DIR$\..\..\Source\c_cmd.h - $PROJ_DIR$\..\..\Source\d_timer.h + 231 83 201 55 76 133 35 77 + + + BICOMP + 231 83 201 55 76 133 35 77 - $PROJ_DIR$\..\src\main.c + $PROJ_DIR$\..\..\Source\d_ioctrl.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\main.r79 + 165 - - - - $PROJ_DIR$\SrcIAR\Cstartup.s79 - - AARM - $PROJ_DIR$\RAM_Debug\Obj\Cstartup.r79 + BICOMP + 145 - - - $PROJ_DIR$\..\..\Source\main.c - + ICCARM - $PROJ_DIR$\RAM_Debug\Obj\main.r79 + 230 10 196 188 89 67 71 16 231 83 201 55 58 37 - + + BICOMP + 230 10 196 89 67 71 16 231 83 201 55 58 37 + + - $PROJ_DIR$\SrcIAR\Cstartup_SAM7.c + $PROJ_DIR$\..\..\Source\d_loader.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\Cstartup_SAM7.r79 + 140 + + + BICOMP + 147 + + + ICCARM + 231 152 83 201 55 90 11 230 10 196 188 89 67 71 16 33 1 96 229 27 20 41 60 84 81 + + + BICOMP + 231 152 83 201 55 90 11 230 10 196 89 67 71 16 33 1 96 229 27 20 41 60 84 81 + + - $PROJ_DIR$\..\..\Source\c_motor.c + $PROJ_DIR$\..\..\Source\d_lowspeed.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\c_motor.r79 + 167 + + + BICOMP + 182 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_motor.iom - $PROJ_DIR$\..\..\Source\c_motor.h - $PROJ_DIR$\..\..\Source\d_motor.h + 231 83 201 55 52 66 + + + BICOMP + 231 83 201 55 52 66 - $PROJ_DIR$\..\..\Source\c_sensor.c + $PROJ_DIR$\..\..\Source\d_output.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\c_sensor.r79 + 148 + + + BICOMP + 129 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_sensor.iom - $PROJ_DIR$\..\..\Source\c_sensor.h - $PROJ_DIR$\..\..\Source\d_sensor.h + 231 83 201 55 49 2 + + + BICOMP + 231 83 201 55 49 2 - $PROJ_DIR$\..\..\Source\d_motor.c + $PROJ_DIR$\..\..\Source\d_sound.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\d_motor.r79 + 162 + + + BICOMP + 172 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s64.h - $PROJ_DIR$\..\..\Source\d_motor.h - $PROJ_DIR$\..\..\Source\d_motor.r + 231 83 201 55 25 17 101 + + + BICOMP + 231 83 201 55 25 17 101 - $PROJ_DIR$\..\..\Source\d_sensor.c + $PROJ_DIR$\..\..\Source\d_timer.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\d_sensor.r79 + 156 + + + BICOMP + 184 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\m_sched.h - $PROJ_DIR$\..\Include\sam7s256.h - $PROJ_DIR$\..\Include\ioat91sam7s64.h - $PROJ_DIR$\..\..\Source\d_sensor.h - $PROJ_DIR$\..\..\Source\d_sensor.r + 231 83 201 55 142 197 + + + BICOMP + 231 83 201 55 142 197 - $PROJ_DIR$\RAM_Debug\Exe\LMS_ARM.d79 + $PROJ_DIR$\..\..\Source\d_usb.c - XLINK - $PROJ_DIR$\RAM_Debug\List\LMS_ARM.map + ICCARM + 170 + + + BICOMP + 178 - XLINK - $PROJ_DIR$\at91SAM7S64_16KRAM.xcl - $PROJ_DIR$\RAM_Debug\Obj\Cstartup.r79 - $PROJ_DIR$\RAM_Debug\Obj\Cstartup_SAM7.r79 - $PROJ_DIR$\RAM_Debug\Obj\c_button.r79 - $PROJ_DIR$\RAM_Debug\Obj\c_cmd.r79 - $PROJ_DIR$\RAM_Debug\Obj\c_comm.r79 - $PROJ_DIR$\RAM_Debug\Obj\c_display.r79 - $PROJ_DIR$\RAM_Debug\Obj\c_ioctrl.r79 - $PROJ_DIR$\RAM_Debug\Obj\c_led.r79 - $PROJ_DIR$\RAM_Debug\Obj\c_loader.r79 - $PROJ_DIR$\RAM_Debug\Obj\c_lowspeed.r79 - $PROJ_DIR$\RAM_Debug\Obj\c_motor.r79 - $PROJ_DIR$\RAM_Debug\Obj\c_sensor.r79 - $PROJ_DIR$\RAM_Debug\Obj\c_sound.r79 - $PROJ_DIR$\RAM_Debug\Obj\d_bt.r79 - $PROJ_DIR$\RAM_Debug\Obj\d_button.r79 - $PROJ_DIR$\RAM_Debug\Obj\d_display.r79 - $PROJ_DIR$\RAM_Debug\Obj\d_hispeed.r79 - $PROJ_DIR$\RAM_Debug\Obj\d_ioctrl.r79 - $PROJ_DIR$\RAM_Debug\Obj\d_led.r79 - $PROJ_DIR$\RAM_Debug\Obj\d_lowspeed.r79 - $PROJ_DIR$\RAM_Debug\Obj\d_motor.r79 - $PROJ_DIR$\RAM_Debug\Obj\d_sensor.r79 - $PROJ_DIR$\RAM_Debug\Obj\d_sound.r79 - $PROJ_DIR$\RAM_Debug\Obj\d_timer.r79 - $PROJ_DIR$\RAM_Debug\Obj\d_usb.r79 - $PROJ_DIR$\RAM_Debug\Obj\m_sched.r79 - $TOOLKIT_DIR$\lib\dl4tptinl8n.r79 + ICCARM + 231 83 201 55 30 94 + + + BICOMP + 231 83 201 55 30 94 - $PROJ_DIR$\..\..\Source\c_comm.c + $PROJ_DIR$\..\..\Source\m_sched.c ICCARM - $PROJ_DIR$\RAM_Debug\Obj\c_comm.r79 + 195 + + + BICOMP + 187 ICCARM - $PROJ_DIR$\..\..\Source\stdconst.h - $PROJ_DIR$\..\..\Source\modules.h - $PROJ_DIR$\..\..\Source\c_comm.iom - $PROJ_DIR$\..\..\Source\c_comm.h - $PROJ_DIR$\..\..\Source\d_usb.h - $PROJ_DIR$\..\..\Source\d_hispeed.h - $PROJ_DIR$\..\..\Source\d_bt.h + 231 152 83 201 55 40 51 76 133 29 93 53 57 8 56 68 34 92 97 73 79 + + + BICOMP + 231 152 83 201 55 40 51 76 133 29 93 53 57 8 56 68 34 92 97 73 79 diff --git a/AT91SAM7S256/SAM7S256/Tools/LMS_ARM.ewd b/AT91SAM7S256/SAM7S256/Tools/LMS_ARM.ewd index edb35bb..51f3c07 100644 --- a/AT91SAM7S256/SAM7S256/Tools/LMS_ARM.ewd +++ b/AT91SAM7S256/SAM7S256/Tools/LMS_ARM.ewd @@ -12,7 +12,7 @@ C-SPY 2 - 12 + 13 1 1 - - - - - @@ -220,7 +200,7 @@ JLINK_ID 2 - 1 + 6 1 1 + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 0 + 1 + 1 + + + + + + @@ -273,7 +355,7 @@ MACRAIGOR_ID 2 - 1 + 2 1 1 + + + @@ -429,12 +523,16 @@ $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin 1 + + $EW_DIR$\common\plugins\Orti\Orti.ewplugin + 0 + $EW_DIR$\common\plugins\Profiling\Profiling.ewplugin 1 - $EW_DIR$\common\plugins\Trace\Trace.ewplugin + $EW_DIR$\common\plugins\Stack\Stack.ewplugin 1 @@ -445,10 +543,26 @@ $TOOLKIT_DIR$\plugins\rtos\CMX\CMXTinyArmPlugin.ewplugin 0 + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin 0 + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + @@ -461,7 +575,7 @@ C-SPY 2 - 12 + 13 1 1 - - - - - @@ -603,118 +697,783 @@ 1 + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ewplugin + 1 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + + + Bin Output + + ARM + + 1 + + C-SPY + 2 + + 13 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 0 + 1 + 1 + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + - - - - IARROM_ID - 2 - - 0 - 1 - 1 - JLINK_ID + LMIFTDI_ID 2 - 1 + 0 1 1 - - - @@ -722,7 +1481,7 @@ MACRAIGOR_ID 2 - 1 + 2 1 1 + + + @@ -878,12 +1649,16 @@ $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin 1 + + $EW_DIR$\common\plugins\Orti\Orti.ewplugin + 0 + $EW_DIR$\common\plugins\Profiling\Profiling.ewplugin 1 - $EW_DIR$\common\plugins\Trace\Trace.ewplugin + $EW_DIR$\common\plugins\Stack\Stack.ewplugin 1 @@ -894,25 +1669,41 @@ $TOOLKIT_DIR$\plugins\rtos\CMX\CMXTinyArmPlugin.ewplugin 0 + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin 0 + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + - Bin Output + Benchmark ARM - 1 + 0 C-SPY 2 - 12 + 13 1 - 1 + 0 - - - - - @@ -1029,7 +1800,7 @@ 0 1 - 1 + 0 diff --git a/AT91SAM7S256/SAM7S256/Tools/LMS_ARM.ewp b/AT91SAM7S256/SAM7S256/Tools/LMS_ARM.ewp index 9106c9f..c90d273 100644 --- a/AT91SAM7S256/SAM7S256/Tools/LMS_ARM.ewp +++ b/AT91SAM7S256/SAM7S256/Tools/LMS_ARM.ewp @@ -12,7 +12,7 @@ General 2 - 8 + 9 1 1 - + ICCARM 2 - 11 + 14 1 1 - - + + + + + + + AARM 2 - 5 + 7 1 1 - - - - - @@ -544,7 +543,7 @@ XLINK 2 - 17 + 18 1 1 + + @@ -830,7 +837,7 @@ General 2 - 8 + 9 1 1 - + ICCARM 2 - 11 + 14 1 1 - - + + + + + + + AARM 2 - 5 + 7 1 1 - - - - - @@ -1360,7 +1368,7 @@ XLINK 2 - 17 + 18 1 1 + + @@ -1646,7 +1662,7 @@ General 2 - 8 + 9 1 1 - + ICCARM 2 - 11 + 14 1 1 - - + + + + + + + AARM 2 - 5 + 7 1 1 - - - - - @@ -2176,7 +2193,7 @@ XLINK 2 - 17 + 18 1 1 + + @@ -2452,6 +2477,832 @@ + + Benchmark + + ARM + + 0 + + General + 2 + + 9 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 14 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 2 + + 18 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 2 + + 0 + 1 + 0 + + + + + + + BILINK + 0 + + + $PROJ_DIR$\..\..\Source\c_button.c diff --git a/AT91SAM7S256/SAM7S256/Tools/at91SAM7S256_Remap.xcl b/AT91SAM7S256/SAM7S256/Tools/at91SAM7S256_Remap.xcl index ebc4205..bca7a2a 100644 --- a/AT91SAM7S256/SAM7S256/Tools/at91SAM7S256_Remap.xcl +++ b/AT91SAM7S256/SAM7S256/Tools/at91SAM7S256_Remap.xcl @@ -88,6 +88,7 @@ // Code segments may be placed anywhere. //************************************************ -Z(CODE)CODE=ROMSTART-ROMEND +-Z(CODE)RAMCODE=RAMSTART-RAMEND //************************************************ // Various constants and initializers. @@ -125,6 +126,9 @@ -Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND -Z(DATA)IRQ_STACK+_IRQ_STACK_SIZE=RAMSTART-RAMEND +-D_HEAP_SIZE=1024 +-Z(DATA)HEAP+_HEAP_SIZE=RAMSTART-RAMEND + //************************************************************************* // ELF/DWARF support. // diff --git a/AT91SAM7S256/SAM7S256/Tools/settings/LMS_ARM.cspy.bat b/AT91SAM7S256/SAM7S256/Tools/settings/LMS_ARM.cspy.bat new file mode 100644 index 0000000..89906fa --- /dev/null +++ b/AT91SAM7S256/SAM7S256/Tools/settings/LMS_ARM.cspy.bat @@ -0,0 +1,32 @@ +@REM This bat file has been generated by the IAR Embeddded Workbench +@REM C-SPY interactive debugger,as an aid to preparing a command +@REM line for running the cspybat command line utility with the +@REM appropriate settings. +@REM +@REM After making some adjustments to this file, you can launch cspybat +@REM by typing the name of this file followed by the name of the debug +@REM file (usually an ubrof file). Note that this file is generated +@REM every time a new debug session is initialized, so you may want to +@REM move or rename the file before making changes. +@REM +@REM Note: some command line arguments cannot be properly generated +@REM by this process. Specifically, the plugin which is responsible +@REM for the Terminal I/O window (and other C runtime functionality) +@REM comes in a special version for cspybat, and the name of that +@REM plugin dll is not known when generating this file. It resides in +@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or +@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding +@REM tool chain. Replace the '' parameter +@REM below with the appropriate file name. Other plugins loaded by +@REM C-SPY are usually not needed by, or will not work in, cspybat +@REM but they are listed at the end of this file for reference. + + +"C:\Program Files\IAR Systems\Embedded Workbench 4.0 LEGO\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 4.0 LEGO\arm\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 4.0 LEGO\arm\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 4.0 LEGO\arm\bin\" --macro "C:\NXT\LMS NXT\AT91SAM7S256\SAM7S256\Tools\SAM7.mac" --backend -B "--endian" "little" "--cpu" "ARM7TDMI" "--fpu" "None" "--proc_device_desc_file" "C:\NXT\LMS NXT\AT91SAM7S256\SAM7S256\Tools\ioat91sam7s256.ddf" "--proc_driver" "jlink" "--jlink_connection" "USB:0" "--jlink_initial_speed" "32" + + +@REM Loaded plugins: +@REM armlibsupport.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0 LEGO\common\plugins\CodeCoverage\CodeCoverage.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0 LEGO\common\plugins\Profiling\Profiling.dll +@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0 LEGO\common\plugins\stack\stack.dll diff --git a/AT91SAM7S256/SAM7S256/Tools/settings/LMS_ARM.dbgdt b/AT91SAM7S256/SAM7S256/Tools/settings/LMS_ARM.dbgdt index 092fee7..b3ca4cc 100644 --- a/AT91SAM7S256/SAM7S256/Tools/settings/LMS_ARM.dbgdt +++ b/AT91SAM7S256/SAM7S256/Tools/settings/LMS_ARM.dbgdt @@ -8,7 +8,7 @@ - 152272727 + 217272727 @@ -17,12 +17,12 @@ 200100 300Build 3002291424360 - 10010010010045527127225100100200300010300 + 100100100100200RegisterDisassemblyQuickWatch127225100100200DisassemblyWatchQuickWatch300010300200Disassembly100117100100 - + TabID-16470-5520 @@ -30,24 +30,24 @@ Workspace - LMS_ARM + LMS_ARMLMS_ARM/c_cmd.c - 0TabID-17326-28629RegisterRegister0000TabID-9192-28577DisassemblyDisassemblyTabID-2396-28705WatchWatch11272251001001 + 0TabID-9457-21118Debug LogDebug-Log0TabID-10897-9476Quick WatchQuickWatchStatus0 - TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_timer.h0000TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\SAM7S256\include\lib_at91sam7s64.h02825642564TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_display.r00591591TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_display.c015677677TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_hispeed.h00594594TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_hispeed.r00591591TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_hispeed.c00618618TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_sound.c06515515TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_sound.h00596596TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_sound.r00587587TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_sound.c030665665TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_sound.h00493493TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_timer.r020615615TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_button.c00619619TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\SAM7S256\include\ioat91sam7s64.h0000TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\SAM7S256\include\sam7s256.c00584584TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_ioctrl.r06738213821TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\SAM7S256\Include\Cstartup_SAM7.c05133363336TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_output.iom02811751175TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\SAM7S256\Include\Cstartup.s790010171017TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_loader.r00700700TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_loader.c0731763176TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_timer.c017679679TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_lowspeed.c08115631563TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_loader.iom0000TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_loader.h0000TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\m_sched.h08811521152TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_comm.c07526092609TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_usb.c06802351723517TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_button.c05011521152TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_display.c04771051010510TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_ioctrl.c03410251025TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_ioctrl.c015782782TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\m_sched.c04411961196TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_cmd.c01117315743157434TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_output.c03210821082TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_loader.c033160216020100000010000001 + TextEditorC:\NXT\LMS NXT\AT91SAM7S256\Source\c_cmd.c0436012375312375300100000010000001 - iaridepm1debuggergui1-2-2624226-2-25548827225222656904624-2-2624245-2-2159140155273202312241210904624 + iaridepm.enu1debuggergui.enu1-2-2539308-2-27650406993223182630536-2-2539280-2-2200200143988233100203024630536-2-22511391-2-213932531002880294872172066294872 diff --git a/AT91SAM7S256/SAM7S256/Tools/settings/LMS_ARM.dni b/AT91SAM7S256/SAM7S256/Tools/settings/LMS_ARM.dni index 409b4b4..883e131 100644 --- a/AT91SAM7S256/SAM7S256/Tools/settings/LMS_ARM.dni +++ b/AT91SAM7S256/SAM7S256/Tools/settings/LMS_ARM.dni @@ -6,14 +6,29 @@ Watch1=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 [DisAssemblyWindow] NumStates=_ 1 State 1=_ 1 -[Log file] +[StackPlugin] +Enabled=1 +OverflowWarningsEnabled=1 +WarningThreshold=90 +SpWarningsEnabled=1 +WarnHow=0 +UseTrigger=1 +TriggerName=main +LimitSize=0 +ByteLimit=50 +[Profiling] +Enabled=0 +[TermIOLog] LoggingEnabled=_ 0 LogFile=_ "" -Category=_ 0 -[TermIOLog] +[Log file] LoggingEnabled=_ 0 LogFile=_ "" +Category=_ 0 [Disassemble mode] mode=0 [Breakpoints] Count=0 +[TraceHelper] +Enabled=0 +ShowSource=1 diff --git a/AT91SAM7S256/SAM7S256/Tools/settings/LMS_ARM.wsdt b/AT91SAM7S256/SAM7S256/Tools/settings/LMS_ARM.wsdt index 7183c3d..23abd75 100644 --- a/AT91SAM7S256/SAM7S256/Tools/settings/LMS_ARM.wsdt +++ b/AT91SAM7S256/SAM7S256/Tools/settings/LMS_ARM.wsdt @@ -3,7 +3,7 @@ - LMS_ARM/Flash Debug + LMS_ARM/Bin Output @@ -11,9 +11,9 @@ - 150272727 + 1563271307876 - 1891724461 + 300Find-in-FilesDebug-Log1862724461 @@ -22,33 +22,17 @@ 45527 - + 300Find-in-FilesBuild 1004142444 - 01044062754 + 010300BuildDebug-Log44062754 - - - - TabID-7290-5487 - Build - Build - - - - TabID-5721-5516 - Debug Log - Debug-Log - - - TabID-447-5816Find in FilesFind-in-Files - - 1 + TabID-32446-5425 @@ -56,24 +40,24 @@ Workspace - LMS_ARMLMS_ARM/c_led.c + LMS_ARMLMS_ARM/c_led.cLMS_ARM/d_input.c - 0 + 0TabID-25637-22042BuildBuildTabID-24384-30343Find in FilesFind-in-FilesTabID-7323-21632Debug LogDebug-Log0 - TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_timer.h0000TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\SAM7S256\include\lib_at91sam7s64.h02825642564TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_display.r00591591TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_display.c015677677TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_hispeed.h00594594TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_hispeed.r00591591TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_hispeed.c00618618TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_sound.c06515515TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_sound.h00596596TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_sound.r00587587TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_sound.c030665665TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_sound.h00493493TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_timer.r020615615TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_button.c00619619TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\SAM7S256\include\ioat91sam7s64.h0000TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\SAM7S256\include\sam7s256.c00584584TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_ioctrl.r06738213821TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\SAM7S256\Include\Cstartup_SAM7.c05133363336TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_output.iom02811751175TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\SAM7S256\Include\Cstartup.s790010171017TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_loader.r00700700TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_loader.c0731763176TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_timer.c017679679TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_lowspeed.c08115631563TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_loader.iom0000TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_loader.h0000TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\m_sched.h08811521152TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_comm.c07526092609TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_usb.c06802351723517TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_button.c05011521152TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_display.c04771051010510TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_ioctrl.c03410251025TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\d_ioctrl.c015782782TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\m_sched.c04411961196TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_cmd.c01117315743157434TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_output.c03210821082TextEditorC:\Projects\LMS2006\Sys01\Main\Firmware\Source\c_loader.c033160216020100000010000001 + TextEditorC:\NXT\LMS NXT\AT91SAM7S256\Source\c_cmd.c0262378175781750TextEditorC:\NXT\LMS NXT\AT91SAM7S256\Source\c_cmd.iom02515251525TextEditorC:\NXT\LMS NXT 105\AT91SAM7S256\Source\c_cmd.iom07638353835TextEditorC:\NXT\LMS NXT 128\AT91SAM7S256\Source\c_cmd.iom09241924192TextEditorC:\NXT\LMS NXT\AT91SAM7S256\Source\c_input.c04982002420024TextEditorC:\NXT\LMS NXT\AT91SAM7S256\Source\d_input.c024761761TextEditorC:\NXT\LMS NXT\AT91SAM7S256\Source\d_input.r04127812789TextEditorC:\NXT\LMS NXT\AT91SAM7S256\Source\c_input.iom012025692569TextEditorC:\NXT\LMS NXT\AT91SAM7S256\Source\c_input.h00567567TextEditorC:\NXT\LMS NXT\AT91SAM7S256\Source\c_comm.c03651125011250TextEditorC:\NXT\LMS NXT\AT91SAM7S256\Source\c_cmd.h051115367153670100000010000001 - iaridepm1-2-2526241-2-20000237304763005-2-21221026-2-21028124100390617919000 + iaridepm.enu1-2-2546223-2-20000169683743555-2-21471328-2-21330149100301720217100 diff --git a/AT91SAM7S256/Source/BtTest.inc b/AT91SAM7S256/Source/BtTest.inc index 31d9373..ff0de90 100644 --- a/AT91SAM7S256/Source/BtTest.inc +++ b/AT91SAM7S256/Source/BtTest.inc @@ -4,6 +4,7 @@ #include "Test2.txt" //#define TESTPRG // If defined the test program will be included + extern void BtIo(void); const char BUILD_DATE[] = __DATE__; @@ -19,11 +20,11 @@ void GetProtocolVersion(UBYTE *String) if (Tmp < 100) { - sprintf((char*)String,"FW %3u.%02u",(FIRMWAREVERSION >> 8) & 0x00FF,Tmp & 0x00FF); + sprintf((char*)String,"FW NBC/NXC %2u.%02u",(FIRMWAREVERSION >> 8) & 0x00FF,Tmp & 0x00FF); } else { - sprintf((char*)String,"FW Hex %2X.%02X",(FIRMWAREVERSION >> 8) & 0x00FF,Tmp & 0x00FF); + sprintf((char*)String,"FW NBC/NXC %2X.%02X",(FIRMWAREVERSION >> 8) & 0x00FF,Tmp & 0x00FF); } } @@ -96,6 +97,7 @@ enum TSTPRG { SYSTEM_INIT = 1, SYSTEM_UNLOCK_INIT, +#ifdef TESTPRG SYSTEM_UNLOCK, SYSTEM_PAGE, TIMER_INIT, @@ -143,9 +145,9 @@ enum TSTPRG TSTPRG_MOTOR_INIT, TSTPRG_MOTOR, TSTPRG_SKIP_MOTOR, - - TSTPRG_SKIP, - TSTPRG_WAIT +#endif + TSTPRG_SKIP//, +// TSTPRG_WAIT }; const UBYTE TXT_EMPTY[] = " "; diff --git a/AT91SAM7S256/Source/Functions.inl b/AT91SAM7S256/Source/Functions.inl index 4211137..d12ebc0 100644 --- a/AT91SAM7S256/Source/Functions.inl +++ b/AT91SAM7S256/Source/Functions.inl @@ -322,11 +322,11 @@ void cUiUpdateSensor(SWORD Time) { if (Sensor == MENU_SENSOR_IIC_TEMP_F) { - VarsUi.DatalogSampleValue[Port - MENU_PORT_1] = (SLONG)((float)(Tmp + 4544) / 14.2); + VarsUi.DatalogSampleValue[Port - MENU_PORT_1] = (SLONG)((float)(Tmp + 4544) / (float)14.2); } else { - VarsUi.DatalogSampleValue[Port - MENU_PORT_1] = (SLONG)((float)Tmp / 25.6); + VarsUi.DatalogSampleValue[Port - MENU_PORT_1] = (SLONG)((float)Tmp / (float)25.6); } VarsUi.DatalogSampleValid[Port - MENU_PORT_1] = TRUE; } @@ -1319,7 +1319,7 @@ UBYTE cUiGetUserString(UBYTE Type) // 0=Pincode, 1=filename Tmp2 = 0; } } - pMapDisplay->pFunc(DISPLAY_HORISONTAL_LINE,TRUE,42,47,57,0); + pMapDisplay->pFunc(DISPLAY_HORIZONTAL_LINE,TRUE,42,47,57,0); pMapDisplay->pFunc(DISPLAY_VERTICAL_LINE,TRUE,42,47,0,63); pMapDisplay->pFunc(DISPLAY_VERTICAL_LINE,TRUE,57,47,0,63); @@ -1482,7 +1482,7 @@ UBYTE cUiDataLogging(UBYTE Action) case MENU_INIT : // Initialize all ports to empty { // Show select - pMapDisplay->pTextLines[TEXTLINE_3] = cUiGetString(TXT_VIEW_SELECT); + pMapDisplay->pTextLines[TEXTLINE_3] = cUiGetString(TXT_GENERIC_SELECT); pMapDisplay->TextLinesCenterFlags |= TEXTLINE_BIT(TEXTLINE_3); pMapDisplay->UpdateMask |= TEXTLINE_BIT(TEXTLINE_3); pMapDisplay->EraseMask |= SCREEN_BIT(SCREEN_SMALL); @@ -1498,7 +1498,7 @@ UBYTE cUiDataLogging(UBYTE Action) case MENU_EXIT : // Initialize all ports to empty { // Show select - pMapDisplay->pTextLines[TEXTLINE_3] = cUiGetString(TXT_VIEW_SELECT); + pMapDisplay->pTextLines[TEXTLINE_3] = cUiGetString(TXT_GENERIC_SELECT); pMapDisplay->TextLinesCenterFlags |= TEXTLINE_BIT(TEXTLINE_3); pMapDisplay->UpdateMask |= TEXTLINE_BIT(TEXTLINE_3); pMapDisplay->EraseMask |= SCREEN_BIT(SCREEN_SMALL); @@ -1891,7 +1891,7 @@ UBYTE cUiDataLogging(UBYTE Action) case 2 : // Display saved text { - if (!cUiFeedback((BMPMAP*)Info,TXT_FB_DL_FILE_SAVED_INFO,0xFF,DISPLAY_SHOW_FILENAME_TIME)) + if (!cUiFeedback((BMPMAP*)Info,TXT_FB_FILE_SAVED_INFO,0xFF,DISPLAY_SHOW_FILENAME_TIME)) { VarsUi.State++; } @@ -1953,7 +1953,7 @@ UBYTE cUiDataLogging(UBYTE Action) case MENU_SELECT : // Save sensor { - pMapDisplay->pTextLines[TEXTLINE_3] = cUiGetString(TXT_VIEW_SELECT); + pMapDisplay->pTextLines[TEXTLINE_3] = cUiGetString(TXT_GENERIC_SELECT); pMapDisplay->TextLinesCenterFlags |= TEXTLINE_BIT(TEXTLINE_3); pMapDisplay->UpdateMask |= TEXTLINE_BIT(TEXTLINE_3); @@ -2268,7 +2268,7 @@ UBYTE cUiOnBrickProgramming(UBYTE Action) // On brick programming case 2 : { - if (!cUiFeedback((BMPMAP*)Fail,TXT_FB_OBP_FILE_EXIST_FAIL,TXT_FB_OBP_OVERWRITE_FAIL,0)) + if (!cUiFeedback((BMPMAP*)Fail,TXT_FB_FILE_EXIST_FAIL,TXT_FB_OVERWRITE_FAIL,0)) { VarsUi.State = 0; } @@ -2287,7 +2287,7 @@ UBYTE cUiOnBrickProgramming(UBYTE Action) // On brick programming case 4 : // Display saved text { - if (!cUiFeedback((BMPMAP*)Info,TXT_FB_OBP_FILE_SAVED_INFO,0,DISPLAY_SHOW_TIME)) + if (!cUiFeedback((BMPMAP*)Info,TXT_FB_FILE_SAVED_INFO,0,DISPLAY_SHOW_TIME)) { VarsUi.State++; } @@ -2330,7 +2330,7 @@ UBYTE cUiOnBrickProgramming(UBYTE Action) // On brick programming default : // Display saved text { - if (!cUiFeedback((BMPMAP*)Info,TXT_FB_OBP_FILE_SAVED_INFO,0,DISPLAY_SHOW_TIME)) + if (!cUiFeedback((BMPMAP*)Info,TXT_FB_FILE_SAVED_INFO,0,DISPLAY_SHOW_TIME)) { VarsUi.State = 0; } @@ -2667,7 +2667,8 @@ UBYTE cUiFileRun(UBYTE Action) // Run selected file default : { - pMapDisplay->pTextLines[FILERUN_TEXTLINE] = cUiGetString(TXT_FILERUN_FILE_ERROR); + sprintf((char*)VarsUi.DisplayText,(char*)cUiGetString(TXT_FILERUN_FILE_ERROR), pMapCmd->ProgStatus); + pMapDisplay->pTextLines[FILERUN_TEXTLINE] = VarsUi.DisplayText; VarsUi.State = 99; } break; @@ -2840,7 +2841,7 @@ UBYTE cUiView(UBYTE Action) // MENU_INIT { case MENU_INIT : // Init { - pMapDisplay->pTextLines[TEXTLINE_3] = cUiGetString(TXT_VIEW_SELECT); + pMapDisplay->pTextLines[TEXTLINE_3] = cUiGetString(TXT_GENERIC_SELECT); pMapDisplay->TextLinesCenterFlags |= TEXTLINE_BIT(TEXTLINE_3); pMapDisplay->UpdateMask |= TEXTLINE_BIT(TEXTLINE_3); pMapDisplay->EraseMask |= SCREEN_BIT(SCREEN_SMALL); @@ -2897,7 +2898,7 @@ UBYTE cUiView(UBYTE Action) // MENU_INIT VarsUi.Tmp = cUiReadButtons(); if (VarsUi.Tmp == BUTTON_EXIT) { - pMapDisplay->pTextLines[TEXTLINE_3] = cUiGetString(TXT_VIEW_SELECT); + pMapDisplay->pTextLines[TEXTLINE_3] = cUiGetString(TXT_GENERIC_SELECT); pMapDisplay->TextLinesCenterFlags |= TEXTLINE_BIT(TEXTLINE_3); pMapDisplay->UpdateMask |= TEXTLINE_BIT(TEXTLINE_3); pMapDisplay->UpdateMask &= ~TEXTLINE_BIT(TEXTLINE_4); @@ -2980,7 +2981,7 @@ UBYTE cUiBtOn(UBYTE Action) default : // Display fail text { - if (!cUiFeedback((BMPMAP*)Fail,TXT_FB_BT_TURNING_ON_FAIL,0,DISPLAY_SHOW_ERROR_TIME)) + if (!cUiFeedback((BMPMAP*)Fail,TXT_FB_GENERIC_FAIL,0,DISPLAY_SHOW_ERROR_TIME)) { Action = MENU_EXIT; } @@ -3038,7 +3039,7 @@ UBYTE cUiBtOn(UBYTE Action) default : // Display fail text { - if (!cUiFeedback((BMPMAP*)Fail,TXT_FB_BT_TURNING_OFF_FAIL,0,DISPLAY_SHOW_ERROR_TIME)) + if (!cUiFeedback((BMPMAP*)Fail,TXT_FB_GENERIC_FAIL,0,DISPLAY_SHOW_ERROR_TIME)) { Action = MENU_EXIT; } @@ -3277,7 +3278,7 @@ UBYTE cUiBtSearch(UBYTE Action) // Search for devices default : // Display fail text { - if (!cUiFeedback((BMPMAP*)Fail,TXT_FB_BT_SEARCHING_FAIL,0,DISPLAY_SHOW_ERROR_TIME)) + if (!cUiFeedback((BMPMAP*)Fail,TXT_FB_GENERIC_FAIL,0,DISPLAY_SHOW_ERROR_TIME)) { VarsUi.State = 0; IOMapUi.State = EXIT_PRESSED; @@ -3306,7 +3307,7 @@ UBYTE cUiBtDeviceList(UBYTE Action) // Show devices cUiBTCommand(UI_BT_GET_DEVICES,VarsUi.DevicesKnown,&VarsUi.Devices,NULL); if (VarsUi.Devices) { - pMapDisplay->pTextLines[TEXTLINE_3] = cUiGetString(TXT_BTDEVICELIST_SELECT); + pMapDisplay->pTextLines[TEXTLINE_3] = cUiGetString(TXT_GENERIC_SELECT); pMapDisplay->TextLinesCenterFlags |= TEXTLINE_BIT(TEXTLINE_3); pMapDisplay->UpdateMask |= TEXTLINE_BIT(TEXTLINE_3); VarsUi.MenuIconTextSave = pMapDisplay->pMenuText; @@ -3328,7 +3329,7 @@ UBYTE cUiBtDeviceList(UBYTE Action) // Show devices cUiBTCommand(UI_BT_GET_DEVICES,VarsUi.DevicesKnown,&VarsUi.Devices,NULL); if (VarsUi.Devices) { - pMapDisplay->pTextLines[TEXTLINE_3] = cUiGetString(TXT_BTDEVICELIST_SELECT); + pMapDisplay->pTextLines[TEXTLINE_3] = cUiGetString(TXT_GENERIC_SELECT); pMapDisplay->TextLinesCenterFlags |= TEXTLINE_BIT(TEXTLINE_3); pMapDisplay->UpdateMask |= TEXTLINE_BIT(TEXTLINE_3); VarsUi.MenuIconTextSave = pMapDisplay->pMenuText; @@ -3420,7 +3421,7 @@ UBYTE cUiBtDeviceList(UBYTE Action) // Show devices default : // Display fail text { - if (!cUiFeedback((BMPMAP*)Fail,TXT_FB_BT_REMOVE_FAIL,0,DISPLAY_SHOW_ERROR_TIME)) + if (!cUiFeedback((BMPMAP*)Fail,TXT_FB_GENERIC_FAIL,0,DISPLAY_SHOW_ERROR_TIME)) { Action = MENU_EXIT; } @@ -3562,7 +3563,7 @@ UBYTE cUiBtConnectList(UBYTE Action) // Show connections and maybe disconnec default : // Display fail text { - if (!cUiFeedback((BMPMAP*)Fail,TXT_FB_BT_DISCONNECT_FAIL,0,DISPLAY_SHOW_ERROR_TIME)) + if (!cUiFeedback((BMPMAP*)Fail,TXT_FB_GENERIC_FAIL,0,DISPLAY_SHOW_ERROR_TIME)) { Action = MENU_EXIT; } @@ -3793,7 +3794,7 @@ UBYTE cUiBtConnect(UBYTE Action) // Select connection no and insert device default : // Display fail text { - if (!cUiFeedback((BMPMAP*)Fail,TXT_FB_BT_CONNECTING_FAIL,0,DISPLAY_SHOW_ERROR_TIME)) + if (!cUiFeedback((BMPMAP*)Fail,TXT_FB_GENERIC_FAIL,0,DISPLAY_SHOW_ERROR_TIME)) { Action = MENU_EXIT; } @@ -3870,7 +3871,7 @@ UBYTE cUiBtConnect(UBYTE Action) // Select connection no and insert device case 4 : // Display fail text { - if (!cUiFeedback((BMPMAP*)Fail,TXT_FB_BT_SENDING_FAIL,0,DISPLAY_SHOW_ERROR_TIME)) + if (!cUiFeedback((BMPMAP*)Fail,TXT_FB_GENERIC_FAIL,0,DISPLAY_SHOW_ERROR_TIME)) { Action = MENU_EXIT; } diff --git a/AT91SAM7S256/Source/Ui.txt b/AT91SAM7S256/Source/Ui.txt index 6db746e..1a29c67 100644 --- a/AT91SAM7S256/Source/Ui.txt +++ b/AT91SAM7S256/Source/Ui.txt @@ -3,38 +3,29 @@ const TXT Ui[] = 0x05,0x00, // Text Format 0x04,0x0D, // Text DataSize 0x01, // ItemsX - 0x3D, // ItemsY + 0x32, // ItemsY 0x11, // ItemCharsX 0x01, // ItemCharsY + 'F','a','i','l','e','d','!', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 'C','o','n','n','e','c','t','i','n','g', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 'L','i','n','e',' ','i','s',' ','b','u','s','y', 0 , 0 , 0 , 0 , 0 , - 'F','a','i','l','e','d','!', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 'C','o','n','n','e','c','t','i','o','n','?', 0 , 0 , 0 , 0 , 0 , 0 , 'S','e','n','d','i','n','g',' ','f','i','l','e', 0 , 0 , 0 , 0 , 0 , - 'F','a','i','l','e','d','!', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 'T','u','r','n','i','n','g',' ','o','n', 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 'F','a','i','l','e','d','!', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 'T','u','r','n','i','n','g',' ','o','f','f', 0 , 0 , 0 , 0 , 0 , 0 , - 'F','a','i','l','e','d','!', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 'S','e','a','r','c','h','i','n','g', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 'A','b','o','r','t','e','d','!', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 'F','a','i','l','e','d','!', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 'F','a','i','l','e','d','!', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 'F','a','i','l','e','d','!', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 'M','e','m','o','r','y',' ','f','u','l','l','!', 0 , 0 , 0 , 0 , 0 , 'F','i','l','e',' ','s','a','v','e','d', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 'F','i','l','e',' ','e','x','i','s','t','s', 0 , 0 , 0 , 0 , 0 , 0 , 'o','v','e','r','w','r','i','t','e','!', 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 'S','a','v','e','d',' ','a','s', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 'F','i','l','e',' ','e','x','i','s','t', 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 'o','v','e','r','w','r','i','t','e','!', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 'F','i','l','e',' ','d','e','l','e','t','e','d', 0 , 0 , 0 , 0 , 0 , 'F','i','l','e','s', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 'd','e','l','e','t','e','d', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 'R','u','n','n','i','n','g', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 'A','b','o','r','t','e','d','!', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 'D','o','n','e', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 'F','i','l','e',' ','e','r','r','o','r','!', 0 , 0 , 0 , 0 , 0 , 0 , + 'F','i','l','e',' ','e','r','r','o','r','!',' ','%','d', 0 , 0 , 0 , 'D','e','l','e','t','i','n','g',' ','a','l','l', 0 , 0 , 0 , 0 , 0 , '%','s',' ','f','i','l','e','s','!', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 'P','r','e','s','s',' ','C','l','e','a','r',' ','t','o', 0 , 0 , 0 , @@ -56,8 +47,6 @@ const TXT Ui[] = '4',' ','-',' ','U','l','t','r','a','s','o','n','i','c',' ',' ', 0 , 'B','/','C',' ','-',' ','L','/','R',' ','m','o','t','o','r','s', 0 , 'S','e','l','e','c','t', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 'S','e','l','e','c','t', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 'S','e','l','e','c','t', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 'B','T',' ','s','a','v','e',' ','d','a','t','a', 0 , 0 , 0 , 0 , 0 , 'e','r','r','o','r','!', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 'B','T',' ','s','t','o','r','e',' ','i','s', 0 , 0 , 0 , 0 , 0 , 0 , diff --git a/AT91SAM7S256/Source/c_cmd.c b/AT91SAM7S256/Source/c_cmd.c index 4ce9829..9253735 100644 --- a/AT91SAM7S256/Source/c_cmd.c +++ b/AT91SAM7S256/Source/c_cmd.c @@ -1,11 +1,11 @@ // // Date init 14.12.2004 // -// Revision date $Date: 24-06-09 8:53 $ +// Revision date $Date: 17-02-09 7:30 $ // // Filename $Workfile:: c_cmd.c $ // -// Version $Revision: 14 $ +// Version $Revision: 13 $ // // Archive $Archive:: /LMS2006/Sys01/Main_V02/Firmware/Source/c_cmd. $ // @@ -43,13 +43,13 @@ #include #include #include // for sqrt, abs, and trig stuff +#include #define VMProfilingCode 0 static IOMAPCMD IOMapCmd; static VARSCMD VarsCmd; static HEADER **pHeaders; -static ULONG gInstrsToExecute; static SLONG gPCDelta; #define NUM_INTERP_FUNCS 16 #define NUM_SHORT_INTERP_FUNCS 8 @@ -192,7 +192,7 @@ static pSysCall SysCallFuncs[SYSCALL_COUNT] = cCmdWrapKeepAlive, cCmdWrapIOMapRead, cCmdWrapIOMapWrite, - cCmdWrapColorSensorRead, + cCmdWrapColorSensorRead, // new in 2.0 cCmdWrapCommBTOnOff, // 35 cCmdWrapCommBTConnection, cCmdWrapCommHSWrite, @@ -205,8 +205,61 @@ static pSysCall SysCallFuncs[SYSCALL_COUNT] = cCmdWrapDatalogWrite, cCmdWrapDatalogGetTimes, //45 cCmdWrapSetSleepTimeout, - cCmdWrapListFiles //47 - + cCmdWrapListFiles, //47 + cCmdWrapUndefinedSysCall, // leave a gap so that I don't have to keep renumbering system calls + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, // 50 + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, // 55 + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, // 60 + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, // 65 + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, // 70 + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, // 75 + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, +// enhanced NBC/NXC + cCmdWrapIOMapReadByID, // 78 + cCmdWrapIOMapWriteByID, + cCmdWrapDisplayExecuteFunction, // 80 + cCmdWrapCommExecuteFunction, + cCmdWrapLoaderExecuteFunction, + cCmdWrapFileFindFirst, + cCmdWrapFileFindNext, + cCmdWrapFileOpenWriteLinear, // 85 + cCmdWrapFileOpenWriteNonLinear, + cCmdWrapFileOpenReadLinear, + cCmdWrapCommHSControl, + cCmdWrapCommLSWriteEx, + cCmdWrapFileSeek, // 90 + cCmdWrapFileResize, + cCmdWrapDrawPictureArray, + cCmdWrapDrawPolygon, + cCmdWrapDrawEllipse, + cCmdWrapDrawFont, // 95 + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall, + cCmdWrapUndefinedSysCall // 99 --> 100 system call slots + // don't forget to update SYSCALL_COUNT in c_cmd.h }; @@ -266,6 +319,7 @@ TYPE_CODE IO_TYPES_OUT[IO_OUT_FIELD_COUNT] = TC_UBYTE, //IO_OUT_REG_D_VAL TC_SLONG, //IO_OUT_BLOCK_TACH_COUNT TC_SLONG, //IO_OUT_ROTATION_COUNT + TC_UBYTE, //IO_OUT_OPTIONS //IO_OUT1 TC_UBYTE, //IO_OUT_FLAGS @@ -283,6 +337,7 @@ TYPE_CODE IO_TYPES_OUT[IO_OUT_FIELD_COUNT] = TC_UBYTE, //IO_OUT_REG_D_VAL TC_SLONG, //IO_OUT_BLOCK_TACH_COUNT TC_SLONG, //IO_OUT_ROTATION_COUNT + TC_UBYTE, //IO_OUT_OPTIONS //IO_OUT2 TC_UBYTE, //IO_OUT_FLAGS @@ -300,6 +355,7 @@ TYPE_CODE IO_TYPES_OUT[IO_OUT_FIELD_COUNT] = TC_UBYTE, //IO_OUT_REG_D_VAL TC_SLONG, //IO_OUT_BLOCK_TACH_COUNT TC_SLONG, //IO_OUT_ROTATION_COUNT + TC_UBYTE, //IO_OUT_OPTIONS }; @@ -461,32 +517,64 @@ UWORD cCmdHandleRemoteCommands(UBYTE * pInBuf, UBYTE * pOutBuf, UBYTE * pLen) case RC_SET_OUT_STATE: { + UBYTE Port = pInBuf[1]; //Don't do anything if illegal port specification is made - if (pInBuf[1] >= NO_OF_OUTPUTS && pInBuf[1] != 0xFF) + // supported ports are 0, 1, 2 == A, B, C + // 3 == AB, 4 == AC, 5 == BC, 6 == ABC + if (Port > RC_OUT_ABC && Port < RC_PORTS_AB) { RCStatus = ERR_RC_ILLEGAL_VAL; break; } //0xFF is protocol defined to mean "all ports". - if (pInBuf[1] == 0xFF) - { - FirstPort = 0; - LastPort = NO_OF_OUTPUTS - 1; + switch(Port) { + case RC_PORTS_ALL: + case RC_OUT_ABC: + case RC_PORTS_AC: + case RC_OUT_AC: + { + FirstPort = 0; + LastPort = NO_OF_OUTPUTS - 1; + } + break; + case RC_PORTS_BC: + case RC_OUT_BC: + { + // B&C + FirstPort = 1; + LastPort = NO_OF_OUTPUTS - 1; + } + break; + case RC_PORTS_AB: + case RC_OUT_AB: + { + // A&B + FirstPort = 0; + LastPort = 1; + } + break; + default: + { + FirstPort = LastPort = Port; + } + break; } - else - FirstPort = LastPort = pInBuf[1]; for (i = FirstPort; i <= LastPort; i++) { - pMapOutPut->Outputs[i].Speed = pInBuf[2]; - pMapOutPut->Outputs[i].Mode = pInBuf[3]; - pMapOutPut->Outputs[i].RegMode = pInBuf[4]; - pMapOutPut->Outputs[i].SyncTurnParameter = pInBuf[5]; - pMapOutPut->Outputs[i].RunState = pInBuf[6]; - memcpy((PSZ)(&(pMapOutPut->Outputs[i].TachoLimit)), (PSZ)(&pInBuf[7]), 4); - - pMapOutPut->Outputs[i].Flags |= UPDATE_MODE | UPDATE_SPEED | UPDATE_TACHO_LIMIT; + if (((Port == RC_PORTS_AC) || (Port == RC_OUT_AC)) && (i > FirstPort) && (i < LastPort)) + continue; + OUTPUT * pOut = &(pMapOutPut->Outputs[i]); + pOut->Speed = pInBuf[2]; + pOut->Mode = pInBuf[3]; + pOut->RegMode = pInBuf[4]; + pOut->SyncTurnParameter = pInBuf[5]; + pOut->RunState = pInBuf[6]; + pOut->Options = pOut->Mode & REG_METHOD; + memcpy((PSZ)(&(pOut->TachoLimit)), (PSZ)(&pInBuf[7]), 4); + + pOut->Flags |= UPDATE_MODE | UPDATE_SPEED | UPDATE_TACHO_LIMIT; } } break; @@ -502,12 +590,12 @@ UWORD cCmdHandleRemoteCommands(UBYTE * pInBuf, UBYTE * pOutBuf, UBYTE * pLen) RCStatus = ERR_RC_ILLEGAL_VAL; break; } + INPUTSTRUCT * pIn = &(pMapInput->Inputs[i]); - pMapInput->Inputs[i].SensorType = pInBuf[2]; - pMapInput->Inputs[i].SensorMode = pInBuf[3]; - + pIn->SensorType = pInBuf[2]; + pIn->SensorMode = pInBuf[3]; //Set InvalidData flag automatically since type may have changed - pMapInput->Inputs[i].InvalidData = TRUE; + pIn->InvalidData = TRUE; } break; @@ -525,45 +613,46 @@ UWORD cCmdHandleRemoteCommands(UBYTE * pInBuf, UBYTE * pOutBuf, UBYTE * pLen) ResponseLen += 22; break; } + OUTPUT * pOut = &(pMapOutPut->Outputs[i]); //Echo port pOutBuf[ResponseLen] = i; ResponseLen++; //Power - pOutBuf[ResponseLen] = pMapOutPut->Outputs[i].Speed; + pOutBuf[ResponseLen] = pOut->Speed; ResponseLen++; //Mode - pOutBuf[ResponseLen] = pMapOutPut->Outputs[i].Mode; + pOutBuf[ResponseLen] = pOut->Mode; ResponseLen++; //RegMode - pOutBuf[ResponseLen] = pMapOutPut->Outputs[i].RegMode; + pOutBuf[ResponseLen] = pOut->RegMode; ResponseLen++; //TurnRatio - pOutBuf[ResponseLen] = pMapOutPut->Outputs[i].SyncTurnParameter; + pOutBuf[ResponseLen] = pOut->SyncTurnParameter; ResponseLen++; //RunState - pOutBuf[ResponseLen] = pMapOutPut->Outputs[i].RunState; + pOutBuf[ResponseLen] = pOut->RunState; ResponseLen++; //TachoLimit ULONG - memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)(&(pMapOutPut->Outputs[i].TachoLimit)), 4); + memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)(&(pOut->TachoLimit)), 4); ResponseLen += 4; //TachoCount SLONG - memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)(&(pMapOutPut->Outputs[i].TachoCnt)), 4); + memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)(&(pOut->TachoCnt)), 4); ResponseLen += 4; //BlockTachoCount SLONG - memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)(&(pMapOutPut->Outputs[i].BlockTachoCount)), 4); + memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)(&(pOut->BlockTachoCount)), 4); ResponseLen += 4; //RotationCount SLONG - memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)(&(pMapOutPut->Outputs[i].RotationCount)), 4); + memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)(&(pOut->RotationCount)), 4); ResponseLen += 4; NXT_ASSERT(ResponseLen == 23); @@ -589,9 +678,11 @@ UWORD cCmdHandleRemoteCommands(UBYTE * pInBuf, UBYTE * pOutBuf, UBYTE * pLen) //Echo port pOutBuf[ResponseLen] = i; ResponseLen++; + + INPUTSTRUCT * pIn = &(pMapInput->Inputs[i]); //Set "Valid?" boolean - if (pMapInput->Inputs[i].InvalidData) + if (pIn->InvalidData) pOutBuf[ResponseLen] = FALSE; else pOutBuf[ResponseLen] = TRUE; @@ -603,24 +694,24 @@ UWORD cCmdHandleRemoteCommands(UBYTE * pInBuf, UBYTE * pOutBuf, UBYTE * pLen) pOutBuf[ResponseLen] = FALSE; ResponseLen++; - pOutBuf[ResponseLen] = pMapInput->Inputs[i].SensorType; + pOutBuf[ResponseLen] = pIn->SensorType; ResponseLen++; - pOutBuf[ResponseLen] = pMapInput->Inputs[i].SensorMode; + pOutBuf[ResponseLen] = pIn->SensorMode; ResponseLen++; //Set Raw, Normalized, and Scaled values - memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)(&(pMapInput->Inputs[i].ADRaw)), 2); + memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)(&(pIn->ADRaw)), 2); ResponseLen += 2; - memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)(&(pMapInput->Inputs[i].SensorRaw)), 2); + memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)(&(pIn->SensorRaw)), 2); ResponseLen += 2; - memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)(&(pMapInput->Inputs[i].SensorValue)), 2); + memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)(&(pIn->SensorValue)), 2); ResponseLen += 2; //!!! Return normalized raw value in place of calibrated value for now -- see comment above - memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)(&(pMapInput->Inputs[i].SensorRaw)), 2); + memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)(&(pIn->SensorRaw)), 2); ResponseLen += 2; NXT_ASSERT(ResponseLen == 14); @@ -683,14 +774,7 @@ UWORD cCmdHandleRemoteCommands(UBYTE * pInBuf, UBYTE * pOutBuf, UBYTE * pLen) //pInBuf[2] is a selector //FALSE: Position relative to start of last program //TRUE: Position relative to start of last motor control block - if (pInBuf[2] == FALSE) - { - pMapOutPut->Outputs[i].Flags |= UPDATE_RESET_ROTATION_COUNT; - } - else - { - pMapOutPut->Outputs[i].Flags |= UPDATE_RESET_BLOCK_COUNT; - } + pMapOutPut->Outputs[i].Flags |= (pInBuf[2] ? UPDATE_RESET_BLOCK_COUNT : UPDATE_RESET_ROTATION_COUNT); } break; @@ -759,7 +843,7 @@ UWORD cCmdHandleRemoteCommands(UBYTE * pInBuf, UBYTE * pOutBuf, UBYTE * pLen) break; } - RCStatus = cCmdLSWrite(i, Count, &(pInBuf[4]), pInBuf[3]); + RCStatus = cCmdLSWrite(i, Count, &(pInBuf[4]), pInBuf[3], 0); } break; @@ -958,6 +1042,14 @@ UWORD cCmdHandleRemoteCommands(UBYTE * pInBuf, UBYTE * pOutBuf, UBYTE * pLen) pMapUi->SleepTimeout= value / 60000; } break; + case RC_PROP_DEBUGGING: { // ulong debug info + ULONG value; + memcpy((PSZ)&value, (PSZ)&(pInBuf[2]), 4); + VarsCmd.Debugging = (UBYTE)((value>>24)&0xFF); + VarsCmd.PauseClump = (UBYTE)((value>>16)&0xFF); + VarsCmd.PausePC = (CODE_INDEX)(value&0xFFFF); + } + break; default: //Unknown property -- still inform client to not expect any response bytes NXT_BREAK; @@ -979,7 +1071,14 @@ UWORD cCmdHandleRemoteCommands(UBYTE * pInBuf, UBYTE * pOutBuf, UBYTE * pLen) } break; case RC_PROP_SLEEP_TIMEOUT: { - ULONG value= (pMapUi->SleepTimeout * 60 * 1000); + ULONG value= (pMapUi->SleepTimeout * 60000); + memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)&value, 4); + ResponseLen += 4; + } + break; + case RC_PROP_DEBUGGING: { // ulong debug info + ULONG value; + value = ((VarsCmd.Debugging<<24)|(VarsCmd.PauseClump<<16)|VarsCmd.PausePC); memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)&value, 4); ResponseLen += 4; } @@ -992,7 +1091,7 @@ UWORD cCmdHandleRemoteCommands(UBYTE * pInBuf, UBYTE * pOutBuf, UBYTE * pLen) } } break; - case RC_UPDATE_RESET_COUNT: + case RC_UPDATE_RESET_COUNT: { i = pInBuf[1]; @@ -1006,6 +1105,87 @@ UWORD cCmdHandleRemoteCommands(UBYTE * pInBuf, UBYTE * pOutBuf, UBYTE * pLen) pMapOutPut->Outputs[i].Flags |= UPDATE_RESET_COUNT; } break; + case RC_SET_VM_STATE: + { + // don't change the VM state if the state is currently idle or resetting + if (VarsCmd.VMState > VM_IDLE && VarsCmd.VMState < VM_RESET1) + { + VarsCmd.VMState = (VM_STATE)pInBuf[1]; + // setting the VM state turns on debugging + VarsCmd.Debugging = TRUE; + if (VarsCmd.VMState == VM_RESET1) + IOMapCmd.ProgStatus = PROG_ABORT; + } + // fall through to RC_GET_VM_STATE + } + case RC_GET_VM_STATE: + { + if (SendResponse == TRUE) + { + // output the vm state, current clump and its relative program counter (4 bytes) + pOutBuf[ResponseLen] = VarsCmd.VMState; + ResponseLen++; + pOutBuf[ResponseLen] = VarsCmd.RunQ.Head; + ResponseLen++; + CLUMP_REC* pClumpRec = &(VarsCmd.pAllClumps[VarsCmd.RunQ.Head]); + CODE_INDEX pc = (CODE_INDEX)(pClumpRec->PC-pClumpRec->CodeStart); + memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)&(pc), 2); + ResponseLen += 2; + } + } + break; + + case RC_SET_BREAKPOINTS: + { + CLUMP_ID Clump = (CLUMP_ID)pInBuf[1]; + //Don't do anything if illegal clump specification is made + if (Clump >= VarsCmd.AllClumpsCount) + { + RCStatus = ERR_RC_ILLEGAL_VAL; + break; + } + // setting breakpoint information turns on debugging mode + VarsCmd.Debugging = TRUE; + CLUMP_BREAK_REC* pBreakpoints = VarsCmd.pAllClumps[Clump].Breakpoints; + // length varies from 6 bytes min to 18 bytes max + // clump byte, bpidx, bplocation (2 bytes), bp enabled, [...] terminal byte 0xFF + UBYTE idx = 2; + UBYTE bDone = FALSE; + while (!bDone) { + UBYTE bpIdx = (UBYTE)pInBuf[idx]; + idx++; + memcpy((PSZ)(&(pBreakpoints[bpIdx].Location)), (PSZ)(&pInBuf[idx]), 2); + idx += 2; + pBreakpoints[bpIdx].Enabled = (UBYTE)pInBuf[idx]; + idx++; + bDone = (((UBYTE)pInBuf[idx] == 0xFF) || (idx >= 18)); + } + // fall through to RC_GET_BREAKPOINTS + } + + case RC_GET_BREAKPOINTS: + { + if (SendResponse == TRUE) + { + // output the list of breakpoints for the specified clump ID + CLUMP_ID Clump = (CLUMP_ID)pInBuf[1]; + //Don't do anything if illegal clump specification is made + if (Clump >= VarsCmd.AllClumpsCount) + { + RCStatus = ERR_RC_ILLEGAL_VAL; + break; + } + CLUMP_BREAK_REC* pBreakpoints = VarsCmd.pAllClumps[Clump].Breakpoints; + for(int j = 0; j < MAX_BREAKPOINTS; j++) + { + memcpy((PSZ)&(pOutBuf[ResponseLen]), (PSZ)&(pBreakpoints[j].Location), 2); + ResponseLen += 2; + pOutBuf[ResponseLen] = pBreakpoints[j].Enabled; + ResponseLen++; + } + } + } + break; default: { //Unknown remote command -- still inform client to not expect any response bytes @@ -1092,32 +1272,35 @@ void cCmdInit(void* pHeader) //Initialize IO_PTRS_OUT for (i = 0; i < NO_OF_OUTPUTS; i++) { - IO_PTRS_OUT[IO_OUT_FLAGS + i * IO_OUT_FPP] = (void*)&(pMapOutPut->Outputs[i].Flags); - IO_PTRS_OUT[IO_OUT_MODE + i * IO_OUT_FPP] = (void*)&(pMapOutPut->Outputs[i].Mode); - IO_PTRS_OUT[IO_OUT_SPEED + i * IO_OUT_FPP] = (void*)&(pMapOutPut->Outputs[i].Speed); - IO_PTRS_OUT[IO_OUT_ACTUAL_SPEED + i * IO_OUT_FPP] = (void*)&(pMapOutPut->Outputs[i].ActualSpeed); - IO_PTRS_OUT[IO_OUT_TACH_COUNT + i * IO_OUT_FPP] = (void*)&(pMapOutPut->Outputs[i].TachoCnt); - IO_PTRS_OUT[IO_OUT_TACH_LIMIT + i * IO_OUT_FPP] = (void*)&(pMapOutPut->Outputs[i].TachoLimit); - IO_PTRS_OUT[IO_OUT_RUN_STATE + i * IO_OUT_FPP] = (void*)&(pMapOutPut->Outputs[i].RunState); - IO_PTRS_OUT[IO_OUT_TURN_RATIO + i * IO_OUT_FPP] = (void*)&(pMapOutPut->Outputs[i].SyncTurnParameter); - IO_PTRS_OUT[IO_OUT_REG_MODE + i * IO_OUT_FPP] = (void*)&(pMapOutPut->Outputs[i].RegMode); - IO_PTRS_OUT[IO_OUT_OVERLOAD + i * IO_OUT_FPP] = (void*)&(pMapOutPut->Outputs[i].Overloaded); - IO_PTRS_OUT[IO_OUT_REG_P_VAL + i * IO_OUT_FPP] = (void*)&(pMapOutPut->Outputs[i].RegPParameter); - IO_PTRS_OUT[IO_OUT_REG_I_VAL + i * IO_OUT_FPP] = (void*)&(pMapOutPut->Outputs[i].RegIParameter); - IO_PTRS_OUT[IO_OUT_REG_D_VAL + i * IO_OUT_FPP] = (void*)&(pMapOutPut->Outputs[i].RegDParameter); - IO_PTRS_OUT[IO_OUT_BLOCK_TACH_COUNT + i * IO_OUT_FPP] = (void*)&(pMapOutPut->Outputs[i].BlockTachoCount); - IO_PTRS_OUT[IO_OUT_ROTATION_COUNT + i * IO_OUT_FPP] = (void*)&(pMapOutPut->Outputs[i].RotationCount); + OUTPUT * pOut = &(pMapOutPut->Outputs[i]); + IO_PTRS_OUT[IO_OUT_FLAGS + i * IO_OUT_FPP] = (void*)&(pOut->Flags); + IO_PTRS_OUT[IO_OUT_MODE + i * IO_OUT_FPP] = (void*)&(pOut->Mode); + IO_PTRS_OUT[IO_OUT_SPEED + i * IO_OUT_FPP] = (void*)&(pOut->Speed); + IO_PTRS_OUT[IO_OUT_ACTUAL_SPEED + i * IO_OUT_FPP] = (void*)&(pOut->ActualSpeed); + IO_PTRS_OUT[IO_OUT_TACH_COUNT + i * IO_OUT_FPP] = (void*)&(pOut->TachoCnt); + IO_PTRS_OUT[IO_OUT_TACH_LIMIT + i * IO_OUT_FPP] = (void*)&(pOut->TachoLimit); + IO_PTRS_OUT[IO_OUT_RUN_STATE + i * IO_OUT_FPP] = (void*)&(pOut->RunState); + IO_PTRS_OUT[IO_OUT_TURN_RATIO + i * IO_OUT_FPP] = (void*)&(pOut->SyncTurnParameter); + IO_PTRS_OUT[IO_OUT_REG_MODE + i * IO_OUT_FPP] = (void*)&(pOut->RegMode); + IO_PTRS_OUT[IO_OUT_OVERLOAD + i * IO_OUT_FPP] = (void*)&(pOut->Overloaded); + IO_PTRS_OUT[IO_OUT_REG_P_VAL + i * IO_OUT_FPP] = (void*)&(pOut->RegPParameter); + IO_PTRS_OUT[IO_OUT_REG_I_VAL + i * IO_OUT_FPP] = (void*)&(pOut->RegIParameter); + IO_PTRS_OUT[IO_OUT_REG_D_VAL + i * IO_OUT_FPP] = (void*)&(pOut->RegDParameter); + IO_PTRS_OUT[IO_OUT_BLOCK_TACH_COUNT + i * IO_OUT_FPP] = (void*)&(pOut->BlockTachoCount); + IO_PTRS_OUT[IO_OUT_ROTATION_COUNT + i * IO_OUT_FPP] = (void*)&(pOut->RotationCount); + IO_PTRS_OUT[IO_OUT_OPTIONS + i * IO_OUT_FPP] = (void*)&(pOut->Options); } //Initialize IO_PTRS_IN for (i = 0; i < NO_OF_INPUTS; i++) { - IO_PTRS_IN[IO_IN_TYPE + i * IO_IN_FPP] = (void*)&(pMapInput->Inputs[i].SensorType); - IO_PTRS_IN[IO_IN_MODE + i * IO_IN_FPP] = (void*)&(pMapInput->Inputs[i].SensorMode); - IO_PTRS_IN[IO_IN_ADRAW + i * IO_IN_FPP] = (void*)&(pMapInput->Inputs[i].ADRaw); - IO_PTRS_IN[IO_IN_NORMRAW + i * IO_IN_FPP] = (void*)&(pMapInput->Inputs[i].SensorRaw); - IO_PTRS_IN[IO_IN_SCALEDVAL + i * IO_IN_FPP] = (void*)&(pMapInput->Inputs[i].SensorValue); - IO_PTRS_IN[IO_IN_INVALID_DATA + i * IO_IN_FPP] = (void*)&(pMapInput->Inputs[i].InvalidData); + INPUTSTRUCT * pIn = &(pMapInput->Inputs[i]); + IO_PTRS_IN[IO_IN_TYPE + i * IO_IN_FPP] = (void*)&(pIn->SensorType); + IO_PTRS_IN[IO_IN_MODE + i * IO_IN_FPP] = (void*)&(pIn->SensorMode); + IO_PTRS_IN[IO_IN_ADRAW + i * IO_IN_FPP] = (void*)&(pIn->ADRaw); + IO_PTRS_IN[IO_IN_NORMRAW + i * IO_IN_FPP] = (void*)&(pIn->SensorRaw); + IO_PTRS_IN[IO_IN_SCALEDVAL + i * IO_IN_FPP] = (void*)&(pIn->SensorValue); + IO_PTRS_IN[IO_IN_INVALID_DATA + i * IO_IN_FPP] = (void*)&(pIn->InvalidData); } //Clear memory pool and initialize VarsCmd (cCmdDeactivateProgram effectively re-inits VarsCmd) @@ -1190,12 +1373,14 @@ void cCmdCtrl(void) VarsCmd.CmdCtrlCount++; #endif //Abort current program if cancel button is pressed - if (IOMapCmd.DeactivateFlag == TRUE || pMapButton->State[BTN1] & PRESSED_EV) + if (IOMapCmd.DeactivateFlag == TRUE || + ((pMapButton->State[BTN1] & pMapUi->AbortFlag) && + ((pMapButton->State[BTN4] & PRESSED_EV) != PRESSED_EV))) // JCH 2010-01-13 Make sure enter button is not also pressed { IOMapCmd.DeactivateFlag = FALSE; //Clear pressed event so it doesn't get double-counted by UI - pMapButton->State[BTN1] &= ~PRESSED_EV; + pMapButton->State[BTN1] &= ~(pMapUi->AbortFlag); //Go to VM_RESET1 state and report abort VarsCmd.VMState = VM_RESET1; @@ -1221,6 +1406,9 @@ void cCmdCtrl(void) #if VMProfilingCode CmdCtrlClumpTime[clump] += dTimerReadHiRes() - ClumpEnterTime; #endif + // automatically switch from RUN_SINGLE to RUN_PAUSE after a single step + if (VarsCmd.VMState == VM_RUN_SINGLE) + VarsCmd.VMState = VM_RUN_PAUSE; //If RunQ and RestQ are empty, program is done, or wacko if (!cCmdIsClumpIDSane(VarsCmd.RunQ.Head)) { @@ -1230,9 +1418,10 @@ void cCmdCtrl(void) IOMapCmd.ProgStatus = PROG_OK; } } - else if (Status == CLUMP_SUSPEND || Status == CLUMP_DONE) + else if (Status == CLUMP_SUSPEND || Status == CLUMP_DONE) { Continue = TRUE; // queue isn't empty, didn't timeout //Only rotate RunQ on a "normal" finish, i.e. no error, clump end, or breakout request + } else if (Status == ROTATE_QUEUE) { // done and suspend do their own cCmdRotateQ(); Continue= TRUE; @@ -1245,7 +1434,8 @@ void cCmdCtrl(void) { Continue = FALSE; VarsCmd.VMState = VM_RESET1; - IOMapCmd.ProgStatus = PROG_ERROR; +// IOMapCmd.ProgStatus = PROG_ERROR; + IOMapCmd.ProgStatus = Status; } else if (Status == STOP_REQ) { @@ -1257,7 +1447,7 @@ void cCmdCtrl(void) { Continue = FALSE; } - } while (Continue == TRUE); + } while (Continue == TRUE && VarsCmd.VMState == VM_RUN_FREE); #if VMProfilingCode FinishTime= dTimerReadHiRes(); if(NotFirstCall) @@ -1286,7 +1476,8 @@ void cCmdCtrl(void) //2. Proceed to VM_RESET1 (some unneeded work, yes, but preserves contract with UI if (IS_ERR(Status)) { - IOMapCmd.ProgStatus = PROG_ERROR; +// IOMapCmd.ProgStatus = PROG_ERROR; + IOMapCmd.ProgStatus = Status; VarsCmd.VMState = VM_RESET1; } //Else start running program @@ -1295,10 +1486,6 @@ void cCmdCtrl(void) VarsCmd.VMState = VM_RUN_FREE; IOMapCmd.ProgStatus = PROG_RUNNING; VarsCmd.StartTick = IOMapCmd.Tick; - if(VarsCmd.VMState == VM_RUN_FREE) - gInstrsToExecute = 20; - else - gInstrsToExecute= 1; #if VM_BENCHMARK //Re-init benchmark @@ -1344,7 +1531,7 @@ void cCmdCtrl(void) cCmdWriteBenchmarkFile(); #endif - + //Re-initialize program state data (contents of memory pool preserved) //!!! Skip this step in simulator builds so helper access methods still work #ifndef SIM_NXT @@ -1392,7 +1579,13 @@ void cCmdCtrl(void) } while (IOMapCmd.Tick == dTimerRead()); // delay until scheduled time } - break; + break; + + case VM_RUN_PAUSE: + { + while (IOMapCmd.Tick == dTimerRead()); // delay until scheduled time + } + break; }//END state machine switch //Set tick to new value for next time 'round @@ -1425,6 +1618,16 @@ NXT_STATUS cCmdReadFileHeader(UBYTE* pData, ULONG DataSize, NXT_ASSERT(pData != NULL); + if (strncmp((PSZ)pData, "NXTBINARY", VM_FORMAT_STRING_SIZE) == 0) + { + ULONG NativeOffset; + pCursor = (pData + 12); + NativeOffset = (ULONG)(*pCursor); + void (*native)(ULONG, ULONG) = (void (*)())(pData + NativeOffset); + (*native)((ULONG)pData, DataSize); + NXT_BREAK; + return (ERR_VER); + } //Assign pCursor to point to version word inside file header pCursor = (pData + VM_FORMAT_STRING_SIZE - 2); @@ -1486,7 +1689,7 @@ NXT_STATUS cCmdReadFileHeader(UBYTE* pData, ULONG DataSize, //Must have at least one clump and count can't exceed the NOT_A_CLUMP sentinel if (FileClumpCount == 0 || FileClumpCount >= NOT_A_CLUMP) - return (ERR_FILE); + return (ERR_CLUMP_COUNT); else VarsCmd.AllClumpsCount = (CLUMP_ID)FileClumpCount; @@ -1495,7 +1698,7 @@ NXT_STATUS cCmdReadFileHeader(UBYTE* pData, ULONG DataSize, //Can't have a valid program with no code if (VarsCmd.CodespaceCount == 0) - return (ERR_FILE); + return (ERR_NO_CODE); // // Now, calculate offsets for each data segment in the file @@ -1536,7 +1739,7 @@ NXT_STATUS cCmdReadFileHeader(UBYTE* pData, ULONG DataSize, if (CurrOffset != (DataSize - VarsCmd.CodespaceCount * 2)) { NXT_BREAK; - return (ERR_FILE); + return (ERR_INSANE_OFFSET); } // @@ -1573,7 +1776,7 @@ NXT_STATUS cCmdReadFileHeader(UBYTE* pData, ULONG DataSize, if (VarsCmd.PoolSize > POOL_MAX_SIZE) { NXT_BREAK; - return (ERR_FILE); + return (ERR_BAD_POOL_SIZE); } return (NO_ERR); @@ -1671,7 +1874,7 @@ NXT_STATUS cCmdActivateProgram(UBYTE * pFileName) //If Loader returned error or bad file pointer, bail out if (LOADER_ERR(LStatus) != SUCCESS || pData == NULL || DataSize == 0) - return (ERR_FILE); + return (ERR_LOADER_ERR); //Deactivate current program and re-initialize memory pool cCmdDeactivateProgram(); @@ -1702,7 +1905,7 @@ NXT_STATUS cCmdActivateProgram(UBYTE * pFileName) || (VarsCmd.DataspaceSize == 0) ) { NXT_BREAK; - return ERR_FILE; + return ERR_SPOTCHECK_FAIL; } //Initialize CLUMP_RECs as contiguous list in RAM @@ -1717,6 +1920,14 @@ NXT_STATUS cCmdActivateProgram(UBYTE * pFileName) //Initialize remaining CLUMP_REC fields clumpPtr->PC = clumpPtr->CodeStart; clumpPtr->Link = NOT_A_CLUMP; + clumpPtr->Priority = INSTR_MAX_COUNT; + + CLUMP_BREAK_REC* pBreakpoints = clumpPtr->Breakpoints; + for (j = 0; j < MAX_BREAKPOINTS; j++) + { + pBreakpoints[j].Location = 0; + pBreakpoints[j].Enabled = FALSE; + } //Activate any clumps with CurrFireCount of 0 clumpPtr->CurrFireCount = clumpPtr->InitFireCount; @@ -1804,7 +2015,7 @@ NXT_STATUS cCmdActivateProgram(UBYTE * pFileName) } //Programs with no active clumps constitutes an activation error if (VarsCmd.RunQ.Head == NOT_A_CLUMP) - return (ERR_FILE); + return (ERR_NO_ACTIVE_CLUMP); else { // now that we know which clumps are scalar and poly, refresh dispatch table to match head @@ -1828,7 +2039,7 @@ NXT_STATUS cCmdActivateProgram(UBYTE * pFileName) || (DefaultsOffset + FileOffsets.DynamicDefaultsSize != FileOffsets.DSDefaultsSize)) { NXT_BREAK; - return (ERR_FILE); + return (ERR_DEFAULT_OFFSETS); } //Copy Dynamic defaults from file @@ -1845,7 +2056,7 @@ NXT_STATUS cCmdActivateProgram(UBYTE * pFileName) if ((UBYTE *)VarsCmd.MemMgr.pDopeVectorArray != VarsCmd.pDataspace + DV_ARRAY[0].Offset) { NXT_BREAK; - return (ERR_FILE); + return (ERR_MEMMGR_FAIL); } //Initialize message queues @@ -1867,7 +2078,7 @@ NXT_STATUS cCmdActivateProgram(UBYTE * pFileName) { VarsCmd.DatalogBuffer.Datalogs[j] = NOT_A_DS_ID; } - + // now that we've loaded program, prime memmgr dopevectors based upon number of handles in ds. ULONG numHandles= DV_ARRAY[0].Count/2; if(numHandles > 200) @@ -1881,6 +2092,14 @@ NXT_STATUS cCmdActivateProgram(UBYTE * pFileName) gRequestSemData= 0; // preload all calibration coefficients into mem cCmdLoadCalibrationFiles(); + // initialize the graphic globals + gpPassedImgVars = NULL; + memset(gpImgData,0,sizeof(gpImgData)); + gPassedVarsCount = 0; + // configure debugging flags in VarsCmd + VarsCmd.Debugging = FALSE; + VarsCmd.PauseClump = NOT_A_CLUMP; + VarsCmd.PausePC = 0xFFFF; return (Status); } @@ -1889,6 +2108,10 @@ void cCmdDeactivateProgram() { UBYTE i, tmp; + // reset the DS and DVA Offsets + IOMapCmd.OffsetDVA = 0xFFFF; + IOMapCmd.OffsetDS = 0xFFFF; + //Wipe away all references into the pool and clear all run-time data VarsCmd.pCodespace = NULL; VarsCmd.CodespaceCount = 0; @@ -1927,12 +2150,19 @@ void cCmdDeactivateProgram() tmp = i; //Close file if (*(VarsCmd.FileHandleTable[i]) != 0) - pMapLoader->pFunc(CROPDATAFILE, &tmp, NULL, NULL); + pMapLoader->pFunc(CLOSE, &tmp, NULL, NULL); +// pMapLoader->pFunc(CROPDATAFILE, &tmp, NULL, NULL); } //Clear FileHandleTable memset(VarsCmd.FileHandleTable, 0, sizeof(VarsCmd.FileHandleTable)); - + + // reset AbortFlag to default value + pMapUi->AbortFlag = PRESSED_EV; + + // reset Contrast to default value + pMapDisplay->Contrast = DISPLAY_CONTRAST_DEFAULT; + return; } @@ -1952,29 +2182,31 @@ void cCmdResetDevices(void) for (i = 0; i < NO_OF_INPUTS; i++) { + INPUTSTRUCT * pIn = &(pMapInput->Inputs[i]); //Clear type and mode to defaults - pMapInput->Inputs[i].SensorType = NO_SENSOR; - pMapInput->Inputs[i].SensorMode = RAWMODE; + pIn->SensorType = NO_SENSOR; + pIn->SensorMode = RAWMODE; //Reset input values to 0 prior to running (clear things like stale rotation counts) - pMapInput->Inputs[i].ADRaw = 0; - pMapInput->Inputs[i].SensorRaw = 0; - pMapInput->Inputs[i].SensorValue = 0; + pIn->ADRaw = 0; + pIn->SensorRaw = 0; + pIn->SensorValue = 0; //Assert invalid data flag so future code is aware of these changes - pMapInput->Inputs[i].InvalidData = TRUE; + pIn->InvalidData = TRUE; } for (i = 0; i < NO_OF_OUTPUTS; i++) { //Coast and reset all motor parameters - pMapOutPut->Outputs[i].Mode = 0; - pMapOutPut->Outputs[i].RegMode = REGULATION_MODE_IDLE; - pMapOutPut->Outputs[i].RunState = MOTOR_RUN_STATE_IDLE; - pMapOutPut->Outputs[i].Speed = 0; - pMapOutPut->Outputs[i].TachoLimit = 0; - pMapOutPut->Outputs[i].SyncTurnParameter = 0; - pMapOutPut->Outputs[i].Flags = UPDATE_MODE | UPDATE_SPEED | UPDATE_TACHO_LIMIT | UPDATE_RESET_COUNT | UPDATE_RESET_BLOCK_COUNT | UPDATE_RESET_ROTATION_COUNT; + OUTPUT * pOut = &(pMapOutPut->Outputs[i]); + pOut->Mode = 0; + pOut->RegMode = REGULATION_MODE_IDLE; + pOut->RunState = MOTOR_RUN_STATE_IDLE; + pOut->Speed = 0; + pOut->TachoLimit = 0; + pOut->SyncTurnParameter = 0; + pOut->Flags = UPDATE_MODE | UPDATE_SPEED | UPDATE_TACHO_LIMIT | UPDATE_RESET_COUNT | UPDATE_RESET_BLOCK_COUNT | UPDATE_RESET_ROTATION_COUNT; } //Lowspeed init, INSERT CODE !!! @@ -2201,6 +2433,45 @@ NXT_STATUS cCmdAcquireMutex(MUTEX_Q * Mutex) return (Status); } +UBYTE cCmdIsClumpOnAMutexWaitQ(CLUMP_ID Clump) +{ + //Make sure Clump's ID is valid + NXT_ASSERT(cCmdIsClumpIDSane(Clump)); + DATA_ARG Arg1; + MUTEX_Q * Mutex; + for (Arg1=0; Arg1 < VarsCmd.DataspaceCount; Arg1++) + { + if (VarsCmd.pDataspaceTOC[Arg1].TypeCode == TC_MUTEX) + { + Mutex = cCmdDSPtr(Arg1, 0); + if (cCmdIsClumpOnQ(&(Mutex->WaitQ), Clump)) + return TRUE; + } + } + return FALSE; +} + +NXT_STATUS cCmdReleaseAllMutexes(CLUMP_ID Clump) +{ + //Make sure Clump's ID is valid + NXT_ASSERT(cCmdIsClumpIDSane(Clump)); + DATA_ARG Arg1; + MUTEX_Q * Mutex; + for (Arg1=0; Arg1 < VarsCmd.DataspaceCount; Arg1++) + { + if (VarsCmd.pDataspaceTOC[Arg1].TypeCode == TC_MUTEX) + { + Mutex = cCmdDSPtr(Arg1, 0); + // if this clump owns the Mutex then release it + if (Mutex->Owner == Clump) + cCmdReleaseMutex(Mutex); + // also make sure that this Clump is not waiting in this mutex's wait queue + if (cCmdIsClumpOnQ(&(Mutex->WaitQ), Clump)) + cCmdDeQClump(&(Mutex->WaitQ), Clump); + } + } + return (NO_ERR); +} NXT_STATUS cCmdReleaseMutex(MUTEX_Q * Mutex) { @@ -3226,32 +3497,33 @@ NXT_STATUS cCmdDatalogRead(UBYTE * pBuffer, UWORD Length, UBYTE Remove) return Status; } - // // Color Sensor Functions // NXT_STATUS cCmdColorSensorRead (UBYTE Port, SWORD * SensorValue, UWORD * RawArray, UWORD * NormalizedArray, SWORD * ScaledArray, UBYTE * InvalidData) { - ULONG i; + ULONG i; //Make sure Port is valid for Color Sensor - if (!(pMapInput->Inputs[Port].SensorType == COLORFULL || pMapInput->Inputs[Port].SensorType == COLORRED - || pMapInput->Inputs[Port].SensorType == COLORGREEN || pMapInput->Inputs[Port].SensorType == COLORBLUE - || pMapInput->Inputs[Port].SensorType == COLORNONE)) + INPUTSTRUCT * pIn = &(pMapInput->Inputs[Port]); + UBYTE sType = pIn->SensorType; + if (!(sType == COLORFULL || sType == COLORRED || sType == COLORGREEN || + sType == COLORBLUE || sType == COLORNONE)) { return (ERR_COMM_CHAN_NOT_READY); //TODO - is this the right error? } //Copy Detected Color - *SensorValue = pMapInput->Inputs[Port].SensorValue; + *SensorValue = pIn->SensorValue; //Copy all raw, normalized and scaled data from I/O Map for (i=0; iColors[Port].ADRaw[i]; - NormalizedArray[i] = pMapInput->Colors[Port].SensorRaw[i]; - ScaledArray[i] = pMapInput->Colors[Port].SensorValue[i]; + COLORSTRUCT * pColor = &(pMapInput->Colors[Port]); + RawArray[i] = pColor->ADRaw[i]; + NormalizedArray[i] = pColor->SensorRaw[i]; + ScaledArray[i] = pColor->SensorValue[i]; } //Copy the Invalid Data Flag - *InvalidData = pMapInput->Inputs[Port].InvalidData; + *InvalidData = pIn->InvalidData; return NO_ERR; @@ -3363,13 +3635,14 @@ void cCmdSetByte(void * pVal, ULONG NewVal); void cCmdSetWord(void * pVal, ULONG NewVal); void cCmdSetLong(void * pVal, ULONG NewVal); void cCmdSetError(void * pVal, ULONG NewVal); +void cCmdSetFloat(void * pVal, ULONG NewVal); typedef ULONG (*pGetOperand)(void *); static pGetOperand GetProcArray[11]= {cCmdGetUByte, cCmdGetUByte, cCmdGetSByte, cCmdGetUWord, cCmdGetSWord, cCmdGetULong, cCmdGetSLong, cCmdGetError, cCmdGetError, cCmdGetError, cCmdGetFloat}; // dup UByte to line up typedef void (*pSetOperand)(void *, ULONG); -static pSetOperand SetProcArray[9]= {cCmdSetByte, cCmdSetByte, cCmdSetByte, cCmdSetWord, cCmdSetWord, cCmdSetLong, cCmdSetLong, cCmdSetError, cCmdSetError}; // dup UByte to line up +static pSetOperand SetProcArray[11]= {cCmdSetByte, cCmdSetByte, cCmdSetByte, cCmdSetWord, cCmdSetWord, cCmdSetLong, cCmdSetLong, cCmdSetError, cCmdSetError, cCmdSetError, cCmdSetFloat}; // dup UByte to line up void cCmdSetError(void * pVal, ULONG NewVal) { NXT_BREAK; @@ -3387,6 +3660,10 @@ void cCmdSetByte(void * pVal, ULONG NewVal) { *(UBYTE*)pVal = (UBYTE)NewVal; } +void cCmdSetFloat(void * pVal, ULONG NewVal) { + *(float*)pVal = (float)NewVal; +} + // only works on simple types, equivalent to resolve and get, but faster ULONG cCmdGetScalarValFromDataArg(DATA_ARG DataArg, UWORD Offset) { @@ -3394,6 +3671,11 @@ ULONG cCmdGetScalarValFromDataArg(DATA_ARG DataArg, UWORD Offset) return GetProcArray[dsTOCPtr->TypeCode](VarsCmd.pDataspace + dsTOCPtr->DSOffset + Offset); } +float cCmdGetFloatValFromDataArg(DATA_ARG DataArg, UWORD Offset) +{ + DS_TOC_ENTRY *dsTOCPtr= &VarsCmd.pDataspaceTOC[DataArg]; + return (float)(*(float*)(VarsCmd.pDataspace + dsTOCPtr->DSOffset + Offset)); +} ULONG cCmdGetError(void * pVal) { NXT_BREAK; @@ -3426,11 +3708,11 @@ ULONG cCmdGetSByte(void * pVal) { ULONG cCmdGetFloat(void * pVal) { float tempVal = *(float*)pVal; - if (tempVal >= 0) { - tempVal += 0.5; + if (tempVal >= (float)0.0) { + tempVal += (float)0.5; } else { - tempVal -= 0.5; + tempVal -= (float)0.5; } return (ULONG)tempVal; } @@ -3822,6 +4104,17 @@ UWORD cCmdGetDVIndex(DS_ELEMENT_ID DSElementID, UWORD Offset) return DVIndex; } +UWORD cCmdArrayDimensions(DS_ELEMENT_ID DSElementID) +{ + NXT_ASSERT(cCmdIsDSElementIDSane(DSElementID)); + UWORD result = 0; + while (cCmdDSType(DSElementID) == TC_ARRAY) + { + result++; + DSElementID = INC_ID(DSElementID); + } + return result; +} UWORD cCmdArrayCount(DS_ELEMENT_ID DSElementID, UWORD Offset) { @@ -4137,10 +4430,66 @@ NXT_STATUS cCmdInterpFromClump() pInstr = pClumpRec->PC; // abs lastClumpInstr= pClumpRec->CodeEnd; // abs - i= gInstrsToExecute; +/* + // are we free running and reach a breakpoint? + if (VarsCmd.VMState == VM_RUN_FREE) + { + CLUMP_BREAK_REC* pBreakpoints = pClumpRec->Breakpoints; + for(int j = 0; j < MAX_BREAKPOINTS; j++) + { + if (pBreakpoints[j].Enabled && + (pBreakpoints[j].Location == (CODE_INDEX)(pClumpRec->PC-pClumpRec->CodeStart))) + { + VarsCmd.VMState = VM_RUN_PAUSE; + return BREAKOUT_REQ; + } + } + // auto pause at clump == pauseClump and relative PC = pausePC + if ((Clump == VarsCmd.PauseClump) && + ((CODE_INDEX)(pClumpRec->PC-pClumpRec->CodeStart) == VarsCmd.PausePC)) + { + VarsCmd.VMState = VM_RUN_PAUSE; + // turn off the auto pause flags + VarsCmd.PauseClump = NOT_A_CLUMP; + VarsCmd.PausePC = 0xFFFF; + return BREAKOUT_REQ; + } + } +*/ + + if(VarsCmd.VMState == VM_RUN_FREE) + i = pClumpRec->Priority; + else + i = 1; nextMSTick= dTimerGetNextMSTickCnt(); do { + // are we debugging and are free running and reach a breakpoint/autopause? + if (VarsCmd.Debugging && (VarsCmd.VMState == VM_RUN_FREE)) + { + CLUMP_BREAK_REC* pBreakpoints = pClumpRec->Breakpoints; + for(int j = 0; j < MAX_BREAKPOINTS; j++) + { + if (pBreakpoints[j].Enabled && + (pBreakpoints[j].Location == (CODE_INDEX)(pClumpRec->PC-pClumpRec->CodeStart))) + { + VarsCmd.VMState = VM_RUN_PAUSE; + return BREAKOUT_REQ; + } + } + // auto pause at clump == pauseClump and relative PC = pausePC + if ((Clump == VarsCmd.PauseClump) && + ((CODE_INDEX)(pClumpRec->PC-pClumpRec->CodeStart) == VarsCmd.PausePC)) + { + // pause the VM + VarsCmd.VMState = VM_RUN_PAUSE; + // and turn off the auto pause flags + VarsCmd.PauseClump = NOT_A_CLUMP; + VarsCmd.PausePC = 0xFFFF; + return BREAKOUT_REQ; + } + } + #if VMProfilingCode ULONG instrStartTime; instrStartTime= dTimerReadHiRes(); @@ -4291,6 +4640,22 @@ NXT_STATUS cCmdInterpUnop1(CODE_WORD * const pCode) } break; + case OP_WAITI: + case OP_WAITV: + { + ULONG wait= 0; + if (opCode == OP_WAITV) { + wait = cCmdGetScalarValFromDataArg(Arg1, 0); + } + else + wait = Arg1; + if(wait == 0) + Status= ROTATE_QUEUE; + else + Status = cCmdSleepClump(wait + IOMapCmd.Tick); // put to sleep, to wake up wait ms in future + } + break; + case OP_GETTICK: { cCmdSetScalarValFromDataArg(Arg1, dTimerReadNoPoll()); @@ -4307,6 +4672,45 @@ NXT_STATUS cCmdInterpUnop1(CODE_WORD * const pCode) } break; + case OP_STOPCLUMPIMMED: + { + // Release any mutexes that the clump we are stopping owns + CLUMP_ID Clump = (CLUMP_ID)Arg1; + // release any mutexes owned by this clump + // and remove it from any wait queues that it might be on + cCmdReleaseAllMutexes(Clump); + if (cCmdIsClumpOnQ(&(VarsCmd.RunQ), Clump)) { + // remove the specified clump from the run queue if it is on it + cCmdDeQClump(&(VarsCmd.RunQ), Clump); + } + else if (cCmdIsClumpOnQ(&(VarsCmd.RestQ), Clump)) { + // if the specified clump happened to be sleeping then + // remove it from the rest queue + cCmdDeQClump(&(VarsCmd.RestQ), Clump); + } + // since we have stopped that clump we should reset its clump rec values. + CLUMP_REC* pClumpRec = &(VarsCmd.pAllClumps[Clump]); + pClumpRec->PC = pClumpRec->CodeStart; + pClumpRec->CurrFireCount = pClumpRec->InitFireCount; + pClumpRec->awakenTime = 0; + } + break; + + case OP_STARTCLUMPIMMED: + { + CLUMP_ID Clump = (CLUMP_ID)Arg1; + // only enqueue the clump if it is not already on the run queue + // otherwise this is a no-op + if (!cCmdIsClumpOnQ(&(VarsCmd.RunQ), Clump) && + !cCmdIsClumpOnQ(&(VarsCmd.RestQ), Clump) && + !cCmdIsClumpOnAMutexWaitQ(Clump)) + { + cCmdEnQClump(&(VarsCmd.RunQ), Clump); //Enqueue the specified clump + Status = CLUMP_SUSPEND; + } + } + break; + default: { //Fatal error: Unrecognized instruction @@ -4408,13 +4812,10 @@ NXT_STATUS cCmdInterpUnop2(CODE_WORD * const pCode) polyUn2Dispatch ++; UWORD Count; UWORD Offset; - SLONG TmpSLong; - ULONG TmpULong; +// SLONG TmpSLong; +// ULONG TmpULong; ULONG ArgVal2; float FltArgVal2; - char Buffer[30]; - char FormatString[5]; - UBYTE CheckTrailingZeros = 0; NXT_ASSERT(pCode != NULL); @@ -4423,7 +4824,10 @@ NXT_STATUS cCmdInterpUnop2(CODE_WORD * const pCode) Arg1 = pCode[1]; Arg2 = pCode[2]; - if (opCode == OP_NEG || opCode == OP_NOT || opCode == OP_TST || opCode == OP_SQRT || opCode == OP_ABS) + if (opCode == OP_NEG || opCode == OP_NOT || opCode == OP_TST || + opCode == OP_CMNT || opCode == OP_SQRT || opCode == OP_ABS || opCode == OP_SIGN || + (opCode >= OP_ACOS && opCode <= OP_FRAC) || + (opCode >= OP_ACOSD && opCode <= OP_SINHD)) { return cCmdInterpPolyUnop2(*pCode, Arg1, 0, Arg2, 0); } @@ -4440,7 +4844,13 @@ NXT_STATUS cCmdInterpUnop2(CODE_WORD * const pCode) { //!!! Should throw error if TypeCode1 is non-scalar // Accepting non-scalar destinations could have unpredictable results! - cCmdSetScalarValFromDataArg(Arg1, Arg2); + pArg1 = cCmdResolveDataArg(Arg1, 0, &TypeCode1); + if (TypeCode1 == TC_SLONG) + *(ULONG*)pArg1 = (SWORD)Arg2; + else if (TypeCode1 == TC_ULONG) + *(ULONG*)pArg1 = (UWORD)Arg2; + else if (TypeCode1 < TC_ULONG) + cCmdSetScalarValFromDataArg(Arg1, Arg2); } break; @@ -4482,6 +4892,19 @@ NXT_STATUS cCmdInterpUnop2(CODE_WORD * const pCode) } break; + case OP_PRIORITY: + { + // set the priority of the specified clump + CLUMP_ID clump; + if (Arg2 != NOT_A_DS_ID) + clump = (CLUMP_ID)Arg1; + else + clump = VarsCmd.RunQ.Head; + CLUMP_REC* pClumpRec = &(VarsCmd.pAllClumps[clump]); + pClumpRec->Priority = (UBYTE)Arg2; + } + break; + case OP_SUBCALL: { NXT_ASSERT(cCmdIsClumpIDSane((CLUMP_ID)Arg1)); @@ -4590,6 +5013,7 @@ NXT_STATUS cCmdInterpUnop2(CODE_WORD * const pCode) case OP_NUMTOSTRING: { + char Buffer[36]; //Assert that the destination is a string (array of bytes) NXT_ASSERT(cCmdDSType(Arg1) == TC_ARRAY); NXT_ASSERT(cCmdDSType(INC_ID(Arg1)) == TC_UBYTE); @@ -4600,65 +5024,36 @@ NXT_STATUS cCmdInterpUnop2(CODE_WORD * const pCode) if (TypeCode2 == TC_FLOAT) { - pArg2 = cCmdResolveDataArg(Arg2, 0, NULL); - FltArgVal2 = cCmdGetValFlt(pArg2, TypeCode2); - // is number too big for display? then format differently and don't bother with trailing zeros - if ((FltArgVal2 > 9999999999999.99)||(FltArgVal2 < -999999999999.99)){ // these are the widest %.2f numbers that will fit on display - strcpy (FormatString, "%.6g"); - } - else{ - strcpy (FormatString, "%.2f"); - CheckTrailingZeros = 1; - } - Count = sprintf(Buffer, FormatString, FltArgVal2); + FltArgVal2 = cCmdGetFloatValFromDataArg(Arg2, 0); + Count = sprintf(Buffer, "%.4f", FltArgVal2); Count++; //add room for null terminator - - if (CheckTrailingZeros){ - // Determine if the trailing digits are zeros. If so, drop them - if (Buffer[Count-2] == 0x30) { // NOTE: 0x30 is ASCII 0 - if (Buffer[Count-3] == 0x30){ - strcpy (FormatString, "%.0f"); // the last two digits = 0, copy as integer - Count = Count - 3; // don't need memory for decimal and 2 ascii characters - } - else { - strcpy (FormatString, "%.1f"); // only the 2nd digit = 0 so drop it, but keep the tenths place - Count = Count - 1; // don't need memory for 2nd ascii character - } - } + // remove trailing zeros + while (Buffer[Count-2] == 0x30) { + Buffer[Count-2] = 0x00; + Count--; + } + // if last character is now a period then delete it too + if (Buffer[Count-2] == '.') { + Buffer[Count-2] = 0x00; + Count--; } } else { - ArgVal2 = cCmdGetScalarValFromDataArg(Arg2, 0); - //Calculate size of array - if (ArgVal2 == 0) - Count = 1; - else { - Count = 0; - SLONG digits= 0; - ULONG Tmp= 1; - if (TypeCode2 == TC_SLONG || TypeCode2 == TC_SWORD || TypeCode2 == TC_SBYTE) + ArgVal2 = cCmdGetScalarValFromDataArg(Arg2, 0); + + // Calculate size of array + if (IS_SIGNED_TYPE(TypeCode2)) { - TmpSLong = (SLONG)ArgVal2; - //Add room for negative sign - if (TmpSLong < 0) { - Count++; - TmpULong= -TmpSLong; - } - else - TmpULong= ArgVal2; + Count = sprintf(Buffer, "%d", (SLONG)ArgVal2); } else - TmpULong= ArgVal2; - - while (Tmp <= TmpULong && digits < 10) { // maxint is ten digits, max - Tmp *= 10; - digits++; + { + Count = sprintf(Buffer, "%u", ArgVal2); } - Count += digits; - } - //add room for NULL terminator - Count++; + + //add room for NULL terminator + Count++; } //Allocate array @@ -4669,18 +5064,7 @@ NXT_STATUS cCmdInterpUnop2(CODE_WORD * const pCode) pArg1 = cCmdResolveDataArg(Arg1, 0, &TypeCode1); //Populate array - if (TypeCode2 == TC_FLOAT) - { - sprintf(pArg1, FormatString, FltArgVal2); - } - else if (TypeCode2 == TC_SLONG || TypeCode2 == TC_SWORD || TypeCode2 == TC_SBYTE) - { - sprintf(pArg1, "%d", (SLONG)ArgVal2); - } - else - { - sprintf(pArg1, "%u", ArgVal2); - } + memcpy(pArg1, Buffer, Count); } break; @@ -4739,7 +5123,7 @@ NXT_STATUS cCmdInterpUnop2(CODE_WORD * const pCode) } break; - default: + default: { //Fatal error: Unrecognized instruction NXT_BREAK; @@ -4772,6 +5156,8 @@ NXT_STATUS cCmdInterpPolyUnop2(CODE_WORD const Code, DATA_ARG Arg1, UWORD Offset TypeCode1 = cCmdDSType(Arg1); TypeCode2 = cCmdDSType(Arg2); + UBYTE opCode = OP_CODE(&Code); + //Simple case, scalar. Solve and return. if (!IS_AGGREGATE_TYPE(TypeCode2)) { @@ -4789,8 +5175,8 @@ NXT_STATUS cCmdInterpPolyUnop2(CODE_WORD const Code, DATA_ARG Arg1, UWORD Offset else { ArgVal2= cCmdGetScalarValFromDataArg(Arg2, Offset2); - if(OP_CODE(&Code) == OP_MOV) - ArgVal1= ArgVal2; + if (opCode == OP_MOV) + ArgVal1 = ArgVal2; else ArgVal1 = cCmdUnop2(Code, ArgVal2, TypeCode2); cCmdSetVal(pArg1, TypeCode1, ArgVal1); @@ -4799,12 +5185,11 @@ NXT_STATUS cCmdInterpPolyUnop2(CODE_WORD const Code, DATA_ARG Arg1, UWORD Offset } //At least one of the args is an aggregate type - - if(TypeCode1 == TC_ARRAY && TypeCode2 == TC_ARRAY) { + if(TypeCode1 == TC_ARRAY && TypeCode2 == TC_ARRAY && opCode == OP_MOV) { TYPE_CODE tc1, tc2; - tc1= cCmdDSType(INC_ID(Arg1)); - tc2= cCmdDSType(INC_ID(Arg2)); - if(tc1 <= TC_LAST_INT_SCALAR && tc1 == tc2) { + tc1 = cCmdDSType(INC_ID(Arg1)); + tc2 = cCmdDSType(INC_ID(Arg2)); + if((tc1 <= TC_LAST_INT_SCALAR || tc1 == TC_FLOAT) && tc1 == tc2) { void *pArg1, *pArg2; ULONG Count = cCmdArrayCount(Arg2, Offset2); Status = cCmdDSArrayAlloc(Arg1, Offset1, Count); @@ -4915,6 +5300,10 @@ ULONG cCmdUnop2(CODE_WORD const Code, ULONG Operand, TYPE_CODE TypeCode) return cCmdCompare(COMP_CODE((&Code)), Operand, 0, TypeCode, TypeCode); else if(opCode == OP_ABS) return abs(Operand); + else if (opCode == OP_CMNT) + return (~Operand); + else if (opCode == OP_SIGN) + return (((SLONG)Operand) < 0) ? -1 : ((Operand == 0) ? 0 : 1); else { //Unrecognized instruction, NXT_BREAK for easy debugging (ERR_INSTR handled in caller) @@ -4923,9 +5312,13 @@ ULONG cCmdUnop2(CODE_WORD const Code, ULONG Operand, TYPE_CODE TypeCode) } } +#define DEG2RAD 0.017453F +#define RAD2DEG 57.29578F + float cCmdUnop2Flt(CODE_WORD const Code, float Operand, TYPE_CODE TypeCode) { UBYTE opCode; + float ip, fp; opCode = OP_CODE((&Code)); if(opCode == OP_MOV) @@ -4940,22 +5333,66 @@ float cCmdUnop2Flt(CODE_WORD const Code, float Operand, TYPE_CODE TypeCode) return cCmdCompareFlt(COMP_CODE((&Code)), Operand, 0, TypeCode, TypeCode); else if(opCode == OP_ABS) return fabsf(Operand); + else if (opCode == OP_SIGN) + return (Operand < 0) ? -1 : ((Operand == 0) ? 0 : 1); else if(opCode == OP_SQRT) - return sqrt(Operand); -#if 0 + return sqrtf(Operand); else if(opCode == OP_SIN) - return sin(Operand); + return sinf(Operand); else if(opCode == OP_COS) - return cos(Operand); + return cosf(Operand); else if(opCode == OP_TAN) - return tan(Operand); + return tanf(Operand); else if(opCode == OP_ASIN) - return asin(Operand); + return asinf(Operand); else if(opCode == OP_ACOS) - return acos(Operand); + return acosf(Operand); else if(opCode == OP_ATAN) - return atan(Operand); -#endif + return atanf(Operand); + else if(opCode == OP_CEIL) + return ceilf(Operand); + else if(opCode == OP_EXP) + return expf(Operand); + else if(opCode == OP_FLOOR) + return floorf(Operand); + else if(opCode == OP_LOG) + return logf(Operand); + else if(opCode == OP_LOG10) + return log10f(Operand); + else if (opCode == OP_TRUNC) + { + modff(Operand, &ip); + return ip; + } + else if (opCode == OP_FRAC) + { + fp = modff(Operand, &ip); + return fp; + } + else if(opCode == OP_SIND) + return sinf((float)Operand*DEG2RAD); + else if(opCode == OP_COSD) + return cosf((float)Operand*DEG2RAD); + else if(opCode == OP_TAND) + return tanf((float)Operand*DEG2RAD); + else if(opCode == OP_ASIND) + return (float)(asinf(Operand)*RAD2DEG); + else if(opCode == OP_ACOSD) + return (float)(acosf(Operand)*RAD2DEG); + else if(opCode == OP_ATAND) + return (float)(atanf(Operand)*RAD2DEG); + else if(opCode == OP_TANH) + return tanhf(Operand); + else if(opCode == OP_COSH) + return coshf(Operand); + else if(opCode == OP_SINH) + return sinhf(Operand); + else if(opCode == OP_TANHD) + return tanhf((float)Operand*DEG2RAD); + else if(opCode == OP_COSHD) + return coshf((float)Operand*DEG2RAD); + else if(opCode == OP_SINHD) + return sinhf((float)Operand*DEG2RAD); else { //Unrecognized instruction, NXT_BREAK for easy debugging (ERR_INSTR handled in caller) @@ -4999,7 +5436,7 @@ NXT_STATUS cCmdIOGetSet(ULONG opCode, DATA_ARG Arg1, DATA_ARG Arg2, DATA_ARG Arg pArg2 = cCmdResolveIODataArg(Arg2, 0, &TypeCode2); TypeCode1= cCmdDSType(Arg1); pArg1= cCmdDSScalarPtr(Arg1, 0); - if(TypeCode1 <= TC_SBYTE && TypeCode1 <= TC_SBYTE) // seems really common + if(TypeCode1 <= TC_SBYTE && TypeCode2 <= TC_SBYTE) // seems really common *(UBYTE*)pArg1= *(UBYTE*)pArg2; else cCmdSetVal(pArg1, TypeCode1, cCmdGetVal(pArg2, TypeCode2)); @@ -5037,12 +5474,12 @@ NXT_STATUS cCmdInterpScalarBinop(CODE_WORD * const pCode) if(TypeCode2 <= TC_LAST_INT_SCALAR && TypeCode3 <= TC_LAST_INT_SCALAR) { ArgVal2= GetProcArray[TypeCode2](VarsCmd.pDataspace + dsTOC2Ptr->DSOffset); ArgVal3= GetProcArray[TypeCode3](VarsCmd.pDataspace + dsTOC3Ptr->DSOffset); - ArgVal1= cCmdCompare(COMP_CODE(pCode), ArgVal2, ArgVal3, TypeCode2, TypeCode3); + ArgVal1= cCmdCompare(COMP_CODE(pCode), ArgVal2, ArgVal3, TypeCode2, TypeCode3); DS_TOC_ENTRY *dsTOC1Ptr= &VarsCmd.pDataspaceTOC[Arg1]; SetProcArray[dsTOC1Ptr->TypeCode](VarsCmd.pDataspace + dsTOC1Ptr->DSOffset, ArgVal1); - scalarCmp++; - Status = NO_ERR; - } + scalarCmp++; + Status = NO_ERR; + } else if (TypeCode2 == TC_ARRAY) // two strings { // memcmp(); here or in compareagg, could use memcmp to speed up string compares ??? @@ -5056,31 +5493,31 @@ NXT_STATUS cCmdInterpScalarBinop(CODE_WORD * const pCode) } } else if(opCode == OP_BRCMP) { // t2 and t3 guaranteed scalar - TYPE_CODE TypeCode2, TypeCode3; - ULONG ArgVal2, ArgVal3; + TYPE_CODE TypeCode2, TypeCode3; + ULONG ArgVal2, ArgVal3; - Arg1 = pCode[1]; - Arg2 = pCode[2]; - Arg3 = pCode[3]; - TypeCode2= cCmdDSType(Arg2); - TypeCode3= cCmdDSType(Arg3); - ArgVal2= cCmdGetScalarValFromDataArg(Arg2, 0); - ArgVal3= cCmdGetScalarValFromDataArg(Arg3, 0); - CmpBool= cCmdCompare(COMP_CODE(pCode), ArgVal2, ArgVal3, TypeCode2, TypeCode3); + Arg1 = pCode[1]; + Arg2 = pCode[2]; + Arg3 = pCode[3]; + TypeCode2= cCmdDSType(Arg2); + TypeCode3= cCmdDSType(Arg3); + ArgVal2= cCmdGetScalarValFromDataArg(Arg2, 0); + ArgVal3= cCmdGetScalarValFromDataArg(Arg3, 0); + CmpBool= cCmdCompare(COMP_CODE(pCode), ArgVal2, ArgVal3, TypeCode2, TypeCode3); - if (CmpBool) - gPCDelta = (SWORD)Arg1; - else - gPCDelta= 4; - Status= NO_ERR; - } + if (CmpBool) + gPCDelta = (SWORD)Arg1; + else + gPCDelta= 4; + Status= NO_ERR; + } else if(opCode >= OP_SETIN && opCode <= OP_GETOUT) { - Arg1 = pCode[1]; - Arg2 = pCode[2]; - Arg3 = pCode[3]; + Arg1 = pCode[1]; + Arg2 = pCode[2]; + Arg3 = pCode[3]; Status= cCmdIOGetSet(opCode, Arg1, Arg2, Arg3); gPCDelta= 4; - } + } else { scalarOther ++; Status= cCmdInterpBinop(pCode); @@ -5098,116 +5535,181 @@ NXT_STATUS cCmdInterpBinop(CODE_WORD * const pCode) UBYTE CmpBool; DV_INDEX DVIndex1, DVIndex2; UWORD i; + void *pArg1 = NULL, *pArg2 = NULL; + UWORD Count; polyBinopDispatch ++; gPCDelta= 4; NXT_ASSERT(pCode != NULL); - opCode = OP_CODE(pCode); - Arg1 = pCode[1]; - Arg2 = pCode[2]; - Arg3 = pCode[3]; + opCode = OP_CODE(pCode); + Arg1 = pCode[1]; + Arg2 = pCode[2]; + Arg3 = pCode[3]; - if (opCode <= OP_XOR) // && ! OP_NEG, can't happen since it is unop + if ((opCode <= OP_XOR) || + (opCode >= OP_LSL && opCode <= OP_ROTR) || + (opCode == OP_ATAN2) || (opCode == OP_POW) || (opCode == OP_ATAN2D)) // && ! OP_NEG, can't happen since it is unop Status= cCmdInterpPolyBinop(opCode, Arg1, 0, Arg2, 0, Arg3, 0); else if(opCode >= OP_SETIN && opCode <= OP_GETOUT) Status= cCmdIOGetSet(opCode, Arg1, Arg2, Arg3); else { - switch (opCode) - { - case OP_CMP: + switch (opCode) { + case OP_CMP: + { + TYPE_CODE TypeCode2= cCmdDSType(Arg2), TypeCode3= cCmdDSType(Arg3); + if(TypeCode2 <= TC_LAST_INT_SCALAR && TypeCode3 <= TC_LAST_INT_SCALAR) { + ULONG ArgVal1, ArgVal2, ArgVal3; + ArgVal2= cCmdGetScalarValFromDataArg(Arg2, 0); + ArgVal3= cCmdGetScalarValFromDataArg(Arg3, 0); + ArgVal1= cCmdCompare(COMP_CODE(pCode), ArgVal2, ArgVal3, TypeCode2, TypeCode3); + cCmdSetScalarValFromDataArg(Arg1, ArgVal1); + PolyScalarCmp++; + } + else if (IS_AGGREGATE_TYPE(TypeCode2) && IS_AGGREGATE_TYPE(TypeCode3) && !IS_AGGREGATE_TYPE(cCmdDSType(Arg1))) + { + //Compare Aggregates + Status = cCmdCompareAggregates(COMP_CODE(pCode), &CmpBool, Arg2, 0, Arg3, 0); + cCmdSetScalarValFromDataArg(Arg1, CmpBool); + recursiveCmp++; + } + else + { + //Compare Elements + Status = cCmdInterpPolyBinop(*pCode, Arg1, 0, Arg2, 0, Arg3, 0); + polyPolyCmp++; + } + } + break; + + case OP_BRCMP: + { TYPE_CODE TypeCode2= cCmdDSType(Arg2), TypeCode3= cCmdDSType(Arg3); - if(TypeCode2 <= TC_LAST_INT_SCALAR && TypeCode3 <= TC_LAST_INT_SCALAR) { - ULONG ArgVal1, ArgVal2, ArgVal3; + if(TypeCode2 <= TC_LAST_INT_SCALAR && TypeCode3 <= TC_LAST_INT_SCALAR) { + ULONG ArgVal2, ArgVal3; ArgVal2= cCmdGetScalarValFromDataArg(Arg2, 0); ArgVal3= cCmdGetScalarValFromDataArg(Arg3, 0); - ArgVal1= cCmdCompare(COMP_CODE(pCode), ArgVal2, ArgVal3, TypeCode2, TypeCode3); - cCmdSetScalarValFromDataArg(Arg1, ArgVal1); - PolyScalarCmp++; + CmpBool= cCmdCompare(COMP_CODE(pCode), ArgVal2, ArgVal3, TypeCode2, TypeCode3); } - else if (IS_AGGREGATE_TYPE(TypeCode2) && IS_AGGREGATE_TYPE(TypeCode3) && !IS_AGGREGATE_TYPE(cCmdDSType(Arg1))) - { - //Compare Aggregates + else //Compare Aggregates Status = cCmdCompareAggregates(COMP_CODE(pCode), &CmpBool, Arg2, 0, Arg3, 0); - cCmdSetScalarValFromDataArg(Arg1, CmpBool); - recursiveCmp++; + + if (CmpBool) + gPCDelta = (SWORD)Arg1; } - else + break; + + case OP_INDEX: { - //Compare Elements - Status = cCmdInterpPolyBinop(*pCode, Arg1, 0, Arg2, 0, Arg3, 0); - polyPolyCmp++; - } - } - break; - - case OP_BRCMP: - { - TYPE_CODE TypeCode2= cCmdDSType(Arg2), TypeCode3= cCmdDSType(Arg3); - if(TypeCode2 <= TC_LAST_INT_SCALAR && TypeCode3 <= TC_LAST_INT_SCALAR) { - ULONG ArgVal2, ArgVal3; - ArgVal2= cCmdGetScalarValFromDataArg(Arg2, 0); - ArgVal3= cCmdGetScalarValFromDataArg(Arg3, 0); - CmpBool= cCmdCompare(COMP_CODE(pCode), ArgVal2, ArgVal3, TypeCode2, TypeCode3); + ArgVal3 = (Arg3 != NOT_A_DS_ID) ? cCmdGetScalarValFromDataArg(Arg3, 0) : 0; + + DVIndex2 = cCmdGetDVIndex(Arg2, 0); + if (ArgVal3 >= DV_ARRAY[DVIndex2].Count) + return (ERR_ARG); + + Status = cCmdInterpPolyUnop2(OP_MOV, Arg1, 0, INC_ID(Arg2), ARRAY_ELEM_OFFSET(DVIndex2, ArgVal3)); } - else //Compare Aggregates - Status = cCmdCompareAggregates(COMP_CODE(pCode), &CmpBool, Arg2, 0, Arg3, 0); - - if (CmpBool) - gPCDelta = (SWORD)Arg1; - } - break; - - case OP_INDEX: - { - ArgVal3 = (Arg3 != NOT_A_DS_ID) ? cCmdGetScalarValFromDataArg(Arg3, 0) : 0; - - DVIndex2 = cCmdGetDVIndex(Arg2, 0); - if (ArgVal3 >= DV_ARRAY[DVIndex2].Count) - return (ERR_ARG); - - Status = cCmdInterpPolyUnop2(OP_MOV, Arg1, 0, INC_ID(Arg2), ARRAY_ELEM_OFFSET(DVIndex2, ArgVal3)); - } - break; - - case OP_ARRINIT: - { - //Arg1 - Dst, Arg2 - element type/default val, Arg3 - length - + break; + + case OP_ARRINIT: + { + //Arg1 - Dst, Arg2 - element type/default val, Arg3 - length + NXT_ASSERT(cCmdDSType(Arg1) == TC_ARRAY); - + + // determine the type of the array destination arg + TYPE_CODE TypeCode = cCmdDSType(INC_ID(Arg1)); + + // How many elements do we want? ArgVal3 = (Arg3 != NOT_A_DS_ID) ? cCmdGetScalarValFromDataArg(Arg3, 0) : 0; - - Status = cCmdDSArrayAlloc(Arg1, 0, (UWORD)ArgVal3); + + Status = cCmdDSArrayAlloc(Arg1, 0, (UWORD)ArgVal3); if (!IS_ERR(Status)) { - DVIndex1 = cCmdGetDVIndex(Arg1, 0); - if(cCmdDSType(Arg2) <= TC_LAST_INT_SCALAR) + DVIndex1 = cCmdGetDVIndex(Arg1, 0); + if(cCmdDSType(Arg2) <= TC_LAST_INT_SCALAR && TypeCode <= TC_LAST_INT_SCALAR) { ULONG val= cCmdGetScalarValFromDataArg(Arg2, 0); - TYPE_CODE TypeCode= cCmdDSType(INC_ID(Arg1)); for (i = 0; i < ArgVal3; i++) // could init ptr and incr by offset GM??? - { - //copy Arg2 into each element of Arg1 + { + //copy Arg2 into each element of Arg1 cCmdSetVal(VarsCmd.pDataspace + ARRAY_ELEM_OFFSET(DVIndex1, i), TypeCode, val); } } else for (i = 0; i < ArgVal3; i++) //copy Arg2 into each element of Arg1 - Status = cCmdInterpPolyUnop2(OP_MOV, INC_ID(Arg1), ARRAY_ELEM_OFFSET(DVIndex1, i), Arg2, 0); + Status = cCmdInterpPolyUnop2(OP_MOV, INC_ID(Arg1), ARRAY_ELEM_OFFSET(DVIndex1, i), Arg2, 0); + } } - } - break; + break; + + case OP_FMTNUM: + { + //Check that the destination is a string (array of bytes) + if (cCmdDSType(Arg1) != TC_ARRAY || cCmdDSType(INC_ID(Arg1)) != TC_UBYTE) { + Status = ERR_INSTR; + return (Status); + } + + //Check that the format is a string (array of bytes) + if (cCmdDSType(Arg2) != TC_ARRAY || cCmdDSType(INC_ID(Arg2)) != TC_UBYTE) { + Status = ERR_INSTR; + return (Status); + } + + pArg2 = cCmdResolveDataArg(Arg2, 0, NULL); + TYPE_CODE TypeCode3 = cCmdDSType(Arg3); - default: - { - //Fatal error: Unrecognized instruction - NXT_BREAK; - Status = ERR_INSTR; + //Make sure we're trying to convert a scalar/float to a string + if (TypeCode3 == TC_VOID || (TypeCode3 > TC_LAST_INT_SCALAR && TypeCode3 != TC_FLOAT)) { + Status = ERR_INSTR; + return (Status); + } + + char fmtBuf[256]; // arbitrary limit!!! + // handle floats separately from scalar types + if (TypeCode3 == TC_FLOAT) { + float FltArgVal3 = cCmdGetFloatValFromDataArg(Arg3, 0); + Count = sprintf(fmtBuf, pArg2, FltArgVal3); + } + else + { + ArgVal3 = cCmdGetScalarValFromDataArg(Arg3, 0); + // Calculate size of array + if (IS_SIGNED_TYPE(TypeCode3)) + { + Count = sprintf(fmtBuf, pArg2, (SLONG)ArgVal3); + } + else + { + Count = sprintf(fmtBuf, pArg2, ArgVal3); + } + } + + //add room for NULL terminator + Count++; + + //Allocate array + Status = cCmdDSArrayAlloc(Arg1, 0, Count); + if (IS_ERR(Status)) + return Status; + + pArg1 = cCmdResolveDataArg(Arg1, 0, NULL); + + //Populate array + memcpy(pArg1, fmtBuf, Count); + } + break; + + default: + { + //Fatal error: Unrecognized instruction + NXT_BREAK; + Status = ERR_INSTR; + } + break; } - break; - } } return (Status); } @@ -5252,10 +5754,10 @@ NXT_STATUS cCmdInterpPolyBinop(CODE_WORD const Code, DATA_ARG Arg1, UWORD Offset } else { - ArgVal2 = cCmdGetScalarValFromDataArg(Arg2, Offset2); - ArgVal3 = cCmdGetScalarValFromDataArg(Arg3, Offset3); - ArgVal1 = cCmdBinop(Code, ArgVal2, ArgVal3, TypeCode2, TypeCode3); - cCmdSetVal(pArg1, TypeCode1, ArgVal1); + ArgVal2 = cCmdGetScalarValFromDataArg(Arg2, Offset2); + ArgVal3 = cCmdGetScalarValFromDataArg(Arg3, Offset3); + ArgVal1 = cCmdBinop(Code, ArgVal2, ArgVal3, TypeCode2, TypeCode3); + cCmdSetVal(pArg1, TypeCode1, ArgVal1); } return Status; } @@ -5434,7 +5936,7 @@ ULONG cCmdBinop(CODE_WORD const Code, ULONG LeftOp, ULONG RightOp, TYPE_CODE Lef case OP_XOR: { - return ((LeftOp | RightOp) & (~(LeftOp & RightOp))); + return ((LeftOp | RightOp) & (~(LeftOp & RightOp))); // LeftOp ^ RightOp } case OP_CMP: @@ -5442,6 +5944,70 @@ ULONG cCmdBinop(CODE_WORD const Code, ULONG LeftOp, ULONG RightOp, TYPE_CODE Lef return cCmdCompare(COMP_CODE((&Code)), LeftOp, RightOp, LeftType, RightType); } + case OP_LSL: + { + if (((SLONG)RightOp) <= 0) + return LeftOp; // negative shifts == shifting by zero + else + return LeftOp << RightOp; + } + + case OP_LSR: + { + if (((SLONG)RightOp) <= 0) + return LeftOp; // negative shifts == shifting by zero + else + return LeftOp >> RightOp; + } + + case OP_ASL: + { + if (((SLONG)RightOp) <= 0) + return LeftOp; // negative shifts == shifting by zero + else if (!IS_SIGNED_TYPE(LeftType)) + return LeftOp << RightOp; + else + return LeftOp * (1 << RightOp); + } + + case OP_ASR: + { + if (((SLONG)RightOp) <= 0) + return LeftOp; // negative shifts == shifting by zero + else if (!IS_SIGNED_TYPE(LeftType)) + return LeftOp >> RightOp; + else + return ((SLONG)LeftOp) / (1 << RightOp); + } + + case OP_ROTL: + { + if (((SLONG)RightOp) <= 0) + return LeftOp; // negative rotates == rotating by zero + else { + if (LeftType == TC_ULONG || LeftType == TC_SLONG) + return (LeftOp << RightOp) | (LeftOp >> (32 - RightOp)); + else if (LeftType == TC_UWORD || LeftType == TC_SWORD) + return (((UWORD)LeftOp) << RightOp) | (((UWORD)LeftOp) >> (16 - RightOp)); + else if (LeftType == TC_UBYTE || LeftType == TC_SBYTE) + return (((UBYTE)LeftOp) << RightOp) | (((UBYTE)LeftOp) >> (8 - RightOp)); + } + } + + case OP_ROTR: + { + if (((SLONG)RightOp) <= 0) + return LeftOp; // negative rotates == rotating by zero + else { + if (LeftType == TC_ULONG || LeftType == TC_SLONG) + return (LeftOp >> RightOp) | (LeftOp << (32 - RightOp)); + else if (LeftType == TC_UWORD || LeftType == TC_SWORD) + return (((UWORD)LeftOp) >> RightOp) | (((UWORD)LeftOp) << (16 - RightOp)); + else if (LeftType == TC_UBYTE || LeftType == TC_SBYTE) + return (((UBYTE)LeftOp) >> RightOp) | (((UBYTE)LeftOp) << (8 - RightOp)); + } + } + default: { //Unrecognized instruction, NXT_BREAK for easy debugging (ERR_INSTR handled in caller) @@ -5491,7 +6057,7 @@ float cCmdBinopFlt(CODE_WORD const Code, float LeftOp, float RightOp, TYPE_CODE if (RightOp == 0) return (LeftOp); - return (SLONG)LeftOp % (SLONG)RightOp; + return fmodf(LeftOp, RightOp); } case OP_AND: @@ -5514,6 +6080,26 @@ float cCmdBinopFlt(CODE_WORD const Code, float LeftOp, float RightOp, TYPE_CODE return cCmdCompareFlt(COMP_CODE((&Code)), LeftOp, RightOp, LeftType, RightType); } + case OP_ATAN2: + { + return atan2f(LeftOp, RightOp); + } + + case OP_POW: + { + float intpart, fracpart; + fracpart = modff(LeftOp, &intpart); + if (LeftOp < 0 && fracpart != 0) + return 0; // make the result zero if you try to raise a negative number to a fractional exponent + else + return powf(LeftOp, RightOp); + } + + case OP_ATAN2D: + { + return (float)(atan2f(LeftOp, RightOp)*RAD2DEG); + } + default: { //Unrecognized instruction, NXT_BREAK for easy debugging (ERR_INSTR handled in caller) @@ -5560,13 +6146,15 @@ NXT_STATUS cCmdInterpShortSubCall(CODE_WORD * const pCode) return Status; } -ULONG moveSameInt= 0, moveDiffInt= 0, moveFloat= 0, moveArrInt= 0, moveOther= 0; +ULONG moveSameInt= 0, moveDiffInt= 0, moveFloat= 0, moveIntFloat= 0, moveFloatInt= 0, moveArrInt= 0, moveOther= 0; NXT_STATUS cCmdMove(DATA_ARG Arg1, DATA_ARG Arg2) { NXT_STATUS Status; DS_TOC_ENTRY *TOC1Ptr= &VarsCmd.pDataspaceTOC[Arg1], *TOC2Ptr= &VarsCmd.pDataspaceTOC[Arg2]; TYPE_CODE tc1= TOC1Ptr->TypeCode, tc2= TOC2Ptr->TypeCode; + UBYTE ElemSize1 = cCmdSizeOf((TOC1Ptr+1)->TypeCode), + ElemSize2 = cCmdSizeOf((TOC2Ptr+1)->TypeCode); void *pArg1, *pArg2; if(tc1 <= TC_LAST_INT_SCALAR && tc2 <= TC_LAST_INT_SCALAR) @@ -5585,7 +6173,7 @@ NXT_STATUS cCmdMove(DATA_ARG Arg1, DATA_ARG Arg2) *(UWORD*)pArg1= *(UWORD*)pArg2; Status= NO_ERR; } - else + else { moveDiffInt++; ULONG val= cCmdGetScalarValFromDataArg(Arg2, 0); @@ -5593,17 +6181,53 @@ NXT_STATUS cCmdMove(DATA_ARG Arg1, DATA_ARG Arg2) Status= NO_ERR; } } - else if(tc1 == TC_FLOAT && tc2 == TC_FLOAT) { // may also need to speed up float to int and int to float conversions + else if(tc1 == TC_FLOAT && tc2 == TC_FLOAT) { moveFloat++; pArg1= VarsCmd.pDataspace + TOC1Ptr->DSOffset; pArg2= VarsCmd.pDataspace + TOC2Ptr->DSOffset; *(float*)pArg1= *(float*)pArg2; Status= NO_ERR; } - //!!! Optimized move for arrays of ints. - else if ((tc1 == TC_ARRAY) && (tc2 == TC_ARRAY) - && ((TOC1Ptr+1)->TypeCode <= TC_LAST_INT_SCALAR) - && ((TOC1Ptr+1)->TypeCode == (TOC2Ptr+1)->TypeCode)) + else if(tc1 == TC_FLOAT && tc2 <= TC_LAST_INT_SCALAR) { // int to float + moveIntFloat++; + pArg1= VarsCmd.pDataspace + TOC1Ptr->DSOffset; + pArg2= VarsCmd.pDataspace + TOC2Ptr->DSOffset; + if (tc2 == TC_SLONG) + *(float*)pArg1 = *(SLONG*)pArg2; + else if (tc2 == TC_ULONG) + *(float*)pArg1 = *(ULONG*)pArg2; + else if (tc2 == TC_SBYTE) + *(float*)pArg1 = *(SBYTE*)pArg2; + else if (tc2 == TC_UBYTE) + *(float*)pArg1 = *(UBYTE*)pArg2; + else if (tc2 == TC_UWORD) + *(float*)pArg1 = *(UWORD*)pArg2; + else + *(float*)pArg1= *(SWORD*)pArg2; + Status= NO_ERR; + } + else if(tc2 == TC_FLOAT && tc1 <= TC_LAST_INT_SCALAR) { // float to int + moveFloatInt++; + pArg1= VarsCmd.pDataspace + TOC1Ptr->DSOffset; + pArg2= VarsCmd.pDataspace + TOC2Ptr->DSOffset; + if (tc1 == TC_SLONG) + *(SLONG*)pArg1 = *(float*)pArg2; + else if (tc1 == TC_ULONG) + *(ULONG*)pArg1 = *(float*)pArg2; + else if (tc1 == TC_SBYTE) + *(SBYTE*)pArg1 = *(float*)pArg2; + else if (tc1 == TC_UBYTE) + *(UBYTE*)pArg1 = *(float*)pArg2; + else if (tc1 == TC_UWORD) + *(UWORD*)pArg1 = *(float*)pArg2; + else + *(SWORD*)pArg1 = *(float*)pArg2; + Status= NO_ERR; + } + //!!! Optimized move for arrays of ints and floats. + else if ((tc1 == TC_ARRAY) && (tc2 == TC_ARRAY) && + (((TOC1Ptr+1)->TypeCode <= TC_LAST_INT_SCALAR && ElemSize1 == ElemSize2) || + ((TOC1Ptr+1)->TypeCode == TC_FLOAT && (TOC2Ptr+1)->TypeCode == TC_FLOAT))) { ULONG Count; moveArrInt++; @@ -5669,6 +6293,23 @@ NXT_STATUS cCmdInterpShortRelease(CODE_WORD * const pCode) } +ULONG cCmdGetPortFromValue(ULONG val, ULONG i) +{ + ULONG result = NO_OF_OUTPUTS; // invalid NO-OP output + if (val < NO_OF_OUTPUTS) + result = val; + else + { + if (val <= RC_OUT_ABC) + { + result = i; + if ((val == RC_OUT_BC) || (val == RC_OUT_AC && i)) + result++; + } + } + return result; +} + //OP_SETOUT gets it's own interpreter function because it is relatively complex // (called from cCmdInterpOther()) //This also serves as a convenient breakpoint stop for investigating output module behavior @@ -5680,7 +6321,7 @@ NXT_STATUS cCmdExecuteSetOut(CODE_WORD * const pCode) *pPort = NULL; DS_ELEMENT_ID PortArg; UWORD PortCount, InstrSize; - ULONG Port, FieldTableIndex, i, j; + ULONG Port, FieldTableIndex, i, j, val = 0; DV_INDEX DVIndex; //Arg1 = InstrSize @@ -5702,7 +6343,17 @@ NXT_STATUS cCmdExecuteSetOut(CODE_WORD * const pCode) PortCount = cCmdArrayCount(PortArg, 0); } else - PortCount = 1; + { + // arg may refer to multiple ports + // (0, 1, 2 are single ports; + val = cCmdGetScalarValFromDataArg(PortArg, 0); + if (val < NO_OF_OUTPUTS) + PortCount = 1; + else if (val < RC_OUT_ABC) + PortCount = 2; + else + PortCount = 3; + } //For each port, process all the tuples for (i = 0; i < PortCount; i++) @@ -5714,7 +6365,7 @@ NXT_STATUS cCmdExecuteSetOut(CODE_WORD * const pCode) } else { - Port = cCmdGetScalarValFromDataArg(PortArg, 0); + Port = cCmdGetPortFromValue(val, i); } //If user specified a valid port, process the tuples. Else, this port is a no-op @@ -5743,6 +6394,174 @@ NXT_STATUS cCmdExecuteSetOut(CODE_WORD * const pCode) } +void shell_sort_u1(UBYTE* A, UWORD size) +{ + UWORD i, j, increment; + UBYTE temp; + increment = size / 2; + + while (increment > 0) { + for (i = increment; i < size; i++) { + j = i; + temp = A[i]; + while ((j >= increment) && (A[j-increment] > temp)) { + A[j] = A[j - increment]; + j = j - increment; + } + A[j] = temp; + } + + if (increment == 2) + increment = 1; + else + increment = (UWORD)((float)increment / (float)2.2); + } +} + +void shell_sort_s1(SBYTE* A, UWORD size) +{ + UWORD i, j, increment; + SBYTE temp; + increment = size / 2; + + while (increment > 0) { + for (i = increment; i < size; i++) { + j = i; + temp = A[i]; + while ((j >= increment) && (A[j-increment] > temp)) { + A[j] = A[j - increment]; + j = j - increment; + } + A[j] = temp; + } + + if (increment == 2) + increment = 1; + else + increment = (UWORD)((float)increment / (float)2.2); + } +} + +void shell_sort_u2(UWORD* A, UWORD size) +{ + UWORD i, j, increment; + UWORD temp; + increment = size / 2; + + while (increment > 0) { + for (i = increment; i < size; i++) { + j = i; + temp = A[i]; + while ((j >= increment) && (A[j-increment] > temp)) { + A[j] = A[j - increment]; + j = j - increment; + } + A[j] = temp; + } + + if (increment == 2) + increment = 1; + else + increment = (UWORD)((float)increment / (float)2.2); + } +} + +void shell_sort_s2(SWORD* A, UWORD size) +{ + UWORD i, j, increment; + SWORD temp; + increment = size / 2; + + while (increment > 0) { + for (i = increment; i < size; i++) { + j = i; + temp = A[i]; + while ((j >= increment) && (A[j-increment] > temp)) { + A[j] = A[j - increment]; + j = j - increment; + } + A[j] = temp; + } + + if (increment == 2) + increment = 1; + else + increment = (UWORD)((float)increment / (float)2.2); + } +} + +void shell_sort_u4(ULONG* A, UWORD size) +{ + UWORD i, j, increment; + ULONG temp; + increment = size / 2; + + while (increment > 0) { + for (i = increment; i < size; i++) { + j = i; + temp = A[i]; + while ((j >= increment) && (A[j-increment] > temp)) { + A[j] = A[j - increment]; + j = j - increment; + } + A[j] = temp; + } + + if (increment == 2) + increment = 1; + else + increment = (UWORD)((float)increment / (float)2.2); + } +} + +void shell_sort_s4(SLONG* A, UWORD size) +{ + UWORD i, j, increment; + SLONG temp; + increment = size / 2; + + while (increment > 0) { + for (i = increment; i < size; i++) { + j = i; + temp = A[i]; + while ((j >= increment) && (A[j-increment] > temp)) { + A[j] = A[j - increment]; + j = j - increment; + } + A[j] = temp; + } + + if (increment == 2) + increment = 1; + else + increment = (UWORD)((float)increment / (float)2.2); + } +} + +void shell_sort_flt(float* A, UWORD size) +{ + UWORD i, j, increment; + float temp; + increment = size / 2; + + while (increment > 0) { + for (i = increment; i < size; i++) { + j = i; + temp = A[i]; + while ((j >= increment) && (A[j-increment] > temp)) { + A[j] = A[j - increment]; + j = j - increment; + } + A[j] = temp; + } + + if (increment == 2) + increment = 1; + else + increment = (UWORD)((float)increment / (float)2.2); + } +} + NXT_STATUS cCmdInterpOther(CODE_WORD * const pCode) { NXT_STATUS Status = NO_ERR; @@ -5783,6 +6602,7 @@ NXT_STATUS cCmdInterpOther(CODE_WORD * const pCode) //Arg2 - Src //Arg3 - Index //Arg4 - New val / array of vals + UWORD SrcDims, NewValDims; Arg1 = pCode[1]; Arg2 = pCode[2]; @@ -5796,7 +6616,8 @@ NXT_STATUS cCmdInterpOther(CODE_WORD * const pCode) //!!! Could avoid full data copy if we knew which portion to overwrite if (Arg1 != Arg2) { - Status= cCmdMove(Arg1, Arg2); +// Status= cCmdMove(Arg1, Arg2); + Status = cCmdInterpPolyUnop2(OP_MOV, Arg1, 0, Arg2, 0); if (IS_ERR(Status)) return Status; } @@ -5820,13 +6641,17 @@ NXT_STATUS cCmdInterpOther(CODE_WORD * const pCode) if (ArgVal3 >= ArrayCount1) return (NO_ERR); - if (cCmdDSType(Arg4) != TC_ARRAY) + SrcDims = cCmdArrayDimensions(Arg2); + NewValDims = cCmdArrayDimensions(Arg4); + // if the new value argument has an array dimension that is 1 less than + // the array dimension of the source array then use MOV to copy data + if (NewValDims == (SrcDims-1)) { Status = cCmdInterpPolyUnop2(OP_MOV, INC_ID(Arg1), ARRAY_ELEM_OFFSET(DVIndex1, ArgVal3), Arg4, 0); if (IS_ERR(Status)) return Status; } - else + else if (NewValDims == SrcDims) { DVIndex4 = cCmdGetDVIndex(Arg4, 0); @@ -5843,6 +6668,12 @@ NXT_STATUS cCmdInterpOther(CODE_WORD * const pCode) return Status; } } + else + { + // any other situation is unsupported + NXT_BREAK; + return 0; + } } break; @@ -6205,6 +7036,7 @@ NXT_STATUS cCmdInterpOther(CODE_WORD * const pCode) case OP_STRINGTONUM: { + ULONG ArgVal1; float ArgValF; SLONG decimals= 0; UBYTE cont= TRUE; @@ -6214,10 +7046,6 @@ NXT_STATUS cCmdInterpOther(CODE_WORD * const pCode) // Arg4 - Offset // Arg5 - Default (type/value) - //!!! Currently, both outputs must have valid destinations. - // It would be trivial to handle NOT_A_DS_ID to avoid dummy - // allocations when outputs are unused. - Arg1 = pCode[1]; Arg2 = pCode[2]; Arg3 = pCode[3]; @@ -6243,113 +7071,437 @@ NXT_STATUS cCmdInterpOther(CODE_WORD * const pCode) } //Read number from string - if (sscanf(((PSZ)pArg3 + ArgVal4), "%f", &ArgValF) == 1) + // scan either to integer or float, depending on TypeCode1 + int scanResult; + if (TypeCode1 == TC_FLOAT) + scanResult = sscanf(((PSZ)pArg3 + ArgVal4), "%f", &ArgValF); + else + scanResult = sscanf(((PSZ)pArg3 + ArgVal4), "%d", &ArgVal1); + // check the result + if (scanResult == 1) { - i = (UWORD)ArgVal4; - //Scan until we see the number, consumes negative sign too - while ((((UBYTE *)pArg3)[i] < '0') || (((UBYTE *)pArg3)[i] > '9')) - i++; - - //Scan until we get past the number and no more than one decimal - while (cont) { - if ((((UBYTE *)pArg3)[i] >= '0') && (((UBYTE *)pArg3)[i] <= '9')) - i++; - else if(((UBYTE *)pArg3)[i] == '.' && !decimals) { + if (Arg2 != NOT_A_DS_ID) + { + i = (UWORD)ArgVal4; + //Scan until we see the number, consumes negative sign too + while ((((UBYTE *)pArg3)[i] < '0') || (((UBYTE *)pArg3)[i] > '9')) i++; - decimals++; + + if (TypeCode1 == TC_FLOAT) + { + //Scan until we get past the number and no more than one decimal + while (cont) { + if ((((UBYTE *)pArg3)[i] >= '0') && (((UBYTE *)pArg3)[i] <= '9')) + i++; + else if(((UBYTE *)pArg3)[i] == '.' && !decimals) { + i++; + decimals++; + } + else + cont= FALSE; } - else - cont= FALSE; + } + else { + //Scan until we get past the number + while ((((UBYTE *)pArg3)[i] >= '0') && (((UBYTE *)pArg3)[i] <= '9')) + i++; + } + ArgVal2 = i; } - ArgVal2 = i; } else { //Number wasn't found in string, use defaults ArgValF = ArgVal5; + ArgVal1 = ArgVal5; ArgVal2 = 0; } //Set outputs - cCmdSetValFlt(pArg1, TypeCode1, ArgValF); - cCmdSetScalarValFromDataArg(Arg2, ArgVal2); + if (TypeCode1 == TC_FLOAT) + cCmdSetValFlt(pArg1, TypeCode1, ArgValF); + else + cCmdSetVal(pArg1, TypeCode1, ArgVal1); + if (Arg2 != NOT_A_DS_ID) + cCmdSetScalarValFromDataArg(Arg2, ArgVal2); } break; - default: + case OP_ARROP: { - //Fatal error: Unrecognized instruction - NXT_BREAK; - Status = ERR_INSTR; - } - break; - } - - return (Status); -} + //Arg1 - Command (immediate constant) + //Arg2 - Dst (scalar|array) + //Arg3 - Src (scalar array) + //Arg4 - Index + //Arg5 - Length + Arg1 = pCode[1]; + Arg2 = pCode[2]; + Arg3 = pCode[3]; + Arg4 = pCode[4]; + Arg5 = pCode[5]; -// -//Support functions for lowspeed (I2C devices, i.e. ultrasonic sensor) communications -// + // array operation + if (Arg1 == OPARR_SORT) { + // source must be an array of non-aggregate type + NXT_ASSERT(cCmdDSType(Arg2) == TC_ARRAY); + TypeCode2 = cCmdDSType(INC_ID(Arg2)); + NXT_ASSERT(!IS_AGGREGATE_TYPE(TypeCode2)); + } + else { + // destination must be a non-aggregate type + NXT_ASSERT(!IS_AGGREGATE_TYPE(cCmdDSType(Arg2))); + } + // source must be an array of non-aggregate type + NXT_ASSERT(cCmdDSType(Arg3) == TC_ARRAY); + TypeCode3 = cCmdDSType(INC_ID(Arg3)); + NXT_ASSERT(!IS_AGGREGATE_TYPE(TypeCode3)); -//Simple lookup table for pMapLowSpeed->ChannelState[Port] values -//This is used to keep VM status code handling consistent -//...and ChannelState gives us too much information, anyway... -static const NXT_STATUS MapLStoVMStat[6] = -{ - NO_ERR, //LOWSPEED_IDLE, - STAT_COMM_PENDING, //LOWSPEED_INIT, - STAT_COMM_PENDING, //LOWSPEED_LOAD_BUFFER, - STAT_COMM_PENDING, //LOWSPEED_COMMUNICATING, - ERR_COMM_BUS_ERR, //LOWSPEED_ERROR, - STAT_COMM_PENDING, //LOWSPEED_DONE (really means c_lowspeed state machine is resetting) -}; + ArrayCount3 = cCmdArrayCount(Arg3, 0); + if (Arg4 != NOT_A_DS_ID) + ArgVal4 = cCmdGetScalarValFromDataArg(Arg4, 0); + else //Index input unwired + ArgVal4 = 0; -//cCmdLSCheckStatus -//Check lowspeed port status, optionally returning bytes available in the buffer for reading -NXT_STATUS cCmdLSCheckStatus(UBYTE Port) -{ - if (Port >= NO_OF_LOWSPEED_COM_CHANNEL) - { - return (ERR_COMM_CHAN_INVALID); - } + if (Arg5 != NOT_A_DS_ID) + ArgVal5 = cCmdGetScalarValFromDataArg(Arg5, 0); + else //Length input unwired, set to "rest" + ArgVal5 = 0xFFFF; - //If port is not configured properly ahead of time, report that error - //!!! This seems like the right policy, but may restrict otherwise valid read operations... - if (!(pMapInput->Inputs[Port].SensorType == LOWSPEED_9V || pMapInput->Inputs[Port].SensorType == LOWSPEED) - || !(pMapInput->Inputs[Port].InvalidData == FALSE)) - { - return (ERR_COMM_CHAN_NOT_READY); - } + //Bounds check + if (ArgVal4 > ArrayCount3) + { + if (Arg1 == OPARR_SORT) { + //Illegal range - return empty subset + Status = cCmdDSArrayAlloc(Arg2, 0, 0); + return Status; + } + else { + //Illegal range - return zero + pArg2 = cCmdResolveDataArg(Arg2, 0, &TypeCode2); + cCmdSetVal(pArg2, TypeCode2, 0); + return NO_ERR; + } + } - return (MapLStoVMStat[pMapLowSpeed->ChannelState[Port]]); -} + //Set MinCount to "rest" + MinCount = (UWORD)(ArrayCount3 - ArgVal4); -//cCmdLSCalcBytesReady -//Calculate true number of bytes available in the inbound LS buffer -UBYTE cCmdLSCalcBytesReady(UBYTE Port) -{ - SLONG Tmp; + // Copy "Length" if it is less than "rest" + if (ArgVal5 < (ULONG)MinCount) + MinCount = (UWORD)ArgVal5; - //Expect callers to validate Port, but short circuit here to be safe. - if (Port >= NO_OF_LOWSPEED_COM_CHANNEL) - return 0; + DV_INDEX DVIndex3 = cCmdGetDVIndex(Arg3, 0); - //Normally, bytes available is a simple difference. - Tmp = pMapLowSpeed->InBuf[Port].InPtr - pMapLowSpeed->InBuf[Port].OutPtr; + SLONG sval, svaltmp; + ULONG uval, uvaltmp; + float numElements = (float)MinCount; + //sum elements from src subset to dst + if ((Arg1 == OPARR_SUM) || (Arg1 == OPARR_MEAN) || + (Arg1 == OPARR_SUMSQR) || (Arg1 == OPARR_STD)) + { + pArg2 = cCmdResolveDataArg(Arg2, 0, &TypeCode2); + if (IS_SIGNED_TYPE(TypeCode3) && (Arg1 != OPARR_SUMSQR)) + { + sval = 0; + for (i = 0; i < MinCount; i++) + { + pArg3 = cCmdResolveDataArg(INC_ID(Arg3), ARRAY_ELEM_OFFSET(DVIndex3, ArgVal4 + i), NULL); + svaltmp = (SLONG)cCmdGetVal(pArg3, TypeCode3); + sval += svaltmp; + } + if (Arg1 == OPARR_MEAN) + cCmdSetVal(pArg2, TypeCode2, (SLONG)(float)sval/numElements); + else if (Arg1 != OPARR_STD) + cCmdSetVal(pArg2, TypeCode2, sval); + } + else + { + uval = 0; + for (i = 0; i < MinCount; i++) + { + pArg3 = cCmdResolveDataArg(INC_ID(Arg3), ARRAY_ELEM_OFFSET(DVIndex3, ArgVal4 + i), NULL); + if (IS_SIGNED_TYPE(TypeCode3)) + { + // this can only be the SUMSQR operation (given the IF statement above) + svaltmp = cCmdGetVal(pArg3, TypeCode3); + uvaltmp = (ULONG)abs(svaltmp) * (ULONG)abs(svaltmp); + uval += uvaltmp; + } + else { + uvaltmp = cCmdGetVal(pArg3, TypeCode3); + if (Arg1 == OPARR_SUMSQR) + uvaltmp *= uvaltmp; + uval += uvaltmp; + } + } + if (Arg1 == OPARR_MEAN) + cCmdSetVal(pArg2, TypeCode2, (ULONG)(float)uval/numElements); + else if (Arg1 != OPARR_STD) + cCmdSetVal(pArg2, TypeCode2, uval); + } + // calculate standard deviation + if (Arg1 == OPARR_STD) { + float avg, delta, sumSqr; + if (IS_SIGNED_TYPE(TypeCode3)) + avg = (float)sval/numElements; + else + avg = (float)uval/numElements; + sumSqr = 0; + for (i = 0; i < MinCount; i++) + { + pArg3 = cCmdResolveDataArg(INC_ID(Arg3), ARRAY_ELEM_OFFSET(DVIndex3, ArgVal4 + i), NULL); + if (IS_SIGNED_TYPE(TypeCode3)) + delta = (float)(SLONG)cCmdGetVal(pArg3, TypeCode3) - avg; + else + delta = (float)cCmdGetVal(pArg3, TypeCode3) - avg; + sumSqr += (delta*delta); + } + delta = sqrtf(sumSqr / (numElements - (float)1.0)); + if (IS_SIGNED_TYPE(TypeCode3)) + cCmdSetVal(pArg2, TypeCode2, (SLONG)delta); + else + cCmdSetVal(pArg2, TypeCode2, (ULONG)delta); + } + } + else if ((Arg1 == OPARR_MIN) || (Arg1 == OPARR_MAX)) + { + pArg2 = cCmdResolveDataArg(Arg2, 0, &TypeCode2); + if (IS_SIGNED_TYPE(TypeCode3)) + { + if (Arg1 == OPARR_MIN) + sval = LONG_MAX; + else + sval = LONG_MIN; + for (i = 0; i < MinCount; i++) + { + pArg3 = cCmdResolveDataArg(INC_ID(Arg3), ARRAY_ELEM_OFFSET(DVIndex3, ArgVal4 + i), NULL); + svaltmp = (SLONG)cCmdGetVal(pArg3, TypeCode3); + if (((Arg1 == OPARR_MIN) && (svaltmp < sval)) || + ((Arg1 == OPARR_MAX) && (svaltmp > sval))) + sval = svaltmp; + } + cCmdSetVal(pArg2, TypeCode2, sval); + } + else + { + if (Arg1 == OPARR_MIN) + uval = ULONG_MAX; + else + uval = 0; + for (i = 0; i < MinCount; i++) + { + pArg3 = cCmdResolveDataArg(INC_ID(Arg3), ARRAY_ELEM_OFFSET(DVIndex3, ArgVal4 + i), NULL); + uvaltmp = cCmdGetVal(pArg3, TypeCode3); + if (((Arg1 == OPARR_MIN) && (uvaltmp < uval)) || + ((Arg1 == OPARR_MAX) && (uvaltmp > uval))) + uval = uvaltmp; + } + cCmdSetVal(pArg2, TypeCode2, uval); + } + } + else if (Arg1 == OPARR_SORT) + { + //Allocate Dst array + Status = cCmdDSArrayAlloc(Arg2, 0, MinCount); + if (IS_ERR(Status)) + return Status; - //If InPtr is actually behind OutPtr, circular buffer has wrapped. Account for wrappage... - if (Tmp < 0) - Tmp = (pMapLowSpeed->InBuf[Port].InPtr + (SIZE_OF_LSBUF - pMapLowSpeed->InBuf[Port].OutPtr)); + DVIndex2 = cCmdGetDVIndex(Arg2, 0); + + //Move src subset to dst + for (i = 0; i < MinCount; i++) + { + Status = cCmdInterpPolyUnop2(OP_MOV, INC_ID(Arg2), ARRAY_ELEM_OFFSET(DVIndex2, i), INC_ID(Arg3), ARRAY_ELEM_OFFSET(DVIndex3, ArgVal4 + i)); + if (IS_ERR(Status)) + return Status; + } + // now dst is ready to be sorted + pArg2 = cCmdResolveDataArg(Arg2, 0, NULL); + Size = cCmdSizeOf(TypeCode2); + if (TypeCode2 == TC_SBYTE) + shell_sort_s1(pArg2, MinCount); + else if (TypeCode2 == TC_SWORD) + shell_sort_s2(pArg2, MinCount); + else if (TypeCode2 == TC_SLONG) + shell_sort_s4(pArg2, MinCount); + else if (TypeCode2 == TC_UBYTE) + shell_sort_u1(pArg2, MinCount); + else if (TypeCode2 == TC_UWORD) + shell_sort_u2(pArg2, MinCount); + else if (TypeCode2 == TC_ULONG) + shell_sort_u4(pArg2, MinCount); + else if (TypeCode2 == TC_FLOAT) + shell_sort_flt(pArg2, MinCount); + } + else + { + //Fatal error: Unrecognized instruction + NXT_BREAK; + Status = ERR_INSTR; + } + } + break; + + case OP_MULDIV: + { + //Arg1 - Dst (scalar) + //Arg2 - SrcA (scalar) + //Arg3 - SrcB (scalar) + //Arg4 - SrcC (scalar) + + Arg1 = pCode[1]; + Arg2 = pCode[2]; + Arg3 = pCode[3]; + Arg4 = pCode[4]; + ArgVal2 = cCmdGetScalarValFromDataArg(Arg2, 0); + ArgVal3 = cCmdGetScalarValFromDataArg(Arg3, 0); + ArgVal4 = cCmdGetScalarValFromDataArg(Arg4, 0); + ArgVal3 = (ULONG)(((long long)ArgVal2*(long long)ArgVal3)/(long long)ArgVal4); + pArg1 = cCmdResolveDataArg(Arg1, 0, &TypeCode1); + cCmdSetVal(pArg1, TypeCode1, ArgVal3); + } + break; + +/* + case OP_PRINTF: + { + // Arg1 - Instruction Size in bytes + // Arg2 - Dst + // Arg3 - Fmtstr + // Arg4-N - Srcs (max args = 8) + void *srcPtrs[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; + void *pArg2 = NULL, *pArg3 = NULL; + + Arg2 = pCode[2]; + Arg3 = pCode[3]; + + //Make sure Dst arg is a string + NXT_ASSERT(cCmdDSType(Arg2) == TC_ARRAY); + NXT_ASSERT(cCmdDSType(INC_ID(Arg2)) == TC_UBYTE); + + //Make sure Fmtstr arg is a string + NXT_ASSERT(cCmdDSType(Arg3) == TC_ARRAY); + NXT_ASSERT(cCmdDSType(INC_ID(Arg3)) == TC_UBYTE); + + //Number of Srcs = total code words - 4 (account for opcode word, size, Dst, and Fmtstr) + //!!! Argument access like this is potentially unsafe. + //A function/macro which checks proper encoding would be better + SrcCount = (pCode[1] / 2) - 4; + if (SrcCount > 8) { + Status = ERR_INSTR; + return (Status); + } + + // get pointers to Dst and FmtSt + pArg2 = cCmdResolveDataArg(Arg2, 0, &TypeCode2); + pArg3 = cCmdResolveDataArg(Arg3, 0, &TypeCode3); + + // resolve src pointers for all our sources + for (i = 0; i < SrcCount; i++) + { + TmpDSID = pCode[4 + i]; + TYPE_CODE tc = cCmdDSType(TmpDSID); + if ((tc == TC_ARRAY && cCmdDSType(INC_ID(TmpDSID)) != TC_UBYTE) || + (tc == TC_VOID) || (tc > TC_LAST_INT_SCALAR && tc != TC_FLOAT)) + { + // invalid source (only scalars, floats, and strings are supported) + Status = ERR_INSTR; + return (Status); + } + srcPtrs[i] = cCmdResolveDataArg(TmpDSID, 0, &TypeCode1); + } + + //Calculate Dst array count + ArrayCount2 = sprintf(NULL, pArg3, srcPtrs[0], srcPtrs[1], srcPtrs[2], + srcPtrs[3], srcPtrs[4], srcPtrs[5], + srcPtrs[6], srcPtrs[7], srcPtrs[8]); + } + break; +*/ + default: + { + //Fatal error: Unrecognized instruction + NXT_BREAK; + Status = ERR_INSTR; + } + break; + } + + return (Status); +} + + +// +//Support functions for lowspeed (I2C devices, i.e. ultrasonic sensor) communications +// + +//Simple lookup table for pMapLowSpeed->ChannelState[Port] values +//This is used to keep VM status code handling consistent +//...and ChannelState gives us too much information, anyway... +static const NXT_STATUS MapLStoVMStat[6] = +{ + NO_ERR, //LOWSPEED_IDLE, + STAT_COMM_PENDING, //LOWSPEED_INIT, + STAT_COMM_PENDING, //LOWSPEED_LOAD_BUFFER, + STAT_COMM_PENDING, //LOWSPEED_COMMUNICATING, + ERR_COMM_BUS_ERR, //LOWSPEED_ERROR, + STAT_COMM_PENDING, //LOWSPEED_DONE (really means c_lowspeed state machine is resetting) +}; + + +//cCmdLSCheckStatus +//Check lowspeed port status, optionally returning bytes available in the buffer for reading +NXT_STATUS cCmdLSCheckStatus(UBYTE Port) +{ + if (Port >= NO_OF_LOWSPEED_COM_CHANNEL) + { + return (ERR_COMM_CHAN_INVALID); + } + + INPUTSTRUCT * pInput = &(pMapInput->Inputs[Port]); + + //If port is not configured properly ahead of time, report that error + //!!! This seems like the right policy, but may restrict otherwise valid read operations... + if (!(pInput->SensorType == LOWSPEED_9V || pInput->SensorType == LOWSPEED) + || !(pInput->InvalidData == FALSE)) + { + return (ERR_COMM_CHAN_NOT_READY); + } + + return (MapLStoVMStat[pMapLowSpeed->ChannelState[Port]]); +} + +//cCmdLSCalcBytesReady +//Calculate true number of bytes available in the inbound LS buffer +UBYTE cCmdLSCalcBytesReady(UBYTE Port) +{ + SLONG Tmp; + + //Expect callers to validate Port, but short circuit here to be safe. + if (Port >= NO_OF_LOWSPEED_COM_CHANNEL) + return 0; + + LSBUF * pInBuf = &(pMapLowSpeed->InBuf[Port]); + + //Normally, bytes available is a simple difference. + Tmp = pInBuf->InPtr - pInBuf->OutPtr; + + //If InPtr is actually behind OutPtr, circular buffer has wrapped. Account for wrappage... + if (Tmp < 0) + Tmp = (pInBuf->InPtr + (SIZE_OF_LSBUF - pInBuf->OutPtr)); + else if ((Tmp == 0) && + (pInBuf->BytesToRx == SIZE_OF_LSBUF) && + (pMapLowSpeed->ChannelState[Port] == LOWSPEED_IDLE)) + Tmp = SIZE_OF_LSBUF; return (UBYTE)(Tmp); } //cCmdLSWrite //Write BufLength bytes into specified port's lowspeed buffer and kick off comm process to device -NXT_STATUS cCmdLSWrite(UBYTE Port, UBYTE BufLength, UBYTE *pBuf, UBYTE ResponseLength) +NXT_STATUS cCmdLSWrite(UBYTE Port, UBYTE BufLength, UBYTE *pBuf, UBYTE ResponseLength, UBYTE NoRestartOnRead) { if (Port >= NO_OF_LOWSPEED_COM_CHANNEL) { @@ -6361,21 +7513,29 @@ NXT_STATUS cCmdLSWrite(UBYTE Port, UBYTE BufLength, UBYTE *pBuf, UBYTE ResponseL return (ERR_INVALID_SIZE); } + INPUTSTRUCT * pInput = &(pMapInput->Inputs[Port]); + UBYTE * pChState = &(pMapLowSpeed->ChannelState[Port]); + LSBUF * pOutBuf = &(pMapLowSpeed->OutBuf[Port]); + //Only start writing process if port is properly configured and c_lowspeed module is ready - if ((pMapInput->Inputs[Port].SensorType == LOWSPEED_9V || pMapInput->Inputs[Port].SensorType == LOWSPEED) - && (pMapInput->Inputs[Port].InvalidData == FALSE) - && (pMapLowSpeed->ChannelState[Port] == LOWSPEED_IDLE) || (pMapLowSpeed->ChannelState[Port] == LOWSPEED_ERROR)) + if ((pInput->SensorType == LOWSPEED_9V || pInput->SensorType == LOWSPEED) + && (pInput->InvalidData == FALSE) + && (LOWSPEED_IDLE == *pChState) || (LOWSPEED_ERROR == *pChState)) { - pMapLowSpeed->OutBuf[Port].InPtr = 0; - pMapLowSpeed->OutBuf[Port].OutPtr = 0; + pOutBuf->InPtr = 0; + pOutBuf->OutPtr = 0; - memcpy(pMapLowSpeed->OutBuf[Port].Buf, pBuf, BufLength); - pMapLowSpeed->OutBuf[Port].InPtr = (UBYTE)BufLength; + memcpy(pOutBuf->Buf, pBuf, BufLength); + pOutBuf->InPtr = (UBYTE)BufLength; pMapLowSpeed->InBuf[Port].BytesToRx = ResponseLength; - pMapLowSpeed->ChannelState[Port] = LOWSPEED_INIT; + *pChState = LOWSPEED_INIT; pMapLowSpeed->State |= (COM_CHANNEL_ONE_ACTIVE << Port); + if (NoRestartOnRead) + pMapLowSpeed->NoRestartOnRead |= (0x01 << Port); + else + pMapLowSpeed->NoRestartOnRead &= ~(0x01 << Port); return (NO_ERR); } @@ -6412,18 +7572,21 @@ NXT_STATUS cCmdLSRead(UBYTE Port, UBYTE BufLength, UBYTE * pBuf) BytesToRead = BufLength; + LSBUF * pInBuf = &(pMapLowSpeed->InBuf[Port]); + //If the bytes we want to read wrap around the end, we must first read the end, then reset back to the beginning - if (pMapLowSpeed->InBuf[Port].OutPtr + BytesToRead >= SIZE_OF_LSBUF) + if (pInBuf->OutPtr + BytesToRead >= SIZE_OF_LSBUF) { - BytesToRead = SIZE_OF_LSBUF - pMapLowSpeed->InBuf[Port].OutPtr; - memcpy(pBuf, pMapLowSpeed->InBuf[Port].Buf + pMapLowSpeed->InBuf[Port].OutPtr, BytesToRead); - pMapLowSpeed->InBuf[Port].OutPtr = 0; + BytesToRead = SIZE_OF_LSBUF - pInBuf->OutPtr; + memcpy(pBuf, pInBuf->Buf + pInBuf->OutPtr, BytesToRead); + pInBuf->OutPtr = 0; pBuf += BytesToRead; BytesToRead = BufLength - BytesToRead; } - - memcpy(pBuf, pMapLowSpeed->InBuf[Port].Buf + pMapLowSpeed->InBuf[Port].OutPtr, BytesToRead); - pMapLowSpeed->InBuf[Port].OutPtr += BytesToRead; + if (BytesToRead > 0) { + memcpy(pBuf, pInBuf->Buf + pInBuf->OutPtr, BytesToRead); + pInBuf->OutPtr += BytesToRead; + } return (NO_ERR); } @@ -6433,13 +7596,7 @@ NXT_STATUS cCmdLSRead(UBYTE Port, UBYTE BufLength, UBYTE * pBuf) //Wrappers for OP_SYSCALL // -// -//cCmdWrapFileOpenRead -//ArgV[0]: (Function return) Loader status, U16 return -//ArgV[1]: File Handle, U8 return -//ArgV[2]: Filename, CStr -//ArgV[3]: Length, U32 return -NXT_STATUS cCmdWrapFileOpenRead(UBYTE * ArgV[]) +NXT_STATUS cCmdWrapFileOpenReadHelper(UBYTE Cmd, UBYTE * ArgV[]) { LOADER_STATUS LStatus; DV_INDEX DVIndex; @@ -6448,7 +7605,7 @@ NXT_STATUS cCmdWrapFileOpenRead(UBYTE * ArgV[]) DVIndex = *(DV_INDEX *)(ArgV[2]); ArgV[2] = cCmdDVPtr(DVIndex); - LStatus = pMapLoader->pFunc(OPENREAD, ArgV[2], NULL, (ULONG *)ArgV[3]); + LStatus = pMapLoader->pFunc(Cmd, ArgV[2], NULL, (ULONG *)ArgV[3]); //Add entry into FileHandleTable if (LOADER_ERR(LStatus) == SUCCESS) @@ -6465,12 +7622,7 @@ NXT_STATUS cCmdWrapFileOpenRead(UBYTE * ArgV[]) return NO_ERR; } -//cCmdWrapFileOpenWrite -//ArgV[0]: (Function return) Loader status, U16 return -//ArgV[1]: File Handle, U8 return -//ArgV[2]: Filename, CStr -//ArgV[3]: Length, U32 return -NXT_STATUS cCmdWrapFileOpenWrite(UBYTE * ArgV[]) +NXT_STATUS cCmdWrapFileOpenWriteHelper(UBYTE Cmd, UBYTE * ArgV[]) { LOADER_STATUS LStatus; DV_INDEX DVIndex; @@ -6479,7 +7631,7 @@ NXT_STATUS cCmdWrapFileOpenWrite(UBYTE * ArgV[]) DVIndex = *(DV_INDEX *)(ArgV[2]); ArgV[2] = cCmdDVPtr(DVIndex); - LStatus = pMapLoader->pFunc(OPENWRITEDATA, ArgV[2], NULL, (ULONG *)ArgV[3]); + LStatus = pMapLoader->pFunc(Cmd, ArgV[2], NULL, (ULONG *)ArgV[3]); //Add entry into FileHandleTable if (LOADER_ERR(LStatus) == SUCCESS) @@ -6496,6 +7648,27 @@ NXT_STATUS cCmdWrapFileOpenWrite(UBYTE * ArgV[]) return NO_ERR; } +// +//cCmdWrapFileOpenRead +//ArgV[0]: (Function return) Loader status, U16 return +//ArgV[1]: File Handle, U8 return +//ArgV[2]: Filename, CStr +//ArgV[3]: Length, U32 return +NXT_STATUS cCmdWrapFileOpenRead(UBYTE * ArgV[]) +{ + return cCmdWrapFileOpenReadHelper(OPENREAD, ArgV); +} + +//cCmdWrapFileOpenWrite +//ArgV[0]: (Function return) Loader status, U16 return +//ArgV[1]: File Handle, U8 return +//ArgV[2]: Filename, CStr +//ArgV[3]: Length, U32 return +NXT_STATUS cCmdWrapFileOpenWrite(UBYTE * ArgV[]) +{ + return cCmdWrapFileOpenWriteHelper(OPENWRITEDATA, ArgV); +} + //cCmdWrapFileOpenAppend //ArgV[0]: (Function return) Loader status, U16 return //ArgV[1]: File Handle, U8 return @@ -6503,28 +7676,7 @@ NXT_STATUS cCmdWrapFileOpenWrite(UBYTE * ArgV[]) //ArgV[3]: Length Remaining, U32 return NXT_STATUS cCmdWrapFileOpenAppend(UBYTE * ArgV[]) { - LOADER_STATUS LStatus; - DV_INDEX DVIndex; - - //Resolve array argument - DVIndex = *(DV_INDEX *)(ArgV[2]); - ArgV[2] = cCmdDVPtr(DVIndex); - - LStatus = pMapLoader->pFunc(OPENAPPENDDATA, ArgV[2], NULL, (ULONG *)ArgV[3]); - - //Add entry into FileHandleTable - if (LOADER_ERR(LStatus) == SUCCESS) - { - VarsCmd.FileHandleTable[LOADER_HANDLE(LStatus)][0] = 'w'; - strcpy((PSZ)(VarsCmd.FileHandleTable[LOADER_HANDLE(LStatus)] + 1), (PSZ)(ArgV[2])); - } - - //Status code in high byte of LStatus - *((UWORD *)ArgV[0]) = LOADER_ERR(LStatus); - //File handle in low byte of LStatus - *(ArgV[1]) = LOADER_HANDLE(LStatus); - - return NO_ERR; + return cCmdWrapFileOpenWriteHelper(OPENAPPENDDATA, ArgV); } //cCmdWrapFileRead @@ -6860,7 +8012,7 @@ NXT_STATUS cCmdWrapCommLSWrite(UBYTE * ArgV[]) pBuf = cCmdDVPtr(DVIndex); BufLength = DV_ARRAY[DVIndex].Count; - *pReturnVal = cCmdLSWrite(Port, (UBYTE)BufLength, pBuf, ResponseLength); + *pReturnVal = cCmdLSWrite(Port, (UBYTE)BufLength, pBuf, ResponseLength, 0); return (NO_ERR); } @@ -7266,7 +8418,7 @@ NXT_STATUS cCmdWrapKeepAlive(UBYTE * ArgV[]) -#define MAX_IOM_BUFFER_SIZE 64 +#define MAX_IOM_BUFFER_SIZE 800 // //cCmdWrapIOMapRead //ArgV[0]: (return) Status byte, SBYTE @@ -7477,7 +8629,6 @@ void cCmdWriteBenchmarkFile() } #endif - ///////////////////////////////////////////////////////////// // Dymanic syscall implementations //////////////////////////////////////////////////////////// @@ -7541,149 +8692,61 @@ NXT_STATUS cCmdWrapSetSleepTimeout(UBYTE * ArgV[]) return (NO_ERR); } -// currently copied from LS, not finished. // -//cCmdWrapCommHSWrite -//ArgV[0]: (return) Status code, SBYTE -//ArgV[1]: Port specifier, UBYTE -//ArgV[2]: Buffer to send, UBYTE array, only SIZE_OF_LSBUF bytes will be used -//ArgV[3]: ResponseLength, UBYTE, specifies expected bytes back from slave device +//cCmdWrapCommBTOnOff +//ArgV[0]: (return) Status byte, SBYTE // JCH - this should be UWORD +//ArgV[1]: Power State, 0-1 // -NXT_STATUS cCmdWrapCommHSWrite(UBYTE * ArgV[]) +NXT_STATUS cCmdWrapCommBTOnOff(UBYTE * ArgV[]) { - SBYTE * pReturnVal = (SBYTE*)(ArgV[0]); - UBYTE Port = *(ArgV[1]); - UBYTE * pBuf; - UWORD BufLength; - UBYTE ResponseLength = *(ArgV[3]); - DV_INDEX DVIndex; - - //Resolve array arguments - DVIndex = *(DV_INDEX *)(ArgV[2]); - pBuf = cCmdDVPtr(DVIndex); - BufLength = DV_ARRAY[DVIndex].Count; + UWORD retVal; + UWORD status; + UWORD * pReturnVal = (UWORD*)(ArgV[0]); - *pReturnVal = cCmdLSWrite(Port, (UBYTE)BufLength, pBuf, ResponseLength); + UBYTE powerState = *(ArgV[1]); + if(powerState) + status= pMapComm->pFunc(BTON, 0, 0, 0, NULL, &retVal); + else + status= pMapComm->pFunc(BTOFF, 0, 0, 0, NULL, &retVal); + *pReturnVal= (status == SUCCESS) ? retVal : status; return (NO_ERR); } // -//cCmdWrapCommHSCheckStatus -//ArgV[0]: (return) Status code, SBYTE -//ArgV[1]: Port specifier, UBYTE -//ArgV[2]: BytesReady, UBYTE +//cCmdWrapCommBTConnection +//ArgV[0]: (return) Status byte, SBYTE // JCH - this should be UWORD +//ArgV[1]: Action, UBYTE +//ArgV[2]: name, UBYTE array CStr +//ArgV[3]: connection slot, UBYTE // -NXT_STATUS cCmdWrapCommHSCheckStatus(UBYTE * ArgV[]) +NXT_STATUS cCmdWrapCommBTConnection(UBYTE * ArgV[]) { - UBYTE Port = *(ArgV[1]); + UWORD retVal; + UWORD status; + UWORD * pReturnVal = (UWORD*)(ArgV[0]); + UBYTE *nmPtr; - *((SBYTE*)(ArgV[0])) = cCmdLSCheckStatus(Port); - *((UBYTE*)(ArgV[2])) = cCmdLSCalcBytesReady(Port); + UBYTE action = *(ArgV[1]); + UBYTE connection = *(ArgV[3]); + nmPtr = cCmdDVPtr(*(DV_INDEX *)(ArgV[2])); + + if(action) // Init + status= pMapComm->pFunc(CONNECTBYNAME, 0, connection, 0, nmPtr, &retVal); + else // Close + status= pMapComm->pFunc(DISCONNECT, connection, 0, 0, NULL, &retVal); + *pReturnVal= (status == SUCCESS) ? retVal : status; return (NO_ERR); } + // -//cCmdWrapCommHSRead -//ArgV[0]: (return) Status code, SBYTE -//ArgV[1]: Port specifier, UBYTE -//ArgV[2]: Buffer for data, UBYTE array, max SIZE_OF_LSBUF bytes will be written -//ArgV[3]: BufferLength, UBYTE, specifies size of buffer requested +//cCmdWrapReadSemData +//ArgV[0]: return data, U8 +//ArgV[1]: which (0=used, 1=request), U8 // -NXT_STATUS cCmdWrapCommHSRead(UBYTE * ArgV[]) -{ - SBYTE * pReturnVal = (SBYTE*)(ArgV[0]); - UBYTE Port = *(ArgV[1]); - UBYTE * pBuf; - UBYTE BufLength = *(ArgV[3]); - UBYTE BytesToRead; - DV_INDEX DVIndex = *(DV_INDEX *)(ArgV[2]); - NXT_STATUS AllocStatus; - - *pReturnVal = cCmdLSCheckStatus(Port); - BytesToRead = cCmdLSCalcBytesReady(Port); - - //If channel is OK and has data ready for us, put the data into outgoing buffer - if (!IS_ERR(*pReturnVal) && BytesToRead > 0) - { - //Limit buffer to available data - if (BufLength > BytesToRead) - BufLength = BytesToRead; - - AllocStatus = cCmdDVArrayAlloc(DVIndex, BufLength); - if (IS_ERR(AllocStatus)) - return (AllocStatus); - - pBuf = cCmdDVPtr(DVIndex); - *pReturnVal = cCmdLSRead(Port, BufLength, pBuf); - } - //Else, the channel has an error and/or there's no data to read; clear the output array - else - { - AllocStatus = cCmdDVArrayAlloc(DVIndex, 0); - if (IS_ERR(AllocStatus)) - return (AllocStatus); - } - - return (NO_ERR); -} - -// -//cCmdWrapCommBTOnOff -//ArgV[0]: (return) Status byte, SBYTE -//ArgV[1]: Power State, 0-1 -// -NXT_STATUS cCmdWrapCommBTOnOff(UBYTE * ArgV[]) -{ - UWORD retVal; - NXT_STATUS status; - SBYTE * pReturnVal = (SBYTE*)(ArgV[0]); - - UBYTE powerState = *(ArgV[1]); - if(powerState) - status= pMapComm->pFunc(BTON, 0, 0, 0, NULL, &retVal); - else - status= pMapComm->pFunc(BTOFF, 0, 0, 0, NULL, &retVal); - - *pReturnVal= (status == SUCCESS) ? retVal : status; - return (NO_ERR); -} - -// -//cCmdWrapCommBTConnection -//ArgV[0]: (return) Status byte, SBYTE -//ArgV[1]: Action, UBYTE -//ArgV[2]: name, UBYTE array CStr -//ArgV[3]: connection slot, UBYTE -// -NXT_STATUS cCmdWrapCommBTConnection(UBYTE * ArgV[]) -{ - UWORD retVal; - NXT_STATUS status; - SBYTE * pReturnVal = (SBYTE*)(ArgV[0]); - UBYTE *nmPtr; - - UBYTE action = *(ArgV[1]); - UBYTE connection = *(ArgV[3]); - nmPtr = cCmdDVPtr(*(DV_INDEX *)(ArgV[2])); - - if(action) // Init - status= pMapComm->pFunc(CONNECTBYNAME, 0, connection, 0, nmPtr, &retVal); - else // Close - status= pMapComm->pFunc(DISCONNECT, connection, 0, 0, NULL, &retVal); - - *pReturnVal= (status == SUCCESS) ? retVal : status; - return (NO_ERR); -} - - -// -//cCmdWrapReadSemData -//ArgV[0]: return data, U8 -//ArgV[1]: which (0=used, 1=request), U8 -// -NXT_STATUS cCmdWrapReadSemData(UBYTE * ArgV[]) +NXT_STATUS cCmdWrapReadSemData(UBYTE * ArgV[]) { if(!(*((UBYTE *)ArgV[1]))) *((UBYTE *)ArgV[0])= gUsageSemData; @@ -7923,6 +8986,489 @@ NXT_STATUS cCmdWrapListFiles (UBYTE * ArgV[]) return Status; } +// +//cCmdWrapCommExecuteFunction +//ArgV[0]: (return) Result word, UWORD +//ArgV[1]: UBYTE Cmd +//ArgV[2]: UBYTE Param1 +//ArgV[3]: UBYTE Param2 +//ArgV[4]: UBYTE Param3 +//ArgV[5]: Name, UBYTE array +//ArgV[6]: UWORD RetVal +// +NXT_STATUS cCmdWrapCommExecuteFunction(UBYTE * ArgV[]) +{ + // resolve Name + ArgV[5] = cCmdDVPtr(*(DV_INDEX *)(ArgV[5])); + + *(UWORD*)(ArgV[0]) = + pMapComm->pFunc(*(UBYTE*)(ArgV[1]), + *(UBYTE*)(ArgV[2]), + *(UBYTE*)(ArgV[3]), + *(UBYTE*)(ArgV[4]), + (UBYTE*)(ArgV[5]), + (UWORD*)(ArgV[6])); + return (NO_ERR); +} + +// +//cCmdWrapLoaderExecuteFunction +//ArgV[0]: (return) Result word, UWORD +//ArgV[1]: UBYTE Cmd +//ArgV[2]: FileName, UBYTE array +//ArgV[3]: Buffer, UBYTE array +//ArgV[4]: ULONG pLength +// +NXT_STATUS cCmdWrapLoaderExecuteFunction(UBYTE * ArgV[]) +{ + // resolve FileName + ArgV[2] = cCmdDVPtr(*(DV_INDEX *)(ArgV[2])); + // resolve Buffer + ArgV[3] = cCmdDVPtr(*(DV_INDEX *)(ArgV[3])); + + *(UWORD*)(ArgV[0]) = + pMapLoader->pFunc(*(UBYTE*)(ArgV[1]), + (UBYTE*)(ArgV[2]), + (UBYTE*)(ArgV[3]), + (ULONG*)(ArgV[4])); + return (NO_ERR); +} + +// +//cCmdWrapIOMapReadByID +//ArgV[0]: (return) Status byte, SBYTE +//ArgV[1]: ModuleID, ULONG +//ArgV[2]: Offset, UWORD +//ArgV[3]: Count, UWORD +//ArgV[4]: Buffer, UBYTE array +// +NXT_STATUS cCmdWrapIOMapReadByID(UBYTE * ArgV[]) +{ + UWORD LStatus; + NXT_STATUS Status; + + SBYTE * pReturnVal = (SBYTE*)(ArgV[0]); + UWORD Offset = *(UWORD*)(ArgV[2]); + //Our copy of 'Count' must be a ULONG to match the loader interface + ULONG Count = *(UWORD*)(ArgV[3]); + ULONG ModuleID = *(ULONG*)ArgV[1]; + + DV_INDEX DVIndex; + + //Buffer to store data and offset in for IOMAPREAD call + //!!! Constant size means only limited reads and writes + UBYTE DataBuffer[MAX_IOM_BUFFER_SIZE + 2]; + + if (Count > MAX_IOM_BUFFER_SIZE) + { + //Request to read too much data at once; clear buffer, return error. + DVIndex = *(DV_INDEX *)(ArgV[4]); + *pReturnVal = cCmdDVArrayAlloc(DVIndex, 0); + if (IS_ERR(*pReturnVal)) + return (*pReturnVal); + + *pReturnVal = ERR_INVALID_SIZE; + return (NO_ERR); + } + + //Module was found, transfer Offset into first two bytes of DataBuffer and attempt to read + *(UWORD*)(DataBuffer) = Offset; + LStatus = pMapLoader->pFunc(IOMAPREAD, (UBYTE *)&ModuleID, DataBuffer, &Count); + + if (LOADER_ERR(LStatus) == SUCCESS) + { + //No error from IOMAPREAD, so copy the data into VM's dataspace + //Size destination array + DVIndex = *(DV_INDEX *)(ArgV[4]); + Status = cCmdDVArrayAlloc(DVIndex, (UWORD)Count); + if (IS_ERR(Status)) + { + //Alloc failed, so return + return (Status); + } + + //Alloc succeeded, so resolve and copy away + ArgV[4] = cCmdDVPtr(DVIndex); + memcpy(ArgV[4], &(DataBuffer[2]), Count); + } + + *pReturnVal = LOADER_ERR_BYTE(LStatus); + + return (NO_ERR); +} + +// +//cCmdWrapIOMapWriteByID +//ArgV[0]: (return) Status byte, SBYTE +//ArgV[1]: ModuleID, ULONG +//ArgV[2]: Offset, UWORD +//ArgV[3]: Buffer, UBYTE array +// +NXT_STATUS cCmdWrapIOMapWriteByID(UBYTE * ArgV[]) +{ + UWORD LStatus; + + SBYTE * pReturnVal = (SBYTE*)(ArgV[0]); + UWORD Offset = *(UWORD*)(ArgV[2]); + ULONG ModuleID = *(ULONG*)ArgV[1]; + + //Our copy of 'Count' must be a ULONG to match the loader interface + ULONG Count; + DV_INDEX DVIndex; + + //Buffer to store data and offset in for IOMAPREAD call + //!!! Constant size means only limited reads and writes + UBYTE DataBuffer[MAX_IOM_BUFFER_SIZE + 2]; + + //Resolve buffer + DVIndex = *(DV_INDEX *)(ArgV[3]); + ArgV[3] = cCmdDVPtr(DVIndex); + Count = DV_ARRAY[DVIndex].Count; + + if (Count > MAX_IOM_BUFFER_SIZE) + { + //Request to read too much data at once; return error and give up + *pReturnVal = ERR_INVALID_SIZE; + return (NO_ERR); + } + + //Module was found, transfer Offset into first two bytes of DataBuffer, copy data into rest of buffer, then write + *(UWORD*)(DataBuffer) = Offset; + memcpy(&(DataBuffer[2]), ArgV[3], Count); + LStatus = pMapLoader->pFunc(IOMAPWRITE, (UBYTE *)&ModuleID, DataBuffer, &Count); + + *pReturnVal = LOADER_ERR_BYTE(LStatus); + + return (NO_ERR); +} + +/* +NXT_STATUS cCmdWrapFileFindHelper(UBYTE First, UBYTE * ArgV[]) +{ + LOADER_STATUS LStatus; + NXT_STATUS Status; + DV_INDEX DVIndex; + UBYTE LoaderCmd = FINDNEXT; + + UBYTE FileMask[FILENAME_LENGTH+1]; + + //Resolve array arguments + // input mask/output filename + DVIndex = *(DV_INDEX *)(ArgV[2]); + if (First) { + LoaderCmd = FINDFIRST; + ArgV[1] = FileMask; + memcpy(FileMask, cCmdDVPtr(DVIndex), DV_ARRAY[DVIndex].Count); + } + //Size Buffer to Length + //Add room for null terminator to length + Status = cCmdDVArrayAlloc(DVIndex, (UWORD)(FILENAME_LENGTH + 1)); + if (IS_ERR(Status)) + return Status; + ArgV[2] = cCmdDVPtr(DVIndex); + + LStatus = pMapLoader->pFunc(LoaderCmd, ArgV[1], ArgV[2], (ULONG *)ArgV[3]); + + //Status code in high byte of LStatus + *((UWORD *)ArgV[0]) = LOADER_ERR(LStatus); + + //File handle in low byte of LStatus + *(ArgV[1]) = LOADER_HANDLE(LStatus); + + return (NO_ERR); +} +*/ +//cCmdWrapFileFindFirst +//ArgV[0]: (Function return) Loader status, U16 return +//ArgV[1]: File Handle, U8 out +//ArgV[2]: Filename, CStr in/out +//ArgV[3]: Length, U32 out +NXT_STATUS cCmdWrapFileFindFirst(UBYTE * ArgV[]) +{ +// return cCmdWrapFileFindHelper(TRUE, ArgV); + LOADER_STATUS LStatus; + NXT_STATUS Status; + DV_INDEX DVIndex; + + UBYTE FileMask[FILENAME_LENGTH+1]; + + //Resolve array arguments + // input mask/output filename + DVIndex = *(DV_INDEX *)(ArgV[2]); + memcpy(FileMask, cCmdDVPtr(DVIndex), DV_ARRAY[DVIndex].Count); + //Size Buffer to Length + //Add room for null terminator to length + Status = cCmdDVArrayAlloc(DVIndex, (UWORD)(FILENAME_LENGTH + 1)); + if (IS_ERR(Status)) + return Status; + ArgV[2] = cCmdDVPtr(DVIndex); + + LStatus = pMapLoader->pFunc(FINDFIRST, FileMask, ArgV[2], (ULONG *)ArgV[3]); + + //Status code in high byte of LStatus + *((UWORD *)ArgV[0]) = LOADER_ERR(LStatus); + + //File handle in low byte of LStatus + *(ArgV[1]) = LOADER_HANDLE(LStatus); + + return (NO_ERR); +} + +//cCmdWrapFileFindNext +//ArgV[0]: (Function return) Loader status, U16 return +//ArgV[1]: File Handle, U8 in/out +//ArgV[2]: Filename, CStr out +//ArgV[3]: Length, U32 out +NXT_STATUS cCmdWrapFileFindNext(UBYTE * ArgV[]) +{ +// return cCmdWrapFileFindHelper(FALSE, ArgV); + LOADER_STATUS LStatus; + NXT_STATUS Status; + DV_INDEX DVIndex; + + //Resolve array arguments + // output filename + DVIndex = *(DV_INDEX *)(ArgV[2]); + //Size Buffer to Length + //Add room for null terminator to length + Status = cCmdDVArrayAlloc(DVIndex, (UWORD)(FILENAME_LENGTH + 1)); + if (IS_ERR(Status)) + return Status; + ArgV[2] = cCmdDVPtr(DVIndex); + + LStatus = pMapLoader->pFunc(FINDNEXT, ArgV[1], ArgV[2], (ULONG *)ArgV[3]); + + //Status code in high byte of LStatus + *((UWORD *)ArgV[0]) = LOADER_ERR(LStatus); + + //File handle in low byte of LStatus + *(ArgV[1]) = LOADER_HANDLE(LStatus); + + return (NO_ERR); +} + +//cCmdWrapFileOpenReadLinear +//ArgV[0]: (Function return) Loader status, U16 return +//ArgV[1]: File Handle, U8 return +//ArgV[2]: Filename, CStr +//ArgV[3]: Length, U32 return +NXT_STATUS cCmdWrapFileOpenReadLinear(UBYTE * ArgV[]) +{ + return cCmdWrapFileOpenReadHelper(OPENREADLINEAR, ArgV); +} + +//cCmdWrapFileOpenWriteLinear +//ArgV[0]: (Function return) Loader status, U16 return +//ArgV[1]: File Handle, U8 return +//ArgV[2]: Filename, CStr +//ArgV[3]: Length, U32 return +NXT_STATUS cCmdWrapFileOpenWriteLinear(UBYTE * ArgV[]) +{ + return cCmdWrapFileOpenWriteHelper(OPENWRITELINEAR, ArgV); +} + +//cCmdWrapFileOpenWriteNonLinear +//ArgV[0]: (Function return) Loader status, U16 return +//ArgV[1]: File Handle, U8 return +//ArgV[2]: Filename, CStr +//ArgV[3]: Length, U32 return +NXT_STATUS cCmdWrapFileOpenWriteNonLinear(UBYTE * ArgV[]) +{ + return cCmdWrapFileOpenWriteHelper(OPENWRITE, ArgV); +} + +// +//cCmdWrapCommHSControl +//ArgV[0]: (return) Status byte, SBYTE +//ArgV[1]: Command, UBYTE (init, uart, or exit) +//ArgV[2]: BaudRate, UBYTE +//ArgV[3]: Mode, UWORD +NXT_STATUS cCmdWrapCommHSControl(UBYTE * ArgV[]) +{ + pMapComm->HsInBuf.InPtr = 0; + pMapComm->HsInBuf.OutPtr = 0; + pMapComm->HsOutBuf.InPtr = 0; + pMapComm->HsOutBuf.OutPtr = 0; + switch (*(ArgV[1])) + { + case HS_CTRL_INIT: + { + // hi-speed init + pMapComm->HsState = HS_ENABLE; + pMapComm->HsFlags = HS_UPDATE; + } + break; + + case HS_CTRL_UART: + { + // hi-speed setup uart + pMapComm->HsSpeed = *(ArgV[2]); + pMapComm->HsMode = *(ArgV[3]); + pMapComm->HsState = HS_INITIALISE; + pMapComm->HsFlags = HS_UPDATE; + } + break; + + case HS_CTRL_EXIT: + { + // hi-speed exit + pMapComm->HsState = HS_DISABLE; + pMapComm->HsFlags = HS_UPDATE; + } + break; + } + + *((UWORD *)ArgV[0]) = pMapComm->HsState; + + return (NO_ERR); +} + +//cCmdWrapCommHSCheckStatus +//ArgV[0]: SendingData, UBYTE out +//ArgV[1]: DataAvailable, UBYTE out +NXT_STATUS cCmdWrapCommHSCheckStatus(UBYTE * ArgV[]) +{ + *(ArgV[0]) = (pMapComm->HsOutBuf.InPtr != pMapComm->HsOutBuf.OutPtr) || (pMapComm->HsState == HS_SEND_DATA); + *(ArgV[1]) = (pMapComm->HsInBuf.InPtr != pMapComm->HsInBuf.OutPtr); + return (NO_ERR); +} + +//cCmdWrapCommHSWrite +//ArgV[0]: (return) Status byte, SBYTE +//ArgV[1]: Buffer +NXT_STATUS cCmdWrapCommHSWrite(UBYTE * ArgV[]) +{ + SBYTE * pReturnVal = (SBYTE*)(ArgV[0]); + UBYTE * pBuf; + UWORD BufLength; + DV_INDEX DVIndex; + + //Resolve array arguments + DVIndex = *(DV_INDEX *)(ArgV[1]); + pBuf = cCmdDVPtr(DVIndex); + BufLength = DV_ARRAY[DVIndex].Count; + + if (BufLength > SIZE_OF_HSBUF) + { + *pReturnVal = ERR_INVALID_SIZE; + return (NO_ERR); + } + + // set inptr & outptr + pMapComm->HsOutBuf.OutPtr = 0; + pMapComm->HsOutBuf.InPtr = BufLength; + memcpy(pMapComm->HsOutBuf.Buf, pBuf, BufLength); + + // send the data + pMapComm->HsState = HS_SEND_DATA; + pMapComm->HsFlags = HS_UPDATE; + + *pReturnVal = pMapComm->HsState; + + return (NO_ERR); +} + +//cCmdWrapCommHSRead +//ArgV[0]: (return) Status byte, SBYTE +//ArgV[1]: Buffer, out +NXT_STATUS cCmdWrapCommHSRead(UBYTE * ArgV[]) +{ + //Normally, bytes available is a simple difference. + SLONG Tmp = pMapComm->HsInBuf.InPtr - pMapComm->HsInBuf.OutPtr; + + //If InPtr is actually behind OutPtr, circular buffer has wrapped. Account for wrappage... + if (Tmp < 0) + Tmp = (pMapComm->HsInBuf.InPtr + (SIZE_OF_HSBUF - pMapComm->HsInBuf.OutPtr)); + + //Resolve array arguments + // output buffer + DV_INDEX DVIndex = *(DV_INDEX *)(ArgV[1]); + //Size Buffer to Length + NXT_STATUS Status = cCmdDVArrayAlloc(DVIndex, (UWORD)Tmp); + if (IS_ERR(Status)) + return Status; + UBYTE* pBuf = cCmdDVPtr(DVIndex); + ArgV[1] = pBuf; + + //If the bytes we want to read wrap around the end, we must first read the end, then reset back to the beginning + UBYTE BytesToRead = (UBYTE)Tmp; + if (pMapComm->HsInBuf.OutPtr + BytesToRead >= SIZE_OF_HSBUF) + { + BytesToRead = SIZE_OF_HSBUF - pMapComm->HsInBuf.OutPtr; + memcpy(pBuf, pMapComm->HsInBuf.Buf + pMapComm->HsInBuf.OutPtr, BytesToRead); + pMapComm->HsInBuf.OutPtr = 0; + pBuf += BytesToRead; + BytesToRead = Tmp - BytesToRead; + } + + memcpy(pBuf, pMapComm->HsInBuf.Buf + pMapComm->HsInBuf.OutPtr, BytesToRead); + pMapComm->HsInBuf.OutPtr += BytesToRead; + + return (NO_ERR); +} + +//cCmdWrapCommLSWriteEx +//ArgV[0]: (return) Status code, SBYTE +//ArgV[1]: Port specifier, UBYTE +//ArgV[2]: Buffer to send, UBYTE array, only SIZE_OF_LSBUF bytes will be used +//ArgV[3]: ResponseLength, UBYTE, specifies expected bytes back from slave device +//ArgV[4]: NoRestartOnRead, UBYTE, specifies whether or not to restart before the read +// +NXT_STATUS cCmdWrapCommLSWriteEx(UBYTE * ArgV[]) +{ + SBYTE * pReturnVal = (SBYTE*)(ArgV[0]); + UBYTE Port = *(ArgV[1]); + UBYTE * pBuf; + UWORD BufLength; + UBYTE ResponseLength = *(ArgV[3]); + UBYTE NoRestartOnRead = *(ArgV[4]); + DV_INDEX DVIndex; + + //Resolve array arguments + DVIndex = *(DV_INDEX *)(ArgV[2]); + pBuf = cCmdDVPtr(DVIndex); + BufLength = DV_ARRAY[DVIndex].Count; + + *pReturnVal = cCmdLSWrite(Port, (UBYTE)BufLength, pBuf, ResponseLength, NoRestartOnRead); + + return (NO_ERR); +} + +//cCmdWrapFileSeek +//ArgV[0]: (Function return) Loader status, U16 return +//ArgV[1]: File Handle, U8 in/out +//ArgV[2]: Origin, U8 in +//ArgV[3]: Length, S32 in +NXT_STATUS cCmdWrapFileSeek(UBYTE * ArgV[]) +{ + UBYTE Origin = *((UBYTE *)ArgV[2]); + LOADER_STATUS LStatus = pMapLoader->pFunc(Origin+SEEKFROMSTART, ArgV[1], NULL, (ULONG *)ArgV[3]); + //Status code in high byte of LStatus + *((UWORD *)ArgV[0]) = LOADER_ERR(LStatus); + //File handle in low byte of LStatus + *(ArgV[1]) = LOADER_HANDLE(LStatus); + return (NO_ERR); +} + +//cCmdWrapFileResize +//ArgV[0]: (Function return) Loader status, U16 return +//ArgV[1]: File Handle, U8 in/out +//ArgV[2]: NewSize, U16 in +NXT_STATUS cCmdWrapFileResize(UBYTE * ArgV[]) +{ + LOADER_STATUS LStatus = pMapLoader->pFunc(RESIZEDATAFILE, ArgV[1], NULL, (ULONG *)ArgV[2]); + //Status code in high byte of LStatus + *((UWORD *)ArgV[0]) = LOADER_ERR(LStatus); + //File handle in low byte of LStatus + *(ArgV[1]) = LOADER_HANDLE(LStatus); + return (NO_ERR); +} + +NXT_STATUS cCmdWrapUndefinedSysCall(UBYTE * ArgV[]) +{ + return (NO_ERR); +} + #ifdef SIM_NXT // Accessors for simulator library code SWORD cCmdGetCodeWord(CLUMP_ID Clump, CODE_INDEX Index) diff --git a/AT91SAM7S256/Source/c_cmd.h b/AT91SAM7S256/Source/c_cmd.h index e9227eb..729e14b 100644 --- a/AT91SAM7S256/Source/c_cmd.h +++ b/AT91SAM7S256/Source/c_cmd.h @@ -27,7 +27,7 @@ #endif #include "c_cmd_bytecodes.h" -#define SYSCALL_COUNT 48 +#define SYSCALL_COUNT 100 extern const HEADER cCmd; @@ -55,6 +55,17 @@ void cCmdExit(void); // #define ENABLE_VM 1 #undef ARM_DEBUG + + +// +//WRITE_IOMAP_OFFSETS enables saving a file containing accurate iomap offsets. +// +#define WRITE_IOMAP_OFFSETS 0 + +#if WRITE_IOMAP_OFFSETS +void cCmdWriteIOMapOffsetsFile(); +#endif + // //VM_BENCHMARK enables extra instrumentation code to measure VM performance. //When enabled, a file named "benchmark.txt" is produced every time a program completes. @@ -194,10 +205,11 @@ enum IO_OUT_REG_I_VAL, IO_OUT_REG_D_VAL, IO_OUT_BLOCK_TACH_COUNT, - IO_OUT_ROTATION_COUNT + IO_OUT_ROTATION_COUNT, + IO_OUT_OPTIONS, }; -#define IO_OUT_FPP 15 +#define IO_OUT_FPP 16 #define IO_OUT_FIELD_COUNT (IO_OUT_FPP * NO_OF_OUTPUTS) // @@ -350,7 +362,6 @@ typedef struct #define SET_WRITE_DTLG(DVIndex) (VarsCmd.DatalogBuffer.Datalogs[VarsCmd.DatalogBuffer.WriteIndex] = (DVIndex)) #define SET_READ_DTLG(DVIndex) (VarsCmd.DatalogBuffer.Datalogs[VarsCmd.DatalogBuffer.ReadIndex] = (DVIndex)) - // //Definitions related to dataflow scheduling // @@ -385,6 +396,17 @@ typedef struct CLUMP_Q WaitQ; } MUTEX_Q; + +// Clump Breakpoints +// +typedef struct +{ + CODE_INDEX Location; + UBYTE Enabled; +} CLUMP_BREAK_REC; + +#define MAX_BREAKPOINTS 4 + // // Clump Record, run-time book-keeping for each clump // @@ -395,6 +417,7 @@ typedef struct // CurrFireCount: Run-time count of unsatisfied dependencies // Link: ID of next clump in the queue. NOT_A_CLUMP denotes end or bad link. // +// Priority: number of instructions to run per pass on this clump // clumpScalarDispatchHints: this clump only uses scalar data args, can be interpretted with faster dispatch tables // // pDependents: pointer to list of downstream dependents' ClumpIDs @@ -410,11 +433,13 @@ typedef struct UBYTE CurrFireCount; //AKA ShortCount CLUMP_ID Link; + UBYTE Priority; // deleted in 1.28 UBYTE clumpScalarDispatchHints; CLUMP_ID* pDependents; ULONG awakenTime; UBYTE DependentCount; + CLUMP_BREAK_REC Breakpoints[MAX_BREAKPOINTS]; } CLUMP_REC; // @@ -535,6 +560,10 @@ typedef struct DATALOG_QUEUE DatalogBuffer; + UBYTE Debugging; + UBYTE PauseClump; + CODE_INDEX PausePC; + #if VM_BENCHMARK ULONG InstrCount; ULONG Average; @@ -544,8 +573,10 @@ typedef struct ULONG CompactionCount; ULONG LastCompactionTick; ULONG MaxCompactionTime; - ULONG OpcodeBenchmarks[OPCODE_COUNT][4]; - ULONG SyscallBenchmarks[SYSCALL_COUNT][4]; + ULONG CmdCtrlOverTimeCnt; + ULONG MaxCmdCtrlOverTimeLen; + ULONG OpcodeBenchmarks[OPCODE_COUNT][3]; + ULONG SyscallBenchmarks[SYSCALL_COUNT][3]; UBYTE Buffer[256]; #endif @@ -786,7 +817,7 @@ float cCmdGetValFlt(void * pVal, TYPE_CODE TypeCode); NXT_STATUS cCmdLSCheckStatus(UBYTE Port); UBYTE cCmdLSCalcBytesReady(UBYTE Port); -NXT_STATUS cCmdLSWrite(UBYTE Port, UBYTE BufLength, UBYTE *pBuf, UBYTE ResponseLength); +NXT_STATUS cCmdLSWrite(UBYTE Port, UBYTE BufLength, UBYTE *pBuf, UBYTE ResponseLength, UBYTE NoRestartOnRead); NXT_STATUS cCmdLSRead(UBYTE Port, UBYTE BufLength, UBYTE * pBuf); // @@ -844,9 +875,6 @@ NXT_STATUS cCmdWrapSetSleepTimeout(UBYTE * ArgV[]); NXT_STATUS cCmdWrapListFiles(UBYTE * ArgV[]); // Handlers for dynamically added syscalls -NXT_STATUS cCmdWrapCommHSWrite(UBYTE * ArgV[]); -NXT_STATUS cCmdWrapCommHSRead(UBYTE * ArgV[]); -NXT_STATUS cCmdWrapCommHSCheckStatus(UBYTE * ArgV[]); NXT_STATUS cCmdWrapCommBTOnOff(UBYTE * ArgV[]); NXT_STATUS cCmdWrapCommBTConnection(UBYTE * ArgV[]); NXT_STATUS cCmdWrapReadSemData(UBYTE * ArgV[]); @@ -854,6 +882,29 @@ NXT_STATUS cCmdWrapWriteSemData(UBYTE * ArgV[]); NXT_STATUS cCmdWrapUpdateCalibCacheInfo(UBYTE * ArgV[]); NXT_STATUS cCmdWrapComputeCalibValue(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapIOMapReadByID(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapIOMapWriteByID(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapDisplayExecuteFunction(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapCommExecuteFunction(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapLoaderExecuteFunction(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapFileFindFirst(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapFileFindNext(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapFileOpenWriteLinear(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapFileOpenWriteNonLinear(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapFileOpenReadLinear(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapCommHSControl(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapCommHSCheckStatus(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapCommHSWrite(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapCommHSRead(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapCommLSWriteEx(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapFileSeek(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapFileResize(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapDrawPictureArray(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapDrawPolygon(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapDrawEllipse(UBYTE * ArgV[]); +NXT_STATUS cCmdWrapDrawFont(UBYTE * ArgV[]); + +NXT_STATUS cCmdWrapUndefinedSysCall(UBYTE * ArgV[]); //Handler for remote control protocol packets -- called from comm module via IO map function pointer UWORD cCmdHandleRemoteCommands(UBYTE * pInBuf, UBYTE * pOutBuf, UBYTE * pLen); diff --git a/AT91SAM7S256/Source/c_cmd.iom b/AT91SAM7S256/Source/c_cmd.iom index 7c5906c..09a6477 100644 --- a/AT91SAM7S256/Source/c_cmd.iom +++ b/AT91SAM7S256/Source/c_cmd.iom @@ -41,12 +41,24 @@ #define NO_ERR 0 //Fatal errors -#define ERR_ARG -1 //0xFF Bad arguments -#define ERR_INSTR -2 //0xFE Illegal bytecode instruction -#define ERR_FILE -3 //0xFD Mal-formed file contents -#define ERR_VER -4 //0xFC Version mismatch between firmware and compiler -#define ERR_MEM -5 //0xFB Insufficient memory available -#define ERR_BAD_PTR -6 //0xFA Someone passed us a bad pointer! +#define ERR_ARG -1 // 0xFF Bad arguments +#define ERR_INSTR -2 // 0xFE Illegal bytecode instruction +#define ERR_FILE -3 // 0xFD cCmdVerifyMemMgr() != TRUE +#define ERR_VER -4 // 0xFC Version mismatch between firmware and compiler +#define ERR_MEM -5 // 0xFB Insufficient memory available +#define ERR_BAD_PTR -6 // 0xFA Someone passed us a bad pointer! + +#define ERR_CLUMP_COUNT -7 // 0xF9 (FileClumpCount == 0 || FileClumpCount >= NOT_A_CLUMP) +#define ERR_NO_CODE -8 // 0xF8 VarsCmd.CodespaceCount == 0 +#define ERR_INSANE_OFFSET -9 // 0xF7 CurrOffset != (DataSize - VarsCmd.CodespaceCount * 2) +#define ERR_BAD_POOL_SIZE -10 // 0xF6 VarsCmd.PoolSize > POOL_MAX_SIZE +#define ERR_LOADER_ERR -11 // 0xF5 LOADER_ERR(LStatus) != SUCCESS || pData == NULL || DataSize == 0 +#define ERR_SPOTCHECK_FAIL -12 // 0xF4 ((UBYTE*)(VarsCmd.pCodespace) < pData) (c_cmd.c 1893) +#define ERR_NO_ACTIVE_CLUMP -13 // 0xF3 VarsCmd.RunQ.Head == NOT_A_CLUMP +#define ERR_DEFAULT_OFFSETS -14 // 0xF2 (DefaultsOffset != FileOffsets.DynamicDefaults) || (DefaultsOffset + FileOffsets.DynamicDefaultsSize != FileOffsets.DSDefaultsSize) +#define ERR_MEMMGR_FAIL -15 // 0xF1 (UBYTE *)VarsCmd.MemMgr.pDopeVectorArray != VarsCmd.pDataspace + DV_ARRAY[0].Offset + +#define ERR_NON_FATAL -16 //0xF0 or greater //General errors #define ERR_INVALID_PORT -16 //0xF0 Bad input or output port specified @@ -73,7 +85,7 @@ #define IS_ERR(Status) ((Status) < NO_ERR) //Errors are considered fatal if they are something we'd consider halting the VM for. -#define IS_FATAL(Status) ((Status) < NO_ERR && (Status) >= ERR_BAD_PTR) +#define IS_FATAL(Status) ((Status) < NO_ERR && (Status) > ERR_NON_FATAL) //Direct command protocol opcodes //!!! These MUST be mutually exclusive with c_comm's protocol opcodes. @@ -114,7 +126,10 @@ enum RC_SET_PROPERTY, RC_GET_PROPERTY, RC_UPDATE_RESET_COUNT, - + RC_SET_VM_STATE, + RC_GET_VM_STATE, + RC_SET_BREAKPOINTS, + RC_GET_BREAKPOINTS, NUM_RC_OPCODES }; @@ -122,9 +137,20 @@ enum enum { RC_PROP_BTONOFF, RC_PROP_SOUND_LEVEL, -RC_PROP_SLEEP_TIMEOUT +RC_PROP_SLEEP_TIMEOUT, +RC_PROP_DEBUGGING = 0xF }; +#define RC_PORTS_AB 0xFC +#define RC_PORTS_AC 0xFD +#define RC_PORTS_BC 0xFE +#define RC_PORTS_ALL 0xFF + +#define RC_OUT_AB 0x03 +#define RC_OUT_AC 0x04 +#define RC_OUT_BC 0x05 +#define RC_OUT_ABC 0x06 + // //Published status of last program to be activated //This value is published so outside parties (like the UI) can check if a program is running, @@ -134,6 +160,15 @@ RC_PROP_SLEEP_TIMEOUT //PROG_ERROR: Last program ended because of an error //PROG_ABORT: Last program ended because of (user) abort // + +typedef SBYTE PROGRAM_STATUS; +#define PROG_IDLE 0x00 +#define PROG_OK 0x01 +#define PROG_RUNNING 0x02 +#define PROG_ERROR 0x03 +#define PROG_ABORT 0x04 +#define PROG_RESET 0x05 +/* typedef enum { PROG_IDLE, @@ -143,7 +178,7 @@ typedef enum PROG_ABORT, PROG_RESET } PROGRAM_STATUS; - +*/ //Maximum size of memory pool, in bytes //!!! Code assumes this value is evenly divisible by 4! #define POOL_MAX_SIZE 32768 diff --git a/AT91SAM7S256/Source/c_cmd_alternate.c b/AT91SAM7S256/Source/c_cmd_alternate.c new file mode 100644 index 0000000..c892c9d --- /dev/null +++ b/AT91SAM7S256/Source/c_cmd_alternate.c @@ -0,0 +1,108 @@ +// +// File Description: +// This file contains an alternate implementation of c_cmd for testing purposes. +// It implements the minimal standard interface for the module, and serves as +// an example of output module control via C code. +// + +void cCmdInit(void* pHeader) +{ + pHeaders = pHeader; + + IOMapCmd.Awake = TRUE; + + dTimerInit(); + IOMapCmd.Tick = dTimerRead(); + + return; +} + +//Test: Start at speed 100 when enter is pressed; then progressively ramp down every half second until -100. +void cCmdCtrl(void) +{ + static UBYTE State = 0; + static ULONG MyTick = 0; + + if (pMapButton->State[BTN1] & PRESSED_EV) + { + pMapButton->State[BTN1] &= ~PRESSED_EV; + + State = 1; + } + + switch(State) + { + case 0: + { + //Initialize + pMapInput->Inputs[0].SensorType = LOWSPEED; + } + break; + + case 1: + { + if (pMapLowSpeed->ChannelState[0] == LOWSPEED_IDLE) + { + pMapLowSpeed->OutBuf[0].InPtr = 0; + pMapLowSpeed->OutBuf[0].OutPtr = 0; + + pMapLowSpeed->OutBuf[0].Buf[pMapLowSpeed->OutBuf[0].InPtr] = 0x88; // I2C adress = 1000100X + pMapLowSpeed->OutBuf[0].InPtr++; + pMapLowSpeed->OutBuf[0].Buf[pMapLowSpeed->OutBuf[0].InPtr] = 0x00; // Selecting register to write into + pMapLowSpeed->OutBuf[0].InPtr++; + pMapLowSpeed->OutBuf[0].Buf[pMapLowSpeed->OutBuf[0].InPtr] = 0x88; // Data to set into register => Setting Control register + pMapLowSpeed->OutBuf[0].InPtr++; + + pMapLowSpeed->InBuf[0].BytesToRx = 0; + pMapLowSpeed->ChannelState[0] = LOWSPEED_INIT; + pMapLowSpeed->State = COM_CHANNEL_ONE_ACTIVE; + + State = 2; + } + } + break; + + case 2: + { + if (pMapLowSpeed->ChannelState[0] == LOWSPEED_IDLE) + { + pMapLowSpeed->OutBuf[0].InPtr = 0; + pMapLowSpeed->OutBuf[0].OutPtr = 0; + + pMapLowSpeed->OutBuf[0].Buf[pMapLowSpeed->OutBuf[0].InPtr] = 0x88; // I2C adress = 1000100X + pMapLowSpeed->OutBuf[0].InPtr++; + pMapLowSpeed->OutBuf[0].Buf[pMapLowSpeed->OutBuf[0].InPtr] = 0x04; // Start register to read from + pMapLowSpeed->OutBuf[0].InPtr++; + + pMapLowSpeed->InBuf[0].BytesToRx = 2; // Read 2 bytes from I2C unit + pMapLowSpeed->ChannelState[0] = LOWSPEED_INIT; + pMapLowSpeed->State = COM_CHANNEL_ONE_ACTIVE; + + State = 3; + } + } + break; + + case 3: + { + + } + break; + + default: + break; + }; + + //Busy loop to ensure return on 1ms boundary + while (IOMapCmd.Tick == dTimerRead()); + + IOMapCmd.Tick = dTimerRead(); + MyTick++; + + return; +} + +void cCmdExit(void) +{ + return; +} diff --git a/AT91SAM7S256/Source/c_cmd_bytecodes.h b/AT91SAM7S256/Source/c_cmd_bytecodes.h index 5cd9dfd..36a9084 100644 --- a/AT91SAM7S256/Source/c_cmd_bytecodes.h +++ b/AT91SAM7S256/Source/c_cmd_bytecodes.h @@ -4,7 +4,7 @@ // opcode definitions // symbol, bits, arg format // -#define OPCODE_COUNT 0x38 +#define OPCODE_COUNT 0x51 //Family: Math #define OP_ADD 0x00 // dest, src1, src2 @@ -21,13 +21,13 @@ #define OP_NOT 0x09 // dest, src //Family: Bit manipulation -#define OP_CMNT 0x0A // dest, src -#define OP_LSL 0x0B // dest, src -#define OP_LSR 0x0C // dest, src -#define OP_ASL 0x0D // dest, src -#define OP_ASR 0x0E // dest, src -#define OP_ROTL 0x0F // dest, src -#define OP_ROTR 0x10 // dest, src +#define OP_CMNT 0x0A // dest, src +#define OP_LSL 0x0B // dest, src, bits +#define OP_LSR 0x0C // dest, src, bits +#define OP_ASL 0x0D // dest, src, bits +#define OP_ASR 0x0E // dest, src, bits +#define OP_ROTL 0x0F // dest, src, bits +#define OP_ROTR 0x10 // dest, src, bits //Family: Comparison #define OP_CMP 0x11 // dest, src1, src2 @@ -86,6 +86,66 @@ #define OP_SQRT 0x36 // dest, src #define OP_ABS 0x37 // dest, src +// JCH ADDS +#define OP_WAITI 0x64 // immed +#define OP_WAITV 0x65 // var +#define OP_SIGN 0x66 // dest, src +#define OP_STOPCLUMPIMMED 0x67 // clumpID +#define OP_STARTCLUMPIMMED 0x68 // clumpID +#define OP_PRIORITY 0x69 // clumpID, pri +#define OP_FMTNUM 0x6a // dest, fmt, src1 +#define OP_ARROP 0x6b // cmd, dest, src, idx, len + +// math ops (float) +#define OP_ACOS 0x6c // dest, src +#define OP_ASIN 0x6d // dest, src +#define OP_ATAN 0x6e // dest, src +#define OP_CEIL 0x6f // dest, src +#define OP_EXP 0x70 // dest, src +#define OP_FLOOR 0x71 // dest, src +#define OP_TAN 0x72 // dest, src +#define OP_COS 0x74 // dest, src +#define OP_LOG 0x76 // dest, src +#define OP_LOG10 0x77 // dest, src +#define OP_SIN 0x78 // dest, src +#define OP_TRUNC 0x7a // dest, src +#define OP_FRAC 0x7b // dest, src + +#define OP_ATAN2 0x7c // dest, src1, src2 +#define OP_POW 0x7d // dest, src1, src2 + +#define OP_MULDIV 0x7e // dest, src1, src2, src3 + +// transcendental opcodes that use degrees instead of radians +#define OP_ACOSD 0x7f // dest, src +#define OP_ASIND 0x80 // dest, src +#define OP_ATAND 0x81 // dest, src +#define OP_TAND 0x82 // dest, src +#define OP_COSD 0x84 // dest, src +#define OP_SIND 0x86 // dest, src +#define OP_ATAN2D 0x88 // dest, src1, src2 + + +// hyperbolic transcendental functions +#define OP_TANH 0x73 // dest, src +#define OP_COSH 0x75 // dest, src +#define OP_SINH 0x79 // dest, src +#define OP_TANHD 0x83 // dest, src +#define OP_COSHD 0x85 // dest, src +#define OP_SINHD 0x87 // dest, src + +// additional string opcodes + + +// array operation definitions +#define OPARR_SUM 0x00 +#define OPARR_MEAN 0x01 +#define OPARR_SUMSQR 0x02 +#define OPARR_STD 0x03 +#define OPARR_MIN 0x04 +#define OPARR_MAX 0x05 +#define OPARR_SORT 0x06 + // condition code definitions #define OPCC1_LT 0x00 #define OPCC1_GT 0x01 diff --git a/AT91SAM7S256/Source/c_cmd_drawing.inc b/AT91SAM7S256/Source/c_cmd_drawing.inc index 0132d44..a8b5d86 100644 --- a/AT91SAM7S256/Source/c_cmd_drawing.inc +++ b/AT91SAM7S256/Source/c_cmd_drawing.inc @@ -12,12 +12,17 @@ // Platform C // +#define MAX_CORNERS 128 + //absolute value of a #define ABS(a) (((a)<0) ? -(a) : (a)) //take binary sign of a, either -1, or 1 if >= 0 #define SGN(a) (((a)<0) ? -1 : 1) +#define MAX(a,b) (((a>b) ? (a) : (b))) +#define MIN(a,b) (((aNormal)) //------------------------------------------------------------------ @@ -30,7 +35,7 @@ void cCmdRestoreDefaultScreen(void); //------------------------------------------------------------------ // cCmdDrawString - Draw string to display buffer -void cCmdDrawString(UBYTE *pString, ULONG X, ULONG Y); +void cCmdDrawString(UBYTE *pString, ULONG X, ULONG Y, UBYTE InvertMode, UBYTE LogicalMode, UBYTE FillMode); // OP codes supported by RIC files enum { @@ -42,17 +47,70 @@ enum { IMG_LINE_ID = 5, IMG_RECTANGLE_ID = 6, IMG_CIRCLE_ID = 7, - IMG_NUMBOX_ID = 8 + IMG_NUMBOX_ID = 8, + IMG_ELLIPSE_ID = 9, + IMG_POLYGON_ID = 10 }; #define IMG_SYMB_USEARGS(_v) (_v & (SWORD)0xF000) #define IMG_SYMB_MAP(_v) ((_v & 0x0F00) >> 8) -#define IMG_SYMB_ARG(_v) (_v & 0x000F) +#define IMG_SYMB_ARG(_v) (_v & 0x00FF) + +//JJR +//#define DRAW_OPT_CLEAR_PIXELS (0x0004) +//#define SET_PIXELS(_v) (((_v) & DRAW_OPT_CLEAR_PIXELS) ? FALSE : TRUE) // DrawingOptions -#define DRAW_OPT_CLEAR_WHOLE_SCREEN (0x0001) -#define DRAW_OPT_CLEAR_EXCEPT_STATUS_SCREEN (0x0002) -#define DRAW_OPT_CLEAR_MODE(_v) ((_v) & 0x0003) +// (and CopyOptions) +// - parameter used within byte code drawing operations +// - now unified with 'CopyOptions' parameter in RIC files +// Bits 0 & 1 (values 0,1,2,3) control screen clearing behaviour (Not within RIC files). +// Bit 2 (value 4) controls the NOT operation, i.e. draw in white or invert text/graphics. +// Bits 3 & 4 (values 0,8,16,24) control pixel logical combinations (COPY/AND/OR/XOR). +// Bit 5 (value 32) controls shape filling, or overrides text/graphic bitmaps with set pixels. +// These may be ORed together for the full instruction. +// These operations are resolved into the separate, common parameters +// defined in 'c_display.iom' before any drawing function is called. +// Note that when drawing a RIC file, the initial 'DrawingOptions' parameter +// supplied in the drawing instruction controls screen clearing, but nothing else. +// The 'CopyOptions' parameter from each instruction in the RIC file then controls +// graphic operations, but the screen-clearing bits are ignored. + +#define DRAW_OPT_NORMAL (0x0000) +#define DRAW_OPT_LOGICAL_COPY (0x0000) + +#define DRAW_OPT_CLEAR_WHOLE_SCREEN (0x0001) +#define DRAW_OPT_CLEAR_EXCEPT_STATUS_SCREEN (0x0002) +#define DRAW_OPT_INVERT (0x0004) +#define DRAW_OPT_LOGICAL_AND (0x0008) +#define DRAW_OPT_LOGICAL_OR (0x0010) +#define DRAW_OPT_LOGICAL_XOR (0x0018) +#define DRAW_OPT_FILL_SHAPE (0x0020) + +// Combined parameter masks: +#define DRAW_OPT_CLEAR_SCREEN_MODES (0x0003) +#define DRAW_OPT_LOGICAL_OPERATIONS (0x0018) +#define DRAW_OPT_FONT_DIRECTIONS (0x01C0) + +#define DRAW_OPT_FONT_WRAP (0x0200) + +#define DRAW_OPT_FONT_DIR_L2RB (0x0000) // Font left to right bottom align +#define DRAW_OPT_FONT_DIR_L2RT (0x0040) // Font left to right top align +#define DRAW_OPT_FONT_DIR_R2LB (0x0080) // Font right to left bottom align +#define DRAW_OPT_FONT_DIR_R2LT (0x00C0) // Font right to left top align +#define DRAW_OPT_FONT_DIR_B2TL (0x0100) // Font bottom to top left align +#define DRAW_OPT_FONT_DIR_B2TR (0x0140) // Font bottom to top right align +#define DRAW_OPT_FONT_DIR_T2BL (0x0180) // Font top to bottom left align +#define DRAW_OPT_FONT_DIR_T2BR (0x01C0) // Font top to bottom right align + +#define DESC_FONTOUT 0x8001 // ID for new font out function + +// CopyOptions, as originally defined for RIC files, now equate to: +// COPY = 0 = 0x00 = DRAW_OPT_NORMAL = Copy all bits, solid and clear +// COPY_NOT = 4 = 0x04 = DRAW_OPT_INVERT = Copy all bits, but invert bitmap images first +// OR = 16 = 0x10 = DRAW_OPT_LOGICAL_OR = Copy solid bits, ignore clear bits +// BIT_CLEAR = 12 = 0x0C = DRAW_OPT_INVERT + DRAW_OPT_LOGICAL_AND = Erase screen for solid bits, ignore clear bits +//JJR // Clear Before Drawing Modes for Draw functions @@ -63,7 +121,8 @@ enum { // Screen Modes for SetScreenMode function enum { - RESTORE_NXT_SCREEN = 0 + RESTORE_NXT_SCREEN = 0, + CLEAR_NXT_SCREEN = 1 }; #define IMG_COMMON_FIELDS UWORD OpSize; UWORD OpCode; @@ -118,7 +177,7 @@ typedef struct typedef struct { IMG_COMMON_FIELDS - UWORD CopyOptions; // Copy, CopyNot, Or, BitClear; + UWORD CopyOptions; // Copy, CopyNot, Or, BitClear; //JJR ,Xor; UWORD DataAddr; // Address of an already defined sprite IMG_RECT Src; // Source rectangle IMG_PT Dst; // Destination left top @@ -164,6 +223,23 @@ typedef struct UWORD Value; // typically mapped to an argument } IMG_OP_NUMBOX; +typedef struct +{ + IMG_COMMON_FIELDS + UWORD CopyOptions; + IMG_PT Pt; + UWORD Radius1; + UWORD Radius2; +} IMG_OP_ELLIPSE; + +typedef struct +{ + IMG_COMMON_FIELDS + UWORD CopyOptions; + UWORD Count; //The actual size of the following array. + IMG_PT Points[3]; //Minimum of 3 for polygon +} IMG_OP_POLYGON; + typedef union { IMG_OP_CORE Core; IMG_OP_DESCRIPTION Desc; @@ -175,22 +251,47 @@ typedef union IMG_OP_RECT Rect; IMG_OP_CIRCLE Circle; IMG_OP_NUMBOX NumBox; + IMG_OP_ELLIPSE Ellipse; + IMG_OP_POLYGON Polygon; } IMG_OP_UNION; // Variables for DrawImage #define IMG_MAX_DATA 11 IMG_OP_UNION * gpImgData[IMG_MAX_DATA]; -SLONG * gpPassedImgVars; -SWORD gPassedVarsCount; +SLONG * gpPassedImgVars = NULL; +SWORD gPassedVarsCount = 0; // Private Prototypes -void cCmdDrawLine(SLONG x1, SLONG y1, SLONG x2, SLONG y2); -void cCmdDrawRect(SLONG left, SLONG bottom, SLONG width, SLONG hieght); +void cCmdDrawLine(SLONG x1, SLONG y1, SLONG x2, SLONG y2, UBYTE PixelMode); +void cCmdDrawRect(SLONG left, SLONG bottom, SLONG width, SLONG height, UBYTE PixelMode, UBYTE FillMode); +void cCmdDrawCircle(SLONG cx, SLONG cy, SLONG radius, UBYTE PixelMode, UBYTE FillMode); +void cCmdDrawPolygon(IMG_PT* points, UWORD polyCorners, UBYTE PixelMode, UBYTE FillMode); +void cCmdDrawEllipse(SWORD cx, SWORD cy, SWORD a, SWORD b, UBYTE PixelMode, UBYTE FillMode); void cCmdCopyBitMapBits(SLONG dst_x, SLONG dst_y, SLONG src_x, SLONG src_y, SLONG src_width, SLONG src_height, - IMG_OP_SPRITE * pSprite); + IMG_OP_SPRITE * pSprite, + UBYTE InvertMode, UBYTE LogicalMode, UBYTE FillMode); SLONG cCmdResolveValue(SWORD Value); -void cCmdSetPixel(SLONG X, SLONG Y, ULONG Val); +void cCmdSetPixel(SLONG X, SLONG Y, ULONG PixelMode); + +UBYTE cCmdResolveDrawingMode(UWORD DrawingOptions, UBYTE* pPixelMode, UBYTE* pFillMode); +void cCmdResolveBitmapMode(UWORD DrawingOptions, UBYTE* pInvertMode, UBYTE* pLogicalMode, UBYTE* pFillMode); +UBYTE cCmdResolveClearScreenMode(UWORD DrawingOptions); + +void cCmdResolveFontOptions(UWORD DrawingOptions, UBYTE* pFontDir, UBYTE* pFontWrap); +void cCmdDrawFont(IMG_OP_SPRITE *pSprite, SLONG sW, SLONG sH, SLONG startx, SLONG starty, + UBYTE fontDir, UBYTE fontWrap, UBYTE invertMode, UBYTE logicalMode, UBYTE fillMode); + + +void cCmdDrawTextHelper(ULONG DrawOptions, UBYTE *pString, IMG_PT * pPt) +{ + UBYTE invertMode, logicalMode, fillMode; + cCmdClearScreenIfNeeded(DrawOptions); + // Display the String + cCmdResolveBitmapMode(DrawOptions, &invertMode, &logicalMode, &fillMode); + cCmdDrawString(pString, (UBYTE)pPt->X, (UBYTE)pPt->Y, invertMode, logicalMode, fillMode); + pMapDisplay->UpdateMask |= SCREEN_BIT(SCREEN_BACKGROUND); +} //----------------------------------------------------------------- //cCmdWrapDrawText @@ -202,18 +303,10 @@ void cCmdSetPixel(SLONG X, SLONG Y, ULONG Val); NXT_STATUS cCmdWrapDrawText(UBYTE * ArgV[]) { IMG_PT * pPt = (IMG_PT*) ArgV[1]; - ArgV[2] = (UBYTE*)cCmdDVPtr(*(DV_INDEX *)(ArgV[2])); //Resolve array argument - - cCmdClearScreenIfNeeded(*(ULONG*)ArgV[3]); - - // Display the String - cCmdDrawString(ArgV[2], (UBYTE)pPt->X, (UBYTE)(pPt->Y)); - pMapDisplay->UpdateMask |= SCREEN_BIT(SCREEN_BACKGROUND); - + cCmdDrawTextHelper(*(ULONG*)ArgV[3], ArgV[2], pPt); // Set return value *((SBYTE*)(ArgV[0])) = NO_ERR; - return NO_ERR; } @@ -225,11 +318,14 @@ NXT_STATUS cCmdWrapDrawText(UBYTE * ArgV[]) NXT_STATUS cCmdWrapDrawPoint(UBYTE * ArgV[]) { IMG_PT * pPt = (IMG_PT*) ArgV[1]; + ULONG DrawOptions = *(ULONG*)ArgV[2]; + UBYTE pixelMode, fillMode; - cCmdClearScreenIfNeeded(*(ULONG*)ArgV[2]); + cCmdClearScreenIfNeeded(DrawOptions); - // Display the String - cCmdSetPixel(pPt->X, pPt->Y, TRUE); + // Display the Pixel + if (cCmdResolveDrawingMode(DrawOptions, &pixelMode, &fillMode)) + cCmdSetPixel(pPt->X, pPt->Y, pixelMode); pMapDisplay->UpdateMask |= SCREEN_BIT(SCREEN_BACKGROUND); @@ -249,10 +345,13 @@ NXT_STATUS cCmdWrapDrawLine(UBYTE * ArgV[]) { IMG_PT * pPt1 = (IMG_PT*) ArgV[1]; IMG_PT * pPt2 = (IMG_PT*) ArgV[2]; + ULONG DrawOptions = *(ULONG*)ArgV[3]; + UBYTE pixelMode, fillMode; - cCmdClearScreenIfNeeded(*(ULONG*)ArgV[3]); + cCmdClearScreenIfNeeded(DrawOptions); - cCmdDrawLine(pPt1->X, pPt1->Y, pPt2->X, pPt2->Y); + if (cCmdResolveDrawingMode(DrawOptions, &pixelMode, &fillMode)) + cCmdDrawLine(pPt1->X, pPt1->Y, pPt2->X, pPt2->Y, pixelMode); pMapDisplay->UpdateMask |= SCREEN_BIT(SCREEN_BACKGROUND); @@ -270,66 +369,18 @@ NXT_STATUS cCmdWrapDrawLine(UBYTE * ArgV[]) //ArgV[3]: Options (ULONG) NXT_STATUS cCmdWrapDrawCircle(UBYTE * ArgV[]) { - SLONG x, x1, y1, y, dp, delta; IMG_PT * pPt = (IMG_PT*) ArgV[1]; SLONG radius = *(UBYTE*)ArgV[2]; - - cCmdClearScreenIfNeeded(*(ULONG*)ArgV[3]); - - x1 = pPt->X; - y1 = pPt->Y; - x = 0; - y = radius; - dp=2*(1-radius); - while(y >= 0) - { - cCmdSetPixel((x+x1), (y+y1), TRUE); - cCmdSetPixel((-x+x1),(-y+y1), TRUE); - cCmdSetPixel((x+x1), (-y+y1), TRUE); - cCmdSetPixel((-x+x1),(y+y1), TRUE); - if(dp<0) - { - delta = 2*dp + 2*y - 1; - if (delta > 0) - { - x++; - y--; - dp += 2*x - 2*y + 2; - } - else - { - x++; - dp += 2*x + 1; - } - } - else if (dp > 0) - { - delta = 2*dp - 2*x - 1; - if (delta > 0) - { - y--; - dp += 1 - 2*y; - } - else - { - x++; - y--; - dp += 2*x - 2*y + 2; - } - } - else - { - x++; - y--; - dp += 2*x - 2*y +2; - } - } - + ULONG DrawOptions = *(ULONG*)ArgV[3]; + UBYTE pixelMode, fillMode; + + cCmdClearScreenIfNeeded(DrawOptions); + if (cCmdResolveDrawingMode(DrawOptions, &pixelMode, &fillMode)) + cCmdDrawCircle(pPt->X, pPt->Y, radius, pixelMode, fillMode); + pMapDisplay->UpdateMask |= SCREEN_BIT(SCREEN_BACKGROUND); - // Set return value *((SBYTE*)(ArgV[0])) = NO_ERR; - return NO_ERR; } @@ -343,10 +394,13 @@ NXT_STATUS cCmdWrapDrawRect(UBYTE * ArgV[]) { IMG_PT * pPt1 = (IMG_PT*) ArgV[1]; IMG_PT * pPt2 = (IMG_PT*) ArgV[2]; // Second point is actually (width, height) + ULONG DrawOptions = *(ULONG*)ArgV[3]; + UBYTE pixelMode, fillMode; - cCmdClearScreenIfNeeded(*(ULONG*)ArgV[3]); + cCmdClearScreenIfNeeded(DrawOptions); - cCmdDrawRect(pPt1->X, pPt1->Y, pPt2->X, pPt2->Y); + if (cCmdResolveDrawingMode(DrawOptions, &pixelMode, &fillMode)) + cCmdDrawRect(pPt1->X, pPt1->Y, pPt2->X, pPt2->Y, pixelMode, fillMode); pMapDisplay->UpdateMask |= SCREEN_BIT(SCREEN_BACKGROUND); @@ -356,6 +410,66 @@ NXT_STATUS cCmdWrapDrawRect(UBYTE * ArgV[]) return NO_ERR; } +//----------------------------------------------------------------- +//cCmdWrapDrawPolygon +//ArgV[0]: (Function return) Status byte, SBYTE +//ArgV[1]: Points IMG_PT[] +//ArgV[2]: Options (ULONG) +NXT_STATUS cCmdWrapDrawPolygon(UBYTE * ArgV[]) +{ + ULONG DrawOptions = *(ULONG*)ArgV[2]; + UBYTE pixelMode, fillMode; + + //Resolve array argument + IMG_PT * Points = (IMG_PT*)cCmdDVPtr(*(DV_INDEX *)(ArgV[1])); + UWORD polyCorners = DV_ARRAY[*(DV_INDEX *)(ArgV[1])].Count; + if (polyCorners <= MAX_CORNERS) { + + cCmdClearScreenIfNeeded(DrawOptions); + + if (cCmdResolveDrawingMode(DrawOptions, &pixelMode, &fillMode)) + cCmdDrawPolygon(Points, polyCorners, pixelMode, fillMode); + + pMapDisplay->UpdateMask |= SCREEN_BIT(SCREEN_BACKGROUND); + + // Set return value + *((SBYTE*)(ArgV[0])) = NO_ERR; + + return NO_ERR; + } + else { + // Set return value + *((SBYTE*)(ArgV[0])) = ERR_INSTR; + + return ERR_INSTR; + } +} + +//----------------------------------------------------------------- +//cCmdWrapDrawEllipse +//ArgV[0]: (Function return) Status byte, SBYTE +//ArgV[1]: Start Location (IMG_PT *) +//ArgV[2]: Radius1 (U8) +//ArgV[3]: Radius2 (U8) +//ArgV[4]: Options (ULONG) +NXT_STATUS cCmdWrapDrawEllipse(UBYTE * ArgV[]) +{ + IMG_PT * pPt = (IMG_PT*) ArgV[1]; + SWORD radius1 = *(UBYTE*)ArgV[2]; + SWORD radius2 = *(UBYTE*)ArgV[3]; + ULONG DrawOptions = *(ULONG*)ArgV[4]; + UBYTE pixelMode, fillMode; + + cCmdClearScreenIfNeeded(DrawOptions); + if (cCmdResolveDrawingMode(DrawOptions, &pixelMode, &fillMode)) + cCmdDrawEllipse(pPt->X, pPt->Y, radius1, radius2, pixelMode, fillMode); + + pMapDisplay->UpdateMask |= SCREEN_BIT(SCREEN_BACKGROUND); + // Set return value + *((SBYTE*)(ArgV[0])) = NO_ERR; + return NO_ERR; +} + //----------------------------------------------------------------- IMG_OP_UNION * cCmdGetIMGData(ULONG DataAddr) { @@ -375,12 +489,17 @@ void cCmdSetIMGData(ULONG DataAddr, IMG_OP_UNION * pSprite) //----------------------------------------------------------------- SLONG cCmdResolveValue(SWORD Value) { - if (!IMG_SYMB_USEARGS(Value)) + if (!IMG_SYMB_USEARGS(Value) || !gpPassedImgVars || (gPassedVarsCount == 0)) { return Value; } else { + // if we try to access a variable beyond the end of the array we provided + // then just return the original value + if (IMG_SYMB_ARG(Value) >= gPassedVarsCount) + return Value; + IMG_OP_VARMAP * pVarMap; SLONG Arg; @@ -428,252 +547,829 @@ SLONG cCmdResolveValue(SWORD Value) } -//----------------------------------------------------------------- -//cCmdWrapDrawGraphic -//ArgV[0]: (Function return) Status Byte, SBYTE -//ArgV[1]: Left Top (IMG_PT *) -//ArgV[2]: Filename, CStr -//ArgV[3]: Variables, array of I32 -//ArgV[4]: Options (ULONG) -NXT_STATUS cCmdWrapDrawPicture(UBYTE * ArgV[]) +NXT_STATUS cCmdDrawPictureHelper(IMG_OP_UNION** ppImage, IMG_PT* pPoint, SLONG* pVars, ULONG DataSize, ULONG Options) { - SBYTE * pReturnVal = (SBYTE*)(ArgV[0]); - LOADER_STATUS LStatus; - NXT_STATUS DStatus = NO_ERR; - ULONG DataSize; - SLONG OpSize; - IMG_PT Pt; // Where to draw the picture at (up and to the right) - UBYTE ImageHandle; - IMG_OP_UNION * pImage; - - //Resolve array argument - ArgV[2] = (UBYTE*)cCmdDVPtr(*(DV_INDEX *)(ArgV[2])); - ArgV[3] = (UBYTE*)cCmdDVPtr(*(DV_INDEX *)(ArgV[3])); - - cCmdClearScreenIfNeeded(*(ULONG*)ArgV[4]); - - //Open the file in memory map mode. return if failure. - LStatus = pMapLoader->pFunc(OPENREADLINEAR, ArgV[2], (UBYTE*)(&pImage), &DataSize); - ImageHandle = LOADER_HANDLE(LStatus); - - //If error opening file, give up and write loader status back to user. - if (LOADER_ERR(LStatus) != SUCCESS || pImage == NULL) + SLONG OpSize; + UBYTE gFillMode, gInvertMode, gLogicalMode, gFontDir, gFontWrap; + UBYTE pixelMode, fillMode; + UBYTE invertMode, logicalMode; + IMG_PT Pt; // Where to draw the picture at (up and to the right) + NXT_STATUS DStatus = NO_ERR; + IMG_OP_UNION* pImage = *ppImage; + // Read the params, Clear the data table. + Pt = *pPoint; + gpPassedImgVars = pVars; + memset(gpImgData,0,sizeof(gpImgData)); + + cCmdClearScreenIfNeeded(Options); + + cCmdResolveBitmapMode(Options, &gInvertMode, &gLogicalMode, &gFillMode); + cCmdResolveFontOptions(Options, &gFontDir, &gFontWrap); + + // Run through the op codes. + while(!IS_ERR(DStatus)) { - *pReturnVal = (SBYTE)(LOADER_ERR_BYTE(LStatus)); - return (NO_ERR); - } - //Else, start interpretting the file - else - { - // Read the ArgV params, Clear the data table. - Pt = *(IMG_PT*)ArgV[1]; - //!!! Unsafe assumption that array is non-empty. Should check and avoid using pointer if empty. - gpPassedImgVars = (SLONG*)ArgV[3]; - memset(gpImgData,0,sizeof(gpImgData)); - - // Run through the op codes. - while(!IS_ERR(DStatus)) + // Setup to look at an opcode, make sure it looke reasonable. + if (DataSize < sizeof(IMG_OP_CORE)) + { + DStatus = ERR_FILE; + break; // Too small to look at, somethings wrong. + } + OpSize = pImage->Core.OpSize + sizeof(UWORD); + if (OpSize & 0x01) + { + DStatus = ERR_FILE; + break; // Odd sizes not allowed. + } + + switch(pImage->Core.OpCode) { - // Setup to look at an opcode, make sure it looke reasonable. - if (DataSize < sizeof(IMG_OP_CORE)) + case IMG_SPRITE_ID: { - DStatus = ERR_FILE; - break; // Too small to look at, somethings wrong. + if (OpSize >= sizeof(IMG_OP_SPRITE)) + cCmdSetIMGData(pImage->Sprite.DataAddr, pImage); } - OpSize = pImage->Core.OpSize + sizeof(UWORD); - if (OpSize & 0x01) + break; + + case IMG_VARMAP_ID: { - DStatus = ERR_FILE; - break; // Odd sizes not allowed. + if (OpSize >= sizeof(IMG_OP_VARMAP)) + cCmdSetIMGData(pImage->VarMap.DataAddr, pImage); } + break; - switch(pImage->Core.OpCode) + case IMG_COPYBITS_ID: { - case IMG_SPRITE_ID: + if (OpSize >= sizeof(IMG_OP_COPYBITS)) { - if (OpSize >= sizeof(IMG_OP_SPRITE)) - cCmdSetIMGData(pImage->Sprite.DataAddr, pImage); + IMG_OP_COPYBITS * pCB = &(pImage->CopyBits); + cCmdResolveBitmapMode(pCB->CopyOptions, &invertMode, &logicalMode, &fillMode); + cCmdCopyBitMapBits( + (cCmdResolveValue(pCB->Dst.X) + Pt.X), + (cCmdResolveValue(pCB->Dst.Y) + Pt.Y), + cCmdResolveValue((pCB->Src.Pt.X)), + cCmdResolveValue((pCB->Src.Pt.Y)), + cCmdResolveValue((pCB->Src.Width)), + cCmdResolveValue((pCB->Src.Height)), + (IMG_OP_SPRITE*)cCmdGetIMGData(cCmdResolveValue(pCB->DataAddr)), + invertMode, logicalMode, fillMode); } - break; + } + break; - case IMG_VARMAP_ID: + case IMG_LINE_ID: + { + if (OpSize >= sizeof(IMG_OP_LINE)) { - if (OpSize >= sizeof(IMG_OP_VARMAP)) - cCmdSetIMGData(pImage->VarMap.DataAddr, pImage); + IMG_OP_LINE * pL = &(pImage->Line); + cCmdResolveDrawingMode(pL->CopyOptions, &pixelMode, &fillMode); //JJR + cCmdDrawLine( + (cCmdResolveValue(pL->Pt1.X)+Pt.X), + (cCmdResolveValue(pL->Pt1.Y)+Pt.Y), + (cCmdResolveValue(pL->Pt2.X)+Pt.X), + (cCmdResolveValue(pL->Pt2.Y)+Pt.Y), + pixelMode //JJR + ); } - break; + } + break; - case IMG_COPYBITS_ID: + case IMG_RECTANGLE_ID: + { + if (OpSize >= sizeof(IMG_OP_RECT)) { - if (OpSize >= sizeof(IMG_OP_COPYBITS)) - { - IMG_OP_COPYBITS * pCB = &(pImage->CopyBits); - cCmdCopyBitMapBits( - (cCmdResolveValue(pCB->Dst.X) + Pt.X), - (cCmdResolveValue(pCB->Dst.Y) + Pt.Y), - cCmdResolveValue((pCB->Src.Pt.X)), - cCmdResolveValue((pCB->Src.Pt.Y)), - cCmdResolveValue((pCB->Src.Width)), - cCmdResolveValue((pCB->Src.Height)), - (IMG_OP_SPRITE*)cCmdGetIMGData(cCmdResolveValue(pCB->DataAddr))); - } + IMG_OP_RECT * pR = &(pImage->Rect); + cCmdResolveDrawingMode(pR->CopyOptions, &pixelMode, &fillMode); //JJR + cCmdDrawRect( + (SWORD)(cCmdResolveValue(pR->Pt.X)+Pt.X), + (SWORD)(cCmdResolveValue(pR->Pt.Y)+Pt.Y), + (SWORD)(cCmdResolveValue(pR->Width)), + (SWORD)(cCmdResolveValue(pR->Height)), + pixelMode, fillMode //JJR + ); } - break; + } + break; - case IMG_LINE_ID: + case IMG_CIRCLE_ID: + { + if (OpSize >= sizeof(IMG_OP_CIRCLE)) { - if (OpSize >= sizeof(IMG_OP_LINE)) - { - IMG_OP_LINE * pL = &(pImage->Line); - cCmdDrawLine( - (cCmdResolveValue(pL->Pt1.X)+Pt.X), - (cCmdResolveValue(pL->Pt1.Y)+Pt.Y), - (cCmdResolveValue(pL->Pt2.X)+Pt.X), - (cCmdResolveValue(pL->Pt2.Y)+Pt.Y) - ); - } + IMG_OP_CIRCLE * pC = &(pImage->Circle); + cCmdResolveDrawingMode(pC->CopyOptions, &pixelMode, &fillMode); //JJR + cCmdDrawCircle( + (SWORD)(cCmdResolveValue(pC->Pt.X)+Pt.X), + (SWORD)(cCmdResolveValue(pC->Pt.Y)+Pt.Y), + (SWORD)(cCmdResolveValue(pC->Radius)), + pixelMode, fillMode //JJR + ); } - break; + } + break; - case IMG_RECTANGLE_ID: + case IMG_PIXEL_ID: + { + if (OpSize >= sizeof(IMG_OP_PIXEL)) { - if (OpSize >= sizeof(IMG_OP_LINE)) - { - IMG_OP_RECT * pL = &(pImage->Rect); - cCmdDrawRect( - (SWORD)(cCmdResolveValue(pL->Pt.X)+Pt.X), - (SWORD)(cCmdResolveValue(pL->Pt.Y)+Pt.Y), - (SWORD)(cCmdResolveValue(pL->Width)), - (SWORD)(cCmdResolveValue(pL->Height)) + cCmdResolveDrawingMode(pImage->Pixel.CopyOptions, &pixelMode, &fillMode); //JJR + cCmdSetPixel( + (cCmdResolveValue(pImage->Pixel.Pt.X) + Pt.X), + (cCmdResolveValue(pImage->Pixel.Pt.Y) + Pt.Y), + pixelMode //JJR ); - } } - break; + } + break; - case IMG_PIXEL_ID: + case IMG_NUMBOX_ID: + { + if (OpSize >= sizeof(IMG_OP_NUMBOX)) { - if (OpSize >= sizeof(IMG_OP_PIXEL)) - { - cCmdSetPixel( - (cCmdResolveValue(pImage->Pixel.Pt.X) + Pt.X), - (cCmdResolveValue(pImage->Pixel.Pt.Y) + Pt.Y), - TRUE); - } + UBYTE NumStr[20]; + IMG_OP_NUMBOX * pNB = &(pImage->NumBox); + sprintf((PSZ)NumStr, "%d", cCmdResolveValue(pNB->Value)); + cCmdResolveBitmapMode(pNB->CopyOptions, &invertMode, &logicalMode, &fillMode); + cCmdDrawString( + NumStr, + (UBYTE) (cCmdResolveValue(pNB->Pt.X) + Pt.X), + (UBYTE) (cCmdResolveValue(pNB->Pt.Y) + Pt.Y), + invertMode, logicalMode, fillMode //JJR + ); } - break; + } + break; - case IMG_NUMBOX_ID: + case IMG_ELLIPSE_ID: + { + if (OpSize >= sizeof(IMG_OP_ELLIPSE)) { - if (OpSize >= sizeof(IMG_OP_NUMBOX)) - { - UBYTE NumStr[20]; - IMG_OP_NUMBOX * pNB = &(pImage->NumBox); - sprintf((PSZ)NumStr, "%d", cCmdResolveValue(pNB->Value)); - cCmdDrawString( - NumStr, - (UBYTE) (cCmdResolveValue(pNB->Pt.X) + Pt.X), - (UBYTE) (cCmdResolveValue(pNB->Pt.Y) + Pt.Y)); - } + IMG_OP_ELLIPSE * pE = &(pImage->Ellipse); + cCmdResolveDrawingMode(pE->CopyOptions, &pixelMode, &fillMode); //JJR + cCmdDrawEllipse( + (SWORD)(cCmdResolveValue(pE->Pt.X)+Pt.X), + (SWORD)(cCmdResolveValue(pE->Pt.Y)+Pt.Y), + (SWORD)(cCmdResolveValue(pE->Radius1)), + (SWORD)(cCmdResolveValue(pE->Radius2)), + pixelMode, fillMode //JJR + ); } - break; + } + break; - case IMG_DESCRIPTION_ID: + case IMG_POLYGON_ID: + { + if (OpSize >= sizeof(IMG_OP_POLYGON)) { - //No-op + IMG_OP_POLYGON * pP = &(pImage->Polygon); + cCmdResolveDrawingMode(pP->CopyOptions, &pixelMode, &fillMode); //JJR + // resolve all the values in the struct + for(int i=0;iCount; i++) { + pP->Points[i].X = (SWORD)(cCmdResolveValue(pP->Points[i].X)+Pt.X); + pP->Points[i].Y = (SWORD)(cCmdResolveValue(pP->Points[i].Y)+Pt.Y); + } + cCmdDrawPolygon(pP->Points, pP->Count, pixelMode, fillMode); } - break; + } + break; - default: + case IMG_DESCRIPTION_ID: + { + switch( pImage->Desc.Options ) { - //Unrecognized opcode, pass an error back to the user. - DStatus = ERR_FILE; + case DESC_FONTOUT : + cCmdDrawFont((IMG_OP_SPRITE*)cCmdGetIMGData(1), pImage->Desc.Width, + pImage->Desc.Height, Pt.X, Pt.Y, gFontDir, gFontWrap, gInvertMode, + gLogicalMode, gFillMode); + break; } - break; } + break; - DataSize -= OpSize; - pImage = (IMG_OP_UNION*) ((UBYTE*)pImage + OpSize); + default: + { + //Unrecognized opcode, pass an error back to the user. + DStatus = ERR_FILE; + } + break; } - pMapDisplay->UpdateMask |= SCREEN_BIT(SCREEN_BACKGROUND); + DataSize -= OpSize; + pImage = (IMG_OP_UNION*) ((UBYTE*)pImage + OpSize); } + gpPassedImgVars = NULL; + memset(gpImgData,0,sizeof(gpImgData)); + pMapDisplay->UpdateMask |= SCREEN_BIT(SCREEN_BACKGROUND); + return DStatus; +} - // Set return value, close file and return - *pReturnVal = DStatus; +void cCmdDrawPictureFromFile(UBYTE *pFilename, IMG_PT* pPoint, SLONG* pVars, ULONG Options, SBYTE * pReturnVal) +{ + LOADER_STATUS LStatus; + ULONG DataSize; + UBYTE ImageHandle; + IMG_OP_UNION * pImage; + + //Open the file in memory map mode. return if failure. + LStatus = pMapLoader->pFunc(OPENREADLINEAR, pFilename, (UBYTE*)(&pImage), &DataSize); + ImageHandle = LOADER_HANDLE(LStatus); + + //If error opening file, give up and write loader status back to user. + if (LOADER_ERR(LStatus) != SUCCESS || pImage == NULL) + { + *pReturnVal = (SBYTE)(LOADER_ERR_BYTE(LStatus)); + return; + } + //Else, start interpretting the file + else + { + *pReturnVal = cCmdDrawPictureHelper(&pImage, pPoint, pVars, DataSize, Options); + } pMapLoader->pFunc(CLOSE, &ImageHandle, NULL, NULL); +} + +//----------------------------------------------------------------- +//cCmdWrapDrawPicture +//ArgV[0]: (Function return) Status Byte, SBYTE +//ArgV[1]: Left Top (IMG_PT *) +//ArgV[2]: Filename, CStr +//ArgV[3]: Variables, array of I32 +//ArgV[4]: Options (ULONG) +NXT_STATUS cCmdWrapDrawPicture(UBYTE * ArgV[]) +{ + SBYTE * pReturnVal = (SBYTE *)ArgV[0]; + IMG_PT* pPt = (IMG_PT*)ArgV[1]; + ULONG Options = *(ULONG *)ArgV[4]; + + // count the variables + gPassedVarsCount = DV_ARRAY[*(DV_INDEX *)(ArgV[3])].Count; + + //Resolve array argument + ArgV[2] = (UBYTE*)cCmdDVPtr(*(DV_INDEX *)(ArgV[2])); + ArgV[3] = (UBYTE*)cCmdDVPtr(*(DV_INDEX *)(ArgV[3])); + + cCmdDrawPictureFromFile((UBYTE *)ArgV[2], pPt, (SLONG *)ArgV[3], Options, pReturnVal); + + return (NO_ERR); +} + +//----------------------------------------------------------------- +//cCmdWrapDrawPictureArray +//ArgV[0]: (Function return) Status Byte, SBYTE +//ArgV[1]: Left Top (IMG_PT *) +//ArgV[2]: Data, array of U8 +//ArgV[3]: Variables, array of I32 +//ArgV[4]: Options (ULONG) +NXT_STATUS cCmdWrapDrawPictureArray(UBYTE * ArgV[]) +{ + SBYTE * pReturnVal = (SBYTE *)ArgV[0]; + IMG_PT* pPt = (IMG_PT *)ArgV[1]; + DV_INDEX DVIndex = *(DV_INDEX*)ArgV[2]; + ULONG Options = *(ULONG *)ArgV[4]; + ULONG DataSize = DV_ARRAY[DVIndex].Count; + IMG_OP_UNION* pImage; + + // count the variables + gPassedVarsCount = DV_ARRAY[*(DV_INDEX *)(ArgV[3])].Count; + + //Resolve array argument + pImage = (IMG_OP_UNION*)cCmdDVPtr(DVIndex); + ArgV[3] = (UBYTE*)cCmdDVPtr(*(DV_INDEX *)(ArgV[3])); // pVar + + *pReturnVal = cCmdDrawPictureHelper((IMG_OP_UNION**)&pImage, pPt, (SLONG*)ArgV[3], DataSize, Options); return (NO_ERR); } //----------------------------------------------------------------- -// cCmdDrawLine - draw a line. All clipping is done by the set pixel function. +//cCmdWrapDrawFont +//ArgV[0]: (Function return) Status Byte, SBYTE +//ArgV[1]: Left Top (IMG_PT *) +//ArgV[2]: FontFilename, CStr +//ArgV[3]: Text, CStr +//ArgV[4]: Options (ULONG) +NXT_STATUS cCmdWrapDrawFont(UBYTE * ArgV[]) +{ + SBYTE * pReturnVal = (SBYTE *)ArgV[0]; + IMG_PT * pPt = (IMG_PT*)ArgV[1]; + ULONG Options = *(ULONG *)ArgV[4]; + + // count the number of characters + gPassedVarsCount = DV_ARRAY[*(DV_INDEX *)(ArgV[3])].Count; + + //Resolve array arguments + ArgV[2] = (UBYTE*)cCmdDVPtr(*(DV_INDEX *)(ArgV[2])); + ArgV[3] = (UBYTE*)cCmdDVPtr(*(DV_INDEX *)(ArgV[3])); + + if (strlen((PSZ)ArgV[2]) == 0) { + // if font filename is empty then use draw text instead + cCmdDrawTextHelper(Options, ArgV[3], pPt); + // Set return value + *pReturnVal = NO_ERR; + return NO_ERR; + } + else + { + // count the variables + gPassedVarsCount = MIN(strlen((PSZ)ArgV[3]), 256); + // copy data from input string into SLONG* array + SLONG Vars[256]; + for(int i=0; i<256;i++) { + if (i < gPassedVarsCount) + Vars[i] = ArgV[3][i]; + else + Vars[i] = 0; + } + cCmdDrawPictureFromFile((UBYTE *)ArgV[2], pPt, (SLONG*)Vars, Options, pReturnVal); + return (NO_ERR); + } +} + +//----------------------------------------------------------------- +// cCmdDrawLine - draw a line. Line is clipped to screen boundaries. void cCmdDrawLine( SLONG x1, SLONG y1, SLONG x2, - SLONG y2) -{ - SLONG d,x,y,ax,ay,sx,sy,dx,dy; - - // Initialize variables - dx = x2-x1; ax = ABS(dx)<<1; sx = SGN(dx); - dy = y2-y1; ay = ABS(dy)<<1; sy = SGN(dy); - x = x1; - y = y1; - if (ax>ay) - { /* x dominant */ - d = ay-(ax>>1); - for (;;) + SLONG y2, + UBYTE PixelMode) //JJR +{ + SLONG tx, ty; //JJR + SLONG dx, dy; //JJR + + dx = x2-x1; //JJR + dy = y2-y1; //JJR + + //Clip line ends vertically - easier if y1 y2) {tx=x1; x1=x2; x2=tx; + ty=y1; y1=y2; y2=ty;} + + //Is line completely off screen? + if (y2<0 || y1>=DISPLAY_HEIGHT) return; + + //Trim y1 end: + if (y1 < 0) + { + if (dx && dy) + x1 = x1 + (((0-y1)*dx)/dy); + y1 = 0; + } + //Trim y2 end: + if (y2 > DISPLAY_HEIGHT-1) + { + if (dx && dy) + x2 = x2 - (((y2-(DISPLAY_HEIGHT-1))*dx)/dy); + y2 = DISPLAY_HEIGHT-1; + } + + //Clip horizontally - easier if x1 x2) {tx=x1; x1=x2; x2=tx; + ty=y1; y1=y2; y2=ty;} + + //Is line completely off screen? + if (x2<0 || x1>=DISPLAY_WIDTH) return; + + //Trim x1 end: + if (x1 < 0) { - cCmdSetPixel(x, y, TRUE); - if (x==x2) - return; - if (d>=0) - { - y += sy; - d -= ax; - } - x += sx; - d += ay; + if (dx && dy) + y1 = y1 + (((0-x1)*dy)/dx); + x1 = 0; } - } - else - { /* y dominant */ - d = ax-(ay>>1); - for (;;) + //Trim x2 end: + if (x2 > DISPLAY_WIDTH-1) { - cCmdSetPixel(x, y, TRUE); - if (y==y2) - return; - if (d>=0) + if (dx && dy) + y2 = y2 - (((x2-(DISPLAY_WIDTH-1))*dy)/dx); + x2 = DISPLAY_WIDTH-1; + } + + if (x1 == x2) { + // vertical line or a single point + if (y1 == y2) + //cCmdSetPixel(x1, y1, Set); //JJR + pMapDisplay->pFunc(DISPLAY_PIXEL, (UBYTE)PixelMode, (UBYTE)x1, (UBYTE)TRANSLATE_Y(y1), 0, 0); //JJR + else + { + //pMapDisplay->pFunc(DISPLAY_VERTICAL_LINE, Set, x1, TRANSLATE_Y(y1), 0, TRANSLATE_Y(y2)); //JJR + pMapDisplay->pFunc(DISPLAY_VERTICAL_LINE, PixelMode, x1, TRANSLATE_Y(y1), 0, TRANSLATE_Y(y2)); //JJR + } + } + else if (y1 == y2) { + + // horizontal line (single point already dealt with) + pMapDisplay->pFunc(DISPLAY_HORIZONTAL_LINE, PixelMode, x1, TRANSLATE_Y(y1), x2, 0); //JJR + } + else { + SLONG d,x,y,ax,ay,sx,sy,dx,dy; + // Initialize variables + dx = x2-x1; ax = ABS(dx)<<1; sx = SGN(dx); + dy = y2-y1; ay = ABS(dy)<<1; sy = SGN(dy); + x = x1; + y = y1; + if (ax>ay) + { // x dominant + d = ay-(ax>>1); + for (;;) { + //cCmdSetPixel(x, y, Set); //JJR + pMapDisplay->pFunc(DISPLAY_PIXEL, (UBYTE)PixelMode, (UBYTE)x, (UBYTE)TRANSLATE_Y(y), 0, 0); //JJR + if (x==x2) + return; + if (d>=0) + { + y += sy; + d -= ax; + } x += sx; - d -= ay; + d += ay; + } + } + else + { // y dominant + d = ax-(ay>>1); + for (;;) + { + //cCmdSetPixel(x, y, Set); //JJR + pMapDisplay->pFunc(DISPLAY_PIXEL, (UBYTE)PixelMode, (UBYTE)x, (UBYTE)TRANSLATE_Y(y), 0, 0); //JJR + if (y==y2) + return; + if (d>=0) + { + x += sx; + d -= ay; + } + y += sy; + d += ax; } - y += sy; - d += ax; } } } //----------------------------------------------------------------- -// cCmdDrawRect - draw a rectangle. All clipping is done by the set pixel function. +// cCmdDrawRect - draw a rectangle. void cCmdDrawRect( SLONG left, SLONG bottom, SLONG width, - SLONG height) + SLONG height, + UBYTE PixelMode, //JJR + UBYTE FillMode) //JJR +{ + SLONG x1, y1; + SLONG x2, y2; + SLONG t; + + x1 = left; + x2 = left + width; +/* + if (width > 0) + x2 = left + width - 1; + else if (width < 0) + x2 = left + width + 1; + else + x2 = x1; +*/ + y1 = bottom; + y2 = bottom + height; +/* + if (height > 0) + y2 = bottom + height - 1; + else if (height < 0) + y2 = bottom + height + 1; + else + y2 = y1; +*/ + + if (x1>x2) {t = x1; x1 = x2; x2 = t;} + if (y1>y2) {t = y1; y1 = y2; y2 = t;} + + if (y2 == y1 || x2 == x1) { + // height == 0 so draw a single pixel horizontal line OR + // width == 0 so draw a single pixel vertical line + cCmdDrawLine(x1, y1, x2, y2, PixelMode); + return; + } + // rectangle has abs(width) or abs(height) >= 1 + if (FillMode == DRAW_SHAPE_FILLED) + { + if (x2<0 || y2<0 || x1>DISPLAY_WIDTH-1 || y1>DISPLAY_HEIGHT-1) return; + if (x1<0) x1=0; + if (y1<0) y1=0; + if (x2>DISPLAY_WIDTH-1) x2=DISPLAY_WIDTH-1; + if (y2>DISPLAY_HEIGHT-1) y2=DISPLAY_HEIGHT-1; + pMapDisplay->pFunc(DISPLAY_FILL_REGION, PixelMode, x1, TRANSLATE_Y(y2), x2-x1+1, y2-y1+1); + } + else + { + //Use the full line drawing functions rather than horizontal/vertical + //functions so these get clipped properly. These will fall straight + //through to the faster functions anyway. + //Also don't re-draw parts of slim rectangles since XOR might be on. + + cCmdDrawLine(x1, y1, x2, y1, PixelMode); + if (y2>y1) + { + cCmdDrawLine(x1, y2, x2, y2, PixelMode); + if (y2 > y1+1) + { + cCmdDrawLine(x2, y1+1, x2, y2-1, PixelMode); + if (x2>x1) + cCmdDrawLine(x1, y1+1, x1, y2-1, PixelMode); + } + } + } + +} + +void cCmdDrawPolygon(IMG_PT* points, UWORD polyCorners, UBYTE PixelMode, UBYTE FillMode) { - SLONG right = left + width; - SLONG top = bottom + height; + if (FillMode == DRAW_SHAPE_FILLED) + { + int nodes; + int nodeX[MAX_CORNERS]; + int pixelY; + int i, j; + int swap; + int IMAGE_TOP = -1; + int IMAGE_BOTTOM = 1024; + int IMAGE_RIGHT = -1; + int IMAGE_LEFT = 1024; + // calculate maximum and minimum X and Y coordinate values + for(i=0;iIMAGE_TOP) IMAGE_TOP = tmpY; + if (tmpYIMAGE_RIGHT) IMAGE_RIGHT = tmpX; + if (tmpX=pixelY) || + (pJ.Y=pixelY)) { + nodeX[nodes++]=(pI.X+(pixelY-pI.Y)*(pJ.X-pI.X)/(pJ.Y-pI.Y)); + } + j=i; + } + + // Sort the nodes, via a simple “Bubble” sort. + i=0; + while (inodeX[i+1]) { + swap=nodeX[i]; + nodeX[i]=nodeX[i+1]; + nodeX[i+1]=swap; + if (i) i--; + } + else + i++; + } - // Draw the four line segments - cCmdDrawLine(left, top, right, top); - cCmdDrawLine(right, top, right, bottom); - cCmdDrawLine(right, bottom, left, bottom); - cCmdDrawLine(left, bottom, left, top); + // Fill the pixels between node pairs. + for (i=0; i=IMAGE_RIGHT) break; + if (nodeX[i+1]> IMAGE_LEFT) { + if (nodeX[i ]< IMAGE_LEFT) nodeX[i ]=IMAGE_LEFT; + if (nodeX[i+1]> IMAGE_RIGHT) nodeX[i+1]=IMAGE_RIGHT; + cCmdDrawLine(nodeX[i], pixelY, nodeX[i+1], pixelY, PixelMode); + } + } + } + } + else + { + for(int i = 0, j = polyCorners-1; i=0 && x<=a) + { + if (FillMode != DRAW_SHAPE_FILLED) + { + cCmdSetPixel(xc+x, yc+y, PixelMode); + if (x!=0 || y!=0) + cCmdSetPixel(xc-x, yc-y, PixelMode); + if (x!=0 && y!=0) + { + cCmdSetPixel(xc+x, yc-y, PixelMode); + cCmdSetPixel(xc-x, yc+y, PixelMode); + } + } + if (t + b2*x <= crit1 || /* e(x+1,y-1/2) <= 0 */ + t + a2*y <= crit3) /* e(x+1/2,y) <= 0 */ + { + if (FillMode == DRAW_SHAPE_FILLED) + { + if (height == 1) + ; /* draw nothing */ + else if (ry*2+1 > (height-1)*2) + { + cCmdDrawRect(xc-rx, yc-ry, width-1, height-1, PixelMode, FillMode); + cCmdDrawRect(xc-rx, yc+ry, width-1, -(height-1), PixelMode, FillMode); + ry -= height-1; + height = 1; + } + else + { + cCmdDrawRect(xc-rx, yc-ry, width-1, ry*2, PixelMode, FillMode); + ry -= ry; + height = 1; + } + rx++; + width += 2; + } + x++; + dxt += d2xt; + t += dxt; + } + else if (t - a2*y > crit2) /* e(x+1/2,y-1) > 0 */ + { + y--; + dyt += d2yt; + t += dyt; + if (FillMode == DRAW_SHAPE_FILLED) + height++; + } + else + { + if (FillMode == DRAW_SHAPE_FILLED) + { + if (ry*2+1 > height*2) + { + cCmdDrawRect(xc-rx, yc-ry, width-1, height-1, PixelMode, FillMode); + cCmdDrawRect(xc-rx, yc+ry, width-1, -(height-1), PixelMode, FillMode); + } + else + { + cCmdDrawRect(xc-rx, yc-ry, width-1, ry*2, PixelMode, FillMode); + } + width += 2; + ry -= height; + height = 1; + rx++; + } + x++; + dxt += d2xt; + t += dxt; + y--; + dyt += d2yt; + t += dyt; + } + } + if (FillMode == DRAW_SHAPE_FILLED) + { + if (ry > height) { + cCmdDrawRect(xc-rx, yc-ry, width-1, height-1, PixelMode, FillMode); + cCmdDrawRect(xc-rx, yc+ry, width-1, -(height-1), PixelMode, FillMode); + } + else { + cCmdDrawRect(xc-rx, yc-ry, width-1, ry*2, PixelMode, FillMode); + } + } +} + +//----------------------------------------------------------------- +// cCmdDrawCircle - draw a circle. All clipping is done by the set pixel function. +//void cCmdDrawCircle(SLONG cx, SLONG cy, SLONG radius, UBYTE Set) //JJR +void cCmdDrawCircle(SLONG cx, SLONG cy, SLONG radius, UBYTE PixelMode, UBYTE FillMode) //JJR +{ + cCmdDrawEllipse(cx, cy, radius, radius, PixelMode, FillMode); +} +/* +//----------------------------------------------------------------- +// cCmdDrawCircle - draw a circle. All clipping is done by the set pixel function. +//void cCmdDrawCircle(SLONG cx, SLONG cy, SLONG radius, UBYTE Set) //JJR +void cCmdDrawCircle(SLONG cx, SLONG cy, SLONG radius, UBYTE PixelMode, UBYTE FillMode) //JJR +{ + SLONG f, ddF_x, ddF_y, x, y; + SLONG ox, oy; //JJR + + f = 1 - radius; + ddF_x = 0; + ddF_y = -2 * radius; + x = 0; + y = abs(radius); //JJR + +//JJR + if (y==0) + { + cCmdSetPixel(cx, cy + radius, PixelMode); + return; + } + + if (FillMode == DRAW_SHAPE_FILLED) + { + cCmdDrawLine(cx-radius, cy, cx+radius, cy, PixelMode); + } + else + { + cCmdSetPixel(cx + radius, cy, PixelMode); + cCmdSetPixel(cx - radius, cy, PixelMode); + } + + if (FillMode != DRAW_SHAPE_FILLED || y==1) + { + cCmdSetPixel(cx, cy + radius, PixelMode); + cCmdSetPixel(cx, cy - radius, PixelMode); + } + + if (y==1) return; + + + while (x < y) + { + ox = x; //JJR + oy = y; //JJR + if(f >= 0) + { + y--; + ddF_y += 2; + f += ddF_y; + } + x++; + ddF_x += 2; + f += ddF_x + 1; + +//JJR + //Need to avoid duplicating pixels if drawing with XOR: + + if (FillMode == DRAW_SHAPE_FILLED) + { + //Fill by drawing successive horizontal lines above and below + //a horizontal centre line. + if (x <= y) + { + cCmdDrawLine(cx-y, cy+x, cx+y, cy+x, PixelMode); + cCmdDrawLine(cx-y, cy-x, cx+y, cy-x, PixelMode); + } + //Only draw horizontal lines from the top and bottom if: + //i. The line doesn't overlap with the one just drawn, and the top + // curve has just stepped down a pixel or: + //ii. A line wasn't just drawn and the loop is about to exit. + if ((xy && oxOpCode!=IMG_SPRITE_ID) @@ -750,17 +1447,56 @@ void cCmdCopyBitMapBits( for (dy = dst_y; dy > last_y; dy--) { sx = src_x; - bit_y = masks[7 - (dy & 0x07)]; - not_bit_y = ~ bit_y; + bit_y = masks[7 - (dy & 0x07)]; + // not_bit_y = ~ bit_y; //JJR pDstByte = pFirstDstByte; pLastDstByte = pDstByte + (last_x - dst_x); for (; pDstByte < pLastDstByte; pDstByte++) { - if ( *(pSrcByte + (sx >> 3)) & masks[sx & 0x07] ){ - *pDstByte |= bit_y; - } else { - *pDstByte &= not_bit_y; + //Read source byte: + //If fill mode is on, pretend the source bitmap is solid: + if (FillMode==DRAW_SHAPE_FILLED) + srcByte = 0xff; + else + srcByte = *(pSrcByte + (sx >> 3)); //JJR + + //If invert mode is on, invert the source byte: + if (InvertMode==DRAW_BITMAP_INVERT) srcByte = ~srcByte; //JJR + + //Test the pixel in the source byte: + if ( srcByte & masks[sx & 0x07] ) //JJR + { + //If pixel is set in source image: + switch (LogicalMode) + { + case DRAW_LOGICAL_AND: + break; + case DRAW_LOGICAL_XOR: + *pDstByte ^= bit_y; + break; + case DRAW_LOGICAL_OR: + case DRAW_LOGICAL_COPY: + default: + *pDstByte |= bit_y; + break; + } } + else + { + //If pixel is clear in source image: + switch (LogicalMode) + { + case DRAW_LOGICAL_OR: + case DRAW_LOGICAL_XOR: + break; + case DRAW_LOGICAL_AND: + case DRAW_LOGICAL_COPY: + default: + *pDstByte &= ~bit_y; + break; + } + } +//JJR sx ++; } pSrcByte -= rowbytes; @@ -772,15 +1508,15 @@ void cCmdCopyBitMapBits( } //----------------------------------------------------------------- -// cCmdSetPixel - Set or clear a pixel based on Val -void cCmdSetPixel(SLONG X, SLONG Y, ULONG Val) +// cCmdSetPixel - Set, clear or invert a pixel based on PixelMode +void cCmdSetPixel(SLONG X, SLONG Y, ULONG PixelMode) { Y = TRANSLATE_Y(Y); - pMapDisplay->pFunc(DISPLAY_PIXEL, (UBYTE)Val, (UBYTE)X, (UBYTE)Y, 0, 0); + if (X>=0 && X=0 && YpFunc(DISPLAY_PIXEL, (UBYTE)PixelMode, (UBYTE)X, (UBYTE)Y, 0, 0); } - //----------------------------------------------------------------- //cCmdWrapSetScreenMode //ArgV[0]: (Function return) Status code, SBYTE @@ -791,27 +1527,68 @@ NXT_STATUS cCmdWrapSetScreenMode(UBYTE * ArgV[]) if (ScreenMode == RESTORE_NXT_SCREEN) { cCmdRestoreDefaultScreen(); } + else if (ScreenMode == CLEAR_NXT_SCREEN) { + pMapDisplay->pFunc(DISPLAY_ERASE_ALL, 0, 0, 0, 0, 0); + } // Set return value *(SBYTE*)(ArgV[0]) = NO_ERR; return NO_ERR; } -//------------------------------------------------------------------ -// cCmdClearScreenIfNeeded - Clear entire sceen buffer if explicitly requested or implicitly required. -void cCmdClearScreenIfNeeded(ULONG DrawOptions) +void cDirtyDisplay(ULONG* DrawOptions) { - //If we are the first drawing command, clear the screen and record that we've done so + //If we are the first drawing command mark the display as dirty if (VarsCmd.DirtyDisplay == FALSE) { VarsCmd.DirtyDisplay = TRUE; pMapUi->Flags &= ~UI_ENABLE_STATUS_UPDATE; - - //Override DrawOptions because we have to clear anyway - DrawOptions = DRAW_OPT_CLEAR_WHOLE_SCREEN; + + if (DrawOptions) { + //Override DrawOptions because we have to clear anyway + *DrawOptions = DRAW_OPT_CLEAR_WHOLE_SCREEN; + } } +} + +// +//cCmdWrapDisplayExecuteFunction +//ArgV[0]: (return) Status byte, SBYTE +//ArgV[1]: UBYTE Cmd +//ArgV[2]: UBYTE On +//ArgV[3]: UBYTE X1 +//ArgV[4]: UBYTE Y1 +//ArgV[5]: UBYTE X2 +//ArgV[6]: UBYTE Y2 +// +NXT_STATUS cCmdWrapDisplayExecuteFunction(UBYTE * ArgV[]) +{ + cDirtyDisplay(NULL); + UBYTE Cmd = *(UBYTE*)(ArgV[1]); + UBYTE Y1 = *(UBYTE*)(ArgV[4]); + UBYTE Y2 = *(UBYTE*)(ArgV[6]); + if (Cmd != DISPLAY_CHAR) + Y1 = TRANSLATE_Y(Y1); + if (Cmd == DISPLAY_VERTICAL_LINE) + Y2 = TRANSLATE_Y(Y2); + pMapDisplay->pFunc(Cmd, + *(UBYTE*)(ArgV[2]), + *(UBYTE*)(ArgV[3]), + Y1, + *(UBYTE*)(ArgV[5]), + Y2); + *(SBYTE*)(ArgV[0]) = NO_ERR; + return (NO_ERR); +} + + +//------------------------------------------------------------------ +// cCmdClearScreenIfNeeded - Clear entire sceen buffer if explicitly requested or implicitly required. +void cCmdClearScreenIfNeeded(ULONG DrawOptions) +{ + cDirtyDisplay(&DrawOptions); - if (DRAW_OPT_CLEAR_MODE(DrawOptions)) + if (cCmdResolveClearScreenMode(DrawOptions)) { pMapDisplay->pFunc(DISPLAY_ERASE_ALL, 0, 0, 0, 0, 0); @@ -827,10 +1604,12 @@ void cCmdClearScreenIfNeeded(ULONG DrawOptions) // Properly uses 'Normal' display buffer to avoid conflicts with popup buffer // Clips text at bottom and right hand edges of the screen buffer //!!! Function copied and modified from cDisplayString -void cCmdDrawString(UBYTE *pString, ULONG X, ULONG Y) +//void cCmdDrawString(UBYTE *pString, ULONG X, ULONG Y) //JJR +void cCmdDrawString(UBYTE *pString, ULONG X, ULONG Y, UBYTE InvertMode, UBYTE LogicalMode, UBYTE FillMode) //JJR { UBYTE *pSource; UBYTE *pDestination; + UBYTE a; FONT *pFont; ULONG FontWidth; ULONG Items; @@ -868,7 +1647,37 @@ void cCmdDrawString(UBYTE *pString, ULONG X, ULONG Y) pSource = (UBYTE*)&(pFont->Data[Item * FontWidth]); while (FontWidth--) { - *pDestination = *pSource; +//JJR +// *pDestination = *pSource; + + //Fetch a byte from the source bitmap: + //If fill mode is on, pretend the source bitmap is solid: + if (FillMode==DRAW_SHAPE_FILLED) + a = 0xff; + else + a = *pSource; + + //Implement bitmap invert mode: + if (InvertMode==DRAW_BITMAP_INVERT) a = ~a; + + //Implement bitmap logical mode when writing on screen: + switch (LogicalMode) + { + case DRAW_LOGICAL_OR: + *pDestination |= a; + break; + case DRAW_LOGICAL_AND: + *pDestination &= a; + break; + case DRAW_LOGICAL_XOR: + *pDestination ^= a; + break; + case DRAW_LOGICAL_COPY: + default: + *pDestination = a; + break; + } +//JJR pDestination++; pSource++; } @@ -879,7 +1688,7 @@ void cCmdDrawString(UBYTE *pString, ULONG X, ULONG Y) //------------------------------------------------------------------ // cCmdRestoreDefaultScreen - Restore to Default 'Running' screen -void cCmdRestoreDefaultScreen(void) +__ramfunc void cCmdRestoreDefaultScreen(void) { //If this program has taken over the display, reset it for the UI if (VarsCmd.DirtyDisplay == TRUE) @@ -891,4 +1700,338 @@ void cCmdRestoreDefaultScreen(void) pMapUi->Flags |= UI_ENABLE_STATUS_UPDATE | UI_REDRAW_STATUS; } + // restore default display state + pMapDisplay->Display = (UBYTE*)pMapDisplay->Normal; + pMapDisplay->Flags = DISPLAY_REFRESH | DISPLAY_ON; } + +//------------------------------------------------------------------ +// cCmdResolveDrawingMode - extract the parameters that affect pixel, line and shape +// drawing from the 'DrawingOptions' or 'CopyOptions' parameter. +// Return FALSE for combinations that do nothing. + +UBYTE cCmdResolveDrawingMode(UWORD DrawingOptions, UBYTE* pPixelMode, UBYTE* pFillMode) +{ + DrawingOptions = cCmdResolveValue(DrawingOptions); + // Extract shape fill option: + if (DrawingOptions & DRAW_OPT_FILL_SHAPE) + *pFillMode = DRAW_SHAPE_FILLED; + else + *pFillMode = DRAW_SHAPE_HOLLOW; + + // Extract pixel drawing options: + if (DrawingOptions & DRAW_OPT_INVERT) + { + //Drawing with white pixels: + switch (DrawingOptions & DRAW_OPT_LOGICAL_OPERATIONS) + { + //Only these cases do anything: + case DRAW_OPT_LOGICAL_COPY: + case DRAW_OPT_LOGICAL_AND: + *pPixelMode = DRAW_PIXELS_CLEAR; + return TRUE; + default: + break; + } + } + else + { + //Drawing with black pixels: + switch (DrawingOptions & DRAW_OPT_LOGICAL_OPERATIONS) + { + //Only these cases do anything: + case DRAW_OPT_LOGICAL_COPY: + case DRAW_OPT_LOGICAL_OR: + *pPixelMode = DRAW_PIXELS_SET; + return TRUE; + case DRAW_OPT_LOGICAL_XOR: + *pPixelMode = DRAW_PIXELS_INVERT; + return TRUE; + default: + break; + } + } + + // If no operation is required, set defaults and return FALSE. + // e.g. 'AND' on its own is meaningless for line drawing, + // 'INVERT + OR' and 'INVERT + XOR' do nothing either. + + *pPixelMode = DRAW_PIXELS_SET; + *pFillMode = DRAW_SHAPE_HOLLOW; + return FALSE; +} + +//------------------------------------------------------------------ +// cCmdResolveBitmapMode - extract the parameters that affect bitmap and text +// drawing from the 'DrawingOptions' or 'CopyOptions' parameter. +void cCmdResolveBitmapMode(UWORD DrawingOptions, UBYTE* pInvertMode, UBYTE* pLogicalMode, UBYTE* pFillMode) +{ + DrawingOptions = cCmdResolveValue(DrawingOptions); + //Extract bitmap inversion mode: + if (DrawingOptions & DRAW_OPT_INVERT) + *pInvertMode = DRAW_BITMAP_INVERT; + else + *pInvertMode = DRAW_BITMAP_PLAIN; + + //Extract bitmap logical operation: + switch (DrawingOptions & DRAW_OPT_LOGICAL_OPERATIONS) + { + case DRAW_OPT_LOGICAL_OR: + *pLogicalMode = DRAW_LOGICAL_OR; + break; + case DRAW_OPT_LOGICAL_AND: + *pLogicalMode = DRAW_LOGICAL_AND; + break; + case DRAW_OPT_LOGICAL_XOR: + *pLogicalMode = DRAW_LOGICAL_XOR; + break; + case DRAW_OPT_LOGICAL_COPY: + default: + *pLogicalMode = DRAW_LOGICAL_COPY; + break; + } + + // Extract shape fill option (overrides source bitmap with all pixels set): + if (DrawingOptions & DRAW_OPT_FILL_SHAPE) + *pFillMode = DRAW_SHAPE_FILLED; + else + *pFillMode = DRAW_SHAPE_HOLLOW; + +} + +//------------------------------------------------------------------ +// cCmdResolveFontOptions - extract the parameters that affect custom RIC font drawing +// drawing from the 'DrawingOptions' parameter. +void cCmdResolveFontOptions(UWORD DrawingOptions, UBYTE* pFontDir, UBYTE* pFontWrap) +{ + //Extract bitmap inversion mode: + if (DrawingOptions & DRAW_OPT_FONT_WRAP) + *pFontWrap = DRAW_FONT_WRAP_ON; + else + *pFontWrap = DRAW_FONT_WRAP_OFF; + + //Extract bitmap logical operation: + switch (DrawingOptions & DRAW_OPT_FONT_DIRECTIONS) + { + case DRAW_OPT_FONT_DIR_L2RB: + *pFontDir = DRAW_FONT_DIR_L2RB; + break; + case DRAW_OPT_FONT_DIR_L2RT: + *pFontDir = DRAW_FONT_DIR_L2RT; + break; + case DRAW_OPT_FONT_DIR_R2LB: + *pFontDir = DRAW_FONT_DIR_R2LB; + break; + case DRAW_OPT_FONT_DIR_R2LT: + *pFontDir = DRAW_FONT_DIR_R2LT; + break; + case DRAW_OPT_FONT_DIR_B2TL: + *pFontDir = DRAW_FONT_DIR_B2TL; + break; + case DRAW_OPT_FONT_DIR_B2TR: + *pFontDir = DRAW_FONT_DIR_B2TR; + break; + case DRAW_OPT_FONT_DIR_T2BL: + *pFontDir = DRAW_FONT_DIR_T2BL; + break; + case DRAW_OPT_FONT_DIR_T2BR: + *pFontDir = DRAW_FONT_DIR_T2BR; + break; + default: + *pFontDir = DRAW_FONT_DIR_L2RB; + break; + } +} + +//------------------------------------------------------------------ +// cCmdResolveClearScreenMode - extract the parameters that affect screen clearing +// from the 'DrawingOptions' parameter. +UBYTE cCmdResolveClearScreenMode(UWORD DrawingOptions) +{ + if (DrawingOptions & DRAW_OPT_CLEAR_SCREEN_MODES) + return TRUE; + else + return FALSE; +} +//JJR + +void cCmdDrawFont(IMG_OP_SPRITE *pSprite, SLONG sW, SLONG sH, SLONG startx, SLONG starty, + UBYTE fontDir, UBYTE fontWrap, UBYTE invertMode, UBYTE logicalMode, UBYTE fillMode) +{ + SWORD index; // index on id for output + SWORD xpos; // x-position for next output + SWORD ypos; // y-position for next output + SLONG sourcex; // X-Pos of pattern inside bitmap + SLONG sourcey; // Y-Pos of pattern inside bitmap + SLONG sourcew; // Width of pattern inside bitmap + SLONG sourceh; // Height of pattern inside bitmap + int destx; // X-Destination position on screen + int desty; // Y-Destination position on screen + SWORD stdw; // Standard font width + SWORD stdh; // Standard font height + + if (!gpPassedImgVars) // exit early if we do not have parameters + return; + + stdw = MIN( sW, DISPLAY_WIDTH ); // calculate the standard width + stdh = MIN( sH, DISPLAY_HEIGHT ); // calculate the standard height + + index=0; // Reset the start position + xpos=startx; // Initial start position X + ypos=starty; // Initial start position Y + + while( index < gPassedVarsCount ) + { + // terminate the loop at our first null + if (gpPassedImgVars[index] == 0) + break; + sourcex=cCmdResolveValue(0xF200|index); // Get dynamic xpos of pattern + sourcey=cCmdResolveValue(0xF300|index); // Get dynamic ypos of pattern + sourcew=cCmdResolveValue(0xF400|index); // Get dynamic width of pattern + sourceh=cCmdResolveValue(0xF500|index); // Get dynamic height of pattern + + //--Calculate the rectangle for source (inside the sprite) and destination + //--on the screen (related to the fontdirection) for performing the + //--BitCopy function + + switch( fontDir ) + { + case DRAW_FONT_DIR_L2RB : // Left to right with bottom align---------------- + + if( fontWrap ) + { + if( ( xpos + sourcew ) > DISPLAY_WIDTH ) + { + xpos = startx; + ypos -= stdh; + } + } + + destx = xpos; + desty = ypos; + xpos = xpos + sourcew; + + break; + + case DRAW_FONT_DIR_L2RT : // Left to right with align to top---------------- + + if( fontWrap ) + { + if( ( xpos + sourcew ) > DISPLAY_WIDTH ) + { + xpos = startx; + ypos += stdh; + } + } + + destx = xpos; + desty = ypos - sourceh + 1; + xpos = xpos + sourcew; + break; + + case DRAW_FONT_DIR_R2LB : // Right to left with align to bottom------------- + + if( fontWrap ) + { + if( ( xpos - sourcew ) < 0 ) + { + xpos = startx; + ypos -= stdh; + } + } + + destx = xpos - sourcew + 1; + desty = ypos; + xpos = xpos - sourcew; + break; + + case DRAW_FONT_DIR_R2LT : // Right to left with align to top---------------- + + if( fontWrap ) + { + if( ( xpos - sourcew ) < 0 ) + { + xpos = startx; + ypos += stdh; + } + } + + destx = xpos - sourcew + 1; + desty = ypos - sourceh + 1; + xpos = xpos - sourcew; + break; + + case DRAW_FONT_DIR_B2TL : // Bottom to top with allign to left-------------- + + if( fontWrap ) + { + if( ( ypos + sourceh ) > DISPLAY_HEIGHT ) + { + xpos += stdw; + ypos = starty; + } + } + + destx = xpos; + desty = ypos; + ypos = ypos + sourceh; + break; + + case DRAW_FONT_DIR_B2TR : // Bottom to top with allign to right------------- + + if( fontWrap ) + { + if( ( ypos + sourceh ) > DISPLAY_HEIGHT ) + { + xpos -= stdw; + ypos = starty; + } + } + + destx = xpos - sourcew + 1; + desty = ypos; + ypos = ypos + sourceh; + break; + + case DRAW_FONT_DIR_T2BL : // Top to bottom with allign to right------------- + + if( fontWrap ) + { + if( ( ypos - sourceh ) < 0 ) + { + xpos += stdw; + ypos = starty; + } + } + + destx = xpos; + desty = ypos - sourceh + 1; + ypos = ypos - sourceh; + break; + + case DRAW_FONT_DIR_T2BR : // Top to bottom with allign to right------------- + + if( fontWrap ) + { + if( ( ypos - sourceh ) < 0 ) + { + xpos -= stdw; + ypos = starty; + } + } + + destx = xpos - sourcew + 1; + desty = ypos - sourceh + 1; + ypos = ypos - sourceh; + break; + } + + //--Output of the calculated pattern to the screen------------------------ + cCmdCopyBitMapBits(destx, desty, sourcex, sourcey, sourcew, sourceh, + pSprite, invertMode, logicalMode, fillMode); + + // move on to next character + index++; + } +} + diff --git a/AT91SAM7S256/Source/c_comm.c b/AT91SAM7S256/Source/c_comm.c index ee0c6ae..610d369 100644 --- a/AT91SAM7S256/Source/c_comm.c +++ b/AT91SAM7S256/Source/c_comm.c @@ -60,13 +60,13 @@ enum IOMapComm.BtInBuf.InPtr = 0;\ CLEARExtMode;\ dBtClearArm7CmdSignal();\ - dBtInitReceive(VarsComm.BtModuleInBuf.Buf, (UBYTE)CMD_MODE); + dBtInitReceive(VarsComm.BtModuleInBuf.Buf, (UBYTE)CMD_MODE, FALSE); -#define SETBtDataState IOMapComm.BtInBuf.InPtr = 0;\ - VarsComm.BtState = BT_ARM_DATA_MODE;\ +#define SETBtDataState(_m) IOMapComm.BtInBuf.InPtr = 0;\ + VarsComm.BtState = _m;\ dBtClearTimeOut(); /* stop cmd timeout because in datamode */\ dBtSetArm7CmdSignal();\ - dBtInitReceive(VarsComm.BtModuleInBuf.Buf, (UBYTE)STREAM_MODE) + dBtInitReceive(VarsComm.BtModuleInBuf.Buf, (UBYTE)STREAM_MODE, (_m == BT_ARM_DATA_MODE ? FALSE : TRUE)); #define SETBtOff VarsComm.BtState = BT_ARM_OFF;\ dBtSetBcResetPinLow() @@ -160,10 +160,13 @@ void cCommInit(void* pHeader) } IOMapComm.BtDeviceCnt = 0; IOMapComm.BrickData.BtStateStatus = 0; - + IOMapComm.HsSpeed = HS_BAUD_921600; + IOMapComm.HsMode = HS_MODE_8N1; + IOMapComm.BtState = BT_ARM_DATA_MODE; + cCommClrConnTable(); - dBtInitReceive(VarsComm.BtModuleInBuf.Buf, (UBYTE)CMD_MODE); + dBtInitReceive(VarsComm.BtModuleInBuf.Buf, (UBYTE)CMD_MODE, FALSE); dBtStartADConverter(); dHiSpeedInit(); @@ -203,7 +206,7 @@ void cCommCtrl(void) switch (VarsComm.BtState) { - /* Bluetooth device can either be in CMD, DATA or OFF state at top level */ + /* Bluetooth device can either be in CMD, DATA, STREAM or OFF state at top level */ case BT_ARM_OFF: { } @@ -212,12 +215,13 @@ void cCommCtrl(void) { if (VarsComm.BtBcPinLevel) { - SETBtDataState; + SETBtDataState(IOMapComm.BtState); } } break; - case BT_ARM_DATA_MODE: + case BT_ARM_GPS_MODE: + case BT_ARM_RAW_MODE: { if (!(VarsComm.BtBcPinLevel)) { @@ -227,7 +231,9 @@ void cCommCtrl(void) break; } } - IOMapComm.BtInBuf.Buf[BT_CMD_BYTE] = 0; + // don't overwrite this byte when we are in GPS or RAW mode + if (VarsComm.BtState != BT_ARM_GPS_MODE && VarsComm.BtState != BT_ARM_RAW_MODE) + IOMapComm.BtInBuf.Buf[BT_CMD_BYTE] = 0; /* Here comes the the HIGHSPEED_PORT implementation */ @@ -238,7 +244,7 @@ void cCommCtrl(void) { case HS_INITIALISE: { - dHiSpeedSetupUart(); + dHiSpeedSetupUart(IOMapComm.HsSpeed, IOMapComm.HsMode); IOMapComm.HsState = HS_INIT_RECEIVER; IOMapComm.HsFlags |= HS_UPDATE; } @@ -263,6 +269,13 @@ void cCommCtrl(void) dHiSpeedExit(); } break; + + case HS_ENABLE: + { + if (VarsComm.HsState == 0) + dHiSpeedInit(); + } + break; } } @@ -1123,7 +1136,7 @@ UWORD cCommInterpreteCmd(UBYTE Cmd, UBYTE *pInBuf, UBYTE *pOutBuf, UBYTE *pL for (Tmp = 0; ((Tmp < (*pLength)) && (IOMapComm.HsInBuf.InPtr != IOMapComm.HsInBuf.OutPtr)); Tmp++) { pOutBuf[3 + Tmp] = IOMapComm.HsInBuf.Buf[IOMapComm.HsInBuf.OutPtr]; - IOMapComm.HsInBuf.OutPtr = ((IOMapComm.HsInBuf.OutPtr) + 1) % SIZE_OF_USBBUF; + IOMapComm.HsInBuf.OutPtr = ((IOMapComm.HsInBuf.OutPtr) + 1) % SIZE_OF_HSBUF; } pOutBuf[2] = Tmp; @@ -1212,23 +1225,37 @@ UWORD cCommReceivedBtData(void) /* ActiveUpdate has to be idle because BC4 can send stream data even if CMD */ /* mode has been requested - dont try to interprete the data */ /* VarsComm.CmdSwitchCnt != 0 if a transition to Cmd mode is in process */ - if ((VarsComm.BtState == BT_ARM_DATA_MODE) && (0 == VarsComm.CmdSwitchCnt)) - { - - /* Move the inptr ahead */ - IOMapComm.BtInBuf.InPtr = NumberOfBytes; - - /* using the outbuf inptr in order to get the number of bytes in the return answer at the right place*/ - IOMapComm.BtOutBuf.InPtr = NumberOfBytes; - - /* call the data stream interpreter */ - cCommInterprete(IOMapComm.BtInBuf.Buf, IOMapComm.BtOutBuf.Buf, &(IOMapComm.BtOutBuf.InPtr), (UBYTE) BT_CMD_READY, BytesToGo); - - /* if there is a reply to be send then send it */ - if (IOMapComm.BtOutBuf.InPtr) + if (0 == VarsComm.CmdSwitchCnt) + { + if (VarsComm.BtState == BT_ARM_DATA_MODE) + { + + /* Move the inptr ahead */ + IOMapComm.BtInBuf.InPtr = NumberOfBytes; + + /* using the outbuf inptr in order to get the number of bytes in the return answer at the right place*/ + IOMapComm.BtOutBuf.InPtr = NumberOfBytes; + + /* call the data stream interpreter */ + cCommInterprete(IOMapComm.BtInBuf.Buf, IOMapComm.BtOutBuf.Buf, &(IOMapComm.BtOutBuf.InPtr), (UBYTE) BT_CMD_READY, BytesToGo); + + /* if there is a reply to be sent then send it */ + if (IOMapComm.BtOutBuf.InPtr) + { + dBtSendMsg(IOMapComm.BtOutBuf.Buf, IOMapComm.BtOutBuf.InPtr, IOMapComm.BtOutBuf.InPtr); + IOMapComm.BtOutBuf.InPtr = 0; + } + } + else if (VarsComm.BtState == BT_ARM_GPS_MODE) + { + /* Move the inptr ahead */ + IOMapComm.BtInBuf.InPtr = NumberOfBytes; + // interpret GPS sentence? + } + else if (VarsComm.BtState == BT_ARM_RAW_MODE) { - dBtSendMsg(IOMapComm.BtOutBuf.Buf, IOMapComm.BtOutBuf.InPtr, IOMapComm.BtOutBuf.InPtr); - IOMapComm.BtOutBuf.InPtr = 0; + /* Move the inptr ahead */ + IOMapComm.BtInBuf.InPtr = NumberOfBytes; } } } @@ -1829,7 +1856,7 @@ void cCommUpdateBt(void) { IOMapComm.BtConnectTable[(VarsComm.BtUpdateDataConnectNr & ~0x80)].StreamStatus = 1; *(VarsComm.pRetVal) = SUCCESS; - SETBtDataState; + SETBtDataState(IOMapComm.BtState); SETBtStateIdle; } } @@ -2625,7 +2652,7 @@ void cCommUpdateBt(void) { IOMapComm.BtConnectTable[0].StreamStatus = 1; *(VarsComm.pRetVal) = SUCCESS; - SETBtDataState; + SETBtDataState(IOMapComm.BtState); SETBtStateIdle; } } @@ -3307,7 +3334,7 @@ void cCommsOpenStream(UBYTE *pNextState) { if (VarsComm.BtBcPinLevel) { - SETBtDataState; + SETBtDataState(IOMapComm.BtState); IOMapComm.BtConnectTable[VarsComm.BtCmdData.ParamTwo].StreamStatus = 1; VarsComm.StreamStateCnt = 0; (*pNextState)++; diff --git a/AT91SAM7S256/Source/c_comm.iom b/AT91SAM7S256/Source/c_comm.iom index 2dfe994..0f6648b 100644 --- a/AT91SAM7S256/Source/c_comm.iom +++ b/AT91SAM7S256/Source/c_comm.iom @@ -38,6 +38,8 @@ enum BT_ARM_OFF, BT_ARM_CMD_MODE, BT_ARM_DATA_MODE, + BT_ARM_GPS_MODE, + BT_ARM_RAW_MODE }; //Constant reffering to BtStateStatus @@ -64,9 +66,61 @@ enum HS_INITIALISE = 1, HS_INIT_RECEIVER, HS_SEND_DATA, - HS_DISABLE + HS_DISABLE, + HS_ENABLE }; +// Constants reffering to hi-speed control syscall function +enum +{ + HS_CTRL_INIT, + HS_CTRL_UART, + HS_CTRL_EXIT +}; + +// Constants refering to HsSpeed +enum +{ + HS_BAUD_1200, + HS_BAUD_2400, + HS_BAUD_3600, + HS_BAUD_4800, + HS_BAUD_7200, + HS_BAUD_9600, + HS_BAUD_14400, + HS_BAUD_19200, + HS_BAUD_28800, + HS_BAUD_38400, + HS_BAUD_57600, + HS_BAUD_76800, + HS_BAUD_115200, + HS_BAUD_230400, + HS_BAUD_460800, + HS_BAUD_921600 +}; + +// constants referring to HsMode (number of bits) +#define HS_MODE_5_DATA 0x0000 +#define HS_MODE_6_DATA 0x0040 +#define HS_MODE_7_DATA 0x0080 +#define HS_MODE_8_DATA 0x00C0 + +// constants referring to HsMode (number of stop bits) +#define HS_MODE_10_STOP 0x0000 +#define HS_MODE_15_STOP 0x1000 +#define HS_MODE_20_STOP 0x2000 + +// constants referring to HsMode (parity) +#define HS_MODE_E_PARITY 0x0000 +#define HS_MODE_O_PARITY 0x0200 +#define HS_MODE_S_PARITY 0x0400 +#define HS_MODE_M_PARITY 0x0600 +#define HS_MODE_N_PARITY 0x0800 + +// constants referring to HsMode (D|P|S) +#define HS_MODE_8N1 (HS_MODE_8_DATA|HS_MODE_N_PARITY|HS_MODE_10_STOP) +#define HS_MODE_7E1 (HS_MODE_7_DATA|HS_MODE_E_PARITY|HS_MODE_10_STOP) + //Constants refering to DeviceStatus within DeviceTable enum { @@ -214,6 +268,11 @@ typedef struct UBYTE UsbState; + UWORD HsMode; + + UBYTE BtState; // off, cmd, data, gps, raw + UBYTE Unused1; + }IOMAPCOMM; diff --git a/AT91SAM7S256/Source/c_display.c b/AT91SAM7S256/Source/c_display.c index 6b15495..0c6f1b2 100644 --- a/AT91SAM7S256/Source/c_display.c +++ b/AT91SAM7S256/Source/c_display.c @@ -98,6 +98,14 @@ void cDisplayClrPixel(UBYTE X,UBYTE Y) } } +void cDisplayXorPixel(UBYTE X,UBYTE Y) +{ + if ((X < DISPLAY_WIDTH) && (Y < DISPLAY_HEIGHT)) + { + IOMapDisplay.Display[(Y / 8) * DISPLAY_WIDTH + X] ^= (1 << (Y % 8)); + } +} + void cDisplayChar(FONT *pFont,UBYTE On,UBYTE X,UBYTE Y,UBYTE Char) { @@ -316,34 +324,85 @@ void cDisplayUpdateIcon(ICON *pIcons,UBYTE Index,SCREEN_CORDINATE *pCord) } -void cDisplayLineX(UBYTE X1,UBYTE X2,UBYTE Y) +void cDisplayLineX(UBYTE X1, UBYTE X2, UBYTE Y, UBYTE PixelMode) { UBYTE X; UBYTE M; + UBYTE t; + if (Y > DISPLAY_HEIGHT) return; + if (X1 > X2) {t = X1; X1 = X2; X2 = t;} + if (X2 > (DISPLAY_WIDTH-1)) X2 = (DISPLAY_WIDTH-1); + M = 1 << (Y % 8); Y >>= 3; - for (X = X1;X < X2;X++) + + for (X=X1; X<=X2; X++) { - IOMapDisplay.Display[Y * DISPLAY_WIDTH + X] |= M; + switch (PixelMode) + { + case DRAW_PIXELS_INVERT: + IOMapDisplay.Display[Y * DISPLAY_WIDTH + X] ^= M; + break; + case DRAW_PIXELS_CLEAR: + IOMapDisplay.Display[Y * DISPLAY_WIDTH + X] &= ~M; + break; + case DRAW_PIXELS_SET: + default: + IOMapDisplay.Display[Y * DISPLAY_WIDTH + X] |= M; + break; + } } } -void cDisplayLineY(UBYTE X,UBYTE Y1,UBYTE Y2) +static UBYTE Masks[9] = {0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff}; + +void cDisplayLineY(UBYTE X,UBYTE Y1,UBYTE Y2,UBYTE PixelMode) { UBYTE Y; - - for (Y = Y1;Y < Y2;Y++) + UBYTE M; + UBYTE t; + + if (X > DISPLAY_WIDTH) return; + if (Y1 > Y2) {t = Y1; Y1 = Y2; Y2 = t;} + if (Y2 > (DISPLAY_HEIGHT-1)) Y2 = (DISPLAY_HEIGHT-1); + + // starting point of Y is the byte containing Y1 + Y = (Y1 / 8) * 8; + + while (Y <= Y2) { - IOMapDisplay.Display[(Y / 8) * DISPLAY_WIDTH + X] |= (1 << (Y % 8)); + M = 0xff; + if (Y < Y1) + M &= ~Masks[Y1 % 8]; + if ((Y2-Y) < 8) + M &= Masks[(Y2 % 8) + 1]; + switch (PixelMode) + { + case DRAW_PIXELS_INVERT: + IOMapDisplay.Display[(Y / 8) * DISPLAY_WIDTH + X] ^= M; + break; + case DRAW_PIXELS_CLEAR: + IOMapDisplay.Display[(Y / 8) * DISPLAY_WIDTH + X] &= ~M; + break; + case DRAW_PIXELS_SET: + default: + IOMapDisplay.Display[(Y / 8) * DISPLAY_WIDTH + X] |= M; + break; + } + Y += 8; } + } -void cDisplayFrame(SCREEN_CORDINATE *pCord) +void cDisplayFrame(SCREEN_CORDINATE *pCord, UBYTE PixelMode) { - cDisplayLineX(pCord->StartX,pCord->StartX + pCord->PixelsX - 1,pCord->StartY); - cDisplayLineY(pCord->StartX,pCord->StartY,pCord->StartY + pCord->PixelsY - 1); - cDisplayLineY(pCord->StartX + pCord->PixelsX - 1,pCord->StartY,pCord->StartY + pCord->PixelsY - 1); + cDisplayLineX(pCord->StartX, pCord->StartX + pCord->PixelsX-1, pCord->StartY, PixelMode); + if (pCord->PixelsY > 1) + { + cDisplayLineY(pCord->StartX, pCord->StartY + 1, pCord->StartY + pCord->PixelsY - 1, PixelMode); + cDisplayLineY(pCord->StartX + pCord->PixelsX - 1, pCord->StartY + 1, pCord->StartY + pCord->PixelsY - 1, PixelMode); + } } @@ -358,30 +417,54 @@ void cDisplayErase(void) memset(&IOMapDisplay.Display[0], 0x00, DISPLAY_WIDTH*DISPLAY_HEIGHT/8); } - -void cDisplayEraseScreen(SCREEN_CORDINATE *pCord) +void cDisplayFillScreen(SCREEN_CORDINATE *pCord, UBYTE PixelMode) { - UBYTE *pDestination; - UBYTE Line; - UBYTE Lines; - - if (((pCord->StartY & 0x07) == 0) && ((pCord->PixelsY & 0x07) == 0)) + UBYTE X1, Y1; + UBYTE X2, Y2; + UBYTE X, Y; + UBYTE M; + + X1 = pCord->StartX; + Y1 = pCord->StartY; + X2 = pCord->StartX + pCord->PixelsX - 1; + Y2 = pCord->StartY + pCord->PixelsY - 1; + + if (X2 > (DISPLAY_WIDTH-1)) X2 = (DISPLAY_WIDTH-1); + if (Y2 > (DISPLAY_HEIGHT-1)) Y2 = (DISPLAY_HEIGHT-1); + + Y = (Y1 / 8) * 8; + + while (Y <= Y2) { - Line = pCord->StartY / 8; - Lines = Line + pCord->PixelsY / 8; - - while (Line < Lines) + M = 0xff; + if (Y < Y1) + M &= ~Masks[Y1 % 8]; + if ((Y2-Y) < 8) + M &= Masks[(Y2 % 8) + 1]; + switch (PixelMode) { - pDestination = &IOMapDisplay.Display[Line * DISPLAY_WIDTH + pCord->StartX]; - memset(pDestination,0,(size_t)pCord->PixelsX); - Line++; + case DRAW_PIXELS_INVERT: + for (X=X1; X<=X2; X++) + IOMapDisplay.Display[(Y / 8) * DISPLAY_WIDTH + X] ^= M; + break; + case DRAW_PIXELS_CLEAR: + for (X=X1; X<=X2; X++) + IOMapDisplay.Display[(Y / 8) * DISPLAY_WIDTH + X] &= ~M; + break; + case DRAW_PIXELS_SET: + default: + for (X=X1; X<=X2; X++) + IOMapDisplay.Display[(Y / 8) * DISPLAY_WIDTH + X] |= M; + break; } + Y += 8; } } - -void cDisplayDraw(UBYTE Cmd,UBYTE On,UBYTE X1,UBYTE Y1,UBYTE X2,UBYTE Y2) +void cDisplayDraw(UBYTE Cmd,UBYTE PixelMode,UBYTE X1,UBYTE Y1,UBYTE X2,UBYTE Y2) { + SCREEN_CORDINATE Coord; + switch (Cmd) { case DISPLAY_ERASE_ALL : @@ -392,52 +475,63 @@ void cDisplayDraw(UBYTE Cmd,UBYTE On,UBYTE X1,UBYTE Y1,UBYTE X2,UBYTE Y2) case DISPLAY_PIXEL : { - if (On == TRUE) - { - cDisplaySetPixel(X1,Y1); - } - else + switch (PixelMode) { - cDisplayClrPixel(X1,Y1); + case DRAW_PIXELS_INVERT: + cDisplayXorPixel(X1,Y1); + break; + case DRAW_PIXELS_CLEAR: + cDisplayClrPixel(X1,Y1); + break; + case DRAW_PIXELS_SET: + default: + cDisplaySetPixel(X1,Y1); + break; } } break; - case DISPLAY_HORISONTAL_LINE : + case DISPLAY_HORIZONTAL_LINE : { - if (On == TRUE) - { - if (X1 > X2) - { - cDisplayLineX(X2,X1,Y1); - } - else - { - cDisplayLineX(X1,X2,Y1); - } - } + cDisplayLineX(X1,X2,Y1,PixelMode); } break; case DISPLAY_VERTICAL_LINE : { - if (On == TRUE) - { - if (Y1 > Y2) - { - cDisplayLineY(X1,Y2,Y1); - } - else - { - cDisplayLineY(X1,Y1,Y2); - } - } + cDisplayLineY(X1,Y1,Y2,PixelMode); } break; case DISPLAY_CHAR : { - cDisplayChar(IOMapDisplay.pFont,On,X1,Y1,X2); + cDisplayChar(IOMapDisplay.pFont,PixelMode,X1,Y1,X2); + } + break; + + case DISPLAY_ERASE_LINE : + { + cDisplayEraseLine(X1); + } + break; + + case DISPLAY_FILL_REGION : + { + Coord.StartX = X1; + Coord.StartY = Y1; + Coord.PixelsX = X2; + Coord.PixelsY = Y2; + cDisplayFillScreen(&Coord, PixelMode); + } + break; + + case DISPLAY_FRAME : + { + Coord.StartX = X1; + Coord.StartY = Y1; + Coord.PixelsX = X2; + Coord.PixelsY = Y2; + cDisplayFrame(&Coord, PixelMode); } break; @@ -454,6 +548,7 @@ void cDisplayInit(void* pHeader) IOMapDisplay.UpdateMask = 0; IOMapDisplay.TextLinesCenterFlags = 0; IOMapDisplay.Flags = DISPLAY_REFRESH | DISPLAY_ON; + IOMapDisplay.Contrast = 0x5A; // 90 VarsDisplay.ErasePointer = 0; VarsDisplay.UpdatePointer = 0; } @@ -514,7 +609,7 @@ void cDisplayCtrl(void) } if (Tmp < MENUICONS) { - cDisplayEraseScreen((SCREEN_CORDINATE*)&MENUICON_CORDINATES[Tmp]); + cDisplayFillScreen((SCREEN_CORDINATE*)&MENUICON_CORDINATES[Tmp], DRAW_PIXELS_CLEAR); } } else @@ -528,7 +623,7 @@ void cDisplayCtrl(void) } if (Tmp < STATUSICONS) { - cDisplayEraseScreen((SCREEN_CORDINATE*)&STATUSICON_CORDINATES[Tmp]); + cDisplayFillScreen((SCREEN_CORDINATE*)&STATUSICON_CORDINATES[Tmp], DRAW_PIXELS_CLEAR); } } else @@ -542,13 +637,13 @@ void cDisplayCtrl(void) } if (Tmp < SCREENS) { - cDisplayEraseScreen((SCREEN_CORDINATE*)&SCREEN_CORDINATES[Tmp]); + cDisplayFillScreen((SCREEN_CORDINATE*)&SCREEN_CORDINATES[Tmp], DRAW_PIXELS_CLEAR); } if ((TmpMask & SCREEN_BIT(SCREEN_LARGE))) { if ((IOMapDisplay.UpdateMask & SPECIAL_BIT(TOPLINE))) { - cDisplayLineX(0,DISPLAY_WIDTH - 1,9); + cDisplayLineX(0,DISPLAY_WIDTH - 1, 9, DRAW_PIXELS_SET); IOMapDisplay.UpdateMask &= ~SPECIAL_BIT(TOPLINE); } } @@ -568,7 +663,7 @@ void cDisplayCtrl(void) Cordinate.StartY = VarsDisplay.pOldBitmaps[Tmp]->StartY; Cordinate.PixelsX = VarsDisplay.pOldBitmaps[Tmp]->PixelsX; Cordinate.PixelsY = VarsDisplay.pOldBitmaps[Tmp]->PixelsY; - cDisplayEraseScreen(&Cordinate); + cDisplayFillScreen(&Cordinate, DRAW_PIXELS_CLEAR); } } else @@ -622,7 +717,7 @@ void cDisplayCtrl(void) } if (Tmp < STEPICONS) { - cDisplayEraseScreen((SCREEN_CORDINATE*)&STEPICON_CORDINATES[Tmp]); + cDisplayFillScreen((SCREEN_CORDINATE*)&STEPICON_CORDINATES[Tmp], DRAW_PIXELS_CLEAR); } } } @@ -740,7 +835,7 @@ void cDisplayCtrl(void) { case FRAME_SELECT : { - cDisplayFrame((SCREEN_CORDINATE*)&SELECT_FRAME_CORDINATES); + cDisplayFrame((SCREEN_CORDINATE*)&SELECT_FRAME_CORDINATES,DRAW_PIXELS_SET); } break; @@ -758,16 +853,16 @@ void cDisplayCtrl(void) case STEPLINE : { - cDisplayLineX(22,28,20); - cDisplayLineX(39,45,20); - cDisplayLineX(56,62,20); - cDisplayLineX(73,79,20); + cDisplayLineX(22,28,20,DRAW_PIXELS_SET); + cDisplayLineX(39,45,20,DRAW_PIXELS_SET); + cDisplayLineX(56,62,20,DRAW_PIXELS_SET); + cDisplayLineX(73,79,20,DRAW_PIXELS_SET); } break; case TOPLINE : { - cDisplayLineX(0,DISPLAY_WIDTH - 1,9); + cDisplayLineX(0,DISPLAY_WIDTH - 1,9,DRAW_PIXELS_SET); } break; @@ -808,11 +903,11 @@ void cDisplayCtrl(void) { if ((IOMapDisplay.Flags & DISPLAY_ON)) { - dDisplayOn(TRUE); + dDisplayOn(TRUE, IOMapDisplay.Contrast); } else { - dDisplayOn(FALSE); + dDisplayOn(FALSE, IOMapDisplay.Contrast); } if (!(dDisplayUpdate(DISPLAY_HEIGHT,DISPLAY_WIDTH,(UBYTE*)IOMapDisplay.Normal))) { diff --git a/AT91SAM7S256/Source/c_display.iom b/AT91SAM7S256/Source/c_display.iom index 2e1ab74..0b3cb46 100644 --- a/AT91SAM7S256/Source/c_display.iom +++ b/AT91SAM7S256/Source/c_display.iom @@ -24,11 +24,63 @@ // Constants related to simple draw entry (x = dont care) enum { - DISPLAY_ERASE_ALL = 0x00, // W - erase entire screen (CMD,x,x,x,x,x) - DISPLAY_PIXEL = 0x01, // W - set pixel (on/off) (CMD,TRUE/FALSE,X,Y,x,x) - DISPLAY_HORISONTAL_LINE = 0x02, // W - draw horisontal line (CMD,TRUE,X1,Y1,X2,x) - DISPLAY_VERTICAL_LINE = 0x03, // W - draw vertical line (CMD,TRUE,X1,Y1,x,Y2) - DISPLAY_CHAR = 0x04 // W - draw char (actual font) (CMD,TRUE,X1,Y1,Char,x) + DISPLAY_ERASE_ALL = 0x00, // W - erase entire screen (CMD,x,x,x,x,x) + DISPLAY_PIXEL = 0x01, // W - set pixel (on/off) (CMD,TRUE/FALSE,X,Y,x,x) + DISPLAY_HORIZONTAL_LINE = 0x02, // W - draw horisontal line (on/off) (CMD,TRUE/FALSE,X1,Y1,X2,x) + DISPLAY_VERTICAL_LINE = 0x03, // W - draw vertical line (on/off) (CMD,TRUE/FALSE,X1,Y1,x,Y2) + DISPLAY_CHAR = 0x04, // W - draw char (actual font) (CMD,TRUE/FALSE,X1,Y1,Char,x) + DISPLAY_ERASE_LINE = 0x05, // W - erase a single line (CMD,x,LINE,x,x,x) + DISPLAY_FILL_REGION = 0x06, // W - fill screen region (CMD,TRUE/FALSE,X1,Y1,X2,Y2) + DISPLAY_FRAME = 0x07 // W - draw a frame (on/off) (CMD,TRUE/FALSE,X1,Y1,X2,Y2) +}; + +//JJR +// Constants related to drawing operations. + +enum +{ + DRAW_PIXELS_SET = 0x00, //Basic options for pixel, line and shape drawing. + DRAW_PIXELS_CLEAR = 0x01, + DRAW_PIXELS_INVERT = 0x02 +}; + +enum +{ + DRAW_SHAPE_HOLLOW = 0x00, //Extra options for shape drawing. + DRAW_SHAPE_FILLED = 0x01 +}; + +enum +{ + DRAW_BITMAP_PLAIN = 0x00, + DRAW_BITMAP_INVERT = 0x01 +}; + +enum +{ + DRAW_LOGICAL_COPY = 0x00, + DRAW_LOGICAL_AND = 0x01, + DRAW_LOGICAL_OR = 0x02, + DRAW_LOGICAL_XOR = 0x03 +}; +//JJR + +enum +{ + DRAW_FONT_WRAP_OFF = 0x00, + DRAW_FONT_WRAP_ON = 0x01 +}; + +enum +{ + DRAW_FONT_DIR_L2RB = 0x00, + DRAW_FONT_DIR_L2RT = 0x01, + DRAW_FONT_DIR_R2LB = 0x02, + DRAW_FONT_DIR_R2LT = 0x03, + DRAW_FONT_DIR_B2TL = 0x04, + DRAW_FONT_DIR_B2TR = 0x05, + DRAW_FONT_DIR_T2BL = 0x06, + DRAW_FONT_DIR_T2BR = 0x07 }; // Constants related to Flags @@ -44,6 +96,7 @@ enum #define DISPLAY_HEIGHT 64 // Y pixels #define DISPLAY_WIDTH 100 // X pixels +#define DISPLAY_BUFF_WIDTH 100 // width of buffer #define DISPLAY_MENUICONS_Y 40 #define DISPLAY_MENUICONS_X_OFFS 7 @@ -51,6 +104,9 @@ enum #define DISPLAY_IDLE ((pMapDisplay->EraseMask == 0) && (pMapDisplay->UpdateMask == 0)) +#define DISPLAY_CONTRAST_DEFAULT 0x5A +#define DISPLAY_CONTRAST_MAX 0x7F + enum TEXTLINE_NO // Used in macro "TEXTLINE_BIT" { TEXTLINE_1, // Upper most line @@ -166,8 +222,10 @@ typedef struct UBYTE TextLinesCenterFlags; // Mask to center TextLines - UBYTE Normal[DISPLAY_HEIGHT / 8][DISPLAY_WIDTH]; // Raw display memory for normal screen - UBYTE Popup[DISPLAY_HEIGHT / 8][DISPLAY_WIDTH]; // Raw display memory for popup screen + UBYTE Normal[DISPLAY_HEIGHT / 8][DISPLAY_BUFF_WIDTH]; // Raw display memory for normal screen + UBYTE Popup[DISPLAY_HEIGHT / 8][DISPLAY_BUFF_WIDTH]; // Raw display memory for popup screen + + UBYTE Contrast; // Display contrast } IOMAPDISPLAY; diff --git a/AT91SAM7S256/Source/c_input.c b/AT91SAM7S256/Source/c_input.c index 47ca7c0..2786326 100644 --- a/AT91SAM7S256/Source/c_input.c +++ b/AT91SAM7S256/Source/c_input.c @@ -69,12 +69,12 @@ enum const SWORD TempConvTable[] = { - 1500, 1460, 1430, 1400, 1380, 1360, 1330, 1310, 1290, 1270, 1250, 1230, 1220, 1200, 1190, 1170, +/* 1500, 1460, 1430, 1400, 1380, 1360, 1330, 1310, 1290, 1270, 1250, 1230, 1220, 1200, 1190, 1170, 1160, 1150, 1140, 1130, 1110, 1100, 1090, 1080, 1070, 1060, 1050, 1040, 1030, 1020, 1010, 1000, 994, 988, 982, 974, 968, 960, 954, 946, 940, 932, 926, 918, 912, 906, 900, 894, 890, 884, 878, 874, 868, 864, 858, 854, 848, 844, 838, 832, 828, 822, 816, 812, 808, 802, 798, 794, 790, 786, 782, 780, 776, 772, 768, 764, 762, 758, 754, 750, - 748, 744, 740, 736, 732, 730, 726, 722, 718, 716, 712, 708, 704, 700, 696, 694, + 748, 744, 740, 736, 732, 730, 726, 722, 718, 716, 712, 708, 704,*/ 700, 696, 694, 690, 688, 684, 682, 678, 674, 672, 668, 666, 662, 660, 656, 654, 650, 648, 644, 642, 640, 638, 634, 632, 630, 628, 624, 622, 620, 616, 614, 612, 610, 608, 604, 602, 600, 598, 596, 592, 590, 588, 586, 584, 582, 580, 578, 576, 574, 572, 570, @@ -114,13 +114,13 @@ const SWORD TempConvTable[] = -98, -98, -100, -102, -104, -106, -106, -108, -110, -112, -114, -114, -116, -118, -120, -120, -122, -124, -126, -128, -130, -130, -132, -134, -136, -138, -140, -142, -144, -146, -146, -148, -150, -152, -154, -156, -158, -160, -162, -164, -166, -166, -168, -170, -172, -174, -176, -178, - -180, -182, -184, -186, -188, -190, -192, -194, -196, -196, -198, -200, -202, -204, -206, -208, + -180, -182, -184, -186, -188, -190, -192, -194, -196, -196, -198, -200/*,-202, -204, -206, -208, -210, -212, -214, -216, -218, -220, -224, -226, -228, -230, -232, -234, -236, -238, -242, -246, -248, -250, -254, -256, -260, -262, -264, -268, -270, -274, -276, -278, -282, -284, -286, -290, -292, -296, -298, -300, -306, -308, -312, -316, -320, -324, -326, -330, -334, -338, -342, -344, -348, -354, -358, -362, -366, -370, -376, -380, -384, -388, -394, -398, -404, -410, -416, -420, -428, -432, -440, -446, -450, -460, -468, -476, -484, -492, -500, -510, -524, -534, -546, -560, - -572, -588, -600, -630, -656, -684, -720, -770 + -572, -588, -600, -630, -656, -684, -720, -770 */ }; static IOMAPINPUT IOMapInput; @@ -145,7 +145,7 @@ void cInputCalcSensorValue(UWORD NewSensorRaw, UWORD *pOldSensorRaw, SWORD UBYTE *pBoolean, UBYTE *pDebounce, UBYTE *pSampleCnt, UBYTE *LastAngle, UBYTE *pEdgeCnt, UBYTE Slope, UBYTE Mode); -void cInputSetupType(UBYTE Port, UBYTE *pType, UBYTE OldType); +void cInputSetupType(UBYTE Port, UBYTE newType, UBYTE OldType); void cInputSetupCustomSensor(UBYTE Port); void cInputCalcSensorValues(UBYTE No); UBYTE cInputInitColorSensor(UBYTE Port, UBYTE *pInitStatus); @@ -226,8 +226,10 @@ void cInputCtrl(void) for (Tmp = 0; Tmp < NO_OF_INPUTS; Tmp++) { + UBYTE sType = IOMapInput.Inputs[Tmp].SensorType; + UBYTE oldType = VarsInput.OldSensorType[Tmp]; - if ((IOMapInput.Inputs[Tmp].SensorType) != (VarsInput.OldSensorType[Tmp])) + if (sType != oldType) { /* Clear all variables for this sensor */ @@ -238,10 +240,21 @@ void cInputCtrl(void) VarsInput.ColorStatus &= ~(0x01< 928) - { - InputVal = 928; - } - } - InputVal = TempConvTable[(InputVal) - 197]; - InputVal = InputVal + 200; - InputVal = (UWORD)(((SLONG)InputVal * (SLONG)1023)/(SLONG)900); - cInputCalcSensorValue( InputVal, - &(IOMapInput.Inputs[No].SensorRaw), - &(IOMapInput.Inputs[No].SensorValue), - &(IOMapInput.Inputs[No].SensorBoolean), - &(VarsInput.InputDebounce[No]), - &(VarsInput.SampleCnt[No]), - &(VarsInput.LastAngle[No]), - &(VarsInput.EdgeCnt[No]), - ((IOMapInput.Inputs[No].SensorMode) & SLOPEMASK), - ((IOMapInput.Inputs[No].SensorMode) & MODEMASK)); - } - break; - case REFLECTION: - { - UWORD InputVal; - - dInputGetRawAd(&InputVal, No); - IOMapInput.Inputs[No].ADRaw = InputVal; - cInputCalcFullScale(&InputVal, REFLECTIONSENSORMIN, REFLECTIONSENSORPCTDYN, TRUE); - cInputCalcSensorValue( InputVal, - &(IOMapInput.Inputs[No].SensorRaw), - &(IOMapInput.Inputs[No].SensorValue), - &(IOMapInput.Inputs[No].SensorBoolean), - &(VarsInput.InputDebounce[No]), - &(VarsInput.SampleCnt[No]), - &(VarsInput.LastAngle[No]), - &(VarsInput.EdgeCnt[No]), - ((IOMapInput.Inputs[No].SensorMode) & SLOPEMASK), - ((IOMapInput.Inputs[No].SensorMode) & MODEMASK)); - } - break; - case ANGLE: - { - UWORD InputVal; - - dInputGetRawAd(&InputVal, No); - IOMapInput.Inputs[No].ADRaw = InputVal; - cInputCalcSensorValue( InputVal, - &(IOMapInput.Inputs[No].SensorRaw), - &(IOMapInput.Inputs[No].SensorValue), - &(IOMapInput.Inputs[No].SensorBoolean), - &(VarsInput.InputDebounce[No]), - &(VarsInput.SampleCnt[No]), - &(VarsInput.LastAngle[No]), - &(VarsInput.EdgeCnt[No]), - ((IOMapInput.Inputs[No].SensorMode) & SLOPEMASK), - ((IOMapInput.Inputs[No].SensorMode) & MODEMASK)); - } - break; - - /* Dual case intended */ case LIGHT_ACTIVE: case LIGHT_INACTIVE: - { - UWORD InputVal; - - dInputGetRawAd(&InputVal, No); - IOMapInput.Inputs[No].ADRaw = InputVal; - cInputCalcFullScale(&InputVal, NEWLIGHTSENSORMIN, NEWLIGHTSENSORPCTDYN, TRUE); - cInputCalcSensorValue( InputVal, - &(IOMapInput.Inputs[No].SensorRaw), - &(IOMapInput.Inputs[No].SensorValue), - &(IOMapInput.Inputs[No].SensorBoolean), - &(VarsInput.InputDebounce[No]), - &(VarsInput.SampleCnt[No]), - &(VarsInput.LastAngle[No]), - &(VarsInput.EdgeCnt[No]), - ((IOMapInput.Inputs[No].SensorMode) & SLOPEMASK), - ((IOMapInput.Inputs[No].SensorMode) & MODEMASK)); - - } - break; - - /* Dual case intended */ case SOUND_DB: case SOUND_DBA: - { - UWORD InputVal; - - dInputGetRawAd(&InputVal, No); - IOMapInput.Inputs[No].ADRaw = InputVal; - cInputCalcFullScale(&InputVal, NEWSOUNDSENSORMIN, NEWSOUNDSENSORPCTDYN, TRUE); - cInputCalcSensorValue( InputVal, - &(IOMapInput.Inputs[No].SensorRaw), - &(IOMapInput.Inputs[No].SensorValue), - &(IOMapInput.Inputs[No].SensorBoolean), - &(VarsInput.InputDebounce[No]), - &(VarsInput.SampleCnt[No]), - &(VarsInput.LastAngle[No]), - &(VarsInput.EdgeCnt[No]), - ((IOMapInput.Inputs[No].SensorMode) & SLOPEMASK), - ((IOMapInput.Inputs[No].SensorMode) & MODEMASK)); - - } - break; - case CUSTOM: { UWORD InputVal; - /* Setup and read digital IO */ - cInputSetupCustomSensor(No); - dInputRead0(No, &(IOMapInput.Inputs[No].DigiPinsIn)); - dInputRead1(No, &(IOMapInput.Inputs[No].DigiPinsIn)); - + if (sType == CUSTOM) { + /* Setup and read digital IO */ + cInputSetupCustomSensor(No); + dInputRead0(No, &(IOMapInput.Inputs[No].DigiPinsIn)); + dInputRead1(No, &(IOMapInput.Inputs[No].DigiPinsIn)); + } + dInputGetRawAd(&InputVal, No); IOMapInput.Inputs[No].ADRaw = InputVal; - cInputCalcFullScale(&InputVal, IOMapInput.Inputs[No].CustomZeroOffset, IOMapInput.Inputs[No].CustomPctFullScale, FALSE); + + if (sType == REFLECTION) + { + cInputCalcFullScale(&InputVal, REFLECTIONSENSORMIN, REFLECTIONSENSORPCTDYN, TRUE); + } + else if (sType == TEMPERATURE) + { + if (InputVal < 290) + InputVal = 290; + else if (InputVal > 928) + InputVal = 928; + InputVal = TempConvTable[(InputVal) - /*197*/ 290]; + InputVal = InputVal + 200; + InputVal = (UWORD)(((SLONG)InputVal * (SLONG)1023)/(SLONG)900); + } + else if (sType == LIGHT_ACTIVE || sType == LIGHT_INACTIVE) + { + cInputCalcFullScale(&InputVal, NEWLIGHTSENSORMIN, NEWLIGHTSENSORPCTDYN, TRUE); + } + else if (sType == SOUND_DB || sType == SOUND_DBA) + { + cInputCalcFullScale(&InputVal, NEWSOUNDSENSORMIN, NEWSOUNDSENSORPCTDYN, TRUE); + } + else if (sType == CUSTOM) + { + cInputCalcFullScale(&InputVal, IOMapInput.Inputs[No].CustomZeroOffset, IOMapInput.Inputs[No].CustomPctFullScale, FALSE); + } cInputCalcSensorValue( InputVal, &(IOMapInput.Inputs[No].SensorRaw), &(IOMapInput.Inputs[No].SensorValue), @@ -449,11 +359,10 @@ void cInputCalcSensorValues(UBYTE No) &(VarsInput.EdgeCnt[No]), ((IOMapInput.Inputs[No].SensorMode) & SLOPEMASK), ((IOMapInput.Inputs[No].SensorMode) & MODEMASK)); - } break; - /* Tripple case intended */ + /* Triple case intended */ case LOWSPEED: case LOWSPEED_9V: case HIGHSPEED: @@ -1100,29 +1009,10 @@ void cInputCalcFullScale(UWORD *pRawVal, UWORD ZeroPointOffset, UBYTE PctFu } -void cInputSetupType(UBYTE Port, UBYTE *pType, UBYTE OldType) +void cInputSetupType(UBYTE Port, UBYTE newType, UBYTE OldType) { - VarsInput.InvalidTimer[Port] = INVALID_RELOAD_NORMAL; - - /* If old type is color sensor in color lamp mode then turn off leds */ - switch (OldType) - { - case COLORRED: - case COLORGREEN: - case COLORBLUE: - case COLORFULL: - case COLOREXIT: - { - if (NO_SENSOR == *pType) - { - VarsInput.InvalidTimer[Port] = INVALID_RELOAD_COLOR; - *pType = COLOREXIT; - } - } - break; - } - switch(*pType) + switch(newType) { case NO_SENSOR: case SWITCH: @@ -1135,13 +1025,6 @@ void cInputSetupType(UBYTE Port, UBYTE *pType, UBYTE OldType) break; case REFLECTION: - { - dInputSetActive(Port); - dInputClearDigi0(Port); - dInputClearDigi1(Port); - } - break; - case ANGLE: { dInputSetActive(Port); @@ -1215,50 +1098,9 @@ void cInputSetupType(UBYTE Port, UBYTE *pType, UBYTE OldType) break; case COLORFULL: - { - VarsInput.InvalidTimer[Port] = INVALID_RELOAD_COLOR; - dInputSetInactive(Port); - dInputSetDigi0(Port); - dInputSetDirInDigi1(Port); - IOMapInput.Colors[Port].CalibrationState = SENSORCAL; - VarsInput.VarsColor[Port].ColorInitState = 0; - - } - break; - case COLORRED: - { - VarsInput.InvalidTimer[Port] = INVALID_RELOAD_COLOR; - dInputSetInactive(Port); - dInputSetDigi0(Port); - dInputSetDirInDigi1(Port); - IOMapInput.Colors[Port].CalibrationState = SENSORCAL; - VarsInput.VarsColor[Port].ColorInitState = 0; - } - break; - case COLORGREEN: - { - VarsInput.InvalidTimer[Port] = INVALID_RELOAD_COLOR; - dInputSetInactive(Port); - dInputSetDigi0(Port); - dInputSetDirInDigi1(Port); - IOMapInput.Colors[Port].CalibrationState = SENSORCAL; - VarsInput.VarsColor[Port].ColorInitState = 0; - } - break; - case COLORBLUE: - { - VarsInput.InvalidTimer[Port] = INVALID_RELOAD_COLOR; - dInputSetInactive(Port); - dInputSetDigi0(Port); - dInputSetDirInDigi1(Port); - IOMapInput.Colors[Port].CalibrationState = SENSORCAL; - VarsInput.VarsColor[Port].ColorInitState = 0; - } - break; - case COLORNONE: { VarsInput.InvalidTimer[Port] = INVALID_RELOAD_COLOR; diff --git a/AT91SAM7S256/Source/c_loader.c b/AT91SAM7S256/Source/c_loader.c index 995c920..d6ee342 100644 --- a/AT91SAM7S256/Source/c_loader.c +++ b/AT91SAM7S256/Source/c_loader.c @@ -18,6 +18,7 @@ #include "c_ioctrl.iom" #include "d_loader.h" #include "c_loader.h" +#include static IOMAPLOADER IOMapLoader; static VARSLOADER VarsLoader; @@ -41,12 +42,18 @@ UWORD cLoaderFileRq(UBYTE Cmd, UBYTE *pFileName, UBYTE *pBuffer, ULONG *pLen UWORD cLoaderGetIoMapInfo(ULONG ModuleId, UBYTE *pIoMap, UWORD *pIoMapSize); UWORD cLoaderFindModule(UBYTE *pBuffer); void cLoaderGetModuleName(UBYTE *pDst, UBYTE *pModule); +UWORD cLoaderCreateFile(UBYTE *pFileName, ULONG *pLength, UBYTE bLinear, UBYTE fType); +UWORD cLoaderRenameFile(UBYTE *pFileName, UBYTE *pBuffer, ULONG *pLength); +UWORD cLoaderOpenRead(UBYTE *pFileName, UBYTE *pBuffer, ULONG *pLength, UBYTE bLinear); +UWORD cLoaderDeleteFile(UBYTE *pFileName); +UWORD cLoaderResizeFile(UBYTE *pFileName, ULONG pLength); void cLoaderInit(void* pHeader) { IOMapLoader.pFunc = &cLoaderFileRq; VarsLoader.IoMapHandle = FALSE; + VarsLoader.Resizing = FALSE; pHeaders = pHeader; dLoaderInit(); IOMapLoader.FreeUserFlash = dLoaderReturnFreeUserFlash(); @@ -54,9 +61,154 @@ void cLoaderInit(void* pHeader) void cLoaderCtrl(void) { + if (VarsLoader.Resizing) + { + // keep resizing the file currently in the file resize operation + // copy 1024 bytes from old file handle to new file handle + // if no more bytes to copy then set Resizing to FALSE, + // close both files, and delete the old file. + } } +UWORD cLoaderCreateFile(UBYTE *pFileName, ULONG *pLength, UBYTE bLinear, UBYTE fType) +{ + UWORD ReturnState; + /* This is to create a new file */ + ReturnState = dLoaderCreateFileHeader(*pLength, pFileName, bLinear, fType); + if (0x8000 <= ReturnState) + { + dLoaderCloseHandle(ReturnState); + } + else + { + IOMapLoader.FreeUserFlash = dLoaderReturnFreeUserFlash(); + } + return ReturnState; +} +UWORD cLoaderRenameFile(UBYTE *pFileName, UBYTE *pBuffer, ULONG *pLength) +{ + UWORD ReturnState; + UBYTE FoundName[FILENAME_LENGTH + 1]; + + /* Check for file exists*/ + ReturnState = dLoaderFind(pBuffer, FoundName, pLength, pLength, (UBYTE) SEARCHING); + dLoaderCloseHandle(LOADER_HANDLE(ReturnState)); + if (FILENOTFOUND == LOADER_ERR(ReturnState)) + { + ReturnState = dLoaderFind(pFileName, FoundName, pLength, pLength, (UBYTE) SEARCHING); + if (ReturnState < 0x8000) + { + ReturnState = dLoaderCheckFiles((UBYTE) ReturnState); + if (ReturnState < 0x8000) + { + dLoaderRenameFile((UBYTE) ReturnState, pBuffer); + } + } + dLoaderCloseHandle(LOADER_HANDLE(ReturnState)); + } + else + { + if (SUCCESS == LOADER_ERR(ReturnState)) + { + ReturnState |= FILEEXISTS; + } + } + return ReturnState; +} + +UWORD cLoaderOpenRead(UBYTE *pFileName, UBYTE *pBuffer, ULONG *pLength, UBYTE bLinear) +{ + UWORD ReturnState; + if (bLinear) + ReturnState = dLoaderGetFilePtr(pFileName, pBuffer, pLength); + else + ReturnState = dLoaderOpenRead(pFileName, pLength); + if (0x8000 <= ReturnState) + { + dLoaderCloseHandle(ReturnState); + } + return ReturnState; +} + +UWORD cLoaderDeleteFile(UBYTE *pFileName) +{ + UWORD ReturnState; + ReturnState = dLoaderDelete(pFileName); + IOMapLoader.FreeUserFlash = dLoaderReturnFreeUserFlash(); + return ReturnState; +} + +UWORD cLoaderResizeFile(UBYTE *pFileName, ULONG pLength) +{ + UWORD ReturnState = SUCCESS; + /* + All that this method can do is start the process of + resizing a file. To do that we will + a) rename the file + b) open old file for reading + c) create new file for writing + d) store both handles in VarsLoader & set resizing flag + e) if any errors occur in a, b, or c then restore original file + f) return LOADER_BUSY (maybe?) + */ +/* + // rename file to _tmpoldname + strcat __frsFRArgs.NewFilename, '_tmp', __frsOldName + mov __frsFRArgs.OldFilename, __frsOldName + syscall FileRename, __frsFRArgs + mov __frsResult, __frsFRArgs.Result + brtst NEQ, __frsEnd, __frsResult + // old file has been renamed successfully + mov __frsFOReadArgs.Filename, __frsFRArgs.NewFilename + syscall FileOpenRead, __frsFOReadArgs + mov __frsResult, __frsFOReadArgs.Result + brtst NEQ, __frsOpenReadFailed, __frsResult + // renamed file is open for reading + mov __frsFOWriteArgs.Filename, __frsOldName + mov __frsFOWriteArgs.Length, __frsNewSize + syscall FileOpenWrite, __frsFOWriteArgs + mov __frsResult, __frsFOWriteArgs.Result + brtst NEQ, __frsOpenWriteFailed, __frsResult + // both files are open + mov __frsFReadArgs.FileHandle, __frsFOReadArgs.FileHandle + mov __frsFWriteArgs.FileHandle, __frsFOWriteArgs.FileHandle +__frsCopyLoop: + set __frsFReadArgs.Length, 1024 + syscall FileRead, __frsFReadArgs + brtst NEQ, __frsEndLoop, __frsFReadArgs.Result + brtst LTEQ, __frsEndLoop, __frsFReadArgs.Length + mov __frsFWriteArgs.Buffer, __frsFReadArgs.Buffer + mov __frsFWriteArgs.Length, __frsFReadArgs.Length + syscall FileWrite, __frsFWriteArgs + brtst NEQ, __frsEndLoop, __frsFWriteArgs.Result + jmp __frsCopyLoop +__frsEndLoop: + // close read file + mov __frsFCArgs.FileHandle, __frsFOReadArgs.FileHandle + syscall FileClose, __frsFCArgs + // close write file + mov __frsFCArgs.FileHandle, __frsFOWriteArgs.FileHandle + syscall FileClose, __frsFCArgs + // delete read file + mov __frsFDArgs.Filename, __frsFOReadArgs.Filename + syscall FileDelete, __frsFDArgs + jmp __frsEnd +__frsOpenWriteFailed: + // close read file + mov __frsFCArgs.FileHandle, __frsFOReadArgs.FileHandle + syscall FileClose, __frsFCArgs +// jmp __frsEnd +__frsOpenReadFailed: + // if the open read failed rename tmp back to original and exit + mov __frsFRArgs.OldFilename, __frsFRArgs.NewFilename + mov __frsFRArgs.NewFilename, __frsOldName + syscall FileRename, __frsFRArgs +__frsEnd: + return +*/ + return ReturnState; +} UWORD cLoaderFileRq(UBYTE Cmd, UBYTE *pFileName, UBYTE *pBuffer, ULONG *pLength) { @@ -68,63 +220,29 @@ UWORD cLoaderFileRq(UBYTE Cmd, UBYTE *pFileName, UBYTE *pBuffer, ULONG *pLen { case OPENREAD: { - ReturnState = dLoaderOpenRead(pFileName, pLength); - if (0x8000 <= ReturnState) - { - dLoaderCloseHandle(ReturnState); - } + ReturnState = cLoaderOpenRead(pFileName, pBuffer, pLength, FALSE); } break; case OPENREADLINEAR: { - ReturnState = dLoaderGetFilePtr(pFileName, pBuffer, pLength); - if (0x8000 <= ReturnState) - { - dLoaderCloseHandle(ReturnState); - } - + ReturnState = cLoaderOpenRead(pFileName, pBuffer, pLength, TRUE); } break; case OPENWRITE: { /* This is to create a new file */ - ReturnState = dLoaderCreateFileHeader(*pLength, pFileName, (UBYTE) NONLINEAR, SYSTEMFILE); - if (0x8000 <= ReturnState) - { - dLoaderCloseHandle(ReturnState); - } - else - { - IOMapLoader.FreeUserFlash = dLoaderReturnFreeUserFlash(); - } + ReturnState = cLoaderCreateFile(pFileName, pLength, (UBYTE) NONLINEAR, SYSTEMFILE); } break; case OPENWRITELINEAR: { - ReturnState = dLoaderCreateFileHeader(*pLength, pFileName, (UBYTE) LINEAR, SYSTEMFILE); - if (0x8000 <= ReturnState) - { - dLoaderCloseHandle(ReturnState); - } - else - { - IOMapLoader.FreeUserFlash = dLoaderReturnFreeUserFlash(); - } + ReturnState = cLoaderCreateFile(pFileName, pLength, (UBYTE) LINEAR, SYSTEMFILE); } break; case OPENWRITEDATA: { - - ReturnState = dLoaderCreateFileHeader(*pLength, pFileName, (UBYTE) NONLINEAR, DATAFILE); - if (0x8000 <= ReturnState) - { - dLoaderCloseHandle(ReturnState); - } - else - { - IOMapLoader.FreeUserFlash = dLoaderReturnFreeUserFlash(); - } + ReturnState = cLoaderCreateFile(pFileName, pLength, (UBYTE) NONLINEAR, DATAFILE); } break; case OPENAPPENDDATA: @@ -147,6 +265,20 @@ UWORD cLoaderFileRq(UBYTE Cmd, UBYTE *pFileName, UBYTE *pBuffer, ULONG *pLen IOMapLoader.FreeUserFlash = dLoaderReturnFreeUserFlash(); } break; + case RESIZEDATAFILE: + { + ReturnState = cLoaderResizeFile(pFileName, *pLength); + IOMapLoader.FreeUserFlash = dLoaderReturnFreeUserFlash(); + } + break; + case SEEKFROMSTART: + case SEEKFROMCURRENT: + case SEEKFROMEND: + { + // *pFileName is the handle, *pLength is the offset, Cmd-SEEKFROMSTART is the origin + ReturnState = dLoaderSeek(*pFileName, *(SLONG*)pLength, Cmd-SEEKFROMSTART); + } + break; case READ: { ReturnState = dLoaderRead(*pFileName, pBuffer, pLength); @@ -179,9 +311,11 @@ UWORD cLoaderFileRq(UBYTE Cmd, UBYTE *pFileName, UBYTE *pBuffer, ULONG *pLen break; case DELETE: { + ReturnState = cLoaderDeleteFile(pFileName); +/* ReturnState = dLoaderDelete(pFileName); IOMapLoader.FreeUserFlash = dLoaderReturnFreeUserFlash(); - +*/ } break; case DELETEUSERFLASH: @@ -320,31 +454,7 @@ UWORD cLoaderFileRq(UBYTE Cmd, UBYTE *pFileName, UBYTE *pBuffer, ULONG *pLen case RENAMEFILE: { - UBYTE FoundName[FILENAME_LENGTH + 1]; - - /* Check for file exists*/ - ReturnState = dLoaderFind(pBuffer, FoundName, pLength, pLength, (UBYTE) SEARCHING); - dLoaderCloseHandle(LOADER_HANDLE(ReturnState)); - if (FILENOTFOUND == LOADER_ERR(ReturnState)) - { - ReturnState = dLoaderFind(pFileName, FoundName, pLength, pLength, (UBYTE) SEARCHING); - if (ReturnState < 0x8000) - { - ReturnState = dLoaderCheckFiles((UBYTE) ReturnState); - if (ReturnState < 0x8000) - { - dLoaderRenameFile((UBYTE) ReturnState, pBuffer); - } - } - dLoaderCloseHandle(LOADER_HANDLE(ReturnState)); - } - else - { - if (SUCCESS == LOADER_ERR(ReturnState)) - { - ReturnState |= FILEEXISTS; - } - } + ReturnState = cLoaderRenameFile(pFileName, pBuffer, pLength); } break; diff --git a/AT91SAM7S256/Source/c_loader.h b/AT91SAM7S256/Source/c_loader.h index 03f8062..2305dd9 100644 --- a/AT91SAM7S256/Source/c_loader.h +++ b/AT91SAM7S256/Source/c_loader.h @@ -30,6 +30,9 @@ typedef struct UBYTE ModSearchType; UBYTE UsbStatus; UBYTE IoMapHandle; + UBYTE Resizing; + UBYTE ResizeOldHandle; + UBYTE ResizeNewHandle; }VARSLOADER; void cLoaderInit(void* pHeader); diff --git a/AT91SAM7S256/Source/c_loader.iom b/AT91SAM7S256/Source/c_loader.iom index dde8b6a..6ad2d53 100644 --- a/AT91SAM7S256/Source/c_loader.iom +++ b/AT91SAM7S256/Source/c_loader.iom @@ -1,11 +1,11 @@ // // Date init 14.12.2004 // -// Revision date $Date:: 24-06-09 8:53 $ +// Revision date $Date:: 16-12-08 12:11 $ // // Filename $Workfile:: c_loader.iom $ // -// Version $Revision:: 15 $ +// Version $Revision:: 14 $ // // Archive $Archive:: /LMS2006/Sys01/Main_V02/Firmware/Source/c_load $ // @@ -21,7 +21,7 @@ //For example, version 1.5 would be 0x0105 //If these switch to little-endian, be sure to update //definition and usages of VM_OLDEST_COMPATIBLE_VERSION, too! -#define FIRMWAREVERSION 0x011D //1.28 +#define FIRMWAREVERSION 0x011C //1.28 #define PROTOCOLVERSION 0x017C //1.124 enum @@ -40,21 +40,35 @@ enum OPENWRITEDATA = 0x8B, OPENAPPENDDATA = 0x8C, CROPDATAFILE = 0x8D, /* New cmd for datalogging */ +// XXXXXXXXXXXXXX = 0x8E, +// XXXXXXXXXXXXXX = 0x8F, FINDFIRSTMODULE = 0x90, FINDNEXTMODULE = 0x91, CLOSEMODHANDLE = 0x92, +// XXXXXXXXXXXXXX = 0x93, IOMAPREAD = 0x94, IOMAPWRITE = 0x95, +// XXXXXXXXXXXXXX = 0x96, BOOTCMD = 0x97, /* external command only */ SETBRICKNAME = 0x98, +// XXXXXXXXXXXXXX = 0x99, BTGETADR = 0x9A, DEVICEINFO = 0x9B, +// XXXXXXXXXXXXXX = 0x9C, +// XXXXXXXXXXXXXX = 0x9D, +// XXXXXXXXXXXXXX = 0x9E, +// XXXXXXXXXXXXXX = 0x9F, DELETEUSERFLASH = 0xA0, POLLCMDLEN = 0xA1, POLLCMD = 0xA2, RENAMEFILE = 0xA3, - BTFACTORYRESET = 0xA4 + BTFACTORYRESET = 0xA4, + // enhanced firmware additions + RESIZEDATAFILE = 0xD0, + SEEKFROMSTART = 0xD1, + SEEKFROMCURRENT = 0xD2, + SEEKFROMEND = 0xD3 }; typedef UWORD LOADER_STATUS; diff --git a/AT91SAM7S256/Source/c_lowspeed.c b/AT91SAM7S256/Source/c_lowspeed.c index 26851db..de0cf77 100644 --- a/AT91SAM7S256/Source/c_lowspeed.c +++ b/AT91SAM7S256/Source/c_lowspeed.c @@ -58,147 +58,147 @@ void cLowSpeedCtrl(void) for (ChannelNumber = 0; ChannelNumber < NO_OF_LOWSPEED_COM_CHANNEL; ChannelNumber++) { //Lowspeed com is activated - switch (IOMapLowSpeed.ChannelState[ChannelNumber]) - { - case LOWSPEED_IDLE: - { - } - break; - - case LOWSPEED_INIT: - { - if ((pMapInput->Inputs[ChannelNumber].SensorType == LOWSPEED) || (pMapInput->Inputs[ChannelNumber].SensorType == LOWSPEED_9V)) + switch (IOMapLowSpeed.ChannelState[ChannelNumber]) + { + case LOWSPEED_IDLE: { - if (VarsLowSpeed.TimerState == TIMER_STOPPED) - { - dLowSpeedStartTimer(); - VarsLowSpeed.TimerState = TIMER_RUNNING; - } - IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_LOAD_BUFFER; - IOMapLowSpeed.ErrorType[ChannelNumber] = LOWSPEED_NO_ERROR; - VarsLowSpeed.ErrorCount[ChannelNumber] = 0; - dLowSpeedInitPins(ChannelNumber); } - else + break; + + case LOWSPEED_INIT: { - IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_ERROR; - IOMapLowSpeed.ErrorType[ChannelNumber] = LOWSPEED_CH_NOT_READY; + if ((pMapInput->Inputs[ChannelNumber].SensorType == LOWSPEED) || (pMapInput->Inputs[ChannelNumber].SensorType == LOWSPEED_9V)) + { + if (VarsLowSpeed.TimerState == TIMER_STOPPED) + { + dLowSpeedStartTimer(); + VarsLowSpeed.TimerState = TIMER_RUNNING; + } + IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_LOAD_BUFFER; + IOMapLowSpeed.ErrorType[ChannelNumber] = LOWSPEED_NO_ERROR; + VarsLowSpeed.ErrorCount[ChannelNumber] = 0; + dLowSpeedInitPins(ChannelNumber); + } + else + { + IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_ERROR; + IOMapLowSpeed.ErrorType[ChannelNumber] = LOWSPEED_CH_NOT_READY; + } } - } - break; + break; - case LOWSPEED_LOAD_BUFFER: - { - if ((pMapInput->Inputs[ChannelNumber].SensorType == LOWSPEED) || (pMapInput->Inputs[ChannelNumber].SensorType == LOWSPEED_9V)) + case LOWSPEED_LOAD_BUFFER: { - VarsLowSpeed.OutputBuf[ChannelNumber].OutPtr = 0; - for (VarsLowSpeed.OutputBuf[ChannelNumber].InPtr = 0; VarsLowSpeed.OutputBuf[ChannelNumber].InPtr < IOMapLowSpeed.OutBuf[ChannelNumber].InPtr; VarsLowSpeed.OutputBuf[ChannelNumber].InPtr++) + if ((pMapInput->Inputs[ChannelNumber].SensorType == LOWSPEED) || (pMapInput->Inputs[ChannelNumber].SensorType == LOWSPEED_9V)) { - VarsLowSpeed.OutputBuf[ChannelNumber].Buf[VarsLowSpeed.OutputBuf[ChannelNumber].InPtr] = IOMapLowSpeed.OutBuf[ChannelNumber].Buf[IOMapLowSpeed.OutBuf[ChannelNumber].OutPtr]; - IOMapLowSpeed.OutBuf[ChannelNumber].OutPtr++; - } - if (dLowSpeedSendData(ChannelNumber, &VarsLowSpeed.OutputBuf[ChannelNumber].Buf[0], (VarsLowSpeed.OutputBuf[ChannelNumber].InPtr - VarsLowSpeed.OutputBuf[ChannelNumber].OutPtr))) - { - if (IOMapLowSpeed.InBuf[ChannelNumber].BytesToRx != 0) + VarsLowSpeed.OutputBuf[ChannelNumber].OutPtr = 0; + for (VarsLowSpeed.OutputBuf[ChannelNumber].InPtr = 0; VarsLowSpeed.OutputBuf[ChannelNumber].InPtr < IOMapLowSpeed.OutBuf[ChannelNumber].InPtr; VarsLowSpeed.OutputBuf[ChannelNumber].InPtr++) + { + VarsLowSpeed.OutputBuf[ChannelNumber].Buf[VarsLowSpeed.OutputBuf[ChannelNumber].InPtr] = IOMapLowSpeed.OutBuf[ChannelNumber].Buf[IOMapLowSpeed.OutBuf[ChannelNumber].OutPtr]; + IOMapLowSpeed.OutBuf[ChannelNumber].OutPtr++; + } + if (dLowSpeedSendData(ChannelNumber, &VarsLowSpeed.OutputBuf[ChannelNumber].Buf[0], (VarsLowSpeed.OutputBuf[ChannelNumber].InPtr - VarsLowSpeed.OutputBuf[ChannelNumber].OutPtr))) { - dLowSpeedReceiveData(ChannelNumber, &VarsLowSpeed.InputBuf[ChannelNumber].Buf[0], IOMapLowSpeed.InBuf[ChannelNumber].BytesToRx); - VarsLowSpeed.RxTimeCnt[ChannelNumber] = 0; + if (IOMapLowSpeed.InBuf[ChannelNumber].BytesToRx != 0) + { + dLowSpeedReceiveData(ChannelNumber, &VarsLowSpeed.InputBuf[ChannelNumber].Buf[0], IOMapLowSpeed.InBuf[ChannelNumber].BytesToRx, IOMapLowSpeed.NoRestartOnRead); + VarsLowSpeed.RxTimeCnt[ChannelNumber] = 0; + } + IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_COMMUNICATING; + IOMapLowSpeed.Mode[ChannelNumber] = LOWSPEED_TRANSMITTING; } - IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_COMMUNICATING; - IOMapLowSpeed.Mode[ChannelNumber] = LOWSPEED_TRANSMITTING; - } + else + { + IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_ERROR; + IOMapLowSpeed.ErrorType[ChannelNumber] = LOWSPEED_CH_NOT_READY; + } + } else { IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_ERROR; IOMapLowSpeed.ErrorType[ChannelNumber] = LOWSPEED_CH_NOT_READY; } } - else - { - IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_ERROR; - IOMapLowSpeed.ErrorType[ChannelNumber] = LOWSPEED_CH_NOT_READY; - } - } - break; + break; - case LOWSPEED_COMMUNICATING: - { - if ((pMapInput->Inputs[ChannelNumber].SensorType == LOWSPEED) || (pMapInput->Inputs[ChannelNumber].SensorType == LOWSPEED_9V)) + case LOWSPEED_COMMUNICATING: { - if (IOMapLowSpeed.Mode[ChannelNumber] == LOWSPEED_TRANSMITTING) - { - Temp = dLowSpeedComTxStatus(ChannelNumber); // Returns 0x00 if not done, 0x01 if success, 0xFF if error - - if (Temp == LOWSPEED_COMMUNICATION_SUCCESS) - { - if (IOMapLowSpeed.InBuf[ChannelNumber].BytesToRx != 0) + if ((pMapInput->Inputs[ChannelNumber].SensorType == LOWSPEED) || (pMapInput->Inputs[ChannelNumber].SensorType == LOWSPEED_9V)) + { + if (IOMapLowSpeed.Mode[ChannelNumber] == LOWSPEED_TRANSMITTING) + { + Temp = dLowSpeedComTxStatus(ChannelNumber); // Returns 0x00 if not done, 0x01 if success, 0xFF if error + + if (Temp == LOWSPEED_COMMUNICATION_SUCCESS) + { + if (IOMapLowSpeed.InBuf[ChannelNumber].BytesToRx != 0) + { + IOMapLowSpeed.Mode[ChannelNumber] = LOWSPEED_RECEIVING; + } + else + { + IOMapLowSpeed.Mode[ChannelNumber] = LOWSPEED_DATA_RECEIVED; + IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_DONE; + } + } + if (Temp == LOWSPEED_COMMUNICATION_ERROR) + { + //ERROR in Communication, No ACK received from SLAVE, retry send data 3 times! + VarsLowSpeed.ErrorCount[ChannelNumber]++; + if (VarsLowSpeed.ErrorCount[ChannelNumber] > MAX_RETRY_TX_COUNT) + { + IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_ERROR; + IOMapLowSpeed.ErrorType[ChannelNumber] = LOWSPEED_TX_ERROR; + } + else + { + IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_LOAD_BUFFER; + } + } + } + if (IOMapLowSpeed.Mode[ChannelNumber] == LOWSPEED_RECEIVING) + { + VarsLowSpeed.RxTimeCnt[ChannelNumber]++; + if (VarsLowSpeed.RxTimeCnt[ChannelNumber] > LOWSPEED_RX_TIMEOUT) { - IOMapLowSpeed.Mode[ChannelNumber] = LOWSPEED_RECEIVING; + IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_ERROR; + IOMapLowSpeed.ErrorType[ChannelNumber] = LOWSPEED_RX_ERROR; } - else + Temp = dLowSpeedComRxStatus(ChannelNumber); + if (Temp == LOWSPEED_COMMUNICATION_SUCCESS) { + for (VarsLowSpeed.InputBuf[ChannelNumber].OutPtr = 0; VarsLowSpeed.InputBuf[ChannelNumber].OutPtr < IOMapLowSpeed.InBuf[ChannelNumber].BytesToRx; VarsLowSpeed.InputBuf[ChannelNumber].OutPtr++) + { + IOMapLowSpeed.InBuf[ChannelNumber].Buf[IOMapLowSpeed.InBuf[ChannelNumber].InPtr] = VarsLowSpeed.InputBuf[ChannelNumber].Buf[VarsLowSpeed.InputBuf[ChannelNumber].OutPtr]; + IOMapLowSpeed.InBuf[ChannelNumber].InPtr++; + if (IOMapLowSpeed.InBuf[ChannelNumber].InPtr >= SIZE_OF_LSBUF) + { + IOMapLowSpeed.InBuf[ChannelNumber].InPtr = 0; + } + VarsLowSpeed.InputBuf[ChannelNumber].Buf[VarsLowSpeed.InputBuf[ChannelNumber].OutPtr] = 0; + } IOMapLowSpeed.Mode[ChannelNumber] = LOWSPEED_DATA_RECEIVED; IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_DONE; } - } - if (Temp == LOWSPEED_COMMUNICATION_ERROR) - { - //ERROR in Communication, No ACK received from SLAVE, retry send data 3 times! - VarsLowSpeed.ErrorCount[ChannelNumber]++; - if (VarsLowSpeed.ErrorCount[ChannelNumber] > MAX_RETRY_TX_COUNT) - { - IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_ERROR; - IOMapLowSpeed.ErrorType[ChannelNumber] = LOWSPEED_TX_ERROR; - } - else - { - IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_LOAD_BUFFER; - } - } - } - if (IOMapLowSpeed.Mode[ChannelNumber] == LOWSPEED_RECEIVING) - { - VarsLowSpeed.RxTimeCnt[ChannelNumber]++; - if (VarsLowSpeed.RxTimeCnt[ChannelNumber] > LOWSPEED_RX_TIMEOUT) - { - IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_ERROR; - IOMapLowSpeed.ErrorType[ChannelNumber] = LOWSPEED_RX_ERROR; - } - Temp = dLowSpeedComRxStatus(ChannelNumber); - if (Temp == LOWSPEED_COMMUNICATION_SUCCESS) - { - for (VarsLowSpeed.InputBuf[ChannelNumber].OutPtr = 0; VarsLowSpeed.InputBuf[ChannelNumber].OutPtr < IOMapLowSpeed.InBuf[ChannelNumber].BytesToRx; VarsLowSpeed.InputBuf[ChannelNumber].OutPtr++) + if (Temp == LOWSPEED_COMMUNICATION_ERROR) { - IOMapLowSpeed.InBuf[ChannelNumber].Buf[IOMapLowSpeed.InBuf[ChannelNumber].InPtr] = VarsLowSpeed.InputBuf[ChannelNumber].Buf[VarsLowSpeed.InputBuf[ChannelNumber].OutPtr]; - IOMapLowSpeed.InBuf[ChannelNumber].InPtr++; - if (IOMapLowSpeed.InBuf[ChannelNumber].InPtr >= SIZE_OF_LSBUF) + //There was and error in receiving data from the device + for (VarsLowSpeed.InputBuf[ChannelNumber].OutPtr = 0; VarsLowSpeed.InputBuf[ChannelNumber].OutPtr < IOMapLowSpeed.InBuf[ChannelNumber].BytesToRx; VarsLowSpeed.InputBuf[ChannelNumber].OutPtr++) { - IOMapLowSpeed.InBuf[ChannelNumber].InPtr = 0; + VarsLowSpeed.InputBuf[ChannelNumber].Buf[VarsLowSpeed.InputBuf[ChannelNumber].OutPtr] = 0; } - VarsLowSpeed.InputBuf[ChannelNumber].Buf[VarsLowSpeed.InputBuf[ChannelNumber].OutPtr] = 0; - } - IOMapLowSpeed.Mode[ChannelNumber] = LOWSPEED_DATA_RECEIVED; - IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_DONE; + IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_ERROR; + IOMapLowSpeed.ErrorType[ChannelNumber] = LOWSPEED_RX_ERROR; + } } - if (Temp == LOWSPEED_COMMUNICATION_ERROR) - { - //There was and error in receiving data from the device - for (VarsLowSpeed.InputBuf[ChannelNumber].OutPtr = 0; VarsLowSpeed.InputBuf[ChannelNumber].OutPtr < IOMapLowSpeed.InBuf[ChannelNumber].BytesToRx; VarsLowSpeed.InputBuf[ChannelNumber].OutPtr++) - { - VarsLowSpeed.InputBuf[ChannelNumber].Buf[VarsLowSpeed.InputBuf[ChannelNumber].OutPtr] = 0; - } - IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_ERROR; - IOMapLowSpeed.ErrorType[ChannelNumber] = LOWSPEED_RX_ERROR; - } - } - } - else - { - IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_ERROR; - IOMapLowSpeed.ErrorType[ChannelNumber] = LOWSPEED_CH_NOT_READY; - } - } - break; + } + else + { + IOMapLowSpeed.ChannelState[ChannelNumber] = LOWSPEED_ERROR; + IOMapLowSpeed.ErrorType[ChannelNumber] = LOWSPEED_CH_NOT_READY; + } + } + break; case LOWSPEED_ERROR: { diff --git a/AT91SAM7S256/Source/c_lowspeed.iom b/AT91SAM7S256/Source/c_lowspeed.iom index 290ed35..15e0a8e 100644 --- a/AT91SAM7S256/Source/c_lowspeed.iom +++ b/AT91SAM7S256/Source/c_lowspeed.iom @@ -67,6 +67,19 @@ enum LOWSPEED_RX_ERROR }; +// Constants referring to NoRestartOnRead +enum +{ + COM_CHANNEL_RESTART_ALL = 0x00, + COM_CHANNEL_NO_RESTART_1 = 0x01, + COM_CHANNEL_NO_RESTART_2 = 0x02, + COM_CHANNEL_NO_RESTART_3 = 0x04, + COM_CHANNEL_NO_RESTART_4 = 0x08, + COM_CHANNEL_RESTART_NONE = 0x0F, + COM_CHANNEL_NO_RESTART_MASK = 0x10 +}; + + typedef struct { @@ -85,7 +98,7 @@ typedef struct UBYTE ErrorType[NO_OF_LSBUF]; UBYTE State; UBYTE Speed; - UBYTE Spare1; + UBYTE NoRestartOnRead; }IOMAPLOWSPEED; diff --git a/AT91SAM7S256/Source/c_output.c b/AT91SAM7S256/Source/c_output.c index 9566938..23e0e28 100644 --- a/AT91SAM7S256/Source/c_output.c +++ b/AT91SAM7S256/Source/c_output.c @@ -43,17 +43,20 @@ void cOutputInit(void* pHeader) { UBYTE Tmp; + IOMapOutput.PwnFreq = REGULATION_TIME; for(Tmp = 0; Tmp < NO_OF_OUTPUTS; Tmp++) { - IOMapOutput.Outputs[Tmp].Mode = 0x00; - IOMapOutput.Outputs[Tmp].Speed = 0x00; - IOMapOutput.Outputs[Tmp].ActualSpeed = 0x00; - IOMapOutput.Outputs[Tmp].TachoCnt = 0x00; - IOMapOutput.Outputs[Tmp].RunState = 0x00; - IOMapOutput.Outputs[Tmp].TachoLimit = 0x00; - IOMapOutput.Outputs[Tmp].RegPParameter = DEFAULT_P_GAIN_FACTOR; - IOMapOutput.Outputs[Tmp].RegIParameter = DEFAULT_I_GAIN_FACTOR; - IOMapOutput.Outputs[Tmp].RegDParameter = DEFAULT_D_GAIN_FACTOR; + OUTPUT * pOut = &(IOMapOutput.Outputs[Tmp]); + pOut->Mode = 0x00; + pOut->Speed = 0x00; + pOut->ActualSpeed = 0x00; + pOut->TachoCnt = 0x00; + pOut->RunState = 0x00; + pOut->TachoLimit = 0x00; + pOut->RegPParameter = DEFAULT_P_GAIN_FACTOR; + pOut->RegIParameter = DEFAULT_I_GAIN_FACTOR; + pOut->RegDParameter = DEFAULT_D_GAIN_FACTOR; + pOut->Options = 0x00; } VarsOutput.TimeCnt = 0; dOutputInit(); @@ -63,74 +66,76 @@ void cOutputCtrl(void) { UBYTE Tmp; + dOutputUpdateRegulationTime(IOMapOutput.PwnFreq); for(Tmp = 0; Tmp < NO_OF_OUTPUTS; Tmp++) { - if (IOMapOutput.Outputs[Tmp].Flags != 0) - { - if (IOMapOutput.Outputs[Tmp].Flags & UPDATE_RESET_ROTATION_COUNT) + OUTPUT * pOut = &(IOMapOutput.Outputs[Tmp]); + if (pOut->Flags != 0) + { + if (pOut->Flags & UPDATE_RESET_ROTATION_COUNT) { - IOMapOutput.Outputs[Tmp].Flags &= ~UPDATE_RESET_ROTATION_COUNT; + pOut->Flags &= ~UPDATE_RESET_ROTATION_COUNT; dOutputResetRotationCaptureCount(Tmp); } - if (IOMapOutput.Outputs[Tmp].Flags & UPDATE_RESET_COUNT) - { - IOMapOutput.Outputs[Tmp].Flags &= ~UPDATE_RESET_COUNT; - dOutputResetTachoLimit(Tmp); - } - if (IOMapOutput.Outputs[Tmp].Flags & UPDATE_RESET_BLOCK_COUNT) + if (pOut->Flags & UPDATE_RESET_COUNT) + { + pOut->Flags &= ~UPDATE_RESET_COUNT; + dOutputResetTachoLimit(Tmp); + } + if (pOut->Flags & UPDATE_RESET_BLOCK_COUNT) { - IOMapOutput.Outputs[Tmp].Flags &= ~UPDATE_RESET_BLOCK_COUNT; - dOutputResetBlockTachoLimit(Tmp); + pOut->Flags &= ~UPDATE_RESET_BLOCK_COUNT; + dOutputResetBlockTachoLimit(Tmp); } - if (IOMapOutput.Outputs[Tmp].Flags & UPDATE_SPEED) - { - IOMapOutput.Outputs[Tmp].Flags &= ~UPDATE_SPEED; - if (IOMapOutput.Outputs[Tmp].Mode & MOTORON) - { - dOutputSetSpeed (Tmp, IOMapOutput.Outputs[Tmp].RunState, IOMapOutput.Outputs[Tmp].Speed, IOMapOutput.Outputs[Tmp].SyncTurnParameter); - } - } - if (IOMapOutput.Outputs[Tmp].Flags & UPDATE_TACHO_LIMIT) - { - IOMapOutput.Outputs[Tmp].Flags &= ~UPDATE_TACHO_LIMIT; - dOutputSetTachoLimit(Tmp, IOMapOutput.Outputs[Tmp].TachoLimit); - } - if (IOMapOutput.Outputs[Tmp].Flags & UPDATE_MODE) - { - IOMapOutput.Outputs[Tmp].Flags &= ~UPDATE_MODE; - if (IOMapOutput.Outputs[Tmp].Mode & BRAKE) + if (pOut->Flags & UPDATE_SPEED) + { + pOut->Flags &= ~UPDATE_SPEED; + if (pOut->Mode & MOTORON) + { + dOutputSetSpeed(Tmp, pOut->RunState, pOut->Speed, pOut->SyncTurnParameter); + } + } + if (pOut->Flags & UPDATE_TACHO_LIMIT) + { + pOut->Flags &= ~UPDATE_TACHO_LIMIT; + dOutputSetTachoLimit(Tmp, pOut->TachoLimit, pOut->Options); + } + if (pOut->Flags & UPDATE_MODE) + { + pOut->Flags &= ~UPDATE_MODE; + if (pOut->Mode & BRAKE) { // Motor is Braked dOutputSetMode(Tmp, BRAKE); - } + } else { // Motor is floated dOutputSetMode(Tmp, 0x00); } - if (IOMapOutput.Outputs[Tmp].Mode & MOTORON) + if (pOut->Mode & MOTORON) { - if (IOMapOutput.Outputs[Tmp].Mode & REGULATED) - { - dOutputEnableRegulation(Tmp, IOMapOutput.Outputs[Tmp].RegMode); - } - else - { - dOutputDisableRegulation(Tmp); - } - } - else - { - dOutputSetSpeed(Tmp, 0x00, 0x00, 0x00); + if (pOut->Mode & REGULATED) + { + dOutputEnableRegulation(Tmp, pOut->RegMode); + } + else + { + dOutputDisableRegulation(Tmp); + } + } + else + { + dOutputSetSpeed(Tmp, 0x00, 0x00, 0x00); dOutputDisableRegulation(Tmp); - } - } - if (IOMapOutput.Outputs[Tmp].Flags & UPDATE_PID_VALUES) - { - IOMapOutput.Outputs[Tmp].Flags &= ~UPDATE_PID_VALUES; - dOutputSetPIDParameters(Tmp, IOMapOutput.Outputs[Tmp].RegPParameter, IOMapOutput.Outputs[Tmp].RegIParameter, IOMapOutput.Outputs[Tmp].RegDParameter); - } - } + } + } + if (pOut->Flags & UPDATE_PID_VALUES) + { + pOut->Flags &= ~UPDATE_PID_VALUES; + dOutputSetPIDParameters(Tmp, pOut->RegPParameter, pOut->RegIParameter, pOut->RegDParameter); + } + } } dOutputCtrl(); cOutputUpdateIomap(); @@ -138,29 +143,30 @@ void cOutputCtrl(void) void cOutputUpdateIomap(void) { - UBYTE TempCurrentMotorSpeed[NO_OF_OUTPUTS]; - UBYTE TempRunState[NO_OF_OUTPUTS]; + UBYTE TempCurrentMotorSpeed[NO_OF_OUTPUTS]; + UBYTE TempRunState[NO_OF_OUTPUTS]; UBYTE TempMotorOverloaded[NO_OF_OUTPUTS]; - SLONG TempTachoCount[NO_OF_OUTPUTS]; + SLONG TempTachoCount[NO_OF_OUTPUTS]; SLONG TempBlockTachoCount[NO_OF_OUTPUTS]; SLONG TempRotationCount[NO_OF_OUTPUTS]; UBYTE Tmp; - dOutputGetMotorParameters(TempCurrentMotorSpeed, TempTachoCount, TempBlockTachoCount, TempRunState, TempMotorOverloaded,TempRotationCount); + dOutputGetMotorParameters(TempCurrentMotorSpeed, TempTachoCount, TempBlockTachoCount, TempRunState, TempMotorOverloaded,TempRotationCount); - for(Tmp = 0; Tmp < NO_OF_OUTPUTS; Tmp++) + for(Tmp = 0; Tmp < NO_OF_OUTPUTS; Tmp++) { - IOMapOutput.Outputs[Tmp].ActualSpeed = TempCurrentMotorSpeed[Tmp]; - IOMapOutput.Outputs[Tmp].TachoCnt = TempTachoCount[Tmp]; - IOMapOutput.Outputs[Tmp].BlockTachoCount = TempBlockTachoCount[Tmp]; - IOMapOutput.Outputs[Tmp].RotationCount = TempRotationCount[Tmp]; - IOMapOutput.Outputs[Tmp].Overloaded = TempMotorOverloaded[Tmp]; - if (!(IOMapOutput.Outputs[Tmp].Flags & PENDING_UPDATES)) + OUTPUT * pOut = &(IOMapOutput.Outputs[Tmp]); + pOut->ActualSpeed = TempCurrentMotorSpeed[Tmp]; + pOut->TachoCnt = TempTachoCount[Tmp]; + pOut->BlockTachoCount = TempBlockTachoCount[Tmp]; + pOut->RotationCount = TempRotationCount[Tmp]; + pOut->Overloaded = TempMotorOverloaded[Tmp]; + if (!(pOut->Flags & PENDING_UPDATES)) { - IOMapOutput.Outputs[Tmp].RunState = TempRunState[Tmp]; + pOut->RunState = TempRunState[Tmp]; } - } + } } void cOutputExit(void) diff --git a/AT91SAM7S256/Source/c_output.iom b/AT91SAM7S256/Source/c_output.iom index 80e35de..f6191bf 100644 --- a/AT91SAM7S256/Source/c_output.iom +++ b/AT91SAM7S256/Source/c_output.iom @@ -27,6 +27,9 @@ enum REG_METHOD = 0xF0 /* Regulation methods - to be designed! */ }; +#define OPTION_HOLDATLIMIT 0x10 +#define OPTION_RAMPDOWNTOLIMIT 0x20 + // Constants related to Flags enum { @@ -72,7 +75,7 @@ typedef struct UBYTE RegMode; /* RW - Tells which regulation mode should be used */ UBYTE Overloaded; /* R - True if the motor has been overloaded within speed control regulation */ SBYTE SyncTurnParameter; /* RW - Holds the turning parameter need within MoveBlock */ - UBYTE SpareOne; + UBYTE Options; UBYTE SpareTwo; UBYTE SpareThree; }OUTPUT; @@ -81,7 +84,7 @@ typedef struct typedef struct { OUTPUT Outputs[NO_OF_OUTPUTS]; - UBYTE PwnFreq; + UBYTE PwnFreq; // use for frequency of checking regulation mode }IOMAPOUTPUT; diff --git a/AT91SAM7S256/Source/c_ui.c b/AT91SAM7S256/Source/c_ui.c index c79dca9..b47813a 100644 --- a/AT91SAM7S256/Source/c_ui.c +++ b/AT91SAM7S256/Source/c_ui.c @@ -168,43 +168,29 @@ enum STATUS_NO // Index in status icon collection file enum // String index in text string file { TXT_GENERAL_EMPTY, + TXT_FB_GENERIC_FAIL, // "Failed!" + // BlueTooth connect TXT_FB_BT_CONNECTING_WAIT, // "Connecting" TXT_FB_BT_CONNECT_BUSY_FAIL, // "Line is busy" - TXT_FB_BT_CONNECTING_FAIL, // "Failed!" // BlueTooth send file TXT_FB_BT_SENDING_NO_CONN_FAIL, // "Connection?" TXT_FB_BT_SENDING_WAIT, // "Sending file" - TXT_FB_BT_SENDING_FAIL, // "Failed!" // BlueTooth on/off TXT_FB_BT_TURNING_ON_WAIT, // "Turning on" - TXT_FB_BT_TURNING_ON_FAIL, // "Failed!" TXT_FB_BT_TURNING_OFF_WAIT, // "Turning off" - TXT_FB_BT_TURNING_OFF_FAIL, // "Failed!" // BlueTooth seach TXT_FB_BT_SEARCHING_WAIT, // "Searching" TXT_FB_BT_SEARCH_ABORTED_INFO, // "Aborted!" - TXT_FB_BT_SEARCHING_FAIL, // "Failed!" - - // BlueTooth device list - TXT_FB_BT_REMOVE_FAIL, // "Failed!" - - // BlueTooth connection list - TXT_FB_BT_DISCONNECT_FAIL, // "Failed!" // On Brick Programming TXT_FB_OBP_MEMORY_FULL_FAIL, // "Memory full!" - TXT_FB_OBP_FILE_SAVED_INFO, // "File saved" - TXT_FB_OBP_FILE_EXIST_FAIL, // "File exist" - TXT_FB_OBP_OVERWRITE_FAIL, // "overwrite!" - - // Datalogging - TXT_FB_DL_FILE_SAVED_INFO, // "File saved" - TXT_FB_DL_FILE_EXIST_FAIL, // "File exist" - TXT_FB_DL_OVERWRITE_FAIL, // "overwrite!" + TXT_FB_FILE_SAVED_INFO, // "File saved" + TXT_FB_FILE_EXIST_FAIL, // "File exist" + TXT_FB_OVERWRITE_FAIL, // "overwrite!" // File delete TXT_FB_FD_FILE_DELETED_INFO, // "File deleted" @@ -217,7 +203,7 @@ enum // String index in text string file TXT_FILERUN_RUNNING, // "Running" TXT_FILERUN_ABORTED, // "Aborted!" TXT_FILERUN_ENDED, // "Ended" - TXT_FILERUN_FILE_ERROR, // "File error!" + TXT_FILERUN_FILE_ERROR, // "File error! %d" // Files delete TXT_FILESDELETE_DELETING_ALL, // "Deleting all" @@ -250,13 +236,7 @@ enum // String index in text string file TXT_ONBRICKPROGRAMMING_BC_LR_MOTORS, // "B/C - L/R motors" // View - TXT_VIEW_SELECT, // "Select" - - // BlueTooth device list - TXT_BTDEVICELIST_SELECT, // "Select" - - // BlueTooth connection list - TXT_BTCONNECTLIST_SELECT, // "Select" + TXT_GENERIC_SELECT, // "Select" // Bluetooth list errors TXT_FB_BT_ERROR_LR_COULD_NOT_SAVE_1, // BT save data error! @@ -1286,6 +1266,18 @@ void cUiCtrl(void) */ // + if ((!(IOMapUi.Flags & UI_EXECUTE_LMS_FILE)) && (IOMapUi.State == INIT_INTRO)/* && ((pMapButton->State[BTN1] & PRESSED_STATE)!=PRESSED_STATE)*/) + { + UWORD LStatus; + if (LOADER_ERR(LStatus = pMapLoader->pFunc(FINDFIRST, UI_STARTUP_PROGRAM, NULL, NULL)) == SUCCESS) + { + //Close file handle returned by FINDFIRST + pMapLoader->pFunc(CLOSE, LOADER_HANDLE_P(LStatus), NULL, NULL); + strcpy((char*)IOMapUi.LMSfilename, UI_STARTUP_PROGRAM); + IOMapUi.Flags |= UI_EXECUTE_LMS_FILE; + IOMapUi.State = INIT_MENU; + } + } VarsUi.CRPasskey++; VarsUi.ButtonTimer++; diff --git a/AT91SAM7S256/Source/c_ui.h b/AT91SAM7S256/Source/c_ui.h index e74dcbe..08dc1d8 100644 --- a/AT91SAM7S256/Source/c_ui.h +++ b/AT91SAM7S256/Source/c_ui.h @@ -36,7 +36,7 @@ #define CHECKBYTE 0x78 // Used to validate NVData -#define BATTERY_COUNT_TO_MV 13.848 // Battery count to mV factor [mV/cnt] +#define BATTERY_COUNT_TO_MV (float)13.848 // Battery count to mV factor [mV/cnt] #define LOW_BATT_THRESHOLD 6 // Low batt conunts before warning #define BUTTON_DELAY_TIME 800 // Delay before first repeat [mS] diff --git a/AT91SAM7S256/Source/c_ui.iom b/AT91SAM7S256/Source/c_ui.iom index 770b682..a33505e 100644 --- a/AT91SAM7S256/Source/c_ui.iom +++ b/AT91SAM7S256/Source/c_ui.iom @@ -40,6 +40,7 @@ enum #define UI_STARTUP_SOUND "! Startup" // Sound file activated when the menu system starts up #define UI_KEYCLICK_SOUND "! Click" // Sound file activated when key pressed in the menu system #define UI_ATTENTION_SOUND "! Attention" // Sound file activated when incomming BT requests attention +#define UI_STARTUP_PROGRAM "! Startup.rxe" // Program file activated when the NXT boots // Various text strings #define UI_NAME_DEFAULT "NXT" // Default blue tooth name @@ -122,6 +123,7 @@ typedef struct UBYTE Error; // W - Error code UBYTE OBPPointer; // W - Actual OBP step (0 - 4) UBYTE ForceOff; // W - Force off (> 0 = off) + UBYTE AbortFlag; // RW - Abort on this button state }IOMAPUI; #endif diff --git a/AT91SAM7S256/Source/d_bt.c b/AT91SAM7S256/Source/d_bt.c index 6e3e47d..1a76fa5 100644 --- a/AT91SAM7S256/Source/d_bt.c +++ b/AT91SAM7S256/Source/d_bt.c @@ -56,9 +56,9 @@ void dBtStartADConverter(void) BTStartADConverter; } -void dBtInitReceive(UBYTE *InputBuffer, UBYTE Mode) +void dBtInitReceive(UBYTE *InputBuffer, UBYTE Mode, UBYTE NoLengthBytes) { - BTInitReceiver(InputBuffer, Mode); + BTInitReceiver(InputBuffer, Mode, NoLengthBytes); } void dBtSetArm7CmdSignal(void) diff --git a/AT91SAM7S256/Source/d_bt.h b/AT91SAM7S256/Source/d_bt.h index baf3ab6..aab544f 100644 --- a/AT91SAM7S256/Source/d_bt.h +++ b/AT91SAM7S256/Source/d_bt.h @@ -23,7 +23,7 @@ void dBtExit(void); void dBtStartADConverter(void); void dBtSetArm7CmdSignal(void); void dBtClearArm7CmdSignal(void); -void dBtInitReceive(UBYTE *InputBuffer, UBYTE Mode); +void dBtInitReceive(UBYTE *InputBuffer, UBYTE Mode, UBYTE NoLengthBytes); void dBtSetBcResetPinLow(void); void dBtSetBcResetPinHigh(void); void dBtSendBtCmd(UBYTE Cmd, UBYTE Param1, UBYTE Param2, UBYTE *pBdAddr, UBYTE *pName, UBYTE *pCod, UBYTE *pPin); diff --git a/AT91SAM7S256/Source/d_bt.r b/AT91SAM7S256/Source/d_bt.r index 8c9558f..0e9944e 100644 --- a/AT91SAM7S256/Source/d_bt.r +++ b/AT91SAM7S256/Source/d_bt.r @@ -138,18 +138,25 @@ static UWORD RemainingLength; *AT91C_PIOA_CODR = BT_RST_PIN; /* PA11 set output low */\ } -#define BTInitReceiver(InputBuffer, Mode)\ +#define BTInitReceiver(InputBuffer, Mode, noLenBytes)\ {\ pBuffer = InputBuffer;\ MsgIn = 0;\ FullRxLength = 0;\ - if (STREAM_MODE == Mode)\ + if (noLenBytes)\ {\ - LengthSize = 2;\ + LengthSize = 0;\ }\ else\ {\ - LengthSize = 1;\ + if (STREAM_MODE == Mode)\ + {\ + LengthSize = 2;\ + }\ + else\ + {\ + LengthSize = 1;\ + }\ }\ } @@ -200,7 +207,7 @@ static UWORD RemainingLength; OutDma[DmaBufPtr][0] = (UBYTE)MsgSize;\ OutDma[DmaBufPtr][1] = (UBYTE)(MsgSize>>8);\ }\ - else\ + else if (1 == LengthSize)\ {\ OutDma[DmaBufPtr][0] = (UBYTE)MsgSize;\ }\ @@ -244,7 +251,7 @@ static UWORD RemainingLength; /* Remove Length when in strean mode */\ MsgIn = 0;\ }\ - else\ + else if (1 == LengthSize)\ {\ FullRxLength = pBuffer[0];\ }\ diff --git a/AT91SAM7S256/Source/d_button.r b/AT91SAM7S256/Source/d_button.r index c478394..1e24b36 100644 --- a/AT91SAM7S256/Source/d_button.r +++ b/AT91SAM7S256/Source/d_button.r @@ -40,10 +40,7 @@ static UBYTE RisingTime; /* And because it's an AD value returned from the AVR */ /* then a peak detector is needed */ #define BUTTONRead(pB) {\ - UBYTE Tmp, BtnPtr;\ - UWORD TmpBtn;\ *pB = OldState;\ - BtnPtr = 0x01;\ if (OldVal < IoFromAvr.Buttons)\ {\ OldVal = IoFromAvr.Buttons;\ @@ -60,27 +57,31 @@ static UBYTE RisingTime; {\ if (RisingTime > RISING_THRESHOLD)\ {\ - TmpBtn = IoFromAvr.Buttons;\ - if (0x40 > TmpBtn)\ - {\ - TmpBtn = 0x00;\ + UBYTE Tmp, BtnPtr, TmpBtn;\ + UWORD buttonsVal;\ + buttonsVal = IoFromAvr.Buttons;\ + TmpBtn = 0;\ + if (buttonsVal > 0x5FF) {\ + TmpBtn = 0x08;\ + buttonsVal -= 0x7ff;\ }\ - else if (0x100 > TmpBtn)\ + if (0x40 > buttonsVal)\ {\ - TmpBtn = 0x04;\ + TmpBtn |= 0x00;\ }\ - else if (0x1FF > TmpBtn)\ + else if (0x100 > buttonsVal)\ {\ - TmpBtn = 0x02;\ + TmpBtn |= 0x04;\ }\ - else if (0x5FF > TmpBtn)\ + else if (0x1FF > buttonsVal)\ {\ - TmpBtn = 0x01;\ + TmpBtn |= 0x02;\ }\ - else\ + else if (0x5FF > buttonsVal)\ {\ - TmpBtn = 0x08;\ + TmpBtn |= 0x01;\ }\ + BtnPtr = 0x01;\ for (Tmp = 0; Tmp < NOS_OF_AVR_BTNS; Tmp++)\ {\ if ((TmpBtn) & BtnPtr)\ diff --git a/AT91SAM7S256/Source/d_display.c b/AT91SAM7S256/Source/d_display.c index 99f16c6..89d22fd 100644 --- a/AT91SAM7S256/Source/d_display.c +++ b/AT91SAM7S256/Source/d_display.c @@ -28,11 +28,11 @@ void dDisplayInit(void) } -void dDisplayOn(UBYTE On) +void dDisplayOn(UBYTE On, UBYTE Contrast) { if (On) { - DISPLAYOn; + DISPLAYOn(Contrast); } else { diff --git a/AT91SAM7S256/Source/d_display.h b/AT91SAM7S256/Source/d_display.h index a894685..fa04dd3 100644 --- a/AT91SAM7S256/Source/d_display.h +++ b/AT91SAM7S256/Source/d_display.h @@ -20,7 +20,7 @@ #define D_DISPLAY void dDisplayInit(void); -void dDisplayOn(UBYTE On); +void dDisplayOn(UBYTE On, UBYTE Contrast); UBYTE dDisplayUpdate(UWORD Height,UWORD Width,UBYTE *pImage); void dDisplayExit(void); diff --git a/AT91SAM7S256/Source/d_display.r b/AT91SAM7S256/Source/d_display.r index e38bb45..81e7078 100644 --- a/AT91SAM7S256/Source/d_display.r +++ b/AT91SAM7S256/Source/d_display.r @@ -353,8 +353,8 @@ UBYTE DisplayUpdate(UWORD Height,UWORD Width,UBYTE *pImage) #endif -#define DISPLAYOn {\ - DisplayInitString[6] = 0x5A;\ +#define DISPLAYOn(c) {\ + DisplayInitString[6] = (c)&0x7F;\ DisplayInitString[13] = 0xAF;\ } diff --git a/AT91SAM7S256/Source/d_display2.r b/AT91SAM7S256/Source/d_display2.r new file mode 100644 index 0000000..71243be --- /dev/null +++ b/AT91SAM7S256/Source/d_display2.r @@ -0,0 +1,388 @@ +// +// Programmer +// +// Date init 14.12.2004 +// +// Reviser $Author:: Dktochpe $ +// +// Revision date $Date:: 20-12-05 12:28 $ +// +// Filename $Workfile:: d_display.r $ +// +// Version $Revision:: 18 $ +// +// Archive $Archive:: /LMS2006/Sys01/Main/Firmware/Source/d_display. $ +// +// Platform C +// + +#ifdef SAM7S256 + +// Display 128 x 64 +// 1/65 duty, 1/9 bias +// VLCD 12.0V + +// SPI interface +// +// PCB LCD ARM PIO +// ------ ----- ---- ----- +// CS_DIS -CS1 PA10 NPCS2 (PB) +// DIS_A0 A0 PA12 PA12 +// DIS_SCL SCL PA14 SPCK (PA) +// DIS_SDA SI PA13 MOSI (PA) + + +// CPOL = 0, NCPHA=0, + +#define BT_RESET_OUT AT91C_PIO_PA11 +#define BT_RESET_IN AT91C_PIO_PA29 +#define BT_MOSI_OUT AT91C_PIO_PA13 +#define BT_MOSI_IN AT91C_PIO_PA20 +#define BT_CLK_OUT AT91C_PIO_PA14 +#define BT_CLK_IN AT91C_PIO_PA28 +#define BT_CE_OUT AT91C_PIO_PA31 +#define BT_CE_IN AT91C_PIO_PA19 +#define BT_REA_OUT AT91C_PIO_PA7 +#define BT_MISO_OUT AT91C_PIO_PA6 +#define BT_MISO_IN AT91C_PIO_PA12 + +#pragma optimize=s 9 + +__ramfunc void SpiBtIo(void) +{ + register ULONG Port; + + *AT91C_AIC_IDCR = 0xFFFFFFFF; /* Disable all interrupts */ + + *AT91C_PIOA_PER = BT_RESET_OUT; /* Enable pin RESET out */ + *AT91C_PIOA_OER = BT_RESET_OUT; /* Set output */ + *AT91C_PIOA_SODR = BT_RESET_OUT; /* Set high */ + + *AT91C_PIOA_PER = BT_MOSI_OUT; /* Enable pin MOSI out */ + *AT91C_PIOA_OER = BT_MOSI_OUT; /* Set output */ + + *AT91C_PIOA_PER = BT_CLK_OUT; /* Enable pin CLK out */ + *AT91C_PIOA_OER = BT_CLK_OUT; /* Set output */ + + *AT91C_PIOA_PER = BT_CE_OUT; /* Enable pin CE out */ + *AT91C_PIOA_OER = BT_CE_OUT; /* Set output */ + + *AT91C_PIOA_PER = BT_REA_OUT; /* Enable pin REA out */ + *AT91C_PIOA_OER = BT_REA_OUT; /* Set output */ + *AT91C_PIOA_SODR = BT_REA_OUT; /* Set high */ + + *AT91C_PIOA_PER = BT_MISO_OUT; /* Enable pin MISO out */ + *AT91C_PIOA_OER = BT_MISO_OUT; /* Set output */ + + *AT91C_PIOA_PER = BT_RESET_IN; /* Enable pin RESET in */ + *AT91C_PIOA_ODR = BT_RESET_IN; /* Set input */ + *AT91C_PIOA_IFDR = BT_RESET_IN; /* Disable filter */ + *AT91C_PIOA_IDR = BT_RESET_IN; /* Disable interrupt */ + *AT91C_PIOA_MDDR = BT_RESET_IN; /* Disable multidriver */ + *AT91C_PIOA_PPUDR = BT_RESET_IN; /* Disable pullup */ + + *AT91C_PIOA_PER = BT_MOSI_IN; /* Enable pin MOSI in */ + *AT91C_PIOA_ODR = BT_MOSI_IN; /* Set input */ + *AT91C_PIOA_IFDR = BT_MOSI_IN; /* Disable filter */ + *AT91C_PIOA_IDR = BT_MOSI_IN; /* Disable interrupt */ + *AT91C_PIOA_MDDR = BT_MOSI_IN; /* Disable multidriver */ + *AT91C_PIOA_PPUDR = BT_MOSI_IN; /* Disable pullup */ + + *AT91C_PIOA_PER = BT_CLK_IN; /* Enable pin CLK in */ + *AT91C_PIOA_ODR = BT_CLK_IN; /* Set input */ + *AT91C_PIOA_IFDR = BT_CLK_IN; /* Disable filter */ + *AT91C_PIOA_IDR = BT_CLK_IN; /* Disable interrupt */ + *AT91C_PIOA_MDDR = BT_CLK_IN; /* Disable multidriver */ + *AT91C_PIOA_PPUDR = BT_CLK_IN; /* Disable pullup */ + + *AT91C_PIOA_PER = BT_CE_IN; /* Enable pin CE in */ + *AT91C_PIOA_ODR = BT_CE_IN; /* Set input */ + *AT91C_PIOA_IFDR = BT_CE_IN; /* Disable filter */ + *AT91C_PIOA_IDR = BT_CE_IN; /* Disable interrupt */ + *AT91C_PIOA_MDDR = BT_CE_IN; /* Disable multidriver */ + *AT91C_PIOA_PPUDR = BT_CE_IN; /* Disable pullup */ + + *AT91C_PIOA_PER = BT_MISO_IN; /* Enable pin MISO in */ + *AT91C_PIOA_ODR = BT_MISO_IN; /* Set input */ + *AT91C_PIOA_IFDR = BT_MISO_IN; /* Disable filter */ + *AT91C_PIOA_IDR = BT_MISO_IN; /* Disable interrupt */ + *AT91C_PIOA_MDDR = BT_MISO_IN; /* Disable multidriver */ + *AT91C_PIOA_PPUDR = BT_MISO_IN; /* Disable pullup */ + + while (1) + { + Port = *AT91C_PIOA_PDSR; + if ((Port & BT_MISO_IN)) + { + *AT91C_PIOA_SODR = BT_MISO_OUT; + } + else + { + *AT91C_PIOA_CODR = BT_MISO_OUT; + } + if ((Port & BT_MOSI_IN)) + { + *AT91C_PIOA_SODR = BT_MOSI_OUT; + } + else + { + *AT91C_PIOA_CODR = BT_MOSI_OUT; + } + if ((Port & BT_CLK_IN)) + { + *AT91C_PIOA_SODR = BT_CLK_OUT; + } + else + { + *AT91C_PIOA_CODR = BT_CLK_OUT; + } + if ((Port & BT_CE_IN)) + { + *AT91C_PIOA_SODR = BT_CE_OUT; + } + else + { + *AT91C_PIOA_CODR = BT_CE_OUT; + } + } + +} + + +void BtIo(void) +{ + SpiBtIo(); +} + + + +#define SPI_BITRATE 2000000 + +#define SPIA0High {\ + *AT91C_PIOA_SODR = AT91C_PIO_PA12;\ + } + + +#define SPIA0Low {\ + *AT91C_PIOA_CODR = AT91C_PIO_PA12;\ + } + + +#define SPIInit {\ + *AT91C_PMC_PCER = (1L << AT91C_ID_SPI); /* Enable MCK clock */\ + *AT91C_PIOA_PER = AT91C_PIO_PA12; /* Enable A0 on PA12 */\ + *AT91C_PIOA_OER = AT91C_PIO_PA12;\ + *AT91C_PIOA_CODR = AT91C_PIO_PA12;\ + *AT91C_PIOA_PDR = AT91C_PA14_SPCK; /* Enable SPCK on PA14 */\ + *AT91C_PIOA_ASR = AT91C_PA14_SPCK;\ + *AT91C_PIOA_ODR = AT91C_PA14_SPCK;\ + *AT91C_PIOA_OWER = AT91C_PA14_SPCK;\ + *AT91C_PIOA_MDDR = AT91C_PA14_SPCK;\ + *AT91C_PIOA_PPUDR = AT91C_PA14_SPCK;\ + *AT91C_PIOA_IFDR = AT91C_PA14_SPCK;\ + *AT91C_PIOA_CODR = AT91C_PA14_SPCK;\ + *AT91C_PIOA_IDR = AT91C_PA14_SPCK;\ + *AT91C_PIOA_PDR = AT91C_PA13_MOSI; /* Enable mosi on PA13 */\ + *AT91C_PIOA_ASR = AT91C_PA13_MOSI;\ + *AT91C_PIOA_ODR = AT91C_PA13_MOSI;\ + *AT91C_PIOA_OWER = AT91C_PA13_MOSI;\ + *AT91C_PIOA_MDDR = AT91C_PA13_MOSI;\ + *AT91C_PIOA_PPUDR = AT91C_PA13_MOSI;\ + *AT91C_PIOA_IFDR = AT91C_PA13_MOSI;\ + *AT91C_PIOA_CODR = AT91C_PA13_MOSI;\ + *AT91C_PIOA_IDR = AT91C_PA13_MOSI;\ + *AT91C_PIOA_PDR = AT91C_PA10_NPCS2; /* Enable npcs0 on PA11 */\ + *AT91C_PIOA_BSR = AT91C_PA10_NPCS2;\ + *AT91C_PIOA_ODR = AT91C_PA10_NPCS2;\ + *AT91C_PIOA_OWER = AT91C_PA10_NPCS2;\ + *AT91C_PIOA_MDDR = AT91C_PA10_NPCS2;\ + *AT91C_PIOA_PPUDR = AT91C_PA10_NPCS2;\ + *AT91C_PIOA_IFDR = AT91C_PA10_NPCS2;\ + *AT91C_PIOA_CODR = AT91C_PA10_NPCS2;\ + *AT91C_PIOA_IDR = AT91C_PA10_NPCS2;\ + *AT91C_SPI_CR = AT91C_SPI_SWRST; /* Soft reset */\ + *AT91C_SPI_CR = AT91C_SPI_SPIEN; /* Enable spi */\ + *AT91C_SPI_MR = AT91C_SPI_MSTR | AT91C_SPI_MODFDIS | (0xB << 16);\ + AT91C_SPI_CSR[2] = ((OSC / SPI_BITRATE) << 8) | AT91C_SPI_CPOL;\ + } + + +#define SPIWrite(pString,Length) {\ + *AT91C_SPI_TPR = (unsigned int)pString;\ + *AT91C_SPI_TCR = (unsigned int)Length;\ + *AT91C_SPI_PTCR = AT91C_PDC_TXTEN;\ + } + + + +#define CMD 0 +#define DAT 1 +#define DISP_LINES 8 + +#if defined (PROTOTYPE_PCB_3) || (PROTOTYPE_PCB_4) + +#define ACTUAL_WIDTH 100 + +UBYTE DisplayInitString[] = +{ + 0xEB, // LCD bias setting = 1/9 0xEB + 0x2F, // Power control = internal 0x2F + 0xA4, // All points not on 0xA4 + 0xA6, // Not inverse 0xA6 + 0x40, // Start line = 0 0x40 + 0x81, // Electronic volume 0x81 + 0x5A, // -"- 0x5F + 0xC4, // LCD mapping 0xC4 + 0x27, // Set temp comp. 0x27- + 0x29, // Panel loading 0x28 0-1 + 0xA0, // Framerate 0xA0- + 0x88, // CA++ 0x88- + 0x23, // Multiplex 1:65 0x23 + 0xAF // Display on 0xAF +}; + +#else + +#define ACTUAL_WIDTH 128 + +UBYTE DisplayInitString[] = +{ + 0xA2, // LCD bias setting = 1/9 + 0x2F, // Power control = internal + 0xA4, // All points not on + 0xA6, // Not inverse + 0x40, // Start line = 0 + 0x81, // Electronic volume + 0x3F, // -"- + 0xA0, // LCD mapping + 0x27, // Resistor ratio + 0xC8, // Common output state selection + 0xF8, // Booster ratio + 0x00, // -"- + 0xE3, // nop + 0xAF // Display on +}; + +#endif + +UBYTE DisplayLineString[DISP_LINES][3] = +{ + { 0xB0,0x10,0x00 }, + { 0xB1,0x10,0x00 }, + { 0xB2,0x10,0x00 }, + { 0xB3,0x10,0x00 }, + { 0xB4,0x10,0x00 }, + { 0xB5,0x10,0x00 }, + { 0xB6,0x10,0x00 }, + { 0xB7,0x10,0x00 } +}; + +UBYTE DisplayWrite(UBYTE Type,UBYTE *pData,UWORD Length) +{ + UBYTE Result = FALSE; + + if ((*AT91C_SPI_SR & AT91C_SPI_TXEMPTY)) + { + if (Type) + { + SPIA0High; + } + else + { + SPIA0Low; + } + SPIWrite(pData,Length); + Result = TRUE; + } + + return (Result); +} + +UBYTE DisplayUpdate(UWORD Height,UWORD Width,UBYTE *pImage) +{ + static UWORD State = 0; + static UWORD Line; + + if (State == 0) + { + if (DisplayWrite(CMD,(UBYTE*)DisplayInitString,sizeof(DisplayInitString)) == TRUE) + { + Line = 0; + State++; + } + } + else + { + if ((State & 1)) + { + // always write all lines so only use address 0 + if (DisplayWrite(CMD, (UBYTE*)DisplayLineString[0], 3) == TRUE) + State++; +// if (DisplayWrite(CMD,(UBYTE*)DisplayLineString[Line],3) == TRUE) +// State++; + } + else + { + // write 1056 bytes once rather than 100 bytes 8 times + static UBYTE buffer[132*8]; + UBYTE *pBuf = buffer; + while (Line < (Height / 8)) + { + memcpy(pBuf,(UBYTE*)&pImage[Line * Width],ACTUAL_WIDTH); + pBuf += 132; + Line++; + } + if (DisplayWrite(DAT,pBuf,132*8) == TRUE) + State = 0; +/* + if (DisplayWrite(DAT,(UBYTE*)&pImage[Line * Width],ACTUAL_WIDTH) == TRUE) + { + State++; + if (++Line >= (Height / 8)) + { + State = 0; + } + } +*/ + } + } + + return (State); +} + + +#if defined (PROTOTYPE_PCB_3) + +#define DISPLAYInit {\ + TSTInit;\ + TSTOn;\ + SPIInit;\ + } + +#else + +#define DISPLAYInit {\ + SPIInit;\ + } + +#endif + +#define DISPLAYOn {\ + DisplayInitString[6] = 0x5A;\ + DisplayInitString[13] = 0xAF;\ + } + +#define DISPLAYOff {\ + DisplayInitString[6] = 0x00;\ + DisplayInitString[13] = 0xAE;\ + } + +#define DISPLAYUpdate(H,W,I) DisplayUpdate(H,W,I) + +#define DISPLAYExit + +#endif + +#ifdef PCWIN + +#endif diff --git a/AT91SAM7S256/Source/d_hispeed.c b/AT91SAM7S256/Source/d_hispeed.c index 01f2d07..a764492 100644 --- a/AT91SAM7S256/Source/d_hispeed.c +++ b/AT91SAM7S256/Source/d_hispeed.c @@ -17,6 +17,25 @@ #include "d_hispeed.h" #include "d_hispeed.r" +const ULONG SPEED_TO_BAUD[16] = { + 1200L, + 2400L, + 3600L, + 4800L, + 7200L, + 9600L, + 14400L, + 19200L, + 28800L, + 38400L, + 57600L, + 76800L, + 115200L, + 230400L, + 460800L, + BAUD_RATE +}; + void dHiSpeedInit(void) { HIGHSPEEDInit; @@ -27,9 +46,10 @@ void dHiSpeedSendData(UBYTE *OutputBuffer, UBYTE BytesToSend) HIGHSPEEDSendDmaData(OutputBuffer,BytesToSend); } -void dHiSpeedSetupUart(void) +void dHiSpeedSetupUart(UBYTE speed, UWORD mode) { - HIGHSPEEDSetupUart; + ULONG baud = SPEED_TO_BAUD[speed]; + HIGHSPEEDSetupUart(baud, ((unsigned int)mode)); } void dHiSpeedInitReceive(UBYTE *InputBuffer) diff --git a/AT91SAM7S256/Source/d_hispeed.h b/AT91SAM7S256/Source/d_hispeed.h index 669a5d1..b9d8a30 100644 --- a/AT91SAM7S256/Source/d_hispeed.h +++ b/AT91SAM7S256/Source/d_hispeed.h @@ -17,7 +17,7 @@ void dHiSpeedInit(void); void dHiSpeedSendData(UBYTE *OutputBuffer, UBYTE BytesToSend); -void dHiSpeedSetupUart(void); +void dHiSpeedSetupUart(UBYTE speed, UWORD mode); void dHiSpeedInitReceive(UBYTE *InputBuffer); void dHiSpeedReceivedData(UWORD *ByteCnt); void dHiSpeedExit(void); diff --git a/AT91SAM7S256/Source/d_hispeed.r b/AT91SAM7S256/Source/d_hispeed.r index 52d5e14..371b76d 100644 --- a/AT91SAM7S256/Source/d_hispeed.r +++ b/AT91SAM7S256/Source/d_hispeed.r @@ -27,7 +27,7 @@ #define PER_ID6_UART_0 0x40 #define UART0_INQ 0x40 -#define BAUD_RATE 921600L +#define BAUD_RATE 921600L #define SIZE_OF_INBUF 128 #define NO_OF_INBUFFERS 2 @@ -46,14 +46,13 @@ static UBYTE MsgIn; static UBYTE InBufOutCnt; #define HIGHSPEEDInit {\ - *AT91C_PIOA_PER = HIGHSPEED_TX_PIN | HIGHSPEED_RTS_PIN | HIGHSPEED_RX_PIN; /* Enable PIO on PA07, PA06 & PA05 */\ - *AT91C_PIOA_PPUDR = HIGHSPEED_RX_PIN | HIGHSPEED_TX_PIN | HIGHSPEED_RTS_PIN; /* Disable Pull-up resistor */\ + *AT91C_PIOA_PER = HIGHSPEED_TX_PIN | HIGHSPEED_RTS_PIN | HIGHSPEED_RX_PIN; /* Enable PIO on PA07, PA06 & PA05 */\ + *AT91C_PIOA_PPUDR = HIGHSPEED_RX_PIN | HIGHSPEED_TX_PIN | HIGHSPEED_RTS_PIN; /* Disable Pull-up resistor */\ *AT91C_PIOA_OER = HIGHSPEED_TX_PIN | HIGHSPEED_RTS_PIN | HIGHSPEED_RX_PIN; /* PA07 & PA06 set to Output */\ - *AT91C_PIOA_CODR = HIGHSPEED_TX_PIN | HIGHSPEED_RTS_PIN | HIGHSPEED_RX_PIN; /* Set output low */\ + *AT91C_PIOA_CODR = HIGHSPEED_TX_PIN | HIGHSPEED_RTS_PIN | HIGHSPEED_RX_PIN; /* Set output low */\ } - -#define HIGHSPEEDSetupUart {\ +#define HIGHSPEEDSetupUart(_baud, _mode) {\ UBYTE Tmp;\ InBufInPtr = 0;\ for(Tmp = 0; Tmp < NO_OF_INBUFFERS; Tmp++)\ @@ -66,18 +65,16 @@ static UBYTE InBufOutCnt; *AT91C_PIOA_ASR = HIGHSPEED_TX_PIN | HIGHSPEED_RTS_PIN | HIGHSPEED_RX_PIN;; /* Enable Per. A on PA5, PA6 & PA7 */\ *AT91C_US0_CR = AT91C_US_RSTSTA; /* Resets pins on UART0 */\ *AT91C_US0_CR = AT91C_US_STTTO; /* Start timeout functionality after 1 byte */\ - *AT91C_US0_RTOR = 2400; /* Approxitely 20 mS,x times bit time with 115200 bit pr s */\ + *AT91C_US0_RTOR = ((_baud)/400); /* Approxitely 20 mS,x times bit time with 115200 bit pr s */\ *AT91C_US0_IDR = AT91C_US_TIMEOUT; /* Disable interrupt on timeout */\ *AT91C_AIC_IDCR = UART0_INQ; /* Disable UART0 interrupt */\ *AT91C_AIC_ICCR = UART0_INQ; /* Clear interrupt register */\ *AT91C_US0_MR = AT91C_US_USMODE_RS485; /* Set UART to RUN RS485 Mode*/\ *AT91C_US0_MR &= ~AT91C_US_SYNC; /* Set UART in asynchronous mode */\ *AT91C_US0_MR |= AT91C_US_CLKS_CLOCK; /* Clock setup MCK*/\ - *AT91C_US0_MR |= AT91C_US_CHRL_8_BITS; /* UART using 8-bit */\ - *AT91C_US0_MR |= AT91C_US_PAR_NONE; /* UART using none parity bit */\ - *AT91C_US0_MR |= AT91C_US_NBSTOP_1_BIT; /* UART using 1 stop bit */\ - *AT91C_US0_MR |= AT91C_US_OVER; /* UART is using 8-bit sampling */\ - *AT91C_US0_BRGR = ((OSC/8/BAUD_RATE) | (((OSC/8) - ((OSC/8/BAUD_RATE) * BAUD_RATE)) / ((BAUD_RATE + 4)/8)) << 16);\ + *AT91C_US0_MR |= AT91C_US_OVER; /* UART is using over sampling mode */\ + *AT91C_US0_MR |= (_mode); /* default is 8n1 */\ + *AT91C_US0_BRGR = ((OSC/8/(_baud)) | (((OSC/8) - ((OSC/8/(_baud)) * (_baud))) / (((_baud) + 4)/8)) << 16);\ *AT91C_US0_PTCR = (AT91C_PDC_RXTDIS | AT91C_PDC_TXTDIS); /* Disable of TX & RX with DMA */\ *AT91C_US0_RCR = 0; /* Receive Counter Register */\ *AT91C_US0_TCR = 0; /* Transmit Counter Register */\ @@ -97,7 +94,7 @@ static UBYTE InBufOutCnt; #define HIGHSPEEDInitReceiver(InputBuffer)\ {\ - UBYTE Tmp;\ + UBYTE Tmp;\ pBuffer = InputBuffer;\ *AT91C_US0_PTCR = (AT91C_PDC_RXTDIS | AT91C_PDC_TXTDIS); /* Disable of TX & RX with DMA */\ *AT91C_US0_RCR = 0; /* Receive Counter Register */\ @@ -177,7 +174,7 @@ static UBYTE InBufOutCnt; #define HIGHSPEEDExit {\ *AT91C_PMC_PCDR = PER_ID6_UART_0; /* Disable PMC clock for UART 0*/\ *AT91C_PIOA_PER = HIGHSPEED_TX_PIN | HIGHSPEED_RTS_PIN | HIGHSPEED_RX_PIN; /* Enable PIO on PA07, PA06 & PA05 */\ - *AT91C_PIOA_PPUDR = HIGHSPEED_RX_PIN | HIGHSPEED_TX_PIN | HIGHSPEED_RTS_PIN; /* Disable Pull-up resistor */\ + *AT91C_PIOA_PPUDR = HIGHSPEED_RX_PIN | HIGHSPEED_TX_PIN | HIGHSPEED_RTS_PIN; /* Disable Pull-up resistor */\ *AT91C_PIOA_OER = HIGHSPEED_TX_PIN | HIGHSPEED_RTS_PIN | HIGHSPEED_RX_PIN; /* PA07 & PA06 set to Output */\ *AT91C_PIOA_CODR = HIGHSPEED_TX_PIN | HIGHSPEED_RTS_PIN | HIGHSPEED_RX_PIN; /* Set output low */\ } diff --git a/AT91SAM7S256/Source/d_input.h b/AT91SAM7S256/Source/d_input.h index d365dd1..3805103 100644 --- a/AT91SAM7S256/Source/d_input.h +++ b/AT91SAM7S256/Source/d_input.h @@ -45,4 +45,6 @@ void dInputClearColor100msTimer(UBYTE No); UBYTE dInputChkColor100msTimer(UBYTE No); + + #endif diff --git a/AT91SAM7S256/Source/d_input.r b/AT91SAM7S256/Source/d_input.r index 3dc567e..ffcac78 100644 --- a/AT91SAM7S256/Source/d_input.r +++ b/AT91SAM7S256/Source/d_input.r @@ -247,7 +247,7 @@ static ULONG ColorTimer[NO_OF_INPUTS]; {\ V = TRUE;\ } - + void rInputSingleADC(UBYTE Port, UWORD *Val) diff --git a/AT91SAM7S256/Source/d_loader.c b/AT91SAM7S256/Source/d_loader.c index a5ceb7d..86f428f 100644 --- a/AT91SAM7S256/Source/d_loader.c +++ b/AT91SAM7S256/Source/d_loader.c @@ -1,11 +1,11 @@ // // Date init 14.12.2004 // -// Revision date $Date:: 24-06-09 8:53 $ +// Revision date $Date:: 2-12-08 14:30 $ // // Filename $Workfile:: d_loader.c $ // -// Version $Revision:: 18 $ +// Version $Revision:: 16 $ // // Archive $Archive:: /LMS2006/Sys01/Main_V02/Firmware/Source/d_load $ // @@ -20,7 +20,7 @@ #include #include -#define FILEVERSION (0x0000010DL) +#define FILEVERSION (0x0000010CL) #define MAX_FILES ((FILETABLE_SIZE) - 1) /* Last file entry is used for file version*/ #define FILEVERSIONINDEX ((FILETABLE_SIZE) - 1) /* Last file entry is used for file version*/ @@ -219,9 +219,7 @@ UWORD dLoaderDeleteFilePtr(UWORD Handle) /* Update the HandleTable[].FileIndex */ for (LongCnt = 0; LongCnt < MAX_HANDLES; LongCnt++) { - - /* FileIndex must not be decremented for to the file to be deleted (when Handle = LongCnt)*/ - if ((HandleTable[Handle].FileIndex < HandleTable[LongCnt].FileIndex) && (FREE != HandleTable[LongCnt].Status)) + if ((HandleTable[Handle].FileIndex <= HandleTable[LongCnt].FileIndex) && (FREE != HandleTable[LongCnt].Status)) { (HandleTable[LongCnt].FileIndex)--; } @@ -655,6 +653,61 @@ UWORD dLoaderOpenRead(UBYTE *pFileName, ULONG *pLength) return(Handle); } +UWORD dLoaderSeek(UBYTE Handle, SLONG offset, UBYTE from) +{ + // move the ReadLength file pointer for this handle to the new offset + // and update pFlash appropriately + UWORD Status; + SLONG distFromStart; + const FILEHEADER *TmpHeader; + + Status = dLoaderCheckHandle(Handle, BUSY); + if (0x8000 > Status) + { + Status = Handle; + // calculate distance from start regardless of "from" + // and start from there going forward unless distance > current + // in which case start from current going forward + switch (from) { + case SEEK_FROMSTART: + distFromStart = offset; + break; + case SEEK_FROMCURRENT: + distFromStart = (SLONG)HandleTable[Handle].ReadLength + offset; + break; + case SEEK_FROMEND: + distFromStart = (SLONG)HandleTable[Handle].DataLength + offset; + break; + } + if (distFromStart != HandleTable[Handle].ReadLength) { + if ((distFromStart < 0) || (distFromStart > HandleTable[Handle].DataLength)) + return (Status | INVALIDSEEK); + if (distFromStart < HandleTable[Handle].ReadLength) { + // start from the beginning in this case + TmpHeader = (FILEHEADER const *)(FILEPTRTABLE[HandleTable[Handle].FileIndex]); + HandleTable[Handle].pFlash = (const UBYTE *)TmpHeader->FileStartAdr; + HandleTable[Handle].ReadLength = 0; + } + else + distFromStart -= HandleTable[Handle].ReadLength; // dist from current + // now move forward from the current location + while (distFromStart > 0) { + distFromStart--; + // move to next byte in the flash + HandleTable[Handle].pFlash++; + // update our file pointer + HandleTable[Handle].ReadLength++; + // if we reach a flash sector boundary then find the next sector pointer + if (!((ULONG)(HandleTable[Handle].pFlash) & (SECTORSIZE-1))) + { + HandleTable[Handle].pFlash = dLoaderGetNextSectorPtr(Handle); + } + } + } + } + return(Status); +} + UWORD dLoaderRead(UBYTE Handle, UBYTE *pBuffer, ULONG *pLength) { UWORD ByteCnt, Status; @@ -668,16 +721,21 @@ UWORD dLoaderRead(UBYTE Handle, UBYTE *pBuffer, ULONG *pLength) { if (HandleTable[Handle].DataLength <= HandleTable[Handle].ReadLength) { + // if the file pointer (ReadLength) is >= file size then return EOF *pLength = ByteCnt; Status |= ENDOFFILE; } else { + // copy a byte at a time from pFlash to pBuffer *pBuffer = *(HandleTable[Handle].pFlash); pBuffer++; ByteCnt++; + // move to next byte in the flash HandleTable[Handle].pFlash++; + // update our file pointer HandleTable[Handle].ReadLength++; + // if we reach a flash sector boundary then find the next sector pointer if (!((ULONG)(HandleTable[Handle].pFlash) & (SECTORSIZE-1))) { HandleTable[Handle].pFlash = dLoaderGetNextSectorPtr(Handle); diff --git a/AT91SAM7S256/Source/d_loader.h b/AT91SAM7S256/Source/d_loader.h index 4a12f12..2f564ba 100644 --- a/AT91SAM7S256/Source/d_loader.h +++ b/AT91SAM7S256/Source/d_loader.h @@ -1,11 +1,11 @@ // // Date init 14.12.2004 // -// Revision date $Date:: 24-06-09 12:15 $ +// Revision date $Date:: 3/21/09 10:03a $ // // Filename $Workfile:: d_loader.h $ // -// Version $Revision:: 18 $ +// Version $Revision:: 17 $ // // Archive $Archive:: /LMS2006/Sys01/Main_V02/Firmware/Source/d_load $ // @@ -18,7 +18,7 @@ #define FILETABLE_SIZE ((2 * SECTORSIZE)/4) #define STARTOFFILETABLE (0x140000L - (FILETABLE_SIZE*4)) #define FILEPTRTABLE ((const ULONG*)(0x140000L - (FILETABLE_SIZE*4))) -#define STARTOFUSERFLASH (0x122100L) +#define STARTOFUSERFLASH (0x125800L)//(0x124600L) #define SIZEOFUSERFLASH ((ULONG)STARTOFFILETABLE - STARTOFUSERFLASH) #define SIZEOFFLASH 262144L @@ -59,6 +59,14 @@ enum NONLINEAR = 0x08 }; +/* Enum related to seek operation */ +enum +{ + SEEK_FROMSTART, + SEEK_FROMCURRENT, + SEEK_FROMEND +}; + typedef struct { UBYTE FileName[FILENAME_SIZE]; @@ -77,6 +85,7 @@ UWORD dLoaderCreateFileHeader(ULONG FileSize, UBYTE *pName, UBYTE LinearStat UWORD dLoaderWriteData(UWORD Handle, UBYTE *pBuf, UWORD *pLen); UWORD dLoaderCloseHandle(UWORD Handle); UWORD dLoaderOpenRead(UBYTE *pFileName, ULONG *pLength); +UWORD dLoaderSeek(UBYTE Handle, SLONG offset, UBYTE from); UWORD dLoaderRead(UBYTE Handle, UBYTE *pBuf, ULONG *pLength); UWORD dLoaderDelete(UBYTE *pFile); UWORD dLoaderFind(UBYTE *pFind, UBYTE *pFound, ULONG *pFileLength, ULONG *pDataLength, UBYTE Session); diff --git a/AT91SAM7S256/Source/d_lowspeed.c b/AT91SAM7S256/Source/d_lowspeed.c index 91c1341..bb4f699 100644 --- a/AT91SAM7S256/Source/d_lowspeed.c +++ b/AT91SAM7S256/Source/d_lowspeed.c @@ -48,9 +48,9 @@ UBYTE dLowSpeedSendData(UBYTE ChannelNumber, UBYTE *DataOutBuffer, UBYTE NumberO return(Status); } -void dLowSpeedReceiveData(UBYTE ChannelNumber, UBYTE *DataInBuffer, UBYTE ByteToRx) +void dLowSpeedReceiveData(UBYTE ChannelNumber, UBYTE *DataInBuffer, UBYTE ByteToRx, UBYTE NoRestart) { - RxData(ChannelNumber, DataInBuffer, ByteToRx); + RxData(ChannelNumber, DataInBuffer, ByteToRx, NoRestart); } UBYTE dLowSpeedComTxStatus(UBYTE ChannelNumber) diff --git a/AT91SAM7S256/Source/d_lowspeed.h b/AT91SAM7S256/Source/d_lowspeed.h index 6ec62fd..3c916c3 100644 --- a/AT91SAM7S256/Source/d_lowspeed.h +++ b/AT91SAM7S256/Source/d_lowspeed.h @@ -20,7 +20,7 @@ void dLowSpeedStartTimer(void); void dLowSpeedStopTimer(void); void dLowSpeedInitPins(UBYTE ChannelNumber); UBYTE dLowSpeedSendData(UBYTE ChannelNumber, UBYTE *DataOutBuffer, UBYTE NumberOfTxByte); -void dLowSpeedReceiveData(UBYTE ChannelNumber, UBYTE *DataInBuffer, UBYTE ByteToRx); +void dLowSpeedReceiveData(UBYTE ChannelNumber, UBYTE *DataInBuffer, UBYTE ByteToRx, UBYTE NoRestart); UBYTE dLowSpeedComTxStatus(UBYTE ChannelNumber); UBYTE dLowSpeedComRxStatus(UBYTE ChannelNumber); void dLowSpeedExit(void); diff --git a/AT91SAM7S256/Source/d_lowspeed.r b/AT91SAM7S256/Source/d_lowspeed.r index 4b3b8ba..e215b3c 100644 --- a/AT91SAM7S256/Source/d_lowspeed.r +++ b/AT91SAM7S256/Source/d_lowspeed.r @@ -58,6 +58,10 @@ static LOWSPEEDPARAMETERS LowSpeedData[4]; ULONG DATA_PINS[4] = {CHANNEL_ONE_DATA, CHANNEL_TWO_DATA, CHANNEL_THREE_DATA, CHANNEL_FOUR_DATA}; ULONG CLK_PINS[4] = {CHANNEL_ONE_CLK, CHANNEL_TWO_CLK, CHANNEL_THREE_CLK, CHANNEL_FOUR_CLK}; +const ULONG CLK_OR_DATA_PINS[4] = {CHANNEL_ONE_CLK | CHANNEL_ONE_DATA, + CHANNEL_TWO_CLK | CHANNEL_TWO_DATA, + CHANNEL_THREE_CLK | CHANNEL_THREE_DATA, + CHANNEL_FOUR_CLK | CHANNEL_FOUR_DATA}; #define LOWSPEED_CHANNEL1 0 #define LOWSPEED_CHANNEL2 1 @@ -70,17 +74,17 @@ ULONG CLK_PINS[4] = {CHANNEL_ONE_CLK, CHANNEL_TWO_CLK, CHANNEL_THREE_CLK, CHANNE #define PIO_INQ 0x04 //Used for variable ChannelState -#define LOWSPEED_IDLE 0x00 -#define LOWSPEED_TX_STOP_BIT 0x01 +#define LOWSPEED_IDLE 0x00 +#define LOWSPEED_TX_STOP_BIT 0x01 #define LOWSPEED_TRANSMITTING 0x02 -#define LOWSPEED_RECEIVING 0x04 +#define LOWSPEED_RECEIVING 0x04 #define LOWSPEED_TEST_WAIT_STATE 0x08 #define LOWSPEED_RESTART_CONDITION 0x10 #define LOWSPEED_WAIT_BEFORE_RX 0x20 //Used for variable TxState -#define TX_IDLE 0x00 -#define TX_DATA_MORE_DATA 0x01 +#define TX_IDLE 0x00 +#define TX_DATA_MORE_DATA 0x01 #define TX_DATA_CLK_HIGH 0x02 #define TX_EVALUATE_ACK_CLK_HIGH 0x03 #define TX_DATA_READ_ACK_CLK_LOW 0x04 @@ -88,351 +92,174 @@ ULONG CLK_PINS[4] = {CHANNEL_ONE_CLK, CHANNEL_TWO_CLK, CHANNEL_THREE_CLK, CHANNE #define TX_ACK_EVALUATED_CLK_LOW 0x06 //Used for variable RxState -#define RX_IDLE 0x00 -#define RX_START_BIT_CLK_HIGH 0x01 +#define RX_IDLE 0x00 +#define RX_START_BIT_CLK_HIGH 0x01 #define RX_DATA_CLK_HIGH 0x02 #define RX_ACK_TX_CLK_HIGH 0x03 -#define RX_DATA_CLK_LOW 0x04 +#define RX_DATA_CLK_LOW 0x04 #define RX_DONE_OR_NOT_CLK_LOW 0x05 //Used for variable ReStart #define RESTART_STATE_IDLE 0x00 -#define RESTART_STATE_ONE 0x01 -#define RESTART_STATE_TWO 0x02 +#define RESTART_STATE_ONE 0x01 +#define RESTART_STATE_TWO 0x02 #define RESTART_STATE_THREE 0x03 #define RESTART_STATE_FOUR 0x04 #define RESTART_STATE_FIVE 0x05 #define RESTART_STATE_SIX 0x06 #define RESTART_STATE_SEVEN 0x07 -#define LOWSpeedTxInit {\ - LowSpeedData[LOWSPEED_CHANNEL1].ChannelState = 0;\ - LowSpeedData[LOWSPEED_CHANNEL2].ChannelState = 0;\ - LowSpeedData[LOWSPEED_CHANNEL3].ChannelState = 0;\ - LowSpeedData[LOWSPEED_CHANNEL4].ChannelState = 0;\ - } - -#define LOWSpeedTimerInit {\ - *AT91C_PMC_PCER = 0x400; /* Enable clock for PWM, PID10*/\ - *AT91C_PWMC_MR = 0x01; /* CLKA is output from prescaler */\ - *AT91C_PWMC_MR |= 0x600; /* Prescaler MCK divided with 64 */\ - *AT91C_PWMC_CH0_CMR = 0x06; /* Channel 0 uses MCK divided by 64 */\ - *AT91C_PWMC_CH0_CMR &= 0xFFFFFEFF; /* Left alignment on periode */\ - *AT91C_PWMC_CH0_CPRDR = 0x20; /* Set to 39 => 52uSecondes interrupt */\ - *AT91C_PWMC_IDR = AT91C_PWMC_CHID0; /* Disable interrupt for PWM output channel 0 */\ - *AT91C_AIC_IDCR = 0x400; /* Disable AIC intterupt on ID10 PWM */\ - AT91C_AIC_SVR[10] = (unsigned int)LowSpeedPwmIrqHandler;\ - AT91C_AIC_SMR[10] = 0x01; /* Enable trigger on level */\ - *AT91C_AIC_ICCR = 0x400; /* Clear interrupt register PID10*/\ - *AT91C_PWMC_IER = AT91C_PWMC_CHID0; /* Enable interrupt for PWM output channel 0 */\ - *AT91C_AIC_IECR = 0x400; /* Enable interrupt from PWM */\ - } - -#define LOWSpeedExit - -#define ENABLEDebugOutput {\ - *AT91C_PIOA_PER = AT91C_PIO_PA29; /* Enable PIO on PA029 */\ - *AT91C_PIOA_OER = AT91C_PIO_PA29; /* PA029 set to Output */\ - *AT91C_PIOA_CODR = 0x20000000;\ - } - -#define SETDebugOutputHigh *AT91C_PIOA_SODR = 0x20000000 - -#define SETDebugOutputLow *AT91C_PIOA_CODR = 0x20000000 - - -#define SETClkComOneHigh *AT91C_PIOA_SODR = CHANNEL_ONE_CLK - -#define SETClkComOneLow *AT91C_PIOA_CODR = CHANNEL_ONE_CLK - -#define GetClkComOnePinLevel *AT91C_PIOA_PDSR & CHANNEL_ONE_CLK - -#define SETClkComTwoHigh *AT91C_PIOA_SODR = CHANNEL_TWO_CLK - -#define SETClkComTwoLow *AT91C_PIOA_CODR = CHANNEL_TWO_CLK - -#define GetClkComTwoPinLevel *AT91C_PIOA_PDSR & CHANNEL_TWO_CLK - -#define SETClkComThreeHigh *AT91C_PIOA_SODR = CHANNEL_THREE_CLK - -#define SETClkComThreeLow *AT91C_PIOA_CODR = CHANNEL_THREE_CLK - -#define GetClkComThreePinLevel *AT91C_PIOA_PDSR & CHANNEL_THREE_CLK - -#define SETClkComFourHigh *AT91C_PIOA_SODR = CHANNEL_FOUR_CLK - -#define SETClkComFourLow *AT91C_PIOA_CODR = CHANNEL_FOUR_CLK - -#define GetClkComFourPinLevel *AT91C_PIOA_PDSR & CHANNEL_FOUR_CLK - - -#define SETDataComOneHigh *AT91C_PIOA_SODR = CHANNEL_ONE_DATA - -#define SETDataComOneLow *AT91C_PIOA_CODR = CHANNEL_ONE_DATA - -#define GetDataComOnePinLevel *AT91C_PIOA_PDSR & CHANNEL_ONE_DATA - -#define GETDataComOnePinDirection *AT91C_PIOA_OSR & CHANNEL_ONE_DATA - -#define SETDataComTwoHigh *AT91C_PIOA_SODR = CHANNEL_TWO_DATA - -#define SETDataComTwoLow *AT91C_PIOA_CODR = CHANNEL_TWO_DATA - -#define GetDataComTwoPinLevel *AT91C_PIOA_PDSR & CHANNEL_TWO_DATA - -#define GETDataComTwoPinDirection *AT91C_PIOA_OSR & CHANNEL_TWO_DATA +#define LOWSpeedTxInit {\ + LowSpeedData[LOWSPEED_CHANNEL1].ChannelState = 0;\ + LowSpeedData[LOWSPEED_CHANNEL2].ChannelState = 0;\ + LowSpeedData[LOWSPEED_CHANNEL3].ChannelState = 0;\ + LowSpeedData[LOWSPEED_CHANNEL4].ChannelState = 0;\ +} -#define SETDataComThreeHigh *AT91C_PIOA_SODR = CHANNEL_THREE_DATA +#define LOWSpeedTimerInit {\ + *AT91C_PMC_PCER = 0x400; /* Enable clock for PWM, PID10*/\ + *AT91C_PWMC_MR = 0x01; /* CLKA is output from prescaler */\ + *AT91C_PWMC_MR |= 0x600; /* Prescaler MCK divided with 64 */\ + *AT91C_PWMC_CH0_CMR = 0x06; /* Channel 0 uses MCK divided by 64 */\ + *AT91C_PWMC_CH0_CMR &= 0xFFFFFEFF; /* Left alignment on periode */\ + *AT91C_PWMC_CH0_CPRDR = 0x20; /* Set to 39 => 52uSecondes interrupt */\ + *AT91C_PWMC_IDR = AT91C_PWMC_CHID0; /* Disable interrupt for PWM output channel 0 */\ + *AT91C_AIC_IDCR = 0x400; /* Disable AIC intterupt on ID10 PWM */\ + AT91C_AIC_SVR[10] = (unsigned int)LowSpeedPwmIrqHandler;\ + AT91C_AIC_SMR[10] = 0x01; /* Enable trigger on level */\ + *AT91C_AIC_ICCR = 0x400; /* Clear interrupt register PID10*/\ + *AT91C_PWMC_IER = AT91C_PWMC_CHID0; /* Enable interrupt for PWM output channel 0 */\ + *AT91C_AIC_IECR = 0x400; /* Enable interrupt from PWM */\ +} -#define SETDataComThreeLow *AT91C_PIOA_CODR = CHANNEL_THREE_DATA +#define LOWSpeedExit -#define GetDataComThreePinLevel *AT91C_PIOA_PDSR & CHANNEL_THREE_DATA +#define ENABLEDebugOutput {\ + *AT91C_PIOA_PER = AT91C_PIO_PA29; /* Enable PIO on PA029 */\ + *AT91C_PIOA_OER = AT91C_PIO_PA29; /* PA029 set to Output */\ + *AT91C_PIOA_CODR = 0x20000000;\ +} -#define GETDataComThreePinDirection *AT91C_PIOA_OSR & CHANNEL_THREE_DATA +#define SETDebugOutputHigh *AT91C_PIOA_SODR = 0x20000000 +#define SETDebugOutputLow *AT91C_PIOA_CODR = 0x20000000 -#define SETDataComFourHigh *AT91C_PIOA_SODR = CHANNEL_FOUR_DATA +#define SETClkComOneHigh *AT91C_PIOA_SODR = CHANNEL_ONE_CLK +#define SETClkComOneLow *AT91C_PIOA_CODR = CHANNEL_ONE_CLK +#define GetClkComOnePinLevel *AT91C_PIOA_PDSR & CHANNEL_ONE_CLK -#define SETDataComFourLow *AT91C_PIOA_CODR = CHANNEL_FOUR_DATA +#define SETClkComTwoHigh *AT91C_PIOA_SODR = CHANNEL_TWO_CLK +#define SETClkComTwoLow *AT91C_PIOA_CODR = CHANNEL_TWO_CLK +#define GetClkComTwoPinLevel *AT91C_PIOA_PDSR & CHANNEL_TWO_CLK -#define GetDataComFourPinLevel *AT91C_PIOA_PDSR & CHANNEL_FOUR_DATA +#define SETClkComThreeHigh *AT91C_PIOA_SODR = CHANNEL_THREE_CLK +#define SETClkComThreeLow *AT91C_PIOA_CODR = CHANNEL_THREE_CLK +#define GetClkComThreePinLevel *AT91C_PIOA_PDSR & CHANNEL_THREE_CLK -#define GETDataComFourPinDirection *AT91C_PIOA_OSR & CHANNEL_FOUR_DATA +#define SETClkComFourHigh *AT91C_PIOA_SODR = CHANNEL_FOUR_CLK +#define SETClkComFourLow *AT91C_PIOA_CODR = CHANNEL_FOUR_CLK +#define GetClkComFourPinLevel *AT91C_PIOA_PDSR & CHANNEL_FOUR_CLK -#define SETDataComOneToInput *AT91C_PIOA_ODR = CHANNEL_ONE_DATA; +#define SETDataComOneHigh *AT91C_PIOA_SODR = CHANNEL_ONE_DATA +#define SETDataComOneLow *AT91C_PIOA_CODR = CHANNEL_ONE_DATA +#define GetDataComOnePinLevel *AT91C_PIOA_PDSR & CHANNEL_ONE_DATA +#define GETDataComOnePinDirection *AT91C_PIOA_OSR & CHANNEL_ONE_DATA -#define SETDataComOneToOutput *AT91C_PIOA_OER = CHANNEL_ONE_DATA; +#define SETDataComTwoHigh *AT91C_PIOA_SODR = CHANNEL_TWO_DATA +#define SETDataComTwoLow *AT91C_PIOA_CODR = CHANNEL_TWO_DATA +#define GetDataComTwoPinLevel *AT91C_PIOA_PDSR & CHANNEL_TWO_DATA +#define GETDataComTwoPinDirection *AT91C_PIOA_OSR & CHANNEL_TWO_DATA -#define SETDataComTwoToInput *AT91C_PIOA_ODR = CHANNEL_TWO_DATA; +#define SETDataComThreeHigh *AT91C_PIOA_SODR = CHANNEL_THREE_DATA +#define SETDataComThreeLow *AT91C_PIOA_CODR = CHANNEL_THREE_DATA +#define GetDataComThreePinLevel *AT91C_PIOA_PDSR & CHANNEL_THREE_DATA +#define GETDataComThreePinDirection *AT91C_PIOA_OSR & CHANNEL_THREE_DATA -#define SETDataComTwoToOutput *AT91C_PIOA_OER = CHANNEL_TWO_DATA; +#define SETDataComFourHigh *AT91C_PIOA_SODR = CHANNEL_FOUR_DATA +#define SETDataComFourLow *AT91C_PIOA_CODR = CHANNEL_FOUR_DATA +#define GetDataComFourPinLevel *AT91C_PIOA_PDSR & CHANNEL_FOUR_DATA +#define GETDataComFourPinDirection *AT91C_PIOA_OSR & CHANNEL_FOUR_DATA -#define SETDataComThreeToInput *AT91C_PIOA_ODR = CHANNEL_THREE_DATA; +#define SETDataComOneToInput *AT91C_PIOA_ODR = CHANNEL_ONE_DATA; +#define SETDataComOneToOutput *AT91C_PIOA_OER = CHANNEL_ONE_DATA; -#define SETDataComThreeToOutput *AT91C_PIOA_OER = CHANNEL_THREE_DATA; +#define SETDataComTwoToInput *AT91C_PIOA_ODR = CHANNEL_TWO_DATA; +#define SETDataComTwoToOutput *AT91C_PIOA_OER = CHANNEL_TWO_DATA; -#define SETDataComFourToInput *AT91C_PIOA_ODR = CHANNEL_FOUR_DATA; +#define SETDataComThreeToInput *AT91C_PIOA_ODR = CHANNEL_THREE_DATA; +#define SETDataComThreeToOutput *AT91C_PIOA_OER = CHANNEL_THREE_DATA; -#define SETDataComFourToOutput *AT91C_PIOA_OER = CHANNEL_FOUR_DATA; +#define SETDataComFourToInput *AT91C_PIOA_ODR = CHANNEL_FOUR_DATA; +#define SETDataComFourToOutput *AT91C_PIOA_OER = CHANNEL_FOUR_DATA; -#define DISABLEPullupDataComOne *AT91C_PIOA_PPUDR = CHANNEL_ONE_DATA; +#define DISABLEPullupDataComOne *AT91C_PIOA_PPUDR = CHANNEL_ONE_DATA; +#define DISABLEPullupClkComOne *AT91C_PIOA_PPUDR = CHANNEL_ONE_CLK; -#define DISABLEPullupClkComOne *AT91C_PIOA_PPUDR = CHANNEL_ONE_CLK; +#define DISABLEPullupDataComTwo *AT91C_PIOA_PPUDR = CHANNEL_TWO_DATA; +#define DISABLEPullupClkComTwo *AT91C_PIOA_PPUDR = CHANNEL_TWO_CLK; -#define DISABLEPullupDataComTwo *AT91C_PIOA_PPUDR = CHANNEL_TWO_DATA; +#define DISABLEPullupDataComThree *AT91C_PIOA_PPUDR = CHANNEL_THREE_DATA; +#define DISABLEPullupClkComThree *AT91C_PIOA_PPUDR = CHANNEL_THREE_CLK; -#define DISABLEPullupClkComTwo *AT91C_PIOA_PPUDR = CHANNEL_TWO_CLK; +#define DISABLEPullupDataComFour *AT91C_PIOA_PPUDR = CHANNEL_FOUR_DATA; +#define DISABLEPullupClkComFour *AT91C_PIOA_PPUDR = CHANNEL_FOUR_CLK; -#define DISABLEPullupDataComThree *AT91C_PIOA_PPUDR = CHANNEL_THREE_DATA; +#define ENABLEPullupDataComOne *AT91C_PIOA_PPUER = CHANNEL_ONE_DATA; +#define ENABLEPullupClkComOne *AT91C_PIOA_PPUER = CHANNEL_ONE_CLK; -#define DISABLEPullupClkComThree *AT91C_PIOA_PPUDR = CHANNEL_THREE_CLK; +#define ENABLEPullupDataComTwo *AT91C_PIOA_PPUER = CHANNEL_TWO_DATA; +#define ENABLEPullupClkComTwo *AT91C_PIOA_PPUER = CHANNEL_TWO_CLK; -#define DISABLEPullupDataComFour *AT91C_PIOA_PPUDR = CHANNEL_FOUR_DATA; +#define ENABLEPullupDataComThree *AT91C_PIOA_PPUER = CHANNEL_THREE_DATA; +#define ENABLEPullupClkComThree *AT91C_PIOA_PPUER = CHANNEL_THREE_CLK; -#define DISABLEPullupClkComFour *AT91C_PIOA_PPUDR = CHANNEL_FOUR_CLK; +#define ENABLEPullupDataComFour *AT91C_PIOA_PPUER = CHANNEL_FOUR_DATA; +#define ENABLEPullupClkComFour *AT91C_PIOA_PPUER = CHANNEL_FOUR_CLK; -#define ENABLEPullupDataComOne *AT91C_PIOA_PPUER = CHANNEL_ONE_DATA; +#define SETClkLow(ChannelNr) {\ + *AT91C_PIOA_CODR = CLK_PINS[ChannelNr];\ + LowSpeedData[ChannelNr].ClkStatus = 0;\ +} -#define ENABLEPullupClkComOne *AT91C_PIOA_PPUER = CHANNEL_ONE_CLK; +#define SETClkHigh(ChannelNr) {\ + *AT91C_PIOA_SODR = CLK_PINS[ChannelNr];\ + LowSpeedData[ChannelNr].ClkStatus = 1;\ +} -#define ENABLEPullupDataComTwo *AT91C_PIOA_PPUER = CHANNEL_TWO_DATA; +#define SETDataLow(ChannelNr) {\ + *AT91C_PIOA_CODR = DATA_PINS[ChannelNr];\ +} -#define ENABLEPullupClkComTwo *AT91C_PIOA_PPUER = CHANNEL_TWO_CLK; +#define SETDataHigh(ChannelNr) {\ + *AT91C_PIOA_SODR = DATA_PINS[ChannelNr];\ +} -#define ENABLEPullupDataComThree *AT91C_PIOA_PPUER = CHANNEL_THREE_DATA; +#define SETDataToInput(ChannelNr) {\ + *AT91C_PIOA_ODR = DATA_PINS[ChannelNr];\ +} -#define ENABLEPullupClkComThree *AT91C_PIOA_PPUER = CHANNEL_THREE_CLK; +#define SETDataToOutput(ChannelNr) {\ + *AT91C_PIOA_OER = DATA_PINS[ChannelNr];\ +} -#define ENABLEPullupDataComFour *AT91C_PIOA_PPUER = CHANNEL_FOUR_DATA; +#define GetClkPinLevel(ChannelNr) (*AT91C_PIOA_PDSR & CLK_PINS[ChannelNr]) +#define GetDataPinLevel(ChannelNr) (*AT91C_PIOA_PDSR & DATA_PINS[ChannelNr]) +#define GETDataPinDirection(ChannelNr) (*AT91C_PIOA_OSR & DATA_PINS[ChannelNr]) -#define ENABLEPullupClkComFour *AT91C_PIOA_PPUER = CHANNEL_FOUR_CLK; +#define ENABLEPWMTimerForLowCom {\ + *AT91C_PWMC_ENA = AT91C_PWMC_CHID0; /* Enable PWM output channel 0 */\ +} -#define SETClkLow(ChannelNr) {\ - if (ChannelNr == 0)\ - {\ - SETClkComOneLow;\ - }\ - else\ - {\ - if (ChannelNr == 1)\ - {\ - SETClkComTwoLow;\ - }\ - else\ - {\ - if (ChannelNr == 2)\ - {\ - SETClkComThreeLow;\ - }\ - else\ - {\ - if (ChannelNr == 3)\ - {\ - SETClkComFourLow;\ - }\ - }\ - }\ - }\ - LowSpeedData[ChannelNr].ClkStatus = 0;\ - } - -#define SETClkHigh(ChannelNr) {\ - if (ChannelNr == 0)\ - {\ - SETClkComOneHigh;\ - }\ - else\ - {\ - if (ChannelNr == 1)\ - {\ - SETClkComTwoHigh;\ - }\ - else\ - {\ - if (ChannelNr == 2)\ - {\ - SETClkComThreeHigh;\ - }\ - else\ - {\ - if (ChannelNr == 3)\ - {\ - SETClkComFourHigh;\ - }\ - }\ - }\ - }\ - LowSpeedData[ChannelNr].ClkStatus = 1;\ - } - -#define SETDataLow(ChannelNr) {\ - if (ChannelNr == 0)\ - {\ - SETDataComOneLow;\ - }\ - else\ - {\ - if (ChannelNr == 1)\ - {\ - SETDataComTwoLow;\ - }\ - else\ - {\ - if (ChannelNr == 2)\ - {\ - SETDataComThreeLow;\ - }\ - else\ - {\ - if (ChannelNr == 3)\ - {\ - SETDataComFourLow;\ - }\ - }\ - }\ - }\ - } - -#define SETDataHigh(ChannelNr) {\ - if (ChannelNr == 0)\ - {\ - SETDataComOneHigh;\ - }\ - else\ - {\ - if (ChannelNr == 1)\ - {\ - SETDataComTwoHigh;\ - }\ - else\ - {\ - if (ChannelNr == 2)\ - {\ - SETDataComThreeHigh;\ - }\ - else\ - {\ - if (ChannelNr == 3)\ - {\ - SETDataComFourHigh;\ - }\ - }\ - }\ - }\ - } - -#define SETDataToInput(ChannelNr) {\ - if (ChannelNr == 0)\ - {\ - SETDataComOneToInput;\ - }\ - else\ - {\ - if (ChannelNr == 1)\ - {\ - SETDataComTwoToInput;\ - }\ - else\ - {\ - if (ChannelNr == 2)\ - {\ - SETDataComThreeToInput;\ - }\ - else\ - {\ - if (ChannelNr == 3)\ - {\ - SETDataComFourToInput;\ - }\ - }\ - }\ - }\ - } - - -#define SETDataToOutput(ChannelNr) {\ - if (ChannelNr == 0)\ - {\ - SETDataComOneToOutput;\ - }\ - else\ - {\ - if (ChannelNr == 1)\ - {\ - SETDataComTwoToOutput;\ - }\ - else\ - {\ - if (ChannelNr == 2)\ - {\ - SETDataComThreeToOutput;\ - }\ - else\ - {\ - if (ChannelNr == 3)\ - {\ - SETDataComFourToOutput;\ - }\ - }\ - }\ - }\ - } - - -#define ENABLEPWMTimerForLowCom {\ - *AT91C_PWMC_ENA = AT91C_PWMC_CHID0; /* Enable PWM output channel 0 */\ - } - -#define DISABLEPWMTimerForLowCom {\ - *AT91C_PWMC_DIS = AT91C_PWMC_CHID0; /* Disable PWM output channel 0 */\ - } +#define DISABLEPWMTimerForLowCom {\ + *AT91C_PWMC_DIS = AT91C_PWMC_CHID0; /* Disable PWM output channel 0 */\ +} -#define OLD_DISABLEPWMTimerForLowCom {\ - *AT91C_PWMC_DIS = AT91C_PWMC_CHID0; /* Disable PWM output channel 0 */\ - *AT91C_PWMC_IDR = AT91C_PWMC_CHID0; /* Disable interrupt from PWM output channel 0 */\ - *AT91C_AIC_IDCR = 0x400; /* Disable Irq from PID10 */\ - *AT91C_AIC_ICCR = 0x400; /* Clear interrupt register PID10*/\ - *AT91C_PMC_PCDR = 0x400; /* Disable clock for PWM, PID10*/\ - } +#define OLD_DISABLEPWMTimerForLowCom {\ + *AT91C_PWMC_DIS = AT91C_PWMC_CHID0; /* Disable PWM output channel 0 */\ + *AT91C_PWMC_IDR = AT91C_PWMC_CHID0; /* Disable interrupt from PWM output channel 0 */\ + *AT91C_AIC_IDCR = 0x400; /* Disable Irq from PID10 */\ + *AT91C_AIC_ICCR = 0x400; /* Clear interrupt register PID10*/\ + *AT91C_PMC_PCDR = 0x400; /* Disable clock for PWM, PID10*/\ +} __ramfunc void LowSpeedPwmIrqHandler(void) { @@ -625,11 +452,11 @@ __ramfunc void LowSpeedPwmIrqHandler(void) LowSpeedData[ChannelNr].ReStartBit = 0; LowSpeedData[ChannelNr].pComOutBuffer = &LowSpeedData[ChannelNr].ComDeviceAddress; *LowSpeedData[ChannelNr].pComOutBuffer += 0x01; - LowSpeedData[ChannelNr].ChannelState = LOWSPEED_TRANSMITTING; - LowSpeedData[ChannelNr].MaskBit = MASK_BIT_8; - LowSpeedData[ChannelNr].TxByteCnt = 0x01; - LowSpeedData[ChannelNr].TxState = TX_DATA_CLK_HIGH; - LowSpeedData[ChannelNr].AckStatus = 0; + LowSpeedData[ChannelNr].ChannelState = LOWSPEED_TRANSMITTING; + LowSpeedData[ChannelNr].MaskBit = MASK_BIT_8; + LowSpeedData[ChannelNr].TxByteCnt = 0x01; + LowSpeedData[ChannelNr].TxState = TX_DATA_CLK_HIGH; + LowSpeedData[ChannelNr].AckStatus = 0; } break; } @@ -687,9 +514,9 @@ __ramfunc void LowSpeedPwmIrqHandler(void) SETClkLow(ChannelNr); SETDataToInput(ChannelNr); LowSpeedData[ChannelNr].pComInBuffer++; - LowSpeedData[ChannelNr].RxByteCnt--; - LowSpeedData[ChannelNr].RxBitCnt = 0; - LowSpeedData[ChannelNr].RxState = RX_DONE_OR_NOT_CLK_LOW; + LowSpeedData[ChannelNr].RxByteCnt--; + LowSpeedData[ChannelNr].RxBitCnt = 0; + LowSpeedData[ChannelNr].RxState = RX_DONE_OR_NOT_CLK_LOW; } break; @@ -744,205 +571,109 @@ __ramfunc void LowSpeedPwmIrqHandler(void) } -#define ENABLETxPins(ChannelNumber) {\ - if (ChannelNumber == LOWSPEED_CHANNEL1)\ - {\ - *AT91C_PIOA_PER = CHANNEL_ONE_CLK | CHANNEL_ONE_DATA; /* Enable PIO on PA20 & PA28 */\ - *AT91C_PIOA_PPUDR = CHANNEL_ONE_CLK | CHANNEL_ONE_DATA; /* Disable Pull-up resistor */\ - *AT91C_PIOA_ODR = CHANNEL_ONE_CLK | CHANNEL_ONE_DATA; /* PA20 & PA28 set to Input */\ - }\ - if (ChannelNumber == LOWSPEED_CHANNEL2)\ - {\ - *AT91C_PIOA_PER = CHANNEL_TWO_CLK | CHANNEL_TWO_DATA; /* Enable PIO on PA20 & PA28 */\ - *AT91C_PIOA_PPUDR = CHANNEL_TWO_CLK | CHANNEL_TWO_DATA; /* Disable Pull-up resistor */\ - *AT91C_PIOA_ODR = CHANNEL_TWO_CLK | CHANNEL_TWO_DATA; /* PA20 & PA28 set to Input */\ - }\ - if (ChannelNumber == LOWSPEED_CHANNEL3)\ - {\ - *AT91C_PIOA_PER = CHANNEL_THREE_CLK | CHANNEL_THREE_DATA; /* */\ - *AT91C_PIOA_PPUDR = CHANNEL_THREE_CLK | CHANNEL_THREE_DATA; /* */\ - *AT91C_PIOA_ODR = CHANNEL_THREE_CLK | CHANNEL_THREE_DATA; /* */\ - }\ - if (ChannelNumber == LOWSPEED_CHANNEL4)\ - {\ - *AT91C_PIOA_PER = CHANNEL_FOUR_CLK | CHANNEL_FOUR_DATA; /* */\ - *AT91C_PIOA_PPUDR = CHANNEL_FOUR_CLK | CHANNEL_FOUR_DATA; /* */\ - *AT91C_PIOA_ODR = CHANNEL_FOUR_CLK | CHANNEL_FOUR_DATA; /* */\ - }\ - } +#define ENABLETxPins(ChannelNumber) {\ + *AT91C_PIOA_PER = CLK_OR_DATA_PINS[ChannelNumber]; /* Enable PIO on PA20 & PA28 */\ + *AT91C_PIOA_PPUDR = CLK_OR_DATA_PINS[ChannelNumber]; /* Disable Pull-up resistor */\ + *AT91C_PIOA_ODR = CLK_OR_DATA_PINS[ChannelNumber]; /* PA20 & PA28 set to Input */\ +} #define TxData(ChannelNumber, Status, DataOutBuffer, NumberOfByte) {\ - if (ChannelNumber == LOWSPEED_CHANNEL1)\ - {\ - if ((GetDataComOnePinLevel && GetClkComOnePinLevel) && (LowSpeedData[LOWSPEED_CHANNEL1].ChannelState == LOWSPEED_IDLE))\ - {\ - *AT91C_PIOA_PER = CHANNEL_ONE_CLK | CHANNEL_ONE_DATA; /* Enable PIO on PA20 & PA28 */\ - *AT91C_PIOA_OER = CHANNEL_ONE_CLK | CHANNEL_ONE_DATA; /* PA20 & PA28 set to Output */\ - *AT91C_PIOA_PPUDR = CHANNEL_ONE_CLK | CHANNEL_ONE_DATA; /* Disable Pull-up resistor */\ - SETClkComOneHigh;\ - SETDataComOneLow;\ - LowSpeedData[LOWSPEED_CHANNEL1].ClkStatus = 1;\ - LowSpeedData[LOWSPEED_CHANNEL1].pComOutBuffer = DataOutBuffer;\ - LowSpeedData[LOWSPEED_CHANNEL1].ComDeviceAddress = *LowSpeedData[LOWSPEED_CHANNEL1].pComOutBuffer;\ - LowSpeedData[LOWSPEED_CHANNEL1].MaskBit = MASK_BIT_8;\ - LowSpeedData[LOWSPEED_CHANNEL1].TxByteCnt = NumberOfByte;\ - LowSpeedData[LOWSPEED_CHANNEL1].TxState = TX_DATA_CLK_HIGH;\ - LowSpeedData[LOWSPEED_CHANNEL1].AckStatus = 0;\ - LowSpeedData[LOWSPEED_CHANNEL1].ChannelState = LOWSPEED_TRANSMITTING;\ - Status = 1;\ - }\ - else\ - {\ - Status = 0;\ - }\ - }\ - if (ChannelNumber == LOWSPEED_CHANNEL2)\ - {\ - if ((GetDataComTwoPinLevel && GetClkComTwoPinLevel) && (LowSpeedData[LOWSPEED_CHANNEL2].ChannelState == LOWSPEED_IDLE))\ - {\ - *AT91C_PIOA_PER = CHANNEL_TWO_CLK | CHANNEL_TWO_DATA; /* Enable PIO on PA20 & PA28 */\ - *AT91C_PIOA_OER = CHANNEL_TWO_CLK | CHANNEL_TWO_DATA; /* PA20 & PA28 set to Output */\ - *AT91C_PIOA_PPUDR = CHANNEL_TWO_CLK | CHANNEL_TWO_DATA; /* Disable Pull-up resistor */\ - SETClkComTwoHigh;\ - SETDataComTwoLow;\ - LowSpeedData[LOWSPEED_CHANNEL2].ClkStatus = 1;\ - LowSpeedData[LOWSPEED_CHANNEL2].pComOutBuffer = DataOutBuffer;\ - LowSpeedData[LOWSPEED_CHANNEL2].ComDeviceAddress = *LowSpeedData[LOWSPEED_CHANNEL2].pComOutBuffer;\ - LowSpeedData[LOWSPEED_CHANNEL2].MaskBit = MASK_BIT_8;\ - LowSpeedData[LOWSPEED_CHANNEL2].TxByteCnt = NumberOfByte;\ - LowSpeedData[LOWSPEED_CHANNEL2].TxState = TX_DATA_CLK_HIGH;\ - LowSpeedData[LOWSPEED_CHANNEL2].AckStatus = 0;\ - LowSpeedData[LOWSPEED_CHANNEL2].ChannelState = LOWSPEED_TRANSMITTING;\ - Status = 1;\ - }\ - else\ - {\ - Status = 0;\ - }\ - }\ - if (ChannelNumber == LOWSPEED_CHANNEL3)\ - {\ - if ((GetDataComThreePinLevel && GetClkComThreePinLevel) && (LowSpeedData[LOWSPEED_CHANNEL3].ChannelState == LOWSPEED_IDLE))\ - {\ - *AT91C_PIOA_PER = CHANNEL_THREE_CLK | CHANNEL_THREE_DATA; /* */\ - *AT91C_PIOA_OER = CHANNEL_THREE_CLK | CHANNEL_THREE_DATA; /* */\ - *AT91C_PIOA_PPUDR = CHANNEL_THREE_CLK | CHANNEL_THREE_DATA; /* */\ - SETClkComThreeHigh;\ - SETDataComThreeLow;\ - LowSpeedData[LOWSPEED_CHANNEL3].ClkStatus = 1;\ - LowSpeedData[LOWSPEED_CHANNEL3].pComOutBuffer = DataOutBuffer;\ - LowSpeedData[LOWSPEED_CHANNEL3].ComDeviceAddress = *LowSpeedData[LOWSPEED_CHANNEL3].pComOutBuffer;\ - LowSpeedData[LOWSPEED_CHANNEL3].MaskBit = MASK_BIT_8;\ - LowSpeedData[LOWSPEED_CHANNEL3].TxByteCnt = NumberOfByte;\ - LowSpeedData[LOWSPEED_CHANNEL3].TxState = TX_DATA_CLK_HIGH;\ - LowSpeedData[LOWSPEED_CHANNEL3].AckStatus = 0;\ - LowSpeedData[LOWSPEED_CHANNEL3].ChannelState = LOWSPEED_TRANSMITTING;\ - Status = 1;\ - }\ - else\ - {\ - Status = 0;\ - }\ - }\ - if (ChannelNumber == LOWSPEED_CHANNEL4)\ - {\ - if ((GetDataComFourPinLevel && GetClkComFourPinLevel) && (LowSpeedData[LOWSPEED_CHANNEL4].ChannelState == LOWSPEED_IDLE))\ - {\ - *AT91C_PIOA_PER = CHANNEL_FOUR_CLK | CHANNEL_FOUR_DATA; /* */\ - *AT91C_PIOA_OER = CHANNEL_FOUR_CLK | CHANNEL_FOUR_DATA; /* */\ - *AT91C_PIOA_PPUDR = CHANNEL_FOUR_CLK | CHANNEL_FOUR_DATA; /* */\ - SETClkComFourHigh;\ - SETDataComFourLow;\ - LowSpeedData[LOWSPEED_CHANNEL4].ClkStatus = 1;\ - LowSpeedData[LOWSPEED_CHANNEL4].pComOutBuffer = DataOutBuffer;\ - LowSpeedData[LOWSPEED_CHANNEL4].ComDeviceAddress = *LowSpeedData[LOWSPEED_CHANNEL4].pComOutBuffer;\ - LowSpeedData[LOWSPEED_CHANNEL4].MaskBit = MASK_BIT_8;\ - LowSpeedData[LOWSPEED_CHANNEL4].TxByteCnt = NumberOfByte;\ - LowSpeedData[LOWSPEED_CHANNEL4].TxState = TX_DATA_CLK_HIGH;\ - LowSpeedData[LOWSPEED_CHANNEL4].AckStatus = 0;\ - LowSpeedData[LOWSPEED_CHANNEL4].ChannelState = LOWSPEED_TRANSMITTING;\ - Status = 1;\ - }\ - else\ - {\ - Status = 0;\ - }\ - }\ - } - -#define RxData(ChannelNumber, DataInBuffer, RxBytes) {\ - LowSpeedData[ChannelNumber].pComInBuffer = DataInBuffer;\ - LowSpeedData[ChannelNumber].RxBitCnt = 0;\ - LowSpeedData[ChannelNumber].RxByteCnt = RxBytes;\ - LowSpeedData[ChannelNumber].RxState = RX_DATA_CLK_LOW;\ - LowSpeedData[ChannelNumber].ReStartBit = 1;\ - LowSpeedData[ChannelNumber].RxWaitCnt = 0;\ - } + if ((GetDataPinLevel(ChannelNumber) && GetClkPinLevel(ChannelNumber)) && (LowSpeedData[ChannelNumber].ChannelState == LOWSPEED_IDLE))\ + {\ + *AT91C_PIOA_PER = CLK_OR_DATA_PINS[ChannelNumber]; /* Enable PIO on PA20 & PA28 */\ + *AT91C_PIOA_OER = CLK_OR_DATA_PINS[ChannelNumber]; /* PA20 & PA28 set to Output */\ + *AT91C_PIOA_PPUDR = CLK_OR_DATA_PINS[ChannelNumber]; /* Disable Pull-up resistor */\ + SETClkHigh(ChannelNumber);\ + SETDataLow(ChannelNumber);\ + LowSpeedData[ChannelNumber].ClkStatus = 1;\ + LowSpeedData[ChannelNumber].pComOutBuffer = DataOutBuffer;\ + LowSpeedData[ChannelNumber].ComDeviceAddress = *LowSpeedData[ChannelNumber].pComOutBuffer;\ + LowSpeedData[ChannelNumber].MaskBit = MASK_BIT_8;\ + LowSpeedData[ChannelNumber].TxByteCnt = NumberOfByte;\ + LowSpeedData[ChannelNumber].TxState = TX_DATA_CLK_HIGH;\ + LowSpeedData[ChannelNumber].AckStatus = 0;\ + LowSpeedData[ChannelNumber].ChannelState = LOWSPEED_TRANSMITTING;\ + Status = 1;\ + }\ + else\ + {\ + Status = 0;\ + }\ +} + +#define RxData(ChannelNumber, DataInBuffer, RxBytes, NoRestart) {\ + LowSpeedData[ChannelNumber].pComInBuffer = DataInBuffer;\ + LowSpeedData[ChannelNumber].RxBitCnt = 0;\ + LowSpeedData[ChannelNumber].RxByteCnt = RxBytes;\ + LowSpeedData[ChannelNumber].RxState = RX_DATA_CLK_LOW;\ + LowSpeedData[ChannelNumber].ReStartBit = (1 - (NoRestart & (1< 25 mS interval -#define REGULATION_TIME 100 // Measured in 1 mS => 100 mS regulation interval - #define RAMPDOWN_STATE_RAMPDOWN 0 #define RAMPDOWN_STATE_CONTINIUE 1 #define COAST_MOTOR_MODE 0 +#define OPTION_HOLDATLIMIT 0x10 +#define OPTION_RAMPDOWNTOLIMIT 0x20 + void dOutputRampDownSynch(UBYTE MotorNr); typedef struct @@ -64,6 +64,10 @@ typedef struct SLONG MotorRampTachoCountOld; // Used to hold old position during Ramp-Up SLONG MotorRampTachoCountStart; // Used to hold position when Ramp-up started SLONG RotationCaptureCount; // Counter for additional rotation counter + UBYTE RunStateAtLimit; // what run state to switch to when tacho limit is reached + UBYTE RampDownToLimit; + UBYTE Spare2; + UBYTE Spare3; }MOTORDATA; typedef struct @@ -77,6 +81,8 @@ typedef struct static MOTORDATA MotorData[3]; static SYNCMOTORDATA SyncData; +static UBYTE RegTime; + void dOutputInit(void) { UBYTE Temp; @@ -85,30 +91,35 @@ void dOutputInit(void) ENABLECaptureMotorA; ENABLECaptureMotorB; ENABLECaptureMotorC; + + RegTime = REGULATION_TIME; for (Temp = 0; Temp < 3; Temp++) { - MotorData[Temp].MotorSetSpeed = 0; - MotorData[Temp].MotorTargetSpeed = 0; - MotorData[Temp].MotorActualSpeed = 0; - MotorData[Temp].MotorRampUpCount = 0; - MotorData[Temp].MotorRampDownCount = 0; - MotorData[Temp].MotorRunState = 0; - MotorData[Temp].MotorTachoCountToRun = 0; - MotorData[Temp].MotorRunForever = 1; - MotorData[Temp].AccError = 0; - MotorData[Temp].RegulationTimeCount = 0; - MotorData[Temp].RegPParameter = DEFAULT_P_GAIN_FACTOR; - MotorData[Temp].RegIParameter = DEFAULT_I_GAIN_FACTOR; - MotorData[Temp].RegDParameter = DEFAULT_D_GAIN_FACTOR; - MotorData[Temp].RegulationMode = 0; - MotorData[Temp].MotorOverloaded = 0; + MOTORDATA * pMD = &(MotorData[Temp]); + pMD->MotorSetSpeed = 0; + pMD->MotorTargetSpeed = 0; + pMD->MotorActualSpeed = 0; + pMD->MotorRampUpCount = 0; + pMD->MotorRampDownCount = 0; + pMD->MotorRunState = 0; + pMD->MotorTachoCountToRun = 0; + pMD->MotorRunForever = 1; + pMD->AccError = 0; + pMD->RegulationTimeCount = 0; + pMD->RegPParameter = DEFAULT_P_GAIN_FACTOR; + pMD->RegIParameter = DEFAULT_I_GAIN_FACTOR; + pMD->RegDParameter = DEFAULT_D_GAIN_FACTOR; + pMD->RegulationMode = 0; + pMD->MotorOverloaded = 0; + pMD->RunStateAtLimit = MOTOR_RUN_STATE_IDLE; + pMD->RampDownToLimit = 0; INSERTMode(Temp, COAST_MOTOR_MODE); - INSERTSpeed(Temp, MotorData[Temp].MotorSetSpeed); + INSERTSpeed(Temp, pMD->MotorSetSpeed); } } -/* This function is called every 1 mS and will go through all the motors and there dependencies */ +/* This function is called every 1 mS and will go through all the motors and their dependencies */ /* Actual motor speed is only passed (updated) to the AVR controller form this function */ /* DeltacaptureCount used to count number of Tachocount within last 100 mS. Used with position control regulation */ /* CurrentCaptureCount used to tell total current position. Used to tell when movement has been obtained */ @@ -123,43 +134,43 @@ void dOutputCtrl(void) for (MotorNr = 0; MotorNr < 3; MotorNr++) { - MotorData[MotorNr].DeltaCaptureCount += NewTachoCount[MotorNr]; - MotorData[MotorNr].CurrentCaptureCount += NewTachoCount[MotorNr]; - MotorData[MotorNr].MotorBlockTachoCount += NewTachoCount[MotorNr]; - MotorData[MotorNr].RotationCaptureCount += NewTachoCount[MotorNr]; - MotorData[MotorNr].RegulationTimeCount++; + MOTORDATA * pMD = &(MotorData[MotorNr]); + pMD->DeltaCaptureCount += NewTachoCount[MotorNr]; + pMD->CurrentCaptureCount += NewTachoCount[MotorNr]; + pMD->MotorBlockTachoCount += NewTachoCount[MotorNr]; + pMD->RotationCaptureCount += NewTachoCount[MotorNr]; + pMD->RegulationTimeCount++; - if (MotorData[MotorNr].MotorRunState == MOTOR_RUN_STATE_RAMPUP) + if (pMD->MotorRunState == MOTOR_RUN_STATE_RAMPUP) { dOutputRampUpFunction(MotorNr); } - if (MotorData[MotorNr].MotorRunState == MOTOR_RUN_STATE_RAMPDOWN) + if (pMD->MotorRunState == MOTOR_RUN_STATE_RAMPDOWN) { dOutputRampDownFunction(MotorNr); } - if (MotorData[MotorNr].MotorRunState == MOTOR_RUN_STATE_RUNNING) + if (pMD->MotorRunState == MOTOR_RUN_STATE_RUNNING) { dOutputTachoLimitControl(MotorNr); } - if (MotorData[MotorNr].MotorRunState == MOTOR_RUN_STATE_IDLE) + if (pMD->MotorRunState == MOTOR_RUN_STATE_IDLE) { dOutputMotorIdleControl(MotorNr); } - if (MotorData[MotorNr].MotorRunState == MOTOR_RUN_STATE_HOLD) + if (pMD->MotorRunState == MOTOR_RUN_STATE_HOLD) { - MotorData[MotorNr].MotorSetSpeed = 0; - MotorData[MotorNr].MotorActualSpeed = 0; - MotorData[MotorNr].MotorTargetSpeed = 0; - MotorData[MotorNr].RegulationTimeCount = 0; - MotorData[MotorNr].DeltaCaptureCount = 0; - MotorData[MotorNr].MotorRunState = MOTOR_RUN_STATE_RUNNING; - + pMD->MotorSetSpeed = 0; + pMD->MotorActualSpeed = 0; + pMD->MotorTargetSpeed = 0; + pMD->RegulationTimeCount = 0; + pMD->DeltaCaptureCount = 0; +// pMD->MotorRunState = MOTOR_RUN_STATE_RUNNING; } - if (MotorData[MotorNr].RegulationTimeCount > REGULATION_TIME) + if (pMD->RegulationTimeCount > RegTime) { - MotorData[MotorNr].RegulationTimeCount = 0; + pMD->RegulationTimeCount = 0; dOutputRegulateMotor(MotorNr); - MotorData[MotorNr].DeltaCaptureCount = 0; + pMD->DeltaCaptureCount = 0; } } INSERTSpeed(MOTOR_A, MotorData[MOTOR_A].MotorActualSpeed); @@ -180,12 +191,13 @@ void dOutputGetMotorParameters(UBYTE *CurrentMotorSpeed, SLONG *TachoCount, SLON for (Tmp = 0; Tmp < 3; Tmp++) { - CurrentMotorSpeed[Tmp] = MotorData[Tmp].MotorActualSpeed; - TachoCount[Tmp] = MotorData[Tmp].CurrentCaptureCount; - BlockTachoCount[Tmp] = MotorData[Tmp].MotorBlockTachoCount; - RotationCount[Tmp] = MotorData[Tmp].RotationCaptureCount; - RunState[Tmp] = MotorData[Tmp].MotorRunState; - MotorOverloaded[Tmp] = MotorData[Tmp].MotorOverloaded; + MOTORDATA * pMD = &(MotorData[Tmp]); + CurrentMotorSpeed[Tmp] = pMD->MotorActualSpeed; + TachoCount[Tmp] = pMD->CurrentCaptureCount; + BlockTachoCount[Tmp] = pMD->MotorBlockTachoCount; + RotationCount[Tmp] = pMD->RotationCaptureCount; + RunState[Tmp] = pMD->MotorRunState; + MotorOverloaded[Tmp] = pMD->MotorOverloaded; } } @@ -199,17 +211,18 @@ void dOutputSetMode(UBYTE Motor, UBYTE Mode) //Set motor mode (break, Float) /* AccError & OldPositionError used for position regulation and Sync Parameter are used for synchronization regulation */ void dOutputEnableRegulation(UBYTE MotorNr, UBYTE RegulationMode) { - MotorData[MotorNr].RegulationMode = RegulationMode; + MOTORDATA * pMD = &(MotorData[MotorNr]); + pMD->RegulationMode = RegulationMode; - if ((MotorData[MotorNr].RegulationMode & REGSTATE_REGULATED) && (MotorData[MotorNr].MotorSetSpeed == 0) && (MotorData[MotorNr].MotorRunState != MOTOR_RUN_STATE_RAMPDOWN)) + if ((pMD->RegulationMode & REGSTATE_REGULATED) && (pMD->MotorSetSpeed == 0) && (pMD->MotorRunState != MOTOR_RUN_STATE_RAMPDOWN)) { - MotorData[MotorNr].AccError = 0; - MotorData[MotorNr].OldPositionError = 0; + pMD->AccError = 0; + pMD->OldPositionError = 0; } - if (MotorData[MotorNr].RegulationMode & REGSTATE_SYNCHRONE) + if (pMD->RegulationMode & REGSTATE_SYNCHRONE) { - if (((MotorData[MotorNr].MotorActualSpeed == 0) || (MotorData[MotorNr].TurnParameter != 0) || (MotorData[MotorNr].TurnParameter == 0)) && (MotorData[MotorNr].MotorRunState != MOTOR_RUN_STATE_RAMPDOWN)) + if (((pMD->MotorActualSpeed == 0) || (pMD->TurnParameter != 0) || (pMD->TurnParameter == 0)) && (pMD->MotorRunState != MOTOR_RUN_STATE_RAMPDOWN)) { SyncData.SyncTachoDif = 0; @@ -230,17 +243,18 @@ void dOutputDisableRegulation(UBYTE MotorNr) /* Calling this function will reset current movement of the motor if it is running */ void dOutputResetTachoLimit(UBYTE MotorNr) { - MotorData[MotorNr].CurrentCaptureCount = 0; - MotorData[MotorNr].MotorTachoCountToRun = 0; + MOTORDATA * pMD = &(MotorData[MotorNr]); + pMD->CurrentCaptureCount = 0; + pMD->MotorTachoCountToRun = 0; - if (MotorData[MotorNr].RegulationMode & REGSTATE_SYNCHRONE) + if (pMD->RegulationMode & REGSTATE_SYNCHRONE) { dOutputResetSyncMotors(MotorNr); } - if (MotorData[MotorNr].MotorRunForever == 1) + if (pMD->MotorRunForever == 1) { - MotorData[MotorNr].MotorRunForever = 0; // To ensure that we get the same functionality for all combination on motor durations + pMD->MotorRunForever = 0; // To ensure that we get the same functionality for all combination on motor durations } } @@ -259,46 +273,52 @@ void dOutputResetRotationCaptureCount(UBYTE MotorNr) } /* Can be used to set new PID values */ -void dOutputSetPIDParameters(UBYTE Motor, UBYTE NewRegPParameter, UBYTE NewRegIParameter, UBYTE NewRegDParameter) +void dOutputSetPIDParameters(UBYTE MotorNr, UBYTE NewRegPParameter, UBYTE NewRegIParameter, UBYTE NewRegDParameter) { - MotorData[Motor].RegPParameter = NewRegPParameter; - MotorData[Motor].RegIParameter = NewRegIParameter; - MotorData[Motor].RegDParameter = NewRegDParameter; + MOTORDATA * pMD = &(MotorData[MotorNr]); + pMD->RegPParameter = NewRegPParameter; + pMD->RegIParameter = NewRegIParameter; + pMD->RegDParameter = NewRegDParameter; } /* Called to set TachoCountToRun which is used for position control for the model */ /* Must be called before motor start */ /* TachoCountToRun is calculated as a signed value */ -void dOutputSetTachoLimit(UBYTE MotorNr, ULONG BlockTachoCntToTravel) +void dOutputSetTachoLimit(UBYTE MotorNr, ULONG BlockTachoCntToTravel, UBYTE Options) { + MOTORDATA * pMD = &(MotorData[MotorNr]); if (BlockTachoCntToTravel == 0) { - MotorData[MotorNr].MotorRunForever = 1; + pMD->MotorRunForever = 1; + pMD->RunStateAtLimit = MOTOR_RUN_STATE_IDLE; + pMD->RampDownToLimit = 0; } else { - MotorData[MotorNr].MotorRunForever = 0; + pMD->MotorRunForever = 0; + pMD->RunStateAtLimit = (Options & OPTION_HOLDATLIMIT) ? MOTOR_RUN_STATE_HOLD : MOTOR_RUN_STATE_IDLE; + pMD->RampDownToLimit = Options & OPTION_RAMPDOWNTOLIMIT; - if (MotorData[MotorNr].MotorSetSpeed == 0) + if (pMD->MotorSetSpeed == 0) { - if (MotorData[MotorNr].MotorTargetSpeed > 0) + if (pMD->MotorTargetSpeed > 0) { - MotorData[MotorNr].MotorTachoCountToRun += BlockTachoCntToTravel; + pMD->MotorTachoCountToRun += BlockTachoCntToTravel; } else { - MotorData[MotorNr].MotorTachoCountToRun -= BlockTachoCntToTravel; + pMD->MotorTachoCountToRun -= BlockTachoCntToTravel; } } else { - if (MotorData[MotorNr].MotorSetSpeed > 0) + if (pMD->MotorSetSpeed > 0) { - MotorData[MotorNr].MotorTachoCountToRun += BlockTachoCntToTravel; + pMD->MotorTachoCountToRun += BlockTachoCntToTravel; } else { - MotorData[MotorNr].MotorTachoCountToRun -= BlockTachoCntToTravel; + pMD->MotorTachoCountToRun -= BlockTachoCntToTravel; } } } @@ -307,67 +327,69 @@ void dOutputSetTachoLimit(UBYTE MotorNr, ULONG BlockTachoCntToTravel) /* This function is used for setting up the motor mode and motor speed */ void dOutputSetSpeed (UBYTE MotorNr, UBYTE NewMotorRunState, SBYTE Speed, SBYTE NewTurnParameter) { - if ((MotorData[MotorNr].MotorSetSpeed != Speed) || (MotorData[MotorNr].MotorRunState != NewMotorRunState) || (NewMotorRunState == MOTOR_RUN_STATE_IDLE) || (MotorData[MotorNr].TurnParameter != NewTurnParameter)) + MOTORDATA * pMD = &(MotorData[MotorNr]); + if ((pMD->MotorSetSpeed != Speed) || (pMD->MotorRunState != NewMotorRunState) || + (NewMotorRunState == MOTOR_RUN_STATE_IDLE) || (pMD->TurnParameter != NewTurnParameter)) { - if (MotorData[MotorNr].MotorTargetSpeed == 0) + if (pMD->MotorTargetSpeed == 0) { - MotorData[MotorNr].AccError = 0; - MotorData[MotorNr].OldPositionError = 0; - MotorData[MotorNr].RegulationTimeCount = 0; - MotorData[MotorNr].DeltaCaptureCount = 0; + pMD->AccError = 0; + pMD->OldPositionError = 0; + pMD->RegulationTimeCount = 0; + pMD->DeltaCaptureCount = 0; TACHOCountReset(MotorNr); } switch (NewMotorRunState) { case MOTOR_RUN_STATE_IDLE: { - //MotorData[MotorNr].MotorSetSpeed = 0; - //MotorData[MotorNr].MotorTargetSpeed = 0; - //MotorData[MotorNr].TurnParameter = 0; - MotorData[MotorNr].RegulationMode = REGSTATE_IDLE; + //pMD->MotorSetSpeed = 0; + //pMD->MotorTargetSpeed = 0; + //pMD->TurnParameter = 0; + pMD->RegulationMode = REGSTATE_IDLE; } break; case MOTOR_RUN_STATE_RAMPUP: { - if (MotorData[MotorNr].MotorSetSpeed == 0) + if (pMD->MotorSetSpeed == 0) { - MotorData[MotorNr].MotorSetSpeed = Speed; - MotorData[MotorNr].TurnParameter = NewTurnParameter; - MotorData[MotorNr].MotorRampUpIncrement = 0; - MotorData[MotorNr].MotorRampTachoCountStart = MotorData[MotorNr].CurrentCaptureCount; - MotorData[MotorNr].MotorRampUpCount = 0; + pMD->MotorSetSpeed = Speed; + pMD->TurnParameter = NewTurnParameter; + pMD->MotorRampUpIncrement = 0; + pMD->MotorRampTachoCountStart = pMD->CurrentCaptureCount; + pMD->MotorRampUpCount = 0; } else { if (Speed > 0) { - if (MotorData[MotorNr].MotorSetSpeed >= Speed) + if (pMD->MotorSetSpeed >= Speed) { NewMotorRunState = MOTOR_RUN_STATE_RUNNING; } else { - MotorData[MotorNr].MotorSetSpeed = Speed; - MotorData[MotorNr].TurnParameter = NewTurnParameter; - MotorData[MotorNr].MotorRampUpIncrement = 0; - MotorData[MotorNr].MotorRampTachoCountStart = MotorData[MotorNr].CurrentCaptureCount; - MotorData[MotorNr].MotorRampUpCount = 0; + pMD->MotorSetSpeed = Speed; + pMD->TurnParameter = NewTurnParameter; + pMD->MotorRampUpIncrement = 0; + pMD->MotorRampTachoCountStart = pMD->CurrentCaptureCount; + pMD->MotorRampUpCount = 0; } } else { - if (MotorData[MotorNr].MotorSetSpeed <= Speed) + if (pMD->MotorSetSpeed <= Speed) { NewMotorRunState = MOTOR_RUN_STATE_RUNNING; } else { - MotorData[MotorNr].MotorSetSpeed = Speed; - MotorData[MotorNr].TurnParameter = NewTurnParameter; - MotorData[MotorNr].MotorRampUpIncrement = 0; - MotorData[MotorNr].MotorRampTachoCountStart = MotorData[MotorNr].CurrentCaptureCount; - MotorData[MotorNr].MotorRampUpCount = 0; + pMD->MotorSetSpeed = Speed; + pMD->TurnParameter = NewTurnParameter; + pMD->MotorRampUpIncrement = 0; + pMD->MotorRampTachoCountStart = pMD->CurrentCaptureCount; + pMD->MotorRampUpCount = 0; } } } @@ -376,11 +398,11 @@ void dOutputSetSpeed (UBYTE MotorNr, UBYTE NewMotorRunState, SBYTE Speed, SBYTE case MOTOR_RUN_STATE_RUNNING: { - MotorData[MotorNr].MotorSetSpeed = Speed; - MotorData[MotorNr].MotorTargetSpeed = Speed; - MotorData[MotorNr].TurnParameter = NewTurnParameter; + pMD->MotorSetSpeed = Speed; + pMD->MotorTargetSpeed = Speed; + pMD->TurnParameter = NewTurnParameter; - if (MotorData[MotorNr].MotorSetSpeed == 0) + if (pMD->MotorSetSpeed == 0) { NewMotorRunState = MOTOR_RUN_STATE_HOLD; } @@ -389,41 +411,41 @@ void dOutputSetSpeed (UBYTE MotorNr, UBYTE NewMotorRunState, SBYTE Speed, SBYTE case MOTOR_RUN_STATE_RAMPDOWN: { - if (MotorData[MotorNr].MotorTargetSpeed >= 0) + if (pMD->MotorTargetSpeed >= 0) { - if (MotorData[MotorNr].MotorSetSpeed <= Speed) + if (pMD->MotorSetSpeed <= Speed) { NewMotorRunState = MOTOR_RUN_STATE_RUNNING; } else { - MotorData[MotorNr].MotorSetSpeed = Speed; - MotorData[MotorNr].TurnParameter = NewTurnParameter; - MotorData[MotorNr].MotorRampDownIncrement = 0; - MotorData[MotorNr].MotorRampTachoCountStart = MotorData[MotorNr].CurrentCaptureCount; - MotorData[MotorNr].MotorRampDownCount = 0; + pMD->MotorSetSpeed = Speed; + pMD->TurnParameter = NewTurnParameter; + pMD->MotorRampDownIncrement = 0; + pMD->MotorRampTachoCountStart = pMD->CurrentCaptureCount; + pMD->MotorRampDownCount = 0; } } else { - if (MotorData[MotorNr].MotorSetSpeed >= Speed) + if (pMD->MotorSetSpeed >= Speed) { NewMotorRunState = MOTOR_RUN_STATE_RUNNING; } else { - MotorData[MotorNr].MotorSetSpeed = Speed; - MotorData[MotorNr].TurnParameter = NewTurnParameter; - MotorData[MotorNr].MotorRampDownIncrement = 0; - MotorData[MotorNr].MotorRampTachoCountStart = MotorData[MotorNr].CurrentCaptureCount; - MotorData[MotorNr].MotorRampDownCount = 0; + pMD->MotorSetSpeed = Speed; + pMD->TurnParameter = NewTurnParameter; + pMD->MotorRampDownIncrement = 0; + pMD->MotorRampTachoCountStart = pMD->CurrentCaptureCount; + pMD->MotorRampDownCount = 0; } } } break; } - MotorData[MotorNr].MotorRunState = NewMotorRunState; - MotorData[MotorNr].MotorOverloaded = 0; + pMD->MotorRunState = NewMotorRunState; + pMD->MotorOverloaded = 0; } } @@ -431,107 +453,109 @@ void dOutputSetSpeed (UBYTE MotorNr, UBYTE NewMotorRunState, SBYTE Speed, SBYTE /* Ramp-up is done with 1 increment in speed every X number of TachoCount, where X depend on duration of the periode and the wanted speed */ void dOutputRampUpFunction(UBYTE MotorNr) { - if (MotorData[MotorNr].MotorTargetSpeed == 0) + MOTORDATA * pMD = &(MotorData[MotorNr]); + if (pMD->MotorTargetSpeed == 0) { - if (MotorData[MotorNr].MotorSetSpeed > 0) + if (pMD->MotorSetSpeed > 0) { - MotorData[MotorNr].MotorTargetSpeed = MIN_MOVEMENT_POWER; + pMD->MotorTargetSpeed = MIN_MOVEMENT_POWER; } else { - MotorData[MotorNr].MotorTargetSpeed = -MIN_MOVEMENT_POWER; + pMD->MotorTargetSpeed = -MIN_MOVEMENT_POWER; } } else { - if (MotorData[MotorNr].MotorRampUpIncrement == 0) + if (pMD->MotorRampUpIncrement == 0) { - if (MotorData[MotorNr].MotorSetSpeed > 0) + SWORD delta = (SWORD)((pMD->MotorTachoCountToRun - pMD->MotorRampTachoCountStart) / (pMD->MotorSetSpeed - pMD->MotorTargetSpeed)); + if (pMD->MotorSetSpeed > 0) { - MotorData[MotorNr].MotorRampUpIncrement = (SWORD)((MotorData[MotorNr].MotorTachoCountToRun - MotorData[MotorNr].MotorRampTachoCountStart) / (MotorData[MotorNr].MotorSetSpeed - MotorData[MotorNr].MotorTargetSpeed)); + pMD->MotorRampUpIncrement = delta; } else { - MotorData[MotorNr].MotorRampUpIncrement = (SWORD)(-((MotorData[MotorNr].MotorTachoCountToRun - MotorData[MotorNr].MotorRampTachoCountStart) / (MotorData[MotorNr].MotorSetSpeed - MotorData[MotorNr].MotorTargetSpeed))); + pMD->MotorRampUpIncrement = -delta; } - MotorData[MotorNr].MotorRampTachoCountOld = MotorData[MotorNr].CurrentCaptureCount; + pMD->MotorRampTachoCountOld = pMD->CurrentCaptureCount; } - if (MotorData[MotorNr].MotorSetSpeed > 0) + if (pMD->MotorSetSpeed > 0) { - if (MotorData[MotorNr].CurrentCaptureCount > (MotorData[MotorNr].MotorRampTachoCountOld + MotorData[MotorNr].MotorRampUpIncrement)) + if (pMD->CurrentCaptureCount > (pMD->MotorRampTachoCountOld + pMD->MotorRampUpIncrement)) { - MotorData[MotorNr].MotorTargetSpeed += 1; - MotorData[MotorNr].MotorRampTachoCountOld = MotorData[MotorNr].CurrentCaptureCount; - MotorData[MotorNr].MotorRampUpCount = 0; + pMD->MotorTargetSpeed++; + pMD->MotorRampTachoCountOld = pMD->CurrentCaptureCount; + pMD->MotorRampUpCount = 0; } else { - if (!(MotorData[MotorNr].RegulationMode & REGSTATE_REGULATED)) + if (!(pMD->RegulationMode & REGSTATE_REGULATED)) { - MotorData[MotorNr].MotorRampUpCount++; - if (MotorData[MotorNr].MotorRampUpCount > 100) + pMD->MotorRampUpCount++; + if (pMD->MotorRampUpCount > RegTime) { - MotorData[MotorNr].MotorRampUpCount = 0; - MotorData[MotorNr].MotorTargetSpeed++; + pMD->MotorRampUpCount = 0; + pMD->MotorTargetSpeed++; } } } } else { - if (MotorData[MotorNr].CurrentCaptureCount < (MotorData[MotorNr].MotorRampTachoCountOld + MotorData[MotorNr].MotorRampUpIncrement)) + if (pMD->CurrentCaptureCount < (pMD->MotorRampTachoCountOld + pMD->MotorRampUpIncrement)) { - MotorData[MotorNr].MotorTargetSpeed -= 1; - MotorData[MotorNr].MotorRampTachoCountOld = MotorData[MotorNr].CurrentCaptureCount; - MotorData[MotorNr].MotorRampUpCount = 0; + pMD->MotorTargetSpeed--; + pMD->MotorRampTachoCountOld = pMD->CurrentCaptureCount; + pMD->MotorRampUpCount = 0; } else { - if (!(MotorData[MotorNr].RegulationMode & REGSTATE_REGULATED)) + if (!(pMD->RegulationMode & REGSTATE_REGULATED)) { - MotorData[MotorNr].MotorRampUpCount++; - if (MotorData[MotorNr].MotorRampUpCount > 100) + pMD->MotorRampUpCount++; + if (pMD->MotorRampUpCount > RegTime) { - MotorData[MotorNr].MotorRampUpCount = 0; - MotorData[MotorNr].MotorTargetSpeed--; + pMD->MotorRampUpCount = 0; + pMD->MotorTargetSpeed--; } } } } } - if (MotorData[MotorNr].MotorSetSpeed > 0) + if (pMD->MotorSetSpeed > 0) { - if ((MotorData[MotorNr].CurrentCaptureCount - MotorData[MotorNr].MotorRampTachoCountStart) >= (MotorData[MotorNr].MotorTachoCountToRun - MotorData[MotorNr].MotorRampTachoCountStart)) + if ((pMD->CurrentCaptureCount - pMD->MotorRampTachoCountStart) >= (pMD->MotorTachoCountToRun - pMD->MotorRampTachoCountStart)) { - MotorData[MotorNr].MotorTargetSpeed = MotorData[MotorNr].MotorSetSpeed; - MotorData[MotorNr].MotorRunState = MOTOR_RUN_STATE_IDLE; + pMD->MotorTargetSpeed = pMD->MotorSetSpeed; + pMD->MotorRunState = pMD->RunStateAtLimit; } } else { - if ((MotorData[MotorNr].CurrentCaptureCount + MotorData[MotorNr].MotorRampTachoCountStart) <= (MotorData[MotorNr].MotorTachoCountToRun + MotorData[MotorNr].MotorRampTachoCountStart)) + if ((pMD->CurrentCaptureCount + pMD->MotorRampTachoCountStart) <= (pMD->MotorTachoCountToRun + pMD->MotorRampTachoCountStart)) { - MotorData[MotorNr].MotorTargetSpeed = MotorData[MotorNr].MotorSetSpeed; - MotorData[MotorNr].MotorRunState = MOTOR_RUN_STATE_IDLE; + pMD->MotorTargetSpeed = pMD->MotorSetSpeed; + pMD->MotorRunState = pMD->RunStateAtLimit; } } - if (MotorData[MotorNr].MotorSetSpeed > 0) + if (pMD->MotorSetSpeed > 0) { - if (MotorData[MotorNr].MotorTargetSpeed > MotorData[MotorNr].MotorSetSpeed) + if (pMD->MotorTargetSpeed > pMD->MotorSetSpeed) { - MotorData[MotorNr].MotorTargetSpeed = MotorData[MotorNr].MotorSetSpeed; + pMD->MotorTargetSpeed = pMD->MotorSetSpeed; } } else { - if (MotorData[MotorNr].MotorTargetSpeed < MotorData[MotorNr].MotorSetSpeed) + if (pMD->MotorTargetSpeed < pMD->MotorSetSpeed) { - MotorData[MotorNr].MotorTargetSpeed = MotorData[MotorNr].MotorSetSpeed; + pMD->MotorTargetSpeed = pMD->MotorSetSpeed; } } - if (MotorData[MotorNr].RegulationMode == REGSTATE_IDLE) + if (pMD->RegulationMode == REGSTATE_IDLE) { - MotorData[MotorNr].MotorActualSpeed = MotorData[MotorNr].MotorTargetSpeed; + pMD->MotorActualSpeed = pMD->MotorTargetSpeed; } } @@ -539,142 +563,169 @@ void dOutputRampUpFunction(UBYTE MotorNr) /* Ramp-down is done with 1 decrement in speed every X number of TachoCount, where X depend on duration of the periode and the wanted speed */ void dOutputRampDownFunction(UBYTE MotorNr) { - if (MotorData[MotorNr].MotorRampDownIncrement == 0) + MOTORDATA * pMD = &(MotorData[MotorNr]); + if (pMD->MotorRampDownIncrement == 0) { - if (MotorData[MotorNr].MotorTargetSpeed > 0) + if (pMD->MotorTargetSpeed > 0) { - if ((MotorData[MotorNr].MotorTargetSpeed > MIN_MOVEMENT_POWER) && (MotorData[MotorNr].MotorSetSpeed == 0)) + if ((pMD->MotorTargetSpeed > MIN_MOVEMENT_POWER) && (pMD->MotorSetSpeed == 0)) { - MotorData[MotorNr].MotorRampDownIncrement = ((MotorData[MotorNr].MotorTachoCountToRun - MotorData[MotorNr].CurrentCaptureCount) / ((MotorData[MotorNr].MotorTargetSpeed - MotorData[MotorNr].MotorSetSpeed) - MIN_MOVEMENT_POWER)); + pMD->MotorRampDownIncrement = ((pMD->MotorTachoCountToRun - pMD->CurrentCaptureCount) / ((pMD->MotorTargetSpeed - pMD->MotorSetSpeed) - MIN_MOVEMENT_POWER)); } else { - MotorData[MotorNr].MotorRampDownIncrement = ((MotorData[MotorNr].MotorTachoCountToRun - MotorData[MotorNr].CurrentCaptureCount) / (MotorData[MotorNr].MotorTargetSpeed - MotorData[MotorNr].MotorSetSpeed)); + pMD->MotorRampDownIncrement = ((pMD->MotorTachoCountToRun - pMD->CurrentCaptureCount) / (pMD->MotorTargetSpeed - pMD->MotorSetSpeed)); } } else { - if ((MotorData[MotorNr].MotorTargetSpeed < -MIN_MOVEMENT_POWER) && (MotorData[MotorNr].MotorSetSpeed == 0)) + if ((pMD->MotorTargetSpeed < -MIN_MOVEMENT_POWER) && (pMD->MotorSetSpeed == 0)) { - MotorData[MotorNr].MotorRampDownIncrement = (-((MotorData[MotorNr].MotorTachoCountToRun - MotorData[MotorNr].CurrentCaptureCount) / ((MotorData[MotorNr].MotorTargetSpeed - MotorData[MotorNr].MotorSetSpeed) + MIN_MOVEMENT_POWER))); + pMD->MotorRampDownIncrement = (-((pMD->MotorTachoCountToRun - pMD->CurrentCaptureCount) / ((pMD->MotorTargetSpeed - pMD->MotorSetSpeed) + MIN_MOVEMENT_POWER))); } else { - MotorData[MotorNr].MotorRampDownIncrement = (-((MotorData[MotorNr].MotorTachoCountToRun - MotorData[MotorNr].CurrentCaptureCount) / (MotorData[MotorNr].MotorTargetSpeed - MotorData[MotorNr].MotorSetSpeed))); + pMD->MotorRampDownIncrement = (-((pMD->MotorTachoCountToRun - pMD->CurrentCaptureCount) / (pMD->MotorTargetSpeed - pMD->MotorSetSpeed))); } } - MotorData[MotorNr].MotorRampTachoCountOld = MotorData[MotorNr].CurrentCaptureCount; + pMD->MotorRampTachoCountOld = pMD->CurrentCaptureCount; } - if (MotorData[MotorNr].MotorTargetSpeed > 0) + if (pMD->MotorTargetSpeed > 0) { - if (MotorData[MotorNr].CurrentCaptureCount > (MotorData[MotorNr].MotorRampTachoCountOld + (SLONG)MotorData[MotorNr].MotorRampDownIncrement)) + if (pMD->CurrentCaptureCount > (pMD->MotorRampTachoCountOld + (SLONG)pMD->MotorRampDownIncrement)) { - MotorData[MotorNr].MotorTargetSpeed--; - if (MotorData[MotorNr].MotorTargetSpeed < MIN_MOVEMENT_POWER) + pMD->MotorTargetSpeed--; + if (pMD->MotorTargetSpeed < MIN_MOVEMENT_POWER) { - MotorData[MotorNr].MotorTargetSpeed = MIN_MOVEMENT_POWER; + pMD->MotorTargetSpeed = MIN_MOVEMENT_POWER; } - MotorData[MotorNr].MotorRampTachoCountOld = MotorData[MotorNr].CurrentCaptureCount; - MotorData[MotorNr].MotorRampDownCount = 0; + pMD->MotorRampTachoCountOld = pMD->CurrentCaptureCount; + pMD->MotorRampDownCount = 0; dOutputRampDownSynch(MotorNr); } else { - if (!(MotorData[MotorNr].RegulationMode & REGSTATE_REGULATED)) + if (!(pMD->RegulationMode & REGSTATE_REGULATED)) { - MotorData[MotorNr].MotorRampDownCount++; - if (MotorData[MotorNr].MotorRampDownCount > (UWORD)(30 * MotorData[MotorNr].MotorRampDownIncrement)) + pMD->MotorRampDownCount++; + if (pMD->MotorRampDownCount > (UWORD)(30 * pMD->MotorRampDownIncrement)) { - MotorData[MotorNr].MotorRampDownCount = (UWORD)(20 * MotorData[MotorNr].MotorRampDownIncrement); - MotorData[MotorNr].MotorTargetSpeed++; + pMD->MotorRampDownCount = (UWORD)(20 * pMD->MotorRampDownIncrement); + pMD->MotorTargetSpeed++; } } } } else { - if (MotorData[MotorNr].CurrentCaptureCount < (MotorData[MotorNr].MotorRampTachoCountOld + (SLONG)MotorData[MotorNr].MotorRampDownIncrement)) + if (pMD->CurrentCaptureCount < (pMD->MotorRampTachoCountOld + (SLONG)pMD->MotorRampDownIncrement)) { - MotorData[MotorNr].MotorTargetSpeed++; - if (MotorData[MotorNr].MotorTargetSpeed > -MIN_MOVEMENT_POWER) + pMD->MotorTargetSpeed++; + if (pMD->MotorTargetSpeed > -MIN_MOVEMENT_POWER) { - MotorData[MotorNr].MotorTargetSpeed = -MIN_MOVEMENT_POWER; + pMD->MotorTargetSpeed = -MIN_MOVEMENT_POWER; } - MotorData[MotorNr].MotorRampTachoCountOld = MotorData[MotorNr].CurrentCaptureCount; - MotorData[MotorNr].MotorRampDownCount = 0; + pMD->MotorRampTachoCountOld = pMD->CurrentCaptureCount; + pMD->MotorRampDownCount = 0; dOutputRampDownSynch(MotorNr); } else { - if (!(MotorData[MotorNr].RegulationMode & REGSTATE_REGULATED)) + if (!(pMD->RegulationMode & REGSTATE_REGULATED)) { - MotorData[MotorNr].MotorRampDownCount++; - if (MotorData[MotorNr].MotorRampDownCount > (UWORD)(30 * (-MotorData[MotorNr].MotorRampDownIncrement))) + pMD->MotorRampDownCount++; + if (pMD->MotorRampDownCount > (UWORD)(30 * (-pMD->MotorRampDownIncrement))) { - MotorData[MotorNr].MotorRampDownCount = (UWORD)(20 * (-MotorData[MotorNr].MotorRampDownIncrement)); - MotorData[MotorNr].MotorTargetSpeed--; + pMD->MotorRampDownCount = (UWORD)(20 * (-pMD->MotorRampDownIncrement)); + pMD->MotorTargetSpeed--; } } } } - if ((MotorData[MotorNr].RegulationMode & REGSTATE_SYNCHRONE) && (MotorData[MotorNr].TurnParameter != 0)) + if ((pMD->RegulationMode & REGSTATE_SYNCHRONE) && (pMD->TurnParameter != 0)) { dOutputSyncTachoLimitControl(MotorNr); - if (MotorData[MotorNr].MotorRunState == MOTOR_RUN_STATE_IDLE) + if (pMD->MotorRunState == pMD->RunStateAtLimit) { dOutputMotorReachedTachoLimit(MotorNr); } } else { - if (MotorData[MotorNr].MotorTargetSpeed > 0) + if (pMD->MotorTargetSpeed > 0) { - if (MotorData[MotorNr].CurrentCaptureCount >= MotorData[MotorNr].MotorTachoCountToRun) + if (pMD->CurrentCaptureCount >= pMD->MotorTachoCountToRun) { dOutputMotorReachedTachoLimit(MotorNr); } } else { - if (MotorData[MotorNr].CurrentCaptureCount <= MotorData[MotorNr].MotorTachoCountToRun) + if (pMD->CurrentCaptureCount <= pMD->MotorTachoCountToRun) { dOutputMotorReachedTachoLimit(MotorNr); } } } - if (MotorData[MotorNr].RegulationMode == REGSTATE_IDLE) + if (pMD->RegulationMode == REGSTATE_IDLE) { - MotorData[MotorNr].MotorActualSpeed = MotorData[MotorNr].MotorTargetSpeed; + pMD->MotorActualSpeed = pMD->MotorTargetSpeed; } } /* Function used to tell whether the wanted position is obtained */ void dOutputTachoLimitControl(UBYTE MotorNr) { - if (MotorData[MotorNr].MotorRunForever == 0) + MOTORDATA * pMD = &(MotorData[MotorNr]); + if (pMD->MotorRunForever == 0) { - if (MotorData[MotorNr].RegulationMode & REGSTATE_SYNCHRONE) + if (pMD->RegulationMode & REGSTATE_SYNCHRONE) { dOutputSyncTachoLimitControl(MotorNr); } else { - if (MotorData[MotorNr].MotorSetSpeed > 0) + if (pMD->RampDownToLimit == 0) { - if ((MotorData[MotorNr].CurrentCaptureCount >= MotorData[MotorNr].MotorTachoCountToRun)) + if (pMD->MotorSetSpeed > 0) { - MotorData[MotorNr].MotorRunState = MOTOR_RUN_STATE_IDLE; - MotorData[MotorNr].RegulationMode = REGSTATE_IDLE; + if ((pMD->CurrentCaptureCount >= pMD->MotorTachoCountToRun)) + { + pMD->MotorRunState = pMD->RunStateAtLimit; + pMD->RegulationMode = REGSTATE_IDLE; + } + } + else + { + if (pMD->MotorSetSpeed < 0) + { + if (pMD->CurrentCaptureCount <= pMD->MotorTachoCountToRun) + { + pMD->MotorRunState = pMD->RunStateAtLimit; + pMD->RegulationMode = REGSTATE_IDLE; + } + } } } else { - if (MotorData[MotorNr].MotorSetSpeed < 0) + if (pMD->MotorSetSpeed > 0) { - if (MotorData[MotorNr].CurrentCaptureCount <= MotorData[MotorNr].MotorTachoCountToRun) + if ((pMD->CurrentCaptureCount >= (SLONG)((float)pMD->MotorTachoCountToRun * (float)0.80))) { - MotorData[MotorNr].MotorRunState = MOTOR_RUN_STATE_IDLE; - MotorData[MotorNr].RegulationMode = REGSTATE_IDLE; + pMD->MotorRunState = MOTOR_RUN_STATE_RAMPDOWN; + pMD->MotorSetSpeed = 0; + } + } + else + { + if (pMD->MotorSetSpeed < 0) + { + if (pMD->CurrentCaptureCount <= (SLONG)((float)pMD->MotorTachoCountToRun * (float)0.80)) + { + pMD->MotorRunState = MOTOR_RUN_STATE_RAMPDOWN; + pMD->MotorSetSpeed = 0; + } } } } @@ -682,18 +733,18 @@ void dOutputTachoLimitControl(UBYTE MotorNr) } else { - if (MotorData[MotorNr].CurrentCaptureCount > MAX_COUNT_TO_RUN) + if (pMD->CurrentCaptureCount > MAX_COUNT_TO_RUN) { - MotorData[MotorNr].CurrentCaptureCount = 0; + pMD->CurrentCaptureCount = 0; } - if (MotorData[MotorNr].MotorTargetSpeed != 0) + if (pMD->MotorTargetSpeed != 0) { - MotorData[MotorNr].MotorTachoCountToRun = MotorData[MotorNr].CurrentCaptureCount; + pMD->MotorTachoCountToRun = pMD->CurrentCaptureCount; } } - if (MotorData[MotorNr].RegulationMode == REGSTATE_IDLE) + if (pMD->RegulationMode == REGSTATE_IDLE) { - MotorData[MotorNr].MotorActualSpeed = MotorData[MotorNr].MotorTargetSpeed; + pMD->MotorActualSpeed = pMD->MotorTargetSpeed; } } @@ -702,39 +753,41 @@ void dOutputMotorIdleControl(UBYTE MotorNr) { INSERTMode(MotorNr, COAST_MOTOR_MODE); - if (MotorData[MotorNr].MotorActualSpeed != 0) + MOTORDATA * pMD = &(MotorData[MotorNr]); + + if (pMD->MotorActualSpeed != 0) { - if (MotorData[MotorNr].MotorActualSpeed > 0) + if (pMD->MotorActualSpeed > 0) { - MotorData[MotorNr].MotorActualSpeed--; + pMD->MotorActualSpeed--; } else { - MotorData[MotorNr].MotorActualSpeed++; + pMD->MotorActualSpeed++; } } - if (MotorData[MotorNr].MotorTargetSpeed != 0) + if (pMD->MotorTargetSpeed != 0) { - if (MotorData[MotorNr].MotorTargetSpeed > 0) + if (pMD->MotorTargetSpeed > 0) { - MotorData[MotorNr].MotorTargetSpeed--; + pMD->MotorTargetSpeed--; } else { - MotorData[MotorNr].MotorTargetSpeed++; + pMD->MotorTargetSpeed++; } } - if (MotorData[MotorNr].MotorSetSpeed != 0) + if (pMD->MotorSetSpeed != 0) { - if (MotorData[MotorNr].MotorSetSpeed > 0) + if (pMD->MotorSetSpeed > 0) { - MotorData[MotorNr].MotorSetSpeed--; + pMD->MotorSetSpeed--; } else { - MotorData[MotorNr].MotorSetSpeed++; + pMD->MotorSetSpeed++; } } } @@ -745,13 +798,14 @@ void dOutputRegulateMotor(UBYTE MotorNr) UBYTE SyncMotorOne; UBYTE SyncMotorTwo; - if (MotorData[MotorNr].RegulationMode & REGSTATE_REGULATED) + MOTORDATA * pMD = &(MotorData[MotorNr]); + if (pMD->RegulationMode & REGSTATE_REGULATED) { dOutputCalculateMotorPosition(MotorNr); } else { - if (MotorData[MotorNr].RegulationMode & REGSTATE_SYNCHRONE) + if (pMD->RegulationMode & REGSTATE_SYNCHRONE) { dOutputMotorSyncStatus(MotorNr, &SyncMotorOne, &SyncMotorTwo); @@ -774,20 +828,21 @@ void dOutputCalculateMotorPosition(UBYTE MotorNr) SWORD TotalRegValue; SWORD NewSpeedCount = 0; - NewSpeedCount = (SWORD)((MotorData[MotorNr].MotorTargetSpeed * MAX_CAPTURE_COUNT)/INPUT_SCALE_FACTOR); + MOTORDATA * pMD = &(MotorData[MotorNr]); + NewSpeedCount = (SWORD)((pMD->MotorTargetSpeed * MAX_CAPTURE_COUNT)/INPUT_SCALE_FACTOR); - PositionError = (SWORD)(MotorData[MotorNr].OldPositionError - MotorData[MotorNr].DeltaCaptureCount) + NewSpeedCount; + PositionError = (SWORD)(pMD->OldPositionError - pMD->DeltaCaptureCount) + NewSpeedCount; //Overflow control on PositionError - if (MotorData[MotorNr].RegPParameter != 0) + if (pMD->RegPParameter != 0) { - if (PositionError > (SWORD)(32000 / MotorData[MotorNr].RegPParameter)) + if (PositionError > (SWORD)(32000 / pMD->RegPParameter)) { - PositionError = (SWORD)(32000 / MotorData[MotorNr].RegPParameter); + PositionError = (SWORD)(32000 / pMD->RegPParameter); } - if (PositionError < (SWORD)(-(32000 / MotorData[MotorNr].RegPParameter))) + if (PositionError < (SWORD)(-(32000 / pMD->RegPParameter))) { - PositionError = (SWORD)(-(32000 / MotorData[MotorNr].RegPParameter)); + PositionError = (SWORD)(-(32000 / pMD->RegPParameter)); } } else @@ -802,7 +857,7 @@ void dOutputCalculateMotorPosition(UBYTE MotorNr) } } - PValue = PositionError * (SWORD)(MotorData[MotorNr].RegPParameter/REG_CONST_DIV); + PValue = PositionError * (SWORD)(pMD->RegPParameter/REG_CONST_DIV); if (PValue > (SWORD)REG_MAX_VALUE) { PValue = REG_MAX_VALUE; @@ -812,21 +867,21 @@ void dOutputCalculateMotorPosition(UBYTE MotorNr) PValue = REG_MIN_VALUE; } - DValue = (PositionError - MotorData[MotorNr].OldPositionError) * (SWORD)(MotorData[MotorNr].RegDParameter/REG_CONST_DIV); - MotorData[MotorNr].OldPositionError = PositionError; + DValue = (PositionError - pMD->OldPositionError) * (SWORD)(pMD->RegDParameter/REG_CONST_DIV); + pMD->OldPositionError = PositionError; - MotorData[MotorNr].AccError = (MotorData[MotorNr].AccError * 3) + PositionError; - MotorData[MotorNr].AccError = MotorData[MotorNr].AccError / 4; + pMD->AccError = (pMD->AccError * 3) + PositionError; + pMD->AccError = pMD->AccError / 4; - if (MotorData[MotorNr].AccError > (SWORD)800) + if (pMD->AccError > (SWORD)800) { - MotorData[MotorNr].AccError = 800; + pMD->AccError = 800; } - if (MotorData[MotorNr].AccError <= (SWORD)-800) + if (pMD->AccError <= (SWORD)-800) { - MotorData[MotorNr].AccError = -800; + pMD->AccError = -800; } - IValue = MotorData[MotorNr].AccError * (SWORD)(MotorData[MotorNr].RegIParameter/REG_CONST_DIV); + IValue = pMD->AccError * (SWORD)(pMD->RegIParameter/REG_CONST_DIV); if (IValue > (SWORD)REG_MAX_VALUE) { @@ -841,14 +896,14 @@ void dOutputCalculateMotorPosition(UBYTE MotorNr) if (TotalRegValue > MAXIMUM_SPEED_FW) { TotalRegValue = MAXIMUM_SPEED_FW; - MotorData[MotorNr].MotorOverloaded = 1; + pMD->MotorOverloaded = 1; } if (TotalRegValue < MAXIMUM_SPEED_RW) { TotalRegValue = MAXIMUM_SPEED_RW; - MotorData[MotorNr].MotorOverloaded = 1; + pMD->MotorOverloaded = 1; } - MotorData[MotorNr].MotorActualSpeed = (SBYTE)TotalRegValue; + pMD->MotorActualSpeed = (SBYTE)TotalRegValue; } /* Regulation function used when syncrhonization regulation is enabled */ @@ -862,38 +917,40 @@ void dOutputSyncMotorPosition(UBYTE MotorOne, UBYTE MotorTwo) SWORD CorrectionValue; SWORD MotorSpeed; - SyncData.SyncTachoDif = (SLONG)((MotorData[MotorOne].MotorBlockTachoCount) - (MotorData[MotorTwo].MotorBlockTachoCount)); + MOTORDATA * pOne = &(MotorData[MotorOne]); + MOTORDATA * pTwo = &(MotorData[MotorTwo]); + SyncData.SyncTachoDif = (SLONG)((pOne->MotorBlockTachoCount) - (pTwo->MotorBlockTachoCount)); - if (MotorData[MotorOne].TurnParameter != 0) + if (pOne->TurnParameter != 0) { - if ((MotorData[MotorOne].MotorBlockTachoCount != 0) || (MotorData[MotorTwo].MotorBlockTachoCount)) + if ((pOne->MotorBlockTachoCount != 0) || (pTwo->MotorBlockTachoCount != 0)) { - if (MotorData[MotorOne].MotorTargetSpeed >= 0) + if (pOne->MotorTargetSpeed >= 0) { - if (MotorData[MotorOne].TurnParameter > 0) + if (pOne->TurnParameter > 0) { - TempTurnParameter = (SLONG)(((SLONG)MotorData[MotorTwo].TurnParameter * (SLONG)MotorData[MotorTwo].MotorTargetSpeed)/100); + TempTurnParameter = (SLONG)(((SLONG)pTwo->TurnParameter * (SLONG)pTwo->MotorTargetSpeed)/100); } else { - TempTurnParameter = (SLONG)(((SLONG)MotorData[MotorOne].TurnParameter * (SLONG)MotorData[MotorOne].MotorTargetSpeed)/100); + TempTurnParameter = (SLONG)(((SLONG)pOne->TurnParameter * (SLONG)pOne->MotorTargetSpeed)/100); } } else { - if (MotorData[MotorOne].TurnParameter > 0) + if (pOne->TurnParameter > 0) { - TempTurnParameter = (SLONG)(((SLONG)MotorData[MotorOne].TurnParameter * (-(SLONG)MotorData[MotorOne].MotorTargetSpeed))/100); + TempTurnParameter = (SLONG)(((SLONG)pOne->TurnParameter * (-(SLONG)pOne->MotorTargetSpeed))/100); } else { - TempTurnParameter = (SLONG)(((SLONG)MotorData[MotorTwo].TurnParameter * (-(SLONG)MotorData[MotorTwo].MotorTargetSpeed))/100); + TempTurnParameter = (SLONG)(((SLONG)pTwo->TurnParameter * (-(SLONG)pTwo->MotorTargetSpeed))/100); } } } else { - TempTurnParameter = MotorData[MotorOne].TurnParameter; + TempTurnParameter = pOne->TurnParameter; } } else @@ -906,16 +963,6 @@ void dOutputSyncMotorPosition(UBYTE MotorOne, UBYTE MotorTwo) SyncData.SyncTachoDif += SyncData.SyncTurnParameter; - if (SyncData.SyncTachoDif > 500) - { - SyncData.SyncTachoDif = 500; - } - if (SyncData.SyncTachoDif < -500) - { - SyncData.SyncTachoDif = -500; - } - - /* if ((SWORD)SyncData.SyncTachoDif > 500) { SyncData.SyncTachoDif = 500; @@ -924,11 +971,10 @@ void dOutputSyncMotorPosition(UBYTE MotorOne, UBYTE MotorTwo) { SyncData.SyncTachoDif = -500; } - */ - PValue = (SWORD)SyncData.SyncTachoDif * (SWORD)(MotorData[MotorOne].RegPParameter/REG_CONST_DIV); + PValue = (SWORD)SyncData.SyncTachoDif * (SWORD)(pOne->RegPParameter/REG_CONST_DIV); - DValue = ((SWORD)SyncData.SyncTachoDif - SyncData.SyncOldError) * (SWORD)(MotorData[MotorOne].RegDParameter/REG_CONST_DIV); + DValue = ((SWORD)SyncData.SyncTachoDif - SyncData.SyncOldError) * (SWORD)(pOne->RegDParameter/REG_CONST_DIV); SyncData.SyncOldError = (SWORD)SyncData.SyncTachoDif; SyncData.SyncAccError += (SWORD)SyncData.SyncTachoDif; @@ -941,11 +987,11 @@ void dOutputSyncMotorPosition(UBYTE MotorOne, UBYTE MotorTwo) { SyncData.SyncAccError = -900; } - IValue = SyncData.SyncAccError * (SWORD)(MotorData[MotorOne].RegIParameter/REG_CONST_DIV); + IValue = SyncData.SyncAccError * (SWORD)(pOne->RegIParameter/REG_CONST_DIV); CorrectionValue = (SWORD)((PValue + IValue + DValue)/4); - MotorSpeed = (SWORD)MotorData[MotorOne].MotorTargetSpeed - CorrectionValue; + MotorSpeed = (SWORD)pOne->MotorTargetSpeed - CorrectionValue; if (MotorSpeed > (SWORD)MAXIMUM_SPEED_FW) { @@ -959,40 +1005,40 @@ void dOutputSyncMotorPosition(UBYTE MotorOne, UBYTE MotorTwo) } } - if (MotorData[MotorOne].TurnParameter != 0) + if (pOne->TurnParameter != 0) { - if (MotorData[MotorOne].MotorTargetSpeed > 0) + if (pOne->MotorTargetSpeed > 0) { - if (MotorSpeed > (SWORD)MotorData[MotorOne].MotorTargetSpeed) + if (MotorSpeed > (SWORD)pOne->MotorTargetSpeed) { - MotorSpeed = (SWORD)MotorData[MotorOne].MotorTargetSpeed; + MotorSpeed = (SWORD)pOne->MotorTargetSpeed; } else { - if (MotorSpeed < (SWORD)-MotorData[MotorOne].MotorTargetSpeed) + if (MotorSpeed < (SWORD)-pOne->MotorTargetSpeed) { - MotorSpeed = -MotorData[MotorOne].MotorTargetSpeed; + MotorSpeed = -pOne->MotorTargetSpeed; } } } else { - if (MotorSpeed < (SWORD)MotorData[MotorOne].MotorTargetSpeed) + if (MotorSpeed < (SWORD)pOne->MotorTargetSpeed) { - MotorSpeed = (SWORD)MotorData[MotorOne].MotorTargetSpeed; + MotorSpeed = (SWORD)pOne->MotorTargetSpeed; } else { - if (MotorSpeed > (SWORD)-MotorData[MotorOne].MotorTargetSpeed) + if (MotorSpeed > (SWORD)-pOne->MotorTargetSpeed) { - MotorSpeed = -MotorData[MotorOne].MotorTargetSpeed; + MotorSpeed = -pOne->MotorTargetSpeed; } } } } - MotorData[MotorOne].MotorActualSpeed = (SBYTE)MotorSpeed; + pOne->MotorActualSpeed = (SBYTE)MotorSpeed; - MotorSpeed = (SWORD)MotorData[MotorTwo].MotorTargetSpeed + CorrectionValue; + MotorSpeed = (SWORD)pTwo->MotorTargetSpeed + CorrectionValue; if (MotorSpeed > (SWORD)MAXIMUM_SPEED_FW) { @@ -1006,47 +1052,71 @@ void dOutputSyncMotorPosition(UBYTE MotorOne, UBYTE MotorTwo) } } - if (MotorData[MotorOne].TurnParameter != 0) + if (pOne->TurnParameter != 0) { - if (MotorData[MotorTwo].MotorTargetSpeed > 0) + if (pTwo->MotorTargetSpeed > 0) { - if (MotorSpeed > (SWORD)MotorData[MotorTwo].MotorTargetSpeed) + if (MotorSpeed > (SWORD)pTwo->MotorTargetSpeed) { - MotorSpeed = (SWORD)MotorData[MotorTwo].MotorTargetSpeed; + MotorSpeed = (SWORD)pTwo->MotorTargetSpeed; } else { - if (MotorSpeed < (SWORD)-MotorData[MotorTwo].MotorTargetSpeed) + if (MotorSpeed < (SWORD)-pTwo->MotorTargetSpeed) { - MotorSpeed = -MotorData[MotorTwo].MotorTargetSpeed; + MotorSpeed = -pTwo->MotorTargetSpeed; } } } else { - if (MotorSpeed < (SWORD)MotorData[MotorTwo].MotorTargetSpeed) + if (MotorSpeed < (SWORD)pTwo->MotorTargetSpeed) { - MotorSpeed = (SWORD)MotorData[MotorTwo].MotorTargetSpeed; + MotorSpeed = (SWORD)pTwo->MotorTargetSpeed; } else { - if (MotorSpeed > (SWORD)-MotorData[MotorTwo].MotorTargetSpeed) + if (MotorSpeed > (SWORD)-pTwo->MotorTargetSpeed) { - MotorSpeed = -MotorData[MotorTwo].MotorTargetSpeed; + MotorSpeed = -pTwo->MotorTargetSpeed; } } } } - MotorData[MotorTwo].MotorActualSpeed = (SBYTE)MotorSpeed; + pTwo->MotorActualSpeed = (SBYTE)MotorSpeed; } //Called when the motor is ramping down void dOutputMotorReachedTachoLimit(UBYTE MotorNr) { - UBYTE MotorOne, MotorTwo; - - if (MotorData[MotorNr].RegulationMode & REGSTATE_SYNCHRONE) + MOTORDATA * pOne = &(MotorData[MotorNr]); + if (pOne->RegulationMode & REGSTATE_SYNCHRONE) { + UBYTE MotorOne, MotorTwo; + MotorOne = MotorNr; + MotorTwo = 0xFF; + for(UBYTE i = MOTOR_A; i <= MOTOR_C; i++) { + if (i == MotorOne) + continue; + if (MotorData[i].RegulationMode & REGSTATE_SYNCHRONE) { + MotorTwo = i; + break; + } + } + pOne->MotorSetSpeed = 0; + pOne->MotorTargetSpeed = 0; + pOne->MotorActualSpeed = 0; + pOne->MotorRunState = pOne->RunStateAtLimit; + pOne->RegulationMode = REGSTATE_IDLE; + if (MotorTwo != 0xFF) { + MOTORDATA * pTwo = &(MotorData[MotorTwo]); + pTwo->MotorSetSpeed = 0; + pTwo->MotorTargetSpeed = 0; + pTwo->MotorActualSpeed = 0; + pTwo->MotorRunState = pTwo->RunStateAtLimit; + pTwo->RegulationMode = REGSTATE_IDLE; + } +/* if (MotorNr == MOTOR_A) { MotorOne = MotorNr; @@ -1055,14 +1125,15 @@ void dOutputMotorReachedTachoLimit(UBYTE MotorNr) { //Synchronise motor A & B MotorData[MotorOne].MotorSetSpeed = 0; - MotorData[MotorOne].MotorTargetSpeed = 0; + MotorData[MotorOne].MotorTargetSpeed = 0; MotorData[MotorOne].MotorActualSpeed = 0; - MotorData[MotorOne].MotorRunState = MOTOR_RUN_STATE_IDLE; + MotorData[MotorOne].MotorRunState = pOne->RunStateAtLimit; MotorData[MotorOne].RegulationMode = REGSTATE_IDLE; + MotorData[MotorTwo].MotorSetSpeed = 0; - MotorData[MotorTwo].MotorTargetSpeed = 0; + MotorData[MotorTwo].MotorTargetSpeed = 0; MotorData[MotorTwo].MotorActualSpeed = 0; - MotorData[MotorTwo].MotorRunState = MOTOR_RUN_STATE_IDLE; + MotorData[MotorTwo].MotorRunState = pTwo->RunStateAtLimit; MotorData[MotorTwo].RegulationMode = REGSTATE_IDLE; } else @@ -1072,23 +1143,23 @@ void dOutputMotorReachedTachoLimit(UBYTE MotorNr) { //Synchronise motor A & C MotorData[MotorOne].MotorSetSpeed = 0; - MotorData[MotorOne].MotorTargetSpeed = 0; + MotorData[MotorOne].MotorTargetSpeed = 0; MotorData[MotorOne].MotorActualSpeed = 0; - MotorData[MotorOne].MotorRunState = MOTOR_RUN_STATE_IDLE; + MotorData[MotorOne].MotorRunState = pOne->RunStateAtLimit; MotorData[MotorOne].RegulationMode = REGSTATE_IDLE; MotorData[MotorTwo].MotorSetSpeed = 0; - MotorData[MotorTwo].MotorTargetSpeed = 0; + MotorData[MotorTwo].MotorTargetSpeed = 0; MotorData[MotorTwo].MotorActualSpeed = 0; - MotorData[MotorTwo].MotorRunState = MOTOR_RUN_STATE_IDLE; + MotorData[MotorTwo].MotorRunState = pTwo->RunStateAtLimit; MotorData[MotorTwo].RegulationMode = REGSTATE_IDLE; } else { //Only Motor A has Sync setting => Stop normal MotorData[MotorNr].MotorSetSpeed = 0; - MotorData[MotorNr].MotorTargetSpeed = 0; + MotorData[MotorNr].MotorTargetSpeed = 0; MotorData[MotorNr].MotorActualSpeed = 0; - MotorData[MotorNr].MotorRunState = MOTOR_RUN_STATE_IDLE; + MotorData[MotorNr].MotorRunState = pOne->RunStateAtLimit; MotorData[MotorNr].RegulationMode = REGSTATE_IDLE; } } @@ -1103,12 +1174,12 @@ void dOutputMotorReachedTachoLimit(UBYTE MotorNr) MotorData[MotorOne].MotorSetSpeed = 0; MotorData[MotorOne].MotorTargetSpeed = 0; MotorData[MotorOne].MotorActualSpeed = 0; - MotorData[MotorOne].MotorRunState = MOTOR_RUN_STATE_IDLE; + MotorData[MotorOne].MotorRunState = pOne->RunStateAtLimit; MotorData[MotorOne].RegulationMode = REGSTATE_IDLE; MotorData[MotorTwo].MotorSetSpeed = 0; MotorData[MotorTwo].MotorTargetSpeed = 0; MotorData[MotorTwo].MotorActualSpeed = 0; - MotorData[MotorTwo].MotorRunState = MOTOR_RUN_STATE_IDLE; + MotorData[MotorTwo].MotorRunState = pTwo->RunStateAtLimit; MotorData[MotorTwo].RegulationMode = REGSTATE_IDLE; } MotorTwo = MotorOne + 1; @@ -1118,12 +1189,12 @@ void dOutputMotorReachedTachoLimit(UBYTE MotorNr) MotorData[MotorOne].MotorSetSpeed = 0; MotorData[MotorOne].MotorTargetSpeed = 0; MotorData[MotorOne].MotorActualSpeed = 0; - MotorData[MotorOne].MotorRunState = MOTOR_RUN_STATE_IDLE; + MotorData[MotorOne].MotorRunState = pOne->RunStateAtLimit; MotorData[MotorOne].RegulationMode = REGSTATE_IDLE; MotorData[MotorTwo].MotorSetSpeed = 0; MotorData[MotorTwo].MotorTargetSpeed = 0; MotorData[MotorTwo].MotorActualSpeed = 0; - MotorData[MotorTwo].MotorRunState = MOTOR_RUN_STATE_IDLE; + MotorData[MotorTwo].MotorRunState = pTwo->RunStateAtLimit; MotorData[MotorTwo].RegulationMode = REGSTATE_IDLE; } else @@ -1132,7 +1203,7 @@ void dOutputMotorReachedTachoLimit(UBYTE MotorNr) MotorData[MotorNr].MotorSetSpeed = 0; MotorData[MotorNr].MotorTargetSpeed = 0; MotorData[MotorNr].MotorActualSpeed = 0; - MotorData[MotorNr].MotorRunState = MOTOR_RUN_STATE_IDLE; + MotorData[MotorNr].MotorRunState = pOne->RunStateAtLimit; MotorData[MotorNr].RegulationMode = REGSTATE_IDLE; } } @@ -1146,12 +1217,12 @@ void dOutputMotorReachedTachoLimit(UBYTE MotorNr) MotorData[MotorOne].MotorSetSpeed = 0; MotorData[MotorOne].MotorTargetSpeed = 0; MotorData[MotorOne].MotorActualSpeed = 0; - MotorData[MotorOne].MotorRunState = MOTOR_RUN_STATE_IDLE; + MotorData[MotorOne].MotorRunState = pOne->RunStateAtLimit; MotorData[MotorOne].RegulationMode = REGSTATE_IDLE; MotorData[MotorTwo].MotorSetSpeed = 0; MotorData[MotorTwo].MotorTargetSpeed = 0; MotorData[MotorTwo].MotorActualSpeed = 0; - MotorData[MotorTwo].MotorRunState = MOTOR_RUN_STATE_IDLE; + MotorData[MotorTwo].MotorRunState = pTwo->RunStateAtLimit; MotorData[MotorTwo].RegulationMode = REGSTATE_IDLE; } MotorTwo = MotorOne - 1; @@ -1161,35 +1232,35 @@ void dOutputMotorReachedTachoLimit(UBYTE MotorNr) MotorData[MotorOne].MotorSetSpeed = 0; MotorData[MotorOne].MotorTargetSpeed = 0; MotorData[MotorOne].MotorActualSpeed = 0; - MotorData[MotorOne].MotorRunState = MOTOR_RUN_STATE_IDLE; + MotorData[MotorOne].MotorRunState = pOne->RunStateAtLimit; MotorData[MotorOne].RegulationMode = REGSTATE_IDLE; MotorData[MotorTwo].MotorSetSpeed = 0; MotorData[MotorTwo].MotorTargetSpeed = 0; MotorData[MotorTwo].MotorActualSpeed = 0; - MotorData[MotorTwo].MotorRunState = MOTOR_RUN_STATE_IDLE; + MotorData[MotorTwo].MotorRunState = pTwo->RunStateAtLimit; MotorData[MotorTwo].RegulationMode = REGSTATE_IDLE; } else { //Only Motor C has Sync settings => Stop normal MotorData[MotorNr].MotorSetSpeed = 0; - MotorData[MotorNr].MotorTargetSpeed = 0; + MotorData[MotorNr].MotorTargetSpeed = 0; MotorData[MotorNr].MotorActualSpeed = 0; - MotorData[MotorNr].MotorRunState = MOTOR_RUN_STATE_IDLE; + MotorData[MotorNr].MotorRunState = pOne->RunStateAtLimit; MotorData[MotorNr].RegulationMode = REGSTATE_IDLE; } } +*/ } else { - if (MotorData[MotorNr].MotorSetSpeed == 0) + if (pOne->MotorSetSpeed == 0) { - MotorData[MotorNr].MotorSetSpeed = 0; - MotorData[MotorNr].MotorTargetSpeed = 0; - MotorData[MotorNr].MotorActualSpeed = 0; + pOne->MotorTargetSpeed = 0; + pOne->MotorActualSpeed = 0; } - MotorData[MotorNr].MotorRunState = MOTOR_RUN_STATE_IDLE; - MotorData[MotorNr].RegulationMode = REGSTATE_IDLE; + pOne->MotorRunState = pOne->RunStateAtLimit; + pOne->RegulationMode = REGSTATE_IDLE; } } @@ -1199,6 +1270,19 @@ void dOutputSyncTachoLimitControl(UBYTE MotorNr) { UBYTE MotorOne, MotorTwo; + MotorOne = MotorNr; + MotorTwo = 0xFF; + for(UBYTE i = MOTOR_A; i <= MOTOR_C; i++) { + if (i == MotorOne) + continue; + if (MotorData[i].RegulationMode & REGSTATE_SYNCHRONE) { + MotorTwo = i; + break; + } + } + if (MotorTwo == 0xFF) + MotorOne = 0xFF; +/* if (MotorNr == MOTOR_A) { MotorOne = MotorNr; @@ -1274,80 +1358,97 @@ void dOutputSyncTachoLimitControl(UBYTE MotorNr) } } } - +*/ if ((MotorOne != 0xFF) && (MotorTwo != 0xFF)) { - if (MotorData[MotorOne].TurnParameter != 0) + MOTORDATA * pOne = &(MotorData[MotorOne]); + MOTORDATA * pTwo = &(MotorData[MotorTwo]); + SLONG l1 = pOne->MotorTachoCountToRun; + SLONG l2 = pTwo->MotorTachoCountToRun; + UBYTE NewRunState1 = pOne->RunStateAtLimit; + UBYTE NewRunState2 = pTwo->RunStateAtLimit; + if (pOne->RampDownToLimit == OPTION_RAMPDOWNTOLIMIT) + { + NewRunState1 = MOTOR_RUN_STATE_RAMPDOWN; + l1 = (SLONG)((float)l1 * 0.80f); + } + if (pTwo->RampDownToLimit == OPTION_RAMPDOWNTOLIMIT) + { + NewRunState2 = MOTOR_RUN_STATE_RAMPDOWN; + l2 = (SLONG)((float)l2 * 0.80f); + } + if (pOne->TurnParameter != 0) { - if (MotorData[MotorOne].TurnParameter > 0) + if (pOne->TurnParameter > 0) { - if (MotorData[MotorTwo].MotorTargetSpeed >= 0) + if (pTwo->MotorTargetSpeed >= 0) { - if ((SLONG)(MotorData[MotorTwo].CurrentCaptureCount >= MotorData[MotorTwo].MotorTachoCountToRun)) + if ((SLONG)(pTwo->CurrentCaptureCount >= l2)) { - MotorData[MotorOne].MotorRunState = MOTOR_RUN_STATE_IDLE; - MotorData[MotorTwo].MotorRunState = MOTOR_RUN_STATE_IDLE; + pOne->MotorRunState = NewRunState1; + pTwo->MotorRunState = NewRunState2; - MotorData[MotorOne].CurrentCaptureCount = MotorData[MotorTwo].CurrentCaptureCount; - MotorData[MotorOne].MotorTachoCountToRun = MotorData[MotorTwo].MotorTachoCountToRun; + pOne->CurrentCaptureCount = pTwo->CurrentCaptureCount; + pOne->MotorTachoCountToRun = l2; } } else { - if ((SLONG)(MotorData[MotorOne].CurrentCaptureCount <= MotorData[MotorOne].MotorTachoCountToRun)) + if ((SLONG)(pOne->CurrentCaptureCount <= l1)) { - MotorData[MotorOne].MotorRunState = MOTOR_RUN_STATE_IDLE; - MotorData[MotorTwo].MotorRunState = MOTOR_RUN_STATE_IDLE; + pOne->MotorRunState = NewRunState1; + pTwo->MotorRunState = NewRunState2; - MotorData[MotorTwo].CurrentCaptureCount = MotorData[MotorOne].CurrentCaptureCount; - MotorData[MotorTwo].MotorTachoCountToRun = MotorData[MotorOne].MotorTachoCountToRun; + pTwo->CurrentCaptureCount = pOne->CurrentCaptureCount; + pTwo->MotorTachoCountToRun = l1; } } } else { - if (MotorData[MotorOne].MotorTargetSpeed >= 0) + if (pOne->MotorTargetSpeed >= 0) { - if ((SLONG)(MotorData[MotorOne].CurrentCaptureCount >= MotorData[MotorOne].MotorTachoCountToRun)) + if ((SLONG)(pOne->CurrentCaptureCount >= l1)) { - MotorData[MotorOne].MotorRunState = MOTOR_RUN_STATE_IDLE; - MotorData[MotorTwo].MotorRunState = MOTOR_RUN_STATE_IDLE; + pOne->MotorRunState = NewRunState1; + pTwo->MotorRunState = NewRunState2; - MotorData[MotorTwo].CurrentCaptureCount = MotorData[MotorOne].CurrentCaptureCount; - MotorData[MotorTwo].MotorTachoCountToRun = MotorData[MotorOne].MotorTachoCountToRun; + pTwo->CurrentCaptureCount = pOne->CurrentCaptureCount; + pTwo->MotorTachoCountToRun = l1; } } else { - if ((SLONG)(MotorData[MotorTwo].CurrentCaptureCount <= MotorData[MotorTwo].MotorTachoCountToRun)) + if ((SLONG)(pTwo->CurrentCaptureCount <= l2)) { - MotorData[MotorOne].MotorRunState = MOTOR_RUN_STATE_IDLE; - MotorData[MotorTwo].MotorRunState = MOTOR_RUN_STATE_IDLE; + pOne->MotorRunState = NewRunState1; + pTwo->MotorRunState = NewRunState2; - MotorData[MotorOne].CurrentCaptureCount = MotorData[MotorTwo].CurrentCaptureCount; - MotorData[MotorOne].MotorTachoCountToRun = MotorData[MotorTwo].MotorTachoCountToRun; + pOne->CurrentCaptureCount = pTwo->CurrentCaptureCount; + pOne->MotorTachoCountToRun = l2; } } } } else { - if (MotorData[MotorOne].MotorSetSpeed > 0) + // no turning + if (pOne->MotorSetSpeed > 0) { - if ((MotorData[MotorOne].CurrentCaptureCount >= MotorData[MotorOne].MotorTachoCountToRun) || (MotorData[MotorTwo].CurrentCaptureCount >= MotorData[MotorTwo].MotorTachoCountToRun)) + if ((pOne->CurrentCaptureCount >= l1) || (pTwo->CurrentCaptureCount >= l2)) { - MotorData[MotorOne].MotorRunState = MOTOR_RUN_STATE_IDLE; - MotorData[MotorTwo].MotorRunState = MOTOR_RUN_STATE_IDLE; + pOne->MotorRunState = NewRunState1; + pTwo->MotorRunState = NewRunState2; } } else { - if (MotorData[MotorOne].MotorSetSpeed < 0) + if (pOne->MotorSetSpeed < 0) { - if ((MotorData[MotorOne].CurrentCaptureCount <= MotorData[MotorOne].MotorTachoCountToRun) || (MotorData[MotorTwo].CurrentCaptureCount <= MotorData[MotorTwo].MotorTachoCountToRun)) + if ((pOne->CurrentCaptureCount <= l1) || (pTwo->CurrentCaptureCount <= l2)) { - MotorData[MotorOne].MotorRunState = MOTOR_RUN_STATE_IDLE; - MotorData[MotorTwo].MotorRunState = MOTOR_RUN_STATE_IDLE; + pOne->MotorRunState = NewRunState1; + pTwo->MotorRunState = NewRunState2; } } } @@ -1411,6 +1512,19 @@ void dOutputResetSyncMotors(UBYTE MotorNr) { UBYTE MotorOne, MotorTwo; + MotorOne = MotorNr; + MotorTwo = 0xFF; + for(UBYTE i = MOTOR_A; i <= MOTOR_C; i++) { + if (i == MotorOne) + continue; + if (MotorData[i].RegulationMode & REGSTATE_SYNCHRONE) { + MotorTwo = i; + break; + } + } + if (MotorTwo == 0xFF) + MotorOne = 0xFF; +/* if (MotorNr == MOTOR_A) { MotorOne = MotorNr; @@ -1480,18 +1594,20 @@ void dOutputResetSyncMotors(UBYTE MotorNr) } } } - +*/ + MOTORDATA * pMD = &(MotorData[MotorNr]); if ((MotorOne != 0xFF) && (MotorTwo != 0xFF)) { - MotorData[MotorOne].CurrentCaptureCount = 0; - MotorData[MotorOne].MotorTachoCountToRun = 0; - MotorData[MotorTwo].CurrentCaptureCount = 0; - MotorData[MotorTwo].MotorTachoCountToRun = 0; + MOTORDATA * pTwo = &(MotorData[MotorTwo]); + pMD->CurrentCaptureCount = 0; + pMD->MotorTachoCountToRun = 0; + pTwo->CurrentCaptureCount = 0; + pTwo->MotorTachoCountToRun = 0; } else { - MotorData[MotorNr].CurrentCaptureCount = 0; - MotorData[MotorNr].MotorTachoCountToRun = 0; + pMD->CurrentCaptureCount = 0; + pMD->MotorTachoCountToRun = 0; } } @@ -1500,6 +1616,19 @@ void dOutputRampDownSynch(UBYTE MotorNr) { UBYTE MotorOne, MotorTwo; + MotorOne = MotorNr; + MotorTwo = 0xFF; + for(UBYTE i = MOTOR_A; i <= MOTOR_C; i++) { + if (i == MotorOne) + continue; + if (MotorData[i].RegulationMode & REGSTATE_SYNCHRONE) { + MotorTwo = i; + break; + } + } + if (MotorTwo == 0xFF) + MotorOne = 0xFF; +/* if (MotorNr == MOTOR_A) { MotorOne = MotorNr; @@ -1571,42 +1700,44 @@ void dOutputRampDownSynch(UBYTE MotorNr) } } } - +*/ if ((MotorOne != 0xFF) && (MotorTwo != 0xFF)) { - if (MotorData[MotorOne].TurnParameter != 0) + MOTORDATA * pOne = &(MotorData[MotorOne]); + MOTORDATA * pTwo = &(MotorData[MotorTwo]); + if (pOne->TurnParameter != 0) { - if (MotorData[MotorOne].TurnParameter > 0) + if (pOne->TurnParameter > 0) { - if (MotorData[MotorOne].MotorTargetSpeed >= 0) + if (pOne->MotorTargetSpeed >= 0) { - if (MotorData[MotorTwo].MotorActualSpeed < 0) + if (pTwo->MotorActualSpeed < 0) { - MotorData[MotorTwo].MotorTargetSpeed--; + pTwo->MotorTargetSpeed--; } } else { - if (MotorData[MotorTwo].MotorActualSpeed > 0) + if (pTwo->MotorActualSpeed > 0) { - MotorData[MotorTwo].MotorTargetSpeed++; + pTwo->MotorTargetSpeed++; } } } else { - if (MotorData[MotorOne].MotorTargetSpeed >= 0) + if (pOne->MotorTargetSpeed >= 0) { - if (MotorData[MotorTwo].MotorActualSpeed < 0) + if (pTwo->MotorActualSpeed < 0) { - MotorData[MotorTwo].MotorTargetSpeed--; + pTwo->MotorTargetSpeed--; } } else { - if (MotorData[MotorTwo].MotorActualSpeed > 0) + if (pTwo->MotorActualSpeed > 0) { - MotorData[MotorTwo].MotorTargetSpeed++; + pTwo->MotorTargetSpeed++; } } } @@ -1614,3 +1745,7 @@ void dOutputRampDownSynch(UBYTE MotorNr) } } +void dOutputUpdateRegulationTime(UBYTE rt) +{ + RegTime = rt; +} diff --git a/AT91SAM7S256/Source/d_output.h b/AT91SAM7S256/Source/d_output.h index 7369b34..ce78246 100644 --- a/AT91SAM7S256/Source/d_output.h +++ b/AT91SAM7S256/Source/d_output.h @@ -52,6 +52,9 @@ #define MOTOR_RUN_STATE_HOLD 0x60 +#define RAMP_TIME_INTERVAL 25 // Measured in 1 mS => 25 mS interval +#define REGULATION_TIME 100 // Measured in 1 mS => 100 mS regulation interval + enum { MOTOR_A, @@ -64,15 +67,15 @@ void dOutputExit(void); void dOutputCtrl(void); void dOutputGetMotorParameters(UBYTE *CurrentMotorSpeed, SLONG *TachoCount, SLONG *BlockTachoCount, UBYTE *RunState, UBYTE *MotorOverloaded, SLONG *RotationCount); -void dOutputSetMode(UBYTE Motor, UBYTE Mode); +void dOutputSetMode(UBYTE MotorNr, UBYTE Mode); void dOutputSetSpeed (UBYTE MotorNr, UBYTE NewMotorRunState, SBYTE Speed, SBYTE TurnParameter); -void dOutputEnableRegulation(UBYTE Motor, UBYTE RegulationMode); -void dOutputDisableRegulation(UBYTE Motor); -void dOutputSetTachoLimit(UBYTE Motor, ULONG TachoCntToTravel); -void dOutputResetTachoLimit(UBYTE Motor); -void dOutputResetBlockTachoLimit(UBYTE Motor); +void dOutputEnableRegulation(UBYTE MotorNr, UBYTE RegulationMode); +void dOutputDisableRegulation(UBYTE MotorNr); +void dOutputSetTachoLimit(UBYTE MotorNr, ULONG TachoCntToTravel, UBYTE Options); +void dOutputResetTachoLimit(UBYTE MotorNr); +void dOutputResetBlockTachoLimit(UBYTE MotorNr); void dOutputResetRotationCaptureCount(UBYTE MotorNr); -void dOutputSetPIDParameters(UBYTE Motor, UBYTE NewRegPParameter, UBYTE NewRegIParameter, UBYTE NewRegDParameter); +void dOutputSetPIDParameters(UBYTE MotorNr, UBYTE NewRegPParameter, UBYTE NewRegIParameter, UBYTE NewRegDParameter); void dOutputRegulateMotor(UBYTE MotorNr); void dOutputCalculateRampUpParameter(UBYTE MotorNr, ULONG NewTachoLimit); @@ -86,5 +89,6 @@ void dOutputMotorIdleControl(UBYTE MotorNr); void dOutputSyncTachoLimitControl(UBYTE MotorNr); void dOutputMotorSyncStatus(UBYTE MotorNr, UBYTE *SyncMotorOne, UBYTE *SyncMotorTwo); void dOutputResetSyncMotors(UBYTE MotorNr); +void dOutputUpdateRegulationTime(UBYTE rt); #endif diff --git a/AT91SAM7S256/Source/d_output.r b/AT91SAM7S256/Source/d_output.r index 1a30c5f..a856920 100644 --- a/AT91SAM7S256/Source/d_output.r +++ b/AT91SAM7S256/Source/d_output.r @@ -91,11 +91,11 @@ static TACHOPARAMETERS MotorTachoValue[3]; *AT91C_PIOA_PER = MOTOR_A_DIR; /* Enable PIO on PA1 */\ *AT91C_PIOA_ODR = MOTOR_A_DIR; /* PA1 set to input */\ *AT91C_PIOA_IFER = MOTOR_A_INT | MOTOR_A_DIR; /* Enable filter on PA15 & PA1 */\ - *AT91C_PMC_PCER = TIMER_1_ID13; /* Enable clock for TC1*/\ - *AT91C_TCB_BMR = AT91C_TCB_TC1XC1S_NONE; /* No external clock signal XC2 */\ - *AT91C_TCB_BCR = 0x0; /* Clear SYNC */\ - *AT91C_TC1_CMR = *AT91C_TC1_CMR & 0X00000000; /* Clear all bits in TC1_CMR */\ - *AT91C_TC1_CMR = *AT91C_TC1_CMR & 0xFFFF7FFF; /* Enable capture mode */\ + *AT91C_PMC_PCER = TIMER_1_ID13; /* Enable clock for TC1*/\ + *AT91C_TCB_BMR = AT91C_TCB_TC1XC1S_NONE; /* No external clock signal XC2 */\ + *AT91C_TCB_BCR = 0x0; /* Clear SYNC */\ + *AT91C_TC1_CMR = *AT91C_TC1_CMR & 0X00000000; /* Clear all bits in TC1_CMR */\ + *AT91C_TC1_CMR = *AT91C_TC1_CMR & 0xFFFF7FFF; /* Enable capture mode */\ *AT91C_TC1_CMR = *AT91C_TC1_CMR | AT91C_TC_CLKS_TIMER_DIV5_CLOCK; /* Set clock for timer to Clock5 = div 1024*/\ *AT91C_TC1_CMR = *AT91C_TC1_CMR | AT91C_TC_ABETRG; /* Use external trigger for TIO1*/\ *AT91C_TC1_CMR = *AT91C_TC1_CMR | AT91C_TC_EEVTEDG_BOTH; /* Trigger on both edges */\ @@ -118,14 +118,14 @@ static TACHOPARAMETERS MotorTachoValue[3]; *AT91C_PIOA_PPUDR = MOTOR_B_INT | MOTOR_B_DIR; /* Disable Pull Up resistor on PA26 & PA09 */\ *AT91C_PIOA_ODR = MOTOR_B_DIR; /* PA09 set to input */\ *AT91C_PIOA_IFER = MOTOR_B_INT | MOTOR_B_DIR; /* Enable filter on PA26 & PA09 */\ - *AT91C_PMC_PCER = TIMER_2_ID14; /* Enable clock for TC2*/\ - *AT91C_TCB_BMR = AT91C_TCB_TC2XC2S_NONE; /* No external clock signal */\ - *AT91C_TCB_BCR = 0x0; /* Clear SYNC */\ - *AT91C_TC2_CMR = *AT91C_TC2_CMR & 0X00000000; /* Clear all bits in TC1_CMR */\ - *AT91C_TC2_CMR = *AT91C_TC2_CMR & 0xFFFF7FFF; /* Enable capture mode */\ - *AT91C_TC2_CMR = *AT91C_TC2_CMR | AT91C_TC_CLKS_TIMER_DIV5_CLOCK; /* Set clock for timer to Clock5 = div 1024*/\ + *AT91C_PMC_PCER = TIMER_2_ID14; /* Enable clock for TC2*/\ + *AT91C_TCB_BMR = AT91C_TCB_TC2XC2S_NONE; /* No external clock signal */\ + *AT91C_TCB_BCR = 0x0; /* Clear SYNC */\ + *AT91C_TC2_CMR = *AT91C_TC2_CMR & 0X00000000; /* Clear all bits in TC1_CMR */\ + *AT91C_TC2_CMR = *AT91C_TC2_CMR & 0xFFFF7FFF; /* Enable capture mode */\ + *AT91C_TC2_CMR = *AT91C_TC2_CMR | AT91C_TC_CLKS_TIMER_DIV5_CLOCK; /* Set clock for timer to Clock5 = div 1024*/\ *AT91C_TC2_CMR = *AT91C_TC2_CMR | AT91C_TC_ABETRG; /* Use external trigger for TIO2*/\ - *AT91C_TC2_CMR = *AT91C_TC2_CMR | AT91C_TC_EEVTEDG_BOTH; /* Trigger on both edges */\ + *AT91C_TC2_CMR = *AT91C_TC2_CMR | AT91C_TC_EEVTEDG_BOTH; /* Trigger on both edges */\ *AT91C_TC2_CMR = *AT91C_TC2_CMR | AT91C_TC_LDRA_RISING; /* RA loading register set */\ *AT91C_AIC_IDCR = TIMER_2_ID14; /* Irq controller setup */\ AT91C_AIC_SVR[14] = (unsigned int)CaptureBInt; \ @@ -145,13 +145,13 @@ static TACHOPARAMETERS MotorTachoValue[3]; *AT91C_PIOA_PPUDR = MOTOR_C_INT | MOTOR_C_DIR; /* Disable Pull Up resistor on PA0 & PA08 */\ *AT91C_PIOA_ODR = MOTOR_C_DIR; /* PA08 set to input */\ *AT91C_PIOA_IFER = MOTOR_C_INT | MOTOR_C_DIR; /* Enable filter on PA26 & PA09 */\ - *AT91C_PMC_PCER = TIMER_0_ID12; /* Enable clock for TC0*/\ - *AT91C_TCB_BMR = AT91C_TCB_TC0XC0S_NONE; /* No external clock signal */\ - *AT91C_TC0_CMR = *AT91C_TC0_CMR & 0X00000000; /* Clear all bits in TC0_CMR */\ - *AT91C_TC0_CMR = *AT91C_TC0_CMR & 0xFFFF7FFF; /* Enable capture mode */\ - *AT91C_TC0_CMR = *AT91C_TC0_CMR | AT91C_TC_CLKS_TIMER_DIV5_CLOCK; /* Set clock for timer to Clock5 = div 1024*/\ - *AT91C_TC0_CMR = *AT91C_TC0_CMR | AT91C_TC_ABETRG; /* Use external trigger for TI0*/\ - *AT91C_TC0_CMR = *AT91C_TC0_CMR | AT91C_TC_EEVTEDG_BOTH; /* Trigger on both edges */\ + *AT91C_PMC_PCER = TIMER_0_ID12; /* Enable clock for TC0*/\ + *AT91C_TCB_BMR = AT91C_TCB_TC0XC0S_NONE; /* No external clock signal */\ + *AT91C_TC0_CMR = *AT91C_TC0_CMR & 0X00000000; /* Clear all bits in TC0_CMR */\ + *AT91C_TC0_CMR = *AT91C_TC0_CMR & 0xFFFF7FFF; /* Enable capture mode */\ + *AT91C_TC0_CMR = *AT91C_TC0_CMR | AT91C_TC_CLKS_TIMER_DIV5_CLOCK; /* Set clock for timer to Clock5 = div 1024*/\ + *AT91C_TC0_CMR = *AT91C_TC0_CMR | AT91C_TC_ABETRG; /* Use external trigger for TI0*/\ + *AT91C_TC0_CMR = *AT91C_TC0_CMR | AT91C_TC_EEVTEDG_BOTH; /* Trigger on both edges */\ *AT91C_TC0_CMR = *AT91C_TC0_CMR | AT91C_TC_LDRA_RISING; /* RA loading register set */\ *AT91C_AIC_IDCR = TIMER_0_ID12; /* Disable interrupt */\ AT91C_AIC_SVR[12] = (unsigned int)CaptureCInt; \ @@ -270,29 +270,29 @@ __ramfunc void CaptureCInt(void) } } -#define OUTPUTExit {\ - *AT91C_AIC_IDCR = TIMER_0_ID12 | TIMER_1_ID13 | TIMER_2_ID14; /* Disable interrupts for the timers */\ - *AT91C_AIC_ICCR = TIMER_0_ID12 | TIMER_1_ID13 | TIMER_2_ID14; /* Clear penting interrupt register for timers*/\ - *AT91C_PMC_PCDR = TIMER_0_ID12 | TIMER_1_ID13 | TIMER_2_ID14; /* Disable the clock for each of the timers*/\ - *AT91C_PIOA_PER = MOTOR_A_DIR | MOTOR_A_INT | MOTOR_B_DIR | MOTOR_B_INT | MOTOR_C_DIR | MOTOR_C_INT; /* Enable PIO on PA15, PA11, PA26, PA09, PA27 & PA08 */\ - *AT91C_PIOA_ODR = MOTOR_A_DIR | MOTOR_A_INT | MOTOR_B_DIR | MOTOR_B_INT | MOTOR_C_DIR | MOTOR_C_INT; /* Set to input PA15, PA11, PA26, PA09, PA27 & PA08 */\ - *AT91C_PIOA_PPUDR = MOTOR_A_DIR | MOTOR_A_INT | MOTOR_B_DIR | MOTOR_B_INT | MOTOR_C_DIR | MOTOR_C_INT; /* Enable Pullup on PA15, PA11, PA26, PA09, PA27 & PA08 */\ - } +#define OUTPUTExit {\ + *AT91C_AIC_IDCR = TIMER_0_ID12 | TIMER_1_ID13 | TIMER_2_ID14; /* Disable interrupts for the timers */\ + *AT91C_AIC_ICCR = TIMER_0_ID12 | TIMER_1_ID13 | TIMER_2_ID14; /* Clear penting interrupt register for timers*/\ + *AT91C_PMC_PCDR = TIMER_0_ID12 | TIMER_1_ID13 | TIMER_2_ID14; /* Disable the clock for each of the timers*/\ + *AT91C_PIOA_PER = MOTOR_A_DIR | MOTOR_A_INT | MOTOR_B_DIR | MOTOR_B_INT | MOTOR_C_DIR | MOTOR_C_INT; /* Enable PIO on PA15, PA11, PA26, PA09, PA27 & PA08 */\ + *AT91C_PIOA_ODR = MOTOR_A_DIR | MOTOR_A_INT | MOTOR_B_DIR | MOTOR_B_INT | MOTOR_C_DIR | MOTOR_C_INT; /* Set to input PA15, PA11, PA26, PA09, PA27 & PA08 */\ + *AT91C_PIOA_PPUDR = MOTOR_A_DIR | MOTOR_A_INT | MOTOR_B_DIR | MOTOR_B_INT | MOTOR_C_DIR | MOTOR_C_INT; /* Enable Pullup on PA15, PA11, PA26, PA09, PA27 & PA08 */\ + } -#define TACHOCountReset(MotorNr) {\ - MotorTachoValue[MotorNr].TachoCountTable = 0;\ - MotorTachoValue[MotorNr].TachoCountTableOld = 0;\ - } +#define TACHOCountReset(MotorNr) {\ + MotorTachoValue[MotorNr].TachoCountTable = 0;\ + MotorTachoValue[MotorNr].TachoCountTableOld = 0;\ + } #define TACHOCaptureReadResetAll(MotorDataA,MotorDataB,MotorDataC){\ - MotorDataA = (MotorTachoValue[MOTOR_A].TachoCountTable - MotorTachoValue[MOTOR_A].TachoCountTableOld);\ - MotorTachoValue[MOTOR_A].TachoCountTableOld = MotorTachoValue[MOTOR_A].TachoCountTable;\ - MotorDataB = (MotorTachoValue[MOTOR_B].TachoCountTable - MotorTachoValue[MOTOR_B].TachoCountTableOld);\ - MotorTachoValue[MOTOR_B].TachoCountTableOld = MotorTachoValue[MOTOR_B].TachoCountTable;\ - MotorDataC = (MotorTachoValue[MOTOR_C].TachoCountTable - MotorTachoValue[MOTOR_C].TachoCountTableOld);\ - MotorTachoValue[MOTOR_C].TachoCountTableOld = MotorTachoValue[MOTOR_C].TachoCountTable;\ - } + MotorDataA = (MotorTachoValue[MOTOR_A].TachoCountTable - MotorTachoValue[MOTOR_A].TachoCountTableOld);\ + MotorTachoValue[MOTOR_A].TachoCountTableOld = MotorTachoValue[MOTOR_A].TachoCountTable;\ + MotorDataB = (MotorTachoValue[MOTOR_B].TachoCountTable - MotorTachoValue[MOTOR_B].TachoCountTableOld);\ + MotorTachoValue[MOTOR_B].TachoCountTableOld = MotorTachoValue[MOTOR_B].TachoCountTable;\ + MotorDataC = (MotorTachoValue[MOTOR_C].TachoCountTable - MotorTachoValue[MOTOR_C].TachoCountTableOld);\ + MotorTachoValue[MOTOR_C].TachoCountTableOld = MotorTachoValue[MOTOR_C].TachoCountTable;\ + } diff --git a/AT91SAM7S256/Source/modules.h b/AT91SAM7S256/Source/modules.h index a5f3bb1..14a1780 100644 --- a/AT91SAM7S256/Source/modules.h +++ b/AT91SAM7S256/Source/modules.h @@ -66,7 +66,8 @@ enum FILETX_DSTEXISTS = 0x9800, FILETX_SRCMISSING = 0x9900, FILETX_STREAMERROR = 0x9A00, - FILETX_CLOSEERROR = 0x9B00 + FILETX_CLOSEERROR = 0x9B00, + INVALIDSEEK = 0x9C00 }; -- cgit v1.2.3