blob: 3265a81e109ea05cdbcf55f1da08dbb6af525afc [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lamaa8e15a2014-02-11 23:30:06 -08002 * Copyright (c) 2012-2013 Qualcomm Atheros, Inc.
3 * All Rights Reserved.
4 * Qualcomm Atheros Confidential and Proprietary.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08005 */
6/*
Jeff Johnson295189b2012-06-20 16:38:30 -07007 * Airgo Networks, Inc proprietary. All rights reserved.
8 * This file contains the source code for composing and sending messages
9 * to host.
10 *
11 * Author: Kevin Nguyen
12 * Date: 04/09/02
13 * History:-
14 * 04/09/02 Created.
15 * --------------------------------------------------------------------
16 */
17#include "palTypes.h"
18#include "cfgPriv.h"
19#include "limTrace.h"
20#include "cfgDebug.h"
21
22extern void SysProcessMmhMsg(tpAniSirGlobal pMac, tSirMsgQ* pMsg);
23
24/*--------------------------------------------------------------------*/
25/* ATTENTION: The functions contained in this module are to be used */
26/* by CFG module ONLY. */
27/*--------------------------------------------------------------------*/
28
29
30/**---------------------------------------------------------------------
31 * cfgSendHostMsg()
32 *
33 * FUNCTION:
34 * Send CNF/RSP to host.
35 *
36 * LOGIC:
37 * Please see Configuration & Statistic Collection Micro-Architecture
38 * specification for details.
39 *
40 * ASSUMPTIONS:
41 *
42 * NOTE:
43 *
44 * @param msgType: message type
45 * @param msgLen: message length
46 * @param paramNum: number of parameters
47 * @param pParamList: pointer to parameter list
48 * @param dataLen: data length
49 * @param pData: pointer to additional data
50 *
51 * @return None.
52 *
53 */
54void
55cfgSendHostMsg(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 msgLen, tANI_U32 paramNum, tANI_U32 *pParamList,
56 tANI_U32 dataLen, tANI_U32 *pData)
57{
58 tANI_U32 *pMsg, *pEnd;
59 tSirMsgQ mmhMsg;
60
61 // sanity
62 if ((paramNum > 0) && (NULL == pParamList))
63 {
64 PELOGE(cfgLog(pMac, LOGE,
65 FL("pParamList NULL when paramNum greater than 0!"));)
66 return;
67 }
68 if ((dataLen > 0) && (NULL == pData))
69 {
70 PELOGE(cfgLog(pMac, LOGE,
71 FL("pData NULL when dataLen greater than 0!"));)
72 return;
73 }
74
75 // Allocate message buffer
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +053076 pMsg = vos_mem_malloc(msgLen);
77 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -070078 {
79 PELOGE(cfgLog(pMac, LOGE,
80 FL("Memory allocation failure!"));)
81 return;
82 }
83
84 // Fill in message details
85 mmhMsg.type = msgType;
86 mmhMsg.bodyptr = pMsg;
87 mmhMsg.bodyval = 0;
88 ((tSirMbMsg*)pMsg)->type = msgType;
89 ((tSirMbMsg*)pMsg)->msgLen = (tANI_U16)msgLen;
90
91 switch (msgType)
92 {
93 case WNI_CFG_GET_RSP:
94 case WNI_CFG_PARAM_UPDATE_IND:
95 case WNI_CFG_DNLD_REQ:
96 case WNI_CFG_DNLD_CNF:
97 case WNI_CFG_SET_CNF:
98 // Fill in parameters
99 pMsg++;
100 if (NULL != pParamList)
101 {
102 pEnd = pMsg + paramNum;
103 while (pMsg < pEnd)
104 {
105 *pMsg++ = *pParamList++;
106 }
107 }
108 // Copy data if there is any
109 if (NULL != pData)
110 {
111 pEnd = pMsg + (dataLen >> 2);
112 while (pMsg < pEnd)
113 {
114 *pMsg++ = *pData++;
115 }
116 }
117 break;
118
119 default:
120 PELOGE(cfgLog(pMac, LOGE,
121 FL("Unknown msg %d!"), (int) msgType);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530122 vos_mem_free( pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -0700123 return;
124 }
125
126 // Ship it
Jeff Johnsone7245742012-09-05 17:12:55 -0700127 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700128 SysProcessMmhMsg(pMac, &mmhMsg);
129
130} /*** end cfgSendHostMsg() ***/
131
132
133
134