OpenCores
URL https://opencores.org/ocsvn/kiss-board/kiss-board/trunk

Subversion Repositories kiss-board

[/] [kiss-board/] [tags/] [initial/] [kiss-board_soc/] [sw/] [utils/] [bin2bin.c] - Blame information for rev 11

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 fukuchi
#include <stdio.h>
2
#include <stdlib.h>
3
 
4
/* Number of bytes before line is broken
5
   For example if target flash is 8 bits wide,
6
   define BREAK as 1. If it is 16 bits wide,
7
   define it as 2 etc.
8
*/
9
#define BREAK 1
10
 
11
int main(int argc, char **argv)
12
{
13
 
14
        FILE  *fd;
15
        int c;
16
        //int i = 0;
17
 
18
        if(argc < 2) {
19
                fprintf(stderr,"no input file specified\n");
20
                exit(1);
21
        }
22
        if(argc > 2) {
23
                fprintf(stderr,"too many input files (more than one) specified\n");
24
                exit(1);
25
        }
26
 
27
        {
28
                unsigned long int loop;
29
                unsigned long int count;
30
 
31
                fd = fopen( argv[1], "r" );
32
 
33
                for (loop=0;loop<4;loop++) {
34
 
35
                        rewind(fd);
36
 
37
                        if (fd == NULL) {
38
                                fprintf(stderr,"failed to open input file: %s\n",argv[1]);
39
                                exit(1);
40
                        }
41
                        count = 0;
42
                        while ((c = fgetc(fd)) != EOF) {
43
                                fputc(c,stdout);
44
                                count++;
45
                        }
46
                        //while (count<131072) {
47
                        while (count<262144) {
48
                                fputc(0x00,stdout);
49
                                count++;
50
                        }
51
 
52
                }
53
 
54
                fclose(fd);
55
 
56
        }
57
        return 0;
58
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.