void AppProtocolTasks(CHANNEL_HANDLE h) { if (state == STATE_CLOSED) return; if (state == STATE_CLOSING && ByteQueueSize(&tx_queue) == 0) { log_printf("Finished flushing, closing the channel."); ConnectionCloseChannel(h); state = STATE_CLOSED; return; } UARTTasks(); SPITasks(); I2CTasks(); ICSPTasks(); if (ConnectionCanSend(h)) { BYTE prev = SyncInterruptLevel(1); const BYTE* data; if (bytes_out) { ByteQueuePull(&tx_queue, bytes_out); bytes_out = 0; } ByteQueuePeek(&tx_queue, &data, &bytes_out); if (bytes_out > 0) { if (bytes_out > max_packet) bytes_out = max_packet; ConnectionSend(h, data, bytes_out); } SyncInterruptLevel(prev); } }
void AppProtocolTasks(ADB_CHANNEL_HANDLE h) { UARTTasks(); SPITasks(); I2CTasks(); ICSPTasks(); if (ADBChannelReady(h)) { BYTE prev = SyncInterruptLevel(1); const BYTE* data; int size; if (bytes_transmitted) { ByteQueuePull(&tx_queue, bytes_transmitted); bytes_transmitted = 0; } ByteQueuePeek(&tx_queue, &data, &size); if (size > 0) { ADBWrite(h, data, size); bytes_transmitted = size; } SyncInterruptLevel(prev); } }
void AppProtocolTasks(CHANNEL_HANDLE h) { UARTTasks(); SPITasks(); I2CTasks(); ICSPTasks(); /***********************SNES/NES****************************/ SNESTasks(); /***********************************************************/ if (ConnectionCanSend(h)) { BYTE prev = SyncInterruptLevel(1); const BYTE* data; if (bytes_out) { ByteQueuePull(&tx_queue, bytes_out); bytes_out = 0; } ByteQueuePeek(&tx_queue, &data, &bytes_out); if (bytes_out > 0) { if (bytes_out > max_packet) bytes_out = max_packet; ConnectionSend(h, data, bytes_out); } SyncInterruptLevel(prev); } }