rfal_t2t.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /******************************************************************************
  2. * \attention
  3. *
  4. * <h2><center>&copy; COPYRIGHT 2020 STMicroelectronics</center></h2>
  5. *
  6. * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
  7. * You may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at:
  9. *
  10. * www.st.com/myliberty
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
  15. * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. *
  20. ******************************************************************************/
  21. /*
  22. * PROJECT: ST25R391x firmware
  23. * Revision:
  24. * LANGUAGE: ISO C99
  25. */
  26. /*! \file rfal_t2t.h
  27. *
  28. * \author Gustavo Patricio
  29. *
  30. * \brief Provides NFC-A T2T convenience methods and definitions
  31. *
  32. * This module provides an interface to perform as a NFC-A Reader/Writer
  33. * to handle a Type 2 Tag T2T
  34. *
  35. *
  36. * \addtogroup RFAL
  37. * @{
  38. *
  39. * \addtogroup RFAL-AL
  40. * \brief RFAL Abstraction Layer
  41. * @{
  42. *
  43. * \addtogroup T2T
  44. * \brief RFAL T2T Module
  45. * @{
  46. *
  47. */
  48. #ifndef RFAL_T2T_H
  49. #define RFAL_T2T_H
  50. /*
  51. ******************************************************************************
  52. * INCLUDES
  53. ******************************************************************************
  54. */
  55. #include "../platform.h"
  56. #include "../st_errno.h"
  57. #include "rfal_rf.h"
  58. /*
  59. ******************************************************************************
  60. * GLOBAL DEFINES
  61. ******************************************************************************
  62. */
  63. #define RFAL_T2T_BLOCK_LEN 4U /*!< T2T block length */
  64. #define RFAL_T2T_READ_DATA_LEN (4U * RFAL_T2T_BLOCK_LEN) /*!< T2T READ data length */
  65. #define RFAL_T2T_WRITE_DATA_LEN RFAL_T2T_BLOCK_LEN /*!< T2T WRITE data length */
  66. /*
  67. ******************************************************************************
  68. * GLOBAL TYPES
  69. ******************************************************************************
  70. */
  71. /*
  72. ******************************************************************************
  73. * GLOBAL FUNCTION PROTOTYPES
  74. ******************************************************************************
  75. */
  76. /*!
  77. *****************************************************************************
  78. * \brief NFC-A T2T Poller Read
  79. *
  80. * This method sends a Read command to a NFC-A T2T Listener device
  81. *
  82. *
  83. * \param[in] blockNum : Number of the block to read
  84. * \param[out] rxBuf : pointer to place the read data
  85. * \param[in] rxBufLen : size of rxBuf (RFAL_T2T_READ_DATA_LEN)
  86. * \param[out] rcvLen : actual received data
  87. *
  88. * \return ERR_WRONG_STATE : RFAL not initialized or mode not set
  89. * \return ERR_PARAM : Invalid parameter
  90. * \return ERR_PROTO : Protocol error
  91. * \return ERR_NONE : No error
  92. *****************************************************************************
  93. */
  94. ReturnCode
  95. rfalT2TPollerRead(uint8_t blockNum, uint8_t* rxBuf, uint16_t rxBufLen, uint16_t* rcvLen);
  96. /*!
  97. *****************************************************************************
  98. * \brief NFC-A T2T Poller Write
  99. *
  100. * This method sends a Write command to a NFC-A T2T Listener device
  101. *
  102. *
  103. * \param[in] blockNum : Number of the block to write
  104. * \param[in] wrData : data to be written on the given block
  105. * size must be of RFAL_T2T_WRITE_DATA_LEN
  106. *
  107. * \return ERR_WRONG_STATE : RFAL not initialized or mode not set
  108. * \return ERR_PARAM : Invalid parameter
  109. * \return ERR_PROTO : Protocol error
  110. * \return ERR_NONE : No error
  111. *****************************************************************************
  112. */
  113. ReturnCode rfalT2TPollerWrite(uint8_t blockNum, const uint8_t* wrData);
  114. /*!
  115. *****************************************************************************
  116. * \brief NFC-A T2T Poller Sector Select
  117. *
  118. * This method sends a Sector Select commands to a NFC-A T2T Listener device
  119. *
  120. * \param[in] sectorNum : Sector Number
  121. *
  122. * \return ERR_WRONG_STATE : RFAL not initialized or mode not set
  123. * \return ERR_PARAM : Invalid parameter
  124. * \return ERR_PROTO : Protocol error
  125. * \return ERR_NONE : No error
  126. *****************************************************************************
  127. */
  128. ReturnCode rfalT2TPollerSectorSelect(uint8_t sectorNum);
  129. #endif /* RFAL_T2T_H */
  130. /**
  131. * @}
  132. *
  133. * @}
  134. *
  135. * @}
  136. */