RTEMS: bsps/shared/net/smc91111config.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
smc91111config.h
1#ifndef _SMC91111_CONFIG_H_
2#define _SMC91111_CONFIG_H_
3
4/*
5 * RTEMS event used by interrupt handler to signal driver tasks.
6 * This must not be any of the events used by the network task synchronization.
7 */
8#define INTERRUPT_EVENT RTEMS_EVENT_1
9
10/*
11 * RTEMS event used to start transmit daemon.
12 * This must not be the same as INTERRUPT_EVENT.
13 */
14#define START_TRANSMIT_EVENT RTEMS_EVENT_2
15
16 /* event to send when tx buffers become available */
17#define SMC91111_TX_WAIT_EVENT RTEMS_EVENT_3
18
19
20/* Number of OCs supported by this driver*/
21#define NOCDRIVER 1
22
23/* Receive buffer size -- Allow for a full ethernet packet including CRC */
24#define RBUF_SIZE 1536
25
26#define ET_MINLEN 64 /* minimum message length */
27
28#if (MCLBYTES < RBUF_SIZE)
29# error "Driver must have MCLBYTES > RBUF_SIZE"
30#endif
31
32/* ----------------- cygdriver params ----------------- */
33
34#define LAN91CXX_32BIT_RX
35#define LAN91CXX_IS_LAN91C111
36
37/* ----------------- compat layer ----------------- */
38
39#include <stdint.h>
40
41typedef uint32_t CYG_WORD;
42typedef uint8_t CYG_BYTE;
43typedef uint16_t CYG_WORD16;
44typedef uint32_t CYG_WORD32;
45
46#ifndef CYG_SWAP16
47# define CYG_SWAP16(_x_) \
48 ({ uint16_t _x = (_x_); ((_x << 8) | (_x >> 8)); })
49#endif
50
51#ifndef CYG_SWAP32
52# define CYG_SWAP32(_x_) \
53 ({ uint32_t _x = (_x_); \
54 ((_x << 24) | \
55 ((0x0000FF00UL & _x) << 8) | \
56 ((0x00FF0000UL & _x) >> 8) | \
57 (_x >> 24)); })
58#endif
59
60# define CYG_CPU_TO_BE16(_x_) (_x_)
61# define CYG_CPU_TO_BE32(_x_) (_x_)
62# define CYG_BE16_TO_CPU(_x_) (_x_)
63# define CYG_BE32_TO_CPU(_x_) (_x_)
64
65# define CYG_CPU_TO_LE16(_x_) CYG_SWAP16((_x_))
66# define CYG_CPU_TO_LE32(_x_) CYG_SWAP32((_x_))
67# define CYG_LE16_TO_CPU(_x_) CYG_SWAP16((_x_))
68# define CYG_LE32_TO_CPU(_x_) CYG_SWAP32((_x_))
69
70#define CYG_MACRO_START do {
71#define CYG_MACRO_END } while (0)
72#define HAL_IO_BARRIER() \
73 __asm__ volatile ( "" : : : "memory" )
74
75#define HAL_READ_UINT8( _register_, _value_ ) \
76 CYG_MACRO_START \
77 ((_value_) = *((volatile CYG_BYTE *)(_register_))); \
78 HAL_IO_BARRIER (); \
79 CYG_MACRO_END
80
81#define HAL_WRITE_UINT8( _register_, _value_ ) \
82 CYG_MACRO_START \
83 (*((volatile CYG_BYTE *)(_register_)) = (_value_)); \
84 HAL_IO_BARRIER (); \
85 CYG_MACRO_END
86
87#define HAL_READ_UINT16( _register_, _value_ ) \
88 CYG_MACRO_START \
89 ((_value_) = *((volatile CYG_WORD16 *)(_register_))); \
90 HAL_IO_BARRIER (); \
91 CYG_MACRO_END
92
93#define HAL_WRITE_UINT16( _register_, _value_ ) \
94 CYG_MACRO_START \
95 (*((volatile CYG_WORD16 *)(_register_)) = (_value_)); \
96 HAL_IO_BARRIER (); \
97 CYG_MACRO_END
98
99#define HAL_READ_UINT32( _register_, _value_ ) \
100 CYG_MACRO_START \
101 ((_value_) = *((volatile CYG_WORD32 *)(_register_))); \
102 HAL_IO_BARRIER (); \
103 CYG_MACRO_END
104
105#define HAL_READ_UINT16( _register_, _value_ ) \
106 CYG_MACRO_START \
107 ((_value_) = *((volatile CYG_WORD16 *)(_register_))); \
108 HAL_IO_BARRIER (); \
109 CYG_MACRO_END
110
111#define CYG_ASSERT(c,p) do { if (!(c)) { while(1) { printf(p);} }; } while(0)
112
113#define HAL_DELAY_US(p) rtems_task_wake_after (RTEMS_MICROSECONDS_TO_TICKS (p))
114
115
116#endif /* _SMC_91111_CONFIG_H_ */
117
118