?? micro.c
字號:
ucShiftIrBits, &(pXsvfInfo->lvTdi), /*plvTdoCaptured*/0, /*plvTdoExpected*/0, /*plvTdoMask*/0, pXsvfInfo->ucEndIR, pXsvfInfo->lRunTestTime, /*ucMaxRepeat*/0 ); } if ( iErrorCode != XSVF_ERROR_NONE ) { pXsvfInfo->iErrorCode = iErrorCode; } return( iErrorCode );}/***************************************************************************** * Function: xsvfDoXSIR2 * Description: XSIR <(2-byte)shiftlen> <lenVal.TDI[shiftlen]> * Get the instruction and shift the instruction into the TAP. * If prespecified XRUNTEST!=0, goto RUNTEST and wait after * the shift for XRUNTEST usec. * Parameters: pXsvfInfo - XSVF information pointer. * Returns: int - 0 = success; non-zero = error. *****************************************************************************/int xsvfDoXSIR2( SXsvfInfo* pXsvfInfo ){ long lShiftIrBits; short sShiftIrBytes; int iErrorCode; /* Get the shift length and store */ readVal( &(pXsvfInfo->lvTdi), 2 ); lShiftIrBits = value( &(pXsvfInfo->lvTdi) ); sShiftIrBytes = xsvfGetAsNumBytes( lShiftIrBits ); XSVFDBG_PRINTF1( 3, " XSIR2 length = %d\n", (int)lShiftIrBits); if ( sShiftIrBytes > MAX_LEN ) { iErrorCode = XSVF_ERROR_DATAOVERFLOW; } else { /* Get and store instruction to shift in */ readVal( &(pXsvfInfo->lvTdi), xsvfGetAsNumBytes( lShiftIrBits ) ); /* Shift the data */ iErrorCode = xsvfShift( &(pXsvfInfo->ucTapState), XTAPSTATE_SHIFTIR, lShiftIrBits, &(pXsvfInfo->lvTdi), /*plvTdoCaptured*/0, /*plvTdoExpected*/0, /*plvTdoMask*/0, pXsvfInfo->ucEndIR, pXsvfInfo->lRunTestTime, /*ucMaxRepeat*/0 ); } if ( iErrorCode != XSVF_ERROR_NONE ) { pXsvfInfo->iErrorCode = iErrorCode; } return( iErrorCode );}/***************************************************************************** * Function: xsvfDoXSDR * Description: XSDR <lenVal.TDI[XSDRSIZE]> * Shift the given TDI data into the JTAG scan chain. * Compare the captured TDO with the expected TDO from the * previous XSDRTDO command using the previously specified * XTDOMASK. * Parameters: pXsvfInfo - XSVF information pointer. * Returns: int - 0 = success; non-zero = error. *****************************************************************************/int xsvfDoXSDR( SXsvfInfo* pXsvfInfo ){ int iErrorCode; readVal( &(pXsvfInfo->lvTdi), pXsvfInfo->sShiftLengthBytes ); /* use TDOExpected from last XSDRTDO instruction */ iErrorCode = xsvfShift( &(pXsvfInfo->ucTapState), XTAPSTATE_SHIFTDR, pXsvfInfo->lShiftLengthBits, &(pXsvfInfo->lvTdi), &(pXsvfInfo->lvTdoCaptured), &(pXsvfInfo->lvTdoExpected), &(pXsvfInfo->lvTdoMask), pXsvfInfo->ucEndDR, pXsvfInfo->lRunTestTime, pXsvfInfo->ucMaxRepeat ); if ( iErrorCode != XSVF_ERROR_NONE ) { pXsvfInfo->iErrorCode = iErrorCode; } return( iErrorCode );}/***************************************************************************** * Function: xsvfDoXRUNTEST * Description: XRUNTEST <uint32> * Prespecify the XRUNTEST wait time for shift operations. * Parameters: pXsvfInfo - XSVF information pointer. * Returns: int - 0 = success; non-zero = error. *****************************************************************************/int xsvfDoXRUNTEST( SXsvfInfo* pXsvfInfo ){ readVal( &(pXsvfInfo->lvTdi), 4 ); pXsvfInfo->lRunTestTime = value( &(pXsvfInfo->lvTdi) ); XSVFDBG_PRINTF1( 3, " XRUNTEST = %ld\n", pXsvfInfo->lRunTestTime ); return( XSVF_ERROR_NONE );}/***************************************************************************** * Function: xsvfDoXREPEAT * Description: XREPEAT <byte> * Prespecify the maximum number of XC9500/XL retries. * Parameters: pXsvfInfo - XSVF information pointer. * Returns: int - 0 = success; non-zero = error. *****************************************************************************/int xsvfDoXREPEAT( SXsvfInfo* pXsvfInfo ){ readByte( &(pXsvfInfo->ucMaxRepeat) ); XSVFDBG_PRINTF1( 3, " XREPEAT = %d\n", ((unsigned int)(pXsvfInfo->ucMaxRepeat)) ); return( XSVF_ERROR_NONE );}/***************************************************************************** * Function: xsvfDoXSDRSIZE * Description: XSDRSIZE <uint32> * Prespecify the XRUNTEST wait time for shift operations. * Parameters: pXsvfInfo - XSVF information pointer. * Returns: int - 0 = success; non-zero = error. *****************************************************************************/int xsvfDoXSDRSIZE( SXsvfInfo* pXsvfInfo ){ int iErrorCode; iErrorCode = XSVF_ERROR_NONE; readVal( &(pXsvfInfo->lvTdi), 4 ); pXsvfInfo->lShiftLengthBits = value( &(pXsvfInfo->lvTdi) ); pXsvfInfo->sShiftLengthBytes= xsvfGetAsNumBytes( pXsvfInfo->lShiftLengthBits ); XSVFDBG_PRINTF1( 3, " XSDRSIZE = %ld\n", pXsvfInfo->lShiftLengthBits ); if ( pXsvfInfo->sShiftLengthBytes > MAX_LEN ) { iErrorCode = XSVF_ERROR_DATAOVERFLOW; pXsvfInfo->iErrorCode = iErrorCode; } return( iErrorCode );}/***************************************************************************** * Function: xsvfDoXSDRTDO * Description: XSDRTDO <lenVal.TDI[XSDRSIZE]> <lenVal.TDO[XSDRSIZE]> * Get the TDI and expected TDO values. Then, shift. * Compare the expected TDO with the captured TDO using the * prespecified XTDOMASK. * Parameters: pXsvfInfo - XSVF information pointer. * Returns: int - 0 = success; non-zero = error. *****************************************************************************/int xsvfDoXSDRTDO( SXsvfInfo* pXsvfInfo ){ int iErrorCode; iErrorCode = xsvfBasicXSDRTDO( &(pXsvfInfo->ucTapState), pXsvfInfo->lShiftLengthBits, pXsvfInfo->sShiftLengthBytes, &(pXsvfInfo->lvTdi), &(pXsvfInfo->lvTdoCaptured), &(pXsvfInfo->lvTdoExpected), &(pXsvfInfo->lvTdoMask), pXsvfInfo->ucEndDR, pXsvfInfo->lRunTestTime, pXsvfInfo->ucMaxRepeat ); if ( iErrorCode != XSVF_ERROR_NONE ) { pXsvfInfo->iErrorCode = iErrorCode; } return( iErrorCode );}/***************************************************************************** * Function: xsvfDoXSETSDRMASKS * Description: XSETSDRMASKS <lenVal.AddressMask[XSDRSIZE]> * <lenVal.DataMask[XSDRSIZE]> * Get the prespecified address and data mask for the XSDRINC * command. * Used for xc9500/xl compressed XSVF data. * Parameters: pXsvfInfo - XSVF information pointer. * Returns: int - 0 = success; non-zero = error. *****************************************************************************/#ifdef XSVF_SUPPORT_COMPRESSIONint xsvfDoXSETSDRMASKS( SXsvfInfo* pXsvfInfo ){ /* read the addressMask */ readVal( &(pXsvfInfo->lvAddressMask), pXsvfInfo->sShiftLengthBytes ); /* read the dataMask */ readVal( &(pXsvfInfo->lvDataMask), pXsvfInfo->sShiftLengthBytes ); XSVFDBG_PRINTF( 4, " Address Mask = " ); XSVFDBG_PRINTLENVAL( 4, &(pXsvfInfo->lvAddressMask) ); XSVFDBG_PRINTF( 4, "\n" ); XSVFDBG_PRINTF( 4, " Data Mask = " ); XSVFDBG_PRINTLENVAL( 4, &(pXsvfInfo->lvDataMask) ); XSVFDBG_PRINTF( 4, "\n" ); return( XSVF_ERROR_NONE );}#endif /* XSVF_SUPPORT_COMPRESSION *//***************************************************************************** * Function: xsvfDoXSDRINC * Description: XSDRINC <lenVal.firstTDI[XSDRSIZE]> <byte(numTimes)> * <lenVal.data[XSETSDRMASKS.dataMask.len]> ... * Get the XSDRINC parameters and execute the XSDRINC command. * XSDRINC starts by loading the first TDI shift value. * Then, for numTimes, XSDRINC gets the next piece of data, * replaces the bits from the starting TDI as defined by the * XSETSDRMASKS.dataMask, adds the address mask from * XSETSDRMASKS.addressMask, shifts the new TDI value, * and compares the TDO to the expected TDO from the previous * XSDRTDO command using the XTDOMASK. * Used for xc9500/xl compressed XSVF data. * Parameters: pXsvfInfo - XSVF information pointer. * Returns: int - 0 = success; non-zero = error. *****************************************************************************/#ifdef XSVF_SUPPORT_COMPRESSIONint xsvfDoXSDRINC( SXsvfInfo* pXsvfInfo ){ int iErrorCode; int iDataMaskLen; unsigned char ucDataMask; unsigned char ucNumTimes; unsigned char i; readVal( &(pXsvfInfo->lvTdi), pXsvfInfo->sShiftLengthBytes ); iErrorCode = xsvfShift( &(pXsvfInfo->ucTapState), XTAPSTATE_SHIFTDR, pXsvfInfo->lShiftLengthBits, &(pXsvfInfo->lvTdi), &(pXsvfInfo->lvTdoCaptured), &(pXsvfInfo->lvTdoExpected), &(pXsvfInfo->lvTdoMask), pXsvfInfo->ucEndDR, pXsvfInfo->lRunTestTime, pXsvfInfo->ucMaxRepeat ); if ( !iErrorCode ) { /* Calculate number of data mask bits */ iDataMaskLen = 0; for ( i = 0; i < pXsvfInfo->lvDataMask.len; ++i ) { ucDataMask = pXsvfInfo->lvDataMask.val[ i ]; while ( ucDataMask ) { iDataMaskLen += ( ucDataMask & 1 ); ucDataMask >>= 1; } } /* Get the number of data pieces, i.e. number of times to shift */ readByte( &ucNumTimes ); /* For numTimes, get data, fix TDI, and shift */ for ( i = 0; !iErrorCode && ( i < ucNumTimes ); ++i ) { readVal( &(pXsvfInfo->lvNextData), xsvfGetAsNumBytes( iDataMaskLen ) ); xsvfDoSDRMasking( &(pXsvfInfo->lvTdi), &(pXsvfInfo->lvNextData), &(pXsvfInfo->lvAddressMask), &(pXsvfInfo->lvDataMask) ); iErrorCode = xsvfShift( &(pXsvfInfo->ucTapState), XTAPSTATE_SHIFTDR, pXsvfInfo->lShiftLengthBits, &(pXsvfInfo->lvTdi), &(pXsvfInfo->lvTdoCaptured), &(pXsvfInfo->lvTdoExpected), &(pXsvfInfo->lvTdoMask), pXsvfInfo->ucEndDR, pXsvfInfo->lRunTestTime, pXsvfInfo->ucMaxRepeat ); } } if ( iErrorCode != XSVF_ERROR_NONE ) { pXsvfInfo->iErrorCode = iErrorCode; } return( iErrorCode );}#endif /* XSVF_SUPPORT_COMPRESSION *//***************************************************************************** * Function: xsvfDoXSDRBCE * Description: XSDRB/XSDRC/XSDRE <lenVal.TDI[XSDRSIZE]> * If not already in SHIFTDR, goto SHIFTDR. * Shift the given TDI data into the JTAG scan chain. * Ignore TDO. * If cmd==XSDRE, then goto ENDDR. Otherwise, stay in ShiftDR. * XSDRB, XSDRC, and XSDRE are the same implementation. * Parameters: pXsvfInfo - XSVF information pointer. * Returns: int - 0 = success; non-zero = error. *****************************************************************************/int xsvfDoXSDRBCE( SXsvfInfo* pXsvfInfo ){ unsigned char ucEndDR; int iErrorCode; ucEndDR = (unsigned char)(( pXsvfInfo->ucCommand == XSDRE ) ? pXsvfInfo->ucEndDR : XTAPSTATE_SHIFTDR); iErrorCode = xsvfBasicXSDRTDO( &(pXsvfInfo->ucTapState), pXsvfInfo->lShiftLengthBits, pXsvfInfo->sShiftLengthBytes, &(pXsvfInfo->lvTdi), /*plvTdoCaptured*/0, /*plvTdoExpected*/0, /*plvTdoMask*/0, ucEndDR, /*lRunTestTime*/0, /*ucMaxRepeat*/0 ); if ( iErrorCode != XSVF_ERROR_NONE ) { pXsvfInfo->iErrorCode = iErrorCode; } return( iErrorCode );}/***************************************************************************** * Function: xsvfDoXSDRTDOBCE * Description: XSDRB/XSDRC/XSDRE <lenVal.TDI[XSDRSIZE]> <lenVal.TDO[XSDRSIZE]> * If not already in SHIFTDR, goto SHIFTDR. * Shift the given TDI data into the JTAG scan chain. * Compare TDO, but do NOT use XTDOMASK. * If cmd==XSDRTDOE, then goto ENDDR. Otherwise, stay in ShiftDR. * XSDRTDOB, XSDRTDOC, and XSDRTDOE are the same implementation. * Parameters: pXsvfInfo - XSVF information pointer. * Returns: int - 0 = success; non-zero = error. *****************************************************************************/int xsvfDoXSDRTDOBCE( SXsvfInfo* pXsvfInfo ){ unsigned char ucEndDR; int iErrorCode; ucEndDR = (unsigned char)(( pXsvfInfo->ucCommand == XSDRTDOE ) ? pXsvfInfo->ucEndDR : XTAPSTATE_SHIFTDR); iErrorCode = xsvfBasicXSDRTDO( &(pXsvfInfo->ucTapState), pXsvfInfo->lShiftLengthBits, pXsvfInfo->sShiftLengthBytes, &(pXsvfInfo->lvTdi), &(pXsvfInfo->lvTdoCaptured), &(pXsvfInfo->lvTdoExpected), /*plvTdoMask*/0, ucEndDR, /*lRunTestTime*/0, /*ucMaxRepeat*/0 ); if ( iErrorCode != XSVF_ERROR_NONE ) { pXsvfInfo->iErrorCode = iErrorCode; } return( iErrorCode );}/***************************************************************************** * Function: xsvfDoXSTATE * Description: XSTATE <byte> * <byte> == XTAPSTATE; * Get the state parameter and transition the TAP to that state. * Parameters: pXsvfInfo - XSVF information pointer. * Returns: int - 0 = success; non-zero = error. *****************************************************************************/int xsvfDoXSTATE( SXsvfInfo* pXsvfInfo ){ unsigned char ucNextState; int iErrorCode; readByte( &ucNextState ); iErrorCode = xsvfGotoTapState( &(pXsvfInfo->ucTapState), ucNextState ); if ( iErrorCode != XSVF_ERROR_NONE ) { pXsvfInfo->iErrorCode = iErrorCode; } return( iErrorCode );}/***************************************************************************** * Function: xsvfDoXENDXR * Description: XENDIR/XENDDR <byte> * <byte>: 0 = RUNTEST; 1 = PAUSE. * Get the prespecified XENDIR or XENDDR. * Both XENDIR and XENDDR use the same implementation. * Parameters: pXsvfInfo - XSVF information pointer. * Returns: int - 0 = success; non-zero = error. *****************************************************************************/int xsvfDoXENDXR( SXsvfInfo* pXsvfInfo ){ int iErrorCode; unsigned char ucEndState;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -