API Reference | |
| Data types | |
| Function Pointers | |
Data Structures | |
| struct | mtb_stc_lin_frame_t |
| Frame config structure. More... | |
| struct | mtb_stc_lin_frame_context_t |
| Frame context structure All fields for the context structure are internal. More... | |
| struct | mtb_stc_lin_signal_t |
| Signal config structure. More... | |
| struct | mtb_stc_lin_signal_context_t |
| Signal context structure All fields for the context structure are internal. More... | |
| struct | mtb_stc_lin_file_version_t |
| NCF/LDF file version. More... | |
| struct | mtb_stc_lin_config_t |
| LIN Slave config structure. More... | |
| struct | mtb_stc_lin_ifc_config_t |
| LIN interface hardware configuration structure. More... | |
| struct | mtb_stc_lin_context_t |
| LIN Slave context structure. More... | |
| struct mtb_stc_lin_frame_t |
| Data Fields | ||
|---|---|---|
| l_u8 | initial_pid | Specifies the default frame PID that the frame will use before any configuration requests by the master. |
| mtb_stc_lin_frame_direction_t | direction | Specifies the direction of the frame. |
| l_u8 | size | Sets the size of the frame in bytes. |
| mtb_stc_lin_frame_type_t | type | Specifies the type of the frame. |
| volatile l_u8 * | data | The pointer to the array, in which the frame data is located. |
| l_u8 | associated_frame_index |
Associate unconditional frames with event-triggered frames. An event-triggered frame must have at least one unconditional frame that is associated with it, according to the LIN specification. Only one unconditional frame can be associated with an event-triggered frame. An event-triggered frame that is associated with an unconditional frame must have the same length and direction as the unconditional frame with which it is associated.
|
| l_u16 | initial_message_id |
Sets the initial message ID value.
|
| struct mtb_stc_lin_frame_context_t |
| struct mtb_stc_lin_signal_t |
| Data Fields | ||
|---|---|---|
| l_u8 | handle |
Specifies the signal handle. The same signal packed into multiple frames have the same handle value. Used as an input for the signal interaction function. |
| l_u8 | frame_index | Specifies the frame in which a signal will be located. |
| l_u8 | bit_offset |
Defined the position of the signal in the frame (number of bits in offset from the first bit in the frame). For a byte array, both size and offset must be multiples of eight. |
| mtb_stc_lin_signal_type_t | type |
Specifies the type of the signal. Refer to mtb_stc_lin_signal_type_t |
| l_u8 | size |
Sets the size of signal. The allowable signal size depends on the signal type mtb_stc_lin_signal_type_t |
| struct mtb_stc_lin_signal_context_t |
| struct mtb_stc_lin_file_version_t |
| Data Fields | ||
|---|---|---|
| l_u8 | major | The Major Version of LDF/NFC definition ID. |
| l_u8 | minor | The Minor Version of LDF/NFC definition ID. |
| l_u8 | sub | The Sub Version of LDF/NFC definition ID. |
| mtb_stc_lin_file_version_source_t | source | The type of an import file for LIN Slave Node configuration. |
| struct mtb_stc_lin_config_t |
| Data Fields | ||
|---|---|---|
| mtb_stc_lin_spec_t | spec | Specifies the protocol specification mtb_stc_lin_spec_t. |
| bool | iso17987 |
Enable compliant with ISO 17987.
|
| bool | inactivity_enabled |
Enable the bus inactivity feature. After a specified time of bus inactivity, the corresponding status bit is set. The value of this bit can be obtained by the MTB_LIN_IOCTL_READ_STATUS of the l_ifc_ioctl(). |
| l_u32 | inactivity_threshold |
Sets the minimal timeout value.
|
| l_u32 | break_threshold |
Sets the Slave node break detection threshold. See section 5.2.2.3. of the ISO 17987-3 specification for more information about break detection threshold selection criteria.
|
| bool | auto_baud_rate_sync |
Enable or disable the automatic baud rate synchronization. If this option is enabled, the LIN middleware measures the exact baud rate of the bus from the sync byte field of each LIN frame header. If this option is disabled, the LIN middleware does not measure the baud rate from the sync byte field. Instead, it receives the sync byte field as a 0x55 data byte. As required by the ISO 17987-4 specification, LIN Slave nodes with a frequency deviation of +/-1.5 percent or less do not need to use the automatic baud rate synchronization to measure the sync byte field of each frame. However, if the frequency deviation of the LIN Slave node is more than +/-1.5 percent, then Slave node must use automatic baud rate synchronization to measure the sync byte field of each frame. Therefore, frequency deviation specifications must be checked for the clock source which connected to SCB block. |
| l_u32 | baud_rate | Sets the nominal LIN bus baud rate at which this LIN Slave node must operate. |
| bool | tl_enabled | Enable Transport Layer. |
| l_u8 | initial_nad |
This field is used to select the Network Address (NAD) of Slave node. The NAD is used in MRF and SRF frames to address one particular Slave node in a cluster. Note that this field is used to select the Initial NAD for the node. The NAD of a Slave node can change at run time. By default, the Initial NAD value can be in the range from 0x01 to 0xFF. The NAD value of 0x00 is reserved for a "Go To Sleep" command. The NAD value of 0x7E is reserved as a "Functional NAD" which is used for diagnostic services. The NAD value of 0x7F is reserved as a "wildcard" NAD. Therefore, the next value is not allowed: 0x00, 0x7E, or 0x7F. |
| mtb_stc_lin_tl_format_t | tl_api_format |
Sets the format for the Transport Layer API functions. The cooked format is used to send and receive Transport Layer messages using just one API function for each message Cooked Transport Layer. The raw format is used to send or receive each frame that makes up a Transport Layer message using one API function call for each frame Raw Transport Layer. |
| l_u32 | tl_buf_len_max |
Maximum Message Length. Sets the maximum Transport Layer message length that this Slave node supports. The minimum value is 6, because there are up to six Transport Layer message data bytes in messages that use only one frame. This middleware only supports Transport Layer messages with lengths up to 4095 bytes.
|
| l_u32 | tl_tx_queue_len |
TX Queue Length. When using the raw API format, there is a message queue that buffers the frame response data that is being sent or received. If the slave cannot update the queues very quickly, then the queue lengths must be made longer. If Slave can update the queues very quickly, then the queues can be made shorter to decrease RAM memory use. The middleware supports queue lengths from 8 to 2048 with 8-byte steps.
|
| l_u32 | tl_rx_queue_len |
RX Queue Length. Refer to TX Queue Length description above.
|
| volatile l_u8 * | tl_raw_rx_queue |
The Master Request Frame (MRF) buffer. The buffer size is defined by tl_rx_queue_len.
|
| volatile l_u8 * | tl_raw_tx_queue |
The Slave Response Frame (SRF) buffer. The size is defined by tl_tx_queue_len.
|
| bool | auto_config_request_handling |
Automatic Configuration Request Handling. The middleware is designed so that it automatically handles configuration service requests. In other words, you do not have to use any API or application code to service these requests from Master. However, you can disable this automatic handling and handle these requests with your own custom application code. If the option is set to "true", any service that is enabled is automatically handled by the middleware. Whenever any of these automatically handled requests occur during LIN bus operation, the corresponding MRF and SRF frames will not be available to the application through the Transport Layer API. If a service request is not automatically handled (the auto_config_request_handling is set to false), then the corresponding MRF and SRF frames of the configuration service request must be received or sent by the application using the Transport Layer API. |
| l_u16 | supplier_id |
Sets the Supplier ID. The Supplier ID is a 16-bit value, but its valid range is from 0x0000 to 0x7FFE. Used in the configuration service requests to differentiate between the different slave nodes in a LIN cluster.
|
| l_u16 | function_id |
Sets the Function ID. The Function ID is also 16 bits, and its valid range is 0x0000 to 0xFFFE. Used in the configuration service requests to differentiate between the different slave nodes in a LIN cluster.
|
| l_u8 | variant |
Sets the Variant. The Variant is 8 bits and its valid range is from 0x00 to 0xFF. Used in the configuration service requests to differentiate between the different slave nodes in a LIN cluster.
|
| bool | service_assign_nad |
Enable Service 0xB0 - "Assign NAD". This is an optional service in the ISO 17987 specification. This is a service request where a new NAD value is assigned to the slave node. |
| bool | service_assign_frame_id |
Enable Service 0xB1 - "Assign Frame Identifier". This is an obsolete service in the ISO 17987 specification. This configuration service request is used to change the frame ID value for a frame to which this slave node responds.
|
| bool | service_read_by_id |
Enable Service 0xB2 - "Read by identifier". This configuration service request is mandatory according to the ISO 17987 specification. This request is used to allow the LIN master to read Slave's identification information (Supplier ID, Function ID, Variant). LIN middleware supports:
|
| bool | service_cond_change_nad |
Enable Service 0xB3 - "Conditional Change NAD". This is an optional service in the LIN 2.2 and ISO 17987 specifications. This is very similar to the Assign NAD configuration service. One major difference is that this service uses Slave's current (volatile) NAD instead of the initial (nonvolatile) NAD. When this request occurs, Slave does some logic processing on the data bytes received from the master and only updates its current (volatile) NAD if the result of the processing is zero. |
| bool | service_data_dump |
Enable Service 0xB4 - "Data Dump". This service is reserved for initial configuration of a slave node by Slave node supplier and the format of this message is application specific and is not supported by this LIN middleware. Received data is transferred to the application with the transport layer. |
| bool | service_target_reset |
Enable Service 0xB5 - "Assign NAD via SNPD" (Targeted Reset) This service is used for Slave Node Position Detection (SNPD) and the handling of this message is application specific and is not supported by this LIN middleware. Received data is transferred to the application with the transport layer. |
| bool | service_save_config |
Enable Service 0xB6 - "Save Configuration". This is an optional service request in the ISO 17987 specification. The Slave device can save its configuration data (NAD value and PID values) in nonvolatile memory (flash). However, the application code must implement the actual flash writing operations. When this configuration service request occurs, the Save Configuration flag in the status returned by the l_ifc_read_status() API function is set. This lets the application know that it must save its current LIN slave node configuration information to nonvolatile memory (flash). |
| bool | service_assign_frame_id_range |
Enable Service 0xB7 - "Assign frame identifier range". This is a mandatory configuration service request in the ISO 17987 specification. This service allows the LIN master to change the volatile frame PID values for Slave's frames. |
| l_u8 | num_of_frames | Specifies the number of frames. |
| l_u16 | num_of_signals |
Specifies the number of the signals. Matches to the number of the signals in the array pointed by mtb_stc_lin_signal_t. |
| l_u16 | num_of_signal_handles |
Specifies the number of the signal handles. Matches the num_of_signals if no signals with the same name defined. The signals with the same name has different index in the array of the signals (for example, mtb_lin_0_signals), but same handle defined. If no signals with the same name defined, this value should match num_of_signals. |
| l_signal_handle | resp_error_signal_handle | Sets the response error signal handler. |
| volatile const mtb_stc_lin_frame_t * | frames | The pointer to the array of the frames. |
| volatile const mtb_stc_lin_signal_t * | signals | The pointer to the array of the signals. |
| volatile mtb_stc_lin_frame_context_t * | frames_context |
The pointer to the frames' context. The size of the context equals the number of the supported frames. If the Transport layer is enabled, the MRF and SRF frames are taken into account. |
| volatile mtb_stc_lin_signal_context_t * | signals_context | The pointer to the array of the signals. |
| bool | file_rev_defined |
"true" if LDF/NCF file version is specified. See ISO 17987-2, Table 19. If no file version defined, this member is set to "false". |
| const mtb_stc_lin_file_version_t * | file_rev | The pointer to the structure that holds LDF/NCF file version. |
| struct mtb_stc_lin_ifc_config_t |
| Data Fields | ||
|---|---|---|
| CySCB_Type * | scb_base | The pointer to the SCB hardware block base address. |
| IRQn_Type | irq_num | The interrupt source number associated with the SCB block. |
| l_u32 | intr_priority | Sets the priority of the SCB interrupt. |
| cy_en_divider_types_t | divider_type |
Specifies the type of the peripheral clock divider assigned to the SCB block.
|
| l_u32 | divider_num | Specifies the number of the peripheral clock divider assigned to the SCB block. |
| GPIO_PRT_Type * | tx_port | The pointer to the GPIO port register base address for the SCB TX pin. |
| l_u8 | tx_pin | The position of the TX pin within the GPIO port specified by tx_port. |
| struct mtb_stc_lin_context_t |