int32_t CItemRebulidEvent::OnMessageEvent(MessageHeadSS * pMsgHead, IMsgBody* pMsgBody, const uint16_t nOptionLen, const void *pOptionData) { if(pMsgBody==NULL || pMsgHead==NULL) { WRITE_ERROR_LOG("null pointer:{pMsgBody=0x%08x, pMsgHead=0x%08x}\n",pMsgBody,pMsgHead); return E_NULLPOINTER; } int32_t ret = S_OK; WRITE_NOTICE_LOG("rebulid :recv need rebulid noti serverType = %d",pMsgHead->nSourceType); CItemRebulidCtl &stItemRebulidCtl = GET_ITEMREBULIDCTL_INSTANCE(); stItemRebulidCtl.SetItemRebulid(pMsgHead->nSourceType); //发送房间的创建通知 if(pMsgHead->nSourceType == enmEntityType_Item) { ret = SendCreatRoomNotice(); if(ret < 0) { stItemRebulidCtl.SetItemRebulidSuccess(pMsgHead->nSourceType); return ret; } } //获取所有玩家到item_rebulid_ctl中 ret = GetNeedRebulidPlayer(pMsgHead->nSourceType); if(ret<0) { stItemRebulidCtl.SetItemRebulidSuccess(pMsgHead->nSourceType); return ret; } //创建定时器,超时则开始更新玩家 ret = StartTimer(pMsgHead->nSourceType); if (ret < 0) { stItemRebulidCtl.SetItemRebulidSuccess(pMsgHead->nSourceType); return ret; } return S_OK; }
static void ShowCall(tString *pString, unsigned char Type) { static tString CallerId[15] = ""; tMessage Msg; if (Type == SHOW_NOTIF_CALLER_ID) strcpy(CallerId, pString); if (Type == SHOW_NOTIF_CALLER_NAME && *CallerId) { PrintF("- Caller:%s", pString); SetupMessageWithBuffer(&Msg, SetVibrateMode, MSG_OPT_NONE); if (Msg.pBuffer != NULL) { *(tSetVibrateModePayload *)Msg.pBuffer = RingTone; RouteMsg(&Msg); } PageType = PAGE_TYPE_INFO; CurrentPage[PageType] = CallPage; DrawCallScreen(CallerId, pString); // set a 5s timer for switching back to idle screen StartTimer(ShowCallTimer); } else if (Type == SHOW_NOTIF_END || Type == SHOW_NOTIF_REJECT_CALL) { PrintF("- Call Notif End"); *CallerId = NULL; StopTimer(ShowCallTimer); PageType = PAGE_TYPE_IDLE; SendMessage(&Msg, UpdateDisplayMsg, CurrentMode | MSG_OPT_UPD_INTERNAL | (CurrentMode == IDLE_MODE ? MSG_OPT_NEWUI : 0)); if (Type == SHOW_NOTIF_REJECT_CALL) SendMessage(&Msg, HfpMsg, MSG_OPT_HFP_HANGUP); } }
void FHT_F(FFT_DATA_TYPE *Data, size_t Len) /* Decimation in frequency Hartley transform */ { size_t Step, Step2, Step4; TRIG_VARS size_t a,b; FFT_DATA_TYPE *Right,*Left; StartTimer(FFTITime); Step = Len; while (Step > 1) { Step2 = Step/2; Step4 = Step/4; Left = &Data[0]; Right = &Data[Step2]; INIT_TRIG(Step2); /* Do the special b=0 loop below */ for (a = 0; a < Len; a+=Step) { FHT_F1Butterfly(a,a,1.0,0.0); if (Step4) FHT_F1Butterfly(a+Step4,a+Step4,1.0,0.0); } for (b = 1; b < Step4; b++) {size_t I1,I2; NEXT_TRIG_POW; for (I1=b,I2=Step2-b; I1 < Len; I1+=Step,I2+=Step) FHT_F2Butterfly(I1,I2,Pow_r,Pow_i); } Step /= 2; } StopTimer(FFTITime); }
/** * Handles the drawing of the moving map and is called by the DrawThread */ void MapWindow::on_paint_buffer(Canvas &canvas) { #ifndef ENABLE_OPENGL unsigned render_generation = ui_generation; // Start the drawing timer (for drawing time calculation) StartTimer(); #endif // Render the moving map Render(canvas, get_client_rect()); #ifndef ENABLE_OPENGL // Stop the drawing timer and calculate drawing time StopTimer(); /* save the generation number which was active when rendering had begun */ buffer_projection = render_projection; buffer_generation = render_generation; #endif }
void CTcpSocketService::SetKeepAliveHandler(CBaseKeepAliveHandler* Handler) { //release previous handler if(m_KeepAliveHandler != NULL) { StopTimer(); m_KeepAliveHandler->Advise(NULL); if(m_KeepAliveHandler != NULL) { delete m_KeepAliveHandler; m_KeepAliveHandler = NULL; } } if(Handler == NULL) return; m_KeepAliveHandler = Handler; m_KeepAliveHandler->Advise(this); DWORD KeepAliveTimeoutInterval = Handler->TimeoutFrequency(); if(GetCurrentTimerRate() <= 0 || GetCurrentTimerRate() > KeepAliveTimeoutInterval ) StartTimer(KeepAliveTimeoutInterval, "TcpSocketService"); }
void DialogLoggedOutSAS::DialogInit() { if(!m_username.empty()) SetItemText(IDC_USERNAME_TXT, m_username.c_str()); if(!m_password.empty()) SetItemText(IDC_PASSWORD_TXT, m_password.c_str()); std::wstring motd = pGina::Transactions::TileUi::GetDynamicLabel(L"MOTD"); SetItemText(IDC_MOTD, motd.c_str()); ApplyLogoImage(); SetFocusItem(IDC_USERNAME_TXT); bool specialActionEnabled = pGina::Registry::GetBool(L"EnableSpecialActionButton", false); if(specialActionEnabled) { EnableItem(IDC_SPECIAL); SetItemText(IDC_SPECIAL, pGina::Registry::GetString(L"SpecialAction", L"Shutdown").c_str()); } else DisableItem(IDC_SPECIAL); SetServiceStatus(); // Start a timer to update service status m_statusTimerId = StartTimer(pGina::Registry::GetDword(L"PingSleepTime", 5000)); }
/***************************************************************************** * FUNCTION * mmi_java_display_is_busy * DESCRIPTION * To show java is busy now * PARAMETERS * void * RETURNS * void *****************************************************************************/ void mmi_java_display_is_busy(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ EntryNewScreen(SCR_J2ME_SCREEN_NOT_READY, mmi_java_widget_not_ready, NULL, NULL); StartTimer(J2ME_NOT_READY_TIMER, 2000, GoBackHistory); ShowCategory66Screen( STR_JAVA_VM_BUSY, mmi_java_get_title_icon(), 0, 0, STR_GLOBAL_BACK, IMG_GLOBAL_BACK, (PU8) GetString(STR_JAVA_WAIT), IMG_PROCESSING_PHONEBOOK, NULL); SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP); }
/***************************************************************************** * FUNCTION * srv_ctm_med_close_req * DESCRIPTION * * PARAMETERS * void * RETURNS * void *****************************************************************************/ void srv_ctm_med_close_req(void) { #ifndef __CTM_DEBUG /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ MMI_TRACE(MMI_COMMON_TRC_G5_CALL, FUNC_SRV_CTM_MED_CLOSE_REQ); #ifdef __MMI_BT_AUDIO_VIA_SCO__ srv_btsco_enable_sco_connection(SRV_BT_SCO_INT_CTM); #endif SetProtocolEventHandler(srv_ctm_phdlr_close_rsp, MSG_ID_MEDIA_CTM_CLOSE_CNF); mmi_frm_send_ilm(MOD_MED, MSG_ID_MEDIA_CTM_CLOSE_REQ, NULL, NULL); #else /* __CTM_DEBUG */ StartTimer(CM_CTM_ALERT_NOTIFYDURATION_TIMER, 2000, (FuncPtr) srv_ctm_phdlr_close_rsp); #endif /* __CTM_DEBUG */ }
/** * Start all streams and timer */ void KinectWindow::StartStreams() { // Color stream m_pColorStream->StartStream(); // Depth stream m_pDepthStream->StartStream(); // Skeleton stream m_pSkeletonStream->StartStream(); // m_pSkeletonPointsStream->StartStream(); /* // Audio reading stream m_pAudioStream->StartStream(); // Accelerometer reading stream m_pAccelerometerStream->StartStream(); */ // Start waitble timer StartTimer(); }
void DUIInit( void ) { InitScreen(); CmdHistory = WndInitHistory(); SrchHistory = WndInitHistory(); InitToolBar(); InitMemWindow(); InitAboutMessage(); InitIOWindow(); InitMenus(); WndInit( LIT_DUI( The_WATCOM_Debugger ) ); _SwitchOff( SW_ERROR_STARTUP ); #if defined(__GUI__) TellWinHandle(); #endif if( WndMain != NULL ) WndSetIcon( WndMain, &MainIcon ); StartTimer(); InitHelp(); InitGadget(); InitPaint(); InitBrowse(); InitFont(); }
void HandleCallNotification(unsigned char Opt, unsigned char *pVal, unsigned char Len) { tMessage Msg; switch (Opt) { case CALLER_NAME: if (Ring == FALSE) { Ring = TRUE; SendMessage(&Msg, VibrateMsg, VIBRA_PATTERN_RING); StartTimer(VibraTimer); DrawCallNotification(pVal, Len); if (GetProperty(PROP_AUTO_BACKLIGHT)) SendMessage(&Msg, AutoBacklightMsg, MSG_OPT_NONE); } break; case CALL_END: StopTimer(VibraTimer); Ring = FALSE; SendMessage(&Msg, ChangeModeMsg, IDLE_MODE | MSG_OPT_UPD_INTERNAL); if (Connected(CONN_TYPE_HFP)) SendMessage(&Msg, HfpMsg, MSG_OPT_HFP_RING_STOP); break; case CALL_REJECTED: StopTimer(VibraTimer); Ring = FALSE; if (Connected(CONN_TYPE_HFP)) SendMessage(&Msg, HfpMsg, MSG_OPT_HFP_HANGUP); break; case CALLER_NUMBER: SetCallerNumber(pVal, Len); break; } }
static void FwdRFFT_T(Cmplx *Data,size_t Len) /* ** Recursive Forward Decimation in Time */ {size_t x,Len2,Len4,Len8; Cmplx *Left,*Right; TRIG_VARS; Len2 = Len/2;Len4 = Len/4;Len8 = Len/8; if (Len<=(CPU_CACHE/sizeof(Cmplx))) {FwdFFT_T(Data,Len);return;} else if (Len2 >= 2) {FwdRFFT_T(Data,Len2);FwdRFFT_T(Data+Len2,Len2);} StartTimer(FFTRTime); INIT_TRIG(Len2,POS); Left=&Data[0]; Right=&Data[Len2]; RButterfly(0,POS,1.0,POS,0.0); for (x=1;x<Len8;x++) { NEXT_TRIG_POW(POS); RButterfly(x, POS,Pow_r,POS,Pow_i); RButterfly(Len2-x,NEG,Pow_r,POS,Pow_i); RButterfly(Len4-x,POS,Pow_i,POS,Pow_r); RButterfly(Len4+x,NEG,Pow_i,POS,Pow_r); } if (Len8) {LDouble sq=K_SQRT05_; RButterfly(Len8, POS,sq,POS,sq); RButterfly(Len2-Len8,NEG,sq,POS,sq); } if (Len4) RButterfly(Len4,POS,0,POS,1.0); StopTimer(FFTRTime); }
int main(int argc, char* argv[]) { if(argc < 4) { printf("Usage:%s etc_fn server_id log_fn\n", argv[0]); return -1; } //命令行参数,依次为: 配置文件路径,server_id,日志文件路径名 const char* pszEtcFn = argv[1]; uint16_t nServerId = (uint16_t)atoi(argv[2]); const char* pszLogPath = argv[3]; signal(SIGPIPE, SIG_IGN); CDebug::Init(); g_logger.SetLogPath(pszLogPath); CTimerdWorld& world = (CTimerdWorld&)*GetWorld(); int nRet = world.init(pszEtcFn); if(nRet != 0) { printf("world init error:%d\n", nRet); return nRet; } CTimerdServer& s = g_timerd_server; s.SetMailboxId(nServerId); s.SetWorld(&world); world.SetServer(&s); StartTimer(); uint16_t unPort = world.GetServerPort(nServerId); s.Service("", unPort); }
void CUDSMainWnd::OnBnClickedSendUD(){ KillTimer(ID_TIMER_TP); //Added to kill the timer everyTime I've pressed the SEND button FSending = TRUE; // This flag is used to know if a message has been sent from the UDSMainWnd Bytes_to_Show= ("\r\n 1 -> "); //Inicialización de la sección de ResponseData BytesShown_Line = 1; m_abDatas = " "; m_omDiagService = initialEval(m_omMsgDataEdit); m_omBytes.vSetValue(0); CurrentService = m_omMsgDataEdit.Left(NO_OF_CHAR_IN_BYTE); UpdateData(false); if (psTxCanMsgUds ==NULL) psTxCanMsgUds = new mSTXSELMSGDATA; UpdateData(); //setValue(); BYTE byAddress = (BYTE)m_omSourceAddress.lGetValue(); if(psTxCanMsgUds != NULL ) { psTxCanMsgUds->m_unCount = 1; psTxCanMsgUds->m_psTxMsg = new STCAN_MSG[1]; if(psTxCanMsgUds->m_psTxMsg != NULL ) { psTxCanMsgUds->m_psTxMsg->m_ucRTR = FALSE; psTxCanMsgUds->m_psTxMsg->m_ucChannel = (UCHAR)m_omComboChannelUDS.GetCurSel()+1; Current_Channel = psTxCanMsgUds->m_psTxMsg->m_ucChannel; psTxCanMsgUds->m_psTxMsg->m_unMsgID = (int)m_omCanID.lGetValue(); if( psTxCanMsgUds->m_psTxMsg->m_unMsgID != 0 && (TargetAddress || SourceAddress)!=0 && m_omMsgDataEdit.GetLength()!=0 ){ PrepareDiagnosticMessage(m_omMsgDataEdit, psTxCanMsgUds, psTxCanMsgUds->m_psTxMsg->m_ucData, 8); //This funtion evaluate if the message is a long or a short request and prepare the message }else { Font_Color = RGB(184,134,11 ); m_omDiagService = "You have entered an invalid data"; UpdateData(false); StartTimer(); // Start de timer for tester present } } } }
void CLbsTrackingTimerBase::LocationUpdate(TPositionInfoBase &aPosition, CSelfManagingPsy *aPsy) { qDebug() << "CLbsTrackingTimerBase::LocationUpdate from PSY " << aPsy->iPsyName << "Type=" << iTrackType ; delete iLatestQPosInfo; iLatestQPosInfo = new(ELeave) QGeoPositionInfo; PsyUtils::TPositionInfo2QGeoPositionInfo(aPosition, *iLatestQPosInfo); //IF this is the first location after Start updates then //1) Send the location to the client //2) Cancel the TTFF timer and start the regular update interval timer if (iTTFFTimerActive) { qDebug() << "CLbsTrackingTimerBase::LocationUpdate from PSY " << aPsy->iPsyName << "FIRST UPDATE" ; //Cancel TTFF timer and start update interval timer iTimer.Cancel(); Cancel(); StartTimer(); iObserver->TrackingLocation(iLatestQPosInfo, this); delete iLatestQPosInfo; iLatestQPosInfo = NULL; } }
void SpofEntryPwrOffInd(void) { mmi_trace(1," SpofEntryPwrOffInd "); TurnOnBacklight(1); EntryNewScreen(SCR_ID_SPOF_PWROFF_IND, NULL, SpofEntryPwrOffInd, NULL); ClearAllKeyHandler(); ClearKeyHandler( KEY_END, KEY_EVENT_DOWN ); ClearKeyHandler( KEY_END, KEY_LONG_PRESS ); /*modify the right softkey caption from "Back" to "Cancel" by liuxl on 20090626*/ ShowCategory66Screen( SPOF_MAIN_TITLE_STRINGID, #if defined(__PROJECT_GALLITE_C01__) NULL, #else SPOF_TYPEPOWEROFF_IMAGEID, #endif STR_GLOBAL_OK, 0, STR_GLOBAL_CANCEL, 0, (PU8)GetString(SPOF_POWER_OFF_CONFIRM), #if defined(__PROJECT_GALLITE_C01__) NULL, #else SPOF_TYPEPOWEROFF_IMAGEID, #endif NULL); SetLeftSoftkeyFunction(ShutdownSystemOperation, KEY_EVENT_UP); //wangzl: 090912 modify for 14334 //SetRightSoftkeyFunction(QuitPwrOffIndBackToIdleScreen, KEY_EVENT_UP); SetRightSoftkeyFunction(QuitPwrOffIndBack, KEY_EVENT_UP); //wangzl: 090912 modify end StartTimer(SYSTEM_SHUTDOWN, 10*1000, ShutdownSystemOperation); }
NS_IMETHODIMP nsIncrementalDownload::OnStopRequest(nsIRequest *request, nsISupports *context, nsresult status) { // Not a real error; just a trick to kill off the channel without our // listener having to care. if (status == NS_ERROR_DOWNLOAD_NOT_PARTIAL) return NS_OK; // Not a real error; just a trick used to suppress OnDataAvailable calls. if (status == NS_ERROR_DOWNLOAD_COMPLETE) status = NS_OK; if (NS_SUCCEEDED(mStatus)) mStatus = status; if (mChunk) { if (NS_SUCCEEDED(mStatus)) mStatus = FlushChunk(); mChunk = nullptr; // deletes memory mChunkLen = 0; UpdateProgress(); } mChannel = nullptr; // Notify listener if we hit an error or finished if (NS_FAILED(mStatus) || mCurrentSize == mTotalSize) { CallOnStopRequest(); return NS_OK; } return StartTimer(mInterval); // Do next chunk }
void InitExperiment ( void ) { finished = 0 ; count = 0 ; missed = 0 ; accurate = 0 ; max = 0 ; resetEncoders ( ) ; u1k1 = 0 ; u2k1 = 0 ; e1k1 = 0 ; e1k2 = 0 ; e2k1 = 0 ; e2k2 = 0 ; setpoint1 = 0 ; setpoint2 = 0 ; prev1 = 0 ; prev2 = 0 ; X = 0 ; Y = 0 ; Z = 0 ; StartTimer ( ) ; }
TKeyResponse COfferKeyManager::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) { if (aType != EEventKey) return EKeyWasNotConsumed; TInt code = aKeyEvent.iCode; if (code == '#') { iActive = ETrue; StartTimer(); return EKeyWasConsumed; } else if (code >= '1' && code <= '9') { if (iActive) { TInt index = code - '1'; if (SHModel()->GetRuleManager()->Select(index)) return EKeyWasConsumed; } } return EKeyWasNotConsumed; }
NS_IMETHODIMP nsIncrementalDownload::OnStartRequest(nsIRequest *request, nsISupports *context) { nsresult rv; nsCOMPtr<nsIHttpChannel> http = do_QueryInterface(request, &rv); if (NS_FAILED(rv)) return rv; // Ensure that we are receiving a 206 response. uint32_t code; rv = http->GetResponseStatus(&code); if (NS_FAILED(rv)) return rv; if (code != 206) { // We may already have the entire file downloaded, in which case // our request for a range beyond the end of the file would have // been met with an error response code. if (code == 416 && mTotalSize == int64_t(-1)) { mTotalSize = mCurrentSize; // Return an error code here to suppress OnDataAvailable. return NS_ERROR_DOWNLOAD_COMPLETE; } // The server may have decided to give us all of the data in one chunk. If // we requested a partial range, then we don't want to download all of the // data at once. So, we'll just try again, but if this keeps happening then // we'll eventually give up. if (code == 200) { if (mInterval) { mChannel = nullptr; if (++mNonPartialCount > MAX_RETRY_COUNT) { NS_WARNING("unable to fetch a byte range; giving up"); return NS_ERROR_FAILURE; } // Increase delay with each failure. StartTimer(mInterval * mNonPartialCount); return NS_ERROR_DOWNLOAD_NOT_PARTIAL; } // Since we have been asked to download the rest of the file, we can deal // with a 200 response. This may result in downloading the beginning of // the file again, but that can't really be helped. } else { NS_WARNING("server response was unexpected"); return NS_ERROR_UNEXPECTED; } } else { // We got a partial response, so clear this counter in case the next chunk // results in a 200 response. mNonPartialCount = 0; // confirm that the content-range response header is consistent with // expectations on each 206. If it is not then drop this response and // retry with no-cache set. if (!mCacheBust) { nsAutoCString buf; int64_t startByte = 0; bool confirmedOK = false; rv = http->GetResponseHeader(NS_LITERAL_CSTRING("Content-Range"), buf); if (NS_FAILED(rv)) return rv; // it isn't a useful 206 without a CONTENT-RANGE of some sort // Content-Range: bytes 0-299999/25604694 int32_t p = buf.Find("bytes "); // first look for the starting point of the content-range // to make sure it is what we expect if (p != -1) { char *endptr = nullptr; const char *s = buf.get() + p + 6; while (*s && *s == ' ') s++; startByte = strtol(s, &endptr, 10); if (*s && endptr && (endptr != s) && (mCurrentSize == startByte)) { // ok the starting point is confirmed. We still need to check the // total size of the range for consistency if this isn't // the first chunk if (mTotalSize == int64_t(-1)) { // first chunk confirmedOK = true; } else { int32_t slash = buf.FindChar('/'); int64_t rangeSize = 0; if (slash != kNotFound && (PR_sscanf(buf.get() + slash + 1, "%lld", (int64_t *) &rangeSize) == 1) && rangeSize == mTotalSize) { confirmedOK = true; } } } } if (!confirmedOK) { NS_WARNING("unexpected content-range"); mCacheBust = true; mChannel = nullptr; if (++mNonPartialCount > MAX_RETRY_COUNT) { NS_WARNING("unable to fetch a byte range; giving up"); return NS_ERROR_FAILURE; } // Increase delay with each failure. StartTimer(mInterval * mNonPartialCount); return NS_ERROR_DOWNLOAD_NOT_PARTIAL; } } } // Do special processing after the first response. if (mTotalSize == int64_t(-1)) { // Update knowledge of mFinalURI rv = http->GetURI(getter_AddRefs(mFinalURI)); if (NS_FAILED(rv)) return rv; http->GetResponseHeader(NS_LITERAL_CSTRING("Etag"), mPartialValidator); if (StringBeginsWith(mPartialValidator, NS_LITERAL_CSTRING("W/"))) mPartialValidator.Truncate(); // don't use weak validators if (mPartialValidator.IsEmpty()) http->GetResponseHeader(NS_LITERAL_CSTRING("Last-Modified"), mPartialValidator); if (code == 206) { // OK, read the Content-Range header to determine the total size of this // download file. nsAutoCString buf; rv = http->GetResponseHeader(NS_LITERAL_CSTRING("Content-Range"), buf); if (NS_FAILED(rv)) return rv; int32_t slash = buf.FindChar('/'); if (slash == kNotFound) { NS_WARNING("server returned invalid Content-Range header!"); return NS_ERROR_UNEXPECTED; } if (PR_sscanf(buf.get() + slash + 1, "%lld", (int64_t *) &mTotalSize) != 1) return NS_ERROR_UNEXPECTED; } else { rv = http->GetContentLength(&mTotalSize); if (NS_FAILED(rv)) return rv; // We need to know the total size of the thing we're trying to download. if (mTotalSize == int64_t(-1)) { NS_WARNING("server returned no content-length header!"); return NS_ERROR_UNEXPECTED; } // Need to truncate (or create, if it doesn't exist) the file since we // are downloading the whole thing. WriteToFile(mDest, nullptr, 0, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE); mCurrentSize = 0; } // Notify observer that we are starting... rv = CallOnStartRequest(); if (NS_FAILED(rv)) return rv; } // Adjust mChunkSize accordingly if mCurrentSize is close to mTotalSize. int64_t diff = mTotalSize - mCurrentSize; if (diff <= int64_t(0)) { NS_WARNING("about to set a bogus chunk size; giving up"); return NS_ERROR_UNEXPECTED; } if (diff < int64_t(mChunkSize)) mChunkSize = uint32_t(diff); mChunk = MakeUniqueFallible<char[]>(mChunkSize); if (!mChunk) rv = NS_ERROR_OUT_OF_MEMORY; return rv; }
/** * @brief A main function to calculate spectrum by Lanczos * * @param[in,out] X CalcStruct list for getting and pushing calculation information * @retval 0 normally finished * @retval -1 unnormally finished * * @version 1.1 * @author Kazuyoshi Yoshimi (The University of Tokyo) * */ int CalcSpectrumByLanczos( struct EDMainCalStruct *X, double complex *tmp_v1, double dnorm, int Nomega, double complex *dcSpectrum, double complex *dcomega ) { char sdt[D_FileNameMax]; unsigned long int i, i_max; FILE *fp; int iret; unsigned long int liLanczosStp = X->Bind.Def.Lanczos_max; unsigned long int liLanczosStp_vec=0; if(X->Bind.Def.iFlgCalcSpec == RECALC_FROM_TMComponents_VEC || X->Bind.Def.iFlgCalcSpec == RECALC_INOUT_TMComponents_VEC) { fprintf(stdoutMPI, " Start: Input vectors for recalculation.\n"); TimeKeeper(&(X->Bind), cFileNameTimeKeep, c_InputSpectrumRecalcvecStart, "a"); StartTimer(6201); sprintf(sdt, cFileNameOutputRestartVec, X->Bind.Def.CDataFileHead, myrank); if (childfopenALL(sdt, "rb", &fp) != 0) { exitMPI(-1); } fread(&liLanczosStp_vec, sizeof(liLanczosStp_vec),1,fp); fread(&i_max, sizeof(long int), 1, fp); if(i_max != X->Bind.Check.idim_max){ fprintf(stderr, "Error: A size of Inputvector is incorrect.\n"); exitMPI(-1); } fread(v0, sizeof(complex double), X->Bind.Check.idim_max + 1, fp); fread(v1, sizeof(complex double), X->Bind.Check.idim_max + 1, fp); fclose(fp); StopTimer(6201); fprintf(stdoutMPI, " End: Input vectors for recalculation.\n"); TimeKeeper(&(X->Bind), cFileNameTimeKeep, c_InputSpectrumRecalcvecEnd, "a"); } //Read diagonal components if(X->Bind.Def.iFlgCalcSpec == RECALC_FROM_TMComponents || X->Bind.Def.iFlgCalcSpec ==RECALC_FROM_TMComponents_VEC|| X->Bind.Def.iFlgCalcSpec == RECALC_INOUT_TMComponents_VEC) { StartTimer(6202); iret=ReadTMComponents(X, &dnorm, &liLanczosStp); if(!iret ==TRUE){ fprintf(stdoutMPI, " Error: Fail to read TMcomponents\n"); return FALSE; } if(X->Bind.Def.iFlgCalcSpec == RECALC_FROM_TMComponents){ X->Bind.Def.Lanczos_restart=0; } else if(X->Bind.Def.iFlgCalcSpec == RECALC_INOUT_TMComponents_VEC|| X->Bind.Def.iFlgCalcSpec == RECALC_FROM_TMComponents_VEC){ if(liLanczosStp_vec !=liLanczosStp){ fprintf(stdoutMPI, " Error: Input files for vector and TMcomponents are incoorect.\n"); fprintf(stdoutMPI, " Error: Input vector %ld th stps, TMcomponents %ld th stps.\n", liLanczosStp_vec, liLanczosStp); return FALSE; } X->Bind.Def.Lanczos_restart=liLanczosStp; liLanczosStp = liLanczosStp+X->Bind.Def.Lanczos_max; } StopTimer(6202); } // calculate ai, bi if (X->Bind.Def.iFlgCalcSpec == RECALC_NOT || X->Bind.Def.iFlgCalcSpec == RECALC_OUTPUT_TMComponents_VEC || X->Bind.Def.iFlgCalcSpec == RECALC_FROM_TMComponents_VEC || X->Bind.Def.iFlgCalcSpec == RECALC_INOUT_TMComponents_VEC ) { fprintf(stdoutMPI, " Start: Calculate tridiagonal matrix components.\n"); TimeKeeper(&(X->Bind), cFileNameTimeKeep, c_GetTridiagonalStart, "a"); // Functions in Lanczos_EigenValue StartTimer(6203); iret = Lanczos_GetTridiagonalMatrixComponents(&(X->Bind), alpha, beta, tmp_v1, &(liLanczosStp)); StopTimer(6203); if (iret != TRUE) { //Error Message will be added. return FALSE; } fprintf(stdoutMPI, " End: Calculate tridiagonal matrix components.\n\n"); TimeKeeper(&(X->Bind), cFileNameTimeKeep, c_GetTridiagonalEnd, "a"); StartTimer(6204); OutputTMComponents(X, alpha,beta, dnorm, liLanczosStp); StopTimer(6204); }//X->Bind.Def.iFlgCalcSpec == RECALC_NOT || RECALC_FROM_TMComponents_VEC fprintf(stdoutMPI, " Start: Caclulate spectrum from tridiagonal matrix components.\n"); TimeKeeper(&(X->Bind), cFileNameTimeKeep, c_CalcSpectrumFromTridiagonalStart, "a"); StartTimer(6205); for( i = 0 ; i < Nomega; i++) { iret = GetSpectrumByTridiagonalMatrixComponents(alpha, beta, dnorm, dcomega[i], &dcSpectrum[i], liLanczosStp); if (iret != TRUE) { //ToDo: Error Message will be added. //ReAlloc alpha, beta and Set alpha_start and beta_start in Lanczos_EigenValue return FALSE; } dcSpectrum[i] = dnorm * dcSpectrum[i]; } StopTimer(6205); fprintf(stdoutMPI, " End: Caclulate spectrum from tridiagonal matrix components.\n\n"); TimeKeeper(&(X->Bind), cFileNameTimeKeep, c_CalcSpectrumFromTridiagonalEnd, "a"); //output vectors for recalculation if(X->Bind.Def.iFlgCalcSpec==RECALC_OUTPUT_TMComponents_VEC || X->Bind.Def.iFlgCalcSpec==RECALC_INOUT_TMComponents_VEC){ StartTimer(6206); fprintf(stdoutMPI, " Start: Output vectors for recalculation.\n"); TimeKeeper(&(X->Bind), cFileNameTimeKeep, c_OutputSpectrumRecalcvecStart, "a"); sprintf(sdt, cFileNameOutputRestartVec, X->Bind.Def.CDataFileHead, myrank); if(childfopenALL(sdt, "wb", &fp)!=0){ exitMPI(-1); } fwrite(&liLanczosStp, sizeof(liLanczosStp),1,fp); fwrite(&X->Bind.Check.idim_max, sizeof(X->Bind.Check.idim_max),1,fp); fwrite(v0, sizeof(complex double),X->Bind.Check.idim_max+1, fp); fwrite(v1, sizeof(complex double),X->Bind.Check.idim_max+1, fp); fclose(fp); fprintf(stdoutMPI, " End: Output vectors for recalculation.\n"); TimeKeeper(&(X->Bind), cFileNameTimeKeep, c_OutputSpectrumRecalcvecEnd, "a"); StopTimer(6206); } return TRUE; }
/* * ------------------------------------------------------------------------ */ int main( int argc, char ** argv ) { int i; int fg=0; char *cmdname; char *port = "6260"; #if 0 int novideo=1; #endif cmdname=strrchr(*argv,'/'); if ( cmdname ) cmdname ++; else cmdname = *argv; g_av=argv; g_ac=argc; i=0; if (( argc>1 ) && !strcmp(argv[1],"-version")) i=1; memset( cl_array, 0, sizeof(cl_array) ); for( i=1; i < argc; i++ ) { if ( (i<argc-1) && !strcmp(argv[i],"-port") ) { port = strdup(argv[++i]); } else if ( !strcmp(argv[i],"-debug") ) { debug = 1; } else if ( !strncmp(argv[i],"-debug=",7) ) { debug = atoi(argv[i]+7); } else if ( !strcmp(argv[i],"-fg") ) { fg = 1; } #if 0 else if ( !strcmp(argv[i],"+video") ) { novideo=0; } #endif else if ( !strcmp(argv[i],"-version") ) { printf("%s\n",cstr); exit(0); } else { printf("usage: %s [-port <nr>] [-debug=mask] [-fg]\n", *argv); printf(" debug-mask : 1 : quiet debug\n"); printf(" debug-mask : 2 : send mail\n"); printf(" debug-mask : 4 : timer\n"); printf(" debug-mask : 8 : http traffic\n"); printf(" debug-mask : 16 : json traffic\n"); return 1; } } signal( SIGCHLD, SIG_IGN ); signal( SIGPIPE, SIG_IGN ); signal( SIGHUP, SIG_IGN ); memset(&json,0,sizeof(JsonVars)); memset(&timer,0,sizeof(TimerVars)); memset(&mail,0,sizeof(MailVars)); ReadTimerFromFile(); ReadMailConfigFromFile(); HttpLoadCleaningRecord(0,0); system("ifconfig lo up"); #if 0 if ( !novideo ) _v4l2_start(); else HttpSetNoCam(); #endif if ( !fg && fork() ) return 0; listen_line = _lgListen( atol(port) ); StartTimer(); jsonSend(0); skMainLoop(); return( 0 ); }
void DistributeMaterialData() { #ifdef MPI long mat, id, ptr, sz; /* Check number of MPI tasks */ if (mpitasks == 1) return; fprintf(out, "Waiting for results from other MPI tasks...\n"); /* Start timers */ StartTimer(TIMER_MPI_OVERHEAD); StartTimer(TIMER_MPI_OVERHEAD_TOTAL); /***************************************************************************/ /***** Collect data ********************************************************/ mat = (long)RDB[DATA_PTR_M0]; while (mat > VALID_PTR) { /* Check burn-flag */ if ((long)RDB[mat + MATERIAL_OPTIONS] & OPT_BURN_MAT) { /* Get MPI id */ id = (long)RDB[mat + MATERIAL_MPI_ID]; CheckValue(FUNCTION_NAME, "id", "", id, 0, mpitasks - 1); /* Get pointer to data */ ptr = (long)RDB[mat + MATERIAL_PTR_DATA_BLOCK]; CheckPointer(FUNCTION_NAME, "(ptr)", DATA_ARRAY, ptr); /* Get block size */ sz = (long)RDB[mat + MATERIAL_DATA_BLOCK_SIZE]; /* Synchronise */ MPI_Barrier(MPI_COMM_WORLD); /* Broadcast data to other tasks */ MPITransfer(&WDB[ptr], NULL, sz, id, MPI_METH_BC); /* Synchronise */ MPI_Barrier(MPI_COMM_WORLD); } /* Next material */ mat = NextItem(mat); } /***************************************************************************/ fprintf(out, "OK.\n\n"); /* Stop timers */ StopTimer(TIMER_MPI_OVERHEAD); StopTimer(TIMER_MPI_OVERHEAD_TOTAL); #endif }
static uint8_t Transfer(uint32_t dataAddress, size_t nofBytes) { static const uint8_t OneValue = 0xFF; /* value to clear or set the port bits */ TMOUT1_CounterHandle handle; bool isTimeout; uint32_t done0, done1, done2; /* clear any pending done flags for DMA channels */ DMA_PDD_ClearDoneFlag(DMA_BASE_PTR, DMA_PDD_CHANNEL_0); DMA_PDD_ClearDoneFlag(DMA_BASE_PTR, DMA_PDD_CHANNEL_1); DMA_PDD_ClearDoneFlag(DMA_BASE_PTR, DMA_PDD_CHANNEL_2); /* set DMA source addresses */ DMA_PDD_SetSourceAddress(DMA_BASE_PTR, DMA_PDD_CHANNEL_0, (uint32_t)&OneValue); /* set source address */ DMA_PDD_SetSourceAddress(DMA_BASE_PTR, DMA_PDD_CHANNEL_1, dataAddress); /* set source address */ DMA_PDD_SetSourceAddress(DMA_BASE_PTR, DMA_PDD_CHANNEL_2, (uint32_t)&OneValue); /* set source address */ /* set byte count addresses */ DMA_PDD_SetByteCount(DMA_BASE_PTR, DMA_PDD_CHANNEL_0, nofBytes); /* set number of bytes to transfer */ DMA_PDD_SetByteCount(DMA_BASE_PTR, DMA_PDD_CHANNEL_1, nofBytes); /* set number of bytes to transfer */ DMA_PDD_SetByteCount(DMA_BASE_PTR, DMA_PDD_CHANNEL_2, nofBytes); /* set number of bytes to transfer */ /* reset TPM counter */ TPM_PDD_InitializeCounter(TPM0_DEVICE); /* reset timer counter */ TPM_PDD_ClearChannelFlags(TPM0_DEVICE, 0x00); TPM_PDD_ClearOverflowInterruptFlag(TPM0_DEVICE); /* re-enable DMA Muxing: it will disabled at the end of the transfer */ DMAMUX_PDD_EnableChannel(DMAMUX0_BASE_PTR, 0, PDD_ENABLE); DMAMUX_PDD_EnableChannel(DMAMUX0_BASE_PTR, 1, PDD_ENABLE); DMAMUX_PDD_EnableChannel(DMAMUX0_BASE_PTR, 2, PDD_ENABLE); /* enable DMA peripheral requests */ DMA_PDD_EnablePeripheralRequest(DMA_BASE_PTR, DMA_PDD_CHANNEL_2, PDD_ENABLE); /* enable request from peripheral */ DMA_PDD_EnablePeripheralRequest(DMA_BASE_PTR, DMA_PDD_CHANNEL_1, PDD_ENABLE); /* enable request from peripheral */ DMA_PDD_EnablePeripheralRequest(DMA_BASE_PTR, DMA_PDD_CHANNEL_0, PDD_ENABLE); /* enable request from peripheral */ /* clear timer flags and status so it starts from a clean starting point */ TPM_PDD_ClearChannelFlags(TPM0_DEVICE, 0x00); TPM_PDD_ClearOverflowInterruptFlag(TPM0_DEVICE); /* enable TPM DMA */ TPM_PDD_WriteStatusControlReg(TPM0_DEVICE,TPM_PDD_ReadStatusControlReg(TPM0_DEVICE)|TPM_SC_DMA_MASK); TPM_PDD_EnableChannelDma(TPM0_DEVICE, 1); TPM_PDD_EnableChannelDma(TPM0_DEVICE, 0); /* start the TPM timer */ StartTimer(); isTimeout = FALSE; handle = TMOUT1_GetCounter(100/TMOUT1_TICK_PERIOD_MS); for(;;) { /* wait until transfer is complete */ if (TMOUT1_CounterExpired(handle)) { isTimeout = TRUE; break; /* leave loop */ } done0 = DMA_PDD_GetDoneFlag(DMA_BASE_PTR, DMA_PDD_CHANNEL_0); done1 = DMA_PDD_GetDoneFlag(DMA_BASE_PTR, DMA_PDD_CHANNEL_1); done2 = DMA_PDD_GetDoneFlag(DMA_BASE_PTR, DMA_PDD_CHANNEL_2); if (done0 && done1 && done2) { break; /* done! */ } WAIT1_WaitOSms(1); /* give back some time */ } TMOUT1_LeaveCounter(handle); WAIT1_Waitus(50); /* latch, low for at least 50 us (40x1.25us) */ /* disable DMA-Muxing: necessary, otherwise DMA events on TPM0 channel 0 might be still latched. * Will enable muxing for next transfer */ DMAMUX_PDD_EnableChannel(DMAMUX0_BASE_PTR, 0, PDD_DISABLE); DMAMUX_PDD_EnableChannel(DMAMUX0_BASE_PTR, 1, PDD_DISABLE); DMAMUX_PDD_EnableChannel(DMAMUX0_BASE_PTR, 2, PDD_DISABLE); /* disable peripheral DMA */ TPM_PDD_WriteStatusControlReg(TPM0_DEVICE,TPM_PDD_ReadStatusControlReg(TPM0_DEVICE)&(~TPM_SC_DMA_MASK)); TPM_PDD_DisableChannelDma(TPM0_DEVICE, 1); TPM_PDD_DisableChannelDma(TPM0_DEVICE, 0); StopTimer(); /* stop TPM */ if (isTimeout) { return ERR_BUSY; } return ERR_OK; }
int32_t CItemRebulidEvent::SendEnterRoomNotice(EntityType nEntityType) { int32_t ret = S_OK; CItemRebulidCtl &stItemRebulidCtl = GET_ITEMREBULIDCTL_INSTANCE(); int32_t nPlayerCount = 0; RoleID arrRoleID[MaxRebulidCountPer]; stItemRebulidCtl.GetRebulidRoleID(arrRoleID,MaxRebulidCountPer,nPlayerCount,nEntityType); for(int32_t i = 0;i < nPlayerCount;i++) { CPlayer *pPlayer = NULL; PlayerIndex nPlayerIndex = enmInvalidPlayerIndex; ret = g_PlayerMgt.GetPlayer(arrRoleID[i], pPlayer, nPlayerIndex); //没有此玩家 if(ret < 0 || pPlayer == NULL) { WRITE_ERROR_LOG("rebulid itemserver:player does no exist{nRoleID=%d}",arrRoleID[i]); continue; } //进入房间通知 CEnterRoomNotice stEnterRoomNotice; stEnterRoomNotice.nRoleID = pPlayer->GetRoleID(); stEnterRoomNotice.strRoleName = pPlayer->GetRoleName(); stEnterRoomNotice.nAccountID = pPlayer->GetAccountID(); stEnterRoomNotice.nServerID = g_FrameConfigMgt.GetFrameBaseConfig().GetServerID(); stEnterRoomNotice.nPlayerType = pPlayer->GetPlayerType(); stEnterRoomNotice.nIdentityType = pPlayer->GetIdentityType(); if(pPlayer->IsHideEnter()) { stEnterRoomNotice.nEnterRoomType = enmEnterRoomType_Hid; } int32_t nEnterCount = 0; RoomID arrEnterRoomID[MaxEnterRoomCount]; pPlayer->GetEnterRoomInfo(arrEnterRoomID,nEnterCount,MaxEnterRoomCount); for(int32_t j = 0;j < nEnterCount;j++) { CRoom *pRoom = NULL; RoomIndex nRoomIndex = enmInvalidRoomIndex; ret = g_RoomMgt.GetRoom(arrEnterRoomID[j], pRoom, nRoomIndex); if(ret < 0 || pRoom == NULL) { WRITE_ERROR_LOG("get room error!ret=0x%08x{roomid=%d}\n",ret,arrEnterRoomID[j]); continue; } stEnterRoomNotice.nRoomID = arrEnterRoomID[j]; stEnterRoomNotice.nRoleRank = pRoom->GetRoleRank(pPlayer->GetRoleID()); stEnterRoomNotice.nRoomType = pRoom->GetRoomType(); WRITE_NOTICE_LOG("rebulid itemserver:send rebulid enter room notice to item {nRoomID=%d, nRoleID=%d}",arrEnterRoomID[j],pPlayer->GetRoleID()); SendMessageNotifyToServer(MSGID_RSMS_ENTER_ROOM_NOTICE, &stEnterRoomNotice,arrEnterRoomID[j] , enmTransType_Broadcast, pPlayer->GetRoleID(), nEntityType); } } if(nPlayerCount == MaxRebulidCountPer) { WRITE_NOTICE_LOG("rebulid :start other timer to rebulid %d!",nEntityType ); ret = StartTimer(nEntityType); } else { WRITE_NOTICE_LOG("rebulid :rebulid %d ok!",nEntityType); stItemRebulidCtl.SetItemRebulidSuccess(nEntityType); } return ret; }
// timing functions // void StartTimer(int nErr[]); static PyObject* ParODE_StartTimer(PyObject *self, PyObject *args){ int nErr = 0; StartTimer(&nErr); return Py_BuildValue("i", nErr); }
/*----------------------------------------------------------------------------- -----------------------------------------------------------------------------*/ void CBrowserEvents::DocumentComplete(CString & szUrl, DWORD code) { CheckReadyState(); // make sure we are actually measuring something if( active ) { CheckStuff(); EnterCriticalSection(&cs); // if we got an error code, use it if( code ) errorCode = code; // update the end time QueryPerfCounter(lastActivity); end = lastActivity; endDoc = end; lastDoc = lastActivity; GetCPUTime(docCPU, docCPUtotal); // throw away any objects that happen outside of a document load currentDoc = 0; LeaveCriticalSection(&cs); // grab a screen shot of the document complete event if( saveEverything ) { FindBrowserWindow(); screenCapture.Capture(hBrowserWnd, CapturedImage::DOCUMENT_COMPLETE); } // update the waterfall RepaintWaterfall(); } else if(szUrl == _T("about:blank")) { FindBrowserWindow(); ResizeWindow(); // reset the UI on an about:blank navigation if( interactive && !available ) { Reset(); available = true; } // see if we have an url to test testUrl.Empty(); testOptions.Empty(); HKEY hKey; if( RegOpenKeyEx(HKEY_CURRENT_USER, _T("SOFTWARE\\AOL\\ieWatch"), 0, KEY_READ | KEY_WRITE, &hKey) == ERROR_SUCCESS ) { // get the url value out TCHAR buff[4096]; DWORD buffLen = sizeof(buff); if( RegQueryValueEx(hKey, _T("url"), 0, 0, (LPBYTE)buff, &buffLen) == ERROR_SUCCESS ) { // delete the value since we already got it and we get a new value there for every run RegDeleteValue(hKey, _T("url")); // split off any options that were embedded in the url CString tmp = buff; int index = tmp.Find(_T("??pt")); if( index >= 0 ) { testUrl = tmp.Left(index); testOptions = tmp.Mid(index + 2); } else testUrl = buff; // if we have an url to test, launch it if( testUrl.GetLength() ) { if( !testUrl.Left(9).CompareNoCase(_T("script://")) ) { CString script = testUrl.Right(testUrl.GetLength() - 9); LoadScript(script); } StartTimer(2, 100); } } RegCloseKey(hKey); } } else { CString buff; buff.Format(_T("[Pagetest] * Document Complete (not active) - %s\n"), (LPCTSTR)szUrl); OutputDebugString(buff); } }
void AnimationFrame::OnCmd_anim_play(wxCommandEvent& event) { StartTimer(); }
void AnimationFrame::OnSlider_anim_tempo(wxSpinEvent& event) { SetTempo(event.GetPosition()); StartTimer(); }
void debug_parse(char *cmd_line) { int params, result; unsigned int temp1,temp2,temp3,temp4; unsigned short tempword; unsigned char tempbyte; while (*cmd_line == ' ') cmd_line++; switch (toupper(*cmd_line++)) { case '?': DebugPrint("\r\n Compile Date: %s, Time: %s",__DATE__,__TIME__); break; case 'A': // assemble break; case 'B': break; case 'C': // compare break; case 'D': // dump params = sscanf(cmd_line,"%X %X",&temp2,&temp3); switch (params) { case 0: case EOF: dump_end = dump_beg + 127; do_dump(); break; case 1: dump_beg = temp2; dump_end = dump_beg + 127; do_dump(); break; case 2: if (temp3<temp2) temp3=temp2; dump_beg = temp2; dump_end = temp3; do_dump(); break; } break; case 'E': // read unsigned int if (sscanf(cmd_line,"%X",&temp1)==1) debug_port = (unsigned char*)(temp1&0xFFFFFFFC); temp2 = *(unsigned int*)debug_port; DebugPrint("\r\n %08X -> %08X",(int)debug_port,temp2); // debug_port += sizeof(int); break; case 'F': // fill params = sscanf(cmd_line,"%X %X %X",&temp2,&temp3,&temp4); switch (params) { case 3: dump_end = temp3; for (old_dump_beg=temp2;old_dump_beg<=dump_end;old_dump_beg++) { // pokeb(dump_seg,old_dump_beg,temp4); } break; default: { DebugSend(" ?? \r\n"); } break; } break; case 'G': // go DebugInit(); break; case 'H': // hex break; case 'I': // read byte break; case 'J': // read word break; case 'K': break; case 'L': // load break; case 'M': // write unsigned int if (sscanf(cmd_line,"%X %X",&temp1,&temp2)==2) { debug_port = (unsigned char*)(temp1&0xFFFFFFFC); DebugPrint("\r\n %08X <- %08X",(int)debug_port,temp2); *(unsigned int*)debug_port = temp2; debug_port += sizeof(int); } else { DebugSend(" ?? \r\n"); } break; case 'N': // name break; case 'O': // output byte if (sscanf(cmd_line,"%X %X",&temp1,&temp2)==2) { debug_port = (unsigned char*)temp1; tempbyte = temp2; DebugPrint("\r\n %08X <- %02X",(int)debug_port,tempbyte); *debug_port = tempbyte; debug_port += sizeof(tempbyte); } else { DebugSend(" ?? \r\n"); } break; case 'P': // proceed if (sscanf(cmd_line,"%d",&temp1)==1) { gain_Ap = temp1; } DebugPrint("\r\n gain_Ap = %5.1f",gain_Ap); break; case 'Q': // quit if (sscanf(cmd_line,"%d",&temp1)==1) { gain_Ai = temp1; } DebugPrint("\r\n gain_Ai = %5.1f",gain_Ai); break; case 'R': // register if (sscanf(cmd_line,"%d",&temp1)==1) { gain_Ad = temp1; } DebugPrint("\r\n gain_Ad = %5.1f",gain_Ad); break; case 'S': // search if (sscanf(cmd_line,"%X",&temp2)==1) { } break; case 'T': // Test if (sscanf(cmd_line,"%X",&temp1)==1) { switch (temp1){ case 0: #ifdef _MPU6050_H_ result = MPU6050_Setup(); if (result==STATUS_OK) { DebugPrint("\r\n MPU6050 Init Success!"); } else { DebugPrint("\r\n MPU6050 Init Fail. Error = %i", result); } #endif break; case 1: break; case 2: break; case 3: break; case 4: break; case 5: break; case 6: break; case 7: break; case 8: break; case 9: break; } } else { bTest = !bTest; if (bTest) { DebugPrint("\r\n Test ON!"); ResetTimer(DEBUG_TIMER); StartTimer(DEBUG_TIMER,50); } else { DebugPrint("\r\n Test OFF!"); } } break; case 'U': if (sscanf(cmd_line,"%d %d",&temp1,&temp2)==2) { DebugPrint("\r\n L298_set_speed(%d,%d)", temp1, temp2); L298_set_speed(temp1,temp2); } else if (sscanf(cmd_line,"%X",&temp1)==1) { switch (temp1){ case 0: break; case 1: break; case 2: break; case 3: break; case 4: break; case 5: //U5 break; case 6: //U6 break; case 7: //U7 break; case 8: break; case 9: break; } } else { } break; case 'W': // write word if (sscanf(cmd_line,"%X %X",&temp1,&temp2)==2) { debug_port = (unsigned char*)(temp1&0xFFFFFFFE); tempword = temp2; DebugPrint("\r\n %08X <- %04X",(int)debug_port,tempword); *(unsigned short*)debug_port = tempword; debug_port += sizeof(tempword); } else { DebugSend(" ?? \r\n"); } break; case 'X': if (sscanf(cmd_line,"%X",&temp1)==1) { switch (temp1){ case 0: break; case 1: break; case 2: break; case 3: break; case 4: break; case 5: break; case 6: break; case 7: break; case 8: break; case 9: break; } } else { } break; case 'Y': temp4 = sscanf(cmd_line,"%X %X",&temp1,&temp2); if (temp4>=1) { switch (temp1){ case 0: break; case 1: break; case 2: break; case 3: break; case 4: break; case 5: break; case 6: break; case 7: break; case 8: break; case 9: break; } } else { } break; case 'Z': debug_main_Z(cmd_line); break; default: ; } }