while(j->tone_state) { set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(1); } while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0) { set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(1); } 
while(j->tone_state) schedule_timeout_interruptible(1); while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0) schedule_timeout_interruptible(1); 
static void ixj_write_cidcw(IXJ *j){	IXJ_TONE ti;	char sdmf1[50];	char sdmf2[50];	char sdmf3[80];	char mdmflen, len1, len2, len3;	int pad;	int checksum = 0;	if (j->dsp.low == 0x20 || j->flags.cidplay)		return;	j->fskz = j->fskphase = j->fskcnt = j->fskdcnt = 0;	j->cidsize = j->cidcnt = 0;	ixj_fsk_alloc(j);	j->flags.cidcw_ack = 0;	ti.tone_index = 23;	ti.gain0 = 1;	ti.freq0 = hz440;	ti.gain1 = 0;	ti.freq1 = 0;	ixj_init_tone(j, &ti);	ixj_set_tone_on(1500, j);	ixj_set_tone_off(32, j);	if(ixjdebug & 0x0200) {		printk("IXJ cidcw phone%d first tone start at %ld\n", j->board, jiffies);	}	ixj_play_tone(j, 23);	clear_bit(j->board, &j->busyflags);	while(j->tone_state) {		set_current_state(TASK_INTERRUPTIBLE);		schedule_timeout(1);	}	while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0) {		set_current_state(TASK_INTERRUPTIBLE);		schedule_timeout(1);	}	if(ixjdebug & 0x0200) {		printk("IXJ cidcw phone%d first tone end at %ld\n", j->board, jiffies);	}	ti.tone_index = 24;	ti.gain0 = 1;	ti.freq0 = hz2130;	ti.gain1 = 0;	ti.freq1 = hz2750;	ixj_init_tone(j, &ti);	ixj_set_tone_off(10, j);	ixj_set_tone_on(600, j);	if(ixjdebug & 0x0200) {		printk("IXJ cidcw phone%d second tone start at %ld\n", j->board, jiffies);	}	ixj_play_tone(j, 24);	clear_bit(j->board, &j->busyflags);	while(j->tone_state) {		set_current_state(TASK_INTERRUPTIBLE);		schedule_timeout(1);	}	while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0) {		set_current_state(TASK_INTERRUPTIBLE);		schedule_timeout(1);	}	if(ixjdebug & 0x0200) {		printk("IXJ cidcw phone%d sent second tone at %ld\n", j->board, jiffies);	}	j->cidcw_wait = jiffies + ((50 * hertz) / 100);	clear_bit(j->board, &j->busyflags);	while(!j->flags.cidcw_ack && time_before(jiffies, j->cidcw_wait)) {		set_current_state(TASK_INTERRUPTIBLE);		schedule_timeout(1);	}	while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0) {		set_current_state(TASK_INTERRUPTIBLE);		schedule_timeout(1);	}	j->cidcw_wait = 0;	if(!j->flags.cidcw_ack) {		if(ixjdebug & 0x0200) {			printk("IXJ cidcw phone%d did not receive ACK from display %ld\n", j->board, jiffies);		}		ixj_post_cid(j);		if(j->cid_play_flag) {			wake_up_interruptible(&j->write_q);	/* Wake any blocked readers */		}		return;	} else {		ixj_pre_cid(j);	}	j->flags.cidcw_ack = 0;	strcpy(sdmf1, j->cid_send.month);	strcat(sdmf1, j->cid_send.day);	strcat(sdmf1, j->cid_send.hour);	strcat(sdmf1, j->cid_send.min);	strcpy(sdmf2, j->cid_send.number);	strcpy(sdmf3, j->cid_send.name);	len1 = strlen(sdmf1);	len2 = strlen(sdmf2);	len3 = strlen(sdmf3);	mdmflen = len1 + len2 + len3 + 6;	ixj_write_cidcw_seize(j);	ixj_write_cid_byte(j, 0x80);	checksum = 0x80;	ixj_write_cid_byte(j, mdmflen);	checksum = checksum + mdmflen;	ixj_write_cid_byte(j, 0x01);	checksum = checksum + 0x01;	ixj_write_cid_byte(j, len1);	checksum = checksum + len1;	checksum = ixj_write_cid_string(j, sdmf1, checksum);	ixj_write_cid_byte(j, 0x02);	checksum = checksum + 0x02;	ixj_write_cid_byte(j, len2);	checksum = checksum + len2;	checksum = ixj_write_cid_string(j, sdmf2, checksum);	ixj_write_cid_byte(j, 0x07);	checksum = checksum + 0x07;	ixj_write_cid_byte(j, len3);	checksum = checksum + len3;	checksum = ixj_write_cid_string(j, sdmf3, checksum);	checksum %= 256;	checksum ^= 0xFF;	checksum += 1;	ixj_write_cid_byte(j, (char) checksum);	pad = j->fskdcnt % 240;	if (pad) {		pad = 240 - pad;	}	ixj_pad_fsk(j, pad);	if(ixjdebug & 0x0200) {		printk("IXJ cidcw phone%d sent FSK data at %ld\n", j->board, jiffies);	}}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/1e63bc7342c40f0f1dd83d80d368665bd06f4963/ixj.c/clean/drivers/telephony/ixj.c