Home | History | Annotate | Download | only in inc
      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  phNfcLlcpTypes.h
     19  * \brief NFC LLCP public types
     20  *
     21  * Project: NFC-FRI
     22  *
     23  */
     24 
     25 
     26 #ifndef PHNFCLLCPTYPES_H /* */
     27 #define PHNFCLLCPTYPES_H /* */
     28 
     29 #include <phNfcTypes.h>
     30 #include <phLibNfcStatus.h>
     31 
     32 /*=========== CONSTANTS ===========*/
     33 
     34 /**
     35  *  \name LLCP default parameters.
     36  *
     37  *  Definitions for use when wanting to use default LLCP parameter values.
     38  *
     39  */
     40  /*@{*/
     41 #define PHFRINFC_LLCP_MIU_DEFAULT         128  /**< Default MIU value (in bytes).*/
     42 #define PHFRINFC_LLCP_WKS_DEFAULT         1    /**< Default WKS value (bitfield).*/
     43 #define PHFRINFC_LLCP_LTO_DEFAULT         10   /**< Default LTO value (in step of 10ms).*/
     44 #define PHFRINFC_LLCP_RW_DEFAULT          1    /**< Default RW value (in frames).*/
     45 #define PHFRINFC_LLCP_OPTION_DEFAULT      0    /**< Default OPTION value (in frames).*/
     46 #define PHFRINFC_LLCP_MIUX_DEFAULT        0    /**< Default MIUX value (in bytes) */
     47 #define PHFRINFC_LLCP_SN_MAX_LENGTH       255  /**< Max length value for the Service Name */
     48 #define PHFRINFC_LLCP_RW_MAX              15   /**< Max RW value (in frames).*/
     49 /*@}*/
     50 
     51 /**
     52  *  \name LLCP config parameters.
     53  *
     54  *  Definitions used for internal LLCP configuration.
     55  *
     56  */
     57  /*@{*/
     58 #define PHFRINFC_LLCP_NB_SOCKET_MAX          5                                 /**< Max.number of simultaneous sockets */
     59 /*@}*/
     60 
     61 /**
     62  * \internal
     63  * \name Fixed value for ERROR op code.
     64  *
     65  */
     66 /*@{*/
     67 #define PHFRINFC_LLCP_ERR_DISCONNECTED               0x00
     68 #define PHFRINFC_LLCP_ERR_FRAME_REJECTED             0x01
     69 #define PHFRINFC_LLCP_ERR_BUSY_CONDITION             0x02
     70 #define PHFRINFC_LLCP_ERR_NOT_BUSY_CONDITION         0x03
     71 
     72 /**
     73  * \internal
     74  * \name Fixed value for DM op code.
     75  *
     76  */
     77 /*@{*/
     78 #define PHFRINFC_LLCP_DM_OPCODE_DISCONNECTED               0x00
     79 #define PHFRINFC_LLCP_DM_OPCODE_SAP_NOT_ACTIVE             0x01
     80 #define PHFRINFC_LLCP_DM_OPCODE_SAP_NOT_FOUND              0x02
     81 #define PHFRINFC_LLCP_DM_OPCODE_CONNECT_REJECTED           0x03
     82 #define PHFRINFC_LLCP_DM_OPCODE_CONNECT_NOT_ACCEPTED       0x20
     83 #define PHFRINFC_LLCP_DM_OPCODE_SOCKET_NOT_AVAILABLE       0x21
     84 
     85 
     86 /*========== ENUMERATES ===========*/
     87 
     88 /* Enum reperesents the different LLCP Link status*/
     89 typedef enum phFriNfc_LlcpMac_eLinkStatus
     90 {
     91    phFriNfc_LlcpMac_eLinkDefault,
     92    phFriNfc_LlcpMac_eLinkActivated,
     93    phFriNfc_LlcpMac_eLinkDeactivated
     94 }phFriNfc_LlcpMac_eLinkStatus_t;
     95 
     96 /* Enum represents the different Socket types  */
     97 typedef enum phFriNfc_LlcpTransport_eSocketType
     98 {
     99    phFriNfc_LlcpTransport_eDefaultType,
    100    phFriNfc_LlcpTransport_eConnectionOriented,
    101    phFriNfc_LlcpTransport_eConnectionLess
    102 }phFriNfc_LlcpTransport_eSocketType_t;
    103 
    104 
    105 /*========== STRUCTURES ===========*/
    106 
    107 typedef struct phFriNfc_LlcpTransport_sSocketOptions
    108 {
    109     /** The remote Maximum Information Unit Extension (NOTE: this is MIUX, not MIU !)*/
    110     uint16_t miu;
    111 
    112    /** The Receive Window size (4 bits)*/
    113    uint8_t rw;
    114 
    115 }phFriNfc_LlcpTransport_sSocketOptions_t;
    116 
    117 typedef struct phFriNfc_Llcp_sLinkParameters
    118 {
    119     /** The remote Maximum Information Unit (NOTE: this is MIU, not MIUX !)*/
    120     uint16_t   miu;
    121 
    122     /** The remote Well-Known Services*/
    123     uint16_t   wks;
    124 
    125     /** The remote Link TimeOut (in 1/100s)*/
    126     uint8_t    lto;
    127 
    128     /** The remote options*/
    129     uint8_t    option;
    130 
    131 } phFriNfc_Llcp_sLinkParameters_t;
    132 
    133 #endif
    134 
    135 /* EOF */
    136