예제 #1
0
/* Send a request, possibly waiting for a reply */
static int
maciisi_send_request(struct adb_request* req, int sync)
{
	int i;
	static int dump_packet = 1;

	if (via == NULL) {
		req->complete = 1;
		return -ENXIO;
	}

	if (dump_packet) {
		printk(KERN_DEBUG "maciisi_send_request:");
		for (i = 0; i < req->nbytes; i++) {
			printk(" %.2x", req->data[i]);
		}
		printk("\n");
	}
	req->reply_expected = 1;
	
	i = maciisi_write(req);
	if (i)
		return i;
	
	if (sync) {
		while (!req->complete) {
			maciisi_poll();
		}
	}
	return 0;
}
static void maciisi_sync(struct adb_request *req)
{
	int count = 0; 

#ifdef DEBUG_MACIISI_ADB
	printk(KERN_DEBUG "maciisi_sync called\n");
#endif

	
	while (!req->complete && count++ < 50) {
		maciisi_poll();
	}
	if (count > 50) 
		printk(KERN_ERR "maciisi_send_request: poll timed out!\n");
}
예제 #3
0
파일: via-maciisi.c 프로젝트: 274914765/C
/* Poll the ADB chip until the request completes */
static void maciisi_sync(struct adb_request *req)
{
    int count = 0; 

#ifdef DEBUG_MACIISI_ADB
    printk(KERN_DEBUG "maciisi_sync called\n");
#endif

    /* If for some reason the ADB chip shuts up on us, we want to avoid an endless loop. */
    while (!req->complete && count++ < 50) {
        maciisi_poll();
    }
    /* This could be BAD... when the ADB controller doesn't respond
     * for this long, it's probably not coming back :-( */
    if(count >= 50) /* Hopefully shouldn't happen */
        printk(KERN_ERR "maciisi_send_request: poll timed out!\n");
}