Hi all ,
I am new to QNX driver programming. my problem is like this. I have to implement a devctl call in resource manager, that will send a command ( basically a GPS command) to GPS card and block over it. after GPS card ( Compact PCI ) receives the data it will send an interrupt to driver .ISR in turn will sned a pulse after to a pulse handler and pulsehandler will unblock the devctl.
blocking unblocking is happening perfectly in driver but i am unable to send data from driver to application. part of code is posted below .
Thanks in advance.
– rs
devctl_function
…
rxdata= _DEVCTL_DATA(msg->i);
switch(msg->i.dcmd){
case GPS_COMMAND:
{
DBG("GPS_COMMAND");
cmd =(gps_command_t*)&rxdata->cmd;
/* Check if valid Command */
ref=gps_lookup_cmd(cmd);
if(ref == NULL){
DBG("Invalid command :%s",cmd->cmd);
return EINVAL;
}
/* Get Semaphore */
sem_wait(&(dp->i_info.cmd_sem));
dp->i_info.ref=ref;
if(gps_write_command(dp,cmd) == GPS_FAILURE){
sem_post(&(dp->i_info.cmd_sem));
return EINVAL;
}
/* Save Receve ID */
dp->i_info.saved_rcvid=ctp->rcvid;
/* Block here */
return(_RESMGR_NOREPLY);
}
int pulse_handler(message_context_t *ctp, int code,
unsigned flags, void *handle)
{
int mnum;
DeviceData_t *dp;
union sigval value = ctp->msg->pulse.value;
mnum = value.sival_int;
dp = Gps_Device[mnum].Data;
DBG(" Pulse caught from ISR of %X", mnum);
if( NULL == dp)
return 0;
sem_post(&dp->i_info.cmd_sem);
MsgReply(dp->i_info.saved_rcvid,0,&(dp->i_info.cmd),sizeof(dp->i_info.cmd));
#if 0
if( IOFUNC_NOTIFY_INPUT_CHECK( dp->notify, 1, 0) ){
/* If atleast one condition armed on this device for input data,
* trigger resmgr for client notification */
iofunc_notify_trigger(dp->notify, 1, IOFUNC_NOTIFY_INPUT);
}
#endif
return SUCCESS;