1*c188bc0cScgd /* $NetBSD: cfe_api_int.h,v 1.1 2002/11/09 06:20:40 cgd Exp $ */ 2*c188bc0cScgd /* from: SiByte Id: cfe_api_int.h,v 1.21 2002/07/09 23:29:11 cgd Exp $ */ 3*c188bc0cScgd 4*c188bc0cScgd /* 5*c188bc0cScgd * Copyright 2000, 2001, 2002 6*c188bc0cScgd * Broadcom Corporation. All rights reserved. 7*c188bc0cScgd * 8*c188bc0cScgd * This software is furnished under license and may be used and copied only 9*c188bc0cScgd * in accordance with the following terms and conditions. Subject to these 10*c188bc0cScgd * conditions, you may download, copy, install, use, modify and distribute 11*c188bc0cScgd * modified or unmodified copies of this software in source and/or binary 12*c188bc0cScgd * form. No title or ownership is transferred hereby. 13*c188bc0cScgd * 14*c188bc0cScgd * 1) Any source code used, modified or distributed must reproduce and 15*c188bc0cScgd * retain this copyright notice and list of conditions as they appear in 16*c188bc0cScgd * the source file. 17*c188bc0cScgd * 18*c188bc0cScgd * 2) No right is granted to use any trade name, trademark, or logo of 19*c188bc0cScgd * Broadcom Corporation. The "Broadcom Corporation" name may not be 20*c188bc0cScgd * used to endorse or promote products derived from this software 21*c188bc0cScgd * without the prior written permission of Broadcom Corporation. 22*c188bc0cScgd * 23*c188bc0cScgd * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR IMPLIED 24*c188bc0cScgd * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF 25*c188bc0cScgd * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR 26*c188bc0cScgd * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE 27*c188bc0cScgd * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE 28*c188bc0cScgd * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29*c188bc0cScgd * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30*c188bc0cScgd * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 31*c188bc0cScgd * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 32*c188bc0cScgd * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 33*c188bc0cScgd * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34*c188bc0cScgd */ 35*c188bc0cScgd 36*c188bc0cScgd /* ********************************************************************* 37*c188bc0cScgd * 38*c188bc0cScgd * Broadcom Common Firmware Environment (CFE) 39*c188bc0cScgd * 40*c188bc0cScgd * Device function prototypes File: cfe_api_int.h 41*c188bc0cScgd * 42*c188bc0cScgd * This header defines all internal types and macros for the 43*c188bc0cScgd * library. This is stuff that's not exported to an app 44*c188bc0cScgd * using the library. 45*c188bc0cScgd * 46*c188bc0cScgd * Authors: Mitch Lichtenberg, Chris Demetriou 47*c188bc0cScgd * 48*c188bc0cScgd ********************************************************************* */ 49*c188bc0cScgd 50*c188bc0cScgd #ifndef CFE_API_INT_H 51*c188bc0cScgd #define CFE_API_INT_H 52*c188bc0cScgd 53*c188bc0cScgd /* ********************************************************************* 54*c188bc0cScgd * Constants 55*c188bc0cScgd ********************************************************************* */ 56*c188bc0cScgd 57*c188bc0cScgd #define CFE_CMD_FW_GETINFO 0 58*c188bc0cScgd #define CFE_CMD_FW_RESTART 1 59*c188bc0cScgd #define CFE_CMD_FW_BOOT 2 60*c188bc0cScgd #define CFE_CMD_FW_CPUCTL 3 61*c188bc0cScgd #define CFE_CMD_FW_GETTIME 4 62*c188bc0cScgd #define CFE_CMD_FW_MEMENUM 5 63*c188bc0cScgd #define CFE_CMD_FW_FLUSHCACHE 6 64*c188bc0cScgd 65*c188bc0cScgd #define CFE_CMD_DEV_GETHANDLE 9 66*c188bc0cScgd #define CFE_CMD_DEV_ENUM 10 67*c188bc0cScgd #define CFE_CMD_DEV_OPEN 11 68*c188bc0cScgd #define CFE_CMD_DEV_INPSTAT 12 69*c188bc0cScgd #define CFE_CMD_DEV_READ 13 70*c188bc0cScgd #define CFE_CMD_DEV_WRITE 14 71*c188bc0cScgd #define CFE_CMD_DEV_IOCTL 15 72*c188bc0cScgd #define CFE_CMD_DEV_CLOSE 16 73*c188bc0cScgd #define CFE_CMD_DEV_GETINFO 17 74*c188bc0cScgd 75*c188bc0cScgd #define CFE_CMD_ENV_ENUM 20 76*c188bc0cScgd #define CFE_CMD_ENV_GET 22 77*c188bc0cScgd #define CFE_CMD_ENV_SET 23 78*c188bc0cScgd #define CFE_CMD_ENV_DEL 24 79*c188bc0cScgd 80*c188bc0cScgd #define CFE_CMD_MAX 32 81*c188bc0cScgd 82*c188bc0cScgd #define CFE_CMD_VENDOR_USE 0x8000 /* codes above this are for customer use */ 83*c188bc0cScgd 84*c188bc0cScgd /* ********************************************************************* 85*c188bc0cScgd * Structures 86*c188bc0cScgd ********************************************************************* */ 87*c188bc0cScgd 88*c188bc0cScgd typedef uint64_t cfe_xuint_t; 89*c188bc0cScgd typedef int64_t cfe_xint_t; 90*c188bc0cScgd typedef int64_t cfe_xptr_t; 91*c188bc0cScgd 92*c188bc0cScgd typedef struct xiocb_buffer_s { 93*c188bc0cScgd cfe_xuint_t buf_offset; /* offset on device (bytes) */ 94*c188bc0cScgd cfe_xptr_t buf_ptr; /* pointer to a buffer */ 95*c188bc0cScgd cfe_xuint_t buf_length; /* length of this buffer */ 96*c188bc0cScgd cfe_xuint_t buf_retlen; /* returned length (for read ops) */ 97*c188bc0cScgd cfe_xuint_t buf_ioctlcmd; /* IOCTL command (used only for IOCTLs) */ 98*c188bc0cScgd } xiocb_buffer_t; 99*c188bc0cScgd 100*c188bc0cScgd #define buf_devflags buf_ioctlcmd /* returned device info flags */ 101*c188bc0cScgd 102*c188bc0cScgd typedef struct xiocb_inpstat_s { 103*c188bc0cScgd cfe_xuint_t inp_status; /* 1 means input available */ 104*c188bc0cScgd } xiocb_inpstat_t; 105*c188bc0cScgd 106*c188bc0cScgd typedef struct xiocb_envbuf_s { 107*c188bc0cScgd cfe_xint_t enum_idx; /* 0-based enumeration index */ 108*c188bc0cScgd cfe_xptr_t name_ptr; /* name string buffer */ 109*c188bc0cScgd cfe_xint_t name_length; /* size of name buffer */ 110*c188bc0cScgd cfe_xptr_t val_ptr; /* value string buffer */ 111*c188bc0cScgd cfe_xint_t val_length; /* size of value string buffer */ 112*c188bc0cScgd } xiocb_envbuf_t; 113*c188bc0cScgd 114*c188bc0cScgd typedef struct xiocb_cpuctl_s { 115*c188bc0cScgd cfe_xuint_t cpu_number; /* cpu number to control */ 116*c188bc0cScgd cfe_xuint_t cpu_command; /* command to issue to CPU */ 117*c188bc0cScgd cfe_xuint_t start_addr; /* CPU start address */ 118*c188bc0cScgd cfe_xuint_t gp_val; /* starting GP value */ 119*c188bc0cScgd cfe_xuint_t sp_val; /* starting SP value */ 120*c188bc0cScgd cfe_xuint_t a1_val; /* starting A1 value */ 121*c188bc0cScgd } xiocb_cpuctl_t; 122*c188bc0cScgd 123*c188bc0cScgd typedef struct xiocb_time_s { 124*c188bc0cScgd cfe_xint_t ticks; /* current time in ticks */ 125*c188bc0cScgd } xiocb_time_t; 126*c188bc0cScgd 127*c188bc0cScgd typedef struct xiocb_exitstat_s { 128*c188bc0cScgd cfe_xint_t status; 129*c188bc0cScgd } xiocb_exitstat_t; 130*c188bc0cScgd 131*c188bc0cScgd typedef struct xiocb_meminfo_s { 132*c188bc0cScgd cfe_xint_t mi_idx; /* 0-based enumeration index */ 133*c188bc0cScgd cfe_xint_t mi_type; /* type of memory block */ 134*c188bc0cScgd cfe_xuint_t mi_addr; /* physical start address */ 135*c188bc0cScgd cfe_xuint_t mi_size; /* block size */ 136*c188bc0cScgd } xiocb_meminfo_t; 137*c188bc0cScgd 138*c188bc0cScgd typedef struct xiocb_fwinfo_s { 139*c188bc0cScgd cfe_xint_t fwi_version; /* major, minor, eco version */ 140*c188bc0cScgd cfe_xint_t fwi_totalmem; /* total installed mem */ 141*c188bc0cScgd cfe_xint_t fwi_flags; /* various flags */ 142*c188bc0cScgd cfe_xint_t fwi_boardid; /* board ID */ 143*c188bc0cScgd cfe_xint_t fwi_bootarea_va; /* VA of boot area */ 144*c188bc0cScgd cfe_xint_t fwi_bootarea_pa; /* PA of boot area */ 145*c188bc0cScgd cfe_xint_t fwi_bootarea_size; /* size of boot area */ 146*c188bc0cScgd cfe_xint_t fwi_reserved1; 147*c188bc0cScgd cfe_xint_t fwi_reserved2; 148*c188bc0cScgd cfe_xint_t fwi_reserved3; 149*c188bc0cScgd } xiocb_fwinfo_t; 150*c188bc0cScgd 151*c188bc0cScgd typedef struct cfe_xiocb_s { 152*c188bc0cScgd cfe_xuint_t xiocb_fcode; /* IOCB function code */ 153*c188bc0cScgd cfe_xint_t xiocb_status; /* return status */ 154*c188bc0cScgd cfe_xint_t xiocb_handle; /* file/device handle */ 155*c188bc0cScgd cfe_xuint_t xiocb_flags; /* flags for this IOCB */ 156*c188bc0cScgd cfe_xuint_t xiocb_psize; /* size of parameter list */ 157*c188bc0cScgd union { 158*c188bc0cScgd xiocb_buffer_t xiocb_buffer; /* buffer parameters */ 159*c188bc0cScgd xiocb_inpstat_t xiocb_inpstat; /* input status parameters */ 160*c188bc0cScgd xiocb_envbuf_t xiocb_envbuf; /* environment function parameters */ 161*c188bc0cScgd xiocb_cpuctl_t xiocb_cpuctl; /* CPU control parameters */ 162*c188bc0cScgd xiocb_time_t xiocb_time; /* timer parameters */ 163*c188bc0cScgd xiocb_meminfo_t xiocb_meminfo; /* memory arena info parameters */ 164*c188bc0cScgd xiocb_fwinfo_t xiocb_fwinfo; /* firmware information */ 165*c188bc0cScgd xiocb_exitstat_t xiocb_exitstat; /* Exit Status */ 166*c188bc0cScgd } plist; 167*c188bc0cScgd } cfe_xiocb_t; 168*c188bc0cScgd 169*c188bc0cScgd #endif /* CFE_API_INT_H */ 170