<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;"><font face="Arial">Hi,<br>
<br>
I have a strange behaviour regarding memory access between my user application and the driver i have developed I'd like to get some clarification on.<br>
<br>
The development is all used on or1k arch.<br>
<br>
On the application side, I have a buffer declared as:<br>
</font><font face="Courier New">#define PACKET_SIZE 256 <br>
</font><font face="Courier New">volatile uint8_t __attribute__ ((aligned (32))) buf_rx[256];<br>
<br>
<font face="Arial">Then I use the posix api function <font face="Courier New">read</font> to access the data I want to get from my driver as following:<br>
<br>
rtems_task test_task_rx(rtems_task_argument arg)<br>
</font>{<br>
info_rx_t *info_rx;<br>
info_rx = (info_rx_t*)arg;<br>
<br>
while(true){<br>
memset((uint8_t*)buf_rx, 0xaa, SPWN_TS_PACKET_SIZE);<br>
printk("Waiting for packet...@0x%08X\r\n", buf_rx);<br>
size = read(info_rx->fd, (uint8_t*)&buf_rx[0], PACKET_SIZE);<br>
<br>
if(size > 0) {
<br>
printk("Packet received with size <%d>", buf_rx[0], size);<br>
/* Print info */<br>
if(spwn_info_rx->show_header == true) {<br>
for(i = 0;i < info_rx->packet_len;i++) {<br>
printk("%02X ", buf_rx[1]);<br>
if((i%16) == 0) {<br>
printk("\r\n");<br>
}<br>
} <br>
printk("\b>\r\n");<br>
}<br>
}<br>
}<br>
}<br>
<br>
<font face="Arial">From my driver side I'm just iterating the buffer values by one to see the update, i.e: First time it starts with [01 02 03..." and next time it starts with [02 03 04...]. The strange thing is the first time I get a 'packet' it looks great.
But the second time, It shows a bunch of 0xaa values (from memset before reading):<br>
<br>
<font face="Courier New">Packet received with size <256> header @ 0004D960: AA<br>
AA AA AA ...<br>
11 12 13 ...<br>
AA AA AA ...<br>
...<br>
<br>
<font face="Arial"><b>But looking at the memory area</b> in gdb I see the correct values:</font><br>
01 02 03 ...<br>
11 12 13 ...<br>
21 22 23 ...<br>
...<br>
<br>
</font></font></font><font face="Courier New"><font face="Arial"><font face="Courier New"><font face="Arial"><font face="Courier New"><font face="Arial"><font face="Courier New"><font face="Arial">Removing memset call only shows that the buffer is the same
after first call to read. </font></font></font></font>I can't figure out why. Does anyone have a explanation. Any help would be appreciated.
<br>
<br>
Thanks,<br>
Inderjit<br>
<br>
<br>
</font></font><br>
<br>
</font></font></div>
</body>
</html>