source: rtems/c/src/lib/libbsp/powerpc/beatnik/network/if_gfe/rtemscompat_defs.h @ b7a6d23a

4.104.115
Last change on this file since b7a6d23a was b7a6d23a, checked in by Till Straumann <strauman@…>, on 12/03/09 at 16:56:50
  • importing 'beatnik' BSP from SLAC repository.
  • Property mode set to 100644
File size: 3.5 KB
Line 
1#ifndef RTEMS_COMPAT_DEFS_H
2#define RTEMS_COMPAT_DEFS_H
3
4/* Number of device instances the driver should support
5 * - may be limited to 1 depending on IRQ API
6 * (braindamaged PC586 and powerpc)
7 */
8#define NETDRIVER_SLOTS 1
9/* String name to print with error messages */
10#define NETDRIVER       "gfe"
11/* Name snippet used to make global symbols unique to this driver */
12#define NETDRIVER_PREFIX gfe
13
14/* Define according to endianness of the *ethernet*chip*
15 * (not the CPU - most probably are LE)
16 * This must be either NET_CHIP_LE or NET_CHIP_BE
17 */
18
19#define NET_CHIP_LE
20#undef  NET_CHIP_BE
21
22/* Define either NET_CHIP_MEM_IO or NET_CHIP_PORT_IO,
23 * depending whether the CPU sees it in memory address space
24 * or (e.g. x86) uses special I/O instructions.
25 */
26#define NET_CHIP_MEM_IO
27#undef  NET_CHIP_PORT_IO
28
29/* The name of the hijacked 'bus handle' field in the softc
30 * structure. We use this field to store the chip's base address.
31 */
32#define NET_SOFTC_BHANDLE_FIELD sc_memh
33
34/* define the names of the 'if_XXXreg.h' and 'if_XXXvar.h' headers
35 * (only if present, i.e., if the BSDNET driver has no respective
36 * header, leave this undefined).
37 *
38 */
39#undef  IF_REG_HEADER
40#define  IF_VAR_HEADER <if_gfevar.h>
41
42/* define if a pci device */
43/*
44#define NETDRIVER_PCI <bsp/pci.h>
45*/
46#undef NETDRIVER_PCI
47
48/* Macros to disable and enable interrupts, respectively.
49 * The 'disable' macro is expanded in the ISR, the 'enable'
50 * macro is expanded in the driver task.
51 * The global network semaphore usually provides mutex
52 * protection of the device registers.
53 * Special care must be taken when coding the 'disable' macro,
54 * however to MAKE SURE THERE ARE NO OTHER SIDE EFFECTS such
55 * as:
56 *    - macro must not clear any status flags
57 *    - macro must save/restore any context information
58 *      (e.g., a address register pointer or a bank switch register)
59 *
60 * ARGUMENT: the macro arg is a pointer to the driver's 'softc' structure
61 */
62
63#define NET_DISABLE_IRQS(sc)    GE_WRITE(sc, EIMR, 0)
64#define NET_ENABLE_IRQS(sc)             GE_WRITE(sc, EIMR, sc->sc_intrmask)
65
66/* Driver may provide a macro/function to copy the hardware address
67 * from the device into 'softc.arpcom'.
68 * If this is undefined, the driver must to the copy itself.
69 * Preferrably, it should check soft.arpcom.ac_enaddr for all
70 * zeros and leave it alone if it is nonzero, i.e., write it
71 * to the hardware.
72#define NET_READ_MAC_ADDR(sc)
73 */
74
75typedef struct {
76        uint32_t        ds_addr;
77        uint32_t        ds_len;
78} bus_dma_segment_t;
79
80#define dm_segs         gdm_segs
81#define dm_nsegs        gdm_nsegs
82typedef struct gfe_dmamem *bus_dmamap_t;
83
84typedef uint32_t bus_addr_t;
85typedef uint32_t bus_size_t;
86
87typedef struct device blah;
88
89#define BUS_DMA_NOCACHE 0xdeadbeef
90
91#ifdef __PPC__
92#define bus_dmamap_sync(args...) do { asm volatile("sync":::"memory"); } while(0)
93#else
94#error "Dont' know how to sync memory on your CPU"
95#endif
96
97int     ether_sprintf_r(const unsigned char *enaddr, char *buf, int len);
98
99/* we have it although we're not ansi */
100int snprintf(char *, size_t, const char *,...);
101
102#include <string.h>
103
104/* declare in every routine using ether_sprintf */
105#define SPRINTFVARDECL  char rtems_sprintf_local_buf[3*6]       /* ethernet string */
106
107#define ether_sprintf_macro(a)                                  \
108        (snprintf(rtems_sprintf_local_buf,                      \
109                        sizeof(rtems_sprintf_local_buf),        \
110                        "%02X:%02X:%02X:%02X:%02X:%02X",        \
111                        a[0],a[1],a[2],a[3],a[4],a[5]) ?        \
112                        rtems_sprintf_local_buf : 0             \
113        )
114
115
116#define aprint_normal(args...)  printf(args)
117#define aprint_error(args...)   fprintf(stderr,args)
118
119#define delay(arg)      DELAY(arg)
120
121#define KASSERT(a...) do {} while (0)
122#endif
Note: See TracBrowser for help on using the repository browser.