Forum Topic - Writing a network driver: Page 2 of 2 (41 Items)
   
Re: Writing a network driver  
And the previous qcc line was for a self hosted environment.
Try this:

qcc -shared -Wl,-Bsymbolic -o devnp-sample.so -I $QNX_TARGET/usr/include/io-pkt/ -D_KERNEL sam.c

-seanb


On Thu, Feb 23, 2012 at 10:39:43AM -0500, Sean Boudreau wrote:
> 
> Unfortunately, I don't know what tar file you were given.
> Attached is your missing prodroot_pkt.mk.  Not sure if you'll
> see other issues.
> 
> Regards,
> 
> -seanb
> 
> On Thu, Feb 23, 2012 at 10:30:58AM -0500, Greg Ludewig wrote:
> > If I unzip the tar file and then do a 'make' I get the following error:
> > 
> > C:\QNXDriver\sample>make
> > make -j 1 -Carm -fMakefile
> > make[1]: Entering directory 'C:/QNXDriver/sample/arm'
> > make -j 1 -Cdll.le -fMakefile
> > make[2]: Entering directory 'C:/QNXDriver/sample/arm/dll.le' 
> > ../../common.mk:18: C:/QNXDriver/prodroot_pkt.mk: No such file or directory
> > make[2]: *** No rule to make target 'C:/QNXDriver/prodroot_pkt.mk'. Stop.
> > make[2]: Leaving directory 'C:/QNXDriver/sample/arm/dll.le'
> > make[1]: *** [all] Error 2
> > make[1]: Leaving directory 'C:/QNXDriver/sample/arm'
> > make *** [all] Error 2
> > 
> > If I call qcc directly using the command line you suggest, I get lots of errors in system include files, which is 
the same thing I get if I try to build in the IDE with _KERNEL defined.
> > 
> > Like I said, if I copy all of the defines I need from the system headers into a separate file, I can get it to 
compile without defining _KERNEL. Do you know if there are other things that don't get included if I don't define 
_KERNEL that will result in the driver not working?
> > 
> > Unfortunately, there is no NetBSD based driver for the radio module we're using that I can start my port from.
> > 
> > Thanks again.
> > 
> > Greg
> > 
> > 
> > 
> > _______________________________________________
> > 
> > Networking Drivers
> > http://community.qnx.com/sf/go/post91734
> > 

> 
> # We link the stack with -E so a lot of the undefined
> # references get resolved from the stack itself.  If
> # you want them listed at link time, turn off
> # --allow-shlib-undefined and replace with --warn-once
> # if desired.
> 
> #LDFLAGS+=-Wl,--warn-once
> LDFLAGS+=-Wl,--allow-shlib-undefined
> 
> 
> HDR_PATH=$(INSTALL_ROOT_HDR)/io-pkt
> PUBLIC_HDR_PATH=$(QNX_TARGET)/usr/include/io-pkt
> 
> # Check for staging area first
> EXTRA_INCVPATH+= $(HDR_PATH) $(HDR_PATH)/sys-nto
> # Use headers installed in system if staging area not available
> EXTRA_INCVPATH+= $(PUBLIC_HDR_PATH) $(PUBLIC_HDR_PATH)/sys-nto
> CCFLAGS += -D_KERNEL
> 
> # gcc sometime after 2.95.3 added a builtin log()
> CCFLAGS += -fno-builtin-log
Re: Writing a network driver  
Sorry, that link was for an io-net driver. Please ignore.

-- 
Hugh Brown
QNX Software Systems Limited
1001 Farrar Rd.,
Ottawa. ON. K2K 0B3.
Telephone: 613-591-0931







On 12-02-23 10:30 AM, "Greg Ludewig" <community-noreply@qnx.com> wrote:

>If I unzip the tar file and then do a 'make' I get the following error:
>
>C:\QNXDriver\sample>make
>make -j 1 -Carm -fMakefile
>make[1]: Entering directory 'C:/QNXDriver/sample/arm'
>make -j 1 -Cdll.le -fMakefile
>make[2]: Entering directory 'C:/QNXDriver/sample/arm/dll.le'
>../../common.mk:18: C:/QNXDriver/prodroot_pkt.mk: No such file or
>directory
>make[2]: *** No rule to make target 'C:/QNXDriver/prodroot_pkt.mk'. Stop.
>make[2]: Leaving directory 'C:/QNXDriver/sample/arm/dll.le'
>make[1]: *** [all] Error 2
>make[1]: Leaving directory 'C:/QNXDriver/sample/arm'
>make *** [all] Error 2
>
>If I call qcc directly using the command line you suggest, I get lots of
>errors in system include files, which is the same thing I get if I try to
>build in the IDE with _KERNEL defined.
>
>Like I said, if I copy all of the defines I need from the system headers
>into a separate file, I can get it to compile without defining _KERNEL.
>Do you know if there are other things that don't get included if I don't
>define _KERNEL that will result in the driver not working?
>
>Unfortunately, there is no NetBSD based driver for the radio module we're
>using that I can start my port from.
>
>Thanks again.
>
>Greg
>
>
>
>_______________________________________________
>
>Networking Drivers
>http://community.qnx.com/sf/go/post91734
>
Re: Writing a network driver  
I really want to thank both you guys for all the help here! I'm sure I wouldn't have been able to figure this out 
without you.

The .tar file I got came from the link in post #2 of this thread. The prodroot_pkt.mk file must have been the only thing
 I was missing, because once I add that to my folder, it all builds correctly!

I have just one more thing that I don't understand. I asked about this once already, but I still don't get it. In sam.c,
 the define of the sam_syms structure has the following #ifdef around it:

#ifdef VARIANT_a
#include <nw_dl.h>
/* This is what gets specified in the stack's dl.c */
struct nw_dll_syms sam_syms[] = {
        {"iopkt_drvr_entry", &IOPKT_DRVR_ENTRY_SYM(sam)},
        {NULL, NULL}
};
#endif

 Now, I've attached the output from the make command for the arm/dll.le subdirectory. If I look at the qcc call, I can 
see that _KERNEL is defined, as well as VARIANT_dll and VARIANT_le, but that VARIANT_a is not defined.

Doesn't this mean that the sam_syms structure is not included? And if that's the case, how does the io-pkt stack know to
 execute the sam_entry() function? The documentation you provided on writing native network drivers for io-pkt says this
 structure is necessary.

Thanks once more for putting up with all my 'newbie' questions on this.

Greg
Attachment: Text make.out 1.45 KB
Re: Writing a network driver  
The VARIANT_a is only use if you want to build a library file that is
statically linked with io-pkt. If you create an arm/a.le directory, the
VARIANT_a will be created and can be statically linked with the stack.
This is only used for debugging purposes.


-- 
Hugh Brown
QNX Software Systems Limited
1001 Farrar Rd.,
Ottawa. ON. K2K 0B3.
Telephone: 613-591-0931







On 12-02-23 3:20 PM, "Greg Ludewig" <community-noreply@qnx.com> wrote:

>I really want to thank both you guys for all the help here! I'm sure I
>wouldn't have been able to figure this out without you.
>
>The .tar file I got came from the link in post #2 of this thread. The
>prodroot_pkt.mk file must have been the only thing I was missing, because
>once I add that to my folder, it all builds correctly!
>
>I have just one more thing that I don't understand. I asked about this
>once already, but I still don't get it. In sam.c, the define of the
>sam_syms structure has the following #ifdef around it:
>
>#ifdef VARIANT_a
>#include <nw_dl.h>
>/* This is what gets specified in the stack's dl.c */
>struct nw_dll_syms sam_syms[] = {
>        {"iopkt_drvr_entry", &IOPKT_DRVR_ENTRY_SYM(sam)},
>        {NULL, NULL}
>};
>#endif
>
> Now, I've attached the output from the make command for the arm/dll.le
>subdirectory. If I look at the qcc call, I can see that _KERNEL is
>defined, as well as VARIANT_dll and VARIANT_le, but that VARIANT_a is not
>defined.
>
>Doesn't this mean that the sam_syms structure is not included? And if
>that's the case, how does the io-pkt stack know to execute the
>sam_entry() function? The documentation you provided on writing native
>network drivers for io-pkt says this structure is necessary.
>
>Thanks once more for putting up with all my 'newbie' questions on this.
>
>Greg
>
>
>
>
>_______________________________________________
>
>Networking Drivers
>http://community.qnx.com/sf/go/post91752
Re: Writing a network driver  
OK, so does that mean if I don't make this a static library, I don't need a sam_sysm structure? If that's the case, how 
does the io-pkt stack find out about the entry point for my driver?

Greg
Re: Writing a network driver  
Hello Greg,

I'm sorry if I'm impolite to get in the middle of your support, but I would also like to develop a driver for a RedPine 
Wifi module.

I hope I'm not being impolite too if I ask you to help me get through all this, I guess I'm more a newbie than you !

Is it possible that you give me a quick tour on how to develop a driver for Qnx, the steps and source code necessary.

Best regards,

Paul
Re: Writing a network driver  
How about the _iopkt_drvr_entry structure for your entry point? Yes, I
guess you can leave out the static entry if you don't need it.

-- 
Hugh Brown
QNX Software Systems Limited
1001 Farrar Rd.,
Ottawa. ON. K2K 0B3.
Telephone: 613-591-0931







On 12-02-23 4:13 PM, "Greg Ludewig" <community-noreply@qnx.com> wrote:

>OK, so does that mean if I don't make this a static library, I don't need
>a sam_sysm structure? If that's the case, how does the io-pkt stack find
>out about the entry point for my driver?
>
>Greg
>
>
>
>_______________________________________________
>
>Networking Drivers
>http://community.qnx.com/sf/go/post91754
>
Re: Writing a network driver  
In the dynamic (non static) case, io-pkt does a dlopen() on
your driver then a dlsym() on the following symbol:

# nm ./devnp-sample.so | grep iopkt_drvr_entry
00002320 D iopkt_drvr_entry

It then gets the entry point from that.

-seanb

On Thu, Feb 23, 2012 at 04:13:23PM -0500, Greg Ludewig wrote:
> OK, so does that mean if I don't make this a static library, I don't need a sam_sysm structure? If that's the case, 
how does the io-pkt stack find out about the entry point for my driver?
> 
> Greg
> 
> 
> 
> _______________________________________________
> 
> Networking Drivers
> http://community.qnx.com/sf/go/post91754
> 
Re: Writing a network driver  
Hugh and Sean,

Thanks, I think I understand now.

Paul,

I'd be happy to try to work thru this task together. I'm not sure I know what I'm doing any more than you do. I was kind
 of hoping you'd gotten further than me, and I could ask you for help!

Anyway, it might be easier if we communicated outside the forum. That way we don't have to bother Hugh and Sean anymore 
than necessary. My email address is gludewig@minnetronix.com if you want to send me an email.

Greg
Re: Writing a network driver  
So, I have another question about the driver entry point. In the sample driver, the sam_entry() function has 3 arguments
, a pointer to dll_hdl, a pointer to an io_pkt structure, and a pointer to an options string. Is there some explanation 
of what these arguments are for? Only the dll_hdl argument is actually referenced in the sample code. I assume the 
options argument is how command line arguments are passed to the driver, but I don't know what the format of the options
 argument is. And I have no idea what the iopkt argument is for.

Is there another document somewhere that would explain some of these questions?

Thanks!

Greg
Re: Writing a network driver  
I'm not aware of any document that describes these parameters, so I have
attached the source to our speedo driver that you can refer to.

-- 
Hugh Brown
QNX Software Systems Limited
1001 Farrar Rd.,
Ottawa. ON. K2K 0B3.
Telephone: 613-591-0931







On 12-02-27 12:29 PM, "Greg Ludewig" <community-noreply@qnx.com> wrote:

>So, I have another question about the driver entry point. In the sample
>driver, the sam_entry() function has 3 arguments, a pointer to dll_hdl, a
>pointer to an io_pkt structure, and a pointer to an options string. Is
>there some explanation of what these arguments are for? Only the dll_hdl
>argument is actually referenced in the sample code. I assume the options
>argument is how command line arguments are passed to the driver, but I
>don't know what the format of the options argument is. And I have no idea
>what the iopkt argument is for.
>
>Is there another document somewhere that would explain some of these
>questions?
>
>Thanks!
>
>Greg
>
>
>
>_______________________________________________
>
>Networking Drivers
>http://community.qnx.com/sf/go/post91814
>

Attachment: Text speedo.src.tar.gz 23.62 KB
Re: Writing a network driver  
Hugh,

thanks for the source to the speedo driver, it helps a lot. Would be possible to get the source for one of the wireless 
io-pkt drivers? That might help me understand better how to use some of the ieee80211 data structures and interfaces.

Thanks!

Greg
Re: Writing a network driver  
Greg,

All of the wireless drivers are covered by NDA agreements, so I cannot
give you any source. You might want to see if there are any FreeBSD
wireless driver sources available.

Hugh.

-- 
Hugh Brown
QNX Software Systems Limited
1001 Farrar Rd.,
Ottawa. ON. K2K 0B3.
Telephone: 613-591-0931







On 12-03-06 9:36 AM, "Greg Ludewig" <community-noreply@qnx.com> wrote:

>Hugh,
>
>thanks for the source to the speedo driver, it helps a lot. Would be
>possible to get the source for one of the wireless io-pkt drivers? That
>might help me understand better how to use some of the ieee80211 data
>structures and interfaces.
>
>Thanks!
>
>Greg
>
>
>
>_______________________________________________
>
>Networking Drivers
>http://community.qnx.com/sf/go/post91917
>
Re: Writing a network driver  
I second the request of a sample wifi driver.

I got the sample code, the speedo driver and on the other side, a linux driver for the RedPine module.... but now 
putting the pieces together is quite tricky...
Re: Writing a network driver  
I have a couple more basic questions:

1) Is there any documentation anywhere on using the dev_attach(), if_attach(), and ieee80211_ifattach() functions? 
Something that explains what the purpose of the functions are and what each of the arguments do?
2) Are there any restrictions on threading in an io-pkt driver? Can my driver be multi-threaded?

Thanks!

Greg
Re: Writing a network driver  
Is the QNX networking source code the best place to go for answers to these questions? The ieee80211com structure in the
 QNX net80211/ieee80211_var.h header file doesn't match the NetBSD and FreeBSD versions I can find on line. In 
particular, most of the fields related to VAPs don't exist in the QNX version of the structure. Does the QNX networking 
stack not include VAPs? The documentation I can find online for the ieee80211_ifattach() function spends alot of time 
talking about VAPs and how they're used.