⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 micro_dynamic_target_for_4_virtex.c

📁 Xilinx Jtag Configuration source code, Support *.xsvf file
💻 C
📖 第 1 页 / 共 5 页
字号:
* Parameters:   pucTapState         - Current TAP state.*               lShiftLengthBits    - number of bits to shift.*               sShiftLengthBytes   - number of bytes to read.*               plvTdi              - ptr to lenval for TDI data.*               lvTdoCaptured       - ptr to lenval for storing TDO data.*               iEndState           - state in which to end the shift.*               lRunTestTime        - amount of time to wait after the shift.*               ucMaxRepeat         - maximum xc9500/xl retries.*               iHeader             - Num. of header bits to shift before data.*               iTrailer            - Num. of trailer bits to shift after data.* Returns:      int                 - 0 = success; otherwise TDO mismatch.*****************************************************************************/int xsvfBasicXSDRTDO( unsigned char*    pucTapState,                      long              lShiftLengthBits,                      short             sShiftLengthBytes,                      lenVal*           plvTdi,                      lenVal*           plvTdoCaptured,                      lenVal*           plvTdoExpected,                      lenVal*           plvTdoMask,                      unsigned char     ucEndState,                      long              lRunTestTime,                      unsigned char     ucMaxRepeat,                      int               iHeader,                      int               iTrailer ){    readVal( plvTdi, sShiftLengthBytes );    if ( plvTdoExpected )    {        readVal( plvTdoExpected, sShiftLengthBytes );    }    return( xsvfShift( pucTapState, XTAPSTATE_SHIFTDR, lShiftLengthBits,                       plvTdi, plvTdoCaptured, plvTdoExpected, plvTdoMask,                       ucEndState, lRunTestTime, ucMaxRepeat,                       iHeader, iTrailer ) );}/****************************************************************************** Function:     xsvfDoSDRMasking* Description:  Update the data value with the next XSDRINC data and address.* Example:      dataVal=0x01ff, nextData=0xab, addressMask=0x0100,*               dataMask=0x00ff, should set dataVal to 0x02ab* Parameters:   plvTdi          - The current TDI value.*               plvNextData     - the next data value.*               plvAddressMask  - the address mask.*               plvDataMask     - the data mask.* Returns:      void.*****************************************************************************/#ifdef  XSVF_SUPPORT_COMPRESSIONvoid xsvfDoSDRMasking( lenVal*  plvTdi,                       lenVal*  plvNextData,                       lenVal*  plvAddressMask,                       lenVal*  plvDataMask ){    int             i;    unsigned char   ucTdi;    unsigned char   ucTdiMask;    unsigned char   ucDataMask;    unsigned char   ucNextData;    unsigned char   ucNextMask;    short           sNextData;    /* add the address Mask to dataVal and return as a new dataVal */    addVal( plvTdi, plvTdi, plvAddressMask );    ucNextData  = 0;    ucNextMask  = 0;    sNextData   = plvNextData->len;    for ( i = plvDataMask->len - 1; i >= 0; --i )    {        /* Go through data mask in reverse order looking for mask (1) bits */        ucDataMask  = plvDataMask->val[ i ];        if ( ucDataMask )        {            /* Retrieve the corresponding TDI byte value */            ucTdi       = plvTdi->val[ i ];            /* For each bit in the data mask byte, look for 1's */            ucTdiMask   = 1;            while ( ucDataMask )            {                if ( ucDataMask & 1 )                {                    if ( !ucNextMask )                    {                        /* Get the next data byte */                        ucNextData  = plvNextData->val[ --sNextData ];                        ucNextMask  = 1;                    }                    /* Set or clear the data bit according to the next data */                    if ( ucNextData & ucNextMask )                    {                        ucTdi   |= ucTdiMask;       /* Set bit */                    }                    else                    {                        ucTdi   &= ( ~ucTdiMask );  /* Clear bit */                    }                    /* Update the next data */                    ucNextMask  <<= 1;                }                ucTdiMask   <<= 1;                ucDataMask  >>= 1;            }            /* Update the TDI value */            plvTdi->val[ i ]    = ucTdi;        }    }}#endif  /* XSVF_SUPPORT_COMPRESSION *//*============================================================================* XSVF Command Functions (type = TXsvfDoCmdFuncPtr)* These functions update pXsvfInfo->iErrorCode only on an error.* Otherwise, the error code is left alone.* The function returns the error code from the function.============================================================================*//****************************************************************************** Function:     xsvfDoIllegalCmd* Description:  Function place holder for illegal/unsupported commands.* Parameters:   pXsvfInfo   - XSVF information pointer.* Returns:      int         - 0 = success;  non-zero = error.*****************************************************************************/int xsvfDoIllegalCmd( SXsvfInfo* pXsvfInfo ){    XSVFDBG_PRINTF2( 0, "ERROR:  Encountered unsupported command #%d (%s)\n",                     ((unsigned int)(pXsvfInfo->ucCommand)),                     ((pXsvfInfo->ucCommand < XLASTCMD)                      ? (xsvf_pzCommandName[pXsvfInfo->ucCommand])                      : "Unknown") );    pXsvfInfo->iErrorCode   = XSVF_ERROR_ILLEGALCMD;    return( pXsvfInfo->iErrorCode );}/****************************************************************************** Function:     xsvfDoXCOMPLETE* Description:  XCOMPLETE (no parameters)*               Update complete status for XSVF player.* Parameters:   pXsvfInfo   - XSVF information pointer.* Returns:      int         - 0 = success;  non-zero = error.*****************************************************************************/int xsvfDoXCOMPLETE( SXsvfInfo* pXsvfInfo ){    pXsvfInfo->ucComplete   = 1;    return( XSVF_ERROR_NONE );}/****************************************************************************** Function:     xsvfDoXTDOMASK* Description:  XTDOMASK <lenVal.TdoMask[XSDRSIZE]>*               Prespecify the TDO compare mask.* Parameters:   pXsvfInfo   - XSVF information pointer.* Returns:      int         - 0 = success;  non-zero = error.*****************************************************************************/int xsvfDoXTDOMASK( SXsvfInfo* pXsvfInfo ){    readVal( &(pXsvfInfo->lvTdoMask), pXsvfInfo->sShiftLengthBytes );    XSVFDBG_PRINTF( 4, "    TDO Mask     = ");    XSVFDBG_PRINTLENVAL( 4, &(pXsvfInfo->lvTdoMask) );    XSVFDBG_PRINTF( 4, "\n");    return( XSVF_ERROR_NONE );}/****************************************************************************** Function:     xsvfDoXSIR* Description:  XSIR <(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 xsvfDoXSIR( SXsvfInfo* pXsvfInfo ){    unsigned char   ucShiftIrBits;    short           sShiftIrBytes;    int             iErrorCode;    /* Get the shift length and store */    readByte( &ucShiftIrBits );    sShiftIrBytes   = xsvfGetAsNumBytes( ucShiftIrBits );    XSVFDBG_PRINTF1( 3, "   XSIR length = %d\n",                     ((unsigned int)ucShiftIrBits) );    if ( sShiftIrBytes > MAX_LEN )    {        iErrorCode  = XSVF_ERROR_DATAOVERFLOW;    }    else    {        /* Get and store instruction to shift in */        readVal( &(pXsvfInfo->lvTdi), xsvfGetAsNumBytes( ucShiftIrBits ) );        /* Shift the data */        iErrorCode  = xsvfShift( &(pXsvfInfo->ucTapState), XTAPSTATE_SHIFTIR,                                 ucShiftIrBits, &(pXsvfInfo->lvTdi),                                 /*plvTdoCaptured*/0, /*plvTdoExpected*/0,                                 /*plvTdoMask*/0, pXsvfInfo->ucEndIR,                                 pXsvfInfo->lRunTestTime, /*ucMaxRepeat*/0,                                 pXsvfInfo->iHir, pXsvfInfo->iTir );    }    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", 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,                                 pXsvfInfo->iHir, pXsvfInfo->iTir );    }    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,                             pXsvfInfo->iHdr, pXsvfInfo->iTdr );    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 ){

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -