Check-in [bde3a708f9]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:cleanup
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bde3a708f908f00f024c6c2657633871a7d85203
User & Date: rmax 2017-01-23 15:04:35.789
Context
2017-01-23
16:28
Implement the force option check-in: fbedeafa99 user: rmax tags: trunk
15:04
cleanup check-in: bde3a708f9 user: rmax tags: trunk
2017-01-20
13:55
  • Implement raw mode
  • Implement writing to files
  • Allow specifying a write offset. This is useful for overwriting the CD image.
check-in: 50ebed6eb3 user: rmax tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to jq6500.c.
20
21
22
23
24
25
26




27



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <unistd.h>
#include <err.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>





#define JQ6500_CM




struct jqcmd {
    uint16_t j_cmd;
    uint32_t j_off;
    uint32_t j_foo;
    uint32_t j_len;
    uint16_t j_bar;
} __attribute__((packed));

#define FLASHSIZE 0x200000 /* 2MiB   */
#define BASE       0x40000 /* 256kiB */
#define MAXSIZE (FLASHSIZE - BASE)

off_t
filesize(char *file)
{
    int result;
    struct stat buf;
    result = stat(file, &buf);







>
>
>
>
|
>
>
>









|
|
<







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

46
47
48
49
50
51
52
#include <unistd.h>
#include <err.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>

#define FLASHSIZE 0x200000 /* 2MiB   */
#define BASE       0x40000 /* 256kiB */
#define MAXSIZE (FLASHSIZE - BASE)

#define ERASE 0xfbd8
#define WRITE 0xfbd9
#define BLKSZ 0x1000
#define TIMEOUT 30000

struct jqcmd {
    uint16_t j_cmd;
    uint32_t j_off;
    uint32_t j_foo;
    uint32_t j_len;
    uint16_t j_bar;
} __attribute__((packed));

uint8_t buf[FLASHSIZE];
uint8_t force = 0;


off_t
filesize(char *file)
{
    int result;
    struct stat buf;
    result = stat(file, &buf);
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
	   "  -s prefix   save the content of the pseudo file system on the device\n"
	   "              to a set of files named prefix-dirno-fileno\n"
	   "  -f          force operation (disable size checking).\n");
    
    exit(1);
}

uint8_t buf[FLASHSIZE];

int
mkjqfs(int count, char **files, int offset)
{
    int size, i, len;
    uint8_t *dir, *data;
    memset(buf, 0xff, FLASHSIZE);








<
<







110
111
112
113
114
115
116


117
118
119
120
121
122
123
	   "  -s prefix   save the content of the pseudo file system on the device\n"
	   "              to a set of files named prefix-dirno-fileno\n"
	   "  -f          force operation (disable size checking).\n");
    
    exit(1);
}



int
mkjqfs(int count, char **files, int offset)
{
    int size, i, len;
    uint8_t *dir, *data;
    memset(buf, 0xff, FLASHSIZE);

143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
	w32le(&dir, offset + data - buf); /* File offset */
	w32le(&dir, len);                 /* File length */
	data += len;
    }
    return size;
}

#define ERASE 0xfbd8
#define WRITE 0xfbd9
#define BLKSZ 0x1000
#define TIMEOUT 30000

void
jqwrite(char *device, uint8_t *buf, int offset, int size)
{
    int dev, i;

    dev = open(device, O_RDWR);
    if (dev < 0)







<
<
<
<
<







147
148
149
150
151
152
153





154
155
156
157
158
159
160
	w32le(&dir, offset + data - buf); /* File offset */
	w32le(&dir, len);                 /* File length */
	data += len;
    }
    return size;
}






void
jqwrite(char *device, uint8_t *buf, int offset, int size)
{
    int dev, i;

    dev = open(device, O_RDWR);
    if (dev < 0)