Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
84
Issues
84
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
8bc64c7e
Commit
8bc64c7e
authored
Jun 23, 2014
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mch_flasher: remove most build warnings
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
857598b6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
19 deletions
+18
-19
Makefile
usb-loader/Makefile
+2
-0
mch_flasher.c
usb-loader/mch_flasher.c
+9
-14
serial.h
usb-loader/serial.h
+3
-2
serial_linux.c
usb-loader/serial_linux.c
+4
-3
No files found.
usb-loader/Makefile
View file @
8bc64c7e
OBJS
=
mch_flasher.o serial_linux.o version.o
OUTPUT
=
mch_flasher
CFLAGS
=
-Wall
all
:
$(OBJS)
${
CC
}
-o
$(OUTPUT)
$(OBJS)
...
...
usb-loader/mch_flasher.c
View file @
8bc64c7e
...
...
@@ -2,6 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
...
...
@@ -82,7 +83,7 @@ unsigned int buffer_addr ;
int
mem_write
(
int
type
,
uint32_t
offset
,
uint32_t
buf_addr
,
uint32_t
size
);
int
crc16
(
int
value
,
int
crcin
)
{
...
...
@@ -102,9 +103,9 @@ int crc16(int value, int crcin)
}
static
int
write_xmodem
(
int
index
,
char
*
p
)
int
write_xmodem
(
int
index
,
char
*
p
)
{
unsigned
char
data
[
133
]
,
c
;
unsigned
char
data
[
133
];
unsigned
short
crc
=
0
;
int
i
;
data
[
0
]
=
1
;
...
...
@@ -141,7 +142,7 @@ void die(const char *fmt, ...)
void
samba_write
(
uint32_t
addr
,
uint32_t
data
,
int
size
,
int
timeout
)
{
char
tmpbuf
[
1024
]
,
c
;
char
tmpbuf
[
1024
];
uint32_t
tstart
;
serial_purge
();
...
...
@@ -212,13 +213,9 @@ static int samba_send_file(const char *filename, uint32_t address, uint32_t offs
{
FILE
*
f
;
unsigned
char
*
buf
;
uint32_t
file_size
,
sent
;
int
idx
=
0
;
int
boffset
=
0
;
char
tmp
[
4097
];
uint32_t
tstart
;
// printf("SendFile: %s\n", filename);
f
=
fopen
(
filename
,
"rb"
);
...
...
@@ -338,9 +335,7 @@ void samba_run(uint32_t addr, int timeout)
int
samba_connect
(
int
board_rev
)
{
char
handshake
[]
=
{
0x80
,
0x80
,
0x23
},
cmd
[
128
],
buffer
[
16384
];
int
tstart
,
i
,
length
,
npages
;
int
c
;
char
handshake
[]
=
{
0x80
,
0x80
,
0x23
};
serial_write
(
handshake
,
3
);
sys_delay
(
100
);
...
...
@@ -501,6 +496,7 @@ int mem_write(int type, uint32_t offset, uint32_t buf_addr, uint32_t size)
if
(
samba_read
(
INTERNAL_SRAM_BUF
+
MBOX_STATUS
,
4
,
10000000
)
!=
APPLET_SUCCESS
)
die
(
" write failure"
);
printf
(
" OK
\n
"
);
return
0
;
}
void
nand_scrub
()
...
...
@@ -548,7 +544,7 @@ void show_help(const char* serial_port)
printf
(
"
\n
"
);
}
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
int
board_rev
=
BOARD_REV_V3
;
char
*
serial_port
=
"/dev/ttyACM0"
;
...
...
@@ -556,8 +552,7 @@ main(int argc, char *argv[])
char
opt
;
int
erase
=
0
,
check
=
0
,
scrub
=
0
;
int
type
=-
1
;
unsigned
int
offset
=
0
,
run_addr
=
0
;
int
noopts
=
1
;
unsigned
int
run_addr
=
0
;
int
nFile
=
0
;
int
run
=
0
;
...
...
usb-loader/serial.h
View file @
8bc64c7e
...
...
@@ -15,11 +15,12 @@
int
serial_open
(
char
*
dev_name
,
int
speed
);
void
serial_close
();
void
serial_set_dtr
(
int
s
);
int
serial_read
(
char
*
data
,
int
len
);
int
serial_write
(
char
*
data
,
int
len
);
int
serial_read
(
void
*
data
,
int
len
);
int
serial_write
(
void
*
data
,
int
len
);
void
serial_write_byte
(
unsigned
char
b
);
unsigned
char
serial_read_byte
();
int
serial_data_avail
();
void
serial_purge
();
void
sys_delay
(
int
msecs
);
unsigned
int
sys_get_clock_usec
();
...
...
usb-loader/serial_linux.c
View file @
8bc64c7e
...
...
@@ -20,6 +20,7 @@
#include <string.h>
#include <termios.h>
#include <fcntl.h>
#include "serial.h"
static
int
serial_fd
=
-
1
;
...
...
@@ -68,10 +69,10 @@ void serial_close()
close
(
serial_fd
);
}
int
serial_write
(
char
*
data
,
int
len
)
int
serial_write
(
void
*
data
,
int
len
)
{
// printf("WS: '");
int
i
;
//
int i;
// for(i=0;i<len;i++) printf("%c", data[i]);
// printf("'\n");
...
...
@@ -79,7 +80,7 @@ int serial_write(char *data, int len)
}
int
serial_read
(
char
*
data
,
int
len
)
int
serial_read
(
void
*
data
,
int
len
)
{
int
nbytes
=
0
;
while
(
len
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment