My Project
|
00001 /* 00002 Copyright (c) 2012, Broadcom Europe Ltd 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without 00006 modification, are permitted provided that the following conditions are met: 00007 * Redistributions of source code must retain the above copyright 00008 notice, this list of conditions and the following disclaimer. 00009 * Redistributions in binary form must reproduce the above copyright 00010 notice, this list of conditions and the following disclaimer in the 00011 documentation and/or other materials provided with the distribution. 00012 * Neither the name of the copyright holder nor the 00013 names of its contributors may be used to endorse or promote products 00014 derived from this software without specific prior written permission. 00015 00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00017 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00018 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 00020 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00021 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00022 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00023 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00024 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00025 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 */ 00027 00028 #ifndef MMAL_VC_API_H 00029 #define MMAL_VC_API_H 00030 00037 #include "interface/mmal/mmal_types.h" 00038 #include "interface/mmal/mmal_parameters.h" 00039 #include "interface/mmal/mmal_port.h" 00040 00041 #ifdef __cplusplus 00042 extern "C" { 00043 #endif 00044 00048 typedef enum { 00049 MMAL_STATS_COMP_IDLE, 00050 MMAL_STATS_COMP_CREATED, 00051 MMAL_STATS_COMP_DESTROYING, 00052 MMAL_STATS_COMP_DESTROYED, 00053 MMAL_STATS_COMP_UNUSED = 0xffffffff /* force 32bit */ 00054 } MMAL_STATS_COMP_STATE_T; 00055 00058 struct MMAL_VC_COMP_STATS_T { 00059 struct MMAL_DRIVER_COMPONENT_T *comp; 00060 MMAL_STATS_COMP_STATE_T state; 00061 uint32_t pid; 00062 uint32_t pool_mem_alloc_size; 00063 char name[20]; 00064 }; 00065 00068 struct MMAL_VC_STATS_T 00069 { 00070 struct 00071 { 00072 uint32_t rx; 00073 uint32_t rx_zero_copy; 00074 uint32_t rx_empty; 00075 uint32_t rx_fails; 00076 uint32_t tx; 00077 uint32_t tx_zero_copy; 00078 uint32_t tx_empty; 00079 uint32_t tx_fails; 00080 uint32_t tx_short_msg; 00081 uint32_t rx_short_msg; 00082 } buffers; 00083 struct service 00084 { 00085 uint32_t created; 00086 uint32_t pending_destroy; 00087 uint32_t destroyed; 00088 uint32_t failures; 00089 } service; 00090 struct commands 00091 { 00092 uint32_t bad_messages; 00093 uint32_t executed; 00094 uint32_t failed; 00095 uint32_t replies; 00096 uint32_t reply_fails; 00097 } commands; 00098 struct 00099 { 00100 uint32_t tx; 00101 uint32_t tx_fails; 00102 } events; 00103 struct 00104 { 00105 uint32_t created; 00106 uint32_t destroyed; 00107 uint32_t destroying; 00108 uint32_t failed; 00109 uint32_t list_size; 00110 struct MMAL_VC_COMP_STATS_T component_list[8]; 00111 } components; 00112 struct 00113 { 00114 uint32_t enqueued_messages; 00115 uint32_t dequeued_messages; 00116 uint32_t max_parameter_set_delay; 00117 uint32_t max_messages_waiting; 00118 } worker; 00119 00120 }; 00121 typedef struct MMAL_VC_STATS_T MMAL_VC_STATS_T; 00122 00123 /* Simple circular text buffer used to store 'interesting' data 00124 * from MMAL clients. e.g. settings for each picture taken */ 00125 struct MMAL_VC_HOST_LOG_T 00126 { 00128 char buffer[16 << 10]; 00130 uint32_t magic; 00132 int32_t offset; 00134 unsigned count; 00135 }; 00136 typedef struct MMAL_VC_HOST_LOG_T MMAL_VC_HOST_LOG_T; 00137 00140 typedef enum 00141 { 00142 MMAL_STATS_FOUND, 00143 MMAL_STATS_COMPONENT_NOT_FOUND, 00144 MMAL_STATS_PORT_NOT_FOUND, 00145 MMAL_STATS_INVALID = 0x7fffffff 00146 } MMAL_STATS_RESULT_T; 00147 00148 MMAL_STATUS_T mmal_vc_init(void); 00149 void mmal_vc_deinit(void); 00150 00151 MMAL_STATUS_T mmal_vc_use(void); 00152 MMAL_STATUS_T mmal_vc_release(void); 00153 00154 MMAL_STATUS_T mmal_vc_get_version(uint32_t *major, uint32_t *minor, uint32_t *minimum); 00155 MMAL_STATUS_T mmal_vc_get_stats(MMAL_VC_STATS_T *stats, int reset); 00156 00168 MMAL_STATUS_T mmal_vc_get_core_stats(MMAL_CORE_STATISTICS_T *stats, 00169 MMAL_STATS_RESULT_T *result, 00170 char *name, 00171 size_t namelen, 00172 MMAL_PORT_TYPE_T type, 00173 unsigned component, 00174 unsigned port, 00175 MMAL_CORE_STATS_DIR dir, 00176 MMAL_BOOL_T reset); 00187 MMAL_STATUS_T mmal_vc_host_log(const char *msg); 00188 00189 /* For backwards compatibility in builds */ 00190 #define MMAL_VC_API_HAVE_HOST_LOG 00191 00192 /* VC DEBUG ONLY ************************************************************/ 00209 MMAL_STATUS_T mmal_vc_consume_mem(size_t size, uint32_t *handle); 00210 00214 MMAL_STATUS_T mmal_vc_lmk(uint32_t alloc_size); 00215 00216 #ifdef __cplusplus 00217 } 00218 #endif 00219 #endif