4 * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #ifndef __IMC_COMMON_H__
20 #define __IMC_COMMON_H__
22 #define IMC_SWAP_BYTES_16(x) \
24 unsigned short int data = *(unsigned short int *)&(x); \
25 data = ((data & 0xff00) >> 8) | \
26 ((data & 0x00ff) << 8); \
27 *(unsigned short int *)&(x) = data; \
31 TcoreObjectResponseCallback cb;
33 char data[]; /* Additional data */
36 #define IMC_GET_DATA_FROM_RESP_CB_DATA(ptr) (gpointer)ptr->data
37 #define IMC_CHECK_REQUEST_RET(ret, resp_cb_data, request) \
39 if (ret != TEL_RETURN_SUCCESS) { \
40 err("Failed to process request - [%s]", request); \
41 imc_destroy_resp_cb_data(resp_cb_data); \
45 ImcRespCbData *imc_create_resp_cb_data(TcoreObjectResponseCallback cb,
46 void *cb_data, void *data, guint data_len);
47 void imc_destroy_resp_cb_data(ImcRespCbData *resp_cb_data);
49 void on_send_imc_request(TcorePending *p,
50 TelReturn send_status, void *user_data);
52 #endif /* __IMC_COMMON_H__ */