need help

GAURAV GUPTA emdgaurav at gmail.com
Sun Oct 21 08:07:31 PDT 2007


Hi Petter,
Thanks for replying.
i am not able to understand  ATTATCH function call usb_task itself .
 how internally this function work in stack and why we need it.
I have seen function definition below in USB stack .

     *struct* usb_task {
     TAILQ_ENTRY <http://opengrok.creo.hu/openbsd/s?defs=TAILQ_ENTRY>(
usb_task<http://opengrok.creo.hu/openbsd/xref/src/sys/dev/usb/usbdi.h#usb_task>)
next ;
     *void* (*fun)(*void* *);
     *void* * arg;
     *char* onqueue;
     };
     *void* usb_add_task<http://opengrok.creo.hu/openbsd/s?defs=usb_add_task>
( usbd_device_handle<http://opengrok.creo.hu/openbsd/xref/src/sys/dev/usb/usbdi.h#usbd_device_handle>
dev <http://opengrok.creo.hu/openbsd/s?defs=dev>, *struct*
usb_task<http://opengrok.creo.hu/openbsd/xref/src/sys/dev/usb/usbdi.h#usb_task>*task<http://opengrok.creo.hu/openbsd/s?defs=task>
);
     *void* usb_rem_task<http://opengrok.creo.hu/openbsd/s?defs=usb_rem_task>
( usbd_device_handle<http://opengrok.creo.hu/openbsd/xref/src/sys/dev/usb/usbdi.h#usbd_device_handle>
dev <http://opengrok.creo.hu/openbsd/s?defs=dev>, *struct*
usb_task<http://opengrok.creo.hu/openbsd/xref/src/sys/dev/usb/usbdi.h#usb_task>*task<http://opengrok.creo.hu/openbsd/s?defs=task>
);
     #*define* usb_init_task(t, f, a) ((t)->
fun<http://opengrok.creo.hu/openbsd/xref/src/sys/dev/usb/usbdi.h#fun>=
(f), (t)->
arg <http://opengrok.creo.hu/openbsd/xref/src/sys/dev/usb/usbdi.h#arg> =
(a), (t)->onqueue
<http://opengrok.creo.hu/openbsd/xref/src/sys/dev/usb/usbdi.h#onqueue>= 0)

I am looking in code of driver if_axe.c (Dlink lan to usb )
not able to understand function call

*usb_init_task(&sc->axe_tick_task, axe_tick_task, sc);*

I understand this question look very basic or silly ,but i am really looking
for your  input .. we are in college and
just started to understand to BSD .

Thanks,

Gaurav

On 10/20/07, Hans Petter Selasky <hselasky at c2i.net> wrote:
>
> On Saturday 20 October 2007, GAURAV GUPTA wrote:
> > Hi all,
> >
> > Can anyone explain me the functionality of this standard function.
> > I am beginner in this BSD area,so cudn'n get the details clear.
> >
> > #define usb_init_task(t, f, a) ((t)->fun = (f), (t)->arg = (a),
> > (t)->onqueue = 0)
> >
>
> The macro initialises a task structure.
>
> --HPS
>


More information about the freebsd-usb mailing list