SAMV71 Xplained Ultra Software Package 1.5

iso7816_4.h

00001 /* ---------------------------------------------------------------------------- */
00002 /*                  Atmel Microcontroller Software Support                      */
00003 /*                       SAM Software Package License                           */
00004 /* ---------------------------------------------------------------------------- */
00005 /* Copyright (c) 2015, Atmel Corporation                                        */
00006 /*                                                                              */
00007 /* All rights reserved.                                                         */
00008 /*                                                                              */
00009 /* Redistribution and use in source and binary forms, with or without           */
00010 /* modification, are permitted provided that the following condition is met:    */
00011 /*                                                                              */
00012 /* - Redistributions of source code must retain the above copyright notice,     */
00013 /* this list of conditions and the disclaimer below.                            */
00014 /*                                                                              */
00015 /* Atmel's name may not be used to endorse or promote products derived from     */
00016 /* this software without specific prior written permission.                     */
00017 /*                                                                              */
00018 /* DISCLAIMER:  THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR   */
00019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
00020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE   */
00021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,      */
00022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
00023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,  */
00024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    */
00025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING         */
00026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
00027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           */
00028 /* ---------------------------------------------------------------------------- */
00029 
00030 //------------------------------------------------------------------------------
00031 /** \page
00032  *
00033  *  \section Purpose
00034  *
00035  *  Definition of methods for ISO7816 driver.
00036  *
00037  *  \section Usage
00038  *
00039  *  -# ISO7816_Init
00040  *  -# ISO7816_IccPowerOff
00041  *  -# ISO7816_XfrBlockTPDU_T0
00042  *  -# ISO7816_Escape
00043  *  -# ISO7816_RestartClock
00044  *  -# ISO7816_StopClock
00045  *  -# ISO7816_toAPDU
00046  *  -# ISO7816_Datablock_ATR
00047  *  -# ISO7816_SetDataRateandClockFrequency
00048  *  -# ISO7816_StatusReset
00049  *  -# ISO7816_cold_reset
00050  *  -# ISO7816_warm_reset
00051  *  -# ISO7816_Decode_ATR
00052  *----------------------------------------------------------------------------*/
00053 
00054 #ifndef ISO7816_4_H
00055 #define ISO7816_4_H
00056 
00057 #include "chip.h"
00058 
00059 /*------------------------------------------------------------------------------
00060  * Constants Definition
00061  *----------------------------------------------------------------------------*/
00062 
00063 /** Size max of Answer To Reset */
00064 #define ATR_SIZE_MAX            55
00065 
00066 /** NULL byte to restart byte procedure */
00067 #define ISO_NULL_VAL            0x60
00068 
00069 /*------------------------------------------------------------------------------
00070  *         Exported functions
00071  *----------------------------------------------------------------------------*/
00072 
00073 extern void ISO7816_Init(
00074     Usart *pUsart,
00075     uint32_t usartId ,
00076     const Pin pPinIso7816RstMC);
00077 
00078 extern void ISO7816_IccPowerOff(void);
00079 
00080 extern uint16_t ISO7816_XfrBlockTPDU_T0(
00081     const uint8_t *pAPDU,
00082     uint8_t *pMessage,
00083     uint16_t wLength);
00084 
00085 extern void ISO7816_Escape(void);
00086 
00087 extern void ISO7816_RestartClock(void);
00088 
00089 extern void ISO7816_StopClock(void);
00090 
00091 extern void ISO7816_toAPDU(void);
00092 
00093 extern void ISO7816_Datablock_ATR(
00094     uint8_t *pAtr,
00095     uint8_t *pLength);
00096 
00097 extern void ISO7816_SetDataRateandClockFrequency(
00098     uint32_t dwClockFrequency,
00099     uint32_t dwDataRate);
00100 
00101 extern uint8_t ISO7816_StatusReset(void);
00102 
00103 extern void ISO7816_cold_reset(void);
00104 
00105 extern void ISO7816_warm_reset(void);
00106 
00107 extern void ISO7816_Decode_ATR(uint8_t *pAtr);
00108 
00109 #endif /* ISO7816_4_H */
00110 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines