Changeset 16cf6ff in avrstuff


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

Location:
EPRoxygen
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • EPRoxygen/Makefile

    ra6ae6ac r16cf6ff  
    1 eproxygen: main.o at29c040.o
     1eproxygen: main.o at29c040.o 27c020.o
    22        g++ -Wall -g -O3 -fno-rtti -fno-exceptions $^ -o $@
    33
  • EPRoxygen/device.h

    ra6ae6ac r16cf6ff  
    2020                {};
    2121
     22                virtual ~Device() {
     23                        shutdown();
     24                };
     25
    2226                void shutdown();
    2327                virtual void power() = 0;
     
    3842                        return 0;
    3943                }
    40 
    41                 virtual ~Device() {};
    42        
    4344        protected:
    4445                typedef enum {
     
    131132                        usleep(1000);
    132133                        byte |= inb(port + 1) >> 4;
    133 printf("R %X", byte ^ 0x88);
    134 getchar();
    135134                        outb(port+2, NYBLE ^ 4);
    136135                        usleep(1000);
  • 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.