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

📄 ohcitd.h

📁 Usb Host/Periphel Control TD1120 codes
💻 H
字号:
/*-----------------------------------------------------------------------------
$File: //hodad/usblink/3.4/source/hostctrl/otg242/ohcitd.h $
$DateTime: 2003/09/08 15:17:45 $
$Revision: #1 $
Purpose:   OHCD TD definitions.

CONFIDENTIAL AND PROPRIETARY INFORMATION OF SOFTCONNEX TECHNOLOGIES, INC.

THIS NOTICE IS NOT TO BE DELETED, MODIFIED, MOVED OR CHANGED IN ANY WAY.

Copyright (c) 1999 - 2003 by SoftConnex Technologies, Inc. 

This software is protected by copyright laws and international copyright 
treaties, as well as other intellectual property laws and treaties.  This
software is a CONFIDENTIAL, unpublished work of authorship, and with portions 
constituting TRADE SECRETS of SoftConnex Technologies, Inc., a Delaware USA 
corporation.  Any unauthorized use, disclosure, and/or reproduction of this 
software, or any part of this software; or distribution of this software in any 
form or by any means; or storage of this software in any database or retrieval 
system, without the express written consent of, and license from, SoftConnex 
Technologies, Inc. is strictly prohibited.  This software is protected under the
copyright and/or trade secret laws in other countries in addition to USA.  All 
Rights Reserved.  Failure to abide by the use, disclosure and/or reproduction 
restrictions may result in civil and /or criminal penalties, and will be 
prosecuted to the maximum extent of the law.
-----------------------------------------------------------------------------*/

#ifndef _SOFTCONNEX_OHCITD_H_
#define _SOFTCONNEX_OHCITD_H_

#define OHCITD_CONDITION_CODE         0xF0000000
#define OHCITD_ERROR_COUNT            0x0C000000
#define OHCITD_DATA_TOGGLE            0x03000000
#define OHCITD_DELAY_INTERRUPT        0x00E00000
#define OHCITD_DIRECTION_PID          0x00180000
#define OHCITD_BUFFER_ROUNDING        0x00040000

#define OHCITD_DIRECTION_PID_SETUP    0x00000000
#define OHCITD_DIRECTION_PID_OUT      0x00080000
#define OHCITD_DIRECTION_PID_IN       0x00100000

#define OHCITD_OFFSET_PAGE_SELECT     0x00001000
#define OHCITD_PAGE                   0xFFFFF000

#define OHCITD_MAX_ISOC_PACKET        8 /* 8 */

typedef struct _OhciTd
   {
   U32 desc;
   U32 currentBufferPointer;
   U32 nextTd;
   U32 bufferEnd;
   U32 offset[OHCITD_MAX_ISOC_PACKET / 2];   /* Isoc TD only */
   }
OhciTd;


#define OHCITD_FRAME_COUNT            0x07000000
#define OHCITD_STARTING_FRAME         0x0000FFFF

#define OhciTd_IsSetup(td)            ((td->desc & OHCITD_DIRECTION_PID) == OHCITD_DIRECTION_PID_SETUP)
#define OhciTd_IsOut(td)              ((td->desc & OHCITD_DIRECTION_PID) == OHCITD_DIRECTION_PID_OUT)

#define OhciTd_GetStartingFrame(td)   (td->desc & OHCITD_STARTING_FRAME)
#define OhciTd_GetFrameCount(td)      (td->desc & OHCITD_FRAME_COUNT)
#define OhciTd_GetDelayInterrupt(td)  (td->desc & OHCITD_DELAY_INTERRUPT)
#define OhciTd_GetPacketStatus(td, i) (td->offset[i >> 1])
#define OhciTd_GetDirectionPid(td)    (td->desc & OHCITD_DIRECTION_PID)
#define OhciTd_GetBufferRounding(td)  (td->desc & OHCITD_BUFFER_ROUNDING)
#define OhciTd_GetDelayInterrupt(td)  (td->desc & OHCITD_DELAY_INTERRUPT)
#define OhciTd_GetDataToggle(td)      (td->desc & OHCITD_DATA_TOGGLE)
#define OhciTd_GetErrorCount(td)      (td->desc & OHCITD_ERROR_COUNT)
#define OhciTd_GetCompletionCode(td)  (td->desc & OHCITD_CONDITION_CODE)

#define OhciTd_GetBufferPointer(td)   (td->currentBufferPointer)
#define OhciTd_GetBufferPage0(td)     (td->currentBufferPointer)
#define OhciTd_GetBufferEnd(td)       (td->bufferEnd)

#define OhciTd_SetConditionCode(td,code) {td->desc &= ~OHCITD_CONDITION_CODE; td->desc |= code;}
#define OhciTd_SetErrorCount(td, count)  {td->desc &= ~OHCITD_ERROR_COUNT; td->desc |= count;}

#define OhciTd_IsDirectionOut(td)     (((td->desc & OHCITD_DIRECTION_PID) == OHCITD_DIRECTION_PID_OUT) || \
                                      ((td->desc & OHCITD_DIRECTION_PID) == OHCITD_DIRECTION_PID_SETUP))

#define OhciTd_IsDirectionIn(td)      ((td->desc & OHCITD_DIRECTION_PID) == OHCITD_DIRECTION_PID_IN)

#define OhciTd_GetFrameCountValue(td) ((td->desc & OHCITD_FRAME_COUNT) >> 24)

#define OhciTd_MoveBufferPointer(td, length)   td->currentBufferPointer += length
#define OhciTd_SetBufferPointer(td, addr)      td->currentBufferPointer = addr

#define OhciTd_IsPacketNotAccessed(td, i)      ((td->offset[i >> 1] & ((i & 1)? 0xF0000000 : 0xF000)) == 0)
#define OhciTd_SetOffset(td, i, val)     \
      {td->offset[i >> 1] &= ((i & 1)? 0x0000FFFF : 0xFFFF0000); td->offset[i >> 1] |= (i & 1)? (val << 16) : val;}

#define OhciTd_GetOffsetPsw(td, i)    \
         (((i) & 1)? (td->offset[(i) >> 1] >> 16) : td->offset[(i) >> 1])

#define OhciTd_IsPageSelect(td, i)    (((i) & 1)? (td->offset[(i) >> 1] & 0x10000000) : (td->offset[(i) >> 1] & 0x1000))

#endif

⌨️ 快捷键说明

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