changeset 3266:edcc78939bd0

* include/canio.h: Added structure cyg_can_err_count_info for reading CAN hardware error counter values from CAN hardware. * doc/can.sgml: Documented new CAN config key CYG_IO_GET_CONFIG_ERR_COUNTERS.
author sergeig
date Wed, 28 Aug 2013 16:28:10 +0000
parents 1e90246544b4
children 1053b0d2490c
files packages/io/can/current/ChangeLog packages/io/can/current/doc/can.sgml packages/io/can/current/include/canio.h
diffstat 3 files changed, 38 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/packages/io/can/current/ChangeLog
+++ b/packages/io/can/current/ChangeLog
@@ -1,3 +1,10 @@
+2013-06-24  Uwe Kindler <uwe_kindler@web.de>
+
+	* include/canio.h: Added structure cyg_can_err_count_info for reading
+	CAN hardware error counter values from CAN hardware.
+	* doc/can.sgml: Documented new CAN config key
+	CYG_IO_GET_CONFIG_ERR_COUNTERS.
+
 2013-05-06  Uwe Kindler <uwe_kindler@web.de>
 
 	* doc/can.sgml: Documented return code -ENOSPC for cyg_io_set_config()
--- a/packages/io/can/current/doc/can.sgml
+++ b/packages/io/can/current/doc/can.sgml
@@ -664,6 +664,7 @@ CYG_IO_GET_CONFIG_CAN_MSGBUF_INFO
 CYG_IO_GET_CONFIG_CAN_TIMEOUT
 CYG_IO_GET_CONFIG_CAN_HDI
 CYG_IO_GET_CONFIG_CAN_STATE
+CYG_IO_GET_CONFIG_CAN_ERR_COUNTERS
 </PROGRAMLISTING>
 </SECTION><!-- can-cyg-io-get-config -->
   
@@ -1009,6 +1010,26 @@ present state of the CAN controller. Pos
 </PARA>   
 </SECTION> <!-- can-read-hw-state -->
 
+<SECTION>
+<TITLE>Reading CAN hardware error counters</TITLE>
+
+<PROGRAMLISTING>
+typedef struct cyg_can_err_count_info_st
+{
+    cyg_uint8 rx_err_count;
+    cyg_uint8 tx_err_count;
+} cyg_can_err_count_info;
+</PROGRAMLISTING>
+
+<PARA>
+Each CAN node maintains two error counters: the Transmit Error Counter (TEC)
+and the Receive Error Counter (REC). There are several rules governing how
+these counters are incremented and/or decremented.
+<varname>CYG_IO_GET_CONFIG_CAN_ERR_COUNTERS</varname> retrieves the present
+value of both error counters (TEC and REC).
+</PARA>
+</SECTION> <!-- can-read-err-counters -->
+
 
 <SECTION>
 <TITLE>Changing mode of CAN hardware</TITLE>
--- a/packages/io/can/current/include/canio.h
+++ b/packages/io/can/current/include/canio.h
@@ -283,6 +283,16 @@ typedef struct cyg_can_timeout_info_st
 
 
 //
+// For reading error counter values from CAN controller
+//
+typedef struct cyg_can_err_count_info_st
+{
+    cyg_uint8 rx_err_count;
+    cyg_uint8 tx_err_count;
+} cyg_can_err_count_info;
+
+
+//
 // this data type defines a handle to a message buffer or message box
 // of the CAN hardware device
 //