Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
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
Software for White Rabbit PTP Core
Commits
0bb4615c
Commit
0bb4615c
authored
Apr 24, 2020
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: bring back sdbfs erase command
parent
a057343e
Pipeline
#278
failed with stages
in 10 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
10 deletions
+34
-10
storage.c
dev/storage.c
+21
-8
storage.h
include/storage.h
+1
-0
cmd_sdb.c
shell/cmd_sdb.c
+12
-2
No files found.
dev/storage.c
View file @
0bb4615c
...
...
@@ -1092,6 +1092,26 @@ static inline unsigned long SDB_ALIGN(unsigned long x, int blocksize)
return
(
x
+
(
blocksize
-
1
))
&
~
(
blocksize
-
1
);
}
int
storage_sdbfs_erase
(
struct
storage_device
*
dev
,
uint32_t
addr
,
int
force_base
)
{
int
total_size
=
SDBFS_REC
*
wrc_sdbfs
.
blocksize
;
int
count
=
0
;
uint32_t
base_addr
;
if
(
force_base
)
base_addr
=
addr
;
else
base_addr
=
dev
->
cfg_entry
;
wrc_sdbfs
.
drvdata
=
dev
;
wrc_sdbfs
.
blocksize
=
dev
->
block_size
;
while
(
count
<
total_size
)
{
sdbfs_erase_callback
(
&
wrc_sdbfs
,
base_addr
+
count
,
wrc_sdbfs
.
blocksize
);
count
+=
wrc_sdbfs
.
blocksize
;
}
}
int
storage_sdbfs_format
(
struct
storage_device
*
dev
,
uint32_t
addr
,
int
force_base
)
{
...
...
@@ -1144,14 +1164,7 @@ int storage_sdbfs_format( struct storage_device *dev, uint32_t addr, int force_b
pp_printf
(
"Formatting SDBFS in %s (base 0x%08x, size 0x%08x)...
\n
"
,
dev
->
name
,
base_addr
,
SDBFS_REC
*
wrc_sdbfs
.
blocksize
);
int
total_size
=
SDBFS_REC
*
wrc_sdbfs
.
blocksize
;
int
count
=
0
;
while
(
count
<
total_size
)
{
sdbfs_erase_callback
(
&
wrc_sdbfs
,
base_addr
+
count
,
wrc_sdbfs
.
blocksize
);
count
+=
wrc_sdbfs
.
blocksize
;
}
storage_sdbfs_erase
(
dev
,
addr
,
force_base
);
size
=
sizeof
(
struct
sdb_device
);
...
...
include/storage.h
View file @
0bb4615c
...
...
@@ -128,6 +128,7 @@ int storage_init_erase(void);
int
storage_init_add
(
const
char
*
args
[]);
int
storage_init_show
(
void
);
int
storage_init_readcmd
(
uint8_t
*
buf
,
uint8_t
bufsize
,
uint8_t
next
);
int
storage_sdbfs_erase
(
struct
storage_device
*
dev
,
uint32_t
addr
,
int
force_base
);
int
storage_sdbfs_format
(
struct
storage_device
*
dev
,
uint32_t
addr
,
int
force_base
);
void
storage_sdbfs_list
(
void
);
...
...
shell/cmd_sdb.c
View file @
0bb4615c
...
...
@@ -33,13 +33,23 @@ static int cmd_sdb(const char *args[])
if
(
!
args
[
1
]
)
{
pp_printf
(
"Formatting using default location
\n
"
);
storage_sdbfs_format
(
&
wrc_storage_dev
,
base
,
0
);
}
else
{
}
else
{
base
=
atoi
(
args
[
1
]);
pp_printf
(
"Formatting using custom location 0x%X
\n
"
,
base
);
storage_sdbfs_format
(
&
wrc_storage_dev
,
base
,
1
);
}
return
0
;
}
else
if
(
!
strcasecmp
(
args
[
0
],
"fse"
))
{
uint32_t
base
=
0
;
if
(
!
args
[
1
]
)
{
pp_printf
(
"Erasing using default location
\n
"
);
storage_sdbfs_erase
(
&
wrc_storage_dev
,
base
,
0
);
}
else
{
base
=
atoi
(
args
[
1
]);
pp_printf
(
"Erasing using custom location 0x%X
\n
"
,
base
);
storage_sdbfs_erase
(
&
wrc_storage_dev
,
base
,
1
);
}
return
0
;
}
else
if
(
!
strcasecmp
(
args
[
0
],
"ls"
))
{
storage_sdbfs_list
();
return
0
;
...
...
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