commit | c7e764a2bf6254469d257cccd9353696520bccd7 | [log] [tgz] |
---|---|---|
author | Jeremy Kerr <jk@ozlabs.org> | Tue May 28 16:49:03 2019 +0800 |
committer | Jeremy Kerr <jk@ozlabs.org> | Thu May 30 21:26:00 2019 +0800 |
tree | bc7b92c1e60eb531c75960d460a8d5beaf6ff8da | |
parent | b2ef62bafcff3a31662301ada6c8e525a2cc8b27 [diff] |
Rework conditional feature usage Currently, the infrastructure that we have to enable a flexible compilation environment has a few issues: - the allocator configuration is performed at run-time, while the log configuration is performed at compile-time - for a standard compile (ie, standard userspace, using autoconf+automake to build), we need a few pre-defined configuration options. This change adds a bit of runtime selection to the logging infrastructure, to match the allocator setup. We also unify the compile-time defines into config.h, using MCTP_-prefixed macro names, allowing integration into other build systems. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
This library is intended to be a portable implementation of the Management Component Transport Protocol (MCTP), as defined by DMTF standard "DSP0236", plus transport binding specifications.
Currently, the library is is only at prototyping stage. Interfaces will likely change, and are missing lots of components of the standard.
To initialise the MCTP stack with a single hardware bus:
mctp = mctp_init()
: Initialise the MCTP corebinding = mctp_<binding>_init()
: Initialise a hardware bindingmctp_register_bus(mctp, binding, eid)
: Register the hardware binding with the core, using a predefined EIDThen, register a function call to be invoked when a message is received:
mctp_set_rx_all(mctp, function)
: Provide a callback to be invoked when a MCTP message is receivedOr transmit a message:
mctp_message_tx(mctp, message, len)
: Transmit a MCTP messageThe binding may require you to notify it to receive packets. For example, for the serial binding, the mctp_serial_read()
function should be invoked when the file-descriptor for the serial device has data available.
The libmctp code is intended to be integrated into other codebases by two methods:
as a simple library (libmctp.{a,so}
) which can be compiled separately and linked into the containing project
as a set of sources to be included into the containing project (either imported, or as a git subtree/submodule)
For (1), you can use the top-level makefile to produce libmtcp.a
.
For (2), the Makefile.inc
file provides the minimum set of dependencies to either build libmctp.a, or just the actual object files (LIBMCTP_OBS
), which you can include into your existing make definitions. You'll want to set LIBMTCP_DIR
to refer to the subdirectory that contains that makefile, so we can set the correct paths to sources.
This library is intended to be portable to be used in a range of environments, but the main targets are:
For the latter, we need to support customisation of the functions that libmctp uses (for example, POSIX file IO is not available).
In order to support these, we have a few compile-time definitions:
MCTP_HAVE_FILEIO
: define if POSIX file io is available, allowing the serial hardware binding to access char devices for IO.
MCTP_HAVE_SYSLOG
: allow logging to syslog, through the vsyslog
call.
MCTP_DEFAULT_ALLOC
: set default allocator functions (malloc, free, realloc), so that applications do not have to provide their own.