--- /dev/null
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * 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.
+ */
+
+#pragma once
+
+/*
+ * Defentions for HCI Error Codes that are past in the events
+ */
+#define HCI_SUCCESS 0x00
+#define HCI_PENDING 0x00
+#define HCI_ERR_ILLEGAL_COMMAND 0x01
+#define HCI_ERR_NO_CONNECTION 0x02
+#define HCI_ERR_HW_FAILURE 0x03
+#define HCI_ERR_PAGE_TIMEOUT 0x04
+#define HCI_ERR_AUTH_FAILURE 0x05
+#define HCI_ERR_KEY_MISSING 0x06
+#define HCI_ERR_MEMORY_FULL 0x07
+#define HCI_ERR_CONNECTION_TOUT 0x08
+#define HCI_ERR_MAX_NUM_OF_CONNECTIONS 0x09
+#define HCI_ERR_MAX_NUM_OF_SCOS 0x0A
+#define HCI_ERR_CONNECTION_EXISTS 0x0B
+#define HCI_ERR_COMMAND_DISALLOWED 0x0C
+#define HCI_ERR_HOST_REJECT_RESOURCES 0x0D
+#define HCI_ERR_HOST_REJECT_SECURITY 0x0E
+#define HCI_ERR_HOST_REJECT_DEVICE 0x0F
+#define HCI_ERR_HOST_TIMEOUT 0x10
+#define HCI_ERR_UNSUPPORTED_VALUE 0x11
+#define HCI_ERR_ILLEGAL_PARAMETER_FMT 0x12
+#define HCI_ERR_PEER_USER 0x13
+#define HCI_ERR_PEER_LOW_RESOURCES 0x14
+#define HCI_ERR_PEER_POWER_OFF 0x15
+#define HCI_ERR_CONN_CAUSE_LOCAL_HOST 0x16
+#define HCI_ERR_REPEATED_ATTEMPTS 0x17
+#define HCI_ERR_PAIRING_NOT_ALLOWED 0x18
+#define HCI_ERR_UNKNOWN_LMP_PDU 0x19
+#define HCI_ERR_UNSUPPORTED_REM_FEATURE 0x1A
+#define HCI_ERR_SCO_OFFSET_REJECTED 0x1B
+#define HCI_ERR_SCO_INTERVAL_REJECTED 0x1C
+#define HCI_ERR_SCO_AIR_MODE 0x1D
+#define HCI_ERR_INVALID_LMP_PARAM 0x1E
+#define HCI_ERR_UNSPECIFIED 0x1F
+#define HCI_ERR_UNSUPPORTED_LMP_FEATURE 0x20
+#define HCI_ERR_ROLE_CHANGE_NOT_ALLOWED 0x21
+#define HCI_ERR_LMP_RESPONSE_TIMEOUT 0x22
+#define HCI_ERR_LMP_ERR_TRANS_COLLISION 0x23
+#define HCI_ERR_LMP_PDU_NOT_ALLOWED 0x24
+#define HCI_ERR_ENCRY_MODE_NOT_ACCEPTABLE 0x25
+#define HCI_ERR_UNIT_KEY_USED 0x26
+#define HCI_ERR_QOS_NOT_SUPPORTED 0x27
+#define HCI_ERR_INSTANT_PASSED 0x28
+#define HCI_ERR_PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED 0x29
+#define HCI_ERR_DIFF_TRANSACTION_COLLISION 0x2A
+#define HCI_ERR_UNDEFINED_0x2B 0x2B
+#define HCI_ERR_QOS_UNACCEPTABLE_PARAM 0x2C
+#define HCI_ERR_QOS_REJECTED 0x2D
+#define HCI_ERR_CHAN_CLASSIF_NOT_SUPPORTED 0x2E
+#define HCI_ERR_INSUFFCIENT_SECURITY 0x2F
+#define HCI_ERR_PARAM_OUT_OF_RANGE 0x30
+#define HCI_ERR_UNDEFINED_0x31 0x31
+#define HCI_ERR_ROLE_SWITCH_PENDING 0x32
+#define HCI_ERR_UNDEFINED_0x33 0x33
+#define HCI_ERR_RESERVED_SLOT_VIOLATION 0x34
+#define HCI_ERR_ROLE_SWITCH_FAILED 0x35
+#define HCI_ERR_INQ_RSP_DATA_TOO_LARGE 0x36
+#define HCI_ERR_SIMPLE_PAIRING_NOT_SUPPORTED 0x37
+#define HCI_ERR_HOST_BUSY_PAIRING 0x38
+#define HCI_ERR_REJ_NO_SUITABLE_CHANNEL 0x39
+#define HCI_ERR_CONTROLLER_BUSY 0x3A
+#define HCI_ERR_UNACCEPT_CONN_INTERVAL 0x3B
+#define HCI_ERR_ADVERTISING_TIMEOUT 0x3C
+#define HCI_ERR_CONN_TOUT_DUE_TO_MIC_FAILURE 0x3D
+#define HCI_ERR_CONN_FAILED_ESTABLISHMENT 0x3E
+#define HCI_ERR_LIMIT_REACHED 0x43
+#define HCI_ERR_MAC_CONNECTION_FAILED 0x3F
+
+/* ConnectionLess Broadcast errors */
+#define HCI_ERR_LT_ADDR_ALREADY_IN_USE 0x40
+#define HCI_ERR_LT_ADDR_NOT_ALLOCATED 0x41
+#define HCI_ERR_CLB_NOT_ENABLED 0x42
+#define HCI_ERR_CLB_DATA_TOO_BIG 0x43
+
+#define HCI_ERR_MAX_ERR 0x43
+
+#define HCI_HINT_TO_RECREATE_AMP_PHYS_LINK 0xFF
#ifndef HCIDEFS_H
#define HCIDEFS_H
+#include "stack/include/hci_error_code.h"
+
#define HCI_PROTO_VERSION 0x01 /* Version for BT spec 1.1 */
#define HCI_PROTO_VERSION_1_2 0x02 /* Version for BT spec 1.2 */
#define HCI_PROTO_VERSION_2_0 0x03 /* Version for BT spec 2.0 */
specification compliant */
/*
- * Defentions for HCI Error Codes that are past in the events
-*/
-#define HCI_SUCCESS 0x00
-#define HCI_PENDING 0x00
-#define HCI_ERR_ILLEGAL_COMMAND 0x01
-#define HCI_ERR_NO_CONNECTION 0x02
-#define HCI_ERR_HW_FAILURE 0x03
-#define HCI_ERR_PAGE_TIMEOUT 0x04
-#define HCI_ERR_AUTH_FAILURE 0x05
-#define HCI_ERR_KEY_MISSING 0x06
-#define HCI_ERR_MEMORY_FULL 0x07
-#define HCI_ERR_CONNECTION_TOUT 0x08
-#define HCI_ERR_MAX_NUM_OF_CONNECTIONS 0x09
-#define HCI_ERR_MAX_NUM_OF_SCOS 0x0A
-#define HCI_ERR_CONNECTION_EXISTS 0x0B
-#define HCI_ERR_COMMAND_DISALLOWED 0x0C
-#define HCI_ERR_HOST_REJECT_RESOURCES 0x0D
-#define HCI_ERR_HOST_REJECT_SECURITY 0x0E
-#define HCI_ERR_HOST_REJECT_DEVICE 0x0F
-#define HCI_ERR_HOST_TIMEOUT 0x10
-#define HCI_ERR_UNSUPPORTED_VALUE 0x11
-#define HCI_ERR_ILLEGAL_PARAMETER_FMT 0x12
-#define HCI_ERR_PEER_USER 0x13
-#define HCI_ERR_PEER_LOW_RESOURCES 0x14
-#define HCI_ERR_PEER_POWER_OFF 0x15
-#define HCI_ERR_CONN_CAUSE_LOCAL_HOST 0x16
-#define HCI_ERR_REPEATED_ATTEMPTS 0x17
-#define HCI_ERR_PAIRING_NOT_ALLOWED 0x18
-#define HCI_ERR_UNKNOWN_LMP_PDU 0x19
-#define HCI_ERR_UNSUPPORTED_REM_FEATURE 0x1A
-#define HCI_ERR_SCO_OFFSET_REJECTED 0x1B
-#define HCI_ERR_SCO_INTERVAL_REJECTED 0x1C
-#define HCI_ERR_SCO_AIR_MODE 0x1D
-#define HCI_ERR_INVALID_LMP_PARAM 0x1E
-#define HCI_ERR_UNSPECIFIED 0x1F
-#define HCI_ERR_UNSUPPORTED_LMP_FEATURE 0x20
-#define HCI_ERR_ROLE_CHANGE_NOT_ALLOWED 0x21
-#define HCI_ERR_LMP_RESPONSE_TIMEOUT 0x22
-#define HCI_ERR_LMP_ERR_TRANS_COLLISION 0x23
-#define HCI_ERR_LMP_PDU_NOT_ALLOWED 0x24
-#define HCI_ERR_ENCRY_MODE_NOT_ACCEPTABLE 0x25
-#define HCI_ERR_UNIT_KEY_USED 0x26
-#define HCI_ERR_QOS_NOT_SUPPORTED 0x27
-#define HCI_ERR_INSTANT_PASSED 0x28
-#define HCI_ERR_PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED 0x29
-#define HCI_ERR_DIFF_TRANSACTION_COLLISION 0x2A
-#define HCI_ERR_UNDEFINED_0x2B 0x2B
-#define HCI_ERR_QOS_UNACCEPTABLE_PARAM 0x2C
-#define HCI_ERR_QOS_REJECTED 0x2D
-#define HCI_ERR_CHAN_CLASSIF_NOT_SUPPORTED 0x2E
-#define HCI_ERR_INSUFFCIENT_SECURITY 0x2F
-#define HCI_ERR_PARAM_OUT_OF_RANGE 0x30
-#define HCI_ERR_UNDEFINED_0x31 0x31
-#define HCI_ERR_ROLE_SWITCH_PENDING 0x32
-#define HCI_ERR_UNDEFINED_0x33 0x33
-#define HCI_ERR_RESERVED_SLOT_VIOLATION 0x34
-#define HCI_ERR_ROLE_SWITCH_FAILED 0x35
-#define HCI_ERR_INQ_RSP_DATA_TOO_LARGE 0x36
-#define HCI_ERR_SIMPLE_PAIRING_NOT_SUPPORTED 0x37
-#define HCI_ERR_HOST_BUSY_PAIRING 0x38
-#define HCI_ERR_REJ_NO_SUITABLE_CHANNEL 0x39
-#define HCI_ERR_CONTROLLER_BUSY 0x3A
-#define HCI_ERR_UNACCEPT_CONN_INTERVAL 0x3B
-#define HCI_ERR_ADVERTISING_TIMEOUT 0x3C
-#define HCI_ERR_CONN_TOUT_DUE_TO_MIC_FAILURE 0x3D
-#define HCI_ERR_CONN_FAILED_ESTABLISHMENT 0x3E
-#define HCI_ERR_LIMIT_REACHED 0x43
-#define HCI_ERR_MAC_CONNECTION_FAILED 0x3F
-
-/* ConnectionLess Broadcast errors */
-#define HCI_ERR_LT_ADDR_ALREADY_IN_USE 0x40
-#define HCI_ERR_LT_ADDR_NOT_ALLOCATED 0x41
-#define HCI_ERR_CLB_NOT_ENABLED 0x42
-#define HCI_ERR_CLB_DATA_TOO_BIG 0x43
-
-#define HCI_ERR_MAX_ERR 0x43
-
-#define HCI_HINT_TO_RECREATE_AMP_PHYS_LINK 0xFF
-
-/*
* Definitions for HCI enable event
*/
#define HCI_INQUIRY_COMPLETE_EV(p) (*((uint32_t*)(p)) & 0x00000001)