static void remote_close(atransport *t) { #if !ADB_HOST release_wakelock(); #endif adb_close(t->fd); }
/** * @brief Main program. * @param None * @retval None */ void main(void) { if ( rtl_cryptoEngine_init() != 0 ) { DiagPrintf("crypto engine init failed\r\n"); } /* Initialize log uart and at command service */ console_init(); /* pre-processor of application example */ pre_example_entry(); /* wlan intialization */ #if defined(CONFIG_WIFI_NORMAL) && defined(CONFIG_NETWORK) wlan_network(); #endif // setup uart with capability of wakeup system config_uart(); // setup log uart with capability of wakeup system config_loguart(); // By default tickless is disabled because WAKELOCK_OS is locked. // Release this wakelock to enable tickless release_wakelock(WAKELOCK_OS); // Register pre/post sleep callback. They are called when system automatically enter/leave sleep. register_pre_sleep_callback(pre_sleep_process_callback); register_post_sleep_callback(post_sleep_process_callback); /* Execute application example */ example_entry(); /*Enable Schedule, Start Kernel*/ #if defined(CONFIG_KERNEL) && !TASK_SCHEDULER_DISABLED #ifdef PLATFORM_FREERTOS vTaskStartScheduler(); #endif #else RtlConsolTaskRom(NULL); #endif }
void uart_irq_callback(uint32_t id, SerialIrq event) { serial_t *sobj = (void*)id; if(event == RxIrq) { acquire_wakelock(WAKELOCK_EXAMPLE); rc = serial_getc(sobj); if (rc == '\r' || rc == '\n') { serial_putc(sobj, '\r'); serial_putc(sobj, '\n'); serial_putc(sobj, '#'); serial_putc(sobj, ' '); if (cmdbuf_index != 0) { /* NOTICE: If you don't want loss any data from treating UART signal as GPIO interrupt, * you can set FREERTOS_PMU_TICKLESS_PLL_RESERVED to 1 in "platform_opt.h". * It will reserved PLL clock in tickless and UART can receive the whole data. * But it also cost more power consumption. **/ // process command printf("cmd(%d): %s\r\n", cmdbuf_index, cmdbuf); // release wakelock and reset buf cmdbuf_index = 0; release_wakelock(WAKELOCK_EXAMPLE); } } if (!(rc == '\r' || rc == '\n' )) { // receive command serial_putc(sobj, rc); cmdbuf[cmdbuf_index] = rc; cmdbuf_index++; cmdbuf[cmdbuf_index] = '\0'; } } }