]> rtime.felk.cvut.cz Git - arc.git/commitdiff
Added test interface for Can
authormahi <devnull@localhost>
Tue, 24 Apr 2012 12:33:11 +0000 (14:33 +0200)
committermahi <devnull@localhost>
Tue, 24 Apr 2012 12:33:11 +0000 (14:33 +0200)
arch/ppc/mpc55xx/drivers/Can.c
include/Can.h

index d749bca8dc49416b38c85355524aa604ea2f7b20..945e431b91199a28fa8f02b6b8267545769e4a55 100644 (file)
 \r
 typedef struct FLEXCAN_tag flexcan_t;\r
 \r
+#if defined(CFG_CAN_TEST)\r
+Can_TestType Can_Test;\r
+#endif\r
+\r
 typedef enum {\r
     CAN_UNINIT = 0, CAN_READY\r
 } Can_DriverStateType;\r
@@ -372,6 +376,11 @@ void Can_F_BusOff( void ) {Can_BusOff(CAN_CTRL_F);}
 #endif\r
 //-------------------------------------------------------------------\r
 \r
+#if defined(CFG_CAN_TEST)\r
+Can_TestType * Can_Arc_GetTestInfo( void ) {\r
+       return &Can_Test;\r
+}\r
+#endif\r
 \r
 /**\r
  * Hardware error ISR for CAN\r
@@ -497,6 +506,11 @@ static void Can_Isr_Tx(Can_UnitType *uPtr)
     /*\r
      * Tx\r
      */\r
+#if defined(CFG_CAN_TEST)\r
+    Can_Test.mbMaskTx |= mbMask;\r
+#endif\r
+\r
+\r
     for (; mbMask; mbMask &= ~(1ull << mbNr)) {\r
         mbNr = ilog2_64(mbMask);\r
 \r
@@ -525,6 +539,10 @@ static void Can_Isr_Rx(Can_UnitType *uPtr)
 \r
     uint64_t iFlag = *(uint64_t*) (&canHw->IFRH.R);\r
 \r
+#if defined(CFG_CAN_TEST)\r
+    Can_Test.mbMaskRx |= iFlag & uPtr->Can_Arc_RxMbMask;\r
+#endif\r
+\r
     while (iFlag & uPtr->Can_Arc_RxMbMask) {\r
 \r
         /* Find mailbox */\r
index 3f48f4b0e871b625f9c95abefb78c993d5c21b09..785f22c112a347300ad3f0d8c56dc176d542b5d7 100644 (file)
@@ -95,6 +95,13 @@ typedef struct {
 } Can_Arc_StatisticsType;\r
 \r
 \r
+#if defined(CFG_CAN_TEST)\r
+typedef struct {\r
+       uint64_t mbMaskTx;\r
+       uint64_t mbMaskRx;\r
+} Can_TestType;\r
+#endif\r
+\r
 // uint16: if only Standard IDs are used\r
 // uint32: if also Extended IDs are used\r
 typedef uint32 Can_IdType;\r
@@ -319,5 +326,9 @@ void Can_MainFunction_BusOff( void );
 void Can_MainFunction_Wakeup( void );\r
 \r
 void Can_Arc_GetStatistics( uint8 controller, Can_Arc_StatisticsType * stat);\r
+#if defined(CFG_CAN_TEST)\r
+Can_TestType *Can_Arc_GetTestInfo( void  );\r
+#endif\r
+\r
 \r
 #endif /*CAN_H_*/\r