1 //<MStar Software> 2 //****************************************************************************** 3 // MStar Software 4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved. 5 // All software, firmware and related documentation herein ("MStar Software") are 6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by 7 // law, including, but not limited to, copyright law and international treaties. 8 // Any use, modification, reproduction, retransmission, or republication of all 9 // or part of MStar Software is expressly prohibited, unless prior written 10 // permission has been granted by MStar. 11 // 12 // By accessing, browsing and/or using MStar Software, you acknowledge that you 13 // have read, understood, and agree, to be bound by below terms ("Terms") and to 14 // comply with all applicable laws and regulations: 15 // 16 // 1. MStar shall retain any and all right, ownership and interest to MStar 17 // Software and any modification/derivatives thereof. 18 // No right, ownership, or interest to MStar Software and any 19 // modification/derivatives thereof is transferred to you under Terms. 20 // 21 // 2. You understand that MStar Software might include, incorporate or be 22 // supplied together with third party`s software and the use of MStar 23 // Software may require additional licenses from third parties. 24 // Therefore, you hereby agree it is your sole responsibility to separately 25 // obtain any and all third party right and license necessary for your use of 26 // such third party`s software. 27 // 28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as 29 // MStar`s confidential information and you agree to keep MStar`s 30 // confidential information in strictest confidence and not disclose to any 31 // third party. 32 // 33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any 34 // kind. Any warranties are hereby expressly disclaimed by MStar, including 35 // without limitation, any warranties of merchantability, non-infringement of 36 // intellectual property rights, fitness for a particular purpose, error free 37 // and in conformity with any international standard. You agree to waive any 38 // claim against MStar for any loss, damage, cost or expense that you may 39 // incur related to your use of MStar Software. 40 // In no event shall MStar be liable for any direct, indirect, incidental or 41 // consequential damages, including without limitation, lost of profit or 42 // revenues, lost or damage of data, and unauthorized system use. 43 // You agree that this Section 4 shall still apply without being affected 44 // even if MStar Software has been modified by MStar in accordance with your 45 // request or instruction for your use, except otherwise agreed by both 46 // parties in writing. 47 // 48 // 5. If requested, MStar may from time to time provide technical supports or 49 // services in relation with MStar Software to you for your use of 50 // MStar Software in conjunction with your or your customer`s product 51 // ("Services"). 52 // You understand and agree that, except otherwise agreed by both parties in 53 // writing, Services are provided on an "AS IS" basis and the warranty 54 // disclaimer set forth in Section 4 above shall apply. 55 // 56 // 6. Nothing contained herein shall be construed as by implication, estoppels 57 // or otherwise: 58 // (a) conferring any license or right to use MStar name, trademark, service 59 // mark, symbol or any other identification; 60 // (b) obligating MStar or any of its affiliates to furnish any person, 61 // including without limitation, you and your customers, any assistance 62 // of any kind whatsoever, or any information; or 63 // (c) conferring any license or right under any intellectual property right. 64 // 65 // 7. These terms shall be governed by and construed in accordance with the laws 66 // of Taiwan, R.O.C., excluding its conflict of law rules. 67 // Any and all dispute arising out hereof or related hereto shall be finally 68 // settled by arbitration referred to the Chinese Arbitration Association, 69 // Taipei in accordance with the ROC Arbitration Law and the Arbitration 70 // Rules of the Association by three (3) arbitrators appointed in accordance 71 // with the said Rules. 72 // The place of arbitration shall be in Taipei, Taiwan and the language shall 73 // be English. 74 // The arbitration award shall be final and binding to both parties. 75 // 76 //****************************************************************************** 77 //<MStar Software> 78 #if defined (MSOS_TYPE_LINUX) 79 #ifndef _FRHSL_DATALINK_ 80 #define _FRHSL_DATALINK_ 81 82 #include "MsTypes.h" 83 84 //--------------------------------------------------- 85 // Message's Body 86 //--------------------------------------------------- 87 // MS_U8 | MS_U8 | MS_U32 | MS_U32 | 88 // --------------------------------- 89 // GetCardStatusReq 90 // 0x01 | SN | 91 // GetCardStatusResp 92 // 0x02 | SN |used |total | 93 // GetDataReq 94 // 0x03 | SN |req.size| 95 // GetDataResp 96 // 0x04 | SN |size | DATA (size) bytes ... 97 // SendCommandReq 98 // 0x05 | SN |snd.size| DATA (size) bytes ... 99 // SendCommandResp 100 // 0x06 | SN |err.code| 101 // SendFilterArrayReq 102 // 0x07 | SN |snd.size| Byte array from Genie 103 // SendFilterArrayResp 104 // 0x08 | SN |(MS_U8)[0|1]| 105 106 #define LINK_PROTOCOL_VERSION 0x02 107 108 #define LINK_BUFFER_SIZE (32) 109 #define LINK_MAX_COMMAND (sizeof(ST_HSL_CMD_REQ)) 110 // connection timeout [s]. 111 #define LINK_CONNECTION_TIMEOUT (15) 112 113 #define LINK_HEADER_SIZE 2 114 #define LINK_DATA_GET_CARD_STATUS 0 115 #define LINK_DATA_RESPONSE_CARD_STATUS 8 116 #define LINK_DATA_GET_HSL_DATA 4 117 #define LINK_DATA_RESPONSE_HSL_DATA 4 118 #define LINK_DATA_SEND_HSL_CMD 4 119 #define LINK_DATA_RESPONSE_HSL_CMD 4 120 121 typedef enum EnLinkCommandTag 122 { 123 EN_LINK_CMD_NONE = 0x00, 124 EN_LINK_CMD_GET_CARD_STATUS = 0x01, 125 EN_LINK_CMD_RESP_CARD_STATUS = 0x02, 126 EN_LINK_CMD_GET_HSL_DATA = 0x03, 127 EN_LINK_CMD_RESP_HSL_DATA = 0x04, 128 EN_LINK_CMD_SEND_HSL_CMD = 0x05, 129 EN_LINK_CMD_RESP_HSL_CMD = 0x06, 130 EN_LINK_CMD_SND_FILTER_MX = 0x07, 131 EN_LINK_CMD_RSP_FILTER_MX = 0x08 132 } EN_LINK_CMD; 133 134 /* ===================================== */ 135 /* COMMAND LAYER */ 136 137 typedef enum EnCmdErrorCodeTag 138 { 139 EN_CMD_EC_OK = 0, 140 EN_CMD_EC_VERSION, 141 EN_CMD_EC_DATA_SIZE, 142 EN_CMD_EC_AT_FAILURE, 143 EN_CMD_EC_THREAD_FAIL, 144 EN_CMD_EC_CMD_UNKNOWN, 145 EN_CMD_EC_LAST 146 } EN_CMD_ERROR_CODE; 147 148 typedef enum EnCommandIdTag 149 { 150 EN_CMD_TEST_NONE = 0x00, 151 EN_CMD_TEST_AT = 0x01, 152 EN_CMD_TEST_LOAD = 0x02, 153 EN_CMD_TEST_CMD_LAST 154 } EN_COMMAND_ID; 155 156 typedef enum EnResponseIdTag 157 { 158 EN_RESP_TEST_AT = 0, 159 EN_RESP_TEST_AT_ECHO = 1, 160 EN_RESP_TEST_CMD_LAST 161 } EN_RESPONSE_ID; 162 163 #define CMD_MAX_AT (128) 164 #define RSP_MAX_AT (1024) 165 #define CMD_MAX_FILTER (10000) //maximum single use local variable 166 #define HSL_MAX_LOG_POINT_SIZE (20*1000) // Maximum size of GKI signal that can be handled by Genie. 167 #define HSL_MAX_SILO_ARRAY_SIZE (HSL_MAX_LOG_POINT_SIZE - 4) // The -4 accounts for length field of HslLogPointRawData (with 2 bytes padding) 168 169 typedef struct StHslSelftestCmd 170 { 171 MS_U32 mRunTime; 172 MS_U32 mThreadDelay; 173 MS_U16 mThreadNo; 174 MS_U16 mCntSimpleLP; 175 MS_U16 mCntPrintf1p; 176 MS_U16 mParamPrintf1p; 177 MS_U16 mCntArray16; 178 MS_U16 mParamArray16Size; 179 MS_U16 mCntArray32; 180 MS_U16 mParamArray32Size; 181 MS_U16 mCntTypedef; 182 } ST_HSL_SELFTEST_CMD; 183 184 typedef struct StTestStruct 185 { 186 MS_U32 a; 187 MS_U32 b; 188 MS_U32 c; 189 } ST_TEST_STRUCT; 190 191 typedef union U_HslCmdReqTag 192 { 193 char atCmd[CMD_MAX_AT]; /**< \assoc STRING */ 194 ST_HSL_SELFTEST_CMD loadTestCmd; 195 } U_HslCmdReq; 196 197 typedef struct ST_HSL_CMD_REQTag 198 { 199 MS_U8 ver; 200 /** \assoc UNION \ref U_Cmd */ 201 EN_COMMAND_ID cmdId; 202 U_HslCmdReq U_Cmd; 203 } ST_HSL_CMD_REQ; 204 205 206 #define HSL_CMD_RESP_LOG_POINT_ID (0x000A) /* Hard coded log point id to containt the ST_HSL_CMD_RESP structure */ 207 208 209 typedef char AtCommandEchoString[CMD_MAX_AT]; 210 typedef struct AtCmdEchoTag 211 { 212 MS_BOOL result; 213 AtCommandEchoString atCmd; /**< \assoc STRING */ 214 } AtCmdEcho; 215 216 typedef char AtCommandRespString[RSP_MAX_AT]; 217 typedef union U_HslCmdRespTag 218 { 219 AtCommandRespString atResponse; /**< \assoc STRING */ 220 AtCmdEcho atCmdEcho; 221 } U_HslCmdResp; 222 223 /** Please update the function PackIntoHslCmdResp() when adding new members before U_Resp union.*/ 224 typedef struct ST_HSL_CMD_RESPTag 225 { 226 /** \assoc UNION \ref U_Resp */ 227 EN_RESPONSE_ID respId; 228 U_HslCmdResp U_Resp; 229 } ST_HSL_CMD_RESP; 230 231 232 /** This type is used to wrap around every array HSL log point. 233 This is not used for logged typedef arrays which use a different HSL macro. */ 234 typedef struct HslArrayLogPointTag 235 { 236 MS_U8 rawData[HSL_MAX_SILO_ARRAY_SIZE]; 237 }HslArrayLogPoint; 238 239 /** This type is used to wrap around every printf HSL log point to present 240 them as serialised SILO GKI signals. */ 241 typedef struct HslLogPointRawDataTag 242 { 243 /** \assoc VAR_ARRAY \ref rawData */ 244 MS_U16 length; 245 MS_U8 rawData[HSL_MAX_SILO_ARRAY_SIZE]; 246 }HslLogPointRawData; 247 248 /** This type is used on PC to interpret those Log points coming via log 249 point ID 0x9 which is effectively a wrapper for string info. */ 250 typedef struct HslMessageLogPointTag 251 { 252 char message[RSP_MAX_AT]; /**< \assoc STRING */ 253 }HslMessageLogPoint; 254 255 256 void PackAtRespIntoHslCmdResp(const char* a_atResp); 257 void PackIntoHslCmdResp(EN_RESPONSE_ID a_respId, const void* a_body); 258 259 #endif 260 #endif 261