Maxim Integrated / Mbed OS MAXREFDES155#

Dependencies:   MaximInterface

Embed: (wiki syntax)

« Back to documentation index

Hardware Transport Interface

Hardware Transport Interface
[Porting]

Functions

_SlFd_t sl_IfOpen (const char *ifName, unsigned long flags)
 Opens an interface communication port to be used for communicating with a SimpleLink device.
int sl_IfClose (_SlFd_t fd)
 Closes an opened interface communication port.
int sl_IfRead (_SlFd_t fd, unsigned char *pBuff, int len)
 Attempts to read up to len bytes from an opened communication channel into a buffer starting at pBuff.
int sl_IfWrite (_SlFd_t fd, const unsigned char *pBuff, int len)
 attempts to write up to len bytes to the SPI channel
int sl_IfRegIntHdlr (SL_P_EVENT_HANDLER InterruptHdl, void *pValue)
 register an interrupt handler routine for the host IRQ

Detailed Description

The simple link device can work with different transport interfaces (namely,SPI or UART). Texas Instruments provides single driver that can work with all these types. This section binds the physical transport interface with the SimpleLink driver

Note:
Correct and efficient implementation of this driver is critical for the performances of the SimpleLink device on this platform.

PORTING ACTION:

  • None

Function Documentation

int sl_IfClose ( _SlFd_t  fd )

Closes an opened interface communication port.

Parameters:
fd- file descriptor of opened communication channel
Returns:
upon successful completion, the function shall return 0. Otherwise, -1 shall be returned
See also:
sl_IfOpen , sl_IfRead , sl_IfWrite
Note:
The prototype of the function is as follow: int xxx_IfClose(Fd_t Fd);
belongs to porting_sec
Warning:

Definition at line 59 of file CC3100.cpp.

_SlFd_t sl_IfOpen ( const char *  ifName,
unsigned long  flags 
)

Opens an interface communication port to be used for communicating with a SimpleLink device.

Given an interface name and option flags, this function opens the communication port and creates a file descriptor. This file descriptor is used afterwards to read and write data from and to this specific communication channel. The speed, clock polarity, clock phase, chip select and all other specific attributes of the channel are all should be set to hardcoded in this function.

Parameters:
ifName- points to the interface name/path. The interface name is an optional attributes that the simple link driver receives on opening the driver (sl_Start). In systems that the spi channel is not implemented as part of the OS device drivers, this parameter could be NULL.
flags- optional flags parameters for future use
Returns:
upon successful completion, the function shall open the channel and return a non-negative integer representing the file descriptor. Otherwise, -1 shall be returned
See also:
sl_IfClose , sl_IfRead , sl_IfWrite
Note:
The prototype of the function is as follow: Fd_t xxx_IfOpen(char* pIfName , unsigned long flags);
belongs to porting_sec
Warning:

Definition at line 51 of file CC3100.cpp.

int sl_IfRead ( _SlFd_t  fd,
unsigned char *  pBuff,
int  len 
)

Attempts to read up to len bytes from an opened communication channel into a buffer starting at pBuff.

Parameters:
fd- file descriptor of an opened communication channel
pBuff- pointer to the first location of a buffer that contains enough space for all expected data
len- number of bytes to read from the communication channel
Returns:
upon successful completion, the function shall return the number of read bytes. Otherwise, 0 shall be returned
See also:
sl_IfClose , sl_IfOpen , sl_IfWrite
Note:
The prototype of the function is as follow: int xxx_IfRead(Fd_t Fd , char* pBuff , int Len);
belongs to porting_sec
Warning:

Definition at line 63 of file CC3100.cpp.

int sl_IfRegIntHdlr ( SL_P_EVENT_HANDLER  InterruptHdl,
void *  pValue 
)

register an interrupt handler routine for the host IRQ

Parameters:
InterruptHdl- pointer to interrupt handler routine
pValue- pointer to a memory structure that is passed to the interrupt handler.
Returns:
upon successful registration, the function shall return 0. Otherwise, -1 shall be returned
See also:
Note:
If there is already registered interrupt handler, the function should overwrite the old handler with the new one
If the handler is a null pointer, the function should un-register the interrupt handler, and the interrupts can be disabled.
belongs to porting_sec
Warning:

Definition at line 80 of file CC3100.cpp.

int sl_IfWrite ( _SlFd_t  fd,
const unsigned char *  pBuff,
int  len 
)

attempts to write up to len bytes to the SPI channel

Parameters:
fd- file descriptor of an opened communication channel
pBuff- pointer to the first location of a buffer that contains the data to send over the communication channel
len- number of bytes to write to the communication channel
Returns:
upon successful completion, the function shall return the number of sent bytes. otherwise, 0 shall be returned
See also:
sl_IfClose , sl_IfOpen , sl_IfRead
Note:
This function could be implemented as zero copy and return only upon successful completion of writing the whole buffer, but in cases that memory allocation is not too tight, the function could copy the data to internal buffer, return back and complete the write in parallel to other activities as long as the other SPI activities would be blocked until the entire buffer write would be completed

The prototype of the function is as follow: int xxx_IfWrite(Fd_t Fd , char* pBuff , int Len);

Note:
belongs to porting_sec
Warning:

Definition at line 72 of file CC3100.cpp.