Driver/tiny_tty/tiny_write()

Last-modified: 2007-09-27 (木) 14:37:02

174 :static int tiny_write(struct tty_struct *tty,
175 : const unsigned char *buffer, int count)
176 :{
177 : struct tiny_serial *tiny = tty->driver_data;
178 : int i;
179 : int retval = -EINVAL;
180 :
181 : if (!tiny)
182 : return -ENODEV;
183 :
184 : down(&tiny->sem);
185 :
186 : if (!tiny->open_count)
187 : /* port was not opened */
188 : goto exit;
189 :
190 : /* fake sending the data out a hardware port by
191 : * writing it to the kernel debug log.
192 : */
193 : printk(KERN_DEBUG "%s - ", __FUNCTION__);
194 : for (i = 0; i < count; ++i)
195 : printk("%02x ", buffer[i]);
196 : printk("\n");

本当は上記のロジックで、H/Wポートにデータを出力する。

197 :
198 :exit:
199 : up(&tiny->sem);
200 : return retval;
201 :}