You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(75) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(70) |
Feb
(20) |
Mar
(52) |
Apr
(149) |
May
(387) |
Jun
(466) |
Jul
(133) |
Aug
(87) |
Sep
(122) |
Oct
(140) |
Nov
(185) |
Dec
(105) |
| 2010 |
Jan
(85) |
Feb
(45) |
Mar
(75) |
Apr
(17) |
May
(41) |
Jun
(52) |
Jul
(33) |
Aug
(29) |
Sep
(36) |
Oct
(15) |
Nov
(26) |
Dec
(34) |
| 2011 |
Jan
(26) |
Feb
(25) |
Mar
(26) |
Apr
(29) |
May
(20) |
Jun
(27) |
Jul
(15) |
Aug
(32) |
Sep
(13) |
Oct
(64) |
Nov
(60) |
Dec
(10) |
| 2012 |
Jan
(64) |
Feb
(63) |
Mar
(39) |
Apr
(43) |
May
(54) |
Jun
(11) |
Jul
(30) |
Aug
(45) |
Sep
(11) |
Oct
(70) |
Nov
(24) |
Dec
(23) |
| 2013 |
Jan
(17) |
Feb
(8) |
Mar
(35) |
Apr
(40) |
May
(20) |
Jun
(24) |
Jul
(36) |
Aug
(25) |
Sep
(42) |
Oct
(40) |
Nov
(9) |
Dec
(21) |
| 2014 |
Jan
(29) |
Feb
(24) |
Mar
(60) |
Apr
(22) |
May
(22) |
Jun
(46) |
Jul
(11) |
Aug
(23) |
Sep
(26) |
Oct
(10) |
Nov
(14) |
Dec
(2) |
| 2015 |
Jan
(28) |
Feb
(47) |
Mar
(33) |
Apr
(58) |
May
(5) |
Jun
(1) |
Jul
|
Aug
(8) |
Sep
(12) |
Oct
(25) |
Nov
(58) |
Dec
(21) |
| 2016 |
Jan
(12) |
Feb
(40) |
Mar
(2) |
Apr
(1) |
May
(67) |
Jun
(2) |
Jul
(5) |
Aug
(36) |
Sep
|
Oct
(24) |
Nov
(17) |
Dec
(50) |
| 2017 |
Jan
(14) |
Feb
(16) |
Mar
(2) |
Apr
(35) |
May
(14) |
Jun
(16) |
Jul
(3) |
Aug
(3) |
Sep
|
Oct
(19) |
Nov
|
Dec
(16) |
| 2018 |
Jan
(55) |
Feb
(11) |
Mar
(34) |
Apr
(14) |
May
(4) |
Jun
(20) |
Jul
(39) |
Aug
(16) |
Sep
(17) |
Oct
(16) |
Nov
(20) |
Dec
(30) |
| 2019 |
Jan
(29) |
Feb
(24) |
Mar
(37) |
Apr
(26) |
May
(19) |
Jun
(21) |
Jul
(2) |
Aug
(3) |
Sep
(9) |
Oct
(12) |
Nov
(12) |
Dec
(12) |
| 2020 |
Jan
(47) |
Feb
(36) |
Mar
(54) |
Apr
(44) |
May
(37) |
Jun
(19) |
Jul
(32) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(32) |
Dec
(11) |
| 2021 |
Jan
(14) |
Feb
(5) |
Mar
(40) |
Apr
(32) |
May
(42) |
Jun
(31) |
Jul
(29) |
Aug
(47) |
Sep
(38) |
Oct
(17) |
Nov
(74) |
Dec
(33) |
| 2022 |
Jan
(11) |
Feb
(15) |
Mar
(40) |
Apr
(21) |
May
(39) |
Jun
(44) |
Jul
(19) |
Aug
(46) |
Sep
(79) |
Oct
(35) |
Nov
(21) |
Dec
(15) |
| 2023 |
Jan
(56) |
Feb
(13) |
Mar
(43) |
Apr
(28) |
May
(60) |
Jun
(15) |
Jul
(29) |
Aug
(28) |
Sep
(32) |
Oct
(21) |
Nov
(42) |
Dec
(39) |
| 2024 |
Jan
(35) |
Feb
(17) |
Mar
(28) |
Apr
(7) |
May
(14) |
Jun
(35) |
Jul
(30) |
Aug
(35) |
Sep
(30) |
Oct
(28) |
Nov
(38) |
Dec
(18) |
| 2025 |
Jan
(21) |
Feb
(28) |
Mar
(36) |
Apr
(35) |
May
(34) |
Jun
(58) |
Jul
(9) |
Aug
(54) |
Sep
(47) |
Oct
(15) |
Nov
(68) |
Dec
(18) |
| 2026 |
Jan
(30) |
Feb
(31) |
Mar
(9) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <oh...@ma...> - 2008-12-19 20:45:05
|
Author: oharboe
Date: 2008-12-19 20:45:01 +0100 (Fri, 19 Dec 2008)
New Revision: 1264
Modified:
trunk/src/jtag/jtag.c
trunk/src/jtag/jtag.h
Log:
Dick Hollenbeck <di...@so...> better logging
Modified: trunk/src/jtag/jtag.c
===================================================================
--- trunk/src/jtag/jtag.c 2008-12-19 19:41:58 UTC (rev 1263)
+++ trunk/src/jtag/jtag.c 2008-12-19 19:45:01 UTC (rev 1264)
@@ -1300,7 +1300,7 @@
{
if (cmd->fields[i].in_handler(cmd->fields[i].in_value, cmd->fields[i].in_handler_priv, cmd->fields+i) != ERROR_OK)
{
- LOG_WARNING("in_handler reported a failed check");
+ LOG_WARNING("in_handler: with \"in_value\", mismatch in %s", cmd->ir_scan ? "SIR" : "SDR" );
retval = ERROR_JTAG_QUEUE_FAILED;
}
}
@@ -1314,7 +1314,7 @@
/* We're going to call the error:handler later, but if the in_handler
* reported an error we report this failure upstream
*/
- LOG_WARNING("in_handler reported a failed check");
+ LOG_WARNING("in_handler: w/o \"in_value\", mismatch in %s", cmd->ir_scan ? "SIR" : "SDR" );
retval = ERROR_JTAG_QUEUE_FAILED;
}
}
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2008-12-19 19:41:58 UTC (rev 1263)
+++ trunk/src/jtag/jtag.h 2008-12-19 19:45:01 UTC (rev 1264)
@@ -35,14 +35,14 @@
/* 16 Tap States, from page 21 of ASSET InterTech, Inc.'s svf.pdf
*/
-enum tap_state
+typedef enum tap_state
{
TAP_RESET = 0x0, TAP_IDLE = 0x8,
TAP_DRSELECT = 0x1, TAP_DRCAPTURE = 0x2, TAP_DRSHIFT = 0x3, TAP_DREXIT1 = 0x4,
TAP_DRPAUSE = 0x5, TAP_DREXIT2 = 0x6, TAP_DRUPDATE = 0x7,
TAP_IRSELECT = 0x9, TAP_IRCAPTURE = 0xa, TAP_IRSHIFT = 0xb, TAP_IREXIT1 = 0xc,
TAP_IRPAUSE = 0xd, TAP_IREXIT2 = 0xe, TAP_IRUPDATE = 0xf
-};
+} tap_state_t;
typedef struct tap_transition_s
{
@@ -530,7 +530,7 @@
/**
* Function jtag_state_name
- * Returns a string suitable for display representing the JTAG tap_state
+ * Returns a string suitable for display representing the JTAG tap_state
*/
const char* jtag_state_name(enum tap_state state);
|
|
From: <oh...@ma...> - 2008-12-19 20:42:00
|
Author: oharboe
Date: 2008-12-19 20:41:58 +0100 (Fri, 19 Dec 2008)
New Revision: 1263
Modified:
trunk/src/jtag/dummy.c
Log:
Dick Hollenbeck <di...@so...> - This patch adds JTAG state tracking to dummy.c
Modified: trunk/src/jtag/dummy.c
===================================================================
--- trunk/src/jtag/dummy.c 2008-12-19 19:40:38 UTC (rev 1262)
+++ trunk/src/jtag/dummy.c 2008-12-19 19:41:58 UTC (rev 1263)
@@ -26,6 +26,15 @@
#include "jtag.h"
#include "bitbang.h"
+
+/* my private tap controller state, which tracks state for calling code */
+static tap_state_t dummy_state = TAP_RESET;
+
+static int dummy_clock; /* edge detector */
+
+static tap_state_t tap_state_transition(tap_state_t cur_state, int tms);
+
+
int dummy_speed(int speed);
int dummy_register_commands(struct command_context_s *cmd_ctx);
int dummy_init(void);
@@ -70,12 +79,28 @@
return 1;
}
+
void dummy_write(int tck, int tms, int tdi)
{
+ /* TAP standard: "state transitions occur on rising edge of clock" */
+ if( tck != dummy_clock )
+ {
+ if( tck )
+ {
+ int old_state = dummy_state;
+ dummy_state = tap_state_transition( dummy_state, tms );
+ if( old_state != dummy_state )
+ LOG_INFO( "dummy_tap=%s", jtag_state_name(dummy_state) );
+ }
+ dummy_clock = tck;
+ }
}
void dummy_reset(int trst, int srst)
{
+ dummy_clock = 0;
+ dummy_state = TAP_RESET;
+ LOG_DEBUG( "reset to %s", jtag_state_name(dummy_state) );
}
static int dummy_khz(int khz, int *jtag_speed)
@@ -130,3 +155,107 @@
void dummy_led(int on)
{
}
+
+
+/**
+ * Function tap_state_transition
+ * takes a current TAP state and returns the next state according to the tms value.
+ *
+ * Even though there is code to duplicate this elsewhere, we do it here a little
+ * differently just to get a second opinion, i.e. a verification, on state tracking
+ * in that other logic. Plus array lookups without index checking are no favorite thing.
+ * This is educational for developers new to TAP controllers.
+ */
+static tap_state_t tap_state_transition(tap_state_t cur_state, int tms)
+{
+ tap_state_t new_state;
+
+ if (tms)
+ {
+ switch (cur_state)
+ {
+ case TAP_RESET:
+ new_state = cur_state;
+ break;
+ case TAP_IDLE:
+ case TAP_DRUPDATE:
+ case TAP_IRUPDATE:
+ new_state = TAP_DRSELECT;
+ break;
+ case TAP_DRSELECT:
+ new_state = TAP_IRSELECT;
+ break;
+ case TAP_DRCAPTURE:
+ case TAP_DRSHIFT:
+ new_state = TAP_DREXIT1;
+ break;
+ case TAP_DREXIT1:
+ case TAP_DREXIT2:
+ new_state = TAP_DRUPDATE;
+ break;
+ case TAP_DRPAUSE:
+ new_state = TAP_DREXIT2;
+ break;
+ case TAP_IRSELECT:
+ new_state = TAP_RESET;
+ break;
+ case TAP_IRCAPTURE:
+ case TAP_IRSHIFT:
+ new_state = TAP_IREXIT1;
+ break;
+ case TAP_IREXIT1:
+ case TAP_IREXIT2:
+ new_state = TAP_IRUPDATE;
+ break;
+ case TAP_IRPAUSE:
+ new_state = TAP_IREXIT2;
+ break;
+ default:
+ LOG_ERROR( "fatal: invalid argument cur_state=%d", cur_state );
+ exit(1);
+ break;
+ }
+ }
+ else
+ {
+ switch (cur_state)
+ {
+ case TAP_RESET:
+ case TAP_IDLE:
+ case TAP_DRUPDATE:
+ case TAP_IRUPDATE:
+ new_state = TAP_IDLE;
+ break;
+ case TAP_DRSELECT:
+ new_state = TAP_DRCAPTURE;
+ break;
+ case TAP_DRCAPTURE:
+ case TAP_DRSHIFT:
+ case TAP_DREXIT2:
+ new_state = TAP_DRSHIFT;
+ break;
+ case TAP_DREXIT1:
+ case TAP_DRPAUSE:
+ new_state = TAP_DRPAUSE;
+ break;
+ case TAP_IRSELECT:
+ new_state = TAP_IRCAPTURE;
+ break;
+ case TAP_IRCAPTURE:
+ case TAP_IRSHIFT:
+ case TAP_IREXIT2:
+ new_state = TAP_IRSHIFT;
+ break;
+ case TAP_IREXIT1:
+ case TAP_IRPAUSE:
+ new_state = TAP_IRPAUSE;
+ break;
+ default:
+ LOG_ERROR( "fatal: invalid argument cur_state=%d", cur_state );
+ exit(1);
+ break;
+ }
+ }
+
+ return new_state;
+}
|
|
From: <oh...@ma...> - 2008-12-19 20:40:40
|
Author: oharboe
Date: 2008-12-19 20:40:38 +0100 (Fri, 19 Dec 2008)
New Revision: 1262
Modified:
trunk/src/helper/log.c
Log:
Dick Hollenbeck <di...@so...> better logging
Modified: trunk/src/helper/log.c
===================================================================
--- trunk/src/helper/log.c 2008-12-19 14:48:00 UTC (rev 1261)
+++ trunk/src/helper/log.c 2008-12-19 19:40:38 UTC (rev 1262)
@@ -55,13 +55,14 @@
static char *log_strings[5] =
{
- "User: ",
- "Error: ",
- "Warning:",
- "Info: ",
- "Debug: "
+ "User : ",
+ "Error: ",
+ "Warn : ", /* want a space after each colon, all same width, colons aligned */
+ "Info : ",
+ "Debug: "
};
+
static int count = 0;
/* The log_puts() serves to somewhat different goals:
@@ -99,7 +100,7 @@
struct mallinfo info;
info = mallinfo();
#endif
- fprintf(log_output, "%s %d %d %s:%d %s()"
+ fprintf(log_output, "%s%d %d %s:%d %s()"
#if PRINT_MEM()
" %d"
#endif
@@ -217,7 +218,7 @@
LOG_WARNING("enabling log output as we are using pipes");
}
}
-
+
return ERROR_OK;
}
|
|
From: <oh...@ma...> - 2008-12-19 15:48:02
|
Author: oharboe Date: 2008-12-19 15:48:00 +0100 (Fri, 19 Dec 2008) New Revision: 1261 Modified: trunk/src/helper/types.h Log: Dick Hollenbeck <di...@so...> better comments Modified: trunk/src/helper/types.h =================================================================== --- trunk/src/helper/types.h 2008-12-19 13:58:15 UTC (rev 1260) +++ trunk/src/helper/types.h 2008-12-19 14:48:00 UTC (rev 1261) @@ -46,18 +46,22 @@ typedef struct jtag_tap_s jtag_tap_t; -/* DANGER!!!! here be dragons! - * +/* DANGER!!!! here be dragons! + * * Leave these fn's as byte accesses because it is safe * across architectures. Clever usage of 32 bit access * will create problems on some hosts. - * - * Note that the pointer in memory might be unaligned. - * - * On some CPU's, i.e. ARM7, the 2 lsb are ignored for 32 - * bit access, on others it will cause an exception and - * on e.g. x86, it works the same as if aligned. - * + * + * Note that the "buf" pointer in memory is probably unaligned. + * + * Were these functions to be re-written to take a 32 bit wide or 16 bit wide + * memory access shortcut, then on some CPU's, i.e. ARM7, the 2 lsbytes of the address are + * ignored for 32 bit access, whereas on other CPU's a 32 bit wide unaligned memory access + * will cause an exception, and lastly on x86, an unaligned "greater than bytewide" + * memory access works as if aligned. So what follows below will work for all + * platforms and gives the compiler leeway to do its own platform specific optimizations. + * + * Again, note that the "buf" pointer in memory is probably unaligned. */ |
|
From: ntfreak at B. <nt...@ma...> - 2008-12-19 14:58:16
|
Author: ntfreak
Date: 2008-12-19 14:58:15 +0100 (Fri, 19 Dec 2008)
New Revision: 1260
Added:
trunk/src/target/interface/rlink.cfg
Modified:
trunk/src/helper/replacements.h
trunk/src/jtag/rlink/call.m4
trunk/src/jtag/rlink/init.m4
trunk/src/jtag/rlink/rlink.c
trunk/src/server/httpd.c
trunk/tools/rlink_make_speed_table/rlink_make_speed_table
trunk/tools/rlink_make_speed_table/rlink_make_speed_table.pl
trunk/tools/st7_dtc_as/st7_dtc_as
trunk/tools/st7_dtc_as/st7_dtc_as.pl
Log:
- fix rlink build under native win32 (mingw)
- remove rlink build warnings
- add usb_set_configuration to rlink_init, win32 requires this
- add win32 ETIMEDOUT define
Modified: trunk/src/helper/replacements.h
===================================================================
--- trunk/src/helper/replacements.h 2008-12-19 06:49:34 UTC (rev 1259)
+++ trunk/src/helper/replacements.h 2008-12-19 13:58:15 UTC (rev 1260)
@@ -84,7 +84,6 @@
/* gettimeofday() */
#ifndef HAVE_GETTIMEOFDAY
-
#ifdef _WIN32
struct timezone {
int tz_minuteswest;
@@ -161,6 +160,12 @@
#include <windows.h>
#include <time.h>
+/* win32 systems do not support ETIMEDOUT */
+
+#ifndef ETIMEDOUT
+#define ETIMEDOUT WSAETIMEDOUT
+#endif
+
#if IS_MINGW == 1
static __inline unsigned char inb(unsigned short int port)
{
Property changes on: trunk/src/jtag/rlink/call.m4
___________________________________________________________________
Name: svn:eol-style
+ LF
Modified: trunk/src/jtag/rlink/init.m4
===================================================================
--- trunk/src/jtag/rlink/init.m4 2008-12-19 06:49:34 UTC (rev 1259)
+++ trunk/src/jtag/rlink/init.m4 2008-12-19 13:58:15 UTC (rev 1260)
@@ -1,74 +1,74 @@
-m4_divert(`-1')
-/***************************************************************************
- * Copyright (C) 2008 Lou Deluxe *
- * lou...@fi... *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
-
-m4_undefine(`CTRL_MPEG_L')
-m4_undefine(`CTRL_CARD_L')
-
-m4_ifelse(SHIFTER_PRESCALER, 1, `
- m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x0')')
-')
-m4_ifelse(SHIFTER_PRESCALER, 2, `
- m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x2')')
- m4_define(`CTRL_CARD_L', `m4_eval(`0x8 | 0x1')')
-')
-m4_ifelse(SHIFTER_PRESCALER, 8, `
- m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x3')')
-')
-m4_ifelse(SHIFTER_PRESCALER, 11, `
- m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x4')')
-')
-m4_ifelse(SHIFTER_PRESCALER, 64, `
- m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x7')')
-')
-
-m4_ifdef(`CTRL_MPEG_L',,`
- m4_errprint(`SHIFTER_PRESCALER was not defined with a supported value
-') m4_m4exit(`1')
-')
-
-m4_divert(`0')m4_dnl
-
-init:
- A.H = 0
-
- A.L = 0
-
- DR_MPEG = A ; TDI and TCK start out low
- DR_CARD = A ; TMS starts out low
-
- A.L = 0x6
-
- CTRL_FCI = A ; MPEG and CARD driven by FCI
- DDR_MPEG = A ; TDI and TCK are outputs
-
- A.L = 0x1
-
- X = A ; X == 1
- DDR_CARD = A ; TMS is output
-
- A.L = CTRL_MPEG_L
- CTRL_MPEG = A
-m4_ifdef(`CTRL_CARD_L',
-` A.L = 'CTRL_CARD_L`
-')m4_dnl
- CTRL_CARD = A
-
- STATUS STOP
+m4_divert(`-1')
+/***************************************************************************
+ * Copyright (C) 2008 Lou Deluxe *
+ * lou...@fi... *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+m4_undefine(`CTRL_MPEG_L')
+m4_undefine(`CTRL_CARD_L')
+
+m4_ifelse(SHIFTER_PRESCALER, 1, `
+ m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x0')')
+')
+m4_ifelse(SHIFTER_PRESCALER, 2, `
+ m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x2')')
+ m4_define(`CTRL_CARD_L', `m4_eval(`0x8 | 0x1')')
+')
+m4_ifelse(SHIFTER_PRESCALER, 8, `
+ m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x3')')
+')
+m4_ifelse(SHIFTER_PRESCALER, 11, `
+ m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x4')')
+')
+m4_ifelse(SHIFTER_PRESCALER, 64, `
+ m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x7')')
+')
+
+m4_ifdef(`CTRL_MPEG_L',,`
+ m4_errprint(`SHIFTER_PRESCALER was not defined with a supported value
+') m4_m4exit(`1')
+')
+
+m4_divert(`0')m4_dnl
+
+init:
+ A.H = 0
+
+ A.L = 0
+
+ DR_MPEG = A ; TDI and TCK start out low
+ DR_CARD = A ; TMS starts out low
+
+ A.L = 0x6
+
+ CTRL_FCI = A ; MPEG and CARD driven by FCI
+ DDR_MPEG = A ; TDI and TCK are outputs
+
+ A.L = 0x1
+
+ X = A ; X == 1
+ DDR_CARD = A ; TMS is output
+
+ A.L = CTRL_MPEG_L
+ CTRL_MPEG = A
+m4_ifdef(`CTRL_CARD_L',
+` A.L = 'CTRL_CARD_L`
+')m4_dnl
+ CTRL_CARD = A
+
+ STATUS STOP
Property changes on: trunk/src/jtag/rlink/init.m4
___________________________________________________________________
Name: svn:eol-style
+ LF
Modified: trunk/src/jtag/rlink/rlink.c
===================================================================
--- trunk/src/jtag/rlink/rlink.c 2008-12-19 06:49:34 UTC (rev 1259)
+++ trunk/src/jtag/rlink/rlink.c 2008-12-19 13:58:15 UTC (rev 1260)
@@ -31,6 +31,7 @@
#include <errno.h>
#include <string.h>
#include <usb.h>
+#include <stdint.h>
/* project specific includes */
#include "log.h"
@@ -1034,7 +1035,6 @@
int tdi_bit_offset;
u8 tdi_mask, *tdi_p;
u8 dtc_mask;
- dtc_reply_queue_entry_t *rq_entry;
if(scan_size < 1) {
LOG_ERROR("scan_size cannot be less than 1 bit\n");
@@ -1555,7 +1555,7 @@
{
struct usb_bus *busses;
struct usb_bus *bus;
- int c, i, a, j, retries,len;
+ int i, j, retries;
int found=0;
int success=0;
u8 reply_buffer[USB_EP1IN_SIZE];
@@ -1597,6 +1597,9 @@
{
LOG_DEBUG("Opened device, pHDev = %p\n",pHDev);
+ /* usb_set_configuration required under win32 */
+ usb_set_configuration(pHDev, dev->config[0].bConfigurationValue);
+
retries = 3;
do
{
Modified: trunk/src/server/httpd.c
===================================================================
--- trunk/src/server/httpd.c 2008-12-19 06:49:34 UTC (rev 1259)
+++ trunk/src/server/httpd.c 2008-12-19 13:58:15 UTC (rev 1260)
@@ -1,457 +1,457 @@
-/***************************************************************************
- * Copyright (C) 2007,2008 vind Harboe *
- * oyv...@zy... *
- * *
- * Copyright (C) 2008 Free Software Foundation
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
-
-/* some bits were copied from ahttpd which is under eCos license and
- * copyright to FSF
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "replacements.h"
-
-#include "server.h"
-
-#include "log.h"
-#include "telnet_server.h"
-#include "target.h"
-
-#include <command.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <signal.h>
-
-#include <sys/types.h>
-#include <sys/select.h>
-#include <sys/socket.h>
-#include <microhttpd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#define PAGE_NOT_FOUND "<html><head><title>File not found</title></head><body>File not found</body></html>"
-
-static const char *appendf(const *prev, const char *format, ...)
-{
- va_list ap;
- va_start(ap, format);
- char *string = alloc_vprintf(format, ap);
- va_end(ap);
- char *string2 = NULL;
-
- if (string != NULL)
- {
- string2 = alloc_printf("%s%s", (prev == NULL) ? "" : prev, string);
- }
-
- if (prev != NULL)
- {
- free(prev);
- }
-
- if (string == NULL)
- free(string);
-
- return string2;
-}
-
-static const char *httpd_exec_cgi_tcl_error(Jim_Interp *interp)
-{
- int len, i;
-
- const char *t = NULL;
- t = appendf(t, "<html><body>\n");
-
- t = appendf(t, "Runtime error, file \"%s\", line %d:<br>",
- interp->errorFileName, interp->errorLine);
- t = appendf(t, " %s<br>", Jim_GetString(interp->result, NULL));
- Jim_ListLength(interp, interp->stackTrace, &len);
- for (i = 0; i < len; i += 3)
- {
- Jim_Obj *objPtr;
- const char *proc, *file, *line;
-
- Jim_ListIndex(interp, interp->stackTrace, i, &objPtr, JIM_NONE);
- proc = Jim_GetString(objPtr, NULL);
- Jim_ListIndex(interp, interp->stackTrace, i + 1, &objPtr, JIM_NONE);
- file = Jim_GetString(objPtr, NULL);
- Jim_ListIndex(interp, interp->stackTrace, i + 2, &objPtr, JIM_NONE);
- line = Jim_GetString(objPtr, NULL);
- t = appendf(t, "In procedure '%s' called at file \"%s\", line %s<br>",
- proc, file, line);
- }
- t = appendf(t, "</html></body>\n");
-
- return t;
-}
-
-static int httpd_Jim_Command_writeform(Jim_Interp *interp, int argc,
- Jim_Obj * const *argv)
-{
- if (argc != 3)
- {
- Jim_WrongNumArgs(interp, 1, argv, "method ?args ...?");
- return JIM_ERR;
- }
- char *name = (char*) Jim_GetString(argv[1], NULL);
- char *file = (char*) Jim_GetString(argv[2], NULL);
-
- // Find length
- char *data;
- int actual;
-
- int retcode;
-
- const char *script = alloc_printf("set dummy_val $httppostdata(%s); set dummy_val",
- name);
- retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__ );
- free((void *) script);
- if (retcode != JIM_OK)
- return retcode;
-
- data = Jim_GetString(Jim_GetResult(interp), &actual);
-
- FILE *f;
- f = fopen(file, "wb");
- if (f != NULL)
- {
- int ok;
- ok = fwrite(data, 1, actual, f) == actual;
- fclose(f);
-
- if (!ok)
- {
- Jim_SetResultString(interp, "Could not write to file", -1);
- return JIM_ERR;
- }
- }
- else
- {
- Jim_SetResultString(interp, "Could not create file", -1);
- return JIM_ERR;
- }
- return JIM_OK;
-}
-
-
-int
-httpd_Jim_Command_formfetch(Jim_Interp *interp,
- int argc,
- Jim_Obj *const *argv)
-{
- if (argc!=2)
- {
- Jim_WrongNumArgs(interp, 1, argv, "method ?args ...?");
- return JIM_ERR;
- }
- char *name = (char*)Jim_GetString(argv[1], NULL);
-
-
- const char *script = alloc_printf("set dummy_val $httppostdata(%s); set dummy_val",
- name);
- int retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__ );
- free((void *) script);
- if (retcode != JIM_OK)
- {
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- } else
- {
- Jim_SetResult(interp, Jim_GetResult(interp));
- }
-
- return JIM_OK;
-}
-
-struct httpd_request
-{
- int post;
- struct MHD_PostProcessor *postprocessor;
-
- //Jim_Obj *dict;
-
- int complete; /* did we receive the entire post ? */
-
-};
-
-static void request_completed(void *cls, struct MHD_Connection *connection,
- void **con_cls, enum MHD_RequestTerminationCode toe)
-{
- struct httpd_request *r = (struct httpd_request*) *con_cls;
-
- if (NULL == r)
- return;
-
- if (r->postprocessor)
- {
- MHD_destroy_post_processor(r->postprocessor);
- }
-
- free(r);
- *con_cls = NULL;
-}
-
-/* append to said key in dictonary */
-static void append_key(struct httpd_request *r, const char *key,
- const char *data, size_t off, size_t size)
-{
- Jim_Obj *keyObj = Jim_NewStringObj(interp, key, -1);
- Jim_Obj *value = NULL;
-
- Jim_Obj *dict = Jim_GetVariableStr(interp, "httppostdata", 0);
-
- if (dict!=NULL)
- {
- if (Jim_DictKey(interp, dict, keyObj, &value, 0) != JIM_OK)
- {
- value = NULL;
- }
- }
- if (value == NULL)
- value = Jim_NewStringObj(interp, "", -1);
-
- /* create a new object we append to and insert into this location */
- Jim_Obj *newObj = Jim_NewStringObj(interp, "", -1);
- Jim_AppendObj(interp, newObj, value);
- Jim_AppendString(interp, newObj, data, size);
- /* uhh... use name here of dictionary */
- Jim_SetDictKeysVector(interp, Jim_NewStringObj(interp, "httppostdata", -1), &keyObj, 1, newObj);
-}
-
-/* append data to each key */
-static int iterate_post(void *con_cls, enum MHD_ValueKind kind,
- const char *key, const char *filename, const char *content_type,
- const char *transfer_encoding, const char *data, size_t off,
- size_t size)
-{
- struct httpd_request *r = (struct httpd_request*) con_cls;
-
- append_key(r, key, data, off, size);
-
- return MHD_YES;
-}
-
-static int record_arg(void *cls, enum MHD_ValueKind kind, const char *key,
- const char *value)
-{
- struct httpd_request *r = (struct httpd_request*) cls;
- append_key(r, key, value, 0, strlen(value));
- return MHD_YES;
-}
-
-static int ahc_echo(void * cls, struct MHD_Connection * connection,
- const char * url, const char * method, const char * version,
- const char * upload_data, unsigned int * upload_data_size, void ** ptr)
-{
- struct MHD_Response * response;
- int ret;
-
- int post = 0;
-
- if (0 == strcmp(method, "POST"))
- {
- post = 1;
- }
- else if (0 == strcmp(method, "GET"))
- {
- }
- else
- {
- return MHD_NO; /* unexpected method */
- }
-
- struct httpd_request *r;
- if (*ptr == NULL)
- {
- /* The first time only the headers are valid,
- do not respond in the first round... */
-
- *ptr = malloc(sizeof(struct httpd_request));
- if (*ptr == NULL)
- return MHD_NO;
- memset(*ptr, 0, sizeof(struct httpd_request));
-
- r = (struct httpd_request *) *ptr;
-
- r->post = post;
- Jim_SetVariableStr(interp, "httppostdata", Jim_NewDictObj(interp, NULL, 0));
-
- /* fill in url query strings in dictonary */
- MHD_get_connection_values(connection, MHD_GET_ARGUMENT_KIND,
- record_arg, r);
-
- if (r->post)
- {
- r->postprocessor = MHD_create_post_processor(connection, 2048
- * 1024, iterate_post, r);
- }
-
- return MHD_YES;
- }
-
- r = (struct httpd_request *) *ptr;
-
- if (r->post)
- {
- /* consume post data */
- if (*upload_data_size)
- {
- MHD_post_process(r->postprocessor, upload_data, *upload_data_size);
- *upload_data_size = 0;
- return MHD_YES;
- }
- else
- {
- }
- } else
- {
- }
-
- /* hand over to request who will be using it. */
- // r->dict = NULL;
-
-
- /* FIX!!!! we need more advanced handling of url's to avoid them
- * being subverted to evil purposes
- */
-
- url++; /* skip '/' */
-
- const char *suffix;
- suffix = strrchr(url, '.');
- if ((suffix != NULL) && (strcmp(suffix, ".tcl") == 0))
- {
- printf("Run tcl %s\n", url);
-
- int retcode;
-
- const char *script = alloc_printf(
- "global httpdata; source {%s}; set httpdata", url);
- retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__ );
- free((void *) script);
-
- if (retcode == JIM_ERR)
- {
- printf("Tcl failed\n");
- const char *t = httpd_exec_cgi_tcl_error(interp);
- if (t == NULL)
- return MHD_NO;
-
- response = MHD_create_response_from_data(strlen(t), (void *) t,
- MHD_YES, MHD_NO);
- ret = MHD_queue_response(connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR, response);
- MHD_destroy_response(response);
- return ret;
- }
- else
- {
- printf("Tcl OK\n");
- /* FIX!!! how to handle mime types??? */
- const char *result;
- int reslen;
- result = Jim_GetString(Jim_GetResult(interp), &reslen);
-
- response = MHD_create_response_from_data(reslen, (void *) result,
- MHD_NO, MHD_YES);
- ret = MHD_queue_response(connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR, response);
- MHD_destroy_response(response);
- return ret;
- }
- }
- else
- {
- void *data;
- int len;
-
- int retval = loadFile(url, &data, &len);
- if (retval != ERROR_OK)
- {
- printf("Did not find %s\n", url);
-
- response = MHD_create_response_from_data(strlen(PAGE_NOT_FOUND),
- (void *) PAGE_NOT_FOUND, MHD_NO, MHD_NO);
- ret = MHD_queue_response(connection, MHD_HTTP_NOT_FOUND, response);
- MHD_destroy_response(response);
- return ret;
- }
-
- printf("Serving %s length=%d\n", url, len);
- /* serve file directly */
- response = MHD_create_response_from_data(len, data, MHD_YES, MHD_NO);
- MHD_add_response_header(response, "Content-Type", "image/png");
-
- ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
- MHD_destroy_response(response);
-
- //free(data);
- return ret;
- }
-}
-
-static struct MHD_Daemon * d;
-
-int httpd_start(void)
-{
-
- int port = 8888;
- LOG_USER("Launching httpd server on port %d", port);
- d = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, port, NULL, NULL,
- &ahc_echo, NULL, /* could be data for handler, but we only have a single handler, use global variables instead */
- MHD_OPTION_NOTIFY_COMPLETED, request_completed, NULL, /* Closure... what's that??? */
- MHD_OPTION_END);
- if (d == NULL)
- return ERROR_FAIL;
-
- Jim_CreateCommand(interp,
- "formfetch",
- httpd_Jim_Command_formfetch,
- NULL,
- NULL);
-
- Jim_CreateCommand(interp,
- "writeform",
- httpd_Jim_Command_writeform,
- NULL,
- NULL);
-
-
- return ERROR_OK;
-}
-
-void httpd_stop(void)
-{
- MHD_stop_daemon(d);
-}
-
-void openocd_sleep_prelude(void)
-{
-}
-
-void openocd_sleep_postlude(void)
-{
-}
-
+/***************************************************************************
+ * Copyright (C) 2007,2008 vind Harboe *
+ * oyv...@zy... *
+ * *
+ * Copyright (C) 2008 Free Software Foundation
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+/* some bits were copied from ahttpd which is under eCos license and
+ * copyright to FSF
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "replacements.h"
+
+#include "server.h"
+
+#include "log.h"
+#include "telnet_server.h"
+#include "target.h"
+
+#include <command.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <signal.h>
+
+#include <sys/types.h>
+#include <sys/select.h>
+#include <sys/socket.h>
+#include <microhttpd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#define PAGE_NOT_FOUND "<html><head><title>File not found</title></head><body>File not found</body></html>"
+
+static const char *appendf(const *prev, const char *format, ...)
+{
+ va_list ap;
+ va_start(ap, format);
+ char *string = alloc_vprintf(format, ap);
+ va_end(ap);
+ char *string2 = NULL;
+
+ if (string != NULL)
+ {
+ string2 = alloc_printf("%s%s", (prev == NULL) ? "" : prev, string);
+ }
+
+ if (prev != NULL)
+ {
+ free(prev);
+ }
+
+ if (string == NULL)
+ free(string);
+
+ return string2;
+}
+
+static const char *httpd_exec_cgi_tcl_error(Jim_Interp *interp)
+{
+ int len, i;
+
+ const char *t = NULL;
+ t = appendf(t, "<html><body>\n");
+
+ t = appendf(t, "Runtime error, file \"%s\", line %d:<br>",
+ interp->errorFileName, interp->errorLine);
+ t = appendf(t, " %s<br>", Jim_GetString(interp->result, NULL));
+ Jim_ListLength(interp, interp->stackTrace, &len);
+ for (i = 0; i < len; i += 3)
+ {
+ Jim_Obj *objPtr;
+ const char *proc, *file, *line;
+
+ Jim_ListIndex(interp, interp->stackTrace, i, &objPtr, JIM_NONE);
+ proc = Jim_GetString(objPtr, NULL);
+ Jim_ListIndex(interp, interp->stackTrace, i + 1, &objPtr, JIM_NONE);
+ file = Jim_GetString(objPtr, NULL);
+ Jim_ListIndex(interp, interp->stackTrace, i + 2, &objPtr, JIM_NONE);
+ line = Jim_GetString(objPtr, NULL);
+ t = appendf(t, "In procedure '%s' called at file \"%s\", line %s<br>",
+ proc, file, line);
+ }
+ t = appendf(t, "</html></body>\n");
+
+ return t;
+}
+
+static int httpd_Jim_Command_writeform(Jim_Interp *interp, int argc,
+ Jim_Obj * const *argv)
+{
+ if (argc != 3)
+ {
+ Jim_WrongNumArgs(interp, 1, argv, "method ?args ...?");
+ return JIM_ERR;
+ }
+ char *name = (char*) Jim_GetString(argv[1], NULL);
+ char *file = (char*) Jim_GetString(argv[2], NULL);
+
+ // Find length
+ char *data;
+ int actual;
+
+ int retcode;
+
+ const char *script = alloc_printf("set dummy_val $httppostdata(%s); set dummy_val",
+ name);
+ retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__ );
+ free((void *) script);
+ if (retcode != JIM_OK)
+ return retcode;
+
+ data = Jim_GetString(Jim_GetResult(interp), &actual);
+
+ FILE *f;
+ f = fopen(file, "wb");
+ if (f != NULL)
+ {
+ int ok;
+ ok = fwrite(data, 1, actual, f) == actual;
+ fclose(f);
+
+ if (!ok)
+ {
+ Jim_SetResultString(interp, "Could not write to file", -1);
+ return JIM_ERR;
+ }
+ }
+ else
+ {
+ Jim_SetResultString(interp, "Could not create file", -1);
+ return JIM_ERR;
+ }
+ return JIM_OK;
+}
+
+
+int
+httpd_Jim_Command_formfetch(Jim_Interp *interp,
+ int argc,
+ Jim_Obj *const *argv)
+{
+ if (argc!=2)
+ {
+ Jim_WrongNumArgs(interp, 1, argv, "method ?args ...?");
+ return JIM_ERR;
+ }
+ char *name = (char*)Jim_GetString(argv[1], NULL);
+
+
+ const char *script = alloc_printf("set dummy_val $httppostdata(%s); set dummy_val",
+ name);
+ int retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__ );
+ free((void *) script);
+ if (retcode != JIM_OK)
+ {
+ Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
+ } else
+ {
+ Jim_SetResult(interp, Jim_GetResult(interp));
+ }
+
+ return JIM_OK;
+}
+
+struct httpd_request
+{
+ int post;
+ struct MHD_PostProcessor *postprocessor;
+
+ //Jim_Obj *dict;
+
+ int complete; /* did we receive the entire post ? */
+
+};
+
+static void request_completed(void *cls, struct MHD_Connection *connection,
+ void **con_cls, enum MHD_RequestTerminationCode toe)
+{
+ struct httpd_request *r = (struct httpd_request*) *con_cls;
+
+ if (NULL == r)
+ return;
+
+ if (r->postprocessor)
+ {
+ MHD_destroy_post_processor(r->postprocessor);
+ }
+
+ free(r);
+ *con_cls = NULL;
+}
+
+/* append to said key in dictonary */
+static void append_key(struct httpd_request *r, const char *key,
+ const char *data, size_t off, size_t size)
+{
+ Jim_Obj *keyObj = Jim_NewStringObj(interp, key, -1);
+ Jim_Obj *value = NULL;
+
+ Jim_Obj *dict = Jim_GetVariableStr(interp, "httppostdata", 0);
+
+ if (dict!=NULL)
+ {
+ if (Jim_DictKey(interp, dict, keyObj, &value, 0) != JIM_OK)
+ {
+ value = NULL;
+ }
+ }
+ if (value == NULL)
+ value = Jim_NewStringObj(interp, "", -1);
+
+ /* create a new object we append to and insert into this location */
+ Jim_Obj *newObj = Jim_NewStringObj(interp, "", -1);
+ Jim_AppendObj(interp, newObj, value);
+ Jim_AppendString(interp, newObj, data, size);
+ /* uhh... use name here of dictionary */
+ Jim_SetDictKeysVector(interp, Jim_NewStringObj(interp, "httppostdata", -1), &keyObj, 1, newObj);
+}
+
+/* append data to each key */
+static int iterate_post(void *con_cls, enum MHD_ValueKind kind,
+ const char *key, const char *filename, const char *content_type,
+ const char *transfer_encoding, const char *data, size_t off,
+ size_t size)
+{
+ struct httpd_request *r = (struct httpd_request*) con_cls;
+
+ append_key(r, key, data, off, size);
+
+ return MHD_YES;
+}
+
+static int record_arg(void *cls, enum MHD_ValueKind kind, const char *key,
+ const char *value)
+{
+ struct httpd_request *r = (struct httpd_request*) cls;
+ append_key(r, key, value, 0, strlen(value));
+ return MHD_YES;
+}
+
+static int ahc_echo(void * cls, struct MHD_Connection * connection,
+ const char * url, const char * method, const char * version,
+ const char * upload_data, unsigned int * upload_data_size, void ** ptr)
+{
+ struct MHD_Response * response;
+ int ret;
+
+ int post = 0;
+
+ if (0 == strcmp(method, "POST"))
+ {
+ post = 1;
+ }
+ else if (0 == strcmp(method, "GET"))
+ {
+ }
+ else
+ {
+ return MHD_NO; /* unexpected method */
+ }
+
+ struct httpd_request *r;
+ if (*ptr == NULL)
+ {
+ /* The first time only the headers are valid,
+ do not respond in the first round... */
+
+ *ptr = malloc(sizeof(struct httpd_request));
+ if (*ptr == NULL)
+ return MHD_NO;
+ memset(*ptr, 0, sizeof(struct httpd_request));
+
+ r = (struct httpd_request *) *ptr;
+
+ r->post = post;
+ Jim_SetVariableStr(interp, "httppostdata", Jim_NewDictObj(interp, NULL, 0));
+
+ /* fill in url query strings in dictonary */
+ MHD_get_connection_values(connection, MHD_GET_ARGUMENT_KIND,
+ record_arg, r);
+
+ if (r->post)
+ {
+ r->postprocessor = MHD_create_post_processor(connection, 2048
+ * 1024, iterate_post, r);
+ }
+
+ return MHD_YES;
+ }
+
+ r = (struct httpd_request *) *ptr;
+
+ if (r->post)
+ {
+ /* consume post data */
+ if (*upload_data_size)
+ {
+ MHD_post_process(r->postprocessor, upload_data, *upload_data_size);
+ *upload_data_size = 0;
+ return MHD_YES;
+ }
+ else
+ {
+ }
+ } else
+ {
+ }
+
+ /* hand over to request who will be using it. */
+ // r->dict = NULL;
+
+
+ /* FIX!!!! we need more advanced handling of url's to avoid them
+ * being subverted to evil purposes
+ */
+
+ url++; /* skip '/' */
+
+ const char *suffix;
+ suffix = strrchr(url, '.');
+ if ((suffix != NULL) && (strcmp(suffix, ".tcl") == 0))
+ {
+ printf("Run tcl %s\n", url);
+
+ int retcode;
+
+ const char *script = alloc_printf(
+ "global httpdata; source {%s}; set httpdata", url);
+ retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__ );
+ free((void *) script);
+
+ if (retcode == JIM_ERR)
+ {
+ printf("Tcl failed\n");
+ const char *t = httpd_exec_cgi_tcl_error(interp);
+ if (t == NULL)
+ return MHD_NO;
+
+ response = MHD_create_response_from_data(strlen(t), (void *) t,
+ MHD_YES, MHD_NO);
+ ret = MHD_queue_response(connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR, response);
+ MHD_destroy_response(response);
+ return ret;
+ }
+ else
+ {
+ printf("Tcl OK\n");
+ /* FIX!!! how to handle mime types??? */
+ const char *result;
+ int reslen;
+ result = Jim_GetString(Jim_GetResult(interp), &reslen);
+
+ response = MHD_create_response_from_data(reslen, (void *) result,
+ MHD_NO, MHD_YES);
+ ret = MHD_queue_response(connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR, response);
+ MHD_destroy_response(response);
+ return ret;
+ }
+ }
+ else
+ {
+ void *data;
+ int len;
+
+ int retval = loadFile(url, &data, &len);
+ if (retval != ERROR_OK)
+ {
+ printf("Did not find %s\n", url);
+
+ response = MHD_create_response_from_data(strlen(PAGE_NOT_FOUND),
+ (void *) PAGE_NOT_FOUND, MHD_NO, MHD_NO);
+ ret = MHD_queue_response(connection, MHD_HTTP_NOT_FOUND, response);
+ MHD_destroy_response(response);
+ return ret;
+ }
+
+ printf("Serving %s length=%d\n", url, len);
+ /* serve file directly */
+ response = MHD_create_response_from_data(len, data, MHD_YES, MHD_NO);
+ MHD_add_response_header(response, "Content-Type", "image/png");
+
+ ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
+ MHD_destroy_response(response);
+
+ //free(data);
+ return ret;
+ }
+}
+
+static struct MHD_Daemon * d;
+
+int httpd_start(void)
+{
+
+ int port = 8888;
+ LOG_USER("Launching httpd server on port %d", port);
+ d = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, port, NULL, NULL,
+ &ahc_echo, NULL, /* could be data for handler, but we only have a single handler, use global variables instead */
+ MHD_OPTION_NOTIFY_COMPLETED, request_completed, NULL, /* Closure... what's that??? */
+ MHD_OPTION_END);
+ if (d == NULL)
+ return ERROR_FAIL;
+
+ Jim_CreateCommand(interp,
+ "formfetch",
+ httpd_Jim_Command_formfetch,
+ NULL,
+ NULL);
+
+ Jim_CreateCommand(interp,
+ "writeform",
+ httpd_Jim_Command_writeform,
+ NULL,
+ NULL);
+
+
+ return ERROR_OK;
+}
+
+void httpd_stop(void)
+{
+ MHD_stop_daemon(d);
+}
+
+void openocd_sleep_prelude(void)
+{
+}
+
+void openocd_sleep_postlude(void)
+{
+}
+
Property changes on: trunk/src/server/httpd.c
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/src/target/interface/rlink.cfg
===================================================================
--- trunk/src/target/interface/rlink.cfg 2008-12-19 06:49:34 UTC (rev 1259)
+++ trunk/src/target/interface/rlink.cfg 2008-12-19 13:58:15 UTC (rev 1260)
@@ -0,0 +1,3 @@
+# rlink interface
+interface rlink
+
Property changes on: trunk/src/target/interface/rlink.cfg
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: trunk/tools/rlink_make_speed_table/rlink_make_speed_table
___________________________________________________________________
Name: svn:eol-style
+ LF
Property changes on: trunk/tools/rlink_make_speed_table/rlink_make_speed_table.pl
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:eol-style
+ LF
Property changes on: trunk/tools/st7_dtc_as/st7_dtc_as
___________________________________________________________________
Name: svn:eol-style
+ LF
Property changes on: trunk/tools/st7_dtc_as/st7_dtc_as.pl
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:eol-style
+ LF
|
|
From: <oh...@ma...> - 2008-12-19 07:49:38
|
Author: oharboe
Date: 2008-12-19 07:49:34 +0100 (Fri, 19 Dec 2008)
New Revision: 1259
Modified:
trunk/src/helper/types.h
Log:
Dick Hollenbeck <di...@so...> convert macros to inline fn's.
Modified: trunk/src/helper/types.h
===================================================================
--- trunk/src/helper/types.h 2008-12-19 04:25:22 UTC (rev 1258)
+++ trunk/src/helper/types.h 2008-12-19 06:49:34 UTC (rev 1259)
@@ -45,37 +45,68 @@
typedef struct jtag_tap_s jtag_tap_t;
-/* DANGER!!!! here be dragons! Note that the pointer in
- * memory might be unaligned. On some CPU's, i.e. ARM7,
- * the 2 lsb are ignored for 32 bit access, on others
- * it will cause an exception and on e.g. x86, it works
- * the same as if aligned.
+
+/* DANGER!!!! here be dragons!
+ *
+ * Leave these fn's as byte accesses because it is safe
+ * across architectures. Clever usage of 32 bit access
+ * will create problems on some hosts.
+ *
+ * Note that the pointer in memory might be unaligned.
+ *
+ * On some CPU's, i.e. ARM7, the 2 lsb are ignored for 32
+ * bit access, on others it will cause an exception and
+ * on e.g. x86, it works the same as if aligned.
+ *
*/
-#define le_to_h_u32(x) ((u32)((x)[0] | (x)[1] << 8 | (x)[2] << 16 | (x)[3] << 24))
-#define le_to_h_u16(x) ((u16)((x)[0] | (x)[1] << 8))
-#define be_to_h_u32(x) ((u32)((x)[3] | (x)[2] << 8 | (x)[1] << 16 | (x)[0] << 24))
-#define be_to_h_u16(x) ((u16)((x)[1] | (x)[0] << 8))
-#define h_u32_to_le(buf, val) do {\
- (buf)[3] = ((val) & 0xff000000) >> 24;\
- (buf)[2] = ((val) & 0x00ff0000) >> 16;\
- (buf)[1] = ((val) & 0x0000ff00) >> 8;\
- (buf)[0] = ((val) & 0x000000ff);\
-} while (0)
-#define h_u32_to_be(buf, val) do {\
- (buf)[0] = ((val) & 0xff000000) >> 24;\
- (buf)[1] = ((val) & 0x00ff0000) >> 16;\
- (buf)[2] = ((val) & 0x0000ff00) >> 8;\
- (buf)[3] = ((val) & 0x000000ff);\
-} while (0)
-#define h_u16_to_le(buf, val) do {\
- (buf)[1] = ((val) & 0xff00) >> 8;\
- (buf)[0] = ((val) & 0x00ff) >> 0;\
-} while (0)
-#define h_u16_to_be(buf, val) do {\
- (buf)[0] = ((val) & 0xff00) >> 8;\
- (buf)[1] = ((val) & 0x00ff) >> 0;\
-} while (0)
+static inline u32 le_to_h_u32(const u8* buf)
+{
+ return (u32)(buf[0] | buf[1] << 8 | buf[2] << 16 | buf[3] << 24);
+}
+static inline u16 le_to_h_u16(const u8* buf)
+{
+ return (u16)(buf[0] | buf[1] << 8);
+}
+
+static inline u32 be_to_h_u32(const u8* buf)
+{
+ return (u32)(buf[3] | buf[2] << 8 | buf[1] << 16 | buf[0] << 24);
+}
+
+static inline u16 be_to_h_u16(const u8* buf)
+{
+ return (u16)(buf[1] | buf[0] << 8);
+}
+
+static inline void h_u32_to_le(u8* buf, int val)
+{
+ buf[3] = (u8) (val >> 24);
+ buf[2] = (u8) (val >> 16);
+ buf[1] = (u8) (val >> 8);
+ buf[0] = (u8) (val >> 0);
+}
+
+static inline void h_u32_to_be(u8* buf, int val)
+{
+ buf[0] = (u8) (val >> 24);
+ buf[1] = (u8) (val >> 16);
+ buf[2] = (u8) (val >> 8);
+ buf[3] = (u8) (val >> 0);
+}
+
+static inline void h_u16_to_le(u8* buf, int val)
+{
+ buf[1] = (u8) (val >> 8);
+ buf[0] = (u8) (val >> 0);
+}
+
+static inline void h_u16_to_be(u8* buf, int val)
+{
+ buf[0] = (u8) (val >> 8);
+ buf[1] = (u8) (val >> 0);
+}
+
#endif /* TYPES_H */
|
|
From: <kc...@ma...> - 2008-12-19 05:25:41
|
Author: kc8apf
Date: 2008-12-19 05:25:22 +0100 (Fri, 19 Dec 2008)
New Revision: 1258
Added:
trunk/src/jtag/rlink/
trunk/src/jtag/rlink/Makefile
trunk/src/jtag/rlink/call.m4
trunk/src/jtag/rlink/dtc_cmd.h
trunk/src/jtag/rlink/ep1_cmd.h
trunk/src/jtag/rlink/init.m4
trunk/src/jtag/rlink/rlink.c
trunk/src/jtag/rlink/rlink.h
trunk/src/jtag/rlink/rlink_speed_table.c
trunk/src/jtag/rlink/st7.h
trunk/tools/
trunk/tools/rlink_make_speed_table/
trunk/tools/rlink_make_speed_table/rlink_make_speed_table
trunk/tools/rlink_make_speed_table/rlink_make_speed_table.pl
trunk/tools/st7_dtc_as/
trunk/tools/st7_dtc_as/st7_dtc_as
trunk/tools/st7_dtc_as/st7_dtc_as.pl
Modified:
trunk/configure.in
trunk/doc/openocd.texi
trunk/src/Makefile.am
trunk/src/jtag/Makefile.am
trunk/src/jtag/jtag.c
Log:
- rlink interface support from Lou Deluxe <lou...@fi...>
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2008-12-17 14:55:12 UTC (rev 1257)
+++ trunk/configure.in 2008-12-19 04:25:22 UTC (rev 1258)
@@ -116,6 +116,10 @@
AS_HELP_STRING([--enable-jlink], [Enable building support for the Segger J-Link JTAG Programmer]),
[build_jlink=$enableval], [build_jlink=no])
+AC_ARG_ENABLE(rlink,
+ AS_HELP_STRING([--enable-rlink], [Enable building support for the Raisonance RLink JTAG Programmer]),
+ [build_rlink=$enableval], [build_rlink=no])
+
AC_ARG_WITH(ftd2xx,
[AS_HELP_STRING(--with-ftd2xx,
[Where libftd2xx can be found <default=search>])],
@@ -286,6 +290,12 @@
AC_DEFINE(BUILD_JLINK, 0, [0 if you don't want the J-Link JTAG driver.])
fi
+if test $build_rlink = yes; then
+ AC_DEFINE(BUILD_RLINK, 1, [1 if you want the RLink JTAG driver.])
+else
+ AC_DEFINE(BUILD_RLINK, 0, [0 if you don't want the RLink JTAG driver.])
+fi
+
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(openocd, 1.0)
@@ -307,6 +317,7 @@
AM_CONDITIONAL(USBPROG, test $build_usbprog = yes)
AM_CONDITIONAL(OOCD_TRACE, test $build_oocd_trace = yes)
AM_CONDITIONAL(JLINK, test $build_jlink = yes)
+AM_CONDITIONAL(RLINK, test $build_rlink = yes)
AM_CONDITIONAL(IS_CYGWIN, test $is_cygwin = yes)
AM_CONDITIONAL(IS_MINGW, test $is_mingw = yes)
AM_CONDITIONAL(IS_WIN32, test $is_win32 = yes)
Modified: trunk/doc/openocd.texi
===================================================================
--- trunk/doc/openocd.texi 2008-12-17 14:55:12 UTC (rev 1257)
+++ trunk/doc/openocd.texi 2008-12-19 04:25:22 UTC (rev 1258)
@@ -218,6 +218,8 @@
@option{--enable-presto_ftd2xx}
@item
@option{--enable-jlink}
+@item
+@option{--enable-rlink}
@end itemize
If you want to access the parallel port using the PPDEV interface you have to specify
@@ -322,6 +324,18 @@
@* Link: @url{http://www.iar.com/website1/1.0.1.0/369/1/index.php}
@end itemize
+@section USB RLINK based
+Raisonance has an adapter called @b{RLink}. It exists in a stripped-down form on the STM32 Primer, permanently attached to the JTAG lines. It also exists on the STM32 Primer2, but that is wired for SWD and not JTAG, thus not supported.
+
+@itemize @bullet
+@item @b{Raisonance RLink}
+@* Link: @url{http://www.raisonance.com/products/RLink.php}
+@item @b{STM32 Primer}
+@* Link: @url{http://www.stm32circle.com/resources/stm32primer.php}
+@item @b{STM32 Primer2}
+@* Link: @url{http://www.stm32circle.com/resources/stm32primer2.php}
+@end itemize
+
@section USB Other
@itemize @bullet
@item @b{USBprog}
@@ -1017,6 +1031,11 @@
# jlink interface
interface jlink
@end verbatim
+@b{A Raisonance RLink}
+@verbatim
+# rlink interface
+interface rlink
+@end verbatim
@b{Parallel Port}
@verbatim
interface parport
@@ -1066,6 +1085,9 @@
@item @b{jlink}
@* Segger jlink usb adapter
+
+@item @b{rlink}
+@* Raisonance RLink usb adapter
@comment - End parameters
@end itemize
@comment - End Interface
@@ -1247,6 +1269,7 @@
@item ft2232: 6MHz / (@var{number}+1)
@item amt jtagaccel: 8 / 2**@var{number}
@item jlink: maximum speed in kHz (0-12000), 0 will use RTCK
+@item rlink: 24MHz / @var{number}, but only for certain values of @var{number}
@comment end speed list.
@end itemize
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2008-12-17 14:55:12 UTC (rev 1257)
+++ trunk/src/Makefile.am 2008-12-19 04:25:22 UTC (rev 1258)
@@ -47,9 +47,13 @@
if JLINK
LIBUSB = -lusb
else
+if RLINK
+LIBUSB = -lusb
+else
LIBUSB =
endif
endif
+endif
if IS_WIN32
if FTD2XXDIR
Modified: trunk/src/jtag/Makefile.am
===================================================================
--- trunk/src/jtag/Makefile.am 2008-12-17 14:55:12 UTC (rev 1257)
+++ trunk/src/jtag/Makefile.am 2008-12-19 04:25:22 UTC (rev 1258)
@@ -99,7 +99,13 @@
JLINKFILES =
endif
+if RLINK
+RLINKFILES = rlink/rlink.c rlink/rlink_speed_table.c
+else
+RLINKFILES =
+endif
+
libjtag_a_SOURCES = jtag.c $(BITBANGFILES) $(PARPORTFILES) $(DUMMYFILES) $(FT2232FILES) $(AMTJTAGACCELFILES) $(EP93XXFILES) \
- $(AT91RM9200FILES) $(GW16012FILES) $(BITQFILES) $(PRESTOFILES) $(USBPROGFILES) $(ECOSBOARDFILES) $(JLINKFILES)
+ $(AT91RM9200FILES) $(GW16012FILES) $(BITQFILES) $(PRESTOFILES) $(USBPROGFILES) $(ECOSBOARDFILES) $(JLINKFILES) $(RLINKFILES)
noinst_HEADERS = bitbang.h jtag.h
Modified: trunk/src/jtag/jtag.c
===================================================================
--- trunk/src/jtag/jtag.c 2008-12-17 14:55:12 UTC (rev 1257)
+++ trunk/src/jtag/jtag.c 2008-12-19 04:25:22 UTC (rev 1258)
@@ -196,6 +196,10 @@
extern jtag_interface_t jlink_interface;
#endif
+#if BUILD_RLINK == 1
+ extern jtag_interface_t rlink_interface;
+#endif
+
jtag_interface_t *jtag_interfaces[] = {
#if BUILD_ECOSBOARD == 1
&zy1000_interface,
@@ -233,6 +237,9 @@
#if BUILD_JLINK == 1
&jlink_interface,
#endif
+#if BUILD_RLINK == 1
+ &rlink_interface,
+#endif
NULL,
};
Added: trunk/src/jtag/rlink/Makefile
===================================================================
--- trunk/src/jtag/rlink/Makefile 2008-12-17 14:55:12 UTC (rev 1257)
+++ trunk/src/jtag/rlink/Makefile 2008-12-19 04:25:22 UTC (rev 1258)
@@ -0,0 +1,73 @@
+#***************************************************************************
+#* Copyright (C) 2008 Lou Deluxe *
+#* lou...@fi... *
+#* *
+#* This program is free software; you can redistribute it and/or modify *
+#* it under the terms of the GNU General Public License as published by *
+#* the Free Software Foundation; either version 2 of the License, or *
+#* (at your option) any later version. *
+#* *
+#* This program is distributed in the hope that it will be useful, *
+#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+#* GNU General Public License for more details. *
+#* *
+#* You should have received a copy of the GNU General Public License *
+#* along with this program; if not, write to the *
+#* Free Software Foundation, Inc., *
+#* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+#***************************************************************************
+
+TOP = ../../..
+INTERFACE_NAME = rlink
+
+PERL = perl
+M4 = m4
+
+TARGETDIR = ${TOP}/src/target
+TOOLSDIR = ${TOP}/tools
+
+MAKE_SPEED_TABLE = ${TOOLSDIR}/rlink_make_speed_table/rlink_make_speed_table
+ST7_DTC_AS = ${TOOLSDIR}/st7_dtc_as/st7_dtc_as
+
+OPENOCD = ${TOP}/src/openocd
+OPENOCD_CONFIG = -s ${TARGETDIR}
+OPENOCD_CONFIG += -f interface/rlink.cfg
+OPENOCD_CONFIG += -f board/stm32f10x_128k_eval.cfg
+
+PATCHFILE = /tmp/openocd_${INTERFACE_NAME}.diff.gz
+
+# relative to ${TOP}
+SVNADDFILES =
+SVNADDFILES += src/target/interface/rlink.cfg
+SVNADDFILES += src/jtag/${INTERFACE_NAME}.c
+SVNADDFILES += src/jtag/${INTERFACE_NAME}
+
+PRESCALERS = 64 11 8 2
+
+DTCFILES =
+DTCFILES += $(addsuffix _init.dtc, ${PRESCALERS})
+DTCFILES += $(addsuffix _call.dtc, ${PRESCALERS})
+
+default: rlink_speed_table.c clean
+
+%_init.fsm: init.m4
+ ${M4} -P -DSHIFTER_PRESCALER=`echo "$@" | sed -e's/_.*//'` $< > $@
+
+%_call.fsm: call.m4
+ ${M4} -P -DSHIFTER_PRESCALER=`echo "$@" | sed -e's/_.*//'` $< > $@
+
+%.dtc: %.fsm
+ ${ST7_DTC_AS} -b -o $@ -i $< > /dev/null
+
+rlink_speed_table.c: ${DTCFILES}
+ ${MAKE_SPEED_TABLE} ${PRESCALERS} > $@ || rm $@
+
+clean:
+ -rm *.dtc *.fsm
+
+distclean: clean
+
+test: default
+ (cd ${TOP} && (rm src/jtag/${INTERFACE_NAME}.o; ${MAKE}))
+ ${OPENOCD} -d0 ${OPENOCD_CONFIG} -c init -c 'poll off'
Property changes on: trunk/src/jtag/rlink/Makefile
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/src/jtag/rlink/call.m4
===================================================================
--- trunk/src/jtag/rlink/call.m4 2008-12-17 14:55:12 UTC (rev 1257)
+++ trunk/src/jtag/rlink/call.m4 2008-12-19 04:25:22 UTC (rev 1258)
@@ -0,0 +1,485 @@
+m4_divert(`-1')
+/***************************************************************************
+ * Copyright (C) 2008 Lou Deluxe *
+ * lou...@fi... *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+m4_dnl Setup and hold times depend on SHIFTER_PRESCALER
+m4_define(`SETUP_DELAY_CYCLES', m4_eval(`('SHIFTER_PRESCALER` + 1) / 2'))
+m4_define(`HOLD_DELAY_CYCLES', m4_eval(`'SHIFTER_PRESCALER` / 2'))
+
+m4_dnl Some macros to make nybble handling a little easier
+m4_define(`m4_high_nybble', `m4_eval(`(($1) >> 4) & 0xf')')
+m4_define(`m4_low_nybble', `m4_eval(`($1) & 0xf')')
+
+m4_dnl A macro to generate a number of NOPs depending on the argument
+m4_define(`m4_0_to_5_nops', `m4_ifelse(m4_eval(`($1) >= 1'), 1, ` NOP
+'m4_ifelse(m4_eval(`($1) >= 2'), 1, ` NOP
+'m4_ifelse(m4_eval(`($1) >= 3'), 1, ` NOP
+'m4_ifelse(m4_eval(`($1) >= 4'), 1, ` NOP
+'m4_ifelse(m4_eval(`($1) >= 5'), 1, ` NOP
+')))))')
+
+
+m4_dnl Some macros to facilitate bit-banging delays.
+m4_dnl There are 3 of them. One for self-contained delays, and two for those which must be split between setup and loop to keep from disturbing A at delay time.
+m4_dnl The argument passed to any of them is the number of cycles which the delay should consume.
+
+m4_dnl This one is self-contained.
+
+m4_define(`m4_delay',
+`; delay (m4_eval($1) cycles)'
+`m4_ifelse(m4_eval(`('$1`) < 6'), 1,
+ m4_0_to_5_nops($1)
+,
+ m4_ifelse(m4_eval(`(('$1`) - 3) % 2'), 1, ` NOP')
+ A.H = m4_high_nybble(`(('$1`) - 3) / 2')
+ A.L = m4_low_nybble(`(('$1`) - 3) / 2')
+ Y = A
+ DECY
+ JP -1
+)')
+
+
+m4_dnl These are the setup and loop parts of the split delay.
+m4_dnl The argument passed to both must match for the result to make sense.
+m4_dnl The setup does not figure into the delay. It takes 3 cycles when a loop is used and none if nops are used.
+
+m4_define(`m4_delay_setup',
+`; delay setup (m4_eval($1) cycles)'
+`m4_ifelse(m4_eval(`('$1`) < 6'), 0, ` '
+ A.H = m4_high_nybble(`('$1`) / 2')
+ A.L = m4_low_nybble(`('$1`) / 2')
+ Y = A
+)')
+
+m4_define(`m4_delay_loop',
+`; delay loop (m4_eval($1) cycles)'
+`m4_ifelse(m4_eval(`('$1`) < 6'), 1,
+ m4_0_to_5_nops($1)
+,
+ m4_ifelse(m4_eval(`('$1`) % 2'), 1, ` NOP')
+ DECY
+ JP -1
+)')
+
+m4_dnl These are utility macros for use with delays. Specifically, there is code below which needs some predictability in code size for relative jumps to reach. The m4_delay macro generates an extra NOP when an even delay is needed, and the m4_delay_loop macro generates an extra NOP when an odd delay is needed. Using this for the argument to the respective macro rounds up the argument so that the extra NOP will not be generated. There is also logic built in to cancel the rounding when the result is small enough that a loop would not be generated.
+
+m4_define(`m4_delay_loop_round_up', `m4_ifelse(m4_eval($1` < 6'), 1, $1, m4_eval(`(('$1`) + 1) / 2 * 2'))')
+m4_define(`m4_delay_round_up', `m4_ifelse(m4_eval($1` < 6'), 1, $1, m4_eval(`(('$1`) / 2 * 2) + 1'))')
+
+
+m4_divert(`0')m4_dnl
+
+;------------------------------------------------------------------------------
+:opcode_error
+; This is at address 0x00 in case of empty LUT entries
+ STATUS STOP ERROR
+
+;------------------------------------------------------------------------------
+; Command interpreter at address 0x01 because it is branched to a lot and having it be 0x01 means we can use X for it, which is already used for other purposes which want it to be 1.
+; Assumes X is 1
+; Assumes ADR_BUFFER0 points to the next command byte
+; Stores the current command byte in CMP01
+
+:command_interpreter
+ A = DATA_BUFFER0
+ ADR_BUFFER0 += X
+ CMP01 = A ; store the current command for later
+
+ EXCHANGE ; put MSN into LSN
+ A.H = 0xc ; lookup table at 0x1550 + 0xc0 = 0x1610
+
+ ; branch to address in lookup table
+ Y = A
+ A = <Y>
+ BRANCH
+
+;------------------------------------------------------------------------------
+; LUT for high nybble
+
+;LUT; c0 opcode_error
+;LUT; c1 opcode_shift_tdi_andor_tms_bytes
+;LUT; c2 opcode_shift_tdi_andor_tms_bytes
+;LUT; c3 opcode_shift_tdi_andor_tms_bytes
+;LUT; c4 opcode_shift_tdo_bytes
+;LUT; c5 opcode_error
+;LUT; c6 opcode_shift_tdio_bytes
+;LUT; c7 opcode_error
+;LUT; c8 opcode_shift_tms_tdi_bit_pair
+;LUT; c9 opcode_shift_tms_bits
+;LUT; ca opcode_error
+;LUT; cb opcode_error
+;LUT; cc opcode_error
+;LUT; cd opcode_error
+;LUT; ce opcode_shift_tdio_bits
+;LUT; cf opcode_stop
+
+
+;------------------------------------------------------------------------------
+; USB/buffer handling
+;
+
+;ENTRY; download entry_download
+
+opcode_stop:
+opcode_next_buffer:
+ ; pointer to completion flag
+ A.H = 0xf
+ A.L = 0xf
+ Y = A
+
+ A = OR_MPEG ; buffer indicator from previous iteration
+ <Y> = A ; either indicator will have bit 0 set
+ BSET 1 ; was buffer 1 previously current?
+; A.H = 0 ; already zero from OR_MPEG
+ JP opcode_next_buffer_0
+
+opcode_next_buffer_1:
+ A.L = 0x1 ; ack buffer 0
+ BUFFER_MNGT = A
+; A.H = 0x0 ; already zero from BUFFER_MNGT
+ A.L = 0x3 ; Input buffer 1 = 0x1850 (0x0300)
+ JP +4
+
+opcode_next_buffer_0:
+ A.L = 0x2 ; ack buffer 1
+ BUFFER_MNGT = A
+entry_download:
+ A = X ; Input buffer 0 = 0x1650 (0x0100)
+
+ ADR_BUFFER01 = A
+ OR_MPEG = A ; store for next iteration
+
+ A.L = 0x0
+ BUFFER_MNGT = A ; finish acking previous buffer
+ Y = A
+ ADR_BUFFER00 = A
+ ADR_BUFFER11 = A
+
+ A.H = 0x4 ; Output buffer = 0x1590 (0x0040)
+ ADR_BUFFER10 = A
+
+ EXCHANGE ; 0x04
+ X = A ; for the spin loop below
+
+ ; pointer to status in shared memory
+ DECY ; setting to 0 above and decrementing here saves a byte
+
+ ; wait until a command buffer is available
+ A = BUFFER_MNGT ; spin while neither of bits 2 or 3 are set
+ CP A<X ; this is slightly faster and smaller than trying to AND and compare the result, and it lets us just use the nybble-swapped 0x40 from the output buffer setup.
+ JP -2
+ <Y> = A ; update status once done spinning
+
+ ; restore X, since we used it
+; A.H = 0 ; high nybble of BUFFER_MNGT will always be 0 the way we use it
+ A.L = 1
+ X = A
+
+ ; go to command interpreter
+ BRANCH
+
+
+;;------------------------------------------------------------------------------
+;:opcode_stop
+;;
+;
+; ; Ack buffer 0 in download mode
+; A.L = 0x1
+; BUFFER_MNGT = A
+;
+; STATUS STOP
+
+
+;------------------------------------------------------------------------------
+:opcode_shift_tdi_andor_tms_bytes
+;
+
+ A = CMP01 ; bits 3..0 contain the number of bytes to shift - 1
+ A.H = 0
+ Y = A ; loop counter
+
+ A = CMP01
+ EXCHANGE
+ CMP01 = A ; we're interested in bits in the high nybble
+
+opcode_shift_tdi_andor_tms_bytes__loop:
+
+; set tdi to supplied byte or zero
+ A = CMP01
+ BSET 1
+ JP +4
+ A.H = 0
+ A.L = 0
+ JP +3
+ A = DATA_BUFFER0
+ ADR_BUFFER0 += X
+ SHIFT_MPEG = A
+
+; set tms to supplied byte or zero
+ A = CMP01
+ BCLR 0
+ JP +5
+ A = DATA_BUFFER0
+ ADR_BUFFER0 += X
+ SHIFT_CARD = A
+ SHIFT CARD OUT=>PIN0
+
+; run both shifters as nearly simultaneously as possible
+ SHIFT MPEG OUT=>PIN1
+
+ A = CTRL_FCI
+ EXCHANGE
+ BCLR 3
+ JP -3
+
+ DECY
+ JP opcode_shift_tdi_andor_tms_bytes__loop
+
+ A = X
+ BRANCH
+
+
+;------------------------------------------------------------------------------
+:opcode_shift_tdo_bytes
+;
+
+ A = CMP01 ; bits 3..0 contain the number of bytes to shift - 1
+ A.H = 0
+ Y = A ; loop counter
+
+opcode_shift_tdo_bytes__loop:
+ SHIFT MPEG PIN0=>IN
+
+ A = CTRL_FCI
+ EXCHANGE
+ BCLR 3
+ JP -3
+
+ ; put shifted byte into output buffer
+ A = SHIFT_MPEG
+ DATA_BUFFER1 = A
+ ADR_BUFFER1 += X
+
+ DECY
+ JP opcode_shift_tdo_bytes__loop
+
+ A = X
+ BRANCH
+
+
+;------------------------------------------------------------------------------
+:opcode_shift_tdio_bytes
+;
+
+ A = CMP01 ; bits 3..0 contain the number of bytes to shift - 1
+ A.H = 0
+ CMP10 = A ; byte loop counter
+
+ A.H = opcode_shift_tdio_bytes__sub_return
+ A.L = opcode_shift_tdio_bytes__sub_return
+ CMP00 = A ; return address
+
+opcode_shift_tdio_bytes__loop:
+ A.H = 0
+ A.L = 7
+ CMP11 = A ; always use 8 bits
+
+ JP sub_shift_tdio_bits
+opcode_shift_tdio_bytes__sub_return:
+
+ A = CMP10 ; byte loop counter
+ CP A=>X
+ CLC
+ A -= X
+ CMP10 = A
+ JP opcode_shift_tdio_bytes__loop
+
+ A = X
+;DR_MPEG = A ; return TCK low, as str912 reset halt seems to require it
+ BRANCH
+
+
+;------------------------------------------------------------------------------
+:opcode_shift_tdio_bits
+;
+
+ A = CMP01 ; bits 2..0 contain the number of bits to shift - 1
+ A.H = 0
+ BCLR 3 ; set TMS=1 if bit 3 was set
+ CMP11 = A ; bit loop counter
+
+ A.H = opcode_shift_tdio_bits__sub_return
+ A.L = opcode_shift_tdio_bits__sub_return
+ CMP00 = A ; return address
+
+ JP sub_shift_tdio_bits
+ A.L = 0x1 ; TMS=1
+ DR_CARD = A
+ JP sub_shift_tdio_bits
+opcode_shift_tdio_bits__sub_return:
+
+ A = X
+;DR_MPEG = A ; return TCK low, as str912 reset halt seems to require it
+ BRANCH
+
+
+;------------------------------------------------------------------------------
+:sub_shift_tdio_bits
+;
+
+ A = DATA_BUFFER0 ; get byte from input buffer
+ ADR_BUFFER0 += X
+ MASK = A ; put it in MASK where bit routine will use it
+
+:sub_shift_tdio_bits__loop
+m4_delay_setup(m4_delay_loop_round_up(SETUP_DELAY_CYCLES - 1))
+
+ A = MASK ; shift TDO into and TDI out of MASK via carry
+ A += MASK
+ MASK = A
+
+ ; shifting out TDI
+ A.L = 0x2 ; TCK=0, TDI=1
+ CP CARRY
+ JP +2
+ A.L = 0x0 ; TCK=0, TDI=0
+ DR_MPEG = A
+
+m4_delay_loop(m4_delay_loop_round_up(SETUP_DELAY_CYCLES - 1))
+
+ BSET 2 ; TCK high
+ DR_MPEG = A
+
+ A = DR_MPEG ; set carry bit to TDO
+ CLC
+ BCLR 0
+ JP +2
+ SEC
+
+m4_delay(HOLD_DELAY_CYCLES - 10)
+
+ A = CMP11 ; bit loop counter
+ Y = A ; use Y to avoid corrupting carry bit with subtract
+ DECY
+ A = Y
+ CMP11 = A
+ JP :sub_shift_tdio_bits__loop
+
+ ; shift last TDO bit into result
+ A = MASK
+ A += MASK
+ DATA_BUFFER1 = A
+ ADR_BUFFER1 += X
+
+ A = CMP00 ; return to caller
+ BRANCH
+
+
+;------------------------------------------------------------------------------
+:opcode_shift_tms_tdi_bit_pair
+;
+
+; set TMS line manually
+ A = CMP01 ; bits 3..0 contain TDI and TMS bits and whether to return TDO
+ BSET 0 ; TMS bit
+ A.L = 0x1 ; TMS=1
+ JP +2
+ A.L = 0x0 ; TMS=0
+ DR_CARD = A
+
+; stuff command buffer with bitmap of single TDI bit
+ A = CMP01
+ BSET 1 ; TDI bit
+ A.H = 0x8 ; TDI=1
+ JP +2
+ A.H = 0x0 ; TDI=0
+ ADR_BUFFER0 -= X
+ DATA_BUFFER0 = A
+
+ A.H = 0
+ A.L = 0
+ CMP11 = A ; bit loop counter (only doing one bit)
+
+ A.H = opcode_shift_tms_tdi_bit_pair__sub_return
+ A.L = opcode_shift_tms_tdi_bit_pair__sub_return
+ CMP00 = A ; return address
+
+; jump this way due to relative jump range issues
+ A.H = sub_shift_tdio_bits
+ A.L = sub_shift_tdio_bits
+ BRANCH
+opcode_shift_tms_tdi_bit_pair__sub_return:
+
+ A = CMP01
+ BSET 3 ; bit says whether to return TDO
+ JP +2
+ ADR_BUFFER1 -= X ; subroutine returns it, so undo that
+
+ A = X
+ DR_MPEG = A ; return TCK low, as str912 reset halt seems to require it
+ BRANCH
+
+
+;------------------------------------------------------------------------------
+:opcode_shift_tms_bits
+;
+
+ A = CMP01 ; bits 3..0 contain the number of bits to shift - 1 (only 1-8 bits is valid... no checking, just improper operation)
+ A.H = 0
+ CMP11 = A ; bit loop counter
+
+ A = DATA_BUFFER0 ; get byte from input buffer
+ ADR_BUFFER0 += X
+ MASK = A ; The byte we'll be shifting
+
+:opcode_shift_tms_bits__loop
+m4_delay_setup(SETUP_DELAY_CYCLES - 1)
+
+ A = MASK ; shift TMS out of MASK via carry
+ A += MASK
+ MASK = A
+
+ ; shifting out TMS
+ A.L = 0x1 ; TCK=0, TDI=0, TMS=1
+ CP CARRY
+ JP +2
+ A.L = 0x0 ; TCK=0, TDI=0, TMS=0
+ DR_CARD = A
+ DR_MPEG = A
+
+m4_delay_loop(SETUP_DELAY_CYCLES - 1)
+
+ BSET 2 ; TCK high
+ DR_MPEG = A
+
+m4_delay(HOLD_DELAY_CYCLES - 10)
+
+ A = CMP11 ; bit loop counter
+ CP A=>X
+ CLC
+ A -= X
+ CMP11 = A
+ JP :opcode_shift_tms_bits__loop
+
+ A = X
+ DR_MPEG = A ; return TCK low, as str912 reset halt seems to require it
+ BRANCH
+
+
Added: trunk/src/jtag/rlink/dtc_cmd.h
===================================================================
--- trunk/src/jtag/rlink/dtc_cmd.h 2008-12-17 14:55:12 UTC (rev 1257)
+++ trunk/src/jtag/rlink/dtc_cmd.h 2008-12-19 04:25:22 UTC (rev 1258)
@@ -0,0 +1,66 @@
+/***************************************************************************
+ * Copyright (C) 2008 Lou Deluxe *
+ * lou...@fi... *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+/* A command position with the high nybble of 0x0 is reserved for an error condition. If executed, it stops the DTC and raises the ERROR flag */
+
+#define DTC_CMD_SHIFT_TMS_BYTES(bytes) ((0x1 << 4) | ((bytes) - 1))
+/* Shift 1-16 bytes out TMS. TDI is 0. */
+/* Bytes to shift follow. */
+
+#define DTC_CMD_SHIFT_TDI_BYTES(bytes) ((0x2 << 4) | ((bytes) - 1))
+/* Shift 1-16 bytes out TDI. TMS is 0. */
+/* Bytes to shift follow. */
+
+#define DTC_CMD_SHIFT_TDI_AND_TMS_BYTES(bytes) ((0x3 << 4) | ((bytes) - 1))
+/* Shift 1-16 byte pairs out TDI and TMS. */
+/* Byte pairs to shift follow in TDI, TMS order. */
+
+#define DTC_CMD_SHIFT_TDO_BYTES(bytes) ((0x4 << 4) | ((bytes) - 1))
+/* Shift 1-16 bytes in TDO. TMS is unaffected. */
+/* Reply buffer contains bytes shifted in. */
+
+#define DTC_CMD_SHIFT_TDIO_BYTES(bytes) ((0x6 << 4) | ((bytes) - 1))
+/* Shift 1-16 bytes out TDI and in TDO. TMS is unaffected. */
+
+#define DTC_CMD_SHIFT_TMS_TDI_BIT_PAIR(tms, tdi, tdo) ((0x8 << 4) | ( \
+ (tms) ? (1 << 0) : 0 \
+ ) | ( \
+ (tdi) ? (1 << 1) : 0 \
+ ) | ( \
+ (tdo) ? (1 << 3) : 0 \
+ ))
+/* Single bit shift. */
+/* tms and tdi are the levels shifted out on TMS and TDI, respectively. */
+/* tdo indicates whether a byte will be returned in the reply buffer with its least significant bit set to reflect TDO */
+/* Care should be taken when tdo is zero, as the underlying code actually does put that byte in the reply buffer. Setting tdo to zero just moves the pointer back. The result is that if this command is executed when the reply buffer is already full, a byte will be written erroneously to memory not belonging to the reply buffer. This could be worked around at the expense of DTC code space and speed. */
+
+#define DTC_CMD_SHIFT_TMS_BITS(bits) ((0x9 << 4) | ((bits) - 1))
+/* Shift 1-8 bits out TMS. */
+/* Bits to be shifted out are left justified in the following byte. */
+
+#define DTC_CMD_SHIFT_TDIO_BITS(bits) ((0xe << 4) | ((bits) - 1))
+/* Shift 1-8 bits out TDI and in TDO, TMS is unaffected. */
+/* Bits to be shifted out are left justified in the following byte. */
+/* Bits shifted in are right justified in the byte placed in the reply buffer. */
+
+
+#define DTC_CMD_STOP (0xf << 4)
+/* Stop processing the command buffer and wait for the next one. */
+/* A shared status byte is updated with bit 0 set when this has happened, and it is cleared when a new command buffer becomes ready. The host can poll that byte to see when it is safe to read a reply. */
Property changes on: trunk/src/jtag/rlink/dtc_cmd.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/src/jtag/rlink/ep1_cmd.h
===================================================================
--- trunk/src/jtag/rlink/ep1_cmd.h 2008-12-17 14:55:12 UTC (rev 1257)
+++ trunk/src/jtag/rlink/ep1_cmd.h 2008-12-19 04:25:22 UTC (rev 1258)
@@ -0,0 +1,57 @@
+/***************************************************************************
+ * Copyright (C) 2008 Lou Deluxe *
+ * lou...@fi... *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+/*
+ * Command opcodes that can be sent over endpoint 1.
+ * This codifies information provided by Rob Brown <ro...@co...>.
+ * The buffer can contain several of these, but only one which returns data.
+ * Some of these opcodes have arguments, which follow immediately.
+ * If shorter than the packet size, trailing positions should be zero-filled.
+ */
+
+/* LED update enables:
+ * When enabled, each LED is updated automatically.
+ * When not enabled, each LED can be controlled manually with EP1_CMD_SET_PORTD_LEDS.
+ */
+#define EP1_CMD_LEDUE_BOTH (0x05)
+/* EP1_CMD_LEDUE_NONE has the side effect of turning the LEDs on */
+#define EP1_CMD_LEDUE_NONE (0x06)
+#define EP1_CMD_LEDUE_ERROR (0x17)
+#define EP1_CMD_LEDUE_BUSY (0x18)
+
+#define EP1_CMD_DTC_STOP (0x0b)
+#define EP1_CMD_DTC_LOAD (0x0c)
+#define EP1_CMD_DTC_CALL (0x0d)
+#define EP1_CMD_SET_UPLOAD (0x0f)
+#define EP1_CMD_SET_DOWNLOAD (0x10)
+#define EP1_CMD_DTC_WAIT (0x12)
+#define EP1_CMD_DTC_GET_STATUS (0x15)
+/* a quick way to just read back one byte */
+#define EP1_CMD_DTC_GET_CACHED_STATUS (0x16)
+
+/* Writes upper 2 bits port D with argument */
+#define EP1_CMD_SET_PORTD_UPPER (0x19)
+/* Writes lower 2 bits (BUSY and ERROR) of port D with argument */
+#define EP1_CMD_SET_PORTD_LEDS (0x1a)
+
+#define EP1_CMD_MEMORY_READ (0x28)
+#define EP1_CMD_MEMORY_WRITE (0x29)
+#define EP1_CMD_GET_FWREV (0xfe)
+#define EP1_CMD_GET_SERIAL (0xff)
Property changes on: trunk/src/jtag/rlink/ep1_cmd.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/src/jtag/rlink/init.m4
===================================================================
--- trunk/src/jtag/rlink/init.m4 2008-12-17 14:55:12 UTC (rev 1257)
+++ trunk/src/jtag/rlink/init.m4 2008-12-19 04:25:22 UTC (rev 1258)
@@ -0,0 +1,74 @@
+m4_divert(`-1')
+/***************************************************************************
+ * Copyright (C) 2008 Lou Deluxe *
+ * lou...@fi... *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+m4_undefine(`CTRL_MPEG_L')
+m4_undefine(`CTRL_CARD_L')
+
+m4_ifelse(SHIFTER_PRESCALER, 1, `
+ m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x0')')
+')
+m4_ifelse(SHIFTER_PRESCALER, 2, `
+ m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x2')')
+ m4_define(`CTRL_CARD_L', `m4_eval(`0x8 | 0x1')')
+')
+m4_ifelse(SHIFTER_PRESCALER, 8, `
+ m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x3')')
+')
+m4_ifelse(SHIFTER_PRESCALER, 11, `
+ m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x4')')
+')
+m4_ifelse(SHIFTER_PRESCALER, 64, `
+ m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x7')')
+')
+
+m4_ifdef(`CTRL_MPEG_L',,`
+ m4_errprint(`SHIFTER_PRESCALER was not defined with a supported value
+') m4_m4exit(`1')
+')
+
+m4_divert(`0')m4_dnl
+
+init:
+ A.H = 0
+
+ A.L = 0
+
+ DR_MPEG = A ; TDI and TCK start out low
+ DR_CARD = A ; TMS starts out low
+
+ A.L = 0x6
+
+ CTRL_FCI = A ; MPEG and CARD driven by FCI
+ DDR_MPEG = A ; TDI and TCK are outputs
+
+ A.L = 0x1
+
+ X = A ; X == 1
+ DDR_CARD = A ; TMS is output
+
+ A.L = CTRL_MPEG_L
+ CTRL_MPEG = A
+m4_ifdef(`CTRL_CARD_L',
+` A.L = 'CTRL_CARD_L`
+')m4_dnl
+ CTRL_CARD = A
+
+ STATUS STOP
Added: trunk/src/jtag/rlink/rlink.c
===================================================================
--- trunk/src/jtag/rlink/rlink.c 2008-12-17 14:55:12 UTC (rev 1257)
+++ trunk/src/jtag/rlink/rlink.c 2008-12-19 04:25:22 UTC (rev 1258)
@@ -0,0 +1,1808 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Dominic Rath *
+ * Dom...@gm... *
+ * *
+ * Copyright (C) 2007,2008 vind Harboe *
+ * oyv...@zy... *
+ * *
+ * Copyright (C) 2008 Rob Brown, Lou Deluxe *
+ * ro...@co..., lou...@fi... *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/* system includes */
+#include <errno.h>
+#include <string.h>
+#include <usb.h>
+
+/* project specific includes */
+#include "log.h"
+#include "types.h"
+#include "jtag.h"
+#include "configuration.h"
+#include "rlink.h"
+#include "st7.h"
+#include "ep1_cmd.h"
+#include "dtc_cmd.h"
+
+
+/* This feature is made useless by running the DTC all the time. When automatic, the LED is on whenever the DTC is running. Otherwise, USB messages are sent to turn it on and off. */
+#undef AUTOMATIC_BUSY_LED
+
+/* This feature may require derating the speed due to reduced hold time. */
+#undef USE_HARDWARE_SHIFTER_FOR_TMS
+
+
+#define INTERFACE_NAME "RLink"
+
+#define USB_IDVENDOR (0x138e)
+#define USB_IDPRODUCT (0x9000)
+
+#define USB_EP1OUT_ADDR (0x01)
+#define USB_EP1OUT_SIZE (16)
+#define USB_EP1IN_ADDR (USB_EP1OUT_ADDR | 0x80)
+#define USB_EP1IN_SIZE (USB_EP1OUT_SIZE)
+
+#define USB_EP2OUT_ADDR (0x02)
+#define USB_EP2OUT_SIZE (64)
+#define USB_EP2IN_ADDR (USB_EP2OUT_ADDR | 0x80)
+#define USB_EP2IN_SIZE (USB_EP2OUT_SIZE)
+#define USB_EP2BANK_SIZE (512)
+
+#define USB_TIMEOUT_MS (3 * 1000)
+
+#define DTC_STATUS_POLL_BYTE (ST7_USB_BUF_EP0OUT + 0xff)
+
+
+/* Symbolic names for some pins */
+#define ST7_PA_NJTAG_TRST ST7_PA1
+#define ST7_PA_NRLINK_RST ST7_PA3
+#define ST7_PA_NLINE_DRIVER_ENABLE ST7_PA5
+
+/* mask for negative-logic pins */
+#define ST7_PA_NUNASSERTED (0 \
+ | ST7_PA_NJTAG_TRST \
+ | ST7_PA_NRLINK_RST \
+ | ST7_PA_NLINE_DRIVER_ENABLE \
+)
+
+#define ST7_PD_NBUSY_LED ST7_PD0
+#define ST7_PD_NERROR_LED ST7_PD1
+#define ST7_PD_NRUN_LED ST7_PD7
+
+#define ST7_PE_ADAPTER_SENSE_IN ST7_PE3
+#define ST7_PE_ADAPTER_SENSE_OUT ST7_PE4
+
+static usb_dev_handle *pHDev;
+
+
+/*
+ * ep1 commands are up to USB_EP1OUT_SIZE bytes in length.
+ * This function takes care of zeroing the unused bytes before sending the packet.
+ * Any reply packet is not handled by this function.
+ */
+static
+int
+ep1_generic_commandl(
+ usb_dev_handle *pHDev,
+ size_t length,
+ ...
+) {
+ uint8_t usb_buffer[USB_EP1OUT_SIZE];
+ uint8_t *usb_buffer_p;
+ va_list ap;
+ int usb_ret;
+
+ if(length > sizeof(usb_buffer)) {
+ length = sizeof(usb_buffer);
+ }
+
+ usb_buffer_p = usb_buffer;
+
+ va_start(ap, length);
+ while(length > 0) {
+ *usb_buffer_p++ = va_arg(ap, int);
+ length--;
+ }
+
+ memset(
+ usb_buffer_p,
+ 0,
+ sizeof(usb_buffer) - (usb_buffer_p - usb_buffer)
+ );
+
+ usb_ret = usb_bulk_write(
+ pHDev,
+ USB_EP1OUT_ADDR,
+ usb_buffer, sizeof(usb_buffer),
+ USB_TIMEOUT_MS
+ );
+
+ return(usb_ret);
+}
+
+
+
+#if 0
+static
+ssize_t
+ep1_memory_read(
+ usb_dev_handle *pHDev,
+ uint16_t addr,
+ size_t length,
+ uint8_t *buffer
+) {
+ uint8_t usb_buffer[USB_EP1OUT_SIZE];
+ int usb_ret;
+ size_t remain;
+ ssize_t count;
+
+ usb_buffer[0] = EP1_CMD_MEMORY_READ;
+ memset(
+ usb_buffer + 4,
+ 0,
+ sizeof(usb_buffer) - 4
+ );
+
+ remain = length;
+ count = 0;
+
+ while(remain) {
+ if(remain > sizeof(usb_buffer)) {
+ length = sizeof(usb_buffer);
+ } else {
+ length = remain;
+ }
+
+ usb_buffer[1] = addr >> 8;
+ usb_buffer[2] = addr;
+ usb_buffer[3] = length;
+
+ usb_ret = usb_bulk_write(
+ pHDev, USB_EP1OUT_ADDR,
+ usb_buffer, sizeof(usb_buffer),
+ USB_TIMEOUT_MS
+ );
+
+ if(usb_ret < sizeof(usb_buffer)) {
+ break;
+ }
+
+ usb_ret = usb_bulk_read(
+ pHDev, USB_EP1IN_ADDR,
+ buffer, length,
+ USB_TIMEOUT_MS
+ );
+
+ if(usb_ret < length) {
+ break;
+ }
+
+ addr += length;
+ buffer += length;
+ count += length;
+ remain -= length;
+ }
+
+ return(count);
+}
+#endif
+
+
+
+static
+ssize_t
+ep1_memory_write(
+ usb_dev_handle *pHDev,
+ uint16_t addr,
+ size_t length,
+ uint8_t const *buffer
+) {
+ uint8_t usb_buffer[USB_EP1OUT_SIZE];
+ int usb_ret;
+ size_t remain;
+ ssize_t count;
+
+ usb_buffer[0] = EP1_CMD_MEMORY_WRITE;
+
+ remain = length;
+ count = 0;
+
+ while(remain) {
+ if(remain > (sizeof(usb_buffer) - 4)) {
+ length = (sizeof(usb_buffer) - 4);
+ } else {
+ length = remain;
+ }
+
+ usb_buffer[1] = addr >> 8;
+ usb_buffer[2] = addr;
+ usb_buffer[3] = length;
+ memcpy(
+ usb_buffer + 4,
+ buffer,
+ length
+ );
+ memset(
+ usb_buffer + 4 + length,
+ 0,
+ sizeof(usb_buffer) - 4 - length
+ );
+
+ usb_ret = usb_bulk_write(
+ pHDev, USB_EP1OUT_ADDR,
+ usb_buffer, sizeof(usb_buffer),
+ USB_TIMEOUT_MS
+ );
+
+ if(usb_ret < sizeof(usb_buffer)) {
+ break;
+ }
+
+ addr += length;
+ buffer += length;
+ count += length;
+ remain -= length;
+ }
+
+ return(count);
+}
+
+
+#if 0
+static
+ssize_t
+ep1_memory_writel(
+ usb_dev_handle *pHDev,
+ uint16_t addr,
+ size_t length,
+ ...
+) {
+ uint8_t buffer[USB_EP1OUT_SIZE - 4];
+ uint8_t *buffer_p;
+ va_list ap;
+ size_t remain;
+
+ if(length > sizeof(buffer)) {
+ length = sizeof(buffer);
+ }
+
+ remain = length;
+ buffer_p = buffer;
+
+ va_start(ap, length);
+ while(remain > 0) {
+ *buffer_p++ = va_arg(ap, int);
+ remain--;
+ }
+
+ return(ep1_memory_write(pHDev, addr, length, buffer));
+}
+#endif
+
+
+#define DTCLOAD_COMMENT (0)
+#define DTCLOAD_ENTRY (1)
+#define DTCLOAD_LOAD (2)
+#define DTCLOAD_RUN (3)
+#define DTCLOAD_LUT_START (4)
+#define DTCLOAD_LUT (5)
+
+#define DTC_LOAD_BUFFER ST7_USB_BUF_EP2UIDO
+
+/* This gets set by the DTC loader */
+static uint8_t dtc_entry_download;
+
+
+/* The buffer is specially formatted to represent a valid image to load into the DTC. */
+static
+int
+dtc_load_from_buffer(
+ usb_dev_handle *pHDev,
+ const u8 *buffer,
+ size_t length
+) {
+ struct header_s {
+ u8 type;
+ u8 length;
+ };
+
+ int usb_err;
+ struct header_s *header;
+ u8 lut_start = 0xc0;
+
+ dtc_entry_download = 0;
+
+ /* Stop the DTC before loading anything. */
+ usb_err = ep1_generic_commandl(
+ pHDev, 1,
+ EP1_CMD_DTC_STOP
+ );
+ if(usb_err < 0) return(usb_err);
+
+ while(length) {
+ if(length < sizeof(*header)) {
+ LOG_ERROR("Malformed DTC image\n");
+ exit(1);
+ }
+
+ header = (struct header_s *)buffer;
+ buffer += sizeof(*header);
+ length -= sizeof(*header);
+
+ if(length < header->length + 1) {
+ LOG_ERROR("Malformed DTC image\n");
+ exit(1);
+ }
+
+ switch(header->type) {
+ case DTCLOAD_COMMENT:
+ break;
+
+ case DTCLOAD_ENTRY:
+ /* store entry addresses somewhere */
+ if(!strncmp("download", buffer + 1, 8)) {
+ dtc_entry_download = buffer[0];
+ }
+ break;
+
+ case DTCLOAD_LOAD:
+ /* Send the DTC program to ST7 RAM. */
+ usb_err = ep1_memory_write(
+ pHDev,
+ DTC_LOAD_BUFFER,
+ header->length + 1, buffer
+ );
+ if(usb_err < 0) return(usb_err);
+
+ /* Load it into the DTC. */
+ usb_err = ep1_generic_commandl(
+ pHDev, 3,
+ EP1_CMD_DTC_LOAD,
+ (DTC_LOAD_BUFFER >> 8),
+ DTC_LOAD_BUFFER
+ );
+ if(usb_err < 0) return(usb_err);
+
+ break;
+
+ case DTCLOAD_RUN:
+ usb_err = ep1_generic_commandl(
+ pHDev, 3,
+ EP1_CMD_DTC_CALL,
+ buffer[0],
+ EP1_CMD_DTC_WAIT
+ );
+ if(usb_err < 0) return(usb_err);
+
+ break;
+
+ case DTCLOAD_LUT_START:
+ lut_start = buffer[0];
+ break;
+
+ case DTCLOAD_LUT:
+ usb_err = ep1_memory_write(
+ pHDev,
+ ST7_USB_BUF_EP0OUT + lut_start,
+ header->length + 1, buffer
+ );
+ if(usb_err < 0) return(usb_err);
+ break;
+
+ default:
+ LOG_ERROR("Invalid DTC image record type: 0x%02x\n", header->type);
+ exit(1);
+ break;
+ }
+
+ buffer += (header->length + 1);
+ length -= (header->length + 1);
+ }
+
+ return(0);
+}
+
+
+/*
+ * Start the DTC running in download mode (waiting for 512 byte command packets on ep2).
+ */
+static
+int
+dtc_start_download(
+) {
+ int usb_err;
+ u8 ep2txr;
+
+ /* set up for download mode and make sure EP2 is set up to transmit */
+ usb_err = ep1_generic_commandl(
+ pHDev, 7,
+
+ EP1_CMD_DTC_STOP,
+ EP1_CMD_SET_UPLOAD,
+ EP1_CMD_SET_DOWNLOAD,
+ EP1_CMD_MEMORY_READ, /* read EP2TXR for its data toggle */
+ ST7_EP2TXR >> 8,
+ ST7_EP2TXR,
+ 1
+ );
+ if(usb_err < 0) return(usb_err);
+
+ /* read back ep2txr */
+ usb_err = usb_bulk_read(
+ pHDev, USB_EP1IN_ADDR,
+ &ep2txr, 1,
+ USB_TIMEOUT_MS
+ );
+ if(usb_err < 0) return(usb_err);
+
+ usb_err = ep1_generic_commandl(
+ pHDev, 13,
+
+ EP1_CMD_MEMORY_WRITE, /* preinitialize poll byte */
+ DTC_STATUS_POLL_BYTE >> 8,
+ DTC_STATUS_POLL_BYTE,
+ 1,
+ 0x00,
+ EP1_CMD_MEMORY_WRITE, /* set EP2IN to return data */
+ ST7_EP2TXR >> 8,
+ ST7_EP2TXR,
+ 1,
+ (ep2txr & ST7_EP2TXR_DTOG_TX) | ST7_EP2TXR_STAT_VALID,
+ EP1_CMD_DTC_CALL, /* start running the DTC */
+ dtc_entry_download,
+ EP1_CMD_DTC_GET_CACHED_STATUS
+ );
+ if(usb_err < 0) return(usb_err);
+
+ /* wait for completion */
+ usb_err = usb_bulk_read(
+ pHDev, USB_EP1IN_ADDR,
+ &ep2txr, 1,
+ USB_TIMEOUT_MS
+ );
+
+ return(usb_err);
+}
+
+
+static
+int
+dtc_run_download(
+ usb_dev_handle *pHDev,
+ u8 *command_buffer,
+ int command_buffer_size,
+ u8 *reply_buffer,
+ int reply_buffer_size
+) {
+ u8 ep2_buffer[USB_EP2IN_SIZE];
+ int usb_err;
+ int i;
+
+ LOG_DEBUG(": %d/%d\n", command_buffer_size, reply_buffer_size);
+
+ usb_err = usb_bulk_write(
+ pHDev,
+ USB_EP2OUT_ADDR,
+ command_buffer, USB_EP2BANK_SIZE,
+ USB_TIMEOUT_MS
+ );
+ if(usb_err < 0) return(usb_err);
+
+
+ /* Wait for DTC to finish running command buffer */
+ for(i = 5;;) {
+ usb_err = ep1_generic_commandl(
+ pHDev, 4,
+
+ EP1_CMD_MEMORY_READ,
+ DTC_STATUS_POLL_BYTE >> 8,
+ DTC_STATUS_POLL_BYTE,
+ 1
+ );
+ if(usb_err < 0) return(usb_err);
+
+ usb_err = usb_bulk_read(
+ pHDev,
+ USB_EP1IN_ADDR,
+ ep2_buffer, 1,
+ USB_TIMEOUT_MS
+ );
+ if(usb_err < 0) return(usb_err);
+
+ if(ep2_buffer[0] & 0x01) break;
+
+ if(!--i) {
+ LOG_ERROR("%s, %d: too many retries waiting for DTC status\n",
+ __FILE__, __LINE__
+ );
+ return(-ETIMEDOUT);
+ }
+ }
+
+
+ if(!reply_buffer) reply_buffer_size = 0;
+ if(reply_buffer_size) {
+ usb_err = usb_bulk_read(
+ pHDev,
+ USB_EP2IN_ADDR,
+ ep2_buffer, sizeof(ep2_buffer),
+ USB_TIMEOUT_MS
+ );
+
+ if(usb_err < (int)sizeof(ep2_buffer)) {
+ LOG_ERROR("%s, %d: Read of endpoint 2 returned %d\n",
+ __FILE__, __LINE__, usb_err
+ );
+ return(usb_err);
+ }
+
+ memcpy(reply_buffer, ep2_buffer, reply_buffer_size);
+
+ }
+
+ return(usb_err);
+}
+
+
+/*
+ * The dtc reply queue is a singly linked list that describes what to do with the reply packet that comes from the DTC. Only SCAN_IN and SCAN_IO generate these entries.
+ */
+
+typedef
+struct dtc_reply_queue_entry_s {
+ struct dtc_reply_queue_entry_s *next;
+ jtag_command_t *cmd; /* the command that resulted in this entry */
+
+ struct {
+ u8 *buffer; /* the scan buffer */
+ int size; /* size of the scan buffer in bits */
+ int offset; /* how many bits were already done before this? */
+ int length; /* how many bits are processed in this operation? */
+ enum scan_type type; /* SCAN_IN/SCAN_OUT/SCAN_IO */
+ } scan;
+} dtc_reply_queue_entry_t;
+
+
+/*
+ * The dtc_queue consists of a buffer of pending commands and a reply queue.
+ * rlink_scan and tap_state_run add to the command buffer and maybe to the reply queue.
+ */
+
+static
+struct {
+ dtc_reply_queue_entry_t *rq_head;
+ dtc_reply_queue_entry_t *rq_tail;
+ int cmd_index;
+ int reply_index;
+ u8 cmd_buffer[USB_EP2BANK_SIZE];
+} dtc_queue;
+
+
+/*
+ * The tap state queue is for accumulating TAP state changes wiithout needlessly flushing the dtc_queue. When it fills or is run, it adds the accumulated bytes to the dtc_queue.
+ */
+
+static
+struct {
+ int length;
+ u32 buffer;
+} tap_state_queue;
+
+
+
+static
+int
+dtc_queue_init(
+) {
+ dtc_queue.rq_head = NULL;
+ dtc_queue.rq_tail = NULL;
+ dtc_queue.cmd_index = 0;
+ dtc_queue.reply_index = 0;
+ return(0);
+}
+
+
+static
+inline
+dtc_reply_queue_entry_t *
+dtc_queue_enqueue_reply(
+ enum scan_type type,
+ u8 *buffer,
+ int size,
+ int offset,
+ int length,
+ jtag_command_t *cmd
+) {
+ dtc_reply_queue_entry_t *rq_entry;
+
+ rq_entry = malloc(sizeof(dtc_reply_queue_entry_t));
+ if(rq_entry != NULL) {
+ rq_entry->scan.type = type;
+ rq_entry->scan.buffer = buffer;
+ rq_entry->scan.size = size;
+ rq_entry->scan.offset = offset;
+ rq_entry->scan.length = length;
+ rq_entry->cmd = cmd;
+ rq_entry->next = NULL;
+
+ if(dtc_queue.rq_head == NULL)
+ dtc_queue.rq_head = rq_entry;
+ else
+ dtc_queue.rq_tail->next = rq_entry;
+
+ dtc_queue.rq_tail = rq_entry;
+ }
+
+ return(rq_entry);
+}
+
+
+/*
+ * Running the queue means that any pending command buffer is run and any reply data dealt with. The command buffer is then cleared for subsequent processing.
+ * The queue is automatically run by append when it is necessary to get space for the append.
+*/
+
+static
+int
+dtc_queue_run(
+) {
+ dtc_reply_queue_entry_t *rq_p, *rq_next;
+ int retval;
+ int usb_err;
+ int bit_cnt;
+ int x;
+ u8 *dtc_p, *tdo_p;
+ u8 dtc_mask, tdo_mask;
+ u8 reply_buffer[USB_EP2IN_SIZE];
+
+ retval = ERROR_OK;
+
+ if(dtc_queue.cmd_index < 1) return(retval);
+
+ dtc_queue.cmd_buffer[dtc_queue.cmd_index++] = DTC_CMD_STOP;
+
+ /* run the cmd */
+ if(dtc_queue.rq_head == NULL) {
+ usb_err = dtc_run_download(pHDev,
+ dtc_queue.cmd_buffer, dtc_queue.cmd_index,
+ NULL, 0
+ );
+ if(usb_err < 0) {
+ LOG_ERROR("dtc_run_download: %s\n", usb_strerror());
+ exit(1);
+ }
+ } else {
+ usb_err = dtc_run_download(pHDev,
+ dtc_queue.cmd_buffer, dtc_queue.cmd_index,
+ reply_buffer, dtc_queue.reply_index
+ );
+ if(usb_err < 0) {
+ LOG_ERROR("dtc_run_download: %s\n", usb_strerror());
+ exit(1);
+ } else {
+ /* process the reply, which empties the reply queue and frees its entries */
+ dtc_p = reply_buffer;
+
+ /* The rigamarole with the masks and doing it bit-by-bit is due to the fact that the scan buffer is LSb-first and the DTC code is MSb-first for hardware reasons. It was that or craft a function to do the reversal, and that wouldn't work with bit-stuffing (supplying extra bits to use mostly byte operations), or any other scheme which would throw the byte alignment off. */
+
+ for(
+ rq_p = dtc_queue.rq_head;
+ rq_p != NULL;
+ rq_p = rq_next
+ ) {
+ tdo_p = rq_p->scan.buffer + (rq_p->scan.offset / 8);
+ tdo_mask = 1 << (rq_p->scan.offset % 8);
+
+
+ bit_cnt = rq_p->scan.length;
+ if(bit_cnt >= 8) {
+ /* bytes */
+
+ dtc_mask = 1 << (8 - 1);
+
+ for(
+ ;
+ bit_cnt;
+ bit_cnt--
+ ) {
+ if(*dtc_p & dtc_mask) {
+ *tdo_p |= tdo_mask;
+ } else {
+ *tdo_p &=~ tdo_mask;
+ }
+
+ dtc_mask >>= 1;
+ if(dtc_mask == 0) {
+ dtc_p++;
+ dtc_mask = 1 << (8 - 1);
+ }
+
+ tdo_mask <<= 1;
+ if(tdo_mask == 0) {
+ tdo_p++;
+ tdo_mask = 1;
+ }
+ }
+ } else {
+ /* extra bits or last bit */
+
+ x = *dtc_p++;
+ if((
+ rq_p->scan.type == SCAN_IN
+ ) && (
+ rq_p->scan.offset != rq_p->scan.size - 1
+ )) {
+ /* extra bits were sent as a full byte with padding on the end */
+ dtc_mask = 1 << (8 - 1);
+ } else {
+ dtc_mask = 1 << (bit_cnt - 1);
+ }
+
+ for(
+ ;
+ bit_cnt;
+ bit_cnt--
+ ) {
+ if(x & dtc_mask) {
+ *tdo_p |= tdo_mask;
+ } else {
+ *tdo_p &=~ tdo_mask;
+ }
+
+ dtc_mask >>= 1;
+
+ tdo_mask <<= 1;
+ if(tdo_mask == 0) {
+ tdo_p++;
+ tdo_mask = 1;
+ }
+
+ }
+ }
+
+ if((rq_p->scan.offset + rq_p->scan.length) >= rq_p->scan.size) {
+ /* feed scan buffer back into openocd and free it */
+ if(jtag_read_buffer(rq_p->scan.buffer, rq_p->cmd->cmd.scan) != ERROR_OK) {
+ retval = ERROR_JTAG_QUEUE_FAILED;
+ }
+ free(rq_p->scan.buffer);
+ }
+
+ rq_next = rq_p->next;
+ free(rq_p);
+ }
+ dtc_queue.rq_head = NULL;
+ dtc_queue.rq_tail = NULL;
+ }
+
+ }
+
+
+ /* reset state for new appends */
+ dtc_queue.cmd_index = 0;
+ dtc_queue.reply_index = 0;
+
+ return(retval);
+}
+
+
+
+static
+int
+tap_state_queue_init(
+) {
+ tap_state_queue.length = 0;
+ tap_state_queue.buffer = 0;
+ return(0);
+}
+
+
+static
+int
+tap_state_queue_run(
+) {
+ int i;
+ int bits;
+ u8 byte;
+ int retval;
+
+ retval = 0;
+ if(!tap_state_queue.length) return(retval);
+ bits = 1;
+ byte = 0;
+ for(i = tap_state_queue.length; i--;) {
+
+ byte <<= 1;
+ if(tap_state_queue.buffer & 1) {
+ byte |= 1;
+ }
+ if((bits >= 8) || !i) {
+ byte <<= (8 - bits);
+
+ /* make sure there's room for stop, byte op, and one byte */
+ if(dtc_queue.cmd_index >= (sizeof(dtc_queue.cmd_buffer) - (1 + 1 + 1))) {
+ dtc_queue.cmd_buffer[dtc_queue.cmd_index++] =
+ DTC_CMD_STOP;
+ dtc_queue_run();
+ }
+
+#ifdef USE_HARDWARE_SHIFTER_FOR_TMS
+ if(bits == 8) {
+ dtc_queue.cmd_buffer[dtc_queue.cmd_index++] =
+ DTC_CMD_SHIFT_TMS_BYTES(1);
+ } else {
+#endif
+ dtc_queue.cmd_buffer[dtc_queue.cmd_index++] =
+ DTC_CMD_SHIFT_TMS_BITS(bits);
+#ifdef USE_HARDWARE_SHIFTER_FOR_TMS
+ }
+#endif
+
+ dtc_queue.cmd_buffer[dtc_queue.cmd_index++] =
+ byte;
+
+ byte = 0;
+ bits = 1;
+ } else {
+ bits++;
+ }
+
+ tap_state_queue.buffer >>= 1;
+ }
+ retval = tap_state_queue_init();
+ return(retval);
+}
+
+
+static
+int
+tap_state_queue_append(
+ u8 tms
+) {
+ int retval;
+
+ if(tap_state_queue.length >= sizeof(tap_state_queue.buffer) * 8) {
+ retval = tap_state_queue_run();
+ if(retval != 0) return(retval);
+ }
+
+ if(tms) {
+ tap_state_queue.buffer |= (1 << tap_state_queue.length);
+ }
+ tap_state_queue.length++;
+
+ return(0);
+}
+
+
+static
+void rlink_end_state(enum tap_state state)
+{
+ if (tap_move_map[state] != -1)
+ end_state = state;
+ else
+ {
+ LOG_ERROR("BUG: %i is not a valid end state", state);
+ exit(-1);
+ }
+}
+
+
+static
+void rlink_state_move(void) {
+
+ int i=0, tms=0;
+ u8 tms_scan = TAP_MOVE(cur_state, end_state);
+
+ for (i = 0; i < 7; i++)
+ {
+ tms = (tms_scan >> i) & 1;
+ tap_state_queue_append(tms);
+ }
+
+ cur_state = end_state;
+}
+
+static
+void rlink_path_move(pathmove_command_t *cmd)
+{
+ int num_states = cmd->num_states;
+ int state_count;
+ int tms = 0;
+
+ state_count = 0;
+ while (num_states)
+ {
+ if (tap_transitions[cur_state].low == cmd->path[state_count])
+ {
+ tms = 0;
+ }
+ else if (tap_transitions[cur_state].high == cmd->path[state_count])
+ {
+ tms = 1;
+ }
+ else
+ {
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(cmd->path[state_count]));
+ exit(-1);
+ }
+
+ tap_state_queue_append(tms);
+
+ cur_state = cmd->path[state_count];
+ state_count++;
+ num_states--;
+ }
+
+ end_state = cur_state;
+}
+
+
+static
+void rlink_runtest(int num_cycles)
+{
+ int i;
+
+ enum tap_state saved_end_state = end_state;
+
+ /* only do a state_move when we're not already in RTI */
+ if (cur_state != TAP_IDLE)
+ {
+ rlink_end_state(TAP_IDLE);
+ rlink_state_move();
+ }
+
+ /* execute num_cycles */
+ for (i = 0; i < num_cycles; i++)
+ {
+ tap_state_queue_append(0);
+ }
+
+ /* finish in end_state */
+ rlink_end_state(saved_end_state);
+ if (cur_state != end_state)
+ rlink_state_move();
+}
+
+
+/* (1) assert or (0) deassert reset lines */
+static
+void rlink_reset(int trst, int srst)
+{
+ u8 bitmap;
+ int usb_err;
+
+ bitmap = ((~(ST7_PA_NLINE_DRIVER_ENABLE)) & ST7_PA_NUNASSERTED);
+
+ if(trst) {
+ bitmap &= ~ST7_PA_NJTAG_TRST;
+ }
+ if(srst) {
+ bitmap &= ~ST7_PA_NRLINK_RST;
+ }
+
+ usb_err = ep1_generic_commandl(
+ pHDev, 5,
+
+ EP1_CMD_MEMORY_WRITE,
+ ST7_PADR >> 8,
+ ST7_PADR,
+ 1,
+ bitmap
+ );
+ if(usb_err < 0) {
+ LOG_ERROR("%s: %s\n", __func__, usb_strerror());
+ exit(1);
+ }
+}
+
+
+static
+int
+rlink_scan(
+ jtag_command_t *cmd,
+ enum scan_type type,
+ u8 *buffer,
+ int scan_size
+) {
+ int ir_scan;
+ enum tap_state saved_end_state;
+ int byte_bits;
+ int extra_bits;
+ int chunk_bits;
+ int chunk_bytes;
+ int x;
+
+ int tdi_bit_offset;
+ u8 tdi_mask, *tdi_p;
+ u8 dtc_mask;
+ dtc_reply_queue_entry_t *rq_entry;
+
+ if(scan_size < 1) {
+ LOG_ERROR("scan_size cannot be less than 1 bit\n");
+ exit(1);
+ }
+
+ ir_scan = cmd->cmd.scan->ir_scan;
+
+ /* Move to the proper state before starting to shift TDI/TDO. */
+ if (!(
+ (!ir_scan && (cur_state == TAP_DRSHIFT))
+ ||
+ (ir_scan && (cur_state == TAP_IRSHIFT))
+ )) {
+ saved_end_state = end_state;
+ rlink_end_state(ir_scan ? TAP_IRSHIFT : TAP_DRSHIFT);
+ rlink_state_move();
+ rlink_end_state(saved_end_state);
+ }
+
+ tap_state_queue_run();
+
+
+#if 0
+ printf("scan_size = %d, type=0x%x\n", scan_size, type);
+ {
+ int i;
+
+ /* clear unused bits in scan buffer for ease of debugging */
+ /* (it makes diffing output easier) */
+ buffer[scan_size / 8] &= ((1 << ((scan_size - 1) % 8) + 1) - 1);
+
+ printf("before scan:");
+ for(i = 0; i < (scan_size + 7) / 8; i++) {
+ printf(" %02x", buffer[i]);
+ }
+ printf("\n");
+ }
+#endif
+
+ /* The number of bits that can be shifted as complete bytes */
+ byte_bits = (int)(scan_size - 1) / 8 * 8;
+ /* The number of bits left over, not counting the last bit */
+ extra_bits = (scan_size - 1) - byte_bits;
+
+ tdi_bit_offset = 0;
+ tdi_p = buffer;
+ tdi_mask = 1;
+
+ if(extra_bits && (type == SCAN_OUT)) {
+ /* Schedule any extra bits into the DTC command buffer, padding as needed */
+ /* For SCAN_OUT, this comes before the full bytes so the (leading) padding bits will fall off the end */
+ /* make sure there's room for stop, byte op, and one byte */
+ if(
+ (dtc_queue.cmd_index >= sizeof(dtc_queue.cmd_buffer) - (1 + 1 + 1))
+ ) {
+ dtc_queue_run();
+ }
+
+ x = 0;
+ dtc_mask = 1 << (extra_bits - 1);
+
+ while(extra_bits--) {
+ if(*tdi_p & tdi_mask) {
+ x |= dtc_mask;
+ }
+
+ dtc_mask >>= 1;
+
+ tdi_mask <<= 1;
+ if(tdi_mask == 0) {
+ tdi_p++;
+ tdi_mask = 1;
+ }
+ }
+
+ dtc_queue.cmd_buffer[dtc_queue.cmd_index++] =
+ DTC_CMD_SHIFT_TDI_BYTES(1);
+
+ dtc_queue.cmd_buffer[dtc_queue.cmd_index++] = x;
+ }
+
+ /* Loop scheduling full bytes into the DTC command buffer */
+ while(byte_bits) {
+ if(type == SCAN_IN) {
+ /* make sure there's room for stop and byte op */
+ x = (dtc_queue.cmd_index >= sizeof(dtc_queue.cmd_buffer) - (1 + 1));
+ } else {
+ /* make sure there's room for stop, byte op, and at least one byte */
+ x = (dtc_queue.cmd_index >= sizeof(dtc_queue.cmd_buffer) - (1 + 1 + 1));
+ }
+
+ if(type != SCAN_OUT) {
+ /* make sure there's room for at least one reply byte */
+ x |= (dtc_queue.reply_index >= USB_EP2IN_SIZE - (1));
+ }
+
+ if(x) {
+ dtc_queue_run();
+ }
+
+ chunk_bits = byte_bits;
+ /* we can only use up to 16 bytes at a time */
+ if(chunk_bits > (16 * 8)) chunk_bits = (16 * 8);
+
+ if(type != SCAN_IN) {
+ /* how much is there room for, considering stop and byte op? */
+ x = (sizeof(dtc_queue.cmd_buffer) - (dtc_queue.cmd_index + 1 + 1)) * 8;
+ if(chunk_bits > x) chunk_bits = x;
+ }
+
+ if(type != SCAN_OUT) {
+ /* how much is there room for in the reply buffer? */
+ x = (USB_EP2IN_SIZE - dtc_queue.reply_index) * 8;
+ if(chunk_bits > x) chunk_bits = x;
+ }
+
+ /* so the loop will end */
+ byte_bits -= chunk_bits;
+
+ if(type != SCAN_OUT) {
+ if(dtc_queue_enqueue_reply(
+ type, buffer, scan_size, tdi_bit_offset,
+ chunk_bits,
+ cmd
+ ) == NULL) {
+ LOG_ERROR("enqueuing DTC reply entry: %s\n", strerror(errno));
+ exit(1);
+ }
+
+ tdi_bit_offset += chunk_bits;
+ }
+
+ /* chunk_bits is a multiple of 8, so there are no rounding issues. */
+ chunk_bytes = chunk_bits / 8;
+
+ switch(type) {
+ case SCAN_IN:
+ x = DTC_CMD_SHIFT_TDO_BYTES(chunk_bytes);
+ break;
+ case SCAN_OUT:
+ x = DTC_CMD_SHIFT_TDI_BYTES(chunk_bytes);
+ break;
+ default:
+ x = DTC_CMD_SHIFT_TDIO_BYTES(chunk_bytes);
+ break;
+ }
+ dtc_queue.cmd_buffer[dtc_queue.cmd_index++] = x;
+
+ if(type != SCAN_IN) {
+ x = 0;
+ dtc_mask = 1 << (8 - 1);
+
+ while(chunk_bits--) {
+ if(*tdi_p & tdi_mask) {
+ x |= dtc_mask;
+ }
+
+ dtc_mask >>= 1;
+ if(dtc_mask == 0) {
+ dtc_queue.cmd_buffer[dtc_queue.cmd_index++] = x;
+ dtc_queue.reply_index++;
+ x = 0;
+ dtc_mask = 1 << (8 - 1);
+ }
+
+ tdi_mask <<= 1;
+ if(tdi_mask == 0) {
+ tdi_p++;
+ tdi_mask = 1;
+ }
+ }
+ }
+ }
+
+ if(extra_bits && (type != SCAN_OUT)) {
+ /* Schedule any extra bits into the DTC command buffer */
+ /* make sure there's room for stop, byte op, and one byte */
+ if(
+ (dtc_queue.cmd_index >= sizeof(dtc_queue.cmd_buffer) - (1 + 1 + 1))
+ ||
+ (dtc_queue.reply_index >= USB_EP2IN_SIZE - (1))
+ ) {
+ dtc_queue_run();
+ }
+
+ if(dtc_queue_enqueue_reply(
+ type, buffer, scan_size, tdi_bit_offset,
+ extra_bits,
+ cmd
+ ) == NULL) {
+ LOG_ERROR("enqueuing DTC reply entry: %s\n", strerror(errno));
+ exit(1);
+ }
+
+ tdi_bit_offset += extra_bits;
+
+ if(type == SCAN_IN) {
+ dtc_queue.cmd_buffer[dtc_queue.cmd_index++] =
+ DTC_CMD_SHIFT_TDO_BYTES(1);
+
+ } else {
+ dtc_queue.cmd_buffer[dtc_queue.cmd_index++] =
+ DTC_CM...
[truncated message content] |
|
From: <oh...@ma...> - 2008-12-17 15:55:16
|
Author: oharboe
Date: 2008-12-17 15:55:12 +0100 (Wed, 17 Dec 2008)
New Revision: 1257
Modified:
trunk/src/jtag/zy1000.c
trunk/src/openocd.c
zy1000/trunk/build/tcl/openocd.cfg
Log:
check syntax for init/version
Modified: trunk/src/jtag/zy1000.c
===================================================================
--- trunk/src/jtag/zy1000.c 2008-12-17 14:07:03 UTC (rev 1256)
+++ trunk/src/jtag/zy1000.c 2008-12-17 14:55:12 UTC (rev 1257)
@@ -355,7 +355,7 @@
int zy1000_init(void)
{
- LOG_ERROR("%s\n", ZYLIN_OPENOCD_VERSION);
+ LOG_USER("%s", ZYLIN_OPENOCD_VERSION);
ZY1000_POKE(ZY1000_JTAG_BASE+0x10, 0x30); // Turn on LED1 & LED2
Modified: trunk/src/openocd.c
===================================================================
--- trunk/src/openocd.c 2008-12-17 14:07:03 UTC (rev 1256)
+++ trunk/src/openocd.c 2008-12-17 14:55:12 UTC (rev 1257)
@@ -82,6 +82,9 @@
/* Give TELNET a way to find out what version this is */
int handle_version_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
+ if (argc!=0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
command_print(cmd_ctx, OPENOCD_VERSION);
return ERROR_OK;
@@ -123,6 +126,10 @@
/* OpenOCD can't really handle failure of this command. Patches welcome! :-) */
int handle_init_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
+
+ if (argc!=0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
int retval;
static int initialized=0;
if (initialized)
Modified: zy1000/trunk/build/tcl/openocd.cfg
===================================================================
--- zy1000/trunk/build/tcl/openocd.cfg 2008-12-17 14:07:03 UTC (rev 1256)
+++ zy1000/trunk/build/tcl/openocd.cfg 2008-12-17 14:55:12 UTC (rev 1257)
@@ -90,6 +90,16 @@
}
+add_help_text ls "<directory> - lists files in directory"
+add_help_text reboot "reboots ZY1000 unit"
+add_help_text mac "prints MAC number of ZY1000 unit"
+add_help_text ip "print current IP number of ZY1000 unit"
+
+
+proc zy1000_flash {} {
+ set t [lindex 0 [ocd_flash_banks]]
+ return $t(base)
+}
interface ZY1000
telnet_port 23
@@ -105,18 +115,7 @@
# Here we do *not* catch the error since we want the file & line number to appear
# in the log
script /config/settings/openocd.cfg
-init result
+init
# Startup was OK
set startup_status 1
-
-add_help_text ls "<directory> - lists files in directory"
-add_help_text reboot "reboots ZY1000 unit"
-add_help_text mac "prints MAC number of ZY1000 unit"
-add_help_text ip "print current IP number of ZY1000 unit"
-
-
-proc zy1000_flash {} {
- set t [lindex 0 [ocd_flash_banks]]
- return $t(base)
-}
\ No newline at end of file
|
|
From: <oh...@ma...> - 2008-12-17 15:07:05
|
Author: oharboe
Date: 2008-12-17 15:07:03 +0100 (Wed, 17 Dec 2008)
New Revision: 1256
Modified:
trunk/src/jtag/zy1000.c
zy1000/trunk/build/menu/zy1000menu.xml
zy1000/trunk/build/tcl/index.tcl
Log:
more houskeeping
Modified: trunk/src/jtag/zy1000.c
===================================================================
--- trunk/src/jtag/zy1000.c 2008-12-17 13:39:40 UTC (rev 1255)
+++ trunk/src/jtag/zy1000.c 2008-12-17 14:07:03 UTC (rev 1256)
@@ -319,6 +319,25 @@
}
+static int
+zylinjtag_Jim_Command_powerstatus(Jim_Interp *interp,
+ int argc,
+ Jim_Obj * const *argv)
+{
+ if (argc != 1)
+ {
+ Jim_WrongNumArgs(interp, 1, argv, "powerstatus");
+ return JIM_ERR;
+ }
+
+ cyg_uint32 status;
+ ZY1000_PEEK(ZY1000_JTAG_BASE+0x10, status);
+
+ Jim_SetResult(interp, Jim_NewIntObj(interp, (status&0x80)!=0));
+
+ return JIM_OK;
+}
+
int zy1000_register_commands(struct command_context_s *cmd_ctx)
{
register_command(cmd_ctx, NULL, "power", handle_power_command, COMMAND_ANY,
@@ -326,11 +345,14 @@
register_command(cmd_ctx, NULL, "zy1000_version", handle_zy1000_version_command,
COMMAND_EXEC, "show zy1000 version numbers");
+ Jim_CreateCommand(interp, "powerstatus", zylinjtag_Jim_Command_powerstatus, NULL, NULL);
return ERROR_OK;
}
+
+
int zy1000_init(void)
{
LOG_ERROR("%s\n", ZYLIN_OPENOCD_VERSION);
Modified: zy1000/trunk/build/menu/zy1000menu.xml
===================================================================
--- zy1000/trunk/build/menu/zy1000menu.xml 2008-12-17 13:39:40 UTC (rev 1255)
+++ zy1000/trunk/build/menu/zy1000menu.xml 2008-12-17 14:07:03 UTC (rev 1256)
@@ -85,7 +85,7 @@
<tr>
<td class="fontbigger" style="height:20px;padding-right:10px;">Target power:
<tcl>
- if {[expr [peek 0x08000010] & 0x80]!=0} {
+ if {[powerstatus]!=0} {
append buffer "no"
} else {
append buffer "yes"
Modified: zy1000/trunk/build/tcl/index.tcl
===================================================================
--- zy1000/trunk/build/tcl/index.tcl 2008-12-17 13:39:40 UTC (rev 1255)
+++ zy1000/trunk/build/tcl/index.tcl 2008-12-17 14:07:03 UTC (rev 1256)
@@ -187,7 +187,7 @@
<tr>
<td class="fontbigger" style="height:20px;padding-right:10px;">Target power:
<tcl>
- if {[expr [peek 0x08000010] & 0x80]!=0} {
+ if {[powerstatus]!=0} {
append buffer "no"
} else {
append buffer "yes"
|
|
From: <oh...@ma...> - 2008-12-17 14:39:48
|
Author: oharboe
Date: 2008-12-17 14:39:40 +0100 (Wed, 17 Dec 2008)
New Revision: 1255
Modified:
trunk/src/ecosboard.c
trunk/src/helper/ioutil.c
trunk/src/server/telnet_server.c
Log:
houskeeping
Modified: trunk/src/ecosboard.c
===================================================================
--- trunk/src/ecosboard.c 2008-12-17 12:50:07 UTC (rev 1254)
+++ trunk/src/ecosboard.c 2008-12-17 13:39:40 UTC (rev 1255)
@@ -419,61 +419,7 @@
return JIM_OK;
}
-static int zylinjtag_Jim_Command_mac(Jim_Interp *interp, int argc,
- Jim_Obj * const *argv)
-{
- Jim_Obj *tclOutput = Jim_NewStringObj(interp, "", 0);
-
- Jim_AppendString(httpstate.jim_interp, tclOutput, hwaddr, strlen(hwaddr));
-
- Jim_SetResult(interp, tclOutput);
-
- return JIM_OK;
-}
-
-static int zylinjtag_Jim_Command_ip(Jim_Interp *interp, int argc,
- Jim_Obj * const *argv)
-{
- Jim_Obj *tclOutput = Jim_NewStringObj(interp, "", 0);
-
- struct ifaddrs *ifa = NULL, *ifp = NULL;
-
- if (getifaddrs(&ifp) < 0)
- {
- return JIM_ERR;
- }
-
- for (ifa = ifp; ifa; ifa = ifa->ifa_next)
- {
- char ip[200];
- socklen_t salen;
-
- if (ifa->ifa_addr->sa_family == AF_INET)
- salen = sizeof(struct sockaddr_in);
- else if (ifa->ifa_addr->sa_family == AF_INET6)
- salen = sizeof(struct sockaddr_in6);
- else
- continue;
-
- if (getnameinfo(ifa->ifa_addr, salen, ip, sizeof(ip), NULL, 0,
- NI_NUMERICHOST) < 0)
- {
- continue;
- }
-
- Jim_AppendString(httpstate.jim_interp, tclOutput, ip, strlen(ip));
- break;
-
- }
-
- freeifaddrs(ifp);
-
- Jim_SetResult(interp, tclOutput);
-
- return JIM_OK;
-}
-
extern Jim_Interp *interp;
static void zylinjtag_startNetwork()
@@ -506,10 +452,6 @@
zylinjtag_Jim_Command_reboot, NULL, NULL);
Jim_CreateCommand(httpstate.jim_interp, "threads",
zylinjtag_Jim_Command_threads, NULL, NULL);
- Jim_CreateCommand(httpstate.jim_interp, "mac", zylinjtag_Jim_Command_mac,
- NULL, NULL);
- Jim_CreateCommand(httpstate.jim_interp, "ip", zylinjtag_Jim_Command_ip,
- NULL, NULL);
Jim_CreateCommand(httpstate.jim_interp, "format_jffs2",
zylinjtag_Jim_Command_format_jffs2, NULL, NULL);
Modified: trunk/src/helper/ioutil.c
===================================================================
--- trunk/src/helper/ioutil.c 2008-12-17 12:50:07 UTC (rev 1254)
+++ trunk/src/helper/ioutil.c 2008-12-17 13:39:40 UTC (rev 1255)
@@ -63,6 +63,8 @@
#include <string.h>
+#include <ifaddrs.h>
+
#include <unistd.h>
#include <stdio.h>
@@ -557,6 +559,120 @@
return JIM_OK;
}
+
+/* not so pretty code to fish out ip number*/
+static int zylinjtag_Jim_Command_ip(Jim_Interp *interp, int argc,
+ Jim_Obj * const *argv)
+{
+ Jim_Obj *tclOutput = Jim_NewStringObj(interp, "", 0);
+
+ struct ifaddrs *ifa = NULL, *ifp = NULL;
+
+ if (getifaddrs(&ifp) < 0)
+ {
+ return JIM_ERR;
+ }
+
+ for (ifa = ifp; ifa; ifa = ifa->ifa_next)
+ {
+ char ip[200];
+ socklen_t salen;
+
+ if (ifa->ifa_addr->sa_family == AF_INET)
+ salen = sizeof(struct sockaddr_in);
+ else if (ifa->ifa_addr->sa_family == AF_INET6)
+ salen = sizeof(struct sockaddr_in6);
+ else
+ continue;
+
+ if (getnameinfo(ifa->ifa_addr, salen, ip, sizeof(ip), NULL, 0,
+ NI_NUMERICHOST) < 0)
+ {
+ continue;
+ }
+
+ Jim_AppendString(interp, tclOutput, ip, strlen(ip));
+ break;
+
+ }
+
+ freeifaddrs(ifp);
+
+ Jim_SetResult(interp, tclOutput);
+
+ return JIM_OK;
+}
+
+
+/* not so pretty code to fish out eth0 mac address */
+static int zylinjtag_Jim_Command_mac(Jim_Interp *interp, int argc,
+ Jim_Obj * const *argv)
+{
+
+
+ struct ifreq *ifr, *ifend;
+ struct ifreq ifreq;
+ struct ifconf ifc;
+ struct ifreq ifs[5];
+ int SockFD;
+
+ SockFD = socket(AF_INET, SOCK_DGRAM, 0);
+ if (SockFD < 0)
+ {
+ return JIM_ERR;
+ }
+
+ ifc.ifc_len = sizeof(ifs);
+ ifc.ifc_req = ifs;
+ if (ioctl(SockFD, SIOCGIFCONF, &ifc) < 0)
+ {
+ close(SockFD);
+ return JIM_ERR;
+ }
+
+ ifend = ifs + (ifc.ifc_len / sizeof(struct ifreq));
+ for (ifr = ifc.ifc_req; ifr < ifend; ifr++)
+ {
+ //if (ifr->ifr_addr.sa_family == AF_INET)
+ {
+ if (strcmp("eth0", ifr->ifr_name)!=0)
+ continue;
+ strncpy(ifreq.ifr_name, ifr->ifr_name, sizeof(ifreq.ifr_name));
+ if (ioctl(SockFD, SIOCGIFHWADDR, &ifreq) < 0)
+ {
+ close(SockFD);
+ return JIM_ERR;
+ }
+
+ close(SockFD);
+
+
+ Jim_Obj *tclOutput = Jim_NewStringObj(interp, "", 0);
+
+ char buffer[256];
+ sprintf(buffer, "%02x-%02x-%02x-%02x-%02x-%02x",
+ ifreq.ifr_hwaddr.sa_data[0]&0xff,
+ ifreq.ifr_hwaddr.sa_data[1]&0xff,
+ ifreq.ifr_hwaddr.sa_data[2]&0xff,
+ ifreq.ifr_hwaddr.sa_data[3]&0xff,
+ ifreq.ifr_hwaddr.sa_data[4]&0xff,
+ ifreq.ifr_hwaddr.sa_data[5]&0xff);
+
+ Jim_AppendString(interp, tclOutput, buffer, strlen(buffer));
+
+ Jim_SetResult(interp, tclOutput);
+
+ return JIM_OK;
+ }
+ }
+ close(SockFD);
+
+ return JIM_ERR;
+
+}
+
+
+
int ioutil_init(struct command_context_s *cmd_ctx)
{
register_command(cmd_ctx, NULL, "rm", handle_rm_command, COMMAND_ANY,
@@ -583,7 +699,12 @@
Jim_CreateCommand(interp, "poke", zylinjtag_Jim_Command_poke, NULL, NULL);
Jim_CreateCommand(interp, "ls", zylinjtag_Jim_Command_ls, NULL, NULL);
+ Jim_CreateCommand(interp, "mac", zylinjtag_Jim_Command_mac,
+ NULL, NULL);
+ Jim_CreateCommand(interp, "ip", zylinjtag_Jim_Command_ip,
+ NULL, NULL);
+
return ERROR_OK;
}
Modified: trunk/src/server/telnet_server.c
===================================================================
--- trunk/src/server/telnet_server.c 2008-12-17 12:50:07 UTC (rev 1254)
+++ trunk/src/server/telnet_server.c 2008-12-17 13:39:40 UTC (rev 1255)
@@ -626,7 +626,7 @@
COMMAND_EXEC, "exit telnet session");
register_command(command_context, NULL, "telnet_port", handle_telnet_port_command,
- COMMAND_CONFIG, "port on which to listen for incoming telnet connections");
+ COMMAND_ANY, "port on which to listen for incoming telnet connections");
return ERROR_OK;
}
|
|
From: <oh...@ma...> - 2008-12-17 13:50:09
|
Author: oharboe
Date: 2008-12-17 13:50:07 +0100 (Wed, 17 Dec 2008)
New Revision: 1254
Modified:
trunk/src/server/httpd.c
Log:
fixed gaffe in post handling
Modified: trunk/src/server/httpd.c
===================================================================
--- trunk/src/server/httpd.c 2008-12-17 11:33:33 UTC (rev 1253)
+++ trunk/src/server/httpd.c 2008-12-17 12:50:07 UTC (rev 1254)
@@ -175,9 +175,13 @@
int retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__ );
free((void *) script);
if (retcode != JIM_OK)
- return retcode;
+ {
+ Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
+ } else
+ {
+ Jim_SetResult(interp, Jim_GetResult(interp));
+ }
- Jim_SetResult(interp, Jim_GetResult(interp));
return JIM_OK;
}
@@ -292,9 +296,8 @@
r = (struct httpd_request *) *ptr;
r->post = post;
+ Jim_SetVariableStr(interp, "httppostdata", Jim_NewDictObj(interp, NULL, 0));
-// r->dict = Jim_NewDictObj(interp, NULL, 0);
-
/* fill in url query strings in dictonary */
MHD_get_connection_values(connection, MHD_GET_ARGUMENT_KIND,
record_arg, r);
@@ -327,7 +330,6 @@
}
/* hand over to request who will be using it. */
- //Jim_SetGlobalVariableStr(interp, "httppostdata", Jim_GetVariableStr(interp, "httppostdata", 0));
// r->dict = NULL;
|
|
From: <oh...@ma...> - 2008-12-17 12:33:49
|
Author: oharboe
Date: 2008-12-17 12:33:33 +0100 (Wed, 17 Dec 2008)
New Revision: 1253
Modified:
zy1000/trunk/build/include/rom.h
zy1000/trunk/build/tcl/browsemem.tcl
zy1000/trunk/build/tcl/downloadmem.tcl
zy1000/trunk/build/tcl/editconfigs.tcl
zy1000/trunk/build/tcl/editfile.tcl
zy1000/trunk/build/tcl/erase.tcl
zy1000/trunk/build/tcl/flash.tcl
zy1000/trunk/build/tcl/flashinfo.tcl
zy1000/trunk/build/tcl/guiupload.tcl
zy1000/trunk/build/tcl/index.tcl
zy1000/trunk/build/tcl/log.tcl
zy1000/trunk/build/tcl/openocd.tcl
zy1000/trunk/build/tcl/preconfig.tcl
zy1000/trunk/build/tcl/production.tcl
zy1000/trunk/build/tcl/reload.tcl
zy1000/trunk/build/tcl/run.tcl
zy1000/trunk/build/tcl/support.tcl
zy1000/trunk/build/tcl/targets.tcl
zy1000/trunk/build/tcl/terminal.tcl
zy1000/trunk/build/tcl/upgrade.tcl
zy1000/trunk/build/tcl/zy1000.tcl
Log:
wip
Modified: zy1000/trunk/build/include/rom.h
===================================================================
--- zy1000/trunk/build/include/rom.h 2008-12-17 09:56:59 UTC (rev 1252)
+++ zy1000/trunk/build/include/rom.h 2008-12-17 11:33:33 UTC (rev 1253)
@@ -2,688 +2,688 @@
static CYGBLD_ATTRIB_ALIGN(4) const unsigned char filedata[] = {
0x2e, 0x6d, 0x6f, 0x52, 0xaa, 0x00, 0x00, 0x00,
- 0x00, 0xde, 0x07, 0x00, 0x04, 0x03, 0x02, 0x01,
+ 0xc0, 0xdd, 0x07, 0x00, 0x04, 0x03, 0x02, 0x01,
0x52, 0x4f, 0x4d, 0x46, 0x53, 0x20, 0x76, 0x31,
0x2e, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x6f, 0x01, 0x09, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x40, 0x05, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x60, 0x15, 0x00, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0x60, 0x15, 0x00, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x30, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xe0, 0x8f, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x80, 0x2e, 0x00, 0x00,
+ 0xe2, 0xcb, 0x48, 0x49, 0x80, 0x2e, 0x00, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x31, 0x3e,
0x01, 0x00, 0x6f, 0x01, 0x02, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x60, 0x01, 0x00, 0x00,
- 0x77, 0x3e, 0x46, 0x49, 0xa0, 0x1a, 0x00, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0xa0, 0x1a, 0x00, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x32, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x90, 0x37, 0x00, 0x00,
- 0x2b, 0x3e, 0x46, 0x49, 0x60, 0xbe, 0x00, 0x00,
+ 0xec, 0xcb, 0x48, 0x49, 0x60, 0xbe, 0x00, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x33, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x8a, 0x2b, 0x00, 0x00,
- 0x2b, 0x3e, 0x46, 0x49, 0x00, 0xf6, 0x00, 0x00,
+ 0xec, 0xcb, 0x48, 0x49, 0x00, 0xf6, 0x00, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x34, 0x3e,
0x01, 0x00, 0x6f, 0x01, 0x02, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x60, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x00, 0x1c, 0x00, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x00, 0x1c, 0x00, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x35, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xae, 0x37, 0x00, 0x00,
- 0x2c, 0x3e, 0x46, 0x49, 0xa0, 0x21, 0x01, 0x00,
+ 0xec, 0xcb, 0x48, 0x49, 0xa0, 0x21, 0x01, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x36, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x9d, 0x2f, 0x00, 0x00,
- 0x2c, 0x3e, 0x46, 0x49, 0x60, 0x59, 0x01, 0x00,
+ 0xed, 0xcb, 0x48, 0x49, 0x60, 0x59, 0x01, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x37, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xf3, 0x2d, 0x00, 0x00,
- 0x2c, 0x3e, 0x46, 0x49, 0x00, 0x89, 0x01, 0x00,
+ 0xed, 0xcb, 0x48, 0x49, 0x00, 0x89, 0x01, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x9e, 0x00, 0x00, 0x00,
- 0x2c, 0x3e, 0x46, 0x49, 0x00, 0xb7, 0x01, 0x00,
+ 0xed, 0xcb, 0x48, 0x49, 0x00, 0xb7, 0x01, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x39, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x78, 0x38, 0x00, 0x00,
- 0x2d, 0x3e, 0x46, 0x49, 0xa0, 0xb7, 0x01, 0x00,
+ 0xed, 0xcb, 0x48, 0x49, 0xa0, 0xb7, 0x01, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x31, 0x30, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x06, 0x2e, 0x00, 0x00,
- 0x2d, 0x3e, 0x46, 0x49, 0x20, 0xf0, 0x01, 0x00,
+ 0xee, 0xcb, 0x48, 0x49, 0x20, 0xf0, 0x01, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x31, 0x31, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x8b, 0x65, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x40, 0x1e, 0x02, 0x00,
+ 0xe2, 0xcb, 0x48, 0x49, 0x40, 0x1e, 0x02, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x31, 0x32, 0x3e,
0x08, 0x00, 0x6f, 0x01, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x92, 0x02, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x60, 0xdb, 0x07, 0x00,
+ 0xe2, 0xcb, 0x48, 0x49, 0x20, 0xdb, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x31, 0x33, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xf3, 0x2e, 0x00, 0x00,
- 0x2e, 0x3e, 0x46, 0x49, 0xe0, 0x83, 0x02, 0x00,
+ 0xee, 0xcb, 0x48, 0x49, 0xe0, 0x83, 0x02, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x31, 0x34, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xa9, 0x39, 0x00, 0x00,
- 0x2f, 0x3e, 0x46, 0x49, 0xe0, 0xb2, 0x02, 0x00,
+ 0xee, 0xcb, 0x48, 0x49, 0xe0, 0xb2, 0x02, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x31, 0x35, 0x3e,
0x01, 0x00, 0x6f, 0x01, 0x02, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x00, 0x03, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x60, 0x1c, 0x00, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x60, 0x1c, 0x00, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x31, 0x36, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x59, 0x26, 0x00, 0x00,
- 0x2f, 0x3e, 0x46, 0x49, 0xa0, 0xec, 0x02, 0x00,
+ 0xef, 0xcb, 0x48, 0x49, 0xa0, 0xec, 0x02, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x31, 0x37, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x22, 0x03, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x00, 0x13, 0x03, 0x00,
+ 0xe2, 0xcb, 0x48, 0x49, 0x00, 0x13, 0x03, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x31, 0x38, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x6a, 0x08, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x40, 0x16, 0x03, 0x00,
+ 0xe2, 0xcb, 0x48, 0x49, 0x40, 0x16, 0x03, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x31, 0x39, 0x3e,
0x01, 0x00, 0x6f, 0x01, 0x02, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xc0, 0x02, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x60, 0x1f, 0x00, 0x00,
+ 0xeb, 0xcb, 0x48, 0x49, 0x60, 0x1f, 0x00, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x32, 0x30, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0xed, 0x03, 0x01, 0x02, 0x30, 0x09, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0xc0, 0x1e, 0x03, 0x00,
+ 0xed, 0x03, 0x01, 0x02, 0xf9, 0x08, 0x00, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0xc0, 0x1e, 0x03, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x32, 0x31, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xdf, 0x2a, 0x00, 0x00,
- 0x35, 0x3e, 0x46, 0x49, 0x00, 0x28, 0x03, 0x00,
+ 0xf3, 0xcb, 0x48, 0x49, 0xc0, 0x27, 0x03, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x32, 0x32, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x19, 0x30, 0x00, 0x00,
- 0x35, 0x3e, 0x46, 0x49, 0xe0, 0x52, 0x03, 0x00,
+ 0xf4, 0xcb, 0x48, 0x49, 0xa0, 0x52, 0x03, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x32, 0x33, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xcb, 0x32, 0x00, 0x00,
- 0x35, 0x3e, 0x46, 0x49, 0x00, 0x83, 0x03, 0x00,
+ 0xf4, 0xcb, 0x48, 0x49, 0xc0, 0x82, 0x03, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x32, 0x34, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x0d, 0x29, 0x00, 0x00,
- 0x36, 0x3e, 0x46, 0x49, 0xe0, 0xb5, 0x03, 0x00,
+ 0xf4, 0xcb, 0x48, 0x49, 0xa0, 0xb5, 0x03, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x32, 0x35, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xd7, 0x2d, 0x00, 0x00,
- 0x36, 0x3e, 0x46, 0x49, 0x00, 0xdf, 0x03, 0x00,
+ 0xf4, 0xcb, 0x48, 0x49, 0xc0, 0xde, 0x03, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x32, 0x36, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x26, 0x01, 0x00, 0x00,
- 0x36, 0x3e, 0x46, 0x49, 0xe0, 0x0c, 0x04, 0x00,
+ 0xf5, 0xcb, 0x48, 0x49, 0xa0, 0x0c, 0x04, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x32, 0x37, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x3f, 0x0b, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x20, 0x0e, 0x04, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0xe0, 0x0d, 0x04, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x32, 0x38, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x91, 0x30, 0x00, 0x00,
- 0x37, 0x3e, 0x46, 0x49, 0x60, 0x19, 0x04, 0x00,
+ 0xf5, 0xcb, 0x48, 0x49, 0x20, 0x19, 0x04, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x32, 0x39, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x41, 0x07, 0x00, 0x00,
- 0x37, 0x3e, 0x46, 0x49, 0x00, 0x4a, 0x04, 0x00,
+ 0xf5, 0xcb, 0x48, 0x49, 0xc0, 0x49, 0x04, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x33, 0x30, 0x3e,
0x01, 0x00, 0x6f, 0x01, 0x02, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xe0, 0x06, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x20, 0x22, 0x00, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x20, 0x22, 0x00, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x33, 0x31, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x22, 0x48, 0x00, 0x00,
- 0x37, 0x3e, 0x46, 0x49, 0x60, 0x51, 0x04, 0x00,
+ 0xf5, 0xcb, 0x48, 0x49, 0x20, 0x51, 0x04, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x33, 0x32, 0x3e,
0x01, 0x00, 0x6f, 0x01, 0x04, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x00, 0x01, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x00, 0x29, 0x00, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0x00, 0x29, 0x00, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x33, 0x33, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xca, 0x2e, 0x00, 0x00,
- 0x37, 0x3e, 0x46, 0x49, 0xa0, 0x99, 0x04, 0x00,
+ 0xf6, 0xcb, 0x48, 0x49, 0x60, 0x99, 0x04, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x33, 0x34, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xab, 0x30, 0x00, 0x00,
- 0x38, 0x3e, 0x46, 0x49, 0x80, 0xc8, 0x04, 0x00,
+ 0xf6, 0xcb, 0x48, 0x49, 0x40, 0xc8, 0x04, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x33, 0x35, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x70, 0x01, 0x00, 0x00,
- 0x38, 0x3e, 0x46, 0x49, 0x40, 0xf9, 0x04, 0x00,
+ 0xf7, 0xcb, 0x48, 0x49, 0x00, 0xf9, 0x04, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x33, 0x36, 0x3e,
0x01, 0x00, 0x6f, 0x01, 0x02, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x60, 0x00, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x00, 0x2a, 0x00, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0x00, 0x2a, 0x00, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x33, 0x37, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xb3, 0x35, 0x00, 0x00,
- 0x38, 0x3e, 0x46, 0x49, 0xc0, 0xfa, 0x04, 0x00,
+ 0xf7, 0xcb, 0x48, 0x49, 0x80, 0xfa, 0x04, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x33, 0x38, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x13, 0x06, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x80, 0x30, 0x05, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0x40, 0x30, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x33, 0x39, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x65, 0x03, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0xa0, 0x36, 0x05, 0x00,
+ 0xe2, 0xcb, 0x48, 0x49, 0x60, 0x36, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x34, 0x30, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xce, 0x00, 0x00, 0x00,
- 0x77, 0x3e, 0x46, 0x49, 0x20, 0x3a, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0xe0, 0x39, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x34, 0x31, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x51, 0x08, 0x00, 0x00,
- 0x77, 0x3e, 0x46, 0x49, 0x00, 0x3b, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0xc0, 0x3a, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x34, 0x32, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x62, 0x09, 0x00, 0x00,
- 0x77, 0x3e, 0x46, 0x49, 0x60, 0x43, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x20, 0x43, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x34, 0x33, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x14, 0x04, 0x00, 0x00,
- 0x77, 0x3e, 0x46, 0x49, 0xe0, 0x4c, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0xa0, 0x4c, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x34, 0x34, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x60, 0x00, 0x00, 0x00,
- 0x77, 0x3e, 0x46, 0x49, 0x00, 0x51, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0xc0, 0x50, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x34, 0x35, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x23, 0x01, 0x00, 0x00,
- 0x77, 0x3e, 0x46, 0x49, 0x60, 0x51, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x20, 0x51, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x34, 0x36, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x64, 0x00, 0x00, 0x00,
- 0x77, 0x3e, 0x46, 0x49, 0xa0, 0x52, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x60, 0x52, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x34, 0x37, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x69, 0x00, 0x00, 0x00,
- 0x77, 0x3e, 0x46, 0x49, 0x20, 0x53, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0xe0, 0x52, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x34, 0x38, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xa9, 0x00, 0x00, 0x00,
- 0x77, 0x3e, 0x46, 0x49, 0xa0, 0x53, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x60, 0x53, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x34, 0x39, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xe0, 0x8f, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x60, 0x54, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x20, 0x54, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x35, 0x30, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x85, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x40, 0xe4, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x00, 0xe4, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x35, 0x31, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x3d, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0xe0, 0xe4, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0xa0, 0xe4, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x35, 0x32, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xfc, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x20, 0xe5, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0xe0, 0xe4, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x35, 0x33, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xfe, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x20, 0xe6, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0xe0, 0xe5, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x35, 0x34, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xb4, 0x01, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x20, 0xe7, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0xe0, 0xe6, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x35, 0x35, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x3a, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0xe0, 0xe8, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0xa0, 0xe8, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x35, 0x36, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x11, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x20, 0xe9, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0xe0, 0xe8, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x35, 0x37, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xee, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x40, 0xe9, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x00, 0xe9, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x35, 0x38, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x26, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x40, 0xea, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x00, 0xea, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x35, 0x39, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x7b, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x80, 0xea, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x40, 0xea, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x36, 0x30, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x7b, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x00, 0xeb, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0xc0, 0xea, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x36, 0x31, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xa5, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x80, 0xeb, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x40, 0xeb, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x36, 0x32, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x72, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x40, 0xec, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x00, 0xec, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x36, 0x33, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x86, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0xc0, 0xec, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x80, 0xec, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x36, 0x34, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x75, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x60, 0xed, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x20, 0xed, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x36, 0x35, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x99, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0xe0, 0xed, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0xa0, 0xed, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x36, 0x36, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xad, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x80, 0xee, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x40, 0xee, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x36, 0x37, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x72, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x40, 0xef, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x00, 0xef, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x36, 0x38, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x79, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0xc0, 0xef, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x80, 0xef, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x36, 0x39, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x6f, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x40, 0xf0, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x00, 0xf0, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x37, 0x30, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x50, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0xc0, 0xf0, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x80, 0xf0, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x37, 0x31, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x8d, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x20, 0xf1, 0x05, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0xe0, 0xf0, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x37, 0x32, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x35, 0x01, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0xc0, 0xf1, 0x05, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0x80, 0xf1, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x37, 0x33, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x33, 0x01, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x00, 0xf3, 0x05, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0xc0, 0xf2, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x37, 0x34, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x6c, 0x01, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x40, 0xf4, 0x05, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0x00, 0xf4, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x37, 0x35, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x36, 0x01, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0xc0, 0xf5, 0x05, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0x80, 0xf5, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x37, 0x36, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x5d, 0x01, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x00, 0xf7, 0x05, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0xc0, 0xf6, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x37, 0x37, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x4a, 0x01, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x60, 0xf8, 0x05, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0x20, 0xf8, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x37, 0x38, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xc6, 0x01, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0xc0, 0xf9, 0x05, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0x80, 0xf9, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x37, 0x39, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xc0, 0x03, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0xa0, 0xfb, 0x05, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0x60, 0xfb, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x38, 0x30, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x0a, 0x0c, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x60, 0xff, 0x05, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0x20, 0xff, 0x05, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x38, 0x31, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x5f, 0x01, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x80, 0x0b, 0x06, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0x40, 0x0b, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x38, 0x32, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x19, 0x01, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0xe0, 0x0c, 0x06, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0xa0, 0x0c, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x38, 0x33, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x09, 0x01, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x00, 0x0e, 0x06, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0xc0, 0x0d, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x38, 0x34, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x60, 0x01, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x20, 0x0f, 0x06, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0xe0, 0x0e, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x38, 0x35, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x31, 0x01, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x80, 0x10, 0x06, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0x40, 0x10, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x38, 0x36, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xa9, 0x00, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0xc0, 0x11, 0x06, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0x80, 0x11, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x38, 0x37, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xf1, 0x08, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x80, 0x12, 0x06, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0x40, 0x12, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x38, 0x38, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x86, 0x01, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x80, 0x1b, 0x06, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0x40, 0x1b, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x38, 0x39, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x65, 0x01, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0x20, 0x1d, 0x06, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0xe0, 0x1c, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x39, 0x30, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x84, 0x0f, 0x00, 0x00,
- 0x2a, 0x3e, 0x46, 0x49, 0xa0, 0x1e, 0x06, 0x00,
+ 0xe8, 0xcb, 0x48, 0x49, 0x60, 0x1e, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x39, 0x31, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x01, 0x06, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x40, 0x2e, 0x06, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x00, 0x2e, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x39, 0x32, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x27, 0x07, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x60, 0x34, 0x06, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x20, 0x34, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x39, 0x33, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x47, 0x05, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0xa0, 0x3b, 0x06, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0x60, 0x3b, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x39, 0x34, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x37, 0x06, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x00, 0x41, 0x06, 0x00,
+ 0x19, 0xcc, 0x48, 0x49, 0xc0, 0x40, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x39, 0x35, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x52, 0x0c, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x40, 0x47, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x00, 0x47, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x39, 0x36, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xfa, 0x03, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0xa0, 0x53, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x60, 0x53, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x39, 0x37, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x83, 0x0b, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0xa0, 0x57, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x60, 0x57, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x39, 0x38, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x9f, 0x03, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x40, 0x63, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x00, 0x63, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x20, 0x39, 0x39, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xf4, 0x05, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0xe0, 0x66, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0xa0, 0x66, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x30, 0x30, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xf2, 0x05, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0xe0, 0x6c, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0xa0, 0x6c, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x30, 0x31, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x77, 0x04, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0xe0, 0x72, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0xa0, 0x72, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x30, 0x32, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xfe, 0x06, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x60, 0x77, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x20, 0x77, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x30, 0x33, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x17, 0x03, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x60, 0x7e, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x20, 0x7e, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x30, 0x34, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xe2, 0x05, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x80, 0x81, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x40, 0x81, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x30, 0x35, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x19, 0x05, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x80, 0x87, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x40, 0x87, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x30, 0x36, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xc2, 0x04, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0xa0, 0x8c, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x60, 0x8c, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x30, 0x37, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xbd, 0x04, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x80, 0x91, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x40, 0x91, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x30, 0x38, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xf6, 0x03, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x40, 0x96, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x00, 0x96, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x30, 0x39, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xa2, 0x05, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x40, 0x9a, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x00, 0x9a, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x31, 0x30, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x34, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x00, 0xa0, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0xc0, 0x9f, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x31, 0x31, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x31, 0x00, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x40, 0xa0, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x00, 0xa0, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x31, 0x32, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x4c, 0x04, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x80, 0xa0, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x40, 0xa0, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x31, 0x33, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x25, 0x03, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0xe0, 0xa4, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0xa0, 0xa4, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x31, 0x34, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x14, 0x01, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x20, 0xa8, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0xe0, 0xa7, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x31, 0x35, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x3c, 0x06, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x40, 0xa9, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x00, 0xa9, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x31, 0x36, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x05, 0x04, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x80, 0xaf, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x40, 0xaf, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x31, 0x37, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x88, 0x09, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0xa0, 0xb3, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x60, 0xb3, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x31, 0x38, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x15, 0x02, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x40, 0xbd, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x00, 0xbd, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x31, 0x39, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x9b, 0x05, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x60, 0xbf, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x20, 0xbf, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x32, 0x30, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xc3, 0x04, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x00, 0xc5, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0xc0, 0xc4, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x32, 0x31, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x03, 0x04, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0xe0, 0xc9, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0xa0, 0xc9, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x32, 0x32, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x98, 0x05, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0x00, 0xce, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0xc0, 0xcd, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x32, 0x33, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xe3, 0x03, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0xa0, 0xd3, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x60, 0xd3, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x32, 0x34, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xe3, 0x03, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0xa0, 0xd7, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x60, 0xd7, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x32, 0x35, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x3f, 0x04, 0x00, 0x00,
- 0x78, 0x3e, 0x46, 0x49, 0xa0, 0xdb, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x60, 0xdb, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x32, 0x36, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x4e, 0x02, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0xe0, 0xdf, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0xa0, 0xdf, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x32, 0x37, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x97, 0x05, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x40, 0xe2, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x00, 0xe2, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x32, 0x38, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x67, 0x02, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0xe0, 0xe7, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0xa0, 0xe7, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x32, 0x39, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x33, 0x01, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x60, 0xea, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x20, 0xea, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x33, 0x30, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x84, 0x05, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0xa0, 0xeb, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x60, 0xeb, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x33, 0x31, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x2d, 0x05, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x40, 0xf1, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x00, 0xf1, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x33, 0x32, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x48, 0x05, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x80, 0xf6, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x40, 0xf6, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x33, 0x33, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xfc, 0x04, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0xe0, 0xfb, 0x06, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0xa0, 0xfb, 0x06, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x33, 0x34, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x5d, 0x05, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0xe0, 0x00, 0x07, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0xa0, 0x00, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x33, 0x35, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x9e, 0x06, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x40, 0x06, 0x07, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x00, 0x06, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x33, 0x36, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x84, 0x07, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0xe0, 0x0c, 0x07, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0xa0, 0x0c, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x33, 0x37, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xf0, 0x04, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x80, 0x14, 0x07, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x40, 0x14, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x33, 0x38, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xcc, 0x01, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x80, 0x19, 0x07, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x40, 0x19, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x33, 0x39, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x5a, 0x00, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x60, 0x1b, 0x07, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x20, 0x1b, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x34, 0x30, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x21, 0x0f, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0xc0, 0x1b, 0x07, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x80, 0x1b, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x34, 0x31, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xfa, 0x09, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x00, 0x2b, 0x07, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0xc0, 0x2a, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x34, 0x32, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xf5, 0x0b, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x00, 0x35, 0x07, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0xc0, 0x34, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x34, 0x33, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x7f, 0x06, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x00, 0x41, 0x07, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0xc0, 0x40, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x34, 0x34, 0x3e,
0x01, 0x00, 0x6f, 0x01, 0x04, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x80, 0x00, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x60, 0x2a, 0x00, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0x60, 0x2a, 0x00, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x34, 0x35, 0x3e,
0x01, 0x00, 0x6f, 0x01, 0x03, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x60, 0x00, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0xe0, 0x2a, 0x00, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0xe0, 0x2a, 0x00, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x34, 0x36, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x88, 0x0e, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x80, 0x47, 0x07, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0x40, 0x47, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x34, 0x37, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xe0, 0x06, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x20, 0x56, 0x07, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0xe0, 0x55, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x34, 0x38, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x5e, 0x02, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x00, 0x5d, 0x07, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0xc0, 0x5c, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x34, 0x39, 0x3e,
0x01, 0x00, 0x6f, 0x01, 0x03, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x60, 0x00, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x40, 0x2b, 0x00, 0x00,
+ 0x1b, 0xcc, 0x48, 0x49, 0x40, 0x2b, 0x00, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x35, 0x30, 0x3e,
0x01, 0x00, 0x6f, 0x01, 0x03, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x60, 0x00, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0xa0, 0x2b, 0x00, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0xa0, 0x2b, 0x00, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x35, 0x31, 0x3e,
0x01, 0x00, 0x6f, 0x01, 0x02, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x00, 0x01, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x00, 0x2c, 0x00, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0x00, 0x2c, 0x00, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x35, 0x32, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x18, 0x0c, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x60, 0x5f, 0x07, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0x20, 0x5f, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x35, 0x33, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x21, 0x0f, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x80, 0x6b, 0x07, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0x40, 0x6b, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x35, 0x34, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xa9, 0x10, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0xc0, 0x7a, 0x07, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0x80, 0x7a, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x35, 0x35, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x66, 0x01, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x80, 0x8b, 0x07, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0x40, 0x8b, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x35, 0x36, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xaf, 0x05, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x00, 0x8d, 0x07, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0xc0, 0x8c, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x35, 0x37, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xcf, 0x0e, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0xc0, 0x92, 0x07, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0x80, 0x92, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x35, 0x38, 0x3e,
0x01, 0x00, 0x6f, 0x01, 0x02, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xa0, 0x00, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x00, 0x2d, 0x00, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0x00, 0x2d, 0x00, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x35, 0x39, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xec, 0x00, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0xa0, 0xa1, 0x07, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0x60, 0xa1, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x36, 0x30, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xf1, 0x1d, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0xa0, 0xa2, 0x07, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0x60, 0xa2, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x36, 0x31, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xf6, 0x11, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0xa0, 0xc0, 0x07, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0x60, 0xc0, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x36, 0x32, 0x3e,
0x01, 0x00, 0x6f, 0x01, 0x02, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0xe0, 0x00, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0xa0, 0x2d, 0x00, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0xa0, 0x2d, 0x00, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x36, 0x33, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x79, 0x00, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0xa0, 0xd2, 0x07, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0x60, 0xd2, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x36, 0x34, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x77, 0x00, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x20, 0xd3, 0x07, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0xe0, 0xd2, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x36, 0x35, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x78, 0x00, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0xa0, 0xd3, 0x07, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0x60, 0xd3, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x36, 0x36, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x78, 0x00, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x20, 0xd4, 0x07, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0xe0, 0xd3, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x36, 0x37, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x79, 0x00, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0xa0, 0xd4, 0x07, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0x60, 0xd4, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x36, 0x38, 0x3e,
0x08, 0x00, 0x4b, 0x00, 0x01, 0x00, 0x00, 0x00,
0xed, 0x03, 0x01, 0x02, 0x38, 0x06, 0x00, 0x00,
- 0x79, 0x3e, 0x46, 0x49, 0x20, 0xd5, 0x07, 0x00,
+ 0x1c, 0xcc, 0x48, 0x49, 0xe0, 0xd4, 0x07, 0x00,
0x3c, 0x20, 0x20, 0x20, 0x31, 0x36, 0x39, 0x3e,
0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -6211,8 +6211,8 @@
0x65, 0x78, 0x74, 0x6c, 0x69, 0x67, 0x68, 0x74,
0x22, 0x3e, 0x0d, 0x0a, 0x7d, 0x0d, 0x0a, 0x61,
0x70, 0x70, 0x65, 0x6e, 0x64, 0x20, 0x62, 0x75,
- 0x66, 0x66, 0x65, 0x72, 0x20, 0x5b, 0x6f, 0x70,
- 0x65, 0x6e, 0x6f, 0x63, 0x64, 0x20, 0x7a, 0x79,
+ 0x66, 0x66, 0x65, 0x72, 0x20, 0x5b, 0x63, 0x61,
+ 0x70, 0x74, 0x75, 0x72, 0x65, 0x20, 0x7a, 0x79,
0x31, 0x30, 0x30, 0x30, 0x5f, 0x76, 0x65, 0x72,
0x73, 0x69, 0x6f, 0x6e, 0x5d, 0x0d, 0x0a, 0x61,
0x70, 0x70, 0x65, 0x6e, 0x64, 0x20, 0x62, 0x75,
@@ -6877,8 +6877,8 @@
0x3d, 0x30, 0x7d, 0x20, 0x7b, 0x0d, 0x0a, 0x09,
0x09, 0x09, 0x09, 0x09, 0x61, 0x70, 0x70, 0x65,
0x6e, 0x64, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x6f,
- 0x6c, 0x65, 0x20, 0x5b, 0x6f, 0x70, 0x65, 0x6e,
- 0x6f, 0x63, 0x64, 0x20, 0x22, 0x24, 0x6d, 0x6f,
+ 0x6c, 0x65, 0x20, 0x5b, 0x63, 0x61, 0x70, 0x74,
+ 0x75, 0x72, 0x65, 0x20, 0x22, 0x24, 0x6d, 0x6f,
0x64, 0x69, 0x66, 0x79, 0x5f, 0x63, 0x6d, 0x64,
0x20, 0x24, 0x66, 0x6f, 0x72, 0x6d, 0x5f, 0x61,
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x20, 0x24,
@@ -6894,7 +6894,7 @@
0x7b, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09,
0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x20, 0x63,
0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x20, 0x5b,
- 0x6f, 0x70, 0x65, 0x6e, 0x6f, 0x63, 0x64, 0x20,
+ 0x63, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x20,
0x22, 0x24, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79,
0x5f, 0x63, 0x6d, 0x64, 0x20, 0x24, 0x66, 0x6f,
0x72, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65,
@@ -7183,13 +7183,13 @@
0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x20, 0x63,
0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x20, 0x5b,
0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x5b,
- 0x6f, 0x70, 0x65, 0x6e, 0x6f, 0x63, 0x64, 0x20,
+ 0x63, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x20,
0x68, 0x61, 0x6c, 0x74, 0x5d, 0x5d, 0x0d, 0x0a,
0x09, 0x09, 0x09, 0x09, 0x09, 0x61, 0x70, 0x70,
0x65, 0x6e, 0x64, 0x20, 0x62, 0x75, 0x66, 0x66,
0x65, 0x72, 0x20, 0x5b, 0x65, 0x6e, 0x63, 0x6f,
- 0x64, 0x65, 0x20, 0x5b, 0x6f, 0x70, 0x65, 0x6e,
- 0x6f, 0x63, 0x64, 0x20, 0x22, 0x24, 0x66, 0x6f,
+ 0x64, 0x65, 0x20, 0x5b, 0x63, 0x61, 0x70, 0x74,
+ 0x75, 0x72, 0x65, 0x20, 0x22, 0x24, 0x66, 0x6f,
0x72, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x20,
0x24, 0x66, 0x6f, 0x72, 0x6d, 0x5f, 0x61, 0x64,
0x64, 0x72, 0x65, 0x73, 0x73, 0x20, 0x5b, 0x65,
@@ -7993,8 +7993,8 @@
0x74, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x22, 0x3e,
0x0d, 0x0a, 0x7d, 0x0d, 0x0a, 0x61, 0x70, 0x70,
0x65, 0x6e, 0x64, 0x20, 0x62, 0x75, 0x66, 0x66,
- 0x65, 0x72, 0x20, 0x5b, 0x6f, 0x70, 0x65, 0x6e,
- 0x6f, 0x63, 0x64, 0x20, 0x7a, 0x79, 0x31, 0x30,
+ 0x65, 0x72, 0x20, 0x5b, 0x63, 0x61, 0x70, 0x74,
+ 0x75, 0x72, 0x65, 0x20, 0x7a, 0x79, 0x31, 0x30,
0x30, 0x30, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69,
0x6f, 0x6e, 0x5d, 0x0d, 0x0a, 0x61, 0x70, 0x70,
0x65, 0x6e, 0x64, 0x20, 0x62, 0x75, 0x66, 0x66,
@@ -8581,15 +8581,15 @@
0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x61,
0x70, 0x70, 0x65, 0x6e, 0x64, 0x20, 0x63, 0x6f,
0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x20, 0x5b, 0x65,
- 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x5b, 0x6f,
- 0x70, 0x65, 0x6e, 0x6f, 0x63, 0x64, 0x20, 0x22,
+ 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x5b, 0x63,
+ 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x20, 0x22,
0x72, 0x65, 0x73, 0x65, 0x74, 0x20, 0x69, 0x6e,
0x69, 0x74, 0x22, 0x5d, 0x5d, 0x0d, 0x0a, 0x09,
0x09, 0x09, 0x09, 0x09, 0x61, 0x70, 0x70, 0x65,
0x6e, 0x64, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x6f,
0x6c, 0x65, 0x20, 0x5b, 0x65, 0x6e, 0x63, 0x6f,
- 0x64, 0x65, 0x20, 0x5b, 0x6f, 0x70, 0x65, 0x6e,
- 0x6f, 0x63, 0x64, 0x20, 0x22, 0x64, 0x75, 0x6d,
+ 0x64, 0x65, 0x20, 0x5b, 0x63, 0x61, 0x70, 0x74,
+ 0x75, 0x72, 0x65, 0x20, 0x22, 0x64, 0x75, 0x6d,
0x70, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x20,
0x2f, 0x72, 0x61, 0x6d, 0x2f, 0x64, 0x75, 0x6d,
0x70, 0x2e, 0x62, 0x69, 0x6e, 0x20, 0x24, 0x66,
@@ -9378,8 +9378,8 @@
0x65, 0x78, 0x74, 0x6c, 0x69, 0x67, 0x68, 0x74,
0x22, 0x3e, 0x0d, 0x0a, 0x7d, 0x0d, 0x0a, 0x61,
0x70, 0x70, 0x65, 0x6e, 0x64, 0x20, 0x62, 0x75,
- 0x66, 0x66, 0x65, 0x72, 0x20, 0x5b, 0x6f, 0x70,
- 0x65, 0x6e, 0x6f, 0x63, 0x64, 0x20, 0x7a, 0x79,
+ 0x66, 0x66, 0x65, 0x72, 0x20, 0x5b, 0x63, 0x61,
+ 0x70, 0x74, 0x75, 0x72, 0x65, 0x20, 0x7a, 0x79,
0x31, 0x30, 0x30, 0x30, 0x5f, 0x76, 0x65, 0x72,
0x73, 0x69, 0x6f, 0x6e, 0x5d, 0x0d, 0x0a, 0x61,
0x70, 0x70, 0x65, 0x6e, 0x64, 0x20, 0x62, 0x75,
@@ -9969,8 +9969,8 @@
0x74, 0x69, 0x6f, 0x6e, 0x20, 0x22, 0x44, 0x65,
0x6c, 0x65, 0x74, 0x65, 0x22, 0x5d, 0x3d, 0x3d,
0x30, 0x7d, 0x20, 0x7b, 0x0d, 0x0a, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x6f, 0x70, 0x65, 0x6e, 0x6f,
- 0x63, 0x64, 0x20, 0x22, 0x72, 0x6d, 0x20, 0x2f,
+ 0x09, 0x09, 0x09, 0x63, 0x61, 0x70, 0x74, 0x75,
+ 0x72, 0x65, 0x20, 0x22, 0x72, 0x6d, 0x20, 0x2f,
0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x73,
0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f,
0x24, 0x66, 0x6f, 0x72, 0x6d, 0x5f, 0x73, 0x65,
@@ -11180,7 +11180,7 @@
0x68, 0x74, 0x22, 0x3e, 0x0d, 0x0a, 0x7d, 0x0d,
0x0a, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x20,
0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x5b,
- 0x6f, 0x70, 0x65, 0x6e, 0x6f, 0x63, 0x64, 0x20,
+ 0x63, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x20,
0x7a, 0x79, 0x31, 0x30, 0x30, 0x30, 0x5f, 0x76,
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5d, 0x0d,
0x0a, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x20,
@@ -11784,8 +11784,8 @@
0x24, 0x66, 0x6f, 0x72, 0x6d, 0x5f, 0x61, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x20, 0x22, 0x44, 0x65,
0x6c, 0x65, 0x74, 0x65, 0x22, 0x5d, 0x3d, 0x3d,
- 0x30, 0x7d, 0x20, 0x7b, 0x0d, 0x0a, 0x09, 0x6f,
- 0x70, 0x65, 0x6e, 0x6f, 0x63, 0x64, 0x20, 0x22,
+ 0x30, 0x7d, 0x20, 0x7b, 0x0d, 0x0a, 0x09, 0x63,
+ 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x20, 0x22,
0x72, 0x6d, 0x20, 0x24, 0x66, 0x6f, 0x72, 0x6d,
0x5f, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d,
0x65, 0x22, 0x0d, 0x0a, 0x7d, 0x0d, 0x0a, 0x0d,
@@ -12693,8 +12693,8 @@
0x65, 0x78, 0x74, 0x6c, 0x69, 0x67, 0x68, 0x74,
0x22, 0x3e, 0x0d, 0x0a, 0x7d, 0x0d, 0x0a, 0x61,
0x70, 0x70, 0x65, 0x6e, 0x64, 0x20, 0x62, 0x75,
- 0x66, 0x66, 0x65, 0x72, 0x20, 0x5b, 0x6f, 0x70,
- 0x65, 0x6e, 0x6f, 0x63, 0x64, 0x20, 0x7a, 0x79,
+ 0x66, 0x66, 0x65, 0x72, 0x20, 0x5b, 0x63, 0x61,
+ 0x70, 0x74, 0x75, 0x72, 0x65, 0x20, 0x7a, 0x79,
0x31, 0x30, 0x30, 0x30, 0x5f, 0x76, 0x65, 0x72,
0x73, 0x69, 0x6f, 0x6e, 0x5d, 0x0d, 0x0a, 0x61,
0x70, 0x70, 0x65, 0x6e, 0x64, 0x20, 0x62, 0x75,
@@ -13297,14 +13297,14 @@
0x09, 0x09, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64,
0x20, 0x63, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65,
0x20, 0x5b, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65,
- 0x20, 0x5b, 0x6f, 0x70, 0x65, 0x6e, 0x6f, 0x63,
- 0x64, 0x20, 0x22, 0x72, 0x65, 0x73, 0x65, 0x74,
+ 0x20, 0x5b, 0x63, 0x61, 0x70, 0x74, 0x75, 0x72,
+ 0x65, 0x20, 0x22, 0x72, 0x65, 0x73, 0x65, 0x74,
0x20, 0x69, 0x6e, 0x69, 0x74, 0x22, 0x5d, 0x5d,
0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x20, 0x63,
0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x20, 0x5b,
0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x5b,
- 0x6f, 0x70, 0x65, 0x6e, 0x6f, 0x63, 0x64, 0x20,
+ 0x63, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x20,
0x22, 0x66, 0x6c, 0x61, 0x73, 0x68, 0x20, 0x65,
0x72, 0x61, 0x73, 0x65, 0x5f, 0x61, 0x64, 0x64,
0x72, 0x65, 0x73, 0x73, 0x20, 0x24, 0x66, 0x6f,
@@ -14183,7 +14183,7 @@
0x68, 0x74, 0x22, 0x3e, 0x0d, 0x0a, 0x7d, 0x0d,
0x0a, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x20,
0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x5b,
- 0x6f, 0x70, 0x65, 0x6e, 0x6f, 0x63, 0x64, 0x20,
+ 0x63, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x20,
0x7a, 0x79, 0x31, 0x30, 0x30, 0x30, 0x5f, 0x76,
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5d, 0x0d,
0x0a, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x20,
@@ -14827,7 +14827,7 @@
0x09, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x20,
0x63, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x20,
0x5b, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x20,
- 0x5b, 0x6f, 0x70, 0x65, 0x6e, 0x6f, 0x63, 0x64,
+ 0x5b, 0x63, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65,
0x20, 0x22, 0x72, 0x65, 0x73, 0x65, 0x74, 0x20,
0x69, 0x6e, 0x69, 0x74, 0x22, 0x5d, 0x5d, 0x0d,
0x0a, 0x09, 0x09, 0x09, 0x7d, 0x0d, 0x0a, 0x09,
@@ -15083,8 +15083,8 @@
0x09, 0x09, 0x09, 0x09, 0x61, 0x70, 0x70, 0x65,
0x6e, 0x64, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x6f,
0x6c, 0x65, 0x20, 0x5b, 0x65, 0x6e, 0x63, 0x6f,
- 0x64, 0x65, 0x20, 0x5b, 0x6f, 0x70, 0x65, 0x6e,
- 0x6f, 0x63, 0x64, 0x20, 0x22, 0x68, 0x61, 0x6c,
+ 0x64, 0x65, 0x20, 0x5b, 0x63, 0x61, 0x70, 0x74,
+ 0x75, 0x72, 0x65, 0x20, 0x22, 0x68, 0x61, 0x6c,
0x74, 0x22, 0x5d, 0x5d, 0x0d, 0x0a, 0x09, 0x09,
0x09, 0x09, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64,
0x20, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20,
@@ -15136,8 +15136,8 @@
0x7b, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x61,
0x70, 0x70, 0x65, 0x6e, 0x64, 0x20, 0x63, 0x6f,
0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x20, 0x5b, 0x65,
- 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x5b, 0x6f,
- 0x70, 0x65, 0x6e, 0x6f, 0x63, 0x64, 0x20, 0x22,
+ 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x5b, 0x63,
+ 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x20, 0x22,
0x68, 0x61, 0x6c, 0x74, 0x22, 0x5d, 0x5d, 0x0d,
0x0a, 0x09, 0x09, 0x09, 0x09, 0x61, 0x70, 0x70,
0x65, 0x6e, 0x64, 0x20, 0x62, 0x75, 0x66, 0x66,
@@ -15990,8 +15990,8 @@
0x69, 0x67, 0x68, 0x74, 0x22, 0x3e, 0x0d, 0x0a,
0x7d, 0x0d, 0x0a, 0x61, 0x70, 0x70, 0x65, 0x6e,
0x64, 0x20, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72,
- 0x20, 0x5b, 0x6f, 0x70, 0x65, 0x6e, 0x6f, 0x63,
- 0x64, 0x20, 0x7a, 0x79, 0x31, 0x30, 0x30, 0x30,
+ 0x20, 0x5b, 0x63, 0x61, 0x70, 0x74, 0x75, 0x72,
+ 0x65, 0x20, 0x7a, 0x79, 0x31, 0x30, 0x30, 0x30,
0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
0x5d, 0x0d, 0x0a, 0x61, 0x70, 0x70, 0x65, 0x6e,
0x64, 0x20, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72,
@@ -16570,21 +16570,21 @@
0x09, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x20,
0x63, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x20,
0x5b, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x20,
- 0x5b, 0x6f, 0x70, 0x65, 0x6e, 0x6f, 0x63, 0x64,
+ 0x5b, 0x63, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65,
0x20, 0x22, 0x72, 0x65, 0x73, 0x65, 0x74, 0x20,
0x69, 0x6e, 0x69, 0x74, 0x22, 0x5d, 0x5d, 0x0d,
0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x20, 0x62,
0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x5b, 0x65,
- 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x5b, 0x6f,
- 0x70, 0x65, 0x6e, 0x6f, 0x63, 0x64, 0x20, 0x22,
+ 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x5b, 0x63,
+ 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x20, 0x22,
0x66, 0x6c, 0x61, 0x73, 0x68, 0x20, 0x70, 0x72,
0x6f, 0x62, 0x65, 0x20, 0x30, 0x22, 0x5d, 0x5d,
0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
0x09, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x20,
0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x5b,
0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x5b,
- 0x6f, 0x70, 0x65, 0x6e, 0x6f, 0x63, 0x64, 0x20,
+ 0x63, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x20,
0x22, 0x66, 0x6c, 0x61, 0x73, 0x68, 0x20, 0x69,
0x6e, 0x66, 0x6f, 0x20, 0x30, 0x22, 0x5d, 0x5d,
0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
@@ -20729,8 +20729,8 @@
0x74, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x22, 0x3e,
0x0d, 0x0a, 0x7d, 0x0d, 0x0a, 0x61, 0x70, 0x70,
0x65, 0x6e, 0x64, 0x20, 0x62, 0x75, 0x66, 0x66,
- 0x65, 0x72, 0x20, 0x5b, 0x6f, 0x70, 0x65, 0x6e,
- 0x6f, 0x63, 0x64, 0x20, 0x7a, 0x79, 0x31, 0x30,
+ 0x65, 0x72, 0x20, 0x5b, 0x63, 0x61, 0x70, 0x74,
+ 0x75, 0x72, 0x65, 0x20, 0x7a, 0x79, 0x31, 0x30,
0x30, 0x30, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69,
0x6f, 0x6e, 0x5d, 0x0d, 0x0a, 0x61, 0x70, 0x70,
0x65, 0x6e, 0x64, 0x20, 0x62, 0x75, 0x66, 0x66,
@@ -22216,8 +22216,8 @@
0x69, 0x67, 0x68, 0x74, 0x22, 0x3e, 0x0d, 0x0a,
0x7d, 0x0d, 0x0a, 0x61, 0x70, 0x70, 0x65, 0x6e,
0x64, 0x20, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72,
- 0x20, 0x5b, 0x6f, 0x70, 0x65, 0x6e, 0x6f, 0x63,
- 0x64, 0x20, 0x7a, 0x79, 0x31, 0x30, 0x30, 0x30,
+ 0x20, 0x5b, 0x63, 0x61, 0x70, 0x74, 0x75, 0x72,
+ 0x65, 0x20, 0x7a, 0x79, 0x31, 0x30, 0x30, 0x30,
0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
0x5d, 0x0d, 0x0a, 0x61, 0x70, 0x70, 0x65, 0x6e,
0x64, 0x20, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72,
@@ -22853,8 +22853,8 @@
0x09, 0x3c, 0x62, 0x72, 0x3e, 0x0d, 0x0a, 0x09,
0x09, 0x09, 0x09, 0x09, 0x09, 0x7d, 0x0d, 0x0a,
0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x20, 0x62,
- 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x5b, 0x6f,
- 0x70, 0x65, 0x6e, 0x6f, 0x63, 0x64, 0x20, 0x7b,
+ 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x5b, 0x63,
+ 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x20, 0x7b,
0x7a, 0x79, 0x31, 0x30, 0x30, 0x30, 0x5f, 0x76,
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x7a,
0x79, 0x31, 0x30, 0x30, 0x30, 0x7d, 0x5d, 0x0d,
@@ -22863,8 +22863,8 @@
0x3c, 0x62, 0x72, 0x3e, 0x0d, 0x0a, 0x09, 0x09,
0x09, 0x09, 0x09, 0x09, 0x7d, 0x0d, 0x0a, 0x61,
0x70, 0x70, 0x65, 0x6e, 0x64, 0x20, 0x62, 0x75,
- 0x66, 0x66, 0x65, 0x72, 0x20, 0x5b, 0x6f, 0x70,
- 0x65, 0x6e, 0x6f, 0x63, 0x64, 0x20, 0x7b, 0x7a,
+ 0x66, 0x66, 0x65, 0x72, 0x20, 0x5b, 0x63, 0x61,
+ 0x70, 0x74, 0x75, 0x72, 0x65, 0x20, 0x7b, 0x7a,
0x79, 0x31, 0x30, 0x30, 0x30, 0x5f, 0x76, 0x65,
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x70,
0x65, 0x6e, 0x6f, 0x63, 0x64, 0x7d, 0x5d, 0x0d,
@@ -22873,8 +22873,8 @@
0x3c, 0x62, 0x72, 0x3e, 0x0d, 0x0a, 0x09, 0x09,
0x09, 0x09, 0x09, 0x09, 0x7d, 0x0d, 0x0a, 0x61,
0x70, 0x70, 0x65, 0x6e, 0x64, 0x20, 0x62, 0x75,
- 0x66, 0x66, 0x65, 0x72, 0x20, 0x5b, 0x6f, 0x70,
- 0x65, 0x6e, 0x6f, 0x63, 0x64, 0x20, 0...
[truncated message content] |
|
From: <oh...@ma...> - 2008-12-17 10:57:05
|
Author: oharboe
Date: 2008-12-17 10:56:59 +0100 (Wed, 17 Dec 2008)
New Revision: 1252
Modified:
zy1000/trunk/build/menu/zy1000menu.xml
zy1000/trunk/build/menu/zy1000menu.xsl
zy1000/trunk/build/tcl/openocd.cfg
Log:
retire unused code
Modified: zy1000/trunk/build/menu/zy1000menu.xml
===================================================================
--- zy1000/trunk/build/menu/zy1000menu.xml 2008-12-16 22:20:10 UTC (rev 1251)
+++ zy1000/trunk/build/menu/zy1000menu.xml 2008-12-17 09:56:59 UTC (rev 1252)
@@ -62,9 +62,9 @@
append buffer [ocd_jtag_khz]
</tcl>
<br>
- <tcl>append buffer [openocd {zy1000_version zy1000}]</tcl><br>
- <tcl>append buffer [openocd {zy1000_version openocd}]</tcl><br>
- <tcl>append buffer [openocd {zy1000_version date}]</tcl><br>
+ <tcl>append buffer [capture {zy1000_version zy1000}]</tcl><br>
+ <tcl>append buffer [capture {zy1000_version openocd}]</tcl><br>
+ <tcl>append buffer [capture {zy1000_version date}]</tcl><br>
<tcl>append buffer [ip]</tcl><br>
<tcl>append buffer [ocd_gdb_port]</tcl>
</td>
@@ -100,25 +100,25 @@
set form_action [formfetch form_action]
if {[string compare $form_action "Halt"]==0} {
- append console [encode [openocd "halt"]]
+ append console [encode [capture "halt"]]
}
if {[string compare $form_action "Resume"]==0} {
- append console [encode [openocd "resume"]]
+ append console [encode [capture "resume"]]
}
if {[string compare $form_action "Reset and run"]==0} {
- append console [encode [openocd "reset run"]]
+ append console [encode [capture "reset run"]]
}
if {[string compare $form_action "Power on"]==0} {
- append console [encode [openocd "power on"]]
+ append console [encode [capture "power on"]]
}
if {[string compare $form_action "Power off"]==0} {
- append console [encode [openocd "power off"]]
+ append console [encode [capture "power off"]]
}
</tcl>
- <tcl>append console [encode [openocd poll]]</tcl>
+ <tcl>append console [encode [capture poll]]</tcl>
</td>
</tr>
</table>
@@ -184,8 +184,8 @@
append buffer {<form enctype="multipart/form-data" action="preconfig.tcl" method="post">}
if {[string compare $form_action "Select and reload"]==0} {
- openocd "trunc /config/settings/openocd.cfg"
- openocd "append_file /config/settings/openocd.cfg script target/$form_target"
+ capture "trunc /config/settings/openocd.cfg"
+ capture "append_file /config/settings/openocd.cfg script target/$form_target"
reboot
}
@@ -271,7 +271,7 @@
}
if {[string compare $form_action "Delete"]==0} {
- openocd "rm /config/settings/$form_selected"
+ capture "rm /config/settings/$form_selected"
}
if {[string compare $form_action "Save"]==0} {
@@ -463,9 +463,9 @@
set form_action [formfetch form_action]
if {[string compare $form_action "Reset CPU and probe flash"]==0} {
- append console [encode [openocd "reset init"]]
- append buffer [encode [openocd "flash probe 0"]]
- append buffer [encode [openocd "flash info 0"]]
+ append console [encode [capture "reset init"]]
+ append buffer [encode [capture "flash probe 0"]]
+ append buffer [encode [capture "flash info 0"]]
}
} else {
append buffer "No flash bank configured."
@@ -540,7 +540,7 @@
set action_verify [expr {[string compare $form_action "Verify"]==0 || [string compare $form_action "Flash and verify"]==0}]
if {$action_reset} {
- append console [encode [openocd "reset init"]]
+ append console [encode [capture "reset init"]]
}
</tcl>
</code><tcl>
@@ -594,7 +594,7 @@
}
append buffer "<br>"
if {$action_flash} {
- append console [encode [openocd "halt"]]
+ append console [encode [capture "halt"]]
append buffer "<b>"
if {[catch {capture {eval "flash write_image erase $upload_filename $form_offset $form_type"}} result]} {
append buffer "Flash write failed<br>"
@@ -606,7 +606,7 @@
append buffer "</b>"
}
if {$action_verify} {
- append console [encode [openocd "halt"]]
+ append console [encode [capture "halt"]]
append buffer "<b>"
if {[catch {capture {eval "verify_image $upload_filename $form_offset $form_type"}} result]} {
append buffer "Verify failed<br>"
@@ -674,10 +674,10 @@
append console [encode [capture {catch production_test}]]
}
if {[string compare $form_action "Power on"]==0} {
- append console [encode [openocd "power on"]]
+ append console [encode [capture "power on"]]
}
if {[string compare $form_action "Power off"]==0} {
- append console [encode [openocd "power off"]]
+ append console [encode [capture "power off"]]
}
</tcl>
</code>
@@ -751,8 +751,8 @@
if {[string compare $form_address ""]!=0} {
if {[string compare $form_action "Erase"]==0} {
append buffer "<code style=\"white-space: nowrap;\">"
- append console [encode [openocd "reset init"]]
- append console [encode [openocd "flash erase_address $form_address $form_length"]]
+ append console [encode [capture "reset init"]]
+ append console [encode [capture "flash erase_address $form_address $form_length"]]
append buffer </code>
}
}
@@ -808,25 +808,25 @@
set form_action [formfetch form_action]
if {[string compare $form_action "Run from address"]==0} {
- append console [encode [openocd "halt"]]
- append console [encode [openocd "wait_halt"]]
- append console [encode [openocd "resume $form_address"]]
+ append console [encode [capture "halt"]]
+ append console [encode [capture "wait_halt"]]
+ append console [encode [capture "resume $form_address"]]
}
if {[string compare $form_action "Halt"]==0} {
- append console [encode [openocd "halt"]]
- append console [encode [openocd "wait_halt"]]
+ append console [encode [capture "halt"]]
+ append console [encode [capture "wait_halt"]]
}
if {[string compare $form_action "Reset and run"]==0} {
- append console [encode [openocd "reset run"]]
+ append console [encode [capture "reset run"]]
}
if {[string compare $form_action "Reset and init"]==0} {
- append console [encode [openocd "reset init"]]
+ append console [encode [capture "reset init"]]
}
-append console [encode [openocd poll]]
+append console [encode [capture poll]]
</tcl>
@@ -941,10 +941,10 @@
set form_address "0x[tohex [expr $form_address+$form_length]]"
}
if {[string compare $form_action "Modify"]==0} {
- append console [openocd "$modify_cmd $form_address $form_value"]
+ append console [capture "$modify_cmd $form_address $form_value"]
}
if {[string compare $form_action "Fill"]==0} {
- append console [openocd "$modify_cmd $form_address $form_value $form_length"]
+ append console [capture "$modify_cmd $form_address $form_value $form_length"]
}
}
@@ -992,8 +992,8 @@
<code style="white-space: nowrap; font-size:11px;font:courier new;">
<tcl>
if {[string compare $form_address ""]!=0} {
- append console [encode [openocd halt]]
- append buffer [encode [openocd "$form_type $form_address [expr $form_length]"]]
+ append console [encode [capture halt]]
+ append buffer [encode [capture "$form_type $form_address [expr $form_length]"]]
}
</tcl>
</code>
@@ -1051,8 +1051,8 @@
</form>
<tcl>
if {[string compare $form_action "Download"]==0} {
- append console [encode [openocd "reset init"]]
- append console [encode [openocd "dump_image /ram/dump.bin $form_address $form_length"]]
+ append console [encode [capture "reset init"]]
+ append console [encode [capture "dump_image /ram/dump.bin $form_address $form_length"]]
</tcl>
<form action="../dump.bin" target="_blank">
<input type="submit" name="form_action" value="Save downloaded memory">
@@ -1344,7 +1344,7 @@
} err
}
if {[string compare $form_action "Delete"]==0} {
- openocd "rm $form_filename"
+ capture "rm $form_filename"
}
set form_edittext_subst [to_textarea $form_edittext]
@@ -1560,9 +1560,9 @@
set form_config [load_config "target/[load_target]"]
set support_id [string range [rand] 0 7]
set form_log ""
- append form_log "Version: [openocd "zy1000_version zy1000"]"
- append form_log "OpenOCD version: [openocd "zy1000_version openocd"]"
- append form_log "Version date: [openocd "zy1000_version date"]"
+ append form_log "Version: [capture "zy1000_version zy1000"]"
+ append form_log "OpenOCD version: [capture "zy1000_version openocd"]"
+ append form_log "Version date: [capture "zy1000_version date"]"
append form_log [log]
</tcl>
Modified: zy1000/trunk/build/menu/zy1000menu.xsl
===================================================================
--- zy1000/trunk/build/menu/zy1000menu.xsl 2008-12-16 22:20:10 UTC (rev 1251)
+++ zy1000/trunk/build/menu/zy1000menu.xsl 2008-12-17 09:56:59 UTC (rev 1252)
@@ -36,7 +36,7 @@
</div>
<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('/rom/menu_cuts/top_right.png');">
<div class="textlight" style="position:relative;left:15px;top:4px;">
- <tcl>append buffer [openocd zy1000_version]</tcl>
+ <tcl>append buffer [capture zy1000_version]</tcl>
</div>
</div>
</div>
Modified: zy1000/trunk/build/tcl/openocd.cfg
===================================================================
--- zy1000/trunk/build/tcl/openocd.cfg 2008-12-16 22:20:10 UTC (rev 1251)
+++ zy1000/trunk/build/tcl/openocd.cfg 2008-12-17 09:56:59 UTC (rev 1252)
@@ -2,12 +2,7 @@
-proc openocd {cmd} {
- catch "ocd_$cmd" t
- return $t
-}
-
proc tohex {a} {
set r ""
while 1 {
|
|
From: <oh...@ma...> - 2008-12-16 23:20:15
|
Author: oharboe
Date: 2008-12-16 23:20:10 +0100 (Tue, 16 Dec 2008)
New Revision: 1251
Added:
trunk/src/server/httpd.c
zy1000/trunk/build/testhttpd.tcl
Modified:
trunk/configure.in
trunk/src/Makefile.am
trunk/src/main.c
trunk/src/openocd.c
trunk/src/server/Makefile.am
Log:
work in progress to hook up libmicrohttpd + tcl integration
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2008-12-16 21:10:06 UTC (rev 1250)
+++ trunk/configure.in 2008-12-16 22:20:10 UTC (rev 1251)
@@ -71,6 +71,10 @@
AS_HELP_STRING([--enable-ioutil], [Enable ioutil functions - useful for standalone OpenOCD implementations]),
[build_ioutil=$enableval], [build_ioutil=no])
+AC_ARG_ENABLE(httpd,
+ AS_HELP_STRING([--enable-httpd], [Enable builtin httpd server - useful for standalone OpenOCD implementations]),
+ [build_httpd=$enableval], [build_httpd=no])
+
case "${host_cpu}" in
arm*)
AC_ARG_ENABLE(ep93xx,
@@ -189,6 +193,12 @@
AC_DEFINE(BUILD_IOUTIL, 0, [0 if you don't want ioutils.])
fi
+if test $build_httpd = yes; then
+ AC_DEFINE(BUILD_HTTPD, 1, [1 if you want httpd.])
+else
+ AC_DEFINE(BUILD_HTTPD, 0, [0 if you don't want httpd.])
+fi
+
if test $build_at91rm9200 = yes; then
build_bitbang=yes
AC_DEFINE(BUILD_AT91RM9200, 1, [1 if you want at91rm9200.])
@@ -285,6 +295,7 @@
AM_CONDITIONAL(EP93XX, test $build_ep93xx = yes)
AM_CONDITIONAL(ECOSBOARD, test $build_ecosboard = yes)
AM_CONDITIONAL(IOUTIL, test $build_ioutil = yes)
+AM_CONDITIONAL(HTTPD, test $build_httpd = yes)
AM_CONDITIONAL(AT91RM9200, test $build_at91rm9200 = yes)
AM_CONDITIONAL(BITBANG, test $build_bitbang = yes)
AM_CONDITIONAL(FT2232_LIBFTDI, test $build_ft2232_libftdi = yes)
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2008-12-16 21:10:06 UTC (rev 1250)
+++ trunk/src/Makefile.am 2008-12-16 22:20:10 UTC (rev 1251)
@@ -79,6 +79,13 @@
$(top_builddir)/src/pld/libpld.a \
$(FTDI2232LIB) $(FTD2XXLIB) $(MINGWLDADD) $(LIBUSB)
+
+if HTTPD
+openocd_LDADD += -lmicrohttpd
+endif
+
+
+
nobase_dist_pkglib_DATA = \
tcl/bitsbytes.tcl \
tcl/chip/atmel/at91/aic.tcl \
Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c 2008-12-16 21:10:06 UTC (rev 1250)
+++ trunk/src/main.c 2008-12-16 22:20:10 UTC (rev 1251)
@@ -18,6 +18,12 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#if !BUILD_HTTPD
/* implementations of OpenOCD that uses multithreading needs to know when
* OpenOCD is sleeping. No-op in vanilla OpenOCD
*/
@@ -28,13 +34,14 @@
void openocd_sleep_postlude(void)
{
}
+#endif
/* This is the main entry for developer PC hosted OpenOCD.
*
* OpenOCD can also be used as a library that is linked with
* another application(not mainstream yet, but possible), e.g.
* w/as an embedded application.
- *
+ *
* Those applications will have their own main() implementation
* and use bits and pieces from openocd.c. */
Modified: trunk/src/openocd.c
===================================================================
--- trunk/src/openocd.c 2008-12-16 21:10:06 UTC (rev 1250)
+++ trunk/src/openocd.c 2008-12-16 22:20:10 UTC (rev 1251)
@@ -229,6 +229,9 @@
return cmd_ctx;
}
+int httpd_start(void);
+void httpd_stop(void);
+
/* normally this is the main() function entry, but if OpenOCD is linked
* into application, then this fn will not be invoked, but rather that
* application will have it's own implementation of main(). */
@@ -255,6 +258,11 @@
if ( (ret != ERROR_OK) && (ret != ERROR_COMMAND_CLOSE_CONNECTION) )
return EXIT_FAILURE;
+#if BUILD_HTTPD
+ if (httpd_start()!=ERROR_OK)
+ return EXIT_FAILURE;
+#endif
+
if (ret != ERROR_COMMAND_CLOSE_CONNECTION)
{
command_context_mode(cmd_ctx, COMMAND_EXEC);
@@ -268,10 +276,15 @@
/* shut server down */
server_quit();
+#if BUILD_HTTPD
+ httpd_stop();
+#endif
+
unregister_all_commands(cmd_ctx);
/* free commandline interface */
command_done(cmd_ctx);
+
return EXIT_SUCCESS;
}
Modified: trunk/src/server/Makefile.am
===================================================================
--- trunk/src/server/Makefile.am 2008-12-16 21:10:06 UTC (rev 1250)
+++ trunk/src/server/Makefile.am 2008-12-16 22:20:10 UTC (rev 1251)
@@ -4,6 +4,11 @@
noinst_HEADERS = server.h telnet_server.h gdb_server.h
libserver_a_SOURCES = server.c telnet_server.c gdb_server.c
+if HTTPD
+libserver_a_SOURCES += httpd.c
+endif
+
+
# tcl server addons
noinst_HEADERS += tcl_server.h
libserver_a_SOURCES += tcl_server.c
Added: trunk/src/server/httpd.c
===================================================================
--- trunk/src/server/httpd.c 2008-12-16 21:10:06 UTC (rev 1250)
+++ trunk/src/server/httpd.c 2008-12-16 22:20:10 UTC (rev 1251)
@@ -0,0 +1,455 @@
+/***************************************************************************
+ * Copyright (C) 2007,2008 vind Harboe *
+ * oyv...@zy... *
+ * *
+ * Copyright (C) 2008 Free Software Foundation
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+/* some bits were copied from ahttpd which is under eCos license and
+ * copyright to FSF
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "replacements.h"
+
+#include "server.h"
+
+#include "log.h"
+#include "telnet_server.h"
+#include "target.h"
+
+#include <command.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <signal.h>
+
+#include <sys/types.h>
+#include <sys/select.h>
+#include <sys/socket.h>
+#include <microhttpd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#define PAGE_NOT_FOUND "<html><head><title>File not found</title></head><body>File not found</body></html>"
+
+static const char *appendf(const *prev, const char *format, ...)
+{
+ va_list ap;
+ va_start(ap, format);
+ char *string = alloc_vprintf(format, ap);
+ va_end(ap);
+ char *string2 = NULL;
+
+ if (string != NULL)
+ {
+ string2 = alloc_printf("%s%s", (prev == NULL) ? "" : prev, string);
+ }
+
+ if (prev != NULL)
+ {
+ free(prev);
+ }
+
+ if (string == NULL)
+ free(string);
+
+ return string2;
+}
+
+static const char *httpd_exec_cgi_tcl_error(Jim_Interp *interp)
+{
+ int len, i;
+
+ const char *t = NULL;
+ t = appendf(t, "<html><body>\n");
+
+ t = appendf(t, "Runtime error, file \"%s\", line %d:<br>",
+ interp->errorFileName, interp->errorLine);
+ t = appendf(t, " %s<br>", Jim_GetString(interp->result, NULL));
+ Jim_ListLength(interp, interp->stackTrace, &len);
+ for (i = 0; i < len; i += 3)
+ {
+ Jim_Obj *objPtr;
+ const char *proc, *file, *line;
+
+ Jim_ListIndex(interp, interp->stackTrace, i, &objPtr, JIM_NONE);
+ proc = Jim_GetString(objPtr, NULL);
+ Jim_ListIndex(interp, interp->stackTrace, i + 1, &objPtr, JIM_NONE);
+ file = Jim_GetString(objPtr, NULL);
+ Jim_ListIndex(interp, interp->stackTrace, i + 2, &objPtr, JIM_NONE);
+ line = Jim_GetString(objPtr, NULL);
+ t = appendf(t, "In procedure '%s' called at file \"%s\", line %s<br>",
+ proc, file, line);
+ }
+ t = appendf(t, "</html></body>\n");
+
+ return t;
+}
+
+static int httpd_Jim_Command_writeform(Jim_Interp *interp, int argc,
+ Jim_Obj * const *argv)
+{
+ if (argc != 3)
+ {
+ Jim_WrongNumArgs(interp, 1, argv, "method ?args ...?");
+ return JIM_ERR;
+ }
+ char *name = (char*) Jim_GetString(argv[1], NULL);
+ char *file = (char*) Jim_GetString(argv[2], NULL);
+
+ // Find length
+ char *data;
+ int actual;
+
+ int retcode;
+
+ const char *script = alloc_printf("set dummy_val $httppostdata(%s); set dummy_val",
+ name);
+ retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__ );
+ free((void *) script);
+ if (retcode != JIM_OK)
+ return retcode;
+
+ data = Jim_GetString(Jim_GetResult(interp), &actual);
+
+ FILE *f;
+ f = fopen(file, "wb");
+ if (f != NULL)
+ {
+ int ok;
+ ok = fwrite(data, 1, actual, f) == actual;
+ fclose(f);
+
+ if (!ok)
+ {
+ Jim_SetResultString(interp, "Could not write to file", -1);
+ return JIM_ERR;
+ }
+ }
+ else
+ {
+ Jim_SetResultString(interp, "Could not create file", -1);
+ return JIM_ERR;
+ }
+ return JIM_OK;
+}
+
+
+int
+httpd_Jim_Command_formfetch(Jim_Interp *interp,
+ int argc,
+ Jim_Obj *const *argv)
+{
+ if (argc!=2)
+ {
+ Jim_WrongNumArgs(interp, 1, argv, "method ?args ...?");
+ return JIM_ERR;
+ }
+ char *name = (char*)Jim_GetString(argv[1], NULL);
+
+
+ const char *script = alloc_printf("set dummy_val $httppostdata(%s); set dummy_val",
+ name);
+ int retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__ );
+ free((void *) script);
+ if (retcode != JIM_OK)
+ return retcode;
+
+ Jim_SetResult(interp, Jim_GetResult(interp));
+ return JIM_OK;
+}
+
+struct httpd_request
+{
+ int post;
+ struct MHD_PostProcessor *postprocessor;
+
+ //Jim_Obj *dict;
+
+ int complete; /* did we receive the entire post ? */
+
+};
+
+static void request_completed(void *cls, struct MHD_Connection *connection,
+ void **con_cls, enum MHD_RequestTerminationCode toe)
+{
+ struct httpd_request *r = (struct httpd_request*) *con_cls;
+
+ if (NULL == r)
+ return;
+
+ if (r->postprocessor)
+ {
+ MHD_destroy_post_processor(r->postprocessor);
+ }
+
+ free(r);
+ *con_cls = NULL;
+}
+
+/* append to said key in dictonary */
+static void append_key(struct httpd_request *r, const char *key,
+ const char *data, size_t off, size_t size)
+{
+ Jim_Obj *keyObj = Jim_NewStringObj(interp, key, -1);
+ Jim_Obj *value = NULL;
+
+ Jim_Obj *dict = Jim_GetVariableStr(interp, "httppostdata", 0);
+
+ if (dict!=NULL)
+ {
+ if (Jim_DictKey(interp, dict, keyObj, &value, 0) != JIM_OK)
+ {
+ value = NULL;
+ }
+ }
+ if (value == NULL)
+ value = Jim_NewStringObj(interp, "", -1);
+
+ /* create a new object we append to and insert into this location */
+ Jim_Obj *newObj = Jim_NewStringObj(interp, "", -1);
+ Jim_AppendObj(interp, newObj, value);
+ Jim_AppendString(interp, newObj, data, size);
+ /* uhh... use name here of dictionary */
+ Jim_SetDictKeysVector(interp, Jim_NewStringObj(interp, "httppostdata", -1), &keyObj, 1, newObj);
+}
+
+/* append data to each key */
+static int iterate_post(void *con_cls, enum MHD_ValueKind kind,
+ const char *key, const char *filename, const char *content_type,
+ const char *transfer_encoding, const char *data, size_t off,
+ size_t size)
+{
+ struct httpd_request *r = (struct httpd_request*) con_cls;
+
+ append_key(r, key, data, off, size);
+
+ return MHD_YES;
+}
+
+static int record_arg(void *cls, enum MHD_ValueKind kind, const char *key,
+ const char *value)
+{
+ struct httpd_request *r = (struct httpd_request*) cls;
+ append_key(r, key, value, 0, strlen(value));
+ return MHD_YES;
+}
+
+static int ahc_echo(void * cls, struct MHD_Connection * connection,
+ const char * url, const char * method, const char * version,
+ const char * upload_data, unsigned int * upload_data_size, void ** ptr)
+{
+ struct MHD_Response * response;
+ int ret;
+
+ int post = 0;
+
+ if (0 == strcmp(method, "POST"))
+ {
+ post = 1;
+ }
+ else if (0 == strcmp(method, "GET"))
+ {
+ }
+ else
+ {
+ return MHD_NO; /* unexpected method */
+ }
+
+ struct httpd_request *r;
+ if (*ptr == NULL)
+ {
+ /* The first time only the headers are valid,
+ do not respond in the first round... */
+
+ *ptr = malloc(sizeof(struct httpd_request));
+ if (*ptr == NULL)
+ return MHD_NO;
+ memset(*ptr, 0, sizeof(struct httpd_request));
+
+ r = (struct httpd_request *) *ptr;
+
+ r->post = post;
+
+// r->dict = Jim_NewDictObj(interp, NULL, 0);
+
+ /* fill in url query strings in dictonary */
+ MHD_get_connection_values(connection, MHD_GET_ARGUMENT_KIND,
+ record_arg, r);
+
+ if (r->post)
+ {
+ r->postprocessor = MHD_create_post_processor(connection, 2048
+ * 1024, iterate_post, r);
+ }
+
+ return MHD_YES;
+ }
+
+ r = (struct httpd_request *) *ptr;
+
+ if (r->post)
+ {
+ /* consume post data */
+ if (*upload_data_size)
+ {
+ MHD_post_process(r->postprocessor, upload_data, *upload_data_size);
+ *upload_data_size = 0;
+ return MHD_YES;
+ }
+ else
+ {
+ }
+ } else
+ {
+ }
+
+ /* hand over to request who will be using it. */
+ //Jim_SetGlobalVariableStr(interp, "httppostdata", Jim_GetVariableStr(interp, "httppostdata", 0));
+ // r->dict = NULL;
+
+
+ /* FIX!!!! we need more advanced handling of url's to avoid them
+ * being subverted to evil purposes
+ */
+
+ url++; /* skip '/' */
+
+ const char *suffix;
+ suffix = strrchr(url, '.');
+ if ((suffix != NULL) && (strcmp(suffix, ".tcl") == 0))
+ {
+ printf("Run tcl %s\n", url);
+
+ int retcode;
+
+ const char *script = alloc_printf(
+ "global httpdata; source {%s}; set httpdata", url);
+ retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__ );
+ free((void *) script);
+
+ if (retcode == JIM_ERR)
+ {
+ printf("Tcl failed\n");
+ const char *t = httpd_exec_cgi_tcl_error(interp);
+ if (t == NULL)
+ return MHD_NO;
+
+ response = MHD_create_response_from_data(strlen(t), (void *) t,
+ MHD_YES, MHD_NO);
+ ret = MHD_queue_response(connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR, response);
+ MHD_destroy_response(response);
+ return ret;
+ }
+ else
+ {
+ printf("Tcl OK\n");
+ /* FIX!!! how to handle mime types??? */
+ const char *result;
+ int reslen;
+ result = Jim_GetString(Jim_GetResult(interp), &reslen);
+
+ response = MHD_create_response_from_data(reslen, (void *) result,
+ MHD_NO, MHD_YES);
+ ret = MHD_queue_response(connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR, response);
+ MHD_destroy_response(response);
+ return ret;
+ }
+ }
+ else
+ {
+ void *data;
+ int len;
+
+ int retval = loadFile(url, &data, &len);
+ if (retval != ERROR_OK)
+ {
+ printf("Did not find %s\n", url);
+
+ response = MHD_create_response_from_data(strlen(PAGE_NOT_FOUND),
+ (void *) PAGE_NOT_FOUND, MHD_NO, MHD_NO);
+ ret = MHD_queue_response(connection, MHD_HTTP_NOT_FOUND, response);
+ MHD_destroy_response(response);
+ return ret;
+ }
+
+ printf("Serving %s length=%d\n", url, len);
+ /* serve file directly */
+ response = MHD_create_response_from_data(len, data, MHD_YES, MHD_NO);
+ MHD_add_response_header(response, "Content-Type", "image/png");
+
+ ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
+ MHD_destroy_response(response);
+
+ //free(data);
+ return ret;
+ }
+}
+
+static struct MHD_Daemon * d;
+
+int httpd_start(void)
+{
+
+ int port = 8888;
+ LOG_USER("Launching httpd server on port %d", port);
+ d = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, port, NULL, NULL,
+ &ahc_echo, NULL, /* could be data for handler, but we only have a single handler, use global variables instead */
+ MHD_OPTION_NOTIFY_COMPLETED, request_completed, NULL, /* Closure... what's that??? */
+ MHD_OPTION_END);
+ if (d == NULL)
+ return ERROR_FAIL;
+
+ Jim_CreateCommand(interp,
+ "formfetch",
+ httpd_Jim_Command_formfetch,
+ NULL,
+ NULL);
+
+ Jim_CreateCommand(interp,
+ "writeform",
+ httpd_Jim_Command_writeform,
+ NULL,
+ NULL);
+
+
+ return ERROR_OK;
+}
+
+void httpd_stop(void)
+{
+ MHD_stop_daemon(d);
+}
+
+void openocd_sleep_prelude(void)
+{
+}
+
+void openocd_sleep_postlude(void)
+{
+}
+
Added: zy1000/trunk/build/testhttpd.tcl
===================================================================
--- zy1000/trunk/build/testhttpd.tcl 2008-12-16 21:10:06 UTC (rev 1250)
+++ zy1000/trunk/build/testhttpd.tcl 2008-12-16 22:20:10 UTC (rev 1251)
@@ -0,0 +1,41 @@
+# some dummy proc's to get things going for test purposes
+
+proc zy1000_version {args} {
+return abc
+}
+
+script ../zy1000/linux_zy1000/build/tcl/openocd.cfg
+
+interface dummy
+
+
+proc ip {} {
+return 10.0.0.55
+}
+
+proc start_chunked {a} {
+ global httpdata
+ global httpmime
+ set httpmime $a
+ set httpdata ""
+}
+
+proc write_chunked {a} {
+ global httpdata
+ append httpdata $a
+}
+
+proc end_chunked {} {
+}
+
+
+
+#proc formfetch {a} {
+# global httppostdata
+ #catch {
+# echo "$a=$httppostdata($a)"
+ #return $httppostdata($a)
+ #}
+#
+ #return ""
+#}
\ No newline at end of file
|
|
From: <oh...@ma...> - 2008-12-16 22:10:08
|
Author: oharboe
Date: 2008-12-16 22:10:06 +0100 (Tue, 16 Dec 2008)
New Revision: 1250
Modified:
trunk/src/helper/jim.c
trunk/src/helper/jim.h
Log:
sync up to latest jim tcl
Modified: trunk/src/helper/jim.c
===================================================================
--- trunk/src/helper/jim.c 2008-12-16 19:29:50 UTC (rev 1249)
+++ trunk/src/helper/jim.c 2008-12-16 21:10:06 UTC (rev 1250)
@@ -7,6 +7,7 @@
* Copyright 2008 Andrew Lunn <an...@lu...>
* Copyright 2008 Duane Ellis <op...@du...>
* Copyright 2008 Uwe Klein <uk...@kl...>
+ * Copyright 2008 Steve Bennett <st...@wo...>
*
* The FreeBSD license
*
@@ -85,6 +86,10 @@
#endif /* WIN32 */
#endif /* JIM_DYNLIB */
+#ifndef WIN32
+#include <unistd.h>
+#endif
+
#ifdef __ECOS
#include <cyg/jimtcl/jim.h>
#else
@@ -1325,19 +1330,21 @@
if (brace) {
while (!stop) {
if (*pc->p == '}' || pc->len == 0) {
+ pc->tend = pc->p-1;
stop = 1;
if (pc->len == 0)
- continue;
+ break;
}
else if (*pc->p == '\n')
pc->linenr++;
pc->p++; pc->len--;
}
- if (pc->len == 0)
- pc->tend = pc->p-1;
- else
- pc->tend = pc->p-2;
} else {
+ /* Include leading colons */
+ while (*pc->p == ':') {
+ pc->p++;
+ pc->len--;
+ }
while (!stop) {
if (!((*pc->p >= 'a' && *pc->p <= 'z') ||
(*pc->p >= 'A' && *pc->p <= 'Z') ||
@@ -2197,9 +2204,14 @@
static Jim_Obj *JimStringToLower(Jim_Interp *interp, Jim_Obj *strObjPtr)
{
- char *buf = Jim_Alloc(strObjPtr->length+1);
+ char *buf;
int i;
+ if (strObjPtr->typePtr != &stringObjType) {
+ SetStringFromAny(interp, strObjPtr);
+ }
+ buf = Jim_Alloc(strObjPtr->length+1);
+
memcpy(buf, strObjPtr->bytes, strObjPtr->length+1);
for (i = 0; i < strObjPtr->length; i++)
buf[i] = tolower(buf[i]);
@@ -2208,9 +2220,14 @@
static Jim_Obj *JimStringToUpper(Jim_Interp *interp, Jim_Obj *strObjPtr)
{
- char *buf = Jim_Alloc(strObjPtr->length+1);
+ char *buf;
int i;
+ if (strObjPtr->typePtr != &stringObjType) {
+ SetStringFromAny(interp, strObjPtr);
+ }
+ buf = Jim_Alloc(strObjPtr->length+1);
+
memcpy(buf, strObjPtr->bytes, strObjPtr->length+1);
for (i = 0; i < strObjPtr->length; i++)
buf[i] = toupper(buf[i]);
@@ -2289,32 +2306,32 @@
/* non-terminals */
case '0': /* zero pad */
zpad = 1;
- *fmt++; fmtLen--;
+ fmt++; fmtLen--;
goto next_fmt;
break;
case '+':
forceplus = 1;
- *fmt++; fmtLen--;
+ fmt++; fmtLen--;
goto next_fmt;
break;
case ' ': /* sign space */
spad = 1;
- *fmt++; fmtLen--;
+ fmt++; fmtLen--;
goto next_fmt;
break;
case '-':
ljust = 1;
- *fmt++; fmtLen--;
+ fmt++; fmtLen--;
goto next_fmt;
break;
case '#':
altfm = 1;
- *fmt++; fmtLen--;
+ fmt++; fmtLen--;
goto next_fmt;
-
+
case '.':
inprec = 1;
- *fmt++; fmtLen--;
+ fmt++; fmtLen--;
goto next_fmt;
break;
case '1':
@@ -2340,7 +2357,7 @@
goto next_fmt;
case '*':
/* suck up the next item as an integer */
- *fmt++; fmtLen--;
+ fmt++; fmtLen--;
objc--;
if( objc <= 0 ){
goto not_enough_args;
@@ -2358,12 +2375,12 @@
prec = 0;
}
} else {
- width = wideValue;
- if( width < 0 ){
- ljust = 1;
- width = -width;
- }
+ width = wideValue;
+ if( width < 0 ){
+ ljust = 1;
+ width = -width;
}
+ }
objv++;
goto next_fmt;
break;
@@ -2455,6 +2472,7 @@
break;
case 'b':
case 'd':
+ case 'o':
case 'i':
case 'u':
case 'x':
@@ -3009,7 +3027,7 @@
initialLineNumber = objPtr->internalRep.sourceValue.lineNumber;
propagateSourceInfo = 1;
} else {
- script->fileName = Jim_StrDup("?");
+ script->fileName = Jim_StrDup("");
initialLineNumber = 1;
}
@@ -3161,9 +3179,6 @@
he = Jim_FindHashEntry(&interp->commands, cmdName);
if (he == NULL) { /* New command to create */
cmdPtr = Jim_Alloc(sizeof(*cmdPtr));
- cmdPtr->cmdProc = cmdProc;
- cmdPtr->privData = privData;
- cmdPtr->delProc = delProc;
Jim_AddHashEntry(&interp->commands, cmdName, cmdPtr);
} else {
Jim_InterpIncrProcEpoch(interp);
@@ -3181,9 +3196,13 @@
/* If it was a C coded command, call the delProc if any */
cmdPtr->delProc(interp, cmdPtr->privData);
}
- cmdPtr->cmdProc = cmdProc;
- cmdPtr->privData = privData;
}
+
+ /* Store the new details for this proc */
+ cmdPtr->delProc = delProc;
+ cmdPtr->cmdProc = cmdProc;
+ cmdPtr->privData = privData;
+
/* There is no need to increment the 'proc epoch' because
* creation of a new procedure can never affect existing
* cached commands. We don't do negative caching. */
@@ -3463,15 +3482,23 @@
/* Make sure it's not syntax glue to get/set dict. */
if (Jim_NameIsDictSugar(varName, len))
return JIM_DICT_SUGAR;
- /* Lookup this name into the variables hash table */
- he = Jim_FindHashEntry(&interp->framePtr->vars, varName);
- if (he == NULL) {
- /* Try with static vars. */
- if (interp->framePtr->staticVars == NULL)
+ if (varName[0] == ':' && varName[1] == ':') {
+ he = Jim_FindHashEntry(&interp->topFramePtr->vars, varName + 2);
+ if (he == NULL) {
return JIM_ERR;
- if (!(he = Jim_FindHashEntry(interp->framePtr->staticVars, varName)))
- return JIM_ERR;
+ }
}
+ else {
+ /* Lookup this name into the variables hash table */
+ he = Jim_FindHashEntry(&interp->framePtr->vars, varName);
+ if (he == NULL) {
+ /* Try with static vars. */
+ if (interp->framePtr->staticVars == NULL)
+ return JIM_ERR;
+ if (!(he = Jim_FindHashEntry(interp->framePtr->staticVars, varName)))
+ return JIM_ERR;
+ }
+ }
/* Free the old internal repr and set the new one. */
Jim_FreeIntRep(interp, objPtr);
objPtr->typePtr = &variableObjType;
@@ -3509,7 +3536,13 @@
Jim_IncrRefCount(valObjPtr);
var->linkFramePtr = NULL;
/* Insert the new variable */
- Jim_AddHashEntry(&interp->framePtr->vars, name, var);
+ if (name[0] == ':' && name[1] == ':') {
+ /* Into to the top evel frame */
+ Jim_AddHashEntry(&interp->topFramePtr->vars, name + 2, var);
+ }
+ else {
+ Jim_AddHashEntry(&interp->framePtr->vars, name, var);
+ }
/* Make the object int rep a variable */
Jim_FreeIntRep(interp, nameObjPtr);
nameObjPtr->typePtr = &variableObjType;
@@ -4410,6 +4443,7 @@
i->result = i->emptyObj;
i->stackTrace = Jim_NewListObj(i, NULL, 0);
i->unknown = Jim_NewStringObj(i, "unknown", -1);
+ i->unknown_called = 0;
Jim_IncrRefCount(i->emptyObj);
Jim_IncrRefCount(i->result);
Jim_IncrRefCount(i->stackTrace);
@@ -4624,6 +4658,11 @@
static void JimAppendStackTrace(Jim_Interp *interp, const char *procname,
const char *filename, int linenr)
{
+ /* No need to add this dummy entry to the stack trace */
+ if (strcmp(procname, "unknown") == 0) {
+ return;
+ }
+
if (Jim_IsShared(interp->stackTrace)) {
interp->stackTrace =
Jim_DuplicateObj(interp, interp->stackTrace);
@@ -6592,7 +6631,7 @@
case JIM_EXPROP_STRING:
break;
default:
- op = JimExprOperatorInfoByOpcode(expr->opcode[i]);
+ op = JimExprOperatorInfoByOpcode(expr->opcode[leftindex]);
if (op == NULL) {
Jim_Panic(interp,"Default reached in ExprMakeLazy()");
}
@@ -6982,6 +7021,16 @@
/* --- Double --- */
if (Jim_GetDouble(interp, A, &dA) != JIM_OK ||
Jim_GetDouble(interp, B, &dB) != JIM_OK) {
+
+ /* Hmmm! For compatibility, maybe convert != and == into ne and eq */
+ if (expr->opcode[i] == JIM_EXPROP_NUMNE) {
+ opcode = JIM_EXPROP_STRNE;
+ goto retry_as_string;
+ }
+ else if (expr->opcode[i] == JIM_EXPROP_NUMEQ) {
+ opcode = JIM_EXPROP_STREQ;
+ goto retry_as_string;
+ }
Jim_DecrRefCount(interp, A);
Jim_DecrRefCount(interp, B);
error = 1;
@@ -7043,9 +7092,10 @@
} else if (opcode == JIM_EXPROP_STREQ || opcode == JIM_EXPROP_STRNE) {
B = stack[--stacklen];
A = stack[--stacklen];
+retry_as_string:
sA = Jim_GetString(A, &Alen);
sB = Jim_GetString(B, &Blen);
- switch(expr->opcode[i]) {
+ switch(opcode) {
case JIM_EXPROP_STREQ:
if (Alen == Blen && memcmp(sA, sB, Alen) ==0)
wC = 1;
@@ -7877,21 +7927,21 @@
if (Jim_ListIndex(interp, libPathObjPtr, i,
&prefixObjPtr, JIM_NONE) != JIM_OK)
continue;
- prefix = Jim_GetString(prefixObjPtr, NULL);
- prefixlen = strlen(prefix);
+ prefix = Jim_GetString(prefixObjPtr, &prefixlen);
if (prefixlen+strlen(pathName)+1 >= JIM_PATH_LEN)
continue;
- if (prefixlen && prefix[prefixlen-1] == '/')
+ if (*pathName == '/') {
+ strcpy(buf, pathName);
+ }
+ else if (prefixlen && prefix[prefixlen-1] == '/')
sprintf(buf, "%s%s", prefix, pathName);
else
sprintf(buf, "%s/%s", prefix, pathName);
- printf("opening '%s'\n", buf);
fp = fopen(buf, "r");
if (fp == NULL)
continue;
fclose(fp);
handle = dlopen(buf, RTLD_LAZY);
- printf("got handle %p\n", handle);
}
if (handle == NULL) {
Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
@@ -8235,6 +8285,9 @@
Jim_HashEntry *he;
int requiredVer;
+ /* Start with an empty error string */
+ Jim_SetResultString(interp, "", 0);
+
if (JimPackageVersionToInt(interp, ver, &requiredVer, JIM_ERRMSG) != JIM_OK)
return NULL;
he = Jim_FindHashEntry(&interp->packages, name);
@@ -8249,8 +8302,9 @@
}
/* No way... return an error. */
if (flags & JIM_ERRMSG) {
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp),
+ int len;
+ Jim_GetString(Jim_GetResult(interp), &len);
+ Jim_AppendStrings(interp, Jim_GetResult(interp), len ? "\n" : "",
"Can't find package '", name, "'", NULL);
}
return NULL;
@@ -8263,7 +8317,6 @@
}
/* Check if version matches. */
if (JimPackageMatchVersion(requiredVer, actualVer, flags) == 0) {
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
Jim_AppendStrings(interp, Jim_GetResult(interp),
"Package '", name, "' already loaded, but with version ",
he->val, NULL);
@@ -8288,6 +8341,13 @@
Jim_Obj **v, *sv[JIM_EVAL_SARGV_LEN];
int retCode;
+ /* If JimUnknown() is recursively called (e.g. error in the unknown proc,
+ * done here
+ */
+ if (interp->unknown_called) {
+ return JIM_ERR;
+ }
+
/* If the [unknown] command does not exists returns
* just now */
if (Jim_GetCommand(interp, interp->unknown, JIM_NONE) == NULL)
@@ -8308,7 +8368,10 @@
memcpy(v+1, argv, sizeof(Jim_Obj*)*argc);
v[0] = interp->unknown;
/* Call it */
+ interp->unknown_called++;
retCode = Jim_EvalObjVector(interp, argc+1, v);
+ interp->unknown_called--;
+
/* Clean up */
if (v != sv)
Jim_Free(v);
@@ -8342,12 +8405,16 @@
if (cmdPtr->cmdProc) {
interp->cmdPrivData = cmdPtr->privData;
retcode = cmdPtr->cmdProc(interp, objc, objv);
+ if (retcode == JIM_ERR_ADDSTACK) {
+ //JimAppendStackTrace(interp, "", script->fileName, token[i-argc*2].linenr);
+ retcode = JIM_ERR;
+ }
} else {
retcode = JimCallProcedure(interp, cmdPtr, objc, objv);
- if (retcode == JIM_ERR) {
- JimAppendStackTrace(interp,
- Jim_GetString(objv[0], NULL), "?", 1);
- }
+ if (retcode == JIM_ERR) {
+ JimAppendStackTrace(interp,
+ Jim_GetString(objv[0], NULL), "", 1);
+ }
}
}
/* Decr refcount of arguments and return the retcode */
@@ -8628,6 +8695,10 @@
if (cmd->cmdProc) {
interp->cmdPrivData = cmd->privData;
retcode = cmd->cmdProc(interp, argc, argv);
+ if (retcode == JIM_ERR_ADDSTACK) {
+ JimAppendStackTrace(interp, "", script->fileName, token[i-argc*2].linenr);
+ retcode = JIM_ERR;
+ }
} else {
retcode = JimCallProcedure(interp, cmd, argc, argv);
if (retcode == JIM_ERR) {
@@ -8641,7 +8712,7 @@
retcode = JimUnknown(interp, argc, argv);
if (retcode == JIM_ERR) {
JimAppendStackTrace(interp,
- Jim_GetString(argv[0], NULL), script->fileName,
+ "", script->fileName,
token[i-argc*2].linenr);
}
}
@@ -8697,6 +8768,7 @@
{
int i, retcode;
Jim_CallFrame *callFramePtr;
+ int num_args;
/* Check arity */
if (argc < cmd->arityMin || (cmd->arityMax != -1 &&
@@ -8727,19 +8799,47 @@
Jim_IncrRefCount(cmd->bodyObjPtr);
interp->framePtr = callFramePtr;
interp->numLevels ++;
+
/* Set arguments */
- for (i = 0; i < cmd->arityMin-1; i++) {
- Jim_Obj *objPtr;
+ Jim_ListLength(interp, cmd->argListObjPtr, &num_args);
- Jim_ListIndex(interp, cmd->argListObjPtr, i, &objPtr, JIM_NONE);
- Jim_SetVariable(interp, objPtr, argv[i+1]);
+ /* If last argument is 'args', don't set it here */
+ if (cmd->arityMax == -1) {
+ num_args--;
}
+
+ for (i = 0; i < num_args; i++) {
+ Jim_Obj *argObjPtr;
+ Jim_Obj *nameObjPtr;
+ Jim_Obj *valueObjPtr;
+
+ Jim_ListIndex(interp, cmd->argListObjPtr, i, &argObjPtr, JIM_NONE);
+ if (i + 1 >= cmd->arityMin) {
+ /* The name is the first element of the list */
+ Jim_ListIndex(interp, argObjPtr, 0, &nameObjPtr, JIM_NONE);
+ }
+ else {
+ /* The element arg is the name */
+ nameObjPtr = argObjPtr;
+ }
+
+ if (i + 1 >= argc) {
+ /* No more values, so use default */
+ /* The value is the second element of the list */
+ Jim_ListIndex(interp, argObjPtr, 1, &valueObjPtr, JIM_NONE);
+ }
+ else {
+ valueObjPtr = argv[i+1];
+ }
+ Jim_SetVariable(interp, nameObjPtr, valueObjPtr);
+ }
+ /* Set optional arguments */
if (cmd->arityMax == -1) {
Jim_Obj *listObjPtr, *objPtr;
- listObjPtr = Jim_NewListObj(interp, argv+cmd->arityMin,
- argc-cmd->arityMin);
- Jim_ListIndex(interp, cmd->argListObjPtr, i, &objPtr, JIM_NONE);
+ i++;
+ listObjPtr = Jim_NewListObj(interp, argv+i, argc-i);
+ Jim_ListIndex(interp, cmd->argListObjPtr, num_args, &objPtr, JIM_NONE);
Jim_SetVariable(interp, objPtr, listObjPtr);
}
/* Eval the body */
@@ -10895,17 +10995,31 @@
}
Jim_ListLength(interp, argv[2], &argListLen);
arityMin = arityMax = argListLen+1;
+
if (argListLen) {
const char *str;
int len;
- Jim_Obj *lastArgPtr;
+ Jim_Obj *argPtr;
- Jim_ListIndex(interp, argv[2], argListLen-1, &lastArgPtr, JIM_NONE);
- str = Jim_GetString(lastArgPtr, &len);
+ /* Check for 'args' and adjust arityMin and arityMax if necessary */
+ Jim_ListIndex(interp, argv[2], argListLen-1, &argPtr, JIM_NONE);
+ str = Jim_GetString(argPtr, &len);
if (len == 4 && memcmp(str, "args", 4) == 0) {
arityMin--;
arityMax = -1;
}
+
+ /* Check for default arguments and reduce arityMin if necessary */
+ while (arityMin > 1) {
+ int len;
+ Jim_ListIndex(interp, argv[2], arityMin - 2, &argPtr, JIM_NONE);
+ Jim_ListLength(interp, argPtr, &len);
+ if (len != 2) {
+ /* No default argument */
+ break;
+ }
+ arityMin--;
+ }
}
if (argc == 4) {
return Jim_CreateProcedure(interp, Jim_GetString(argv[1], NULL),
@@ -11537,10 +11651,10 @@
int cmd, result = JIM_OK;
static const char *commands[] = {
"body", "commands", "exists", "globals", "level", "locals",
- "vars", "version", "complete", "args", NULL
+ "vars", "version", "complete", "args", "hostname", NULL
};
enum {INFO_BODY, INFO_COMMANDS, INFO_EXISTS, INFO_GLOBALS, INFO_LEVEL,
- INFO_LOCALS, INFO_VARS, INFO_VERSION, INFO_COMPLETE, INFO_ARGS};
+ INFO_LOCALS, INFO_VARS, INFO_VERSION, INFO_COMPLETE, INFO_ARGS, INFO_HOSTNAME};
if (argc < 2) {
Jim_WrongNumArgs(interp, 1, argv, "command ?args ...?");
@@ -11636,6 +11750,10 @@
s = Jim_GetString(argv[2], &len);
Jim_SetResult(interp,
Jim_NewIntObj(interp, Jim_ScriptIsComplete(s, len, NULL)));
+ } else if (cmd == INFO_HOSTNAME) {
+ /* Redirect to os.hostname if it exists */
+ Jim_Obj *command = Jim_NewStringObj(interp, "os.gethostname", -1);
+ result = Jim_EvalObjVector(interp, 1, &command);
}
return result;
}
@@ -11854,6 +11972,24 @@
const char *key;
char *val;
+ if (argc == 1) {
+ extern char **environ;
+
+ int i;
+ Jim_Obj *listObjPtr = Jim_NewListObj(interp, NULL, 0);
+
+ for (i = 0; environ[i]; i++) {
+ const char *equals = strchr(environ[i], '=');
+ if (equals) {
+ Jim_ListAppendElement(interp, listObjPtr, Jim_NewStringObj(interp, environ[i], equals - environ[i]));
+ Jim_ListAppendElement(interp, listObjPtr, Jim_NewStringObj(interp, equals + 1, -1));
+ }
+ }
+
+ Jim_SetResult(interp, listObjPtr);
+ return JIM_OK;
+ }
+
if (argc != 2) {
Jim_WrongNumArgs(interp, 1, argv, "varName");
return JIM_ERR;
@@ -11882,6 +12018,9 @@
return JIM_ERR;
}
retval = Jim_EvalFile(interp, Jim_GetString(argv[1], NULL));
+ if (retval == JIM_ERR) {
+ return JIM_ERR_ADDSTACK;
+ }
if (retval == JIM_RETURN)
return JIM_OK;
return retval;
@@ -12031,7 +12170,7 @@
argc == 4 ? Jim_GetString(argv[3], NULL) : "",
JIM_ERRMSG);
if (ver == NULL)
- return JIM_ERR;
+ return JIM_ERR_ADDSTACK;
Jim_SetResultString(interp, ver, -1);
} else if (option == OPT_PROVIDE) {
if (argc != 4) {
@@ -12044,108 +12183,6 @@
return JIM_OK;
}
-
-static void
-jim_get_s_us( jim_wide *s, jim_wide *us )
-{
-#if defined(WIN32)
- /*
- * Sorry - I do not have, or use Win32.
- * This concept is from
- *
- * Method is from:
- * http://www.openasthra.com/c-tidbits/gettimeofday-function-for-windows/
- *
- * I have no method to test/verify.
- * - Duane 6-sep-2008.
- * (once verified, please somebody remove this comment)
- */
-#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
- #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
-#else
- #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
-#endif
-
- FILETIME ft;
- unsigned __int64 tmpres;
- tmpres = 0;
- GetSystemTimeAsFileTime( &ft );
-
- tmpres |= ft.dwHighDateTime;
- tmpres <<= 32;
- tmpres |= ft.dwLowDateTime;
- /* convert to unix representation */
- tmpres /= 10;
- tmpres -= DELTA_EPOCH_IN_MICROSECS;
-
- *s = (tmpres / 1000000ULL);
- *us = (tmpres % 1000000ULL);
-
-#undef DELTA_EPOCH_IN_MICROSECS
-
-#else
- /* LINUX/CYGWIN */
- struct timeval tv;
- struct timezone tz;
- gettimeofday( &tv, &tz );
- *s = tv.tv_sec;
- *us = tv.tv_usec;
-#endif
-}
-
-
-/* [clock] */
-static int Jim_ClockCoreCommand( Jim_Interp *interp, int argc,
- Jim_Obj *const *argv)
-{
- /*
- * See: TCL man page for 'clock'
- * we do not impliment all features.
- */
- jim_wide r,s,us;
- int option;
- const char *options[] = {
- "clicks",
- "microseconds",
- "milliseconds",
- "seconds",
- NULL
- };
- enum { OPT_CLICKS, OPT_USEC, OPT_MSEC, OPT_SEC };
-
- if( argc < 2 ){
- Jim_WrongNumArgs( interp, 1, argv, "option ?arguments ...?");
- return JIM_ERR;
- }
-
- if( Jim_GetEnum(interp, argv[1], options, &option, "option",
- JIM_ERRMSG) != JIM_OK ){
- return JIM_ERR;
- }
-
- // platform independent get time.
- jim_get_s_us( &s, &us );
-
- r = 0;
- switch(option){
- case OPT_CLICKS:
- case OPT_USEC:
- /* clicks & usecs are the same */
- r = (s * 1000000) + us;
- break;
- case OPT_MSEC:
- r = (s * 1000) + (us / 1000);
- break;
- case OPT_SEC:
- r = s;
- break;
- }
-
- Jim_SetResult( interp, Jim_NewWideObj( interp, r ) );
- return JIM_OK;
-}
-
-
static struct {
const char *name;
Jim_CmdProc cmdProc;
@@ -12210,7 +12247,6 @@
{"rand", Jim_RandCoreCommand},
{"package", Jim_PackageCoreCommand},
{"tailcall", Jim_TailcallCoreCommand},
- {"clock", Jim_ClockCoreCommand},
{NULL, NULL},
};
@@ -12250,9 +12286,11 @@
{
int len, i;
- Jim_fprintf(interp, interp->cookie_stderr, "Runtime error, file \"%s\", line %d:" JIM_NL,
- interp->errorFileName, interp->errorLine);
- Jim_fprintf(interp,interp->cookie_stderr, " %s" JIM_NL,
+ if (*interp->errorFileName) {
+ Jim_fprintf(interp, interp->cookie_stderr, "Runtime error, file \"%s\", line %d:" JIM_NL " ",
+ interp->errorFileName, interp->errorLine);
+ }
+ Jim_fprintf(interp,interp->cookie_stderr, "%s" JIM_NL,
Jim_GetString(interp->result, NULL));
Jim_ListLength(interp, interp->stackTrace, &len);
for (i = len-3; i >= 0; i-= 3) {
@@ -12267,9 +12305,18 @@
Jim_ListIndex(interp, interp->stackTrace, i+2, &objPtr,
JIM_NONE);
line = Jim_GetString(objPtr, NULL);
- Jim_fprintf( interp, interp->cookie_stderr,
- "In procedure '%s' called at file \"%s\", line %s" JIM_NL,
- proc, file, line);
+ if (*proc) {
+ Jim_fprintf( interp, interp->cookie_stderr,
+ "in procedure '%s' ", proc);
+ }
+ if (*file) {
+ Jim_fprintf( interp, interp->cookie_stderr,
+ "called at file \"%s\", line %s",
+ file, line);
+ }
+ if (*file || *proc) {
+ Jim_fprintf( interp, interp->cookie_stderr, JIM_NL);
+ }
}
}
@@ -12393,7 +12440,6 @@
}
return (*(interp->cb_fgets))( s, size, cookie );
}
-
Jim_Nvp *
Jim_Nvp_name2value_simple( const Jim_Nvp *p, const char *name )
{
@@ -12555,7 +12601,7 @@
Jim_Obj *o;
o = NULL; // failure
- if( goi->argc > 0 ){
+ if( goi->argc ){
// success
o = goi->argv[0];
goi->argc -= 1;
@@ -12704,7 +12750,7 @@
{
va_list ap;
char *buf;
-
+
va_start(ap,fmt);
buf = jim_vasprintf( fmt, ap );
va_end(ap);
@@ -12773,3 +12819,12 @@
return Jim_GetString( debug_string_obj, NULL );
}
+
+
+
+/*
+ * Local Variables: ***
+ * c-basic-offset: 4 ***
+ * tab-width: 4 ***
+ * End: ***
+ */
Modified: trunk/src/helper/jim.h
===================================================================
--- trunk/src/helper/jim.h 2008-12-16 19:29:50 UTC (rev 1249)
+++ trunk/src/helper/jim.h 2008-12-16 21:10:06 UTC (rev 1250)
@@ -164,6 +164,7 @@
#define JIM_CONTINUE 4
#define JIM_EVAL 5
#define JIM_EXIT 6
+#define JIM_ERR_ADDSTACK 7
#define JIM_MAX_NESTING_DEPTH 10000 /* default max nesting depth */
/* Some function get an integer argument with flags to change
@@ -530,6 +531,7 @@
struct Jim_HashTable sharedStrings; /* Shared Strings hash table */
Jim_Obj *stackTrace; /* Stack trace object. */
Jim_Obj *unknown; /* Unknown command cache */
+ int unknown_called; /* The unknown command has been invoked */
int errorFlag; /* Set if an error occurred during execution. */
int evalRetcodeLevel; /* Level where the last return with code JIM_EVAL
happened. */
@@ -560,6 +562,7 @@
* cached can no longer considered valid. */
#define Jim_InterpIncrProcEpoch(i) (i)->procEpoch++
#define Jim_SetResultString(i,s,l) Jim_SetResult(i, Jim_NewStringObj(i,s,l))
+#define Jim_SetResultInt(i,intval) Jim_SetResult(i, Jim_NewIntObj(i,intval))
#define Jim_SetEmptyResult(i) Jim_SetResult(i, (i)->emptyObj)
#define Jim_GetResult(i) ((i)->result)
#define Jim_CmdPrivData(i) ((i)->cmdPrivData)
@@ -1296,7 +1299,7 @@
JIM_GET_API(Nvp_name2value);
JIM_GET_API(Nvp_name2value_nocase);
JIM_GET_API(Nvp_name2value_simple);
-
+
JIM_GET_API(Nvp_value2name);
JIM_GET_API(Nvp_value2name_simple);
@@ -1337,3 +1340,10 @@
#endif
#endif /* __JIM__H */
+
+/*
+ * Local Variables: ***
+ * c-basic-offset: 4 ***
+ * tab-width: 4 ***
+ * End: ***
+ */
|
|
From: <oh...@ma...> - 2008-12-16 20:30:18
|
Author: oharboe
Date: 2008-12-16 20:29:50 +0100 (Tue, 16 Dec 2008)
New Revision: 1249
Modified:
trunk/doc/openocd.texi
Log:
Dirk Behme <dir...@go...> Fix some typos in documentation
Modified: trunk/doc/openocd.texi
===================================================================
--- trunk/doc/openocd.texi 2008-12-16 11:49:14 UTC (rev 1248)
+++ trunk/doc/openocd.texi 2008-12-16 19:29:50 UTC (rev 1249)
@@ -544,7 +544,7 @@
@enumerate
@item The RESET configuration of your debug environment as a hole
-@item Is there a ``work area'' that that OpenOCD can use?
+@item Is there a ``work area'' that OpenOCD can use?
@* For ARM - work areas mean up to 10x faster downloads.
@item For MMU/MPU based ARM chips (ie: ARM9 and later) will that work area still be available?
@item For complex targets (multiple chips) the JTAG SPEED becomes an issue.
@@ -920,7 +920,7 @@
@node Daemon Configuration
@chapter Daemon Configuration
-The commands here are commonly found inthe openocd.cfg file and are
+The commands here are commonly found in the openocd.cfg file and are
used to specify what TCP/IP ports are used, and how GDB should be
supported.
@section init
@@ -1492,9 +1492,9 @@
by the ``jtag newtap'' command. The documentation remains here so that
one can easily convert the old syntax to the new syntax. About the old
syntax: The old syntax is positional, ie: The 4th parameter is the
-``irmask'' The new syntax requires named prefixes, and supports
-additional options, for example ``-irmask 4'' Please refer to the
-@b{jtag newtap} command for deails.
+``irmask''. The new syntax requires named prefixes, and supports
+additional options, for example ``-irmask 4''. Please refer to the
+@b{jtag newtap} command for details.
@example
OLD: jtag_device 8 0x01 0x0e3 0xfe
NEW: jtag newtap CHIPNAME TAPNAME -irlen 8 -ircapture 0xe3 -irmask 0xfe
@@ -1543,7 +1543,7 @@
@b{jtag tapisenabled DOTTED.NAME}
-This command return 1 if the named tap is currently enabled, 0 if not.
+This command returns 1 if the named tap is currently enabled, 0 if not.
This command exists so that scripts that manipulate a JRC (like the
Omap3530 has) can determine if OpenOCD thinks a tap is presently
enabled, or disabled.
@@ -1558,7 +1558,7 @@
@section targets [NAME]
@b{Note:} This command name is PLURAL - not singular.
-With NO parameter, this pural @b{targets} command lists all known
+With NO parameter, this plural @b{targets} command lists all known
targets in a human friendly form.
With a parameter, this pural @b{targets} command sets the current
@@ -1690,13 +1690,13 @@
@end itemize
@section Target Events
-At various times, certian things happen, or you want to happen.
+At various times, certain things can happen, or you want them to happen.
Examples:
@itemize @bullet
@item What should happen when GDB connects? Should your target reset?
@item When GDB tries to flash the target, do you need to enable the flash via a special command?
-@item During reset, do you need to write to certian memory locations to reconfigure the SDRAM?
+@item During reset, do you need to write to certain memory location to reconfigure the SDRAM?
@end itemize
All of the above items are handled by target events.
@@ -1708,7 +1708,7 @@
target event name, and BODY is a tcl procedure or string of commands
to execute.
-The programers model is the: ``-command'' option used in Tcl/Tk
+The programmers model is the ``-command'' option used in Tcl/Tk
buttons and events. Below are two identical examples, the first
creates and invokes small procedure. The second inlines the procedure.
@@ -1822,13 +1822,13 @@
@comment end TYPES
@end itemize
@item @b{PARAMS}
-@*PARAMs are various target configure parameters, the following are manditory
-at configuration.
-@comment START manditory
+@*PARAMs are various target configure parameters, the following are mandatory
+at configuration:
+@comment START mandatory
@itemize @bullet
@item @b{-endian big|little}
@item @b{-chain-position DOTTED.NAME}
-@comment end MANDITORY
+@comment end MANDATORY
@end itemize
@comment END params
@end itemize
@@ -3269,7 +3269,7 @@
@section TCL Rule #1
There is a famous joke, it goes like this:
@enumerate
-@item Rule #1: The wife is aways correct
+@item Rule #1: The wife is always correct
@item Rule #2: If you think otherwise, See Rule #1
@end enumerate
@@ -3280,7 +3280,7 @@
@item Rule #2: If you think otherwise, See Rule #1
@end enumerate
-As in the famous joke, the consiquences of Rule #1 are profound. Once
+As in the famous joke, the consequences of Rule #1 are profound. Once
you understand Rule #1, you will understand TCL.
@section TCL Rule #1b
@@ -3350,9 +3350,9 @@
28/nov/2008, Jim/OpenOCD does not have a date command.
@end itemize
-@section Consiquences of Rule 1/2/3/4
+@section Consequences of Rule 1/2/3/4
-The consiquences of Rule 1 is profound.
+The consequences of Rule 1 is profound.
@subsection Tokenizing & Execution.
|
|
From: <oh...@ma...> - 2008-12-16 12:49:24
|
Author: oharboe
Date: 2008-12-16 12:49:14 +0100 (Tue, 16 Dec 2008)
New Revision: 1248
Modified:
trunk/src/jtag/dummy.c
Log:
jtag_khz simulation
Modified: trunk/src/jtag/dummy.c
===================================================================
--- trunk/src/jtag/dummy.c 2008-12-16 10:55:08 UTC (rev 1247)
+++ trunk/src/jtag/dummy.c 2008-12-16 11:49:14 UTC (rev 1248)
@@ -30,18 +30,24 @@
int dummy_register_commands(struct command_context_s *cmd_ctx);
int dummy_init(void);
int dummy_quit(void);
+static int dummy_khz(int khz, int *jtag_speed);
+static int dummy_speed_div(int speed, int *khz);
-/* The dummy driver is used to easily check the code path
+
+/* The dummy driver is used to easily check the code path
* where the target is unresponsive.
*/
-jtag_interface_t dummy_interface =
+jtag_interface_t dummy_interface =
{
.name = "dummy",
-
+
.execute_queue = bitbang_execute_queue,
- .speed = dummy_speed,
+ .speed = dummy_speed,
.register_commands = dummy_register_commands,
+ .khz = dummy_khz,
+ .speed_div = dummy_speed_div,
+
.init = dummy_init,
.quit = dummy_quit,
};
@@ -72,6 +78,33 @@
{
}
+static int dummy_khz(int khz, int *jtag_speed)
+{
+ if (khz==0)
+ {
+ *jtag_speed=0;
+ }
+ else
+ {
+ *jtag_speed=64000/khz;
+ }
+ return ERROR_OK;
+}
+
+static int dummy_speed_div(int speed, int *khz)
+{
+ if (speed==0)
+ {
+ *khz = 0;
+ }
+ else
+ {
+ *khz=64000/speed;
+ }
+
+ return ERROR_OK;
+}
+
int dummy_speed(int speed)
{
return ERROR_OK;
@@ -84,7 +117,7 @@
int dummy_init(void)
{
- bitbang_interface = &dummy_bitbang;
+ bitbang_interface = &dummy_bitbang;
return ERROR_OK;
}
|
|
From: <oh...@ma...> - 2008-12-16 11:55:11
|
Author: oharboe
Date: 2008-12-16 11:55:08 +0100 (Tue, 16 Dec 2008)
New Revision: 1247
Modified:
trunk/src/server/gdb_server.c
Log:
allow setting/reading gdb_port at any time
Modified: trunk/src/server/gdb_server.c
===================================================================
--- trunk/src/server/gdb_server.c 2008-12-16 10:22:24 UTC (rev 1246)
+++ trunk/src/server/gdb_server.c 2008-12-16 10:55:08 UTC (rev 1247)
@@ -180,7 +180,7 @@
return retval;
gdb_con->buf_cnt = read_socket(connection->fd, gdb_con->buffer, GDB_BUFFER_SIZE);
}
-
+
if (gdb_con->buf_cnt > 0)
{
break;
@@ -276,7 +276,7 @@
gdb_connection_t *gdb_con = connection->priv;
if (gdb_con->closed)
return ERROR_SERVER_REMOTE_CLOSED;
-
+
if (connection->service->type == CONNECTION_PIPE)
{
/* write to stdout */
@@ -2205,7 +2205,7 @@
if (server_use_pipes)
{
/* only a single gdb connection when using a pipe */
-
+
gdb_service = malloc(sizeof(gdb_service_t));
gdb_service->target = target;
@@ -2221,12 +2221,12 @@
gdb_service->target = target;
add_service("gdb", CONNECTION_TCP, gdb_port + target->target_number, 1, gdb_new_connection, gdb_input, gdb_connection_closed, gdb_service);
-
+
LOG_DEBUG("gdb service for target %s at port %i", target->type->name, gdb_port + target->target_number);
target = target->next;
}
}
-
+
return ERROR_OK;
}
@@ -2377,7 +2377,7 @@
int gdb_register_commands(command_context_t *command_context)
{
register_command(command_context, NULL, "gdb_port", handle_gdb_port_command,
- COMMAND_CONFIG, "daemon configuration command gdb_port");
+ COMMAND_ANY, "daemon configuration command gdb_port");
register_command(command_context, NULL, "gdb_detach", handle_gdb_detach_command,
COMMAND_CONFIG, "");
register_command(command_context, NULL, "gdb_memory_map", handle_gdb_memory_map_command,
|
|
From: <oh...@ma...> - 2008-12-16 11:22:26
|
Author: oharboe
Date: 2008-12-16 11:22:24 +0100 (Tue, 16 Dec 2008)
New Revision: 1246
Modified:
trunk/src/helper/command.c
Log:
fix broken -c/f options where it would silently terminate for scripts that did not set the return value.
Modified: trunk/src/helper/command.c
===================================================================
--- trunk/src/helper/command.c 2008-12-15 16:10:18 UTC (rev 1245)
+++ trunk/src/helper/command.c 2008-12-16 10:22:24 UTC (rev 1246)
@@ -290,9 +290,9 @@
/* find command */
c = context->commands;
-
+
while(NULL != c)
- {
+ {
if (strcmp(name, c->name) == 0)
{
/* unlink command */
@@ -305,7 +305,7 @@
/* first element in command list */
context->commands = c->next;
}
-
+
/* unregister children */
while(NULL != c->children)
{
@@ -316,7 +316,7 @@
free(c2);
c2 = NULL;
}
-
+
/* delete command */
free(c->name);
c->name = NULL;
@@ -324,7 +324,7 @@
c = NULL;
return ERROR_OK;
}
-
+
/* remember the last command for unlinking */
p = c;
c = c->next;
@@ -479,21 +479,20 @@
int reslen;
result = Jim_GetString(Jim_GetResult(interp), &reslen);
- if (reslen) {
- int i;
- char buff[256+1];
- for (i = 0; i < reslen; i += 256)
- {
- int chunk;
- chunk = reslen - i;
- if (chunk > 256)
- chunk = 256;
- strncpy(buff, result+i, chunk);
- buff[chunk] = 0;
- LOG_USER_N("%s", buff);
- }
- LOG_USER_N("%s", "\n");
+ int i;
+ char buff[256+1];
+ for (i = 0; i < reslen; i += 256)
+ {
+ int chunk;
+ chunk = reslen - i;
+ if (chunk > 256)
+ chunk = 256;
+ strncpy(buff, result+i, chunk);
+ buff[chunk] = 0;
+ LOG_USER_N("%s", buff);
}
+ LOG_USER_N("%s", "\n");
+ retval=ERROR_OK;
}
return retval;
}
|
|
From: ntfreak at B. <nt...@ma...> - 2008-12-15 17:10:19
|
Author: ntfreak
Date: 2008-12-15 17:10:18 +0100 (Mon, 15 Dec 2008)
New Revision: 1245
Modified:
trunk/src/helper/ioutil.c
Log:
- add missing svn props from r1243 commit
Modified: trunk/src/helper/ioutil.c
===================================================================
--- trunk/src/helper/ioutil.c 2008-12-15 12:57:29 UTC (rev 1244)
+++ trunk/src/helper/ioutil.c 2008-12-15 16:10:18 UTC (rev 1245)
@@ -1,590 +1,590 @@
-/***************************************************************************
- * Copyright (C) 2007-2008 by vind Harboe *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
-
-/* this file contains various functionality useful to standalone systems */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "log.h"
-#include "types.h"
-#include "configuration.h"
-#include "target.h"
-
-#include "command.h"
-
-#include <time_support.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <strings.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#if !BUILD_ECOSBOARD
-#include <malloc.h>
-#endif
-#include <errno.h>
-
-
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <netinet/tcp.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <net/if.h>
-#include <arpa/inet.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <unistd.h>
-#include <arpa/inet.h>
-#include <stdio.h>
-#include <string.h>
-
-
-#include <unistd.h>
-#include <stdio.h>
-
-int handle_rm_command(struct command_context_s *cmd_ctx, char *cmd,
- char **args, int argc)
-{
- if (argc != 1)
- {
- command_print(cmd_ctx, "rm <filename>");
- return ERROR_INVALID_ARGUMENTS;
- }
-
- if (unlink(args[0]) != 0)
- {
- command_print(cmd_ctx, "failed: %d", errno);
- }
-
- return ERROR_OK;
-}
-
-
-/* loads a file and returns a pointer to it in memory. The file contains
- * a 0 byte(sentinel) after len bytes - the length of the file. */
-int loadFile(const char *fileName, void **data, int *len)
-{
- FILE * pFile;
- pFile = fopen(fileName,"rb");
- if (pFile==NULL)
- {
- LOG_ERROR("Can't open %s\n", fileName);
- return ERROR_FAIL;
- }
- if (fseek(pFile, 0, SEEK_END)!=0)
- {
- LOG_ERROR("Can't open %s\n", fileName);
- fclose(pFile);
- return ERROR_FAIL;
- }
- *len=ftell(pFile);
- if (*len==-1)
- {
- LOG_ERROR("Can't open %s\n", fileName);
- fclose(pFile);
- return ERROR_FAIL;
- }
-
- if (fseek(pFile, 0, SEEK_SET)!=0)
- {
- LOG_ERROR("Can't open %s\n", fileName);
- fclose(pFile);
- return ERROR_FAIL;
- }
- *data=malloc(*len+1);
- if (*data==NULL)
- {
- LOG_ERROR("Can't open %s\n", fileName);
- fclose(pFile);
- return ERROR_FAIL;
- }
-
- if (fread(*data, 1, *len, pFile)!=*len)
- {
- fclose(pFile);
- free(*data);
- LOG_ERROR("Can't open %s\n", fileName);
- return ERROR_FAIL;
- }
- fclose(pFile);
- *(((char *)(*data))+*len)=0; /* sentinel */
-
- return ERROR_OK;
-
-
-
-}
-
-
-
-int handle_cat_command(struct command_context_s *cmd_ctx, char *cmd,
- char **args, int argc)
-{
- if (argc != 1)
- {
- command_print(cmd_ctx, "cat <filename>");
- return ERROR_INVALID_ARGUMENTS;
- }
-
- // NOTE!!! we only have line printing capability so we print the entire file as a single line.
- void *data;
- int len;
-
- int retval = loadFile(args[0], &data, &len);
- if (retval == ERROR_OK)
- {
- command_print(cmd_ctx, "%s", data);
- free(data);
- }
- else
- {
- command_print(cmd_ctx, "%s not found %d", args[0], retval);
- }
-
- return ERROR_OK;
-}
-int handle_trunc_command(struct command_context_s *cmd_ctx, char *cmd,
- char **args, int argc)
-{
- if (argc != 1)
- {
- command_print(cmd_ctx, "trunc <filename>");
- return ERROR_INVALID_ARGUMENTS;
- }
-
- FILE *config_file = NULL;
- config_file = fopen(args[0], "w");
- if (config_file != NULL)
- fclose(config_file);
-
- return ERROR_OK;
-}
-
-
-int handle_meminfo_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
-{
- static int prev = 0;
- struct mallinfo info;
-
- if (argc != 0)
- {
- command_print(cmd_ctx, "meminfo");
- return ERROR_INVALID_ARGUMENTS;
- }
-
- info = mallinfo();
-
- if (prev > 0)
- {
- command_print(cmd_ctx, "Diff: %d", prev - info.fordblks);
- }
- prev = info.fordblks;
-
- command_print(cmd_ctx, "Available ram: %d", info.fordblks );
-
- return ERROR_OK;
-}
-
-
-int handle_append_command(struct command_context_s *cmd_ctx, char *cmd,
- char **args, int argc)
-{
- if (argc < 1)
- {
- command_print(cmd_ctx,
- "append <filename> [<string1>, [<string2>, ...]]");
- return ERROR_INVALID_ARGUMENTS;
- }
-
- FILE *config_file = NULL;
- config_file = fopen(args[0], "a");
- if (config_file != NULL)
- {
- int i;
- fseek(config_file, 0, SEEK_END);
-
- for (i = 1; i < argc; i++)
- {
- fwrite(args[i], strlen(args[i]), 1, config_file);
- if (i != argc - 1)
- {
- fwrite(" ", 1, 1, config_file);
- }
- }
- fwrite("\n", 1, 1, config_file);
- fclose(config_file);
- }
-
- return ERROR_OK;
-}
-
-
-
-int handle_cp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
-{
- if (argc != 2)
- {
- return ERROR_INVALID_ARGUMENTS;
- }
-
- // NOTE!!! we only have line printing capability so we print the entire file as a single line.
- void *data;
- int len;
-
- int retval = loadFile(args[0], &data, &len);
- if (retval != ERROR_OK)
- return retval;
-
- FILE *f = fopen(args[1], "wb");
- if (f == NULL)
- retval = ERROR_INVALID_ARGUMENTS;
-
- int pos = 0;
- for (;;)
- {
- int chunk = len - pos;
- static const int maxChunk = 512 * 1024; // ~1/sec
- if (chunk > maxChunk)
- {
- chunk = maxChunk;
- }
-
- if ((retval==ERROR_OK)&&(fwrite(((char *)data)+pos, 1, chunk, f)!=chunk))
- retval = ERROR_INVALID_ARGUMENTS;
-
- if (retval != ERROR_OK)
- {
- break;
- }
-
- command_print(cmd_ctx, "%d", len - pos);
-
- pos += chunk;
-
- if (pos == len)
- break;
- }
-
- if (retval == ERROR_OK)
- {
- command_print(cmd_ctx, "Copied %s to %s", args[0], args[1]);
- } else
- {
- command_print(cmd_ctx, "Failed: %d", retval);
- }
-
- if (data != NULL)
- free(data);
- if (f != NULL)
- fclose(f);
-
- if (retval != ERROR_OK)
- unlink(args[1]);
-
- return retval;
-}
-
-
-
-
-#define SHOW_RESULT(a, b) LOG_ERROR(#a " failed %d\n", (int)b)
-
-#define IOSIZE 512
-void copyfile(char *name2, char *name1)
-{
-
- int err;
- char buf[IOSIZE];
- int fd1, fd2;
- ssize_t done, wrote;
-
- fd1 = open(name1, O_WRONLY | O_CREAT);
- if (fd1 < 0)
- SHOW_RESULT( open, fd1 );
-
- fd2 = open(name2, O_RDONLY);
- if (fd2 < 0)
- SHOW_RESULT( open, fd2 );
-
- for (;;)
- {
- done = read(fd2, buf, IOSIZE );
- if (done < 0)
- {
- SHOW_RESULT( read, done );
- break;
- }
-
- if( done == 0 ) break;
-
- wrote = write(fd1, buf, done);
- if( wrote != done ) SHOW_RESULT( write, wrote );
-
- if( wrote != done ) break;
- }
-
- err = close(fd1);
- if( err < 0 ) SHOW_RESULT( close, err );
-
- err = close(fd2);
- if( err < 0 ) SHOW_RESULT( close, err );
-
-}
-
-/* utility fn to copy a directory */
-void copydir(char *name, char *destdir)
-{
- int err;
- DIR *dirp;
-
- dirp = opendir(destdir);
- if (dirp==NULL)
- {
- mkdir(destdir, 0777);
- } else
- {
- err = closedir(dirp);
- }
-
- dirp = opendir(name);
- if( dirp == NULL ) SHOW_RESULT( opendir, -1 );
-
- for (;;)
- {
- struct dirent *entry = readdir(dirp);
-
- if (entry == NULL)
- break;
-
- if (strcmp(entry->d_name, ".") == 0)
- continue;
- if (strcmp(entry->d_name, "..") == 0)
- continue;
-
- int isDir = 0;
- struct stat buf;
- char fullPath[PATH_MAX];
- strncpy(fullPath, name, PATH_MAX);
- strcat(fullPath, "/");
- strncat(fullPath, entry->d_name, PATH_MAX - strlen(fullPath));
-
- if (stat(fullPath, &buf) == -1)
- {
- LOG_ERROR("unable to read status from %s", fullPath);
- break;
- }
- isDir = S_ISDIR(buf.st_mode) != 0;
-
- if (isDir)
- continue;
-
- // diag_printf("<INFO>: entry %14s",entry->d_name);
- char fullname[PATH_MAX];
- char fullname2[PATH_MAX];
-
- strcpy(fullname, name);
- strcat(fullname, "/");
- strcat(fullname, entry->d_name);
-
- strcpy(fullname2, destdir);
- strcat(fullname2, "/");
- strcat(fullname2, entry->d_name);
- // diag_printf("from %s to %s\n", fullname, fullname2);
- copyfile(fullname, fullname2);
-
- // diag_printf("\n");
- }
-
- err = closedir(dirp);
- if( err < 0 ) SHOW_RESULT( stat, err );
-}
-
-
-
-
-static int
-zylinjtag_Jim_Command_rm(Jim_Interp *interp,
- int argc,
- Jim_Obj * const *argv)
-{
- int del;
- if (argc != 2)
- {
- Jim_WrongNumArgs(interp, 1, argv, "rm ?dirorfile?");
- return JIM_ERR;
- }
-
- del = 0;
- if (unlink(Jim_GetString(argv[1], NULL)) == 0)
- del = 1;
- if (rmdir(Jim_GetString(argv[1], NULL)) == 0)
- del = 1;
-
- return del ? JIM_OK : JIM_ERR;
-}
-
-
-static int
-zylinjtag_Jim_Command_ls(Jim_Interp *interp,
- int argc,
- Jim_Obj * const *argv)
-{
- if (argc != 2)
- {
- Jim_WrongNumArgs(interp, 1, argv, "ls ?dir?");
- return JIM_ERR;
- }
-
- char *name = (char*) Jim_GetString(argv[1], NULL);
-
- DIR *dirp = NULL;
- dirp = opendir(name);
- if (dirp == NULL)
- {
- return JIM_ERR;
- }
- Jim_Obj *objPtr = Jim_NewListObj(interp, NULL, 0);
-
- for (;;)
- {
- struct dirent *entry = NULL;
- entry = readdir(dirp);
- if (entry == NULL)
- break;
-
- if ((strcmp(".", entry->d_name)==0)||(strcmp("..", entry->d_name)==0))
- continue;
-
- Jim_ListAppendElement(interp, objPtr, Jim_NewStringObj(interp, entry->d_name, strlen(entry->d_name)));
- }
- closedir(dirp);
-
- Jim_SetResult(interp, objPtr);
-
- return JIM_OK;
-}
-
-int handle_peek_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
-{
- if (argc != 1)
- {
- return ERROR_COMMAND_SYNTAX_ERROR;
- }
- volatile int *address=(volatile int *)strtoul(args[0], NULL, 0);
- int value=*address;
- command_print(cmd_ctx, "0x%x : 0x%x", address, value);
- return ERROR_OK;
-}
-
-int handle_poke_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
-{
- if (argc != 2)
- {
- return ERROR_INVALID_ARGUMENTS;
- }
- volatile int *address=(volatile int *)strtoul(args[0], NULL, 0);
- int value=strtoul(args[1], NULL, 0);
- *address=value;
- return ERROR_OK;
-}
-
-static int
-zylinjtag_Jim_Command_peek(Jim_Interp *interp,
- int argc,
- Jim_Obj * const *argv)
-{
- if (argc != 2)
- {
- Jim_WrongNumArgs(interp, 1, argv, "peek ?address?");
- return JIM_ERR;
- }
-
- long address;
- if (Jim_GetLong(interp, argv[1], &address) != JIM_OK)
- return JIM_ERR;
-
- int value = *((volatile int *) address);
-
- Jim_SetResult(interp, Jim_NewIntObj(interp, value));
-
- return JIM_OK;
-}
-
-static int
-zylinjtag_Jim_Command_poke(Jim_Interp *interp,
- int argc,
- Jim_Obj * const *argv)
-{
- if (argc != 3)
- {
- Jim_WrongNumArgs(interp, 1, argv, "poke ?address? ?value?");
- return JIM_ERR;
- }
-
- long address;
- if (Jim_GetLong(interp, argv[1], &address) != JIM_OK)
- return JIM_ERR;
- long value;
- if (Jim_GetLong(interp, argv[2], &value) != JIM_OK)
- return JIM_ERR;
-
- *((volatile int *) address) = value;
-
- return JIM_OK;
-}
-
-int ioutil_init(struct command_context_s *cmd_ctx)
-{
- register_command(cmd_ctx, NULL, "rm", handle_rm_command, COMMAND_ANY,
- "remove file");
-
- register_command(cmd_ctx, NULL, "cat", handle_cat_command, COMMAND_ANY,
- "display file content");
-
- register_command(cmd_ctx, NULL, "trunc", handle_trunc_command, COMMAND_ANY,
- "truncate a file to 0 size");
-
- register_command(cmd_ctx, NULL, "cp", handle_cp_command,
- COMMAND_ANY, "copy a file <from> <to>");
-
- register_command(cmd_ctx, NULL, "append_file", handle_append_command,
- COMMAND_ANY, "append a variable number of strings to a file");
-
- register_command(cmd_ctx, NULL, "meminfo", handle_meminfo_command,
- COMMAND_ANY, "display available ram memory");
-
- Jim_CreateCommand(interp, "rm", zylinjtag_Jim_Command_rm, NULL, NULL);
-
- Jim_CreateCommand(interp, "peek", zylinjtag_Jim_Command_peek, NULL, NULL);
- Jim_CreateCommand(interp, "poke", zylinjtag_Jim_Command_poke, NULL, NULL);
- Jim_CreateCommand(interp, "ls", zylinjtag_Jim_Command_ls, NULL, NULL);
-
-
- return ERROR_OK;
-}
-
-
+/***************************************************************************
+ * Copyright (C) 2007-2008 by vind Harboe *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+/* this file contains various functionality useful to standalone systems */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "log.h"
+#include "types.h"
+#include "configuration.h"
+#include "target.h"
+
+#include "command.h"
+
+#include <time_support.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <strings.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#if !BUILD_ECOSBOARD
+#include <malloc.h>
+#endif
+#include <errno.h>
+
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <netinet/tcp.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <net/if.h>
+#include <arpa/inet.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <unistd.h>
+#include <arpa/inet.h>
+#include <stdio.h>
+#include <string.h>
+
+
+#include <unistd.h>
+#include <stdio.h>
+
+int handle_rm_command(struct command_context_s *cmd_ctx, char *cmd,
+ char **args, int argc)
+{
+ if (argc != 1)
+ {
+ command_print(cmd_ctx, "rm <filename>");
+ return ERROR_INVALID_ARGUMENTS;
+ }
+
+ if (unlink(args[0]) != 0)
+ {
+ command_print(cmd_ctx, "failed: %d", errno);
+ }
+
+ return ERROR_OK;
+}
+
+
+/* loads a file and returns a pointer to it in memory. The file contains
+ * a 0 byte(sentinel) after len bytes - the length of the file. */
+int loadFile(const char *fileName, void **data, int *len)
+{
+ FILE * pFile;
+ pFile = fopen(fileName,"rb");
+ if (pFile==NULL)
+ {
+ LOG_ERROR("Can't open %s\n", fileName);
+ return ERROR_FAIL;
+ }
+ if (fseek(pFile, 0, SEEK_END)!=0)
+ {
+ LOG_ERROR("Can't open %s\n", fileName);
+ fclose(pFile);
+ return ERROR_FAIL;
+ }
+ *len=ftell(pFile);
+ if (*len==-1)
+ {
+ LOG_ERROR("Can't open %s\n", fileName);
+ fclose(pFile);
+ return ERROR_FAIL;
+ }
+
+ if (fseek(pFile, 0, SEEK_SET)!=0)
+ {
+ LOG_ERROR("Can't open %s\n", fileName);
+ fclose(pFile);
+ return ERROR_FAIL;
+ }
+ *data=malloc(*len+1);
+ if (*data==NULL)
+ {
+ LOG_ERROR("Can't open %s\n", fileName);
+ fclose(pFile);
+ return ERROR_FAIL;
+ }
+
+ if (fread(*data, 1, *len, pFile)!=*len)
+ {
+ fclose(pFile);
+ free(*data);
+ LOG_ERROR("Can't open %s\n", fileName);
+ return ERROR_FAIL;
+ }
+ fclose(pFile);
+ *(((char *)(*data))+*len)=0; /* sentinel */
+
+ return ERROR_OK;
+
+
+
+}
+
+
+
+int handle_cat_command(struct command_context_s *cmd_ctx, char *cmd,
+ char **args, int argc)
+{
+ if (argc != 1)
+ {
+ command_print(cmd_ctx, "cat <filename>");
+ return ERROR_INVALID_ARGUMENTS;
+ }
+
+ // NOTE!!! we only have line printing capability so we print the entire file as a single line.
+ void *data;
+ int len;
+
+ int retval = loadFile(args[0], &data, &len);
+ if (retval == ERROR_OK)
+ {
+ command_print(cmd_ctx, "%s", data);
+ free(data);
+ }
+ else
+ {
+ command_print(cmd_ctx, "%s not found %d", args[0], retval);
+ }
+
+ return ERROR_OK;
+}
+int handle_trunc_command(struct command_context_s *cmd_ctx, char *cmd,
+ char **args, int argc)
+{
+ if (argc != 1)
+ {
+ command_print(cmd_ctx, "trunc <filename>");
+ return ERROR_INVALID_ARGUMENTS;
+ }
+
+ FILE *config_file = NULL;
+ config_file = fopen(args[0], "w");
+ if (config_file != NULL)
+ fclose(config_file);
+
+ return ERROR_OK;
+}
+
+
+int handle_meminfo_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+{
+ static int prev = 0;
+ struct mallinfo info;
+
+ if (argc != 0)
+ {
+ command_print(cmd_ctx, "meminfo");
+ return ERROR_INVALID_ARGUMENTS;
+ }
+
+ info = mallinfo();
+
+ if (prev > 0)
+ {
+ command_print(cmd_ctx, "Diff: %d", prev - info.fordblks);
+ }
+ prev = info.fordblks;
+
+ command_print(cmd_ctx, "Available ram: %d", info.fordblks );
+
+ return ERROR_OK;
+}
+
+
+int handle_append_command(struct command_context_s *cmd_ctx, char *cmd,
+ char **args, int argc)
+{
+ if (argc < 1)
+ {
+ command_print(cmd_ctx,
+ "append <filename> [<string1>, [<string2>, ...]]");
+ return ERROR_INVALID_ARGUMENTS;
+ }
+
+ FILE *config_file = NULL;
+ config_file = fopen(args[0], "a");
+ if (config_file != NULL)
+ {
+ int i;
+ fseek(config_file, 0, SEEK_END);
+
+ for (i = 1; i < argc; i++)
+ {
+ fwrite(args[i], strlen(args[i]), 1, config_file);
+ if (i != argc - 1)
+ {
+ fwrite(" ", 1, 1, config_file);
+ }
+ }
+ fwrite("\n", 1, 1, config_file);
+ fclose(config_file);
+ }
+
+ return ERROR_OK;
+}
+
+
+
+int handle_cp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+{
+ if (argc != 2)
+ {
+ return ERROR_INVALID_ARGUMENTS;
+ }
+
+ // NOTE!!! we only have line printing capability so we print the entire file as a single line.
+ void *data;
+ int len;
+
+ int retval = loadFile(args[0], &data, &len);
+ if (retval != ERROR_OK)
+ return retval;
+
+ FILE *f = fopen(args[1], "wb");
+ if (f == NULL)
+ retval = ERROR_INVALID_ARGUMENTS;
+
+ int pos = 0;
+ for (;;)
+ {
+ int chunk = len - pos;
+ static const int maxChunk = 512 * 1024; // ~1/sec
+ if (chunk > maxChunk)
+ {
+ chunk = maxChunk;
+ }
+
+ if ((retval==ERROR_OK)&&(fwrite(((char *)data)+pos, 1, chunk, f)!=chunk))
+ retval = ERROR_INVALID_ARGUMENTS;
+
+ if (retval != ERROR_OK)
+ {
+ break;
+ }
+
+ command_print(cmd_ctx, "%d", len - pos);
+
+ pos += chunk;
+
+ if (pos == len)
+ break;
+ }
+
+ if (retval == ERROR_OK)
+ {
+ command_print(cmd_ctx, "Copied %s to %s", args[0], args[1]);
+ } else
+ {
+ command_print(cmd_ctx, "Failed: %d", retval);
+ }
+
+ if (data != NULL)
+ free(data);
+ if (f != NULL)
+ fclose(f);
+
+ if (retval != ERROR_OK)
+ unlink(args[1]);
+
+ return retval;
+}
+
+
+
+
+#define SHOW_RESULT(a, b) LOG_ERROR(#a " failed %d\n", (int)b)
+
+#define IOSIZE 512
+void copyfile(char *name2, char *name1)
+{
+
+ int err;
+ char buf[IOSIZE];
+ int fd1, fd2;
+ ssize_t done, wrote;
+
+ fd1 = open(name1, O_WRONLY | O_CREAT);
+ if (fd1 < 0)
+ SHOW_RESULT( open, fd1 );
+
+ fd2 = open(name2, O_RDONLY);
+ if (fd2 < 0)
+ SHOW_RESULT( open, fd2 );
+
+ for (;;)
+ {
+ done = read(fd2, buf, IOSIZE );
+ if (done < 0)
+ {
+ SHOW_RESULT( read, done );
+ break;
+ }
+
+ if( done == 0 ) break;
+
+ wrote = write(fd1, buf, done);
+ if( wrote != done ) SHOW_RESULT( write, wrote );
+
+ if( wrote != done ) break;
+ }
+
+ err = close(fd1);
+ if( err < 0 ) SHOW_RESULT( close, err );
+
+ err = close(fd2);
+ if( err < 0 ) SHOW_RESULT( close, err );
+
+}
+
+/* utility fn to copy a directory */
+void copydir(char *name, char *destdir)
+{
+ int err;
+ DIR *dirp;
+
+ dirp = opendir(destdir);
+ if (dirp==NULL)
+ {
+ mkdir(destdir, 0777);
+ } else
+ {
+ err = closedir(dirp);
+ }
+
+ dirp = opendir(name);
+ if( dirp == NULL ) SHOW_RESULT( opendir, -1 );
+
+ for (;;)
+ {
+ struct dirent *entry = readdir(dirp);
+
+ if (entry == NULL)
+ break;
+
+ if (strcmp(entry->d_name, ".") == 0)
+ continue;
+ if (strcmp(entry->d_name, "..") == 0)
+ continue;
+
+ int isDir = 0;
+ struct stat buf;
+ char fullPath[PATH_MAX];
+ strncpy(fullPath, name, PATH_MAX);
+ strcat(fullPath, "/");
+ strncat(fullPath, entry->d_name, PATH_MAX - strlen(fullPath));
+
+ if (stat(fullPath, &buf) == -1)
+ {
+ LOG_ERROR("unable to read status from %s", fullPath);
+ break;
+ }
+ isDir = S_ISDIR(buf.st_mode) != 0;
+
+ if (isDir)
+ continue;
+
+ // diag_printf("<INFO>: entry %14s",entry->d_name);
+ char fullname[PATH_MAX];
+ char fullname2[PATH_MAX];
+
+ strcpy(fullname, name);
+ strcat(fullname, "/");
+ strcat(fullname, entry->d_name);
+
+ strcpy(fullname2, destdir);
+ strcat(fullname2, "/");
+ strcat(fullname2, entry->d_name);
+ // diag_printf("from %s to %s\n", fullname, fullname2);
+ copyfile(fullname, fullname2);
+
+ // diag_printf("\n");
+ }
+
+ err = closedir(dirp);
+ if( err < 0 ) SHOW_RESULT( stat, err );
+}
+
+
+
+
+static int
+zylinjtag_Jim_Command_rm(Jim_Interp *interp,
+ int argc,
+ Jim_Obj * const *argv)
+{
+ int del;
+ if (argc != 2)
+ {
+ Jim_WrongNumArgs(interp, 1, argv, "rm ?dirorfile?");
+ return JIM_ERR;
+ }
+
+ del = 0;
+ if (unlink(Jim_GetString(argv[1], NULL)) == 0)
+ del = 1;
+ if (rmdir(Jim_GetString(argv[1], NULL)) == 0)
+ del = 1;
+
+ return del ? JIM_OK : JIM_ERR;
+}
+
+
+static int
+zylinjtag_Jim_Command_ls(Jim_Interp *interp,
+ int argc,
+ Jim_Obj * const *argv)
+{
+ if (argc != 2)
+ {
+ Jim_WrongNumArgs(interp, 1, argv, "ls ?dir?");
+ return JIM_ERR;
+ }
+
+ char *name = (char*) Jim_GetString(argv[1], NULL);
+
+ DIR *dirp = NULL;
+ dirp = opendir(name);
+ if (dirp == NULL)
+ {
+ return JIM_ERR;
+ }
+ Jim_Obj *objPtr = Jim_NewListObj(interp, NULL, 0);
+
+ for (;;)
+ {
+ struct dirent *entry = NULL;
+ entry = readdir(dirp);
+ if (entry == NULL)
+ break;
+
+ if ((strcmp(".", entry->d_name)==0)||(strcmp("..", entry->d_name)==0))
+ continue;
+
+ Jim_ListAppendElement(interp, objPtr, Jim_NewStringObj(interp, entry->d_name, strlen(entry->d_name)));
+ }
+ closedir(dirp);
+
+ Jim_SetResult(interp, objPtr);
+
+ return JIM_OK;
+}
+
+int handle_peek_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+{
+ if (argc != 1)
+ {
+ return ERROR_COMMAND_SYNTAX_ERROR;
+ }
+ volatile int *address=(volatile int *)strtoul(args[0], NULL, 0);
+ int value=*address;
+ command_print(cmd_ctx, "0x%x : 0x%x", address, value);
+ return ERROR_OK;
+}
+
+int handle_poke_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+{
+ if (argc != 2)
+ {
+ return ERROR_INVALID_ARGUMENTS;
+ }
+ volatile int *address=(volatile int *)strtoul(args[0], NULL, 0);
+ int value=strtoul(args[1], NULL, 0);
+ *address=value;
+ return ERROR_OK;
+}
+
+static int
+zylinjtag_Jim_Command_peek(Jim_Interp *interp,
+ int argc,
+ Jim_Obj * const *argv)
+{
+ if (argc != 2)
+ {
+ Jim_WrongNumArgs(interp, 1, argv, "peek ?address?");
+ return JIM_ERR;
+ }
+
+ long address;
+ if (Jim_GetLong(interp, argv[1], &address) != JIM_OK)
+ return JIM_ERR;
+
+ int value = *((volatile int *) address);
+
+ Jim_SetResult(interp, Jim_NewIntObj(interp, value));
+
+ return JIM_OK;
+}
+
+static int
+zylinjtag_Jim_Command_poke(Jim_Interp *interp,
+ int argc,
+ Jim_Obj * const *argv)
+{
+ if (argc != 3)
+ {
+ Jim_WrongNumArgs(interp, 1, argv, "poke ?address? ?value?");
+ return JIM_ERR;
+ }
+
+ long address;
+ if (Jim_GetLong(interp, argv[1], &address) != JIM_OK)
+ return JIM_ERR;
+ long value;
+ if (Jim_GetLong(interp, argv[2], &value) != JIM_OK)
+ return JIM_ERR;
+
+ *((volatile int *) address) = value;
+
+ return JIM_OK;
+}
+
+int ioutil_init(struct command_context_s *cmd_ctx)
+{
+ register_command(cmd_ctx, NULL, "rm", handle_rm_command, COMMAND_ANY,
+ "remove file");
+
+ register_command(cmd_ctx, NULL, "cat", handle_cat_command, COMMAND_ANY,
+ "display file content");
+
+ register_command(cmd_ctx, NULL, "trunc", handle_trunc_command, COMMAND_ANY,
+ "truncate a file to 0 size");
+
+ register_command(cmd_ctx, NULL, "cp", handle_cp_command,
+ COMMAND_ANY, "copy a file <from> <to>");
+
+ register_command(cmd_ctx, NULL, "append_file", handle_append_command,
+ COMMAND_ANY, "append a variable number of strings to a file");
+
+ register_command(cmd_ctx, NULL, "meminfo", handle_meminfo_command,
+ COMMAND_ANY, "display available ram memory");
+
+ Jim_CreateCommand(interp, "rm", zylinjtag_Jim_Command_rm, NULL, NULL);
+
+ Jim_CreateCommand(interp, "peek", zylinjtag_Jim_Command_peek, NULL, NULL);
+ Jim_CreateCommand(interp, "poke", zylinjtag_Jim_Command_poke, NULL, NULL);
+ Jim_CreateCommand(interp, "ls", zylinjtag_Jim_Command_ls, NULL, NULL);
+
+
+ return ERROR_OK;
+}
+
+
Property changes on: trunk/src/helper/ioutil.c
___________________________________________________________________
Name: svn:eol-style
+ native
|
|
From: <oh...@ma...> - 2008-12-15 13:57:31
|
Author: oharboe
Date: 2008-12-15 13:57:29 +0100 (Mon, 15 Dec 2008)
New Revision: 1244
Modified:
trunk/doc/openocd.texi
Log:
fixed compilation problem
Modified: trunk/doc/openocd.texi
===================================================================
--- trunk/doc/openocd.texi 2008-12-15 11:32:22 UTC (rev 1243)
+++ trunk/doc/openocd.texi 2008-12-15 12:57:29 UTC (rev 1244)
@@ -96,8 +96,7 @@
@b{Dongles:} OpenOCD currently many types of hardware dongles: USB
Based, Parallel Port Based, and other standalone boxes that run
-OpenOCD internally. See the section titled: @xref{JTAG Hardware
-Dongles}.
+OpenOCD internally. See the section titled: @xref{JTAG Hardware Dongles}.
@b{GDB Debug:} It allows ARM7 (ARM7TDMI and ARM720t), ARM9 (ARM920t,
ARM922t, ARM926ej--s, ARM966e--s), XScale (PXA25x, IXP42x) and
|
|
From: <oh...@ma...> - 2008-12-15 12:32:41
|
Author: oharboe
Date: 2008-12-15 12:32:22 +0100 (Mon, 15 Dec 2008)
New Revision: 1243
Added:
trunk/src/helper/ioutil.c
Modified:
trunk/configure.in
trunk/src/Makefile.am
trunk/src/ecosboard.c
trunk/src/helper/Makefile.am
trunk/src/jtag/zy1000.c
trunk/src/openocd.c
zy1000/trunk/build/buildocd.sh
zy1000/trunk/build/include/jtag_minidriver.h
zy1000/trunk/build/include/rom.h
zy1000/trunk/build/tcl/openocd.cfg
Log:
sync up to tap_xxx rename + add with-ioutil for standalone openocd implemetnations
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2008-12-15 09:43:26 UTC (rev 1242)
+++ trunk/configure.in 2008-12-15 11:32:22 UTC (rev 1243)
@@ -67,6 +67,10 @@
AS_HELP_STRING([--enable-ecosboard], [Enable building support for eCosBoard based JTAG debugger]),
[build_ecosboard=$enableval], [build_ecosboard=no])
+AC_ARG_ENABLE(ioutil,
+ AS_HELP_STRING([--enable-ioutil], [Enable ioutil functions - useful for standalone OpenOCD implementations]),
+ [build_ioutil=$enableval], [build_ioutil=no])
+
case "${host_cpu}" in
arm*)
AC_ARG_ENABLE(ep93xx,
@@ -179,6 +183,12 @@
AC_DEFINE(BUILD_ECOSBOARD, 0, [0 if you don't want eCosBoard.])
fi
+if test $build_ioutil = yes; then
+ AC_DEFINE(BUILD_IOUTIL, 1, [1 if you want ioutils.])
+else
+ AC_DEFINE(BUILD_IOUTIL, 0, [0 if you don't want ioutils.])
+fi
+
if test $build_at91rm9200 = yes; then
build_bitbang=yes
AC_DEFINE(BUILD_AT91RM9200, 1, [1 if you want at91rm9200.])
@@ -274,6 +284,7 @@
AM_CONDITIONAL(GIVEIO, test $parport_use_giveio = yes)
AM_CONDITIONAL(EP93XX, test $build_ep93xx = yes)
AM_CONDITIONAL(ECOSBOARD, test $build_ecosboard = yes)
+AM_CONDITIONAL(IOUTIL, test $build_ioutil = yes)
AM_CONDITIONAL(AT91RM9200, test $build_at91rm9200 = yes)
AM_CONDITIONAL(BITBANG, test $build_bitbang = yes)
AM_CONDITIONAL(FT2232_LIBFTDI, test $build_ft2232_libftdi = yes)
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2008-12-15 09:43:26 UTC (rev 1242)
+++ trunk/src/Makefile.am 2008-12-15 11:32:22 UTC (rev 1243)
@@ -6,6 +6,7 @@
MAINFILE = main.c
endif
+
openocd_SOURCES = $(MAINFILE) openocd.c
# set the include path found by configure
Modified: trunk/src/ecosboard.c
===================================================================
--- trunk/src/ecosboard.c 2008-12-15 09:43:26 UTC (rev 1242)
+++ trunk/src/ecosboard.c 2008-12-15 11:32:22 UTC (rev 1243)
@@ -81,7 +81,6 @@
#include <ifaddrs.h>
#include <string.h>
-
#include <unistd.h>
#include <stdio.h>
#define MAX_IFS 64
@@ -98,14 +97,6 @@
#endif
-#define ZYLIN_VERSION "1.48"
-#define ZYLIN_DATE __DATE__
-#define ZYLIN_TIME __TIME__
-/* hmmm.... we can't pick up the right # during build if we've checked this out
- * in Eclipse... arrggghh...*/
-#define ZYLIN_OPENOCD "$Revision$"
-#define ZYLIN_OPENOCD_VERSION "Zylin JTAG ZY1000 " ZYLIN_VERSION " " ZYLIN_DATE " " ZYLIN_TIME
-#define ZYLIN_CONFIG_DIR "/config/settings"
void diag_write(char *buf, int len)
{
@@ -122,39 +113,6 @@
char hwaddr[512];
-/* Give TELNET a way to find out what version this is */
-int handle_zy1000_version_command(struct command_context_s *cmd_ctx, char *cmd,
- char **args, int argc)
-{
- if (argc > 1)
- {
- return ERROR_COMMAND_SYNTAX_ERROR;
- }
- if (argc == 0)
- {
- command_print(cmd_ctx, ZYLIN_OPENOCD_VERSION);
- } else if (strcmp("openocd", args[0])==0)
- {
- int revision;
- revision=atol(ZYLIN_OPENOCD+strlen("XRevision: "));
- command_print(cmd_ctx, "%d", revision);
- } else if (strcmp("zy1000", args[0])==0)
- {
- command_print(cmd_ctx, "%s", ZYLIN_VERSION);
- } else if (strcmp("date", args[0])==0)
- {
- command_print(cmd_ctx, "%s", ZYLIN_DATE);
- } else
- {
- return ERROR_COMMAND_SYNTAX_ERROR;
- }
-
- return ERROR_OK;
-}
-
-
-
-
extern flash_driver_t *flash_drivers[];
extern target_type_t *target_types[];
@@ -184,48 +142,17 @@
// no more interrupts than 1/10ms.
//profile_on((void *)0, (void *)0x40000, 16, 10000); // SRAM
-// profile_on(0, &_etext, 16, 10000); // SRAM & DRAM
+ // profile_on(0, &_etext, 16, 10000); // SRAM & DRAM
profile_on(start_of_code, end_of_code, 16, 10000); // Nios DRAM
}
#endif
-// launch GDB server if a config file exists
-bool zylinjtag_parse_config_file(struct command_context_s *cmd_ctx, const char *config_file_name)
-{
- bool foundFile = false;
- FILE *config_file = NULL;
- command_print(cmd_ctx, "executing config file %s", config_file_name);
- config_file = fopen(config_file_name, "r");
- if (config_file)
- {
- fclose(config_file);
- int retval;
- retval = command_run_linef(cmd_ctx, "script %s", config_file_name);
- if (retval == ERROR_OK)
- {
- foundFile = true;
- }
- else
- {
- command_print(cmd_ctx, "Failed executing %s %d", config_file_name, retval);
- }
- }
- else
- {
- command_print(cmd_ctx, "No %s found", config_file_name);
- }
-
- return foundFile;
-}
-
extern int eth0_up;
static FILE *log;
static char reboot_stack[2048];
-
-static void
-zylinjtag_reboot(cyg_addrword_t data)
+static void zylinjtag_reboot(cyg_addrword_t data)
{
serialLog = true;
diag_printf("Rebooting in 100 ticks..\n");
@@ -240,324 +167,28 @@
void reboot(void)
{
- cyg_thread_create(1,
- zylinjtag_reboot,
- (cyg_addrword_t)0,
- "reboot Thread",
- (void *)reboot_stack,
- sizeof(reboot_stack),
- &zylinjtag_thread_handle,
- &zylinjtag_thread_object);
+ cyg_thread_create(1, zylinjtag_reboot, (cyg_addrword_t) 0, "reboot Thread",
+ (void *) reboot_stack, sizeof(reboot_stack),
+ &zylinjtag_thread_handle, &zylinjtag_thread_object);
cyg_thread_resume(zylinjtag_thread_handle);
}
-int configuration_output_handler(struct command_context_s *context, const char* line)
+int configuration_output_handler(struct command_context_s *context,
+ const char* line)
{
diag_printf("%s", line);
return ERROR_OK;
}
-int zy1000_configuration_output_handler_log(struct command_context_s *context, const char* line)
+int zy1000_configuration_output_handler_log(struct command_context_s *context,
+ const char* line)
{
LOG_USER_N("%s", line);
return ERROR_OK;
}
-int handle_rm_command(struct command_context_s *cmd_ctx, char *cmd,
- char **args, int argc)
-{
- if (argc != 1)
- {
- command_print(cmd_ctx, "rm <filename>");
- return ERROR_INVALID_ARGUMENTS;
- }
-
- if (unlink(args[0]) != 0)
- {
- command_print(cmd_ctx, "failed: %d", errno);
- }
-
- return ERROR_OK;
-}
-
-int loadFile(const char *fileName, void **data, int *len);
-
-int handle_cat_command(struct command_context_s *cmd_ctx, char *cmd,
- char **args, int argc)
-{
- if (argc != 1)
- {
- command_print(cmd_ctx, "cat <filename>");
- return ERROR_INVALID_ARGUMENTS;
- }
-
- // NOTE!!! we only have line printing capability so we print the entire file as a single line.
- void *data;
- int len;
-
- int retval = loadFile(args[0], &data, &len);
- if (retval == ERROR_OK)
- {
- command_print(cmd_ctx, "%s", data);
- free(data);
- }
- else
- {
- command_print(cmd_ctx, "%s not found %d", args[0], retval);
- }
-
- return ERROR_OK;
-}
-int handle_trunc_command(struct command_context_s *cmd_ctx, char *cmd,
- char **args, int argc)
-{
- if (argc != 1)
- {
- command_print(cmd_ctx, "trunc <filename>");
- return ERROR_INVALID_ARGUMENTS;
- }
-
- FILE *config_file = NULL;
- config_file = fopen(args[0], "w");
- if (config_file != NULL)
- fclose(config_file);
-
- return ERROR_OK;
-}
-
-
-int handle_meminfo_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
-{
- static int prev = 0;
- struct mallinfo info;
-
- if (argc != 0)
- {
- command_print(cmd_ctx, "meminfo");
- return ERROR_INVALID_ARGUMENTS;
- }
-
- info = mallinfo();
-
- if (prev > 0)
- {
- command_print(cmd_ctx, "Diff: %d", prev - info.fordblks);
- }
- prev = info.fordblks;
-
- command_print(cmd_ctx, "Available ram: %d", info.fordblks );
-
- return ERROR_OK;
-}
-
-static bool savePower;
-
-static void setPower(bool power)
-{
- savePower = power;
- if (power)
- {
- HAL_WRITE_UINT32(ZY1000_JTAG_BASE+0x14, 0x8);
- } else
- {
- HAL_WRITE_UINT32(ZY1000_JTAG_BASE+0x10, 0x8);
- }
-}
-
-int handle_power_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
-{
- if (argc > 1)
- {
- return ERROR_INVALID_ARGUMENTS;
- }
-
- if (argc == 1)
- {
- if (strcmp(args[0], "on") == 0)
- {
- setPower(1);
- }
- else if (strcmp(args[0], "off") == 0)
- {
- setPower(0);
- } else
- {
- command_print(cmd_ctx, "arg is \"on\" or \"off\"");
- return ERROR_INVALID_ARGUMENTS;
- }
- }
-
- command_print(cmd_ctx, "Target power %s", savePower ? "on" : "off");
-
- return ERROR_OK;
-}
-
-int handle_append_command(struct command_context_s *cmd_ctx, char *cmd,
- char **args, int argc)
-{
- if (argc < 1)
- {
- command_print(cmd_ctx,
- "append <filename> [<string1>, [<string2>, ...]]");
- return ERROR_INVALID_ARGUMENTS;
- }
-
- FILE *config_file = NULL;
- config_file = fopen(args[0], "a");
- if (config_file != NULL)
- {
- int i;
- fseek(config_file, 0, SEEK_END);
-
- for (i = 1; i < argc; i++)
- {
- fwrite(args[i], strlen(args[i]), 1, config_file);
- if (i != argc - 1)
- {
- fwrite(" ", 1, 1, config_file);
- }
- }
- fwrite("\n", 1, 1, config_file);
- fclose(config_file);
- }
-
- return ERROR_OK;
-}
-
-extern int telnet_socket;
-
-int readMore(int fd, void *data, int length)
-{
- /* used in select() */
- fd_set read_fds;
-
- /* monitor sockets for acitvity */
- int fd_max = 1;
- FD_ZERO(&read_fds);
- /* listen for new connections */
- FD_SET(fd, &read_fds);
-
- // Maximum 5 seconds.
- struct timeval tv;
- tv.tv_sec = 5;
- tv.tv_usec = 0;
-
- int retval = select(fd_max + 1, &read_fds, NULL, NULL, &tv);
- if (retval == 0)
- {
- diag_printf("Timed out waiting for binary payload\n");
- return -1;
- }
- if (retval != 1)
- return -1;
-
- return read_socket(fd, data, length);
-}
-
-int readAll(int fd, void *data, int length)
-{
- int pos = 0;
- for (;;)
- {
- int actual = readMore(fd, ((char *) data) + pos, length - pos);
- // diag_printf("Read %d bytes(pos=%d, length=%d)\n", actual, pos, length);
- if (actual <= 0)
- return -1;
- pos += actual;
- if (pos == length)
- break;
- }
- return length;
-}
-
-int handle_peek_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
-{
- cyg_uint32 value;
- if (argc != 1)
- {
- return ERROR_INVALID_ARGUMENTS;
- }
- HAL_READ_UINT32(strtoul(args[0], NULL, 0), value);
- command_print(cmd_ctx, "0x%x : 0x%x", strtoul(args[0], NULL, 0), value);
- return ERROR_OK;
-}
-
-int handle_poke_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
-{
- if (argc != 2)
- {
- return ERROR_INVALID_ARGUMENTS;
- }
- HAL_WRITE_UINT32(strtoul(args[0], NULL, 0), strtoul(args[1], NULL, 0));
- return ERROR_OK;
-}
-
-int handle_cp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
-{
- if (argc != 2)
- {
- return ERROR_INVALID_ARGUMENTS;
- }
-
- // NOTE!!! we only have line printing capability so we print the entire file as a single line.
- void *data;
- int len;
-
- int retval = loadFile(args[0], &data, &len);
- if (retval != ERROR_OK)
- return retval;
-
- FILE *f = fopen(args[1], "wb");
- if (f == NULL)
- retval = ERROR_INVALID_ARGUMENTS;
-
- int pos = 0;
- for (;;)
- {
- int chunk = len - pos;
- static const int maxChunk = 512 * 1024; // ~1/sec
- if (chunk > maxChunk)
- {
- chunk = maxChunk;
- }
-
- if ((retval==ERROR_OK)&&(fwrite(((char *)data)+pos, 1, chunk, f)!=chunk))
- retval = ERROR_INVALID_ARGUMENTS;
-
- if (retval != ERROR_OK)
- {
- break;
- }
-
- command_print(cmd_ctx, "%d", len - pos);
-
- pos += chunk;
-
- if (pos == len)
- break;
- }
-
- if (retval == ERROR_OK)
- {
- command_print(cmd_ctx, "Copied %s to %s", args[0], args[1]);
- } else
- {
- command_print(cmd_ctx, "Failed: %d", retval);
- }
-
- if (data != NULL)
- free(data);
- if (f != NULL)
- fclose(f);
-
- if (retval != ERROR_OK)
- unlink(args[1]);
-
- return retval;
-}
-
#ifdef CYGPKG_PROFILE_GPROF
extern void start_profile();
@@ -618,116 +249,10 @@
#endif
}
-#define SHOW_RESULT(a, b) diag_printf(#a " failed %d\n", (int)b)
+void copyfile(char *name2, char *name1);
-#define IOSIZE 512
-static void copyfile(char *name2, char *name1)
-{
+void copydir(char *name, char *destdir);
- int err;
- char buf[IOSIZE];
- int fd1, fd2;
- ssize_t done, wrote;
-
- fd1 = open(name1, O_WRONLY | O_CREAT);
- if (fd1 < 0)
- SHOW_RESULT( open, fd1 );
-
- fd2 = open(name2, O_RDONLY);
- if (fd2 < 0)
- SHOW_RESULT( open, fd2 );
-
- for (;;)
- {
- done = read(fd2, buf, IOSIZE );
- if (done < 0)
- {
- SHOW_RESULT( read, done );
- break;
- }
-
- if( done == 0 ) break;
-
- wrote = write(fd1, buf, done);
- if( wrote != done ) SHOW_RESULT( write, wrote );
-
- if( wrote != done ) break;
- }
-
- err = close(fd1);
- if( err < 0 ) SHOW_RESULT( close, err );
-
- err = close(fd2);
- if( err < 0 ) SHOW_RESULT( close, err );
-
-}
-static void copydir(char *name, char *destdir)
-{
- int err;
- DIR *dirp;
-
- dirp = opendir(destdir);
- if (dirp==NULL)
- {
- mkdir(destdir, 0777);
- } else
- {
- err = closedir(dirp);
- }
-
- dirp = opendir(name);
- if( dirp == NULL ) SHOW_RESULT( opendir, -1 );
-
- for (;;)
- {
- struct dirent *entry = readdir(dirp);
-
- if (entry == NULL)
- break;
-
- if (strcmp(entry->d_name, ".") == 0)
- continue;
- if (strcmp(entry->d_name, "..") == 0)
- continue;
-
- bool isDir = false;
- struct stat buf;
- char fullPath[PATH_MAX];
- strncpy(fullPath, name, PATH_MAX);
- strcat(fullPath, "/");
- strncat(fullPath, entry->d_name, PATH_MAX - strlen(fullPath));
-
- if (stat(fullPath, &buf) == -1)
- {
- diag_printf("unable to read status from %s", fullPath);
- break;
- }
- isDir = S_ISDIR(buf.st_mode) != 0;
-
- if (isDir)
- continue;
-
- // diag_printf("<INFO>: entry %14s",entry->d_name);
- char fullname[PATH_MAX];
- char fullname2[PATH_MAX];
-
- strcpy(fullname, name);
- strcat(fullname, "/");
- strcat(fullname, entry->d_name);
-
- strcpy(fullname2, destdir);
- strcat(fullname2, "/");
- strcat(fullname2, entry->d_name);
- // diag_printf("from %s to %s\n", fullname, fullname2);
- copyfile(fullname, fullname2);
-
- // diag_printf("\n");
- }
-
- err = closedir(dirp);
- if( err < 0 ) SHOW_RESULT( stat, err );
-}
-
#if 0
MTAB_ENTRY( romfs_mte1,
"/rom",
@@ -746,7 +271,6 @@
cyg_mutex_lock(&httpstate.jim_lock);
}
-
void format(void)
{
diag_printf("Formatting JFFS2...\n");
@@ -761,12 +285,10 @@
reboot();
}
-
cyg_uint32 len;
cyg_io_flash_getconfig_devsize_t ds;
- len = sizeof (ds);
- err = cyg_io_get_config(handle,
- CYG_IO_GET_CONFIG_FLASH_DEVSIZE, &ds, &len);
+ len = sizeof(ds);
+ err = cyg_io_get_config(handle, CYG_IO_GET_CONFIG_FLASH_DEVSIZE, &ds, &len);
if (err != ENOERR)
{
diag_printf("Flash error cyg_io_get_config %d\n", err);
@@ -775,15 +297,14 @@
cyg_io_flash_getconfig_erase_t e;
void *err_addr;
- len = sizeof (e);
+ len = sizeof(e);
e.offset = 0;
e.len = ds.dev_size;
e.err_address = &err_addr;
diag_printf("Formatting 0x%08x bytes\n", ds.dev_size);
- err = cyg_io_get_config(handle, CYG_IO_GET_CONFIG_FLASH_ERASE,
- &e, &len);
+ err = cyg_io_get_config(handle, CYG_IO_GET_CONFIG_FLASH_ERASE, &e, &len);
if (err != ENOERR)
{
diag_printf("Flash erase error %d offset 0x%p\n", err, err_addr);
@@ -795,11 +316,7 @@
reboot();
}
-
-
-static int
-zylinjtag_Jim_Command_format_jffs2(Jim_Interp *interp,
- int argc,
+static int zylinjtag_Jim_Command_format_jffs2(Jim_Interp *interp, int argc,
Jim_Obj * const *argv)
{
if (argc != 1)
@@ -808,31 +325,10 @@
}
format();
- for(;;);
+ for (;;)
+ ;
}
-
-static int
-zylinjtag_Jim_Command_rm(Jim_Interp *interp,
- int argc,
- Jim_Obj * const *argv)
-{
- int del;
- if (argc != 2)
- {
- Jim_WrongNumArgs(interp, 1, argv, "rm ?dirorfile?");
- return JIM_ERR;
- }
-
- del = 0;
- if (unlink(Jim_GetString(argv[1], NULL)) == 0)
- del = 1;
- if (rmdir(Jim_GetString(argv[1], NULL)) == 0)
- del = 1;
-
- return del ? JIM_OK : JIM_ERR;
-}
-
static int zylinjtag_Jim_Command_threads(Jim_Interp *interp, int argc,
Jim_Obj * const *argv)
{
@@ -887,198 +383,28 @@
Jim_ListAppendElement(interp, threadObj, Jim_NewStringObj(interp,
state_string, strlen(state_string)));
- Jim_ListAppendElement (interp, threadObj, Jim_NewIntObj(interp, id));
- Jim_ListAppendElement(interp, threadObj, Jim_NewIntObj(interp, info.set_pri));
- Jim_ListAppendElement(interp, threadObj, Jim_NewIntObj(interp, info.cur_pri));
+ Jim_ListAppendElement(interp, threadObj, Jim_NewIntObj(interp, id));
+ Jim_ListAppendElement(interp, threadObj, Jim_NewIntObj(interp,
+ info.set_pri));
+ Jim_ListAppendElement(interp, threadObj, Jim_NewIntObj(interp,
+ info.cur_pri));
Jim_ListAppendElement(interp, threads, threadObj);
}
- Jim_SetResult( interp, threads);
+ Jim_SetResult(interp, threads);
return JIM_OK;
}
-
-static int
-zylinjtag_Jim_Command_ls(Jim_Interp *interp,
- int argc,
+static int zylinjtag_Jim_Command_log(Jim_Interp *interp, int argc,
Jim_Obj * const *argv)
{
- if (argc != 2)
- {
- Jim_WrongNumArgs(interp, 1, argv, "ls ?dir?");
- return JIM_ERR;
- }
-
- char *name = (char*) Jim_GetString(argv[1], NULL);
-
- DIR *dirp = NULL;
- dirp = opendir(name);
- if (dirp == NULL)
- {
- return JIM_ERR;
- }
- Jim_Obj *objPtr = Jim_NewListObj(interp, NULL, 0);
-
- for (;;)
- {
- struct dirent *entry = NULL;
- entry = readdir(dirp);
- if (entry == NULL)
- break;
-
- if ((strcmp(".", entry->d_name)==0)||(strcmp("..", entry->d_name)==0))
- continue;
-
- Jim_ListAppendElement(interp, objPtr, Jim_NewStringObj(interp, entry->d_name, strlen(entry->d_name)));
- }
- closedir(dirp);
-
- Jim_SetResult(interp, objPtr);
-
- return JIM_OK;
-}
-
-
-static int
-zylinjtag_Jim_Command_getmem(Jim_Interp *interp,
- int argc,
- Jim_Obj * const *argv)
-{
- if (argc != 3)
- {
- Jim_WrongNumArgs(interp, 1, argv, "ls ?dir?");
- return JIM_ERR;
- }
-
- long address;
- long length;
- if (Jim_GetLong(interp, argv[1], &address) != JIM_OK)
- return JIM_ERR;
- if (Jim_GetLong(interp, argv[2], &length) != JIM_OK)
- return JIM_ERR;
-
- if (length < 0 && length > (4096 * 1024))
- {
- Jim_WrongNumArgs(interp, 1, argv, "getmem ?dir?");
- return JIM_ERR;
- }
-
- void *mem = malloc(length);
- if (mem == NULL)
- return JIM_ERR;
-
- target_t *target = get_current_target(cmd_ctx);
-
- int retval;
- int size = 1;
- int count = length;
- if ((address % 4 == 0) && (count % 4 == 0))
- {
- size = 4;
- count /= 4;
- }
-
- if ((retval = target->type->read_memory(target, address, size, count, mem)) != ERROR_OK)
- {
- free(mem);
- return JIM_ERR;
- }
-
- Jim_Obj *objPtr = Jim_NewStringObj(interp, mem, length);
- Jim_SetResult(interp, objPtr);
-
- free(mem);
-
- return JIM_OK;
-}
-
-static int
-zylinjtag_Jim_Command_peek(Jim_Interp *interp,
- int argc,
- Jim_Obj * const *argv)
-{
- if (argc != 2)
- {
- Jim_WrongNumArgs(interp, 1, argv, "peek ?address?");
- return JIM_ERR;
- }
-
- long address;
- if (Jim_GetLong(interp, argv[1], &address) != JIM_OK)
- return JIM_ERR;
-
- int value = *((volatile int *) address);
-
- Jim_SetResult(interp, Jim_NewIntObj(interp, value));
-
- return JIM_OK;
-}
-
-static int
-zylinjtag_Jim_Command_poke(Jim_Interp *interp,
- int argc,
- Jim_Obj * const *argv)
-{
- if (argc != 3)
- {
- Jim_WrongNumArgs(interp, 1, argv, "poke ?address? ?value?");
- return JIM_ERR;
- }
-
- long address;
- if (Jim_GetLong(interp, argv[1], &address) != JIM_OK)
- return JIM_ERR;
- long value;
- if (Jim_GetLong(interp, argv[2], &value) != JIM_OK)
- return JIM_ERR;
-
- *((volatile int *) address) = value;
-
- return JIM_OK;
-}
-
-
-
-static int
-zylinjtag_Jim_Command_flash(Jim_Interp *interp,
- int argc,
- Jim_Obj * const *argv)
-{
- int retval;
- u32 base = 0;
- flash_bank_t *t = get_flash_bank_by_num_noprobe(0);
- if (t != NULL)
- {
- base = t->base;
- retval = JIM_OK;
- } else
- {
- retval = JIM_ERR;
- }
-
- if (retval == JIM_OK)
- {
- Jim_SetResult(interp, Jim_NewIntObj(interp, base));
- }
-
- return retval;
-}
-
-
-
-
-
-static int
-zylinjtag_Jim_Command_log(Jim_Interp *interp,
- int argc,
- Jim_Obj * const *argv)
-{
Jim_Obj *tclOutput = Jim_NewStringObj(interp, "", 0);
if (logCount >= logSize)
{
- Jim_AppendString(httpstate.jim_interp, tclOutput, logBuffer+logCount%logSize, logSize-logCount%logSize);
+ Jim_AppendString(httpstate.jim_interp, tclOutput, logBuffer + logCount
+ % logSize, logSize - logCount % logSize);
}
Jim_AppendString(httpstate.jim_interp, tclOutput, logBuffer, writePtr);
@@ -1086,18 +412,14 @@
return JIM_OK;
}
-static int
-zylinjtag_Jim_Command_reboot(Jim_Interp *interp,
- int argc,
+static int zylinjtag_Jim_Command_reboot(Jim_Interp *interp, int argc,
Jim_Obj * const *argv)
{
reboot();
return JIM_OK;
}
-static int
-zylinjtag_Jim_Command_mac(Jim_Interp *interp,
- int argc,
+static int zylinjtag_Jim_Command_mac(Jim_Interp *interp, int argc,
Jim_Obj * const *argv)
{
@@ -1110,9 +432,7 @@
return JIM_OK;
}
-static int
-zylinjtag_Jim_Command_ip(Jim_Interp *interp,
- int argc,
+static int zylinjtag_Jim_Command_ip(Jim_Interp *interp, int argc,
Jim_Obj * const *argv)
{
Jim_Obj *tclOutput = Jim_NewStringObj(interp, "", 0);
@@ -1156,7 +476,6 @@
extern Jim_Interp *interp;
-
static void zylinjtag_startNetwork()
{
// Bring TCP/IP up immediately before we're ready to accept commands.
@@ -1181,18 +500,18 @@
interp = httpstate.jim_interp;
- Jim_CreateCommand(httpstate.jim_interp, "log", zylinjtag_Jim_Command_log, NULL, NULL);
- Jim_CreateCommand(httpstate.jim_interp, "reboot", zylinjtag_Jim_Command_reboot, NULL, NULL);
- Jim_CreateCommand(httpstate.jim_interp, "peek", zylinjtag_Jim_Command_peek, NULL, NULL);
- Jim_CreateCommand(httpstate.jim_interp, "zy1000_flash", zylinjtag_Jim_Command_flash, NULL, NULL);
- Jim_CreateCommand(httpstate.jim_interp, "poke", zylinjtag_Jim_Command_poke, NULL, NULL);
- Jim_CreateCommand(httpstate.jim_interp, "ls", zylinjtag_Jim_Command_ls, NULL, NULL);
- Jim_CreateCommand(httpstate.jim_interp, "threads", zylinjtag_Jim_Command_threads, NULL, NULL);
- Jim_CreateCommand(httpstate.jim_interp, "getmem", zylinjtag_Jim_Command_getmem, NULL, NULL);
- Jim_CreateCommand(httpstate.jim_interp, "mac", zylinjtag_Jim_Command_mac, NULL, NULL);
- Jim_CreateCommand(httpstate.jim_interp, "ip", zylinjtag_Jim_Command_ip, NULL, NULL);
- Jim_CreateCommand(httpstate.jim_interp, "rm", zylinjtag_Jim_Command_rm, NULL, NULL);
- Jim_CreateCommand(httpstate.jim_interp, "format_jffs2", zylinjtag_Jim_Command_format_jffs2, NULL, NULL);
+ Jim_CreateCommand(httpstate.jim_interp, "log", zylinjtag_Jim_Command_log,
+ NULL, NULL);
+ Jim_CreateCommand(httpstate.jim_interp, "reboot",
+ zylinjtag_Jim_Command_reboot, NULL, NULL);
+ Jim_CreateCommand(httpstate.jim_interp, "threads",
+ zylinjtag_Jim_Command_threads, NULL, NULL);
+ Jim_CreateCommand(httpstate.jim_interp, "mac", zylinjtag_Jim_Command_mac,
+ NULL, NULL);
+ Jim_CreateCommand(httpstate.jim_interp, "ip", zylinjtag_Jim_Command_ip,
+ NULL, NULL);
+ Jim_CreateCommand(httpstate.jim_interp, "format_jffs2",
+ zylinjtag_Jim_Command_format_jffs2, NULL, NULL);
cyg_httpd_start();
@@ -1225,18 +544,14 @@
(int) ((unsigned char *) &ifr.ifr_hwaddr.sa_data)[4],
(int) ((unsigned char *) &ifr.ifr_hwaddr.sa_data)[5]);
+ discover_message
+ = alloc_printf("ZY1000 Zylin JTAG debugger MAC %s", hwaddr);
- discover_message=alloc_printf("ZY1000 Zylin JTAG debugger MAC %s", hwaddr);
-
discover_launch();
}
-
-
-
-
-static void
-print_exception_handler(cyg_addrword_t data, cyg_code_t exception, cyg_addrword_t info)
+static void print_exception_handler(cyg_addrword_t data, cyg_code_t exception,
+ cyg_addrword_t info)
{
writeLog = false;
serialLog = true;
@@ -1245,17 +560,17 @@
{
#ifdef CYGNUM_HAL_VECTOR_UNDEF_INSTRUCTION
case CYGNUM_HAL_VECTOR_UNDEF_INSTRUCTION:
- infoStr = "undefined instruction";
- break;
+ infoStr = "undefined instruction";
+ break;
case CYGNUM_HAL_VECTOR_SOFTWARE_INTERRUPT:
- infoStr = "software interrupt";
- break;
+ infoStr = "software interrupt";
+ break;
case CYGNUM_HAL_VECTOR_ABORT_PREFETCH:
- infoStr = "abort prefetch";
- break;
+ infoStr = "abort prefetch";
+ break;
case CYGNUM_HAL_VECTOR_ABORT_DATA:
- infoStr = "abort data";
- break;
+ infoStr = "abort data";
+ break;
#endif
default:
break;
@@ -1282,11 +597,8 @@
cyg_exception_handler_t *old_handler;
cyg_addrword_t old_data;
- cyg_exception_set_handler(exception,
- print_exception_handler,
- 0,
- &old_handler,
- &old_data);
+ cyg_exception_set_handler(exception, print_exception_handler, 0,
+ &old_handler, &old_data);
}
static cyg_thread zylinjtag_uart_thread_object;
@@ -1296,7 +608,6 @@
static char forwardBuffer[1024]; // NB! must be smaller than a TCP/IP packet!!!!!
static char backwardBuffer[1024];
-
void setNoDelay(int session, int flag)
{
#if 1
@@ -1324,8 +635,7 @@
} tcpipSent[512 * 1024];
int cur;
-static void
-zylinjtag_uart(cyg_addrword_t data)
+static void zylinjtag_uart(cyg_addrword_t data)
{
int so_reuseaddr_option = 1;
@@ -1336,7 +646,8 @@
exit(-1);
}
- setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void*)&so_reuseaddr_option, sizeof(int));
+ setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void*) &so_reuseaddr_option,
+ sizeof(int));
struct sockaddr_in sin;
unsigned int address_size;
@@ -1417,7 +728,8 @@
if (actual2 <= 0)
{
memset(backwardBuffer, 's', sizeof(backwardBuffer));
- actual2=read(serHandle, backwardBuffer, sizeof(backwardBuffer));
+ actual2 = read(serHandle, backwardBuffer,
+ sizeof(backwardBuffer));
if (actual2 < 0)
{
if (errno != EAGAIN)
@@ -1441,7 +753,8 @@
y = written;
}
- if (FD_ISSET(session, &read_fds)&&(sizeof(forwardBuffer)>actual))
+ if (FD_ISSET(session, &read_fds)
+ && (sizeof(forwardBuffer) > actual))
{
// NB! Here it is important that we empty the TCP/IP read buffer
// to make transmission tick right
@@ -1449,7 +762,8 @@
pos = 0;
int t;
// this will block if there is no data at all
- t=read_socket(session, forwardBuffer+actual, sizeof(forwardBuffer)-actual);
+ t = read_socket(session, forwardBuffer + actual,
+ sizeof(forwardBuffer) - actual);
if (t <= 0)
{
goto closeSession;
@@ -1475,7 +789,8 @@
}
// The serial buffer is full
written = 0;
- } else
+ }
+ else
{
actual -= written;
pos += written;
@@ -1492,14 +807,14 @@
}
}
- closeSession:
- close(session);
+ closeSession: close(session);
close(serHandle);
int i;
for (i = 0; i < 1024; i++)
{
- diag_printf("%d %d %d %d\n", tcpipSent[i].req, tcpipSent[i].actual, tcpipSent[i].req2, tcpipSent[i].actual2);
+ diag_printf("%d %d %d %d\n", tcpipSent[i].req, tcpipSent[i].actual,
+ tcpipSent[i].req2, tcpipSent[i].actual2);
}
}
@@ -1509,28 +824,23 @@
void startUart(void)
{
- cyg_thread_create(1,
- zylinjtag_uart,
- (cyg_addrword_t)0,
- "uart thread",
- (void *)uart_stack,
- sizeof(uart_stack),
- &zylinjtag_uart_thread_handle,
- &zylinjtag_uart_thread_object);
+ cyg_thread_create(1, zylinjtag_uart, (cyg_addrword_t) 0, "uart thread",
+ (void *) uart_stack, sizeof(uart_stack),
+ &zylinjtag_uart_thread_handle, &zylinjtag_uart_thread_object);
cyg_thread_set_priority(zylinjtag_uart_thread_handle, 1); // low priority as it sits in a busy loop
cyg_thread_resume(zylinjtag_uart_thread_handle);
}
-
-
-int handle_uart_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+int handle_uart_command(struct command_context_s *cmd_ctx, char *cmd,
+ char **args, int argc)
{
static int current_baud = 38400;
if (argc == 0)
{
command_print(cmd_ctx, "%d", current_baud);
return ERROR_OK;
- } else if (argc != 1)
+ }
+ else if (argc != 1)
{
return ERROR_INVALID_ARGUMENTS;
}
@@ -1577,9 +887,10 @@
return ERROR_FAIL;
}
-
- err = cyg_io_get_config(serial_handle, CYG_IO_GET_CONFIG_SERIAL_OUTPUT_DRAIN, &buf, &len);
- err = cyg_io_get_config(serial_handle, CYG_IO_GET_CONFIG_SERIAL_INFO, &buf, &len);
+ err = cyg_io_get_config(serial_handle,
+ CYG_IO_GET_CONFIG_SERIAL_OUTPUT_DRAIN, &buf, &len);
+ err = cyg_io_get_config(serial_handle, CYG_IO_GET_CONFIG_SERIAL_INFO, &buf,
+ &len);
if (err != ENOERR)
{
command_print(cmd_ctx, "Failed to get serial port settings %d", err);
@@ -1587,7 +898,8 @@
}
buf.baud = baud;
- err = cyg_io_set_config(serial_handle, CYG_IO_SET_CONFIG_SERIAL_INFO, &buf, &len);
+ err = cyg_io_set_config(serial_handle, CYG_IO_SET_CONFIG_SERIAL_INFO, &buf,
+ &len);
if (err != ENOERR)
{
command_print(cmd_ctx, "Failed to set serial port settings %d", err);
@@ -1599,49 +911,27 @@
bool logAllToSerial = false;
-/* boolean parameter stored on config */
-bool boolParam(char *var)
-{
- bool result = false;
- char *name = alloc_printf(ZYLIN_CONFIG_DIR "/%s", var);
- if (name == NULL)
- return result;
- void *data;
- int len;
- if (loadFile(name, &data, &len) == ERROR_OK)
- {
- if (len > 1)
- len = 1;
- result = strncmp((char *) data, "1", len) == 0;
- free(data);
- }
- free(name);
- return result;
-}
+int boolParam(char *var);
+
command_context_t *setup_command_handler();
+extern const char *zylin_config_dir;
+
int add_default_dirs(void)
{
- add_script_search_dir(ZYLIN_CONFIG_DIR);
+ add_script_search_dir(zylin_config_dir);
add_script_search_dir("/rom/lib/openocd");
add_script_search_dir("/rom");
return ERROR_OK;
}
-static cyg_uint8 *ramblockdevice;
-static const int ramblockdevice_size=4096*1024;
int main(int argc, char *argv[])
{
/* ramblockdevice will be the same address every time. The deflate app uses a buffer 16mBytes out, so we
* need to allocate towards the end of the heap. */
- ramblockdevice=(cyg_uint8 *)malloc(ramblockdevice_size);
- memset(ramblockdevice, 0xff, ramblockdevice_size);
-
-
-
#ifdef CYGNUM_HAL_VECTOR_UNDEF_INSTRUCTION
setHandler(CYGNUM_HAL_VECTOR_UNDEF_INSTRUCTION);
setHandler(CYGNUM_HAL_VECTOR_ABORT_PREFETCH);
@@ -1650,10 +940,12 @@
int err;
- setPower(true); // on by default
-
atexit(keep_webserver);
+ diag_init_putc(_zylinjtag_diag_write_char);
+ // We want this in the log.
+ diag_printf("Zylin ZY1000.\n");
+
err = mount("", "/ram", "ramfs");
if (err < 0)
{
@@ -1688,12 +980,7 @@
exit(-1);
}
- diag_init_putc(_zylinjtag_diag_write_char);
- // We want this in the log.
- diag_printf("Zylin ZY1000. Copyright Zylin AS 2007-2008.\n");
- diag_printf("%s\n", ZYLIN_OPENOCD_VERSION);
-
copydir("/rom", "/ram/cgi");
err = mount("/dev/flash1", "/config", "jffs2");
@@ -1701,12 +988,13 @@
{
diag_printf("unable to mount jffs2, falling back to ram disk..\n");
err = mount("", "/config", "ramfs");
- if (err<0)
+ if (err < 0)
{
diag_printf("unable to mount /config as ramdisk.\n");
reboot();
}
- } else
+ }
+ else
{
/* are we using a ram disk instead of a flash disk? This is used
* for ZY1000 live demo...
@@ -1716,7 +1004,7 @@
if (boolParam("ramdisk"))
{
diag_printf("Unmounting /config from flash and using ram instead\n");
- err=umount("/config");
+ err = umount("/config");
if (err < 0)
{
diag_printf("unable to unmount jffs\n");
@@ -1737,23 +1025,22 @@
reboot();
}
- // copydir("/config2", "/config");
+ // copydir("/config2", "/config");
copyfile("/config2/ip", "/config/ip");
copydir("/config2/settings", "/config/settings");
umount("/config2");
- } else
- {
- /* we're not going to use a ram block disk */
- free(ramblockdevice);
}
}
+ mkdir(zylin_config_dir, 0777);
+ char *dirname=alloc_printf("%s/target", zylin_config_dir);
+ mkdir(dirname, 0777);
+ free(dirname);
+ dirname=alloc_printf("%s/event", zylin_config_dir);
+ mkdir(dirname, 0777);
+ free(dirname);
- mkdir(ZYLIN_CONFIG_DIR, 0777);
- mkdir(ZYLIN_CONFIG_DIR "/target", 0777);
- mkdir(ZYLIN_CONFIG_DIR "/event", 0777);
-
logAllToSerial = boolParam("logserial");
// We need the network & web server in case there is something wrong with
@@ -1767,43 +1054,18 @@
add_default_dirs();
/* initialize commandline interface */
- command_context_t *cmd_ctx;
+ command_context_t * cmd_ctx;
cmd_ctx = setup_command_handler();
command_set_output_handler(cmd_ctx, configuration_output_handler, NULL);
command_context_mode(cmd_ctx, COMMAND_CONFIG);
-
- register_command(cmd_ctx, NULL, "zy1000_version", handle_zy1000_version_command,
- COMMAND_EXEC, "show zy1000 version numbers");
-
- register_command(cmd_ctx, NULL, "rm", handle_rm_command, COMMAND_ANY,
- "remove file");
-
- register_command(cmd_ctx, NULL, "cat", handle_cat_command, COMMAND_ANY,
- "display file content");
-
- register_command(cmd_ctx, NULL, "trunc", handle_trunc_command, COMMAND_ANY,
- "truncate a file to 0 size");
-
- register_command(cmd_ctx, NULL, "append_file", handle_append_command,
- COMMAND_ANY, "append a variable number of strings to a file");
-
- register_command(cmd_ctx, NULL, "power", handle_power_command, COMMAND_ANY,
- "power <on/off> - turn power switch to target on/off. No arguments - print status.");
-
- register_command(cmd_ctx, NULL, "meminfo", handle_meminfo_command,
- COMMAND_ANY, "display available ram memory");
-
- register_command(cmd_ctx, NULL, "cp", handle_cp_command,
- COMMAND_ANY, "copy a file <from> <to>");
-
#ifdef CYGPKG_PROFILE_GPROF
register_command(cmd_ctx, NULL, "ecosboard_profile", eCosBoard_handle_eCosBoard_profile_command,
COMMAND_ANY, NULL);
#endif
- register_command(cmd_ctx, NULL, "uart", handle_uart_command,
- COMMAND_ANY, "uart <baud> - forward uart on port 5555");
+ register_command(cmd_ctx, NULL, "uart", handle_uart_command, COMMAND_ANY,
+ "uart <baud> - forward uart on port 5555");
int errVal;
errVal = log_init(cmd_ctx);
@@ -1821,11 +1083,12 @@
if (logAllToSerial)
{
- diag_printf(ZYLIN_CONFIG_DIR "/logserial=1 => sending log output to serial port using \"debug_level 3\" as default.\n");
+ diag_printf(
+ "%s/logserial=1 => sending log output to serial port using \"debug_level 3\" as default.\n", zylin_config_dir);
command_run_line(cmd_ctx, "debug_level 3");
}
- zylinjtag_parse_config_file(cmd_ctx, "/rom/openocd.cfg");
+ command_run_linef(cmd_ctx, "script /rom/openocd.cfg");
// FIX!!! Yuk!
// diag_printf() is really invoked from many more places than we trust it
@@ -1834,7 +1097,8 @@
// Disabling it here is safe and gives us enough logged debug output for now. Crossing
// fingers that it doesn't cause any crashes.
diag_printf("Init complete, GDB & telnet servers launched.\n");
- command_set_output_handler(cmd_ctx, zy1000_configuration_output_handler_log, NULL);
+ command_set_output_handler(cmd_ctx,
+ zy1000_configuration_output_handler_log, NULL);
if (!logAllToSerial)
{
serialLog = false;
@@ -1852,13 +1116,11 @@
umount("/config");
exit(0);
- for (;;);
+ for (;;)
+ ;
}
-
-
-cyg_int32
-cyg_httpd_exec_cgi_tcl(char *file_name);
+cyg_int32 cyg_httpd_exec_cgi_tcl(char *file_name);
cyg_int32 homeForm(CYG_HTTPD_STATE *p)
{
cyg_httpd_exec_cgi_tcl("/ram/cgi/index.tcl");
@@ -1960,18 +1222,12 @@
// This set of file operations are used for normal open files.
static cyg_fileops tftpfs_fileops =
-{
- tftpfs_fo_read,
- tftpfs_fo_write,
- tftpfs_fo_lseek,
- (cyg_fileop_ioctl *)cyg_fileio_erofs,
- cyg_fileio_seltrue,
- tftpfs_fo_fsync,
- tftpfs_fo_close,
+{ tftpfs_fo_read, tftpfs_fo_write, tftpfs_fo_lseek,
+ (cyg_fileop_ioctl *) cyg_fileio_erofs, cyg_fileio_seltrue,
+ tftpfs_fo_fsync, tftpfs_fo_close,
(cyg_fileop_fstat *) cyg_fileio_erofs,
(cyg_fileop_getinfo *) cyg_fileio_erofs,
- (cyg_fileop_setinfo *)cyg_fileio_erofs,
-};
+ (cyg_fileop_setinfo *) cyg_fileio_erofs, };
// -------------------------------------------------------------------------
// tftpfs_mount()
@@ -2068,7 +1324,8 @@
if (!tftp->readFile)
{
int err;
- tftp->actual = tftp_client_get( tftp->file, tftp->server, 0, tftp->mem, tftpMaxSize, TFTP_OCTET, &err);
+ tftp->actual = tftp_client_get(tftp->file, tftp->server, 0, tftp->mem,
+ tftpMaxSize, TFTP_OCTET, &err);
if (tftp->actual < 0)
{
@@ -2083,8 +1340,7 @@
// tftpfs_fo_write()
// Read data from file.
-static int
-tftpfs_fo_read(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio)
+static int tftpfs_fo_read(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio)
{
struct Tftp *tftp = (struct Tftp *) fp->f_data;
@@ -2116,9 +1372,7 @@
return ENOERR;
}
-
-static int
-tftpfs_fo_write(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio)
+static int tftpfs_fo_write(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio)
{
struct Tftp *tftp = (struct Tftp *) fp->f_data;
@@ -2149,8 +1403,7 @@
return ENOERR;
}
-static int
-tftpfs_fo_fsync(struct CYG_FILE_TAG *fp, int mode)
+static int tftpfs_fo_fsync(struct CYG_FILE_TAG *fp, int mode)
{
int error = ENOERR;
return error;
@@ -2167,7 +1420,8 @@
if (tftp->write)
{
- tftp_client_put( tftp->file, tftp->server, 0, tftp->mem, fp->f_offset, TFTP_OCTET, &error);
+ tftp_client_put(tftp->file, tftp->server, 0, tftp->mem, fp->f_offset,
+ TFTP_OCTET, &error);
}
freeTftp(tftp);
@@ -2227,13 +1481,13 @@
}
// Chunked version.
-cyg_int32
-show_log_entry(CYG_HTTPD_STATE *phttpstate)
+cyg_int32 show_log_entry(CYG_HTTPD_STATE *phttpstate)
{
cyg_httpd_start_chunked("text");
if (logCount >= logSize)
{
- cyg_httpd_write_chunked(logBuffer+logCount%logSize, logSize-logCount%logSize);
+ cyg_httpd_write_chunked(logBuffer + logCount % logSize, logSize
+ - logCount % logSize);
}
cyg_httpd_write_chunked(logBuffer, writePtr);
cyg_httpd_end_chunked();
@@ -2247,8 +1501,7 @@
static int logfs_umount(cyg_mtab_entry *mte);
static int logfs_open(cyg_mtab_entry *mte, cyg_dir dir, const char *name,
int mode, cyg_file *fte);
-static int
-logfs_fo_write(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio);
+static int logfs_fo_write(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio);
// File operations
static int logfs_fo_fsync(struct CYG_FILE_TAG *fp, int mode);
@@ -2285,18 +1538,12 @@
// This set of file operations are used for normal open files.
static cyg_fileops logfs_fileops =
-{
- (cyg_fileop_read *)cyg_fileio_erofs,
- (cyg_fileop_write *)logfs_fo_write,
+{ (cyg_fileop_read *) cyg_fileio_erofs, (cyg_fileop_write *) logfs_fo_write,
(cyg_fileop_lseek *) cyg_fileio_erofs,
- (cyg_fileop_ioctl *)cyg_fileio_erofs,
- cyg_fileio_seltrue,
- logfs_fo_fsync,
- logfs_fo_close,
- (cyg_fileop_fstat *)cyg_fileio_erofs,
+ (cyg_fileop_ioctl *) cyg_fileio_erofs, cyg_fileio_seltrue,
+ logfs_fo_fsync, logfs_fo_close, (cyg_fileop_fstat *) cyg_fileio_erofs,
(cyg_fileop_getinfo *) cyg_fileio_erofs,
- (cyg_fileop_setinfo *)cyg_fileio_erofs,
-};
+ (cyg_fileop_setinfo *) cyg_fileio_erofs, };
// -------------------------------------------------------------------------
// logfs_mount()
@@ -2329,8 +1576,7 @@
// logfs_fo_write()
// Write data to file.
-static int
-logfs_fo_write(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio)
+static int logfs_fo_write(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio)
{
int i;
for (i = 0; i < uio->uio_iovcnt; i++)
@@ -2345,8 +1591,7 @@
return ENOERR;
}
-static int
-logfs_fo_fsync(struct CYG_FILE_TAG *fp, int mode)
+static int logfs_fo_fsync(struct CYG_FILE_TAG *fp, int mode)
{
return ENOERR;
}
Modified: trunk/src/helper/Makefile.am
===================================================================
--- trunk/src/helper/Makefile.am 2008-12-15 09:43:26 UTC (rev 1242)
+++ trunk/src/helper/Makefile.am 2008-12-15 11:32:22 UTC (rev 1243)
@@ -9,9 +9,16 @@
CONFIGFILES = options.c jim.c jim-eventloop.c
endif
+
+
libhelper_a_SOURCES = binarybuffer.c $(CONFIGFILES) configuration.c log.c command.c time_support.c \
replacements.c fileio.c startup_tcl.c
+if IOUTIL
+libhelper_a_SOURCES += ioutil.c
+endif
+
+
noinst_HEADERS = binarybuffer.h configuration.h types.h log.h command.h \
time_support.h replacements.h fileio.h jim.h jim-eventloop.h \
startup.tcl bin2char.c
Added: trunk/src/helper/ioutil.c
===================================================================
--- trunk/src/helper/ioutil.c 2008-12-15 09:43:26 UTC (rev 1242)
+++ trunk/src/helper/ioutil.c 2008-12-15 11:32:22 UTC (rev 1243)
@@ -0,0 +1,590 @@
+/***************************************************************************
+ * Copyright (C) 2007-2008 by vind Harboe *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+/* this file contains various functionality useful to standalone systems */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "log.h"
+#include "types.h"
+#include "configuration.h"
+#include "target.h"
+
+#include "command.h"
+
+#include <time_support.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <strings.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#if !BUILD_ECOSBOARD
+#include <malloc.h>
+#endif
+#include <errno.h>
+
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <netinet/tcp.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <net/if.h>
+#include <arpa/inet.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <unistd.h>
+#include <arpa/inet.h>
+#include <stdio.h>
+#include <string.h>
+
+
+#include <unistd.h>
+#include <stdio.h>
+
+int handle_rm_command(struct command_context_s *cmd_ctx, char *cmd,
+ char **args, int argc)
+{
+ if (argc != 1)
+ {
+ command_print(cmd_ctx, "rm <filename>");
+ return ERROR_INVALID_ARGUMENTS;
+ }
+
+ if (unlink(args[0]) != 0)
+ {
+ command_print(cmd_ctx, "failed: %d", errno);
+ }
+
+ return ERROR_OK;
+}
+
+
+/* loads a file and returns a pointer to it in memory. The file contains
+ * a 0 byte(sentinel) after len bytes - the length of the file. */
+int loadFile(const char *fileName, void **data, int *len)
+{
+ FILE * pFile;
+ pFile = fopen(fileName,"rb");
+ if (pFile==NULL)
+ {
+ LOG_ERROR("Can't open %s\n", fileName);
+ return ERROR_FAIL;
+ }
+ if (fseek(pFile, 0, SEEK_END)!=0)
+ {
+ LOG_ERROR("Can't open %s\n", fileName);
+ fclose(pFile);
+ return ERROR_FAIL;
+ }
+ *len=ftell(pFile);
+ if (*len==-1)
+ {
+ LOG_ERROR("Can't open %s\n", fileName);
+ fclose(pFile);
+ return ERROR_FAIL;
+ }
+
+ if (fseek(pFile, 0, SEEK_SET)!=0)
+ {
+ LOG_ERROR("Can't open %s\n", fileName);
+ fclose(pFile);
+ return ERROR_FAIL;
+ }
+ *data=malloc(*len+1);
+ if (*data==NULL)
+ {
+ LOG_ERROR("Can't open %s\n", fileName);
+ fclose(pFile);
+ return ERROR_FAIL;
+ }
+
+ if (fread(*data, 1, *len, pFile)!=*len)
+ {
+ fclose(pFile);
+ free(*data);
+ LOG_ERROR("Can't open %s\n", fileName);
+ return ERROR_FAIL;
+ }
+ fclose(pFile);
+ *(((char *)(*data))+*len)=0; /* sentinel */
+
+ return ERROR_OK;
+
+
+
+}
+
+
+
+int handle_cat_command(struct command_context_s *cmd_ctx, char *cmd,
+ char **args, int argc)
+{
+ if (argc != 1)
+ {
+ command_print(cmd_ctx, "cat <filename>");
+ return ERROR_INVALID_ARGUMENTS;
+ }
+
+ // NOTE!!! we only have line printing capability so we print the entire file as a single line.
+ void *data;
+ int len;
+
+ int retval = loadFile(args[0], &data, &len);
+ if (retval == ERROR_OK)
+ {
+ command_print(cmd_ctx, "%s", data);
+ free(data);
+ }
+ else
+ {
+ command_print(cmd_ctx, "%s not found %d", args[0], retval);
+ }
+
+ return ERROR_OK;
+}
+int handle_trunc_command(struct command_context_s *cmd_ctx, char *cmd,
+ char **args, int argc)
+{
+ if (argc != 1)
+ {
+ command_print(cmd_ctx, "trunc <filename>");
+ return ERROR_INVALID_ARGUMENTS;
+ }
+
+ FILE *config_file = NULL;
+ config_file = fopen(args[0], "w");
+ if (config_file != NULL)
+ fclose(config_file);
+
+ return ERROR_OK;
+}
+
+
+int handle_meminfo_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+{
+ static int prev = 0;
+ struct mallinfo info;
+
+ if (argc != 0)
+ {
+ command_print(cmd_ctx, "meminfo");
+ return ERROR_INVALID_ARGUMENTS;
+ }
+
+ info = mallinfo();
+
+ if (prev > 0)
+ {
+ command_print(cmd_ctx, "Diff: %d", prev - info.fordblks);
+ }
+ prev = info.fordblks;
+
+ command_print(cmd_ctx, "Available ram: %d", info.fordblks );
+
+ return ERROR_OK;
+}
+
+
+int handle_append_command(struct command_context_s *cmd_ctx, char *cmd,
+ char **args, int argc)
+{
+ if (argc < 1)
+ {
+ command_print(cmd_ctx,
+ "append <filename> [<string1>, [<string2>, ...]]");
+ return ERROR_INVALID_ARGUMENTS;
+ }
+
+ FILE *config_file = NULL;
+ config_file = fopen(args[0], "a");
+ if (config_file != NULL)
+ {
+ int i;
+ fseek(config_file, 0, SEEK_END);
+
+ for (i = 1; i < argc; i++)
+ {
+ fwrite(args[i], strlen(args[i]), 1, config_file);
+ if (i != argc - 1)
+ {
+ fwrite(" ", 1, 1, config_file);
+ }
+ }
+ fwrite("\n", 1, 1, config_file);
+ fclose(config_file);
+ }
+
+ return ERROR_OK;
+}
+
+
+
+int handle_cp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+{
+ if (argc != 2)
+ {
+ return ERROR_INVALID_ARGUMENTS;
+ }
+
+ // NOTE!!! we only have line printing capability so we print the entire file as a single line.
+ void *data;
+ int len;
+
+ int retval = loadFile(args[0], &data, &len);
+ if (retval != ERROR_OK)
+ return retval;
+
+ FILE *f = fopen(args[1], "wb");
+ if (f == NULL)
+ retval = ERROR_INVALID_ARGUMENTS;
+
+ int pos = 0;
+ for (;;)
+ {
+ int chunk = len - pos;
+ static const int maxChunk = 512 * 1024; // ~1/sec
+ if (chunk > maxChunk)
+ {
+ chunk = maxChunk;
+ }
+
+ if ((retval==ERROR_OK)&&(fwrite(((char *)data)+pos, 1, chunk, f)!=chunk))
+ retval = ERROR_INVALID_ARGUMENTS;
+
+ if (retval != ERROR_OK)
+ {
+ break;
+ }
+
+ command_print(cmd_ctx, "%d", len - pos);
+
+ pos += chunk;
+
+ if (pos == len)
+ break;
+ }
+
+ if (retval == ERROR_OK)
+ {
+ command_print(cmd_ctx, "Copied %s to %s", args[0], args[1]);
+ } else
+ {
+ command_print(cmd_ctx, "Failed: %d", retval);
+ }
+
+ if (data != NULL)
+ free(data);
+ if (f != NULL)
+ fclose(f);
+
+ if (retval != ERROR_OK)
+ unlink(args[1]);
+
+ return retval;
+}
+
+
+
+
+#define SHOW_RESULT(a, b) LOG_ERROR(#a " failed %d\n", (int)b)
+
+#define IOSIZE 512
+void copyfile(char *name2, char *name1)
+{
+
+ int err;
+ char buf[IOSIZE];
+ int fd1, fd2;
+ ssize_t done, wrote;
+
+ fd1 = open(name1, O_WRONLY | O_CREAT);
+ if (fd1 < 0)
+ SHOW_RESULT( open, fd1 );
+
+ fd2 = open(name2, O_RDONLY);
+ if (fd2 < 0)
+ SHOW_RESULT( open, fd2 );
+
+ for (;;)
+ {
+ done = read(fd2, buf, IOSIZE );
+ if (done < 0)
+ {
+ SHOW_RESULT( read, done );
+ break;
+ }
+
+ if( done == 0 ) break;
+
+ wrote = write(fd1, buf, done);
+ if( wrote != done ) SHOW_RESULT( write, wrote );
+
+ if( wrote != done ) break;
+ }
+
+ err = close(fd1);
+ if( err < 0 ) SHOW_RESULT( close, err );
+
+ err = close(fd2);
+ if( err < 0 ) SHOW_RESULT( close, err );
+
+}
+
+/* utility fn to copy a directory */
+void copydir(char *name, char *destdir)
+{
+ int err;
+ DIR *dirp;
+
+ dirp = opendir(destdir);
+ if (dirp==NULL)
+ {
+ mkdir(destdir, 0777);
+ } else
+ {
+ err = closedir(dirp);
+ }
+
+ dirp = opendir(name);
+ if( dirp == NULL ) SHOW_RESULT( opendir, -1 );
+
+ for (;;)
+ {
+ struct dirent *entry = readdir(dirp);
+
+ if (entry == NULL)
+ break;
+
+ if (strcmp(entry->d_name, ".") == 0)
+ continue;
+ if (strcmp(entry->d_name, "..") == 0)
+ continue;
+
+ int isDir = 0;
+ struct stat buf;
+ char fullPath[PATH_MAX];
+ strncpy(fullPath, name, PATH_MAX);
+ strcat(fullPath, "/");
+ strncat(fullPath, entry->d_name, PATH_MAX - strlen(fullPath));
+
+ if (stat(fullPath, &buf) == -1)
+ {
+ LOG_ERROR("unable to read status from %s", fullPath);
+ break;
+ }
+ isDir = S_ISDIR(buf.st_mode) != 0;
+
+ if (isDir)
+ continue;
+
+ // diag_printf("<INFO>: entry %14s",entry->d_name);
+ char fullname[PATH_MAX];
+ char fullname2[PATH_MAX];
+
+ strcpy(fullname, name);
+ strcat(fullname, "/");
+ strcat(fullname, entry->d_name);
+
+ strcpy(fullname2, destdir);
+ strcat(fullname2, "/");
+ strcat(fullname2, entry->d_name);
+ // diag_printf("from %s to %s\n", fullname, fullname2);
+ copyfile(fullname, fullname2);
+
+ // diag_printf("\n");
+ }
+
+ err = closedir(dirp);
+ if( err < 0 ) SHOW_RESULT( stat, err );
+}
+
+
+
+
+static int
+zylinjtag_Jim_Command_rm(Jim_Interp *interp,
+ int argc,
+ Jim_Obj * const *argv)
+{
+ int del;
+ if (argc != 2)
+ {
+ Jim_WrongNumArgs(interp, 1, argv, "rm ?dirorfile?");
+ return JIM_ERR;
+ }
+
+ del = 0;
+ if (unlink(Jim_GetString(argv[1], NULL)) == 0)
+ del = 1;
+ if (rmdir(Jim_GetString(argv[1], NULL)) == 0)
+ del = 1;
+
+ return del ? JIM_OK : JIM_ERR;
+}
+
+
+static int
+zylinjtag_Jim_Command_ls(Jim_Interp *interp,
+ int argc,
+ Jim_Obj * const *argv)
+{
+ if (argc != 2)
+ {
+ Jim_WrongNumArgs(interp, 1, argv, "ls ?dir?");
+ return JIM_ERR;
+ }
+
+ char *name = (char*) Jim_GetString(argv[1], NULL);
+
+ DIR *dirp = NULL;
+ dirp = opendir(name);
+ if (dirp == NULL)
+ {
+ return JIM_ERR;
+ }
+ Jim_Obj *objPtr = Jim_NewListObj(interp, NULL, 0);
+
+ for (;;)
+ {
+ struct dirent *entry = NULL;
+ entry = readdir(dirp);
+ if (entry == NULL)
+ break;
+
+ if ((strcmp(".", entry->d_name)==0)||(strcmp("..", entry->d_name)==0))
+ continue;
+
+ Jim_ListAppendElement(interp, objPtr, Jim_NewStringObj(interp, entry->d_name, strlen(entry->d_name)));
+ }
+ closedir(dirp);
+
+ Jim_SetResult(interp, objPtr);
+
+ return JIM_OK;
+}
+
+int handle_peek_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+{
+ if (argc != 1)
+ {
+ return ERROR_COMMAND_SYNTAX_ERROR;
+ }
+ volatile int *address=(volatile int *)strtoul(args[0], NULL, 0);
+ int value=*address;
+ command_print(cmd_ctx, "0x%x : 0x%x", address, value);
+ return ERROR_OK;
+}
+
+int handle_poke_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+{
+ if (argc != 2)
+ {
+ return ERROR_INVALID_ARGUMENTS;
+ }
+ volatile int *address=(volatile int *)strtoul(args[0], NULL, 0);
+ int value=strtoul(args[1], NULL, 0);
+ *address=value;
+ return ERROR_OK;
+}
+
+static int
+zylinjtag_Jim_Command_peek(Jim_Interp *interp,
+ int argc,
+ Jim_Obj * const *argv)
+{
+ if (argc != 2)
+ {
+ Jim_WrongNumArgs(interp, 1, argv, "peek ?address?");
+ return JIM_ERR;
+ }
+
+ long address;
+ if (Jim_GetLong(interp, argv[1], &address) != JIM_OK)
+ return JIM_ERR;
+
+ int value = *((volatile int *) address);
+
+ Jim_SetResult(interp, Jim_NewIntObj(interp, value));
+
+ return JIM_OK;
+}
+
+static int
+zylinjtag_Jim_Command_poke(Jim_Interp *interp,
+ int argc,
+ Jim_Obj * const *argv)
+{
+ if (argc != 3)
+ {
+ Jim_WrongNumArgs(interp, 1, argv, "poke ?address? ?value?");
+ return JIM_ERR;
+ }
+
+ long address;
+ if (Jim_GetLong(interp, argv[1], &address) != JIM_OK)
+ return JIM_ERR;
+ long value;
+ if (Jim_GetLong(interp, argv[2], &value) != JIM_OK)
+ return JIM_ERR;
+
+ *((volatile int *) address) = value;
+
+ return JIM_OK;
+}
+
+int ioutil_init(struct command_context_s *cmd_ctx)
+{
+ register_command(cmd_ctx, NULL, "rm", handle_rm_command, COMMAND_ANY,
+ "remove file");
+
+ register_command(cmd_ctx, NULL, "cat", handle_cat_command, COMMAND_ANY,
+ "display file content");
+
+ register_command(cmd_ctx, NULL, "trunc", handle_trunc_command, COMMAND_ANY,
+ "truncate a file to 0 size");
+
+ register_command(cmd_ctx, NULL, "cp", handle_cp_command,
+ COMMAND_ANY, "copy a file <from> <to>");
+
+ register_command(cmd_ctx, NULL, "append_file", handle_append_command,
+ COMMAND_ANY, "append a variable number of strings to a file");
+
+ register_command(cmd_ctx, NULL, "meminfo", handle_meminfo_command,
+ COMMAND_ANY, "display available ram memory");
+
+ Jim_CreateCommand(interp, "rm", zylinjtag_Jim_Command_rm, NULL, NULL);
+
+ Jim_CreateCommand(interp, "peek", zylinjtag_Jim_Command_peek, NULL, NULL);
+ Jim_CreateCommand(interp, "poke", zylinjtag_Jim_Command_poke, NULL, NULL);
+ Jim_CreateCommand(interp, "ls", zylinjtag_Jim_Command_ls, NULL, NULL);
+
+
+ return ERROR_OK;
+}
+
+
Modified: trunk/src/jtag/zy1000.c
===================================================================
--- trunk/src/jtag/zy1000.c 2008-12-15 09:43:26 UTC (rev 1242)
+++ trunk/src/jtag/zy1000.c 2008-12-15 11:32:22 UTC (rev 1243)
@@ -32,6 +32,12 @@
#include <stdlib.h>
+#define ZYLIN_VERSION "1.48"
+#define ZYLIN_DATE __DATE__
+#define ZYLIN_TIME __TIME__
+#define ZYLIN_OPENOCD "$Revision: 1241 $"
+#define ZYLIN_OPENOCD_VERSION "Zylin JTAG ZY1000 " ZYLIN_VERSION " " ZYLIN_DATE " " ZYLIN_TIME
+const char *zylin_config_dir="/config/settings";
extern int jtag_error;
@@ -223,7 +229,7 @@
{
if(speed > 8190 || speed < 2)
{
- LOG_ERROR("valid ZY1000 jtag_speed=[8190,2]. Divisor is 64MHz / even values between 8190-2, i.e. min 7814Hz, max 32MHz");
+ LOG_USER("valid ZY1000 jtag_speed=[8190,2]. Divisor is 64MHz / even values between 8190-2, i.e. min 7814Hz, max 32MHz");
return ERROR_INVALID_ARGUMENTS;
}
@@ -234,91 +240,124 @@
return ERROR_OK;
}
-int zy1000_register_commands(struct command_context_s *cmd_ctx)
+static bool savePower;
+
+
+static void setPower(bool power)
{
- return ERROR_OK;
+ savePower = power;
+ if (power)
+ {
+ HAL_WRITE_UINT32(ZY1000_JTAG_BASE+0x14, 0x8);
+ } else
+ {
+ HAL_WRITE_UINT32(ZY1000_JTAG_BASE+0x10, 0x8);
+ }
}
-
-int zy1000_init(void)
+int handle_power_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
- ZY1000_POKE(ZY1000_JTAG_BASE+0x10, 0x30); // Turn on LED1 & LED2
+ if (argc > 1)
+ {
+ return ERROR_INVALID_ARGUMENTS;
+ }
- /* deassert resets. Important to avoid infinite loop waiting for SRST to deassert */
- zy1000_reset(0, 0);
- zy1000_speed(jtag_speed);
+ if (argc == 1)
+ {
+ if (strcmp(args[0], "on") == 0)
+ {
+ setPower(1);
+ }
+ else if (strcmp(args[0], "off") == 0)
+ {
+ setPower(0);
+ } else
+ {
+ command_print(cmd_ctx, "arg is \"on\" or \"off\"");
+ return ERROR_INVALID_ARGUMENTS;
+ }
+ }
- bitbang_interface = &zy1000_bitbang;
+ command_print(cmd_ctx, "Target power %s", savePower ? "on" : "off");
return ERROR_OK;
}
-int zy1000_quit(void)
-{
- return ERROR_OK;
-}
-
-
-
-/* loads a file and returns a pointer to it in memory. The file contains
- * a 0 byte(sentinel) after len bytes - the length of the file. */
-int loadFile(const char *fileName, void **data, int *len)
+/* Give TELNET a way to find out what version this is */
+int handle_zy1000_version_command(struct command_context_s *cmd_ctx, char *cmd,
+ char **args, int argc)
{
- FILE * pFile;
- pFile = fopen(fileName,"rb");
- if (pFile==NULL)
+ if (argc > 1)
{
- LOG_ERROR("Can't open %s\n", fileName);
- return ERROR_JTAG_DEVICE_ERROR;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
- if (fseek(pFile, 0, SEEK_END)!=0)
+ if (argc == 0)
{
- LOG_ERROR("Can't open %s\n", fileName);
- fclose(pFile);
- return ERROR_JTAG_DEVICE_ERROR;
+ command_print(cmd_ctx, ZYLIN_OPENOCD_VERSION);
}
- *len=ftell(pFile);
- if (*len==-1)
+ else if (strcmp("openocd", args[0]) == 0)
{
- LOG_ERROR("Can't open %s\n", fileName);
- fclose(pFile);
- return ERROR_JTAG_DEVICE_ERROR;
+ int revision;
+ revision = atol(ZYLIN_OPENOCD+strlen("XRevision: "));
+ command_print(cmd_ctx, "%d", revision);
}
-
- if (fseek(pFile, 0, SEEK_SET)!=0)
+ else if (strcmp("zy1000", args[0]) == 0)
{
- LOG_ERROR("Can't open %s\n", fileName);
- fclose(pFile);
- return ERROR_JTAG_DEVICE_ERROR;
+ command_print(cmd_ctx, "%s", ZYLIN_VERSION);
}
- *data=malloc(*len+1);
- if (*data==NULL)
+ else if (strcmp("date", args[0]) == 0)
{
- LOG_ERROR("Can't open %s\n", fileName);
- fclose(pFile);
- return ERROR_JTAG_DEVICE_ERROR;
+ command_print(cmd_ctx, "%s", ZYLIN_DATE);
}
-
- if (fread(*data, 1, *len, pFile)!=*len)
+ else
{
- fclose(pFile);
- free(*data);
- LOG_ERROR("Can't open %s\n", fileName);
- return ERROR_JTAG_DEVICE_ERROR;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
- fclose(pFile);
- *(((char *)(*data))+*len)=0; /* sentinel */
return ERROR_OK;
+}
+int zy1000_register_commands(struct command_context_s *cmd_ctx)
+{
+ register_command(cmd_ctx, NULL, "power", handle_power_command, COMMAND_ANY,
+ "power <on/off> - turn power switch to target on/off. No arguments - print status.");
+ register_command(cmd_ctx, NULL, "zy1000_version", handle_zy1000_version_command,
+ COMMAND_EXEC, "show zy1000 version numbers");
+
+ return ERROR_OK;
}
+int zy1000_init(void)
+{
+ LOG_ERROR("%s\n", ZYLIN_OPENOCD_VERSION);
+ ZY1000_POKE(ZY1000_JTAG_BASE+0x10, 0x30); // Turn on LED1 & LED2
+ setPower(true); // on by default
+
+
+ /* deassert resets. Important to avoid infinite loop waiting for SRST to deassert */
+ zy1000_reset(0, 0);
+ zy1000_speed(jtag_speed);
+
+ bitbang_interface = &zy1000_bitbang;
+
+ return ERROR_OK;
+}
+
+int zy1000_quit(void)
+{
+
+ return ERROR_OK;
+}
+
+
+
+
int interface_jtag_execute_queue(void)
{
cyg_uint32 empty;
@@ -703,7 +742,7 @@
}
else
{
- LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(path[state_count)]);
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(path[state_count]));
exit(-1);
}
@@ -760,3 +799,25 @@
}
}
+int loadFile(const char *fileName, void **data, int *len);
+
+/* boolean parameter stored on config */
+int boolParam(char *var)
+{
+ bool result = false;
+ char *name = alloc_printf("%s/%s", zylin_config_dir, var);
+ if (name == NULL)
+ return result;
+
+ void *data;
+ int len;
+ if (loadFile(name, &data, &len) == ERROR_OK)
+ {
+ if (len > 1)
+ len = 1;
+ result = strncmp((char *) data, "1", len) == 0;
+ free(data);
+ }
+ free(name);
+ return result;
+}
Modified: trunk/src/openocd.c
===================================================================
--- trunk/src/openocd.c 2008-12-15 09:43:26 UTC (rev 1242)
+++ trunk/src/openocd.c 2008-12-15 11:32:22 UTC (rev 1243)
@@ -118,6 +118,8 @@
return ERROR_OK;
}
+int ioutil_init(struct command_context_s *cmd_ctx);
+
/* OpenOCD can't really handle failure of this command. Patches welcome! :-) */
int handle_init_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
@@ -130...
[truncated message content] |
|
From: ntfreak at B. <nt...@ma...> - 2008-12-15 10:43:27
|
Author: ntfreak
Date: 2008-12-15 10:43:26 +0100 (Mon, 15 Dec 2008)
New Revision: 1242
Modified:
trunk/doc/openocd.texi
trunk/src/helper/Makefile.am
trunk/src/helper/log.c
trunk/src/helper/options.c
trunk/src/server/gdb_server.c
trunk/src/server/server.c
trunk/src/server/server.h
trunk/src/server/tcl_server.c
trunk/src/server/telnet_server.c
trunk/src/target/target.c
Log:
- add ability for openocd to communicate to gdb using pipes (stdin/stdout).
- this is enabled by new command line option option --pipe.
Modified: trunk/doc/openocd.texi
===================================================================
--- trunk/doc/openocd.texi 2008-12-15 09:05:16 UTC (rev 1241)
+++ trunk/doc/openocd.texi 2008-12-15 09:43:26 UTC (rev 1242)
@@ -15,7 +15,7 @@
@itemize @bullet
@item Copyright @copyright{} 2008 The OpenOCD Project
-@item Copyright @copyright{} 2007-2008 Spen @email{spen@@spen-soft.co.uk}
+@item Copyright @copyright{} 2007-2008 Spencer Oliver @email{spen@@spen-soft.co.uk}
@item Copyright @copyright{} 2008 Oyvind Harboe @email{oyvind.harboe@@zylin.com}
@item Copyright @copyright{} 2008 Duane Ellis @email{openocd@@duaneellis.com}
@end itemize
@@ -411,9 +411,10 @@
--debug | -d set debug level <0-3>
--log_output | -l redirect log output to file <name>
--command | -c run <command>
+--pipe | -p use pipes when talking to gdb
@end verbatim
-By default openocd reads the file configuration file ``openocd.cfg''
+By default OpenOCD reads the file configuration file ``openocd.cfg''
in the current directory. To specify a different (or multiple)
configuration file, you can use the ``-f'' option. For example:
@@ -445,6 +446,9 @@
the @option{-s <search>} switch. The current directory and the OpenOCD
target library is in the search path by default.
+For details on the @option{-p} option. @xref{Connecting to GDB}.
+Option @option{-p} is not currently supported under native win32.
+
Note! OpenOCD will launch the GDB & telnet server even if it can not
establish a connection with the target. In general, it is possible for
the JTAG controller to be unresponsive until the target is set up
@@ -455,7 +459,7 @@
@cindex configuration
@section Outline
-There are 4 basic ways of ``configurating'' openocd to run, they are:
+There are 4 basic ways of ``configurating'' OpenOCD to run, they are:
@enumerate
@item A small openocd.cfg file which ``sources'' other configuration files
@@ -671,7 +675,7 @@
every chip. If the @t{-expected-id} is nonzero, OpenOCD attempts
to verify the tap id number verses configuration file and may issue an
error or warning like this. The hope is this will help pin point
-problem openocd configurations.
+problem OpenOCD configurations.
@example
Info: JTAG tap: sam7x256.cpu tap/device found: 0x3f0f0f0f (Manufacturer: 0x787, Part: 0xf0f0, Version: 0x3)
@@ -904,7 +908,7 @@
JIM-Tcl commands, and (older) the orginal command interpretor.
@item @b{Commands}
-@* At the openocd telnet command line (or via the GDB mon command) one
+@* At the OpenOCD telnet command line (or via the GDB mon command) one
can type a Tcl for() loop, set variables, etc.
@item @b{Historical Note}
@@ -1145,7 +1149,7 @@
@b{TODO:} Confirm the following: On windows the name needs to end with
a ``space A''? Or not? It has to do with the FTD2xx driver. When must
this be added and when must it not be added? Why can't the code in the
-interface or in openocd automatically add this if needed? -- Duane.
+interface or in OpenOCD automatically add this if needed? -- Duane.
@item @b{ft2232_serial} <@var{serial-number}>
@cindex ft2232_serial
@@ -1527,7 +1531,7 @@
circuit and skipped.
-From OpenOCDs view point, a JTAG TAP is in one of 3 states:
+From OpenOCD's view point, a JTAG TAP is in one of 3 states:
@itemize @bullet
@item @b{Enabled - Not In ByPass} and has a variable bit length
@@ -1640,7 +1644,7 @@
puts [format "The button is %s" $x]
@end example
-In OpenOCDs terms, the ``target'' is an object just like a Tcl/Tk
+In OpenOCD's terms, the ``target'' is an object just like a Tcl/Tk
button. Commands avaialble as a ``target object'' are:
@comment START targetobj commands.
@@ -1841,7 +1845,7 @@
@item @b{-work-area-size [ADDRESS]} specify/set the work area
@item @b{-work-area-backup [0|1]} does the work area get backed up
@item @b{-endian [big|little]}
-@item @b{-variant [NAME]} some chips have varients openocd needs to know about
+@item @b{-variant [NAME]} some chips have varients OpenOCD needs to know about
@item @b{-chain-position DOTTED.NAME} the tap name this target refers to.
@end itemize
Example:
@@ -1870,7 +1874,7 @@
@* None (this is also used as the ARM946)
@item @b{cortex_m3}
@* use variant <@var{-variant lm3s}> when debugging luminary lm3s targets. This will cause
-openocd to use a software reset rather than asserting SRST to avoid a issue with clearing
+OpenOCD to use a software reset rather than asserting SRST to avoid a issue with clearing
the debug registers. This is fixed in Fury Rev B, DustDevil Rev B, Tempest, these revisions will
be detected and the normal reset behaviour used.
@item @b{xscale}
@@ -1880,9 +1884,9 @@
@item @b{mips_m4k}
@* Use variant @option{ejtag_srst} when debugging targets that do not
provide a functional SRST line on the EJTAG connector. This causes
-openocd to instead use an EJTAG software reset command to reset the
+OpenOCD to instead use an EJTAG software reset command to reset the
processor. You still need to enable @option{srst} on the reset
-configuration command to enable openocd hardware reset functionality.
+configuration command to enable OpenOCD hardware reset functionality.
@comment END varients
@end itemize
@section working_area - Command Removed
@@ -2004,7 +2008,7 @@
@end itemize
@section flash bank command
-The @b{flash bank} command is used to configure one or more flash chips (or banks in openocd terms)
+The @b{flash bank} command is used to configure one or more flash chips (or banks in OpenOCD terms)
@example
@b{flash bank} <@var{driver}> <@var{base}> <@var{size}> <@var{chip_width}>
@@ -2170,7 +2174,7 @@
@end itemize
Note: Before using the str9xpec driver here is some background info to help
-you better understand how the drivers works. Openocd has two flash drivers for
+you better understand how the drivers works. OpenOCD has two flash drivers for
the str9.
@enumerate
@item
@@ -2793,41 +2797,52 @@
OpenOCD complies with the remote gdbserver protocol, and as such can be used
to debug remote targets.
-@section Connecting to gdb
-@cindex Connecting to gdb
+@section Connecting to GDB
+@cindex Connecting to GDB
+@anchor{Connecting to GDB}
Use GDB 6.7 or newer with OpenOCD if you run into trouble. For
instance 6.3 has a known bug where it produces bogus memory access
errors, which has since been fixed: look up 1836 in
@url{http://sourceware.org/cgi-bin/gnatsweb.pl?database=gdb}
-
-A connection is typically started as follows:
+@*OpenOCD can communicate with GDB in two ways:
+@enumerate
+@item
+A socket (tcp) connection is typically started as follows:
@example
target remote localhost:3333
@end example
-This would cause gdb to connect to the gdbserver on the local pc using port 3333.
+This would cause GDB to connect to the gdbserver on the local pc using port 3333.
+@item
+A pipe connection is typically started as follows:
+@example
+target remote openocd --pipe
+@end example
+This would cause GDB to run OpenOCD and communicate using pipes (stdin/stdout).
+Using this method has the advantage of GDB starting/stopping OpenOCD for debug session.
+@end enumerate
-To see a list of available OpenOCD commands type @option{monitor help} on the
-gdb commandline.
+@*To see a list of available OpenOCD commands type @option{monitor help} on the
+GDB commandline.
OpenOCD supports the gdb @option{qSupported} packet, this enables information
-to be sent by the gdb server (openocd) to gdb. Typical information includes
+to be sent by the gdb server (OpenOCD) to GDB. Typical information includes
packet size and device memory map.
-Previous versions of OpenOCD required the following gdb options to increase
-the packet size and speed up gdb communication.
+Previous versions of OpenOCD required the following GDB options to increase
+the packet size and speed up GDB communication.
@example
set remote memory-write-packet-size 1024
set remote memory-write-packet-size fixed
set remote memory-read-packet-size 1024
set remote memory-read-packet-size fixed
@end example
-This is now handled in the @option{qSupported} PacketSize.
+This is now handled in the @option{qSupported} PacketSize and should not be required.
-@section Programming using gdb
-@cindex Programming using gdb
+@section Programming using GDB
+@cindex Programming using GDB
-By default the target memory map is sent to gdb, this can be disabled by
+By default the target memory map is sent to GDB, this can be disabled by
the following OpenOCD config option:
@example
gdb_memory_map disable
@@ -2836,34 +2851,34 @@
in OpenOCD. For faster performance you should also configure a valid
working area.
-Informing gdb of the memory map of the target will enable gdb to protect any
+Informing GDB of the memory map of the target will enable GDB to protect any
flash area of the target and use hardware breakpoints by default. This means
that the OpenOCD option @option{gdb_breakpoint_override} is not required when
using a memory map. @xref{gdb_breakpoint_override}.
-To view the configured memory map in gdb, use the gdb command @option{info mem}
-All other unasigned addresses within gdb are treated as RAM.
+To view the configured memory map in GDB, use the gdb command @option{info mem}
+All other unasigned addresses within GDB are treated as RAM.
GDB 6.8 and higher set any memory area not in the memory map as inaccessible,
-this can be changed to the old behaviour by using the following gdb command.
+this can be changed to the old behaviour by using the following GDB command.
@example
set mem inaccessible-by-default off
@end example
-If @option{gdb_flash_program enable} is also used, gdb will be able to
+If @option{gdb_flash_program enable} is also used, GDB will be able to
program any flash memory using the vFlash interface.
-gdb will look at the target memory map when a load command is given, if any
+GDB will look at the target memory map when a load command is given, if any
areas to be programmed lie within the target flash area the vFlash packets
will be used.
-If the target needs configuring before gdb programming, an event
+If the target needs configuring before GDB programming, an event
script can be executed.
@example
$_TARGETNAME configure -event EVENTNAME BODY
@end example
-To verify any flash programming the gdb command @option{compare-sections}
+To verify any flash programming the GDB command @option{compare-sections}
can be used.
@node TCL scripting API
@@ -3598,7 +3613,7 @@
OpenOCD comes with a target configuration script library. These scripts can be
used as-is or serve as a starting point.
-The target library is published together with the openocd executable and
+The target library is published together with the OpenOCD executable and
the path to the target library is in the OpenOCD script search path.
Similarly there are example scripts for configuring the JTAG interface.
Modified: trunk/src/helper/Makefile.am
===================================================================
--- trunk/src/helper/Makefile.am 2008-12-15 09:05:16 UTC (rev 1241)
+++ trunk/src/helper/Makefile.am 2008-12-15 09:43:26 UTC (rev 1242)
@@ -1,4 +1,4 @@
-INCLUDES = -I$(top_srcdir)/src $(all_includes) -I$(top_srcdir)/src/target
+INCLUDES = -I$(top_srcdir)/src $(all_includes) -I$(top_srcdir)/src/target -I$(top_srcdir)/src/server
METASOURCES = AUTO
AM_CPPFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" -DPKGLIBDIR=\"$(pkglibdir)\" @CPPFLAGS@
noinst_LIBRARIES = libhelper.a
Modified: trunk/src/helper/log.c
===================================================================
--- trunk/src/helper/log.c 2008-12-15 09:05:16 UTC (rev 1241)
+++ trunk/src/helper/log.c 2008-12-15 09:43:26 UTC (rev 1242)
@@ -31,6 +31,7 @@
#include "configuration.h"
#include "time_support.h"
#include "command.h"
+#include "server.h"
#include <stdio.h>
#include <stdlib.h>
@@ -108,9 +109,11 @@
#endif
string);
}
- else
+ else if(server_use_pipes == 0)
{
- if (strcmp(string, "\n")!=0)
+ /* if we are using gdb through pipes then we do not want any output
+ * to the pipe otherwise we get repeated strings */
+ if (strcmp(string, "\n") != 0)
{
/* print human readable output - but skip empty lines */
fprintf(log_output, "%s%s",
@@ -203,6 +206,18 @@
if (debug_level > 3)
debug_level = 3;
+ if (debug_level >= LOG_LVL_DEBUG && server_use_pipes == 1)
+ {
+ /* if we are enabling debug info then we need to write to a log file
+ * otherwise the pipe will get full and cause issues with gdb */
+ FILE* file = fopen("openocd.log", "w");
+ if (file)
+ {
+ log_output = file;
+ LOG_WARNING("enabling log output as we are using pipes");
+ }
+ }
+
return ERROR_OK;
}
Modified: trunk/src/helper/options.c
===================================================================
--- trunk/src/helper/options.c 2008-12-15 09:05:16 UTC (rev 1241)
+++ trunk/src/helper/options.c 2008-12-15 09:43:26 UTC (rev 1242)
@@ -24,10 +24,13 @@
#include "config.h"
#endif
+#include "replacements.h"
+
#include "types.h"
#include "command.h"
#include "configuration.h"
#include "log.h"
+#include "server.h"
#include <stdio.h>
#include <stdlib.h>
@@ -43,8 +46,9 @@
{"debug", optional_argument, 0, 'd'},
{"file", required_argument, 0, 'f'},
{"search", required_argument, 0, 's'},
- {"log_output", required_argument, 0, 'l'},
+ {"log_output", required_argument, 0, 'l'},
{"command", required_argument, 0, 'c'},
+ {"pipe", no_argument, 0, 'p'},
{0, 0, 0, 0}
};
@@ -95,7 +99,7 @@
/* getopt_long stores the option index here. */
int option_index = 0;
- c = getopt_long(argc, argv, "hvd::l:f:s:c:", long_options, &option_index);
+ c = getopt_long(argc, argv, "hvd::l:f:s:c:p", long_options, &option_index);
/* Detect the end of the options. */
if (c == -1)
@@ -140,7 +144,20 @@
add_config_command(optarg);
}
break;
-
+ case 'p': /* --pipe | -p */
+#if BUILD_ECOSBOARD == 1
+ /* pipes unsupported on hosted platforms */
+ LOG_WARNING("pipes not supported on this platform");
+#else
+#ifdef IS_MINGW
+ /* pipes currently unsupported on win32 */
+ LOG_WARNING("pipes currently unsupported on win32");
+ exit(1);
+#else
+ server_use_pipes = 1;
+#endif
+#endif
+ break;
}
}
@@ -154,6 +171,7 @@
LOG_OUTPUT("--debug | -d\tset debug level <0-3>\n");
LOG_OUTPUT("--log_output | -l\tredirect log output to file <name>\n");
LOG_OUTPUT("--command | -c\trun <command>\n");
+ LOG_OUTPUT("--pipe | -p\tuse pipes for gdb communication\n");
exit(-1);
}
@@ -161,7 +179,7 @@
{
/* Nothing to do, version gets printed automatically. */
exit(-1);
- }
-
+ }
+
return ERROR_OK;
}
Modified: trunk/src/server/gdb_server.c
===================================================================
--- trunk/src/server/gdb_server.c 2008-12-15 09:05:16 UTC (rev 1241)
+++ trunk/src/server/gdb_server.c 2008-12-15 09:43:26 UTC (rev 1242)
@@ -169,10 +169,18 @@
for (;;)
{
- retval=check_pending(connection, 1, NULL);
- if (retval!=ERROR_OK)
- return retval;
- gdb_con->buf_cnt = read_socket(connection->fd, gdb_con->buffer, GDB_BUFFER_SIZE);
+ if (connection->service->type == CONNECTION_PIPE)
+ {
+ gdb_con->buf_cnt = read(connection->fd, gdb_con->buffer, GDB_BUFFER_SIZE);
+ }
+ else
+ {
+ retval = check_pending(connection, 1, NULL);
+ if (retval != ERROR_OK)
+ return retval;
+ gdb_con->buf_cnt = read_socket(connection->fd, gdb_con->buffer, GDB_BUFFER_SIZE);
+ }
+
if (gdb_con->buf_cnt > 0)
{
break;
@@ -268,11 +276,22 @@
gdb_connection_t *gdb_con = connection->priv;
if (gdb_con->closed)
return ERROR_SERVER_REMOTE_CLOSED;
-
- if (write_socket(connection->fd, data, len) == len)
+
+ if (connection->service->type == CONNECTION_PIPE)
{
- return ERROR_OK;
+ /* write to stdout */
+ if (write(STDOUT_FILENO, data, len) == len)
+ {
+ return ERROR_OK;
+ }
}
+ else
+ {
+ if (write_socket(connection->fd, data, len) == len)
+ {
+ return ERROR_OK;
+ }
+ }
gdb_con->closed = 1;
return ERROR_SERVER_REMOTE_CLOSED;
}
@@ -2158,7 +2177,7 @@
if (retval == ERROR_SERVER_REMOTE_CLOSED)
return retval;
- /* logging does not propagate the error, yet can set th gdb_con->closed flag */
+ /* logging does not propagate the error, yet can set the gdb_con->closed flag */
if (gdb_con->closed)
return ERROR_SERVER_REMOTE_CLOSED;
@@ -2177,34 +2196,37 @@
return ERROR_OK;
}
- if (gdb_port == 0)
+ if (gdb_port == 0 && server_use_pipes == 0)
{
LOG_WARNING("no gdb port specified, using default port 3333");
gdb_port = 3333;
}
- while (target)
+ if (server_use_pipes)
{
- char service_name[8];
-
- snprintf(service_name, 8, "gdb-%2.2i", target->target_number);
-
+ /* only a single gdb connection when using a pipe */
+
gdb_service = malloc(sizeof(gdb_service_t));
gdb_service->target = target;
- add_service("gdb", CONNECTION_GDB,
- gdb_port + target->target_number,
- 1, gdb_new_connection, gdb_input,
- gdb_connection_closed,
- gdb_service);
+ add_service("gdb", CONNECTION_PIPE, 0, 1, gdb_new_connection, gdb_input, gdb_connection_closed, gdb_service);
- LOG_DEBUG("gdb service for target %s at port %i",
- target->type->name,
- gdb_port + target->target_number);
+ LOG_DEBUG("gdb service for target %s using pipes", target->type->name);
+ }
+ else
+ {
+ while (target)
+ {
+ gdb_service = malloc(sizeof(gdb_service_t));
+ gdb_service->target = target;
- target = target->next;
+ add_service("gdb", CONNECTION_TCP, gdb_port + target->target_number, 1, gdb_new_connection, gdb_input, gdb_connection_closed, gdb_service);
+
+ LOG_DEBUG("gdb service for target %s at port %i", target->type->name, gdb_port + target->target_number);
+ target = target->next;
+ }
}
-
+
return ERROR_OK;
}
Modified: trunk/src/server/server.c
===================================================================
--- trunk/src/server/server.c 2008-12-15 09:05:16 UTC (rev 1241)
+++ trunk/src/server/server.c 2008-12-15 09:43:26 UTC (rev 1242)
@@ -53,6 +53,9 @@
static int shutdown_openocd = 0;
int handle_shutdown_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+/* set when using pipes rather than tcp */
+int server_use_pipes = 0;
+
int add_connection(service_t *service, command_context_t *cmd_ctx)
{
unsigned int address_size;
@@ -69,28 +72,44 @@
c->priv = NULL;
c->next = NULL;
- address_size = sizeof(c->sin);
-
- c->fd = accept(service->fd, (struct sockaddr *)&service->sin, &address_size);
-
- /* This increases performance dramatically for e.g. GDB load which
- * does not have a sliding window protocol. */
- retval=setsockopt(c->fd, /* socket affected */
- IPPROTO_TCP, /* set option at TCP level */
- TCP_NODELAY, /* name of option */
- (char *)&flag, /* the cast is historical cruft */
- sizeof(int)); /* length of option value */
+ if (service->type == CONNECTION_TCP)
+ {
+ address_size = sizeof(c->sin);
- LOG_INFO("accepting '%s' connection from %i", service->name, c->sin.sin_port);
- if ((retval = service->new_connection(c)) == ERROR_OK)
- {
+ c->fd = accept(service->fd, (struct sockaddr *)&service->sin, &address_size);
+
+ /* This increases performance dramatically for e.g. GDB load which
+ * does not have a sliding window protocol. */
+ retval=setsockopt(c->fd, /* socket affected */
+ IPPROTO_TCP, /* set option at TCP level */
+ TCP_NODELAY, /* name of option */
+ (char *)&flag, /* the cast is historical cruft */
+ sizeof(int)); /* length of option value */
+
+ LOG_INFO("accepting '%s' connection from %i", service->name, c->sin.sin_port);
+ if ((retval = service->new_connection(c)) != ERROR_OK)
+ {
+ close_socket(c->fd);
+ LOG_ERROR("attempted '%s' connection rejected", service->name);
+ free(c);
+ return retval;
+ }
}
- else
+ else if (service->type == CONNECTION_PIPE)
{
- close_socket(c->fd);
- LOG_ERROR("attempted '%s' connection rejected", service->name);
- free(c);
- return retval;
+#ifndef _WIN32
+ c->fd = service->fd;
+
+ /* do not check for new connections again on stdin */
+ service->fd = -1;
+#endif
+ LOG_INFO("accepting '%s' connection from pipe", service->name);
+ if ((retval = service->new_connection(c)) != ERROR_OK)
+ {
+ LOG_ERROR("attempted '%s' connection rejected", service->name);
+ free(c);
+ return retval;
+ }
}
/* add to the end of linked list */
@@ -113,7 +132,8 @@
if (c->fd == connection->fd)
{
service->connection_closed(c);
- close_socket(c->fd);
+ if (service->type == CONNECTION_TCP)
+ close_socket(c->fd);
command_done(c->cmd_ctx);
/* delete connection */
@@ -150,45 +170,68 @@
c->priv = priv;
c->next = NULL;
- if ((c->fd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
+ if (type == CONNECTION_TCP)
{
- LOG_ERROR("error creating socket: %s", strerror(errno));
- exit(-1);
- }
-
- setsockopt(c->fd, SOL_SOCKET, SO_REUSEADDR, (void*)&so_reuseaddr_option, sizeof(int));
-
- socket_nonblock(c->fd);
-
- memset(&c->sin, 0, sizeof(c->sin));
- c->sin.sin_family = AF_INET;
- c->sin.sin_addr.s_addr = INADDR_ANY;
- c->sin.sin_port = htons(port);
-
- if (bind(c->fd, (struct sockaddr *)&c->sin, sizeof(c->sin)) == -1)
- {
- LOG_ERROR("couldn't bind to socket: %s", strerror(errno));
- exit(-1);
- }
-
+ if ((c->fd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
+ {
+ LOG_ERROR("error creating socket: %s", strerror(errno));
+ exit(-1);
+ }
+
+ setsockopt(c->fd, SOL_SOCKET, SO_REUSEADDR, (void*)&so_reuseaddr_option, sizeof(int));
+
+ socket_nonblock(c->fd);
+
+ memset(&c->sin, 0, sizeof(c->sin));
+ c->sin.sin_family = AF_INET;
+ c->sin.sin_addr.s_addr = INADDR_ANY;
+ c->sin.sin_port = htons(port);
+
+ if (bind(c->fd, (struct sockaddr *)&c->sin, sizeof(c->sin)) == -1)
+ {
+ LOG_ERROR("couldn't bind to socket: %s", strerror(errno));
+ exit(-1);
+ }
+
#ifndef _WIN32
- int segsize=65536;
- setsockopt(c->fd, IPPROTO_TCP, TCP_MAXSEG, &segsize, sizeof(int));
+ int segsize=65536;
+ setsockopt(c->fd, IPPROTO_TCP, TCP_MAXSEG, &segsize, sizeof(int));
#endif
- int window_size = 128 * 1024;
-
- /* These setsockopt()s must happen before the listen() */
+ int window_size = 128 * 1024;
- setsockopt(c->fd, SOL_SOCKET, SO_SNDBUF,
- (char *)&window_size, sizeof(window_size));
- setsockopt(c->fd, SOL_SOCKET, SO_RCVBUF,
- (char *)&window_size, sizeof(window_size));
-
- if (listen(c->fd, 1) == -1)
+ /* These setsockopt()s must happen before the listen() */
+
+ setsockopt(c->fd, SOL_SOCKET, SO_SNDBUF,
+ (char *)&window_size, sizeof(window_size));
+ setsockopt(c->fd, SOL_SOCKET, SO_RCVBUF,
+ (char *)&window_size, sizeof(window_size));
+
+ if (listen(c->fd, 1) == -1)
+ {
+ LOG_ERROR("couldn't listen on socket: %s", strerror(errno));
+ exit(-1);
+ }
+ }
+ else if (type == CONNECTION_PIPE)
{
- LOG_ERROR("couldn't listen on socket: %s", strerror(errno));
- exit(-1);
+ /* use stdin */
+ c->fd = STDIN_FILENO;
+
+#ifdef _WIN32
+ /* for win32 set stdin/stdout to binary mode */
+ if (_setmode(_fileno(stdout), _O_BINARY) < 0)
+ LOG_WARNING("cannot change stdout mode to binary");
+ if (_setmode(_fileno(stdin), _O_BINARY) < 0)
+ LOG_WARNING("cannot change stdin mode to binary");
+#else
+ socket_nonblock(c->fd);
+#endif
}
+ else
+ {
+ LOG_ERROR("unknown connection type: %d", type);
+ exit(1);
+ }
/* add to the end of linked list */
for (p = &services; *p; p = &(*p)->next);
@@ -310,14 +353,18 @@
#ifndef _WIN32
#if BUILD_ECOSBOARD == 0
- /* add STDIN to read_fds */
- FD_SET(fileno(stdin), &read_fds);
+ if (server_use_pipes == 0)
+ {
+ /* add STDIN to read_fds */
+ FD_SET(fileno(stdin), &read_fds);
+ }
#endif
#endif
openocd_sleep_prelude();
kept_alive();
- // Only while we're sleeping we'll let others run
+
+ /* Only while we're sleeping we'll let others run */
retval = select(fd_max + 1, &read_fds, NULL, NULL, &tv);
openocd_sleep_postlude();
@@ -371,11 +418,14 @@
}
else
{
- struct sockaddr_in sin;
- unsigned int address_size = sizeof(sin);
- int tmp_fd;
- tmp_fd = accept(service->fd, (struct sockaddr *)&service->sin, &address_size);
- close_socket(tmp_fd);
+ if (service->type != CONNECTION_PIPE)
+ {
+ struct sockaddr_in sin;
+ unsigned int address_size = sizeof(sin);
+ int tmp_fd;
+ tmp_fd = accept(service->fd, (struct sockaddr *)&service->sin, &address_size);
+ close_socket(tmp_fd);
+ }
LOG_INFO("rejected '%s' connection, no more connections allowed", service->name);
}
}
@@ -389,11 +439,16 @@
{
if ((FD_ISSET(c->fd, &read_fds)) || c->input_pending)
{
- if (service->input(c) != ERROR_OK)
+ if ((retval = service->input(c)) != ERROR_OK)
{
connection_t *next = c->next;
+ if (service->type == CONNECTION_PIPE)
+ {
+ /* if connection uses a pipe then shutdown openocd on error */
+ shutdown_openocd = 1;
+ }
remove_connection(service, c);
- LOG_INFO("dropped '%s' connection", service->name);
+ LOG_INFO("dropped '%s' connection - error %d", service->name, retval);
c = next;
continue;
}
@@ -405,11 +460,15 @@
#ifndef _WIN32
#if BUILD_ECOSBOARD == 0
- if (FD_ISSET(fileno(stdin), &read_fds))
+ /* check for data on stdin if not using pipes */
+ if (server_use_pipes == 0)
{
- if (getc(stdin) == 'x')
+ if (FD_ISSET(fileno(stdin), &read_fds))
{
- shutdown_openocd = 1;
+ if (getc(stdin) == 'x')
+ {
+ shutdown_openocd = 1;
+ }
}
}
#endif
@@ -459,7 +518,6 @@
signal(SIGBREAK, sig_handler);
signal(SIGABRT, sig_handler);
#endif
-
return ERROR_OK;
}
Modified: trunk/src/server/server.h
===================================================================
--- trunk/src/server/server.h 2008-12-15 09:05:16 UTC (rev 1241)
+++ trunk/src/server/server.h 2008-12-15 09:43:26 UTC (rev 1242)
@@ -34,9 +34,8 @@
enum connection_type
{
- CONNECTION_GDB,
- CONNECTION_TELNET,
- CONNECTION_TCL,
+ CONNECTION_TCP,
+ CONNECTION_PIPE
};
typedef struct connection_s
@@ -76,6 +75,8 @@
extern int server_loop(command_context_t *command_context);
extern int server_register_commands(command_context_t *context);
+extern int server_use_pipes;
+
#define ERROR_SERVER_REMOTE_CLOSED (-400)
#define ERROR_CONNECTION_REJECTED (-401)
Modified: trunk/src/server/tcl_server.c
===================================================================
--- trunk/src/server/tcl_server.c 2008-12-15 09:05:16 UTC (rev 1241)
+++ trunk/src/server/tcl_server.c 2008-12-15 09:43:26 UTC (rev 1242)
@@ -179,7 +179,7 @@
tcl_port = 6666;
}
- retval = add_service("tcl", CONNECTION_TCL, tcl_port, 1, tcl_new_connection, tcl_input, tcl_closed, NULL);
+ retval = add_service("tcl", CONNECTION_TCP, tcl_port, 1, tcl_new_connection, tcl_input, tcl_closed, NULL);
return retval;
}
Modified: trunk/src/server/telnet_server.c
===================================================================
--- trunk/src/server/telnet_server.c 2008-12-15 09:05:16 UTC (rev 1241)
+++ trunk/src/server/telnet_server.c 2008-12-15 09:43:26 UTC (rev 1242)
@@ -615,7 +615,7 @@
telnet_service->banner = banner;
- add_service("telnet", CONNECTION_TELNET, telnet_port, 1, telnet_new_connection, telnet_input, telnet_connection_closed, telnet_service);
+ add_service("telnet", CONNECTION_TCP, telnet_port, 1, telnet_new_connection, telnet_input, telnet_connection_closed, telnet_service);
return ERROR_OK;
}
Modified: trunk/src/target/target.c
===================================================================
--- trunk/src/target/target.c 2008-12-15 09:05:16 UTC (rev 1241)
+++ trunk/src/target/target.c 2008-12-15 09:43:26 UTC (rev 1242)
@@ -232,7 +232,6 @@
{ .name = NULL, .value = -1 },
};
-
const Jim_Nvp nvp_target_endian[] = {
{ .name = "big", .value = TARGET_BIG_ENDIAN },
{ .name = "little", .value = TARGET_LITTLE_ENDIAN },
@@ -249,8 +248,7 @@
{ .name = NULL , .value = -1 },
};
-static int
-max_target_number( void )
+static int max_target_number(void)
{
target_t *t;
int x;
@@ -267,8 +265,7 @@
}
/* determine the number of the new target */
-static int
-new_target_number( void )
+static int new_target_number(void)
{
target_t *t;
int x;
|
|
From: <oh...@ma...> - 2008-12-15 10:05:19
|
Author: oharboe
Date: 2008-12-15 10:05:16 +0100 (Mon, 15 Dec 2008)
New Revision: 1241
Modified:
trunk/src/ecosboard.c
trunk/src/target/target.c
Log:
fast_load profiling tool moved to target.c
Modified: trunk/src/ecosboard.c
===================================================================
--- trunk/src/ecosboard.c 2008-12-14 20:33:01 UTC (rev 1240)
+++ trunk/src/ecosboard.c 2008-12-15 09:05:16 UTC (rev 1241)
@@ -121,197 +121,7 @@
char hwaddr[512];
-struct FastLoad
-{
- u32 address;
- u8 *data;
- int length;
-};
-
-static int fastload_num;
-static struct FastLoad *fastload;
-
-static void free_fastload()
-{
- if (fastload!=NULL)
- {
- int i;
- for (i=0; i<fastload_num; i++)
- {
- if (fastload[i].data)
- free(fastload[i].data);
- }
- free(fastload);
- fastload=NULL;
- }
-}
-
-
-int handle_fast_load_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
-{
- u8 *buffer;
- u32 buf_cnt;
- u32 image_size;
- u32 min_address=0;
- u32 max_address=0xffffffff;
- int i;
- int retval;
-
- image_t image;
-
- duration_t duration;
- char *duration_text;
-
- if ((argc < 1)||(argc > 5))
- {
- return ERROR_COMMAND_SYNTAX_ERROR;
- }
-
- /* a base address isn't always necessary, default to 0x0 (i.e. don't relocate) */
- if (argc >= 2)
- {
- image.base_address_set = 1;
- image.base_address = strtoul(args[1], NULL, 0);
- }
- else
- {
- image.base_address_set = 0;
- }
-
-
- image.start_address_set = 0;
-
- if (argc>=4)
- {
- min_address=strtoul(args[3], NULL, 0);
- }
- if (argc>=5)
- {
- max_address=strtoul(args[4], NULL, 0)+min_address;
- }
-
- if (min_address>max_address)
- {
- return ERROR_COMMAND_SYNTAX_ERROR;
- }
-
- duration_start_measure(&duration);
-
- if (image_open(&image, args[0], (argc >= 3) ? args[2] : NULL) != ERROR_OK)
- {
- return ERROR_OK;
- }
-
- image_size = 0x0;
- retval = ERROR_OK;
- fastload_num=image.num_sections;
- fastload=(struct FastLoad *)malloc(sizeof(struct FastLoad)*image.num_sections);
- if (fastload==NULL)
- {
- image_close(&image);
- return ERROR_FAIL;
- }
- memset(fastload, 0, sizeof(struct FastLoad)*image.num_sections);
- for (i = 0; i < image.num_sections; i++)
- {
- buffer = malloc(image.sections[i].size);
- if (buffer == NULL)
- {
- command_print(cmd_ctx, "error allocating buffer for section (%d bytes)", image.sections[i].size);
- break;
- }
-
- if ((retval = image_read_section(&image, i, 0x0, image.sections[i].size, buffer, &buf_cnt)) != ERROR_OK)
- {
- free(buffer);
- break;
- }
-
- u32 offset=0;
- u32 length=buf_cnt;
-
-
- /* DANGER!!! beware of unsigned comparision here!!! */
-
- if ((image.sections[i].base_address+buf_cnt>=min_address)&&
- (image.sections[i].base_address<max_address))
- {
- if (image.sections[i].base_address<min_address)
- {
- /* clip addresses below */
- offset+=min_address-image.sections[i].base_address;
- length-=offset;
- }
-
- if (image.sections[i].base_address+buf_cnt>max_address)
- {
- length-=(image.sections[i].base_address+buf_cnt)-max_address;
- }
-
- fastload[i].address=image.sections[i].base_address+offset;
- fastload[i].data=malloc(length);
- if (fastload[i].data==NULL)
- {
- free(buffer);
- break;
- }
- memcpy(fastload[i].data, buffer+offset, length);
- fastload[i].length=length;
-
- image_size += length;
- command_print(cmd_ctx, "%u byte written at address 0x%8.8x", length, image.sections[i].base_address+offset);
- }
-
- free(buffer);
- }
-
- duration_stop_measure(&duration, &duration_text);
- if (retval==ERROR_OK)
- {
- command_print(cmd_ctx, "Loaded %u bytes in %s", image_size, duration_text);
- command_print(cmd_ctx, "NB!!! image has not been loaded to target, issue a subsequent 'fast_load' to do so.");
- }
- free(duration_text);
-
- image_close(&image);
-
- if (retval!=ERROR_OK)
- {
- free_fastload();
- }
-
- return retval;
-}
-
-int handle_fast_load_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
-{
- if (argc>0)
- return ERROR_COMMAND_SYNTAX_ERROR;
- if (fastload==NULL)
- {
- LOG_ERROR("No image in memory");
- return ERROR_FAIL;
- }
- int i;
- int ms=timeval_ms();
- int size=0;
- for (i=0; i<fastload_num;i++)
- {
- int retval;
- target_t *target = get_current_target(cmd_ctx);
- if ((retval = target_write_buffer(target, fastload[i].address, fastload[i].length, fastload[i].data)) != ERROR_OK)
- {
- return retval;
- }
- size+=fastload[i].length;
- }
- int after=timeval_ms();
- command_print(cmd_ctx, "Loaded image %f kBytes/s", (float)(size/1024.0)/((float)(after-ms)/1000.0));
- return ERROR_OK;
-}
-
-
/* Give TELNET a way to find out what version this is */
int handle_zy1000_version_command(struct command_context_s *cmd_ctx, char *cmd,
char **args, int argc)
@@ -1969,12 +1779,6 @@
register_command(cmd_ctx, NULL, "rm", handle_rm_command, COMMAND_ANY,
"remove file");
- register_command(cmd_ctx, NULL, "fast_load_image", handle_fast_load_image_command, COMMAND_ANY,
- "same args as load_image, image stored in memory");
-
- register_command(cmd_ctx, NULL, "fast_load", handle_fast_load_command, COMMAND_ANY,
- "loads active fast load image to current target");
-
register_command(cmd_ctx, NULL, "cat", handle_cat_command, COMMAND_ANY,
"display file content");
Modified: trunk/src/target/target.c
===================================================================
--- trunk/src/target/target.c 2008-12-14 20:33:01 UTC (rev 1240)
+++ trunk/src/target/target.c 2008-12-15 09:05:16 UTC (rev 1241)
@@ -82,6 +82,9 @@
int handle_rwp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_virt2phys_command(command_context_t *cmd_ctx, char *cmd, char **args, int argc);
int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+int handle_fast_load_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+int handle_fast_load_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+
static int jim_array2mem(Jim_Interp *interp, int argc, Jim_Obj *const *argv);
static int jim_mem2array(Jim_Interp *interp, int argc, Jim_Obj *const *argv);
static int jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv);
@@ -929,6 +932,14 @@
register_command(cmd_ctx, NULL, "virt2phys", handle_virt2phys_command, COMMAND_ANY, "translate a virtual address into a physical address");
register_command(cmd_ctx, NULL, "profile", handle_profile_command, COMMAND_EXEC, "profiling samples the CPU PC");
+ register_command(cmd_ctx, NULL, "fast_load_image", handle_fast_load_image_command, COMMAND_ANY,
+ "same args as load_image, image stored in memory - mainly for profiling purposes");
+
+ register_command(cmd_ctx, NULL, "fast_load", handle_fast_load_command, COMMAND_ANY,
+ "loads active fast load image to current target - mainly for profiling purposes");
+
+
+
register_jim(cmd_ctx, "target", jim_target, "configure target" );
@@ -3845,7 +3856,7 @@
/* incase variant is not set */
if (!target->variant)
target->variant = strdup("");
-
+
/* create the target specific commands */
if( target->type->register_commands ){
(*(target->type->register_commands))( cmd_ctx );
@@ -3993,3 +4004,196 @@
return JIM_ERR;
}
+
+
+struct FastLoad
+{
+ u32 address;
+ u8 *data;
+ int length;
+
+};
+
+static int fastload_num;
+static struct FastLoad *fastload;
+
+static void free_fastload()
+{
+ if (fastload!=NULL)
+ {
+ int i;
+ for (i=0; i<fastload_num; i++)
+ {
+ if (fastload[i].data)
+ free(fastload[i].data);
+ }
+ free(fastload);
+ fastload=NULL;
+ }
+}
+
+
+
+
+int handle_fast_load_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+{
+ u8 *buffer;
+ u32 buf_cnt;
+ u32 image_size;
+ u32 min_address=0;
+ u32 max_address=0xffffffff;
+ int i;
+ int retval;
+
+ image_t image;
+
+ duration_t duration;
+ char *duration_text;
+
+ if ((argc < 1)||(argc > 5))
+ {
+ return ERROR_COMMAND_SYNTAX_ERROR;
+ }
+
+ /* a base address isn't always necessary, default to 0x0 (i.e. don't relocate) */
+ if (argc >= 2)
+ {
+ image.base_address_set = 1;
+ image.base_address = strtoul(args[1], NULL, 0);
+ }
+ else
+ {
+ image.base_address_set = 0;
+ }
+
+
+ image.start_address_set = 0;
+
+ if (argc>=4)
+ {
+ min_address=strtoul(args[3], NULL, 0);
+ }
+ if (argc>=5)
+ {
+ max_address=strtoul(args[4], NULL, 0)+min_address;
+ }
+
+ if (min_address>max_address)
+ {
+ return ERROR_COMMAND_SYNTAX_ERROR;
+ }
+
+ duration_start_measure(&duration);
+
+ if (image_open(&image, args[0], (argc >= 3) ? args[2] : NULL) != ERROR_OK)
+ {
+ return ERROR_OK;
+ }
+
+ image_size = 0x0;
+ retval = ERROR_OK;
+ fastload_num=image.num_sections;
+ fastload=(struct FastLoad *)malloc(sizeof(struct FastLoad)*image.num_sections);
+ if (fastload==NULL)
+ {
+ image_close(&image);
+ return ERROR_FAIL;
+ }
+ memset(fastload, 0, sizeof(struct FastLoad)*image.num_sections);
+ for (i = 0; i < image.num_sections; i++)
+ {
+ buffer = malloc(image.sections[i].size);
+ if (buffer == NULL)
+ {
+ command_print(cmd_ctx, "error allocating buffer for section (%d bytes)", image.sections[i].size);
+ break;
+ }
+
+ if ((retval = image_read_section(&image, i, 0x0, image.sections[i].size, buffer, &buf_cnt)) != ERROR_OK)
+ {
+ free(buffer);
+ break;
+ }
+
+ u32 offset=0;
+ u32 length=buf_cnt;
+
+
+ /* DANGER!!! beware of unsigned comparision here!!! */
+
+ if ((image.sections[i].base_address+buf_cnt>=min_address)&&
+ (image.sections[i].base_address<max_address))
+ {
+ if (image.sections[i].base_address<min_address)
+ {
+ /* clip addresses below */
+ offset+=min_address-image.sections[i].base_address;
+ length-=offset;
+ }
+
+ if (image.sections[i].base_address+buf_cnt>max_address)
+ {
+ length-=(image.sections[i].base_address+buf_cnt)-max_address;
+ }
+
+ fastload[i].address=image.sections[i].base_address+offset;
+ fastload[i].data=malloc(length);
+ if (fastload[i].data==NULL)
+ {
+ free(buffer);
+ break;
+ }
+ memcpy(fastload[i].data, buffer+offset, length);
+ fastload[i].length=length;
+
+ image_size += length;
+ command_print(cmd_ctx, "%u byte written at address 0x%8.8x", length, image.sections[i].base_address+offset);
+ }
+
+ free(buffer);
+ }
+
+ duration_stop_measure(&duration, &duration_text);
+ if (retval==ERROR_OK)
+ {
+ command_print(cmd_ctx, "Loaded %u bytes in %s", image_size, duration_text);
+ command_print(cmd_ctx, "NB!!! image has not been loaded to target, issue a subsequent 'fast_load' to do so.");
+ }
+ free(duration_text);
+
+ image_close(&image);
+
+ if (retval!=ERROR_OK)
+ {
+ free_fastload();
+ }
+
+ return retval;
+}
+
+int handle_fast_load_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+{
+ if (argc>0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+ if (fastload==NULL)
+ {
+ LOG_ERROR("No image in memory");
+ return ERROR_FAIL;
+ }
+ int i;
+ int ms=timeval_ms();
+ int size=0;
+ for (i=0; i<fastload_num;i++)
+ {
+ int retval;
+ target_t *target = get_current_target(cmd_ctx);
+ if ((retval = target_write_buffer(target, fastload[i].address, fastload[i].length, fastload[i].data)) != ERROR_OK)
+ {
+ return retval;
+ }
+ size+=fastload[i].length;
+ }
+ int after=timeval_ms();
+ command_print(cmd_ctx, "Loaded image %f kBytes/s", (float)(size/1024.0)/((float)(after-ms)/1000.0));
+ return ERROR_OK;
+}
|
|
From: <kc...@ma...> - 2008-12-14 21:33:18
|
Author: kc8apf
Date: 2008-12-14 21:33:01 +0100 (Sun, 14 Dec 2008)
New Revision: 1240
Modified:
trunk/src/jtag/bitbang.c
trunk/src/jtag/bitq.c
trunk/src/jtag/ft2232.c
trunk/src/jtag/gw16012.c
trunk/src/jtag/jlink.c
trunk/src/jtag/jtag.c
trunk/src/jtag/jtag.h
trunk/src/jtag/usbprog.c
trunk/src/jtag/zy1000.c
Log:
- Update tap_state_strings to correspond to SVF state names
- Use new jtag_state_name() instead of global tap_state_strings[]
Modified: trunk/src/jtag/bitbang.c
===================================================================
--- trunk/src/jtag/bitbang.c 2008-12-13 13:11:15 UTC (rev 1239)
+++ trunk/src/jtag/bitbang.c 2008-12-14 20:33:01 UTC (rev 1240)
@@ -109,7 +109,7 @@
}
else
{
- LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[state_count]]);
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(cmd->path[state_count]));
exit(-1);
}
Modified: trunk/src/jtag/bitq.c
===================================================================
--- trunk/src/jtag/bitq.c 2008-12-13 13:11:15 UTC (rev 1239)
+++ trunk/src/jtag/bitq.c 2008-12-14 20:33:01 UTC (rev 1240)
@@ -172,7 +172,7 @@
if (tap_transitions[cur_state].low == cmd->path[i]) bitq_io(0, 0, 0);
else if (tap_transitions[cur_state].high == cmd->path[i]) bitq_io(1, 0, 0);
else {
- LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[i]]);
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(cmd->path[i)]);
exit(-1);
}
Modified: trunk/src/jtag/ft2232.c
===================================================================
--- trunk/src/jtag/ft2232.c 2008-12-13 13:11:15 UTC (rev 1239)
+++ trunk/src/jtag/ft2232.c 2008-12-14 20:33:01 UTC (rev 1240)
@@ -525,7 +525,7 @@
buf_set_u32(&tms_byte, bit_count++, 1, 0x1);
else
{
- LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[state_count]]);
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(cmd->path[state_count]));
exit(-1);
}
Modified: trunk/src/jtag/gw16012.c
===================================================================
--- trunk/src/jtag/gw16012.c 2008-12-13 13:11:15 UTC (rev 1239)
+++ trunk/src/jtag/gw16012.c 2008-12-14 20:33:01 UTC (rev 1240)
@@ -240,7 +240,7 @@
}
else
{
- LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[state_count]]);
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(cmd->path[state_count]));
exit(-1);
}
Modified: trunk/src/jtag/jlink.c
===================================================================
--- trunk/src/jtag/jlink.c 2008-12-13 13:11:15 UTC (rev 1239)
+++ trunk/src/jtag/jlink.c 2008-12-14 20:33:01 UTC (rev 1240)
@@ -376,7 +376,7 @@
}
else
{
- LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[path[i]]);
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(path[i]));
exit(-1);
}
Modified: trunk/src/jtag/jtag.c
===================================================================
--- trunk/src/jtag/jtag.c 2008-12-13 13:11:15 UTC (rev 1239)
+++ trunk/src/jtag/jtag.c 2008-12-14 20:33:01 UTC (rev 1240)
@@ -41,14 +41,6 @@
int jtag_error=ERROR_OK;
-char* tap_state_strings[16] =
-{
- "tlr",
- "sds", "cd", "sd", "e1d", "pd", "e2d", "ud",
- "rti",
- "sis", "ci", "si", "e1i", "pi", "e2i", "ui"
-};
-
typedef struct cmd_queue_page_s
{
void *address;
@@ -1004,7 +996,7 @@
if ((tap_transitions[cur_state].low != path[i])&&
(tap_transitions[cur_state].high != path[i]))
{
- LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[path[i]]);
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(path[i]));
exit(-1);
}
cur_state = path[i];
@@ -2656,14 +2648,14 @@
{
for (state = 0; state < 16; state++)
{
- if (strcmp(args[0], tap_state_strings[state]) == 0)
+ if (strcmp(args[0], jtag_state_name(state)) == 0)
{
jtag_add_end_state(state);
jtag_execute_queue();
}
}
}
- command_print(cmd_ctx, "current endstate: %s", tap_state_strings[cmd_queue_end_state]);
+ command_print(cmd_ctx, "current endstate: %s", jtag_state_name(cmd_queue_end_state));
return ERROR_OK;
}
@@ -2915,3 +2907,34 @@
Jim_Nvp_value2name_simple( nvp_jtag_tap_event, e)->name);
}
}
+
+
+/* map state number to SVF state string */
+const char* jtag_state_name(enum tap_state state)
+{
+ const char* ret;
+
+ switch( state )
+ {
+ case TAP_RESET: ret = "RESET"; break;
+ case TAP_IDLE: ret = "IDLE"; break;
+ case TAP_DRSELECT: ret = "DRSELECT"; break;
+ case TAP_DRCAPTURE: ret = "DRCAPTURE"; break;
+ case TAP_DRSHIFT: ret = "DRSHIFT"; break;
+ case TAP_DREXIT1: ret = "DREXIT1"; break;
+ case TAP_DRPAUSE: ret = "DRPAUSE"; break;
+ case TAP_DREXIT2: ret = "DREXIT2"; break;
+ case TAP_DRUPDATE: ret = "DRUPDATE"; break;
+ case TAP_IRSELECT: ret = "IRSELECT"; break;
+ case TAP_IRCAPTURE: ret = "IRCAPTURE"; break;
+ case TAP_IRSHIFT: ret = "IRSHIFT"; break;
+ case TAP_IREXIT1: ret = "IREXIT1"; break;
+ case TAP_IRPAUSE: ret = "IRPAUSE"; break;
+ case TAP_IREXIT2: ret = "IREXIT2"; break;
+ case TAP_IRUPDATE: ret = "IRUPDATE"; break;
+ default: ret = "???";
+ }
+
+ return ret;
+}
+
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2008-12-13 13:11:15 UTC (rev 1239)
+++ trunk/src/jtag/jtag.h 2008-12-14 20:33:01 UTC (rev 1240)
@@ -50,7 +50,6 @@
enum tap_state low;
} tap_transition_t;
-extern char* tap_state_strings[16];
extern int tap_move_map[16]; /* map 16 TAP states to 6 stable states */
extern u8 tap_move[6][6]; /* value scanned to TMS to move from one of six stable states to another */
extern tap_transition_t tap_transitions[16]; /* describe the TAP state diagram */
@@ -529,4 +528,11 @@
interface_jtag_add_dr_out(tap, num_fields, num_bits, value, cmd_queue_end_state);
}
+/**
+ * Function jtag_state_name
+ * Returns a string suitable for display representing the JTAG tap_state
+ */
+const char* jtag_state_name(enum tap_state state);
+
+
#endif /* JTAG_H */
Modified: trunk/src/jtag/usbprog.c
===================================================================
--- trunk/src/jtag/usbprog.c 2008-12-13 13:11:15 UTC (rev 1239)
+++ trunk/src/jtag/usbprog.c 2008-12-14 20:33:01 UTC (rev 1240)
@@ -282,7 +282,7 @@
}
else
{
- LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[state_count]]);
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(cmd->path[state_count]));
exit(-1);
}
Modified: trunk/src/jtag/zy1000.c
===================================================================
--- trunk/src/jtag/zy1000.c 2008-12-13 13:11:15 UTC (rev 1239)
+++ trunk/src/jtag/zy1000.c 2008-12-14 20:33:01 UTC (rev 1240)
@@ -266,51 +266,51 @@
int loadFile(const char *fileName, void **data, int *len)
{
FILE * pFile;
- pFile = fopen (fileName,"rb");
+ pFile = fopen(fileName,"rb");
if (pFile==NULL)
{
LOG_ERROR("Can't open %s\n", fileName);
return ERROR_JTAG_DEVICE_ERROR;
}
- if (fseek (pFile, 0, SEEK_END)!=0)
- {
+ if (fseek(pFile, 0, SEEK_END)!=0)
+ {
LOG_ERROR("Can't open %s\n", fileName);
fclose(pFile);
return ERROR_JTAG_DEVICE_ERROR;
- }
- *len=ftell (pFile);
- if (*len==-1)
- {
+ }
+ *len=ftell(pFile);
+ if (*len==-1)
+ {
LOG_ERROR("Can't open %s\n", fileName);
fclose(pFile);
return ERROR_JTAG_DEVICE_ERROR;
- }
+ }
- if (fseek (pFile, 0, SEEK_SET)!=0)
- {
+ if (fseek(pFile, 0, SEEK_SET)!=0)
+ {
LOG_ERROR("Can't open %s\n", fileName);
fclose(pFile);
return ERROR_JTAG_DEVICE_ERROR;
- }
- *data=malloc(*len+1);
- if (*data==NULL)
- {
+ }
+ *data=malloc(*len+1);
+ if (*data==NULL)
+ {
LOG_ERROR("Can't open %s\n", fileName);
fclose(pFile);
return ERROR_JTAG_DEVICE_ERROR;
- }
+ }
- if (fread(*data, 1, *len, pFile)!=*len)
- {
+ if (fread(*data, 1, *len, pFile)!=*len)
+ {
fclose(pFile);
free(*data);
LOG_ERROR("Can't open %s\n", fileName);
return ERROR_JTAG_DEVICE_ERROR;
- }
- fclose (pFile);
- *(((char *)(*data))+*len)=0; /* sentinel */
+ }
+ fclose(pFile);
+ *(((char *)(*data))+*len)=0; /* sentinel */
- return ERROR_OK;
+ return ERROR_OK;
@@ -365,7 +365,7 @@
#if 0
static void shiftValueInnerFlip(const enum tap_state state, const enum tap_state endState, int repeat, cyg_uint32 value)
{
- VERBOSE(LOG_INFO("shiftValueInner %s %s %d %08x (flipped)", tap_state_strings[state], tap_state_strings[endState], repeat, value));
+ VERBOSE(LOG_INFO("shiftValueInner %s %s %d %08x (flipped)", jtag_state_name(state), jtag_state_name(endState), repeat, value));
cyg_uint32 a,b;
a=state;
b=endState;
@@ -476,7 +476,7 @@
int r=fields[i].in_handler(inBuffer, fields[i].in_handler_priv, fields+i);
if (r!=ERROR_OK)
{
- /* this will cause jtag_execute_queue() to return an error */
+ /* this will cause jtag_execute_queue() to return an error */
jtag_error=r;
}
}
@@ -703,7 +703,7 @@
}
else
{
- LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[path[state_count]]);
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(path[state_count)]);
exit(-1);
}
|