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

📄 ixqmgr.h

📁 AMCC POWERPC 44X系列的U-BOOT文件
💻 H
📖 第 1 页 / 共 5 页
字号:
	 * counters.	 */	/* fetch a queue entry */	nullCheckEntry = IX_QMGR_INLINE_READ_LONG(infoPtr->qAccRegAddr);	/* iterate the specified number of queue entries */ 	while (--numEntries)	{	    /* check the result of the previous read */	    if (nullCheckEntry == 0)	    {		/* if we read a NULL entry, stop. We have underflowed */		break;	    }	    else	    {		/* write the entry */		*entries = nullCheckEntry;		/* fetch next entry */		nullCheckEntry = IX_QMGR_INLINE_READ_LONG(qAccRegAddr);		/* increment the write address */		entries++;	    }	}	/* write the pre-fetched entry */	*entries = nullCheckEntry;    }    else    {	IxQMgrQEntrySizeInWords entrySizeInWords = infoPtr->qEntrySizeInWords;	/* read the specified number of queue entries */	nullCheckEntry = 0;	while (numEntries--)	{	    UINT32 i;	    for (i = 0; i < (UINT32)entrySizeInWords; i++)	    {		*entries = IX_QMGR_INLINE_READ_LONG(infoPtr->qAccRegAddr + i);		nullCheckEntry |= *entries++;	    }	    /* if we read a NULL entry, stop. We have underflowed */	    if (nullCheckEntry == 0)	    {		break;	    }	    nullCheckEntry = 0;	}    }    /* reset the current read count : next access to the read function      * will force a underflow status check      */    infoPtr->qReadCount = 0;    /* Check if underflow occurred on the read */    if (nullCheckEntry == 0 && qId < IX_QMGR_MIN_QUEUPP_QID)    {	/* get the queue status */	UINT32 status = IX_QMGR_INLINE_READ_LONG(infoPtr->qUOStatRegAddr);	if (status & infoPtr->qUflowStatBitMask)	{	    /* clear the underflow status bit if it was set */	    IX_QMGR_INLINE_WRITE_LONG(infoPtr->qUOStatRegAddr,				 status & ~infoPtr->qUflowStatBitMask);	    return IX_QMGR_Q_UNDERFLOW;	}    }    return IX_SUCCESS;}#endif/** * @ingroup IxQMgrAPI *  * @fn ixQMgrQPeek (IxQMgrQId qId,	     unsigned int entryIndex,	     UINT32 *entry) * * @brief Read an entry from a queue without moving the read pointer. * * This function inspects an entry in a queue. The entry is inspected directly * in AQM SRAM and is not read from queue access registers. The entry is NOT removed * from the queue and the read/write pointers are unchanged. * N.B: The queue should not be accessed when this function is called. * * @param  qId @ref IxQMgrQId [in]   - the queue identifier. * @param  entryIndex unsigned int [in] - index of entry in queue in the range *                          [0].......[current number of entries in queue]. * @param  *entry UINT32 [out] - pointer to the entry word(s). * * @return @li IX_SUCCESS, entry was successfully inspected. * @return @li IX_QMGR_PARAMETER_ERROR, invalid paramter(s). * @return @li IX_QMGR_Q_NOT_CONFIGURED, queue not configured for this QId. * @return @li IX_QMGR_ENTRY_INDEX_OUT_OF_BOUNDS, an entry does not exist at *             specified index. * @return @li IX_FAIL, failed to inpected the queue entry. */PUBLIC IX_STATUSixQMgrQPeek (IxQMgrQId qId,	     unsigned int entryIndex,	     UINT32 *entry);/** * * @ingroup IxQMgrAPI *  * @fn ixQMgrQWriteWithChecks (IxQMgrQId qId,                        UINT32 *entry) * * @brief Write an entry to an AQM queue. * * This function will write the entry size number of words pointed to by entry to * the queue specified by qId. The queue configuration word is read to * determine the entry size of queue and the corresponding number of words is * then written to the queue. * * @note - IX_QMGR_Q_OVERFLOW is only returned for queues 0-31 as queues 32-63 * do not have an overflow status maintained. * * @param qId @ref IxQMgrQId [in] - the queue identifier. * @param *entry UINT32 [in] - the word(s) to write. * * @return @li IX_SUCCESS, value was successfully written. * @return @li IX_QMGR_PARAMETER_ERROR, invalid paramter(s). * @return @li IX_QMGR_Q_NOT_CONFIGURED, queue not configured for this QId * @return @li IX_QMGR_Q_OVERFLOW, attempt to write to a full queue * */PUBLIC IX_STATUSixQMgrQWriteWithChecks (IxQMgrQId qId,                        UINT32 *entry);/** * * @ingroup IxQMgrAPI *  * @fn ixQMgrQWrite (IxQMgrQId qId,	      UINT32 *entry) * * @brief Fast write of an entry to a queue. * * This function is a heavily streamlined version of ixQMgrQWriteWithChecks(), * but performs essentially the same task.  It will write the entry size number * of words pointed to by entry to the queue specified by qId. * * @note - This function is inlined, to reduce unnecessary function call * overhead.  It does not perform any parameter checks, or update any * statistics. Also, it does not check that the queue specified by qId has * been configured. It simply writes an entry to the queue, and checks for * overflow. * * @note - IX_QMGR_Q_OVERFLOW is only returned for queues 0-31 as queues 32-63 * do not have an overflow status maintained. * * @param  qId @ref IxQMgrQId [in]   - the queue identifier. * @param  *entry UINT32 [in] - pointer to the entry word(s). * * @return @li IX_SUCCESS, entry was successfully read. * @return @li IX_QMGR_Q_OVERFLOW, attempt to write to a full queue * */#ifdef NO_INLINE_APISPUBLIC IX_STATUSixQMgrQWrite (IxQMgrQId qId,	      UINT32 *entry);#elseIX_QMGR_INLINE PUBLIC IX_STATUSixQMgrQWrite (IxQMgrQId qId,	      UINT32 *entry);#endif /* NO_INLINE_APIS */IX_QMGR_INLINE PUBLIC IX_STATUSixQMgrQWrite (IxQMgrQId qId,	      UINT32 *entry)#ifdef NO_INLINE_APIS    ;#else{    IxQMgrQInlinedReadWriteInfo *infoPtr = &ixQMgrQInlinedReadWriteInfo[qId];    UINT32 entrySize;    /* write the entry */    IX_QMGR_INLINE_WRITE_LONG(infoPtr->qAccRegAddr, *entry);    entrySize = infoPtr->qEntrySizeInWords;    if (entrySize != IX_QMGR_Q_ENTRY_SIZE1)    {		/* process the remaining part of the entry */	volatile UINT32 *qAccRegAddr = infoPtr->qAccRegAddr;	while (--entrySize)	{	    ++entry;	    IX_QMGR_INLINE_WRITE_LONG(++qAccRegAddr, *entry);	} 	entrySize = infoPtr->qEntrySizeInWords;    }    /* overflow is available for lower queues only */    if (qId < IX_QMGR_MIN_QUEUPP_QID)    {   	UINT32 qSize = infoPtr->qSizeInEntries;	/* increment the current number of entries in the queue	 * and check for overflow 	 */	if (infoPtr->qWriteCount++ == qSize)	{	    /* the queue may have overflow */	    UINT32 qPtrs; /* queue internal pointers */  	    /* get the queue status */	    UINT32 status = IX_QMGR_INLINE_READ_LONG(infoPtr->qUOStatRegAddr);	    /* read the status twice because the status may 	     * not be immediately ready after the write operation	     */	    if ((status & infoPtr->qOflowStatBitMask) ||		((status = IX_QMGR_INLINE_READ_LONG(infoPtr->qUOStatRegAddr))		 & infoPtr->qOflowStatBitMask))	    {		/* the queue is full, clear the overflow status		 *  bit if it was set 		 */		IX_QMGR_INLINE_WRITE_LONG(infoPtr->qUOStatRegAddr,				     status & ~infoPtr->qOflowStatBitMask);		infoPtr->qWriteCount = infoPtr->qSizeInEntries;		return IX_QMGR_Q_OVERFLOW;	    }	    /* No overflow occured : someone is draining the queue	     * and the current counter needs to be	     * updated from the current number of entries in the queue	     */	    /* get q pointer snapshot */	    qPtrs = IX_QMGR_INLINE_READ_LONG(infoPtr->qConfigRegAddr);	    /* Mod subtraction of pointers to get number of words in Q. */	    qPtrs = (qPtrs - (qPtrs >> 7)) & 0x7f; 	    if (qPtrs == 0)	    {		/* the queue may be full at the time of the 		 * snapshot. Next access will check 		 * the overflow status again.		 */		infoPtr->qWriteCount = qSize;	    }	    else 	    {		/* convert the number of words to a number of entries */		if (entrySize == IX_QMGR_Q_ENTRY_SIZE1)		{		    infoPtr->qWriteCount = qPtrs & (qSize - 1);		}		else		{		    infoPtr->qWriteCount = (qPtrs / entrySize) & (qSize - 1);		}	    }	}    }    return IX_SUCCESS;}#endif/** * * @ingroup IxQMgrAPI *  * @fn ixQMgrQBurstWrite (IxQMgrQId qId,		   unsigned numEntries,		   UINT32 *entries) * * @brief Write a number of entries to an AQM queue. * * This function will burst write a number of entries to the specified queue. * The entry size of queue is auto-detected. The function will attempt to * write as many entries as specified by the numEntries parameter and will * return an OVERFLOW if any one of the individual entry writes fail. * * @warning * IX_QMGR_Q_OVERFLOW is only returned for queues 0-31 as queues 32-63 * do not have an overflow status maintained, hence there is a potential for * silent failure here. This function must be used with caution. * * @note * This function is intended for fast population of queues, so to make it * as efficient as possible, it has the following features: * - This function is inlined, to reduce unnecessary function call overhead. * - It does not perform any parameter checks, or update any statistics. * - It does not check that the queue specified by qId has been configured. * - It does not check that the queue has enough free space to hold the entries * before writing, and only checks for overflow after all writes have been * performed.  Therefore, the client should ensure before calling this function * that there is enough free space in the queue to hold the number of entries * to be written.  ixQMgrQWrite() or ixQMgrQWriteWithChecks(), which only writes * a single queue entry per call, should be used instead if the user requires * checks for OVERFLOW after each entry written. * * @param qId @ref IxQMgrQId [in]   - the queue identifier. * @param numEntries unsigned [in] - the number of entries to write. * @param *entries UINT32 [in]  - the word(s) to write. * * @return @li IX_SUCCESS, value was successfully written. * @return @li IX_QMGR_Q_OVERFLOW, attempt to write to a full queue * */#ifdef NO_INLINE_APISPUBLIC IX_STATUSixQMgrQBurstWrite (IxQMgrQId qId,		   unsigned numEntries,		   UINT32 *entries);#elseIX_QMGR_INLINE PUBLIC IX_STATUSixQMgrQBurstWrite (IxQMgrQId qId,		   unsigned numEntries,		   UINT32 *entries);#endif /* NO_INLINE_APIS */IX_QMGR_INLINE PUBLIC IX_STATUSixQMgrQBurstWrite (IxQMgrQId qId,		   unsigned numEntries,		   UINT32 *entries)#ifdef NO_INLINE_APIS;#else{    IxQMgrQInlinedReadWriteInfo *infoPtr = &ixQMgrQInlinedReadWriteInfo[qId];    UINT32 status;    /* update the current write count */    infoPtr->qWriteCount += numEntries;    if (infoPtr->qEntrySizeInWords == IX_QMGR_Q_ENTRY_SIZE1)    {	volatile UINT32 *qAccRegAddr = infoPtr->qAccRegAddr;	while (numEntries--)	{	    IX_QMGR_INLINE_WRITE_LONG(qAccRegAddr, *entries);	    entries++;	}    }    else    {	IxQMgrQEntrySizeInWords entrySizeInWords = infoPtr->qEntrySizeInWords;	UINT32 i;	/* write each queue entry */	while (numEntries--)	{	    /* write the queueEntrySize number of words for each entry */	    for (i = 0; i < (UINT32)entrySizeInWords; i++)	    {		IX_QMGR_INLINE_WRITE_LONG((infoPtr->qAccRegAddr + i), *entries);		entries++;	    }	}    }    /* check if the write count overflows */    if (infoPtr->qWriteCount > infoPtr->qSizeInEntries)    {	/* reset the current write count */	infoPtr->qWriteCount = infoPtr->qSizeInEntries;    }    /* Check if overflow occurred on the write operation */    if (qId < IX_QMGR_MIN_QUEUPP_QID)    {	/* get the queue status */	status = IX_QMGR_INLINE_READ_LONG(infoPtr->qUOStatRegAddr);	/* read the status twice because the status may 	 * not be ready at the time of the write	 */	if ((status & infoPtr->qOflowStatBitMask) ||	    ((status = IX_QMGR_INLINE_READ_LONG(infoPtr->qUOStatRegAddr))	     & infoPtr->qOflowStatBitMask))	{	    /* clear the underflow status bit if it was set */	    IX_QMGR_INLINE_WRITE_LONG(infoPtr->qUOStatRegAddr,				 status & ~infoPtr->qOflowStatBitMask);	    return IX_QMGR_Q_OVERFLOW;	}    }    return IX_SUCCESS;}#endif/** * @ingroup IxQMgrAPI *  * @fn ixQMgrQPoke (IxQMgrQId qId,	     unsigned int entryIndex,	     UINT32 *entry) * * @brief Write an entry to a queue without moving the write pointer. * * This function modifies an entry in a queue. The entry is modified directly * in AQM SRAM and not using the queue access registers. The entry is NOT added to the * queue and the read/write pointers are unchanged. * N.B: The queue should not be accessed when this function is called. * * @param qId @ref IxQMgrQId [in]  - the queue identifier. * @param  entryIndex unsigned int [in] - index of entry in queue in the range *                          [0].......[current number of entries in queue]. * @param  *entry UINT32 [in] - pointer to the entry word(s). * * @return @li IX_SUCCESS, entry was successfully modified. * @return @li IX_QMGR_PARAMETER_ERROR, invalid paramter(s). * @return @li IX_QMGR_Q_NOT_CONFIGURED, queue not configured for this QId. * @return @li IX_QMGR_ENTRY_INDEX_OUT_OF_BOUNDS, an entry does not exist at *             specified index. * @return @li IX_FAIL, failed to modify the queue entry. */PUBLIC IX_STATUSixQMgrQPoke (IxQMgrQId qId,	     unsigned int entryIndex,	     UINT32 *entry);/**

⌨️ 快捷键说明

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