rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | /***************************************************************************** |
| 2 | * Copyright Statement: |
| 3 | * -------------------- |
| 4 | * This software is protected by Copyright and the information contained |
| 5 | * herein is confidential. The software may not be copied and the information |
| 6 | * contained herein may not be used or disclosed except with the written |
| 7 | * permission of MediaTek Inc. (C) 2016 |
| 8 | * |
| 9 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 10 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS (""MEDIATEK SOFTWARE"") |
| 11 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 12 | * AN ""AS-IS"" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 15 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 16 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 17 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 18 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 19 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 20 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 21 | * |
| 22 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 23 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 24 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 25 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 26 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 27 | * |
| 28 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 29 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 30 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 31 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 32 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 33 | * |
| 34 | *****************************************************************************/ |
| 35 | /************************************************************* |
| 36 | * |
| 37 | * This Software is the property of VIA Telecom, Inc. and may only be used pursuant to a license from VIA Telecom, Inc. |
| 38 | * |
| 39 | * Any unauthorized use inconsistent with the terms of such license is strictly prohibited. |
| 40 | * |
| 41 | * Copyright (c) 2007-2010 VIA Telecom, Inc. All rights reserved. |
| 42 | * |
| 43 | *************************************************************/ |
| 44 | |
| 45 | #ifndef _DSCPDEFS_H_ |
| 46 | #define _DSCPDEFS_H_ |
| 47 | /***************************************************************************** |
| 48 | * |
| 49 | * FILE NAME : dscpdefs.h |
| 50 | * |
| 51 | * DESCRIPTION : |
| 52 | * |
| 53 | * Contains the typdefs for dscp protocol entity. |
| 54 | * |
| 55 | * |
| 56 | *****************************************************************************/ |
| 57 | #include "do_dsaapi.h" |
| 58 | #include "do_rcpapi.h" |
| 59 | #include "do_scpapi.h" |
| 60 | #include "do_slcapi.h" |
| 61 | #include "slc_nvram.h" |
| 62 | |
| 63 | /*------------------------------------------------------------------------ |
| 64 | * global definitons |
| 65 | *------------------------------------------------------------------------*/ |
| 66 | |
| 67 | /************* Default Session Configuration Protocol **********/ |
| 68 | /*-------------OTA messages handled by DSCP-------------------*/ |
| 69 | typedef enum { |
| 70 | DSCP_CONFIGURATION_COMPLETE_OTAMESSAGE = 0x00, |
| 71 | DSCP_CONFIGURATION_START_OTAMESSAGE, |
| 72 | DSCP_SOFT_CONFIGURATION_COMPLETE_OTAMESSAGE, |
| 73 | DSCP_LOCK_CONFIGURATION_OTAMESSAGE, |
| 74 | DSCP_LOCK_CONFIGURATION_ACK_OTAMESSAGE, |
| 75 | DSCP_UNLOCK_CONFIGURATION_OTAMESSAGE, |
| 76 | DSCP_UNLOCK_CONFIGURATION_ACK_OTAMESSAGE, |
| 77 | DSCP_DELETE_PERSONALITY_OTAMESSAGE, |
| 78 | DSCP_DELETE_PERSONALITY_ACK_OTAMESSAGE, |
| 79 | |
| 80 | DSCP_CONFIGURATION_REQUEST_OTAMESSAGE = 0x50, |
| 81 | DSCP_CONFIGURATION_REPONSE_OTAMESSAGE, |
| 82 | |
| 83 | DSCP_ATTRIBUTE_UPDATE_REQUEST_OTAMESSAGE = 0x52, |
| 84 | DSCP_ATTRIBUTE_UPDATE_ACCEPT_OTAMESSAGE, |
| 85 | DSCP_ATTRIBUTE_UPDATE_REJECT_OTAMESSAGE |
| 86 | } |
| 87 | DScpOTAMsgsT; |
| 88 | |
| 89 | /* DSCP SM state */ |
| 90 | typedef enum { |
| 91 | DSCP_INACTIVE, |
| 92 | DSCP_OPEN, |
| 93 | DSCP_AT_INITIATED, |
| 94 | DSCP_AN_INITIATED, |
| 95 | DSCP_NUM_STATE |
| 96 | } DScpStateT; |
| 97 | |
| 98 | /* GAUP AttributeUpdateAccept transmision control */ |
| 99 | typedef enum { |
| 100 | GAUP_DONE, |
| 101 | GAUP_SENDINGACCEPT, /* trans 3 times */ |
| 102 | GAUP_SENDINGACCEPT1, |
| 103 | GAUP_SENDINGACCEPT2 |
| 104 | } DScpGAUPStepT; |
| 105 | |
| 106 | /* OTA message field width */ |
| 107 | #define DSCP_SCC_PERSONALITY_INDEX_STORE_WIDTH 4 |
| 108 | #define DSCP_SCC_CONTINUE_WIDTH 1 |
| 109 | #define DSCP_SCC_COMMIT_WIDTH 1 |
| 110 | #define DSCP_SCC_SC_TOKEN_WIDTH 16 |
| 111 | |
| 112 | #define DSCP_DP_PERSONALITY_COUNT_WIDTH 4 |
| 113 | #define DSCP_DP_PERSONALITY_INDEX_WIDTH 4 |
| 114 | |
| 115 | #define DSCP_CC_SC_TOKEN_WIDTH_IN_OCTET 2 |
| 116 | |
| 117 | #define DSCP_ATTR_REC_LENGTH_WIDTH_IN_OCTET 1 |
| 118 | #define DSCP_ATTR_ID_WIDTH_IN_OCTET 2 |
| 119 | #define DSCP_ATTR_VALUE_ID_WIDTH_IN_OCTET 1 |
| 120 | #define DSCP_SIMPLE_ATTR_VALUE_WIDTH_IN_OCTET 2 |
| 121 | |
| 122 | /*-------------------------------------------------------------*/ |
| 123 | /* DSCP attributes and public data definition: table 7.4.7.1-1 */ |
| 124 | enum { |
| 125 | CONFIG_UNLOCK = 0x00, |
| 126 | CONFIG_LOCK |
| 127 | }; |
| 128 | typedef kal_uint8 DScpConfigurationStatusT; |
| 129 | |
| 130 | enum { |
| 131 | CONNECTION_CLOSED = 0x00, |
| 132 | CONNECTION_OPEN |
| 133 | }; |
| 134 | typedef kal_uint8 DScpConnectionStateT; |
| 135 | |
| 136 | enum { |
| 137 | NO_GAUP_SCTOKEN = 0x00, |
| 138 | SUPPORT_GAUP_SCTOKEN |
| 139 | }; |
| 140 | |
| 141 | enum { |
| 142 | NO_CONFIG_LOCK = 0x00, |
| 143 | SUPPORT_CONFIG_LOCK |
| 144 | }; |
| 145 | |
| 146 | /* 7.4.7.2.1 */ |
| 147 | typedef struct { |
| 148 | kal_uint8 RestorePriorSession; /* 0: not restore the session. Otherwise restore */ |
| 149 | kal_uint8 ANAccepted; |
| 150 | kal_uint16 SessionConfigurationToken; |
| 151 | kal_uint8 Uati[16]; |
| 152 | kal_uint8 SecurityPacketLength; |
| 153 | kal_uint8 SecurityPacket[SECURITY_PACKET_LENGTH]; |
| 154 | }DScpPriorSessionInfoT; |
| 155 | |
| 156 | |
| 157 | #define PROTTYPE_SIZE (NUM_PROTOCOL_TYPE * sizeof(kal_uint16)) |
| 158 | |
| 159 | typedef struct { |
| 160 | /* internal data */ |
| 161 | DScpConnectionStateT ConnectionState; |
| 162 | |
| 163 | /* public data */ |
| 164 | DScpConfigurationStatusT ConfigurationLock; |
| 165 | kal_uint16 SessionConfigurationToken; |
| 166 | kal_uint8 PersonalityIndex; |
| 167 | |
| 168 | /* InUse attributes */ |
| 169 | #if defined(__GNUC__) |
| 170 | ATTRIB_ALIGNED(2) |
| 171 | #endif |
| 172 | DScpAttributesDataT InUseAttrs; |
| 173 | |
| 174 | /* PriorSession */ |
| 175 | DScpPriorSessionInfoT PriorSessionInfo; |
| 176 | |
| 177 | }DScpSessionStateInfoT; |
| 178 | |
| 179 | /*-------------------sample of other SCP protocol--------------------*/ |
| 180 | |
| 181 | /* here define the attributes and public data of other SCP subtype */ |
| 182 | |
| 183 | /* XSCP attributes */ |
| 184 | typedef struct { |
| 185 | kal_uint16 ProtocolType[NUM_PROTOCOL_TYPE]; /* must be first */ |
| 186 | |
| 187 | /* other attributes */ |
| 188 | } XScpAttributesDataT; |
| 189 | |
| 190 | /* sample subtype */ |
| 191 | typedef struct { |
| 192 | /* internal data */ |
| 193 | DScpConnectionStateT ConnectionState; |
| 194 | |
| 195 | /* public data */ |
| 196 | DScpConfigurationStatusT ConfigurationLock; |
| 197 | kal_uint16 SessionConfigurationToken; |
| 198 | kal_uint8 PersonalityIndex; |
| 199 | |
| 200 | /* InUse attributes */ |
| 201 | XScpAttributesDataT InUseAttrs; |
| 202 | |
| 203 | DScpPriorSessionInfoT PriorSessionInfo; |
| 204 | |
| 205 | } XScpSessionStateInfoT; |
| 206 | |
| 207 | |
| 208 | |
| 209 | /*------------------------------------------------------------------------ |
| 210 | * global functions |
| 211 | *------------------------------------------------------------------------*/ |
| 212 | void DScpInit(void); |
| 213 | void DScpReconfigCnfWaitTimerHandler(void); |
| 214 | void DScpANInitStWaitReqTimerHandler(void); |
| 215 | void DScpGaupTimerHandler(void); |
| 216 | void DScpSendOpenConnectionCmd(void); |
| 217 | #if 0 |
| 218 | /* under construction !*/ |
| 219 | #endif |
| 220 | /*------------------------------------------------------------------------ |
| 221 | * global variable |
| 222 | *------------------------------------------------------------------------*/ |
| 223 | extern const SCPConfigInterfaceT DScpConfigInterface; |
| 224 | |
| 225 | |
| 226 | #endif /* _DSCPDEFS_H_ */ |
| 227 | |