0.3.1
|
Data Structures | |
struct | cpu_sci_cfg |
CPU-SCI configuration. More... | |
Typedefs | |
typedef enum cpu_sci_mode | cpu_sci_mode_t |
CPU-SCI communication mode. | |
typedef enum cpu_sci_length | cpu_sci_length_t |
Single transfer length in bits. | |
typedef enum cpu_sci_parity | cpu_sci_parity_t |
Parity. | |
typedef enum cpu_sci_parity_mode | cpu_sci_parity_mode_t |
Parity mode. | |
typedef enum cpu_sci_stop_bit_length | cpu_sci_stop_bit_length_t |
Stop bit length. | |
typedef enum cpu_sci_mp | cpu_sci_mp_t |
Multiprocessor mode. | |
typedef enum cpu_sci_clock_div | cpu_sci_clock_div_t |
Clock divider for baudrate prescaler. | |
typedef enum cpu_sci_sck_cfg | cpu_sci_sck_cfg_t |
SCK pin configuration. | |
typedef void(* | cpu_sci_ihr) (void *ihr) |
Callback type. | |
typedef struct cpu_sci_cfg | cpu_sci_cfg_t |
CPU-SCI configuration. | |
Enumerations | |
enum | cpu_sci_mode |
CPU-SCI communication mode. More... | |
enum | cpu_sci_length |
Single transfer length in bits. More... | |
enum | cpu_sci_parity |
Parity. More... | |
enum | cpu_sci_parity_mode |
Parity mode. More... | |
enum | cpu_sci_stop_bit_length |
Stop bit length. More... | |
enum | cpu_sci_mp |
Multiprocessor mode. More... | |
enum | cpu_sci_clock_div |
Clock divider for baudrate prescaler. More... | |
enum | cpu_sci_sck_cfg |
SCK pin configuration. More... | |
Functions | |
static void | cpu_sci_enable (void) |
Enable CPU-SCI. | |
static void | cpu_sci_disable (void) |
Disable CPU-SCI. | |
static void | cpu_sci_interrupt_priority_set (uint8_t priority) |
Set the interrupt priority level for CPU-SCI. | |
static void | cpu_sci_status_reset (void) |
Reset CPU-SCI status. | |
void | cpu_sci_config_set (const cpu_sci_cfg_t *cfg) |
Configure a CPU-SCI for transfer. | |
void | cpu_sci_with_dmac_enable (const cpu_sci_cfg_t *cfg) |
Execute a CPU-SCI transfer in CPI+DMAC mode. | |
static void | cpu_sci_write_value_set (uint8_t value) |
Execute a single byte CPU-SCI transfer in normal mode. | |
static uint8_t | cpu_sci_read_value_get (void) |
Returns the last value read during CPU-SCI transfer in normal mode. | |
static void | cpu_sci_wait (void) |
Waits for CPU-SCI transfer end. | |
Description goes here.
struct cpu_sci_cfg |
CPU-SCI configuration.
Data Fields | ||
---|---|---|
cpu_sci_mode_t | mode:1 | Communication mode. |
cpu_sci_length_t | length:1 | Length. |
cpu_sci_parity_t | parity:1 | Parity. |
cpu_sci_parity_mode_t | parity_mode:1 | Parity mode. |
cpu_sci_stop_bit_length_t | stop_bit:1 | Stop bit. |
cpu_sci_mp_t | mp:1 | Multiprocessor mode. |
cpu_sci_clock_div_t | clock_div:2 | Clock divider. |
cpu_sci_sck_cfg_t | sck_config:2 | SCK pin configuration. |
uint8_t | baudrate | Baudrate. |
cpu_sci_ihr | ihr_eri |
Callback when receive error is encountered. Set to |
cpu_sci_ihr | ihr_rxi |
Callback when new serial data is received in receive data register. Set to |
cpu_sci_ihr | ihr_txi |
Callback when transmit data register content is dispatched for transfer. Set to |
cpu_sci_ihr | ihr_tei |
Callback when transmit data register content is sent. Set to |
typedef enum cpu_sci_mode cpu_sci_mode_t |
CPU-SCI communication mode.
typedef enum cpu_sci_length cpu_sci_length_t |
Single transfer length in bits.
typedef enum cpu_sci_parity cpu_sci_parity_t |
Parity.
typedef enum cpu_sci_parity_mode cpu_sci_parity_mode_t |
Parity mode.
typedef enum cpu_sci_stop_bit_length cpu_sci_stop_bit_length_t |
Stop bit length.
typedef enum cpu_sci_mp cpu_sci_mp_t |
Multiprocessor mode.
typedef enum cpu_sci_clock_div cpu_sci_clock_div_t |
Clock divider for baudrate prescaler.
typedef enum cpu_sci_sck_cfg cpu_sci_sck_cfg_t |
SCK pin configuration.
typedef void(* cpu_sci_ihr) (void *ihr) |
Callback type.
enum cpu_sci_mode |
CPU-SCI communication mode.
Enumerator | |
---|---|
CPU_SCI_MODE_ASYNC | Asynchronous mode. |
CPU_SCI_MODE_SYNC | Clocked synchronous mode. |
enum cpu_sci_length |
Single transfer length in bits.
Enumerator | |
---|---|
CPU_SCI_LENGTH_8_BITS | 8-bit data. |
CPU_SCI_LENGTH_7_BITS | 7-bit data. When 7-bit data is selected, the MSB (bit 7) of the transmit data register is not transmitted. |
enum cpu_sci_parity |
Parity.
enum cpu_sci_parity_mode |
Parity mode.
Enumerator | |
---|---|
CPU_SCI_PARITY_EVEN | Even parity. |
CPU_SCI_PARIT_ODD | Odd parity. |
Stop bit length.
Enumerator | |
---|---|
CPU_SCI_1_STOP_BIT | One stop bit. |
CPU_SCI_2_STOP_BITS | Two stop bits. |
enum cpu_sci_mp |
Multiprocessor mode.
Enumerator | |
---|---|
CPU_SCI_MP_OFF | Multiprocessor function disabled. |
CPU_SCI_MP_ON | Multiprocessor function enabled. |
enum cpu_sci_clock_div |
Clock divider for baudrate prescaler.
Enumerator | |
---|---|
CPU_SCI_CLOCK_DIV_4 | 1/4 clock division. |
CPU_SCI_CLOCK_DIV_16 | 1/16 clock division. |
CPU_SCI_CLOCK_DIV_64 | 1/64 clock division. |
CPU_SCI_CLOCK_DIV_256 | 1/256 clock division. |
enum cpu_sci_sck_cfg |
SCK pin configuration.
Enumerator | |
---|---|
CPU_SCI_SCK_DONTCARE | SCK pin is unused. |
CPU_SCI_SCK_OUTPUT | SCK pin is used as a clock output. |
CPU_SCI_SCK_INPUT | SCK pin is used as a clock input. |
|
inlinestatic |
Set the interrupt priority level for CPU-SCI.
priority | The priority ranging from 0 to 15 . |
void cpu_sci_config_set | ( | const cpu_sci_cfg_t * | cfg | ) |
Configure a CPU-SCI for transfer.
Configuring the CPU-SCI in cfg
does not start the transfer. To start the transfer, use either cpu_sci_with_dmac_enable (for SCI+DMAC mode) or cpu_sci_write_value_set (for normal mode). The CPU-SCI is forcefully stopped upon starting the configuration. If the CPU_SCI is currently operating int SCI+DMAC mode, use cpu_dmac_channel_wait with the corresponding CPU-DMAC channel to wait until the transfer is complete.
[in] | cfg | The CPU-SCI transfer configuration. |
void cpu_sci_with_dmac_enable | ( | const cpu_sci_cfg_t * | cfg | ) |
Execute a CPU-SCI transfer in CPI+DMAC mode.
Every transfer should be configured with cpu_sci_config_set first. The corresponding DMAC channed should be started with cpu_dmac_channel_start as well.
[in] | cfg | The CPU-SCI transfer configuration. |
|
inlinestatic |
Execute a single byte CPU-SCI transfer in normal mode.
Every transfer is bidirectional, reading is done alowng with writing. To get the readen valuer call cpu_sci_read_value_get.
[in] | value | Value for transmitting. |
|
inlinestatic |
Returns the last value read during CPU-SCI transfer in normal mode.
This function returns the value readen diring last cpu_sci_write_value_set call.
|
inlinestatic |
Waits for CPU-SCI transfer end.