On 01/22/2014 03:04 PM, Alexandre COFFIGNAL wrote: > > Le 22/01/2014 14:30, Gilles Chanteperdrix a écrit : >> On 01/22/2014 02:27 PM, Alexandre COFFIGNAL wrote: >>> >>> Le 22/01/2014 13:00, Gilles Chanteperdrix a écrit : >>>> On 01/22/2014 12:36 PM, Alexandre COFFIGNAL wrote: >>>>>>> + cf->data[3]=((data0 >> 0) & 0xFF) ; >>>>>>> + cf->data[2]=((data0 >> 8) & 0xFF) ; >>>>>>> + cf->data[1]=((data0 >> 16) & 0xFF) ; >>>>>>> + cf->data[0]=((data0 >> 24) & 0xFF) ; >>>>>>> + cf->data[7]=((data1 >> 0) & 0xFF) ; >>>>>>> + cf->data[6]=((data1 >> 8) & 0xFF) ; >>>>>>> + cf->data[5]=((data1 >> 16) & 0xFF) ; >>>>>>> + cf->data[4]=((data1 >> 24) & 0xFF) ; >>>>>>> >>>>>>> rtcan flexcan works perfectly. >>>>>>> is anyone know what is the problem with first instructions ? >>>>>> Probably mb->data does not have the right alignment. Could you not >>>>>> arrange to get it properly aligned? Failing that, you should use >>>>>> put_unaligned instead of open coding it. >>>>>> >>>>>> >>>>> here structures used in flexcan driver, it seem to be aligned >>>> >>>> I am talking about the alignment of cf->data, since obviously, that is >>>> the one which is causing problems. >>>> >>>> >>> Thank a lot, put_unaligned fix this issue if you want, i can send a path >>> >> >> The other solution (getting cf->data to be properly aligned) would be >> more efficient, why is not it possible to get cf->data properly aligned? >> > I think, i can't get cf->data to be properly aligned because "cf" is > receive internal frame representation within the ring buffer > of a struct rtcan_socket and struct rtcan_rb_frame is a generic > structure used in all rtcan drivers .
Hi Alexandr, Could you try the following patch? diff --git a/ksrc/drivers/can/rtcan_socket.h b/ksrc/drivers/can/rtcan_socket.h index e0a395d..8984121 100644 --- a/ksrc/drivers/can/rtcan_socket.h +++ b/ksrc/drivers/can/rtcan_socket.h @@ -77,6 +77,7 @@ struct rtcan_rb_frame { * existence of a timestamp is indicated by the RTCAN_HAS_TIMESTAMP * bit. */ unsigned char can_dlc; + unsigned short pad; /* Data bytes */ uint8_t data[8]; Regards. -- Gilles. _______________________________________________ Xenomai mailing list Xenomai@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai