Functions | |
| NUTFILE * | LpcDevDebugOpen (NUTDEVICE *dev, const char *name, int mode, int acc) |
| Open debug device. | |
| int | LpcDevDebugClose (NUTFILE *fp) |
| Close debug device. | |
| int | LpcDevDebugIOCtl (NUTDEVICE *dev, int req, void *conf) |
| Handle I/O controls for debug device 2. | |
| int | LpcDevDebugWrite (NUTFILE *fp, const void *buffer, int len) |
| Send characters to debug device 0. | |
Variables | |
| NUTDEVICE | devDebug0 |
| Debug device 0 information structure. | |
Open debug device.
| dev | Pointer to a previously registered NUTDEVICE structure. |
| name | Ignored, typically points to an empty string. |
| mode | Ignored, operation mode. |
| acc | Ignored, should be zero. |
References _NUTDEVICE::dev_dcb, _NUTFILE::nf_dev, _NUTFILE::nf_fcb, _NUTFILE::nf_next, and NULL.
| int LpcDevDebugClose | ( | NUTFILE * | fp | ) |
Close debug device.
| fp | Pointer to a _NUTFILE structure, obtained by a previous call to LpcDevDebugOpen(). |
| int LpcDevDebugIOCtl | ( | NUTDEVICE * | dev, |
| int | req, | ||
| void * | conf | ||
| ) |
Handle I/O controls for debug device 2.
The debug device supports UART_SETSPEED only.
| dev | Identifies the device that receives the device-control function. |
| req | Requested control function. May be set to one of the following constants:
|
| conf | Points to a variable that contains any data required for the given control function or receives data from that function. |
| int LpcDevDebugWrite | ( | NUTFILE * | fp, |
| const void * | buffer, | ||
| int | len | ||
| ) |
Send characters to debug device 0.
This function is called by the low level input routines of the C runtime library, using the _NUTDEVICE::dev_write entry.
A newline character will be automatically prepended by a carriage return.
| fp | Pointer to a _NUTFILE structure, obtained by a previous call to LpcDevDebugOpen(). |
References _NUTFILE::nf_dev.
{
NULL,
{'u', 'a', 'r', 't', '0', 0, 0, 0, 0}
,
0,
LPC_UART0_BASE,
0,
NULL,
&dbg0file,
Debug0Init,
LpcDevDebugIOCtl,
NULL,
LpcDevDebugWrite,
LpcDevDebugOpen,
LpcDevDebugClose,
NULL
}
Debug device 0 information structure.
Debug device 0 information structure.
Usually, the device structure is the only public symbol that may be referenced by the application code using
#include <dev/debug.h> { ... NutRegisterDevice(&devDebug0, 0, 0); ... }
If not referenced, the driver code (and this structure) will not be included in the final binary.
The name of the structure may differ among platforms. Portable applications should avoid it and instead make use of dev/board.h.
#include <dev/board.h> { ... NutRegisterDevice(&DEV_DEBUG, 0, 0); ... }
While output is supported by default, input may be not. If input is required, applications may replace DEV_DEBUG by DEV_CONSOLE. In this case the debug driver is selected only, if it has input capability (see NUT_DEV_DEBUG_READ). Otherwise an interrupt driven UART driver will be used.
Note, that this polling driver has certain advantages
but also some disadvantages
When used with Harvard architectures, additional functions may be offered to access data in program space.