fsl_smartcard_phy.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /*
  2. * The Clear BSD License
  3. * Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
  4. * Copyright 2016-2017 NXP
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without modification,
  8. * are permitted (subject to the limitations in the disclaimer below) provided
  9. * that the following conditions are met:
  10. *
  11. * o Redistributions of source code must retain the above copyright notice, this list
  12. * of conditions and the following disclaimer.
  13. *
  14. * o Redistributions in binary form must reproduce the above copyright notice, this
  15. * list of conditions and the following disclaimer in the documentation and/or
  16. * other materials provided with the distribution.
  17. *
  18. * o Neither the name of the copyright holder nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  24. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  25. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  26. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  27. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  28. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  29. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  30. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  31. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  32. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. */
  34. #ifndef _FSL_SMARTCARD_PHY_H_
  35. #define _FSL_SMARTCARD_PHY_H_
  36. #include "fsl_smartcard.h"
  37. /*!
  38. * @addtogroup smartcard_phy_driver
  39. * @{
  40. */
  41. /*******************************************************************************
  42. * Definitions
  43. ******************************************************************************/
  44. /*! @brief Smart card definition which specifies the adjustment number of clock cycles during which an ATR string has to
  45. * be received.
  46. */
  47. #define SMARTCARD_ATR_DURATION_ADJUSTMENT (360u)
  48. /*! @brief Smart card definition which specifies the adjustment number of clock cycles until an initial 'TS' character
  49. * has to be
  50. * received. */
  51. #define SMARTCARD_INIT_DELAY_CLOCK_CYCLES_ADJUSTMENT (4200u)
  52. /*******************************************************************************
  53. * API
  54. ******************************************************************************/
  55. #if defined(__cplusplus)
  56. extern "C" {
  57. #endif
  58. /*!
  59. * @brief Fills in the configuration structure with default values.
  60. *
  61. * @param config The Smart card user configuration structure which contains configuration structure of type
  62. * smartcard_interface_config_t.
  63. * Function fill in members:
  64. * clockToResetDelay = 42000,
  65. * vcc = kSmartcardVoltageClassB3_3V,
  66. * with default values.
  67. */
  68. void SMARTCARD_PHY_GetDefaultConfig(smartcard_interface_config_t *config);
  69. /*!
  70. * @brief Initializes a Smart card interface instance.
  71. *
  72. * @param base The Smart card peripheral base address.
  73. * @param config The user configuration structure of type smartcard_interface_config_t. Call the
  74. * function SMARTCARD_PHY_GetDefaultConfig() to fill the configuration structure.
  75. * @param srcClock_Hz Smart card clock generation module source clock.
  76. *
  77. * @retval kStatus_SMARTCARD_Success or kStatus_SMARTCARD_OtherError in case of error.
  78. */
  79. status_t SMARTCARD_PHY_Init(void *base, smartcard_interface_config_t const *config, uint32_t srcClock_Hz);
  80. /*!
  81. * @brief De-initializes a Smart card interface, stops the Smart card clock, and disables the VCC.
  82. *
  83. * @param base The Smart card peripheral module base address.
  84. * @param config The user configuration structure of type smartcard_interface_config_t.
  85. */
  86. void SMARTCARD_PHY_Deinit(void *base, smartcard_interface_config_t const *config);
  87. /*!
  88. * @brief Activates the Smart card IC.
  89. *
  90. * @param base The Smart card peripheral module base address.
  91. * @param context A pointer to a Smart card driver context structure.
  92. * @param resetType type of reset to be performed, possible values
  93. * = kSmartcardColdReset, kSmartcardWarmReset
  94. *
  95. * @retval kStatus_SMARTCARD_Success or kStatus_SMARTCARD_OtherError in case of error.
  96. */
  97. status_t SMARTCARD_PHY_Activate(void *base, smartcard_context_t *context, smartcard_reset_type_t resetType);
  98. /*!
  99. * @brief De-activates the Smart card IC.
  100. *
  101. * @param base The Smart card peripheral module base address.
  102. * @param context A pointer to a Smart card driver context structure.
  103. *
  104. * @retval kStatus_SMARTCARD_Success or kStatus_SMARTCARD_OtherError in case of error.
  105. */
  106. status_t SMARTCARD_PHY_Deactivate(void *base, smartcard_context_t *context);
  107. /*!
  108. * @brief Controls the Smart card interface IC.
  109. *
  110. * @param base The Smart card peripheral module base address.
  111. * @param context A pointer to a Smart card driver context structure.
  112. * @param control A interface command type.
  113. * @param param Integer value specific to control type
  114. *
  115. * @retval kStatus_SMARTCARD_Success or kStatus_SMARTCARD_OtherError in case of error.
  116. */
  117. status_t SMARTCARD_PHY_Control(void *base,
  118. smartcard_context_t *context,
  119. smartcard_interface_control_t control,
  120. uint32_t param);
  121. /*!
  122. * @brief Smart card interface IC IRQ ISR.
  123. *
  124. * @param base The Smart card peripheral module base address.
  125. * @param context The Smart card context pointer.
  126. */
  127. #if defined(USING_PHY_TDA8035)
  128. void SMARTCARD_PHY_IRQHandler(void *base, smartcard_context_t *context);
  129. #endif
  130. /*@}*/
  131. #if defined(__cplusplus)
  132. }
  133. #endif
  134. /*! @}*/
  135. #endif /* _FSL_SMARTCARD_PHY_H_*/