blob: 0abfdc5b5b255b529d2d6c54f1f0d2e57919f26d [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Satyanarayana Dash6f438272015-03-03 18:01:06 +05302 * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
Kiet Lam0fb93dd2014-02-19 00:32:59 -08003 *
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.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam0fb93dd2014-02-19 00:32:59 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Jeff Johnson295189b2012-06-20 16:38:30 -070028/** ------------------------------------------------------------------------- *
29 ------------------------------------------------------------------------- *
30 \file ccmApi.h
31
32 \brief Exports and types for the Common Config Module (CCM)
33
Kiet Lam0fb93dd2014-02-19 00:32:59 -080034 $Id$
Jeff Johnson295189b2012-06-20 16:38:30 -070035
36 This file contains all the interfaces for thge Platform Abstration Layer
37 functions. It is intended to be included in all modules that are using
38 the PAL interfaces.
39
40 ========================================================================== */
41#ifndef CCMAPI_H__
42#define CCMAPI_H__
43
44//#include "wniCfgAp.h" /* CFG_PARAM_MAX_NUM */
Satyanarayana Dash6f438272015-03-03 18:01:06 +053045#include "wniCfg.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070046#include "halTypes.h"
47
48#define CCM_11B_CHANNEL_END 14
49
50#define CCM_IS_RESULT_SUCCESS(result) (WNI_CFG_SUCCESS == (result) ||\
51 WNI_CFG_NEED_RESTART == (result) || \
52 WNI_CFG_NEED_RELOAD == (result))
53
54#define CCM_INTEGER_TYPE 0
55#define CCM_STRING_TYPE 1
56
57typedef void (*tCcmCfgSetCallback)(tHalHandle hHal, tANI_S32 result) ;
58
59typedef enum {
60 eCCM_STOPPED,
61 eCCM_STARTED,
62 eCCM_REQ_SENT,
63 eCCM_REQ_QUEUED,
64 eCCM_REQ_DONE,
65} eCcmState ;
66
67/* We do not use Linux's list facility */
68typedef struct cfgreq {
69 struct cfgreq *next ;
70 tANI_U16 cfgId ;
71 tANI_U8 type ;
72 tANI_U8 state : 7 ;
73 tANI_U8 toBeSaved : 1 ;
74 tANI_S32 length ;
75 void *ccmPtr;
76 tANI_U32 ccmValue;
77 tCcmCfgSetCallback callback;
78 void *done ;
79} tCfgReq ;
80
81typedef struct {
82 tANI_U16 started : 1 ;
83 tANI_U16 in_progress : 1 ;
84 tANI_U16 reserved : 14 ;
85 tANI_S16 nr_param ;
86 tANI_U32 result ;
87 tCcmCfgSetCallback callback ;
88 void *done ;
89} tCfgReplay ;
90
91struct ccmlink {
92 tCfgReq *head;
93 tCfgReq *tail;
94} ;
95
96typedef struct {
97 struct ccmlink reqQ ;
98 eCcmState state ;
99 tCfgReq * comp[CFG_PARAM_MAX_NUM] ;
100 tCfgReplay replay ;
101 void *lock;
102} tCcm ;
103
104void ccmCfgCnfMsgHandler(tHalHandle hHal, void *msg) ;
105eHalStatus ccmOpen(tHalHandle hHal) ;
106eHalStatus ccmClose(tHalHandle hHal) ;
107void ccmStart(tHalHandle hHal) ;
108void ccmStop(tHalHandle hHal) ;
109//If callback is NULL, the API is not serialized for the CFGs
110eHalStatus ccmCfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue, tCcmCfgSetCallback callback, eAniBoolean toBeSaved) ;
111//If callback is NULL, the API is not serialized for the CFGs
112eHalStatus ccmCfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr, tANI_U32 length, tCcmCfgSetCallback callback, eAniBoolean toBeSaved) ;
113eHalStatus ccmCfgUpdate(tHalHandle hHal, tCcmCfgSetCallback callback) ;
114eHalStatus ccmCfgGetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 *pValue) ;
115eHalStatus ccmCfgGetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pBuf, tANI_U32 *pLength) ;
116
117void ccmDumpInit(tHalHandle hHal);
118
119#endif /*CCMAPI_H__*/