This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: What functions should I call in ethernet drv ?


ariga masahiro wrote:
> Hello Gary and others,
> 
> Gary,
> thanks for your help, I think I came close to the root of the trouble.(I
> hope)
> 
> I discovered(to the truth,I dicovered previously) received data upsidedown.
> Please refer to 809-line in last-sent output log
> 
> 8C05ECEC: FF FF FF FF FF FF 15 00  6D C5 F0 23 06 08       
> |........m..#.. |
> 
> Whereas host sends.
> 0000  ff ff ff ff ff ff 00 15  c5 6d 23 f0 08 06 00 01   ........ .m#.....
> 0010  08 00 06 04 00 01 00 15  c5 6d 23 f0 ac 10 01 1c   ........ .m#.....
> 0020  00 00 00 00 00 00 ac 10  01 1c                     ........ ..
> 
> ARP command should be 08 06.
> 
> (I am very sorry if it deliberately display them in little endian form.)
> 
> I thought I could amend this and I amended(I thought) like next in
> \packages\devs\eth\smsc\lan91cxx\current\src\if_lan91cxx.c.
> (I risk of appearing stupid but I henestly tell what I did.)
> cyg_uint8 get_data_byte(struct eth_drv_sc *sc)
> {
>    //20070919
>    int sf;
> 
>    cyg_uint8 c;
>    struct lan91cxx_priv_data *cpd =
>        (struct lan91cxx_priv_data *)sc->driver_private;
> 
> //    //20070919
> //    db_printf("cpd->data_pos=%d rxd_t=%d\n",cpd->data_pos,sizeof(rxd_t));
> 
>    if( cpd->data_pos == sizeof(rxd_t) )
>    {
>        cpd->data_buf = get_data(sc);
>        cpd->data_pos = 0;
>        //20070919
>        sf = 1;
>    }
>    //20070919 begin
>    else{
>        sf = 0;
>  }
>    //20070919 end
> 
>    //20070919 begin
> //ORG    c = (cpd->data_buf>>(cpd->data_pos*8))&0xFF;
>    c = (cpd->data_buf>>(sf*8))&0xFF;
> 
> //    //20070919
> //    db_printf("cpd->data_buf=%x c=%x\n",cpd->data_buf,c);
> 
>    cpd->data_pos++;
> 
>    return c;
> 
> }
> 
> After that I ran and stored output log(I send gzip file).
> To my astonishment,I found RxEvent errored.
> Please refer to 795-line.
> RxEvent - bad rx: stat: 0x7f40, len: 0x41fa
> 
> Apparantly I wrongly concocted.
> I am still tracing source but I haven't found smart answer.
> Even if I thought I could have corrected it myself,
> I worries that my bad coding affects anywhere else.
> 
> Please teach me how to best amend this behaviour.
> (I am afraid this time also I am missing target.)
> 
> I honestly hope this breaks the stagnation.
> 
> I would appreciate your reply.
> Thanks in advance.
> 
> Masahiro Ariga

You should not have to change the driver.  The differences in
endian-ness are handled by the macros CYG_CPU_TO_LE16() and
CYG_LE16_TO_CPU().  Make sure that your HAL defines them
correctly.


-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]