static void mtk_wcn_stp_uart_exit(void)
{
    int err;

    mtk_wcn_stp_register_if_tx(STP_UART_IF_TX, NULL);    // unregister if_tx function

    /* Release tty registration of line discipline */
    if ((err = tty_unregister_ldisc(N_MTKSTP)))
    {
        UART_ERR_FUNC("Can't unregister MTK STP line discipline (%d)\n", err);
    }

#if (LDISC_RX == LDISC_RX_TASKLET)
    tasklet_kill(&g_stp_uart_rx_fifo_tasklet);
    stp_uart_fifo_deinit();
#elif (LDISC_RX == LDISC_RX_WORK)
	if (g_stp_uart_rx_work) {
		cancel_work_sync(g_stp_uart_rx_work);
	}
	if (g_stp_uart_rx_wq) {
		destroy_workqueue(g_stp_uart_rx_wq);
		g_stp_uart_rx_wq = NULL;
	}
	if (g_stp_uart_rx_work) {
		vfree(g_stp_uart_rx_work);
		g_stp_uart_rx_work = NULL;
	}
	stp_uart_fifo_deinit();

#endif
    return;
}
/* stp_uart_tty_close()
 *
 *    Called when the line discipline is changed to something
 *    else, the tty is closed, or the tty detects a hangup.
 */
static void stp_uart_tty_close(struct tty_struct *tty)
{
    UART_DBG_FUNC("stp_uart_tty_close(): tty %p\n", tty);
    mtk_wcn_stp_register_if_tx(STP_UART_IF_TX, NULL);

    return;
}
示例#3
0
/* stp_uart_tty_open
 *
 *     Called when line discipline changed to HCI_UART.
 *
 * Arguments:
 *     tty    pointer to tty info structure
 * Return Value:
 *     0 if success, otherwise error code
 */
static int stp_uart_tty_open(struct tty_struct *tty)
{
    UART_DBG_FUNC("stp_uart_tty_opentty: %p\n", tty);

    tty->receive_room = 65536;
    tty->low_latency = 1;

    /* Flush any pending characters in the driver and line discipline. */

    /* FIXME: why is this needed. Note don't use ldisc_ref here as the
       open path is before the ldisc is referencable */

#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29)
    /* definition changed!! */
    if (tty->ldisc->ops->flush_buffer) {
        tty->ldisc->ops->flush_buffer(tty);
    }
#else
    if (tty->ldisc.ops->flush_buffer) {
        tty->ldisc.ops->flush_buffer(tty);
    }
#endif

    tty_driver_flush_buffer(tty);

//    init_MUTEX(&buf_mtx);
////    spin_lock_init(&buf_lock);

    rd_idx = wr_idx = 0;
    stp_tty = tty;
    mtk_wcn_stp_register_if_tx(STP_UART_IF_TX,  mtk_wcn_uart_tx);

    return 0;
}
INT32 mtk_wcn_consys_stp_btif_open(VOID)
{
	INT32 iRet = -1;

	iRet = mtk_wcn_btif_open(BTIF_OWNER_NAME, pBtifRef);
	if (iRet) {
		WMT_WARN_FUNC("STP open btif fail(%d)\n", iRet);
		return -1;
	}
	WMT_DBG_FUNC("STP open bitf OK\n");

	mtk_wcn_stp_register_if_tx(STP_BTIF_IF_TX, (MTK_WCN_STP_IF_TX) mtk_wcn_consys_stp_btif_tx);

	return 0;
}
示例#5
0
static void __exit mtk_wcn_stp_uart_exit(void)
{
    int err;

    mtk_wcn_stp_register_if_tx(STP_UART_IF_TX, NULL);    // unregister if_tx function

    /* Release tty registration of line discipline */
    if ((err = tty_unregister_ldisc(N_MTKSTP)))
    {
        UART_ERR_FUNC("Can't unregister MTK STP line discipline (%d)\n", err);
    }

#ifdef LDISC_RX_TASKLET
    tasklet_kill(&g_stp_uart_rx_fifo_tasklet);
    stp_uart_fifo_deinit();
#endif
    return;
}
示例#6
0
/* stp_uart_tty_open
 *
 *     Called when line discipline changed to HCI_UART.
 *
 * Arguments:
 *     tty    pointer to tty info structure
 * Return Value:
 *     0 if success, otherwise error code
 */
static int stp_uart_tty_open(struct tty_struct *tty)
{
    UART_DBG_FUNC("original receive_room(%d) low_latency(%d) in tty(%p)\n",
        tty->receive_room, tty->low_latency, tty);

    tty->receive_room = 65536;
#if LDISC_LOW_LATENCY
    tty->low_latency = 1;
#endif
    UART_DBG_FUNC("set receive_room(%d) low_latency(%d) to tty(%p)\n",
        tty->receive_room, tty->low_latency, tty);

    /* Flush any pending characters in the driver and line discipline. */

    /* FIXME: why is this needed. Note don't use ldisc_ref here as the
       open path is before the ldisc is referencable */

#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29)
    /* definition changed!! */
    if (tty->ldisc->ops->flush_buffer) {
        tty->ldisc->ops->flush_buffer(tty);
    }
#else
    if (tty->ldisc.ops->flush_buffer) {
        tty->ldisc.ops->flush_buffer(tty);
    }
#endif

    tty_driver_flush_buffer(tty);

    stp_uart_fifo_reset();
    stp_uart_tty_tx_init();

    stp_tty = tty;

    /* Register to STP-CORE */
    mtk_wcn_stp_register_if_tx(STP_UART_IF_TX,  mtk_wcn_uart_tx);

    return 0;
}