This file defines the structures and macros for the Infineon I2C Protocol. More...
#include "pal_i2c.h"
#include "pal_gpio.h"
#include "pal_os_timer.h"
#include "pal_os_datastore.h"
#include "optiga_lib_config.h"
#include "optiga_lib_logger.h"
Go to the source code of this file.
Classes | |
struct | ifx_i2c_pl |
Physical layer structure. More... | |
struct | ifx_i2c_dl |
Datalink layer structure. More... | |
struct | ifx_i2c_tl |
Transport layer structure. More... | |
struct | ifx_i2c_prl_manage_context |
Presentation layer manage context structure. More... | |
struct | ifx_i2c_datastore_config |
Data store configuration structure. More... | |
struct | ifx_i2c_prl |
Presentation layer structure. More... | |
struct | ifx_i2c_context |
IFX I2C context structure. More... | |
#define | IFX_I2C_BASE_ADDR (0x30) |
I2C slave address of the Infineon device. More... | |
#define | PL_POLLING_INVERVAL_US (1000U) |
Physical Layer: polling interval in microseconds. More... | |
#define | PL_POLLING_MAX_CNT (200U) |
Physical layer: maximal attempts. More... | |
#define | PL_DATA_POLLING_INVERVAL_US (5000U) |
Physical Layer: data register polling interval in microseconds. More... | |
#define | PL_GUARD_TIME_INTERVAL_US (50U) |
Physical Layer: guard time interval in microseconds. More... | |
#define | IFX_I2C_FRAME_SIZE (19U) |
Data link layer: frame size (max supported is 277 decimal). Note: This can be configured externally to a lesser value due to platform restrictions. More... | |
#define | TL_HEADER_SIZE (1U) |
Transport Layer: header size. More... | |
#define | DL_HEADER_SIZE (5U) |
Data link layer: header size. More... | |
#define | DL_TRANS_REPEAT (3U) |
Data link layer: maximum number of retries in case of transmission error. More... | |
#define | PL_TRANS_TIMEOUT_MS (10U) |
Data link layer: Trans timeout in milliseconds. More... | |
#define | TL_MAX_EXIT_TIMEOUT (180U) |
Transport layer: Maximum exit timeout in seconds. More... | |
#define | RESET_LOW_TIME_MSEC (2000U) |
Reset low time for GPIO pin toggling. More... | |
#define | STARTUP_TIME_MSEC (12000U) |
Start up time. More... | |
#define | IFX_I2C_STACK_SUCCESS (0x0000) |
Protocol Stack: Status codes for success. More... | |
#define | IFX_I2C_STACK_BUSY (0x0001) |
Protocol Stack: Status codes busy. More... | |
#define | IFX_I2C_STACK_ERROR (0x0102) |
Protocol Stack: Status codes for error. More... | |
#define | IFX_I2C_STACK_MEM_ERROR (0x0104) |
Protocol Stack: Memory insufficient. More... | |
#define | IFX_I2C_FATAL_ERROR (0x0106) |
Protocol Stack: Fatal error. Used internal to IFX I2C Stack. More... | |
#define | IFX_I2C_HANDSHAKE_ERROR (0x0107) |
Protocol Stack: handshake error. More... | |
#define | IFX_I2C_SESSION_ERROR (0x0108) |
Protocol Stack: session error. More... | |
#define | IFX_I2C_DL_HEADER_OFFSET (0U) |
Offset of Datalink header in tx_frame_buffer. More... | |
#define | IFX_I2C_TL_HEADER_OFFSET (IFX_I2C_DL_HEADER_OFFSET + 3) |
Offset of Transport header in tx_frame_buffer. More... | |
#define | IFX_I2C_LOG_PL (0U) |
Protocol Stack debug switch for physical layer (set to 0 or 1) More... | |
#define | IFX_I2C_LOG_DL (0U) |
Protocol Stack debug switch for data link layer (set to 0 or 1) More... | |
#define | IFX_I2C_LOG_TL (0U) |
Protocol Stack debug switch for transport layer (set to 0 or 1) More... | |
#define | IFX_I2C_LOG_PRL (0U) |
Protocol Stack debug switch for presentation layer (set to 0 or 1) More... | |
#define | IFX_I2C_LOG_ID_PL (0x00) |
Log ID number for physical layer. More... | |
#define | IFX_I2C_LOG_ID_DL (0x01) |
Log ID number for data link layer. More... | |
#define | IFX_I2C_LOG_ID_TL (0x02) |
Log ID number for transport layer. More... | |
#define | IFX_I2C_LOG_ID_PRL (0x03) |
Log ID number for presentation layer. More... | |
#define | IFX_I2C_LOG_ID_PAL (0x04) |
Log ID number for platform abstraction layer. More... | |
#define | IFX_I2C_PRL_ENABLED (1U) |
#define | IFX_I2C_TL_ENABLE (1U) |
#define | IFX_I2C_PRESENCE_BIT (0x08) |
#define | IFX_I2C_PRL_MAC_SIZE (0x08) |
#define | IFX_I2C_PRL_HEADER_SIZE (0x05) |
#define | IFX_I2C_PRL_OVERHEAD_SIZE (IFX_I2C_PRL_HEADER_SIZE + IFX_I2C_PRL_MAC_SIZE) |
Overhead buffer size for user buffer. More... | |
#define | IFX_I2C_DATA_OFFSET (IFX_I2C_PRL_HEADER_SIZE) |
Offset for data. More... | |
#define | IFX_I2C_PRESENCE_BIT_CHECK (0x08) |
#define | PROTOCOL_VERSION_PRE_SHARED_SECRET (0x01) |
Pre shared secret protocol version. More... | |
#define | IFX_I2C_SESSION_CONTEXT_RESTORE (0x11) |
To restore saved secure session. More... | |
#define | IFX_I2C_SESSION_CONTEXT_SAVE (0x22) |
To store active secure session. More... | |
#define | IFX_I2C_SESSION_CONTEXT_NONE (0x33) |
For no manage context operation. More... | |
#define | NO_PROTECTION (0x00) |
When data from master and slave is unprotected. More... | |
#define | MASTER_PROTECTION (0x01) |
When data from master is protected and data from slave is unprotected. More... | |
#define | SLAVE_PROTECTION (0x02) |
When data from master is unprotected and data from is slave protected. More... | |
#define | FULL_PROTECTION (0x03) |
When data from master and slave protected. More... | |
#define | RE_ESTABLISH (0x80) |
To re-establish secure channel. More... | |
#define | OPTIGA_IFXI2C_LOG_TRANSMIT_HEX_DATA(array, array_len, p_ifx_i2c_ctx) {} |
#define | OPTIGA_IFXI2C_LOG_RECEIVE_HEX_DATA(array, array_len, p_ifx_i2c_ctx) {} |
#define | OPTIGA_COMMS_LOG_MESSAGE(msg) {} |
#define | OPTIGA_COMMS_LOG_STATUS(return_value) {} |
typedef struct ifx_i2c_context | ifx_i2c_context_t |
IFX I2C context structure. More... | |
typedef void(* | ifx_i2c_event_handler_t) (struct ifx_i2c_context *p_ctx, optiga_lib_status_t event, const uint8_t *data, uint16_t data_len) |
Event handler function prototype. More... | |
typedef struct ifx_i2c_pl | ifx_i2c_pl_t |
Physical layer structure. More... | |
typedef struct ifx_i2c_dl | ifx_i2c_dl_t |
Datalink layer structure. More... | |
typedef struct ifx_i2c_tl | ifx_i2c_tl_t |
Transport layer structure. More... | |
typedef struct ifx_i2c_prl_manage_context | ifx_i2c_prl_manage_context_t |
Presentation layer manage context structure. More... | |
typedef struct ifx_i2c_datastore_config | ifx_i2c_datastore_config_t |
Data store configuration structure. More... | |
typedef struct ifx_i2c_prl | ifx_i2c_prl_t |
Presentation layer structure. More... | |
ifx_i2c_context_t | ifx_i2c_context_0 |
IFX I2C Instance. More... | |
This file defines the structures and macros for the Infineon I2C Protocol.
Copyright (c) 2019 Infineon Technologies AG
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
\endcopyright
#define DL_HEADER_SIZE (5U) |
Data link layer: header size.
#define DL_TRANS_REPEAT (3U) |
Data link layer: maximum number of retries in case of transmission error.
#define FULL_PROTECTION (0x03) |
When data from master and slave protected.
#define IFX_I2C_BASE_ADDR (0x30) |
I2C slave address of the Infineon device.
#define IFX_I2C_DATA_OFFSET (IFX_I2C_PRL_HEADER_SIZE) |
Offset for data.
#define IFX_I2C_DL_HEADER_OFFSET (0U) |
Offset of Datalink header in tx_frame_buffer.
#define IFX_I2C_FATAL_ERROR (0x0106) |
Protocol Stack: Fatal error. Used internal to IFX I2C Stack.
#define IFX_I2C_FRAME_SIZE (19U) |
Data link layer: frame size (max supported is 277 decimal). Note: This can be configured externally to a lesser value due to platform restrictions.
#define IFX_I2C_HANDSHAKE_ERROR (0x0107) |
Protocol Stack: handshake error.
#define IFX_I2C_LOG_DL (0U) |
Protocol Stack debug switch for data link layer (set to 0 or 1)
#define IFX_I2C_LOG_ID_DL (0x01) |
Log ID number for data link layer.
#define IFX_I2C_LOG_ID_PAL (0x04) |
Log ID number for platform abstraction layer.
#define IFX_I2C_LOG_ID_PL (0x00) |
Log ID number for physical layer.
#define IFX_I2C_LOG_ID_PRL (0x03) |
Log ID number for presentation layer.
#define IFX_I2C_LOG_ID_TL (0x02) |
Log ID number for transport layer.
#define IFX_I2C_LOG_PL (0U) |
Protocol Stack debug switch for physical layer (set to 0 or 1)
#define IFX_I2C_LOG_PRL (0U) |
Protocol Stack debug switch for presentation layer (set to 0 or 1)
#define IFX_I2C_LOG_TL (0U) |
Protocol Stack debug switch for transport layer (set to 0 or 1)
#define IFX_I2C_PRESENCE_BIT (0x08) |
#define IFX_I2C_PRESENCE_BIT_CHECK (0x08) |
#define IFX_I2C_PRL_ENABLED (1U) |
#define IFX_I2C_PRL_HEADER_SIZE (0x05) |
#define IFX_I2C_PRL_MAC_SIZE (0x08) |
#define IFX_I2C_PRL_OVERHEAD_SIZE (IFX_I2C_PRL_HEADER_SIZE + IFX_I2C_PRL_MAC_SIZE) |
Overhead buffer size for user buffer.
#define IFX_I2C_SESSION_CONTEXT_NONE (0x33) |
For no manage context operation.
#define IFX_I2C_SESSION_CONTEXT_RESTORE (0x11) |
To restore saved secure session.
#define IFX_I2C_SESSION_CONTEXT_SAVE (0x22) |
To store active secure session.
#define IFX_I2C_SESSION_ERROR (0x0108) |
Protocol Stack: session error.
#define IFX_I2C_STACK_BUSY (0x0001) |
Protocol Stack: Status codes busy.
#define IFX_I2C_STACK_ERROR (0x0102) |
Protocol Stack: Status codes for error.
#define IFX_I2C_STACK_MEM_ERROR (0x0104) |
Protocol Stack: Memory insufficient.
#define IFX_I2C_STACK_SUCCESS (0x0000) |
Protocol Stack: Status codes for success.
#define IFX_I2C_TL_ENABLE (1U) |
#define IFX_I2C_TL_HEADER_OFFSET (IFX_I2C_DL_HEADER_OFFSET + 3) |
Offset of Transport header in tx_frame_buffer.
#define MASTER_PROTECTION (0x01) |
When data from master is protected and data from slave is unprotected.
#define NO_PROTECTION (0x00) |
When data from master and slave is unprotected.
#define OPTIGA_COMMS_LOG_MESSAGE | ( | msg | ) | {} |
#define OPTIGA_COMMS_LOG_STATUS | ( | return_value | ) | {} |
#define OPTIGA_IFXI2C_LOG_RECEIVE_HEX_DATA | ( | array, | |
array_len, | |||
p_ifx_i2c_ctx | |||
) | {} |
#define OPTIGA_IFXI2C_LOG_TRANSMIT_HEX_DATA | ( | array, | |
array_len, | |||
p_ifx_i2c_ctx | |||
) | {} |
#define PL_DATA_POLLING_INVERVAL_US (5000U) |
Physical Layer: data register polling interval in microseconds.
#define PL_GUARD_TIME_INTERVAL_US (50U) |
Physical Layer: guard time interval in microseconds.
#define PL_POLLING_INVERVAL_US (1000U) |
Physical Layer: polling interval in microseconds.
#define PL_POLLING_MAX_CNT (200U) |
Physical layer: maximal attempts.
#define PL_TRANS_TIMEOUT_MS (10U) |
Data link layer: Trans timeout in milliseconds.
#define PROTOCOL_VERSION_PRE_SHARED_SECRET (0x01) |
Pre shared secret protocol version.
#define RE_ESTABLISH (0x80) |
To re-establish secure channel.
#define RESET_LOW_TIME_MSEC (2000U) |
Reset low time for GPIO pin toggling.
#define SLAVE_PROTECTION (0x02) |
When data from master is unprotected and data from is slave protected.
#define STARTUP_TIME_MSEC (12000U) |
Start up time.
#define TL_HEADER_SIZE (1U) |
Transport Layer: header size.
#define TL_MAX_EXIT_TIMEOUT (180U) |
Transport layer: Maximum exit timeout in seconds.
typedef struct ifx_i2c_context ifx_i2c_context_t |
IFX I2C context structure.
typedef struct ifx_i2c_datastore_config ifx_i2c_datastore_config_t |
Data store configuration structure.
typedef struct ifx_i2c_dl ifx_i2c_dl_t |
Datalink layer structure.
typedef void( * ifx_i2c_event_handler_t) (struct ifx_i2c_context *p_ctx, optiga_lib_status_t event, const uint8_t *data, uint16_t data_len) |
Event handler function prototype.
typedef struct ifx_i2c_pl ifx_i2c_pl_t |
Physical layer structure.
typedef struct ifx_i2c_prl_manage_context ifx_i2c_prl_manage_context_t |
Presentation layer manage context structure.
typedef struct ifx_i2c_prl ifx_i2c_prl_t |
Presentation layer structure.
typedef struct ifx_i2c_tl ifx_i2c_tl_t |
Transport layer structure.
ifx_i2c_context_t ifx_i2c_context_0 |
IFX I2C Instance.
IFX I2C Instance.