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
84
Issues
84
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
a1fc8805
Commit
a1fc8805
authored
Jul 10, 2015
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace/tools: add wrs_status_led to manage status LED
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
06920861
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
0 deletions
+90
-0
Makefile
userspace/tools/Makefile
+2
-0
wrs_status_led.c
userspace/tools/wrs_status_led.c
+88
-0
No files found.
userspace/tools/Makefile
View file @
a1fc8805
...
...
@@ -6,6 +6,8 @@ TOOLS += sdb-read
TOOLS
+=
nbtee
TOOLS
+=
wrs_auxclk
TOOLS
+=
wrs_checkcfg
TOOLS
+=
wrs_status_led
PPSI_CONFIG
=
../ppsi/include/generated/autoconf.h
WR_INSTALL_ROOT
?=
/usr/lib/white-rabbit
...
...
userspace/tools/wrs_status_led.c
0 → 100644
View file @
a1fc8805
/*
* wrs_status_led.c
*
* Turn on/off and change color of status LED
*
* Created on: July 9, 2015
* Authors:
* - Adam Wujek
*
* 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 <getopt.h>
#include <libwr/shw_io.h>
#include <libwr/wrs-msg.h>
#ifndef __GIT_VER__
#define __GIT_VER__ "x.x"
#endif
#ifndef __GIT_USR__
#define __GIT_USR__ "?"
#endif
void
help
(
const
char
*
pgrname
)
{
printf
(
"wrs_status_led. Commit %s, built on "
__DATE__
"
\n
"
,
__GIT_VER__
);
printf
(
"usage: %s <command>
\n
"
,
pgrname
);
printf
(
"available commands are:
\n
"
" -x turn off status led
\n
"
" -h this help
\n
"
"
\n
"
);
exit
(
1
);
}
int
main
(
int
argc
,
char
**
argv
)
{
int
opt
;
/* argc forced to 1: -t and -v are not "terse" and "verbose" */
wrs_msg_init
(
1
,
argv
);
assert_init
(
shw_pio_mmap_init
());
shw_io_init
();
shw_io_configure_all
();
while
((
opt
=
getopt
(
argc
,
argv
,
"yxhqv"
))
!=
-
1
)
{
switch
(
opt
)
{
case
'x'
:
shw_io_write
(
shw_io_led_state_o
,
0
);
shw_io_write
(
shw_io_led_state_g
,
0
);
break
;
case
'y'
:
shw_io_write
(
shw_io_led_state_o
,
1
);
shw_io_write
(
shw_io_led_state_g
,
1
);
break
;
case
'h'
:
help
(
argv
[
0
]);
exit
(
0
);
break
;
case
'q'
:
break
;
/* done in wrs_msg_init() */
case
'v'
:
break
;
/* done in wrs_msg_init() */
default:
fprintf
(
stderr
,
"Unrecognized option. Call %s -h for help.
\n
"
,
argv
[
0
]);
exit
(
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