blob: 88fd39a44727c8d18901cc7621826517da04ab3e [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 Moreland20ea4ea2016-10-06 02:49:38 +000030 * If open() returns 0, the NCI stack will wait for a HAL_NFC_OPEN_CPLT_EVT
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 */
36 open(INfcClientCallback clientCallback) generates (int32_t retval);
37
38 /*
39 * Performs an NCI write.
40 *
41 * This method may queue writes and return immediately. The only
42 * requirement is that the writes are executed in order.
43 */
Steven Moreland20ea4ea2016-10-06 02:49:38 +000044 write(nfc_data_t data) generates (int32_t retval);
Andreas Hubera4831392016-07-29 15:05:03 -070045
46 /*
Steven Moreland20ea4ea2016-10-06 02:49:38 +000047 * core_initialized() is called after the CORE_INIT_RSP is received from the NFCC.
Andreas Hubera4831392016-07-29 15:05:03 -070048 * At this time, the HAL can do any chip-specific configuration.
49 *
Steven Moreland20ea4ea2016-10-06 02:49:38 +000050 * If core_initialized() returns 0, the NCI stack will wait for a HAL_NFC_POST_INIT_CPLT_EVT
Andreas Hubera4831392016-07-29 15:05:03 -070051 * before continuing.
52 *
Steven Moreland20ea4ea2016-10-06 02:49:38 +000053 * If core_initialized() returns any other value, the NCI stack will continue
Andreas Hubera4831392016-07-29 15:05:03 -070054 * immediately.
55 */
Steven Moreland20ea4ea2016-10-06 02:49:38 +000056 core_initialized(vec<uint8_t> data) generates (int32_t retval);
Andreas Hubera4831392016-07-29 15:05:03 -070057
58 /*
Steven Moreland20ea4ea2016-10-06 02:49:38 +000059 * pre_discover is called every time before starting RF discovery.
Andreas Hubera4831392016-07-29 15:05:03 -070060 * It is a good place to do vendor-specific configuration that must be
61 * performed every time RF discovery is about to be started.
62 *
Steven Moreland20ea4ea2016-10-06 02:49:38 +000063 * If pre_discover() returns 0, the NCI stack will wait for a HAL_NFC_PRE_DISCOVER_CPLT_EVT
Andreas Hubera4831392016-07-29 15:05:03 -070064 * before continuing.
65 *
Steven Moreland20ea4ea2016-10-06 02:49:38 +000066 * If pre_discover() returns any other value, the NCI stack will start
Andreas Hubera4831392016-07-29 15:05:03 -070067 * RF discovery immediately.
68 */
Steven Moreland20ea4ea2016-10-06 02:49:38 +000069 pre_discover() generates (int32_t retval);
Andreas Hubera4831392016-07-29 15:05:03 -070070
71 /*
72 * Close the NFC controller. Should free all resources.
73 */
74 close() generates (int32_t retval);
75
76 /*
77 * Grant HAL the exclusive control to send NCI commands.
Steven Moreland20ea4ea2016-10-06 02:49:38 +000078 * Called in response to HAL_REQUEST_CONTROL_EVT.
Andreas Hubera4831392016-07-29 15:05:03 -070079 * Must only be called when there are no NCI commands pending.
Steven Moreland20ea4ea2016-10-06 02:49:38 +000080 * HAL_RELEASE_CONTROL_EVT will notify when HAL no longer needs exclusive control.
Andreas Hubera4831392016-07-29 15:05:03 -070081 */
Steven Moreland20ea4ea2016-10-06 02:49:38 +000082 control_granted() generates (int32_t retval);
Andreas Hubera4831392016-07-29 15:05:03 -070083
84 /*
85 * Restart controller by power cyle;
Steven Moreland20ea4ea2016-10-06 02:49:38 +000086 * HAL_OPEN_CPLT_EVT will notify when operation is complete.
Andreas Hubera4831392016-07-29 15:05:03 -070087 */
Steven Moreland20ea4ea2016-10-06 02:49:38 +000088 power_cycle() generates (int32_t retval);
Andreas Hubera4831392016-07-29 15:05:03 -070089};