static void stp_uart_rx_handling(unsigned long func_data){
    unsigned int how_much_get = 0;
    unsigned int how_much_to_get = 0;
    unsigned int flag = 0;
    
//    read_lock(&g_stp_uart_rx_handling_lock);
    how_much_to_get = kfifo_len(g_stp_uart_rx_fifo);
    
    if (how_much_to_get >= RX_BUFFER_LEN)
    {
        flag = 1;
        UART_INFO_FUNC ("fifolen(%d)\n", how_much_to_get);
    }
    
    do{
        #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
        how_much_get= kfifo_get(g_stp_uart_rx_fifo, g_rx_data, RX_BUFFER_LEN);
        #else
        how_much_get= kfifo_out(g_stp_uart_rx_fifo, g_rx_data, RX_BUFFER_LEN);
        #endif
        //UART_INFO_FUNC ("fifoget(%d)\n", how_much_get);
        mtk_wcn_stp_parser_data((UINT8 *)g_rx_data, how_much_get);
        how_much_to_get = kfifo_len(g_stp_uart_rx_fifo);
    }while(how_much_to_get > 0);
    
//    read_unlock(&g_stp_uart_rx_handling_lock);
    if (1 == flag)
    {
        UART_INFO_FUNC ("finish, fifolen(%d)\n", kfifo_len(g_stp_uart_rx_fifo));
    }
}
static void stp_uart_rx_worker (struct work_struct *work)
{
    unsigned int read;

    if (unlikely(!g_stp_uart_rx_fifo)) {
        UART_ERR_FUNC("NULL rx fifo!\n");
        return;
    }
    if (unlikely(!g_stp_uart_rx_buf)) {
        UART_ERR_FUNC("NULL rx buf!\n");
        return;
    }
	

    /* run until fifo becomes empty */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
    while (kfifo_len(g_stp_uart_rx_fifo)) {
        read = kfifo_get(g_stp_uart_rx_fifo, g_stp_uart_rx_buf, LDISC_RX_BUF_SIZE);
        //UART_LOUD_FUNC("kfifo_get(%d)\n", read);
        if (likely(read)) {
            mtk_wcn_stp_parser_data((UINT8 *)g_stp_uart_rx_buf, read);
        }
    }
#else
    while (!kfifo_is_empty(g_stp_uart_rx_fifo)) {
        read = kfifo_out(g_stp_uart_rx_fifo, g_stp_uart_rx_buf, LDISC_RX_BUF_SIZE);
        UART_DBG_FUNC("kfifo_out(%d)\n", read);
		//printk("rx_work:%d\n\r",read);
        if (likely(read)) {
            //UART_LOUD_FUNC("->%d\n", read);
            mtk_wcn_stp_parser_data((UINT8 *)g_stp_uart_rx_buf, read);
            //UART_LOUD_FUNC("<-\n", read);
        }
    }
#endif

    return;
}
static void stp_uart_tty_receive(struct tty_struct *tty, const u8 *data, char *flags, int count)
{

#if 0
    mtk_wcn_stp_debug_gpio_assert(IDX_STP_RX_PROC, DBG_TIE_LOW);
#endif

    if(count > 2000){
        /*this is abnormal*/
        UART_ERR_FUNC("stp_uart_tty_receive buffer count = %d\n", count);
    }

#if 0
    {
        struct timeval now;

        do_gettimeofday(&now);

        printk("[+STP][  ][R] %4d --> sec = %d, --> usec --> %d\n",
            count, now.tv_sec, now.tv_usec);
    }
#endif


    /*There are multi-context to access here? Need to spinlock?*/
    /*Only one context: flush_to_ldisc in tty_buffer.c*/
    mtk_wcn_stp_parser_data((UINT8 *)data, (UINT32)count);

#if 0
    mtk_wcn_stp_debug_gpio_assert(IDX_STP_RX_PROC, DBG_TIE_HIGH);
#endif

    tty_unthrottle(tty);

#if 0
    {
        struct timeval now;

        do_gettimeofday(&now);

        printk("[-STP][  ][R] %4d --> sec = %d, --> usec --> %d\n",
            count, now.tv_sec, now.tv_usec);
    }
#endif
    return;
}
示例#4
0
/* stp_uart_tty_receive()
 *
 *     Called by tty low level driver when receive data is
 *     available.
 *
 * Arguments:  tty          pointer to tty isntance data
 *             data         pointer to received data
 *             flags        pointer to flags for data
 *             count        count of received data in bytes
 *
 * Return Value:    None
 */
static void stp_uart_tty_receive(struct tty_struct *tty, const u8 *data, char *flags, int count)
{
    //UART_INFO_FUNC("count = %d\n", count);

    if (count > 2000){
        /*this is abnormal*/
        UART_WARN_FUNC("count = %d\n", count);
    }

#if 0
    {
        struct timeval now;

        do_gettimeofday(&now);

        printk("[+STP][  ][R] %4d --> sec = %d, --> usec --> %d\n",
            count, now.tv_sec, now.tv_usec);
    }
#endif


    /*There are multi-context to access here? Need to spinlock?*/
    /*Only one context: flush_to_ldisc in tty_buffer.c*/
    mtk_wcn_stp_parser_data((UINT8 *)data, (UINT32)count);

    /* George Test: useless? */
    /*tty_unthrottle(tty);*/

#if 0
    {
        struct timeval now;

        do_gettimeofday(&now);

        printk("[-STP][  ][R] %4d --> sec = %d, --> usec --> %d\n",
            count, now.tv_sec, now.tv_usec);
    }
#endif
    return;
}
示例#5
0
static void stp_uart_rx_handling(unsigned long func_data){
    #define LOCAL_BUFFER_LEN 1024
    unsigned char data[LOCAL_BUFFER_LEN];
    unsigned int how_much_get = 0;
    unsigned int how_much_to_get = 0;
    unsigned int flag = 0;

#if LDISC_RX_TASKLET_RWLOCK
    read_lock(&g_stp_uart_rx_handling_lock);
#endif

    how_much_to_get = kfifo_len(g_stp_uart_rx_fifo);

    if (how_much_to_get >= LOCAL_BUFFER_LEN)
    {
        flag = 1;
        UART_INFO_FUNC ("fifolen(%d)\n", how_much_to_get);
    }

    do {
        #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
        how_much_get= kfifo_get(g_stp_uart_rx_fifo, data, LOCAL_BUFFER_LEN);
        #else
        how_much_get= kfifo_out(g_stp_uart_rx_fifo, data, LOCAL_BUFFER_LEN);
        #endif
        UART_INFO_FUNC ("fifoget(%d)\n", how_much_get);
        mtk_wcn_stp_parser_data((UINT8 *)data, how_much_get);
        how_much_to_get = kfifo_len(g_stp_uart_rx_fifo);
    }while(how_much_to_get > 0);

#if LDISC_RX_TASKLET_RWLOCK
    read_unlock(&g_stp_uart_rx_handling_lock);
#endif

    if (1 == flag)
    {
        UART_INFO_FUNC ("finish, fifolen(%d)\n", kfifo_len(g_stp_uart_rx_fifo));
    }
}