02.03.2014 Views

BSP Developer's Guide

BSP Developer's Guide

BSP Developer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

VxWorks 5.5<br />

<strong>BSP</strong> Developer’s <strong>Guide</strong><br />

Handling a Polling Receive: endPollReceive( )<br />

Your endPollReceive( ) is used by any task (such as the debug agent) that wants<br />

to do a polling receive.<br />

NOTE: When the system calls your endPollReceive( ), it is probably in a mode that<br />

cannot service kernel calls. Thus, this entry point should not call any kernel<br />

functions, such as taking a semaphore or allocating memory. Likewise, this entry<br />

point should not block or busy wait because that would probably hang the entire<br />

system.<br />

Your endPollReceive( ) must take the following form:<br />

int endPollReceive<br />

(<br />

void* pCookie, /* device structure */<br />

M_BLK_ID pMblk /* place to return the data */<br />

)<br />

Your endPollReceive( ) should check that the device is set to polled mode (by a<br />

previous endIoctl( ) call). Your endPollReceive( ) should then get a packet directly<br />

from the network and copy it to the mBlk passed in by the pMblk parameter.<br />

Your endPollReceive( ) entry point should return OK or an appropriate error<br />

value. One likely error return value is EAGAIN. Your endPollReceive( ) should<br />

return EAGAIN if the submitted mBlk was not big enough to contain the received<br />

packet, or if no packet is available.<br />

The parameters are:<br />

pCookie<br />

Passes a pointer to the END_OBJ structure returned by endLoad( ).<br />

pMblk<br />

Passes in a pointer to an mBlk structure. This parameter is an output<br />

parameter. Your endPollReceive( ) must copy the data from the stack to the<br />

mBlk structure referenced here.<br />

Adding a Multicast Address: endMCastAddrAdd( )<br />

Your endMCastAddAddr( ) entry point must add an address to the multicast table<br />

that is maintained by the device. Your endMCastAddAddr( ) must take the<br />

following form:<br />

296

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

Saved successfully!

Ooh no, something went wrong!