| /****************************************************************************** |
| *(C) Copyright 2014 Marvell International Ltd. |
| * All Rights Reserved |
| ******************************************************************************/ |
| /* ------------------------------------------------------------------------------------------------------------------- |
| * |
| * Filename: mbim_blob.c |
| * |
| * Authors: Boaz Sommer |
| * |
| * Description: BLOB interface for MBIM functions. |
| * This module exports BLOB functionality using MbimMessage |
| * interface |
| * |
| * HISTORY: |
| * |
| * Dec 12, 2014 - Initial Version |
| * |
| * Notes: |
| * |
| ******************************************************************************/ |
| |
| /****************************************************************************** |
| * Include files |
| ******************************************************************************/ |
| #include "mbim_imessage.h" |
| #include "mbim_blob.h" |
| |
| /* |
| struct MessageInterfaceS mbimMessage = { |
| .Init = MbimBlobInit, |
| |
| .AddInt8 = MbimBlobAddInt8, |
| .AddInt16 = MbimBlobAddInt16, |
| .AddInt32 = MbimBlobAddInt32, |
| .AddInt64 = MbimBlobAddInt64, |
| .AddString = MbimBlobAddString, |
| |
| .GetInt8 = MbimBlobGetInt8, |
| .GetInt16 = MbimBlobGetInt16, |
| .GetInt32 = MbimBlobGetInt32, |
| .GetInt64 = MbimBlobGetInt64, |
| .GetString = MbimBlobGetString, |
| }; |
| */ |
| |
| //static struct blob_buf gBlobMsg; |
| |
| /* |
| void MbimBlobInit (struct MessageInterfaceS *msg) |
| { |
| struct blob_buf *blobMsg = (struct blob_buf *)msg->MsgContainer; |
| blob_buf_init(blobMsg, 0); |
| } |
| */ |
| |
| int InitMessageInterface (struct MessageInterfaceS *msg) |
| { |
| msg->AddInt8 = MbimBlobAddInt8; |
| msg->AddInt16 = MbimBlobAddInt16; |
| msg->AddInt32 = MbimBlobAddInt32; |
| msg->AddInt64 = MbimBlobAddInt64; |
| msg->AddString = MbimBlobAddString; |
| msg->AddData = MbimBlobAddData; |
| |
| msg->GetInt8 = MbimBlobGetInt8; |
| msg->GetInt16 = MbimBlobGetInt16; |
| msg->GetInt32 = MbimBlobGetInt32; |
| msg->GetInt64 = MbimBlobGetInt64; |
| msg->GetString = MbimBlobGetString; |
| |
| struct blob_buf *blobMsg = (struct blob_buf *)msg->MsgContainer; |
| return blob_buf_init(blobMsg, 0); |
| |
| } |
| |
| void MbimBlobAddInt8(struct MessageInterfaceS *msg, char *name, Int8 data) |
| { |
| struct blob_buf *blobMsg = (struct blob_buf *)msg->MsgContainer; |
| |
| blobmsg_add_u8(blobMsg, name, data); |
| } |
| |
| void MbimBlobAddInt16(struct MessageInterfaceS *msg, char *name, Int16 data) |
| { |
| struct blob_buf *blobMsg = (struct blob_buf *)msg->MsgContainer; |
| |
| blobmsg_add_u16(blobMsg, name, data); |
| } |
| |
| void MbimBlobAddInt32(struct MessageInterfaceS *msg, char *name, Int32 data) |
| { |
| struct blob_buf *blobMsg = (struct blob_buf *)msg->MsgContainer; |
| |
| blobmsg_add_u32(blobMsg, name, data); |
| } |
| |
| |
| void MbimBlobAddString(struct MessageInterfaceS *msg, char *name, char *data) |
| { |
| struct blob_buf *blobMsg = (struct blob_buf *)msg->MsgContainer; |
| |
| blobmsg_add_string(blobMsg, name, data); |
| } |
| |
| void MbimBlobAddData(struct MessageInterfaceS *msg, int id, void *data, int datalen) |
| { |
| struct blob_buf *blobMsg = (struct blob_buf *)msg->MsgContainer; |
| |
| blob_put(blobMsg, id, data, datalen); |
| } |
| |