Exemplo n.º 1
0
/* OMX_Init */
OMX_ERRORTYPE OMX_APIENTRY OMX_Init(void)
{
   VCOS_STATUS_T status;
   OMX_ERRORTYPE err = OMX_ErrorNone;

   status = vcos_once(&once, initOnce);
   vcos_demand(status == VCOS_SUCCESS);

   vcos_mutex_lock(&lock);

   if(coreInit == 0)
   {
      // we need to connect via an ILCS connection to VideoCore
      VCHI_INSTANCE_T initialise_instance;
      VCHI_CONNECTION_T *connection;
      ILCS_CONFIG_T config;

      vc_host_get_vchi_state(&initialise_instance, &connection);

      vcilcs_config(&config);

      ilcs_service = ilcs_init((VCHIQ_INSTANCE_T) initialise_instance, (void **) &connection, &config, 0);

      if(ilcs_service == NULL)
      {
         err = OMX_ErrorHardware;
         goto end;
      }

      coreInit = 1;
   }
   else
      coreInit++;

end:
   vcos_mutex_unlock(&lock);
   return err;
}
Exemplo n.º 2
0
int main(int argc, char **argv)
{
   VCHIQ_INSTANCE_T vchiq_instance;
   VCHI_INSTANCE_T initialise_instance;
   VCHI_CONNECTION_T *connection;

   int success = -1;
   ILCS_CONFIG_T config;
   char response[ 128 ];

   printf("vcos_init\n");
   vcos_init();

   if (vchiq_initialise(&vchiq_instance) != VCHIQ_SUCCESS)
   {
      printf("* failed to open vchiq instance\n");
      return -1;
   }

   // initialise the OS abstraction layer
   os_init();

   // initialise the mphi driver

   // mphi_get_func_table()->init();

   // initialise the vchi layer

   printf("vchi_initialise\n");
   success = vchi_initialise( &initialise_instance);
   assert(success == 0);
   vchiq_instance = (VCHIQ_INSTANCE_T)initialise_instance;

   connection = vchi_create_connection(single_get_func_table(),
                                       vchi_mphi_message_driver_func_table());

   printf("vchi_connect\n");
   vchi_connect(&connection, 1, initialise_instance);

   vc_vchi_gencmd_init(initialise_instance, &connection, 1);
   vc_vchi_filesys_init(initialise_instance, &connection, 1);

   if ( success == 0 )
   {
      success = vc_gencmd( response, sizeof(response), "set_vll_dir /sd/vlls" );
      vcos_assert( success == 0 );
   }

   printf("vcilcs_config\n");
   vcilcs_config(&config);
   
   printf("ilcs_init\n");
   il_service_global = ilcs_init(vchiq_instance, &config, 0, host_OMX_SetILCSState);

   printf("do_stripes\n");
   do_stripes_default();

   printf("do_blocks_test\n");
   do_blocks_test();

   printf("do_playback_api_test\n");
   do_playback_api_test();

   return 0;
}