/*---------------------------------------------------------------------------- FILE: c2b.c DESCRIPTION: Translates object code structure to EPROM bytes. Part of pub21k.c program. AUTHOR: Jim Donahue, Analog Devices DSP Division (617) 461-3672 DATE: 6/13/91 MODIFIED: 4/10/92 to fix shift constant to LONG in scanDR ----------------------------------------------------------------------------*/ #include "pub21k.h" /*---------------------------------------------------------------------------- SUBROUTINE: changeState DESCRIPTION: change state of Test Access Port ----------------------------------------------------------------------------*/ void changeState(char *str, BYTE_ARRAY *bytes, long *bitindex) { #ifdef DEBUG printf ("changeState: bitindex = %d, byte = %X, index = %X\n", *bitindex, *bitindex/4, *bitindex%4); #endif while (*str != (char) NULL) { if (*str++ == '1') SET_TMS(*bitindex,0); (*bitindex)++; } } /*---------------------------------------------------------------------------- SUBROUTINE: scanIR DESCRIPTION: scan into Test Access Port Instruction register ----------------------------------------------------------------------------*/ void scanIR(char *str, BYTE_ARRAY *bytes, long *bitindex) { #ifdef DEBUG printf ("scanIR: bitindex = %d, byte = %X, index = %X\n", *bitindex, *bitindex/4, *bitindex%4); #endif while (*str != (char) NULL) { if (*str++ == '1') SET_TDI(*bitindex,0); (*bitindex)++; } (*bitindex)--; /* must correct bitindex since exiting scan state */ /* (TMS=1) must coincide with sending last datum */ } /*---------------------------------------------------------------------------- SUBROUTINE: scanDR DESCRIPTION: scan into Test Access Port Data register ----------------------------------------------------------------------------*/ void scanDR(int num, char strobeState, OBJCODE *code, BYTE_ARRAY *bytes, long *bitindex) { int i; #ifdef DEBUG printf ("scanDR: bitindex = %d, byte = %X, index = %X", *bitindex, *bitindex/4, *bitindex%4); if (strobeState) printf (", active strobes\n"); else printf (", inactive strobes\n"); #endif /* Set background mask of all ones - this assures inactive (high) */ /* memory strobes and interrupts. */ /* All further operations will be selective clearing of TDI bits */ for (i=0; ibank==BANK0) CLR_TDI(*bitindex,PMS0); else CLR_TDI(*bitindex,PMS1); CLR_TDI(*bitindex,PMWR); } for (i=0;i<24;i++) if (!((code+num)->pma & (1L<pmdl & (1L<pmdu & (1L<<(i-32)))) CLR_TDI(*bitindex,PMD(i)); /* DMD[15:0] used as a flag to indicate which instruction */ /* is being scanned down */ for (i=0;i<8;i++) if (!(num & (1L<