1*8a6b8c3bScgd /* $NetBSD: cfe_api_int.h,v 1.2 2003/02/07 17:38:48 cgd Exp $ */ 249c87f08Scgd /* from: SiByte Id: cfe_api_int.h,v 1.21 2002/07/09 23:29:11 cgd Exp $ */ 349c87f08Scgd 449c87f08Scgd /* 549c87f08Scgd * Copyright 2000, 2001, 2002 649c87f08Scgd * Broadcom Corporation. All rights reserved. 749c87f08Scgd * 849c87f08Scgd * This software is furnished under license and may be used and copied only 949c87f08Scgd * in accordance with the following terms and conditions. Subject to these 1049c87f08Scgd * conditions, you may download, copy, install, use, modify and distribute 1149c87f08Scgd * modified or unmodified copies of this software in source and/or binary 1249c87f08Scgd * form. No title or ownership is transferred hereby. 1349c87f08Scgd * 1449c87f08Scgd * 1) Any source code used, modified or distributed must reproduce and 1549c87f08Scgd * retain this copyright notice and list of conditions as they appear in 1649c87f08Scgd * the source file. 1749c87f08Scgd * 1849c87f08Scgd * 2) No right is granted to use any trade name, trademark, or logo of 1949c87f08Scgd * Broadcom Corporation. The "Broadcom Corporation" name may not be 2049c87f08Scgd * used to endorse or promote products derived from this software 2149c87f08Scgd * without the prior written permission of Broadcom Corporation. 2249c87f08Scgd * 2349c87f08Scgd * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR IMPLIED 2449c87f08Scgd * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF 2549c87f08Scgd * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR 2649c87f08Scgd * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE 2749c87f08Scgd * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE 2849c87f08Scgd * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2949c87f08Scgd * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 3049c87f08Scgd * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 3149c87f08Scgd * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 3249c87f08Scgd * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 3349c87f08Scgd * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3449c87f08Scgd */ 3549c87f08Scgd 3649c87f08Scgd /* ********************************************************************* 3749c87f08Scgd * 3849c87f08Scgd * Broadcom Common Firmware Environment (CFE) 3949c87f08Scgd * 4049c87f08Scgd * Device function prototypes File: cfe_api_int.h 4149c87f08Scgd * 4249c87f08Scgd * This header defines all internal types and macros for the 4349c87f08Scgd * library. This is stuff that's not exported to an app 4449c87f08Scgd * using the library. 4549c87f08Scgd * 4649c87f08Scgd * Authors: Mitch Lichtenberg, Chris Demetriou 4749c87f08Scgd * 4849c87f08Scgd ********************************************************************* */ 4949c87f08Scgd 5049c87f08Scgd #ifndef CFE_API_INT_H 5149c87f08Scgd #define CFE_API_INT_H 5249c87f08Scgd 5349c87f08Scgd /* ********************************************************************* 5449c87f08Scgd * Constants 5549c87f08Scgd ********************************************************************* */ 5649c87f08Scgd 5749c87f08Scgd #define CFE_CMD_FW_GETINFO 0 5849c87f08Scgd #define CFE_CMD_FW_RESTART 1 5949c87f08Scgd #define CFE_CMD_FW_BOOT 2 6049c87f08Scgd #define CFE_CMD_FW_CPUCTL 3 6149c87f08Scgd #define CFE_CMD_FW_GETTIME 4 6249c87f08Scgd #define CFE_CMD_FW_MEMENUM 5 6349c87f08Scgd #define CFE_CMD_FW_FLUSHCACHE 6 6449c87f08Scgd 6549c87f08Scgd #define CFE_CMD_DEV_GETHANDLE 9 6649c87f08Scgd #define CFE_CMD_DEV_ENUM 10 6749c87f08Scgd #define CFE_CMD_DEV_OPEN 11 6849c87f08Scgd #define CFE_CMD_DEV_INPSTAT 12 6949c87f08Scgd #define CFE_CMD_DEV_READ 13 7049c87f08Scgd #define CFE_CMD_DEV_WRITE 14 7149c87f08Scgd #define CFE_CMD_DEV_IOCTL 15 7249c87f08Scgd #define CFE_CMD_DEV_CLOSE 16 7349c87f08Scgd #define CFE_CMD_DEV_GETINFO 17 7449c87f08Scgd 7549c87f08Scgd #define CFE_CMD_ENV_ENUM 20 7649c87f08Scgd #define CFE_CMD_ENV_GET 22 7749c87f08Scgd #define CFE_CMD_ENV_SET 23 7849c87f08Scgd #define CFE_CMD_ENV_DEL 24 7949c87f08Scgd 8049c87f08Scgd #define CFE_CMD_MAX 32 8149c87f08Scgd 8249c87f08Scgd #define CFE_CMD_VENDOR_USE 0x8000 /* codes above this are for customer use */ 8349c87f08Scgd 8449c87f08Scgd /* ********************************************************************* 8549c87f08Scgd * Structures 8649c87f08Scgd ********************************************************************* */ 8749c87f08Scgd 8849c87f08Scgd typedef uint64_t cfe_xuint_t; 8949c87f08Scgd typedef int64_t cfe_xint_t; 9049c87f08Scgd typedef int64_t cfe_xptr_t; 9149c87f08Scgd 9249c87f08Scgd typedef struct xiocb_buffer_s { 9349c87f08Scgd cfe_xuint_t buf_offset; /* offset on device (bytes) */ 9449c87f08Scgd cfe_xptr_t buf_ptr; /* pointer to a buffer */ 9549c87f08Scgd cfe_xuint_t buf_length; /* length of this buffer */ 9649c87f08Scgd cfe_xuint_t buf_retlen; /* returned length (for read ops) */ 9749c87f08Scgd cfe_xuint_t buf_ioctlcmd; /* IOCTL command (used only for IOCTLs) */ 9849c87f08Scgd } xiocb_buffer_t; 9949c87f08Scgd 10049c87f08Scgd #define buf_devflags buf_ioctlcmd /* returned device info flags */ 10149c87f08Scgd 10249c87f08Scgd typedef struct xiocb_inpstat_s { 10349c87f08Scgd cfe_xuint_t inp_status; /* 1 means input available */ 10449c87f08Scgd } xiocb_inpstat_t; 10549c87f08Scgd 10649c87f08Scgd typedef struct xiocb_envbuf_s { 10749c87f08Scgd cfe_xint_t enum_idx; /* 0-based enumeration index */ 10849c87f08Scgd cfe_xptr_t name_ptr; /* name string buffer */ 10949c87f08Scgd cfe_xint_t name_length; /* size of name buffer */ 11049c87f08Scgd cfe_xptr_t val_ptr; /* value string buffer */ 11149c87f08Scgd cfe_xint_t val_length; /* size of value string buffer */ 11249c87f08Scgd } xiocb_envbuf_t; 11349c87f08Scgd 11449c87f08Scgd typedef struct xiocb_cpuctl_s { 11549c87f08Scgd cfe_xuint_t cpu_number; /* cpu number to control */ 11649c87f08Scgd cfe_xuint_t cpu_command; /* command to issue to CPU */ 11749c87f08Scgd cfe_xuint_t start_addr; /* CPU start address */ 11849c87f08Scgd cfe_xuint_t gp_val; /* starting GP value */ 11949c87f08Scgd cfe_xuint_t sp_val; /* starting SP value */ 12049c87f08Scgd cfe_xuint_t a1_val; /* starting A1 value */ 12149c87f08Scgd } xiocb_cpuctl_t; 12249c87f08Scgd 12349c87f08Scgd typedef struct xiocb_time_s { 12449c87f08Scgd cfe_xint_t ticks; /* current time in ticks */ 12549c87f08Scgd } xiocb_time_t; 12649c87f08Scgd 12749c87f08Scgd typedef struct xiocb_exitstat_s { 12849c87f08Scgd cfe_xint_t status; 12949c87f08Scgd } xiocb_exitstat_t; 13049c87f08Scgd 13149c87f08Scgd typedef struct xiocb_meminfo_s { 13249c87f08Scgd cfe_xint_t mi_idx; /* 0-based enumeration index */ 13349c87f08Scgd cfe_xint_t mi_type; /* type of memory block */ 13449c87f08Scgd cfe_xuint_t mi_addr; /* physical start address */ 13549c87f08Scgd cfe_xuint_t mi_size; /* block size */ 13649c87f08Scgd } xiocb_meminfo_t; 13749c87f08Scgd 13849c87f08Scgd typedef struct xiocb_fwinfo_s { 13949c87f08Scgd cfe_xint_t fwi_version; /* major, minor, eco version */ 14049c87f08Scgd cfe_xint_t fwi_totalmem; /* total installed mem */ 14149c87f08Scgd cfe_xint_t fwi_flags; /* various flags */ 14249c87f08Scgd cfe_xint_t fwi_boardid; /* board ID */ 14349c87f08Scgd cfe_xint_t fwi_bootarea_va; /* VA of boot area */ 14449c87f08Scgd cfe_xint_t fwi_bootarea_pa; /* PA of boot area */ 14549c87f08Scgd cfe_xint_t fwi_bootarea_size; /* size of boot area */ 14649c87f08Scgd cfe_xint_t fwi_reserved1; 14749c87f08Scgd cfe_xint_t fwi_reserved2; 14849c87f08Scgd cfe_xint_t fwi_reserved3; 14949c87f08Scgd } xiocb_fwinfo_t; 15049c87f08Scgd 15149c87f08Scgd typedef struct cfe_xiocb_s { 15249c87f08Scgd cfe_xuint_t xiocb_fcode; /* IOCB function code */ 15349c87f08Scgd cfe_xint_t xiocb_status; /* return status */ 15449c87f08Scgd cfe_xint_t xiocb_handle; /* file/device handle */ 15549c87f08Scgd cfe_xuint_t xiocb_flags; /* flags for this IOCB */ 15649c87f08Scgd cfe_xuint_t xiocb_psize; /* size of parameter list */ 15749c87f08Scgd union { 15849c87f08Scgd xiocb_buffer_t xiocb_buffer; /* buffer parameters */ 15949c87f08Scgd xiocb_inpstat_t xiocb_inpstat; /* input status parameters */ 16049c87f08Scgd xiocb_envbuf_t xiocb_envbuf; /* environment function parameters */ 16149c87f08Scgd xiocb_cpuctl_t xiocb_cpuctl; /* CPU control parameters */ 16249c87f08Scgd xiocb_time_t xiocb_time; /* timer parameters */ 16349c87f08Scgd xiocb_meminfo_t xiocb_meminfo; /* memory arena info parameters */ 16449c87f08Scgd xiocb_fwinfo_t xiocb_fwinfo; /* firmware information */ 16549c87f08Scgd xiocb_exitstat_t xiocb_exitstat; /* Exit Status */ 16649c87f08Scgd } plist; 16749c87f08Scgd } cfe_xiocb_t; 16849c87f08Scgd 16949c87f08Scgd #endif /* CFE_API_INT_H */ 170