/usr/include/android-19/libnfc-nxp/phHciNfc_Generic.h is in android-headers-19 23-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 | /*
* Copyright (C) 2010 NXP Semiconductors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*!
* =========================================================================== *
* *
* *
* \file phHciNfc_Generic.h *
* \brief Common HCI Header for the Generic HCI Management. *
* *
* *
* Project: NFC-FRI-1.1 *
* *
* $Date: Mon Mar 29 17:34:47 2010 $ *
* $Author: ing04880 $ *
* $Revision: 1.73 $ *
* $Aliases: NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $
* *
* =========================================================================== *
*/
/*@{*/
#ifndef PHHCINFC_GENERIC_H
#define PHHCINFC_GENERIC_H
/*@}*/
/**
* \name HCI
*
* File: \ref phHciNfc_Generic.h
*
*/
/*@{*/
#define PHHCINFC_GENERIC_FILEREVISION "$Revision: 1.73 $" /**< \ingroup grp_file_attributes */
#define PHHCINFC_GENERIC_FILEALIASES "$Aliases: NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $" /**< \ingroup grp_file_attributes */
/*@}*/
/*
################################################################################
***************************** Header File Inclusion ****************************
################################################################################
*/
#define LOG_TAG "NFC-HCI"
#include <cutils/log.h>
#include <phNfcIoctlCode.h>
#include<phNfcInterface.h>
#include <phHciNfc.h>
/*
################################################################################
****************************** Macro Definitions *******************************
################################################################################
*/
#define Trace_buffer phOsalNfc_DbgTraceBuffer
/* HCI TRACE Macros */
#if defined(HCI_TRACE)&& !defined(SILENT_HCI)
#include <phOsalNfc.h>
#include <stdio.h>
extern char phOsalNfc_DbgTraceBuffer[];
#define MAX_TRACE_BUFFER 150
/* #define HCI_PRINT( str ) phOsalNfc_DbgTrace(str) */
#define HCI_PRINT( str ) phOsalNfc_DbgString(str)
#define HCI_DEBUG(...) ALOGD(__VA_ARGS__)
#define HCI_PRINT_BUFFER(msg,buf,len) \
{ \
snprintf(Trace_buffer,MAX_TRACE_BUFFER,"\t %s:",msg); \
phOsalNfc_DbgString(Trace_buffer); \
phOsalNfc_DbgTrace(buf,len); \
phOsalNfc_DbgString("\r"); \
\
}
#else
#include <phDbgTrace.h>
#if defined(PHDBG_TRACES) && !defined(HCI_TRACE)
#define HCI_PRINT( str ) PHDBG_INFO(str)
#define HCI_DEBUG(str, arg)
#define HCI_PRINT_BUFFER(msg,buf,len)
#else
#define HCI_PRINT( str )
#define HCI_DEBUG(...)
#define HCI_PRINT_BUFFER(msg,buf,len)
#endif /* #if defined(PHDBG_TRACES) */
/* #if defined(PHDBG_INFO) && defined (PHDBG_CRITICAL_ERROR) */
#endif /* #if defined(HCI_TRACE) */
#define ZERO 0x00U
#ifdef MASK_BITS
#define BYTE_SIZE 0x08U
/* HCI GET and SET BITS Macros */
#define MASK_BITS8(p,l) \
( ( (((uint8_t)(p))+((uint8_t)(l)))<=BYTE_SIZE )? \
(~(0xFFU<<((p)+(l))) & (0xFFU<<(p))):(0U) )
#ifdef MASK_BITS
#define GET_BITS8(num,p,l) \
( ((((uint8_t)(p))+((uint8_t)(l)))<=BYTE_SIZE)? \
(((num)& (MASK_BITS8(p,l)))>>(p)):(0U) )
#else
#define GET_BITS8(num,p,l) \
( ((((p)+(l))<=BYTE_SIZE))? \
(((num)>>(p))& (~(0xFFU<<(l)))):(0U) )
#endif
#define SET_BITS8(num,p,l,val) \
( ((((uint8_t)(p))+((uint8_t)(l)))<=BYTE_SIZE)? \
(((num)& (~MASK_BITS8(p,l)))|((val)<<(p))):(0U))
#endif
/** \ingroup grp_hci_retval
The Corresponding HCI Gate Not Supported.
*/
#define NFCSTATUS_HCI_GATE_NOT_SUPPORTED (0x71U)
/** \ingroup grp_hci_retval
Invalid Command from the HCI Layer
*/
#define NFCSTATUS_INVALID_HCI_COMMAND (0x72U)
/** \ingroup grp_hci_retval
HCI Command not supported . */
#define NFCSTATUS_COMMAND_NOT_SUPPORTED (0x73U)
/** \ingroup grp_hci_retval
Invalide Response from the HCI Layer
*/
#define NFCSTATUS_INVALID_HCI_RESPONSE (0x74U)
/** \ingroup grp_hci_retval
The Invalid Instruction type (Neither Command/Response nor Event ).
*/
#define NFCSTATUS_INVALID_HCI_INSTRUCTION (0x75U)
/** \ingroup grp_hci_retval
The Invalid Instruction type (Neither Command/Response nor Event ).
*/
#define NFCSTATUS_INVALID_HCI_INFORMATION (0x76U)
/** \ingroup grp_hci_retval
The Invalid HCI Sequence.
*/
#define NFCSTATUS_INVALID_HCI_SEQUENCE (0x78U)
/** \ingroup grp_hci_retval
The HCI Error Response with Response code.
*/
#define NFCSTATUS_HCI_RESPONSE(code) (code)
/* Length of the HCP and the HCP Message Header in Bytes */
#define HCP_HEADER_LEN 0x02U
/* Length of the HCP Message Header in Bytes */
#define HCP_MESSAGE_LEN 0x01U
/* HCP Header Chaining Bit Offset */
#define HCP_CHAINBIT_OFFSET 0x07U
/* HCP Header Chaining Bit Length */
#define HCP_CHAINBIT_LEN 0x01U
/* Chaining Bit Values */
#define HCP_CHAINBIT_DEFAULT 0x01U
#define HCP_CHAINBIT_BEGIN 0x00U
#define HCP_CHAINBIT_END HCP_CHAINBIT_DEFAULT
/* HCP Header Pipe ID Offset */
#define HCP_PIPEID_OFFSET 0x00U
/* HCP Header Pipe ID Length */
#define HCP_PIPEID_LEN 0x07U
/* HCP Message Header Type Offset */
#define HCP_MSG_TYPE_OFFSET 0x06U
/* HCP Message Header Type Length */
#define HCP_MSG_TYPE_LEN 0x02U
/* HCP Message Type Values */
#define HCP_MSG_TYPE_COMMAND 0x00U
#define HCP_MSG_TYPE_EVENT 0x01U
#define HCP_MSG_TYPE_RESPONSE 0x02U
#define HCP_MSG_TYPE_RESERVED 0x03U
/* HCP Message Header Instruction Offset */
#define HCP_MSG_INSTRUCTION_OFFSET 0x00U
/* HCP Message Header Instruction Length */
#define HCP_MSG_INSTRUCTION_LEN 0x06U
/* HCP Invalid Message Instruction */
#define HCP_MSG_INSTRUCTION_INVALID 0x3FU
/* HCP Packet Zero Length */
#define HCP_ZERO_LEN 0x00U
/** \internal Generic HCI Commands for all the Gates */
#define ANY_SET_PARAMETER 0x01U
#define ANY_GET_PARAMETER 0x02U
#define ANY_OPEN_PIPE 0x03U
#define ANY_CLOSE_PIPE 0x04U
#define ANY_GENERIC_CMD_RFU_B 0x05U
#define ANY_GENERIC_CMD_RFU_E 0x0FU
/*
* 0x05-0x0F is Reserved for Future Use
*/
/** \internal HCI Administration Com mands for the Management of the Host Network */
#define ADM_CREATE_PIPE 0x10U
#define ADM_DELETE_PIPE 0x11U
#define ADM_NOTIFY_PIPE_CREATED 0x12U
#define ADM_NOTIFY_PIPE_DELETED 0x13U
#define ADM_CLEAR_ALL_PIPE 0x14U
#define ADM_NOTIFY_ALL_PIPE_CLEARED 0x15U
#define ADM_CMD_RFU_B 0x16U
#define ADM_CMD_RFU_E 0x3FU
#define MSG_INSTRUCTION_UNKNWON 0x3FU
/*
* 0x16-0x3F is Reserved for Future Use
*/
/** \internal HCI Generic Responses from the Gates */
#define ANY_OK 0x00U
#define ANY_E_NOT_CONNECTED 0x01U
#define ANY_E_CMD_PAR_UNKNOWN 0x02U
#define ANY_E_NOK 0x03U
#define ANY_E_PIPES_FULL 0x04U
#define ANY_E_REG_PAR_UNKNOWN 0x05U
#define ANY_E_PIPE_NOT_OPENED 0x06U
#define ANY_E_CMD_NOT_SUPPORTED 0x07U
#define ANY_E_INHIBITED 0x08U
#define ANY_E_TIMEOUT 0x09U
#define ANY_E_REG_ACCESS_DENIED 0x0AU
#define ANY_E_PIPE_ACCESS_DENIED 0x0BU
/* Response Error Code for RF Reader Gate */
#define WR_RF_ERROR 0x10U
/*
* 0x08, 0x0B-0x3F is Reserved for Future Use
*/
/** \internal HCI Generic Events from the Gates */
#define EVT_HCI_END_OF_OPERATION 0x01
#define EVT_POST_DATA 0x02
#define EVT_HOT_PLUG 0x03
/* Maximum Buffer Size for the HCI Data */
#define PHHCINFC_MAX_BUFFERSIZE (PHHAL_MAX_DATASIZE + 0x50U)
#define PHHCINFC_MAX_OPENPIPE 0x6FU
#define PHHCINFC_MAX_PIPE 0x6FU
#define PHHCINFC_MIN_PIPE 0x02U
/* Maximum Payload Length of HCI. */
#define PHHCINFC_MAX_PACKET_DATA 0x1CU
#define PHHCINFC_MAX_HCP_LEN PHHCINFC_MAX_PACKET_DATA + 1
/* Maximum Payload Length of HCI. */
/*
################################################################################
******************** Enumeration and Structure Definition **********************
################################################################################
*/
#if 1
typedef NFCSTATUS (*pphHciNfc_Pipe_Receive_t) (
void *pContext,
void *pHwRef,
uint8_t *data,
#ifdef ONE_BYTE_LEN
uint8_t length
#else
uint16_t length
#endif
);
#else
typedef pphNfcIF_Transact_t pphHciNfc_Pipe_Receive_t;
#endif
/** \defgroup grp_hci_nfc HCI Component
*
*
*/
typedef enum phHciNfc_HostID {
phHciNfc_HostControllerID = 0x00U,
phHciNfc_TerminalHostID = 0x01U,
phHciNfc_UICCHostID = 0x02U
/*
phHciNfc_HostID_RFU_B = 0x03U,
phHciNfc_HostID_RFU_E = 0xBFU,
phHciNfc_HostIDProprietary_B = 0xC0U,
phHciNfc_HostIDProprietary_E = 0xFFU
*/
}phHciNfc_HostID_t;
typedef enum phHciNfc_GateID{
phHciNfc_AdminGate = 0x00U,
/*
phHciNfc_evGateIDProprietary_B = 0x01U,
phHciNfc_evGateIDProprietary_E = 0x03U,
*/
phHciNfc_LoopBackGate = 0x04U,
phHciNfc_IdentityMgmtGate = 0x05U,
phHciNfc_LinkMgmtGate = 0x06U,
/*
phHciNfc_GateID_RFU_B = 0x07U,
phHciNfc_GateID_RFU_E = 0x0FU,
*/
/* TODO: Fillin Other Gate Information */
/* ETSI HCI Specific RF Reader Gates */
phHciNfc_RFReaderAGate = 0x13,
phHciNfc_RFReaderBGate = 0x11,
/* Proprietary Reader Gate */
phHciNfc_ISO15693Gate = 0x12,
phHciNfc_RFReaderFGate = 0x14,
phHciNfc_JewelReaderGate = 0x15,
/* ETSI HCI Card RF Gates */
phHciNfc_CETypeBGate = 0x21,
phHciNfc_CETypeBPrimeGate = 0x22,
phHciNfc_CETypeAGate = 0x23,
phHciNfc_CETypeFGate = 0x24,
/* NFC-IP1 Gates */
phHciNfc_NFCIP1InitRFGate = 0x30,
phHciNfc_NFCIP1TargetRFGate = 0x31,
/* ETSI HCI Connectivity Gate */
phHciNfc_ConnectivityGate = 0x41,
/* Device Configuration Gates */
phHciNfc_PN544MgmtGate = 0x90,
phHciNfc_HostCommGate = 0x91,
phHciNfc_GPIOGate = 0x92,
phHciNfc_RFMgmtGate = 0x93,
phHciNfc_PollingLoopGate = 0x94,
phHciNfc_DownloadMgmtGate = 0x95,
/* Card Emulation Managment Gates */
phHciNfc_SwpMgmtGate = 0xA0,
phHciNfc_NfcWIMgmtGate = 0xA1,
phHciNfc_UnknownGate = 0xFF
}phHciNfc_GateID_t;
typedef enum phHciNfc_PipeID{
HCI_LINKMGMT_PIPE_ID = 0x00U,
HCI_ADMIN_PIPE_ID = 0x01U,
HCI_DYNAMIC_PIPE_ID = 0x02U,
HCI_RESERVED_PIPE_ID = 0x70U,
HCI_UNKNOWN_PIPE_ID = PHHCINFC_MAX_PIPE
/*
phHciNfc_evOtherGatePipeID_B = 0x02U,
phHciNfc_evOtherGatePipeID_E = 0x6FU,
phHciNfc_evGatePipeID_RFU_B = 0x70U,
phHciNfc_evGatePipeID_RFU_E = 0x7FU,
*/
}phHciNfc_PipeID_t;
typedef enum phHciNfc_eState {
hciState_Reset = 0x00U,
hciState_Initialise,
hciState_Test,
hciState_Config,
hciState_IO,
hciState_Select,
hciState_Listen,
hciState_Activate,
hciState_Reactivate,
hciState_Connect,
hciState_Transact,
hciState_Disconnect,
hciState_Presence,
hciState_Release,
hciState_Unknown
}phHciNfc_eState_t;
typedef enum phHciNfc_eMode {
hciMode_Reset = 0x00U,
hciMode_Session,
hciMode_Override,
hciMode_Test,
hciMode_Unknown
}phHciNfc_eMode_t;
typedef enum phHciNfc_eSeq{
/* HCI Admin Sequence */
ADMIN_INIT_SEQ = 0x00U,
ADMIN_SESSION_SEQ,
ADMIN_CE_SEQ,
ADMIN_REL_SEQ,
ADMIN_EVT_HOTPLUG_SEQ,
/* HCI Link Management Sequence */
LINK_MGMT_INIT_SEQ,
LINK_MGMT_REL_SEQ,
/* HCI Identity Management Sequence */
IDENTITY_INIT_SEQ,
IDENTITY_INFO_SEQ,
IDENTITY_REL_SEQ,
/* HCI Polling Loop Sequence */
PL_INIT_SEQ,
PL_DURATION_SEQ,
PL_CONFIG_PHASE_SEQ,
PL_TGT_DISABLE_SEQ,
PL_RESTART_SEQ,
PL_STOP_SEQ,
PL_REL_SEQ,
/* HCI Device Management Sequence */
DEV_INIT_SEQ,
DEV_HAL_INFO_SEQ,
DEV_CONFIG_SEQ,
DEV_REL_SEQ,
/* HCI Reader Management Sequence */
READER_MGMT_INIT_SEQ,
READER_ENABLE_SEQ,
READER_SELECT_SEQ,
READER_REACTIVATE_SEQ,
READER_SW_AUTO_SEQ,
READER_PRESENCE_CHK_SEQ,
READER_UICC_DISPATCH_SEQ,
READER_DESELECT_SEQ,
READER_RESELECT_SEQ,
READER_DISABLE_SEQ,
READER_MGMT_REL_SEQ,
/* HCI NFC-IP1 Sequence */
NFCIP1_INIT_SEQ,
INITIATOR_SPEED_SEQ,
INITIATOR_GENERAL_SEQ,
TARGET_GENERAL_SEQ,
TARGET_SPEED_SEQ,
NFCIP1_REL_SEQ,
/* HCI Emulation Management Sequence */
EMULATION_INIT_SEQ,
EMULATION_SWP_SEQ,
EMULATION_CONFIG_SEQ,
EMULATION_REL_SEQ,
HCI_END_SEQ,
HCI_INVALID_SEQ
} phHciNfc_eSeq_t;
typedef enum phHciNfc_eSeqType{
RESET_SEQ = 0x00U,
INIT_SEQ,
UPDATE_SEQ,
INFO_SEQ,
CONFIG_SEQ,
REL_SEQ,
END_SEQ
} phHciNfc_eSeqType_t;
typedef enum phHciNfc_eConfigType{
INVALID_CFG = 0x00U,
POLL_LOOP_CFG,
SMX_WI_CFG,
SMX_WI_MODE,
UICC_SWP_CFG,
SWP_EVT_CFG,
SWP_PROTECT_CFG,
NFC_GENERAL_CFG,
NFC_TARGET_CFG,
NFC_CE_A_CFG,
NFC_CE_B_CFG
} phHciNfc_eConfigType_t;
typedef struct phHciNfc_HCP_Message{
/** \internal Identifies the Type and Kind of Instruction */
uint8_t msg_header;
/** \internal Host Controller Protocol (HCP) Packet Message Payload */
uint8_t payload[PHHCINFC_MAX_PACKET_DATA - 1];
}phHciNfc_HCP_Message_t;
typedef struct phHciNfc_HCP_Packet{
/** \internal Chaining Information and Pipe Identifier */
uint8_t hcp_header;
/** \internal Host Controller Protocol (HCP) Packet Message or Payload */
union
{
/** \internal Host Controller Protocol (HCP) Packet Message */
phHciNfc_HCP_Message_t message;
/** \internal Host Controller Protocol (HCP) Packet Payload */
uint8_t payload[PHHCINFC_MAX_PACKET_DATA];
}msg;
}phHciNfc_HCP_Packet_t;
typedef struct phHciNfc_Gate_Info{
/** \internal HCI Host Identifier */
uint8_t host_id;
/** \internal HCI Gate Identifier */
uint8_t gate_id;
}phHciNfc_Gate_Info_t;
typedef struct phHciNfc_Pipe_Params{
/** \internal HCI Source Gate Information for the pipe */
phHciNfc_Gate_Info_t source;
/** \internal HCI Destination Gate Information for the pipe */
phHciNfc_Gate_Info_t dest;
/** \internal HCI Pipe Identifier */
uint8_t pipe_id;
}phHciNfc_Pipe_Params_t;
typedef struct phHciNfc_Pipe_Info{
/** \internal Structure containing the created dynamic pipe information */
phHciNfc_Pipe_Params_t pipe;
/** \internal Status of the previous command sent to this pipe */
NFCSTATUS prev_status;
/** \internal previous message type Sent to this pipe */
uint8_t sent_msg_type;
/** \internal Message type Received in this pipe */
uint8_t recv_msg_type;
/** \internal previous message sent to this pipe */
uint8_t prev_msg;
/** \internal Index of the previous Set/Get Parameter command
* sent to this pipe */
uint8_t reg_index;
/** \internal length of Parameter of the Set/Get Parameter
* command sent to this pipe */
uint16_t param_length;
/** \internal Parameter of the Set/Get Parameter command
* sent to this pipe */
void *param_info;
/** \internal Pointer to a Pipe specific Receive Response function */
pphHciNfc_Pipe_Receive_t recv_resp;
/** \internal Pointer to a Pipe specific Receive Event function */
pphHciNfc_Pipe_Receive_t recv_event;
/** \internal Pointer to a Pipe specific Receive Command function */
pphHciNfc_Pipe_Receive_t recv_cmd;
}phHciNfc_Pipe_Info_t;
typedef struct phHciNfc_sContext{
/** \internal HCI Layer Pointer from the upper layer for
lower layer function registration */
phNfcLayer_sCfg_t *p_hci_layer;
/** \internal Pointer to the upper layer context */
void *p_upper_context;
/** \internal Pointer to the Hardware Reference Sturcture */
phHal_sHwReference_t *p_hw_ref;
/** \internal Pointer to the upper layer notification callback function */
pphNfcIF_Notification_CB_t p_upper_notify;
/** \internal Structure to store the lower interface operations */
phNfc_sLowerIF_t lower_interface;
/** \internal Execution Sequence using the HCI Context */
volatile phHciNfc_eSeq_t hci_seq;
/** \internal State of the HCI Context */
volatile phNfc_sState_t hci_state;
/** \internal Mode of HCI Initialisation */
phHciNfc_Init_t init_mode;
/** \internal Memory Information for HCI Initialisation */
uint8_t hal_mem_info[NXP_HAL_MEM_INFO_SIZE];
/** \internal HCI Configuration Type */
phHciNfc_eConfigType_t config_type;
/** \internal HCI SmartMX Mode Configuration */
phHal_eSmartMX_Mode_t smx_mode;
/** \internal HCI Configuration Information */
void *p_config_params;
/** \internal Current RF Reader/Emulation Gate in Use */
phHal_eRFDevType_t host_rf_type;
/** \internal Connected Target Information */
phHal_sRemoteDevInformation_t *p_target_info;
/** \internal Information of all the pipes created and opened */
phHciNfc_Pipe_Info_t *p_pipe_list[PHHCINFC_MAX_PIPE+1];
/** \internal Tag */
phHciNfc_XchgInfo_t *p_xchg_info;
/** \internal Information of the HCI Gates */
/** \internal HCI Admin Management Gate Information */
void *p_admin_info;
/** \internal HCI Link Management Gate Information */
void *p_link_mgmt_info;
/** \internal HCI Identity Management Gate Information */
void *p_identity_info;
/** \internal HCI Polling Loop Gate Information */
void *p_poll_loop_info;
/** \internal HCI NFC Device Management Information */
void *p_device_mgmt_info;
/** \internal HCI RF Reader Gates Management Information */
void *p_reader_mgmt_info;
/** \internal HCI Card Application Gates and Emulation
Information */
void *p_emulation_mgmt_info;
/** \internal HCI RF Reader A Gate Information */
void *p_reader_a_info;
#ifdef TYPE_B
/** \internal HCI RF Reader B Gate Information */
void *p_reader_b_info;
#endif
#ifdef TYPE_FELICA
/** \internal HCI Felica Reader Gate Information */
void *p_felica_info;
#endif
#ifdef TYPE_JEWEL
/** \internal HCI Jewel Reader Gate Information */
void *p_jewel_info;
#endif
#ifdef TYPE_ISO15693
/** \internal HCI ISO15693 Reader Gate Information */
void *p_iso_15693_info;
#endif
#ifdef ENABLE_P2P
/** \internal HCI NFC-IP1 Peer to Peer Information */
void *p_nfcip_info;
#endif
/** \internal HCI Secure Element Management Information */
void *p_wi_info;
/** \internal HCI UICC Information */
void *p_uicc_info;
/** \internal HCI SWP Information */
void *p_swp_info;
#ifdef HOST_EMULATION
/** \internal HCI Card Emulation A Gate Information */
void *p_ce_a_info;
/** \internal HCI Card Emulation B Gate Information */
void *p_ce_b_info;
#endif
/** \internal HCI Packet Data to be sent to the lower layer */
phHciNfc_HCP_Packet_t tx_packet;
/** \internal HCI Packet Data to be received from the lower layer */
phHciNfc_HCP_Packet_t rx_packet;
/** \internal Previous Status (To Store the Error Status ) */
NFCSTATUS error_status;
/** \internal Pointer to HCI Send Buffer */
uint8_t send_buffer[PHHCINFC_MAX_BUFFERSIZE];
/** \internal Pointer to HCI Receive Buffer */
uint8_t recv_buffer[PHHCINFC_MAX_BUFFERSIZE];
/** \internal Total Number of bytes to be Sent */
volatile uint16_t tx_total;
/** \internal Number of bytes Remaining to be Sent */
volatile uint16_t tx_remain;
/** \internal Number of bytes sent */
volatile uint16_t tx_sent;
volatile uint16_t rx_index;
/** \internal Total Number of bytes received */
volatile uint16_t rx_total;
/** \internal Number of bytes received */
volatile uint16_t rx_recvd;
/** \internal Index of the received data in the
* response packet
*/
/** \internal Send HCP Chaining Information */
volatile uint8_t tx_hcp_chaining;
/** \internal Send HCP Fragment Index */
volatile uint16_t tx_hcp_frgmnt_index;
/** \internal Receive HCP Chaining Information */
volatile uint8_t rx_hcp_chaining;
/** \internal Receive HCP Fragment Index */
volatile uint16_t rx_hcp_frgmnt_index;
/** \internal The Device under Test */
volatile uint8_t hci_mode;
/** \internal Wait for Response if Response is Pending */
volatile uint8_t response_pending;
/** \internal Notify the Event if Notifcation is Pending */
volatile uint8_t event_pending;
/** \internal Pending Release of the detected Target */
uint8_t target_release;
}phHciNfc_sContext_t;
/*
################################################################################
*********************** Function Prototype Declaration *************************
################################################################################
*/
/**
*
* \ingroup grp_hci_nfc
*
* The phHciNfc_Receive function receives the HCI Events or Response from the
* corresponding peripheral device, described by the HCI Context Structure.
*
* \param[in] psContext psContext is the context of
* the HCI Layer.
* \param[in] pHwRef pHwRef is the Information of
* the Device Interface Link .
* \param[out] pdata Pointer to the response buffer that
* receives the response read.
* \param[in] length Variable that receives
* the number of bytes read.
*
* \retval NFCSTATUS_PENDING Data successfully read.
* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
* could not be interpreted properly.
* \retval Other errors Other related errors
*
*/
extern
NFCSTATUS
phHciNfc_Receive(
void *psContext,
void *pHwRef,
uint8_t *pdata,
#ifdef ONE_BYTE_LEN
uint8_t length
#else
uint16_t length
#endif
);
/**
* \ingroup grp_hci_nfc
*
* The phHciNfc_Send_Complete function acknowledges the completion of the HCI
* Commands sent to the device.
*
* \param[in] psContext psContext is the context of
* the HCI Layer.
* \param[in] pHwRef pHwRef is the Information of
* the Device Interface Link .
* \param[in] pInfo Transaction information like
* status and length after the
* completion of the send.
*
* \retval NONE.
*
*/
extern
void
phHciNfc_Send_Complete (
void *psContext,
void *pHwRef,
phNfc_sTransactionInfo_t *pInfo
);
/**
* \ingroup grp_hci_nfc
*
* The phHciNfc_Receive_Complete function acknowledges the completion of the HCI
* Event Information or Response received from the device.
*
* \param[in] psContext psContext is the context of
* the HCI Layer.
* \param[in] pHwRef pHwRef is the Information of
* the Device Interface Link .
* \param[in] pInfo Transaction information like status
* data and length after the completely
* receiving the response .
* \retval NONE.
*
*
*/
extern
void
phHciNfc_Receive_Complete (
void *psContext,
void *pHwRef,
phNfc_sTransactionInfo_t *pInfo
);
/**
* \ingroup grp_hci_nfc
*
* The phHciNfc_Notify_Event function notifies the occurence of the HCI
* Event from the device.
*
* \param[in] psContext psContext is the context of
* the HCI Layer.
* \param[in] pHwRef pHwRef is the Information of
* the Device Interface Link .
* \param[in] type reason returned for the notification to
* the HCI.
* \param[in] pInfo Notification information like status
* data,length etc from the lower layer
* to the HCI Layer.
* \retval NONE.
*
*/
extern
void
phHciNfc_Notify_Event(
void *psContext,
void *pHwRef,
uint8_t type,
void *pInfo
);
/**
* \ingroup grp_hci_nfc
*
* The phHciNfc_Tag_Notify function notifies the the upper layer
* with the Tag Specific Notifications .
*
* \param[in] psContext psContext is the context of
* the HCI Layer.
* \param[in] pHwRef pHwRef is the Information of
* the Device Interface Link .
* \param[in] type reason returned for the notification to
* the HCI.
* \param[in] pInfo Notification information like status
* data,length etc from the lower layer
* to the HCI Layer.
* \retval NONE.
*
*/
extern
void
phHciNfc_Tag_Notify(
phHciNfc_sContext_t *psHciContext,
void *pHwRef,
uint8_t type,
void *pInfo
);
/**
* \ingroup grp_hci_nfc
*
* The phHciNfc_Tag_Notify function notifies the the upper layer
* with the Tag Specific Notifications .
*
* \param[in] psContext psContext is the context of
* the HCI Layer.
* \param[in] pHwRef pHwRef is the Information of
* the Device Interface Link .
* \param[in] type reason returned for the notification to
* the HCI.
* \param[in] pInfo Notification information like status
* data,length etc from the lower layer
* to the HCI Layer.
* \retval NONE.
*
*/
extern
void
phHciNfc_Target_Select_Notify(
phHciNfc_sContext_t *psHciContext,
void *pHwRef,
uint8_t type,
void *pInfo
);
/**
* \ingroup grp_hci_nfc
*
* The phHciNfc_Transceive_Notify function notifies the the upper layer
* with the after the transceive operation.
*
* \param[in] psContext psContext is the context of
* the HCI Layer.
* \param[in] pHwRef pHwRef is the Information of
* the Device Interface Link .
* \param[in] type reason returned for the notification to
* the HCI.
* \param[in] pInfo Notification information like status
* data,length etc from the lower layer
* to the HCI Layer.
* \retval NONE.
*
*/
extern
void
phHciNfc_Transceive_Notify(
phHciNfc_sContext_t *psHciContext,
void *pHwRef,
uint8_t type,
void *pInfo
);
/**
* \ingroup grp_hci_nfc
*
* The phHciNfc_Notify function calls the upper layer notification callback.
*
* \param[in] pUpperNotify pUpperNotify is the notification
* callback of the upper HAL Layer.
* \param[in] pUpperContext pUpperContext is the context of
* the upper HAL Layer.
* \param[in] pHwRef pHwRef is the Information of
* the Device Interface Link .
* \param[in] type type of the notification to
* the upper HAL layer.
* \param[in] pInfo completion information returned
* to the Upper HAL Layer.
* NFCSTATUS_SUCCESS Notification successfully completed .
* NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
* could not be interpreted properly.
* Other errors Errors related to the HCI or lower layers
*
* \retval NONE.
*
*/
extern
void
phHciNfc_Notify(
pphNfcIF_Notification_CB_t p_upper_notify,
void *p_upper_context,
void *pHwRef,
uint8_t type,
void *pInfo
);
/**
* \ingroup grp_hci_nfc
*
* The phHciNfc_Release_Notify function Releases HCI and notifies
* the upper layer.
*
* \param[in] psHciContext psHciContext is the context of
* the HCI Layer.
* \param[in] pHwRef pHwRef is the Information of
* the Device Interface Link .
* \param[in] type reason returned for the notification to
* the HCI.
* \param[in] pInfo Notification information like status
* data,length etc from the lower layer
* to the HCI Layer.
* \retval NONE.
*
*/
extern
void
phHciNfc_Release_Notify(
phHciNfc_sContext_t *psHciContext,
void *pHwRef,
uint8_t type,
void *pInfo
);
/**
* \ingroup grp_hci_nfc
*
* The phHciNfc_Send_Generic_Cmd function sends the HCI Generic Commands
* to the device.
*
* \param[in] psHciContext psHciContext is the context of
* the HCI Layer.
* \param[in] pHwRef pHwRef is the Information of
* the Device Interface Link .
* \param[in] pipe_id The pipe to which the command
* is being sent.
* \param[in] cmd The HCI Generic command sent to a
* particular pipe .
*
* \retval NFCSTATUS_PENDING HCI Generic Command send in progress .
* \retval
* NFCSTATUS_INSUFFICIENT_RESOURCES The memory could not be allocated
* as required amount of memory
* is not sufficient.
*
*/
extern
NFCSTATUS
phHciNfc_Send_Generic_Cmd (
phHciNfc_sContext_t *psHciContext,
void *pHwRef,
uint8_t pipe_id,
uint8_t cmd
);
/**
* \ingroup grp_hci_nfc
*
* The phHciNfc_Set_Param function configures the Gate specific register
* with the provided value.
*
* \param[in] psHciContext psHciContext is the context of
* the HCI Layer.
* \param[in] pHwRef pHwRef is the Information of
* the Device Interface Link .
* \param[in] p_pipe_info Pointer to pipe specific information.
* \param[in] reg_index Index of the register to be
* configured .
* \param[in] p_param Value to the configured in
* particular register.
* \param[in] param_length Length of the parameter provided
* for the configuration.
*
* \retval NFCSTATUS_PENDING HCI Set parameter in progress .
* \retval
* NFCSTATUS_INVALID_HCI_INFORMATION The Information like p_pipe_info,
* p_param or param_length is invalid
*
*/
extern
NFCSTATUS
phHciNfc_Set_Param (
phHciNfc_sContext_t *psHciContext,
void *pHwRef,
phHciNfc_Pipe_Info_t *p_pipe_info,
uint8_t reg_index,
void *p_param,
uint16_t param_length
);
/**
* \ingroup grp_hci_nfc
*
* The phHciNfc_Send_HCP function sends the HCI Host Control Packet
* Frames to the device.
*
* \param[in] psHciContext psHciContext is the context of
* the HCI Layer.
* \param[in] pHwRef pHwRef is the Information of
* the Device Interface Link .
*
* \retval NFCSTATUS_PENDING HCP Frame send pending.
* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
* could not be interpreted properly.
* \retval Other errors Other related errors
*
*
*/
extern
NFCSTATUS
phHciNfc_Send_HCP (
phHciNfc_sContext_t *psHciContext,
void *pHwRef
);
/**
* \ingroup grp_hci_nfc
*
* The phHciNfc_Build_HCPFrame function initially builds the HCP Packet Frame
* with the values passed in the arguments .
*
* \param[in] hcp_packet hcp_packet is the frame packet structure
* in which the frame is populated with the
* appropriate fields.
* \param[in] chainbit chainbit specifies whether the following
* HCP frames are chained or the frame is a
* normal frame.
* \param[in] pipe_id pipe_id of the pipe to which the frame has
* to be sent.
* \param[in] msg_type type of message sent to the pipe.
* \param[in] instruction type of message instruction send to the pipe.
*
* \retval NONE.
*
*/
extern
void
phHciNfc_Build_HCPFrame (
phHciNfc_HCP_Packet_t *hcp_packet,
uint8_t chainbit,
uint8_t pipe_id,
uint8_t msg_type,
uint8_t instruction
);
/**
* \ingroup grp_hci_nfc
*
* The phHciNfc_Append_HCPFrame function Appends the HCP Packet Frame
* with the values passed in the arguments .
*
* \param[in] hcp_data hcp_data is the pointer to the HCP
* payload to which the data is to be
* appended.
* \param[in] hcp_index hcp_index is the index from which
* the data source needs to be appended.
* \param[in] src_data src_data that is to be appended to the
* HCP packet.
* \param[in] src_len The length of the data source that is
* to be appended.
* \retval NONE.
*
*/
extern
void
phHciNfc_Append_HCPFrame (
uint8_t *hcp_data,
uint16_t hcp_index,
uint8_t *src_data,
uint16_t src_len
);
/**
* \ingroup grp_hci_nfc
*
* The phHciNfc_Allocate_Resource function allocates and initialises the
* resource memory for the HCI layer.
*
* \param[in] ppBuffer ppBuffer is the pointer to which the
* resource memory is allocated.
* \param[in] size Variable that specifies the size of
* the memory that needs to be created.
*
* \retval NFCSTATUS_SUCCESS The Resource Memory was allocated
* successfully .
* \retval
* NFCSTATUS_INSUFFICIENT_RESOURCES The memory could not be allocated
* as required amount of memory
* is not suffient.
*
*/
extern
NFCSTATUS
phHciNfc_Allocate_Resource (
void **ppBuffer,
uint16_t size
);
/**
* \ingroup grp_hci_nfc
*
* The phHciNfc_Release_Resources function releases all the resources
* allocated in the HCI Layer.
*
* \param[in] psHciContext psHciContext is the context of
* the HCI Layer.
*
* \retval NONE.
*
*/
extern
void
phHciNfc_Release_Resources (
phHciNfc_sContext_t **ppsHciContext
);
/**
* \ingroup grp_hci_nfc
*
* The phHciNfc_Release_Lower function initiates the release of the
* lower layers.
*
* \param[in] psHciContext psHciContext is the context of
* the HCI Layer.
* \param[in] pHwRef pHwRef is the Information of
* the Device Interface Link .
*
* \retval NONE.
*
*/
extern
void
phHciNfc_Release_Lower(
phHciNfc_sContext_t *psHciContext,
void *pHwRef
);
#endif
|