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
a057343e
Commit
a057343e
authored
Apr 24, 2020
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: use entry point provided by HDL for formatting sdbfs
parent
da0b206e
Pipeline
#213
failed with stages
in 9 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
13 deletions
+26
-13
board.c
boards/generic/board.c
+3
-3
flash.c
dev/flash.c
+1
-1
spi_flash.c
dev/spi_flash.c
+2
-1
storage.c
dev/storage.c
+8
-1
spi_flash.h
include/dev/spi_flash.h
+2
-1
storage.h
include/storage.h
+2
-1
cmd_sdb.c
shell/cmd_sdb.c
+8
-5
No files found.
boards/generic/board.c
View file @
a057343e
...
...
@@ -12,7 +12,7 @@ int wrc_board_early_init()
int
wrc_board_init
()
{
int
memtype
;
uint32_t
sdbfs_
addr
;
uint32_t
sdbfs_
entry
;
uint32_t
sector_size
;
/*
...
...
@@ -31,12 +31,12 @@ int wrc_board_init()
* Read from gateware info about used memory. Currently only base
* address and sector size for memtype flash is supported.
*/
get_storage_info
(
&
memtype
,
&
sdbfs_
addr
,
&
sector_size
);
get_storage_info
(
&
memtype
,
&
sdbfs_
entry
,
&
sector_size
);
/*
* Initialize SPI flash and read its ID
*/
spi_flash_create
(
&
wrc_flash_dev
,
&
spi_wrc_flash
,
sector_size
);
spi_flash_create
(
&
wrc_flash_dev
,
&
spi_wrc_flash
,
sector_size
,
sdbfs_entry
);
/*
* Initialize storage subsystem with newly created SPI Flash
...
...
dev/flash.c
View file @
a057343e
...
...
@@ -29,7 +29,7 @@ void flash_init(void)
&
pin_sysc_spi_miso
,
&
pin_sysc_spi_sclk
,
10
);
spi_flash_create
(
&
wrc_flash_dev
,
&
spi_wrc_flash
,
16384
);
spi_flash_create
(
&
wrc_flash_dev
,
&
spi_wrc_flash
,
16384
,
0
);
return
0
;
}
dev/spi_flash.c
View file @
a057343e
...
...
@@ -16,12 +16,13 @@ static uint8_t spi_flash_rsr(struct spi_flash_device *dev);
/*
* Init function (just set the SPI pins for idle)
*/
void
spi_flash_create
(
struct
spi_flash_device
*
dev
,
struct
spi_bus
*
bus
,
uint32_t
sector_size
)
void
spi_flash_create
(
struct
spi_flash_device
*
dev
,
struct
spi_bus
*
bus
,
uint32_t
sector_size
,
uint32_t
cfg_entry
)
{
int
i
;
dev
->
bus
=
bus
;
dev
->
sector_size
=
sector_size
;
dev
->
cfg_entry
=
cfg_entry
;
dev
->
use_4byte_addr
=
0
;
for
(
i
=
0
;
i
<
10
;
i
++
)
...
...
dev/storage.c
View file @
a057343e
...
...
@@ -184,6 +184,7 @@ void storage_spiflash_create(struct storage_device *dev, struct spi_flash_device
dev
->
priv
=
flash
;
dev
->
rwops
=
&
spi_flash_rwops
;
dev
->
size
=
flash
->
size
;
dev
->
cfg_entry
=
flash
->
cfg_entry
;
dev
->
block_size
=
flash
->
sector_size
;
dev
->
entry_points
=
spi_flash_default_entry_points
;
dev
->
flags
=
STORAGE_FLAG_DEVICE_OK
;
...
...
@@ -1092,7 +1093,7 @@ static inline unsigned long SDB_ALIGN(unsigned long x, int blocksize)
}
int
storage_sdbfs_format
(
struct
storage_device
*
dev
,
uint32_t
base_addr
)
int
storage_sdbfs_format
(
struct
storage_device
*
dev
,
uint32_t
addr
,
int
force_base
)
{
struct
sdb_device
*
sdbfs
=
(
struct
sdb_device
*
)
sdbfs_default_bin
;
...
...
@@ -1104,6 +1105,12 @@ int storage_sdbfs_format( struct storage_device *dev, uint32_t base_addr )
char
buf
[
19
]
=
{
0
};
int
cur_adr
,
size
;
uint32_t
val
;
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
;
...
...
include/dev/spi_flash.h
View file @
a057343e
...
...
@@ -20,11 +20,12 @@ struct spi_flash_device
struct
spi_bus
*
bus
;
uint32_t
sector_size
;
uint32_t
size
;
uint32_t
cfg_entry
;
int
use_4byte_addr
;
};
void
spi_flash_create
(
struct
spi_flash_device
*
dev
,
struct
spi_bus
*
bus
,
uint32_t
sector_size
);
void
spi_flash_create
(
struct
spi_flash_device
*
dev
,
struct
spi_bus
*
bus
,
uint32_t
sector_size
,
uint32_t
cfg_entry
);
int
spi_flash_write
(
struct
spi_flash_device
*
dev
,
uint32_t
addr
,
uint8_t
*
buf
,
int
count
);
int
spi_flash_read
(
struct
spi_flash_device
*
dev
,
uint32_t
addr
,
uint8_t
*
buf
,
int
count
);
uint32_t
spi_flash_read_id
(
struct
spi_flash_device
*
dev
);
...
...
include/storage.h
View file @
a057343e
...
...
@@ -106,6 +106,7 @@ struct storage_device
void
*
priv
;
uint32_t
block_size
;
uint32_t
size
;
uint32_t
cfg_entry
;
int32_t
*
entry_points
;
struct
storage_rwops
*
rwops
;
int
flags
;
...
...
@@ -127,7 +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_format
(
struct
storage_device
*
dev
,
uint32_t
base_addr
);
int
storage_sdbfs_format
(
struct
storage_device
*
dev
,
uint32_t
addr
,
int
force_base
);
void
storage_sdbfs_list
(
void
);
int
storage_get_calibration_parameter
(
int
id
,
uint32_t
*
valp
);
...
...
shell/cmd_sdb.c
View file @
a057343e
...
...
@@ -28,14 +28,17 @@ static int cmd_sdb(const char *args[])
return
0
;
}
if
(
!
strcasecmp
(
args
[
0
],
"format"
))
{
if
(
!
strcasecmp
(
args
[
0
],
"format"
)
||
!
strcasecmp
(
args
[
0
],
"fs"
)
)
{
uint32_t
base
=
0
;
if
(
!
args
[
1
]
)
if
(
!
args
[
1
]
)
{
pp_printf
(
"Formatting using default location
\n
"
);
else
storage_sdbfs_format
(
&
wrc_storage_dev
,
base
,
0
);
}
else
{
base
=
atoi
(
args
[
1
]);
storage_sdbfs_format
(
&
wrc_storage_dev
,
base
);
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
],
"ls"
))
{
storage_sdbfs_list
();
...
...
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