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
86
Issues
86
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
0b69e1cd
Commit
0b69e1cd
authored
Oct 19, 2012
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
usb-loader: little style review
Signed-off-by:
Federico Vaga
<
federico.vaga@gmail.com
>
parent
9fa122e1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
27 deletions
+46
-27
mch_flasher.c
usb-loader/mch_flasher.c
+46
-27
No files found.
usb-loader/mch_flasher.c
View file @
0b69e1cd
...
...
@@ -568,14 +568,26 @@ main(int argc, char *argv[])
//Parse options
while
((
opt
=
getopt
(
argc
,
argv
,
"m:p:r:ecsh"
))
!=
-
1
)
switch
(
opt
)
{
case
'm'
:
mode_str
=
optarg
;
break
;
case
'p'
:
serial_port
=
optarg
;
break
;
case
'e'
:
erase
=
1
;
break
;
case
'c'
:
check
=
1
;
break
;
case
's'
:
scrub
=
1
;
break
;
case
'r'
:
run
=
1
;
sscanf
(
optarg
,
"%i"
,
&
run_addr
);
break
;
switch
(
opt
)
{
case
'm'
:
mode_str
=
optarg
;
break
;
case
'p'
:
serial_port
=
optarg
;
break
;
case
'e'
:
erase
=
1
;
break
;
case
'c'
:
check
=
1
;
break
;
case
's'
:
scrub
=
1
;
break
;
case
'r'
:
run
=
1
;
sscanf
(
optarg
,
"%i"
,
&
run_addr
);
break
;
case
'h'
:
case
'?'
:
...
...
@@ -607,11 +619,13 @@ main(int argc, char *argv[])
fprintf
(
stderr
,
"Initializing DDR > Done
\n\n
"
);
//Obtain the memory type mode
if
(
strcmp
(
mode_str
,
"nand"
)
==
0
||
strcmp
(
mode_str
,
"nf"
)
==
0
)
type
=
MEMTYPE_NAND
;
else
if
(
strcmp
(
mode_str
,
"dataflash"
)
==
0
||
strcmp
(
mode_str
,
"df"
)
==
0
)
type
=
MEMTYPE_DF
;
else
if
(
strcmp
(
mode_str
,
"ddr"
)
==
0
||
strcmp
(
mode_str
,
"ram"
)
==
0
)
type
=
MEMTYPE_DDR
;
else
{
if
(
strcmp
(
mode_str
,
"nand"
)
==
0
||
strcmp
(
mode_str
,
"nf"
)
==
0
)
{
type
=
MEMTYPE_NAND
;
}
else
if
(
strcmp
(
mode_str
,
"dataflash"
)
==
0
||
strcmp
(
mode_str
,
"df"
)
==
0
)
{
type
=
MEMTYPE_DF
;
}
else
if
(
strcmp
(
mode_str
,
"ddr"
)
==
0
||
strcmp
(
mode_str
,
"ram"
)
==
0
)
{
type
=
MEMTYPE_DDR
;
}
else
{
fprintf
(
stderr
,
"Bad memory type %s...
\n\n
"
,
mode_str
);
show_help
(
serial_port
);
return
0
;
...
...
@@ -619,13 +633,18 @@ main(int argc, char *argv[])
//Init the memory (except DDR which is already init)
if
(
type
!=
MEMTYPE_DDR
)
memflash_init
(
type
,
board_rev
);
if
(
type
!=
MEMTYPE_DDR
)
memflash_init
(
type
,
board_rev
);
//Run the action
if
(
erase
)
mem_full_erase
(
type
);
if
(
check
)
mem_check
(
type
);
if
(
scrub
&&
type
==
MEMTYPE_NAND
)
nand_scrub
();
if
(
nFile
>
0
)
mem_program
(
type
,
nFile
,(
const
sndfile
*
)
&
filearray
);
if
(
erase
)
mem_full_erase
(
type
);
if
(
check
)
mem_check
(
type
);
if
(
scrub
&&
type
==
MEMTYPE_NAND
)
nand_scrub
();
if
(
nFile
>
0
)
mem_program
(
type
,
nFile
,(
const
sndfile
*
)
&
filearray
);
if
(
run
)
{
...
...
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