Changeset 16cf6ff in avrstuff for EPRoxygen/main.cpp


Ignore:
Timestamp:
Jul 12, 2012, 10:20:53 PM (12 years ago)
Author:
Adrien Destugues <pulkomandy@…>
Branches:
main
Children:
f2bd94f
Parents:
a6ae6ac
Message:

Add some suport for reading 27c020 chips.

Should be usable with most other ROMs as well.

git-svn-id: svn://pulkomandy.tk/avrstuff@61 c6672c3c-f6b6-47f9-9001-1fd6b12fecbe

File:
1 edited

Legend:

Unmodified
Added
Removed
  • EPRoxygen/main.cpp

    ra6ae6ac r16cf6ff  
    1010
    1111#include "device.h"
     12#include "27c020.h"
    1213#include "at29c040.h"
    1314
     
    2223        int error = 0;
    2324
    24         puts("EPRoxygen - UNIX driver for SEEIT EPR-02 ROM programmer\n"
     25        fprintf(stderr, "EPRoxygen - UNIX driver for SEEIT EPR-02 ROM programmer\n"
    2526                "Copyright 2012, Adrien Destugues <pulkomandy@pulkomandy.tk>\n"
    2627                "Distributed under the terms of the MIT licence\n"
     
    4849                        case 'd':
    4950                                // TODO Set device
    50                                 if (strcmp(optarg, "AT29C040"))
     51                                if (strcmp(optarg, "AT29C040") == 0)
    5152                                {
     53                                        device = new AT29C040();
     54                                } else if(strcmp(optarg, "27C020") == 0)
     55                                {
     56                                        device = new x27C020();
     57                                } else {
    5258                                        fprintf(stderr,"Unknown device (only AT29C040 is supported)\n");
    5359                                        error = -3;
    5460                                        goto abort;
    5561                                }
    56                                 device = new AT29C040();
    5762                                break;
    5863                        case 'r':
     
    7176                                opcode = c;
    7277                }
     78        }
     79
     80        if (optind < argc)
     81        {
     82                fprintf(stderr, "Error parsing the command line before \"%s\"\n", argv[optind]);
     83                error = -7;
     84                goto abort;
    7385        }
    7486
     
    94106        }
    95107
    96         // TODO Ask user to put ROM on socket
    97         puts("Now insert chip into socket, then press any key...");
     108        fprintf(stderr,"Now insert chip into socket, then press any key...\n");
    98109        getchar();
    99110
     
    117128
    118129abort:
    119         device->shutdown();
     130        // TODO in case ioperm failed, delete will try to shutdown() and give a bus error...
    120131        delete device;
    121132
Note: See TracChangeset for help on using the changeset viewer.