The simple link device can work with different communication channels (e.g. spi/uart). Texas Instruments provides single driver that can work with all these types. This section bind between the physical communication interface channel and 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:
- Bind the functions of the communication channel interface driver with the simple link driver
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);
- Note
- belongs to porting_sec
- Warning
#define sl_IfMaskIntHdlr |
( |
| ) |
|
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);
- Note
- belongs to porting_sec
- Warning
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);
- Note
- belongs to porting_sec
- Warning
#define sl_IfRegIntHdlr |
( |
|
InterruptHdl, |
|
|
|
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
\note If the handler is a null pointer, the function should un-register the
interrupt handler, and the interrupts can be disabled.
- Note
- belongs to porting_sec
- Warning
#define sl_IfUnMaskIntHdlr |
( |
| ) |
|
Unmasks the Host IRQ.
- See Also
- sl_IfMaskIntHdlr
- Note
- belongs to porting_sec
- Warning
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. therwise, 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
#define SL_START_WRITE_STAT |
Write Handers for statistics debug on write.
- Parameters
-
interface | handler - pointer to interrupt handler routine |
\return no return value
- See Also
\note An optional hooks for monitoring before and after write info
- Note
- belongs to porting_sec
- Warning