X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f X-Originating-IP: [213.131.66.41] From: "Mohamed El-dawy" To: djgpp AT delorie DOT com Subject: could you please compile this? Date: Fri, 15 Feb 2002 18:31:02 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 15 Feb 2002 18:31:02.0555 (UTC) FILETIME=[EBF5E6B0:01C1B64E] Reply-To: djgpp AT delorie DOT com Good morning... i had the following C program, i tried to compile in VC++6, but it didn't compile. i was told it was written for DJGPP, and as i am having some problems on the machine having DJGPP, and i am too lazy to install it on this m/c :), could some one please try to compile it on his machine? if it compiles please tell me, and i'd be very grateful if you send me the resulting executable (no viruses or spyware please, thank you! :)) Thank you very much in advance... yours.. Mohamed El Dawy /* eepromburn.c * eeprom burning software to accompanying the eeprom programmer * design at: http://ucsub.colorado.edu/~kominek/hardware/eeprom.html * * written by jay f kominek * public domain, 1999... or 2000... somewhere in there... */ #include #include #include #include #include #include #include #include #include #include #include #define BASEPORT 0x378 #define DataShiftRegCtl (1<<7) #define ShiftRegClk (1<<6) #define DataSerialOut (1<<5) #define ShiftRegReset (1<<4) #define EEPROMWE (1<<3) #define EEPROMOE (1<<2) #define AddrHSerialOut (1<<1) #define AddrLSerialOut (1<<0) #define DataShiftRegOE (1<<3) #define DataSerialIn (1<<6) #undef CSI 1 #define MYoutb(X,Y) {unsigned char foo=(ShiftRegReset|EEPROMWE|EEPROMOE);foo^=(X);outb(foo,Y);} #define debugpause(X) {/*printf(X);getchar();*/} void nsleep(long nsec) { struct timespec in, out; in.tv_sec = 0; in.tv_nsec = nsec; nanosleep(&in,&out); } void printbinary(unsigned char byte) { int i; for(i=7;i>=0;i--) { printf("%i",(byte&(1<>8; val=ShiftRegReset; MYoutb(val,BASEPORT); nsleep(100); /* Load up the serial-in/parallel-out shift register */ for(i=7;i>=0;i--) { int databit = !!(byte&(1<>8; val=ShiftRegReset; MYoutb(val,BASEPORT); nsleep(75); MYoutb(0,BASEPORT); /* Load up the serial-in/parallel-out shift register for the address */ for(i=7;i>=0;i--) { int ahbit = !!(ah&(1<=0;i--) { unsigned char status; MYoutb(ShiftRegClk,BASEPORT); nsleep(100); // printf("look at output bit %i\n",i); getchar(); MYoutb(0,BASEPORT); nsleep(100); /* Guarantee that the output has stabilized */ status = inb(BASEPORT+1); byte |= ((!!(status&DataSerialIn))<32768?32768:maxbytes; }break; case 'r': { readfile=(char *)malloc(strlen(optarg)+1); strcpy(readfile,optarg); }break; case 'w': { writefile=(char *)malloc(strlen(optarg)+1); strcpy(writefile,optarg); }break; case 'i': { // interrupt/BRK intv = strtoul(optarg,NULL,16); }break; case 'b': { // boot/reset bootv = strtoul(optarg,NULL,16); }break; case 'n': { // nmi nmiv = strtoul(optarg,NULL,16); }break; } } if(ioperm(BASEPORT, 3, 1)) {perror("ioperm");exit(1);} p.sched_priority = 1; sched_setscheduler(0, SCHED_RR, &p); fprintf(stderr, "Taken on soft realtime priority.\n"); if(writefile) { int cnt=0xf; fd = open(writefile,O_RDONLY); fstat(fd, &buf); printf("File opened, %i bytes long.\n",buf.st_size); if(buf.st_size>32768) { printf("File too big. (EEPROM is 32768 bytes big.) Exiting.\n"); exit(1); } data=(unsigned char*)mmap(0,(buf.st_size>8, 0xFFFF-base, 1); writebyte( intv&0xFF, 0xFFFE-base, 1); } if(bootv!=0xFFFF) { writebyte((bootv&0xFF00)>>8, 0xFFFF-base, 1); writebyte( bootv&0xFF, 0xFFFC-base, 1); } if(nmiv!=0xFFFF) { writebyte( (nmiv&0xFF00)>>8, 0xFFFB-base, 1); writebyte( nmiv&0xFF, 0xFFFA-base, 1); } } } if(readfile) { fd = creat(readfile,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); printf("Beginning read.\n"); for(ptr=0;ptr