CPC

Description

CPC.

Overview

TODO

Initialization

TODO

Data Structures

struct  sl_cpc_endpoint_handle_t
 Struct representing an CPC endpoint handle.
 
struct  sl_cpc_endpoint_debug_counters_t
 Struct representing CPC Core debug stats.
 
struct  sl_cpc_core_debug_counters_t
 Struct representing CPC Core debug counters.
 
struct  sl_cpc_mem_pool_handle_t
 Struct representing a memory pool handle.
 
struct  sl_cpc_debug_memory_t
 Struct representing a memory pool debug.
 

Functions

sl_status_t sl_cpc_init (void)
 Initialize CPC module.
 
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)
 The baremetal process action function.
 
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_close_endpoint (sl_cpc_endpoint_handle_t *endpoint_handle)
 Close endpoint.
 
sl_status_t sl_cpc_abort_read (sl_cpc_endpoint_handle_t *endpoint_handle)
 Abort 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 flag, void *on_write_completed_arg)
 Write Data.
 
sl_cpc_endpoint_state_t sl_cpc_get_endpoint_state (sl_cpc_endpoint_handle_t *endpoint_handle)
 Get endpoint state.
 
sl_status_t sl_cpc_free_rx_buffer (void *data)
 Free buffer returned by sl_cpc_read().
 

Macros

#define SL_CPC_OPEN_ENDPOINT_FLAG_NONE   0
 
#define SL_CPC_USER_ENDPOINT_ID_START   ((uint8_t)SL_CPC_ENDPOINT_USER_ID_0)
 
#define SL_CPC_USER_ENDPOINT_ID_END   ((uint8_t)(SL_CPC_ENDPOINT_USER_ID_0 + SL_CPC_USER_ENDPOINT_MAX_COUNT - 1))
 
#define SL_CPC_FLAG_NO_BLOCK   0x01
 
#define SL_CPC_APP_DATA_MAX_LENGTH   (4087)
 
#define SL_CPC_TRANSMIT_WINDOW_MIN_SIZE   1
 
#define SL_CPC_TRANSMIT_WINDOW_MAX_SIZE   1
 

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 void(* sl_cpc_on_data_reception_t) (uint8_t endpoint_id, void *arg)
 
typedef void(* sl_cpc_on_error_callback_t) (uint8_t endpoint_id, void *arg)
 
typedef void(* sl_cpc_on_poll_t) (uint8_t endpoint_id, void *arg, void *poll_data, uint32_t poll_data_length, void **reply_data, uint32_t *reply_data_lenght, void **on_write_complete_arg)
 
typedef void(* sl_cpc_on_final_t) (uint8_t endpoint_id, void *arg, void *answer, uint32_t answer_lenght)
 

Enumerations

enum  sl_cpc_user_endpoint_id_t {
  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_endpoint_state_t {
  SL_CPC_STATE_OPEN = 0,
  SL_CPC_STATE_CLOSED,
  SL_CPC_STATE_CLOSING,
  SL_CPC_STATE_ERROR_DESTINATION_UNREACHABLE,
  SL_CPC_STATE_ERROR_SECURITY_INCIDENT,
  SL_CPC_STATE_ERROR_FAULT,
  SL_CPC_STATE_FREED
}
 Enumeration representing the possible endpoint state.
 
enum  sl_cpc_endpoint_option_t {
  SL_CPC_ENDPOINT_ON_IFRAME_RECEIVE = 0,
  SL_CPC_ENDPOINT_ON_IFRAME_RECEIVE_ARG,
  SL_CPC_ENDPOINT_ON_UFRAME_RECEIVE,
  SL_CPC_ENDPOINT_ON_UFRAME_RECEIVE_ARG,
  SL_CPC_ENDPOINT_ON_IFRAME_WRITE_COMPLETED,
  SL_CPC_ENDPOINT_ON_UFRAME_WRITE_COMPLETED,
  SL_CPC_ENDPOINT_ON_POLL,
  SL_CPC_ENDPOINT_ON_POLL_ARG,
  SL_CPC_ENDPOINT_ON_FINAL,
  SL_CPC_ENDPOINT_ON_FINAL_ARG,
  SL_CPC_ENDPOINT_ON_ERROR,
  SL_CPC_ENDPOINT_ON_ERROR_ARG
}
 Enumeration representing the possible configurable options for an endpoint.
 

Function Documentation

◆ sl_cpc_init()

sl_status_t sl_cpc_init ( void  )

Initialize CPC module.

Returns
Status code

◆ 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 
)

The baremetal process action function.

Open endpoint

Parameters
[in]endpoint_handleEndpoint handle
[in]idEndpoint ID
[in]flagsEndpoint type flags
[in]tx_window_sizeTransmit window size
Returns
Status code

◆ 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_handleEndpoint handle
[in]optionEndpoint Option to set
[in]valueOption value
Returns
Status code
Note
Options are as follow:

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_UFRAME_RECEIVE: Set an on uframe receive callback. value is a sl_cpc_on_data_reception_t type.

SL_CPC_ENDPOINT_ON_UFRAME_RECEIVE_ARG: Set an on uframe 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_UFRAME_WRITE_COMPLETED: Set an on uframe write completed callback. value is a sl_cpc_on_write_completed_t type.

SL_CPC_ENDPOINT_ON_POLL: Set an on poll callback. value is a sl_cpc_on_poll_t type.

SL_CPC_ENDPOINT_ON_POLL_ARG: Set an on poll callback argument.

SL_CPC_ENDPOINT_ON_FINAL: Set an on final callback. value is a sl_cpc_on_final_t type.

SL_CPC_ENDPOINT_ON_FINAL_ARG: Set an on final callback argument.

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_close_endpoint()

sl_status_t sl_cpc_close_endpoint ( sl_cpc_endpoint_handle_t endpoint_handle)

Close endpoint.

Parameters
[in]endpoint_handleEndpoint handle
Returns
Status code

◆ sl_cpc_abort_read()

sl_status_t sl_cpc_abort_read ( sl_cpc_endpoint_handle_t endpoint_handle)

Abort read.

Parameters
[in]endpoint_handleEndpoint handle
Returns
Status code
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 
)

Read Data.

Parameters
[in]endpoint_handleEndpoint handle
[out]dataAddress of the variable that will receive the data pointer.
[out]data_lengthLength of the data contained in the buffer.
[in]timeoutTimeout in ticks for the read operation. (Requires RTOS) Note: No effect if SL_CPC_FLAG_NO_BLOCK is provided as a flag
[in]flagsOptional flags. i.g. SL_CPC_FLAG_NO_BLOCK Note: SL_CPC_FLAG_NO_BLOCK will cause the function to return SL_STATUS_EMPTY on baremetal applications
Returns
Status code

◆ sl_cpc_write()

sl_status_t sl_cpc_write ( sl_cpc_endpoint_handle_t endpoint_handle,
void *  data,
uint16_t  data_length,
uint8_t  flag,
void *  on_write_completed_arg 
)

Write Data.

Parameters
[in]endpoint_handleEndpoint handle
[in]dataPointer to data buffer.
[in]data_lengthLength of the data contained in the buffer.
[in]flagsOptional flags.
[in]on_write_completed_argArgument that will be passed to on_write_completed().
Returns
Status code
Note
This function cannot be called from an ISR.

◆ 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_handleEndpoint handle
Returns
Endpoint state

◆ sl_cpc_free_rx_buffer()

sl_status_t sl_cpc_free_rx_buffer ( void *  data)

Free buffer returned by sl_cpc_read().

Parameters
[in]dataPointer to data buffer to free.
Returns
Status code

Enumeration Type Documentation

◆ 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

Enumeration representing the possible endpoint state.

Enumerator
SL_CPC_STATE_OPEN 

State open.

SL_CPC_STATE_CLOSED 

State close.

SL_CPC_STATE_CLOSING 

State closing.

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_STATE_FREED 

State freed.

◆ sl_cpc_endpoint_option_t

Enumeration representing the possible configurable options for an endpoint.

Enumerator
SL_CPC_ENDPOINT_ON_IFRAME_RECEIVE 

Option: iframe receive.

SL_CPC_ENDPOINT_ON_IFRAME_RECEIVE_ARG 

Option: iframe receive argument.

SL_CPC_ENDPOINT_ON_UFRAME_RECEIVE 

Option: uframe receive.

SL_CPC_ENDPOINT_ON_UFRAME_RECEIVE_ARG 

Option: uframe receive argument.

SL_CPC_ENDPOINT_ON_IFRAME_WRITE_COMPLETED 

Option: iframe write completed.

SL_CPC_ENDPOINT_ON_UFRAME_WRITE_COMPLETED 

Option: uframe write completed.

SL_CPC_ENDPOINT_ON_POLL 

Option: on poll.

SL_CPC_ENDPOINT_ON_POLL_ARG 

Option: on poll argument.

SL_CPC_ENDPOINT_ON_FINAL 

Option: on final.

SL_CPC_ENDPOINT_ON_FINAL_ARG 

Option: on final argument.

SL_CPC_ENDPOINT_ON_ERROR 

Option: on error.

SL_CPC_ENDPOINT_ON_ERROR_ARG 

Option: on error argument.