RTEMS 5.2
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
rtemscompat_defs.h
1#ifndef RTEMS_COMPAT_DEFS_H
2#define RTEMS_COMPAT_DEFS_H
3
4#include <stdint.h>
5#include <stddef.h>
6
7/* Number of device instances the driver should support
8 * - may be limited to 1 depending on IRQ API
9 * (braindamaged PC586 and powerpc)
10 */
11#define NETDRIVER_SLOTS 1
12/* String name to print with error messages */
13#define NETDRIVER "gfe"
14/* Name snippet used to make global symbols unique to this driver */
15#define NETDRIVER_PREFIX gfe
16
17/* Define according to endianness of the *ethernet*chip*
18 * (not the CPU - most probably are LE)
19 * This must be either NET_CHIP_LE or NET_CHIP_BE
20 */
21
22#define NET_CHIP_LE
23#undef NET_CHIP_BE
24
25/* Define either NET_CHIP_MEM_IO or NET_CHIP_PORT_IO,
26 * depending whether the CPU sees it in memory address space
27 * or (e.g. x86) uses special I/O instructions.
28 */
29#define NET_CHIP_MEM_IO
30#undef NET_CHIP_PORT_IO
31
32/* The name of the hijacked 'bus handle' field in the softc
33 * structure. We use this field to store the chip's base address.
34 */
35#define NET_SOFTC_BHANDLE_FIELD sc_memh
36
37/* define the names of the 'if_XXXreg.h' and 'if_XXXvar.h' headers
38 * (only if present, i.e., if the BSDNET driver has no respective
39 * header, leave this undefined).
40 *
41 */
42#undef IF_REG_HEADER
43#define IF_VAR_HEADER "../if_gfe/if_gfevar.h"
44
45/* define if a pci device */
46/*
47#define NETDRIVER_PCI <bsp/pci.h>
48*/
49#undef NETDRIVER_PCI
50
51/* Macros to disable and enable interrupts, respectively.
52 * The 'disable' macro is expanded in the ISR, the 'enable'
53 * macro is expanded in the driver task.
54 * The global network semaphore usually provides mutex
55 * protection of the device registers.
56 * Special care must be taken when coding the 'disable' macro,
57 * however to MAKE SURE THERE ARE NO OTHER SIDE EFFECTS such
58 * as:
59 * - macro must not clear any status flags
60 * - macro must save/restore any context information
61 * (e.g., a address register pointer or a bank switch register)
62 *
63 * ARGUMENT: the macro arg is a pointer to the driver's 'softc' structure
64 */
65
66#define NET_DISABLE_IRQS(sc) GE_WRITE(sc, EIMR, 0)
67#define NET_ENABLE_IRQS(sc) GE_WRITE(sc, EIMR, sc->sc_intrmask)
68
69/* Driver may provide a macro/function to copy the hardware address
70 * from the device into 'softc.arpcom'.
71 * If this is undefined, the driver must to the copy itself.
72 * Preferrably, it should check soft.arpcom.ac_enaddr for all
73 * zeros and leave it alone if it is nonzero, i.e., write it
74 * to the hardware.
75#define NET_READ_MAC_ADDR(sc)
76 */
77
78typedef struct {
79 uint32_t ds_addr;
80 uint32_t ds_len;
82
83#define dm_segs gdm_segs
84#define dm_nsegs gdm_nsegs
85typedef struct gfe_dmamem *bus_dmamap_t;
86
87typedef uint32_t bus_addr_t;
88typedef uint32_t bus_size_t;
89
90typedef struct device blah;
91
92#define BUS_DMA_NOCACHE 0xdeadbeef
93
94#ifdef __PPC__
95#define bus_dmamap_sync(args...) do { __asm__ volatile("sync":::"memory"); } while(0)
96#else
97#error "Dont' know how to sync memory on your CPU"
98#endif
99
100int ether_sprintf_r(const unsigned char *enaddr, char *buf, int len);
101
102/* we have it although we're not ansi */
103int snprintf(char *, size_t, const char *,...);
104
105#include <string.h>
106
107/* declare in every routine using ether_sprintf */
108#define SPRINTFVARDECL char rtems_sprintf_local_buf[3*6] /* ethernet string */
109
110#define ether_sprintf_macro(a) \
111 (snprintf(rtems_sprintf_local_buf, \
112 sizeof(rtems_sprintf_local_buf), \
113 "%02X:%02X:%02X:%02X:%02X:%02X", \
114 a[0],a[1],a[2],a[3],a[4],a[5]) ? \
115 rtems_sprintf_local_buf : 0 \
116 )
117
118
119#define aprint_normal(args...) printf(args)
120#define aprint_error(args...) fprintf(stderr,args)
121
122#define delay(arg) DELAY(arg)
123
124#define KASSERT(a...) do {} while (0)
125
126#define gfe_assign_desc _bsd_gfe_assign_desc
127#define gfe_attach _bsd_gfe_attach
128#define gfe_dbg_config _bsd_gfe_dbg_config
129#define gfe_dmamem_alloc _bsd_gfe_dmamem_alloc
130#define gfe_dmamem_free _bsd_gfe_dmamem_free
131#define gfe_hash_alloc _bsd_gfe_hash_alloc
132#define gfe_hash_compute _bsd_gfe_hash_compute
133#define gfe_hash_entry_op _bsd_gfe_hash_entry_op
134#define gfe_hash_fill _bsd_gfe_hash_fill
135#define gfe_ifioctl _bsd_gfe_ifioctl
136#define gfe_ifstart _bsd_gfe_ifstart
137#define gfe_ifwatchdog _bsd_gfe_ifwatchdog
138#define gfe_init _bsd_gfe_init
139#define gfe_intr _bsd_gfe_intr
140#define gfe_mdio_access _bsd_gfe_mdio_access
141#define gfe_mii_read _bsd_gfe_mii_read
142#define gfe_mii_write _bsd_gfe_mii_write
143#define gfe_probe _bsd_gfe_probe
144#define gfe_rx_cleanup _bsd_gfe_rx_cleanup
145#define gfe_rx_get _bsd_gfe_rx_get
146#define gfe_rx_prime _bsd_gfe_rx_prime
147#define gfe_rx_process _bsd_gfe_rx_process
148#define gfe_rx_rxqalloc _bsd_gfe_rx_rxqalloc
149#define gfe_rx_rxqinit _bsd_gfe_rx_rxqinit
150#define gfe_rx_stop _bsd_gfe_rx_stop
151#define gfe_tick _bsd_gfe_tick
152#define gfe_tx_cleanup _bsd_gfe_tx_cleanup
153#define gfe_tx_done _bsd_gfe_tx_done
154#define gfe_tx_enqueue _bsd_gfe_tx_enqueue
155#define gfe_tx_start _bsd_gfe_tx_start
156#define gfe_tx_stop _bsd_gfe_tx_stop
157#define gfe_tx_txqalloc _bsd_gfe_tx_txqalloc
158#define gfe_whack _bsd_gfe_whack
159#define the_gfe_devs _bsd_the_gfe_devs
160
161#endif
Definition: rtemscompat_defs.h:91
Definition: rtemscompat1.h:15
Definition: if_gfevar.h:58