コード例 #1
0
/* See fsl_debug_console.h for documentation of this function.*/
debug_console_status_t DbgConsole_DeInit(void)
{
    if (s_debugConsole.type == kDebugConsoleNone)
    {
        return kStatus_DEBUGCONSOLE_Success;
    }

    switch(s_debugConsole.type)
    {
#if defined(HW_UART_INSTANCE_COUNT)
        case kDebugConsoleUART:
            UART_DRV_Deinit(s_debugConsole.instance);
            break;
#endif
#if 0
#if defined(HW_LPUART_INSTANCE_COUNT)
        case kDebugConsoleLPUART:
                LPUART_DRV_Deinit(s_debugConsole.instance);
            break;
#endif
#endif
        default:
            return kStatus_DEBUGCONSOLE_InvalidDevice;
    }

    s_debugConsole.type = kDebugConsoleNone;

    return kStatus_DEBUGCONSOLE_Success;
}
コード例 #2
0
extern int32_t ciaaDriverUart_close(ciaaDevices_deviceType const * const device)
{
   ciaaDriverUart_uartType * uart = device->layer;
   int32_t ret = -1;

   UART_DRV_Deinit(uart->instance);
   ret = 0;

   return ret;
}
コード例 #3
0
ファイル: MicoDriverUart.c プロジェクト: 70year/MICO
OSStatus MicoUartFinalize( mico_uart_t uart )
{
    uint32_t  Instance = getInstanceBy(uart);
    // uart = MICO_UART_1; //test
#ifdef  UART_IRQ_APP 
    UART_DRV_Deinit(Instance);
#else     
    UART_DRV_EdmaDeinit(Instance);    
    EDMA_DRV_Deinit();   
    INT_SYS_DisableIRQ(g_uartRxTxIrqId[Instance]);
#endif
#ifndef NO_MICO_RTOS
  mico_rtos_deinit_semaphore(&uart_interfaces[uart].rx_complete);
  mico_rtos_deinit_semaphore(&uart_interfaces[uart].tx_complete);
#endif  
  
  return kNoErr;
}
コード例 #4
0
ファイル: MicoDriverUart.c プロジェクト: 70year/MICO
OSStatus MicoUartFinalize( mico_uart_t uart )
{
  
    uart = MICO_UART_1; //test
#ifdef  UART_IRQ_APP 
    UART_DRV_Deinit(BOARD_APP_UART_INSTANCE);
#else     
    UART_DRV_EdmaDeinit(BOARD_APP_UART_INSTANCE);    
    EDMA_DRV_Deinit();   
    INT_SYS_DisableIRQ(g_uartRxTxIrqId[BOARD_APP_UART_INSTANCE]);
#endif
#if ADD_OS_CODE
#ifndef NO_MICO_RTOS
  mico_rtos_deinit_semaphore(&uart_interfaces[uart].rx_complete);
  mico_rtos_deinit_semaphore(&uart_interfaces[uart].tx_complete);
#endif  
#endif  
  
  return kNoErr;
}
コード例 #5
0
ファイル: nio_serial.c プロジェクト: nevinxu/HM502B2
static int nio_serial_init(void *init_data, void **dev_context)
{
    osa_status_t status;

    NIO_SERIAL_DEV_CONTEXT_STRUCT *serial_dev_context = (NIO_SERIAL_DEV_CONTEXT_STRUCT *)dev_context;

    NIO_SERIAL_INIT_DATA_STRUCT *init = (NIO_SERIAL_INIT_DATA_STRUCT*)init_data;

    #if PLATFORM_LPUART_ENABLED

    assert(init->UART_INSTANCE < HW_LPUART_INSTANCE_COUNT);

    lpuart_user_config_t uartConfig =
    #else
    assert(init->UART_INSTANCE < HW_UART_INSTANCE_COUNT);

    uart_user_config_t uartConfig =
    #endif
    {
        .baudRate = init->BAUDRATE,
        .parityMode = init->PARITY_MODE,
        .stopBitCount = init->STOPBIT_COUNT,
        .bitCountPerChar = init->BITCOUNT_PERCHAR,
    };

    serial_dev_context = (NIO_SERIAL_DEV_CONTEXT_STRUCT*) OSA_MemAlloc(sizeof(NIO_SERIAL_DEV_CONTEXT_STRUCT));

    /* SDK HAL init */
    #if PLATFORM_LPUART_ENABLED
    if ( kStatus_UART_Success != LPUART_DRV_Init(init->UART_INSTANCE, &serial_dev_context->uart_state, &uartConfig))
    {
        errno = ENXIO;
    }

    /* LPUART handler interrupt installation */
    status = OSA_InstallIntHandler(g_lpuartRxTxIrqId[init->UART_INSTANCE], init->handler);
    if (kStatus_OSA_Success != status)
    {
      errno = ENXIO;
    }
    NVIC_SetPriority(g_lpuartRxTxIrqId[init->UART_INSTANCE], init->RXTX_PRIOR);
    NVIC_EnableIRQ(g_lpuartRxTxIrqId[init->UART_INSTANCE]);

    #else
    if ( kStatus_UART_Success != UART_DRV_Init(init->UART_INSTANCE, &serial_dev_context->uart_state, &uartConfig))
    {
        errno = ENXIO;
    }

    /* UART handler interrupt installation */
    status = OSA_InstallIntHandler(g_uartRxTxIrqId[init->UART_INSTANCE], init->handler);
    if (kStatus_OSA_Success != status)
    {
      errno = ENXIO;
    }
    NVIC_SetPriority(g_uartRxTxIrqId[init->UART_INSTANCE], init->RXTX_PRIOR);
    NVIC_EnableIRQ(g_uartRxTxIrqId[init->UART_INSTANCE]);
    #endif
    serial_dev_context->instance = init->UART_INSTANCE;
    *dev_context = (void*)serial_dev_context;
    return 0;
}

static int nio_serial_deinit(void *dev_context)
{
    NIO_SERIAL_DEV_CONTEXT_STRUCT *serial_dev_context = (NIO_SERIAL_DEV_CONTEXT_STRUCT *)dev_context;
    #if PLATFORM_LPUART_ENABLED
    LPUART_DRV_Deinit(serial_dev_context->instance);
    #else
    UART_DRV_Deinit(serial_dev_context->instance);
    #endif
    OSA_MemFree(dev_context);
    return 0;
}