ISF  2.1
Intelligent Sensing Framework for Kinetis with Processor Expert
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
fsl_uart_hal.h File Reference

fsl_uart_hal.h defines structures and types for the i2c master HAL layer. More...

#include "isf_types.h"
#include <stdbool.h>
Include dependency graph for fsl_uart_hal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  UartConfig
 UART configuration structure. More...
 

Typedefs

typedef enum _uart_status uart_status_t
 Error codes for the UART driver. More...
 
typedef enum _uart_stop_bit_count uart_stop_bit_count_t
 UART number of stop bits. More...
 
typedef enum _uart_parity_mode uart_parity_mode_t
 UART parity mode. More...
 
typedef enum
_uart_bit_count_per_char 
uart_bit_count_per_char_t
 UART number of bits in a character. More...
 
typedef enum _uart_operation_config uart_operation_config_t
 UART operation configuration constants. More...
 
typedef enum _uart_wakeup_method uart_wakeup_method_t
 UART wakeup from standby method constants. More...
 
typedef enum _uart_idle_line_select uart_idle_line_select_t
 UART idle line detect selection types. More...
 
typedef enum
_uart_break_char_length 
uart_break_char_length_t
 UART break character length settings for transmit/detect. More...
 
typedef struct UartConfig uart_config_t
 UART configuration structure. More...
 

Enumerations

enum  _uart_status {
  kStatus_UART_Success = 0, kStatus_UART_BaudRateCalculationError, kStatus_UART_BaudRatePercentDiffExceeded, kStatus_UART_BitCountNotSupported,
  kStatus_UART_StopBitCountNotSupported, kStatus_UART_RxStandbyModeError, kStatus_UART_ClearStatusFlagError, kStatus_UART_MSBFirstNotSupported,
  kStatus_UART_ResyncNotSupported, kStatus_UART_TxNotDisabled, kStatus_UART_RxNotDisabled, kStatus_UART_TxOrRxNotDisabled,
  kStatus_UART_TxBusy, kStatus_UART_RxBusy, kStatus_UART_NoTransmitInProgress, kStatus_UART_NoReceiveInProgress,
  kStatus_UART_InvalidInstanceNumber, kStatus_UART_InvalidBitSetting, kStatus_UART_OverSamplingNotSupported, kStatus_UART_BothEdgeNotSupported,
  kStatus_UART_Timeout, kStatus_UART_Error
}
 Error codes for the UART driver. More...
 
enum  _uart_stop_bit_count { kUartOneStopBit = 0, kUartTwoStopBit = 1 }
 UART number of stop bits. More...
 
enum  _uart_parity_mode { kUartParityDisabled = 0x0, kUartParityEven = 0x2, kUartParityOdd = 0x3 }
 UART parity mode. More...
 
enum  _uart_bit_count_per_char { kUart8BitsPerChar = 0, kUart9BitsPerChar = 1, kUart10BitsPerChar = 2 }
 UART number of bits in a character. More...
 
enum  _uart_operation_config { kUartOperates = 0, kUartStops = 1 }
 UART operation configuration constants. More...
 
enum  _uart_wakeup_method { kUartIdleLineWake = 0, kUartAddrMarkWake = 1 }
 UART wakeup from standby method constants. More...
 
enum  _uart_idle_line_select { kUartIdleLineAfterStartBit = 0, kUartIdleLineAfterStopBit = 1 }
 UART idle line detect selection types. More...
 
enum  _uart_break_char_length { kUartBreakChar10BitMinimum = 0, kUartBreakChar13BitMinimum = 1 }
 UART break character length settings for transmit/detect. More...
 

Functions

uart_status_t uart_hal_init (uint32 uartInstance, const uart_config_t *config)
 Initialize the UART controller. More...
 
void uart_hal_enable_transmitter (uint32 uartInstance)
 Enable the UART transmitter. More...
 
void uart_hal_disable_transmitter (uint32 uartInstance)
 Disable the UART transmitter. More...
 
void uart_hal_enable_receiver (uint32 uartInstance)
 Enable the UART receiver. More...
 
void uart_hal_disable_receiver (uint32 uartInstance)
 Disable the UART receiver. More...
 

Detailed Description

fsl_uart_hal.h defines structures and types for the i2c master HAL layer.

File: fsl_uart_hal.h

Copyright (c) 2014, Freescale Semiconductor, Inc.

Definition in file fsl_uart_hal.h.

Typedef Documentation

UART number of bits in a character.

These constants define the number of allowable data bits per UART character. Note, check the UART documentation to determine if the desired UART instance supports the desired number of data bits per UART character.

UART break character length settings for transmit/detect.

This provides constants for the UART break character length for both transmission and detection purposes. Note that the actual maximum bit times may vary depending on the UART instance.

typedef struct UartConfig uart_config_t

UART configuration structure.

This structure contains the settings for the most common UART configurations including the UART module source clock, baud rate, parity mode, stop bit count, data bit count per character, and tx/rx inversion options (which is the least common of the configuration).

UART idle line detect selection types.

This provides constants for the UART idle character bit-count start: either after start or stop bit.

UART operation configuration constants.

This provides constants for UART operational states: "operates normally" or "stops/siezes to operation"

UART parity mode.

These constants define the UART parity mode options: disabled or enabled of type even or odd.

Error codes for the UART driver.

UART number of stop bits.

These constants define the number of allowable stop bits to configure in a UART instance.

UART wakeup from standby method constants.

This provides constants for the two UART wakeup methods: idle-line or address-mark.

Enumeration Type Documentation

UART number of bits in a character.

These constants define the number of allowable data bits per UART character. Note, check the UART documentation to determine if the desired UART instance supports the desired number of data bits per UART character.

Enumerator
kUart8BitsPerChar 

8-bit data characters

kUart9BitsPerChar 

9-bit data characters

kUart10BitsPerChar 

10-bit data characters

Definition at line 74 of file fsl_uart_hal.h.

UART break character length settings for transmit/detect.

This provides constants for the UART break character length for both transmission and detection purposes. Note that the actual maximum bit times may vary depending on the UART instance.

Enumerator
kUartBreakChar10BitMinimum 

UART break char length 10 bit times (if M = 0, SBNS = 0) or 11 (if M = 1, SBNS = 0 or M = 0, SBNS = 1) or 12 (if M = 1, SBNS = 1 or M10 = 1, SNBS = 0) or 13 (if M10 = 1, SNBS = 1)

kUartBreakChar13BitMinimum 

UART break char length 13 bit times (if M = 0, SBNS = 0) or 14 (if M = 1, SBNS = 0 or M = 0, SBNS = 1) or 15 (if M = 1, SBNS = 1 or M10 = 1, SNBS = 0) or 16 (if M10 = 1, SNBS = 1)

Definition at line 118 of file fsl_uart_hal.h.

UART idle line detect selection types.

This provides constants for the UART idle character bit-count start: either after start or stop bit.

Enumerator
kUartIdleLineAfterStartBit 

UART idle character bit count start after start bit

kUartIdleLineAfterStopBit 

UART idle character bit count start after stop bit

Definition at line 107 of file fsl_uart_hal.h.

UART operation configuration constants.

This provides constants for UART operational states: "operates normally" or "stops/siezes to operation"

Enumerator
kUartOperates 

UART continues to operate normally

kUartStops 

UART siezes operation

Definition at line 86 of file fsl_uart_hal.h.

UART parity mode.

These constants define the UART parity mode options: disabled or enabled of type even or odd.

Enumerator
kUartParityDisabled 

parity disabled

kUartParityEven 

parity enabled, type even, bit setting: PE|PT = 10

kUartParityOdd 

parity enabled, type odd, bit setting: PE|PT = 11

Definition at line 61 of file fsl_uart_hal.h.

Error codes for the UART driver.

Enumerator
kStatus_UART_Success 
kStatus_UART_BaudRateCalculationError 

UART Baud Rate calculation error out of range.

kStatus_UART_BaudRatePercentDiffExceeded 

UART Baud Rate exceeds percentage difference

kStatus_UART_BitCountNotSupported 

UART bit count config not supported.

kStatus_UART_StopBitCountNotSupported 

UART stop bit count config not supported.

kStatus_UART_RxStandbyModeError 

UART unable to place receiver in standby mode.

kStatus_UART_ClearStatusFlagError 

UART clear status flag error.

kStatus_UART_MSBFirstNotSupported 

UART MSB first feature not supported.

kStatus_UART_ResyncNotSupported 

UART resync disable operation not supported.

kStatus_UART_TxNotDisabled 

UART Transmitter not disabled before enabling feature

kStatus_UART_RxNotDisabled 

UART Receiver not disabled before enabling feature

kStatus_UART_TxOrRxNotDisabled 

UART Transmitter or Receiver not disabled

kStatus_UART_TxBusy 

UART transmit still in progress.

kStatus_UART_RxBusy 

UART receive still in progress.

kStatus_UART_NoTransmitInProgress 

UART no transmit in progress.

kStatus_UART_NoReceiveInProgress 

UART no receive in progress.

kStatus_UART_InvalidInstanceNumber 

Invalid UART instance number.

kStatus_UART_InvalidBitSetting 

Invalid setting for desired UART register bit field.

kStatus_UART_OverSamplingNotSupported 

UART oversampling not supported.

kStatus_UART_BothEdgeNotSupported 

UART both edge sampling not supported.

kStatus_UART_Timeout 

UART transfer timed out.

kStatus_UART_Error 

UART error.

Definition at line 21 of file fsl_uart_hal.h.

UART number of stop bits.

These constants define the number of allowable stop bits to configure in a UART instance.

Enumerator
kUartOneStopBit 

one stop bit.

kUartTwoStopBit 

two stop bits.

Definition at line 51 of file fsl_uart_hal.h.

UART wakeup from standby method constants.

This provides constants for the two UART wakeup methods: idle-line or address-mark.

Enumerator
kUartIdleLineWake 

The idle-line wakes UART receiver from standby

kUartAddrMarkWake 

The addr-mark wakes UART receiver from standby

Definition at line 96 of file fsl_uart_hal.h.

Function Documentation

void uart_hal_disable_receiver ( uint32  uartInstance)

Disable the UART receiver.

This function allows the user to disable the UART receiver.

Parameters
uartInstanceUART module instance number.

Referenced by uart_adapter_stop().

Here is the caller graph for this function:

void uart_hal_disable_transmitter ( uint32  uartInstance)

Disable the UART transmitter.

This function allows the user to disable the UART transmitter.

Parameters
uartInstanceUART module instance number.

Referenced by uart_adapter_stop().

Here is the caller graph for this function:

void uart_hal_enable_receiver ( uint32  uartInstance)

Enable the UART receiver.

This function allows the user to enable the UART receiver.

Parameters
uartInstanceUART module instance number.

Referenced by uart_adapter_start().

Here is the caller graph for this function:

void uart_hal_enable_transmitter ( uint32  uartInstance)

Enable the UART transmitter.

This function allows the user to enable the UART transmitter.

Parameters
uartInstanceUART module instance number.

Referenced by uart_adapter_start().

Here is the caller graph for this function:

uart_status_t uart_hal_init ( uint32  uartInstance,
const uart_config_t config 
)

Initialize the UART controller.

This function will initialize the module to user defined settings and default settings. Here is an example demonstrating how to define the uart_config_t structure and call the uart_hal_init function:

1 uart_config_t uartConfig;
2 uartConfig.uartSourceClockInHz = uartSourceClock;
3 uartConfig.baudRate = baudRate;
4 uartConfig.bitCountPerChar = kUart8BitsPerChar;
5 uartConfig.parityMode = kUartParityDisabled;
6 uartConfig.stopBitCount = kUartOneStopBit;
7 uartConfig.txDataInvert = 0;
8 uartConfig.rxDataInvert = 0;
9 uart_hal_init(uartInstance, &uartConfig);
Parameters
uartInstanceUART module instance number.
configUART configuration data.
Returns
An error code or kStatus_UART_Success.

Referenced by uart_adapter_configure().

Here is the caller graph for this function: