• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_MIUX_MAX            0x7FF    /**< Max MIUX value (in bytes) */
48 #define PHFRINFC_LLCP_PDU_HEADER_MAX      3    /**< Max size of PDU header (in bytes) */
49 #define PHFRINFC_LLCP_SN_MAX_LENGTH       255  /**< Max length value for the Service Name */
50 #define PHFRINFC_LLCP_RW_MAX              15   /**< Max RW value (in frames).*/
51 /*@}*/
52 
53 /**
54  *  \name LLCP config parameters.
55  *
56  *  Definitions used for internal LLCP configuration.
57  *
58  */
59  /*@{*/
60 #define PHFRINFC_LLCP_NB_SOCKET_MAX          10                                /**< Max.number of simultaneous sockets */
61 #define PHFRINFC_LLCP_SNL_RESPONSE_MAX       256                               /**< Max.number of simultaneous discovery requests */
62 /*@}*/
63 
64 /**
65  * \internal
66  * \name Fixed value for ERROR op code.
67  *
68  */
69 /*@{*/
70 #define PHFRINFC_LLCP_ERR_DISCONNECTED               0x00
71 #define PHFRINFC_LLCP_ERR_FRAME_REJECTED             0x01
72 #define PHFRINFC_LLCP_ERR_BUSY_CONDITION             0x02
73 #define PHFRINFC_LLCP_ERR_NOT_BUSY_CONDITION         0x03
74 
75 /**
76  * \internal
77  * \name Fixed value for DM op code.
78  *
79  */
80 /*@{*/
81 #define PHFRINFC_LLCP_DM_OPCODE_DISCONNECTED               0x00
82 #define PHFRINFC_LLCP_DM_OPCODE_SAP_NOT_ACTIVE             0x01
83 #define PHFRINFC_LLCP_DM_OPCODE_SAP_NOT_FOUND              0x02
84 #define PHFRINFC_LLCP_DM_OPCODE_CONNECT_REJECTED           0x03
85 #define PHFRINFC_LLCP_DM_OPCODE_CONNECT_NOT_ACCEPTED       0x20
86 #define PHFRINFC_LLCP_DM_OPCODE_SOCKET_NOT_AVAILABLE       0x21
87 
88 
89 /*========== ENUMERATES ===========*/
90 
91 /* Enum reperesents the different LLCP Link status*/
92 typedef enum phFriNfc_LlcpMac_eLinkStatus
93 {
94    phFriNfc_LlcpMac_eLinkDefault,
95    phFriNfc_LlcpMac_eLinkActivated,
96    phFriNfc_LlcpMac_eLinkDeactivated
97 }phFriNfc_LlcpMac_eLinkStatus_t;
98 
99 /* Enum represents the different Socket types  */
100 typedef enum phFriNfc_LlcpTransport_eSocketType
101 {
102    phFriNfc_LlcpTransport_eDefaultType,
103    phFriNfc_LlcpTransport_eConnectionOriented,
104    phFriNfc_LlcpTransport_eConnectionLess
105 }phFriNfc_LlcpTransport_eSocketType_t;
106 
107 
108 /*========== STRUCTURES ===========*/
109 
110 typedef struct phFriNfc_LlcpTransport_sSocketOptions
111 {
112     /** The remote Maximum Information Unit Extension (NOTE: this is MIUX, not MIU !)*/
113     uint16_t miu;
114 
115    /** The Receive Window size (4 bits)*/
116    uint8_t rw;
117 
118 }phFriNfc_LlcpTransport_sSocketOptions_t;
119 
120 typedef struct phFriNfc_Llcp_sLinkParameters
121 {
122     /** The remote Maximum Information Unit (NOTE: this is MIU, not MIUX !)*/
123     uint16_t   miu;
124 
125     /** The remote Well-Known Services*/
126     uint16_t   wks;
127 
128     /** The remote Link TimeOut (in 1/100s)*/
129     uint8_t    lto;
130 
131     /** The remote options*/
132     uint8_t    option;
133 
134 } phFriNfc_Llcp_sLinkParameters_t;
135 
136 #endif
137 
138 /* EOF */
139