ifx_i2c_physical_layer.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /**
  2. * \copyright
  3. * Copyright (c) 2018, Infineon Technologies AG
  4. * All rights reserved.
  5. *
  6. * This software is provided with terms and conditions as specified in OPTIGA(TM) Trust X Evaluation Kit License Agreement.
  7. * \endcopyright
  8. *
  9. * \author Infineon AG
  10. *
  11. * \file ifx_i2c_physical_layer.h
  12. *
  13. * \brief This file defines the API prototype for physical layer of the Infineon I2C Protocol Stack library.
  14. *
  15. * \addtogroup grIFXI2C
  16. * @{
  17. */
  18. #ifndef _IFX_I2C_PHYSICAL_LAYER_H_
  19. #define _IFX_I2C_PHYSICAL_LAYER_H_
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /***********************************************************************************************************************
  24. * HEADER FILES
  25. **********************************************************************************************************************/
  26. #include "ifx_i2c_config.h"
  27. /***********************************************************************************************************************
  28. * MACROS
  29. **********************************************************************************************************************/
  30. /***********************************************************************************************************************
  31. * ENUMS
  32. **********************************************************************************************************************/
  33. /***********************************************************************************************************************
  34. * DATA STRUCTURES
  35. ***********************************************************************************************************************/
  36. /***********************************************************************************************************************
  37. * API PROTOTYPES
  38. **********************************************************************************************************************/
  39. /**
  40. * @brief Function for initializing the module.
  41. *
  42. * Function initializes and enables the module and registers
  43. * an event handler to receive events from this module.
  44. * @attention This function must be called before using the module.
  45. *
  46. * @param[in,out] p_ctx Pointer to ifx i2c context.
  47. * @param[in] handler Function pointer to the event handler of the upper layer.
  48. *
  49. * @retval IFX_I2C_STACK_SUCCESS If initialization was successful.
  50. * @retval IFX_I2C_STACK_ERROR If the module is already initialized.
  51. */
  52. host_lib_status_t ifx_i2c_pl_init(ifx_i2c_context_t *p_ctx,ifx_i2c_event_handler_t handler);
  53. /**
  54. * @brief Function for sending a frame.
  55. *
  56. * Asynchronous function to send a frame. The function returns immediately.
  57. * One of the following events is propagated to the event handler registered
  58. * with @ref ifx_i2c_pl_init
  59. *
  60. * @param[in,out] p_ctx Pointer to ifx i2c context.
  61. * @param[in] p_frame Buffer containing the frame.
  62. * @param[in] frame_len Frame length.
  63. *
  64. * @retval IFX_I2C_STACK_SUCCESS If function was successful.
  65. * @retval IFX_I2C_STACK_ERROR If the module is busy.
  66. */
  67. host_lib_status_t ifx_i2c_pl_send_frame(ifx_i2c_context_t *p_ctx,uint8_t* p_frame, uint16_t frame_len);
  68. /**
  69. * @brief Function for receiving a frame.
  70. *
  71. * Asynchronous function to receive a frame. The function returns immediately.
  72. * One of the following events is propagated to the event handler registered
  73. * with @ref ifx_i2c_pl_init
  74. *
  75. * @param[in] p_ctx Pointer to ifx i2c context.
  76. *
  77. * @retval IFX_I2C_STACK_SUCCESS If function was successful.
  78. * @retval IFX_I2C_STACK_ERROR If the module is busy.
  79. */
  80. host_lib_status_t ifx_i2c_pl_receive_frame(ifx_i2c_context_t *p_ctx);
  81. /**
  82. * @brief Function for setting slave address.
  83. *
  84. * Synchronous function to set slave address.
  85. *
  86. * @param[in] p_ctx Pointer to ifx i2c context.
  87. * @param[in] slave_address Holds new slave address[7 Bit] to be set.
  88. * @param[in] storage_type 0 - To set the Slave address until next reset.<br>
  89. * Non-zero - To set the slave address to persistent memory.
  90. *
  91. * @retval IFX_I2C_STACK_SUCCESS If function was successful.
  92. * @retval IFX_I2C_STACK_ERROR If setting slave address fails.
  93. */
  94. host_lib_status_t ifx_i2c_pl_write_slave_address(ifx_i2c_context_t *p_ctx, uint8_t slave_address, uint8_t storage_type);
  95. /**
  96. * @}
  97. **/
  98. #ifdef __cplusplus
  99. }
  100. #endif
  101. #endif /* _IFX_I2C_PHYSICAL_LAYER_H_ */