当前位置: 首页>>代码示例>>C++>>正文


C++ PHAL_RUART_OP类代码示例

本文整理汇总了C++中PHAL_RUART_OP的典型用法代码示例。如果您正苦于以下问题:C++ PHAL_RUART_OP类的具体用法?C++ PHAL_RUART_OP怎么用?C++ PHAL_RUART_OP使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PHAL_RUART_OP类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: serial_send_stream_dma

int32_t serial_send_stream_dma (serial_t *obj, char *ptxbuf, uint32_t len)
{
    PHAL_RUART_OP      pHalRuartOp;
    PHAL_RUART_ADAPTER pHalRuartAdapter=(PHAL_RUART_ADAPTER)&(obj->hal_uart_adp);
    u8  uart_idx = pHalRuartAdapter->UartIndex;
    int32_t ret;

    pHalRuartOp = &(obj->hal_uart_op);

    if ((serial_dma_en[uart_idx] & SERIAL_TX_DMA_EN)==0) {
        PUART_DMA_CONFIG   pHalRuartDmaCfg;
        
        pHalRuartDmaCfg = &obj->uart_gdma_cfg;
#if 0        
        pHalRuartOp->HalRuartTxGdmaLoadDef (pHalRuartAdapter, pHalRuartDmaCfg);
        pHalRuartOp->HalRuartDmaInit (pHalRuartAdapter);
        InterruptRegister(&pHalRuartDmaCfg->TxGdmaIrqHandle);
        InterruptEn(&pHalRuartDmaCfg->TxGdmaIrqHandle);
        serial_dma_en[uart_idx] |= SERIAL_TX_DMA_EN;
#else
        if (HAL_OK == HalRuartTxGdmaInit(pHalRuartOp, pHalRuartAdapter, pHalRuartDmaCfg)) {
            serial_dma_en[uart_idx] |= SERIAL_TX_DMA_EN;
        }
        else {
            return HAL_BUSY;
        }
#endif
    }    
    ret = pHalRuartOp->HalRuartDmaSend(pHalRuartAdapter, (u8*)ptxbuf, len);
    return (ret);
}
开发者ID:geliang201201,项目名称:RTL_Ameba,代码行数:31,代码来源:serial_api.c

示例2: serial_send_stream_dma

int32_t serial_send_stream_dma (serial_t *obj, char *ptxbuf, uint32_t len)
{
    PHAL_RUART_OP      pHalRuartOp;
    PHAL_RUART_ADAPTER pHalRuartAdapter=(PHAL_RUART_ADAPTER)&(obj->hal_uart_adp);
    u8  uart_idx = pHalRuartAdapter->UartIndex;
    int32_t ret;

    pHalRuartOp = &(obj->hal_uart_op);

    if ((serial_dma_en[uart_idx] & SERIAL_TX_DMA_EN)==0) {
        PUART_DMA_CONFIG   pHalRuartDmaCfg;
        
        pHalRuartDmaCfg = &obj->uart_gdma_cfg;
        if (HAL_OK == HalRuartTxGdmaInit(pHalRuartOp, pHalRuartAdapter, pHalRuartDmaCfg)) {
            serial_dma_en[uart_idx] |= SERIAL_TX_DMA_EN;
        }
        else {
            return HAL_BUSY;
        }
    }    
    obj->tx_len = len;
    HalRuartEnterCritical(pHalRuartAdapter);
    ret = pHalRuartOp->HalRuartDmaSend(pHalRuartAdapter, (u8*)ptxbuf, len);
    HalRuartExitCritical(pHalRuartAdapter);
    return (ret);
}
开发者ID:alex1818,项目名称:rtk-8711af,代码行数:26,代码来源:serial_api.c

示例3: serial_recv_stream_timeout

// return the byte count received before timeout, or error(<0)
int32_t serial_recv_stream_timeout (serial_t *obj, char *prxbuf, uint32_t len, uint32_t timeout_ms, void *force_cs)
{
    PHAL_RUART_OP      pHalRuartOp;
    PHAL_RUART_ADAPTER pHalRuartAdapter=(PHAL_RUART_ADAPTER)&(obj->hal_uart_adp);
    uint32_t TimeoutCount=0, StartCount;
    int ret;
    void (*task_yield)(void);

    task_yield = NULL;
    pHalRuartOp = &(obj->hal_uart_op);
    HalRuartEnterCritical(pHalRuartAdapter);
    ret = pHalRuartOp->HalRuartIntRecv(pHalRuartAdapter, (u8*)prxbuf, len);
    HalRuartExitCritical(pHalRuartAdapter);
    if ((ret == HAL_OK) && (timeout_ms > 0)) {
        TimeoutCount = (timeout_ms*1000/TIMER_TICK_US);
        StartCount = HalTimerOp.HalTimerReadCount(1);
        task_yield = (void (*)(void))force_cs;
        while (pHalRuartAdapter->State & HAL_UART_STATE_BUSY_RX) {
            if (HAL_TIMEOUT == RuartIsTimeout(StartCount, TimeoutCount)) {
                ret = pHalRuartOp->HalRuartStopRecv((VOID*)pHalRuartAdapter);
                ret = pHalRuartOp->HalRuartResetRxFifo((VOID*)pHalRuartAdapter);
                pHalRuartAdapter->Status = HAL_UART_STATUS_TIMEOUT;
                break;
            }
            if (NULL != task_yield) {
               task_yield();
            }
        }
        return (len - pHalRuartAdapter->RxCount);
    } else {
        return (-ret);
    }
}
开发者ID:alex1818,项目名称:rtk-8711af,代码行数:34,代码来源:serial_api.c

示例4: serial_free

void serial_free(serial_t *obj) 
{
    PHAL_RUART_ADAPTER pHalRuartAdapter;
    PHAL_RUART_OP      pHalRuartOp;
#ifdef CONFIG_GDMA_EN
    u8  uart_idx;
    PUART_DMA_CONFIG   pHalRuartDmaCfg;

#endif

    pHalRuartAdapter = &(obj->hal_uart_adp);
    pHalRuartOp = &(obj->hal_uart_op);

    pHalRuartOp->HalRuartDeInit(pHalRuartAdapter);

#ifdef CONFIG_GDMA_EN
    uart_idx = pHalRuartAdapter->UartIndex;
    pHalRuartDmaCfg = &obj->uart_gdma_cfg;
    if (serial_dma_en[uart_idx] & SERIAL_RX_DMA_EN) {
        HalRuartRxGdmaDeInit(pHalRuartDmaCfg);
        serial_dma_en[uart_idx] &= ~SERIAL_RX_DMA_EN;
    }

    if (serial_dma_en[uart_idx] & SERIAL_TX_DMA_EN) {
        HalRuartTxGdmaDeInit(pHalRuartDmaCfg);
        serial_dma_en[uart_idx] &= ~SERIAL_TX_DMA_EN;
    }    
#endif
    // TODO: recovery Pin Mux

}
开发者ID:geliang201201,项目名称:RTL_Ameba,代码行数:31,代码来源:serial_api.c

示例5: serial_send_stream

int32_t serial_send_stream (serial_t *obj, char *ptxbuf, uint32_t len)
{
    PHAL_RUART_OP      pHalRuartOp;
    PHAL_RUART_ADAPTER pHalRuartAdapter=(PHAL_RUART_ADAPTER)&(obj->hal_uart_adp);
    int ret;

    pHalRuartOp = &(obj->hal_uart_op);
    ret = pHalRuartOp->HalRuartIntSend(pHalRuartAdapter, (u8*)ptxbuf, len);
    return (ret);
}
开发者ID:geliang201201,项目名称:RTL_Ameba,代码行数:10,代码来源:serial_api.c

示例6: serial_baud

void serial_baud(serial_t *obj, int baudrate) {
    PHAL_RUART_ADAPTER pHalRuartAdapter;
    PHAL_RUART_OP      pHalRuartOp;

    pHalRuartAdapter = &(obj->hal_uart_adp);
    pHalRuartOp = &(obj->hal_uart_op);

    pHalRuartAdapter->BaudRate = baudrate;
    pHalRuartOp->HalRuartInit(pHalRuartAdapter);
}
开发者ID:eggman,项目名称:arm-gcc-blink-example,代码行数:10,代码来源:serial_api.c

示例7: serial_clear

void serial_clear(serial_t *obj) 
{
    PHAL_RUART_ADAPTER pHalRuartAdapter;
    PHAL_RUART_OP pHalRuartOp;

    pHalRuartAdapter = &(obj->hal_uart_adp);
    pHalRuartOp = &(obj->hal_uart_op);

    pHalRuartOp->HalRuartResetRxFifo(pHalRuartAdapter);
}
开发者ID:eggman,项目名称:arm-gcc-blink-example,代码行数:10,代码来源:serial_api.c

示例8: serial_recv_stream

int32_t serial_recv_stream (serial_t *obj, char *prxbuf, uint32_t len)
{
    PHAL_RUART_OP      pHalRuartOp;
    PHAL_RUART_ADAPTER pHalRuartAdapter=(PHAL_RUART_ADAPTER)&(obj->hal_uart_adp);
    int ret;

    pHalRuartOp = &(obj->hal_uart_op);
    obj->rx_len = len;
    ret = pHalRuartOp->HalRuartIntRecv(pHalRuartAdapter, (u8*)prxbuf, len);
    return (ret);
}
开发者ID:alex1818,项目名称:rtk-8711af,代码行数:11,代码来源:serial_api.c

示例9: serial_send_blocked

// Blocked(busy wait) send, return transmitted bytes count
int32_t serial_send_blocked (serial_t *obj, char *ptxbuf, uint32_t len, uint32_t timeout_ms)
{
    PHAL_RUART_OP      pHalRuartOp;
    PHAL_RUART_ADAPTER pHalRuartAdapter=(PHAL_RUART_ADAPTER)&(obj->hal_uart_adp);
    int ret;

    pHalRuartOp = &(obj->hal_uart_op);
    obj->tx_len = len;
    ret = pHalRuartOp->HalRuartSend(pHalRuartAdapter, (u8*)ptxbuf, len, timeout_ms);
    return (ret);
}
开发者ID:alex1818,项目名称:rtk-8711af,代码行数:12,代码来源:serial_api.c

示例10: serial_clear

void serial_clear(serial_t *obj) 
{
    PHAL_RUART_ADAPTER pHalRuartAdapter;
    PHAL_RUART_OP pHalRuartOp;
    char temp;

    pHalRuartAdapter = &(obj->hal_uart_adp);
    pHalRuartOp = &(obj->hal_uart_op);

    pHalRuartOp->HalRuartResetRxFifo(pHalRuartAdapter);
    while (HAL_OK == pHalRuartOp->HalRuartGetC(pHalRuartAdapter, &temp));
}
开发者ID:alex1818,项目名称:rtk-8711af,代码行数:12,代码来源:serial_api.c

示例11: serial_recv_stream_abort

int32_t serial_recv_stream_abort (serial_t *obj)
{
    PHAL_RUART_OP      pHalRuartOp;
    PHAL_RUART_ADAPTER pHalRuartAdapter=(PHAL_RUART_ADAPTER)&(obj->hal_uart_adp);
    int ret;

    pHalRuartOp = &(obj->hal_uart_op);
    
    ret = pHalRuartOp->HalRuartStopRecv((VOID*)pHalRuartAdapter);
    ret = pHalRuartOp->HalRuartResetRxFifo((VOID*)pHalRuartAdapter);
    return (ret);
}
开发者ID:geliang201201,项目名称:RTL_Ameba,代码行数:12,代码来源:serial_api.c

示例12: serial_init

void serial_init(serial_t *obj, PinName tx, PinName rx) 
{
    uint32_t uart_tx, uart_rx;
    uint32_t uart_sel;
    uint8_t uart_idx;
    PHAL_RUART_OP      pHalRuartOp;
    PHAL_RUART_ADAPTER pHalRuartAdapter;
    
    // Determine the UART to use (UART0, UART1, or UART3)
    uart_tx = pinmap_peripheral(tx, PinMap_UART_TX);
    uart_rx = pinmap_peripheral(rx, PinMap_UART_RX);

    uart_sel = pinmap_merge(uart_tx, uart_rx);
    uart_idx = RTL_GET_PERI_IDX(uart_sel);
    if (unlikely(uart_idx == (uint8_t)NC)) {
        DBG_UART_ERR("%s: Cannot find matched UART\n", __FUNCTION__);
        return;
    }

    pHalRuartOp = &(obj->hal_uart_op);
    pHalRuartAdapter = &(obj->hal_uart_adp);

    if ((NULL == pHalRuartOp) || (NULL == pHalRuartAdapter)) {
        DBG_UART_ERR("%s: Allocate Adapter Failed\n", __FUNCTION__);
        return;
    }
    
    HalRuartOpInit((VOID*)pHalRuartOp);

    pHalRuartOp->HalRuartAdapterLoadDef(pHalRuartAdapter, uart_idx);
    pHalRuartAdapter->PinmuxSelect = RTL_GET_PERI_SEL(uart_sel);
    pHalRuartAdapter->BaudRate = 9600;
    
    // Configure the UART pins
    // TODO:
//    pinmap_pinout(tx, PinMap_UART_TX);
//    pinmap_pinout(rx, PinMap_UART_RX);
//    pin_mode(tx, PullUp);
//    pin_mode(rx, PullUp);
    
    pHalRuartOp->HalRuartInit(pHalRuartAdapter);
    pHalRuartOp->HalRuartRegIrq(pHalRuartAdapter);    
    pHalRuartOp->HalRuartIntEnable(pHalRuartAdapter);

#ifdef CONFIG_MBED_ENABLED
    // For stdio management
    if (uart_idx == STDIO_UART) {
        stdio_uart_inited = 1;
        memcpy(&stdio_uart, obj, sizeof(serial_t));
    }
#endif
}
开发者ID:eggman,项目名称:arm-gcc-blink-example,代码行数:52,代码来源:serial_api.c

示例13: serial_recv_stream_dma_timeout

int32_t serial_recv_stream_dma_timeout (serial_t *obj, char *prxbuf, uint32_t len, uint32_t timeout_ms, void *force_cs)
{
    PHAL_RUART_OP      pHalRuartOp;
    PHAL_RUART_ADAPTER pHalRuartAdapter=(PHAL_RUART_ADAPTER)&(obj->hal_uart_adp);
    u8  uart_idx = pHalRuartAdapter->UartIndex;
    uint32_t TimeoutCount=0, StartCount;
    int ret;
    void (*task_yield)(void);

    pHalRuartOp = &(obj->hal_uart_op);
    if ((serial_dma_en[uart_idx] & SERIAL_RX_DMA_EN)==0) {
        PUART_DMA_CONFIG   pHalRuartDmaCfg;

        pHalRuartDmaCfg = &obj->uart_gdma_cfg;
        if (HAL_OK == HalRuartRxGdmaInit(pHalRuartOp, pHalRuartAdapter, pHalRuartDmaCfg)) {
            serial_dma_en[uart_idx] |= SERIAL_RX_DMA_EN;
        }
        else {
            return HAL_BUSY;
        }
    }
    HalRuartEnterCritical(pHalRuartAdapter);
    ret = pHalRuartOp->HalRuartDmaRecv(pHalRuartAdapter, (u8*)prxbuf, len);
    HalRuartExitCritical(pHalRuartAdapter);
    
    if ((ret == HAL_OK) && (timeout_ms > 0)) {
        TimeoutCount = (timeout_ms*1000/TIMER_TICK_US);
        StartCount = HalTimerOp.HalTimerReadCount(1);
        task_yield = (void (*)(void))force_cs;
        pHalRuartAdapter->Status = HAL_UART_STATUS_OK;
        while (pHalRuartAdapter->State & HAL_UART_STATE_BUSY_RX) {
            if (HAL_TIMEOUT == RuartIsTimeout(StartCount, TimeoutCount)) {
                ret = pHalRuartOp->HalRuartStopRecv((VOID*)pHalRuartAdapter);
                ret = pHalRuartOp->HalRuartResetRxFifo((VOID*)pHalRuartAdapter);
                pHalRuartAdapter->Status = HAL_UART_STATUS_TIMEOUT;
                break;
            }
            if (NULL != task_yield) {
               task_yield();
            }
        }
        if (pHalRuartAdapter->Status == HAL_UART_STATUS_TIMEOUT) {
            return (len - pHalRuartAdapter->RxCount);
        } else {
            return len;
        }
    } else {
        return (-ret);
    }
//  return (ret);
}
开发者ID:alex1818,项目名称:rtk-8711af,代码行数:51,代码来源:serial_api.c

示例14: serial_recv_blocked

// Blocked(busy wait) receive, return received bytes count
int32_t serial_recv_blocked (serial_t *obj, char *prxbuf, uint32_t len, uint32_t timeout_ms)
{
    PHAL_RUART_OP      pHalRuartOp;
    PHAL_RUART_ADAPTER pHalRuartAdapter=(PHAL_RUART_ADAPTER)&(obj->hal_uart_adp);
    int ret;

    pHalRuartOp = &(obj->hal_uart_op);
    obj->rx_len = len;
    HalRuartEnterCritical(pHalRuartAdapter);
    ret = pHalRuartOp->HalRuartRecv(pHalRuartAdapter, (u8*)prxbuf, len, timeout_ms);
    HalRuartExitCritical(pHalRuartAdapter);
    
    return (ret);
}
开发者ID:alex1818,项目名称:rtk-8711af,代码行数:15,代码来源:serial_api.c

示例15: serial_irq_set

void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) 
{
#ifdef CONFIG_MBED_ENABLED
        if (obj->index == UART_3) {
            if (irq == RxIrq) {
                log_uart_irq_set(&stdio_uart_log, IIR_RX_RDY, enable);
            } else {
                log_uart_irq_set(&stdio_uart_log, IIR_THR_EMPTY, enable);
            }
            return;
        }
#endif
    PHAL_RUART_ADAPTER pHalRuartAdapter;
    PHAL_RUART_OP pHalRuartOp;
    u8 uart_idx;
    pHalRuartAdapter = &(obj->hal_uart_adp);
    pHalRuartOp = &(obj->hal_uart_op);
    uart_idx = pHalRuartAdapter->UartIndex;
    
    if (enable) {
        if (irq == RxIrq) {
            pHalRuartAdapter->Interrupts |= RUART_IER_ERBI | RUART_IER_ELSI;
            serial_irq_en[uart_idx] |= SERIAL_RX_IRQ_EN;
            HalRuartSetIMRRtl8195a (pHalRuartAdapter);
        } else {
            serial_irq_en[uart_idx] |= SERIAL_TX_IRQ_EN;
        }
         
        pHalRuartOp->HalRuartRegIrq(pHalRuartAdapter);
        //log_uart
        pHalRuartOp->HalRuartIntEnable(pHalRuartAdapter);
    } else { // disable
        if (irq == RxIrq) {
            pHalRuartAdapter->Interrupts &= ~(RUART_IER_ERBI | RUART_IER_ELSI);
            serial_irq_en[uart_idx] &= ~SERIAL_RX_IRQ_EN;
        } else {
            pHalRuartAdapter->Interrupts &= ~RUART_IER_ETBEI;
            serial_irq_en[uart_idx] &= ~SERIAL_TX_IRQ_EN;
        }
        HalRuartSetIMRRtl8195a (pHalRuartAdapter);
        
        if (pHalRuartAdapter->Interrupts == 0) {
            InterruptUnRegister(&pHalRuartAdapter->IrqHandle);
            InterruptDis(&pHalRuartAdapter->IrqHandle);
        }
    }
}
开发者ID:mbedNoobNinja,项目名称:mbed,代码行数:47,代码来源:serial_api.c


注:本文中的PHAL_RUART_OP类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。