| 1 |
Author: Ben Hutchings <[email protected]> |
| 2 |
Description: Add makefw -b option to enable binary output |
| 3 |
Bug-Debian: http://bugs.debian.org/699104 |
| 4 |
|
| 5 |
We can't compile these bitfiles into the drivers in the free |
| 6 |
dahdi-source package. Add the -b option to write a binary |
| 7 |
instead of a C array. |
| 8 |
|
| 9 |
--- |
| 10 |
--- a/drivers/dahdi/makefw.c |
| 11 |
+++ b/drivers/dahdi/makefw.c |
| 12 |
@@ -1,6 +1,7 @@ |
| 13 |
/* Xilinx firmware convertor program. |
| 14 |
* |
| 15 |
* Written by Jim Dixon <[email protected]>. |
| 16 |
+ * Binary output adde by Ben Hutchings <[email protected]>. |
| 17 |
* |
| 18 |
* Copyright (C) 2001 Jim Dixon / Zapata Telephony. |
| 19 |
* Copyright (C) 2001-2008 Digium, Inc. |
| 20 |
@@ -34,10 +35,12 @@ FILE *fp; |
| 21 |
int i,j,nbytes; |
| 22 |
unsigned char c; |
| 23 |
char buf[300]; |
| 24 |
+int bin; |
| 25 |
|
| 26 |
if (argc < 3) |
| 27 |
{ |
| 28 |
puts("Usage... makefw filename.rbt array_name"); |
| 29 |
+ puts(" makefw filename.rbt -b"); |
| 30 |
exit(1); |
| 31 |
} |
| 32 |
|
| 33 |
@@ -47,8 +50,10 @@ char buf[300]; |
| 34 |
perror("bit file open"); |
| 35 |
exit(1); |
| 36 |
} |
| 37 |
+ bin = !strcmp(argv[2], "-b"); |
| 38 |
nbytes = 0; |
| 39 |
- printf("static unsigned char %s[] = {\n",argv[2]); |
| 40 |
+ if (!bin) |
| 41 |
+ printf("static unsigned char %s[] = {\n",argv[2]); |
| 42 |
i = 0; |
| 43 |
while(fgets(buf,sizeof(buf) - 1,fp)) |
| 44 |
{ |
| 45 |
@@ -66,17 +71,22 @@ char buf[300]; |
| 46 |
if ((j & 7) == 7) |
| 47 |
{ |
| 48 |
nbytes++; |
| 49 |
- if (i) printf(","); |
| 50 |
- printf("0x%02x",c); |
| 51 |
- if (i++ == SWATH) { |
| 52 |
- printf(",\n"); |
| 53 |
- i = 0; |
| 54 |
+ if (bin) { |
| 55 |
+ putchar(c); |
| 56 |
+ } else { |
| 57 |
+ if (i) printf(","); |
| 58 |
+ printf("0x%02x",c); |
| 59 |
+ if (i++ == SWATH) { |
| 60 |
+ printf(",\n"); |
| 61 |
+ i = 0; |
| 62 |
+ } |
| 63 |
} |
| 64 |
c = 0; |
| 65 |
} |
| 66 |
} |
| 67 |
} |
| 68 |
- printf("\n};\n\n"); |
| 69 |
+ if (!bin) |
| 70 |
+ printf("\n};\n\n"); |
| 71 |
fprintf(stderr,"Loaded %d bytes from file\n",nbytes); |
| 72 |
fclose(fp); |
| 73 |
exit(0); |