summaryrefslogtreecommitdiff
path: root/nuttx/include
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-04-30 22:46:48 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-04-30 22:46:48 +0000
commit1e01021d528e896067ebe0f74a172e7c6b39c9ab (patch)
tree5a3cece005053f06809600fc0a620a7d44c9ab22 /nuttx/include
parent0494067399d622417226329f3f818f8a529bbf2a (diff)
downloadpx4-nuttx-1e01021d528e896067ebe0f74a172e7c6b39c9ab.tar.gz
px4-nuttx-1e01021d528e896067ebe0f74a172e7c6b39c9ab.tar.bz2
px4-nuttx-1e01021d528e896067ebe0f74a172e7c6b39c9ab.zip
more cs89x0 logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1749 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include')
-rwxr-xr-xnuttx/include/nuttx/cs89x0.h162
1 files changed, 162 insertions, 0 deletions
diff --git a/nuttx/include/nuttx/cs89x0.h b/nuttx/include/nuttx/cs89x0.h
new file mode 100755
index 000000000..29fffdc5a
--- /dev/null
+++ b/nuttx/include/nuttx/cs89x0.h
@@ -0,0 +1,162 @@
+/****************************************************************************
+ * include/nuttx/cs89x0.h
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_NUTTX_CS89x0_H
+#define __INCLUDE_NUTTX_CS89x0_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <sys/types.h>
+#include <wdog.h>
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/* This structure returns driver statistics (if enabled) */
+
+#ifdef CONFIG_C89x0_STATISTICS
+struct cs89x0_statistics_s
+{
+ uint32 tx_packets;
+ uint32 tx_errors;
+ uint32 tx_carriererrors;
+ uint32 tx_heartbeaterrors;
+ uint32 tx_windowerrors;
+ uint32 tx_abortederrors;
+ uint32 rx_missederrors;
+ uint32 rx_packets;
+ uint32 rx_errors;
+ uint32 rx_lengtherrors;
+ uint32 rx_crcerrors;
+ uint32 rx_frameerrors;
+ uint32 rx_dropped;
+ uint32 rx_missederrors;
+ uint32 collisions;
+};
+#endif
+
+/* This structure encapsulates all state information for a single hardware
+ * interface. It includes values that must be provided by the user to in
+ * to describe details of the CS89x00 implementation on a particular board.
+ * An instance if this structure is passed to cs89x00 to instantiate the
+ * driver.
+ *
+ * This structure also includes internal driver state information that should
+ * be of no concern to the caller of cs89x0_initialize(). These fields must
+ * be zeroed.
+ */
+
+struct cs89x0_driver_s
+{
+ /* User-provided CS89x00 platform-specific implementation details. The
+ * caller of cs89x0_initialize() must provide all of these values.
+ */
+
+ FAR void *cs_base; /* CS89x0 region base address */
+ FAR void *cs_ppbase; /* CS89x0 page packet base address */
+ ubyte cs_irq; /* CS89x00 IRQ number */
+
+ /* Driver internal state fields. These must be zeroed by before the
+ * instance of this structure is passed to cs89x0_initialize
+ */
+
+ boolean cs_bifup; /* TRUE:ifup FALSE:ifdown */
+ WDOG_ID cs_txpoll; /* TX poll timer */
+ WDOG_ID cs_txtimeout; /* TX timeout timer */
+#ifdef CONFIG_CS89x0_XMITEARLY
+ uint32 cs_txunderrun; /* Count of Tx underrun errors */
+#endif
+
+ /* This holds the information visible to uIP/NuttX */
+
+ struct uip_driver_s cs_dev; /* Interface understood by uIP */
+
+ /* Driver statistics */
+
+#ifdef CONFIG_C89x0_STATISTICS
+ struct cs89x0_statistics_s cs_stats;
+#endif
+};
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Function: cs89x0_initialize
+ *
+ * Description:
+ * Initialize the Ethernet driver
+ *
+ * Parameters:
+ * impl - decribes the the implementation of the cs89x00 implementation.
+ * This reference is retained so so must remain stable throughout the
+ * life of the driver instance.
+ * devno - Identifies the device number. This must be a number between
+ * zero CONFIG_CS89x0_NINTERFACES and the same devno must not be
+ * initialized twice. The associated network device will be referred
+ * to with the name "eth" followed by this number (eth0, eth1, etc).
+ *
+ * Returned Value:
+ * OK on success; Negated errno on failure.
+ *
+ * Assumptions:
+ *
+ ****************************************************************************/
+
+/* Initialize the CS89x0 chip and driver */
+
+EXTERN int cs89x0_initialize(FAR const cs89x0_driver_s *cs89x0, int devno);
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __INCLUDE_NUTTX_CS89x0_H */