#ifndef __ohci_h__ #define __ohci_h__ #include "type.h" #include "ieee1394.h" #include "b.h" template struct SetClear { RelativeRef set; RelativeRef clear; }; struct Ohci { struct Version { Field revision; Field version; Field guidRom; U32 all; }; RelativeRef version; struct GuidRom { Field miniRom; Field rdData; Field rdStart; Field addrReset; U32 all; }; RelativeRef guidRom; struct AtRetries { Field maxAtReqRetries; Field maxAtRespRetries; Field maxPhysRespRetries; Field cycleLimit; Field secondLimit; U32 all; }; RelativeRef atRetries; RelativeRef csrData; RelativeRef csrCompare; struct CsrControl { static const U32 selBusManagerId=0; static const U32 selBandwidthAvailable=1; static const U32 selChannelAvailableHi=2; static const U32 selChannelAvailableLo=3; Field sel; Field done; U32 all; }; RelativeRef csrControl; struct ConfigRomHeader { Field romCrcValue; Field crcLength; Field infoLength; U32 all; }; RelativeRef configRomHeader; RelativeRef busId; struct BusOptions { Field linkSpd; Field maxRec; U32 all; }; RelativeRef busOptions; struct GlobalUniqueIdHi { Field chipIdHi; Field nodeVendorId; U32 all; }; RelativeRef globalUniqueIdHi; struct GlobalUniqueIdLo { Field chipIdLo; U32 all; }; RelativeRef globalUniqueIdLo; struct ConfigRomAddr { Field aligned; Field configRomAddrHi; U32 all; }; RelativeRef configRomAddr; struct VendorId { Field vendorCompanyId; Field vendorUnique; U32 all; }; RelativeRef vendorId; struct HcControl { Field softReset; Field linkEnable; Field postedWriteEnable; Field lps; Field aPhyEnhanceEnable; Field programPhyEnable; Field ackTardyEnable; Field noByteSwapData; Field BibImageValid; U32 all; }; RelativeRef,0x050> hcControl; struct InitialBandwidthAvailable { Field initialBandwidthAvailable; U32 all; }; RelativeRef initialBandwidthAvailable; RelativeRef initialChannelAvailableHi; RelativeRef initialChannelAvailableLo; struct FairnessControl { Field priReq; U32 all; }; RelativeRef fairnessControl; struct LinkControl { Field tag1SyncFilterLock; Field rcvSelfId; Field rcvPhyPkt; Field cycleTimerEnable; Field cycleMaster; Field cycleSource; U32 all; }; RelativeRef,0x0e0> linkControl; struct NodeIdentificationAndStatus { Field nodeNumber; Field busNumber; Field cps; Field root; Field idValid; U32 all; }; RelativeRef nodeIdentificationAndStatus; struct PhyControl { Field wrData; Field regAddr; Field wrReg; Field rdReg; Field rdData; Field rdAddr; Field rdDone; U32 all; }; RelativeRef phyControl; struct IsochronousCycleTimer { Field cycleOffset; Field cycleCount; Field cycleSeconds; Field timeStamp; U32 all; }; RelativeRef isochronousCycleTimer; struct AsynchronousRequestFilterHi { Field asynReqResourceHi; Field asynReqResourceAll; U32 all; }; RelativeRef,0x100> asynchronousRequestFilterHi; struct AsynchronousRequestFilterLo { Field asynReqResourceLo; U32 all; }; RelativeRef,0x108> asynchronousRequestFilterLo; struct PhysicalRequestFilterHi { Field physReqResourceHi; Field physReqResourceAllBuses; U32 all; }; RelativeRef,0x110> physicalRequestFilterHi; struct PhysicalRequestFilterLo { Field physReqResourceLo; U32 all; }; RelativeRef,0x118> physicalRequestFilterLo; RelativeRef physicalUpperBoundOffset; struct IntEvent { Field reqTxComplete; Field respTxComplete; Field arrq; Field arrs; Field rqPkt; Field rspPkt; Field isoTx; Field isoRx; Field postedWriteErr; Field lockRespErr; Field selfIdComplete2; Field selfIdComplete; Field busReset; Field regAccessFail; Field phy; Field cycleSync; Field cycle64Seconds; Field cycleLost; Field cycleIconsistent; Field unrecoverableError; Field cycleTooLong; Field phyRegRcvd; Field ackTardy; Field softInterrupt; Field vendorSpecific; Field masterIntEnable; U32 all; }; RelativeRef,0x080> intEvent; RelativeRef,0x088> intMask; RelativeRef,0x090> isoXmitIntEvent; RelativeRef,0x098> isoXmitIntMask; RelativeRef,0x0a0> isoRecvIntEvent; RelativeRef,0x0a8> isoRecvIntMask; struct Program { struct ContextControl { Field eventCode; Field spd; Field active; Field dead; Field wake; Field run; Field cycleMatch; Field cycleMatchEnable; U32 all; }; RelativeRef,0x00> contextControl; struct DmaContext { Field z; Field descriptorAddressMsb; U32 all; }; RelativeRef dmaContext; }; RelativeRef atRequestProgram; RelativeRef atResponseProgram; RelativeRef arRequestProgram; RelativeRef arResponseProgram; struct ItPrograms : public Program { U32 buf[4]; }; struct IrPrograms : public Program { struct ContextMatch { Field channelNumber; Field tag1SyncFilter; Field sync; Field cycleMatch; Field tag0; Field tag1; Field tag2; Field tag3; U32 all; }; RelativeRef contextMatch; U32 buf[8]; }; RelativeRef itPrograms; RelativeRef irPrograms; RelativeRef,0x070> irMultiChannelMaskHi; RelativeRef,0x078> irMultiChannelMaskLo; struct SelfIdPointer { Field aligned; Field selfIdPointer; U32 all; }; RelativeRef selfIdPointer; struct SelfIdCount { Field selfIdSize; Field selfIdGeneration; Field selfIdError; U32 all; }; RelativeRef selfIdCount; RelativeRef postedWriteAddressLo; RelativeRef postedWriteAddressHi; }; struct OhciDescriptor { struct Descriptor { RelativeField id; RelativeField reqCount; RelativeField b; RelativeField i; RelativeField p; RelativeField key; RelativeField s; RelativeField cmd; RelativeField dataAddress; RelativeField branchAddress; RelativeField z; RelativeField branchAddressMsb; RelativeField timeStamp; RelativeField xfer; }; struct OutputMore : public Descriptor { inline void init() { cmd=0; key=0; b=0; } U32 buf[4]; }; struct OutputMoreImmediate : public Descriptor { inline void init() { cmd=0; key=2; b=0; } RelativeRef quadlets; U32 buf[8]; }; struct OutputLast : public Descriptor { inline void init() { cmd=1; key=0; b=3; } U32 buf[4]; }; struct OutputLastImmediate : public Descriptor { inline void init() { bClear((U8*)this,sizeof(*this)); cmd=1; key=2; b=3; } RelativeRef quadlets; U32 buf[8]; }; struct InputMore : public Descriptor { RelativeField resCount; inline void init() { bClear((U8*)this,sizeof(*this)); cmd=2; key=0; b=3; s=1; } U32 buf[4]; }; }; int waitQuadletInit(Ohci *ohci); int waitQuadletPoll(Ohci *ohci); #endif /* __ohci_h__ */