Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2012-2015 The Linux Foundation. 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 | * 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 | |
| 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 <cdf_types.h> |
| 36 | #include <cdf_status.h> |
| 37 | #include <cdf_trace.h> |
| 38 | #include <wlan_nlink_common.h> |
| 39 | /* |
| 40 | * Quarky Message Format: |
| 41 | * The following is the messaging protocol between Quarky and PTT Socket App. |
| 42 | * The totalMsgLen is the length from Radio till msgBody. The value of Radio |
| 43 | * is always defaulted to 0. The MsgLen is the length from msgId till msgBody. |
| 44 | * The length of the msgBody varies with respect to the MsgId. Buffer space |
| 45 | * for MsgBody is already allocated in the received buffer. So in case of READ |
| 46 | * we just need to populate the values in the received message and send it |
| 47 | * back |
| 48 | * +------------+-------+-------+--------+-------+---------+ |
| 49 | * |TotalMsgLen | Radio | MsgId | MsgLen |Status |MsgBody | |
| 50 | * +------------+-------+-------|--------+-------+---------+ |
| 51 | * <------4----><--4---><---2--><---2---><---4--><---------> |
| 52 | */ |
| 53 | /* PTT Socket App Message Ids */ |
| 54 | #define PTT_MSG_READ_REGISTER 0x3040 |
| 55 | #define PTT_MSG_WRITE_REGISTER 0x3041 |
| 56 | #define PTT_MSG_READ_MEMORY 0x3044 |
| 57 | #define PTT_MSG_WRITE_MEMORY 0x3045 |
| 58 | #define PTT_MSG_LOG_DUMP_DBG 0x32A1 |
| 59 | #define PTT_MSG_FTM_CMDS_TYPE 0x4040 |
| 60 | #define ANI_DRIVER_MSG_START 0x0001 |
| 61 | #define ANI_MSG_APP_REG_REQ (ANI_DRIVER_MSG_START + 0) |
| 62 | #define ANI_MSG_APP_REG_RSP (ANI_DRIVER_MSG_START + 1) |
| 63 | #define ANI_MSG_OEM_DATA_REQ (ANI_DRIVER_MSG_START + 2) |
| 64 | #define ANI_MSG_OEM_DATA_RSP (ANI_DRIVER_MSG_START + 3) |
| 65 | #define ANI_MSG_CHANNEL_INFO_REQ (ANI_DRIVER_MSG_START + 4) |
| 66 | #define ANI_MSG_CHANNEL_INFO_RSP (ANI_DRIVER_MSG_START + 5) |
| 67 | #define ANI_MSG_OEM_ERROR (ANI_DRIVER_MSG_START + 6) |
| 68 | #define ANI_MSG_PEER_STATUS_IND (ANI_DRIVER_MSG_START + 7) |
| 69 | |
| 70 | #define ANI_MAX_RADIOS 3 |
| 71 | #define ANI_NL_MSG_OK 0 |
| 72 | #define ANI_NL_MSG_ERROR -1 |
| 73 | #define ANI_NL_MSG_OVERHEAD (NLMSG_SPACE(tAniHdr + 4)) |
| 74 | /* |
| 75 | * Packet Format for READ_REGISTER & WRITE_REGISTER: |
| 76 | * TotalMsgLen : 4 bytes [value=20 bytes] |
| 77 | * Radio : 4 bytes |
| 78 | * MsgId : 2 bytes |
| 79 | * MsgLen : 2 bytes |
| 80 | * Status : 4 bytes |
| 81 | * Address : 4 bytes |
| 82 | * Payload : 4 bytes |
| 83 | */ |
| 84 | /* |
| 85 | * Packet Format for READ_MEMORY & WRITE_MEMORY : |
| 86 | * TotalMsgLen : 4 bytes [value= 20+LEN_PAYLOAD bytes] |
| 87 | * Radio : 4 bytes |
| 88 | * MsgId : 2 bytes |
| 89 | * MsgLen : 2 bytes |
| 90 | * Status : 4 bytes |
| 91 | * Address : 4 bytes |
| 92 | * Length : 4 bytes [LEN_PAYLOAD] |
| 93 | * Payload : LEN_PAYLOAD bytes |
| 94 | */ |
| 95 | int ptt_sock_activate_svc(void); |
| 96 | void ptt_sock_deactivate_svc(void); |
| 97 | int ptt_sock_send_msg_to_app(tAniHdr *wmsg, int radio, int src_mod, int pid); |
| 98 | |
| 99 | /* |
| 100 | * Format of message exchanged between the PTT Socket App in userspace and the |
| 101 | * WLAN Driver, in either direction. Each msg will begin with this header and |
| 102 | * will followed by the Quarky message |
| 103 | */ |
| 104 | typedef struct sAniNlMsg { |
| 105 | struct nlmsghdr nlh; /* Netlink Header */ |
| 106 | int radio; /* unit number of the radio */ |
| 107 | tAniHdr wmsg; /* Airgo Message Header */ |
| 108 | } tAniNlHdr; |
| 109 | typedef struct sAniAppRegReq { |
| 110 | tAniNlModTypes type; /* module id */ |
| 111 | int pid; /* process id */ |
| 112 | } tAniNlAppRegReq; |
| 113 | typedef struct sAniNlAppRegRsp { |
| 114 | tAniHdr wniHdr; /* Generic WNI msg header */ |
| 115 | tAniNlAppRegReq regReq; /* The original request msg */ |
| 116 | int ret; /* Return code */ |
| 117 | } tAniNlAppRegRsp; |
| 118 | #endif |