2 * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 /*!-----------------------------------------------------------------------------
20 * @brief deck_hal API head
24 #ifndef HAL_API_DECK_HAL_H_
25 #define HAL_API_DECK_HAL_H_
27 #include <native_service/frameworkunified_types.h>
33 /** @addtogroup interface_unified
36 /** @addtogroup deck_hal
37 * @ingroup interface_unified
42 #endif /*__cplusplus*/
44 /*! @~english Maximum length of command data division */
45 #define DECK_CMD_SIZE_CMDDATA_MAX 252
46 /*! @~english Maximum length of notification destination */
47 #define NOTIFY_NAME_MAX_SIZE 15
49 // CID_DECK_SYS_DELIVERY is for deck_hal to report correspinding message to vehicle,
50 // the value 0x40 can be changed in the future
52 * \~english @brief DECK SYS Command-Delivery Notification
53 * \~english @brief If you want to receive this DECK SYS command-delivery notification, use the NSFW IF as follows:
55 * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp, DECKHAL_THREAD, CID_DECK_SYS_DELIVERY, LineSensDrvRcvDeckHal);
58 #define CID_DECK_SYS_DELIVERY 0x40
62 * @brief Disc eject mode
65 /*! @~english normal eject */
67 /*! @~english forced eject */
80 /*! @~english Blue-lay disc */
84 /*------------------------------------------------------------------------------
86 *----------------------------------------------------------------------------*/
88 * \~english Deck-Sys command header structure
91 /*! @~english Source logical address */
93 /*! @~english Forwarding destination logical address */
95 /*! @~english OP code */
97 /*! @~english Reserve */
102 * \~english Deck-Sys command body structure
104 typedef struct DeckCmd {
105 /*! @~english Deck-Sys command header */
107 /*! @~english Data length */
108 uint16_t data_length;
109 /*! @~english Reserve */
111 /*! @~english Command data */
112 uint8_t data[DECK_CMD_SIZE_CMDDATA_MAX];
117 * @brief Structure for message header
120 uint16_t replyid; //!< \~english Send Result ID
121 uint16_t sndpno; //!< \~english Send process No
122 uint16_t respno; //!< \~english Response No
123 uint16_t cid; //!< \~english Command ID
124 uint16_t msgbodysize; //!< \~english Message body size
125 uint8_t rid; //!< \~english Resource ID
126 uint8_t reserve; //!< \~english Reserve
127 uint8_t filler[2]; //!< \~english filler
132 * @brief Structure for buffer message header
135 uint32_t signo; //!< \~english Signal No
136 DECK_HEADER_COMM hdr; //!< \~english Message Header
137 } DECK_MSGBUF_HEADER_COMM;
140 * \~english Delivery message structure
143 /*! @~english Header part */
144 DECK_MSGBUF_HEADER_COMM hdr;
145 /*! @~english Physical address */
146 uint16_t phyadr_from;
147 /*! @~english Communication type */
148 uint8_t service_type;
149 /*! @~english Reserve */
151 /*! @~english Data section */
157 * @brief Structure for send command data
160 /*! @~english Physical address */
161 uint16_t phyadr_from;
162 /*! @~english Communication type */
163 uint8_t service_type;
164 /*! @~english Forwarding former logic address */
166 /*! @~english Forwarding site logic address */
168 /*! @~english Operation code */
170 /*! @~english Data length (size in command data */
172 /*! @~english Command data */
173 uint8_t data[DECK_CMD_SIZE_CMDDATA_MAX];
174 /*! @~english reserve */
180 * @brief Structure for send command
183 /*! @~english Command information */
184 DECK_CMD_DATA cmd_data;
187 /*------------------------------------------------------------------------------
188 * function declaration
189 *----------------------------------------------------------------------------*/
190 ////////////////////////////////////////////////////////////////////////////////////////////
191 /// \ingroup StopDiscRotation
192 /// \~english @par Brief
193 /// Stop disc rotation
194 /// \~english @param [in] -
195 /// \~english @param [out] -
196 /// \~english @retval eFrameworkunifiedStatusOK OK
197 /// \~english @retval eFrameworkunifiedStatusFail Abnormal Error
198 /// \~english @par Prerequisite
199 /// - Disc was inserted
200 /// \~english @par Change of internal state
201 /// - Change of internal state according to the API does not occur.
202 /// \~english @par Conditions of processing failure
203 /// - Error occurs when call open or ioctl function.[eFrameworkunifiedStatusFail]
204 /// \~english @par Classification
206 /// \~english @par Type
208 /// \~english @par Detail
209 /// - Stop disc rotation
210 /// - Whatever disc is rotating or stoped, return successed.
211 /// - The API can be used by multi-process.
212 /// \~english @see None
213 ////////////////////////////////////////////////////////////////////////////////////////////
215 EFrameworkunifiedStatus StopDiscRotation();
217 ////////////////////////////////////////////////////////////////////////////////////////////
218 /// \ingroup EjectDisc
219 /// \~english @par Brief
221 /// \~english @param [in] kind
222 /// DeckKind - kind of deck.
223 /// \~english @param [in] mode
224 /// DeckEjectMode - eject mode(normal/forcedly)
225 /// \~english @param [out] -
226 /// \~english @retval eFrameworkunifiedStatusOK OK
227 /// \~english @retval eFrameworkunifiedStatusFail Abnormal Error
228 /// \~english @par Prerequisite
230 /// \~english @par Change of internal state
231 /// - Change of internal state according to the API does not occur.
232 /// \~english @par Conditions of processing failure
233 /// - Error occurs when call open or ioctl function.[eFrameworkunifiedStatusFail]
234 /// \~english @par Classification
236 /// \~english @par Type
238 /// \~english @par Detail
240 /// - Whatever disc is Ejecting or Unejected, return successed.
241 /// - The API can be used by multi-process.
242 /// \~english @see None
243 ////////////////////////////////////////////////////////////////////////////////////////////
244 EFrameworkunifiedStatus EjectDisc(DeckKind kind, DeckEjectMode mode);
246 ////////////////////////////////////////////////////////////////////////////////////////////
247 /// \ingroup DeckHalSysSend
248 /// \~english @par Brief
249 /// Send Disc Sys-Command to MICON
250 /// \~english @param [in] h_app
251 /// HANDLE - Handle of caller (Handle to get in Dispatcher generation
252 /// (FrameworkunifiedCreateDispatcherWithoutLoop etc.))
253 /// \~english @param [in] name
254 /// PCSTR - Name to notification of send result destination thread name
255 /// \~english @param [in] cmd
256 /// DECK_CMD - Send command pointer
257 /// \~english @param [in] req_id
258 /// uint8_t - Resource ID
259 /// \~english @param [out] -
260 /// \~english @retval eFrameworkunifiedStatusOK Normal termination
261 /// \~english @retval eFrameworkunifiedStatusInvldParam Abnormal parameter
262 /// \~english @par Prerequisite
264 /// \~english @par Change of internal state
265 /// - Change of internal state according to the API does not occur.
266 /// \~english @par Conditions of processing failure
267 /// - h_app is NULL.[eFrameworkunifiedStatusInvldParam]
268 /// - name is NULL or the length of name is longer than 15 bytes.
269 /// [eFrameworkunifiedStatusInvldParam]
270 /// - Send command pointer(cmd) is null.[eFrameworkunifiedStatusInvldParam]
271 /// \~english @par Classification
273 /// \~english @par Type
275 /// \~english @par Detail
276 /// - Send SYS command to MICON
277 /// - Now only usb disc exists,MICON disc is stub now.
278 /// - The API can only be used by 1 process.
279 /// \~english @see None
280 ////////////////////////////////////////////////////////////////////////////////////////////
281 EFrameworkunifiedStatus DeckHalSysSend(HANDLE h_app, PCSTR name, const DECK_CMD* cmd, uint8_t req_id);
283 ////////////////////////////////////////////////////////////////////////////////////////////
284 /// \ingroup DeckHalRegister
285 /// \~english @par Brief
286 /// Register the deck_hal command to receive from MICON
287 /// \~english @param [in] h_app
288 /// HANDLE - Handle of caller (Handle to get in Dispatcher generation
289 /// (FrameworkunifiedCreateDispatcherWithoutLoop etc.))
290 /// \~english @param [in] notify_name
291 /// PCSTR - Name to notification destination thread name
292 /// \~english @param [out] -
293 /// \~english @retval eFrameworkunifiedStatusOK Normal termination
294 /// \~english @retval eFrameworkunifiedStatusInvldParam Abnormal parameter
295 /// \~english @par Prerequisite
297 /// \~english @par Change of internal state
298 /// - Change of internal state according to the API does not occur.
299 /// \~english @par Conditions of processing failure
300 /// - h_app is NULL.[eFrameworkunifiedStatusInvldParam]
301 /// - notify_name is NULL or the length of notify_name is longer than 15 bytes.
302 /// [eFrameworkunifiedStatusInvldParam]
303 /// \~english @par Classification
305 /// \~english @par Type
307 /// \~english @par Detail
308 /// - After call this API, the user can received dech_hal command from MICON.
309 /// - Now MICON is stub,so that deck_hal won't register to MICON.
310 /// - The API can only be used by 1 process.
311 /// \~english @see None
312 ////////////////////////////////////////////////////////////////////////////////////////////
313 EFrameworkunifiedStatus DeckHalRegister(HANDLE h_app, PCSTR notify_name);
317 #endif /*__cplusplus */
319 /** @}*/ // end of deck_hal
320 /** @}*/ // end of interface_unified
322 #endif // HAL_API_DECK_HAL_H_