1 /*
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 
17 #ifndef __NANOHUBCOMMAND_H
18 #define __NANOHUBCOMMAND_H
19 
20 #define NANOHUB_FAST_DONT_ACK       0xFFFFFFFE
21 #define NANOHUB_FAST_UNHANDLED_ACK  0xFFFFFFFF
22 
23 struct NanohubCommand {
24     uint32_t reason;
25     uint32_t (*fastHandler)(void *, uint8_t, void *, uint64_t);
26     uint32_t (*handler)(void *, uint8_t, void *, uint64_t);
27     uint8_t minDataLen;
28     uint8_t maxDataLen;
29 };
30 
31 void nanohubInitCommand(void);
32 void nanohubPrefetchTx(uint32_t interrupt, uint32_t wakeup, uint32_t nonwakeup);
33 const struct NanohubCommand *nanohubFindCommand(uint32_t packetReason);
34 
35 struct NanohubHalCommand {
36     uint8_t msg;
37     void (*handler)(void *, uint8_t);
38 };
39 
40 const struct NanohubHalCommand *nanohubHalFindCommand(uint8_t msg);
41 
42 #endif /* __NANOHUBCOMMAND_H */
43