[U-Boot] About the volatile data type in include/net.h

Simon Glass sjg at chromium.org
Wed Nov 23 20:21:20 CET 2011


Hi Macpaul,

On Mon, Nov 21, 2011 at 7:06 PM, Macpaul Lin <macpaul at gmail.com> wrote:
> HI all,
>
> I have found there are some variables declared as volatile in include/net.h.
> Some of them are used as in send and receive functions.
> Since some of them seems won't be update by hardware, like sending functions.
> Should we check and clean them up?

I think so, since any access should go through read()l/writel() anyway.

Regards,
Simon

>
> For example, the send function in eth_device has a volatile type
> points to buffer.
>
> struct eth_device {
>        char name[NAMESIZE];
>        unsigned char enetaddr[6];
>        int iobase;
>        int state;
>
>        int  (*init) (struct eth_device*, bd_t*);
>        int  (*send) (struct eth_device*, volatile void* packet, int length);
>        int  (*recv) (struct eth_device*);
>        void (*halt) (struct eth_device*);
> #ifdef CONFIG_MCAST_TFTP
>        int (*mcast) (struct eth_device*, u32 ip, u8 set);
> #endif
>        int  (*write_hwaddr) (struct eth_device*);
>        struct eth_device *next;
>        void *priv;
> };
>
> --
> Best regards,
> Macpaul Lin
>


More information about the U-Boot mailing list