CPC#
Modules#
sl_cpc_endpoint_debug_counters_t
Enumerations#
Enumeration of journal entry levels.
Enumeration representing user endpoint.
Enumeration representing the possible endpoint state.
Enumeration representing the possible configurable options for an endpoint.
Typedefs#
Functions#
PUBLIC FUNCTIONS.
Push an entry in the Journal.
Record a Journal Entry.
Print the contents of the CPC journal via the default IOStream.
Command Handler to Print the Journal Contents.
Macros#
Record a CPC journal entry.
sl cpc open endpoint flag none
sl cpc open endpoint flag disable encryption
Struct representing a core debug.
sl cpc user endpoint id end.
maximum simultaneous user endpoint.
sl cpc flag no block.
sli cpc security tag length.
sli cpc ldma desciptor max size.
sli cpc header size.
sli cpc payload crc size.
sl cpc tx payload max length.
sl cpc tx payload max lenght with security.
sl cpc transmit window min size.
sl cpc transmit window max size.
Enumeration Documentation#
sl_cpc_journal_level_t#
sl_cpc_journal_level_t
Enumeration of journal entry levels.
| Enumerator | |
|---|---|
| SL_CPC_JOURNAL_ERROR_LEVEL | |
| SL_CPC_JOURNAL_WARNING_LEVEL | |
| SL_CPC_JOURNAL_INFO_LEVEL | |
| SL_CPC_JOURNAL_DEBUG_LEVEL | |
| SL_CPC_JOURNAL_TRACE_LEVEL | |
sl_cpc_user_endpoint_id_t#
sl_cpc_user_endpoint_id_t
Enumeration representing user endpoint.
| Enumerator | |
|---|---|
| SL_CPC_ENDPOINT_USER_ID_0 | User endpoint ID 0. |
| SL_CPC_ENDPOINT_USER_ID_1 | User endpoint ID 1. |
| SL_CPC_ENDPOINT_USER_ID_2 | User endpoint ID 2. |
| SL_CPC_ENDPOINT_USER_ID_3 | User endpoint ID 3. |
| SL_CPC_ENDPOINT_USER_ID_4 | User endpoint ID 4. |
| SL_CPC_ENDPOINT_USER_ID_5 | User endpoint ID 5. |
| SL_CPC_ENDPOINT_USER_ID_6 | User endpoint ID 6. |
| SL_CPC_ENDPOINT_USER_ID_7 | User endpoint ID 7. |
| SL_CPC_ENDPOINT_USER_ID_8 | User endpoint ID 8. |
| SL_CPC_ENDPOINT_USER_ID_9 | User endpoint ID 9. |
sl_cpc_endpoint_state_t#
sl_cpc_endpoint_state_t
Enumeration representing the possible endpoint state.
| Enumerator | |
|---|---|
| SL_CPC_STATE_FREED | State freed. |
| SL_CPC_STATE_OPEN | State open. |
| SL_CPC_STATE_CLOSED | State close. |
| SL_CPC_STATE_CLOSING | State closing. |
| SL_CPC_STATE_CONNECTING | Connecting to remote's endpoint. |
| SL_CPC_STATE_CONNECTED | Connected to remote's endpoint. |
| SL_CPC_STATE_SHUTTING_DOWN | Transmissions shutting down. |
| SL_CPC_STATE_SHUTDOWN | Transmissions shutdown. |
| SL_CPC_STATE_REMOTE_SHUTDOWN | Remote transmissions shutdown. |
| SL_CPC_STATE_DISCONNECTED | Connection terminated. |
| SL_CPC_STATE_ERROR_DESTINATION_UNREACHABLE | Error state, destination unreachable. |
| SL_CPC_STATE_ERROR_SECURITY_INCIDENT | Error state, security incident. |
| SL_CPC_STATE_ERROR_FAULT | Error state, fault. |
sl_cpc_endpoint_option_t#
sl_cpc_endpoint_option_t
Enumeration representing the possible configurable options for an endpoint.
| Enumerator | |
|---|---|
| SL_CPC_ENDPOINT_ON_IFRAME_RECEIVE | Set callback for iframe received notification. |
| SL_CPC_ENDPOINT_ON_IFRAME_RECEIVE_ARG | Set callback argument for iframe received notification. |
| SL_CPC_ENDPOINT_ON_IFRAME_WRITE_COMPLETED | Set callback for write complete notification. |
| SL_CPC_ENDPOINT_ON_ERROR | Set callback for error notification. |
| SL_CPC_ENDPOINT_ON_ERROR_ARG | Set callback argument for error notification. |
| SL_CPC_ENDPOINT_ON_CONNECT | Set callback when host/primary connects to endpoint. |
| SL_CPC_ENDPOINT_ON_CONNECT_ARG | Set callback argument for connect notification. |
| SL_CPC_ENDPOINT_SHUTDOWN_TIMEOUT | Set shutdown timeout, in ticks. |
| SL_CPC_ENDPOINT_WRITE_TIMEOUT | Set the timeout time for blocking write in ticks. |
| SL_CPC_ENDPOINT_ON_UFRAME_RECEIVE | Set callback for uframe received notification. |
| SL_CPC_ENDPOINT_ON_UFRAME_RECEIVE_ARG | Set callback argument for uframe received notification. |
| SL_CPC_ENDPOINT_ON_UFRAME_WRITE_COMPLETED | Set callback for write complete notification. |
| SL_CPC_ENDPOINT_ON_FINAL | Set callback for on final notification. |
| SL_CPC_ENDPOINT_ON_FINAL_ARG | Set callback argument for on final notification. |
Typedef Documentation#
sl_cpc_on_write_completed_t#
typedef void(* sl_cpc_on_write_completed_t) (sl_cpc_user_endpoint_id_t endpoint_id, void *buffer, void *arg, sl_status_t status) )(sl_cpc_user_endpoint_id_t endpoint_id, void *buffer, void *arg, sl_status_t status)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| N/A | endpoint_id | Endpoint ID | |
| N/A | buffer | Pointer to data buffer. | |
| N/A | arg | Transaction user's argument. | |
| N/A | status | Status indicating the transaction result: SL_STATUS_OK Remote should have receive the frame SL_STATUS_TRANSMIT_INCOMPLETE Remote has not received the frame. |
Typedef for the user - supplied callback function which is called when CPC is done with the provided buffer.
The callback must be non-blocking and efficient: it should return quickly and must not perform long-running operations, busy-waiting, or blocking on RTOS primitives or slow I/O. In general, application code must not invoke CPC API functions from within this callback, unless an API is explicitly documented as safe to use from callbacks. Any substantial work, including further CPC operations, should be deferred to another execution context (for example by posting to a queue or signaling a task).
sl_cpc_on_data_reception_t#
typedef void(* sl_cpc_on_data_reception_t) (uint8_t endpoint_id, void *arg) )(uint8_t endpoint_id, void *arg)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| N/A | endpoint_id | Endpoint ID | |
| N/A | arg | User-specific argument . |
Typedef for the user - supplied callback function which is called when CPC receive data on an endpoint.
The callback must be non-blocking and efficient: it should return quickly and must not perform long-running operations, busy-waiting, or blocking on RTOS primitives or slow I/O. In general, application code must not invoke CPC API functions from within this callback, unless an API is explicitly documented as safe to use from callbacks. Any substantial work, including further CPC operations, should be deferred to another execution context (for example by posting to a queue or signaling a task).
sl_cpc_on_error_callback_t#
typedef void(* sl_cpc_on_error_callback_t) (uint8_t endpoint_id, void *arg) )(uint8_t endpoint_id, void *arg)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| N/A | endpoint_id | Endpoint ID | |
| N/A | arg | User-specific argument . |
Typedef for the user-supplied callback function which is called when CPC detects a fatal error on an endpoint.
The callback must be non-blocking and efficient: it should return quickly and must not perform long-running operations, busy-waiting, or blocking on RTOS primitives or slow I/O. In general, application code must not invoke CPC API functions from within this callback, unless an API is explicitly documented as safe to use from callbacks. Any substantial work, including further CPC operations, should be deferred to another execution context (for example by posting to a queue or signaling a task).
sl_cpc_on_connect_callback_t#
typedef void(* sl_cpc_on_connect_callback_t) (uint8_t endpoint_id, void *arg, sl_status_t status) )(uint8_t endpoint_id, void *arg, sl_status_t status)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| N/A | endpoint_id | Endpoint ID | |
| N/A | arg | User-specific argument. | |
| N/A | status | Indicate if the connection was successful or not: SL_STATUS_OK successfully connected SL_STATUS_TIMEOUT operation timed out SL_STATUS_NOT_READY secondary's endpoint is not ready |
Typedef for the user-supplied callback function which is called when CPC connection to a secondary completes, successfully or not.
The callback must be non-blocking and efficient: it should return quickly and must not perform long-running operations, busy-waiting, or blocking on RTOS primitives or slow I/O. In general, application code must not invoke CPC API functions from within this callback, unless an API is explicitly documented as safe to use from callbacks. Any substantial work, including further CPC operations, should be deferred to another execution context (for example by posting to a queue or signaling a task).
Note
If several users connect to the same endpoint on the host side, this callback will only be called only when the first connection occurs.
Function Documentation#
sl_cpc_secondary_app_version#
const char * sl_cpc_secondary_app_version (void )
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
Called when secondary app version is requested. The format is up to the user. The string should be null terminated.
sl_cpc_primary_app_version#
const char * sl_cpc_primary_app_version (void )
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
Called when primary app version is requested. The format is up to the user. The string should be null terminated.
Note
: CPC source code contains a weak definition that default to returning "UNDEFINED". If the user provides a strong definition of this function, the user shall return a static string.
Returns
: String that represents the application version.
Called when primary app version is requested. The format is up to the user. The string should be null terminated.
sl_cpc_user_is_ok_to_run#
bool sl_cpc_user_is_ok_to_run (const char * primary_app_version, const char * secondary_app_version)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| const char * | N/A | primary_app_version | |
| const char * | N/A | secondary_app_version |
Callback implemented by the user to verify if the secondary application version is compatible with this primary version.
Note
: If this function is not implemented, then no version check will be performed and CPC API will always be available after the startup sequence.
: The function prototype is declared as weak. No default weak definition exist.
Returns
bool : true : CPC is authorized to start normally false : The user decided that the application versions are not compatible. CPC API will be blocked and only a firmware upgrade will be possible
sl_cpc_get_fwu_chunk#
sl_status_t sl_cpc_get_fwu_chunk (uint8_t *const chunk_buffer, const size_t index, const size_t chunk_size, size_t * size, bool * last)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| uint8_t *const | [in] | chunk_buffer | : 128 bytes buffer into which the user must copy the chunk |
| const size_t | [in] | index | : The byte index of the chunk being requested. When the FWU starts, the index starts at 0 and will increment by 128 (chunk size) after each time the user submits a chunk. |
| const size_t | [in] | chunk_size | : This will always be 128 (chunk size) and is the number of bytes the user must copy into the chunk_buffer. The only exception is for the last chunk; if the last chunk is less than 128 bytes, then the user must copy the the remaining bytes and return the size of the last chunk in the 'size' out parameter. |
| size_t * | [out] | size | : This is the number of bytes the user has copied into the chunk buffer. For all chunks except the last one, this value is expected to be 128 bytes, and some value between 1-128 for the last chunk. |
| bool * | [out] | last | : false if the chunk is not the last chunk. The firmware update state machine will continue fetching chunks from the user as long as the user does not return true on the last chunk. |
Fetch the next firmware update image chunk from the user.
Note
: The prototype is declared as weak and no weak definition exist in CPC code. Not providing an implementation by the user is valid, although if the user asks to perform a firmware upgrade, sl_firmware_upgrade_start() will return SL_STATUS_NOT_AVAILABLE
Returns
sl_status_t : Whether or not the user has written a valid chunk. In the case where the user does not have the requested chunk in hand when this function is called and does not want to block (for example, fetching is from a serial link or an external storage), SL_STATUS_NOT_READY would be returned. The firmware update state machine will retry later to ask the user for the chunk. The index will remain the same at the next call. When a value of SL_STATUS_OK is returned, the state machine will go ahead and send the chunk to the secondary.
sl_cpc_journal_init#
void sl_cpc_journal_init (void )
PUBLIC FUNCTIONS.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
Initialize the CPC Journal Module.
This function sets up the journal's circular buffers and configures the maximum number of entries. The journal supports four log levels: Error, Warning, Info, and Debug.
Note
To prevent overwriting critical log entries, Debug logs are stored in a separate circular buffer.
sl_cpc_journal_record_internal#
void sl_cpc_journal_record_internal (sl_cpc_journal_level_t level, const char * string, uint32_t value)
Push an entry in the Journal.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_cpc_journal_level_t | [in] | level | The level of the entry (Error, Warning, Info, Debug). |
| const char * | [in] | string | The message string to log. |
| uint32_t | [in] | value | The value associated with the message. |
This function logs a journal entry with a specified severity level, message string, and associated value.
sl_cpc_journal_record#
static void sl_cpc_journal_record (sl_cpc_journal_level_t level, const char * string, uint32_t value)
Record a Journal Entry.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_cpc_journal_level_t | [in] | level | The level of the entry (Error, Warning, Info, Debug). |
| const char * | [in] | string | The message string to log. |
| uint32_t | [in] | value | The value associated with the message. |
Note
If the provided journal level is superior to the configured max level, the journal entry will be ignored.
sl_cpc_journal_print#
void sl_cpc_journal_print (bool print_csv_header, sl_iostream_t * stream)
Print the contents of the CPC journal via the default IOStream.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| bool | [in] | print_csv_header | Whether to print a CSV header. |
| sl_iostream_t * | [in] | stream | The IOStream used to print the journal entries. |
Note
Journal entries will be consumed when called
sl_cpc_journal_print_cmd_handler#
void sl_cpc_journal_print_cmd_handler (sl_cli_command_arg_t * arguments)
Command Handler to Print the Journal Contents.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_cli_command_arg_t * | [in] | arguments | CLI arguments. |
This function handles a command to print the contents of the CPC journal.
Note
Journal entries will be consumed when this function is called.
sl_cpc_init#
sl_status_t sl_cpc_init (void )
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
Initialize CPC module.
Initialize CPC module.
sl_cpc_init_permanent_allocations#
sl_status_t sl_cpc_init_permanent_allocations (void )
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
Initialize and allocate permanent memory for CPC
Initialize permanent memory for CPC
sl_cpc_process_action#
void sl_cpc_process_action (void )
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
The bare metal process action function.
Tick step function, iterate over all instances and process them one by one.
sl_cpc_init_user_endpoint#
sl_status_t sl_cpc_init_user_endpoint (sl_cpc_endpoint_handle_t * endpoint_handle, sl_cpc_user_endpoint_id_t id, uint8_t flags)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_cpc_endpoint_handle_t * | [inout] | endpoint_handle | Endpoint handle. |
| sl_cpc_user_endpoint_id_t | [in] | id | Endpoint ID [90 to 99]. |
| uint8_t | [in] | flags | Initialization flags. Reserved for future used |
Dynamically allocate and initialize a user endpoint. Following the successful initialization of an endpoint, successive attempts to initialize an endpoint of the same ID will fail until the endpoint is freed.
Initialize a CPC user endpoint
sl_cpc_connect_endpoint#
sl_status_t sl_cpc_connect_endpoint (sl_cpc_endpoint_handle_t * endpoint_handle, uint8_t flags)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_cpc_endpoint_handle_t * | [in] | endpoint_handle | Endpoint handle. |
| uint8_t | [in] | flags | Optional flags: SL_CPC_FLAG_NO_BLOCK Cause the function to return SL_STATUS_IN_PROGRESS immediately in RTOS. |
Connect endpoint to remote. (CPC Primary only)
When an RTOS is present and no flag is specified, this function will block until the remote connects. In baremetal this function will return immediately.
sl_cpc_open_user_endpoint#
sl_status_t sl_cpc_open_user_endpoint (sl_cpc_endpoint_handle_t * endpoint_handle, sl_cpc_user_endpoint_id_t id, uint8_t flags, uint8_t tx_window_size)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_cpc_endpoint_handle_t * | [in] | endpoint_handle | Endpoint handle. |
| sl_cpc_user_endpoint_id_t | [in] | id | Endpoint ID [90 to 99]. |
| uint8_t | [in] | flags | Endpoint type flags. SL_CPC_OPEN_ENDPOINT_FLAG_NONE Default behaviors SL_CPC_OPEN_ENDPOINT_FLAG_DISABLE_ENCRYPTION Disable encryption on the endpoint |
| uint8_t | [in] | tx_window_size | The maximum number of packets that can be sent before waiting for an acknowledge from the primary. Currently, only a value of 1 is supported. |
Dynamically allocate and open a user endpoint.
Note
This function will be deprecated in the future. Use
sl_cpc_init_user_endpoint()andsl_cpc_listen_endpoint()instead.
sl_cpc_listen_endpoint#
sl_status_t sl_cpc_listen_endpoint (sl_cpc_endpoint_handle_t * endpoint_handle, uint8_t flags)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_cpc_endpoint_handle_t * | [in] | endpoint_handle | Endpoint handle. |
| uint8_t | [in] | flags | Optional flags: SL_CPC_FLAG_NO_BLOCK Cause the function to return SL_STATUS_IN_PROGRESS immediately in RTOS. |
Put an endpoint in listening mode, waiting for the remote to connect to it.
When an RTOS is present and no flag is specified, this function will block until the remote connects. In baremetal this function will return immediately.
sl_cpc_close_endpoint#
sl_status_t sl_cpc_close_endpoint (sl_cpc_endpoint_handle_t * endpoint_handle)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_cpc_endpoint_handle_t * | [in] | endpoint_handle | Endpoint handle. |
Close endpoint.
Note
This function will be deprecated in the future. Use
sl_cpc_terminate_endpoint()andsl_cpc_free_endpoint()instead.
sl_cpc_set_endpoint_option#
sl_status_t sl_cpc_set_endpoint_option (sl_cpc_endpoint_handle_t * endpoint_handle, sl_cpc_endpoint_option_t option, void * value)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_cpc_endpoint_handle_t * | [in] | endpoint_handle | Endpoint handle. |
| sl_cpc_endpoint_option_t | [in] | option | Endpoint Option. |
| void * | [in] | value | Pointer to the option value. |
Set endpoint option.
Returns
Status code.
Return values
SL_STATUS_OK: Set endpoint option successfully.
Other: sl_status_t if error occurred.
Note
Public options are: SL_CPC_ENDPOINT_NAME: Set endpoint name.
valuemust be a null-terminated string. The string is not copied, only the pointer. Caller must make sure the string is persistent for the lifetime of the endpoint.
SL_CPC_ENDPOINT_ON_CONNECT: Set a callback that will be called when connection is established with the remote.
SL_CPC_ENDPOINT_ON_CONNECT_ARG: Set an on connect argument.
SL_CPC_ENDPOINT_ON_IFRAME_RECEIVE: Set an on iframe receive callback. value is a sl_cpc_on_data_reception_t type.
SL_CPC_ENDPOINT_ON_IFRAME_RECEIVE_ARG: Set an on iframe receive argument.
SL_CPC_ENDPOINT_ON_IFRAME_WRITE_COMPLETED: Set an on iframe write completed callback. value is a sl_cpc_on_write_completed_t type.
SL_CPC_ENDPOINT_ON_ERROR: Set an on error callback. value is a sl_cpc_on_error_callback_t type.
SL_CPC_ENDPOINT_ON_ERROR_ARG: Set an on error callback argument.
SL_CPC_ENDPOINT_SHUTDOWN_TIMEOUT: (RTOS Only) Set shutdown handshake timeout, in ticks.
SL_CPC_ENDPOINT_WRITE_TIMEOUT: (RTOS Only) Set the timeout time for blocking write in ticks.
Set endpoint option
sl_cpc_shutdown_endpoint#
sl_status_t sl_cpc_shutdown_endpoint (sl_cpc_endpoint_handle_t * endpoint_handle, uint8_t flags)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_cpc_endpoint_handle_t * | [in] | endpoint_handle | Endpoint handle. |
| uint8_t | [in] | flags | Optional flags: SL_CPC_FLAG_NO_BLOCK Cause the function to return SL_STATUS_IN_PROGRESS immediately in RTOS data still pending TX. |
Shutdown endpoint connection. Any pending TX frame will attempt to be transmitted.
Note
In RTOS, this function is blocking by default. Use the SL_CPC_FLAG_NO_BLOCK flag to execute without blocking.
Shutdown endpoint's connection
sl_cpc_terminate_endpoint#
sl_status_t sl_cpc_terminate_endpoint (sl_cpc_endpoint_handle_t * endpoint_handle, uint8_t flags)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_cpc_endpoint_handle_t * | [in] | endpoint_handle | Endpoint handle. |
| uint8_t | [in] | flags | Termination flags. Reserved for future use |
Terminate an endpoint, effectively dropping any pending TX and RX frame.
In RTOS, this function will always block until all frames have been dropped.
Note
This function must be called before attempting to reconnect an endpoint to the remote.
Terminate endpoint
sl_cpc_free_endpoint#
sl_status_t sl_cpc_free_endpoint (sl_cpc_endpoint_handle_t * endpoint_handle)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_cpc_endpoint_handle_t * | [in] | endpoint_handle | Endpoint handle. |
Free the memory associated to an endpoint so it can be reused.
Free endpoint
sl_cpc_abort_read#
sl_status_t sl_cpc_abort_read (sl_cpc_endpoint_handle_t * endpoint_handle)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_cpc_endpoint_handle_t * | [in] | endpoint_handle | Endpoint handle. |
Abort read; Allow unblocking task in blocked by a read.
Note
This function can be called from an ISR.
sl_cpc_read#
sl_status_t sl_cpc_read (sl_cpc_endpoint_handle_t * endpoint_handle, void ** data, uint16_t * data_length, uint32_t timeout, uint8_t flags)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_cpc_endpoint_handle_t * | [in] | endpoint_handle | Endpoint handle. |
| void ** | [out] | data | Address of the variable that will receive the data pointer. |
| uint16_t * | [out] | data_length | Length of the data contained in the buffer. |
| uint32_t | [in] | timeout | Timeout in ticks for the read operation. (Requires RTOS). Note: No effect if SL_CPC_FLAG_NO_BLOCK is provided as a flag |
| uint8_t | [in] | flags | Optional flags: SL_CPC_FLAG_NO_BLOCK Cause the function to return SL_STATUS_EMPTY immediately in RTOS if no data available. |
Read data.
Read data from an endpoint
sl_cpc_write#
sl_status_t sl_cpc_write (sl_cpc_endpoint_handle_t * endpoint_handle, void * data, uint16_t data_length, uint8_t flags, void * on_write_completed_arg)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_cpc_endpoint_handle_t * | [in] | endpoint_handle | Endpoint handle. |
| void * | [in] | data | Pointer to data buffer. |
| uint16_t | [in] | data_length | Length of the data contained in the buffer. |
| uint8_t | [in] | flags | Optional flags: SL_CPC_FLAG_NO_BLOCK Cause the function to return SL_STATUS_NO_MORE_RESOURCE immediately in RTOS when out of resources. |
| void * | [in] | on_write_completed_arg | Argument that will be passed to on_write_completed(). |
Write data.
Note
This function cannot be called from an ISR.
When the write buffer is encrypted, the original content is lost and replaced by its encrypted counterpart.
Write data from an endpoint
sl_cpc_get_endpoint_state#
sl_cpc_endpoint_state_t sl_cpc_get_endpoint_state (sl_cpc_endpoint_handle_t * endpoint_handle)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_cpc_endpoint_handle_t * | [in] | endpoint_handle | Endpoint handle. |
Get endpoint state.
Returns
Endpoint state.
Get endpoint status
sl_cpc_get_endpoint_encryption#
bool sl_cpc_get_endpoint_encryption (sl_cpc_endpoint_handle_t * endpoint_handle)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_cpc_endpoint_handle_t * | [in] | endpoint_handle | Endpoint handle. |
Get endpoint encryption state.
Returns
Endpoint encryption state.
Get endpoint encryption
sl_cpc_free_rx_buffer#
sl_status_t sl_cpc_free_rx_buffer (void * data)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void * | [in] | data | Pointer to data buffer to free. |
Free buffer returned by sl_cpc_read().
Free rx buffer returned by sl_cpc_read().
sl_cpc_get_tx_max_payload_length#
uint16_t sl_cpc_get_tx_max_payload_length (sl_cpc_endpoint_handle_t * endpoint_handle)
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_cpc_endpoint_handle_t * | N/A | endpoint_handle | handle of the endpoint for which the query is made |
Get the maximum payload length that the remote can receive.
Returns
the maximum tx payload length in function of whether the encryption is enabled on the endpoint or not
Retrieve the maximum payload length that can be transmitted
Returns
the maximum tx payload length in function of whether the encryption is enabled on the endpoint or not
sl_cpc_is_ok_to_sleep#
bool sl_cpc_is_ok_to_sleep (void )
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
sl_cpc_sleep_on_isr_exit#
sl_power_manager_on_isr_exit_t sl_cpc_sleep_on_isr_exit (void )
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |