/** Restarts the bridge and tunnel services. */ void RestartServices() { const UUdpMessagingSettings& Settings = *GetDefault<UUdpMessagingSettings>(); if (Settings.EnableTransport) { if (!MessageBridge.IsValid()) { InitializeBridge(); } } else { ShutdownBridge(); } if (Settings.EnableTunnel) { if (!MessageTunnel.IsValid()) { InitializeTunnel(); } } else { ShutdownTunnel(); } }
int main() { int t; effect_tunnel_state ets; u_int16_t *framebuffer1 = (u_int16_t *)0x4c000000; #ifdef TUNNEL_DBL_BUFFER u_int16_t *framebuffer2 = (u_int16_t *)0x4c400000; #endif /* TUNNEL_DBL_BUFFER */ task_register_cons *trc; const char *task_name; portTickType last_wake; const portTickType delay = 1000 * portTICK_RATE_MS / 25; trc = task_get_current_trc(); if (trc == NULL) { printf("tunnel effect: could not find trc.\n"); goto error; } task_name = trc->name; printf("%s: Initializing tunnel effect...\n", task_name); InitializeScreen640x480(RGB16BitMode,framebuffer1); if (init_width == 0xffff || init_height == 0xffff || init_w_offset == 0xffff || init_h_offset == 0xffff) { printf("%s: Config parameters not setup.\n", task_name); goto error; } if (!InitializeTunnel(&ets, init_width, init_height, 640, 480, init_w_offset, init_h_offset)) { printf("%s: Could not initiate tunnel effect.\n", task_name); goto error; } int lasttime=0; printf("%s: Starting rendering tunnel effect...\n", task_name); last_wake = xTaskGetTickCount(); #ifdef TUNNEL_DBL_BUFFER for(t=0;;t+=2) { #else /* TUNNEL_DBL_BUFFER */ for(t=0;;t++) { #endif /* TUNNEL_DBL_BUFFER */ if (tm_requested) { TASK_IN_SAFE_STATE(); last_wake = xTaskGetTickCount(); tm_requested = 0; } if((t % 32)==0) { int time=xTaskGetTickCount(); int fps=10*32*1000/(time-lasttime); printf("%s: %d.%01d FPS\n",task_name,fps/10,fps%10); lasttime=time; } #ifdef TUNNEL_DBL_BUFFER taskYIELD(); SetScreenFrameBuffer(framebuffer1); DrawTunnel(&ets, framebuffer2); vTaskDelayUntil(&last_wake, delay); SetScreenFrameBuffer(framebuffer2); DrawTunnel(&ets, framebuffer1); #else /* TUNNEL_DBL_BUFFER */ DrawTunnel(&ets, framebuffer1); #endif /* TUNNEL_DBL_BUFFER */ if (last_wake + delay < xTaskGetTickCount()) { last_wake += delay / 2; } vTaskDelayUntil(&last_wake, delay); } error: while (1) { printf("Tunnel effect in error state.\n"); vTaskSuspend(NULL); } }