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
504cd753
Commit
504cd753
authored
Aug 16, 2023
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tool: minor style fixes
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
060a0973
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
20 deletions
+18
-20
svec-flasher.c
software/tools/vme-flasher/svec-flasher.c
+18
-20
No files found.
software/tools/vme-flasher/svec-flasher.c
View file @
504cd753
...
...
@@ -292,7 +292,8 @@ int flash_program(uint32_t addr, const uint8_t * data, int size, uint32_t flash_
fprintf
(
stderr
,
"Verification failed at offset 0x%06x (is: 0x%02x, should be: 0x%02x)
\n
."
,
addr
+
n
,
d
,
*
p
);
ret
=
-
EINVAL
;
errno
=
EINVAL
;
ret
=
-
1
;
goto
flash_program_exit
;
}
}
...
...
@@ -310,8 +311,7 @@ static int program_flash(struct bitstream *bitstream,
printf
(
"Programming the Application FPGA flash with bitstream %s.
\n
"
,
bitstream
->
path
);
if
(
!
spi_test_presence
())
{
if
(
!
spi_test_presence
())
{
fprintf
(
stderr
,
"SPI Master core not responding. You are probably be running an
\n
old version of the bootloader that doesn't support flash programming via VME.
\n
"
);
return
-
1
;
...
...
@@ -322,20 +322,19 @@ static int program_flash(struct bitstream *bitstream,
fprintf
(
stderr
,
"Flash memory ID invalid (0x%.8x). "
,
flash_id
);
fprintf
(
stderr
,
"You are probably running an old version of the bootloader
\n
"
);
fprintf
(
stderr
,
"that doesn't support flash programming via VME.
\n
"
);
return
-
ENODEV
;
errno
=
ENODEV
;
return
-
1
;
}
printf
(
"Flash ID: 0x%.7x, OK
\n
"
,
flash_id
);
if
(
fpga_bootloader_flash
)
{
if
(
fpga_bootloader_flash
)
{
char
confirm
[
1024
];
printf
(
"
\n
WARNING! You're about to update the SVEC bootloader.
\n
If this operation fails (due to incorrect bitstream or power loss), the card "
"can be only recovered through JTAG.
\n\n
"
);
printf
(
"Type 'yes' to continue or Ctrl-C to exit the program: "
);
fgets
(
confirm
,
1024
,
stdin
);
if
(
strncmp
(
confirm
,
"yes"
,
3
))
{
if
(
strncmp
(
confirm
,
"yes"
,
3
))
{
printf
(
"Bootloader update aborted.
\n
"
);
return
-
1
;
}
...
...
@@ -365,8 +364,8 @@ static int program_afpga(struct bitstream *bitstream)
csr_writel
(
SXLDR_CSR_SWRST
,
SXLDR_REG_CSR
);
csr_writel
(
SXLDR_CSR_START
|
SXLDR_CSR_MSBF
,
SXLDR_REG_CSR
);
while
(
i
<
bitstream
->
size
)
{
if
(
!
(
csr_readl
(
SXLDR_REG_FIFO_CSR
)
&
SXLDR_FIFO_CSR_FULL
))
while
(
i
<
bitstream
->
size
)
{
if
(
!
(
csr_readl
(
SXLDR_REG_FIFO_CSR
)
&
SXLDR_FIFO_CSR_FULL
))
{
uint32_t
word
=
*
(
uint32_t
*
)
(
bitstream
->
buf
+
i
);
...
...
@@ -377,18 +376,17 @@ static int program_afpga(struct bitstream *bitstream)
}
}
while
(
1
)
{
uint32_t
rval
=
csr_readl
(
SXLDR_REG_CSR
);
while
(
1
)
{
uint32_t
rval
=
csr_readl
(
SXLDR_REG_CSR
);
if
(
rval
&
SXLDR_CSR_DONE
)
{
printf
(
"Bitstream loaded, status: %s
\n
"
,
(
rval
&
SXLDR_CSR_ERROR
?
"ERROR"
:
"OK"
));
if
(
rval
&
SXLDR_CSR_DONE
)
{
printf
(
"Bitstream loaded, status: %s
\n
"
,
(
rval
&
SXLDR_CSR_ERROR
?
"ERROR"
:
"OK"
));
/* give the VME bus control to App FPGA */
csr_writel
(
SXLDR_CSR_EXIT
,
SXLDR_REG_CSR
);
if
(
rval
&
SXLDR_CSR_ERROR
)
return
-
1
;
return
0
;
}
if
(
rval
&
SXLDR_CSR_ERROR
)
return
-
1
;
return
0
;
}
}
return
0
;
...
...
@@ -495,7 +493,7 @@ int main(int argc, char *argv[])
init_vme
(
slot
);
enter_bootloader
();
if
(
!
fpga_configure
)
if
(
!
fpga_configure
)
err
=
program_flash
(
&
bitstream
,
fpga_bootloader_flash
);
else
err
=
program_afpga
(
&
bitstream
);
...
...
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