From: Jan-Benedict G. <jb...@us...> - 2004-10-19 18:01:15
|
Update of /cvsroot/linux-vax/usr/firmware_dumper In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9084 Modified Files: main.c main.h Makefile Added Files: backend_alpha.c Log Message: - Alpha support by Peter De Schrijver. - Works for his Turbochannel based M300. Index: main.c =================================================================== RCS file: /cvsroot/linux-vax/usr/firmware_dumper/main.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- main.c 19 Oct 2004 17:58:16 -0000 1.6 +++ main.c 19 Oct 2004 18:00:58 -0000 1.7 @@ -43,6 +43,12 @@ .init = &vax_init, .get_byte = &vax_get_byte, }, + { + .name = "alpha", + .wordsize = 64, + .init = &alpha_init, + .get_byte = &alpha_get_byte, + }, }; --- NEW FILE: backend_alpha.c --- #include <stdio.h> #include <string.h> #include "main.h" #include <unistd.h> #include "serial.h" int alpha_init (int fd) { unsigned char one_byte; int ret; serial_send_break (fd, 0); do { ret = serial_read_byte (fd, &one_byte, 1, 0); } while (ret == 0); sleep (3); do { ret = serial_read_byte (fd, &one_byte, 1, 0); } while (ret == 0); return 0; } int alpha_get_byte (int fd, unsigned char *output, unsigned long long int address) { unsigned char output_buffer[100]; unsigned char input_buffer[200]; unsigned char *ptr; int ret; int input_len = 0; sprintf (output_buffer, "EXAMINE -B -PM -U %016llx\r\n", address); serial_write (fd, output_buffer, strlen (output_buffer)); bzero (input_buffer, sizeof (input_buffer)); do { ret = serial_read_byte (fd, &input_buffer[input_len], 1, 0); if (ret == 0) input_len++; } while (ret == 0 && input_len < sizeof (input_buffer) && !strstr (input_buffer, ">>> ")); if (ret) return -1; ptr = input_buffer; /* Over-read first line */ while (*ptr != '\n' && *ptr != '\r') ptr++; while (*ptr == '\n' || *ptr == '\r') ptr++; ptr++; /* Strip leading spaces of second line */ while (*ptr == ' ') ptr++; /* Over-read 'P' */ ptr+=5; /* Strip leading spaces of second line */ while (*ptr == ' ') ptr++; /* Strip address */ while ( ((*ptr >= '0') && (*ptr <= '9')) || ((*ptr >= 'a') && (*ptr <= 'z')) || ((*ptr >= 'A') && (*ptr <= 'Z')) || (*ptr == '.')) *ptr++; /* Strip leading spaces */ while (*ptr == ' ') ptr++; /* Now get the byte */ if (*ptr >= 'A' && *ptr <= 'Z') *ptr = *ptr - 'A' + 'a'; if (*ptr >= '0' && *ptr <= '9') *output = *ptr - '0'; else *output = *ptr - 'a' + 10; *output <<= 4; ptr++; if (*ptr >= 'A' && *ptr <= 'Z') *ptr = *ptr - 'A' + 'a'; if (*ptr >= '0' && *ptr <= '9') *output |= *ptr - '0'; else *output |= *ptr - 'a' + 10; return 0; } Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/usr/firmware_dumper/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile 23 Jul 2004 17:44:47 -0000 1.1 +++ Makefile 19 Oct 2004 18:00:58 -0000 1.2 @@ -1,6 +1,7 @@ #!/usr/bin/make -f OBJECTS= main.o \ + backend_alpha.o \ backend_vax.o \ serial.o Index: main.h =================================================================== RCS file: /cvsroot/linux-vax/usr/firmware_dumper/main.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- main.h 19 Oct 2004 17:59:53 -0000 1.2 +++ main.h 19 Oct 2004 18:00:58 -0000 1.3 @@ -4,4 +4,7 @@ extern int vax_init (int fd); extern int vax_get_byte (int fd, unsigned char *output, unsigned long long int address); +extern int alpha_init (int fd); +extern int alpha_get_byte (int fd, unsigned char *output, unsigned long long int address); + #endif /* _MAIN_H */ |