diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-09-10 16:48:45 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-09-10 16:48:45 +0000 |
commit | 4f03177a72a65beeca2e40185d2e2fa97f24bc11 (patch) | |
tree | 4568b0eeb29017386bbf5be7f4416f3178c858dc /nuttx/configs/olimex-strp711/src/up_enc28j60.c | |
parent | 1a7287a8a4eeca7fc2a677b983b25877350d1439 (diff) | |
download | px4-nuttx-4f03177a72a65beeca2e40185d2e2fa97f24bc11.tar.gz px4-nuttx-4f03177a72a65beeca2e40185d2e2fa97f24bc11.tar.bz2 px4-nuttx-4f03177a72a65beeca2e40185d2e2fa97f24bc11.zip |
More logic for the MX3 Wildfire board
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5123 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs/olimex-strp711/src/up_enc28j60.c')
-rw-r--r-- | nuttx/configs/olimex-strp711/src/up_enc28j60.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/nuttx/configs/olimex-strp711/src/up_enc28j60.c b/nuttx/configs/olimex-strp711/src/up_enc28j60.c index c6ffdd368..2c693b7a8 100644 --- a/nuttx/configs/olimex-strp711/src/up_enc28j60.c +++ b/nuttx/configs/olimex-strp711/src/up_enc28j60.c @@ -151,14 +151,53 @@ # define ENC_GPIO0_NETINT (1 << 6) /* Interrupt (P0.6) */ /**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static int up_attach(FAR struct enc_lower_s *lower, xcpt_t handler); +static void up_enable(FAR struct enc_lower_s *lower); +static void up_disable(FAR struct enc_lower_s *lower); + +/**************************************************************************** * Private Data ****************************************************************************/ +/* The ENC28J60 normal provides interrupts to the MCU via a GPIO pin. The + * following structure provides an MCU-independent mechanixm for controlling + * the ENC28J60 GPIO interrupt. + */ + +static const struct enc_lower_s g_enclower = +{ + .attach = up_attach, + .enable = up_enable, + .disable = up_disable +}; + /**************************************************************************** * Private Functions ****************************************************************************/ /**************************************************************************** + * Name: struct enc_lower_s methods + ****************************************************************************/ + +static int up_attach(FAR struct enc_lower_s *lower, xcpt_t handler) +{ + return irq_attach(ENC28J60_IRQ, handler) +} + +static void up_enable(FAR struct enc_lower_s *lower) +{ + up_enable_irq(ENC28J60_IRQ); +} + +static void up_disable(FAR struct enc_lower_s *lower) +{ + up_disable_irq(ENC28J60_IRQ); +} + +/**************************************************************************** * Public Functions ****************************************************************************/ @@ -198,7 +237,7 @@ void up_netinitialize(void) /* Bind the SPI port to the ENC28J60 driver */ - ret = enc_initialize(spi, ENC28J60_DEVNO, ENC28J60_IRQ); + ret = enc_initialize(spi, ENC28J60_DEVNO, &g_enclower); if (ret < 0) { nlldbg("Failed to bind SPI port %d ENC28J60 device %d: %d\n", |