Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
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
White Rabbit Switch - Software
Commits
79a97ac9
Commit
79a97ac9
authored
Jan 28, 2013
by
Benoit Rat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libswitchhw: adding shw_ver tool to obtain infos about versions
parent
a3f0fe6d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
105 additions
and
2 deletions
+105
-2
.gitignore
userspace/tools/.gitignore
+3
-1
Makefile
userspace/tools/Makefile
+11
-1
shw_ver.c
userspace/tools/shw_ver.c
+91
-0
No files found.
userspace/tools/.gitignore
View file @
79a97ac9
...
...
@@ -6,4 +6,6 @@ spll_dbg_proxy
wr_phytool
com
mapper
wmapper
\ No newline at end of file
wmapper
shw_ver
userspace/tools/Makefile
View file @
79a97ac9
TOOLS
=
rtu_stat wr_mon wr_phytool spll_dbg_proxy load-lm32 load-virtex com
TOOLS
+=
mapper wmapper
TOOLS
+=
mapper wmapper
shw_ver
# # Standard stanza for cross-compilation (courtesy of the linux makefile)
...
...
@@ -13,6 +13,10 @@ STRIP = $(CROSS_COMPILE)strip
OBJCOPY
=
$(CROSS_COMPILE)
objcopy
OBJDUMP
=
$(CROSS_COMPILE)
objdump
#
GIT_VER
=
$(
shell
git describe
--always
--dirty
=
+ |
sed
's;^.*-\([v0-9\.]*\)\([a-z0-9\-+]*\)$$;\1\2;'
)
GIT_USR
=
$(
shell
git config
--get-all
user.name
)
# LOTs of includes
CFLAGS
=
-O2
-DDEBUG
-g
\
-I
$(LINUX)
/include
\
...
...
@@ -49,6 +53,12 @@ load-virtex: load-virtex.o load-fpga.o
load-lm32
:
load-lm32.o lm32-loader.o
${
CC
}
-o
$@
$^
$(LDFLAGS)
shw_ver.o
:
shw_ver.c
${
CC
}
${
CFLAGS
}
-D__GIT_USR__
=
"
\"
${
GIT_USR
}
\"
"
-D__GIT_VER__
=
"
\"
${
GIT_VER
}
\"
"
$(LDFLAGS)
-c
-o
$@
$^
shw_ver
:
shw_ver.o
${
CC
}
-o
$@
$^
$(LDFLAGS)
clean
:
rm
-f
$(TOOLS)
*
.o
*
~
...
...
userspace/tools/shw_ver.c
0 → 100644
View file @
79a97ac9
/*
* shw_ver.c
*
* Obtain the HW version and FPGA type.
*
* Created on: Jan 20, 2012
* Authors:
* - Benoit RAT
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License...
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <shw_io.h>
#include "pio.h"
#ifndef __GIT_VER__
#define __GIT_VER__ "x.x"
#endif
#ifndef __GIT_USR__
#define __GIT_USR__ "?"
#endif
void
help
(
const
char
*
pgrname
)
{
printf
(
"usage: %s <command>
\n
"
,
pgrname
);
printf
(
"available commands are:
\n
"
" -p PCB version
\n
"
" -f FPGA size
\n
"
" -c Compiling time
\n
"
" -v version (git)
\n
"
" -a All (default)
\n
"
"
\n
"
);
exit
(
1
);
}
int
main
(
int
argc
,
char
**
argv
)
{
char
func
=
'a'
;
if
(
argc
>=
2
&&
argv
[
1
][
0
]
==
'-'
)
{
func
=
argv
[
1
][
1
];
}
else
func
=
'a'
;
assert_init
(
shw_pio_mmap_init
());
shw_io_init
();
shw_io_t
*
all_io
=
(
shw_io_t
*
)
_all_shw_io
;
switch
(
func
)
{
case
'p'
:
printf
(
"%s
\n
"
,
get_shw_info
(
func
));
break
;
case
'f'
:
printf
(
"%s
\n
"
,
get_shw_info
(
func
));
break
;
case
'c'
:
printf
(
"%s %s
\n
"
,
__DATE__
,
__TIME__
);
break
;
case
'v'
:
printf
(
"%s %s
\n
"
,
__GIT_VER__
,
__GIT_USR__
);
case
'a'
:
printf
(
"PCB:%s, FPGA:%s; version: %s (%s); compiled at %s %s
\n
"
,
get_shw_info
(
'p'
),
get_shw_info
(
'f'
),
__GIT_VER__
,
__GIT_USR__
,
__DATE__
,
__TIME__
);
break
;
case
'h'
:
default:
help
(
argv
[
0
]);
return
1
;
}
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