RA Flexible Software Package Documentation  Release v5.6.0

 
CEC Interface

Detailed Description

Interface for CEC peripheral.

Summary

The CEC interface provides common APIs for CEC HAL drivers and supports the following features:

Data Structures

union  cec_message_t
 
struct  cec_callback_args_t
 
struct  cec_cfg_t
 
struct  cec_api_t
 
struct  cec_instance_t
 

Typedefs

typedef void cec_ctrl_t
 

Enumerations

enum  cec_addr_t
 
enum  cec_clock_source_t
 
enum  cec_state_t
 
enum  cec_error_t
 
enum  cec_event_t
 

Data Structure Documentation

◆ cec_message_t

union cec_message_t

CEC message

Data Fields
struct cec_message_t __unnamed__
uint8_t raw_data[CEC_DATA_BUFFER_LENGTH+2 *sizeof(uint8_t)] Contiguous raw data.

◆ cec_callback_args_t

struct cec_callback_args_t

CEC callback parameter definition

Data Fields
cec_event_t event Event code.
void const * p_context Context provided to user during callback.
bool addr_match Local addresss matches message destination.
uint8_t data_byte Received data byte (INTDA)
cec_status_t status CEC Module status data.
cec_error_t errors Error code bitfield.

◆ cec_cfg_t

struct cec_cfg_t

CEC Configuration

Data Fields

cec_timing_t const * bit_timing_cfg
 CEC Bit Timing Configuration.
 
uint16_t rx_data_sample_time
 Receive Data Sample Time Setting.
 
uint16_t rx_data_bit_reference_width
 Receive Data Bit Reference Width.
 
void(* p_callback )(cec_callback_args_t *p_args)
 Pointer to callback function.
 
void const * p_context
 User defined callback context.
 
uint8_t ipl
 Error/Data/Message interrupt priority level.
 
IRQn_Type error_irq
 Error IRQ number.
 
IRQn_Type data_irq
 Data IRQ number.
 
IRQn_Type msg_irq
 Communication Complete IRQ number.
 
void * p_extend
 Pointer to extended configuration structure.
 

◆ cec_api_t

struct cec_api_t

Shared Interface definition for CEC

Data Fields

fsp_err_t(* open )(cec_ctrl_t *const p_ctrl, cec_cfg_t const *const p_cfg)
 
fsp_err_t(* mediaInit )(cec_ctrl_t *const p_ctrl, cec_addr_t local_address)
 
fsp_err_t(* write )(cec_ctrl_t *const p_ctrl, cec_message_t const *const p_message, uint32_t message_size)
 
fsp_err_t(* close )(cec_ctrl_t *const p_ctrl)
 
fsp_err_t(* statusGet )(cec_ctrl_t *const p_ctrl, cec_status_t *const p_status)
 
fsp_err_t(* 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)
 

Field Documentation

◆ open

fsp_err_t(* cec_api_t::open) (cec_ctrl_t *const p_ctrl, cec_cfg_t const *const p_cfg)

Open function for CEC device

Parameters
[in,out]p_ctrlPointer to the CEC control block. Must be declared by user. Value set here.
[in]p_cfgPointer to CEC configuration structure. All elements of this structure must be set by user.

◆ mediaInit

fsp_err_t(* cec_api_t::mediaInit) (cec_ctrl_t *const p_ctrl, cec_addr_t local_address)

Initializes the CEC device. May be called any time after the CEC module has been opened. This API blocks until the device initialization procedure is complete.

Parameters
[in]p_ctrlPointer to CEC instance control block.
[out]local_addressDesired Logical address for local device.

◆ write

fsp_err_t(* cec_api_t::write) (cec_ctrl_t *const p_ctrl, cec_message_t const *const p_message, uint32_t message_size)

Write function for CEC device

Parameters
[in]p_ctrlPointer to CEC instance control block
[in]p_messageMessage data
[in]message_sizeTotal size of entire message

◆ close

fsp_err_t(* cec_api_t::close) (cec_ctrl_t *const p_ctrl)

Close function for CEC device

Parameters
[in]p_ctrlPointer to CEC instance control block
[out]p_messageMessage data

◆ statusGet

fsp_err_t(* cec_api_t::statusGet) (cec_ctrl_t *const p_ctrl, cec_status_t *const p_status)

Get CEC channel info.

Parameters
[in]p_ctrlPointer to CEC instance control block
[out]p_statusMemory address to return channel specific data to.

◆ callbackSet

fsp_err_t(* cec_api_t::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)

Specify callback function, optional context pointer and working memory pointer.

Parameters
[in]p_ctrlControl block set in cec_api_t::open call.
[in]p_callbackCallback function to register
[in]p_contextPointer to send to callback function
[in]p_callback_memoryPointer to volatile memory where callback structure cec be allocated. Callback arguments allocated here are only valid during the callback.

◆ cec_instance_t

struct cec_instance_t

This structure encompasses everything that is needed to use an instance of this interface.

Data Fields
cec_ctrl_t * p_ctrl Pointer to the control structure for this instance.
cec_cfg_t const * p_cfg Pointer to the configuration structure for this instance.
cec_api_t const * p_api Pointer to the API structure for this instance.

Typedef Documentation

◆ cec_ctrl_t

typedef void cec_ctrl_t

CEC control block. Allocate an instance specific control block to pass into the CEC API calls.

Enumeration Type Documentation

◆ cec_addr_t

enum cec_addr_t

CEC Addresses

Enumerator
CEC_ADDR_TV 

CEC Address for TV.

CEC_ADDR_RECORDING_DEVICE_1 

CEC Address for Recording Device 1.

CEC_ADDR_RECORDING_DEVICE_2 

CEC Address for Recording Devide 2.

CEC_ADDR_TUNER_1 

CEC Address for Tuner 1.

CEC_ADDR_PLAYBACK_DEVICE_1 

CEC Address for Playback Device 1.

CEC_ADDR_AUDIO_SYSTEM 

CEC Address for Audio System.

CEC_ADDR_TUNER_2 

CEC Address for Tuner 2.

CEC_ADDR_TUNER_3 

CEC Address for Tuner 3.

CEC_ADDR_PLAYBACK_DEVICE_2 

CEC Address for Playback Device 2.

CEC_ADDR_RECORDING_DEVICE_3 

CEC Address for Recording Device 3.

CEC_ADDR_TUNER_4 

CEC Address for Tuner 4.

CEC_ADDR_PLAYBACK_DEVICE_3 

CEC Address for Playback Device 3.

CEC_ADDR_SPECIFIC_USE 

CEC Address for Specific Use.

CEC_ADDR_UNREGISTERED 

CEC Address for Unregistered Devices.

CEC_ADDR_BROADCAST 

CEC Broadcast message.

◆ cec_clock_source_t

CEC Source Clock

Enumerator
CEC_CLOCK_SOURCE_PCLKB_DIV_32 

PCLKB / 32 is the source of the CEC Clock.

CEC_CLOCK_SOURCE_PCLKB_DIV_64 

PCLKB / 64 is the source of the CEC Clock.

CEC_CLOCK_SOURCE_PCLKB_DIV_128 

PCLKB / 128 is the source of the CEC Clock.

CEC_CLOCK_SOURCE_PCLKB_DIV_256 

PCLKB / 256 is the source of the CEC Clock.

CEC_CLOCK_SOURCE_PCLKB_DIV_512 

PCLKB / 512 is the source of the CEC Clock.

CEC_CLOCK_SOURCE_PCLKB_DIV_1024 

PCLKB / 1024 is the source of the CEC Clock.

CEC_CLOCK_SOURCE_CECCLK 

CECCLK is the source of the CEC Clock.

CEC_CLOCK_SOURCE_CECCLK_DIV_256 

CECCLK / 256 is the source of the CEC Clock.

◆ cec_state_t

CEC State

Enumerator
CEC_STATE_UNINIT 

Module requires initialization.

CEC_STATE_READY 

Module ready for operation.

CEC_STATE_TX_ACTIVE 

Transmit in progress, either direct or broadcast.

CEC_STATE_RX_ACTIVE 

Receive in progress, either direct or broadcast.

CEC_STATE_BUSY 

CEC Signal Free Time has not yet elapsed.

◆ cec_error_t

CEC Error Code

Enumerator
CEC_ERROR_NONE 

No errors currently active.

CEC_ERROR_OERR 

Overrun error.

CEC_ERROR_UERR 

Unterrun Error.

CEC_ERROR_ACKERR 

ACK Error.

CEC_ERROR_TERR 

Timing Error.

CEC_ERROR_TXERR 

Transmission Error.

CEC_ERROR_AERR 

Bus arbitration Loss.

CEC_ERROR_BLERR 

Bus lock error.

CEC_ERROR_ADDR 

Address allocation error.

◆ cec_event_t

CEC event codes

Enumerator
CEC_EVENT_RX_DATA 

Receive Data byte event.

CEC_EVENT_RX_COMPLETE 

Receive complete event.

CEC_EVENT_TX_COMPLETE 

Transmit complete event.

CEC_EVENT_READY 

CEC Address allocated and module is now ready.

CEC_EVENT_ERR 

Error has occurred.