1 /******************************************************************************
2  *
3  *  Copyright (C) 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 #define MCA_OP_ERROR_RSP            0x00   /* invalid opcode response */
35 #define MCA_OP_MDL_CREATE_REQ       0x01   /* create an MDL, wait for an associated data channel connection */
36 #define MCA_OP_MDL_CREATE_RSP       0x02   /* response to above request */
37 #define MCA_OP_MDL_RECONNECT_REQ    0x03   /* req to prepare to rvc a data channel conn associated with a prev MDL */
38 #define MCA_OP_MDL_RECONNECT_RSP    0x04   /* response to above request */
39 #define MCA_OP_MDL_ABORT_REQ        0x05   /* stop waiting for a data channel connection */
40 #define MCA_OP_MDL_ABORT_RSP        0x06   /* response to above request */
41 #define MCA_OP_MDL_DELETE_REQ       0x07   /* delete an MDL */
42 #define MCA_OP_MDL_DELETE_RSP       0x08   /* response to above request */
43 #define MCA_NUM_STANDARD_OPCODE     (1+MCA_OP_MDL_DELETE_RSP)
44 
45 /* clock synchronization op codes */
46 #define MCA_OP_SYNC_CAP_REQ         0x11   /* request sync capabilities & requirements */
47 #define MCA_OP_SYNC_CAP_RSP         0x12   /* indicate completion */
48 #define MCA_OP_SYNC_SET_REQ         0x13   /* request to set the time-stamp clock */
49 #define MCA_OP_SYNC_SET_RSP         0x14   /* indicate completion */
50 #define MCA_OP_SYNC_INFO_IND        0x15   /* update of the actual time-stamp clock instant from the sync slave */
51 
52 #define MCA_FIRST_SYNC_OP          MCA_OP_SYNC_CAP_REQ
53 #define MCA_LAST_SYNC_OP           MCA_OP_SYNC_INFO_IND
54 
55 /* response code */
56 #define MCA_RSP_SUCCESS     0x00    /* The corresponding request was received and processed successfully. */
57 #define MCA_RSP_BAD_OPCODE  0x01    /* The Op Code received is not valid (i.e. neither a Standard Op Code nor a Clock Synchronization Protocol Op Code). */
58 #define MCA_RSP_BAD_PARAM   0x02    /* One or more of the values in the received request is invalid. */
59 /* MCA_RSP_BAD_PARAM shall be used when:
60 - The request length is invalid
61 - Some of the parameters have invalid values and none of the other defined Response Codes are more appropriate.
62 */
63 #define MCA_RSP_BAD_MDEP    0x03    /* The MDEP ID referenced does not exist on this device. */
64 #define MCA_RSP_MDEP_BUSY   0x04    /* The requested MDEP currently has as many active MDLs as it can manage simultaneously. */
65 #define MCA_RSP_BAD_MDL     0x05    /* The MDL ID referenced is invalid. */
66 /* MCA_RSP_BAD_MDL shall be used when:
67 - A reserved or invalid value for MDL ID was used.
68 - The MDL ID referenced is not available (was never created, has been deleted, or was otherwise lost),
69 - The MDL ID referenced in the Abort request is not the same value that was used to initiate the PENDING state
70 */
71 #define MCA_RSP_MDL_BUSY    0x06    /* The device is temporarily unable to complete the request. This is intended for reasons not related to the physical sensor (e.g. communication resources unavailable). */
72 #define MCA_RSP_BAD_OP      0x07    /* The received request is invalid in the current state. */
73 /* MCA_RSP_BAD_OP is used when
74 - Abort request was received while not in the PENDING state.
75 - Create, Reconnect, or Delete request was received while in the PENDING state.
76 - A response is received when a request is expected
77 */
78 #define MCA_RSP_NO_RESOURCE 0x08    /* The device is temporarily unable to complete the request. This is intended for reasons relating to the physical sensor (e.g. hardware fault, low battery), or when processing resources are temporarily committed to other processes. */
79 #define MCA_RSP_ERROR       0x09    /* An internal error other than those listed in this table was encountered while processing the request. */
80 #define MCA_RSP_NO_SUPPORT  0x0A    /* The Op Code that was used in this request is not supported. */
81 #define MCA_RSP_CFG_REJ     0x0B    /* A configuration required by a MD_CREATE_MDL or MD_RECONNECT_MDL operation has been rejected. */
82 
83 #define MCA_MAX_MDEP_ID     0x7F    /* the valid range for MDEP ID is 1-0x7F */
84 #define MCA_IS_VALID_MDL_ID(xxx)    (((xxx)>0) && ((xxx)<=0xFEFF))
85 #define MCA_ALL_MDL_ID      0xFFFF
86 
87 #endif /* MCA_DEFS_H */
88