29#include <basictypes.h>
80 int read(
int fd,
char *buf,
int nbytes);
121 int write(
int fd,
const char *buf,
int nbytes);
166 int writeall(
int fd,
const char *buf,
int nbytes = 0);
420#define FD_SETSIZE (FDSET_ELEMENTS * 32)
427 } __attribute__((packed)) fd_set;
578 int extern_sem_select(
int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds,
OS_SEM &sem,
unsigned long timeout);
580 int textern_sem_select(
int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds,
OS_SEM &sem,
TickTimeout &timeout);
620 int select(
int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds,
unsigned long timeout);
622 int tselect(
int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds,
TickTimeout &timeout);
642 int ZeroWaitSelect(
int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds);
653#define IOCTL_TX_CHANGE_CRLF (1)
654#define IOCTL_RX_CHANGE_CRLF (2)
655#define IOCTL_RX_PROCESS_EDITS (4)
656#define IOCTL_RX_ECHO (8)
657#define IOCTL_TX_NO_BLOCK (32)
658#define IOCTL_ALL_OPTIONS (15)
666#define IOCTL_SET (0x4000)
667#define IOCTL_CLR (0x2000)
TickTimeout objects are used to facilitate sequential function calls with timeout parameters that nee...
Definition nbrtos.h:157
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...
int ReplaceStdio(int stdio_fd, int new_fd)
Maps stdio to any file descriptor (fd).
int charavail()
Checks to see if data is available for read on stdin. By default, stdin is the boot/debug serial port...
void FD_SETFROMSET(const fd_set *from, fd_set *to)
A fd_set (file descriptor set) holds a set of file descriptors (fds). This function adds the file des...
int FD_OVERLAP(const fd_set *f1, const fd_set *f2)
A fd_set (file descriptor set) holds a set of file descriptors (fds). This function determines whethe...
int ReadAllWithTickTimeout(int fd, char *buf, int nbytes, TickTimeout &timeout)
Same as ReadWithTimeout(), except the timeout value parameter is of type TickTimeout instead of an un...
void FD_CLRFROMSET(const fd_set *from, fd_set *to)
A fd_set (file descriptor set) holds a set of file descriptors (fds). This function remove the file d...
FDChangeType
The notifications that a registered FD monitor can receive.
Definition iosys.h:438
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...
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...
void FD_COPY(const fd_set *from, fd_set *to)
A fd_set (file descriptor set) holds a set of file descriptors (fds). This function copies one file d...
int dataavail(int fd)
Check the specified file descriptor to detmeine if data is available to be read.
int writeavail(int fd)
Check the specified file descriptor to determine data can be written.
void FDCallBack(int fd, FDChangeType change, void *pData)
Define the function signature for file descriptor notification callbacks.
Definition iosys.h:456
int peek(int fd, char *c)
Peek at the data for the specified file descriptor (fd). Will block forever until at least one byte i...
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 t...
int CurrentStdioFD(int stdio_fd)
Returns the current file descriptor mapped to the stdio file descriptor.
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 by...
int read(int fd, char *buf, int nbytes)
Read data from a file descriptor (fd).
void IrqStdio()
Open the system default serial port in interrupt mode using the system default baud rate,...
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 sp...
int close(int fd)
Close the specified file descriptor and free the associated resources.
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 ...
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,...
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)...
int writestring(int fd, const char *str)
Write a null terminated ascii string to the stream associated with a file descriptor (fd)....
int getchar()
Get a character from stdin. Will block if no character is available, from stdio library....
void FD_ZERO(fd_set *pfds)
Clear (set to 0) a fd_set (file descriptor set) so no file descriptors (fds) are selected.
int ioctl(int fd, int cmd)
This function controls the selection of input/output control options for stdio: stdin = 0,...
int haserror(int fd)
Check if a file descriptor has an error.
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,...
int ReadWithTickTimeout(int fd, char *buf, int nbytes, TickTimeout &timeout)
Same as ReadWithTimeout(), except the timeout value parameter is of type TickTimeout instead of an un...
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...
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 descr...
@ eWriteSet
When an FD changes from not writable to writeable.
Definition iosys.h:440
@ eReadSet
When read data changes from not available to available.
Definition iosys.h:439
@ eErrorSet
When an FD goes from no error to having an error.
Definition iosys.h:441
@ eClosingNow
when the underlying protocol closes the fd
Definition iosys.h:442
NetBurner System Constants.
#define FDSET_ELEMENTS
Definition nbrtos/include/constants.h:202
Semaphores are used to control access to shared resources or or to communicate between tasks in a mul...
Definition nbrtos.h:386