| 
															 | 
															 | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															
  | 
															 | 
															 | 
															
  | 
														
														
													
														
															 | 
															 | 
															void ADK::control(const Transfer_t *transfer) | 
															 | 
															 | 
															void ADK::control(const Transfer_t *transfer) | 
														
														
													
														
															 | 
															 | 
															{ | 
															 | 
															 | 
															{ | 
														
														
													
														
															 | 
															 | 
																println("Control callback state=%i",state); | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																println("Control callback state=",state); | 
														
														
													
														
															 | 
															 | 
																 | 
															 | 
															 | 
																 | 
														
														
													
														
															 | 
															 | 
																switch (state) | 
															 | 
															 | 
																switch (state) | 
														
														
													
														
															 | 
															 | 
																{ | 
															 | 
															 | 
																{ | 
														
														
													
												
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
																uint32_t head = rx_head; | 
															 | 
															 | 
																uint32_t head = rx_head; | 
														
														
													
														
															 | 
															 | 
																uint32_t tail = rx_tail; | 
															 | 
															 | 
																uint32_t tail = rx_tail; | 
														
														
													
														
															 | 
															 | 
																 | 
															 | 
															 | 
																 | 
														
														
													
														
															 | 
															 | 
																for (uint32_t i=0; i < ceil(len/4); i++)  | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																for (uint32_t i=0; i < len; i++)  | 
														
														
													
														
															 | 
															 | 
																{ | 
															 | 
															 | 
																{ | 
														
														
													
														
															 | 
															 | 
																	uint32_t msg = rx_buffer[i]; | 
															 | 
															 | 
																	uint32_t msg = rx_buffer[i]; | 
														
														
													
														
															 | 
															 | 
																	if (msg) { | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																	if (msg)  | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																	{ | 
														
														
													
														
															 | 
															 | 
																		if (++head >= RX_QUEUE_SIZE)  | 
															 | 
															 | 
																		if (++head >= RX_QUEUE_SIZE)  | 
														
														
													
														
															 | 
															 | 
																			head = 0; | 
															 | 
															 | 
																			head = 0; | 
														
														
													
														
															 | 
															 | 
																		rx_queue[head] = msg; | 
															 | 
															 | 
																		rx_queue[head] = msg; | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																		 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																		if (++head >= RX_QUEUE_SIZE)  | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																			head = 0; | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																		rx_queue[head] = msg >> 8; | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																		 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																		if (++head >= RX_QUEUE_SIZE)  | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																			head = 0; | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																		rx_queue[head] = msg >> 16; | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																		 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																		if (++head >= RX_QUEUE_SIZE)  | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																			head = 0; | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																		rx_queue[head] = msg >> 24; | 
														
														
													
														
															 | 
															 | 
																	} | 
															 | 
															 | 
																	} | 
														
														
													
														
															 | 
															 | 
																} | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
																rx_head = head; | 
															 | 
															 | 
																rx_head = head; | 
														
														
													
												
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
																 | 
															 | 
															 | 
																 | 
														
														
													
														
															 | 
															 | 
																println("rx_size = ", rx_size); | 
															 | 
															 | 
																println("rx_size = ", rx_size); | 
														
														
													
														
															 | 
															 | 
																println("avail = ", avail); | 
															 | 
															 | 
																println("avail = ", avail); | 
														
														
													
														
															 | 
															 | 
																if (avail >= (uint32_t)(rx_size>>2)) { | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																if (avail >= rx_size)  | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																{ | 
														
														
													
														
															 | 
															 | 
																	// enough space to accept another full packet | 
															 | 
															 | 
																	// enough space to accept another full packet | 
														
														
													
														
															 | 
															 | 
																	println("queue another receive packet"); | 
															 | 
															 | 
																	println("queue another receive packet"); | 
														
														
													
														
															 | 
															 | 
																	queue_Data_Transfer(rxpipe, rx_buffer, rx_size, this); | 
															 | 
															 | 
																	queue_Data_Transfer(rxpipe, rx_buffer, rx_size, this); |