blob: 1c952dbac8a42dd2bc21c300825505a9bb2f6206 [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
Andreas Hubera4831392016-07-29 15:05:03 -070021interface INfc {
22 /*
23 * Opens the NFC controller device and performs initialization.
24 * This may include patch download and other vendor-specific initialization.
25 *
26 * If open completes successfully, the controller should be ready to perform
27 * NCI initialization - ie accept CORE_RESET and subsequent commands through
28 * the write() call.
29 *
Steven Morelandcffe8d52016-09-26 12:40:29 -070030 * If open() returns 0, the NCI stack will wait for a NfcEvent.OPEN_CPLT
Andreas Hubera4831392016-07-29 15:05:03 -070031 * before continuing.
32 *
33 * If open() returns any other value, the NCI stack will stop.
34 *
35 */
Ruchi Kandoi846d9ab2016-10-31 16:11:13 -070036 @entry
37 @callflow(next={"write", "coreInitialized", "prediscover", "powerCycle", "controlGranted"})
Andreas Hubera4831392016-07-29 15:05:03 -070038 open(INfcClientCallback clientCallback) generates (int32_t retval);
39
40 /*
41 * Performs an NCI write.
42 *
43 * This method may queue writes and return immediately. The only
44 * requirement is that the writes are executed in order.
45 */
Ruchi Kandoi846d9ab2016-10-31 16:11:13 -070046 @callflow(next={"write", "prediscover", "coreInitialized", "close", "powerCycle",
47 "controlGranted"})
Steven Morelandcffe8d52016-09-26 12:40:29 -070048 write(NfcData data) generates (int32_t retval);
Andreas Hubera4831392016-07-29 15:05:03 -070049
50 /*
Steven Morelandcffe8d52016-09-26 12:40:29 -070051 * coreInitialized() is called after the CORE_INIT_RSP is received from the NFCC.
Andreas Hubera4831392016-07-29 15:05:03 -070052 * At this time, the HAL can do any chip-specific configuration.
53 *
Steven Morelandcffe8d52016-09-26 12:40:29 -070054 * If coreInitialized() returns 0, the NCI stack will wait for a NfcEvent.POST_INIT_CPLT
Andreas Hubera4831392016-07-29 15:05:03 -070055 * before continuing.
56 *
Steven Morelandcffe8d52016-09-26 12:40:29 -070057 * If coreInitialized() returns any other value, the NCI stack will continue
Andreas Hubera4831392016-07-29 15:05:03 -070058 * immediately.
59 */
Ruchi Kandoi846d9ab2016-10-31 16:11:13 -070060 @callflow(next={"write", "prediscover", "close"})
Steven Morelandcffe8d52016-09-26 12:40:29 -070061 coreInitialized(NfcData data) generates (int32_t retval);
Andreas Hubera4831392016-07-29 15:05:03 -070062
63 /*
Steven Morelandcffe8d52016-09-26 12:40:29 -070064 * prediscover is called every time before starting RF discovery.
Andreas Hubera4831392016-07-29 15:05:03 -070065 * It is a good place to do vendor-specific configuration that must be
66 * performed every time RF discovery is about to be started.
67 *
Steven Morelandcffe8d52016-09-26 12:40:29 -070068 * If prediscover() returns 0, the NCI stack will wait for a NfcEvent.PREDISCOVER_CPLT
Andreas Hubera4831392016-07-29 15:05:03 -070069 * before continuing.
70 *
Steven Morelandcffe8d52016-09-26 12:40:29 -070071 * If prediscover() returns any other value, the NCI stack will start
Andreas Hubera4831392016-07-29 15:05:03 -070072 * RF discovery immediately.
73 */
Ruchi Kandoi846d9ab2016-10-31 16:11:13 -070074 @callflow(next={"write", "close", "coreInitialized", "powerCycle", "controlGranted"})
Steven Morelandcffe8d52016-09-26 12:40:29 -070075 prediscover() generates (int32_t retval);
Andreas Hubera4831392016-07-29 15:05:03 -070076
77 /*
78 * Close the NFC controller. Should free all resources.
79 */
Ruchi Kandoi846d9ab2016-10-31 16:11:13 -070080 @exit
Andreas Hubera4831392016-07-29 15:05:03 -070081 close() generates (int32_t retval);
82
83 /*
84 * Grant HAL the exclusive control to send NCI commands.
Steven Morelandcffe8d52016-09-26 12:40:29 -070085 * Called in response to NfcEvent.REQUEST_CONTROL.
Andreas Hubera4831392016-07-29 15:05:03 -070086 * Must only be called when there are no NCI commands pending.
Steven Morelandcffe8d52016-09-26 12:40:29 -070087 * NfcEvent.RELEASE_CONTROL will notify when HAL no longer needs exclusive control.
Andreas Hubera4831392016-07-29 15:05:03 -070088 */
Ruchi Kandoi846d9ab2016-10-31 16:11:13 -070089 @callflow(next={"write", "close", "prediscover", "coreInitialized", "powerCycle"})
Steven Morelandcffe8d52016-09-26 12:40:29 -070090 controlGranted() generates (int32_t retval);
Andreas Hubera4831392016-07-29 15:05:03 -070091
92 /*
93 * Restart controller by power cyle;
Steven Morelandcffe8d52016-09-26 12:40:29 -070094 * NfcEvent.OPEN_CPLT will notify when operation is complete.
Andreas Hubera4831392016-07-29 15:05:03 -070095 */
Ruchi Kandoi846d9ab2016-10-31 16:11:13 -070096 @callflow(next={"write", "coreInitialized", "prediscover", "controlGranted", "close"})
Steven Morelandcffe8d52016-09-26 12:40:29 -070097 powerCycle() generates (int32_t retval);
Andreas Hubera4831392016-07-29 15:05:03 -070098};