/* Copyright Motorola, Inc. 1993, 1994, 1999, 2000 ALL RIGHTS RESERVED You are hereby granted a copyright license to use, modify, and distribute the SOFTWARE so long as this entire notice is retained without alteration in any modified and/or redistributed versions, and that such modified versions are clearly identified as such. No licenses are granted by implication, estoppel or otherwise under any patents or trademarks of Motorola, Inc. The SOFTWARE is provided on an "AS IS" basis and without warranty. To the maximum extent permitted by applicable law, MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE AND ANY WARRANTY AGAINST INFRINGEMENT WITH REGARD TO THE SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF) AND ANY ACCOMPANYING WRITTEN MATERIALS. To the maximum extent permitted by applicable law, IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE. Motorola assumes no responsibility for the maintenance and support of the SOFTWARE. */ /* config_decoder.c decode the config registers * * make this file with the following command: * cc config_decoder.c -o config_decoder * or * gcc config_decoder.c -o config_decoder * * invoke it with config_decoder.elf * * * mo 6/1/00 initial program MPC107 * mo 6/13/00 start MPC106 * mo 7/5/00 upgrade MPC106 to Rev 4.0 * mo 7/6/00 allow user to print in big or little endian mode * */ /* Includes */ #include "config_decoder.h" #include /* Globals */ char lh[MAXLINE][MAXLINESIZE]; /* hold a print line for later printing */ int lc=-1; /* index for lh */ int order=BIG; int lhIndex[10]; /*used to get the minor regs i.e. 0x06 etc in correct order*/ int li=-1; /* index for lhIndex */ int main() { char description[61]; int scanreturn=0; int status; int counter,i; printf("Configuration Register Decoder Version 0.8 July 10, 2000\n"); printf("Enter a description of this data, 60 characters or less\n>>"); gets(description); printf("Data set: %s\n",description); printf("Please chose one of the following by number 1,2,3, or 4:\n"); printf(" 1. MPC106 Rev 4.0\n"); printf(" 2. MPC107\n"); printf(" 3. MPC8240 Host\n"); printf(" 4. MPC8240 Agent\n >>"); scanreturn=scanf("%d",&counter); if((scanreturn == 0) || (scanreturn == EOF)) { printf("ERROR: Invalid Entry, only numeric input acceptable\n"); return 0; } printf("Choose printing order:\n"); printf(" 1. Big endian order\n"); printf(" 2. Little endian order\n"); scanreturn=scanf("%d",&order); if((scanreturn == 0) || (scanreturn == EOF)) { printf("ERROR: Invalid Entry, only numeric input acceptable\n"); return 0; } #ifdef DEBUG printf("You chose %d\n",order); #endif /* DEBUG */ if(order == BIG) printf(" You chose Big endian order for printing\n"); else printf(" You chose Little endian order for printing\n\n"); switch(counter) { case 1: status = MPC106(); break; case 2: status = MPC107(); break; case 3: status = MPC8240H(); break; case 4: status = MPC8240A(); break; default: printf(" ERROR => Invalid entry, try again\n"); break; } return 0; } int MPC106() { int scanreturn=0; int status; int address=0,value; char separator; printf("MPC106 Decoder\n"); printOpen(); while(FOREVER) { #ifdef DEBUG printf("top of while\n"); #endif /* DEBUG */ printf(">> "); scanreturn=scanf("%x %c %x",&address,&separator,&value); if((scanreturn == 0)) { printf("ERROR: Invalid Entry, nn:nn hex values only\n"); return 0; } if((scanreturn == EOF)) { printf("End of File, Program complete\n"); return 0; } #ifdef DEBUG printf("DEBUG: address is %x, separator is %c, value is %x\n", address,separator,value); #endif /* DEBUG */ switch(address) { case 00: status = Reg00(value,PART_MPC106); break; case 04: status = Reg04(value,PART_MPC106); break; case 0x08: status = Reg08(value); break; case 0x0c: status = Reg0c(value); break; case 0x3c: status = Reg3c(value); break; case 0x40: status = Reg40(value,PART_MPC106); break; case 0x44: status = Reg44(value,PART_MPC106); break; case 0x48: status = Reg48(value,PART_MPC106); break; case 0x4c: status = Reg4c(value,PART_MPC106); break; case 0x50: status = Reg50(value,PART_MPC106); break; case 0x54: status = Reg54(value,PART_MPC106); break; case 0x58: status = Reg58(value,PART_MPC106); break; case 0x5c: status = Reg5c(value,PART_MPC106); break; case 0x70: status = Reg70(value,PART_MPC106); break; case 0x80: status = Reg80(value); break; case 0x84: status = Reg84(value); break; case 0x88: status = Reg88(value); break; case 0x8c: status = Reg8c(value); break; case 0x90: status = Reg90(value); break; case 0x94: status = Reg94(value); break; case 0x98: status = Reg98(value); break; case 0x9c: status = Reg9c(value); break; case 0xa0: status = Rega0(value); break; case 0xa8: status = Rega8(value,PART_MPC106); break; case 0xac: status = Regac(value,PART_MPC106); break; case 0xb8: status = Regb8(value,PART_MPC106); break; case 0xc0: status = Regc0(value,PART_MPC106); break; case 0xc4: status = Regc4(value,PART_MPC106); break; case 0xc8: status = Regc8(value,PART_MPC106); break; case 0xe0: status = Rege0(value,PART_MPC106); break; case 0xe4: status = Rege4(value); break; case 0xe8: status = Rege8(value); break; case 0xec: status = Regec(value); break; case 0xf0: status = Regf0(value,PART_MPC106); break; case 0xf4: status = Regf4(value,PART_MPC106); break; case 0xf8: status = Regf8(value,PART_MPC106); break; case 0xfc: status = Regfc(value,PART_MPC106); break; default: printf("ERROR: Invalid Register 0x%2X, try again\n",address); break; } } /* end of while address < 100 */ return 0; } int MPC107() { int scanreturn=0; int status; int address=0,value; char separator; printf("MPC107 Decoder\n"); printOpen(); while(FOREVER) { #ifdef DEBUG printf("top of while\n"); #endif /* DEBUG */ printf(">> "); scanreturn=scanf("%x %c %x",&address,&separator,&value); if((scanreturn == 0)) { printf("ERROR: Invalid Entry, nn:nn hex values only\n"); return 0; } if((scanreturn == EOF)) { printf("End of File, Program complete\n"); return 0; } #ifdef DEBUG printf("DEBUG: address is %x, separator is %c, value is %x\n", address,separator,value); #endif /* DEBUG */ switch(address) { case 00: status = Reg00(value,PART_MPC107); break; case 04: status = Reg04(value,PART_MPC107); break; case 0x08: status = Reg08(value); break; case 0x0c: status = Reg0c(value); break; case 0x10: status = Reg10(value); break; case 0x14: status = Reg14(value); break; case 0x3c: status = Reg3c(value); break; case 0x40: status = Reg40(value,PART_MPC107); break; case 0x44: status = Reg44(value,PART_MPC107); break; case 0x70: status = Reg70(value,PART_MPC107); break; case 0x74: status = Reg74(value,PART_MPC107); break; case 0x78: status = Reg78(value); break; case 0x80: status = Reg80(value); break; case 0x84: status = Reg84(value); break; case 0x88: status = Reg88(value); break; case 0x8c: status = Reg8c(value); break; case 0x90: status = Reg90(value); break; case 0x94: status = Reg94(value); break; case 0x98: status = Reg98(value); break; case 0x9c: status = Reg9c(value); break; case 0xa0: status = Rega0(value); break; case 0xa8: status = Rega8(value,PART_MPC107); break; case 0xac: status = Regac(value,PART_MPC107); break; case 0xb8: status = Regb8(value,PART_MPC107); break; case 0xc0: status = Regc0(value,PART_MPC107); break; case 0xc4: status = Regc4(value,PART_MPC107); break; case 0xc8: status = Regc8(value,PART_MPC107); break; case 0xe0: status = Rege0(value,PART_MPC107); break; case 0xf0: status = Regf0(value,PART_MPC107); break; case 0xf4: status = Regf4(value,PART_MPC107); break; case 0xf8: status = Regf8(value,PART_MPC107); break; case 0xfc: status = Regfc(value,PART_MPC107); break; default: printf("ERROR: Invalid Register 0x%2X, try again\n",address); break; } } /* end of while address < 100 */ return 0; } int MPC8240H() { int scanreturn=0; int status; int address=0,value; char separator; printf("MPC8240 Host Decoder\n"); printOpen(); while(FOREVER) { #ifdef DEBUG printf("top of while\n"); #endif /* DEBUG */ printf(">> "); scanreturn=scanf("%x %c %x",&address,&separator,&value); if((scanreturn == 0)) { printf("ERROR: Invalid Entry, nn:nn hex values only\n"); return 0; } if((scanreturn == EOF)) { printf("End of File, Program complete\n"); return 0; } #ifdef DEBUG printf("DEBUG: address is %x, separator is %c, value is %x\n", address,separator,value); #endif /* DEBUG */ switch(address) { case 00: status = Reg00(value,PART_MPC8240H); break; case 04: status = Reg04(value,PART_MPC8240H); break; case 0x08: status = Reg08(value); break; case 0x0c: status = Reg0c(value); break; case 0x10: status = Reg10(value); break; case 0x14: status = Reg14(value); break; case 0x3c: status = Reg3c(value); break; case 0x40: status = Reg40(value,PART_MPC8240H); break; case 0x44: status = Reg44(value,PART_MPC8240H); break; case 0x70: status = Reg70(value,PART_MPC8240H); break; case 0x74: status = Reg74(value,PART_MPC8240H); break; case 0x78: status = Reg78(value); break; case 0x80: status = Reg80(value); break; case 0x84: status = Reg84(value); break; case 0x88: status = Reg88(value); break; case 0x8c: status = Reg8c(value); break; case 0x90: status = Reg90(value); break; case 0x94: status = Reg94(value); break; case 0x98: status = Reg98(value); break; case 0x9c: status = Reg9c(value); break; case 0xa0: status = Rega0(value); break; case 0xa8: status = Rega8(value,PART_MPC8240H); break; case 0xac: status = Regac(value,PART_MPC8240H); break; case 0xb8: status = Regb8(value,PART_MPC8240H); break; case 0xc0: status = Regc0(value,PART_MPC8240H); break; case 0xc4: status = Regc4(value,PART_MPC8240H); break; case 0xc8: status = Regc8(value,PART_MPC8240H); break; case 0xe0: status = Rege0(value,PART_MPC8240H); break; case 0xf0: status = Regf0(value,PART_MPC8240H); break; case 0xf4: status = Regf4(value,PART_MPC8240H); break; case 0xf8: status = Regf8(value,PART_MPC8240H); break; case 0xfc: status = Regfc(value,PART_MPC8240H); break; default: printf("ERROR: Invalid Register 0x%2X, try again\n",address); break; } } /* end of while address < 100 */ return 0; } int MPC8240A() { int scanreturn=0; int status; int address=0,value; char separator; printf("MPC8240 Agent Decoder\n"); printOpen(); while(FOREVER) { #ifdef DEBUG printf("top of while\n"); #endif /* DEBUG */ printf(">> "); scanreturn=scanf("%x %c %x",&address,&separator,&value); if((scanreturn == 0)) { printf("ERROR: Invalid Entry, nn:nn hex values only\n"); return 0; } if((scanreturn == EOF)) { printf("End of File, Program complete\n"); return 0; } #ifdef DEBUG printf("DEBUG: address is %x, separator is %c, value is %x\n", address,separator,value); #endif /* DEBUG */ switch(address) { case 00: status = Reg00(value,PART_MPC8240A); break; case 04: status = Reg04(value,PART_MPC8240A); break; case 0x08: status = Reg08(value); break; case 0x0c: status = Reg0c(value); break; case 0x10: status = Reg10(value); break; case 0x14: status = Reg14(value); break; case 0x3c: status = Reg3c(value); break; case 0x40: status = Reg40(value,PART_MPC8240A); break; case 0x44: status = Reg44(value,PART_MPC8240A); break; case 0x70: status = Reg70(value,PART_MPC8240A); break; case 0x74: status = Reg74(value,PART_MPC8240A); break; case 0x78: status = Reg78(value); break; case 0x80: status = Reg80(value); break; case 0x84: status = Reg84(value); break; case 0x88: status = Reg88(value); break; case 0x8c: status = Reg8c(value); break; case 0x90: status = Reg90(value); break; case 0x94: status = Reg94(value); break; case 0x98: status = Reg98(value); break; case 0x9c: status = Reg9c(value); break; case 0xa0: status = Rega0(value); break; case 0xa8: status = Rega8(value,PART_MPC8240A); break; case 0xac: status = Regac(value,PART_MPC8240A); break; case 0xb8: status = Regb8(value,PART_MPC8240A); break; case 0xc0: status = Regc0(value,PART_MPC8240A); break; case 0xc4: status = Regc4(value,PART_MPC8240A); break; case 0xc8: status = Regc8(value,PART_MPC8240A); break; case 0xe0: status = Rege0(value,PART_MPC8240A); break; case 0xf0: status = Regf0(value,PART_MPC8240A); break; case 0xf4: status = Regf4(value,PART_MPC8240A); break; case 0xf8: status = Regf8(value,PART_MPC8240A); break; case 0xfc: status = Regfc(value,PART_MPC8240A); break; default: printf("ERROR: Invalid Register 0x%2X, try again\n",address); break; } } /* end of while address < 100 */ return 0; }