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

Create successful ePaper yourself

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

}<br />

}<br />

Related Topics<br />

Top of list<br />

Index page<br />

while(1)<br />

{<br />

// Check if there is data available inside of your device.<br />

if (myDeviceDataAvail())<br />

{<br />

// Receive and move incoming data into the stack<br />

Dev_Recv_Interface(mydevdriver.IfaceHandle, &errorCode);<br />

}<br />

RTX_Sleep_Time(10); // Go to sleep for a defined time.<br />

}<br />

DEV_NOTIFY_ISR API - Dev_Notify_ISR's implementation<br />

DEV_RECV_WAIT API - Dev_Recv_Wait's implementation<br />

DEV_RECV_IFACE API - Dev_Recv_Interface's implementation<br />

RTX_SLEEP_TIME API - RTX_Sleep_Time's implementation<br />

Install the device driver<br />

Based on the previous sections of this document, the following generic example should make clear the main<br />

steps required to install a user implemented device driver:<br />

#include "tcpip.h"<br />

#include "rtos.h"<br />

int huge myDevOpen(DevUserIfaceHandle ifaceHandle);<br />

int huge myDevClose(DevUserIfaceHandle ifaceHandle);<br />

int huge myDevSend(DevUserIfaceHandle ifaceHandle,<br />

unsigned char far * dataPtr,<br />

int dataLength, int flag);<br />

int huge myDevReceive1(DevUserIfaceHandle ifaceHandle,<br />

unsigned char far * far * dataPtr,<br />

int far * dataLength,<br />

DevUserBufferHandle bufferHandle);<br />

int huge myDevGetPhysAddr(DevUserIfaceHandle ifaceHandle,<br />

unsigned char far * physicalAddress);<br />

void interrupt MyDeviceISRHandler(void);<br />

void huge MyReceiveTask(void);<br />

unsigned int recvID; // task ID<br />

unsigned int myrecv_stack[1024]; // stack for receiver task<br />

unsigned char install_done = 0; // waiting flag for receiver task<br />

unsigned int errorCode;<br />

DevUserIfaceHandle MyDevHandle;<br />

TaskDefBlock myrecv_defblock =<br />

{<br />

MyReceiveTask, // task function<br />

{'D','E','V',' '}, // a name: 4 chars<br />

Page 349 / 400

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

Saved successfully!

Ooh no, something went wrong!