Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Simple VME FMC Carrier SVEC
Manage
Activity
Members
Labels
Plan
Issues
14
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
Simple VME FMC Carrier SVEC
Commits
2c7fdcbc
Commit
2c7fdcbc
authored
11 years ago
by
Tomasz Wlostowski
Browse files
Options
Downloads
Patches
Plain Diff
software/vme-flasher: more reliable check for old version of the bootloader
parent
996b595a
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
software/vme-flasher/svec-flasher.c
+25
-0
25 additions, 0 deletions
software/vme-flasher/svec-flasher.c
with
25 additions
and
0 deletions
software/vme-flasher/svec-flasher.c
+
25
−
0
View file @
2c7fdcbc
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment