code update
[adaptation/devices/nfc-plugin-nxp.git] / inc / phNfcLlcpTypes.h
1 /*\r
2  * Copyright (C) 2010 NXP Semiconductors\r
3  *\r
4  * Licensed under the Apache License, Version 2.0 (the "License");\r
5  * you may not use this file except in compliance with the License.\r
6  * You may obtain a copy of the License at\r
7  *\r
8  *      http://www.apache.org/licenses/LICENSE-2.0\r
9  *\r
10  * Unless required by applicable law or agreed to in writing, software\r
11  * distributed under the License is distributed on an "AS IS" BASIS,\r
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13  * See the License for the specific language governing permissions and\r
14  * limitations under the License.\r
15  */\r
16 \r
17 /**\r
18  * \file  phNfcLlcpTypes.h\r
19  * \brief NFC LLCP public types\r
20  *\r
21  * Project: NFC-FRI\r
22  *\r
23  */\r
24 \r
25 \r
26 #ifndef PHNFCLLCPTYPES_H /* */\r
27 #define PHNFCLLCPTYPES_H /* */\r
28 \r
29 #include <phNfcTypes.h>\r
30 #include <phLibNfcStatus.h>\r
31 \r
32 /*=========== CONSTANTS ===========*/\r
33 \r
34 /**\r
35  *  \name LLCP default parameters.\r
36  *\r
37  *  Definitions for use when wanting to use default LLCP parameter values.\r
38  *\r
39  */\r
40  /*@{*/\r
41 #define PHFRINFC_LLCP_MIU_DEFAULT         128  /**< Default MIU value (in bytes).*/\r
42 #define PHFRINFC_LLCP_WKS_DEFAULT         1    /**< Default WKS value (bitfield).*/\r
43 #define PHFRINFC_LLCP_LTO_DEFAULT         10   /**< Default LTO value (in step of 10ms).*/\r
44 #define PHFRINFC_LLCP_RW_DEFAULT          1    /**< Default RW value (in frames).*/\r
45 #define PHFRINFC_LLCP_OPTION_DEFAULT      0    /**< Default OPTION value (in frames).*/\r
46 #define PHFRINFC_LLCP_MIUX_DEFAULT        0    /**< Default MIUX value (in bytes) */\r
47 #define PHFRINFC_LLCP_SN_MAX_LENGTH       255  /**< Max length value for the Service Name */\r
48 #define PHFRINFC_LLCP_RW_MAX              15   /**< Max RW value (in frames).*/\r
49 /*@}*/\r
50 \r
51 /**\r
52  *  \name LLCP config parameters.\r
53  *\r
54  *  Definitions used for internal LLCP configuration.\r
55  *\r
56  */\r
57  /*@{*/\r
58 #define PHFRINFC_LLCP_NB_SOCKET_MAX          10                                /**< Max.number of simultaneous sockets */\r
59 /*@}*/\r
60 \r
61 /**\r
62  * \internal \r
63  * \name Fixed value for ERROR op code.\r
64  *\r
65  */\r
66 /*@{*/\r
67 #define PHFRINFC_LLCP_ERR_DISCONNECTED               0x00\r
68 #define PHFRINFC_LLCP_ERR_FRAME_REJECTED             0x01\r
69 #define PHFRINFC_LLCP_ERR_BUSY_CONDITION             0x02\r
70 #define PHFRINFC_LLCP_ERR_NOT_BUSY_CONDITION         0x03\r
71 \r
72 /**\r
73  * \internal \r
74  * \name Fixed value for DM op code.\r
75  *\r
76  */\r
77 /*@{*/\r
78 #define PHFRINFC_LLCP_DM_OPCODE_DISCONNECTED               0x00\r
79 #define PHFRINFC_LLCP_DM_OPCODE_SAP_NOT_ACTIVE             0x01\r
80 #define PHFRINFC_LLCP_DM_OPCODE_SAP_NOT_FOUND              0x02\r
81 #define PHFRINFC_LLCP_DM_OPCODE_CONNECT_REJECTED           0x03\r
82 #define PHFRINFC_LLCP_DM_OPCODE_CONNECT_NOT_ACCEPTED       0x20\r
83 #define PHFRINFC_LLCP_DM_OPCODE_SOCKET_NOT_AVAILABLE       0x21\r
84 \r
85 \r
86 /*========== ENUMERATES ===========*/\r
87 \r
88 /* Enum reperesents the different LLCP Link status*/\r
89 typedef enum phFriNfc_LlcpMac_eLinkStatus\r
90 {\r
91    phFriNfc_LlcpMac_eLinkDefault,\r
92    phFriNfc_LlcpMac_eLinkActivated,\r
93    phFriNfc_LlcpMac_eLinkDeactivated\r
94 }phFriNfc_LlcpMac_eLinkStatus_t;\r
95 \r
96 /* Enum represents the different Socket types  */\r
97 typedef enum phFriNfc_LlcpTransport_eSocketType\r
98 {\r
99    phFriNfc_LlcpTransport_eDefaultType,\r
100    phFriNfc_LlcpTransport_eConnectionOriented,\r
101    phFriNfc_LlcpTransport_eConnectionLess\r
102 }phFriNfc_LlcpTransport_eSocketType_t;\r
103 \r
104 \r
105 /*========== STRUCTURES ===========*/\r
106 \r
107 typedef struct phFriNfc_LlcpTransport_sSocketOptions\r
108 {\r
109     /** The remote Maximum Information Unit Extension (NOTE: this is MIUX, not MIU !)*/\r
110     uint16_t miu;\r
111 \r
112    /** The Receive Window size (4 bits)*/\r
113    uint8_t rw;\r
114 \r
115 }phFriNfc_LlcpTransport_sSocketOptions_t;\r
116 \r
117 typedef struct phFriNfc_Llcp_sLinkParameters\r
118 {\r
119     /** The remote Maximum Information Unit (NOTE: this is MIU, not MIUX !)*/\r
120     uint16_t   miu;\r
121 \r
122     /** The remote Well-Known Services*/\r
123     uint16_t   wks;\r
124 \r
125     /** The remote Link TimeOut (in 1/100s)*/\r
126     uint8_t    lto;\r
127 \r
128     /** The remote options*/\r
129     uint8_t    option;\r
130 \r
131 } phFriNfc_Llcp_sLinkParameters_t;\r
132 \r
133 #endif\r
134 \r
135 /* EOF */\r