cfe_api_int.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*
  2. * Copyright (C) 2000, 2001, 2002 Broadcom Corporation
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. */
  18. /* *********************************************************************
  19. *
  20. * Broadcom Common Firmware Environment (CFE)
  21. *
  22. * Device function prototypes File: cfe_api_int.h
  23. *
  24. * This header defines all internal types and macros for the
  25. * library. This is stuff that's not exported to an app
  26. * using the library.
  27. *
  28. * Authors: Mitch Lichtenberg, Chris Demetriou
  29. *
  30. ********************************************************************* */
  31. #ifndef CFE_API_INT_H
  32. #define CFE_API_INT_H
  33. /* *********************************************************************
  34. * Constants
  35. ********************************************************************* */
  36. #define CFE_CMD_FW_GETINFO 0
  37. #define CFE_CMD_FW_RESTART 1
  38. #define CFE_CMD_FW_BOOT 2
  39. #define CFE_CMD_FW_CPUCTL 3
  40. #define CFE_CMD_FW_GETTIME 4
  41. #define CFE_CMD_FW_MEMENUM 5
  42. #define CFE_CMD_FW_FLUSHCACHE 6
  43. #define CFE_CMD_DEV_GETHANDLE 9
  44. #define CFE_CMD_DEV_ENUM 10
  45. #define CFE_CMD_DEV_OPEN 11
  46. #define CFE_CMD_DEV_INPSTAT 12
  47. #define CFE_CMD_DEV_READ 13
  48. #define CFE_CMD_DEV_WRITE 14
  49. #define CFE_CMD_DEV_IOCTL 15
  50. #define CFE_CMD_DEV_CLOSE 16
  51. #define CFE_CMD_DEV_GETINFO 17
  52. #define CFE_CMD_ENV_ENUM 20
  53. #define CFE_CMD_ENV_GET 22
  54. #define CFE_CMD_ENV_SET 23
  55. #define CFE_CMD_ENV_DEL 24
  56. #define CFE_CMD_MAX 32
  57. #define CFE_CMD_VENDOR_USE 0x8000 /* codes above this are for customer use */
  58. /* *********************************************************************
  59. * Structures
  60. ********************************************************************* */
  61. typedef uint64_t cfe_xuint_t;
  62. typedef int64_t cfe_xint_t;
  63. typedef int64_t cfe_xptr_t;
  64. typedef struct xiocb_buffer_s {
  65. cfe_xuint_t buf_offset; /* offset on device (bytes) */
  66. cfe_xptr_t buf_ptr; /* pointer to a buffer */
  67. cfe_xuint_t buf_length; /* length of this buffer */
  68. cfe_xuint_t buf_retlen; /* returned length (for read ops) */
  69. cfe_xuint_t buf_ioctlcmd; /* IOCTL command (used only for IOCTLs) */
  70. } xiocb_buffer_t;
  71. #define buf_devflags buf_ioctlcmd /* returned device info flags */
  72. typedef struct xiocb_inpstat_s {
  73. cfe_xuint_t inp_status; /* 1 means input available */
  74. } xiocb_inpstat_t;
  75. typedef struct xiocb_envbuf_s {
  76. cfe_xint_t enum_idx; /* 0-based enumeration index */
  77. cfe_xptr_t name_ptr; /* name string buffer */
  78. cfe_xint_t name_length; /* size of name buffer */
  79. cfe_xptr_t val_ptr; /* value string buffer */
  80. cfe_xint_t val_length; /* size of value string buffer */
  81. } xiocb_envbuf_t;
  82. typedef struct xiocb_cpuctl_s {
  83. cfe_xuint_t cpu_number; /* cpu number to control */
  84. cfe_xuint_t cpu_command; /* command to issue to CPU */
  85. cfe_xuint_t start_addr; /* CPU start address */
  86. cfe_xuint_t gp_val; /* starting GP value */
  87. cfe_xuint_t sp_val; /* starting SP value */
  88. cfe_xuint_t a1_val; /* starting A1 value */
  89. } xiocb_cpuctl_t;
  90. typedef struct xiocb_time_s {
  91. cfe_xint_t ticks; /* current time in ticks */
  92. } xiocb_time_t;
  93. typedef struct xiocb_exitstat_s {
  94. cfe_xint_t status;
  95. } xiocb_exitstat_t;
  96. typedef struct xiocb_meminfo_s {
  97. cfe_xint_t mi_idx; /* 0-based enumeration index */
  98. cfe_xint_t mi_type; /* type of memory block */
  99. cfe_xuint_t mi_addr; /* physical start address */
  100. cfe_xuint_t mi_size; /* block size */
  101. } xiocb_meminfo_t;
  102. typedef struct xiocb_fwinfo_s {
  103. cfe_xint_t fwi_version; /* major, minor, eco version */
  104. cfe_xint_t fwi_totalmem; /* total installed mem */
  105. cfe_xint_t fwi_flags; /* various flags */
  106. cfe_xint_t fwi_boardid; /* board ID */
  107. cfe_xint_t fwi_bootarea_va; /* VA of boot area */
  108. cfe_xint_t fwi_bootarea_pa; /* PA of boot area */
  109. cfe_xint_t fwi_bootarea_size; /* size of boot area */
  110. cfe_xint_t fwi_reserved1;
  111. cfe_xint_t fwi_reserved2;
  112. cfe_xint_t fwi_reserved3;
  113. } xiocb_fwinfo_t;
  114. typedef struct cfe_xiocb_s {
  115. cfe_xuint_t xiocb_fcode; /* IOCB function code */
  116. cfe_xint_t xiocb_status; /* return status */
  117. cfe_xint_t xiocb_handle; /* file/device handle */
  118. cfe_xuint_t xiocb_flags; /* flags for this IOCB */
  119. cfe_xuint_t xiocb_psize; /* size of parameter list */
  120. union {
  121. xiocb_buffer_t xiocb_buffer; /* buffer parameters */
  122. xiocb_inpstat_t xiocb_inpstat; /* input status parameters */
  123. xiocb_envbuf_t xiocb_envbuf; /* environment function parameters */
  124. xiocb_cpuctl_t xiocb_cpuctl; /* CPU control parameters */
  125. xiocb_time_t xiocb_time; /* timer parameters */
  126. xiocb_meminfo_t xiocb_meminfo; /* memory arena info parameters */
  127. xiocb_fwinfo_t xiocb_fwinfo; /* firmware information */
  128. xiocb_exitstat_t xiocb_exitstat; /* Exit Status */
  129. } plist;
  130. } cfe_xiocb_t;
  131. #endif /* CFE_API_INT_H */