1
0
mirror of https://github.com/preble/libpinproc synced 2026-02-24 18:25:23 +01:00

Parsing of board ID for P3-ROC and P-ROC are now different. Both read from address 3, but P3-ROC is bits 11:8, and P-ROC is bits 7:4.

This commit is contained in:
p3
2020-05-22 12:54:19 -05:00
parent bd0046c144
commit 31e7b0b784

View File

@@ -2176,10 +2176,20 @@ int checkPROCFile() {
PRReadData(proc, 0, 0, 4, readdata); PRReadData(proc, 0, 0, 4, readdata);
board_id = readdata[0]; board_id = readdata[0];
board_rev = readdata[3]; board_rev = readdata[3];
if (board_id == P3_ROC_CHIP_ID) {
board_rev = (board_rev & 0x800) >> 11 |
(board_rev & 0x400) >> 10 |
(board_rev & 0x200) >> 9 |
(board_rev & 0x100) >> 8;
fprintf(stderr, "\nReading P3-ROC board_rev: %d", board_rev);
}
else {
board_rev = (board_rev & 0x80) >> 7 | board_rev = (board_rev & 0x80) >> 7 |
(board_rev & 0x40) >> 5 | (board_rev & 0x40) >> 6 |
(board_rev & 0x20) >> 3 | (board_rev & 0x20) >> 5 |
(board_rev & 0x10) >> 1; (board_rev & 0x10) >> 4;
fprintf(stderr, "\nReading P-ROC board_rev: %d", board_rev);
}
if (proc_file_version != 0) { if (proc_file_version != 0) {
fprintf(stderr, "\nERROR: Unsupported .p-roc file version: %x. Check for an updated version of this tool.\n\n", proc_file_version); fprintf(stderr, "\nERROR: Unsupported .p-roc file version: %x. Check for an updated version of this tool.\n\n", proc_file_version);
@@ -2197,6 +2207,14 @@ int checkPROCFile() {
return 0; return 0;
} }
else fprintf(stderr, "\nBoard ID verified"); else fprintf(stderr, "\nBoard ID verified");
if (board_rev > max_board_rev) {
fprintf(stderr, "\nERROR: board_rev %d > max_board_rev %d", board_rev, max_board_rev);
}
if (board_rev < min_board_rev) {
fprintf(stderr, "\nERROR: board_rev < min_board_rev");
}
if (board_rev > max_board_rev || board_rev < min_board_rev) { if (board_rev > max_board_rev || board_rev < min_board_rev) {
fprintf(stderr, "\nERROR: This image is not compatible with the P-ROC board (rev: %x)", board_id); fprintf(stderr, "\nERROR: This image is not compatible with the P-ROC board (rev: %x)", board_id);
return 0; return 0;