romapi_spis.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * @brief SPI 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_SPIS_H_
  32. #define __ROMAPI_SPIS_H_
  33. #include "hw_spisd.h"
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. /** @defgroup ROMAPI_SPIS_WRAPPER CHIP: SPI slave ROM wrapper functions
  38. * @ingroup ROMAPI_5410X
  39. * @{
  40. */
  41. /**
  42. * @brief Get memory size in bytes needed for SPI slave driver context
  43. * @return Size in bytes needed for the ROM driver
  44. */
  45. uint32_t ROM_SPIS_GetMemSize(void);
  46. /**
  47. * @brief Initialize SPI slave peripheral
  48. * @param mem : Pointer to memory area used to driver context
  49. * @param pInit : Pointer to SPI slave init data
  50. * @return NULL on error, or a pointer to the device context handle
  51. */
  52. ROM_SPIS_HANDLE_T ROM_SPIS_Init(void *mem, ROM_SPIS_INIT_T *pInit);
  53. /**
  54. * @brief Register a SPI slave callback
  55. * @param pHandle : Pointer to driver context handle
  56. * @param cbIndex : Callback to register
  57. * @param pCB : Pointer to callback function
  58. * @return Nothing
  59. */
  60. void ROM_SPIS_RegisterCallback(ROM_SPIS_HANDLE_T pHandle, ROM_SPIS_CALLBACK_T cbIndex, void *pCB);
  61. /**
  62. * @brief Setup SPI slave transfer configuration
  63. * @param pHandle : Pointer to driver context handle
  64. * @param pSlaveSetup : Slave setup data
  65. * @return Error code
  66. * @note Sets up the slave interface configuration for a transfer.
  67. */
  68. ErrorCode_t ROM_SPIS_SetupSlave(ROM_SPIS_HANDLE_T pHandle, ROM_SPIS_SLAVE_T *pSlaveSetup);
  69. /**
  70. * @brief Start a SPI slave transfer
  71. * @param pHandle : Pointer to driver context handle
  72. * @param pXfer : Pointer to slave transfer configuration
  73. * @return Error code
  74. * @note This function starts the transfer and returns immediately.
  75. */
  76. ErrorCode_t ROM_SPIS_Transfer(ROM_SPIS_HANDLE_T pHandle, ROM_SPIS_XFER_T *pXfer);
  77. /**
  78. * @brief SPI slave transfer (interrupt) handler
  79. * @param pHandle : Pointer to driver context handle
  80. * @return Nothing
  81. * @note This function should be called from the SPI interrupt handler and
  82. * is used in interrupt and DMA modes.
  83. */
  84. void ROM_SPIS_TransferHandler(ROM_SPIS_HANDLE_T pHandle);
  85. /**
  86. * @brief Return the SPI 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_SPIS_GetDriverVersion(void);
  93. /**
  94. * @}
  95. */
  96. #ifdef __cplusplus
  97. }
  98. #endif
  99. #endif /* __ROMAPI_SPIS_H_ */