SyncHS();
corgi_ts->machinfo->wait_hsync();
static int sync_receive_data_send_cmd(int doRecive, int doSend, unsigned int address, unsigned long wait_time){	unsigned long timer1 = 0, timer2, pmnc = 0;	int pos = 0;	if (wait_time && doSend) {		PMNC_GET(pmnc);		if (!(pmnc & 0x01))			PMNC_SET(0x01);		/* polling HSync */		SyncHS();		/* get CCNT */		CCNT(timer1);	}	if (doRecive)		pos = corgi_ssp_ads7846_get();	if (doSend) {		int cmd = ADSCTRL_PD0 | ADSCTRL_PD1 | (address << ADSCTRL_ADR_SH) | ADSCTRL_STS;		/* dummy command */		corgi_ssp_ads7846_put(cmd);		corgi_ssp_ads7846_get();		if (wait_time) {			/* Wait after HSync */			CCNT(timer2);			if (timer2-timer1 > wait_time) {				/* too slow - timeout, try again */				SyncHS();				/* get OSCR */				CCNT(timer1);				/* Wait after HSync */				CCNT(timer2);			}			while (timer2 - timer1 < wait_time)				CCNT(timer2);		}		corgi_ssp_ads7846_put(cmd);		if (wait_time && !(pmnc & 0x01))			PMNC_SET(pmnc);	}	return pos;}