1 | /* networkconfig.c |
---|
2 | * |
---|
3 | * This file contains the network driver attach function and configuration |
---|
4 | * for the bf537Stamp. |
---|
5 | * |
---|
6 | * Copyright (c) 2008 Kallisti Labs, Los Gatos, CA, USA |
---|
7 | * written by Allan Hessenflow <allanh@kallisti.com> |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be |
---|
10 | * found in the file LICENSE in this distribution or at |
---|
11 | * http://www.rtems.com/license/LICENSE. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | |
---|
17 | |
---|
18 | #include <bsp.h> |
---|
19 | #include <rtems/rtems_bsdnet.h> |
---|
20 | #include <libcpu/interrupt.h> |
---|
21 | #include <libcpu/ethernet.h> |
---|
22 | |
---|
23 | |
---|
24 | static bfin_ethernet_configuration_t ethConfig = { |
---|
25 | SCLK, |
---|
26 | (void *) EMAC_BASE_ADDRESS, |
---|
27 | (void *) DMA1_BASE_ADDRESS, /* ethernet receive */ |
---|
28 | (void *) DMA2_BASE_ADDRESS, /* ethernet transmit */ |
---|
29 | 16, /* receive descriptors */ |
---|
30 | 16, /* transmit descriptors */ |
---|
31 | mii, /* phy type */ |
---|
32 | 1 /* phy address */ |
---|
33 | }; |
---|
34 | |
---|
35 | static bfin_isr_t ethISRs[] = { |
---|
36 | /* careful - shared with a bunch of things */ |
---|
37 | /* |
---|
38 | {SIC_MAC_ERROR_VECTOR, |
---|
39 | bfin_ethernet_mac_isr, |
---|
40 | 0, |
---|
41 | 0, |
---|
42 | NULL}, |
---|
43 | */ |
---|
44 | /* careful - shared with porth irqa */ |
---|
45 | {SIC_DMA1_MAC_RX_VECTOR, |
---|
46 | bfin_ethernet_rxdma_isr, |
---|
47 | 0, |
---|
48 | 0, |
---|
49 | NULL}, |
---|
50 | /* careful - shared with porth irqb */ |
---|
51 | {SIC_DMA2_MAC_TX_VECTOR, |
---|
52 | bfin_ethernet_txdma_isr, |
---|
53 | 0, |
---|
54 | 0, |
---|
55 | NULL} |
---|
56 | }; |
---|
57 | |
---|
58 | int bf537Stamp_network_driver_attach(struct rtems_bsdnet_ifconfig *config, |
---|
59 | int attaching) { |
---|
60 | int result; |
---|
61 | int i; |
---|
62 | |
---|
63 | result = bfin_ethernet_driver_attach(config, attaching, ðConfig); |
---|
64 | for (i = 0; i < sizeof(ethISRs) / sizeof(ethISRs[0]); i++) { |
---|
65 | bfin_interrupt_register(ðISRs[i]); |
---|
66 | bfin_interrupt_enable(ðISRs[i], TRUE); |
---|
67 | } |
---|
68 | |
---|
69 | return result; |
---|
70 | } |
---|
71 | |
---|