ifx_i2c.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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.h
  12. *
  13. * \brief This file defines the API prototype for IFX I2C protocol v1.65 wrapper.
  14. *
  15. * \addtogroup grIFXI2C
  16. * @{
  17. */
  18. #ifndef _IFXI2C_H_
  19. #define _IFXI2C_H_
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /***********************************************************************************************************************
  24. * HEADER FILES
  25. **********************************************************************************************************************/
  26. #include "Datatypes.h"
  27. #include "ifx_i2c_config.h"
  28. /***********************************************************************************************************************
  29. * MACROS
  30. ***********************************************************************************************************************/
  31. /***********************************************************************************************************************
  32. * ENUMS
  33. ***********************************************************************************************************************/
  34. /** @brief IFX I2C Reset types */
  35. typedef enum ifx_i2c_reset_type
  36. {
  37. /// Cold reset. Both reset pin and vdd pin are toggled low and then high
  38. IFX_I2C_COLD_RESET = 0U,
  39. /// Soft reset. 0x0000 is written to IFX-I2C Soft reset register
  40. IFX_I2C_SOFT_RESET = 1U,
  41. /// Warm reset. Only reset pin is toggled low and then high
  42. IFX_I2C_WARM_RESET = 2U
  43. } ifx_i2c_reset_type_t;
  44. /***********************************************************************************************************************
  45. * DATA STRUCTURES
  46. ***********************************************************************************************************************/
  47. /***********************************************************************************************************************
  48. * API PROTOTYPES
  49. **********************************************************************************************************************/
  50. /**
  51. * \brief Initializes the IFX I2C protocol stack for a given context.
  52. */
  53. host_lib_status_t ifx_i2c_open(ifx_i2c_context_t *p_ctx);
  54. /**
  55. * \brief Resets the I2C slave.
  56. */
  57. host_lib_status_t ifx_i2c_reset(ifx_i2c_context_t *p_ctx, ifx_i2c_reset_type_t reset_type);
  58. /**
  59. * \brief Sends a command and receives a response for the command.
  60. */
  61. host_lib_status_t ifx_i2c_transceive(ifx_i2c_context_t *p_ctx,const uint8_t* p_data, const uint16_t* p_data_length,
  62. uint8_t* p_buffer, uint16_t* p_buffer_len);
  63. /**
  64. * \brief Closes the IFX I2C protocol stack for a given context.
  65. */
  66. host_lib_status_t ifx_i2c_close(ifx_i2c_context_t *p_ctx);
  67. /**
  68. * \brief Sets the slave address of the target device.
  69. */
  70. host_lib_status_t ifx_i2c_set_slave_address(ifx_i2c_context_t *p_ctx, uint8_t slave_address, uint8_t persistent);
  71. #ifdef __cplusplus
  72. }
  73. #endif
  74. #endif /* _IFXI2C_H_ */
  75. /**
  76. * @}
  77. **/