SemiDrive SSDK Appication Program Interface PTG3.0
Data Structures | Functions
sdrv_sent.h File Reference
#include <compiler.h>
#include <sdrv_common.h>
#include <types.h>

Go to the source code of this file.

Data Structures

struct  sent_chan_frame
 
struct  sdrv_sent_chan
 
struct  sdrv_sent
 
struct  sdrv_sent_chan_config
 
struct  sdrv_sent_config
 

Functions

status_t sdrv_sent_init (sdrv_sent_t *ctrl, sdrv_sent_config_t *cfg)
 
status_t sdrv_sent_deinit (sdrv_sent_t *ctrl)
 
status_t sdrv_sent_set_callback (sdrv_sent_t *ctrl, sdrv_sent_chanid_e sdrv_sent_chanid, sdrv_sent_recv_cb_t callback, void *userdata)
 
status_t sdrv_sent_recv_start (sdrv_sent_t *ctrl, sdrv_sent_chanid_e sent_chan_id)
 
status_t sdrv_sent_recv_stop (sdrv_sent_t *ctrl, sdrv_sent_chanid_e sent_chan_id)
 
status_t sdrv_sent_parse_msg (sdrv_sent_t *ctrl, sdrv_sent_chanid_e sent_chan_id)
 
status_t sdrv_sent_get_frame (sdrv_sent_t *ctrl, sdrv_sent_chanid_e sent_chan_id, uint32_t *frame_err, sent_chan_frame_t *frame)
 
int sdrv_sent_irq_handle (uint32_t irq, void *ctrl)
 

Detailed Description

Note:

Macro Definition Documentation

◆ SENT_HIGH_SPEED_DATA_NIBBLE

#define SENT_HIGH_SPEED_DATA_NIBBLE   4U

◆ SENT_SECURE_SENSOR_DATA_NIBBLE

#define SENT_SECURE_SENSOR_DATA_NIBBLE   6U

Typedef Documentation

◆ sdrv_frame_err_e

Sdrv sent frame error code enum.

◆ sdrv_sent_chan_config_t

Sdrv sent channel config struct.

◆ sdrv_sent_chan_t

Sdrv sent channel struct.

◆ sdrv_sent_chanid_e

◆ sdrv_sent_config_t

Sdrv sent module config struct.

◆ sdrv_sent_frame_state_e

Sdrv sent frame status enum.

◆ sdrv_sent_recv_cb_t

typedef void(* sdrv_sent_recv_cb_t) (sdrv_sent_t *ctrl, sdrv_sent_chanid_e sent_chan_id, void *userdata)

◆ sdrv_sent_t

typedef struct sdrv_sent sdrv_sent_t

◆ sent_chan_frame_t

◆ sent_chan_state_e

Sdrv sent frame status enum.

Enumeration Type Documentation

◆ sdrv_frame_err

Sdrv sent frame error code enum.

Enumerator
SENT_OK 

Frame no error.

SENT_SYNC_ERR 

Sync/Calibration pulse is not 56 ticks.

SENT_STATUS_ERR 

Status signal error.

SENT_DATA_ERR 

Nibble data is bigger than 15.

SENT_CRC_ERR 

Nibble data crc is mismatched.

SENT_LOW_PULSE_ERR 

Nibble low pulse width error.

SENT_MSB_NOT_ZERO 

SENT_HIGH_SPEED_FORMAT Only.

SENT_INV_MSN_ERR 

SENT_SINGLE_SECURE_FORMAT Only.

SENT_CONUNTER_VAL_ERR 

SENT_SINGLE_SECURE_FORMAT Only.

SENT_TICK_FREQ_ERR 

SENT_SINGLE_SECURE_FORMAT Only.

SENT_NOT_OK 

SENT_SINGLE_SECURE_FORMAT Only.

◆ sdrv_sent_bitnum_e

Sdrv sent data width enum.

Enumerator
SENT_DATA_WIDTH_4_BIT 

Sent frame data width is 4bits.

SENT_DATA_WIDTH_8_BIT 

Sent frame data width is 8bits.

SENT_DATA_WIDTH_12_BIT 
SENT_DATA_WIDTH_16_BIT 

Sent frame data width is 16bits.

SENT_DATA_WIDTH_20_BIT 

Sent frame data width is 20bits.

SENT_DATA_WIDTH_24_BIT 

Sent frame data width is 24bits.

◆ sdrv_sent_chanid

Sdrv sent channel id enum.

Enumerator
SDRV_SENT_HW_CPT_A 

Sdrv sent hardware channel A.

SDRV_SENT_HW_CPT_B 

Sdrv sent hardware channel B.

SDRV_SENT_HW_CPT_C 

Sdrv sent hardware channel C.

SDRV_SENT_HW_CPT_D 

Sdrv sent hardware channel D.

SDRV_SENT_CHAN_NUM 

Sdrv sent hardware channel number.

◆ sdrv_sent_clk_src_e

sdrv sent clock source enum.

Enumerator
SDRV_SENT_HF_CLK 

High frequency(HF) clock, up to 400MHz.

SDRV_SENT_AHF_CLK 

Alternative High frequency(AHF) clock, up to 400MHz.

SDRV_SENT_EXT_CLK 

External clock, up to 24MHz.

SDRV_SENT_LP_CLK 

Low power(LP) clock, typically from low speed om chip RCOSC.

◆ sdrv_sent_fastchan_e

Sdrv sent channel transmit format enum.

Enumerator
SENT_STANDARD_FORMAT 

Sent use standard format.

SENT_SINGLE_SECURE_FORMAT 

Sent use single secure sensor message format.

SENT_HIGH_SPEED_FORMAT 

Sent use high speed message format.

◆ sdrv_sent_sta_e

Sdrv sent status enum.

Enumerator
SENT_STATUS_UNINIT 

Sdrv sent module is uninitialized.

SENT_STATUS_INITED 

Sdrv sent module is initialized.

◆ sent_chan_state

Sdrv sent frame status enum.

Enumerator
CHAN_STATUS_UNINIT 

Sdrv sent channel is uninitialized.

CHAN_STATUS_INITED 

Sdrv sent channel is initialized.

CHAN_STATUS_RUNNING 

Sdrv sent channel is running.

CHAN_STATUS_STOPPED 

Sdrv sent channel is stopped.

◆ sent_frame_state

Sdrv sent frame status enum.

Enumerator
SENT_IDLE 

The sent is idle, waiting to receive the sync pulse.

SENT_SYNC 

The frame successfully receives the sync pulse and waits to receive the status pulse.

SENT_STATUS 

The frame successfully receives the status pulse and waits to receive the data pulse.

SENT_DATA 

The frame is receiving the data pulse.

SENT_CRC 

The frame successfully receives all data pulse and waits to receive the crc pulse.

SENT_PAUSE 

The frame successfully receives the crc pulse and waits to receive the pause pulse.

Function Documentation

◆ sdrv_sent_deinit()

status_t sdrv_sent_deinit ( sdrv_sent_t ctrl)

Sdrv sent controller deinitialization.

This fuction deinitializes sent module.

Parameters
[in]ctrlSdrv sent controller.
Returns
The result of deinitializing sent.
  • SDRV_STATUS_INVALID_PARAM : The input parameter contains a null pointer.
  • SDRV_STATUS_OK : Sent is deinitialized success.

◆ sdrv_sent_get_frame()

status_t sdrv_sent_get_frame ( sdrv_sent_t ctrl,
sdrv_sent_chanid_e  sent_chan_id,
uint32_t *  frame_err,
sent_chan_frame_t frame 
)

Get sent frame info.

Parameters
[in]ctrlSent controller
[in]sent_chan_idSent channel id
[out]frame_errFrame error code
[out]frameFrame information
Returns
The result of initializing sent.
  • SDRV_STATUS_INVALID_PARAM : The input parameter contains a null pointer.
  • SDRV_STATUS_FAIL : The state of channel is error or the frame is invalid.
  • SDRV_STATUS_OK : Get sent frame success.

◆ sdrv_sent_init()

status_t sdrv_sent_init ( sdrv_sent_t ctrl,
sdrv_sent_config_t cfg 
)

Sdrv sent controller initialization.

This fuction initializes sent(etimer) module and channel and controller entity status.

Parameters
[in]ctrlSdrv sent controller.
[in]cfgSdrv sent configurations.
Returns
The result of initializing sent.
  • SDRV_STATUS_INVALID_PARAM : The input parameter contains a null pointer.
  • SDRV_STATUS_OK : Sent is initialized success.

◆ sdrv_sent_irq_handle()

int sdrv_sent_irq_handle ( uint32_t  irq,
void *  ctrl 
)

Sdrv sent interrupt handler.

Parameters
[in]irqThe irq number of uartx
[in]ctrlSdrv sent controller

◆ sdrv_sent_parse_msg()

status_t sdrv_sent_parse_msg ( sdrv_sent_t ctrl,
sdrv_sent_chanid_e  sent_chan_id 
)

Parse sent frame.

This function is used in the following two situations: 1.Enter sent interrupt, 2.The user actively calls function to parse the remaining data in fifo after stopping channal.

Parameters
[in]ctrlSent controller
[in]sent_chan_idSent channel id
Returns
The result of initializing sent.
  • SDRV_STATUS_INVALID_PARAM : The input parameter contains a null pointer.
  • SDRV_STATUS_OK : Parse sent frame success.

◆ sdrv_sent_recv_start()

status_t sdrv_sent_recv_start ( sdrv_sent_t ctrl,
sdrv_sent_chanid_e  sent_chan_id 
)

Sent starts to receive frames.

Sent channel will receive frames after calling this function. User could stop the sent channel by calling sdrv_sent_recv_stop().

Parameters
[in]ctrlSent controller
[in]sent_chan_idSent channel id
Returns
The result of initializing sent.
  • SDRV_STATUS_INVALID_PARAM : The input parameter contains a null pointer.
  • SDRV_STATUS_OK : Start sent channel success.

◆ sdrv_sent_recv_stop()

status_t sdrv_sent_recv_stop ( sdrv_sent_t ctrl,
sdrv_sent_chanid_e  sent_chan_id 
)

Sent stop recv frame.

Sent channel will receive frames after calling sdrv_sent_recv_start(). User could stop the sent channel by calling this function.

Parameters
[in]ctrlSent controller
[in]sent_chan_idSent channel id
Returns
The result of initializing sent.
  • SDRV_STATUS_INVALID_PARAM : The input parameter contains a null pointer.
  • SDRV_STATUS_OK : Stop sent channel success.

◆ sdrv_sent_set_callback()

status_t sdrv_sent_set_callback ( sdrv_sent_t ctrl,
sdrv_sent_chanid_e  sdrv_sent_chanid,
sdrv_sent_recv_cb_t  callback,
void *  userdata 
)

Sent set callback function.

Parameters
[in]ctrlSdrv sent controller.
[in]sent_chan_idSent channel id
[in]callbackCallback function
[in]userdataCallback user param
Returns
The result of initializing sent.
  • SDRV_STATUS_INVALID_PARAM : The input parameter contains a null pointer.
  • SDRV_STATUS_OK : Set callback function success.