static int dxv_decompress_dxt1(AVCodecContext *avctx) { DXVContext *ctx = avctx->priv_data; GetByteContext *gbc = &ctx->gbc; uint32_t value, prev, op; int idx = 0, state = 0; int pos = 2; /* Copy the first two elements */ AV_WL32(ctx->tex_data, bytestream2_get_le32(gbc)); AV_WL32(ctx->tex_data + 4, bytestream2_get_le32(gbc)); /* Process input until the whole texture has been filled */ while (pos < ctx->tex_size / 4) { CHECKPOINT(2); /* Copy two elements from a previous offset or from the input buffer */ if (op) { prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; } else { CHECKPOINT(2); if (op) prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); else prev = bytestream2_get_le32(gbc); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; CHECKPOINT(2); if (op) prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); else prev = bytestream2_get_le32(gbc); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; } } return 0; }
void net_msg_cmd_do(void) { CHECKPOINT(0x44) delay100(2); // commands 40-49 are special AT commands, thus, disable net_msg here if ((net_msg_cmd_code < 40) || (net_msg_cmd_code > 49)) net_msg_start(); // Execute cmd: ask car module to execute first: if ((vehicle_fn_commandhandler == NULL)|| (! vehicle_fn_commandhandler(TRUE, net_msg_cmd_code,net_msg_cmd_msg))) { // Car module does not feel responsible, fall back to standard: if( !net_msg_cmd_exec() ) { // No standard as well => return "unimplemented" STP_UNIMPLEMENTED(net_scratchpad, net_msg_cmd_code); net_msg_encode_puts(); } } // terminate IPSEND by Ctrl-Z (should this be disabled for commands 40-49 as well?) net_msg_send(); #ifdef OVMS_ACCMODULE acc_handle_msg(TRUE, net_msg_cmd_code, net_msg_cmd_msg); #endif // clear command net_msg_cmd_code = 0; net_msg_cmd_msg[0] = 0; }
void LEDs_Init(){ CHECKPOINT(); LED_Init(P1); LED_Init(P2); LED_Init(P3); LED_Init(P4); }
static bool KILL(HANDLE handle) { CHECK_ENTER("KILL") BOOL bRet=TerminateProcess(handle,0); CHECKPOINT() CloseHandle(handle); fprintf(stdout,"brutally terminated by TerminateProcess\n"); fflush(stdout); CHECK_EXIT() return bRet?true:false; }
void net_msg_forward_sms(char *caller, char *SMS) { //Server not ready, stop sending //TODO: store this message inside buffer, resend it when server is connected if ((net_msg_serverok == 0)||(net_msg_sendpending)>0) return; CHECKPOINT(0x45) delay100(2); net_msg_start(); strcpypgm2ram(net_scratchpad,(char const rom far*)"MP-0 PA"); strcatpgm2ram(net_scratchpad,(char const rom far*)"SMS FROM: "); strcat(net_scratchpad, caller); strcatpgm2ram(net_scratchpad,(char const rom far*)" - MSG: "); SMS[170]=0; // Hacky limit on the max size of an SMS forwarded strcat(net_scratchpad, SMS); net_msg_encode_puts(); net_msg_send(); }
static DWORD WINAPI ZombieHunter(LPVOID lpParameter) #endif { CHECK_ENTER("ZombieHunter") DWORD nCount; while (true) { if (aHandlesVector) { delete [] aHandlesVector; aHandlesVector=NULL; } nCount=0; aHandlesVector=new HANDLE[yarp::os::Run::mProcessVector.Size()+yarp::os::Run::mStdioVector.Size()]; yarp::os::Run::mProcessVector.GetHandles(aHandlesVector,nCount); yarp::os::Run::mStdioVector.GetHandles(aHandlesVector,nCount); if (nCount) { CHECKPOINT() WaitForMultipleObjects(nCount,aHandlesVector,FALSE,INFINITE); CHECKPOINT() } else { hZombieHunter=NULL; CHECK_EXIT() return 0; } }
static pixmap_t * rpi_pixmap_decode(pixmap_t *pm, const image_meta_t *im, char *errbuf, size_t errlen) { if(pm->pm_type != PIXMAP_JPEG) return NULL; #ifdef TIMING int64_t ts = showtime_get_ts(), ts2; #endif rpi_pixmap_decoder_t *rpd = pixmap_decoder_create(OMX_IMAGE_CodingJPEG); if(rpd == NULL) return NULL; rpd->rpd_im = im; #ifdef NOCOPY #error check rpd->rpd_decoder->oc_stream_corrupt OMX_PARAM_PORTDEFINITIONTYPE portdef; memset(&portdef, 0, sizeof(portdef)); portdef.nSize = sizeof(OMX_PARAM_PORTDEFINITIONTYPE); portdef.nVersion.nVersion = OMX_VERSION; portdef.nPortIndex = rpd->rpd_decoder->oc_inport; omxchk(OMX_GetParameter(rpd->rpd_decoder->oc_handle, OMX_IndexParamPortDefinition, &portdef)); omx_send_command(rpd->rpd_decoder, OMX_CommandPortEnable, rpd->rpd_decoder->oc_inport, NULL, 0); OMX_BUFFERHEADERTYPE *buf; for(int i = 0; i < portdef.nBufferCountActual; i++) { omxchk(OMX_UseBuffer(rpd->rpd_decoder->oc_handle, &buf, rpd->rpd_decoder->oc_inport, NULL, pm->pm_size, pm->pm_data)); } // Waits for the OMX_CommandPortEnable command omx_wait_command(rpd->rpd_decoder); omx_set_state(rpd->rpd_decoder, OMX_StateExecuting); CHECKPOINT("Initialized"); buf->nOffset = 0; buf->nFilledLen = pm->pm_size; buf->nFlags |= OMX_BUFFERFLAG_EOS; rpd->rpd_decoder->oc_inflight_buffers++; omxchk(OMX_EmptyThisBuffer(rpd->rpd_decoder->oc_handle, buf)); hts_mutex_lock(&rpd->rpd_mtx); while(rpd->rpd_change == 0) hts_cond_wait(&rpd->rpd_cond, &rpd->rpd_mtx); hts_mutex_unlock(&rpd->rpd_mtx); CHECKPOINT("Setup tunnel"); setup_tunnel(rpd); #else const void *data = pm->pm_data; size_t len = pm->pm_size; hts_mutex_lock(&rpd->rpd_mtx); while(len > 0) { OMX_BUFFERHEADERTYPE *buf; if(rpd->rpd_decoder->oc_stream_corrupt) break; if(rpd->rpd_change == 1) { rpd->rpd_change = 2; hts_mutex_unlock(&rpd->rpd_mtx); setup_tunnel(rpd); hts_mutex_lock(&rpd->rpd_mtx); continue; } if(rpd->rpd_decoder->oc_avail == NULL) { hts_cond_wait(&rpd->rpd_cond, &rpd->rpd_mtx); continue; } buf = rpd->rpd_decoder->oc_avail; rpd->rpd_decoder->oc_avail = buf->pAppPrivate; rpd->rpd_decoder->oc_inflight_buffers++; hts_mutex_unlock(&rpd->rpd_mtx); buf->nOffset = 0; buf->nFilledLen = MIN(len, buf->nAllocLen); memcpy(buf->pBuffer, data, buf->nFilledLen); buf->nFlags = 0; if(len <= buf->nAllocLen) buf->nFlags |= OMX_BUFFERFLAG_EOS; data += buf->nFilledLen; len -= buf->nFilledLen; omxchk(OMX_EmptyThisBuffer(rpd->rpd_decoder->oc_handle, buf)); hts_mutex_lock(&rpd->rpd_mtx); } if(rpd->rpd_decoder->oc_stream_corrupt) { hts_mutex_unlock(&rpd->rpd_mtx); goto err; } if(rpd->rpd_change != 2) { while(rpd->rpd_change == 0 && !rpd->rpd_decoder->oc_stream_corrupt) hts_cond_wait(&rpd->rpd_cond, &rpd->rpd_mtx); hts_mutex_unlock(&rpd->rpd_mtx); if(rpd->rpd_decoder->oc_stream_corrupt) goto err; setup_tunnel(rpd); } else { hts_mutex_unlock(&rpd->rpd_mtx); } #endif omx_wait_fill_buffer(rpd->rpd_resizer, rpd->rpd_buf); CHECKPOINT("Got buffer"); err: omx_flush_port(rpd->rpd_decoder, rpd->rpd_decoder->oc_inport); omx_flush_port(rpd->rpd_decoder, rpd->rpd_decoder->oc_outport); omx_flush_port(rpd->rpd_resizer, rpd->rpd_resizer->oc_inport); omx_flush_port(rpd->rpd_resizer, rpd->rpd_resizer->oc_outport); if(rpd->rpd_tunnel != NULL) { omx_tunnel_destroy(rpd->rpd_tunnel); rpd->rpd_tunnel = NULL; } omx_set_state(rpd->rpd_decoder, OMX_StateIdle); omx_set_state(rpd->rpd_resizer, OMX_StateIdle); if(rpd->rpd_buf != NULL) { omxchk(OMX_FreeBuffer(rpd->rpd_resizer->oc_handle, rpd->rpd_resizer->oc_outport, rpd->rpd_buf)); } omx_release_buffers(rpd->rpd_decoder, rpd->rpd_decoder->oc_inport); omx_set_state(rpd->rpd_resizer, OMX_StateLoaded); omx_set_state(rpd->rpd_decoder, OMX_StateLoaded); omx_component_destroy(rpd->rpd_resizer); omx_component_destroy(rpd->rpd_decoder); hts_cond_destroy(&rpd->rpd_cond); hts_mutex_destroy(&rpd->rpd_mtx); pixmap_t *out = rpd->rpd_pm; if(out) { pixmap_release(pm); } else { snprintf(errbuf, errlen, "Load error"); } free(rpd); CHECKPOINT("All done"); return out; }
void LED_Off(u8 index){ CHECKPOINT(); _GPIO_Put(LEDs[index],!LED_LEVEL_EN); }
void main(void) { unsigned char x, y; // DEBUG / QA stats: get last reset reason: x = (~RCON) & 0x1f; if (STKPTRbits.STKFUL) x += 32; if (STKPTRbits.STKUNF) x += 64; // ...clear RCON: RCONbits.NOT_BOR = 1; // b0 = 1 = Brown Out Reset RCONbits.NOT_POR = 1; // b1 = 2 = Power On Reset //RCONbits.NOT_PD = 1; // b2 = 4 = Power Down detection //RCONbits.NOT_TO = 1; // b3 = 8 = watchdog TimeOut occured RCONbits.NOT_RI = 1; // b4 = 16 = Reset Instruction if (x == 3) // 3 = normal Power On { debug_crashreason = 0; debug_crashcnt = 0; #ifdef OVMS_LOGGINGMODULE logging_initialise(); #endif } else { debug_crashreason = x | 0x80; // 0x80 = keep checkpoint until sent to server debug_crashcnt++; } CHECKPOINT(0x20) for (x = 0; x < FEATURES_MAP_PARAM; x++) sys_features[x] = 0; // Turn off the features // The top N features are persistent for (x = FEATURES_MAP_PARAM; x < FEATURES_MAX; x++) { sys_features[x] = atoi(par_get(PARAM_FEATURE_S + (x - FEATURES_MAP_PARAM))); } // Make sure cooldown is off car_coolingdown = -1; // Port configuration inputs_initialise(); TRISB = 0xFE; // Timer 0 enabled, Fosc/4, 16 bit mode, prescaler 1:256 // This gives us one tick every 51.2uS before prescale (13.1ms after) T0CON = 0b10000111; // @ 5Mhz => 51.2uS // Initialisation... led_initialise(); par_initialise(); vehicle_initialise(); net_initialise(); CHECKPOINT(0x21) // Startup sequence... // Holding the RED led on, pulse out the firmware version on the GREEN led delay100(10); // Delay 1 second led_set(OVMS_LED_RED, OVMS_LED_ON); led_set(OVMS_LED_GRN, OVMS_LED_OFF); led_start(); delay100(10); // Delay 1.0 seconds led_set(OVMS_LED_GRN, ovms_firmware[0]); led_start(); delay100(35); // Delay 3.5 seconds ClrWdt(); // Clear Watchdog Timer led_set(OVMS_LED_GRN, ovms_firmware[1]); led_start(); delay100(35); // Delay 3.5 seconds ClrWdt(); // Clear Watchdog Timer led_set(OVMS_LED_GRN, ovms_firmware[2]); led_start(); delay100(35); // Delay 3.5 seconds ClrWdt(); // Clear Watchdog Timer led_set(OVMS_LED_GRN, OVMS_LED_OFF); led_set(OVMS_LED_RED, OVMS_LED_OFF); led_start(); delay100(10); // Delay 1 second ClrWdt(); // Clear Watchdog Timer // Setup ready for the main loop led_set(OVMS_LED_GRN, OVMS_LED_OFF); led_start(); #ifdef OVMS_HW_V2 car_12vline = inputs_voltage()*10; car_12vline_ref = 0; #endif #ifdef OVMS_ACCMODULE acc_initialise(); #endif // Proceed to main loop y = 0; // Last TMR0H while (1) // Main Loop { CHECKPOINT(0x22) if ((vUARTIntStatus.UARTIntRxError) || (vUARTIntStatus.UARTIntRxOverFlow)) net_reset_async(); while (!vUARTIntStatus.UARTIntRxBufferEmpty) { CHECKPOINT(0x23) net_poll(); } CHECKPOINT(0x24) vehicle_idlepoll(); ClrWdt(); // Clear Watchdog Timer x = TMR0L; if (TMR0H >= 0x4c) // Timout ~1sec (actually 996ms) { TMR0H = 0; TMR0L = 0; // Reset timer CHECKPOINT(0x25) net_ticker(); CHECKPOINT(0x26) vehicle_ticker(); #ifdef OVMS_LOGGINGMODULE CHECKPOINT(0x27) logging_ticker(); #endif #ifdef OVMS_ACCMODULE CHECKPOINT(0x28) acc_ticker(); #endif } else if (TMR0H != y) { if ((TMR0H % 0x04) == 0) { CHECKPOINT(0x29) net_ticker10th(); CHECKPOINT(0x2A) vehicle_ticker10th(); CHECKPOINT(0x2B) } y = TMR0H; } }
void kvz_pixels_blit_avx2(const kvz_pixel * const orig, kvz_pixel * const dst, const unsigned width, const unsigned height, const unsigned orig_stride, const unsigned dst_stride) { unsigned y; //There is absolutely no reason to have a width greater than the source or the destination stride. assert(width <= orig_stride); assert(width <= dst_stride); #ifdef CHECKPOINTS char *buffer = malloc((3 * width + 1) * sizeof(char)); for (y = 0; y < height; ++y) { int p; for (p = 0; p < width; ++p) { sprintf((buffer + 3*p), "%02X ", orig[y*orig_stride]); } buffer[3*width] = 0; CHECKPOINT("kvz_pixels_blit_avx2: %04d: %s", y, buffer); } FREE_POINTER(buffer); #endif //CHECKPOINTS if (width == orig_stride && width == dst_stride) { memcpy(dst, orig, width * height * sizeof(kvz_pixel)); return; } int nxn_width = (width == height) ? width : 0; switch (nxn_width) { case 4: *(int32_t*)&dst[dst_stride*0] = *(int32_t*)&orig[orig_stride*0]; *(int32_t*)&dst[dst_stride*1] = *(int32_t*)&orig[orig_stride*1]; *(int32_t*)&dst[dst_stride*2] = *(int32_t*)&orig[orig_stride*2]; *(int32_t*)&dst[dst_stride*3] = *(int32_t*)&orig[orig_stride*3]; break; case 8: *(int64_t*)&dst[dst_stride*0] = *(int64_t*)&orig[orig_stride*0]; *(int64_t*)&dst[dst_stride*1] = *(int64_t*)&orig[orig_stride*1]; *(int64_t*)&dst[dst_stride*2] = *(int64_t*)&orig[orig_stride*2]; *(int64_t*)&dst[dst_stride*3] = *(int64_t*)&orig[orig_stride*3]; *(int64_t*)&dst[dst_stride*4] = *(int64_t*)&orig[orig_stride*4]; *(int64_t*)&dst[dst_stride*5] = *(int64_t*)&orig[orig_stride*5]; *(int64_t*)&dst[dst_stride*6] = *(int64_t*)&orig[orig_stride*6]; *(int64_t*)&dst[dst_stride*7] = *(int64_t*)&orig[orig_stride*7]; break; case 16: for (int i = 0; i < 16; ++i) { __m128i temp = _mm_loadu_si128((__m128i*)(orig + i * orig_stride)); _mm_storeu_si128((__m128i*)(dst + i * dst_stride), temp); } break; case 32: for (int i = 0; i < 32; ++i) { __m256i temp = _mm256_loadu_si256((__m256i*)(orig + i * orig_stride)); _mm256_storeu_si256((__m256i*)(dst + i * dst_stride), temp); } break; case 64: for (int i = 0; i < 64; ++i) { __m256i temp0 = _mm256_loadu_si256((__m256i*)(orig + i * orig_stride)); _mm256_storeu_si256((__m256i*)(dst + i * dst_stride), temp0); __m256i temp1 = _mm256_loadu_si256((__m256i*)(orig + i * orig_stride + sizeof(__m256))); _mm256_storeu_si256((__m256i*)(dst + i * dst_stride + sizeof(__m256)), temp1); } break; default: if (orig == dst) { //If we have the same array, then we should have the same stride assert(orig_stride == dst_stride); return; } assert(orig != dst || orig_stride == dst_stride); for (y = 0; y < height; ++y) { memcpy(&dst[y*dst_stride], &orig[y*orig_stride], width * sizeof(kvz_pixel)); } break; } }
// do Test step 1.1 enum TVerdict CEtelPacketTest1_3::doTestStepL( void ) { RPhone phone; TInt ret=phone.Open(iTelServer,DPCKTTSY_PHONE_NAME); CHECKPOINT(ret,KErrNone,CHP_OPEN_PHONE); RPacketService gprs; ret=gprs.Open(phone); CHECKPOINT(ret,KErrNone,CHP_SRVS_CASE("A.1")); RPacketContext gprsContext; TName contextName; ret=gprsContext.OpenNewContext(gprs, contextName); CHECKPOINT(ret,KErrNone,CHP_CNTXT_CASE("B.1")); RPacketQoS gprsQoS; TName qosName; ret = gprsQoS.OpenNewQoS(gprsContext, qosName); CHECKPOINT(ret,KErrNone,CHP_QOS_CASE("C.1")); CHECKPOINT(qosName.Compare(DPCKTTSY_QOS_NAME),KErrNone,CHP_QOS_CASE("C.1")); // local variables used throughout the gprs tests TRequestStatus reqStatus; TRequestStatus notifyStatus; // post a notification RPacketQoS::TQoSGPRSNegotiated aNotifyQoS; TPckg<RPacketQoS::TQoSGPRSNegotiated> aNotifyQoSPckg(aNotifyQoS); gprsQoS.NotifyProfileChanged(notifyStatus, aNotifyQoSPckg); User::WaitForRequest(notifyStatus); CHECKPOINT(notifyStatus.Int(),KErrNone,CHP_QOS_CASE("C.7")); CHECKPOINT(aNotifyQoS.iDelay , DPCKTTSY_DELAY_MIN1,CHP_QOS_CASE("C.7")); CHECKPOINT(aNotifyQoS.iMeanThroughput , DPCKTTSY_MEAN_THROUGHPUT_MIN1,CHP_QOS_CASE("C.7")); CHECKPOINT(aNotifyQoS.iPeakThroughput , DPCKTTSY_PEAK_THROUGHPUT_MIN1,CHP_QOS_CASE("C.7")); CHECKPOINT(aNotifyQoS.iPrecedence , DPCKTTSY_PRECEDENCE_MIN1,CHP_QOS_CASE("C.7")); CHECKPOINT(aNotifyQoS.iReliability , DPCKTTSY_RELIABILITY_MIN1,CHP_QOS_CASE("C.7")); //fix for defect MPO-576M6R: added cancel case gprsQoS.NotifyProfileChanged(notifyStatus, aNotifyQoSPckg); gprsQoS.CancelAsyncRequest(EPacketQoSNotifyProfileChanged); User::WaitForRequest(notifyStatus); CHECKPOINT(notifyStatus.Int(),KErrCancel,CHP_QOS_CASE("C.3")); // Get QoS GPRS Capabilities RPacketQoS::TQoSCapsGPRS aQoSCaps; TPckg<RPacketQoS::TQoSCapsGPRS> aQoSCapsPckg(aQoSCaps); gprsQoS.GetProfileCapabilities(reqStatus, aQoSCapsPckg); User::WaitForRequest(reqStatus); CHECKPOINT(reqStatus.Int(),KErrNone,CHP_QOS_CASE("C.6")); CHECKPOINT(aQoSCaps.ExtensionId(),TPacketDataConfigBase::KConfigGPRS,CHP_QOS_CASE("C.6")); CHECKPOINT(aQoSCaps.iDelay,DPCKTTSY_DELAY,CHP_QOS_CASE("C.6")); CHECKPOINT(aQoSCaps.iMean,DPCKTTSY_MEAN_THROUGHPUT,CHP_QOS_CASE("C.6")); CHECKPOINT(aQoSCaps.iPeak,DPCKTTSY_PEAK_THROUGHPUT,CHP_QOS_CASE("C.6")); CHECKPOINT(aQoSCaps.iPrecedence,DPCKTTSY_PRECEDENCE,CHP_QOS_CASE("C.6")); CHECKPOINT(aQoSCaps.iReliability,DPCKTTSY_RELIABILITY,CHP_QOS_CASE("C.6")); //fix for defect MPO-576M6R: added cancel case gprsQoS.GetProfileCapabilities(reqStatus, aQoSCapsPckg); gprsQoS.CancelAsyncRequest(EPacketQoSGetProfileCaps); User::WaitForRequest(notifyStatus); CHECKPOINT(notifyStatus.Int(),KErrCancel,CHP_QOS_CASE("C.3")); // Set QoS Profile Params RPacketQoS::TQoSGPRSRequested aQoSReqConfig; TPckg<RPacketQoS::TQoSGPRSRequested> aQoSReqPckg(aQoSReqConfig); aQoSReqConfig.iMinDelay = DPCKTTSY_DELAY_MIN1; aQoSReqConfig.iMinMeanThroughput = DPCKTTSY_MEAN_THROUGHPUT_MIN1; aQoSReqConfig.iMinPeakThroughput = DPCKTTSY_PEAK_THROUGHPUT_MIN1; aQoSReqConfig.iMinPrecedence = DPCKTTSY_PRECEDENCE_MIN1; aQoSReqConfig.iMinReliability = DPCKTTSY_RELIABILITY_MIN1; aQoSReqConfig.iReqDelay = DPCKTTSY_DELAY_REQ1; aQoSReqConfig.iReqMeanThroughput = DPCKTTSY_MEAN_THROUGHPUT_REQ1; aQoSReqConfig.iReqPeakThroughput = DPCKTTSY_PEAK_THROUGHPUT_REQ1; aQoSReqConfig.iReqPrecedence = DPCKTTSY_PRECEDENCE_REQ1; aQoSReqConfig.iReqReliability = DPCKTTSY_RELIABILITY_REQ1; gprsQoS.SetProfileParameters(reqStatus, aQoSReqPckg); User::WaitForRequest(reqStatus); CHECKPOINT(reqStatus.Int(),KErrNone,CHP_QOS_CASE("C.4")); //fix for defect MPO-576M6R: added cancel case gprsQoS.SetProfileParameters(reqStatus, aQoSReqPckg); gprsQoS.CancelAsyncRequest(EPacketQoSSetProfileParams); User::WaitForRequest(notifyStatus); CHECKPOINT(notifyStatus.Int(),KErrCancel,CHP_QOS_CASE("C.3")); // Get QoS Profile Params RPacketQoS::TQoSGPRSNegotiated aQoSNegConfig; TPckg<RPacketQoS::TQoSGPRSNegotiated> aQoSNegPckg(aQoSNegConfig); gprsQoS.GetProfileParameters(reqStatus, aQoSNegPckg); User::WaitForRequest(reqStatus); CHECKPOINT(reqStatus.Int(),KErrNone,CHP_QOS_CASE("C.5")); CHECKPOINT(aQoSNegConfig.ExtensionId(),TPacketDataConfigBase::KConfigGPRS,CHP_QOS_CASE("C.5")); CHECKPOINT(aQoSNegConfig.iDelay,DPCKTTSY_DELAY_NEG2,CHP_QOS_CASE("C.5")); CHECKPOINT(aQoSNegConfig.iMeanThroughput,DPCKTTSY_MEAN_THROUGHPUT_NEG2,CHP_QOS_CASE("C.5")); CHECKPOINT(aQoSNegConfig.iPeakThroughput,DPCKTTSY_PEAK_THROUGHPUT_NEG2,CHP_QOS_CASE("C.5")); CHECKPOINT(aQoSNegConfig.iPrecedence,DPCKTTSY_PRECEDENCE_NEG2,CHP_QOS_CASE("C.5")); CHECKPOINT(aQoSNegConfig.iReliability,DPCKTTSY_RELIABILITY_NEG2,CHP_QOS_CASE("C.5")); //fix for defect MPO-576M6R: added cancel case gprsQoS.GetProfileParameters(reqStatus, aQoSNegPckg); gprsQoS.CancelAsyncRequest(EPacketQoSGetProfileParams); User::WaitForRequest(notifyStatus); CHECKPOINT(notifyStatus.Int(),KErrCancel,CHP_QOS_CASE("C.3")); //Fix for defect MPO-576M6R: Added call to RPacket::OpenExistingQos() RPacketQoS gprsQoS2; ret = gprsQoS2.OpenExistingQoS(gprsContext, qosName); CHECKPOINT(ret,KErrNone,CHP_QOS_CASE("C.2")); gprsQoS.Close(); gprsQoS2.Close(); gprsContext.Close(); gprs.Close(); phone.Close(); return TestStepResult(); }
// Receive a NET msg from the OVMS server void net_msg_in(char* msg) { int k; char s; if (net_msg_serverok == 0) { if (memcmppgm2ram(msg, (char const rom far*)"MP-S 0 ", 7) == 0) { net_msg_server_welcome(msg+7); net_granular_tick = 3590; // Nasty hack to force a status transmission in 10 seconds } return; // otherwise ignore it } // Ok, we've got an encrypted message waiting for work. // The following is a nasty hack because base64decode doesn't like incoming // messages of length divisible by 4, and is really expecting a CRLF // terminated string, so we give it one... CHECKPOINT(0x40) if (((strlen(msg)*4)/3) >= (NET_BUF_MAX-3)) { // Quick exit to reset link if incoming message is too big net_state_enter(NET_STATE_DONETINIT); return; } strcatpgm2ram(msg,(char const rom far*)"\r\n"); k = base64decode(msg,net_scratchpad); CHECKPOINT(0x41) RC4_crypt(&rx_crypto1, &rx_crypto2, net_scratchpad, k); if (memcmppgm2ram(net_scratchpad, (char const rom far*)"MP-0 ", 5) != 0) { net_state_enter(NET_STATE_DONETINIT); return; } msg = net_scratchpad+5; if ((*msg == 'E')&&(msg[1]=='M')) { // A paranoid-mode message from the server (or, more specifically, app) // The following is a nasty hack because base64decode doesn't like incoming // messages of length divisible by 4, and is really expecting a CRLF // terminated string, so we give it one... msg += 2; // Now pointing to the code just before encrypted paranoid message strcatpgm2ram(msg,(char const rom far*)"\r\n"); k = base64decode(msg+1,net_msg_scratchpad+1); RC4_setup(&pm_crypto1, &pm_crypto2, pdigest, MD5_SIZE); for (k=0;k<1024;k++) { net_scratchpad[0] = 0; RC4_crypt(&pm_crypto1, &pm_crypto2, net_scratchpad, 1); } RC4_crypt(&pm_crypto1, &pm_crypto2, net_msg_scratchpad+1, k); net_msg_scratchpad[0] = *msg; // The code // The message is now out of paranoid mode... msg = net_msg_scratchpad; } CHECKPOINT(0x42) switch (*msg) { case 'A': // PING strcpypgm2ram(net_scratchpad,(char const rom far*)"MP-0 a"); if (net_msg_sendpending==0) { net_msg_start(); net_msg_encode_puts(); net_msg_send(); } break; case 'Z': // PEER connection if (msg[1] != '0') { net_apps_connected = 1; if (net_msg_sendpending==0) { net_msg_start(); net_msgp_stat(0); net_msgp_gps(0); net_msgp_tpms(0); net_msgp_firmware(0); net_msgp_environment(0); net_msg_send(); } } else { net_apps_connected = 0; } break; case 'h': // Historical data acknowledgement #ifdef OVMS_LOGGINGMODULE logging_ack(atoi(msg+1)); #endif // #ifdef OVMS_LOGGINGMODULE break; case 'C': // COMMAND net_msg_cmd_in(msg+1); if (net_msg_sendpending==0) net_msg_cmd_do(); break; } }
static int dxv_decompress_dxt5(AVCodecContext *avctx) { DXVContext *ctx = avctx->priv_data; GetByteContext *gbc = &ctx->gbc; uint32_t value, op; int idx, prev, state = 0; int pos = 4; int run = 0; int probe, check; /* Copy the first four elements */ AV_WL32(ctx->tex_data + 0, bytestream2_get_le32(gbc)); AV_WL32(ctx->tex_data + 4, bytestream2_get_le32(gbc)); AV_WL32(ctx->tex_data + 8, bytestream2_get_le32(gbc)); AV_WL32(ctx->tex_data + 12, bytestream2_get_le32(gbc)); /* Process input until the whole texture has been filled */ while (pos < ctx->tex_size / 4) { if (run) { run--; prev = AV_RL32(ctx->tex_data + 4 * (pos - 4)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; prev = AV_RL32(ctx->tex_data + 4 * (pos - 4)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; } else { if (state == 0) { value = bytestream2_get_le32(gbc); state = 16; } op = value & 0x3; value >>= 2; state--; switch (op) { case 0: /* Long copy */ check = bytestream2_get_byte(gbc) + 1; if (check == 256) { do { probe = bytestream2_get_le16(gbc); check += probe; } while (probe == 0xFFFF); } while (check && pos < ctx->tex_size / 4) { prev = AV_RL32(ctx->tex_data + 4 * (pos - 4)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; prev = AV_RL32(ctx->tex_data + 4 * (pos - 4)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; prev = AV_RL32(ctx->tex_data + 4 * (pos - 4)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; prev = AV_RL32(ctx->tex_data + 4 * (pos - 4)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; check--; } /* Restart (or exit) the loop */ continue; break; case 1: /* Load new run value */ run = bytestream2_get_byte(gbc); if (run == 255) { do { probe = bytestream2_get_le16(gbc); run += probe; } while (probe == 0xFFFF); } /* Copy two dwords from previous data */ prev = AV_RL32(ctx->tex_data + 4 * (pos - 4)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; prev = AV_RL32(ctx->tex_data + 4 * (pos - 4)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; break; case 2: /* Copy two dwords from a previous index */ idx = 8 + bytestream2_get_le16(gbc); prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; break; case 3: /* Copy two dwords from input */ prev = bytestream2_get_le32(gbc); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; prev = bytestream2_get_le32(gbc); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; break; } } CHECKPOINT(4); /* Copy two elements from a previous offset or from the input buffer */ if (op) { prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; } else { CHECKPOINT(4); if (op) prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); else prev = bytestream2_get_le32(gbc); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; CHECKPOINT(4); if (op) prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); else prev = bytestream2_get_le32(gbc); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; } } return 0; }