void vc_vchi_khronos_init()
{
   VCOS_STATUS_T status = vcos_event_create(&bulk_event, NULL);
   assert(status == VCOS_SUCCESS);
   
   if (vchiq_initialise(&khrn_vchiq_instance) != VCHIQ_SUCCESS)
   {
      KHRONOS_CLIENT_LOG("* failed to open vchiq device\n");
      
      exit(1);
   }

   KHRONOS_CLIENT_LOG("gldemo: connecting\n");

   if (vchiq_connect(khrn_vchiq_instance) != VCHIQ_SUCCESS)
   {
      KHRONOS_CLIENT_LOG("* failed to connect\n");
      
      exit(1);
   }

   if (vchiq_open_service(khrn_vchiq_instance, FOURCC_KHAN, khan_callback, NULL, &vchiq_khan_service) != VCHIQ_SUCCESS ||
       vchiq_open_service(khrn_vchiq_instance, FOURCC_KHRN, khrn_callback, NULL, &vchiq_khrn_service) != VCHIQ_SUCCESS ||
       vchiq_open_service(khrn_vchiq_instance, FOURCC_KHHN, khhn_callback, NULL, &vchiq_khhn_service) != VCHIQ_SUCCESS)
   {
      KHRONOS_CLIENT_LOG("* failed to add service - already in use?\n");
      
      exit(1);
   }

   vchiu_queue_init(&khrn_queue, 64);
   vchiu_queue_init(&khhn_queue, 64);

   KHRONOS_CLIENT_LOG("gldemo: connected\n");

   /*
      attach to process (there's just one)
   */

//   bool success = client_process_attach();
//   assert(success);
}
Exemple #2
0
static struct shim_service *service_alloc(VCHIQ_INSTANCE_T instance,
	SERVICE_CREATION_T *setup)
{
	struct shim_service *service = kzalloc(sizeof(struct shim_service), GFP_KERNEL);

	(void)instance;

	if (service) {
		if (vchiu_queue_init(&service->queue, 64)) {
			service->callback = setup->callback;
			service->callback_param = setup->callback_param;
		} else {
			kfree(service);
			service = NULL;
		}
	}

	return service;
}