return -1;\r
\r
f->frame_length[f->iWrite] = length;\r
- printk("add one frame, length=%ld\n", f->frame_length[f->iWrite]);\r
+ //printk("add one frame, length=%ld\n", f->frame_length[f->iWrite]);\r
f->iCount++;\r
- printk("now frame iCount=%d\n", f->iCount);\r
+ //printk("now frame iCount=%d\n", f->iCount);\r
f->iWrite = (f->iWrite+1) % MAX_FRAME_NUM;\r
- printk("now frame iWrite=%d\n", f->iWrite);\r
+ //printk("now frame iWrite=%d\n", f->iWrite);\r
\r
\r
return 0;\r
return -1;\r
\r
*length = f->frame_length[f->iRead];\r
- printk("read one frame, length=%ld\n", *length);\r
+ //printk("read one frame, length=%ld\n", *length);\r
f->iCount--;\r
- printk("now frame iCount=%d\n", f->iCount);\r
+ //printk("now frame iCount=%d\n", f->iCount);\r
f->iRead = (f->iRead+1) % MAX_FRAME_NUM;\r
- printk("now frame iRead=%d\n", f->iRead);\r
+ //printk("now frame iRead=%d\n", f->iRead);\r
\r
return 0;\r
}\r
\r
static int bu92747_irda_do_rx(struct bu92747_port *s)\r
{\r
- int i;\r
- unsigned int ch, flag;\r
+ //int i;\r
+ //unsigned int ch, flag;\r
int len;\r
+ struct tty_struct *tty = s->port.state->port.tty;\r
BU92747_IRDA_DBG("line %d, enter %s \n", __LINE__, __FUNCTION__);\r
\r
if (s->rx_enabled == 0) {\r
}\r
\r
len = BU92725GUW_get_data(g_receive_buf);\r
+ #if 0\r
flag = TTY_NORMAL;\r
//printk("receive data:\n");\r
for (i=0;i<len;i++) {\r
//printk("%d ", ch);\r
}\r
//printk("\n");\r
- \r
+ #else\r
+ if (len > 0) {\r
+ tty_insert_flip_string(tty, g_receive_buf, len);\r
+ s->port.icount.rx += len;\r
+ }\r
+ #endif\r
return len;\r
}\r
\r
struct bu92747_port *s = container_of(w, struct bu92747_port, work);\r
struct circ_buf *xmit = &s->port.state->xmit;\r
\r
- dev_dbg(s->dev, "%s\n", __func__);\r
printk("line %d, enter %s \n", __LINE__, __FUNCTION__);\r
\r
if (!s->force_end_work && !freezing(current)) {\r
unsigned long len;\r
struct rev_frame_length *f = &(s->rev_frames);\r
\r
- dev_dbg(s->dev, "%s\n", __func__);\r
- BU92747_IRDA_DBG("line %d, enter %s \n", __LINE__, __FUNCTION__);\r
irq_src = irda_hw_get_irqsrc();\r
printk("[%s][%d], 0x%x\n",__FUNCTION__,__LINE__, irq_src);\r
\r
\r
static void bu92747_irda_stop_tx(struct uart_port *port)\r
{\r
- struct bu92747_port *s = container_of(port,\r
- struct bu92747_port,\r
- port);\r
BU92747_IRDA_DBG("line %d, enter %s \n", __LINE__, __FUNCTION__);\r
-\r
- dev_dbg(s->dev, "%s\n", __func__);\r
}\r
\r
static void bu92747_irda_start_tx(struct uart_port *port)\r
port);\r
BU92747_IRDA_DBG("line %d, enter %s \n", __LINE__, __FUNCTION__);\r
\r
- dev_dbg(s->dev, "%s\n", __func__);\r
-\r
//wait for start cmd\r
if (IS_FIR(s))\r
return ;\r
struct bu92747_port,\r
port);\r
\r
- dev_dbg(s->dev, "%s\n", __func__);\r
BU92747_IRDA_DBG("line %d, enter %s \n", __LINE__, __FUNCTION__);\r
\r
s->rx_enabled = 0;\r
port);\r
\r
BU92747_IRDA_DBG("line %d, enter %s \n", __LINE__, __FUNCTION__);\r
- dev_dbg(s->dev, "%s\n", __func__);\r
\r
/* may not be truly up-to-date */\r
//bu92747_irda_dowork(s);\r
port);\r
\r
BU92747_IRDA_DBG("line %d, enter %s \n", __LINE__, __FUNCTION__);\r
- dev_dbg(s->dev, "%s\n", __func__);\r
\r
return s->port.type == PORT_IRDA ? "BU92747" : NULL;\r
}\r
\r
static void bu92747_irda_release_port(struct uart_port *port)\r
{\r
- struct bu92747_port *s = container_of(port,\r
- struct bu92747_port,\r
- port);\r
-\r
BU92747_IRDA_DBG("line %d, enter %s \n", __LINE__, __FUNCTION__);\r
- dev_dbg(s->dev, "%s\n", __func__);\r
}\r
\r
static void bu92747_irda_config_port(struct uart_port *port, int flags)\r
port);\r
\r
BU92747_IRDA_DBG("line %d, enter %s \n", __LINE__, __FUNCTION__);\r
- dev_dbg(s->dev, "%s\n", __func__);\r
\r
if (flags & UART_CONFIG_TYPE)\r
s->port.type = PORT_IRDA;\r
static int bu92747_irda_verify_port(struct uart_port *port,\r
struct serial_struct *ser)\r
{\r
- struct bu92747_port *s = container_of(port,\r
- struct bu92747_port,\r
- port);\r
int ret = -EINVAL;\r
\r
BU92747_IRDA_DBG("line %d, enter %s \n", __LINE__, __FUNCTION__);\r
- dev_dbg(s->dev, "%s\n", __func__);\r
\r
if (ser->type == PORT_UNKNOWN || ser->type == PORT_IRDA)\r
ret = 0;\r
struct rev_frame_length *f = &(s->rev_frames);\r
\r
BU92747_IRDA_DBG("line %d, enter %s \n", __LINE__, __FUNCTION__);\r
- dev_dbg(s->dev, "%s\n", __func__);\r
\r
if (s->suspending)\r
return;\r
struct rev_frame_length *f = &(s->rev_frames);\r
\r
BU92747_IRDA_DBG("line %d, enter %s \n", __LINE__, __FUNCTION__);\r
- dev_dbg(s->dev, "%s\n", __func__);\r
\r
s->rx_enabled = 1;\r
\r
\r
static int bu92747_irda_request_port(struct uart_port *port)\r
{\r
- struct bu92747_port *s = container_of(port,\r
- struct bu92747_port,\r
- port);\r
-\r
BU92747_IRDA_DBG("line %d, enter %s \n", __LINE__, __FUNCTION__);\r
- dev_dbg(s->dev, "%s\n", __func__);\r
return 0;\r
}\r
\r
static void bu92747_irda_break_ctl(struct uart_port *port, int break_state)\r
{\r
- struct bu92747_port *s = container_of(port,\r
- struct bu92747_port,\r
- port);\r
-\r
BU92747_IRDA_DBG("line %d, enter %s \n", __LINE__, __FUNCTION__);\r
- dev_dbg(s->dev, "%s\n", __func__);\r
}\r
\r
static unsigned int bu92747_irda_get_mctrl(struct uart_port *port)\r
{\r
- struct bu92747_port *s = container_of(port,\r
- struct bu92747_port,\r
- port);\r
-\r
- dev_dbg(s->dev, "%s\n", __func__);\r
-\r
return TIOCM_DSR | TIOCM_CAR;\r
}\r
\r
static void bu92747_irda_set_mctrl(struct uart_port *port, unsigned int mctrl)\r
{\r
- struct bu92747_port *s = container_of(port,\r
- struct bu92747_port,\r
- port);\r
-\r
- dev_dbg(s->dev, "%s\n", __func__);\r
BU92747_IRDA_DBG("line %d, enter %s \n", __LINE__, __FUNCTION__);\r
}\r
\r
struct tty_struct *tty = s->port.state->port.tty;\r
\r
BU92747_IRDA_DBG("line %d, enter %s \n", __LINE__, __FUNCTION__);\r
- dev_dbg(s->dev, "%s\n", __func__);\r
if (!tty)\r
return;\r
\r
{\r
struct bu92747_port *s = dev_get_drvdata(&pdev->dev);\r
\r
- dev_dbg(s->dev, "%s\n", __func__);\r
-\r
if (s->open_flag) {\r
printk("line %d, enter %s \n", __LINE__, __FUNCTION__);\r
disable_irq(s->irq);\r
static int bu92747_irda_resume(struct platform_device *pdev)\r
{\r
struct bu92747_port *s = dev_get_drvdata(&pdev->dev);\r
-\r
- dev_dbg(s->dev, "%s\n", __func__);\r
\r
if (s->open_flag) {\r
printk("line %d, enter %s \n", __LINE__, __FUNCTION__);\r