blob: 3d9d598fbcdd5b76a7fd761b729a8f4683847d35 [file] [log] [blame]
/******************************************************************************
*(C) Copyright 2018 ASR Microelectronics
* All Rights Reserved
******************************************************************************/
/* ----------------------------------------------------------------------------
*
* Filename: mbim_dss.c
*
*
* Description: all auth mbim related functions should be added here
*
*
* Notes:
*
******************************************************************************/
#define LOG_TAG "MBIM"
/******************************************************************************
* Include files
******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include "mbim_types.h"
#include "mbim_util.h"
#include "mbim_dss.h"
#if defined MBIM_MTIL
#include "mbim_mtil.h"
#include "MtilAPI.h"
#endif
#ifndef MBIM_DSS_UNUSEDPARAM
#define MBIM_DSS_UNUSEDPARAM() ((void) cid);((void) transactionId);((void) commandType);((void) infoBufLen);((void) infoBuf_p)
#endif
/******************************************************************************
* Macros
******************************************************************************/
#define CREATE_DSS_CONTEXT(pContext, mBuf) \
pContext = (P_MBIM_MESSAGE_CONTEXT)MBIM_MALLOC(sizeof(MBIM_MESSAGE_CONTEXT)); \
if (pContext != NULL) { \
pContext->hdr.cid = cid; \
pContext->hdr.transId = transactionId; \
pContext->hdr.uuidIndex = UUID_DSS_INDEX; \
pContext->hdr.indication= MBIM_REQUEST; \
pContext->body = mBuf; \
pContext->cmd = NULL; \
} \
else { \
if (mBuf != NULL) \
MBIM_FREE(mBuf); \
MBIM_LOGE("DSS UUID: OUT OF MEMORY CID %d (TransactionId = %d, Cmd Type = %d)", cid, transactionId, commandType); \
return MbimSendFunctionErrorMsg(transactionId, MBIM_ERROR_UNKNOWN); \
}
#define ALLOCATE_RESPONSE_BUFFER(mBuf_p, mSize) \
mBuf_p = (char *)MBIM_MALLOC(mSize); \
if (mBuf_p == NULL) { \
MBIM_LOGE("DSS UUID: OUT OF MEMORY CID %d (TransactionId = %d, Cmd Type = %d)", cid, transactionId, commandType); \
return MbimSendFunctionErrorMsg(transactionId, MBIM_ERROR_UNKNOWN); \
}
/******************************************************************************
* #defines
******************************************************************************/
#define DEFAULT_CONTEXT_ALLOC_SIZE (4000)
/******************************************************************************
* Global Variables
******************************************************************************/
extern MBIM_DATABASE mbimDb;
/******************************************************************************
* Function prototypes
******************************************************************************/
int CID_DssNotSupported(DSS_CID_PARAMS);
int CID_DssConnect(DSS_CID_PARAMS);
/******************************************************************************
* External variables
******************************************************************************/
dssUuidProcessors dssCidProcessor[UUID_CID_DSS_MAX] = {
CID_DssNotSupported, //0
CID_DssConnect,
};
/******************************************************************************
* Code
******************************************************************************/
/*******************************************************************************\
* Function: CID_DssNotSupported
* Description: This function sends Error to HOST when a unknown command is received
* Parameters: dataBuf - String
*
* Returns: 0=OK, <0=Error Code
\*******************************************************************************/
int CID_DssNotSupported(DSS_CID_PARAMS)
{
int rc = MBIM_OK;
//Added for compilation uof unused parameters on Codeline
MBIM_DSS_UNUSEDPARAM();
MBIM_LOGE("DSS UUID: Command %d not supported (TransactionId = %d, Cmd Type = %d)", cid, transactionId, commandType);
rc = MbimSendCommandDone(transactionId, UUID_DSS_INDEX,
cid, MBIM_STATUS_NO_DEVICE_SUPPORT, 0 , NULL);
return rc;
}
int CID_DssConnect(DSS_CID_PARAMS)
{
int rc = MBIM_OK;
//Added for compilation uof unused parameters on Codeline
MBIM_DSS_UNUSEDPARAM();
MBIM_LOGE("DSS UUID: Command %d not supported (TransactionId = %d, Cmd Type = %d)", cid, transactionId, commandType);
rc = MbimSendCommandDone(transactionId, UUID_DSS_INDEX,
cid, MBIM_STATUS_NO_DEVICE_SUPPORT, 0 , NULL);
return rc;
}