•Determines whether packets were transmitted successfully (Section 5.3.14)
•Prints debug information (Section 5.3.15)
•Sets up new media to try if transmit was unsuccessful (Section 5.3.16)
•Establishes media if transmit was successful (Section 5.3.17)
5.3.1Setting Up the el_autosense_thread Routine
The following code shows how to set up the el_autosense_thread( ) routine:
unsigned | char el_junk_msg[] = { | 1 |
|
|
0xaa, | 0x00, 0x04, 0xff, 0xff, | 0xff, 0, 0, 0, 0, 0, 0, 0x60, | 0x06, | |
’t’, ’h’, ’i’, ’s’, ’ ’, ’i’, | ’s’, ’ ’, ’a’, ’ ’, ’j’, ’u’, | ’n’, ’k’, |
’’, ’a’, ’u’, ’t’, ’o’, ’s’, ’e’, ’n’, ’s’, ’e’, ’ ’, ’m’, ’e’, ’s’, ’s’, ’a’, ’g’, ’e’, ’.’
};
#define EL_JUNK_SIZE 46
#define EL_AUTOSENSE_PASSES 3*10
static void el_autosense_thread(struct el_softc *sc)
{
struct ifnet *ifp =
unsigned long prev_tint, prev_tmo, prev_err; struct mbuf *m;
int good_xmits, wait, s, i, link_beat, passes; unsigned long wait_flag=0;
2
1
2
3
Defines the message to transmit when trying to determine the mode of the device.
Declares a pointer to the el_softc data structure and calls it sc.
Declares a pointer to an ifnet data structure and calls it ifp. This line also initializes ifp to the address of the ifnet data structure for this 3Com 3C5x9 device. The ifnet data structure is referenced through the is_if member of the el_softc data structure pointer. The is_if name is an alternate name for the ac_if member of the arpcom data structure. The ac_if member is referred to as the
5.3.2 Blocking Until Awakened
The following code shows how the el_autosense_thread( ) routine blocks until awakened:
while(1) {
1
1
Waits for some process to indicate when to proceed with the autosense test.