newton IrDA : improve IrDA bu92747 sending process
authorlyx <lyx@rock-chips.com>
Thu, 29 Sep 2011 02:58:15 +0000 (10:58 +0800)
committerlyx <lyx@rock-chips.com>
Thu, 29 Sep 2011 02:59:42 +0000 (10:59 +0800)
1.优化IrDA发送流程
2.解决在通常送信模式下,当irda传输的文件大小大于485520Byte的时候,传输失败的问题。

drivers/net/irda/bu92725guw.c
drivers/net/irda/ir_serial.c

index e46c23b6c8b1e4ffa0061f6ddb5716f5ef393165..9578707482ae2643f95a570854d3d1089dd35d89 100755 (executable)
@@ -200,8 +200,8 @@ int irda_hw_set_speed(u32 speed)
                if (mode == BU92725GUW_MIR)\r
                        curTrans_way = BU92725GUW_MIR_SEND;\r
                else if (mode == BU92725GUW_FIR)\r
-                       //curTrans_way = BU92725GUW_MULTI_SEND;\r
-                       curTrans_way = BU92725GUW_FIR_SEND;\r
+                       curTrans_way = BU92725GUW_MULTI_SEND;\r
+                       //curTrans_way = BU92725GUW_FIR_SEND;\r
                break;\r
        case BU92725GUW_MIR_REV:\r
                if (mode == BU92725GUW_SIR)\r
@@ -215,8 +215,8 @@ int irda_hw_set_speed(u32 speed)
                if (mode == BU92725GUW_SIR)\r
                        curTrans_way = BU92725GUW_SEND;\r
                else if (mode == BU92725GUW_FIR)\r
-                       //curTrans_way = BU92725GUW_MULTI_SEND;\r
-                       curTrans_way = BU92725GUW_FIR_SEND;\r
+                       curTrans_way = BU92725GUW_MULTI_SEND;\r
+                       //curTrans_way = BU92725GUW_FIR_SEND;\r
                break;\r
        case BU92725GUW_FIR_REV:\r
        case BU92725GUW_AUTO_MULTI_REV:\r
@@ -260,8 +260,8 @@ int irda_hw_tx_enable_irq(enum eTrans_Mode mode)
        else if (mode == BU92725GUW_MIR)\r
                BU92725GUW_set_trans_way(BU92725GUW_MIR_SEND);\r
        else\r
-               //BU92725GUW_set_trans_way(BU92725GUW_MULTI_SEND);\r
-               BU92725GUW_set_trans_way(BU92725GUW_FIR_SEND);\r
+               BU92725GUW_set_trans_way(BU92725GUW_MULTI_SEND);\r
+               //BU92725GUW_set_trans_way(BU92725GUW_FIR_SEND);\r
        //BU92725GUW_clr_fifo();\r
 \r
     return 0;\r
@@ -351,7 +351,13 @@ void BU92725GUW_set_trans_way(u32 way)
        curTrans_way = way;\r
 \r
        /* set bu92725guw registers */\r
-       internal_set(1);\r
+       /* [Modify] AIC 2011/09/27\r
+        *    MS_EN(TRCR5)¤Ë¤è¤ëͨÐÅ¥â©`¥ÉÇÐÌæ„Ó×÷¤òÐФï¤Ê¤¤¤è¤¦¤ËÐÞÕý¤·¤Þ¤·¤¿¡£\r
+        *\r
+        * internal_set(1);\r
+        */\r
+       internal_set(0);\r
+       /* [Modify] AIC 2011/09/27 */\r
 }\r
 \r
 /*\r
index 1add7b6d2d925bd14f21aa4e0e61c6bd304ef2bf..ec601f680603c111a95483345d399deba0f6e8ec 100755 (executable)
@@ -183,6 +183,7 @@ static int bu92747_irda_do_tx(struct bu92747_port *s)
        //int i;\r
        struct circ_buf *xmit = &s->port.state->xmit;\r
        int len = uart_circ_chars_pending(xmit);\r
+       int len1, len2;\r
        IRDA_DBG_SENT("line %d, enter %s, sending %d data\n", __LINE__, __FUNCTION__, len);\r
        \r
        if (IS_FIR(s)) {\r
@@ -196,7 +197,21 @@ static int bu92747_irda_do_tx(struct bu92747_port *s)
                s->tx_empty = 0;\r
        }\r
        \r
-       BU92725GUW_send_data(xmit->buf+xmit->tail, len, NULL, 0);\r
+       /* [Modify] AIC 2011/09/27\r
+        *    ËÍÐťХåե¡¤«¤é¥Ç©`¥¿¤òÈ¡¤ê³ö¤¹·½·¨¤Ë\86\96î}¤¬¤¢¤ê¡¢Ò»²¿¤Î\r
+        *    ¥Ç©`¥¿¤¬Õý¤·¤¯Ëͤì¤Ê¤¤¤³¤È¤¬¤¢¤ë¤¿¤á¤Ë¡¢ËÍÐťǩ`¥¿¤Î\r
+        *    È¡µÃ·½·¨¤òÐÞÕý¤·¤Þ¤·¤¿¡£\r
+        *\r
+        * BU92725GUW_send_data(xmit->buf+xmit->tail, len, NULL, 0);\r
+        */\r
+       if ( (xmit->tail + len) > UART_XMIT_SIZE ) {\r
+               len1 = UART_XMIT_SIZE - xmit->tail;\r
+               len2 = len - len1;\r
+               BU92725GUW_send_data(xmit->buf+xmit->tail, len1, xmit->buf, len2);\r
+       } else {\r
+               BU92725GUW_send_data(xmit->buf+xmit->tail, len, NULL, 0);\r
+       }\r
+       /* [Modify-end] AIC 2011/09/27 */\r
        s->port.icount.tx += len;\r
        xmit->tail = (xmit->tail + len) & (UART_XMIT_SIZE - 1);\r
 \r
@@ -278,11 +293,25 @@ static irqreturn_t bu92747_irda_irq(int irqno, void *dev_id)
                }\r
        }\r
        \r
+       /* [Modify] AIC 2011/09/27\r
+        *    WRE_EI(EIR11)¸î¤êÞz¤ß¤Î\95rµã¤Ç¡¢ËÍÐÅ¥â©`¥É¤«¤éÊÜÐÅ¥â©`¥É¤Ø\r
+        *    ÇФêÌ椨¤Æ¤·¤Þ¤¦¤È¡¢ËÍÐťǩ`¥¿¤Î×îáá¤Î²¿·Ö¤¬ËÍÐŤµ¤ì¤Ê¤¤¤³¤È¤¬\r
+        *    ¤¢¤ë¤¿¤á¡¢ËÍÐÅÍêÁ˸î¤êÞz¤ß(TXE_EI:EIR3)¤ò´ý¤Ä¤è¤¦¤ËÐÞÕý¤·¤Þ¤·¤¿¡£\r
+        *\r
+        * if (irq_src & (FRM_EVT_TX_TXE | FRM_EVT_TX_WRE)) {\r
+        *      s->tx_empty = 1;\r
+        *      irda_hw_set_moderx();\r
+        * }\r
+        */\r
        if (irq_src & (FRM_EVT_TX_TXE | FRM_EVT_TX_WRE)) {\r
+               /* ËÍÐŤ¬¾A¤¯\88öºÏ¤Ï¡¢¤³¤³¤Ç´Î¤Î¥Ç©`¥¿¤¬ËÍÐÅ¿ÉÄܤȤʤë */\r
                s->tx_empty = 1;\r
-               irda_hw_set_moderx();\r
+               if (irq_src & FRM_EVT_TX_TXE) {\r
+                       /* ÍêÈ«¤ËËÍÐÅÍêÁˤȤʤä¿\88öºÏ¡¢ÊÜÐÅ¥â©`¥É¤ØÇФêÌ椨¤ë */\r
+                       irda_hw_set_moderx();\r
+               }\r
        }\r
-\r
+       /* [Modify-end] AIC 2011/09/27 */\r
 #if 0\r
        /* error */\r
        if (irq_src & REG_INT_TO) {\r