02.03.2014 Views

BSP Developer's Guide

BSP Developer's Guide

BSP Developer's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

H<br />

Implementing a MUX-Based Network Interface Driver<br />

device was down but is now back on line. When such situations arise, the END<br />

should call muxError( ). This routine passes error information up to the MUX,<br />

which, in turn, passes the information on to all protocols that have registered a<br />

routine to receive it. The muxError( ) routine is declared as follows:<br />

void muxError<br />

(<br />

void* pCookie, /* pointer to END_OBJ */<br />

END_ERR* pError /* pointer to END_ERR structure */<br />

)<br />

Among its input, this routine expects a pointer to an end_err structure, which is<br />

declared in end.h as follows:<br />

typedef struct end_err<br />

{<br />

INT32 errCode; /* error code, see above */<br />

char* pMesg; /* NULL-terminated error message, can be NULL */<br />

void* pSpare; /* pointer to user defined data, can be NULL */<br />

} END_ERR;<br />

The error-receive routine that the protocol registers with the MUX must be of the<br />

following prototype:<br />

void xxError<br />

(<br />

END_OBJ* pEnd, /* pointer to END_OBJ */<br />

END_ERR* pError, /* pointer to END_ERR */<br />

void* pSpare /* pointer to protocol private data passed in muxBind */<br />

)<br />

The errCode member of an end_err structure is 32 bits long. Wind River reserves<br />

the lower 16 bits of errCode for its own error messages. However, the upper 16 bits<br />

are available to user applications. Use these bits to encode whatever error<br />

messages you need to pass between drivers and protocols. The currently defined<br />

error codes are as follows:<br />

H<br />

#define END_ERR_INFO 1 /* information only */<br />

#define END_ERR_WARN 2 /* warning */<br />

#define END_ERR_RESET 3 /* device has reset */<br />

#define END_ERR_DOWN 4 /* device has gone down */<br />

#define END_ERR_UP 5 /* device has come back on line */<br />

#define END_ERR_FLAGS 6 /* device flags have changed */<br />

#define END_ERR_NO_BUF 7 /* device’s cluster pool is exhausted */<br />

281

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!