blob: 147348fd0d919a6f03556b941159b647e01ce0d6 [file] [log] [blame]
Martijn Coenencbe590c2016-08-30 11:27:56 -07001/*
2 * Copyright (C) 2016 The Android Open Source Project
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
Andreas Hubera4831392016-07-29 15:05:03 -070017package android.hardware.nfc@1.0;
18
19import INfcClientCallback;
20
Zhuoyao Zhang80b6a122016-08-10 22:37:34 -070021@hal_type(type="NFC")
Andreas Hubera4831392016-07-29 15:05:03 -070022interface INfc {
23 /*
24 * Opens the NFC controller device and performs initialization.
25 * This may include patch download and other vendor-specific initialization.
26 *
27 * If open completes successfully, the controller should be ready to perform
28 * NCI initialization - ie accept CORE_RESET and subsequent commands through
29 * the write() call.
30 *
31 * If open() returns 0, the NCI stack will wait for a HAL_NFC_OPEN_CPLT_EVT
32 * before continuing.
33 *
34 * If open() returns any other value, the NCI stack will stop.
35 *
36 */
37 open(INfcClientCallback clientCallback) generates (int32_t retval);
38
39 /*
40 * Performs an NCI write.
41 *
42 * This method may queue writes and return immediately. The only
43 * requirement is that the writes are executed in order.
44 */
45 write(nfc_data_t data) generates (int32_t retval);
46
47 /*
48 * core_initialized() is called after the CORE_INIT_RSP is received from the NFCC.
49 * At this time, the HAL can do any chip-specific configuration.
50 *
51 * If core_initialized() returns 0, the NCI stack will wait for a HAL_NFC_POST_INIT_CPLT_EVT
52 * before continuing.
53 *
54 * If core_initialized() returns any other value, the NCI stack will continue
55 * immediately.
56 */
57 core_initialized(vec<uint8_t> data) generates (int32_t retval);
58
59 /*
60 * pre_discover is called every time before starting RF discovery.
61 * It is a good place to do vendor-specific configuration that must be
62 * performed every time RF discovery is about to be started.
63 *
64 * If pre_discover() returns 0, the NCI stack will wait for a HAL_NFC_PRE_DISCOVER_CPLT_EVT
65 * before continuing.
66 *
67 * If pre_discover() returns any other value, the NCI stack will start
68 * RF discovery immediately.
69 */
70 pre_discover() generates (int32_t retval);
71
72 /*
73 * Close the NFC controller. Should free all resources.
74 */
75 close() generates (int32_t retval);
76
77 /*
78 * Grant HAL the exclusive control to send NCI commands.
79 * Called in response to HAL_REQUEST_CONTROL_EVT.
80 * Must only be called when there are no NCI commands pending.
81 * HAL_RELEASE_CONTROL_EVT will notify when HAL no longer needs exclusive control.
82 */
83 control_granted() generates (int32_t retval);
84
85 /*
86 * Restart controller by power cyle;
87 * HAL_OPEN_CPLT_EVT will notify when operation is complete.
88 */
89 power_cycle() generates (int32_t retval);
90};