+ <h4>Reading hardware description information</h4>
+ <p><code>typedef struct cyg_can_hdi_st<br>
+ {<br>
+ cyg_uint8 support_flags;<br>
+ cyg_uint8 controller_type;<br>
+ } cyg_can_hdi;</code></p>
+ <p><code>CYG_IO_GET_CONFIG_CAN_HDI - </code>This function retrieves information about the used hardware. The Hardware Description Interface provides a method to gather information about the CAN hardware and the functionality of the driver. For this purpose the structure <code>cyg_can_hdi </code>is defined. The field support_flags contains information about the capabilities of the used CAN hardware. The following flags are available:</p>
+ <table width="600" border="0" cellspacing="2" cellpadding="0">
+ <tr>
+ <td align="center" valign="middle" bgcolor="#c6c6c6" width="70">7</td>
+ <td align="center" valign="middle" bgcolor="#c6c6c6" width="70">6</td>
+ <td align="center" valign="middle" bgcolor="#c6c6c6" width="70">5</td>
+ <td align="center" valign="middle" bgcolor="#c6c6c6" width="70">4</td>
+ <td align="center" valign="middle" bgcolor="#c6c6c6" width="70">3</td>
+ <td align="center" valign="middle" bgcolor="#c6c6c6" width="70">2</td>
+ <td align="center" valign="middle" bgcolor="#c6c6c6" width="70">1</td>
+ <td align="center" valign="middle" bgcolor="#c6c6c6" width="70">0</td>
+ </tr>
+ <tr>
+ <td align="center" valign="middle" width="70">res</td>
+ <td align="center" valign="middle" width="70">res</td>
+ <td align="center" valign="middle" width="70">res</td>
+ <td align="center" valign="middle" width="70">timest.</td>
+ <td align="center" valign="middle" width="70">SW-Filt</td>
+ <td align="center" valign="middle" width="70">FullCAN</td>
+ <td colspan="2" align="center" valign="middle" width="142">Frametype</td>
+ </tr>
+ </table>
+ <p><i>Frametype:<br>
+ </i>Bit 0 and Bit 1 of the structure describe the<i> </i>possibilities of the CAN controller. The following values are defined:</p>
+ <p><code>CYGNUM_CAN_HDI_FRAMETYPE_STD // receives only standard frame<br>
+ CYGNUM_CAN_HDI_FRAMETYPE_EXT_PASSIVE // can recieve but not send extended frames<br>
+ CYGNUM_CAN_HDI_FRAMETYPE_EXT_ACTIVE // can send and receive extended frames<br>
+ </code></p>
+ <p><i>FullCAN:<br>
+ </i>If the Bit 2 is set to one, the CAN controller supports more than one message buffer.</p>
+ <p><code>CYGNUM_CAN_HDI_FULLCAN // supports more than one message buffer<br>
+ </code></p>
+ <p><i>SW-Filter:<br>
+ </i>If Bit3 is set to one then the CAN driver supports some kind of software message filtering.</p>
+ <p><code>CYGNUM_CAN_HDI_FILT_SW // software message filtering supported<br>
+ </code></p>
+ <p><i>Timestamp:<br>
+ </i>If Bit 4 is set to one then the CAN hardware supports timestamps for CAN messages</p>
+ <p><code>CYGNUM_CAN_HDI_TIMESTAMP // CAN hardware supports timestamps<br>
+ </code></p>
+ <h4>Reading message buffer configuration</h4>
+ <p><code>typedef struct cyg_can_msgbox_info_st<br>
+ </code><code>{<br>
+ c</code><code>yg_uint8 count; // number of message buffers available for this device<br>
+ </code><code>cyg_uint8 free; // number of free message buffers<br>
+ </code><code>} cyg_can_msgbuf_info;</code></p>
+ <p><code>CYG_IO_GET_CONFIG_CAN_MSGBUF_INFO</code> - If the CAN hardware supports more than one message buffer for reception of CAN message (flag <code>CYGNUM_CAN_HDI_FULLCAN </code>is set after reading hardware description interface with <code>CYG_IO_GET_CONFIG_CAN_HDI</code>) then this function reads the number of message buffers the CAN hardware supports and the number of free message buffers. The field<i> count</i> contains the number of message buffers supported by device and the field <i>free</i> contains the number of free message buffers. The free message buffers are available for setting up remote buffers (<code>CYG_IO_SET_CONFIG_CAN_REMOTE_BUF)</code> and message filters (<code>CYG_IO_SET_CONFIG_CAN_FILTER_MSG</code>).</p>
+ <h4>Reading state of CAN hardware</h4>
+ <p><code>typedef enum<br>
+ {<br> CYGNUM_CAN_STATE_ACTIVE, // CAN controller is active, no errors<br>
+ </code><code>CYGNUM_CAN_STATE_STOPPED, // CAN controller is in stopped mode<br>
+ </code><code>CYGNUM_CAN_STATE_STANDBY, // CAN controller is in Sleep mode<br>
+ </code><code>CYGNUM_CAN_STATE_BUS_WARN, // CAN controller is active, warning level is reached<br>
+ </code><code>CYGNUM_CAN_STATE_ERR_PASSIVE, // CAN controller went into error passive mode<br>
+ </code><code>CYGNUM_CAN_STATE_BUS_OFF, // CAN controller went into bus off mode<br>
+ </code><code>CYGNUM_CAN_STATE_PHY_FAULT, // General failure of physical layer detected (if supported by hardware)<br>
+ </code><code>CYGNUM_CAN_STATE_PHY_H, // Fault on CAN-H detected (Low Speed CAN)<br>
+ </code><code>CYGNUM_CAN_STATE_PHY_L, // Fault on CAN-L detected (Low Speed CAN)<br>
+ </code><code>} cyg_can_state;</code></p>
+ <p><code>CYG_IO_GET_CONFIG_CAN_STATE</code> - This function retrieves the present state of the CAN controller. Possible values are defined in the <code>cyg_can_state</code> enumeration.</p>
+ <h4>Drain output buffers</h4>
+ <p><code>CYG_IO_SET_CONFIG_CAN_OUTPUT_DRAIN</code> - This function waits for any buffered output to complete. This function only completes when there is no more data remaining to be sent to the device.</p>
+ <h4>Flush output buffers</h4>
+ <p><code>CYG_IO_SET_CONFIG_CAN_OUTPUT_FLUSH</code> - This function discards any buffered output for the device.</p>
+ <h4>Flush input buffers</h4>
+ <p><code>CYG_IO_SET_CONFIG_CAN_INPUT_FLUSH</code> - This function discards any buffered input for the device.</p>