OpenCores
URL https://opencores.org/ocsvn/s6soc/s6soc/trunk

Subversion Repositories s6soc

[/] [s6soc/] [trunk/] [sw/] [host/] [dumpuart.cpp] - Diff between revs 19 and 45

Show entire file | Details | Blame | View Log

Rev 19 Rev 45
Line 52... Line 52...
int main(int argc, char **argv) {
int main(int argc, char **argv) {
        const char      *dev = argv[1];
        const char      *dev = argv[1];
        const   char    *fname = (argc>=3)?argv[2]:NULL;
        const   char    *fname = (argc>=3)?argv[2]:NULL;
        int     ttyfd = -1, dumpfd = -1;
        int     ttyfd = -1, dumpfd = -1;
 
 
 
        if (argc < 2) {
 
                fprintf(stderr, "USAGE: dumpuart /dev/tty... \n");
 
                exit(EXIT_FAILURE);
 
        }
 
 
        ttyfd = open(dev, O_RDONLY);
        ttyfd = open(dev, O_RDONLY);
 
        if (ttyfd < 0) {
 
                fprintf(stderr, "Could not open device, %s\n", dev);
 
                exit(EXIT_FAILURE);
 
        }
 
        if (!isatty(ttyfd)) {
 
                fprintf(stderr, "Err: %s is not a terminal!\n", dev);
 
                exit(EXIT_FAILURE);
 
        }
 
 
        if (fname)
        if (fname)
                dumpfd = open(fname, O_CREAT|O_TRUNC|O_WRONLY, 0644);
                dumpfd = open(fname, O_CREAT|O_TRUNC|O_WRONLY, 0644);
 
 
        // Set the baud rate ...
        // Set the baud rate ...
        {
        {

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.