Home | History | Annotate | Download | only in include
      1 /******************************************************************************
      2  *
      3  *  Copyright 2009-2012 Broadcom Corporation
      4  *
      5  *  Licensed under the Apache License, Version 2.0 (the "License");
      6  *  you may not use this file except in compliance with the License.
      7  *  You may obtain a copy of the License at:
      8  *
      9  *  http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  *  Unless required by applicable law or agreed to in writing, software
     12  *  distributed under the License is distributed on an "AS IS" BASIS,
     13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  *  See the License for the specific language governing permissions and
     15  *  limitations under the License.
     16  *
     17  ******************************************************************************/
     18 
     19 /******************************************************************************
     20  *
     21  *  This contains constants definitions and other information from the MCAP
     22  *  specification.
     23  *
     24  ******************************************************************************/
     25 #ifndef MCA_DEFS_H
     26 #define MCA_DEFS_H
     27 
     28 /*****************************************************************************
     29  * constants
     30  ****************************************************************************/
     31 #define MCA_MIN_MTU 48
     32 
     33 /* standard op codes */
     34 /* invalid opcode response */
     35 #define MCA_OP_ERROR_RSP 0x00
     36 /* create an MDL, wait for an associated data channel connection */
     37 #define MCA_OP_MDL_CREATE_REQ 0x01
     38 /* response to above request */
     39 #define MCA_OP_MDL_CREATE_RSP 0x02
     40 /* req to prepare to rvc a data channel conn associated with a prev MDL */
     41 #define MCA_OP_MDL_RECONNECT_REQ 0x03
     42 /* response to above request */
     43 #define MCA_OP_MDL_RECONNECT_RSP 0x04
     44 /* stop waiting for a data channel connection */
     45 #define MCA_OP_MDL_ABORT_REQ 0x05
     46 /* response to above request */
     47 #define MCA_OP_MDL_ABORT_RSP 0x06
     48 /* delete an MDL */
     49 #define MCA_OP_MDL_DELETE_REQ 0x07
     50 /* response to above request */
     51 #define MCA_OP_MDL_DELETE_RSP 0x08
     52 #define MCA_NUM_STANDARD_OPCODE (1 + MCA_OP_MDL_DELETE_RSP)
     53 
     54 /* clock synchronization op codes */
     55 /* request sync capabilities & requirements */
     56 #define MCA_OP_SYNC_CAP_REQ 0x11
     57 /* indicate completion */
     58 #define MCA_OP_SYNC_CAP_RSP 0x12
     59 /* request to set the time-stamp clock */
     60 #define MCA_OP_SYNC_SET_REQ 0x13
     61 /* indicate completion */
     62 #define MCA_OP_SYNC_SET_RSP 0x14
     63 /* update of the actual time-stamp clock instant from the sync slave */
     64 #define MCA_OP_SYNC_INFO_IND 0x15
     65 
     66 #define MCA_FIRST_SYNC_OP MCA_OP_SYNC_CAP_REQ
     67 #define MCA_LAST_SYNC_OP MCA_OP_SYNC_INFO_IND
     68 
     69 /* response code */
     70 /* The corresponding request was received and processed successfully. */
     71 #define MCA_RSP_SUCCESS 0x00
     72 /* The Op Code received is not valid (i.e. neither a Standard Op Code nor a
     73  * Clock Synchronization Protocol Op Code). */
     74 #define MCA_RSP_BAD_OPCODE 0x01
     75 /* One or more of the values in the received request is invalid. */
     76 #define MCA_RSP_BAD_PARAM 0x02
     77 /* MCA_RSP_BAD_PARAM shall be used when:
     78 - The request length is invalid
     79 - Some of the parameters have invalid values and none of the other defined
     80 Response Codes are more appropriate.
     81 */
     82 /* The MDEP ID referenced does not exist on this device. */
     83 #define MCA_RSP_BAD_MDEP 0x03
     84 /* The requested MDEP currently has as many active MDLs as it can manage
     85  * simultaneously. */
     86 #define MCA_RSP_MDEP_BUSY 0x04
     87 /* The MDL ID referenced is invalid. */
     88 #define MCA_RSP_BAD_MDL 0x05
     89 /* MCA_RSP_BAD_MDL shall be used when:
     90 - A reserved or invalid value for MDL ID was used.
     91 - The MDL ID referenced is not available (was never created, has been deleted,
     92 or was otherwise lost),
     93 - The MDL ID referenced in the Abort request is not the same value that was used
     94 to initiate the PENDING state
     95 */
     96 /* The device is temporarily unable to complete the request. This is intended
     97  * for reasons not related to the physical sensor (e.g. communication resources
     98  * unavailable). */
     99 #define MCA_RSP_MDL_BUSY 0x06
    100 /* The received request is invalid in the current state. */
    101 #define MCA_RSP_BAD_OP 0x07
    102 /* MCA_RSP_BAD_OP is used when
    103 - Abort request was received while not in the PENDING state.
    104 - Create, Reconnect, or Delete request was received while in the PENDING state.
    105 - A response is received when a request is expected
    106 */
    107 /* The device is temporarily unable to complete the request. This is intended
    108  * for reasons relating to the physical sensor (e.g. hardware fault, low
    109  * battery), or when processing resources are temporarily committed to other
    110  * processes. */
    111 #define MCA_RSP_NO_RESOURCE 0x08
    112 /* An internal error other than those listed in this table was encountered while
    113  * processing the request. */
    114 #define MCA_RSP_ERROR 0x09
    115 /* The Op Code that was used in this request is not supported. */
    116 #define MCA_RSP_NO_SUPPORT 0x0A
    117 /* A configuration required by a MD_CREATE_MDL or MD_RECONNECT_MDL operation has
    118  * been rejected. */
    119 #define MCA_RSP_CFG_REJ 0x0B
    120 
    121 /* the valid range for MDEP ID is 1-0x7F */
    122 #define MCA_MAX_MDEP_ID 0x7F
    123 #define MCA_IS_VALID_MDL_ID(xxx) (((xxx) > 0) && ((xxx) <= 0xFEFF))
    124 #define MCA_ALL_MDL_ID 0xFFFF
    125 
    126 #endif /* MCA_DEFS_H */
    127