Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Oct 2007 01:31:42 +0530
From:      "GAURAV GUPTA" <emdgaurav@gmail.com>
To:        "Hans Petter Selasky" <hselasky@c2i.net>
Cc:        freebsd-usb@freebsd.org
Subject:   Re: need help
Message-ID:  <dc2adf190710201301r607c9afcv919bfdf3445c9863@mail.gmail.com>
In-Reply-To: <200710201927.51983.hselasky@c2i.net>
References:  <dc2adf190710201022r102643fg1a3d4360ab84bc7d@mail.gmail.com> <200710201927.51983.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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@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
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?dc2adf190710201301r607c9afcv919bfdf3445c9863>