]> git.kernelconcepts.de Git - karo-tx-redboot.git/blobdiff - packages/devs/can/loop/v2_0/tests/can_txevent.c
unified MX27, MX25, MX37 trees
[karo-tx-redboot.git] / packages / devs / can / loop / v2_0 / tests / can_txevent.c
index a5b9ccc1434ec53baa0a845edac771a8d71a5921..20bc49461585263db91f08b428b385fa4ad55e86 100644 (file)
@@ -110,7 +110,10 @@ void can0_thread(cyg_addrword_t data)
     cyg_can_message    tx_msg =
     {
         0x000,                                               // CAN identifier
-        {0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7},    // 8 data bytes
+        data :
+        {
+            {0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }// 8 data bytes
+        },
         CYGNUM_CAN_ID_STD,                                   // standard frame
         CYGNUM_CAN_FRAME_DATA,                               // data frame
         4,                                                   // data length code
@@ -146,8 +149,8 @@ void can0_thread(cyg_addrword_t data)
     diag_printf("Sending %d CAN messages to /dev/can0 \n", buf_info.rx_bufsize);
     for (i = 0; i < buf_info.rx_bufsize; ++i)
     {
-        tx_msg.id = i;
-        tx_msg.data[0] = i;
+        CYG_CAN_MSG_SET_STD_ID(tx_msg, 0x000 + i);
+        CYG_CAN_MSG_SET_DATA(tx_msg, 0, i);
         len = sizeof(tx_msg);
         
         if (ENOERR != cyg_io_write(hCAN0, &tx_msg, &len))
@@ -160,6 +163,11 @@ void can0_thread(cyg_addrword_t data)
         }
     }
     
+    //
+    // Give the loop back driver time to process all those messages.
+    //
+    cyg_thread_delay(10);
+    
     //
     // now we read the buffer info - we expect a completely filled recieve queue
     //
@@ -204,7 +212,7 @@ void can0_thread(cyg_addrword_t data)
         // Now check if TX events contain valid data - we know that the ID and the first
         // data byte contain the message number
         //
-        if ((rx_event.msg.id != i) || (rx_event.msg.data[0] != i))
+        if ((rx_event.msg.id != i) || (rx_event.msg.data.bytes[0] != i))
         {
             CYG_TEST_FAIL_FINISH("Received invalid data in TX event");
         }