summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2011-11-21 15:25:43 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2011-11-21 15:25:43 +0000
commitada031d4dec6be88be9a8002e645fa5641e26ca0 (patch)
treed53036a352a2beb780ed943dea80a03652682f87
parent0ef23bf738830c2d72ce6fcbb3ede14f90a5b839 (diff)
xpp: astribank_hexload: we need more lines
* Newer firmwares may have more lines. * While we're at it, add better debug printing. * Remove some unused debugging code. Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@10343 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--xpp/astribank_hexload.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/xpp/astribank_hexload.c b/xpp/astribank_hexload.c
index 0e9fb69..0fa9010 100644
--- a/xpp/astribank_hexload.c
+++ b/xpp/astribank_hexload.c
@@ -24,6 +24,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <stdarg.h>
#include <errno.h>
#include <assert.h>
#include <arpa/inet.h>
@@ -36,7 +37,7 @@
#include "../autoconfig.h"
#define DBG_MASK 0x80
-#define MAX_HEX_LINES 10000
+#define MAX_HEX_LINES 64000
#define HAVE_OCTASIC 1
static char *progname;
@@ -81,15 +82,27 @@ int handle_hexline(struct astribank_device *astribank, struct hexline *hexline)
return 0;
}
+void print_parse_errors(int level, const char *msg, ...)
+{
+ va_list ap;
+
+ if (verbose > level) {
+ va_start (ap, msg);
+ vfprintf (stderr, msg, ap);
+ va_end (ap);
+ }
+}
+
static int load_hexfile(struct astribank_device *astribank, const char *hexfile, enum dev_dest dest)
{
struct hexdata *hexdata = NULL;
int finished = 0;
int ret;
- int i;
+ unsigned i;
char star[] = "+\\+|+/+-";
const char *devstr;
+ parse_hexfile_set_reporting(print_parse_errors);
if((hexdata = parse_hexfile(hexfile, MAX_HEX_LINES)) == NULL) {
perror(hexfile);
return -errno;
@@ -100,13 +113,6 @@ static int load_hexfile(struct astribank_device *astribank, const char *hexfile,
xusb_serial(astribank->xusb),
dev_dest2str(dest),
hexdata->fname, hexdata->version_info);
-#if 0
- FILE *fp;
- if((fp = fopen("fpga_dump_new.txt", "w")) == NULL) {
- perror("dump");
- exit(1);
- }
-#endif
if((ret = mpp_send_start(astribank, dest, hexdata->version_info)) < 0) {
ERR("%s: Failed hexfile send start: %d\n", devstr, ret);
return ret;