Commit 42026c4e authored by Tjeerd Pinkert's avatar Tjeerd Pinkert Committed by Adam Wujek

userspace/tools: Initial commit of wrs_pps_control

It has the basic structure but lacks the functionality.
Needs cleanup of libraries used.
Signed-off-by: Tjeerd Pinkert's avatarTjeerd Pinkert <t.j.pinkert@alumnus.utwente.nl>
parent f202c7ce
......@@ -23,3 +23,4 @@ wrs_checkcfg
mkpasswd
wrs_status_led
wrs_sfp_dump
wrs_pps_control
TOOLS = rtu_stat wr_mon wr_phytool spll_dbg_proxy load-lm32 load-virtex com
TOOLS = rtu_stat wr_mon wr_phytool wrs_pps_control spll_dbg_proxy load-lm32 load-virtex com
TOOLS += mapper wmapper
TOOLS += wrs_version wr_date lm32-vuart wrs_pstats
TOOLS += wrs_vlans wrs_dump_shmem
......
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <libwr/wrs-msg.h>
#include <libwr/switch_hw.h>
#include <libwr/pps_gen.h>
#define PPS_ON 1
#define PPS_OFF 0
void help(char *prgname)
{
fprintf(stderr, "%s: Use: \"%s [<options>] <cmd>\n",
prgname, prgname);
fprintf(stderr,
" The program has the following options\n"
" -h print help\n"
"\n"
" Commands are:\n"
" on - switch PPS output on.\n"
" off - switch PPS output off.\n");
exit(1);
}
int main(int argc, char *argv[])
{
int opt;
while ((opt = getopt(argc, argv, "h")) != -1) {
switch (opt) {
case 'h':
default:
help(argv[0]);
}
}
if (argc > 1) {
if (strcmp(argv[1], "on") == 0) {
assert_init(shw_fpga_mmap_init());
shw_pps_gen_enable_output(PPS_ON);
exit(0);
} else if (strcmp(argv[1], "off") == 0) {
assert_init(shw_fpga_mmap_init());
shw_pps_gen_enable_output(PPS_OFF);
exit(0);
} else {
printf("Unknown command\n;");
exit(1);
}
} else {
printf("No command given\n");
exit(1);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment