Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Question about __DIOT macro.: (2 Items)
   
Question about __DIOT macro.  
Hi there,

Could you please explain the role of __DIOT macro ?

I found following explain that following macros should be used to define command for devctl.

http://www.qnx.com/developers/docs/6.3.0SP3/neutrino/lib_ref/d/devctl.html
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Device-control commands
Use these macros to set up the device-control commands: 

__DIOF(class, cmd, data) 
Get information from the device. 
__DION(class, cmd) 
A command with no associated data. 
__DIOT(class, cmd, data) 
Pass information to the device. 
__DIOTF(class, cmd, data) 
Pass some information to the device, and get some from it. 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

But I don't understnad why these macro are necessary.
What if I use just constant value instead of using this macro to define devctl command?

If possible, please let me know where can I get good example which use these macro to implement resource manager

Best Regards,
Dooeui

Re: Question about __DIOT macro.  
On Feb 12, 2008 2:43 AM, Dooeui Hong <dooeui@lge.com> wrote:

> Hi there,
>
> Could you please explain the role of __DIOT macro ?
>
[ Macros and doc reference snipped ]

>
> But I don't understnad why these macro are necessary.


The macros are like any other macros, they don't stop you from doing
something
by hand, but they generally are in place because doing something by hand is
potentially
error prone.

In this case, the client side library that implements devctl() will look at
the bits
in the devctl command to determine if it needs to build up a send, reply or
both
buffers.


> What if I use just constant value instead of using this macro to define
> devctl command?


By constant value, I'm assuming you mean 'some random value'.  Well on most
unix
systems, there is meaning encoded into the devctl command (how big the
structure is etc)
and the same is true on Neutrino ... with other information encoded to
optimize how much
work is done during the message pass.

>
> If possible, please let me know where can I get good example which use
> these macro to implement resource manager
>
If you search the header files, you will find the macro implementations.

If you download the OS source from the Neutrino Operating System project and
you at the
C library (lib/c) you'll find the client implementation of devctl() as well
as the resource manager
framework that does the dispatch of a devctl command.

Hope this helps,
 Thomas