Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple VME FMC Carrier SVEC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
14
Issues
14
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Simple VME FMC Carrier SVEC
Commits
6f616715
Commit
6f616715
authored
Jan 24, 2014
by
Tomasz Wlostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/vme-flasher: more reliable check for old version of the bootloader
parent
ea79f9a6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
svec-flasher.c
software/vme-flasher/svec-flasher.c
+25
-0
No files found.
software/vme-flasher/svec-flasher.c
View file @
6f616715
...
@@ -114,6 +114,21 @@ void enter_bootloader()
...
@@ -114,6 +114,21 @@ void enter_bootloader()
}
}
}
}
/* Tests the presence of the SPI master in the bootloader to check if we are running
version > 1 (v1 does not have the version ID register) */
int
spi_test_presence
()
{
csr_writel
(
SXLDR_FAR_XFER
|
SXLDR_FAR_DATA_W
(
0xff
),
SXLDR_REG_FAR
);
usleep
(
100000
);
uint32_t
far
=
csr_readl
(
SXLDR_REG_FAR
);
/* transaction is not complete after so much time? no SPI... */
return
(
far
&
SXLDR_FAR_READY
);
}
void
spi_cs
(
int
cs
)
void
spi_cs
(
int
cs
)
{
{
csr_writel
(
cs
?
SXLDR_FAR_CS
:
0
,
SXLDR_REG_FAR
);
csr_writel
(
cs
?
SXLDR_FAR_CS
:
0
,
SXLDR_REG_FAR
);
...
@@ -291,12 +306,22 @@ int main(int argc, char *argv[])
...
@@ -291,12 +306,22 @@ int main(int argc, char *argv[])
init_vme
(
slot
);
init_vme
(
slot
);
enter_bootloader
();
enter_bootloader
();
if
(
!
spi_test_presence
())
{
fprintf
(
stderr
,
"SPI Master core not responding. You are probably be running an old version of the bootloader that doesn't support flash programming via VME.
\n
"
);
exit
(
-
1
);
}
if
(
flash_read_id
()
!=
ID_M25P128
)
{
if
(
flash_read_id
()
!=
ID_M25P128
)
{
fprintf
(
stderr
,
fprintf
(
stderr
,
"Flash memory ID invalid. You are probably be running an old version of the bootloader that doesn't support flash programming via VME.
\n
"
);
"Flash memory ID invalid. You are probably be running an old version of the bootloader that doesn't support flash programming via VME.
\n
"
);
exit
(
-
1
);
exit
(
-
1
);
}
}
int
version
=
SXLDR_CSR_VERSION_R
(
csr_readl
(
SXLDR_REG_CSR
));
printf
(
"Bootloader version: %d
\n
"
,
version
);
flash_program
(
BOOTLOADER_SDB_BASE
,
sdb_header
,
sizeof
(
sdb_header
));
flash_program
(
BOOTLOADER_SDB_BASE
,
sdb_header
,
sizeof
(
sdb_header
));
flash_program
(
BOOTLOADER_BITSTREAM_BASE
,
buf
,
size
);
flash_program
(
BOOTLOADER_BITSTREAM_BASE
,
buf
,
size
);
...
...
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