Fix the svace issue - DEREF_AFTER_NULL
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / include / oal-hardware.h
1 /*
2  * Open Adaptation Layer (OAL)
3  *
4  * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *              http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef _OAL_HARDWARE_H_
21 #define _OAL_HARDWARE_H_
22
23 #include <sys/types.h>
24 #include <oal-manager.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 #define FOREACH_TYPE(FUNC)      \
31         FUNC(BT_CHIP_TYPE_PLATFORM,             "Tizen Plaftrom BT Chip")       \
32         FUNC(BT_CHIP_TYPE_UNKNOWN,                      "Unknown Chip Type")    \
33
34 #define GENERATE_TYPE_ENUM(ENUM, STRING) ENUM,
35 #define GENERATE_TYPE_STRING(ENUM, STRING) STRING,
36
37 typedef enum {
38         FOREACH_TYPE(GENERATE_TYPE_ENUM)
39 } bt_chip_type_t;
40
41 /**
42  * @brief Upgrade BT Chip Firmware.
43  *
44  * @remarks BT Chip will be reset and oal will start again after upgrade. \n
45  *
46  * @details EVENT: N/A. as this is a blocking call
47  *
48  * @return OAL_STATUS_SUCCESS on success, otherwise OAL_STATUS_INTERNAL_ERROR.
49  * @retval #OAL_STATUS_SUCCESS  Successful
50  *         #OAL_STATUS_INTERNAL_ERROR  Failure
51  *
52  * @pre N/A, as this is related to hardware, oal need not be initialised.
53  *
54  * @see  -
55  */
56 oal_status_t hw_chip_firmware_update(void);
57
58 /**
59  * @brief Check whether BT chip is connected or not.
60  *
61  * @remarks BT Chip state. \n
62  *
63  * @details EVENT: N/A.
64  *
65  * @return TRUE if chip connected, otherwise FALSE.
66  * @retval #TRUE  Successful
67  *
68  * @pre N/A, as this is related to hardware, oal need not be initialised.
69  *
70  * @see  -
71  */
72 int hw_is_chip_connected(void);
73
74 /**
75  * @brief Get Connected BT Chip Type. (Single/Combo)
76  *
77  * @remarks BT Chip Type. \n
78  *
79  * @details EVENT: N/A
80  *
81  * @return BT_CHIP_TYPE_SINGLE if Single BT Chip connected,
82  *         BT_CHIP_TYPE_COMBO if BT Combo Chip connected,
83  *         otherwise BT_CHIP_TYPE_UNKNOWN on error.
84  * @retval #BT_CHIP_TYPE_SINGLE  Single-BT Chip
85  *
86  * @pre N/A, as this is related to hardware, oal need not be initialised.
87  *
88  * @see  -
89  */
90 bt_chip_type_t hw_get_chip_type(void);
91
92 /**
93  * @brief Get driver state.
94  *
95  * @remarks BT Module State \n
96  *
97  * @details EVENT: N/A
98  *
99  * @return OAL_STATUS_SUCCESS on success, otherwise OAL_STATUS_INTERNAL_ERROR.
100  * @retval #OAL_STATUS_SUCCESS  Successful
101  *         #OAL_STATUS_INTERNAL_ERROR  Failure
102  *
103  * @pre N/A, as this is related to hardware, oal need not be initialised.
104  *
105  * @see  -
106  */
107 oal_status_t hw_is_module_ready(void);
108
109 /**
110  * @brief Firmware Upgrade Required Status
111  *
112  * @remarks whether upgrade firmwares required or not \n
113  * is_required = TRUE, if upgrade required, else FALSE
114  *
115  * @details EVENT: N/A
116  *
117  * @return OAL_STATUS_SUCCESS
118  *
119  * @pre N/A
120  *
121  * @see  N/A
122  */
123 oal_status_t hw_is_fwupgrade_required(gboolean *is_required);
124
125 #ifdef __cplusplus
126 }
127 #endif /* __cplusplus */
128 #endif /*_OAL_HARDWARE_H_*/
129