changeset 3267:1053b0d2490c

* src/can_lpc2xxx.c: Add support for new config key CYG_IO_GET_CONFIG_CAN_ERR_COUNTERS.
author sergeig
date Wed, 28 Aug 2013 16:29:23 +0000
parents edcc78939bd0
children b06697684f0a
files packages/devs/can/arm/lpc2xxx/current/ChangeLog packages/devs/can/arm/lpc2xxx/current/src/can_lpc2xxx.c
diffstat 2 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/packages/devs/can/arm/lpc2xxx/current/ChangeLog
+++ b/packages/devs/can/arm/lpc2xxx/current/ChangeLog
@@ -1,3 +1,8 @@
+2013-06-24  Uwe Kindler <uwe_kindler@web.de>
+
+	* src/can_lpc2xxx.c: Add support for new config key
+	  CYG_IO_GET_CONFIG_CAN_ERR_COUNTERS.
+
 2013-05-06  Uwe Kindler <uwe_kindler@web.de>
 
 	* src/can_lpc2xxx.c: Changed return code for message filter
--- a/packages/devs/can/arm/lpc2xxx/current/src/can_lpc2xxx.c
+++ b/packages/devs/can/arm/lpc2xxx/current/src/can_lpc2xxx.c
@@ -1484,7 +1484,7 @@ static Cyg_ErrNo lpc2xxx_can_get_config(
 
         
         //
-        // Query hardware description of FlexCAN device driver
+        // Query hardware description of LPC2xxx CAN device driver
         //     
         case CYG_IO_GET_CONFIG_CAN_HDI :
              {
@@ -1497,6 +1497,20 @@ static Cyg_ErrNo lpc2xxx_can_get_config(
                                    | CYGNUM_CAN_HDI_FULLCAN;
              }
              break;
+
+        //
+        // Read error counters from device hardware
+        //
+        case CYG_IO_GET_CONFIG_CAN_ERR_COUNTERS :
+             {
+                 lsc_buf_t data;
+                 cyg_can_err_count_info* err_info = (cyg_can_err_count_info*)buf;
+                 HAL_READ_UINT32(CAN_CTRL_GSR(info), data.dword);
+                 err_info->rx_err_count = data.bytes[2];
+                 err_info->tx_err_count = data.bytes[3];
+                 *len = sizeof(cyg_can_err_count_info);
+             }
+             break;
              
         default :
             res = -EINVAL;