Date:2012-12-31 05:54:36 (11 years 2 months ago)
Author:Werner Almesberger
Commit:c7a7d358bb5c7d67dd2cee71e519122e4e4144f4
Message:lpc111x-isp/lpc111x.c: new option -r to reset the target and let it run

Files: lpc111x-isp/lpc111x.c (4 diffs)

Change Details

lpc111x-isp/lpc111x.c
563563}
564564
565565
566/* ----- Reset and run target ---------------------------------------------- */
567
568
569static void run_target(int power)
570{
571    if (ubb_open(0) < 0) {
572        perror("ubb_open");
573        exit(1);
574    }
575
576    if (power)
577        ubb_power(1);
578
579    SET(TGT_nRESET);
580    OUT(TGT_nRESET);
581
582    IN(TGT_nISP);
583
584    CLR(TGT_nRESET);
585    usleep(10); /* DS Table 9 pg 29 says min 50 ns */
586    SET(TGT_nRESET);
587
588    ubb_close(UBB_nPWR | TGT_nRESET | TGT_nISP);
589}
590
591
566592/* ----- Command-line processing ------------------------------------------- */
567593
568594
569595static void usage(const char *name)
570596{
571597    fprintf(stderr,
572"usage: %s [-n] [-q] [-v ...] [file.bin]\n\n"
598"usage: %s [-n] [-q] [-v ...] [file.bin]\n"
599" %s [-n] -r\n\n"
573600" -n don't power the device\n"
574601" -q suppress basic progress messages\n"
602" -r reset the target and let it run\n"
575603" -v increase verbosity level\n"
576    , name);
604    , name, name);
577605    exit(1);
578606}
579607
...... 
582610{
583611    FILE *file = NULL;
584612    int power = 1;
613    int run = 0;
585614    int c;
586615
587    while ((c = getopt(argc, argv, "nqv")) != EOF)
616    while ((c = getopt(argc, argv, "nqrv")) != EOF)
588617        switch (c) {
589618        case 'n':
590619            power = 0;
...... 
592621        case 'q':
593622            quiet = 1;
594623            break;
624        case 'r':
625            run = 1;
626            break;
595627        case 'v':
596628            verbose++;
597629            break;
...... 
599631            usage(*argv);
600632        }
601633
634    if (run) {
635        if (quiet || verbose || argc != optind)
636            usage(*argv);
637        run_target(power);
638        return 0;
639    }
640
602641    switch (argc-optind) {
603642    case 0:
604643        break;

Archive Download the corresponding diff file

Branches:
master



interactive