Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:01

0001 /*
0002  * Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
0003  * Copyright 2016-2017 NXP
0004  * All rights reserved.
0005  *
0006  * SPDX-License-Identifier: BSD-3-Clause
0007  */
0008 
0009 #ifndef _FSL_SMARTCARD_PHY_H_
0010 #define _FSL_SMARTCARD_PHY_H_
0011 
0012 #include "fsl_smartcard.h"
0013 
0014 /*!
0015  * @addtogroup smartcard_phy_driver
0016  * @{
0017  */
0018 
0019 /*******************************************************************************
0020  * Definitions
0021  ******************************************************************************/
0022 
0023 /*! @brief Smart card definition which specifies the adjustment number of clock cycles during which an ATR string has to
0024  * be received.
0025  */
0026 #define SMARTCARD_ATR_DURATION_ADJUSTMENT (360u)
0027 
0028 /*! @brief Smart card definition which specifies the adjustment number of clock cycles until an initial 'TS' character
0029  * has to be
0030  * received. */
0031 #define SMARTCARD_INIT_DELAY_CLOCK_CYCLES_ADJUSTMENT (4200u)
0032 
0033 /*******************************************************************************
0034  * API
0035  ******************************************************************************/
0036 
0037 #if defined(__cplusplus)
0038 extern "C" {
0039 #endif
0040 
0041 /*!
0042  * @brief Fills in the configuration structure with default values.
0043  *
0044  * @param config The Smart card user configuration structure which contains configuration structure of type
0045  * smartcard_interface_config_t.
0046  * Function fill in members:
0047  *      clockToResetDelay = 42000,
0048  *      vcc = kSmartcardVoltageClassB3_3V,
0049  * with default values.
0050  */
0051 void SMARTCARD_PHY_GetDefaultConfig(smartcard_interface_config_t *config);
0052 
0053 /*!
0054  * @brief Initializes a Smart card interface instance.
0055  *
0056  * @param base The Smart card peripheral base address.
0057  * @param config The user configuration structure of type smartcard_interface_config_t. Call the
0058  *  function SMARTCARD_PHY_GetDefaultConfig() to fill the configuration structure.
0059  * @param srcClock_Hz Smart card clock generation module source clock.
0060  *
0061  * @retval kStatus_SMARTCARD_Success or kStatus_SMARTCARD_OtherError in case of error.
0062  */
0063 status_t SMARTCARD_PHY_Init(void *base, smartcard_interface_config_t const *config, uint32_t srcClock_Hz);
0064 
0065 /*!
0066  * @brief De-initializes a Smart card interface, stops the Smart card clock, and disables the VCC.
0067  *
0068  * @param base The Smart card peripheral module base address.
0069  * @param config The user configuration structure of type smartcard_interface_config_t.
0070  */
0071 void SMARTCARD_PHY_Deinit(void *base, smartcard_interface_config_t const *config);
0072 
0073 /*!
0074  * @brief Activates the Smart card IC.
0075  *
0076  * @param base The Smart card peripheral module base address.
0077  * @param context A pointer to a Smart card driver context structure.
0078  * @param resetType type of reset to be performed, possible values
0079  *                       = kSmartcardColdReset, kSmartcardWarmReset
0080  *
0081  * @retval kStatus_SMARTCARD_Success or kStatus_SMARTCARD_OtherError in case of error.
0082  */
0083 status_t SMARTCARD_PHY_Activate(void *base, smartcard_context_t *context, smartcard_reset_type_t resetType);
0084 
0085 /*!
0086  * @brief De-activates the Smart card IC.
0087  *
0088  * @param base The Smart card peripheral module base address.
0089  * @param context A pointer to a Smart card driver context structure.
0090  *
0091  * @retval kStatus_SMARTCARD_Success or kStatus_SMARTCARD_OtherError in case of error.
0092  */
0093 status_t SMARTCARD_PHY_Deactivate(void *base, smartcard_context_t *context);
0094 
0095 /*!
0096  * @brief Controls the Smart card interface IC.
0097  *
0098  * @param base The Smart card peripheral module base address.
0099  * @param context A pointer to a Smart card driver context structure.
0100  * @param control A interface command type.
0101  * @param param Integer value specific to control type
0102  *
0103  * @retval kStatus_SMARTCARD_Success or kStatus_SMARTCARD_OtherError in case of error.
0104  */
0105 status_t SMARTCARD_PHY_Control(void *base,
0106                                smartcard_context_t *context,
0107                                smartcard_interface_control_t control,
0108                                uint32_t param);
0109 
0110 /*!
0111  * @brief Smart card interface IC IRQ ISR.
0112  *
0113  * @param base The Smart card peripheral module base address.
0114  * @param context The Smart card context pointer.
0115  */
0116 #if defined(USING_PHY_TDA8035)
0117 void SMARTCARD_PHY_IRQHandler(void *base, smartcard_context_t *context);
0118 #endif
0119 /*@}*/
0120 
0121 #if defined(__cplusplus)
0122 }
0123 #endif
0124 
0125 /*! @}*/
0126 
0127 #endif /* _FSL_SMARTCARD_PHY_H_*/