romapi_i2cs.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * @brief I2C slave ROM API declarations and functions
  3. *
  4. * @note
  5. * Copyright(C) NXP Semiconductors, 2014
  6. * All rights reserved.
  7. *
  8. * @par
  9. * Software that is described herein is for illustrative purposes only
  10. * which provides customers with programming information regarding the
  11. * LPC products. This software is supplied "AS IS" without any warranties of
  12. * any kind, and NXP Semiconductors and its licensor disclaim any and
  13. * all warranties, express or implied, including all implied warranties of
  14. * merchantability, fitness for a particular purpose and non-infringement of
  15. * intellectual property rights. NXP Semiconductors assumes no responsibility
  16. * or liability for the use of the software, conveys no license or rights under any
  17. * patent, copyright, mask work right, or any other intellectual property rights in
  18. * or to any products. NXP Semiconductors reserves the right to make changes
  19. * in the software without notification. NXP Semiconductors also makes no
  20. * representation or warranty that such application will be suitable for the
  21. * specified use without further testing or modification.
  22. *
  23. * @par
  24. * Permission to use, copy, modify, and distribute this software and its
  25. * documentation is hereby granted, under NXP Semiconductors' and its
  26. * licensor's relevant copyrights in the software, without fee, provided that it
  27. * is used in conjunction with NXP Semiconductors microcontrollers. This
  28. * copyright, permission, and disclaimer notice must appear in all copies of
  29. * this code.
  30. */
  31. #ifndef __ROMAPI_I2CS_H_
  32. #define __ROMAPI_I2CS_H_
  33. #include "hw_i2csd.h"
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. /** @defgroup ROMAPI_I2CS_WRAPPER CHIP: I2C slave ROM wrapper functions
  38. * @ingroup ROMAPI_5410X
  39. * @{
  40. */
  41. /**
  42. * @brief Get memory size in bytes needed for I2C slave driver context
  43. * @return Size in bytes needed for the ROM driver
  44. */
  45. uint32_t ROM_I2CS_GetMemSize(void);
  46. /**
  47. * @brief Initialize I2C slave peripheral
  48. * @param mem : Pointer to memory area used to driver context
  49. * @param pInit : Pointer to I2C slave init data
  50. * @return NULL on error, or a pointer to the device context handle
  51. */
  52. ROM_I2CS_HANDLE_T ROM_I2CS_Init(void *mem, ROM_I2CS_INIT_T *pInit);
  53. /**
  54. * @brief Set I2C slave clock rate
  55. * @param pHandle : Pointer to driver context handle
  56. * @param pSlaveSetup : Slave setup data
  57. * @return Nothing
  58. * @note See the use model for more information on how to setup slave addresses.
  59. */
  60. void ROM_I2CS_SetupSlave(ROM_I2CS_HANDLE_T pHandle, ROM_I2CS_SLAVE_T *pSlaveSetup);
  61. /**
  62. * @brief Register a I2C slave callback
  63. * @param pHandle : Pointer to driver context handle
  64. * @param cbIndex : Callback to register
  65. * @param pCB : Pointer to callback function
  66. * @return Nothing
  67. */
  68. void ROM_I2CS_RegisterCallback(ROM_I2CS_HANDLE_T pHandle, ROM_I2CS_CALLBACK_T cbIndex, void *pCB);
  69. /**
  70. * @brief Queues an I2C slave transfer
  71. * @param pHandle : Pointer to driver context handle
  72. * @param pXfer : Pointer to slave transfer configuration
  73. * @return Always returns LPC_OK
  74. * @note This functions never blocks.
  75. */
  76. ErrorCode_t ROM_I2CS_Transfer(ROM_I2CS_HANDLE_T pHandle, ROM_I2CS_XFER_T *pXfer);
  77. /**
  78. * @brief I2C slave transfer (interrupt) handler
  79. * @param pHandle : Pointer to driver context handle
  80. * @return Nothing
  81. * @note This function should be called from the I2C interrupt handler and
  82. * is used in interrupt and DMA modes.
  83. */
  84. void ROM_I2CS_TransferHandler(ROM_I2CS_HANDLE_T pHandle);
  85. /**
  86. * @brief Return the I2C slave ROM driver version
  87. * @return Driver version number
  88. * @note The returned driver version number consists of a major and minor
  89. * number, with the minor number in the lower 8 bits and the major number in
  90. * the upper 8 bits.
  91. */
  92. uint16_t ROM_I2CS_GetDriverVersion(void);
  93. /**
  94. * @}
  95. */
  96. #ifdef __cplusplus
  97. }
  98. #endif
  99. #endif /* __ROMAPI_I2CS_H_ */