// Caller of this function MUST dynamically allocate memory for pBuf // because this funciton will free the memory. eHalStatus palSendMBMessage(tHddHandle hHdd, void *pBuf) { eHalStatus halStatus = eHAL_STATUS_FAILURE; tSirRetStatus sirStatus; v_CONTEXT_t vosContext; v_VOID_t *hHal; vosContext = vos_get_global_context( VOS_MODULE_ID_HDD, hHdd ); if (NULL == vosContext) { VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR, "%s: invalid vosContext", __func__); } else { hHal = vos_get_context( VOS_MODULE_ID_SME, vosContext ); if (NULL == hHal) { VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR, "%s: invalid hHal", __func__); } else { sirStatus = uMacPostCtrlMsg( hHal, pBuf ); if ( eSIR_SUCCESS == sirStatus ) { halStatus = eHAL_STATUS_SUCCESS; } } } vos_mem_free( pBuf ); return( halStatus ); }
static VOS_STATUS sys_SendHalInitStartReqMsg( v_CONTEXT_t pVosContext ) { VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; tSirMbMsg msg; tSirRetStatus sirStatus = eSIR_SUCCESS; tSirMbMsg *pMsg = &msg; v_VOID_t *hHal; do { // get the HAL context... hHal = vos_get_context( VOS_MODULE_ID_HAL, pVosContext ); if ( NULL == hHal ) break; // format the Init start request message. This message has // the hal handle in the 'data' portion of the message. pMsg->type = WDA_INIT_START_REQ; pMsg->data[0] = (tANI_U32)hHal; // message length is 4 greater than the config data size // need to add in an extra 4 for the message header. pMsg->msgLen = sizeof( tHalHandle ) + FIELD_OFFSET( tSirMbMsg, data ); // Send the HAL Init Start Request message... sirStatus = uMacPostCtrlMsg( hHal, pMsg ); if ( eSIR_SUCCESS != sirStatus ) { vosStatus = VOS_STATUS_E_FAILURE; } } while( 0 ); return( vosStatus ); }