blob: 2f2bac6e601fe5d208d1b17220abe0c7b61a6aaf [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Abhishek Singh5ff2ff62016-05-17 13:40:13 +05302 * Copyright (c) 2012-2016 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 * wlan_ptt_sock_svc.c
30 *
31 ******************************************************************************/
32#ifndef PTT_SOCK_SVC_H
33#define PTT_SOCK_SVC_H
34#include <wlan_nlink_srv.h>
35#include <halTypes.h>
36#include <vos_status.h>
37#include <wlan_hdd_includes.h>
38#include <vos_trace.h>
39#include <wlan_nlink_common.h>
40/*
41 * Quarky Message Format:
42 * The following is the messaging protocol between Quarky and PTT Socket App.
43 * The totalMsgLen is the length from Radio till msgBody. The value of Radio
44 * is always defaulted to 0. The MsgLen is the length from msgId till msgBody.
45 * The length of the msgBody varies with respect to the MsgId. Buffer space
46 * for MsgBody is already allocated in the received buffer. So in case of READ
47 * we just need to populate the values in the received message and send it
48 * back
49 * +------------+-------+-------+--------+-------+---------+
50 * |TotalMsgLen | Radio | MsgId | MsgLen |Status |MsgBody |
51 * +------------+-------+-------|--------+-------+---------+
52 * <------4----><--4---><---2--><---2---><---4--><--------->
53 */
54// PTT Socket App Message Ids
55#define PTT_MSG_READ_REGISTER 0x3040
56#define PTT_MSG_WRITE_REGISTER 0x3041
57#define PTT_MSG_READ_MEMORY 0x3044
58#define PTT_MSG_WRITE_MEMORY 0x3045
59#define PTT_MSG_LOG_DUMP_DBG 0x32A1
Jeff Johnson295189b2012-06-20 16:38:30 -070060#define PTT_MSG_FTM_CMDS_TYPE 0x4040
Jeff Johnson295189b2012-06-20 16:38:30 -070061#define ANI_DRIVER_MSG_START 0x0001
62#define ANI_MSG_APP_REG_REQ (ANI_DRIVER_MSG_START + 0)
63#define ANI_MSG_APP_REG_RSP (ANI_DRIVER_MSG_START + 1)
Padma, Santhosh Kumar2762e9d2015-10-20 15:02:57 +053064#define ANI_MSG_OEM_DATA_REQ (ANI_DRIVER_MSG_START + 2)
65#define ANI_MSG_OEM_DATA_RSP (ANI_DRIVER_MSG_START + 3)
66#define ANI_MSG_CHANNEL_INFO_REQ (ANI_DRIVER_MSG_START + 4)
67#define ANI_MSG_CHANNEL_INFO_RSP (ANI_DRIVER_MSG_START + 5)
68#define ANI_MSG_OEM_ERROR (ANI_DRIVER_MSG_START + 6)
69
Jeff Johnson295189b2012-06-20 16:38:30 -070070#define ANI_MAX_RADIOS 3
71#define ANI_NL_MSG_OK 0
72#define ANI_NL_MSG_ERROR -1
Sushant Kaushik5a64cf72015-05-07 15:26:02 +053073#define INVALID_PID -1
74
Jeff Johnson295189b2012-06-20 16:38:30 -070075#define ANI_NL_MSG_OVERHEAD (NLMSG_SPACE(tAniHdr + 4))
76/*
77 * Packet Format for READ_REGISTER & WRITE_REGISTER:
78 * TotalMsgLen : 4 bytes [value=20 bytes]
79 * Radio : 4 bytes
80 * MsgId : 2 bytes
81 * MsgLen : 2 bytes
82 * Status : 4 bytes
83 * Address : 4 bytes
84 * Payload : 4 bytes
85*/
86/*
87 * Packet Format for READ_MEMORY & WRITE_MEMORY :
88 * TotalMsgLen : 4 bytes [value= 20+LEN_PAYLOAD bytes]
89 * Radio : 4 bytes
90 * MsgId : 2 bytes
91 * MsgLen : 2 bytes
92 * Status : 4 bytes
93 * Address : 4 bytes
94 * Length : 4 bytes [LEN_PAYLOAD]
95 * Payload : LEN_PAYLOAD bytes
96*/
97int ptt_sock_activate_svc(void *pAdapter);
Abhishek Singh5ff2ff62016-05-17 13:40:13 +053098int ptt_sock_deactivate_svc(hdd_context_t *pHddCtx);
Hardik Kantilal Patel9a52d272014-04-29 14:24:55 +053099int ptt_sock_send_msg_to_app(tAniHdr *wmsg, int radio, int src_mod, int pid, int flag);
Jeff Johnson295189b2012-06-20 16:38:30 -0700100
101/*
102 * Format of message exchanged between the PTT Socket App in userspace and the
103 * WLAN Driver, in either direction. Each msg will begin with this header and
104 * will followed by the Quarky message
105 */
106typedef struct sAniNlMsg {
107 struct nlmsghdr nlh; // Netlink Header
108 int radio; // unit number of the radio
109 tAniHdr wmsg; // Airgo Message Header
110} tAniNlHdr;
Siddharth Bhal7bd19932015-03-03 16:54:36 +0530111typedef struct sAniNlMgmtLogMsg {
112 struct nlmsghdr nlh;
113 int radio;
114 tAniHdr wmsg;
115 uint32 frameSize;
116} tAniNlLogHdr;
Jeff Johnson295189b2012-06-20 16:38:30 -0700117typedef struct sAniAppRegReq {
118 tAniNlModTypes type; // module id
119 int pid; // process id
120} tAniNlAppRegReq;
121typedef struct sAniNlAppRegRsp {
122 struct nlmsghdr nlh; // NetLink Msg Header
123 int radio; // Radio unit
124 tAniHdr wniHdr; // Generic WNI msg header
125 tAniNlAppRegReq regReq; // The original request msg
126 int ret; // Return code
127} tAniNlAppRegRsp;
128#endif