01.06.2013 Views

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

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.

❍ Device Receive function<br />

❍ Device FreeReceive function<br />

❍ Device Get PhysicalAddress function<br />

❍ Implementation of an interrupt service routine (ISR) and receiver task<br />

❍ Install the device driver<br />

Device Open function<br />

Top of list<br />

Index page<br />

The TCP/IP stack calls this (optional) function to initialize the hardware and (optional) to install an Interrupt<br />

Service handler. If Borland C compilers are used the driver functions must be declared as huge (see below).<br />

Microsoft C users must declare driver functions as far _saveregs _loadds .<br />

The function should return 0 if initialization was successful. If initialization failed, return -1.<br />

Generic Example:<br />

int huge myDevOpen(DevUserIfaceHandle ifaceHandle)<br />

{<br />

// Install (if necessary) a <strong>RTOS</strong> Interrupt Service function with<br />

// HWAPI handler function 0xA1 service 0x84<br />

return 0;<br />

}<br />

Device Close function<br />

Top of list<br />

Index page<br />

The TCP/IP stack will execute this (optional) function when the device driver interface is closed with the<br />

DEV_CLOSE_IFACE API call.<br />

This callback function should return 0 if the closing of the device was successful, otherwise -1 on failure.<br />

Generic example:<br />

int huge myDevClose(DevUserIfaceHandle ifaceHandle)<br />

{<br />

// DeInitialize the hardware<br />

// Remove the ISR handler<br />

return 0;<br />

}<br />

Device Send function<br />

This callback function is used by the TCP/IP stack to send the data out the device. The TCP/IP stack does not<br />

call this function from within a separate transmit task. This callback executes in the thread which made the send<br />

call, e.g. API_SEND API.<br />

This callback function should return 0 if the sending of data was successful, otherwise -1 on error.<br />

Important:<br />

If the input parameter flaghas value 1 (this indicates this is last frame in block) you must call<br />

DEV_SND_COMPLETEto tell the TCP/IP stack that the send buffer is no longer in use.<br />

Page 344 / 400

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

Saved successfully!

Ooh no, something went wrong!