void HCSR04::AcceptCommand(const Command& command) { unsigned char commandId = command.GetCommandId(); switch(commandId) { case SENSE: Sense(); break; default: break; } }
/** @publishedPartner @prototype 9.5 Default implementation for GetInfo. PSL should override this function to fill the PSL specific arguements @param aInfo Updated with the resource information structure(TPowerResourceInfoV01). @return KErrNone if success or one of the system wide errors */ EXPORT_C TInt DStaticPowerResource::GetInfo(TDes8* anInfo) const { __KTRACE_OPT(KRESMANAGER, Kern::Printf(">DStaticPowerResource::GetInfo")); TPowerResourceInfoV01 *pBuf = (TPowerResourceInfoV01*)anInfo; pBuf->iClass=Class(); pBuf->iLatencyGet=LatencyGet(); pBuf->iLatencySet=LatencySet(); pBuf->iType=Type(); pBuf->iUsage=Usage(); pBuf->iSense=Sense(); pBuf->iResourceName=iName; pBuf->iDefaultLevel = iDefaultLevel; __KTRACE_OPT(KRESMANAGER, Kern::Printf("<DStaticPowerResource::GetInfo")); return KErrNone; }
void TestProgram( void ) { int i, result; printf( "\nTesting...\n" ); for( i = 0; i < totalQueues; i++ ) { Select( theSequence[i].Socket, theSequence[i].Queue ); result = Sense(); printf( "Socket %d, Queue %d - %s: ", theSequence[i].Socket, theSequence[i].Queue, theSequence[i].Desc ); if( result ) printf( "present\n" ); else printf( "MISSING\n" ); } }
void TestAllQueues( void ) { int i, j; for( i = 0; i < 8; i++ ) { printf( "Socket %d:\n", i ); for( j = 0; j < 16; j++ ) { Select( i, j ); if( Sense() ) printf( "Q%d, ", j ); } printf( "\n" ); } }
/// FIXME: Intelligente Motorverwaltung int FloppyDrive::ReadSector(int driveNumber, uint8_t cylinder, uint8_t head, uint8_t sector) { uint8_t cyl0, status; ReadTransfer(); MotorOn(driveNumber); Seek(driveNumber, cylinder, head); for (int i = 0; i<5; i++) { SendCommand(CMD_READ); SendCommand((head<<2) | driveNumber); SendCommand(cylinder); SendCommand(head); SendCommand(sector); SendCommand(2); SendCommand(18); SendCommand(27); SendCommand(0xFF); WaitIRQ(); uint8_t st0 = ReadData(); //st0 ReadData(); //st1 ReadData(); //st2 ReadData(); //cylinder ReadData(); //head ReadData(); //sector ReadData(); //sectorsize Sense(&cyl0, &status); if((st0 & 0xC0) == 0) { MotorOff(driveNumber); return NO_ERROR; } } MotorOff(driveNumber); return ERR_TIMEOUT; }
bool Observer::WillBeNewSight() { RealTime next_sight_time; switch (Sense().GetViewWidth()) { case VW_Narrow: return true; case VW_Normal: next_sight_time = GetLastSightRealTime() + 2 * ServerParam::instance().simStep(); break; case VW_Wide: next_sight_time = GetLastSightRealTime() + 3 * ServerParam::instance().simStep(); break; default: PRINT_ERROR("view width error"); return true; /** bug is here, wait anyway */ } if (next_sight_time - GetLastCycleBeginRealTime() < ServerParam::instance().synchSeeOffset() + PlayerParam::instance().WaitSightBuffer()) { return true; } else { return false; } }
int FloppyDrive::Seek(int driveNumber, uint8_t cylinder, uint8_t head) { uint8_t st0, cyl0; int i = 0; for(i = 0; i < 5; i++) { SendCommand(CMD_SEEK); SendCommand((head << 2) | driveNumber); SendCommand(cylinder); WaitIRQ(); Sense(&st0, &cyl0); if(cyl0 == cylinder) return NO_ERROR; sleep(15); } return ERR_TIMEOUT; }