blob: 8f8314365a15ddece5a6f723ad62cf954c125a4a [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
2 * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * Airgo Networks, Inc proprietary. All rights reserved.
24 * This file contains the source code for composing and sending messages
25 * to host.
26 *
27 * Author: Kevin Nguyen
28 * Date: 04/09/02
29 * History:-
30 * 04/09/02 Created.
31 * --------------------------------------------------------------------
32 */
33#include "palTypes.h"
34#include "cfgPriv.h"
35#include "limTrace.h"
36#include "cfgDebug.h"
37
38extern void SysProcessMmhMsg(tpAniSirGlobal pMac, tSirMsgQ* pMsg);
39
40/*--------------------------------------------------------------------*/
41/* ATTENTION: The functions contained in this module are to be used */
42/* by CFG module ONLY. */
43/*--------------------------------------------------------------------*/
44
45
46/**---------------------------------------------------------------------
47 * cfgSendHostMsg()
48 *
49 * FUNCTION:
50 * Send CNF/RSP to host.
51 *
52 * LOGIC:
53 * Please see Configuration & Statistic Collection Micro-Architecture
54 * specification for details.
55 *
56 * ASSUMPTIONS:
57 *
58 * NOTE:
59 *
60 * @param msgType: message type
61 * @param msgLen: message length
62 * @param paramNum: number of parameters
63 * @param pParamList: pointer to parameter list
64 * @param dataLen: data length
65 * @param pData: pointer to additional data
66 *
67 * @return None.
68 *
69 */
70void
71cfgSendHostMsg(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 msgLen, tANI_U32 paramNum, tANI_U32 *pParamList,
72 tANI_U32 dataLen, tANI_U32 *pData)
73{
74 tANI_U32 *pMsg, *pEnd;
75 tSirMsgQ mmhMsg;
76
77 // sanity
78 if ((paramNum > 0) && (NULL == pParamList))
79 {
80 PELOGE(cfgLog(pMac, LOGE,
81 FL("pParamList NULL when paramNum greater than 0!"));)
82 return;
83 }
84 if ((dataLen > 0) && (NULL == pData))
85 {
86 PELOGE(cfgLog(pMac, LOGE,
87 FL("pData NULL when dataLen greater than 0!"));)
88 return;
89 }
90
91 // Allocate message buffer
92 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMsg, msgLen))
93 {
94 PELOGE(cfgLog(pMac, LOGE,
95 FL("Memory allocation failure!"));)
96 return;
97 }
98
99 // Fill in message details
100 mmhMsg.type = msgType;
101 mmhMsg.bodyptr = pMsg;
102 mmhMsg.bodyval = 0;
103 ((tSirMbMsg*)pMsg)->type = msgType;
104 ((tSirMbMsg*)pMsg)->msgLen = (tANI_U16)msgLen;
105
106 switch (msgType)
107 {
108 case WNI_CFG_GET_RSP:
109 case WNI_CFG_PARAM_UPDATE_IND:
110 case WNI_CFG_DNLD_REQ:
111 case WNI_CFG_DNLD_CNF:
112 case WNI_CFG_SET_CNF:
113 // Fill in parameters
114 pMsg++;
115 if (NULL != pParamList)
116 {
117 pEnd = pMsg + paramNum;
118 while (pMsg < pEnd)
119 {
120 *pMsg++ = *pParamList++;
121 }
122 }
123 // Copy data if there is any
124 if (NULL != pData)
125 {
126 pEnd = pMsg + (dataLen >> 2);
127 while (pMsg < pEnd)
128 {
129 *pMsg++ = *pData++;
130 }
131 }
132 break;
133
134 default:
135 PELOGE(cfgLog(pMac, LOGE,
136 FL("Unknown msg %d!"), (int) msgType);)
137 palFreeMemory( pMac->hHdd, pMsg);
138 return;
139 }
140
141 // Ship it
Jeff Johnsone7245742012-09-05 17:12:55 -0700142 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700143 SysProcessMmhMsg(pMac, &mmhMsg);
144
145} /*** end cfgSendHostMsg() ***/
146
147
148
149