FreeCalypso > hg > freecalypso-tools
view rvinterf/etmsync/fdcmd.c @ 497:74610c4f10f7
target-utils: added 10 ms delay at the end of abb_power_off()
The deosmification of the ABB access code (replacement of osmo_delay_ms()
bogus delays with correctly-timed ones, which are significantly shorter)
had one annoying side effect: when executing the poweroff command from
any of the programs, one last '=' prompt character was being sent (and
received by the x86 host) as the Calypso board powers off. With delays
being shorter now, the abb_power_off() function was returning and the
standalone program's main loop was printing its prompt before the Iota chip
fully executed the switch-off sequence!
I thought about inserting an endless tight loop at the end of the
abb_power_off() function, but the implemented solution of a 10 ms delay
is a little nicer IMO because if the DEVOFF operation doesn't happen for
some reason in a manual hacking scenario, there won't be an artificial
blocker in the form of a tight loop keeping us from further poking around.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 25 May 2019 20:44:05 +0000 |
parents | e7502631a0f9 |
children |
line wrap: on
line source
/* * File descriptor debug commands */ #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include "etm.h" #include "ffs.h" #include "tmffs2.h" #include "limits.h" #include "localtypes.h" #include "localstruct.h" #include "cmdtab.h" #include "exitcodes.h" cmd_fd_open(argc, argv) char **argv; { int rc, fd; rc = fd_open(argv[1], strtoul(argv[2], 0, 16), &fd); if (rc) return(rc); printf("%d\n", fd); return(0); } cmd_fd_read(argc, argv) char **argv; { u_char databuf[MAX_READ_DATA]; int rc, sz, off, l; rc = fd_read(strtoul(argv[1], 0, 0), databuf, strtoul(argv[2], 0, 0), &sz); if (rc) return(rc); printf("%d bytes read\n", sz); for (off = 0; off < sz; off += 16) { l = sz - off; if (l > 16) l = 16; hexdump_line(off, databuf + off, l); } return(0); } cmd_fd_close(argc, argv) char **argv; { return fd_close(strtoul(argv[1], 0, 0)); } struct cmdtab fd_cmds[] = { {"close", 1, 1, cmd_fd_close}, {"open", 2, 2, cmd_fd_open}, {"read", 2, 2, cmd_fd_read}, {0, 0, 0, 0} }; cmd_fd(argc, argv) char **argv; { struct cmdtab *tp; int extargs; for (tp = fd_cmds; tp->cmd; tp++) if (!strcmp(tp->cmd, argv[1])) break; if (!tp->func) { fprintf(stderr, "error: no such fd command\n"); return(ERROR_USAGE); } extargs = argc - 2; if (extargs > tp->maxargs) { fprintf(stderr, "error: too many arguments\n"); return(ERROR_USAGE); } if (extargs < tp->minargs) { fprintf(stderr, "error: too few arguments\n"); return(ERROR_USAGE); } return tp->func(argc - 1, argv + 1); }