Beispiel #1
0
/** Flush a port */
static MMAL_STATUS_T mmal_vc_port_flush(MMAL_PORT_T *port)
{
   static MMAL_PORT_FLUSH_CHECK_T is_port_flush_compatible = PORT_FLUSH_NOT_INITIALIZED;
   uint32_t major = 0, minor = 0, minimum = 0;
   MMAL_STATUS_T status;
   /* Buffers sent to videocore, if not zero-copy, use vchiq bulk transfers to copy the data.
      A flush could be sent while one of these buffers is being copied. If the normal flushing method
      is used, the flush can arrive before the buffer, which causes confusion when a pre-flush buffer
      arrives after the flush. So use a special flush mode that uses a dummy vchiq transfer to synchronise
      things.
      If data has never been sent on the port, then we don't need to worry about a flush overtaking data.
      In that case, the port may not actually be set up on the other end to receive bulk transfers, so use
      the normal flushing mechanism in that case.
    */

   if (port->priv->module->is_zero_copy || !port->priv->module->sent_data_on_port)
      return mmal_vc_port_flush_normal(port);

   if (is_port_flush_compatible == PORT_FLUSH_NOT_INITIALIZED)
   {
      status = mmal_vc_get_version(&major, &minor, &minimum);
      if (major >= 15)
      {
         is_port_flush_compatible = PORT_FLUSH_COMPATIBLE;
      }
      else
      {
         LOG_ERROR("Version number of MMAL Server incompatible. Required Major:14 Minor: 2 \
          or Greater. Current Major %d , Minor %d",major,minor);
         is_port_flush_compatible = PORT_FLUSH_INCOMPATIBLE;
      }
   }
Beispiel #2
0
static int do_version(int argc, const char **argv)
{
   uint32_t maj = UINT_MAX, min = UINT_MAX, minimum;
   MMAL_STATUS_T st = mmal_vc_get_version(&maj, &min, &minimum);
   (void)argc; (void)argv;
   if (st == MMAL_SUCCESS)
   {
      printf("version %d.%02d (min %d)\n", maj, min, minimum);
      return 0;
   }
   else
   {
      fprintf(stderr, "error getting version (%i:%s)\n", st, mmal_status_to_string(st));
      return -1;
   }
}