Driver/tiny_tty/tiny_timer()

Last-modified: 2007-09-27 (木) 14:33:16

063 :static void tiny_timer(unsigned long timer_data)
064 :{
065 : struct tiny_serial *tiny = (struct tiny_serial *)timer_data;

timer_dataはtiny_serial構造体

066 : struct tty_struct *tty;
067 : int i;
068 : char data[1] = {TINY_DATA_CHARACTER};
069 : int data_size = 1;
070 :
071 : if (!tiny)
072 : return;
073 :
074 : tty = tiny->tty;

ttyの取得

075 :
076 : /* send the data to the tty layer for users to read. This doesn't
077 : * actually push the data through unless tty->low_latency is set */

データをユーザが読み取れるように取得する。

078 : for (i = 0; i < data_size; ++i) {
079 : if (tty->flip.count >= TTY_FLIPBUF_SIZE)
080 : tty_flip_buffer_push(tty);
081 : tty_insert_flip_char(tty, data[i], TTY_NORMAL);
082 : }
083 : tty_flip_buffer_push(tty);
084 :
085 : /* resubmit the timer again */

timerを送りなおす

086 : tiny->timer->expires = jiffies + DELAY_TIME;
087 : add_timer(tiny->timer);
088 :}
089 :