2023年12月24日发(作者:)

OHCI USB Host 寄存器详解

//说明:其中的地址定义不属于OHCI规范的内容,这是s3c2440中

//的定义。为方便学习s3c2440的朋友复制粘贴所以就完全拷贝Uboot

//中头文件的内容,还有少部分待完善,欢迎大家指教其中的错误

//-------------------控制和状态组-----------------

#define rHcRevision (*(volatile unsigned *)0x49000000)

#define rHcControl (*(volatile unsigned *)0x49000004)

#define rHcCommandStatus (*(volatile unsigned *)0x49000008)

#define rHcInterruptStatus (*(volatile unsigned *)0x4900000C)

#define rHcInterruptEnable (*(volatile unsigned *)0x49000010)

#define rHcInterruptDisable (*(volatile unsigned *)0x49000014)

//-----------------------内存指针组---------------------------------

#define rHcHCCA (*(volatile unsigned *)0x49000018)

#define rHcPeriodCurrentED (*(volatile unsigned *)0x4900001C)

#define rHcControlHeadED (*(volatile unsigned *)0x49000020)

#define rHcControlCurrentED (*(volatile unsigned *)0x49000024)

#define rHcBulkHeadED (*(volatile unsigned *)0x49000028)

#define rHcBulkCurrentED (*(volatile unsigned *)0x4900002C)

#define rHcDoneHead (*(volatile unsigned *)0x49000030)

//-------------------------祯计数器组--------------------------------

#define rHcFmInterval (*(volatile unsigned *)0x49000034)

#define rHcFmRemaining (*(volatile unsigned *)0x49000038)

#define rHcFmNumber (*(volatile unsigned *)0x4900003C)

#define rHcPeriodicStart (*(volatile unsigned *)0x49000040)

#define rHcLSThreshold (*(volatile unsigned *)0x49000044)

//-----------------------------根集线器组-----------------------

#define rHcRhDescriptorA (*(volatile unsigned *)0x49000048)

#define rHcRhDescriptorB (*(volatile unsigned *)0x4900004C)

#define rHcRhStatus (*(volatile unsigned *)0x49000050)

#define rHcRhPortStatus1 (*(volatile unsigned *)0x49000054)

#define rHcRhPortStatus2 (*(volatile unsigned *)0x49000058)

//括号中的字母为此位代表的意义的缩写,如CBSR是ControlBulkServiceRatio的简写

1.1//-------------------控制和状态组-----------------

HcRevision 版本号

使用[7,0]其余保留; 复位值:0x10(以BCD码表示的版本号) ; HCD,HC读写属性:只读

//-------------------------------------------------------

HcControl HC操作模式定义 (此寄存器的读写权限HCD R/W ; HC R)

[1,0] (CBSR)控制传输与批量传输的时间比:0(1:1) 1(2:1) 2(3:1) 3(4:1)。

[2](PLE) 允许处理周期传输ED

[3](IE) 允许处理同步传输ED

[4](CLE) 允许处理控制传输ED

[5](BLE) 允许处理批量传输ED

[7,6](HCFS)00:USB复位, 01:USB恢复, 10:USB可操作, 11:USB挂起

[8](IR)中断路由,0 只传递到USB主控器 1路由到系统。

//--------------------------------------------------------------------------------------

HcCommandStatus HC用此寄存器接收来自HCD的命令,也可反映HC的当前状态;你只能对某位写1来清零写0对它不起作用。

[0](HCR)HCD对它置1以软件复位HC(不会引起ROOT HUB和下行端口复位),HC完成复位时会清零此位

[1](CLF)此位被HCD置1后HC才会处理控制列表(当HC开始处理时会把此位清零,如果发现了下一个TD又会置1此位)

[2](BLF)此位被HCD置1后HC才会处理批量列表(同上)

[3](OCR)

OwnershipChangeRequest//还不明白其中的道理故保留原文

This bit is set by an OS HCD to request a change of control of the HC. When set HC will

set the OwnershipChange field in HcInterruptStatus. After the changeover, this bit is

cleared and remains so until the next request from OS HCD.

[15,4][31,8]保留

[17,16](SOC)

SchedulingOverrunCount

These bits are incremented on each scheduling overrun error. It is initialized to 00b and

wraps around at 11b. This will be incremented when a scheduling overrun is detected even

if SchedulingOverrun in HcInterruptStatus has already been set.

This is used by HCD to monitor any persistent scheduling problems.

HcInterruptStatus 当某位被置1后你只能写1清除

[0](SO)

SchedulingOverrun

This bit is set when the USB schedule for the current Frame overruns and after the update

of HccaFrameNumber. A scheduling overrun will also cause the

SchedulingOverrunCount of HcCommandStatus to be incremented.

[1](WDH)当HC把HcDoneHead的值写到HCCA的DoneHead域后此位置1,只有当HCD清除此位后HccaDoneHead的值才会被更新

[2](SF) 帧开始

[3] (RD)当HC查到设备发出恢复信号后置此位,但由HCD设置 “USB恢复”状态时,HC不会置1此位

[4](UE) This bit is set when HC detects a system error not related to USB. HC should not

proceed with any processing nor signaling before the system error has been corrected.

HCD clears this bit after HC has been reset.

[5](FNO)当HcFmNumber[15]改变时HC置此位

[6](

RHSC) 当HcRhStatus或HcRhPortStatus[NumberofDownstreamPort]改变时值此位

rHcInterruptEnable

分别对SO,WDH,SF,RD,UE,FNO中断的开启

rHcInterruptDisable

1.2//-----------------------内存指针组---------------------------------

HcHCCA 你需要赋给它HCCA数据结构的地址

//-----------------------------------------------------------------------------

HcPeriodCurrentED 反映当前中断或同步ED物理地址 (读写权限HCD R HC R/W)

当HC完成一个周期传输ED后自动更新,HCD只能读取它来判断当前处理的哪个ED

//----------------------------------------------------------------------------------------

HcControlHeadED 控制传输ED链的头指针

HcControlCurrentED

[31,4](CCED) 指示当前正处理的ED,

HcBulkHeadED

HcBuldCurrentED

HcDoneHead 当一个TD处理完成后HC把HcDoneHead的值写到HCCA的DoneHead域中并清零此寄存器且置HcInterruptStatus中的WDH位

//-------------------------------------------------------------------------------

1.3//-------------------------祯计数器组--------------------------------

HcFmInterval (HCD W/R;HC R)

[13,0](FI)帧之间的间隔时间,复位值0x2EDF,当重启HC后会恢复到初始值

[30,16] FSLargestDataPacket

This field specifies a value which is loaded into the Largest Data Packet Counter at the

beginning of each frame. The counter value represents the largest amount of data in

bits which can be sent or received by the HC in a single transaction at any given time

without causing scheduling overrun. The field value is calculated by the HCD.

[31](FIT)当HCD重设FI时需切换(原来是0则变1是1则改0)此位让设置生效

HcFmRemaining 以FI为初值递减 (HCD R ;HC W/R)

[13,0](FR)指示当前帧还剩余多少时间,为0时自动载入FmInterval的值

HcFmNumber

[15,0](FN)复位值0 (读写权限HCD R,HC R/W)在”USB可操作”状态下,当FR为0时它会加1,当计到0xFFFF后回到0。HC在每个帧开始时先增加FN的值然后再写入HCCA随后就发送一个SOF。并设置HcInterruptStatus中的SF

[31,16]保留

// ----------------------------------------------------------------

HcPeriodicStart

[13,0](PS)硬件复位后此区域的值为0,HCD在初始化HC期间应设置合适初值.一般不应超过FI的10%.. 建议值0x3E67。 当FR达到PS时周期传输才会有高于Control/Bulk传输的优先权。当HC完成当前Control/Bulk TD后就会处理周期TD列表了

HcLSThreshold

[11,0](LST) LSThreshold

This field contains a value which is compared to the FrameRemaining field prior to initiating

a Low Speed transaction. The transaction is started only if FrameRemaining ≥ this field.

The value is calculated by HCD with the consideration of transmission and setup overhead.

1.4//-----------------------------根集线器组-----------------------

rHcRhDescriptorA 用来描述HUB的基本信息

[7,0](NDP)(此位HCD 只读) 指示此根HUB支持多少个端口。(至少是1,最大支持15)

[8](PSM)0所有端口的电源同时开启,1单独控制(NPS为0此域才有效)

[9](NPS)0端口电源可控,1端口电源常开

[31,24]( POTPGT) 指示出HCD在根HUB上电期间要等待多少个2ms。

//---------------------------------------------------------------------------------------

rHcRhDescriptorB

[15,1](DR) 当HCD值某位为1表示此端口上的设备为不可移动设备

[31,17](PPCM)

rHcRhStatus

[0](LPS)

//------------------------------------------------------------------------------------

rHcRhPortStatus1用来控制和报告端口事件。低字反应端口状态,高字反应状态改变

[0](CCS)当读此位为0表示端口无设备连接,1表示有;当对此位写1后清除PortEnableStatus

位,写0无任何反应。(当前连接状态不受写此位的影响)

[1](PES)0端口被禁止 1端口允许。

[2](PSS)1端口处于挂起状态

[3](POCI)1电流过载

[4](PRS)1端口处在重启状态

[8](PPS)

[9](LSDA)1连接的是低速设备0全速

[16](CSC)1当前连接状态改变0没变

[17](PESC)

[18]( PSSC)1恢复完成

[19]

[20](PRSC)1端口复位完成,HCD写1才能清零此位。

rHcRhPortStatus2