RA Flexible Software Package Documentation
Release v5.7.0
|
|
Functions | |
fsp_err_t | R_CEC_Open (cec_ctrl_t *const p_ctrl, cec_cfg_t const *const p_cfg) |
fsp_err_t | R_CEC_MediaInit (cec_ctrl_t *const p_ctrl, cec_addr_t local_address) |
fsp_err_t | R_CEC_Close (cec_ctrl_t *const p_ctrl) |
fsp_err_t | R_CEC_Write (cec_ctrl_t *const p_ctrl, cec_message_t const *const p_message, uint32_t message_size) |
fsp_err_t | R_CEC_StatusGet (cec_ctrl_t *const p_ctrl, cec_status_t *const p_status) |
fsp_err_t | R_CEC_CallbackSet (cec_ctrl_t *const p_ctrl, void(*p_callback)(cec_callback_args_t *), void const *const p_context, cec_callback_args_t *const p_callback_memory) |
Driver for the CEC peripheral on RA MCUs. This module implements the CEC Interface.
The HDMI CEC HAL module provides a high-level API for CEC applications and supports the CEC peripheral available on RA microcontroller hardware. A user-callback function must be defined that the driver will invoke when data received, transmission complete, or error interrupts are received. The callback is passed a parameter which indicates the event as well as received data (if available).
Configuration | Options | Default | Description |
---|---|---|---|
Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
CEC Message Max Data Size | CEC message max data size must be a positive integer | 14 | Maximum Data Size for CEC Message Transmission/Reception. |
Configuration | Options | Default | Description |
---|---|---|---|
General | |||
Name | Name must be a valid C symbol | g_cec0 | Module name |
Control Configuration | |||
Clock Select |
| PCLKB / 1024 | CEC Clock Select Configuration |
Ack Bit Timing Error Enable |
| Enabled | CEC Ack Bit Timing Error Enable |
Signal-Free Time Bit Width |
| 7-data bit width | Signal-Free Time Data Bit Width Select |
Start Bit Error Detection Enable |
| Enabled | Enable to detect timing errors during start bit reception. |
Bus Lock Detection Enable |
| Enabled | Enable to detect sticking of receive data to high or low. |
Digital Filter Enable |
| Enabled | Enable to use a digital filter. |
Long Bit Width Error Pulse Output Enable |
| Disabled | Enable to output an error handling pulse when a long bit width error is detected. |
Start Detection Reception Restart Enable |
| Enabled | Enable to restart reception after a start bit error is detected. |
Bit Width Timing | |||
Bit Width Timing > Transmit | |||
Start Bit Low Time | CEC transmission start bit low width setting must be a positive integer. | 180 | CEC transmission start bit low width setting (CEC Clock Cycles). |
Start Bit Width Time | CEC transmission start bit high width setting must be a positive integer. | 220 | CEC transmission start bit high width setting (CEC Clock Cycles). |
Logical Zero Low Time | CEC transmission logical zero low width setting must be a positive integer. | 73 | CEC transmission logical zero low width setting (CEC Clock Cycles). |
Logical One Low Time | CEC transmission logical one low width setting must be a positive integer. | 29 | CEC transmission logical one low width setting (CEC Clock Cycles). |
Overall Bit Width Time | CEC transmission overall data bit width time setting must be a positive integer. | 117 | CEC transmission overall data bit width time setting (CEC Clock Cycles). |
Bit Width Timing > Receive | |||
Data Sample Time | CEC reception data sampling time must be a positive integer. | 49 | CEC reception data sampling time setting (CEC Clock Cycles). |
Data Bit Reference Width | CEC reception data bit reference width must be a positive integer. | 117 | CEC data bit reference width setting (CEC Clock Cycles). |
Start Bit Low Min Time | CEC reception start bit minimum low width setting must be a positive integer. | 171 | CEC reception start bit minimum low width setting (CEC Clock Cycles). Not used when Start Bit Error Detection and restart Rx on Error are not enabled. |
Start Bit Low Max Time | CEC reception start bit maximum low width setting must be a positive integer. | 190 | CEC reception start bit maximum low width setting (CEC Clock Cycles). Not used when Start Bit Error Detection and restart Rx on Error are not enabled. |
Start Bit Min Time | CEC start bit minimum time setting must be a positive integer. | 210 | CEC start bit minimum time setting (CEC Clock Cycles). Not used when Start Bit Error Detection and restart Rx on Error are not enabled. |
Start Bit Max Time | CEC reception start bit maximum time setting must be a positive integer. | 229 | CEC start bit maximum time setting (CEC Clock Cycles). Not used when Start Bit Error Detection and restart Rx on Error are not enabled. |
Logical Zero Low Min Time | CEC reception logical zero minimum low width setting must be a positive integer. | 64 | CEC reception logical zero minimum low width setting (CEC Clock Cycles). |
Logical Zero Low Max Time | CEC reception locical zero maximum low width setting must be a positive integer. | 83 | CEC reception logical zero maximum low width setting (CEC Clock Cycles). |
Logical One Low Min Time | CEC reception logical one minimum low width setting must be a positive integer. | 20 | CEC reception logical one minimum low width setting (CEC Clock Cycles). |
Logical One Low Max Time | CEC reception logical one maximum low width setting must be a positive integer. | 39 | CEC reception logical one maximum low width (CEC Clock Cycles). |
Overall Bit Width Min Time | CEC reception overall minimum bit width setting must be a positive integer. | 100 | CEC reception overall minimum bit width setting (CEC Clock Cycles). |
Overall Bit Width Max Time | CEC reception overall maximum bit width setting must be a positive integer. | 134 | CEC reception overall maximum bit width setting (CEC Clock Cycles). |
Interrupts | |||
Interrupt Priority Level | MCU Specific Options | Error/Data/Message interrupt priority level. | |
Callback Function | Callback Function must be a valid C symbol | g_rm_cec0_callback | Callback function |
Communication Complete Interrupt Timing |
| After Last Frame and Signal Free Time | Communication Complete Interrupt (INTCE) Generation Timing Select |
Address Mismatch Interrupt Enable |
| Disabled | Enable to generate an interrupt when the addresses do not match. |
Data Interrupt Timing Selection |
| EOM timing (9th bit of data) | INTDA reception interrupt timing selection (EOM or ACK). |
The CEC peripheral uses the CECCLK or PCLKB as its clock source. To set the PCLKB frequency, use the Clocks tab of the RA Configuration editor.
A CEC channel uses one data pin - CECIO for data transmission and reception.
The output type for each pin should be set to n-ch open drain for most hardware designs. This can be configured in Pins tab of the RA Configuration editor by selecting the pin under Pin Selection->Ports.
The CEC standard provides 13 device addresses that may be requested based on a device's primary function. Use R_CEC_MediaInit
to request a specific address before starting communication with other devices.
Developers should be aware of the following limitations when using the CEC module:
R_CEC_MediaInit
may return FSP_ERR_IN_USE
for up to 45 milliseconds after R_CEC_Open
while the hardware initializes.This is a basic example of minimal use of the CEC in an application.
fsp_err_t R_CEC_Open | ( | cec_ctrl_t *const | p_ctrl, |
cec_cfg_t const *const | p_cfg | ||
) |
Open and configure the CEC module for operation.
Example:
FSP_SUCCESS | CEC Module opened successfully. |
FSP_ERR_ALREADY_OPEN | Driver already open. |
FSP_ERR_ASSERTION | An input argument is invalid. |
FSP_ERR_IRQ_BSP_DISABLED | Interrupts are not enabled. |
fsp_err_t R_CEC_MediaInit | ( | cec_ctrl_t *const | p_ctrl, |
cec_addr_t | local_address | ||
) |
Allocate provided CEC Local Address and Initialize the CEC module for operation.
Example:
FSP_SUCCESS | CEC Module Initialized successfully. |
FSP_ERR_ASSERTION | An input argument is invalid or callback has not been set. |
FSP_ERR_NOT_OPEN | Control block not open. |
FSP_ERR_IN_USE | HDMI CEC Bus is currently in use. Try again later. |
fsp_err_t R_CEC_Close | ( | cec_ctrl_t *const | p_ctrl | ) |
Close the CEC module.
FSP_SUCCESS | CEC Module closed successfully. |
FSP_ERR_ASSERTION | An input argument is invalid. |
fsp_err_t R_CEC_Write | ( | cec_ctrl_t *const | p_ctrl, |
cec_message_t const *const | p_message, | ||
uint32_t | message_size | ||
) |
Write data to the CEC bus. Data transmission is asynchronous. Provided message buffer should not be modified until transmission is complete.
Data Transmission follows the pattern defined be the HDMI CEC Specification:
Data | Description | Size |
---|---|---|
Start Bit | Managed by Hardware, per config | N/A |
Header Block | Source/Destination Identifier | 1 Byte |
Data Block 1 | Opcode Value (Optional) | 1 Byte |
Data Block 2 | Operands (Optional) | Variable (0-14 Bytes Typical) |
Example:
FSP_SUCCESS | Operation succeeded. |
FSP_ERR_NOT_OPEN | Control block not open. |
FSP_ERR_NOT_INITIALIZED | Module has not been successfully initialized. |
FSP_ERR_ASSERTION | An input argument is invalid. |
FSP_ERR_INVALID_SIZE | Invalid message size. |
FSP_ERR_IN_USE | HDMI CEC Bus is currently in use. Try again later. |
fsp_err_t R_CEC_StatusGet | ( | cec_ctrl_t *const | p_ctrl, |
cec_status_t *const | p_status | ||
) |
Provides the state and status information according to the provided CEC control instance.
FSP_SUCCESS | Operation succeeded. |
FSP_ERR_NOT_OPEN | Control block not open. |
FSP_ERR_ASSERTION | An input argument is invalid. |
fsp_err_t R_CEC_CallbackSet | ( | cec_ctrl_t *const | p_ctrl, |
void(*)(cec_callback_args_t *) | p_callback, | ||
void const *const | p_context, | ||
cec_callback_args_t *const | p_callback_memory | ||
) |
Updates the user callback with the option to provide memory for the callback argument structure. Implements cec_api_t::callbackSet.
FSP_SUCCESS | Callback updated successfully. |
FSP_ERR_ASSERTION | An input argument is invalid. |
FSP_ERR_NOT_OPEN | The control block has not been opened. |
FSP_ERR_NO_CALLBACK_MEMORY | p_callback is non-secure and p_callback_memory is either secure or NULL. |