Can DBC Framer

  • This is the Can DBC framer implementation with fixed size of user initialization.

  • The main buffer structure variable and the internal data buffer both should be declared on the application side and the pointers of the variables are used in the module.

Usage

  1. All API functions have the first argument configuration of framer.

  2. Using rs_framer_parse_frame () parse the frame

  3. Using rs_framer_prepare_frame () prepare the frame

  4. Return codes of API functions are defined in header file.

Can DBC framer calls

Function

Description

rs_framer_parse_frame

Function to Process the given data as per the give format and returns the associated ID

rs_framer_prepare_frame

Function to Forms the frame as per the given structure and stores it in the given buffer

Error Code

  • Every API’s for the message queue module returns some success or failure values.

    Please refer below section,

Example Demo

Please refer below section,

Message Queue Header Details

Documentation from the relevant header as follows:

Frame the raw data with specific APIs.

Defines macros and functions specific to framer functionality

Author

Embien RAPIDSEA Team

Copyright

Embien Technologies India Pvt. Ltd.

Defines

RS_FRAMER_COMP_TYPE_ID

framer component type ID

RS_FRAMER_COMP_TYPE_BOOL

framer component type boolean

RS_FRAMER_COMP_TYPE_INT

framer component type signed

RS_FRAMER_COMP_TYPE_UINT

framer component type unsigned

RS_FRAMER_COMP_TYPE_FLOAT

framer component type float

RS_FRAMER_COMP_TYPE_CONTINUATION
RS_FRAMER_DATA_OP_ADD

framer data addition operation

RS_FRAMER_DATA_OP_MULTIPLY

framer data multiply operation

RS_FRAMER_DATA_OP_SUBTRACTION

framer data subtraction operation

RS_FRAMER_DATA_OP_DIVISION

framer data division operation

RS_FRAMER_DATA_OP_DATA_MIN

framer data division operation

RS_FRAMER_DATA_OP_DATA_MAX

framer data division operation

RS_FRAMER_COMP_PROP_LITTLE_ENDIAN

Indicate that the data is in little endian format

RS_FRAMER_COMP_PROP_WRITE_AS_SIGNED

Write the communication data in signed format

RS_FRAMER_COMP_PROP_PENDING

Some more part of frame pending. Currently used as index offset

RS_FRAMER_COMP_PROP_CONTIN_OFFSET_MASK

Offset to fetch the next part of data

Typedefs

typedef struct tag_rs_framer_data_op rs_framer_data_op_t
typedef struct tag_rs_framer_component rs_framer_component_t
typedef struct tag_rs_framer_frame rs_framer_frame_t
typedef struct tag_rs_framer_config rs_framer_config_t

Functions

void rcb_framer_data_decoded(rs_framer_config_t *ptr_frame_config, void *ptr_user_data, uint32_t u32_signal_id, void *ptr_data)

Print recevesed data for signal id.

This function Print recevesed data for signal id

Parameters:
  • ptr_frame_config[in] - pointer to rs_framer_config_t

  • ptr_user_data[in] - pointer to the user_data

  • u32_signal_id[in] - id for signal

  • ptr_data[in] - pointer to the data

Returns:

None

rs_ret_val_t rs_framer_prepare_frame(rs_framer_config_t *ptr_frame_config, void *ptr_user_data, uint32_t u32_id, void *ptr_buf)

Forms the frame as per the given structure and stores it in the given buffer.

This function Forms the frame as per the given structure and stores it in the given buffer

Parameters:
  • ptr_frame_config[in] - double pointer to the rs_framer_config_t

  • ptr_user_data[in] - pointer to the user_data

  • u32_id[in] - can data id

  • ptr_buf[out] - pointer to the array

Returns:

0 on success or error code on failure

rs_ret_val_t rs_framer_parse_frame(rs_framer_config_t *ptr_frame_config, void *ptr_user_data, void *ptr_buf, uint32_t u32_frame_len)

Process the given data as per the give format. Returns the associated ID.

This function Process the given data as per the give format. Returns the associated ID

Parameters:
  • ptr_frame_config[in] - pointer to the rs_framer_config_t

  • ptr_user_data[in] - pointer to the user_data

  • ptr_buf[in] - pointer to the array

Returns:

0 on success or error code on failure

struct tag_rs_framer_data_op

Public Members

uint8_t op

framer data operation

uint8_t arg_type

framer data type

uint8_t reserved1

Reserved

uint8_t reserved2

Reserved

float r32_data

32 bit float data

uint8_t u8_data

8 bit unsigned integer data

int8_t s8_data

8 bit signed integer data

uint16_t u16_data

16 bit unsigned integer data

int16_t s16_data

16 bit signed integer data

uint32_t u32_data

32 bit unsigned integer data

int32_t s32_data

32 bit signed integer data

union tag_rs_framer_data_op arg
struct tag_rs_framer_component

Public Members

uint8_t type

Indicates the type

uint8_t num_op

Number of operations to perform before using

uint16_t data_id

Associated data ID

uint16_t bit_offset

Offset inside the frame to start look at, in bits

uint16_t bit_len

Number of bits to use

uint8_t prop

data format is little endian or big endian

uint8_t reserved
uint16_t signal_index

Index to Signal ID

uint16_t signal_id

Associated data ID

uint16_t reserved2
void *ptr_op_list

pointer to the List of operations to perform

struct tag_rs_framer_frame

Public Members

uint16_t id

can id

uint16_t reserved1
uint32_t msg_len

Number of msg bits

uint8_t target_addr

target address

uint8_t reserved2
uint16_t num_comp

number of operation in component

void *ptr_comp_list

pointer to the list of component to perform

struct tag_rs_framer_config

Public Members

uint16_t num_comp

number of operation in component

uint16_t reserved1

Reserved

void **ptr_comp_list

pointer to the list of framer frame to perform