Skip navigation.
Home
The QNX Community Portal

View topic - devctl()

devctl()

For discussion of realtime and/or embedded programming.

devctl()

Postby djidji » Mon Jul 25, 2016 12:39 pm

Hi,

I want to understand how devctl() works, in the developer support of QNX they don't precise how we can use for example __DIOTF(class, cmd, data), we have a different class, but what about cmd, I saw in an example that he use different numbers but I don't know what those numbers represent.
djidji
Active Member
 
Posts: 22
Joined: Tue Jun 28, 2016 1:17 pm

Re: devctl()

Postby denkelly » Mon Jul 25, 2016 2:39 pm

The command and the data_in and/or data_out, are private between you and your driver. The o/s only creates and sends a devctl message with your command and data. All the data you send "in" will be part of the message.

That said, you should pick an appropriate class and create your dcmd_xxx.h from a standard model i.e. usr/include/sys/dcmd_chr.h
denkelly
Senior Member
 
Posts: 161
Joined: Sat Aug 02, 2008 3:27 pm

Re: devctl()

Postby djidji » Tue Jul 26, 2016 2:10 pm

for example :
#define __DIOTF(class, cmd, data) ((sizeof(data)<<16) + ((class)<<8) + (cmd) + _POSIX_DEVDIR_TOFROM)

the class _DCMD_MISC correspond to a number
#define _DCMD_MISC 0x05

and same thing for cmd it's a number.

how I can create my dcmd_xxx and how devctl will interpret it ?
djidji
Active Member
 
Posts: 22
Joined: Tue Jun 28, 2016 1:17 pm

Re: devctl()

Postby Tim » Wed Jul 27, 2016 1:27 pm

Does this help

http://www.qnx.com/developers/docs/660/ ... evctl.html

http://www.qnx.com/developers/docs/660/ ... EVCTL.html

devctl is just a communication layer between your driver & your other program (like a phone is a communication layer between 2 people). It doesn't know/care about what numbers you use (or language 2 people speak over a phone). Your driver & other program are what has to know what those numbers mean.

Tim
Tim
Senior Member
 
Posts: 1390
Joined: Wed Mar 10, 2004 12:28 am


Return to Realtime and Embedded

Who is online

Users browsing this forum: No registered users and 1 guest

cron