Beispiel #1
0
/***********************************************************
 * Name: dispmanx_get_handle
 *
 * Arguments: command, parameter buffer, parameter legnth
 *
 * Description: same as dispmanx_send_command but returns uint instead
 *
 * Returns: handle
 *
 ***********************************************************/
static uint32_t dispmanx_get_handle(  uint32_t command, void *buffer, uint32_t length) {
   VCHI_MSG_VECTOR_T vector[] = { {&command, sizeof(command)},
                                   {buffer, length} };
   uint32_t success = 0;
   uint32_t response = 0;
   lock_obtain();
   success += vchi_msg_queuev( dispmanx_client.client_handle[0],
                               vector, sizeof(vector)/sizeof(vector[0]),
                               VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL );
   if(success == 0)
      success = dispmanx_wait_for_reply(&response, sizeof(response));

   lock_release();
   return VC_VTOH32(response);
}
/**
 * <DFN>vc_hdcp2_service_send_command</DFN> sends a command which has no reply to Videocore
 * side HDCP2 service.
 *
 * @param client_handle is the vchi client handle
 *
 * @param sema is the locking semaphore to protect the buffer
 * 
 * @param command is the command (VC_HDCP2_CMD_CODE_T in vc_hdcp2service_defs.h)
 *
 * @param buffer is the command buffer to be sent
 *
 * @param length is the size of buffer in bytes
 *
 * @return zero if successful, VCHI error code if failed
 */
int32_t vc_hdcp2_service_send_command(VCHI_SERVICE_HANDLE_T client_handle,
                                      VCOS_SEMAPHORE_T *sema,
                                      uint32_t command, void *buffer, uint32_t length) {
   VCHI_MSG_VECTOR_T vector[] = { {&command, sizeof(command)},
                                  {buffer, length} };
   VCOS_STATUS_T status;
   int32_t success = 0;
   vcos_assert(sema);
   status = vcos_semaphore_wait(sema);
   vcos_assert(status == VCOS_SUCCESS);
   success = vchi_msg_queuev( client_handle, vector, sizeof(vector)/sizeof(vector[0]),
                              VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL );
   status = vcos_semaphore_post(sema);
   vcos_assert(status == VCOS_SUCCESS);
   return success;
}
Beispiel #3
0
static int32_t dispmanx_send_command_reply(  uint32_t command, void *buffer, uint32_t length,
                                            void *response, uint32_t max_length) {
   VCHI_MSG_VECTOR_T vector[] = { {&command, sizeof(command)},
                                   {buffer, length} };

   int32_t success = 0;
   lock_obtain();
   success = vchi_msg_queuev( dispmanx_client.client_handle[0],
                               vector, sizeof(vector)/sizeof(vector[0]),
                               VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL );
   if(success == 0)
      success = dispmanx_wait_for_reply(response, max_length);

   lock_release();

   return success;
}
Beispiel #4
0
static int32_t dispmanx_send_command(  uint32_t command, void *buffer, uint32_t length) {
   VCHI_MSG_VECTOR_T vector[] = { {&command, sizeof(command)},
                                  {buffer, length} };
   int32_t success = 0, response = -1;
   lock_obtain();
   success = vchi_msg_queuev( dispmanx_client.client_handle[0],
                              vector, sizeof(vector)/sizeof(vector[0]),
                              VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL );
   if(success == 0 && !(command & DISPMANX_NO_REPLY_MASK)) {
      //otherwise only wait for a reply if we ask for one
      success = dispmanx_wait_for_reply(&response, sizeof(response));
   } else {
      //Not waiting for a reply, send the success code back instead
      response = success;
   }
   lock_release();
   return VC_VTOH32(response);
}
Beispiel #5
0
/* ----------------------------------------------------------------------
 * helper function to transmit an ilcs command/response + payload
 * -------------------------------------------------------------------- */
static void
vc_ilcs_transmit( uint32_t cmd, uint32_t xid, unsigned char *msg, int len, unsigned char *msg2, int len2 )
{
   // could do this in 3 vectors, but hey
   VCHI_MSG_VECTOR_T vec[4];
   int32_t result;
   
   vec[0].vec_base = &cmd;
   vec[0].vec_len  = sizeof(cmd);
   vec[1].vec_base = &xid;
   vec[1].vec_len  = sizeof(xid);
   vec[2].vec_base = msg;
   vec[2].vec_len  = len;
   vec[3].vec_base = msg2;
   vec[3].vec_len  = len2;

   result = vchi_msg_queuev( vc_ilcsg.vchi_handle, vec, 4, VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL );     // call to VCHI
   vc_assert(result == 0);
}
//Send replies/commands across to VMCS
static int32_t hostreq_send_command(uint32_t command, void *buffer, uint32_t length) {
   int success = 0, i;
   VCHI_MSG_VECTOR_T vector[] = { {&command, sizeof(command)},
                                  {buffer, length} };

   assert(hostreq_client.initialised);
   lock_obtain();
   for( i=0; i<hostreq_client.num_connections; i++ ) {
      success = vchi_msg_queuev(hostreq_client.client_handle[i],
                                vector,
                                sizeof(vector)/sizeof(vector[0]),
                                VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL);
      assert(!success);
      if(success != 0)
         break;
   }
   lock_release();
   return success;

}
static int32_t cecservice_send_command(  uint32_t command, const void *buffer, uint32_t length, uint32_t has_reply) {
   VCHI_MSG_VECTOR_T vector[] = { {&command, sizeof(command)},
                                  {buffer, length} };
   int32_t success = 0;
   int32_t response;
   lock_obtain();
   success = vchi_msg_queuev(cecservice_client.client_handle[0],
                             vector, sizeof(vector)/sizeof(vector[0]),
                             VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL );
   vcos_assert( success == 0 );
   if(success == 0 && has_reply) {
      //otherwise only wait for a reply if we ask for one
      success = cecservice_wait_for_reply(&response, sizeof(response));
      response = VC_VTOH32(response);
   } else {
      //No reply expected or failed to send, send the success code back instead
      response = success;
   }
   vcos_assert(success == 0);
   lock_release();
   return response;
}