CPC#

Modules#

sl_cpc_endpoint_handle_t

sl_cpc_endpoint_debug_counters_t

sl_cpc_core_debug_counters_t

Enumerations#

enum
SL_CPC_JOURNAL_ERROR_LEVEL = 1
SL_CPC_JOURNAL_WARNING_LEVEL = 2
SL_CPC_JOURNAL_INFO_LEVEL = 3
SL_CPC_JOURNAL_DEBUG_LEVEL = 4
SL_CPC_JOURNAL_TRACE_LEVEL = 5
}

Enumeration of journal entry levels.

enum
SL_CPC_ENDPOINT_USER_ID_0 = 90
SL_CPC_ENDPOINT_USER_ID_1 = 91
SL_CPC_ENDPOINT_USER_ID_2 = 92
SL_CPC_ENDPOINT_USER_ID_3 = 93
SL_CPC_ENDPOINT_USER_ID_4 = 94
SL_CPC_ENDPOINT_USER_ID_5 = 95
SL_CPC_ENDPOINT_USER_ID_6 = 96
SL_CPC_ENDPOINT_USER_ID_7 = 97
SL_CPC_ENDPOINT_USER_ID_8 = 98
SL_CPC_ENDPOINT_USER_ID_9 = 99
}

Enumeration representing user endpoint.

enum
SL_CPC_STATE_FREED = 0
SL_CPC_STATE_OPEN
SL_CPC_STATE_CLOSED
SL_CPC_STATE_CLOSING
SL_CPC_STATE_CONNECTING
SL_CPC_STATE_CONNECTED
SL_CPC_STATE_SHUTTING_DOWN
SL_CPC_STATE_SHUTDOWN
SL_CPC_STATE_REMOTE_SHUTDOWN
SL_CPC_STATE_DISCONNECTED
SL_CPC_STATE_ERROR_DESTINATION_UNREACHABLE
SL_CPC_STATE_ERROR_SECURITY_INCIDENT
SL_CPC_STATE_ERROR_FAULT
}

Enumeration representing the possible endpoint state.

enum
SL_CPC_ENDPOINT_ON_IFRAME_RECEIVE = 0
SL_CPC_ENDPOINT_ON_IFRAME_RECEIVE_ARG
SL_CPC_ENDPOINT_ON_IFRAME_WRITE_COMPLETED
SL_CPC_ENDPOINT_ON_ERROR
SL_CPC_ENDPOINT_ON_ERROR_ARG
SL_CPC_ENDPOINT_ON_CONNECT
SL_CPC_ENDPOINT_ON_CONNECT_ARG
SL_CPC_ENDPOINT_SHUTDOWN_TIMEOUT
SL_CPC_ENDPOINT_WRITE_TIMEOUT
SL_CPC_ENDPOINT_ON_UFRAME_RECEIVE
SL_CPC_ENDPOINT_ON_UFRAME_RECEIVE_ARG
SL_CPC_ENDPOINT_ON_UFRAME_WRITE_COMPLETED
SL_CPC_ENDPOINT_ON_FINAL
SL_CPC_ENDPOINT_ON_FINAL_ARG
}

Enumeration representing the possible configurable options for an endpoint.

Typedefs#

typedef void(*
sl_cpc_on_write_completed_t)(sl_cpc_user_endpoint_id_t endpoint_id, void *buffer, void *arg, sl_status_t status)

Typedef for the user - supplied callback function which is called when CPC is done with the provided buffer.

typedef void(*
sl_cpc_on_data_reception_t)(uint8_t endpoint_id, void *arg)

Typedef for the user - supplied callback function which is called when CPC receive data on an endpoint.

typedef void(*
sl_cpc_on_error_callback_t)(uint8_t endpoint_id, void *arg)

Typedef for the user-supplied callback function which is called when CPC detects a fatal error on an endpoint.

typedef void(*
sl_cpc_on_connect_callback_t)(uint8_t endpoint_id, void *arg, sl_status_t status)

Typedef for the user-supplied callback function which is called when CPC connection to a secondary completes, successfully or not.

Functions#

const char *

Called when secondary app version is requested.

const char *

Called when primary app version is requested.

bool
sl_cpc_user_is_ok_to_run(const char *primary_app_version, const char *secondary_app_version)

Callback implemented by the user to verify if the secondary application version is compatible with this primary version.

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)

Fetch the next firmware update image chunk from the user.

void

Initialize the CPC journal module.

void
sl_cpc_journal_print(bool print_csv_header, sl_iostream_t *stream)

Print the contents of the CPC journal via the default IOStream.

void
sl_cpc_journal_record(sl_cpc_journal_level_t level, const char *string, uint32_t value)

Record a journal entry.

void
sl_cpc_journal_print_cmd_handler(sl_cli_command_arg_t *arguments)

Command handler to print the contents of the journal.

sl_status_t

Initialize CPC module.

void

The bare metal process action function.

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)

Dynamically allocate and initialize a user endpoint.

sl_status_t
sl_cpc_connect_endpoint(sl_cpc_endpoint_handle_t *endpoint_handle, uint8_t flags)

Connect endpoint to remote.

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)

Dynamically allocate and open a user endpoint.

sl_status_t
sl_cpc_listen_endpoint(sl_cpc_endpoint_handle_t *endpoint_handle, uint8_t flags)

Put an endpoint in listening mode, waiting for the remote to connect to it.

sl_status_t
sl_cpc_close_endpoint(sl_cpc_endpoint_handle_t *endpoint_handle)

Close endpoint.

sl_status_t
sl_cpc_set_endpoint_option(sl_cpc_endpoint_handle_t *endpoint_handle, sl_cpc_endpoint_option_t option, void *value)

Set endpoint option.

sl_status_t
sl_cpc_shutdown_endpoint(sl_cpc_endpoint_handle_t *endpoint_handle, uint8_t flags)

Shutdown endpoint connection.

sl_status_t
sl_cpc_terminate_endpoint(sl_cpc_endpoint_handle_t *endpoint_handle, uint8_t flags)

Terminate an endpoint, effectively dropping any pending TX and RX frame.

sl_status_t
sl_cpc_free_endpoint(sl_cpc_endpoint_handle_t *endpoint_handle)

Free the memory associated to an endpoint so it can be reused.

sl_status_t
sl_cpc_abort_read(sl_cpc_endpoint_handle_t *endpoint_handle)

Abort read; Allow unblocking task in blocked by a 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)

Read data.

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)

Write data.

sl_cpc_get_endpoint_state(sl_cpc_endpoint_handle_t *endpoint_handle)

Get endpoint state.

bool
sl_cpc_get_endpoint_encryption(sl_cpc_endpoint_handle_t *endpoint_handle)

Get endpoint encryption state.

sl_status_t

Free buffer returned by sl_cpc_read().

uint16_t
sl_cpc_get_tx_max_payload_length(sl_cpc_endpoint_handle_t *endpoint_handle)

Get the maximum payload length that the remote can receive.

sl_power_manager_on_isr_exit_t

Macros#

#define

Record a CPC journal entry.

#define
#define
#define
#define
#define

sl cpc open endpoint flag none

#define

sl cpc open endpoint flag disable encryption

#define
SL_CPC_OPEN_ENDPOINT_FLAG_NONE SL_CPC_ENDPOINT_FLAG_NONE
#define
SL_CPC_OPEN_ENDPOINT_FLAG_DISABLE_ENCRYPTION SL_CPC_ENDPOINT_FLAG_DISABLE_ENCRYPTION
#define
SL_CPC_USER_ENDPOINT_ID_START ((uint8_t)SL_CPC_ENDPOINT_USER_ID_0)

Struct representing a core debug.

#define
SL_CPC_USER_ENDPOINT_ID_END ((uint8_t)SL_CPC_ENDPOINT_USER_ID_9)

sl cpc user endpoint id end.

#define
SL_CPC_USER_ENDPOINT_MAX_COUNT (SL_CPC_USER_ENDPOINT_ID_END - SL_CPC_USER_ENDPOINT_ID_START + 1)

maximum simultaneous user endpoint.

#define

sl cpc flag no block.

#define

sli cpc security tag length.

#define

sli cpc ldma desciptor max size.

#define

sli cpc header size.

#define

sli cpc payload crc size.

#define
SL_CPC_TX_PAYLOAD_MAX_LENGTH ((2 * SLI_CPC_LDMA_DESCRIPTOR_MAX_SIZE) - SLI_CPC_HEADER_SIZE - SLI_CPC_PAYLOAD_CRC_SIZE)

sl cpc tx payload max length.

#define
SL_CPC_TX_PAYLOAD_MAX_LENGTH_WITH_SECURITY (SL_CPC_TX_PAYLOAD_MAX_LENGTH - SLI_CPC_SECURITY_TAG_LENGTH)

sl cpc tx payload max lenght with security.

#define

sl cpc transmit window min size.

#define

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

Definition at line 70 of file platform/service/cpc/inc/sl_cpc_journal.h

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.


Definition at line 78 of file platform/service/cpc/inc/sl_cpc.h

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.


Definition at line 92 of file platform/service/cpc/inc/sl_cpc.h

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.


Definition at line 109 of file platform/service/cpc/inc/sl_cpc.h

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)

Typedef for the user - supplied callback function which is called when CPC is done with the provided buffer.

Parameters
N/Aendpoint_id

Endpoint ID

N/Abuffer

Pointer to data buffer.

N/Aarg

Transaction user's argument.

N/Astatus

Status indicating the transaction result: SL_STATUS_OK Remote should have receive the frame SL_STATUS_TRANSMIT_INCOMPLETE Remote has not received the frame.


Definition at line 153 of file platform/service/cpc/inc/sl_cpc.h

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)

Typedef for the user - supplied callback function which is called when CPC receive data on an endpoint.

Parameters
N/Aendpoint_id

Endpoint ID

N/Aarg

User-specific argument .


Definition at line 166 of file platform/service/cpc/inc/sl_cpc.h

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)

Typedef for the user-supplied callback function which is called when CPC detects a fatal error on an endpoint.

Parameters
N/Aendpoint_id

Endpoint ID

N/Aarg

User-specific argument .


Definition at line 176 of file platform/service/cpc/inc/sl_cpc.h

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)

Typedef for the user-supplied callback function which is called when CPC connection to a secondary completes, successfully or not.

Parameters
N/Aendpoint_id

Endpoint ID

N/Aarg

User-specific argument.

N/Astatus

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

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.


Definition at line 194 of file platform/service/cpc/inc/sl_cpc.h

Function Documentation#

sl_cpc_secondary_app_version#

const char * sl_cpc_secondary_app_version (void )

Called when secondary app version is requested.

Parameters
N/A

The format is up to the user. The string should be null terminated.


Definition at line 57 of file platform/service/cpc/inc/sl_cpc_weak_prototypes.h

sl_cpc_primary_app_version#

const char * sl_cpc_primary_app_version (void )

Called when primary app version is requested.

Parameters
N/A

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.


Definition at line 72 of file platform/service/cpc/inc/sl_cpc_weak_prototypes.h

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)

Callback implemented by the user to verify if the secondary application version is compatible with this primary version.

Parameters
N/Aprimary_app_version
N/Asecondary_app_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


Definition at line 88 of file platform/service/cpc/inc/sl_cpc_weak_prototypes.h

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)

Fetch the next firmware update image chunk from the user.

Parameters
[in]chunk_buffer

: 128 bytes buffer into which the user must copy the chunk

[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.

[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.

[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.

[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.

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.


Definition at line 120 of file platform/service/cpc/inc/sl_cpc_weak_prototypes.h

sl_cpc_journal_init#

void sl_cpc_journal_init (void )

Initialize the CPC journal module.

Parameters
N/A

Definition at line 81 of file platform/service/cpc/inc/sl_cpc_journal.h

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.

Parameters
[in]print_csv_header

Whether to print a CSV header.

[in]stream

The IOStream used to print the journal entries.

Note

  • Journal entries will be consumed when called


Definition at line 93 of file platform/service/cpc/inc/sl_cpc_journal.h

sl_cpc_journal_record#

void sl_cpc_journal_record (sl_cpc_journal_level_t level, const char * string, uint32_t value)

Record a journal entry.

Parameters
[in]level

The severity level of the entry.

[in]string

The message string to log.

[in]value

The value associated with the message.


Definition at line 103 of file platform/service/cpc/inc/sl_cpc_journal.h

sl_cpc_journal_print_cmd_handler#

void sl_cpc_journal_print_cmd_handler (sl_cli_command_arg_t * arguments)

Command handler to print the contents of the journal.

Parameters
[in]arguments

CLI arguments.

Note

  • Journal entries will be consumed when called


Definition at line 113 of file platform/service/cpc/inc/sl_cpc_journal.h

sl_cpc_init#

sl_status_t sl_cpc_init (void )

Initialize CPC module.

Parameters
N/A

Definition at line 302 of file platform/service/cpc/inc/sl_cpc.h

sl_cpc_process_action#

void sl_cpc_process_action (void )

The bare metal process action function.

Parameters
N/A

Definition at line 308 of file platform/service/cpc/inc/sl_cpc.h

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)

Dynamically allocate and initialize a user endpoint.

Parameters
[inout]endpoint_handle

Endpoint handle.

[in]id

Endpoint ID [90 to 99].

[in]flags

Initialization flags. Reserved for future used

Following the successful initialization of an endpoint, successive attempts to initialize an endpoint of the same ID will fail until the endpoint is freed.


Definition at line 325 of file platform/service/cpc/inc/sl_cpc.h

sl_cpc_connect_endpoint#

sl_status_t sl_cpc_connect_endpoint (sl_cpc_endpoint_handle_t * endpoint_handle, uint8_t flags)

Connect endpoint to remote.

Parameters
[in]endpoint_handle

Endpoint handle.

[in]flags

Optional flags: SL_CPC_FLAG_NO_BLOCK Cause the function to return SL_STATUS_IN_PROGRESS immediately in RTOS.

(CPC Primary only) Ths function will always block until the remote connects if no flag is specified.


Definition at line 344 of file platform/service/cpc/inc/sl_cpc.h

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)

Dynamically allocate and open a user endpoint.

Parameters
[in]endpoint_handle

Endpoint handle.

[in]id

Endpoint ID [90 to 99].

[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

[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.

Note

  • This function will be deprecated in the future. Use sl_cpc_init_user_endpoint() and sl_cpc_listen_endpoint() instead.


Definition at line 369 of file platform/service/cpc/inc/sl_cpc.h

sl_cpc_listen_endpoint#

sl_status_t sl_cpc_listen_endpoint (sl_cpc_endpoint_handle_t * endpoint_handle, uint8_t flags)

Put an endpoint in listening mode, waiting for the remote to connect to it.

Parameters
[in]endpoint_handle

Endpoint handle.

[in]flags

Optional flags: SL_CPC_FLAG_NO_BLOCK Cause the function to return SL_STATUS_IN_PROGRESS immediately in RTOS.

This function will always block until the remote connects if no flag is specified.


Definition at line 387 of file platform/service/cpc/inc/sl_cpc.h

sl_cpc_close_endpoint#

sl_status_t sl_cpc_close_endpoint (sl_cpc_endpoint_handle_t * endpoint_handle)

Close endpoint.

Parameters
[in]endpoint_handle

Endpoint handle.

Note

  • This function will be deprecated in the future. Use sl_cpc_terminate_endpoint() and sl_cpc_free_endpoint() instead.


Definition at line 400 of file platform/service/cpc/inc/sl_cpc.h

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)

Set endpoint option.

Parameters
[in]endpoint_handle

Endpoint handle.

[in]option

Endpoint Option.

[in]value

Pointer to the option value.

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_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.


Definition at line 443 of file platform/service/cpc/inc/sl_cpc.h

sl_cpc_shutdown_endpoint#

sl_status_t sl_cpc_shutdown_endpoint (sl_cpc_endpoint_handle_t * endpoint_handle, uint8_t flags)

Shutdown endpoint connection.

Parameters
[in]endpoint_handle

Endpoint handle.

[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.

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.


Definition at line 462 of file platform/service/cpc/inc/sl_cpc.h

sl_cpc_terminate_endpoint#

sl_status_t sl_cpc_terminate_endpoint (sl_cpc_endpoint_handle_t * endpoint_handle, uint8_t flags)

Terminate an endpoint, effectively dropping any pending TX and RX frame.

Parameters
[in]endpoint_handle

Endpoint handle.

[in]flags

Termination flags. Reserved for future use

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.


Definition at line 482 of file platform/service/cpc/inc/sl_cpc.h

sl_cpc_free_endpoint#

sl_status_t sl_cpc_free_endpoint (sl_cpc_endpoint_handle_t * endpoint_handle)

Free the memory associated to an endpoint so it can be reused.

Parameters
[in]endpoint_handle

Endpoint handle.


Definition at line 494 of file platform/service/cpc/inc/sl_cpc.h

sl_cpc_abort_read#

sl_status_t sl_cpc_abort_read (sl_cpc_endpoint_handle_t * endpoint_handle)

Abort read; Allow unblocking task in blocked by a read.

Parameters
[in]endpoint_handle

Endpoint handle.

Note

  • This function can be called from an ISR.


Definition at line 507 of file platform/service/cpc/inc/sl_cpc.h

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)

Read data.

Parameters
[in]endpoint_handle

Endpoint handle.

[out]data

Address of the variable that will receive the data pointer.

[out]data_length

Length of the data contained in the buffer.

[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

[in]flags

Optional flags: SL_CPC_FLAG_NO_BLOCK Cause the function to return SL_STATUS_EMPTY immediately in RTOS if no data available.


Definition at line 525 of file platform/service/cpc/inc/sl_cpc.h

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)

Write data.

Parameters
[in]endpoint_handle

Endpoint handle.

[in]data

Pointer to data buffer.

[in]data_length

Length of the data contained in the buffer.

[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.

[in]on_write_completed_arg

Argument that will be passed to on_write_completed().

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.


Definition at line 550 of file platform/service/cpc/inc/sl_cpc.h

sl_cpc_get_endpoint_state#

sl_cpc_endpoint_state_t sl_cpc_get_endpoint_state (sl_cpc_endpoint_handle_t * endpoint_handle)

Get endpoint state.

Parameters
[in]endpoint_handle

Endpoint handle.

Returns

  • Endpoint state.


Definition at line 563 of file platform/service/cpc/inc/sl_cpc.h

sl_cpc_get_endpoint_encryption#

bool sl_cpc_get_endpoint_encryption (sl_cpc_endpoint_handle_t * endpoint_handle)

Get endpoint encryption state.

Parameters
[in]endpoint_handle

Endpoint handle.

Returns

  • Endpoint encryption state.


Definition at line 572 of file platform/service/cpc/inc/sl_cpc.h

sl_cpc_free_rx_buffer#

sl_status_t sl_cpc_free_rx_buffer (void * data)

Free buffer returned by sl_cpc_read().

Parameters
[in]data

Pointer to data buffer to free.


Definition at line 582 of file platform/service/cpc/inc/sl_cpc.h

sl_cpc_get_tx_max_payload_length#

uint16_t sl_cpc_get_tx_max_payload_length (sl_cpc_endpoint_handle_t * endpoint_handle)

Get the maximum payload length that the remote can receive.

Parameters
[in]endpoint_handle

Endpoint handle.

Returns

  • the maximum tx payload length in function of whether the encryption is enabled on the endpoint or not


Definition at line 592 of file platform/service/cpc/inc/sl_cpc.h

sl_cpc_is_ok_to_sleep#

bool sl_cpc_is_ok_to_sleep (void )
Parameters
N/A

Definition at line 597 of file platform/service/cpc/inc/sl_cpc.h

sl_cpc_sleep_on_isr_exit#

sl_power_manager_on_isr_exit_t sl_cpc_sleep_on_isr_exit (void )
Parameters
N/A

Definition at line 601 of file platform/service/cpc/inc/sl_cpc.h

Macro Definition Documentation#

SL_CPC_JOURNAL_RECORD_ERROR#

#define SL_CPC_JOURNAL_RECORD_ERROR
Value:
(string, value)

Record a CPC journal entry.


Definition at line 58 of file platform/service/cpc/inc/sl_cpc_journal.h

SL_CPC_JOURNAL_RECORD_WARNING#

#define SL_CPC_JOURNAL_RECORD_WARNING
Value:
(string, value)

Definition at line 60 of file platform/service/cpc/inc/sl_cpc_journal.h

SL_CPC_JOURNAL_RECORD_INFO#

#define SL_CPC_JOURNAL_RECORD_INFO
Value:
(string, value)

Definition at line 62 of file platform/service/cpc/inc/sl_cpc_journal.h

SL_CPC_JOURNAL_RECORD_DEBUG#

#define SL_CPC_JOURNAL_RECORD_DEBUG
Value:
(string, value)

Definition at line 64 of file platform/service/cpc/inc/sl_cpc_journal.h

SL_CPC_JOURNAL_RECORD_TRACE#

#define SL_CPC_JOURNAL_RECORD_TRACE
Value:
(string, value)

Definition at line 66 of file platform/service/cpc/inc/sl_cpc_journal.h

SL_CPC_ENDPOINT_FLAG_NONE#

#define SL_CPC_ENDPOINT_FLAG_NONE
Value:
0

sl cpc open endpoint flag none


Definition at line 129 of file platform/service/cpc/inc/sl_cpc.h

SL_CPC_ENDPOINT_FLAG_DISABLE_ENCRYPTION#

#define SL_CPC_ENDPOINT_FLAG_DISABLE_ENCRYPTION
Value:
(0x01 << 3)

sl cpc open endpoint flag disable encryption


Definition at line 130 of file platform/service/cpc/inc/sl_cpc.h

SL_CPC_OPEN_ENDPOINT_FLAG_NONE#

#define SL_CPC_OPEN_ENDPOINT_FLAG_NONE
Value:
SL_CPC_ENDPOINT_FLAG_NONE

Definition at line 132 of file platform/service/cpc/inc/sl_cpc.h

SL_CPC_OPEN_ENDPOINT_FLAG_DISABLE_ENCRYPTION#

#define SL_CPC_OPEN_ENDPOINT_FLAG_DISABLE_ENCRYPTION
Value:
SL_CPC_ENDPOINT_FLAG_DISABLE_ENCRYPTION

Definition at line 133 of file platform/service/cpc/inc/sl_cpc.h

SL_CPC_MAJOR_VERSION#

#define SL_CPC_MAJOR_VERSION
Value:
4

Definition at line 135 of file platform/service/cpc/inc/sl_cpc.h

SL_CPC_MINOR_VERSION#

#define SL_CPC_MINOR_VERSION
Value:
5

Definition at line 136 of file platform/service/cpc/inc/sl_cpc.h

SL_CPC_PATCH_VERSION#

#define SL_CPC_PATCH_VERSION
Value:
0

Definition at line 137 of file platform/service/cpc/inc/sl_cpc.h

SL_CPC_USER_ENDPOINT_ID_START#

#define SL_CPC_USER_ENDPOINT_ID_START
Value:
((uint8_t)SL_CPC_ENDPOINT_USER_ID_0)

Struct representing a core debug.

sl cpc endpoint id start.


Definition at line 273 of file platform/service/cpc/inc/sl_cpc.h

SL_CPC_USER_ENDPOINT_ID_END#

#define SL_CPC_USER_ENDPOINT_ID_END
Value:
((uint8_t)SL_CPC_ENDPOINT_USER_ID_9)

sl cpc user endpoint id end.


Definition at line 274 of file platform/service/cpc/inc/sl_cpc.h

SL_CPC_USER_ENDPOINT_MAX_COUNT#

#define SL_CPC_USER_ENDPOINT_MAX_COUNT
Value:
(SL_CPC_USER_ENDPOINT_ID_END - SL_CPC_USER_ENDPOINT_ID_START + 1)

maximum simultaneous user endpoint.


Definition at line 275 of file platform/service/cpc/inc/sl_cpc.h

SL_CPC_FLAG_NO_BLOCK#

#define SL_CPC_FLAG_NO_BLOCK
Value:
0x01

sl cpc flag no block.


Definition at line 277 of file platform/service/cpc/inc/sl_cpc.h

SLI_CPC_SECURITY_TAG_LENGTH#

#define SLI_CPC_SECURITY_TAG_LENGTH
Value:
8

sli cpc security tag length.


Definition at line 279 of file platform/service/cpc/inc/sl_cpc.h

SLI_CPC_LDMA_DESCRIPTOR_MAX_SIZE#

#define SLI_CPC_LDMA_DESCRIPTOR_MAX_SIZE
Value:
2048

sli cpc ldma desciptor max size.


Definition at line 280 of file platform/service/cpc/inc/sl_cpc.h

SLI_CPC_HEADER_SIZE#

#define SLI_CPC_HEADER_SIZE
Value:
7

sli cpc header size.


Definition at line 281 of file platform/service/cpc/inc/sl_cpc.h

SLI_CPC_PAYLOAD_CRC_SIZE#

#define SLI_CPC_PAYLOAD_CRC_SIZE
Value:
2

sli cpc payload crc size.


Definition at line 282 of file platform/service/cpc/inc/sl_cpc.h

SL_CPC_TX_PAYLOAD_MAX_LENGTH#

#define SL_CPC_TX_PAYLOAD_MAX_LENGTH
Value:
((2 * SLI_CPC_LDMA_DESCRIPTOR_MAX_SIZE) - SLI_CPC_HEADER_SIZE - SLI_CPC_PAYLOAD_CRC_SIZE)

sl cpc tx payload max length.


Definition at line 284 of file platform/service/cpc/inc/sl_cpc.h

SL_CPC_TX_PAYLOAD_MAX_LENGTH_WITH_SECURITY#

#define SL_CPC_TX_PAYLOAD_MAX_LENGTH_WITH_SECURITY
Value:
(SL_CPC_TX_PAYLOAD_MAX_LENGTH - SLI_CPC_SECURITY_TAG_LENGTH)

sl cpc tx payload max lenght with security.


Definition at line 285 of file platform/service/cpc/inc/sl_cpc.h

SL_CPC_TRANSMIT_WINDOW_MIN_SIZE#

#define SL_CPC_TRANSMIT_WINDOW_MIN_SIZE
Value:
1

sl cpc transmit window min size.


Definition at line 287 of file platform/service/cpc/inc/sl_cpc.h

SL_CPC_TRANSMIT_WINDOW_MAX_SIZE#

#define SL_CPC_TRANSMIT_WINDOW_MAX_SIZE
Value:
1

sl cpc transmit window max size.


Definition at line 288 of file platform/service/cpc/inc/sl_cpc.h