Home | History | Annotate | Download | only in src
      1 /*
      2  * Copyright (C) 2010 NXP Semiconductors
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 /*
     18  * \file  phFriNfc_MapTools.h
     19  * \brief NFC Internal Ndef Mapping File.
     20  *
     21  * Project: NFC-FRI
     22  *
     23  * $Date: Fri Oct 15 13:50:54 2010 $
     24  * $Author: ing02260 $
     25  * $Revision: 1.6 $
     26  * $Aliases:  $
     27  *
     28  */
     29 
     30 #ifndef PHFRINFC_MAPTOOLS_H
     31 #define PHFRINFC_MAPTOOLS_H
     32 
     33 #include <phFriNfc.h>
     34 #ifdef PH_HAL4_ENABLE
     35 #include <phHal4Nfc.h>
     36 #else
     37 #include <phHalNfc.h>
     38 #endif
     39 #include <phNfcTypes.h>
     40 #include <phNfcStatus.h>
     41 #include <phFriNfc_NdefMap.h>
     42 
     43 /*!
     44  * \name phFriNfc_MapTools.h
     45  *       This file has functions which are used common across all the
     46          typ1/type2/type3/type4 tags.
     47  *
     48  */
     49 /*@{*/
     50 
     51 #define PH_FRINFC_NDEFMAP_TLVLEN_ZERO           0
     52 
     53 /* NFC Device Major and Minor Version numbers*/
     54 /* !!CAUTION!! these needs to be updated periodically.Major and Minor version numbers
     55    should be compatible to the version number of currently implemented mapping document.
     56     Example : NFC Device version Number : 1.0 , specifies
     57               Major VNo is 1,
     58               Minor VNo is 0 */
     59 #define PH_NFCFRI_NDEFMAP_NFCDEV_MAJOR_VER_NUM             0x01
     60 #ifdef DESFIRE_EV1
     61 #define PH_NFCFRI_NDEFMAP_NFCDEV_MAJOR_VER_NUM_2           0x02
     62 #endif /* */
     63 #define PH_NFCFRI_NDEFMAP_NFCDEV_MINOR_VER_NUM             0x00
     64 
     65 /* Macros to find major and minor TAG : Ex:Type1/Type2/Type3/Type4 version numbers*/
     66 #define PH_NFCFRI_NDEFMAP_GET_MAJOR_TAG_VERNO(a)           (((a) & (0xf0))>>(4))
     67 #define PH_NFCFRI_NDEFMAP_GET_MINOR_TAG_VERNO(a)           ((a) & (0x0f))
     68 
     69 /* NFC Device Major and Minor Version numbers*/
     70 /* !!CAUTION!! these needs to be updated periodically.Major and Minor version numbers
     71    should be compatible to the version number of currently implemented mapping document.
     72     Example : NFC Device version Number : 1.0 , specifies
     73               Major VNo is 1,
     74               Minor VNo is 0 */
     75 #define PH_NFCFRI_MFSTDMAP_NFCDEV_MAJOR_VER_NUM             0x40
     76 #define PH_NFCFRI_MFSTDMAP_NFCDEV_MINOR_VER_NUM             0x00
     77 
     78 /* Macros to find major and minor TAG : Ex:Type1/Type2/Type3/Type4 version numbers*/
     79 #define PH_NFCFRI_MFSTDMAP_GET_MAJOR_TAG_VERNO(a)           ((a) & (0x40)) // must be 0xC0
     80 #define PH_NFCFRI_MFSTDMAP_GET_MINOR_TAG_VERNO(a)           ((a) & (0x30))
     81 
     82 /*!
     83  * \name NDEF Mapping - states of the Finite State machine
     84  *
     85  */
     86 /*@{*/
     87 
     88 
     89 NFCSTATUS   phFriNfc_MapTool_ChkSpcVer( const phFriNfc_NdefMap_t  *NdefMap,
     90                                         uint8_t             VersionIndex);
     91 
     92 NFCSTATUS phFriNfc_MapTool_SetCardState(phFriNfc_NdefMap_t  *NdefMap,
     93                                         uint32_t            Length);
     94 
     95 #endif //PHFRINFC_MAPTOOLS_H
     96