NetBurner 3.3.4
PDF Version
iosys.h File Reference

NetBurner I/O System Library API. More...

#include <constants.h>
#include <stdio.h>
#include <basictypes.h>

Go to the source code of this file.

Macros

#define IOCTL_TX_CHANGE_CRLF   (1)
 When set, transmitted char \n gets converted to \r\n
 
#define IOCTL_RX_CHANGE_CRLF   (2)
 When set, received \r\n get turned into \n
 
#define IOCTL_RX_PROCESS_EDITS   (4)
 When set, process backspace and do simple line editing.
 
#define IOCTL_RX_ECHO   (8)
 When set, echo chars received to tx.
 
#define IOCTL_TX_NO_BLOCK   (32)
 When set, stdout and stderr will drop output instead of blocking.
 
#define IOCTL_ALL_OPTIONS   (15)
 When set, turns on all options.
 
#define IOCTL_SET   (0x4000)
 Set an option.
 
#define IOCTL_CLR   (0x2000)
 Clear an option.
 

Typedefs

typedef void FDCallBack(int fd, FDChangeType change, void *pData)
 Define the function signature for file descriptor notification callbacks. More...
 

Enumerations

enum  FDChangeType { eReadSet , eWriteSet , eErrorSet }
 The notifications that a registered FD monitor can receive. More...
 

Functions

int close (int fd)
 Close the specified file descriptor and free the associated resources. More...
 
int read (int fd, char *buf, int nbytes)
 Read data from a file descriptor (fd). This function will block forever until at least one byte is available to be read (as opposed to the ReadWithTimeout() function which reads data from a file descriptor with a specified time-out value). This function can be used to read from stdio, TCP sockets, or Serial ports. More...
 
int peek (int fd, char *c)
 Peek at the data for the specified file descriptor (fd). Will block forever until at least one byte is available to be read. The byte returned is not removed from the fd buffer, it will be the first byte of data returned on any subsequent read operation. More...
 
int write (int fd, const char *buf, int nbytes)
 Write data to the stream associated with a file descriptor (fd). Can be used to write data to stdio, a TCP socket, or a Serial port. More...
 
int writestring (int fd, const char *str)
 Write a null terminated ascii string to the stream associated with a file descriptor (fd). Can be used to write data to stdio, a TCP socket, or a Serial port. More...
 
int writeall (int fd, const char *buf, int nbytes=0)
 Write the specified number of bytes to a file descriptor. Will block until all bytes are sent, or a file descriptor error occurs (such as a TCP socket error). Can be used to write data to stdio, a TCP socket, or a Serial port. More...
 
int ReadWithTimeout (int fd, char *buf, int nbytes, unsigned long timeout)
 Read data from a file descriptor (fd), or return if at least one byte is not read within the specified timeout. Can be used instead of the read() function, which will block forever until at least one byte is read. Can be used to read from stdio, TCP sockets, or Serial ports. More...
 
int ReadAllWithTimeout (int fd, char *buf, int nbytes, unsigned long timeout)
 Attempt to read the specified number of bytes from a file descriptor, or return with the number of bytes read if the timeout value has expired. More...
 
int readall (int fd, char *buf, int nbytes)
 Read the specified number of bytes from a file descriptor (fd). This function will block until either the requested number of bytes have been read, or a file descriptor error occurs. It can be used to read from stdio, TCP sockets, or Serial ports. More...
 
int PeekWithTimeout (int fd, char *c, unsigned long timeout)
 This function peeks at data from a file descriptor (fd), with a specified timeout value (as opposed to the peek function which will block forever until at least one byte is available to be read). This function can be used to peek from stdio, TCP sockets, or Serial ports. More...
 
int dataavail (int fd)
 Check the specified file descriptor to detmeine if data is available to be read. More...
 
int writeavail (int fd)
 Check the specified file descriptor to determine data can be written. More...
 
int haserror (int fd)
 Check if a file descriptor has an error. More...
 
int charavail ()
 Checks to see if data is available for read on stdin. By default, stdin is the boot/debug serial port. More...
 
void RegisterFDCallBack (int fd, FDCallBack *fp, void *pData)
 Register a callback function to receive notification when an FD state changes. Register a NULL fp to remove the notification. More...
 
void FD_ZERO (fd_set *pfds)
 Clear (set to 0) a fd_set (file descriptor set) so no file descriptors (fds) are selected. More...
 
void FD_CLR (int fd, fd_set *pfds)
 A fd_set (file descriptor set) holds a set of file descriptors (fds). This function clears or removes a specific file descriptor in an fd_set. More...
 
void FD_SET (int fd, fd_set *pfds)
 A fd_set (file descriptor set) holds a set of file descriptors (fds). This function sets or adds a specific file descriptor to an fd_set. More...
 
int FD_ISSET (int fd, fd_set *pfds)
 A fd_set (file descriptor set) holds a set of file descriptors (fds). This function checks whether or not a particular fd is set in the specified fd_set. More...
 
int select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, unsigned long timeout)
 Wait for events to occur on one or more I/O resources associated with a set of file descriptors (fds), such as data available to be read, a resource is available to write data, or an error has occurred. More...
 
int ZeroWaitSelect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds)
 Returns whether events have occurred on one or more I/O resources associated with a set of file descriptors (fds), and returns immediately. More...
 
int ioctl (int fd, int cmd)
 This function controls the selection of input/output control options for stdio: stdin = 0, stdout = 1 and stderr = 2. More...
 
int ReplaceStdio (int stdio_fd, int new_fd)
 Maps stdio to any file descriptor (fd). More...
 
int CurrentStdioFD (int stdio_fd)
 Returns the current file descriptor mapped to the stdio file descriptor. More...
 
void IrqStdio ()
 Open the system default serial port in interrupt mode using the system default baud rate, and assign this serial port to stdin, stdout and stderr.
 

Detailed Description

NetBurner I/O System Library API.