Esempio n. 1
0
static void send_space(long length)
{
	gpiochip->set(gpiochip, gpio_out_pin, invert);
	if (length <= 0)
		return;
	safe_udelay(length);
}
Esempio n. 2
0
static void send_space(long length)
{
	gpio_set_value(gpio_out_pin, invert);
	if (length <= 0)
		return;
	safe_udelay(length);
}
Esempio n. 3
0
static void send_space(long length)
{
        gpiochip->set(gpiochip, TX_OFFSET_GPIOCHIP, invert);
        if (length <= 0)
                return;
        safe_udelay(length);
}
Esempio n. 4
0
static long send_pulse(unsigned long length)
{
	if (length <= 0)
		return 0;

	if (softcarrier) {
		return send_pulse_softcarrier(length);
	} else {
		gpiochip->set(gpiochip, gpio_out_pin, !invert);
		safe_udelay(length);
		return 0;
	}
}
Esempio n. 5
0
static long send_pulse(unsigned long length)
{
	if (length <= 0)
		return 0;

	if (softcarrier) {
		return send_pulse_softcarrier(length);
	} else {
		gpio_set_value(gpio_out_pin, 1);
		safe_udelay(length);
		return 0;
	}
}
Esempio n. 6
0
static long send_pulse(unsigned long length)
{
        if (length <= 0)
                return 0;

        if (softcarrier) {
                return send_pulse_softcarrier(length);
        } else {
                gpiochip->set(gpiochip, TX_OFFSET_GPIOCHIP, !invert);
                safe_udelay(length);
                return 0;
        }
}
Esempio n. 7
0
static long send_pulse_homebrew(unsigned long length)
{
	if(length<=0) return 0;
	if(softcarrier)
	{
		return send_pulse_homebrew_softcarrier(length);
	}
	else
	{
		on();
		safe_udelay(length);
		return(0);
	}
}
static ssize_t lirc_write(struct file *file, const char *buf,
			 size_t n, loff_t *ppos)
{
	int i, count;
	unsigned int mod_signal_length = 0;
	unsigned int time_elapse = 0;
	unsigned int total_time_elapsed = 0;
	unsigned int num_bytes_already_sent = 0;
	unsigned int hibyte = 0;
	unsigned int lobyte = 0;
	int cmdir_cnt = 0;
	unsigned int wait_this = 0;
	struct timeval start_time;
	struct timeval end_time;
	unsigned int real_time_elapsed = 0;

	/* save the time we started the write: */
	do_gettimeofday(&start_time);

	if (n % sizeof(lirc_t))
		return -EINVAL;

	count = n/sizeof(lirc_t);
	if (count > WBUF_LEN || count % 2 == 0)
		return -EINVAL;
	if (copy_from_user(wbuf, buf, n))
		return -EFAULT;

	/*
	 * the first time we have to flag that this is the start of a new
	 * signal otherwise COMMANDIR may receive 2 back-to-back pulses &
	 * invert the signal
	 */
	cmdir_char[0] = TX_HEADER_NEW;
	signal_num++;
	cmdir_char[1] = signal_num;
	cmdir_cnt = 2;
	for (i = 0; i < count; i++) {
		/* conversion to number of modulation frequency pulse edges */
		mod_signal_length = wbuf[i] >> 3;
		/*
		 * account for minor rounding errors -
		 * calculate length from this:
		 */
		time_elapse += mod_signal_length * timerval;

		hibyte = mod_signal_length / 256;
		lobyte = mod_signal_length % 256;
		cmdir_char[cmdir_cnt+1] = lobyte;
		cmdir_char[cmdir_cnt] = hibyte;
		cmdir_cnt += 2;

		/* write data to usb if full packet is collected */
		if (cmdir_cnt % MAX_PACKET == 0) {
			write_to_usb(cmdir_char, MAX_PACKET,  time_elapse);

			total_time_elapsed += time_elapse;

			num_bytes_already_sent += MAX_PACKET;
			time_elapse = 0;

			if ((i + 1) < count) {
				/* still more to send: */
				cmdir_char[0] =	TX_HEADER;  /* Next Packet */
				cmdir_char[1] = signal_num;
				cmdir_cnt = 2; /* reset the count */
			}
		}
	}

	/* send last chunk of data */
	if (cmdir_cnt > 0) {
		total_time_elapsed += time_elapse;
		write_to_usb(cmdir_char, cmdir_cnt, time_elapse);
	}
	/* XXX ERS remove all this? */
	/*
	 * we need to _manually delay ourselves_ to remain backwards
	 * compatible with LIRC and prevent our queue buffer from overflowing.
	 * Queuing in this driver is about instant, and send_start for example
	 * will fill it up quickly and prevent send_stop from taking immediate
	 * effect.
	 */
	dprintk("Total elapsed time is: %d. \n", total_time_elapsed);
	do_gettimeofday(&end_time);
	/*
	 * udelay for the difference between endtime and
	 * start + total_time_elapsed
	 */
	if (start_time.tv_usec < end_time.tv_usec)
		real_time_elapsed = (end_time.tv_usec - start_time.tv_usec);
	else
		real_time_elapsed = ((end_time.tv_usec +  1000000) -
							start_time.tv_usec);
	dprintk("Real time elapsed was %u.\n", real_time_elapsed);
	if (real_time_elapsed < (total_time_elapsed - 1000))
		wait_this = total_time_elapsed - real_time_elapsed - 1000;

#if 0 /* enable this for backwards compatibility */
	safe_udelay(wait_this);
#endif

	return(n);
}
Esempio n. 9
0
static void send_space_homebrew(long length)
{
        off();
	if(length<=0) return;
	safe_udelay(length);
}
Esempio n. 10
0
static void send_space_irdeo(long length)
{
	if(length<=0) return;
	safe_udelay(length);
}