-BUILD_NUM = 1329
+BUILD_NUM = 1339
// Check Bucket\r
i = pBuckets[ iNameHash ];\r
if(symtab[i].shndx != SHN_UNDEF && strcmp(symtab[i].name, Name) == 0) {\r
- *ret = symtab[ i ].value;\r
+ if(ret) *ret = symtab[ i ].value;\r
return 1;\r
}\r
\r
{\r
i = pChains[i];\r
if(symtab[i].shndx != SHN_UNDEF && strcmp(symtab[ i ].name, Name) == 0) {\r
- *ret = symtab[ i ].value;\r
+ if(ret) *ret = symtab[ i ].value;\r
return 1;\r
}\r
}\r
CPPFLAGS = -I./include
OBJ = main.o logging.o strmem.o imc.o mem.o buf.o cb.o
OBJ += meta_mgmt.o meta_gio.o
+OBJ += physio.o physio/meta_bus.o physio/meta_intr.o
NAME = UDI
-include ../Makefile.tpl
*/
#include <acess.h>
#include <udi.h>
-#include <udi_buf.h>
// === EXPORTS ===
EXPORT(udi_buf_copy);
/**
- * \file bc.c
+ * \file cb.c
* \author John Hodge (thePowersGang)
*/
#include <acess.h>
#include <udi.h>
-#include <udi_cb.h>
// === EXPORTS ===
EXPORT(udi_cb_alloc);
*/
#include <acess.h>
#include <udi.h>
-#include <udi_imc.h>
+
+// === EXPORTS ===
+EXPORT(udi_channel_anchor);
+EXPORT(udi_channel_spawn);
+EXPORT(udi_channel_set_context);
+EXPORT(udi_channel_op_abort);
+EXPORT(udi_channel_close);
+EXPORT(udi_channel_event_ind);
+EXPORT(udi_channel_event_complete);
// === CODE ===
/**
{
Warning("%s Unimplemented", __func__);
}
-
-// === EXPORTS ===
-EXPORT(udi_channel_anchor);
-EXPORT(udi_channel_spawn);
-EXPORT(udi_channel_set_context);
-EXPORT(udi_channel_op_abort);
-EXPORT(udi_channel_close);
-EXPORT(udi_channel_event_ind);
-EXPORT(udi_channel_event_complete);
--- /dev/null
+/**
+ * \file physio/meta_bus.h
+ */
+#ifndef _PHYSIO_META_BUS_H_
+#define _PHYSIO_META_BUS_H_
+
+#include <udi.h>
+#include <udi_physio.h>
+
+typedef const struct udi_bus_device_ops_s udi_bus_device_ops_t;
+typedef const struct udi_bus_bridge_ops_s udi_bus_bridge_ops_t;
+typedef struct udi_bus_bind_cb_s udi_bus_bind_cb_t;
+typedef void udi_bus_unbind_req_op_t(udi_bus_bind_cb_t *cb);
+typedef void udi_bus_unbind_ack_op_t(udi_bus_bind_cb_t *cb);
+typedef void udi_bus_bind_req_op_t(udi_bus_bind_cb_t *cb);
+typedef void udi_bus_bind_ack_op_t(
+ udi_bus_bind_cb_t *cb,
+ udi_dma_constraints_t dma_constraints,
+ udi_ubit8_t preferred_endianness,
+ udi_status_t status
+ );
+
+
+struct udi_bus_device_ops_s
+{
+ udi_channel_event_ind_op_t *channel_event_ind_op;
+ udi_bus_bind_ack_op_t *bus_bind_ack_op;
+ udi_bus_unbind_ack_op_t *bus_unbind_ack_op;
+ udi_intr_attach_ack_op_t *intr_attach_ack_op;
+ udi_intr_detach_ack_op_t *intr_detach_ack_op;
+};
+/* Bus Device Ops Vector Number */
+#define UDI_BUS_DEVICE_OPS_NUM 1
+
+struct udi_bus_bridge_ops_s
+{
+ udi_channel_event_ind_op_t *channel_event_ind_op;
+ udi_bus_bind_req_op_t *bus_bind_req_op;
+ udi_bus_unbind_req_op_t *bus_unbind_req_op;
+ udi_intr_attach_req_op_t *intr_attach_req_op;
+ udi_intr_detach_req_op_t *intr_detach_req_op;
+};
+/* Bus Bridge Ops Vector Number */
+#define UDI_BUS_BRIDGE_OPS_NUM
+
+struct udi_bus_bind_cb_s
+{
+ udi_cb_t gcb;
+};
+/* Bus Bind Control Block Group Number */
+#define UDI_BUS_BIND_CB_NUM 1
+
+
+extern void udi_bus_bind_req(udi_bus_bind_cb_t *cb);
+
+extern void udi_bus_bind_ack(
+ udi_bus_bind_cb_t *cb,
+ udi_dma_constraints_t dma_constraints,
+ udi_ubit8_t preferred_endianness,
+ udi_status_t status
+ );
+/* Values for preferred_endianness */
+#define UDI_DMA_BIG_ENDIAN (1U<<5)
+#define UDI_DMA_LITTLE_ENDIAN (1U<<6)
+#define UDI_DMA_ANY_ENDIAN (1U<<0)
+
+extern void udi_bus_unbind_req(udi_bus_bind_cb_t *cb);
+extern void udi_bus_unbind_ack(udi_bus_bind_cb_t *cb);
+
+
+
+
+
+#endif
--- /dev/null
+/**
+ * \file physio/meta_intr.h
+ */
+#ifndef _PHYSIO_META_INTR_H_
+#define _PHYSIO_META_INTR_H_
+
+#include <udi.h>
+#include <udi_physio.h>
+#include "pio.h"
+
+typedef struct udi_intr_attach_cb_s udi_intr_attach_cb_t;
+typedef void udi_intr_attach_req_op_t(udi_intr_attach_cb_t *intr_attach_cb);
+typedef void udi_intr_attach_ack_op_t(
+ udi_intr_attach_cb_t *intr_attach_cb,
+ udi_status_t status
+ );
+typedef struct udi_intr_detach_cb_s udi_intr_detach_cb_t;
+typedef void udi_intr_detach_req_op_t(udi_intr_detach_cb_t *intr_detach_cb);
+typedef void udi_intr_detach_ack_op_t(udi_intr_detach_cb_t *intr_detach_cb);
+typedef const struct udi_intr_handler_ops_s udi_intr_handler_ops_t;
+typedef const struct udi_intr_dispatcher_ops_s udi_intr_dispatcher_ops_t;
+typedef struct udi_intr_event_cb_s udi_intr_event_cb_t;
+typedef void udi_intr_event_ind_op_t(udi_intr_event_cb_t *intr_event_cb, udi_ubit8_t flags);
+typedef void udi_intr_event_rdy_op_t(udi_intr_event_cb_t *intr_event_cb);
+
+
+struct udi_intr_attach_cb_s
+{
+ udi_cb_t gcb;
+ udi_index_t interrupt_idx;
+ udi_ubit8_t min_event_pend;
+ udi_pio_handle_t preprocessing_handle;
+};
+/* Bridge Attach Control Block Group Number */
+#define UDI_BUS_INTR_ATTACH_CB_NUM 2
+
+struct udi_intr_detach_cb_s
+{
+ udi_cb_t gcb;
+ udi_index_t interrupt_idx;
+};
+/* Bridge Detach Control Block Group Number */
+#define UDI_BUS_INTR_DETACH_CB_NUM 3
+
+struct udi_intr_handler_ops_s
+{
+ udi_channel_event_ind_op_t *channel_event_ind_op;
+ udi_intr_event_ind_op_t *intr_event_ind_op;
+};
+/* Interrupt Handler Ops Vector Number */
+#define UDI_BUS_INTR_HANDLER_OPS_NUM 3
+
+struct udi_intr_dispatcher_ops_s
+{
+ udi_channel_event_ind_op_t *channel_event_ind_op;
+ udi_intr_event_rdy_op_t *intr_event_rdy_op;
+};
+/* Interrupt Dispatcher Ops Vector Number */
+#define UDI_BUS_INTR_DISPATCH_OPS_NUM 4
+
+struct udi_intr_event_cb_s
+{
+ udi_cb_t gcb;
+ udi_buf_t *event_buf;
+ udi_ubit16_t intr_result;
+};
+/* Flag values for interrupt handling */
+#define UDI_INTR_UNCLAIMED (1U<<0)
+#define UDI_INTR_NO_EVENT (1U<<1)
+/* Bus Interrupt Event Control Block Group Number */
+#define UDI_BUS_INTR_EVENT_CB_NUM 4
+
+
+
+extern void udi_intr_attach_req(udi_intr_attach_cb_t *intr_attach_cb);
+extern void udi_intr_attach_ack(udi_intr_attach_cb_t *intr_attach_cb, udi_status_t status);
+extern void udi_intr_attach_ack_unused(udi_intr_attach_cb_t *intr_attach_cb, udi_status_t status);
+
+extern void udi_intr_detach_req(udi_intr_detach_cb_t *intr_detach_cb);
+extern void udi_intr_detach_ack(udi_intr_detach_cb_t *intr_detach_cb);
+extern void udi_intr_detach_ack_unused(udi_intr_detach_cb_t *intr_detach_cb);
+
+
+extern void udi_intr_event_ind(udi_intr_event_cb_t *intr_event_cb, udi_ubit8_t flags);
+/**
+ * \brief Values for ::udi_intr_event_ind \a flags
+ * \{
+ */
+#define UDI_INTR_MASKING_NOT_REQUIRED (1U<<0)
+#define UDI_INTR_OVERRUN_OCCURRED (1U<<1)
+#define UDI_INTR_PREPROCESSED (1U<<2)
+/**
+ * \}
+ */
+
+extern void udi_intr_event_rdy(udi_intr_event_cb_t *intr_event_cb);
+
+
+
+#endif
--- /dev/null
+/**
+ * \file physio/pio.h
+ */
+#ifndef _PHYSIO_PIO_H_
+#define _PHYSIO_PIO_H_
+
+#include <udi.h>
+#include <udi_physio.h>
+
+
+typedef _udi_handle_t udi_pio_handle_t;
+/* Null handle value for udi_pio_handle_t */
+#define UDI_NULL_PIO_HANDLE _NULL_HANDLE
+
+#endif
typedef size_t udi_size_t; /* buffer size */
typedef size_t udi_index_t; /* zero-based index type */
+typedef void *_udi_handle_t;
+#define _NULL_HANDLE NULL
+
/* Channel Handle */
-typedef void *udi_channel_t;
-#define UDI_NULL_CHANNEL NULL
+typedef _udi_handle_t *udi_channel_t;
+#define UDI_NULL_CHANNEL _NULL_HANDLE
/**
* \brief Buffer Path
*/
-typedef void *udi_buf_path_t;
-#define UDI_NULL_BUF_PATH NULL
+typedef _udi_handle_t udi_buf_path_t;
+#define UDI_NULL_BUF_PATH _NULL_HANDLE
-typedef void *udi_origin_t;
-#define UDI_NULL_ORIGIN NULL
+typedef _udi_handle_t udi_origin_t;
+#define UDI_NULL_ORIGIN _NULL_HANDLE
typedef Sint64 udi_timestamp_t;
// === INCLUDE SUB-SECTIONS ===
-#include "udi_log.h" // Management Metalanguage
-#include "udi_attr.h" // Management Metalanguage
-#include "udi_cb.h" // Management Metalanguage
-#include "udi_meta_mgmt.h" // Management Metalanguage
-#include "udi_init.h" // Init
+#include "udi/cb.h" // Control Blocks
+#include "udi/log.h" // Logging
+#include "udi/attr.h" // Attributes
+#include "udi/strmem.h" // String/Memory
+#include "udi/buf.h" // Buffers
+#include "udi/mem.h" // Memory Management
+#include "udi/imc.h" // Inter-module Communication
+#include "udi/meta_mgmt.h" // Management Metalanguage
+#include "udi/meta_gio.h" // General IO Metalanguage
+#include "udi/init.h" // Init
#endif
--- /dev/null
+/**
+ * \file udi_attr.h
+ */
+#ifndef _UDI_ATTR_H_
+#define _UDI_ATTR_H_
+
+typedef struct udi_instance_attr_list_s udi_instance_attr_list_t;
+typedef udi_ubit8_t udi_instance_attr_type_t;
+
+/* Instance attribute limits */
+#define UDI_MAX_ATTR_NAMELEN 32
+#define UDI_MAX_ATTR_SIZE 64
+
+/**
+ * \brief Instance Attribute
+ */
+struct udi_instance_attr_list_s
+{
+ char attr_name[UDI_MAX_ATTR_NAMELEN];
+ udi_ubit8_t attr_value[UDI_MAX_ATTR_SIZE];
+ udi_ubit8_t attr_length;
+ udi_instance_attr_type_t attr_type;
+};
+
+
+/**
+ * \brief Instance Attribute Types
+ * \see ::udi_instance_attr_type_t
+ */
+enum
+{
+ UDI_ATTR_NONE,
+ UDI_ATTR_STRING,
+ UDI_ATTR_ARRAY8,
+ UDI_ATTR_UBIT32,
+ UDI_ATTR_BOOLEAN,
+ UDI_ATTR_FILE
+};
+
+
+#endif
--- /dev/null
+/**
+ * \file udi_buf.h
+ */
+#ifndef _UDI_BUF_H_
+#define _UDI_BUF_H_
+
+
+typedef struct udi_buf_s udi_buf_t;
+typedef struct udi_xfer_constraints_s udi_xfer_constraints_t;
+typedef void udi_buf_copy_call_t(udi_cb_t *gcb, udi_buf_t *new_dst_buf);
+typedef void udi_buf_write_call_t(udi_cb_t *gcb, udi_buf_t *new_dst_buf);
+
+/**
+ * \brief Describes a buffer
+ * \note Semi-Opaque
+ */
+struct udi_buf_s
+{
+ udi_size_t buf_size;
+ Uint8 Data[]; //!< ENVIRONMENT ONLY
+};
+
+/**
+ * \brief
+ */
+struct udi_xfer_constraints_s
+{
+ udi_ubit32_t udi_xfer_max;
+ udi_ubit32_t udi_xfer_typical;
+ udi_ubit32_t udi_xfer_granularity;
+ udi_boolean_t udi_xfer_one_piece;
+ udi_boolean_t udi_xfer_exact_size;
+ udi_boolean_t udi_xfer_no_reorder;
+};
+
+// --- MACROS ---
+/**
+ * \brief Allocates a buffer
+ */
+#define UDI_BUF_ALLOC(callback, gcb, init_data, size, path_handle) \
+ udi_buf_write(callback, gcb, init_data, size, NULL, 0, 0, path_handle)
+
+/**
+ * \brief Inserts data into a buffer
+ */
+#define UDI_BUF_INSERT(callback, gcb, new_data, size, dst_buf, dst_off) \
+ udi_buf_write(callback, gcb, new_data, size, dst_buf, dst_off, 0, UDI_NULL_BUF_PATH)
+
+/**
+ * \brief Removes data from a buffer (data afterwards will be moved forewards)
+ */
+#define UDI_BUF_DELETE(callback, gcb, size, dst_buf, dst_off) \
+ udi_buf_write(callback, gcb, NULL, 0, dst_buf, dst_off, size, UDI_NULL_BUF_PATH)
+
+/**
+ * \brief Duplicates \a src_buf
+ */
+#define UDI_BUF_DUP(callback, gcb, src_buf, path_handle) \
+ udi_buf_copy(callback, gcb, src_buf, 0, (src_buf)->buf_size, NULL, 0, 0, path_handle)
+
+
+/**
+ * \brief Copies data from one buffer to another
+ */
+extern void udi_buf_copy(
+ udi_buf_copy_call_t *callback,
+ udi_cb_t *gcb,
+ udi_buf_t *src_buf,
+ udi_size_t src_off,
+ udi_size_t src_len,
+ udi_buf_t *dst_buf,
+ udi_size_t dst_off,
+ udi_size_t dst_len,
+ udi_buf_path_t path_handle );
+
+/**
+ * \brief Copies data from driver space to a buffer
+ */
+extern void udi_buf_write(
+ udi_buf_write_call_t *callback,
+ udi_cb_t *gcb,
+ const void *src_mem,
+ udi_size_t src_len,
+ udi_buf_t *dst_buf,
+ udi_size_t dst_off,
+ udi_size_t dst_len,
+ udi_buf_path_t path_handle
+ );
+
+/**
+ * \brief Reads data from a buffer into driver space
+ */
+extern void udi_buf_read(
+ udi_buf_t *src_buf,
+ udi_size_t src_off,
+ udi_size_t src_len,
+ void *dst_mem );
+
+/**
+ * \brief Frees a buffer
+ */
+extern void udi_buf_free(udi_buf_t *buf);
+
+
+#endif
--- /dev/null
+/**
+ * \file udi_cb.h
+ */
+#ifndef _UDI_CB_H_
+#define _UDI_CB_H_
+
+typedef struct udi_cb_s udi_cb_t;
+typedef void udi_cb_alloc_call_t(udi_cb_t *gcb, udi_cb_t *new_cb);
+typedef void udi_cb_alloc_batch_call_t(udi_cb_t *gcb, udi_cb_t *first_new_cb);
+typedef void udi_cancel_call_t(udi_cb_t *gcb);
+
+#define UDI_GCB(mcb) (&(mcb)->gcb)
+#define UDI_MCB(gcb, cb_type) ((cb_type *)(gcb))
+
+/**
+ * \brief Describes a generic control block
+ * \note Semi-opaque
+ */
+struct udi_cb_s
+{
+ /**
+ * \brief Channel associated with the control block
+ */
+ udi_channel_t channel;
+ /**
+ * \brief Current state
+ * \note Driver changable
+ */
+ void *context;
+ /**
+ * \brief CB's scratch area
+ */
+ void *scratch;
+ /**
+ * \brief ???
+ */
+ void *initiator_context;
+ /**
+ * \brief Request Handle?
+ */
+ udi_origin_t origin;
+};
+
+extern void udi_cb_alloc (
+ udi_cb_alloc_call_t *callback,
+ udi_cb_t *gcb,
+ udi_index_t cb_idx,
+ udi_channel_t default_channel
+ );
+
+extern void udi_cb_alloc_dynamic(
+ udi_cb_alloc_call_t *callback,
+ udi_cb_t *gcb,
+ udi_index_t cb_idx,
+ udi_channel_t default_channel,
+ udi_size_t inline_size,
+ udi_layout_t *inline_layout
+ );
+
+extern void udi_cb_alloc_batch(
+ udi_cb_alloc_batch_call_t *callback,
+ udi_cb_t *gcb,
+ udi_index_t cb_idx,
+ udi_index_t count,
+ udi_boolean_t with_buf,
+ udi_size_t buf_size,
+ udi_buf_path_t path_handle
+ );
+
+extern void udi_cb_free(udi_cb_t *cb);
+
+extern void udi_cancel(udi_cancel_call_t *callback, udi_cb_t *gcb);
+
+
+
+
+#endif
--- /dev/null
+/**
+ * \file udi_imc.h
+ * \brief Inter-Module Communication
+ */
+#ifndef _UDI_IMC_H_
+#define _UDI_IMC_H_
+
+typedef void udi_channel_anchor_call_t(udi_cb_t *gcb, udi_channel_t anchored_channel);
+typedef void udi_channel_spawn_call_t(udi_cb_t *gcb, udi_channel_t new_channel);
+
+typedef struct udi_channel_event_cb_s udi_channel_event_cb_t;
+
+typedef void udi_channel_event_ind_op_t(udi_channel_event_cb_t *cb);
+
+/**
+ * \brief Anchors a channel end to the current region
+ */
+extern void udi_channel_anchor(
+ udi_channel_anchor_call_t *callback, udi_cb_t *gcb,
+ udi_channel_t channel, udi_index_t ops_idx, void *channel_context
+ );
+
+/**
+ * \brief Created a new channel between two regions
+ */
+extern void udi_channel_spawn(
+ udi_channel_spawn_call_t *callback,
+ udi_cb_t *gcb,
+ udi_channel_t channel,
+ udi_index_t spawn_idx,
+ udi_index_t ops_idx,
+ void *channel_context
+ );
+
+/**
+ * \brief Attaches a new context pointer to the current channel
+ */
+extern void udi_channel_set_context(
+ udi_channel_t target_channel,
+ void *channel_context
+ );
+/**
+ * \brief
+ */
+extern void udi_channel_op_abort(
+ udi_channel_t target_channel,
+ udi_cb_t *orig_cb
+ );
+
+/**
+ * \brief Closes an open channel
+ */
+extern void udi_channel_close(udi_channel_t channel);
+
+/**
+ * \brief Describes a channel event
+ */
+struct udi_channel_event_cb_s
+{
+ udi_cb_t gcb;
+ udi_ubit8_t event;
+ union {
+ struct {
+ udi_cb_t *bind_cb;
+ } internal_bound;
+ struct {
+ udi_cb_t *bind_cb;
+ udi_ubit8_t parent_ID;
+ udi_buf_path_t *path_handles;
+ } parent_bound;
+ udi_cb_t *orig_cb;
+ } params;
+};
+/* Channel event types */
+#define UDI_CHANNEL_CLOSED 0
+#define UDI_CHANNEL_BOUND 1
+#define UDI_CHANNEL_OP_ABORTED 2
+
+/**
+ * \brief Proxy function
+ */
+extern void udi_channel_event_ind(udi_channel_event_cb_t *cb);
+
+/**
+ * \brief Called when channel event is completed
+ */
+extern void udi_channel_event_complete(
+ udi_channel_event_cb_t *cb, udi_status_t status
+ );
+
+
+#endif
--- /dev/null
+/**
+ * \file udi_init.h
+ */
+#ifndef _UDI_INIT_H_
+#define _UDI_INIT_H_
+
+typedef struct udi_init_s udi_init_t;
+typedef struct udi_primary_init_s udi_primary_init_t;
+typedef struct udi_secondary_init_s udi_secondary_init_t;
+typedef struct udi_ops_init_s udi_ops_init_t;
+typedef struct udi_cb_init_s udi_cb_init_t;
+typedef struct udi_cb_select_s udi_cb_select_t;
+typedef struct udi_gcb_init_s udi_gcb_init_t;
+
+typedef struct udi_init_context_s udi_init_context_t;
+typedef struct udi_limits_s udi_limits_t;
+typedef struct udi_chan_context_s udi_chan_context_t;
+typedef struct udi_child_chan_context_s udi_child_chan_context_t;
+
+typedef void udi_op_t(void);
+typedef udi_op_t * const udi_ops_vector_t;
+
+/**
+ * \brief UDI Initialisation Structure
+ *
+ * Defines how to initialise and use a UDI driver
+ */
+struct udi_init_s
+{
+ /**
+ * \brief Defines the primary region
+ * \note For secondary modules this must be NULL
+ */
+ udi_primary_init_t *primary_init_info;
+
+ /**
+ * \brief Defines all secondary regions
+ * Pointer to a list (so, essentially an array) of ::udi_secondary_init_t
+ * It is terminated by an entry with ::udi_secondary_init_t.region_idx
+ * set to zero.
+ * \note If NULL, it is to be treated as an empty list
+ */
+ udi_secondary_init_t *secondary_init_list;
+
+ /**
+ * \brief Channel operations
+ * Pointer to a ::udi_ops_init_t.ops_idx == 0 terminated list that
+ * defines the channel opterations usage for each ops vector implemented
+ * in this module.
+ * \note Must contain at least one entry for each metalanguage used
+ */
+ udi_ops_init_t *ops_init_list;
+
+ /**
+ * \brief Control Blocks
+ */
+ udi_cb_init_t *cb_init_list;
+
+ /**
+ * \brief Generic Control Blocks
+ */
+ udi_gcb_init_t *gcb_init_list;
+
+ /**
+ * \brief Overrides for control blocks
+ * Allows a control block to override the ammount of scratch space it
+ * gets for a specific ops vector.
+ */
+ udi_cb_select_t *cb_select_list;
+};
+
+
+/**
+ * \name Flags for ::udi_primary_init_t.mgmt_op_flags
+ * \{
+ */
+
+/**
+ * \brief Tells the environment that this operation may take some time
+ * Used as a hint in scheduling tasks
+ */
+#define UDI_OP_LONG_EXEC 0x01
+
+/**
+ * \}
+ */
+
+/**
+ * \brief Describes the Primary Region
+ * Tells the environment how to set up the driver's primary region.
+ */
+struct udi_primary_init_s
+{
+ /**
+ * \brief Management Ops Vector
+ * Pointer to a list of functions for the Management Metalanguage
+ */
+ udi_mgmt_ops_t *mgmt_ops;
+
+ /**
+ * \brief Flags for \a mgmt_ops
+ * Each entry in \a mgmt_ops is acommanied by an entry in this array.
+ * Each entry contains the flags that apply to the specified ops vector.
+ * \see UDI_OP_LONG_EXEC
+ */
+ const udi_ubit8_t *mgmt_op_flags;
+
+ /**
+ * \brief Scratch space size
+ * Specifies the number of bytes to allocate for each control block
+ * passed by the environment.
+ * \note must not exceed ::UDI_MAX_SCRATCH
+ */
+ udi_size_t mgmt_scratch_requirement;
+
+ /**
+ * \todo What is this?
+ */
+ udi_ubit8_t enumeration_attr_list_length;
+
+ /**
+ * \brief Size in bytes to allocate to each instance of the primary
+ * region
+ * Essentially the size of the driver's instance state
+ * \note Must be at least sizeof(udi_init_context_t) and not more
+ * than UDI_MIN_ALLOC_LIMIT
+ */
+ udi_size_t rdata_size;
+
+ /**
+ * \brief Size in bytes to allocate for each call to ::udi_enumerate_req
+ * \note Must not exceed UDI_MIN_ALLOC_LIMIT
+ */
+ udi_size_t child_data_size;
+
+ /**
+ * \brief Number of path handles for each parent bound to this driver
+ * \todo What the hell are path handles?
+ */
+ udi_ubit8_t per_parent_paths;
+};
+
+/**
+ * \brief Tells the environment how to create a secondary region
+ */
+struct udi_secondary_init_s
+{
+ /**
+ * \brief Region Index
+ * Non-zero driver-dependent index value that identifies the region
+ * \note This corresponds to a "region" declaration in the udiprops.txt
+ * file.
+ */
+ udi_index_t region_idx;
+ /**
+ * \brief Number of bytes to allocate
+ *
+ * \note Again, must be between sizeof(udi_init_context_t) and
+ * UDI_MIN_ALLOC_LIMIT
+ */
+ udi_size_t rdata_size;
+};
+
+/**
+ * \brief Defines channel endpoints (ways of communicating with the driver)
+ *
+ */
+struct udi_ops_init_s
+{
+ /**
+ * \brief ops index number
+ * Used to uniquely this entry
+ * \note If this is zero, it marks the end of the list
+ */
+ udi_index_t ops_idx;
+ /**
+ * \brief Metalanguage Index
+ * Defines what metalanguage is used
+ */
+ udi_index_t meta_idx;
+ /**
+ * \brief Metalanguage Operation
+ * Defines what metalanguage operation is used
+ */
+ udi_index_t meta_ops_num;
+ /**
+ * \brief Size of the context area
+ * \note If non-zero, must be at least
+ */
+ udi_size_t chan_context_size;
+ /**
+ * \brief Pointer to the operations
+ * Pointer to a <<meta>>_<<role>>_ops_t structure
+ */
+ udi_ops_vector_t *ops_vector;
+ /**
+ * \brief Flags for each entry in \a ops_vector
+ */
+ const udi_ubit8_t *op_flags;
+};
+
+/**
+ * \brief Defines control blocks
+ * Much the same as ::udi_ops_init_t
+ */
+struct udi_cb_init_s
+{
+ udi_index_t cb_idx;
+ udi_index_t meta_idx;
+ udi_index_t meta_cb_num;
+ udi_size_t scratch_requirement;
+ /**
+ * \brief Size of inline memory
+ */
+ udi_size_t inline_size;
+ /**
+ * \brief Layout of inline memory
+ */
+ udi_layout_t *inline_layout;
+};
+
+/**
+ * \brief Overrides the scratch size for an operation
+ */
+struct udi_cb_select_s
+{
+ udi_index_t ops_idx;
+ udi_index_t cb_idx;
+};
+
+/**
+ * \brief General Control Blocks
+ * These control blocks can only be used as general data storage, not
+ * for any channel operations.
+ */
+struct udi_gcb_init_s
+{
+ udi_index_t cb_idx;
+ udi_size_t scratch_requirement;
+};
+
+
+// ===
+// ===
+/**
+ * \brief Environement Imposed Limits
+ */
+struct udi_limits_s
+{
+ /**
+ * \brief Maximum legal ammount of memory that can be allocated
+ */
+ udi_size_t max_legal_alloc;
+
+ /**
+ * \brief Maximum ammount of guaranteed memory
+ */
+ udi_size_t max_safe_alloc;
+ /**
+ * \brief Maximum size of the final string from ::udi_trace_write
+ * or ::udi_log_write
+ */
+ udi_size_t max_trace_log_formatted_len;
+ /**
+ * \brief Maximum legal size of an instanct attribute value
+ */
+ udi_size_t max_instance_attr_len;
+ /**
+ * \brief Minumum time difference (in nanoseconds between unique values
+ * returned by ::udi_time_current
+ */
+ udi_ubit32_t min_curtime_res;
+ /**
+ * \brief Minimum resolution of timers
+ * \see ::udi_timer_start_repeating, ::udi_timer_start
+ */
+ udi_ubit32_t min_timer_res;
+};
+
+/**
+ * \brief Primary Region Context data
+ */
+struct udi_init_context_s
+{
+ udi_index_t region_idx;
+ udi_limits_t limits;
+};
+
+/**
+ * \brief Channel context data
+ */
+struct udi_chan_context_s
+{
+ /**
+ * \brief Pointer to the driver instance's initial region data
+ */
+ void *rdata;
+};
+
+/**
+ * \brief Child Channel context
+ */
+struct udi_child_chan_context_s
+{
+ /**
+ * \brief Pointer to the driver instance's initial region data
+ */
+ void *rdata;
+ /**
+ * \brief Some sort of unique ID number
+ */
+ udi_ubit32_t child_ID;
+};
+
+#endif
--- /dev/null
+/**
+ * \file udi_log.h
+ */
+#ifndef _UDI_LOG_H_
+#define _UDI_LOG_H_
+
+/**
+ * \brief Trace Event
+ */
+typedef udi_ubit32_t udi_trevent_t;
+
+/**
+ * \brief Log Callback
+ */
+typedef void udi_log_write_call_t(udi_cb_t *gcb, udi_status_t correlated_status);
+
+/**
+ * \name Log Severities
+ * \brief Values for severity
+ * \{
+ */
+#define UDI_LOG_DISASTER 1
+#define UDI_LOG_ERROR 2
+#define UDI_LOG_WARNING 3
+#define UDI_LOG_INFORMATION 4
+/**
+ * \}
+ */
+
+
+#endif
--- /dev/null
+/**
+ * \file udi_mem.h
+ */
+#ifndef _UDI_MEM_H_
+#define _UDI_MEM_H_
+
+/**
+ * \brief Callback type for ::udi_mem_alloc
+ */
+typedef void udi_mem_alloc_call_t(udi_cb_t *gcb, void *new_mem);
+
+/**
+ * \brief Allocate memory
+ */
+extern void udi_mem_alloc(
+ udi_mem_alloc_call_t *callback,
+ udi_cb_t *gcb,
+ udi_size_t size,
+ udi_ubit8_t flags
+ );
+
+/**
+ * \brief Values for ::udi_mem_alloc \a flags
+ * \{
+ */
+#define UDI_MEM_NOZERO (1U<<0) //!< No need to zero the memory
+#define UDI_MEM_MOVABLE (1U<<1) //!< Globally accessable memory?
+/**
+ * \}
+ */
+
+/**
+ * \brief Free allocated memory
+ */
+extern void udi_mem_free(void *target_mem);
+
+
+#endif
--- /dev/null
+/**
+ * \file udi_meta_gio.h
+ */
+#ifndef _UDI_META_GIO_H_
+#define _UDI_META_GIO_H_
+
+typedef const struct udi_gio_provider_ops_s udi_gio_provider_ops_t;
+typedef const struct udi_gio_client_ops_s udi_gio_client_ops_t;
+typedef struct udi_gio_bind_cb_s udi_gio_bind_cb_t;
+typedef struct udi_gio_xfer_cb_s udi_gio_xfer_cb_t;
+typedef struct udi_gio_rw_params_s udi_gio_rw_params_t;
+typedef struct udi_gio_event_cb_s udi_gio_event_cb_t;
+
+typedef void udi_gio_bind_req_op_t(udi_gio_bind_cb_t *cb);
+typedef void udi_gio_unbind_req_op_t(udi_gio_bind_cb_t *cb);
+typedef void udi_gio_xfer_req_op_t(udi_gio_bind_cb_t *cb);
+typedef void udi_gio_event_res_op_t(udi_gio_bind_cb_t *cb);
+
+typedef void udi_gio_bind_ack_op_t(
+ udi_gio_bind_cb_t *cb,
+ udi_ubit32_t device_size_lo,
+ udi_ubit32_t device_size_hi,
+ udi_status_t status
+ );
+typedef void udi_gio_unbind_ack_op_t(udi_gio_bind_cb_t *cb);
+typedef void udi_gio_xfer_ack_op_t(udi_gio_bind_cb_t *cb);
+typedef void udi_gio_xfer_nak_op_t(udi_gio_bind_cb_t *cb, udi_status_t status);
+typedef void udi_gio_event_ind_op_t(udi_gio_bind_cb_t *cb);
+
+typedef udi_ubit8_t udi_gio_op_t;
+/* Limit values for udi_gio_op_t */
+#define UDI_GIO_OP_CUSTOM 16
+#define UDI_GIO_OP_MAX 64
+/* Direction flag values for op */
+#define UDI_GIO_DIR_READ (1U<<6)
+#define UDI_GIO_DIR_WRITE (1U<<7)
+/* Standard Operation Codes */
+#define UDI_GIO_OP_READ UDI_GIO_DIR_READ
+#define UDI_GIO_OP_WRITE UDI_GIO_DIR_WRITE
+
+
+
+struct udi_gio_provider_ops_s
+{
+ udi_channel_event_ind_op_t *channel_event_ind_op;
+ udi_gio_bind_req_op_t *gio_bind_req_op;
+ udi_gio_unbind_req_op_t *gio_unbind_req_op;
+ udi_gio_xfer_req_op_t *gio_xfer_req_op;
+ udi_gio_event_res_op_t *gio_event_res_op;
+};
+/* Ops Vector Number */
+#define UDI_GIO_PROVIDER_OPS_NUM 1
+
+struct udi_gio_client_ops_s
+{
+ udi_channel_event_ind_op_t *channel_event_ind_op;
+ udi_gio_bind_ack_op_t *gio_bind_ack_op;
+ udi_gio_unbind_ack_op_t *gio_unbind_ack_op;
+ udi_gio_xfer_ack_op_t *gio_xfer_ack_op;
+ udi_gio_xfer_nak_op_t *gio_xfer_nak_op;
+ udi_gio_event_ind_op_t *gio_event_ind_op;
+};
+/* Ops Vector Number */
+#define UDI_GIO_CLIENT_OPS_NUM 2
+
+struct udi_gio_bind_cb_s
+{
+ udi_cb_t gcb;
+ udi_xfer_constraints_t xfer_constraints;
+};
+/* Control Block Group Number */
+#define UDI_GIO_BIND_CB_NUM 1
+
+
+struct udi_gio_xfer_cb_s
+{
+ udi_cb_t gcb;
+ udi_gio_op_t op;
+ void *tr_params;
+ udi_buf_t *data_buf;
+};
+/* Control Block Group Number */
+#define UDI_GIO_XFER_CB_NUM 2
+
+struct udi_gio_rw_params_s
+{
+ udi_ubit32_t offset_lo;
+ udi_ubit32_t offset_hi;
+};
+
+struct udi_gio_event_cb_s
+{
+ udi_cb_t gcb;
+ udi_ubit8_t event_code;
+ void *event_params;
+};
+/* Control Block Group Number */
+#define UDI_GIO_EVENT_CB_NUM 3
+
+
+extern void udi_gio_bind_req(udi_gio_bind_cb_t *cb);
+extern void udi_gio_bind_ack(
+ udi_gio_bind_cb_t *cb,
+ udi_ubit32_t device_size_lo,
+ udi_ubit32_t device_size_hi,
+ udi_status_t status
+ );
+
+extern void udi_gio_unbind_req(udi_gio_bind_cb_t *cb);
+extern void udi_gio_unbind_ack(udi_gio_bind_cb_t *cb);
+
+extern void udi_gio_xfer_req(udi_gio_xfer_cb_t *cb);
+extern void udi_gio_xfer_ack(udi_gio_xfer_cb_t *cb);
+extern void udi_gio_xfer_nak(udi_gio_xfer_cb_t *cb, udi_status_t status);
+
+extern void udi_gio_event_res(udi_gio_event_cb_t *cb);
+extern void udi_gio_event_ind(udi_gio_event_cb_t *cb);
+extern void udi_gio_event_res_unused(udi_gio_event_cb_t *cb);
+
+#endif
--- /dev/null
+/**
+ * \file udi_meta_mgmt.h
+ */
+#ifndef _UDI_META_MGMT_H_
+#define _UDI_META_MGMT_H_
+
+typedef struct udi_mgmt_ops_s udi_mgmt_ops_t;
+typedef struct udi_mgmt_cb_s udi_mgmt_cb_t;
+typedef struct udi_usage_cb_s udi_usage_cb_t;
+typedef struct udi_filter_element_s udi_filter_element_t;
+typedef struct udi_enumerate_cb_s udi_enumerate_cb_t;
+
+/**
+ * \name Specify Usage
+ * \{
+ */
+typedef void udi_usage_ind_op_t(udi_usage_cb_t *cb, udi_ubit8_t resource_level);
+/* Values for resource_level */
+#define UDI_RESOURCES_CRITICAL 1
+#define UDI_RESOURCES_LOW 2
+#define UDI_RESOURCES_NORMAL 3
+#define UDI_RESOURCES_PLENTIFUL 4
+/* Proxy */
+extern void udi_static_usage(udi_usage_cb_t *cb, udi_ubit8_t resource_level);
+/**
+ * \}
+ */
+
+typedef void udi_usage_res_op_t(udi_usage_cb_t *cb);
+
+/**
+ * \name Enumerate this driver
+ * \{
+ */
+typedef void udi_enumerate_req_op_t(udi_enumerate_cb_t *cb, udi_ubit8_t enumeration_level);
+/* Values for enumeration_level */
+#define UDI_ENUMERATE_START 1
+#define UDI_ENUMERATE_START_RESCAN 2
+#define UDI_ENUMERATE_NEXT 3
+#define UDI_ENUMERATE_NEW 4
+#define UDI_ENUMERATE_DIRECTED 5
+#define UDI_ENUMERATE_RELEASE 6
+/* Proxy */
+extern void udi_enumerate_no_children(udi_enumerate_cb_t *cb, udi_ubit8_t enumeration_level);
+/**
+ * \}
+ */
+
+/**
+ * \name Enumeration Acknowlagement
+ * \{
+ */
+typedef void udi_enumerate_ack_op_t(udi_enumerate_cb_t *cb, udi_ubit8_t enumeration_result, udi_index_t ops_idx);
+/* Values for enumeration_result */
+#define UDI_ENUMERATE_OK 0
+#define UDI_ENUMERATE_LEAF 1
+#define UDI_ENUMERATE_DONE 2
+#define UDI_ENUMERATE_RESCAN 3
+#define UDI_ENUMERATE_REMOVED 4
+#define UDI_ENUMERATE_REMOVED_SELF 5
+#define UDI_ENUMERATE_RELEASED 6
+#define UDI_ENUMERATE_FAILED 255
+/**
+ * \}
+ */
+
+/**
+ * \name
+ * \{
+ */
+typedef void udi_devmgmt_req_op_t(udi_mgmt_cb_t *cb, udi_ubit8_t mgmt_op, udi_ubit8_t parent_ID);
+
+typedef void udi_devmgmt_ack_op_t(udi_mgmt_cb_t *cb, udi_ubit8_t flags, udi_status_t status);
+/**
+ * \}
+ */
+typedef void udi_final_cleanup_req_op_t(udi_mgmt_cb_t *cb);
+typedef void udi_final_cleanup_ack_op_t(udi_mgmt_cb_t *cb);
+
+
+
+
+
+struct udi_mgmt_ops_s
+{
+ udi_usage_ind_op_t *usage_ind_op;
+ udi_enumerate_req_op_t *enumerate_req_op;
+ udi_devmgmt_req_op_t *devmgmt_req_op;
+ udi_final_cleanup_req_op_t *final_cleanup_req_op;
+};
+
+struct udi_mgmt_cb_s
+{
+ udi_cb_t gcb;
+};
+
+struct udi_usage_cb_s
+{
+ udi_cb_t gcb;
+ udi_trevent_t trace_mask;
+ udi_index_t meta_idx;
+};
+
+
+struct udi_filter_element_s
+{
+ char attr_name[UDI_MAX_ATTR_NAMELEN];
+ udi_ubit8_t attr_min[UDI_MAX_ATTR_SIZE];
+ udi_ubit8_t attr_min_len;
+ udi_ubit8_t attr_max[UDI_MAX_ATTR_SIZE];
+ udi_ubit8_t attr_max_len;
+ udi_instance_attr_type_t attr_type;
+ udi_ubit32_t attr_stride;
+};
+struct udi_enumerate_cb_s
+{
+ udi_cb_t gcb;
+ udi_ubit32_t child_ID;
+ void *child_data;
+ udi_instance_attr_list_t *attr_list;
+ udi_ubit8_t attr_valid_length;
+ const udi_filter_element_t *filter_list;
+ udi_ubit8_t filter_list_length;
+ udi_ubit8_t parent_ID;
+};
+/* Special parent_ID filter values */
+#define UDI_ANY_PARENT_ID 0
+
+/**
+ * \brief
+ */
+extern void udi_devmgmt_req(udi_mgmt_cb_t *cb, udi_ubit8_t mgmt_op, udi_ubit8_t parent_ID );
+/**
+ * \brief Values for ::udi_devmgmt_req \a mgmt_op
+ */
+enum eDMGMT
+{
+ UDI_DMGMT_PREPARE_TO_SUSPEND = 1,
+ UDI_DMGMT_SUSPEND,
+ UDI_DMGMT_SHUTDOWN,
+ UDI_DMGMT_PARENT_SUSPENDED,
+ UDI_DMGMT_RESUME,
+ UDI_DMGMT_UNBIND
+};
+
+extern void udi_devmgmt_ack(udi_mgmt_cb_t *cb, udi_ubit8_t flags, udi_status_t status);
+//!\brief Values for flags
+#define UDI_DMGMT_NONTRANSPARENT (1U<<0)
+//!\brief Meta-Specific Status Codes
+#define UDI_DMGMT_STAT_ROUTING_CHANGE (UDI_STAT_META_SPECIFIC|1)
+
+extern void udi_final_cleanup_req(udi_mgmt_cb_t *cb);
+extern void udi_final_cleanup_ack(udi_mgmt_cb_t *cb);
+
+
+#endif
--- /dev/null
+/**
+ * \file udi_strmem.h
+ */
+#ifndef _UDI_STRMEM_H_
+#define _UDI_STRMEM_H_
+
+/**
+ * \brief Gets the length of a C style string
+ */
+extern udi_size_t udi_strlen(const char *s);
+
+/**
+ * \brief Appends to a string
+ */
+extern char *udi_strcat(char *s1, const char *s2);
+extern char *udi_strncat(char *s1, const char *s2, udi_size_t n);
+
+/**
+ * \brief Compares Strings/Memory
+ */
+extern udi_sbit8_t udi_strcmp(const char *s1, const char *s2);
+extern udi_sbit8_t udi_strncmp(const char *s1, const char *s2, udi_size_t n);
+extern udi_sbit8_t udi_memcmp(const void *s1, const void *s2, udi_size_t n);
+
+extern char *udi_strcpy(char *s1, const char *s2);
+extern char *udi_strncpy(char *s1, const char *s2, udi_size_t n);
+extern void *udi_memcpy(void *s1, const void *s2, udi_size_t n);
+extern void *udi_memmove(void *s1, const void *s2, udi_size_t n);
+
+extern char *udi_strncpy_rtrim(char *s1, const char *s2, udi_size_t n);
+
+extern char *udi_strchr(const char *s, char c);
+extern char *udi_strrchr(const char *s, char c);
+extern void *udi_memchr (const void *s, udi_ubit8_t c, udi_size_t n);
+
+extern void *udi_memset(void *s, udi_ubit8_t c, udi_size_t n);
+extern udi_ubit32_t udi_strtou32(const char *s, char **endptr, int base);
+
+
+extern udi_size_t udi_snprintf(char *s, udi_size_t max_bytes, const char *format, ...);
+
+
+
+#endif
+++ /dev/null
-/**
- * \file udi_attr.h
- */
-#ifndef _UDI_ATTR_H_
-#define _UDI_ATTR_H_
-
-typedef struct udi_instance_attr_list_s udi_instance_attr_list_t;
-typedef udi_ubit8_t udi_instance_attr_type_t;
-
-/* Instance attribute limits */
-#define UDI_MAX_ATTR_NAMELEN 32
-#define UDI_MAX_ATTR_SIZE 64
-
-/**
- * \brief Instance Attribute
- */
-struct udi_instance_attr_list_s
-{
- char attr_name[UDI_MAX_ATTR_NAMELEN];
- udi_ubit8_t attr_value[UDI_MAX_ATTR_SIZE];
- udi_ubit8_t attr_length;
- udi_instance_attr_type_t attr_type;
-};
-
-
-/**
- * \brief Instance Attribute Types
- * \see ::udi_instance_attr_type_t
- */
-enum
-{
- UDI_ATTR_NONE,
- UDI_ATTR_STRING,
- UDI_ATTR_ARRAY8,
- UDI_ATTR_UBIT32,
- UDI_ATTR_BOOLEAN,
- UDI_ATTR_FILE
-};
-
-
-#endif
+++ /dev/null
-/**
- * \file udi_buf.h
- */
-#ifndef _UDI_BUF_H_
-#define _UDI_BUF_H_
-
-
-typedef struct udi_buf_s udi_buf_t;
-typedef struct udi_xfer_constraints_s udi_xfer_constraints_t;
-typedef void udi_buf_copy_call_t(udi_cb_t *gcb, udi_buf_t *new_dst_buf);
-typedef void udi_buf_write_call_t(udi_cb_t *gcb, udi_buf_t *new_dst_buf);
-
-/**
- * \brief Describes a buffer
- * \note Semi-Opaque
- */
-struct udi_buf_s
-{
- udi_size_t buf_size;
- Uint8 Data[]; //!< ENVIRONMENT ONLY
-};
-
-/**
- * \brief
- */
-struct udi_xfer_constraints_s
-{
- udi_ubit32_t udi_xfer_max;
- udi_ubit32_t udi_xfer_typical;
- udi_ubit32_t udi_xfer_granularity;
- udi_boolean_t udi_xfer_one_piece;
- udi_boolean_t udi_xfer_exact_size;
- udi_boolean_t udi_xfer_no_reorder;
-};
-
-// --- MACROS ---
-/**
- * \brief Allocates a buffer
- */
-#define UDI_BUF_ALLOC(callback, gcb, init_data, size, path_handle) \
- udi_buf_write(callback, gcb, init_data, size, NULL, 0, 0, path_handle)
-
-/**
- * \brief Inserts data into a buffer
- */
-#define UDI_BUF_INSERT(callback, gcb, new_data, size, dst_buf, dst_off) \
- udi_buf_write(callback, gcb, new_data, size, dst_buf, dst_off, 0, UDI_NULL_BUF_PATH)
-
-/**
- * \brief Removes data from a buffer (data afterwards will be moved forewards)
- */
-#define UDI_BUF_DELETE(callback, gcb, size, dst_buf, dst_off) \
- udi_buf_write(callback, gcb, NULL, 0, dst_buf, dst_off, size, UDI_NULL_BUF_PATH)
-
-/**
- * \brief Duplicates \a src_buf
- */
-#define UDI_BUF_DUP(callback, gcb, src_buf, path_handle) \
- udi_buf_copy(callback, gcb, src_buf, 0, (src_buf)->buf_size, NULL, 0, 0, path_handle)
-
-
-/**
- * \brief Copies data from one buffer to another
- */
-extern void udi_buf_copy(
- udi_buf_copy_call_t *callback,
- udi_cb_t *gcb,
- udi_buf_t *src_buf,
- udi_size_t src_off,
- udi_size_t src_len,
- udi_buf_t *dst_buf,
- udi_size_t dst_off,
- udi_size_t dst_len,
- udi_buf_path_t path_handle );
-
-/**
- * \brief Copies data from driver space to a buffer
- */
-extern void udi_buf_write(
- udi_buf_write_call_t *callback,
- udi_cb_t *gcb,
- const void *src_mem,
- udi_size_t src_len,
- udi_buf_t *dst_buf,
- udi_size_t dst_off,
- udi_size_t dst_len,
- udi_buf_path_t path_handle
- );
-
-/**
- * \brief Reads data from a buffer into driver space
- */
-extern void udi_buf_read(
- udi_buf_t *src_buf,
- udi_size_t src_off,
- udi_size_t src_len,
- void *dst_mem );
-
-/**
- * \brief Frees a buffer
- */
-extern void udi_buf_free(udi_buf_t *buf);
-
-
-#endif
+++ /dev/null
-/**
- * \file udi_cb.h
- */
-#ifndef _UDI_CB_H_
-#define _UDI_CB_H_
-
-typedef struct udi_cb_s udi_cb_t;
-typedef void udi_cb_alloc_call_t(udi_cb_t *gcb, udi_cb_t *new_cb);
-typedef void udi_cb_alloc_batch_call_t(udi_cb_t *gcb, udi_cb_t *first_new_cb);
-typedef void udi_cancel_call_t(udi_cb_t *gcb);
-
-#define UDI_GCB(mcb) (&(mcb)->gcb)
-#define UDI_MCB(gcb, cb_type) ((cb_type *)(gcb))
-
-/**
- * \brief Describes a generic control block
- * \note Semi-opaque
- */
-struct udi_cb_s
-{
- /**
- * \brief Channel associated with the control block
- */
- udi_channel_t channel;
- /**
- * \brief Current state
- * \note Driver changable
- */
- void *context;
- /**
- * \brief CB's scratch area
- */
- void *scratch;
- /**
- * \brief ???
- */
- void *initiator_context;
- /**
- * \brief Request Handle?
- */
- udi_origin_t origin;
-};
-
-extern void udi_cb_alloc (
- udi_cb_alloc_call_t *callback,
- udi_cb_t *gcb,
- udi_index_t cb_idx,
- udi_channel_t default_channel
- );
-
-extern void udi_cb_alloc_dynamic(
- udi_cb_alloc_call_t *callback,
- udi_cb_t *gcb,
- udi_index_t cb_idx,
- udi_channel_t default_channel,
- udi_size_t inline_size,
- udi_layout_t *inline_layout
- );
-
-extern void udi_cb_alloc_batch(
- udi_cb_alloc_batch_call_t *callback,
- udi_cb_t *gcb,
- udi_index_t cb_idx,
- udi_index_t count,
- udi_boolean_t with_buf,
- udi_size_t buf_size,
- udi_buf_path_t path_handle
- );
-
-extern void udi_cb_free(udi_cb_t *cb);
-
-extern void udi_cancel(udi_cancel_call_t *callback, udi_cb_t *gcb);
-
-
-
-
-#endif
+++ /dev/null
-/**
- * \file udi_imc.h
- * \brief Inter-Module Communication
- */
-#ifndef _UDI_IMC_H_
-#define _UDI_IMC_H_
-
-typedef void udi_channel_anchor_call_t(udi_cb_t *gcb, udi_channel_t anchored_channel);
-typedef void udi_channel_spawn_call_t(udi_cb_t *gcb, udi_channel_t new_channel);
-
-typedef struct udi_channel_event_cb_s udi_channel_event_cb_t;
-
-typedef void udi_channel_event_ind_op_t(udi_channel_event_cb_t *cb);
-
-/**
- * \brief Anchors a channel end to the current region
- */
-extern void udi_channel_anchor(
- udi_channel_anchor_call_t *callback, udi_cb_t *gcb,
- udi_channel_t channel, udi_index_t ops_idx, void *channel_context
- );
-
-/**
- * \brief Created a new channel between two regions
- */
-extern void udi_channel_spawn(
- udi_channel_spawn_call_t *callback,
- udi_cb_t *gcb,
- udi_channel_t channel,
- udi_index_t spawn_idx,
- udi_index_t ops_idx,
- void *channel_context
- );
-
-/**
- * \brief Attaches a new context pointer to the current channel
- */
-extern void udi_channel_set_context(
- udi_channel_t target_channel,
- void *channel_context
- );
-/**
- * \brief
- */
-extern void udi_channel_op_abort(
- udi_channel_t target_channel,
- udi_cb_t *orig_cb
- );
-
-/**
- * \brief Closes an open channel
- */
-extern void udi_channel_close(udi_channel_t channel);
-
-/**
- * \brief Describes a channel event
- */
-struct udi_channel_event_cb_s
-{
- udi_cb_t gcb;
- udi_ubit8_t event;
- union {
- struct {
- udi_cb_t *bind_cb;
- } internal_bound;
- struct {
- udi_cb_t *bind_cb;
- udi_ubit8_t parent_ID;
- udi_buf_path_t *path_handles;
- } parent_bound;
- udi_cb_t *orig_cb;
- } params;
-};
-/* Channel event types */
-#define UDI_CHANNEL_CLOSED 0
-#define UDI_CHANNEL_BOUND 1
-#define UDI_CHANNEL_OP_ABORTED 2
-
-/**
- * \brief Proxy function
- */
-extern void udi_channel_event_ind(udi_channel_event_cb_t *cb);
-
-/**
- * \brief Called when channel event is completed
- */
-extern void udi_channel_event_complete(
- udi_channel_event_cb_t *cb, udi_status_t status
- );
-
-
-#endif
+++ /dev/null
-/**
- * \file udi_init.h
- */
-#ifndef _UDI_INIT_H_
-#define _UDI_INIT_H_
-
-typedef struct udi_init_s udi_init_t;
-typedef struct udi_primary_init_s udi_primary_init_t;
-typedef struct udi_secondary_init_s udi_secondary_init_t;
-typedef struct udi_ops_init_s udi_ops_init_t;
-typedef struct udi_cb_init_s udi_cb_init_t;
-typedef struct udi_cb_select_s udi_cb_select_t;
-typedef struct udi_gcb_init_s udi_gcb_init_t;
-
-typedef struct udi_init_context_s udi_init_context_t;
-typedef struct udi_limits_s udi_limits_t;
-typedef struct udi_chan_context_s udi_chan_context_t;
-typedef struct udi_child_chan_context_s udi_child_chan_context_t;
-
-typedef void udi_op_t(void);
-typedef udi_op_t * const udi_ops_vector_t;
-
-/**
- * \brief UDI Initialisation Structure
- *
- * Defines how to initialise and use a UDI driver
- */
-struct udi_init_s
-{
- /**
- * \brief Defines the primary region
- * \note For secondary modules this must be NULL
- */
- udi_primary_init_t *primary_init_info;
-
- /**
- * \brief Defines all secondary regions
- * Pointer to a list (so, essentially an array) of ::udi_secondary_init_t
- * It is terminated by an entry with ::udi_secondary_init_t.region_idx
- * set to zero.
- * \note If NULL, it is to be treated as an empty list
- */
- udi_secondary_init_t *secondary_init_list;
-
- /**
- * \brief Channel operations
- * Pointer to a ::udi_ops_init_t.ops_idx == 0 terminated list that
- * defines the channel opterations usage for each ops vector implemented
- * in this module.
- * \note Must contain at least one entry for each metalanguage used
- */
- udi_ops_init_t *ops_init_list;
-
- /**
- * \brief Control Blocks
- */
- udi_cb_init_t *cb_init_list;
-
- /**
- * \brief Generic Control Blocks
- */
- udi_gcb_init_t *gcb_init_list;
-
- /**
- * \brief Overrides for control blocks
- * Allows a control block to override the ammount of scratch space it
- * gets for a specific ops vector.
- */
- udi_cb_select_t *cb_select_list;
-};
-
-
-/**
- * \name Flags for ::udi_primary_init_t.mgmt_op_flags
- * \{
- */
-
-/**
- * \brief Tells the environment that this operation may take some time
- * Used as a hint in scheduling tasks
- */
-#define UDI_OP_LONG_EXEC 0x01
-
-/**
- * \}
- */
-
-/**
- * \brief Describes the Primary Region
- * Tells the environment how to set up the driver's primary region.
- */
-struct udi_primary_init_s
-{
- /**
- * \brief Management Ops Vector
- * Pointer to a list of functions for the Management Metalanguage
- */
- udi_mgmt_ops_t *mgmt_ops;
-
- /**
- * \brief Flags for \a mgmt_ops
- * Each entry in \a mgmt_ops is acommanied by an entry in this array.
- * Each entry contains the flags that apply to the specified ops vector.
- * \see UDI_OP_LONG_EXEC
- */
- const udi_ubit8_t *mgmt_op_flags;
-
- /**
- * \brief Scratch space size
- * Specifies the number of bytes to allocate for each control block
- * passed by the environment.
- * \note must not exceed ::UDI_MAX_SCRATCH
- */
- udi_size_t mgmt_scratch_requirement;
-
- /**
- * \todo What is this?
- */
- udi_ubit8_t enumeration_attr_list_length;
-
- /**
- * \brief Size in bytes to allocate to each instance of the primary
- * region
- * Essentially the size of the driver's instance state
- * \note Must be at least sizeof(udi_init_context_t) and not more
- * than UDI_MIN_ALLOC_LIMIT
- */
- udi_size_t rdata_size;
-
- /**
- * \brief Size in bytes to allocate for each call to ::udi_enumerate_req
- * \note Must not exceed UDI_MIN_ALLOC_LIMIT
- */
- udi_size_t child_data_size;
-
- /**
- * \brief Number of path handles for each parent bound to this driver
- * \todo What the hell are path handles?
- */
- udi_ubit8_t per_parent_paths;
-};
-
-/**
- * \brief Tells the environment how to create a secondary region
- */
-struct udi_secondary_init_s
-{
- /**
- * \brief Region Index
- * Non-zero driver-dependent index value that identifies the region
- * \note This corresponds to a "region" declaration in the udiprops.txt
- * file.
- */
- udi_index_t region_idx;
- /**
- * \brief Number of bytes to allocate
- *
- * \note Again, must be between sizeof(udi_init_context_t) and
- * UDI_MIN_ALLOC_LIMIT
- */
- udi_size_t rdata_size;
-};
-
-/**
- * \brief Defines channel endpoints (ways of communicating with the driver)
- *
- */
-struct udi_ops_init_s
-{
- /**
- * \brief ops index number
- * Used to uniquely this entry
- * \note If this is zero, it marks the end of the list
- */
- udi_index_t ops_idx;
- /**
- * \brief Metalanguage Index
- * Defines what metalanguage is used
- */
- udi_index_t meta_idx;
- /**
- * \brief Metalanguage Operation
- * Defines what metalanguage operation is used
- */
- udi_index_t meta_ops_num;
- /**
- * \brief Size of the context area
- * \note If non-zero, must be at least
- */
- udi_size_t chan_context_size;
- /**
- * \brief Pointer to the operations
- * Pointer to a <<meta>>_<<role>>_ops_t structure
- */
- udi_ops_vector_t *ops_vector;
- /**
- * \brief Flags for each entry in \a ops_vector
- */
- const udi_ubit8_t *op_flags;
-};
-
-/**
- * \brief Defines control blocks
- * Much the same as ::udi_ops_init_t
- */
-struct udi_cb_init_s
-{
- udi_index_t cb_idx;
- udi_index_t meta_idx;
- udi_index_t meta_cb_num;
- udi_size_t scratch_requirement;
- /**
- * \brief Size of inline memory
- */
- udi_size_t inline_size;
- /**
- * \brief Layout of inline memory
- */
- udi_layout_t *inline_layout;
-};
-
-/**
- * \brief Overrides the scratch size for an operation
- */
-struct udi_cb_select_s
-{
- udi_index_t ops_idx;
- udi_index_t cb_idx;
-};
-
-/**
- * \brief General Control Blocks
- * These control blocks can only be used as general data storage, not
- * for any channel operations.
- */
-struct udi_gcb_init_s
-{
- udi_index_t cb_idx;
- udi_size_t scratch_requirement;
-};
-
-
-// ===
-// ===
-/**
- * \brief Environement Imposed Limits
- */
-struct udi_limits_s
-{
- /**
- * \brief Maximum legal ammount of memory that can be allocated
- */
- udi_size_t max_legal_alloc;
-
- /**
- * \brief Maximum ammount of guaranteed memory
- */
- udi_size_t max_safe_alloc;
- /**
- * \brief Maximum size of the final string from ::udi_trace_write
- * or ::udi_log_write
- */
- udi_size_t max_trace_log_formatted_len;
- /**
- * \brief Maximum legal size of an instanct attribute value
- */
- udi_size_t max_instance_attr_len;
- /**
- * \brief Minumum time difference (in nanoseconds between unique values
- * returned by ::udi_time_current
- */
- udi_ubit32_t min_curtime_res;
- /**
- * \brief Minimum resolution of timers
- * \see ::udi_timer_start_repeating, ::udi_timer_start
- */
- udi_ubit32_t min_timer_res;
-};
-
-/**
- * \brief Primary Region Context data
- */
-struct udi_init_context_s
-{
- udi_index_t region_idx;
- udi_limits_t limits;
-};
-
-/**
- * \brief Channel context data
- */
-struct udi_chan_context_s
-{
- /**
- * \brief Pointer to the driver instance's initial region data
- */
- void *rdata;
-};
-
-/**
- * \brief Child Channel context
- */
-struct udi_child_chan_context_s
-{
- /**
- * \brief Pointer to the driver instance's initial region data
- */
- void *rdata;
- /**
- * \brief Some sort of unique ID number
- */
- udi_ubit32_t child_ID;
-};
-
-#endif
+++ /dev/null
-/**
- * \file udi_log.h
- */
-#ifndef _UDI_LOG_H_
-#define _UDI_LOG_H_
-
-// Required Files
-#include "udi_cb.h"
-
-/**
- * \brief Trace Event
- */
-typedef udi_ubit32_t udi_trevent_t;
-
-/**
- * \brief Log Callback
- */
-typedef void udi_log_write_call_t(udi_cb_t *gcb, udi_status_t correlated_status);
-
-/**
- * \name Log Severities
- * \brief Values for severity
- * \{
- */
-#define UDI_LOG_DISASTER 1
-#define UDI_LOG_ERROR 2
-#define UDI_LOG_WARNING 3
-#define UDI_LOG_INFORMATION 4
-/**
- * \}
- */
-
-
-#endif
+++ /dev/null
-/**
- * \file udi_mem.h
- */
-#ifndef _UDI_MEM_H_
-#define _UDI_MEM_H_
-
-/**
- * \brief Callback type for ::udi_mem_alloc
- */
-typedef void udi_mem_alloc_call_t(udi_cb_t *gcb, void *new_mem);
-
-/**
- * \brief Allocate memory
- */
-extern void udi_mem_alloc(
- udi_mem_alloc_call_t *callback,
- udi_cb_t *gcb,
- udi_size_t size,
- udi_ubit8_t flags
- );
-
-/**
- * \brief Values for ::udi_mem_alloc \a flags
- * \{
- */
-#define UDI_MEM_NOZERO (1U<<0) //!< No need to zero the memory
-#define UDI_MEM_MOVABLE (1U<<1) //!< Globally accessable memory?
-/**
- * \}
- */
-
-/**
- * \brief Free allocated memory
- */
-extern void udi_mem_free(void *target_mem);
-
-
-#endif
+++ /dev/null
-/**
- * \file udi_meta_gio.h
- */
-#ifndef _UDI_META_GIO_H_
-#define _UDI_META_GIO_H_
-
-#include <udi_imc.h>
-#include <udi_buf.h>
-
-typedef const struct udi_gio_provider_ops_s udi_gio_provider_ops_t;
-typedef const struct udi_gio_client_ops_s udi_gio_client_ops_t;
-typedef struct udi_gio_bind_cb_s udi_gio_bind_cb_t;
-typedef struct udi_gio_xfer_cb_s udi_gio_xfer_cb_t;
-typedef struct udi_gio_rw_params_s udi_gio_rw_params_t;
-typedef struct udi_gio_event_cb_s udi_gio_event_cb_t;
-
-typedef void udi_gio_bind_req_op_t(udi_gio_bind_cb_t *cb);
-typedef void udi_gio_unbind_req_op_t(udi_gio_bind_cb_t *cb);
-typedef void udi_gio_xfer_req_op_t(udi_gio_bind_cb_t *cb);
-typedef void udi_gio_event_res_op_t(udi_gio_bind_cb_t *cb);
-
-typedef void udi_gio_bind_ack_op_t(
- udi_gio_bind_cb_t *cb,
- udi_ubit32_t device_size_lo,
- udi_ubit32_t device_size_hi,
- udi_status_t status
- );
-typedef void udi_gio_unbind_ack_op_t(udi_gio_bind_cb_t *cb);
-typedef void udi_gio_xfer_ack_op_t(udi_gio_bind_cb_t *cb);
-typedef void udi_gio_xfer_nak_op_t(udi_gio_bind_cb_t *cb, udi_status_t status);
-typedef void udi_gio_event_ind_op_t(udi_gio_bind_cb_t *cb);
-
-typedef udi_ubit8_t udi_gio_op_t;
-/* Limit values for udi_gio_op_t */
-#define UDI_GIO_OP_CUSTOM 16
-#define UDI_GIO_OP_MAX 64
-/* Direction flag values for op */
-#define UDI_GIO_DIR_READ (1U<<6)
-#define UDI_GIO_DIR_WRITE (1U<<7)
-/* Standard Operation Codes */
-#define UDI_GIO_OP_READ UDI_GIO_DIR_READ
-#define UDI_GIO_OP_WRITE UDI_GIO_DIR_WRITE
-
-
-
-struct udi_gio_provider_ops_s
-{
- udi_channel_event_ind_op_t *channel_event_ind_op;
- udi_gio_bind_req_op_t *gio_bind_req_op;
- udi_gio_unbind_req_op_t *gio_unbind_req_op;
- udi_gio_xfer_req_op_t *gio_xfer_req_op;
- udi_gio_event_res_op_t *gio_event_res_op;
-};
-/* Ops Vector Number */
-#define UDI_GIO_PROVIDER_OPS_NUM 1
-
-struct udi_gio_client_ops_s
-{
- udi_channel_event_ind_op_t *channel_event_ind_op;
- udi_gio_bind_ack_op_t *gio_bind_ack_op;
- udi_gio_unbind_ack_op_t *gio_unbind_ack_op;
- udi_gio_xfer_ack_op_t *gio_xfer_ack_op;
- udi_gio_xfer_nak_op_t *gio_xfer_nak_op;
- udi_gio_event_ind_op_t *gio_event_ind_op;
-};
-/* Ops Vector Number */
-#define UDI_GIO_CLIENT_OPS_NUM 2
-
-struct udi_gio_bind_cb_s
-{
- udi_cb_t gcb;
- udi_xfer_constraints_t xfer_constraints;
-};
-/* Control Block Group Number */
-#define UDI_GIO_BIND_CB_NUM 1
-
-
-struct udi_gio_xfer_cb_s
-{
- udi_cb_t gcb;
- udi_gio_op_t op;
- void *tr_params;
- udi_buf_t *data_buf;
-};
-/* Control Block Group Number */
-#define UDI_GIO_XFER_CB_NUM 2
-
-struct udi_gio_rw_params_s
-{
- udi_ubit32_t offset_lo;
- udi_ubit32_t offset_hi;
-};
-
-struct udi_gio_event_cb_s
-{
- udi_cb_t gcb;
- udi_ubit8_t event_code;
- void *event_params;
-};
-/* Control Block Group Number */
-#define UDI_GIO_EVENT_CB_NUM 3
-
-
-extern void udi_gio_bind_req(udi_gio_bind_cb_t *cb);
-extern void udi_gio_bind_ack(
- udi_gio_bind_cb_t *cb,
- udi_ubit32_t device_size_lo,
- udi_ubit32_t device_size_hi,
- udi_status_t status
- );
-
-extern void udi_gio_unbind_req(udi_gio_bind_cb_t *cb);
-extern void udi_gio_unbind_ack(udi_gio_bind_cb_t *cb);
-
-extern void udi_gio_xfer_req(udi_gio_xfer_cb_t *cb);
-extern void udi_gio_xfer_ack(udi_gio_xfer_cb_t *cb);
-extern void udi_gio_xfer_nak(udi_gio_xfer_cb_t *cb, udi_status_t status);
-
-extern void udi_gio_event_res(udi_gio_event_cb_t *cb);
-extern void udi_gio_event_ind(udi_gio_event_cb_t *cb);
-extern void udi_gio_event_res_unused(udi_gio_event_cb_t *cb);
-
-#endif
+++ /dev/null
-/**
- * \file udi_meta_mgmt.h
- */
-#ifndef _UDI_META_MGMT_H_
-#define _UDI_META_MGMT_H_
-
-typedef struct udi_mgmt_ops_s udi_mgmt_ops_t;
-typedef struct udi_mgmt_cb_s udi_mgmt_cb_t;
-typedef struct udi_usage_cb_s udi_usage_cb_t;
-typedef struct udi_filter_element_s udi_filter_element_t;
-typedef struct udi_enumerate_cb_s udi_enumerate_cb_t;
-
-/**
- * \name Specify Usage
- * \{
- */
-typedef void udi_usage_ind_op_t(udi_usage_cb_t *cb, udi_ubit8_t resource_level);
-/* Values for resource_level */
-#define UDI_RESOURCES_CRITICAL 1
-#define UDI_RESOURCES_LOW 2
-#define UDI_RESOURCES_NORMAL 3
-#define UDI_RESOURCES_PLENTIFUL 4
-/* Proxy */
-extern udi_usage_ind_op_t udi_static_usage;
-/**
- * \}
- */
-
-typedef void udi_usage_res_op_t(udi_usage_cb_t *cb);
-
-/**
- * \name Enumerate this driver
- * \{
- */
-typedef void udi_enumerate_req_op_t(udi_enumerate_cb_t *cb, udi_ubit8_t enumeration_level);
-/* Values for enumeration_level */
-#define UDI_ENUMERATE_START 1
-#define UDI_ENUMERATE_START_RESCAN 2
-#define UDI_ENUMERATE_NEXT 3
-#define UDI_ENUMERATE_NEW 4
-#define UDI_ENUMERATE_DIRECTED 5
-#define UDI_ENUMERATE_RELEASE 6
-/* Proxy */
-extern udi_enumerate_req_op_t udi_enumerate_no_children;
-/**
- * \}
- */
-
-/**
- * \name Enumeration Acknowlagement
- * \{
- */
-typedef void udi_enumerate_ack_op_t(udi_enumerate_cb_t *cb, udi_ubit8_t enumeration_result, udi_index_t ops_idx);
-/* Values for enumeration_result */
-#define UDI_ENUMERATE_OK 0
-#define UDI_ENUMERATE_LEAF 1
-#define UDI_ENUMERATE_DONE 2
-#define UDI_ENUMERATE_RESCAN 3
-#define UDI_ENUMERATE_REMOVED 4
-#define UDI_ENUMERATE_REMOVED_SELF 5
-#define UDI_ENUMERATE_RELEASED 6
-#define UDI_ENUMERATE_FAILED 255
-/**
- * \}
- */
-
-/**
- * \name
- * \{
- */
-typedef void udi_devmgmt_req_op_t(udi_mgmt_cb_t *cb, udi_ubit8_t mgmt_op, udi_ubit8_t parent_ID);
-
-typedef void udi_devmgmt_ack_op_t(udi_mgmt_cb_t *cb, udi_ubit8_t flags, udi_status_t status);
-/**
- * \}
- */
-typedef void udi_final_cleanup_req_op_t(udi_mgmt_cb_t *cb);
-typedef void udi_final_cleanup_ack_op_t(udi_mgmt_cb_t *cb);
-
-
-
-
-
-struct udi_mgmt_ops_s
-{
- udi_usage_ind_op_t *usage_ind_op;
- udi_enumerate_req_op_t *enumerate_req_op;
- udi_devmgmt_req_op_t *devmgmt_req_op;
- udi_final_cleanup_req_op_t *final_cleanup_req_op;
-};
-
-struct udi_mgmt_cb_s
-{
- udi_cb_t gcb;
-};
-
-struct udi_usage_cb_s
-{
- udi_cb_t gcb;
- udi_trevent_t trace_mask;
- udi_index_t meta_idx;
-};
-
-
-struct udi_filter_element_s
-{
- char attr_name[UDI_MAX_ATTR_NAMELEN];
- udi_ubit8_t attr_min[UDI_MAX_ATTR_SIZE];
- udi_ubit8_t attr_min_len;
- udi_ubit8_t attr_max[UDI_MAX_ATTR_SIZE];
- udi_ubit8_t attr_max_len;
- udi_instance_attr_type_t attr_type;
- udi_ubit32_t attr_stride;
-};
-struct udi_enumerate_cb_s
-{
- udi_cb_t gcb;
- udi_ubit32_t child_ID;
- void *child_data;
- udi_instance_attr_list_t *attr_list;
- udi_ubit8_t attr_valid_length;
- const udi_filter_element_t *filter_list;
- udi_ubit8_t filter_list_length;
- udi_ubit8_t parent_ID;
-};
-/* Special parent_ID filter values */
-#define UDI_ANY_PARENT_ID 0
-
-/**
- * \brief
- */
-extern void udi_devmgmt_req(udi_mgmt_cb_t *cb, udi_ubit8_t mgmt_op, udi_ubit8_t parent_ID );
-/**
- * \brief Values for ::udi_devmgmt_req \a mgmt_op
- */
-enum eDMGMT
-{
- UDI_DMGMT_PREPARE_TO_SUSPEND = 1,
- UDI_DMGMT_SUSPEND,
- UDI_DMGMT_SHUTDOWN,
- UDI_DMGMT_PARENT_SUSPENDED,
- UDI_DMGMT_RESUME,
- UDI_DMGMT_UNBIND
-};
-
-extern void udi_devmgmt_ack(udi_mgmt_cb_t *cb, udi_ubit8_t flags, udi_status_t status);
-//!\brief Values for flags
-#define UDI_DMGMT_NONTRANSPARENT (1U<<0)
-//!\brief Meta-Specific Status Codes
-#define UDI_DMGMT_STAT_ROUTING_CHANGE (UDI_STAT_META_SPECIFIC|1)
-
-extern void udi_final_cleanup_req(udi_mgmt_cb_t *cb);
-extern void udi_final_cleanup_ack(udi_mgmt_cb_t *cb);
-
-
-#endif
--- /dev/null
+/**
+ * \file udi_physio.h
+ */
+#ifndef _UDI_PHYSIO_H_
+#define _UDI_PHYSIO_H_
+
+#include <udi.h>
+
+// === TYPEDEFS ===
+// DMA Core
+typedef _udi_handle_t udi_dma_handle_t;
+#define UDI_NULL_DMA_HANDLE _NULL_HANDLE
+typedef Uint64 udi_busaddr64_t; //!< \note Opaque
+typedef struct udi_scgth_element_32_s udi_scgth_element_32_t;
+typedef struct udi_scgth_element_64_s udi_scgth_element_64_t;
+typedef struct udi_scgth_s udi_scgth_t;
+typedef _udi_handle_t udi_dma_constraints_t;
+#define UDI_NULL_DMA_CONSTRAINTS _NULL_HANDLE
+/**
+ * \name DMA constraints attributes
+ * \{
+ */
+typedef udi_ubit8_t udi_dma_constraints_attr_t;
+/* DMA Convenience Attribute Codes */
+#define UDI_DMA_ADDRESSABLE_BITS 100
+#define UDI_DMA_ALIGNMENT_BITS 101
+/* DMA Constraints on the Entire Transfer */
+#define UDI_DMA_DATA_ADDRESSABLE_BITS 110
+#define UDI_DMA_NO_PARTIAL 111
+/* DMA Constraints on the Scatter/Gather List */
+#define UDI_DMA_SCGTH_MAX_ELEMENTS 120
+#define UDI_DMA_SCGTH_FORMAT 121
+#define UDI_DMA_SCGTH_ENDIANNESS 122
+#define UDI_DMA_SCGTH_ADDRESSABLE_BITS 123
+#define UDI_DMA_SCGTH_MAX_SEGMENTS 124
+/* DMA Constraints on Scatter/Gather Segments */
+#define UDI_DMA_SCGTH_ALIGNMENT_BITS 130
+#define UDI_DMA_SCGTH_MAX_EL_PER_SEG 131
+#define UDI_DMA_SCGTH_PREFIX_BYTES 132
+/* DMA Constraints on Scatter/Gather Elements */
+#define UDI_DMA_ELEMENT_ALIGNMENT_BITS 140
+#define UDI_DMA_ELEMENT_LENGTH_BITS 141
+#define UDI_DMA_ELEMENT_GRANULARITY_BITS 142
+/* DMA Constraints for Special Addressing */
+#define UDI_DMA_ADDR_FIXED_BITS 150
+#define UDI_DMA_ADDR_FIXED_TYPE 151
+#define UDI_DMA_ADDR_FIXED_VALUE_LO 152
+#define UDI_DMA_ADDR_FIXED_VALUE_HI 153
+/* DMA Constraints on DMA Access Behavior */
+#define UDI_DMA_SEQUENTIAL 160
+#define UDI_DMA_SLOP_IN_BITS 161
+#define UDI_DMA_SLOP_OUT_BITS 162
+#define UDI_DMA_SLOP_OUT_EXTRA 163
+#define UDI_DMA_SLOP_BARRIER_BITS 164
+/* Values for UDI_DMA_SCGTH_ENDIANNESS */
+#define UDI_DMA_LITTLE_ENDIAN (1U<<6)
+#define UDI_DMA_BIG_ENDIAN (1U<<5)
+/* Values for UDI_DMA_ADDR_FIXED_TYPE */
+#define UDI_DMA_FIXED_ELEMENT 1
+/**
+ * \}
+ */
+// DMA Constraints Management
+typedef struct udi_dma_constraints_attr_spec_s udi_dma_constraints_attr_spec_t;
+typedef void udi_dma_constraints_attr_set_call_t(
+ udi_cb_t *gcb, udi_dma_constraints_t new_constraints, udi_status_t status
+ );
+typedef struct udi_dma_limits_s udi_dma_limits_t;
+
+
+// === STRUCTURES ===
+// --- DMA Constraints Management ---
+struct udi_dma_constraints_attr_spec_s
+{
+ udi_dma_constraints_attr_t attr_type;
+ udi_ubit32_t attr_value;
+};
+// --- DMA Core ---
+struct udi_dma_limits_s
+{
+ udi_size_t max_legal_contig_alloc;
+ udi_size_t max_safe_contig_alloc;
+ udi_size_t cache_line_size;
+};
+struct udi_scgth_element_32_s
+{
+ udi_ubit32_t block_busaddr;
+ udi_ubit32_t block_length;
+};
+struct udi_scgth_element_64_s
+{
+ udi_busaddr64_t block_busaddr;
+ udi_ubit32_t block_length;
+ udi_ubit32_t el_reserved;
+};
+/* Extension Flag */
+#define UDI_SCGTH_EXT 0x80000000
+struct udi_scgth_s
+{
+ udi_ubit16_t scgth_num_elements;
+ udi_ubit8_t scgth_format;
+ udi_boolean_t scgth_must_swap;
+ union {
+ udi_scgth_element_32_t *el32p;
+ udi_scgth_element_64_t *el64p;
+ } scgth_elements;
+ union {
+ udi_scgth_element_32_t el32;
+ udi_scgth_element_64_t el64;
+ } scgth_first_segment;
+};
+/* Values for scgth_format */
+#define UDI_SCGTH_32 (1U<<0)
+#define UDI_SCGTH_64 (1U<<1)
+#define UDI_SCGTH_DMA_MAPPED (1U<<6)
+#define UDI_SCGTH_DRIVER_MAPPED (1U<<7)
+
+
+
+// === FUNCTIONS ===
+// --- DMA Constraints Management ---
+extern void udi_dma_constraints_attr_set(
+ udi_dma_constraints_attr_set_call_t *callback,
+ udi_cb_t *gcb,
+ udi_dma_constraints_t src_constraints,
+ const udi_dma_constraints_attr_spec_t *attr_list,
+ udi_ubit16_t list_length,
+ udi_ubit8_t flags
+ );
+/* Constraints Flags */
+#define UDI_DMA_CONSTRAINTS_COPY (1U<<0)
+
+extern void udi_dma_constraints_attr_reset(
+ udi_dma_constraints_t constraints,
+ udi_dma_constraints_attr_t attr_type
+ );
+
+extern void udi_dma_constraints_free(udi_dma_constraints_t constraints);
+
+#include <physio/meta_intr.h>
+#include <physio/meta_bus.h>
+
+
+#endif
+++ /dev/null
-/**
- * \file udi_strmem.h
- */
-#ifndef _UDI_STRMEM_H_
-#define _UDI_STRMEM_H_
-
-/**
- * \brief Gets the length of a C style string
- */
-extern udi_size_t udi_strlen(const char *s);
-
-/**
- * \brief Appends to a string
- */
-extern char *udi_strcat(char *s1, const char *s2);
-extern char *udi_strncat(char *s1, const char *s2, udi_size_t n);
-
-/**
- * \brief Compares Strings/Memory
- */
-extern udi_sbit8_t udi_strcmp(const char *s1, const char *s2);
-extern udi_sbit8_t udi_strncmp(const char *s1, const char *s2, udi_size_t n);
-extern udi_sbit8_t udi_memcmp(const void *s1, const void *s2, udi_size_t n);
-
-extern char *udi_strcpy(char *s1, const char *s2);
-extern char *udi_strncpy(char *s1, const char *s2, udi_size_t n);
-extern void *udi_memcpy(void *s1, const void *s2, udi_size_t n);
-extern void *udi_memmove(void *s1, const void *s2, udi_size_t n);
-
-extern char *udi_strncpy_rtrim(char *s1, const char *s2, udi_size_t n);
-
-extern char *udi_strchr(const char *s, char c);
-extern char *udi_strrchr(const char *s, char c);
-extern void *udi_memchr (const void *s, udi_ubit8_t c, udi_size_t n);
-
-extern void *udi_memset(void *s, udi_ubit8_t c, udi_size_t n);
-extern udi_ubit32_t udi_strtou32(const char *s, char **endptr, int base);
-
-
-extern udi_size_t udi_snprintf(char *s, udi_size_t max_bytes, const char *format, ...);
-
-
-
-#endif
int udiprops_size;
int i, j;
+ Log("UDI_LoadDriver: (Base=%p)", Base);
+
if( Binary_FindSymbol(Base, "udi_init_info", (Uint*)&info) == 0) {
Binary_Unload(Base);
return 0;
*/
#include <acess.h>
#include <udi.h>
-#include <udi_mem.h>
+
+// === EXPORTS ===
+EXPORT(udi_mem_alloc);
+EXPORT(udi_mem_free);
// === CODE ===
void udi_mem_alloc(
{
free(target_mem);
}
-
-// === EXPORTS ===
-EXPORT(udi_mem_alloc);
-EXPORT(udi_mem_free);
*/
#include <acess.h>
#include <udi.h>
-#include <udi_meta_gio.h>
// === EXPORTS ===
EXPORT(udi_gio_bind_req);
*/
#include <acess.h>
#include <udi.h>
-#include <udi_meta_mgmt.h>
+
+// === EXPORTS ===
+EXPORT(udi_devmgmt_req);
+EXPORT(udi_devmgmt_ack);
+EXPORT(udi_final_cleanup_req);
+EXPORT(udi_final_cleanup_ack);
+EXPORT(udi_static_usage);
+EXPORT(udi_enumerate_no_children);
// === CODE ===
void udi_devmgmt_req(udi_mgmt_cb_t *cb, udi_ubit8_t mgmt_op, udi_ubit8_t parent_ID )
LEAVE('-');
}
-// === EXPORTS ===
-EXPORT(udi_devmgmt_req);
-EXPORT(udi_devmgmt_ack);
-EXPORT(udi_final_cleanup_req);
-EXPORT(udi_final_cleanup_ack);
+void udi_static_usage(udi_usage_cb_t *cb, udi_ubit8_t resource_level)
+{
+ UNIMPLEMENTED();
+}
+
+void udi_enumerate_no_children(udi_enumerate_cb_t *cb, udi_ubit8_t enumeration_level)
+{
+ UNIMPLEMENTED();
+}
--- /dev/null
+/**
+ * \file physio.c
+ * \author John Hodge (thePowersGang)
+ */
+#include <acess.h>
+#include <udi.h>
+#include <udi_physio.h>
+
+// === EXPORTS ===
+EXPORT(udi_dma_constraints_attr_reset);
+EXPORT(udi_dma_constraints_free);
+
+// === CODE ===
+void udi_dma_constraints_attr_reset(
+ udi_dma_constraints_t constraints,
+ udi_dma_constraints_attr_t attr_type
+ )
+{
+ UNIMPLEMENTED();
+}
+
+void udi_dma_constraints_free(udi_dma_constraints_t constraints)
+{
+ UNIMPLEMENTED();
+}
--- /dev/null
+/**
+ * \file physio/meta_bus.c
+ * \author John Hodge (thePowersGang)
+ */
+#include <acess.h>
+#include <udi.h>
+#include <udi_physio.h>
+
+// === EXPORTS ===
+EXPORT(udi_bus_unbind_req);
+EXPORT(udi_bus_unbind_ack);
+EXPORT(udi_bus_bind_req);
+EXPORT(udi_bus_bind_ack);
+
+// === CODE ===
+void udi_bus_unbind_req(udi_bus_bind_cb_t *cb)
+{
+ UNIMPLEMENTED();
+}
+void udi_bus_unbind_ack(udi_bus_bind_cb_t *cb)
+{
+ UNIMPLEMENTED();
+}
+
+void udi_bus_bind_req(udi_bus_bind_cb_t *cb)
+{
+ UNIMPLEMENTED();
+}
+
+void udi_bus_bind_ack(
+ udi_bus_bind_cb_t *cb,
+ udi_dma_constraints_t dma_constraints,
+ udi_ubit8_t preferred_endianness,
+ udi_status_t status
+ )
+{
+ UNIMPLEMENTED();
+}
--- /dev/null
+/**
+ * \file physio/meta_intr.c
+ * \author John Hodge (thePowersGang)
+ */
+#include <acess.h>
+#include <udi.h>
+#include <udi_physio.h>
+
+// === EXPORTS ===
+EXPORT(udi_intr_attach_req);
+EXPORT(udi_intr_attach_ack);
+EXPORT(udi_intr_attach_ack_unused);
+EXPORT(udi_intr_detach_req);
+EXPORT(udi_intr_detach_ack);
+EXPORT(udi_intr_detach_ack_unused);
+EXPORT(udi_intr_event_ind);
+
+// === CODE ===
+void udi_intr_attach_req(udi_intr_attach_cb_t *intr_attach_cb)
+{
+ UNIMPLEMENTED();
+}
+void udi_intr_attach_ack(udi_intr_attach_cb_t *intr_attach_cb, udi_status_t status)
+{
+ UNIMPLEMENTED();
+}
+void udi_intr_attach_ack_unused(udi_intr_attach_cb_t *intr_attach_cb, udi_status_t status)
+{
+ UNIMPLEMENTED();
+}
+
+void udi_intr_detach_req(udi_intr_detach_cb_t *intr_detach_cb)
+{
+ UNIMPLEMENTED();
+}
+void udi_intr_detach_ack(udi_intr_detach_cb_t *intr_detach_cb)
+{
+ UNIMPLEMENTED();
+}
+void udi_intr_detach_ack_unused(udi_intr_detach_cb_t *intr_detach_cb)
+{
+ UNIMPLEMENTED();
+}
+
+void udi_intr_event_ind(udi_intr_event_cb_t *intr_event_cb, udi_ubit8_t flags)
+{
+ UNIMPLEMENTED();
+}
*/
#include <acess.h>
#include <udi.h>
-#include <udi_strmem.h>
+
+// === EXPORTS ===
+EXPORT(udi_snprintf);
// === CODE ===
udi_size_t udi_snprintf(char *s, udi_size_t max_bytes, const char *format, ...)
s[0] = '\0';
return 0;
}
-
-// === EXPORTS ===
-EXPORT(udi_snprintf);