Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Abhishek Singh | 5ff2ff6 | 2016-05-17 13:40:13 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. |
Kiet Lam | 0fb93dd | 2014-02-19 00:32:59 -0800 | [diff] [blame] | 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. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 20 | */ |
Kiet Lam | 0fb93dd | 2014-02-19 00:32:59 -0800 | [diff] [blame] | 21 | |
| 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 28 | /****************************************************************************** |
| 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 60 | #define PTT_MSG_FTM_CMDS_TYPE 0x4040 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 61 | #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 Kumar | 2762e9d | 2015-10-20 15:02:57 +0530 | [diff] [blame] | 64 | #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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 70 | #define ANI_MAX_RADIOS 3 |
| 71 | #define ANI_NL_MSG_OK 0 |
| 72 | #define ANI_NL_MSG_ERROR -1 |
Sushant Kaushik | 5a64cf7 | 2015-05-07 15:26:02 +0530 | [diff] [blame] | 73 | #define INVALID_PID -1 |
| 74 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 75 | #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 | */ |
| 97 | int ptt_sock_activate_svc(void *pAdapter); |
Abhishek Singh | 5ff2ff6 | 2016-05-17 13:40:13 +0530 | [diff] [blame] | 98 | int ptt_sock_deactivate_svc(hdd_context_t *pHddCtx); |
Hardik Kantilal Patel | 9a52d27 | 2014-04-29 14:24:55 +0530 | [diff] [blame] | 99 | int ptt_sock_send_msg_to_app(tAniHdr *wmsg, int radio, int src_mod, int pid, int flag); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 100 | |
| 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 | */ |
| 106 | typedef 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 Bhal | 7bd1993 | 2015-03-03 16:54:36 +0530 | [diff] [blame] | 111 | typedef struct sAniNlMgmtLogMsg { |
| 112 | struct nlmsghdr nlh; |
| 113 | int radio; |
| 114 | tAniHdr wmsg; |
| 115 | uint32 frameSize; |
| 116 | } tAniNlLogHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 117 | typedef struct sAniAppRegReq { |
| 118 | tAniNlModTypes type; // module id |
| 119 | int pid; // process id |
| 120 | } tAniNlAppRegReq; |
| 121 | typedef 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 |