#
#
-CPPFLAGS = -I../../../../UDI/include
+CPPFLAGS = -I../../../../UDI/include -Iinclude
# - UDI Library Files
-LIB_OBJS := logging.o strmem.o imc.o mem.o buf.o cb.o
-LIB_OBJS += queues.o time.o attr.o
-LIB_OBJS += meta_mgmt.o meta_gio.o
+LIB_OBJS := core/logging.o core/strmem.o core/imc.o core/mem.o core/buf.o
+LIB_OBJS += core/queues.o core/time.o core/attr.o core/mei.o core/cb.o
+LIB_OBJS += core/meta_mgmt.o core/meta_gio.o
LIB_OBJS += physio.o physio/meta_bus.o physio/pio.o physio/dma.o
LIB_OBJS += scsi.o
LIB_OBJS += udi_nic.o
* - Prevents multiple non-dispatched operations on one channel
* TODO: This should actually lock the GCB, not the channel
*/
-#define LOCK_CHANNELS 1
+#define LOCK_CHANNELS 0
#define MAX_SPAWN_IDX 6
--- /dev/null
+/*
+ * Acess2 UDI Layer
+ * - By John Hodge (thePowersGang)
+ *
+ * trans_pci.h
+ * - PCI Translation Layer builtin driver
+ */
+#ifndef _TRANS_PCI_H_
+#define _TRANS_PCI_H_
+
+extern udi_init_t pci_init;
+extern const char pci_udiprops[];
+extern size_t pci_udiprops_size;
+
+#endif
+
--- /dev/null
+/*
+ * Acess2 UDI Layer
+ * - By John Hodge (thePowersGang)
+ *
+ * udi_internal.h
+ * - Definitions for opaque structures
+ */
+#ifndef _UDI_INTERNAL_H_
+#define _UDI_INTERNAL_H_
+
+#include <stdbool.h>
+
+#define NEW(type,extra) (type*)calloc(sizeof(type)extra,1)
+#define NEW_wA(type,fld,cnt) NEW(type,+(sizeof(((type*)NULL)->fld[0])*cnt))
+
+typedef struct sUDI_PropMessage tUDI_PropMessage;
+typedef struct sUDI_PropRegion tUDI_PropRegion;
+typedef struct sUDI_PropDevSpec tUDI_PropDevSpec;
+
+typedef const struct sUDI_MetaLang tUDI_MetaLang;
+
+typedef struct sUDI_MetaLangRef tUDI_MetaLangRef;
+typedef struct sUDI_BindOps tUDI_BindOps;
+
+typedef struct sUDI_DriverModule tUDI_DriverModule;
+typedef struct sUDI_DriverInstance tUDI_DriverInstance;
+typedef struct sUDI_DriverRegion tUDI_DriverRegion;
+
+typedef struct sUDI_ChildBinding tUDI_ChildBinding;
+
+struct sUDI_PropMessage
+{
+ int locale;
+ udi_ubit16_t index;
+ const char *string;
+};
+
+struct sUDI_PropRegion
+{
+ udi_index_t RegionIdx;
+ enum {
+ UDI_REGIONTYPE_NORMAL,
+ UDI_REGIONTYPE_FP,
+ } Type;
+ enum {
+ UDI_REGIONBINDING_STATIC,
+ UDI_REGIONBINDING_DYNAMIC,
+ } Binding;
+ enum {
+ UDI_REGIONPRIO_MED,
+ UDI_REGIONPRIO_LO,
+ UDI_REGIONPRIO_HI,
+ } Priority;
+ enum {
+ UDI_REGIONLATENCY_NONOVERRRUNABLE,
+ UDI_REGIONLATENCY_POWERFAIL,
+ UDI_REGIONLATENCY_OVERRUNNABLE,
+ UDI_REGIONLATENCY_RETRYABLE,
+ // non_overrunable
+ UDI_REGIONLATENCY_NONCTRITICAL,
+ } Latency;
+ udi_ubit32_t OverrunTime;
+
+ udi_index_t BindMeta;
+ udi_index_t PriBindOps;
+ udi_index_t SecBindOps;
+ udi_index_t BindCb;
+};
+
+struct sUDI_MetaLang
+{
+ const char *Name;
+ int nCbTypes;
+ struct {
+ udi_size_t Size;
+ udi_layout_t *Layout;
+ } CbTypes[];
+};
+
+struct sUDI_MetaLangRef
+{
+ udi_ubit8_t meta_idx;
+ const char *interface_name;
+ tUDI_MetaLang *metalang;
+ // TODO: pointer to metalanguage structure
+};
+
+struct sUDI_BindOps
+{
+ udi_ubit8_t meta_idx;
+ udi_ubit8_t region_idx;
+ udi_ubit8_t ops_idx;
+ udi_ubit8_t bind_cb_idx;
+};
+
+struct sUDI_PropDevSpec
+{
+ int MessageNum;
+ udi_ubit8_t MetaIdx;
+ tUDI_MetaLang *Metalang;
+ int nAttribs;
+ udi_instance_attr_list_t Attribs[];
+};
+
+struct sUDI_DriverModule
+{
+ tUDI_DriverModule *Next;
+ void *Base;
+
+ udi_init_t *InitInfo;
+
+ // Counts of arrays in InitInfo
+ int nCBInit;
+ int nOpsInit;
+
+ const char *ModuleName;
+ int nMessages;
+ tUDI_PropMessage *Messages; // Sorted list
+
+ int nRegionTypes;
+ tUDI_PropRegion *RegionTypes;
+
+ int nMetaLangs;
+ tUDI_MetaLangRef *MetaLangs;
+
+ int nParents;
+ tUDI_BindOps *Parents;
+
+ int nChildBindOps;
+ tUDI_BindOps *ChildBindOps;
+
+ int nDevices;
+ tUDI_PropDevSpec **Devices;
+
+ int nRegions;
+};
+
+struct sUDI_DriverInstance
+{
+ struct sUDI_DriverInstance *Next;
+ tUDI_DriverModule *Module;
+ udi_channel_t ManagementChannel;
+ tUDI_DriverInstance *Parent;
+ tUDI_ChildBinding *ParentChildBinding;
+
+ tUDI_ChildBinding *FirstChild;
+ tUDI_DriverRegion *Regions[];
+};
+
+struct sUDI_DriverRegion
+{
+ udi_init_context_t *InitContext;
+};
+
+struct sUDI_ChildBinding
+{
+ tUDI_ChildBinding *Next;
+
+ udi_ubit32_t ChildID;
+ tUDI_MetaLang *Metalang;
+ tUDI_BindOps *BindOps;
+
+ udi_ops_init_t *Ops;
+ tUDI_DriverInstance *BoundInstance;
+
+ int nAttribs;
+ udi_instance_attr_list_t Attribs[];
+};
+
+// --- Metalanguages ---
+extern tUDI_MetaLang cMetaLang_Management;
+
+
+// --- Index to pointer translation ---
+extern udi_ops_init_t *UDI_int_GetOps(tUDI_DriverInstance *Inst, udi_index_t index);
+extern tUDI_MetaLang *UDI_int_GetMetaLang(tUDI_DriverInstance *Inst, udi_index_t meta_idx);
+
+// --- Channels ---
+extern udi_channel_t UDI_CreateChannel_Blank(tUDI_MetaLang *metalang);
+extern udi_channel_t UDI_CreateChannel_Linked(udi_channel_t orig, udi_ubit8_t spawn_idx);
+extern int UDI_BindChannel_Raw(udi_channel_t channel, bool other_side, tUDI_DriverInstance *inst, udi_index_t region_idx, udi_index_t meta_ops_num, void *context, const void *ops);
+extern int UDI_BindChannel(udi_channel_t channel, bool other_side, tUDI_DriverInstance *inst, udi_index_t ops, udi_index_t region, void *context, bool is_child_bind, udi_ubit32_t child_ID);
+extern tUDI_DriverInstance *UDI_int_ChannelGetInstance(udi_cb_t *gcb, bool other_side, udi_index_t *region_idx);
+extern void UDI_int_ChannelSetContext(udi_channel_t channel, void *context);
+extern const void *UDI_int_ChannelPrepForCall(udi_cb_t *gcb, tUDI_MetaLang *metalang, udi_index_t meta_ops_num);
+extern void UDI_int_ChannelFlip(udi_cb_t *gcb);
+extern void UDI_int_ChannelReleaseFromCall(udi_cb_t *gcb);
+
+// --- Async Calls ---
+typedef struct sUDI_DeferredCall tUDI_DeferredCall;
+typedef void tUDI_DeferredUnmarshal(tUDI_DeferredCall *Call);
+struct sUDI_DeferredCall
+{
+ struct sUDI_DeferredCall *Next;
+ tUDI_DeferredUnmarshal *Unmarshal;
+ udi_cb_t *cb;
+ udi_op_t *Handler;
+ // ...
+};
+extern void UDI_int_DeferredThread(void *unused); // Worker started by main.c
+extern void UDI_int_AddDeferred(tUDI_DeferredCall *Call);
+extern void UDI_int_MakeDeferredCb(udi_cb_t *cb, udi_op_t *handler);
+
+extern void UDI_int_MakeDeferredCbU8(udi_cb_t *cb, udi_op_t *handler, udi_ubit8_t arg1);
+extern void UDI_int_MakeDeferredCbS(udi_cb_t *cb, udi_op_t *handler, udi_status_t status);
+
+// --- CBs ---
+extern void *udi_cb_alloc_internal(tUDI_DriverInstance *Inst, udi_ubit8_t bind_cb_idx, udi_channel_t channel);
+
+// --- Attribute Management ---
+extern udi_instance_attr_type_t udi_instance_attr_get_internal(udi_cb_t *gcb, const char *attr_name, udi_ubit32_t child_ID, void *attr_value, udi_size_t attr_length, udi_size_t *actual_length);
+
+#endif
+
--- /dev/null
+/*
+ * Acess2 UDI Layer
+ * - By John Hodge (thePowersGang)
+ *
+ * udi_ma.h
+ * - Management Agent
+ */
+#ifndef _UDI_MA_H_
+#define _UDI_MA_H_
+
+extern void UDI_MA_BindParents(tUDI_DriverModule *Module);
+extern tUDI_DriverInstance *UDI_MA_CreateInstance(tUDI_DriverModule *DriverModule);
+extern tUDI_DriverRegion *UDI_MA_InitRegion(tUDI_DriverInstance *Inst, udi_ubit16_t Index, udi_ubit16_t Type, size_t RDataSize);
+extern void UDI_MA_BeginEnumeration(tUDI_DriverInstance *Inst);
+
+extern void UDI_MA_AddChild(udi_enumerate_cb_t *cb, udi_index_t ops_idx);
+
+
+extern const udi_cb_init_t cUDI_MgmtCbInitList[];
+
+extern tUDI_DriverModule *gpUDI_LoadedModules;
+
+
+#endif
+
/*
* Acess2 UDI Layer
+ * - By John Hodge (thePowersGang)
+ *
+ * main.c
+ * - UDI Entrypoint and Module loading
*/
#define DEBUG 1
#define VERSION ((0<<8)|1)
#include <acess.h>
#include <modules.h>
#include <udi.h>
-#include "udi_internal.h"
-#include "udi_ma.h"
-
-// === IMPORTS ===
-extern udi_init_t pci_init;
-extern char pci_udiprops[];
-extern size_t pci_udiprops_size;
+#include <udi_internal.h>
+#include <udi_internal_ma.h>
+#include <trans_pci.h>
// === PROTOTYPES ===
int UDI_Install(char **Arguments);
* - Managment Agent
*/
#define DEBUG 1
-#include <acess.h>
#include <udi.h>
-#include "udi_internal.h"
-#include "udi_ma.h"
+#include <acess.h>
+#include <udi_internal.h>
+#include <udi_internal_ma.h>
// === CONSTANTS ===
enum {
#include <udi_pci.h>
#include <acess.h>
#include <drv_pci.h> // acess
-#include "../udi_internal.h"
+#include <udi_internal.h>
+#include <trans_pci.h>
// === MACROS ===
/* Copied from http://projectudi.cvs.sourceforge.net/viewvc/projectudi/udiref/driver/udi_dpt/udi_dpt.h */
(attr)->attr_length = (len); \
udi_strncpy_rtrim((char *)(attr)->attr_value, (val), (len))
+#define PCI_OPS_BRIDGE 1
+#define PCI_OPS_IRQ 2
+
+#define PCI_MAX_EVENT_CBS 8
// === TYPES ===
typedef struct
tPCIDev cur_iter;
} pci_rdata_t;
+typedef struct
+{
+ udi_child_chan_context_t child_chan_context;
+
+ udi_channel_t interrupt_channel;
+ struct {
+ tPAddr paddr;
+ void *vaddr;
+ size_t length;
+ } bars[6];
+
+ int interrupt_handle;
+
+ udi_pio_handle_t intr_preprocessing;
+ udi_intr_event_cb_t *event_cbs[PCI_MAX_EVENT_CBS];
+ int event_cb_wr_ofs;
+ int event_cb_rd_ofs;
+} pci_child_chan_context_t;
+
// === PROTOTYPES ===
void pci_usage_ind(udi_usage_cb_t *cb, udi_ubit8_t resource_level);
void pci_enumerate_req(udi_enumerate_cb_t *cb, udi_ubit8_t enumeration_level);
void pci_unbind_req(udi_bus_bind_cb_t *cb);
void pci_bind_req_op(udi_bus_bind_cb_t *cb);
void pci_intr_attach_req(udi_intr_attach_cb_t *cb);
+void pci_intr_attach_req__channel_spawned(udi_cb_t *gcb, udi_channel_t new_channel);
void pci_intr_detach_req(udi_intr_detach_cb_t *cb);
+void pci_intr_ch_event_ind(udi_channel_event_cb_t *cb);
+void pci_intr_event_rdy(udi_intr_event_cb_t *cb);
+void pci_intr_handler(int irq, void *void_context);
+void pci_intr_handle__trans_done(udi_cb_t *gcb, udi_buf_t *new_buf, udi_status_t status, udi_ubit16_t result);
+
// - Hook to physio (UDI doesn't define these)
int pci_pio_get_regset(udi_cb_t *gcb, udi_ubit32_t regset_idx, void **baseptr, size_t *lenptr);
}
void pci_intr_attach_req(udi_intr_attach_cb_t *cb)
{
+ pci_child_chan_context_t *context = UDI_GCB(cb)->context;
+
+ ASSERT(cb->interrupt_idx == 0);
+
+ context->intr_preprocessing = cb->preprocessing_handle;
+ // Check if interrupt is already bound
+ if( !UDI_HANDLE_IS_NULL(context->interrupt_channel, udi_channel_t) )
+ {
+ udi_intr_attach_ack(cb, UDI_OK);
+ return ;
+ }
// Create a channel
- //udi_channel_spawn(, UCI_GCB(cb), cb->gcb.channel, 0, PCI_OPS_IRQ, NULL);
- UNIMPLEMENTED();
+ udi_channel_spawn(pci_intr_attach_req__channel_spawned, UDI_GCB(cb),
+ cb->gcb.channel, cb->interrupt_idx, PCI_OPS_IRQ, context);
+}
+void pci_intr_attach_req__channel_spawned(udi_cb_t *gcb, udi_channel_t new_channel)
+{
+ udi_intr_attach_cb_t *cb = UDI_MCB(gcb, udi_intr_attach_cb_t);
+ pci_child_chan_context_t *context = UDI_GCB(cb)->context;
+
+ if( UDI_HANDLE_IS_NULL(new_channel, udi_channel_t) )
+ {
+ // oops
+ return ;
+ }
+
+ context->interrupt_channel = new_channel;
+
+ context->interrupt_handle = IRQ_AddHandler(
+ PCI_GetIRQ(context->child_chan_context.child_ID),
+ pci_intr_handler, new_channel);
+
+ udi_intr_attach_ack(cb, UDI_OK);
}
void pci_intr_detach_req(udi_intr_detach_cb_t *cb)
{
UNIMPLEMENTED();
}
+void pci_intr_ch_event_ind(udi_channel_event_cb_t *cb)
+{
+ UNIMPLEMENTED();
+}
+void pci_intr_event_rdy(udi_intr_event_cb_t *cb)
+{
+ pci_child_chan_context_t *context = UDI_GCB(cb)->context;
+ if( context->event_cbs[context->event_cb_wr_ofs] )
+ {
+ // oops, overrun.
+ return ;
+ }
+ context->event_cbs[context->event_cb_wr_ofs++] = cb;
+ if( context->event_cb_wr_ofs == PCI_MAX_EVENT_CBS )
+ context->event_cb_wr_ofs = 0;
+}
+
+void pci_intr_handler(int irq, void *void_context)
+{
+ pci_child_chan_context_t *context = void_context;
+
+ if( context->event_cb_rd_ofs == context->event_cb_wr_ofs ) {
+ // Dropped
+ return ;
+ }
+
+ udi_intr_event_cb_t *cb = context->event_cbs[context->event_cb_rd_ofs];
+ context->event_cbs[context->event_cb_rd_ofs] = NULL;
+ context->event_cb_rd_ofs ++;
+ if( context->event_cb_rd_ofs == PCI_MAX_EVENT_CBS )
+ context->event_cb_rd_ofs = 0;
+
+ if( UDI_HANDLE_IS_NULL(context->intr_preprocessing, udi_pio_handle_t) )
+ {
+ udi_intr_event_ind(cb, 0);
+ }
+ else
+ {
+ // Processing
+ // - no event info, so mem_ptr=NULL
+ udi_pio_trans(pci_intr_handle__trans_done, UDI_GCB(cb),
+ context->intr_preprocessing, 1, cb->event_buf, NULL);
+ }
+}
+
+void pci_intr_handle__trans_done(udi_cb_t *gcb, udi_buf_t *new_buf, udi_status_t status, udi_ubit16_t result)
+{
+ udi_intr_event_cb_t *cb = UDI_MCB(gcb, udi_intr_event_cb_t);
+
+ cb->intr_result = result;
+
+ udi_intr_event_ind(cb, UDI_INTR_PREPROCESSED);
+}
+
// - physio hooks
udi_status_t pci_pio_do_io(uint32_t child_ID, udi_ubit32_t regset_idx, udi_ubit32_t ofs, udi_ubit8_t len,
void *data, bool isOutput)
pci_intr_detach_req
};
udi_ubit8_t pci_bridge_op_flags[5] = {0,0,0,0,0};
+udi_intr_dispatcher_ops_t pci_irq_ops = {
+ pci_intr_ch_event_ind,
+ pci_intr_event_rdy
+};
+udi_ubit8_t pci_irq_ops_flags[2] = {0,0};
udi_primary_init_t pci_pri_init = {
.mgmt_ops = &pci_mgmt_ops,
.mgmt_op_flags = pci_mgmt_op_flags,
};
udi_ops_init_t pci_ops_list[] = {
{
- 1, 1, UDI_BUS_BRIDGE_OPS_NUM,
- sizeof(udi_child_chan_context_t),
+ PCI_OPS_BRIDGE, 1, UDI_BUS_BRIDGE_OPS_NUM,
+ sizeof(pci_child_chan_context_t),
(udi_ops_vector_t*)&pci_bridge_ops,
pci_bridge_op_flags
},
+ {
+ PCI_OPS_IRQ, 1, UDI_BUS_INTR_DISPATCH_OPS_NUM,
+ 0,
+ (udi_ops_vector_t*)&pci_irq_ops,
+ pci_irq_ops_flags
+ },
{0}
};
udi_init_t pci_init = {
+++ /dev/null
-/*
- * Acess2 UDI Layer
- * - By John Hodge (thePowersGang)
- *
- * udi_internal.h
- * - Definitions for opaque structures
- */
-#ifndef _UDI_INTERNAL_H_
-#define _UDI_INTERNAL_H_
-
-#include <stdbool.h>
-
-#define NEW(type,extra) (type*)calloc(sizeof(type)extra,1)
-#define NEW_wA(type,fld,cnt) NEW(type,+(sizeof(((type*)NULL)->fld[0])*cnt))
-
-typedef struct sUDI_PropMessage tUDI_PropMessage;
-typedef struct sUDI_PropRegion tUDI_PropRegion;
-typedef struct sUDI_PropDevSpec tUDI_PropDevSpec;
-
-typedef const struct sUDI_MetaLang tUDI_MetaLang;
-
-typedef struct sUDI_MetaLangRef tUDI_MetaLangRef;
-typedef struct sUDI_BindOps tUDI_BindOps;
-
-typedef struct sUDI_DriverModule tUDI_DriverModule;
-typedef struct sUDI_DriverInstance tUDI_DriverInstance;
-typedef struct sUDI_DriverRegion tUDI_DriverRegion;
-
-typedef struct sUDI_ChildBinding tUDI_ChildBinding;
-
-struct sUDI_PropMessage
-{
- int locale;
- udi_ubit16_t index;
- const char *string;
-};
-
-struct sUDI_PropRegion
-{
- udi_index_t RegionIdx;
- enum {
- UDI_REGIONTYPE_NORMAL,
- UDI_REGIONTYPE_FP,
- } Type;
- enum {
- UDI_REGIONBINDING_STATIC,
- UDI_REGIONBINDING_DYNAMIC,
- } Binding;
- enum {
- UDI_REGIONPRIO_MED,
- UDI_REGIONPRIO_LO,
- UDI_REGIONPRIO_HI,
- } Priority;
- enum {
- UDI_REGIONLATENCY_NONOVERRRUNABLE,
- UDI_REGIONLATENCY_POWERFAIL,
- UDI_REGIONLATENCY_OVERRUNNABLE,
- UDI_REGIONLATENCY_RETRYABLE,
- // non_overrunable
- UDI_REGIONLATENCY_NONCTRITICAL,
- } Latency;
- udi_ubit32_t OverrunTime;
-
- udi_index_t BindMeta;
- udi_index_t PriBindOps;
- udi_index_t SecBindOps;
- udi_index_t BindCb;
-};
-
-struct sUDI_MetaLang
-{
- const char *Name;
- int nCbTypes;
- struct {
- udi_size_t Size;
- udi_layout_t *Layout;
- } CbTypes[];
-};
-
-struct sUDI_MetaLangRef
-{
- udi_ubit8_t meta_idx;
- const char *interface_name;
- tUDI_MetaLang *metalang;
- // TODO: pointer to metalanguage structure
-};
-
-struct sUDI_BindOps
-{
- udi_ubit8_t meta_idx;
- udi_ubit8_t region_idx;
- udi_ubit8_t ops_idx;
- udi_ubit8_t bind_cb_idx;
-};
-
-struct sUDI_PropDevSpec
-{
- int MessageNum;
- udi_ubit8_t MetaIdx;
- tUDI_MetaLang *Metalang;
- int nAttribs;
- udi_instance_attr_list_t Attribs[];
-};
-
-struct sUDI_DriverModule
-{
- tUDI_DriverModule *Next;
- void *Base;
-
- udi_init_t *InitInfo;
-
- // Counts of arrays in InitInfo
- int nCBInit;
- int nOpsInit;
-
- const char *ModuleName;
- int nMessages;
- tUDI_PropMessage *Messages; // Sorted list
-
- int nRegionTypes;
- tUDI_PropRegion *RegionTypes;
-
- int nMetaLangs;
- tUDI_MetaLangRef *MetaLangs;
-
- int nParents;
- tUDI_BindOps *Parents;
-
- int nChildBindOps;
- tUDI_BindOps *ChildBindOps;
-
- int nDevices;
- tUDI_PropDevSpec **Devices;
-
- int nRegions;
-};
-
-struct sUDI_DriverInstance
-{
- struct sUDI_DriverInstance *Next;
- tUDI_DriverModule *Module;
- udi_channel_t ManagementChannel;
- tUDI_DriverInstance *Parent;
- tUDI_ChildBinding *ParentChildBinding;
-
- tUDI_ChildBinding *FirstChild;
- tUDI_DriverRegion *Regions[];
-};
-
-struct sUDI_DriverRegion
-{
- udi_init_context_t *InitContext;
-};
-
-struct sUDI_ChildBinding
-{
- tUDI_ChildBinding *Next;
-
- udi_ubit32_t ChildID;
- tUDI_MetaLang *Metalang;
- tUDI_BindOps *BindOps;
-
- udi_ops_init_t *Ops;
- tUDI_DriverInstance *BoundInstance;
-
- int nAttribs;
- udi_instance_attr_list_t Attribs[];
-};
-
-// --- Metalanguages ---
-extern tUDI_MetaLang cMetaLang_Management;
-
-
-// --- Index to pointer translation ---
-extern udi_ops_init_t *UDI_int_GetOps(tUDI_DriverInstance *Inst, udi_index_t index);
-extern tUDI_MetaLang *UDI_int_GetMetaLang(tUDI_DriverInstance *Inst, udi_index_t meta_idx);
-
-// --- Channels ---
-extern udi_channel_t UDI_CreateChannel_Blank(tUDI_MetaLang *metalang);
-extern udi_channel_t UDI_CreateChannel_Linked(udi_channel_t orig, udi_ubit8_t spawn_idx);
-extern int UDI_BindChannel_Raw(udi_channel_t channel, bool other_side, tUDI_DriverInstance *inst, udi_index_t region_idx, udi_index_t meta_ops_num, void *context, const void *ops);
-extern int UDI_BindChannel(udi_channel_t channel, bool other_side, tUDI_DriverInstance *inst, udi_index_t ops, udi_index_t region, void *context, bool is_child_bind, udi_ubit32_t child_ID);
-extern tUDI_DriverInstance *UDI_int_ChannelGetInstance(udi_cb_t *gcb, bool other_side, udi_index_t *region_idx);
-extern void UDI_int_ChannelSetContext(udi_channel_t channel, void *context);
-extern const void *UDI_int_ChannelPrepForCall(udi_cb_t *gcb, tUDI_MetaLang *metalang, udi_index_t meta_ops_num);
-extern void UDI_int_ChannelFlip(udi_cb_t *gcb);
-extern void UDI_int_ChannelReleaseFromCall(udi_cb_t *gcb);
-
-// --- Async Calls ---
-typedef struct sUDI_DeferredCall tUDI_DeferredCall;
-typedef void tUDI_DeferredUnmarshal(tUDI_DeferredCall *Call);
-struct sUDI_DeferredCall
-{
- struct sUDI_DeferredCall *Next;
- tUDI_DeferredUnmarshal *Unmarshal;
- udi_cb_t *cb;
- udi_op_t *Handler;
- // ...
-};
-extern void UDI_int_DeferredThread(void *unused); // Worker started by main.c
-extern void UDI_int_AddDeferred(tUDI_DeferredCall *Call);
-extern void UDI_int_MakeDeferredCb(udi_cb_t *cb, udi_op_t *handler);
-
-extern void UDI_int_MakeDeferredCbU8(udi_cb_t *cb, udi_op_t *handler, udi_ubit8_t arg1);
-extern void UDI_int_MakeDeferredCbS(udi_cb_t *cb, udi_op_t *handler, udi_status_t status);
-
-// --- CBs ---
-extern void *udi_cb_alloc_internal(tUDI_DriverInstance *Inst, udi_ubit8_t bind_cb_idx, udi_channel_t channel);
-
-// --- Attribute Management ---
-extern udi_instance_attr_type_t udi_instance_attr_get_internal(udi_cb_t *gcb, const char *attr_name, udi_ubit32_t child_ID, void *attr_value, udi_size_t attr_length, udi_size_t *actual_length);
-
-#endif
-
+++ /dev/null
-/**
- * Acess2 UDI Layer
- * - By John Hodge (thePowersGang)
- *
- * udi_lib/attr.c
- * - Instance Attribute Management
- */
-#include <acess.h>
-#include <udi.h>
-#include "../udi_internal.h"
-
-// Notes:
-// - Prefixes:
-// > '%': Private persistent
-// > '$': Private Volatile
-// > '': Enumeration
-// > '^': Sibling group
-// > '@': parent-visible (persistent)
-
-// === CODE ===
-udi_instance_attr_type_t udi_instance_attr_get_internal(udi_cb_t *gcb, const char *attr_name, udi_ubit32_t child_ID, void *attr_value, udi_size_t attr_length, udi_size_t *actual_length)
-{
- // Get instance
- tUDI_DriverInstance *inst = UDI_int_ChannelGetInstance(gcb, false, NULL);
-
- const tUDI_ChildBinding *bind = inst->ParentChildBinding;
-
- // Search
- switch(*attr_name)
- {
- // Private Persistent
- case '%':
- // Read cached from tUDI_DriverModule
- // Write to permanent storage?
- break;
- // Private Volatile
- case '$':
- // Read from tUDI_DriverInstance
- break;
- // Sibling group
- case '^':
- // Read from parent's tUDI_DriverInstance
- break;
- // Parent-Visible
- case '@':
- // Read from tUDI_ChildBinding
- break;
- // Enumeration
- default:
- // Check associated tUDI_ChildBinding
- if( !inst->ParentChildBinding ) {
- return UDI_ATTR_NONE;
- }
-
- for( int i = 0; i < bind->nAttribs; i ++ )
- {
- const udi_instance_attr_list_t *at = &bind->Attribs[i];
- if( strcmp(at->attr_name, attr_name) == 0 )
- {
- if( actual_length )
- *actual_length = at->attr_length;
- udi_size_t len = (at->attr_length < attr_length) ? at->attr_length : attr_length;
- memcpy(attr_value, at->attr_value, len);
- return at->attr_type;
- }
- }
- break;
- }
- // - Priv
- // - enumeration attributes
- // - set attributes
- return UDI_ATTR_NONE;
-}
+++ /dev/null
-/**
- * \file buf.c
- * \author John Hodge (thePowersGang)
- *
- * Buffer Manipulation
- */
-#include <acess.h>
-#include <udi.h>
-
-// === EXPORTS ===
-EXPORT(udi_buf_copy);
-EXPORT(udi_buf_write);
-EXPORT(udi_buf_read);
-EXPORT(udi_buf_free);
-
-// === CODE ===
-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
- )
-{
- UNIMPLEMENTED();
-}
-
-/**
- * \brief Write to a buffer
- * \param callback Function to call once the write has completed
- * \param gcb Control Block
- * \param src_mem Source Data
- * \param src_len Length of source data
- * \param dst_buf Destination buffer
- * \param dst_off Destination offset in the buffer
- * \param dst_len Length of destination area (What the?, Redundant
- * Department of redundacny department)
- * \param path_handle ???
- */
-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
- )
-{
- UNIMPLEMENTED();
-}
-
-void udi_buf_read(
- udi_buf_t *src_buf,
- udi_size_t src_off,
- udi_size_t src_len,
- void *dst_mem )
-{
- UNIMPLEMENTED();
-}
-
-void udi_buf_free(udi_buf_t *buf)
-{
- UNIMPLEMENTED();
-}
+++ /dev/null
-/**
- * \file cb.c
- * \author John Hodge (thePowersGang)
- * \brief Control block code
- */
-#define DEBUG 1
-#include <udi.h>
-#include <acess.h>
-#include "../udi_internal.h"
-#include "../udi_ma.h" // for cUDI_MgmtCbInitList
-
-// === CODE ===
-void *udi_cb_alloc_internal(tUDI_DriverInstance *Inst, udi_ubit8_t bind_cb_idx, udi_channel_t channel)
-{
- const udi_cb_init_t *cb_init;
- LOG("Inst=%p, bind_cb_idx=%i, channel=%p", Inst, bind_cb_idx, channel);
- if(Inst) {
- ASSERT(Inst->Module);
- ASSERT(Inst->Module->InitInfo);
- ASSERT(Inst->Module->InitInfo->cb_init_list);
- }
- cb_init = Inst ? Inst->Module->InitInfo->cb_init_list : cUDI_MgmtCbInitList;
- for( ; cb_init->cb_idx; cb_init ++ )
- {
- if( cb_init->cb_idx == bind_cb_idx )
- {
- // TODO: Get base size using meta/cbnum
- tUDI_MetaLang *metalang = UDI_int_GetMetaLang(Inst, cb_init->meta_idx);
- if( !metalang ) {
- Log_Warning("UDI", "Metalang referenced in %s CB %i is invalid (%i)",
- Inst->Module->ModuleName, bind_cb_idx, cb_init->meta_idx);
- return NULL;
- }
- ASSERTC(cb_init->meta_cb_num, <, metalang->nCbTypes);
- size_t base = metalang->CbTypes[cb_init->meta_cb_num].Size;
- ASSERTC(base, >=, sizeof(udi_cb_t));
- base -= sizeof(udi_cb_t);
- LOG("+ %i + %i + %i", base, cb_init->inline_size, cb_init->scratch_requirement);
- udi_cb_t *ret = NEW(udi_cb_t, + base
- + cb_init->inline_size + cb_init->scratch_requirement);
- ret->channel = channel;
- return ret;
- }
- }
- Log_Warning("UDI", "Cannot find CB init def %i for '%s'",
- bind_cb_idx, Inst->Module->ModuleName);
- return NULL;
-}
-
-void udi_cb_alloc (
- udi_cb_alloc_call_t *callback, //!< Function to be called when the CB is allocated
- udi_cb_t *gcb, //!< Parent Control Block
- udi_index_t cb_idx,
- udi_channel_t default_channel
- )
-{
- tUDI_DriverInstance *inst = UDI_int_ChannelGetInstance(gcb, false, NULL);
- void *ret = udi_cb_alloc_internal(inst, cb_idx, default_channel);
- callback(gcb, ret);
-}
-
-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
- )
-{
- UNIMPLEMENTED();
-}
-
-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
- )
-{
- UNIMPLEMENTED();
-}
-
-void udi_cb_free(udi_cb_t *cb)
-{
- UNIMPLEMENTED();
-}
-
-void udi_cancel(udi_cancel_call_t *callback, udi_cb_t *gcb)
-{
- UNIMPLEMENTED();
-}
-
-// === EXPORTS ===
-EXPORT(udi_cb_alloc);
-EXPORT(udi_cb_alloc_dynamic);
-EXPORT(udi_cb_alloc_batch);
-EXPORT(udi_cb_free);
-EXPORT(udi_cancel);
--- /dev/null
+/**
+ * Acess2 UDI Layer
+ * - By John Hodge (thePowersGang)
+ *
+ * udi_lib/attr.c
+ * - Instance Attribute Management
+ */
+#include <udi.h>
+#include <acess.h>
+#include <udi_internal.h>
+
+// Notes:
+// - Prefixes:
+// > '%': Private persistent
+// > '$': Private Volatile
+// > '': Enumeration
+// > '^': Sibling group
+// > '@': parent-visible (persistent)
+
+// === CODE ===
+udi_instance_attr_type_t udi_instance_attr_get_internal(udi_cb_t *gcb, const char *attr_name, udi_ubit32_t child_ID, void *attr_value, udi_size_t attr_length, udi_size_t *actual_length)
+{
+ // Get instance
+ tUDI_DriverInstance *inst = UDI_int_ChannelGetInstance(gcb, false, NULL);
+
+ const tUDI_ChildBinding *bind = inst->ParentChildBinding;
+
+ // Search
+ switch(*attr_name)
+ {
+ // Private Persistent
+ case '%':
+ // Read cached from tUDI_DriverModule
+ // Write to permanent storage?
+ break;
+ // Private Volatile
+ case '$':
+ // Read from tUDI_DriverInstance
+ break;
+ // Sibling group
+ case '^':
+ // Read from parent's tUDI_DriverInstance
+ break;
+ // Parent-Visible
+ case '@':
+ // Read from tUDI_ChildBinding
+ break;
+ // Enumeration
+ default:
+ // Check associated tUDI_ChildBinding
+ if( !inst->ParentChildBinding ) {
+ return UDI_ATTR_NONE;
+ }
+
+ for( int i = 0; i < bind->nAttribs; i ++ )
+ {
+ const udi_instance_attr_list_t *at = &bind->Attribs[i];
+ if( strcmp(at->attr_name, attr_name) == 0 )
+ {
+ if( actual_length )
+ *actual_length = at->attr_length;
+ udi_size_t len = (at->attr_length < attr_length) ? at->attr_length : attr_length;
+ memcpy(attr_value, at->attr_value, len);
+ return at->attr_type;
+ }
+ }
+ break;
+ }
+ // - Priv
+ // - enumeration attributes
+ // - set attributes
+ return UDI_ATTR_NONE;
+}
--- /dev/null
+/**
+ * \file buf.c
+ * \author John Hodge (thePowersGang)
+ *
+ * Buffer Manipulation
+ */
+#include <acess.h>
+#include <udi.h>
+
+// === EXPORTS ===
+EXPORT(udi_buf_copy);
+EXPORT(udi_buf_write);
+EXPORT(udi_buf_read);
+EXPORT(udi_buf_free);
+
+// === CODE ===
+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
+ )
+{
+ UNIMPLEMENTED();
+}
+
+/**
+ * \brief Write to a buffer
+ * \param callback Function to call once the write has completed
+ * \param gcb Control Block
+ * \param src_mem Source Data
+ * \param src_len Length of source data
+ * \param dst_buf Destination buffer
+ * \param dst_off Destination offset in the buffer
+ * \param dst_len Length of destination area (What the?, Redundant
+ * Department of redundacny department)
+ * \param path_handle ???
+ */
+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
+ )
+{
+ UNIMPLEMENTED();
+}
+
+void udi_buf_read(
+ udi_buf_t *src_buf,
+ udi_size_t src_off,
+ udi_size_t src_len,
+ void *dst_mem )
+{
+ UNIMPLEMENTED();
+}
+
+void udi_buf_free(udi_buf_t *buf)
+{
+ UNIMPLEMENTED();
+}
--- /dev/null
+/**
+ * \file cb.c
+ * \author John Hodge (thePowersGang)
+ * \brief Control block code
+ */
+#define DEBUG 1
+#include <udi.h>
+#include <acess.h>
+#include <udi_internal.h>
+#include <udi_internal_ma.h> // for cUDI_MgmtCbInitList
+
+// === CODE ===
+void *udi_cb_alloc_internal(tUDI_DriverInstance *Inst, udi_ubit8_t bind_cb_idx, udi_channel_t channel)
+{
+ const udi_cb_init_t *cb_init;
+ LOG("Inst=%p, bind_cb_idx=%i, channel=%p", Inst, bind_cb_idx, channel);
+ if(Inst) {
+ ASSERT(Inst->Module);
+ ASSERT(Inst->Module->InitInfo);
+ ASSERT(Inst->Module->InitInfo->cb_init_list);
+ }
+ cb_init = Inst ? Inst->Module->InitInfo->cb_init_list : cUDI_MgmtCbInitList;
+ for( ; cb_init->cb_idx; cb_init ++ )
+ {
+ if( cb_init->cb_idx == bind_cb_idx )
+ {
+ // TODO: Get base size using meta/cbnum
+ tUDI_MetaLang *metalang = UDI_int_GetMetaLang(Inst, cb_init->meta_idx);
+ if( !metalang ) {
+ Log_Warning("UDI", "Metalang referenced in %s CB %i is invalid (%i)",
+ Inst->Module->ModuleName, bind_cb_idx, cb_init->meta_idx);
+ return NULL;
+ }
+ ASSERTC(cb_init->meta_cb_num, <, metalang->nCbTypes);
+ size_t base = metalang->CbTypes[cb_init->meta_cb_num].Size;
+ ASSERTC(base, >=, sizeof(udi_cb_t));
+ base -= sizeof(udi_cb_t);
+ LOG("+ %i + %i + %i", base, cb_init->inline_size, cb_init->scratch_requirement);
+ udi_cb_t *ret = NEW(udi_cb_t, + base
+ + cb_init->inline_size + cb_init->scratch_requirement);
+ ret->channel = channel;
+ return ret;
+ }
+ }
+ Log_Warning("UDI", "Cannot find CB init def %i for '%s'",
+ bind_cb_idx, Inst->Module->ModuleName);
+ return NULL;
+}
+
+void udi_cb_alloc (
+ udi_cb_alloc_call_t *callback, //!< Function to be called when the CB is allocated
+ udi_cb_t *gcb, //!< Parent Control Block
+ udi_index_t cb_idx,
+ udi_channel_t default_channel
+ )
+{
+ tUDI_DriverInstance *inst = UDI_int_ChannelGetInstance(gcb, false, NULL);
+ void *ret = udi_cb_alloc_internal(inst, cb_idx, default_channel);
+ callback(gcb, ret);
+}
+
+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
+ )
+{
+ UNIMPLEMENTED();
+}
+
+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
+ )
+{
+ UNIMPLEMENTED();
+}
+
+void udi_cb_free(udi_cb_t *cb)
+{
+ UNIMPLEMENTED();
+}
+
+void udi_cancel(udi_cancel_call_t *callback, udi_cb_t *gcb)
+{
+ UNIMPLEMENTED();
+}
+
+// === EXPORTS ===
+EXPORT(udi_cb_alloc);
+EXPORT(udi_cb_alloc_dynamic);
+EXPORT(udi_cb_alloc_batch);
+EXPORT(udi_cb_free);
+EXPORT(udi_cancel);
--- /dev/null
+/**
+ * \file imc.c
+ * \author John Hodge (thePowersGang)
+ */
+#define DEBUG 1
+#include <udi.h>
+#include <acess.h>
+#include <udi_internal.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 ===
+/**
+ */
+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
+ )
+{
+ UNIMPLEMENTED();
+}
+
+/**
+ */
+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
+ )
+{
+ LOG("gcb=%p,channel=%p", gcb, channel, spawn_idx, ops_idx, channel_context);
+
+ // Search existing channel for a matching spawn_idx
+ udi_channel_t ret = UDI_CreateChannel_Linked(channel, spawn_idx);
+
+ // Bind local end of channel to ops_idx (with channel_context)
+ if( ops_idx != 0 )
+ {
+ udi_index_t region_idx;
+ tUDI_DriverInstance *inst = UDI_int_ChannelGetInstance(gcb, false, ®ion_idx);
+ UDI_BindChannel(ret, false, inst, ops_idx, region_idx, channel_context, false,0);
+ }
+ else
+ {
+ // leave unbound
+ }
+
+ callback(gcb, ret);
+}
+
+/**
+ *
+ */
+void udi_channel_set_context(
+ udi_channel_t target_channel, void *channel_context
+ )
+{
+ LOG("target_channel=%p,channel_context=%p", target_channel, channel_context);
+ UDI_int_ChannelSetContext(target_channel, channel_context);
+}
+
+void udi_channel_op_abort(
+ udi_channel_t target_channel, udi_cb_t *orig_cb
+ )
+{
+ udi_channel_event_cb_t cb;
+ cb.gcb.channel = target_channel;
+ cb.event = UDI_CHANNEL_CLOSED;
+ cb.params.orig_cb = orig_cb;
+ udi_channel_event_ind(&cb);
+}
+
+void udi_channel_close(udi_channel_t channel)
+{
+ Warning("%s Unimplemented", __func__);
+}
+
+void udi_channel_event_ind(udi_channel_event_cb_t *cb)
+{
+ LOG("cb=%p{...}", cb);
+ const struct {
+ udi_channel_event_ind_op_t *channel_event_ind_op;
+ } *ops = UDI_int_ChannelPrepForCall( UDI_GCB(cb), NULL, 0 );
+ if(!ops) {
+ Log_Warning("UDI", "udi_channel_event_ind on wrong channel type");
+ return ;
+ }
+
+ // UDI_int_MakeDeferredCb( UDI_GCB(cb), ops->channel_event_ind_op );
+
+ UDI_int_ChannelReleaseFromCall( UDI_GCB(cb) );
+ ops->channel_event_ind_op(cb);
+}
+
+void udi_channel_event_complete(udi_channel_event_cb_t *cb, udi_status_t status)
+{
+ UNIMPLEMENTED();
+}
--- /dev/null
+/**
+ * \file logging.c
+ * \author John Hodge (thePowersGang)
+ *
+ * \brief UDI Tracing, Logging and Debug
+ */
+#define DEBUG 1
+#include <acess.h>
+#include <udi.h>
+
+void __udi_assert(const char *expr, const char *file, int line);
+
+// === EXPORTS ===
+EXPORT(udi_trace_write);
+EXPORT(udi_log_write);
+EXPORT(__udi_assert);
+//EXPORT(udi_assert);
+EXPORT(udi_debug_break);
+EXPORT(udi_debug_printf);
+
+// === PROTOTYPES ===
+
+// === CODE ===
+void udi_trace_write(udi_init_context_t *init_context, udi_trevent_t trace_event, udi_index_t meta_idx, udi_ubit32_t msgnum, ...)
+{
+ ENTER("pinit_context itrace_event imeta_idx imsgnum",
+ init_context, trace_event, meta_idx, msgnum);
+// const char *format = UDI_GetMessage(init_context, msgnum);
+// LOG("format = \"%s\"", format);
+ LEAVE('-');
+}
+
+void udi_log_write( udi_log_write_call_t *callback, udi_cb_t *gcb,
+ udi_trevent_t trace_event, udi_ubit8_t severity, udi_index_t meta_idx,
+ udi_status_t original_status, udi_ubit32_t msgnum, ... )
+{
+ Log("UDI Log");
+}
+
+void __udi_assert(const char *expr, const char *file, int line)
+{
+ Log("UDI Assertion failure: %s:%i - %s", file, line, expr);
+ UNIMPLEMENTED();
+}
+
+void udi_assert(udi_boolean_t bool)
+{
+ UNIMPLEMENTED();
+}
+
+void udi_debug_break( udi_init_context_t *init_context, const char *message)
+{
+ UNIMPLEMENTED();
+}
+
+void udi_debug_printf( const char *format, ... )
+{
+ va_list args;
+ va_start(args, format);
+ LogF("udi_debug_printf: ");
+ LogFV(format, args);
+ va_end(args);
+}
--- /dev/null
+/*
+ * Acess2 UDI Layer
+ * - By John Hodge (thePowersGang)
+ *
+ * udi_lib/mei.c
+ * - Metalanguage-to-Environment Interface
+ */
+#include <udi.h>
+#include <acess.h>
+
+// === CODE ===
+void udi_mei_call(udi_cb_t *gcb, udi_mei_init_t *meta_info, udi_index_t meta_ops_num, udi_index_t vec_idx, ...)
+{
+ UNIMPLEMENTED();
+}
+
--- /dev/null
+/**
+ * \file mem.c
+ * \author John Hodge (thePowersGang)
+ */
+#include <acess.h>
+#include <udi.h>
+
+// === EXPORTS ===
+EXPORT(udi_mem_alloc);
+EXPORT(udi_mem_free);
+
+// === CODE ===
+void udi_mem_alloc(
+ udi_mem_alloc_call_t *callback,
+ udi_cb_t *gcb,
+ udi_size_t size,
+ udi_ubit8_t flags
+ )
+{
+ void *buf = malloc(size);
+ if(buf)
+ {
+ if( !(flags & UDI_MEM_NOZERO) )
+ memset(buf, 0, size);
+ }
+ callback(gcb, buf);
+}
+
+void udi_mem_free(void *target_mem)
+{
+ free(target_mem);
+}
--- /dev/null
+/**
+ * \file meta_gio.c
+ * \author John Hodge (thePowersGang)
+ */
+#include <acess.h>
+#include <udi.h>
+
+// === EXPORTS ===
+EXPORT(udi_gio_bind_req);
+EXPORT(udi_gio_bind_ack);
+EXPORT(udi_gio_unbind_req);
+EXPORT(udi_gio_unbind_ack);
+EXPORT(udi_gio_xfer_req);
+EXPORT(udi_gio_xfer_ack);
+EXPORT(udi_gio_xfer_nak);
+EXPORT(udi_gio_event_res);
+EXPORT(udi_gio_event_ind);
+EXPORT(udi_gio_event_res_unused);
+
+// === CODE ===
+void udi_gio_bind_req(udi_gio_bind_cb_t *cb)
+{
+ UNIMPLEMENTED();
+}
+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
+ )
+{
+ UNIMPLEMENTED();
+}
+
+void udi_gio_unbind_req(udi_gio_bind_cb_t *cb)
+{
+ UNIMPLEMENTED();
+}
+void udi_gio_unbind_ack(udi_gio_bind_cb_t *cb)
+{
+ UNIMPLEMENTED();
+}
+
+void udi_gio_xfer_req(udi_gio_xfer_cb_t *cb)
+{
+ UNIMPLEMENTED();
+}
+void udi_gio_xfer_ack(udi_gio_xfer_cb_t *cb)
+{
+ UNIMPLEMENTED();
+}
+void udi_gio_xfer_nak(udi_gio_xfer_cb_t *cb, udi_status_t status)
+{
+ UNIMPLEMENTED();
+}
+
+void udi_gio_event_res(udi_gio_event_cb_t *cb)
+{
+ UNIMPLEMENTED();
+}
+void udi_gio_event_ind(udi_gio_event_cb_t *cb)
+{
+ UNIMPLEMENTED();
+}
+void udi_gio_event_res_unused(udi_gio_event_cb_t *cb)
+{
+ UNIMPLEMENTED();
+}
--- /dev/null
+/**
+ * \file meta_mgmt.c
+ * \author John Hodge (thePowersGang)
+ */
+#define DEBUG 0
+#include <udi.h>
+#include <acess.h>
+#include <udi_internal.h>
+#include <udi_internal_ma.h>
+
+// === EXPORTS ===
+EXPORT(udi_usage_ind);
+EXPORT(udi_static_usage);
+EXPORT(udi_usage_res);
+EXPORT(udi_enumerate_req);
+EXPORT(udi_enumerate_no_children);
+EXPORT(udi_enumerate_ack);
+EXPORT(udi_devmgmt_req);
+EXPORT(udi_devmgmt_ack);
+EXPORT(udi_final_cleanup_req);
+EXPORT(udi_final_cleanup_ack);
+
+tUDI_MetaLang cMetaLang_Management = {
+ "udi_mgmt",
+
+ 1,
+ {
+ {sizeof(udi_enumerate_cb_t), NULL}
+ }
+};
+
+// === CODE ===
+void udi_usage_ind(udi_usage_cb_t *cb, udi_ubit8_t resource_level)
+{
+ LOG("cb=%p{...}, resource_level=%i", cb, resource_level);
+ const udi_mgmt_ops_t *ops = UDI_int_ChannelPrepForCall( UDI_GCB(cb), &cMetaLang_Management, 0 );
+ if(!ops) {
+ Log_Warning("UDI", "%s on wrong channel type", __func__);
+ return ;
+ }
+
+ // Non-deferred because it's usually called with a stack allocated cb
+ UDI_int_ChannelReleaseFromCall( UDI_GCB(cb) );
+ ops->usage_ind_op(cb, resource_level);
+}
+
+void udi_static_usage(udi_usage_cb_t *cb, udi_ubit8_t resource_level)
+{
+ cb->trace_mask = 0;
+ udi_usage_res(cb);
+}
+
+void udi_usage_res(udi_usage_cb_t *cb)
+{
+ // TODO: Update trace mask from cb
+ LOG("cb=%p{cb->trace_mask=%x}", cb, cb->trace_mask);
+}
+
+void udi_enumerate_req(udi_enumerate_cb_t *cb, udi_ubit8_t enumeration_level)
+{
+ LOG("cb=%p{...}, enumeration_level=%i", cb, enumeration_level);
+ const udi_mgmt_ops_t *ops = UDI_int_ChannelPrepForCall( UDI_GCB(cb), &cMetaLang_Management, 0 );
+ if(!ops) {
+ Log_Warning("UDI", "%s on wrong channel type", __func__);
+ return ;
+ }
+
+ UDI_int_MakeDeferredCbU8( UDI_GCB(cb), (udi_op_t*)ops->enumerate_req_op, enumeration_level );
+}
+
+void udi_enumerate_no_children(udi_enumerate_cb_t *cb, udi_ubit8_t enumeration_level)
+{
+ udi_enumerate_ack(cb, UDI_ENUMERATE_LEAF, 0);
+}
+
+void udi_enumerate_ack(udi_enumerate_cb_t *cb, udi_ubit8_t enumeration_result, udi_index_t ops_idx)
+{
+ UDI_int_ChannelFlip( UDI_GCB(cb) );
+ LOG("cb=%p, enumeration_result=%i, ops_idx=%i", cb, enumeration_result, ops_idx);
+ switch( enumeration_result )
+ {
+ case UDI_ENUMERATE_OK:
+ #if DEBUG && 0
+ for( int i = 0; i < cb->attr_valid_length; i ++ )
+ {
+ udi_instance_attr_list_t *at = &cb->attr_list[i];
+ switch(at->attr_type)
+ {
+ case UDI_ATTR_STRING:
+ LOG("[%i] String '%.*s'", i, at->attr_length, at->attr_value);
+ break;
+ case UDI_ATTR_UBIT32:
+ LOG("[%i] UBit32 0x%08x", i, UDI_ATTR32_GET(at->attr_value));
+ break;
+ default:
+ LOG("[%i] %i", i, at->attr_type);
+ break;
+ }
+ }
+ #endif
+ // Returned a device
+ UDI_MA_AddChild(cb, ops_idx);
+ udi_enumerate_req(cb, UDI_ENUMERATE_NEXT);
+ return ;
+ case UDI_ENUMERATE_DONE:
+ // All done. Chain terminates
+ return ;
+ default:
+ Log_Notice("UDI", "Unknown enumeration_result %i", enumeration_result);
+ return ;
+ }
+}
+
+void udi_devmgmt_req(udi_mgmt_cb_t *cb, udi_ubit8_t mgmt_op, udi_ubit8_t parent_ID )
+{
+ ENTER("pcb imgmt_op iparent_ID", cb, mgmt_op, parent_ID);
+ LEAVE('-');
+}
+
+void udi_devmgmt_ack(udi_mgmt_cb_t *cb, udi_ubit8_t flags, udi_status_t status)
+{
+ ENTER("pcb xflags istatus", cb, flags, status);
+ LEAVE('-');
+}
+
+void udi_final_cleanup_req(udi_mgmt_cb_t *cb)
+{
+ ENTER("pcb", cb);
+ LEAVE('-');
+}
+
+void udi_final_cleanup_ack(udi_mgmt_cb_t *cb)
+{
+ ENTER("pcb", cb);
+ LEAVE('-');
+}
+
--- /dev/null
+/**
+ * \file queues.c
+ * \author John Hodge (thePowersGang)
+ *
+ * \brief UDI Queue Primatives
+ */
+#include <acess.h>
+#include <udi.h>
+
+// === EXPORTS ===
+EXPORT(udi_enqueue);
+EXPORT(udi_dequeue);
+
+// === CODE ===
+void udi_enqueue(udi_queue_t *new_el, udi_queue_t *old_el)
+{
+ new_el->next = old_el->next;
+ new_el->prev = old_el;
+ old_el->next = new_el;
+ old_el->next->prev = new_el;
+}
+udi_queue_t *udi_dequeue(udi_queue_t *element)
+{
+ element->next->prev = element->prev;
+ element->prev->next = element->next;
+ return element;
+}
--- /dev/null
+/**
+ * \file strmem.c
+ * \author John Hodge (thePowersGang)
+ */
+#include <acess.h>
+#include <udi.h>
+
+// === EXPORTS ===
+EXPORTAS(strlen, udi_strlen);
+EXPORTAS(strcat, udi_strcat);
+EXPORTAS(strncat, udi_strncat);
+EXPORTAS(strcmp, udi_strcmp);
+EXPORTAS(strncmp, udi_strncmp);
+EXPORTAS(memcmp, udi_memcmp);
+EXPORTAS(strcpy, udi_strcpy);
+EXPORTAS(strncpy, udi_strncpy);
+EXPORTAS(memcpy, udi_memcpy);
+EXPORTAS(memmove, udi_memmove);
+EXPORT(udi_strncpy_rtrim);
+EXPORTAS(strchr, udi_strchr);
+EXPORTAS(strrchr, udi_strrchr);
+EXPORT(udi_memchr);
+EXPORTAS(memset, udi_memset);
+EXPORT(udi_strtou32);
+EXPORT(udi_snprintf);
+EXPORT(udi_vsnprintf);
+
+// === CODE ===
+char *udi_strcpy(char *s1, const char *s2)
+{
+ return strcpy(s1, s2);
+}
+char *udi_strncpy_rtrim(char *s1, const char *s2, udi_size_t n)
+{
+ char *dst = s1;
+ while( n-- )
+ {
+ *dst++ = *s2++;
+ }
+ while( dst > s1 && isspace(*--dst) )
+ ;
+ dst ++;
+ *dst = '\0';
+ return s1;
+}
+
+void *udi_memchr(const void *s, udi_ubit8_t c, udi_size_t n)
+{
+ const udi_ubit8_t *p = s;
+ while(n--)
+ {
+ if( *p == c )
+ return (void*)p;
+ p ++;
+ }
+ return NULL;
+}
+
+udi_ubit32_t udi_strtou32(const char *s, char **endptr, int base)
+{
+ return strtoul(s, endptr, base);
+}
+
+udi_size_t udi_snprintf(char *s, udi_size_t max_bytes, const char *format, ...)
+{
+ udi_size_t ret;
+ va_list args;
+ va_start(args, format);
+
+ ret = udi_vsnprintf(s, max_bytes, format, args);
+
+ va_end(args);
+ return ret;
+}
+udi_size_t udi_vsnprintf(char *s, udi_size_t max_bytes, const char *format, va_list ap)
+{
+ // TODO: This should support some stuff Acess doesn't
+ return vsnprintf(s, max_bytes, format, ap);
+}
--- /dev/null
+/**
+ * \file time.c
+ * \author John Hodge (thePowersGang)
+ */
+#include <acess.h>
+#include <udi.h>
+
+// === EXPORTS ===
+EXPORT(udi_timer_start);
+EXPORT(udi_timer_start_repeating);
+EXPORT(udi_timer_cancel);
+EXPORT(udi_time_current);
+EXPORT(udi_time_between);
+EXPORT(udi_time_since);
+
+// === CODE ===
+void udi_timer_start(udi_timer_expired_call_t *callback, udi_cb_t *gcb, udi_time_t interval)
+{
+ UNIMPLEMENTED();
+}
+void udi_timer_start_repeating(udi_timer_tick_call_t *callback, udi_cb_t *gcb, udi_time_t interval)
+{
+ UNIMPLEMENTED();
+}
+void udi_timer_cancel(udi_cb_t *gcb)
+{
+ UNIMPLEMENTED();
+}
+
+udi_timestamp_t udi_time_current(void)
+{
+ return now();
+}
+udi_time_t udi_time_between(udi_timestamp_t start_time, udi_timestamp_t end_time)
+{
+ udi_time_t ret;
+ tTime delta = end_time - start_time;
+ ret.seconds = delta / 1000;
+ ret.nanoseconds = (delta % 1000) * 1000 * 1000;
+ return ret;
+}
+udi_time_t udi_time_since(udi_timestamp_t start_time)
+{
+ return udi_time_between(start_time, udi_time_current());
+}
+++ /dev/null
-/**
- * \file imc.c
- * \author John Hodge (thePowersGang)
- */
-#define DEBUG 1
-#include <acess.h>
-#include <udi.h>
-#include "../udi_internal.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 ===
-/**
- */
-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
- )
-{
- UNIMPLEMENTED();
-}
-
-/**
- */
-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
- )
-{
- LOG("gcb=%p,channel=%p", gcb, channel, spawn_idx, ops_idx, channel_context);
-
- // Search existing channel for a matching spawn_idx
- udi_channel_t ret = UDI_CreateChannel_Linked(channel, spawn_idx);
-
- // Bind local end of channel to ops_idx (with channel_context)
- if( ops_idx != 0 )
- {
- udi_index_t region_idx;
- tUDI_DriverInstance *inst = UDI_int_ChannelGetInstance(gcb, false, ®ion_idx);
- UDI_BindChannel(ret, false, inst, ops_idx, region_idx, channel_context, false,0);
- }
- else
- {
- // leave unbound
- }
-
- callback(gcb, ret);
-}
-
-/**
- *
- */
-void udi_channel_set_context(
- udi_channel_t target_channel, void *channel_context
- )
-{
- LOG("target_channel=%p,channel_context=%p", target_channel, channel_context);
- UDI_int_ChannelSetContext(target_channel, channel_context);
-}
-
-void udi_channel_op_abort(
- udi_channel_t target_channel, udi_cb_t *orig_cb
- )
-{
- udi_channel_event_cb_t cb;
- cb.gcb.channel = target_channel;
- cb.event = UDI_CHANNEL_CLOSED;
- cb.params.orig_cb = orig_cb;
- udi_channel_event_ind(&cb);
-}
-
-void udi_channel_close(udi_channel_t channel)
-{
- Warning("%s Unimplemented", __func__);
-}
-
-void udi_channel_event_ind(udi_channel_event_cb_t *cb)
-{
- LOG("cb=%p{...}", cb);
- const struct {
- udi_channel_event_ind_op_t *channel_event_ind_op;
- } *ops = UDI_int_ChannelPrepForCall( UDI_GCB(cb), NULL, 0 );
- if(!ops) {
- Log_Warning("UDI", "udi_channel_event_ind on wrong channel type");
- return ;
- }
-
- // UDI_int_MakeDeferredCb( UDI_GCB(cb), ops->channel_event_ind_op );
-
- UDI_int_ChannelReleaseFromCall( UDI_GCB(cb) );
- ops->channel_event_ind_op(cb);
-}
-
-void udi_channel_event_complete(udi_channel_event_cb_t *cb, udi_status_t status)
-{
- UNIMPLEMENTED();
-}
+++ /dev/null
-/**
- * \file logging.c
- * \author John Hodge (thePowersGang)
- *
- * \brief UDI Tracing, Logging and Debug
- */
-#define DEBUG 1
-#include <acess.h>
-#include <udi.h>
-
-void __udi_assert(const char *expr, const char *file, int line);
-
-// === EXPORTS ===
-EXPORT(udi_trace_write);
-EXPORT(udi_log_write);
-EXPORT(__udi_assert);
-//EXPORT(udi_assert);
-EXPORT(udi_debug_break);
-EXPORT(udi_debug_printf);
-
-// === PROTOTYPES ===
-
-// === CODE ===
-void udi_trace_write(udi_init_context_t *init_context, udi_trevent_t trace_event, udi_index_t meta_idx, udi_ubit32_t msgnum, ...)
-{
- ENTER("pinit_context itrace_event imeta_idx imsgnum",
- init_context, trace_event, meta_idx, msgnum);
-// const char *format = UDI_GetMessage(init_context, msgnum);
-// LOG("format = \"%s\"", format);
- LEAVE('-');
-}
-
-void udi_log_write( udi_log_write_call_t *callback, udi_cb_t *gcb,
- udi_trevent_t trace_event, udi_ubit8_t severity, udi_index_t meta_idx,
- udi_status_t original_status, udi_ubit32_t msgnum, ... )
-{
- Log("UDI Log");
-}
-
-void __udi_assert(const char *expr, const char *file, int line)
-{
- Log("UDI Assertion failure: %s:%i - %s", file, line, expr);
- UNIMPLEMENTED();
-}
-
-void udi_assert(udi_boolean_t bool)
-{
- UNIMPLEMENTED();
-}
-
-void udi_debug_break( udi_init_context_t *init_context, const char *message)
-{
- UNIMPLEMENTED();
-}
-
-void udi_debug_printf( const char *format, ... )
-{
- va_list args;
- va_start(args, format);
- LogF("udi_debug_printf: ");
- LogFV(format, args);
- va_end(args);
-}
+++ /dev/null
-/**
- * \file mem.c
- * \author John Hodge (thePowersGang)
- */
-#include <acess.h>
-#include <udi.h>
-
-// === EXPORTS ===
-EXPORT(udi_mem_alloc);
-EXPORT(udi_mem_free);
-
-// === CODE ===
-void udi_mem_alloc(
- udi_mem_alloc_call_t *callback,
- udi_cb_t *gcb,
- udi_size_t size,
- udi_ubit8_t flags
- )
-{
- void *buf = malloc(size);
- if(buf)
- {
- if( !(flags & UDI_MEM_NOZERO) )
- memset(buf, 0, size);
- }
- callback(gcb, buf);
-}
-
-void udi_mem_free(void *target_mem)
-{
- free(target_mem);
-}
+++ /dev/null
-/**
- * \file meta_gio.c
- * \author John Hodge (thePowersGang)
- */
-#include <acess.h>
-#include <udi.h>
-
-// === EXPORTS ===
-EXPORT(udi_gio_bind_req);
-EXPORT(udi_gio_bind_ack);
-EXPORT(udi_gio_unbind_req);
-EXPORT(udi_gio_unbind_ack);
-EXPORT(udi_gio_xfer_req);
-EXPORT(udi_gio_xfer_ack);
-EXPORT(udi_gio_xfer_nak);
-EXPORT(udi_gio_event_res);
-EXPORT(udi_gio_event_ind);
-EXPORT(udi_gio_event_res_unused);
-
-// === CODE ===
-void udi_gio_bind_req(udi_gio_bind_cb_t *cb)
-{
- UNIMPLEMENTED();
-}
-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
- )
-{
- UNIMPLEMENTED();
-}
-
-void udi_gio_unbind_req(udi_gio_bind_cb_t *cb)
-{
- UNIMPLEMENTED();
-}
-void udi_gio_unbind_ack(udi_gio_bind_cb_t *cb)
-{
- UNIMPLEMENTED();
-}
-
-void udi_gio_xfer_req(udi_gio_xfer_cb_t *cb)
-{
- UNIMPLEMENTED();
-}
-void udi_gio_xfer_ack(udi_gio_xfer_cb_t *cb)
-{
- UNIMPLEMENTED();
-}
-void udi_gio_xfer_nak(udi_gio_xfer_cb_t *cb, udi_status_t status)
-{
- UNIMPLEMENTED();
-}
-
-void udi_gio_event_res(udi_gio_event_cb_t *cb)
-{
- UNIMPLEMENTED();
-}
-void udi_gio_event_ind(udi_gio_event_cb_t *cb)
-{
- UNIMPLEMENTED();
-}
-void udi_gio_event_res_unused(udi_gio_event_cb_t *cb)
-{
- UNIMPLEMENTED();
-}
+++ /dev/null
-/**
- * \file meta_mgmt.c
- * \author John Hodge (thePowersGang)
- */
-#define DEBUG 0
-#include <acess.h>
-#include <udi.h>
-#include "../udi_internal.h"
-#include "../udi_ma.h"
-
-// === EXPORTS ===
-EXPORT(udi_usage_ind);
-EXPORT(udi_static_usage);
-EXPORT(udi_usage_res);
-EXPORT(udi_enumerate_req);
-EXPORT(udi_enumerate_no_children);
-EXPORT(udi_enumerate_ack);
-EXPORT(udi_devmgmt_req);
-EXPORT(udi_devmgmt_ack);
-EXPORT(udi_final_cleanup_req);
-EXPORT(udi_final_cleanup_ack);
-
-tUDI_MetaLang cMetaLang_Management = {
- "udi_mgmt",
-
- 1,
- {
- {sizeof(udi_enumerate_cb_t), NULL}
- }
-};
-
-// === CODE ===
-void udi_usage_ind(udi_usage_cb_t *cb, udi_ubit8_t resource_level)
-{
- LOG("cb=%p{...}, resource_level=%i", cb, resource_level);
- const udi_mgmt_ops_t *ops = UDI_int_ChannelPrepForCall( UDI_GCB(cb), &cMetaLang_Management, 0 );
- if(!ops) {
- Log_Warning("UDI", "%s on wrong channel type", __func__);
- return ;
- }
-
- // Non-deferred because it's usually called with a stack allocated cb
- UDI_int_ChannelReleaseFromCall( UDI_GCB(cb) );
- ops->usage_ind_op(cb, resource_level);
-}
-
-void udi_static_usage(udi_usage_cb_t *cb, udi_ubit8_t resource_level)
-{
- cb->trace_mask = 0;
- udi_usage_res(cb);
-}
-
-void udi_usage_res(udi_usage_cb_t *cb)
-{
- // TODO: Update trace mask from cb
- LOG("cb=%p{cb->trace_mask=%x}", cb, cb->trace_mask);
-}
-
-void udi_enumerate_req(udi_enumerate_cb_t *cb, udi_ubit8_t enumeration_level)
-{
- LOG("cb=%p{...}, enumeration_level=%i", cb, enumeration_level);
- const udi_mgmt_ops_t *ops = UDI_int_ChannelPrepForCall( UDI_GCB(cb), &cMetaLang_Management, 0 );
- if(!ops) {
- Log_Warning("UDI", "%s on wrong channel type", __func__);
- return ;
- }
-
- UDI_int_MakeDeferredCbU8( UDI_GCB(cb), (udi_op_t*)ops->enumerate_req_op, enumeration_level );
-}
-
-void udi_enumerate_no_children(udi_enumerate_cb_t *cb, udi_ubit8_t enumeration_level)
-{
- udi_enumerate_ack(cb, UDI_ENUMERATE_LEAF, 0);
-}
-
-void udi_enumerate_ack(udi_enumerate_cb_t *cb, udi_ubit8_t enumeration_result, udi_index_t ops_idx)
-{
- UDI_int_ChannelFlip( UDI_GCB(cb) );
- LOG("cb=%p, enumeration_result=%i, ops_idx=%i", cb, enumeration_result, ops_idx);
- switch( enumeration_result )
- {
- case UDI_ENUMERATE_OK:
- #if DEBUG && 0
- for( int i = 0; i < cb->attr_valid_length; i ++ )
- {
- udi_instance_attr_list_t *at = &cb->attr_list[i];
- switch(at->attr_type)
- {
- case UDI_ATTR_STRING:
- LOG("[%i] String '%.*s'", i, at->attr_length, at->attr_value);
- break;
- case UDI_ATTR_UBIT32:
- LOG("[%i] UBit32 0x%08x", i, UDI_ATTR32_GET(at->attr_value));
- break;
- default:
- LOG("[%i] %i", i, at->attr_type);
- break;
- }
- }
- #endif
- // Returned a device
- UDI_MA_AddChild(cb, ops_idx);
- udi_enumerate_req(cb, UDI_ENUMERATE_NEXT);
- return ;
- case UDI_ENUMERATE_DONE:
- // All done. Chain terminates
- return ;
- default:
- Log_Notice("UDI", "Unknown enumeration_result %i", enumeration_result);
- return ;
- }
-}
-
-void udi_devmgmt_req(udi_mgmt_cb_t *cb, udi_ubit8_t mgmt_op, udi_ubit8_t parent_ID )
-{
- ENTER("pcb imgmt_op iparent_ID", cb, mgmt_op, parent_ID);
- LEAVE('-');
-}
-
-void udi_devmgmt_ack(udi_mgmt_cb_t *cb, udi_ubit8_t flags, udi_status_t status)
-{
- ENTER("pcb xflags istatus", cb, flags, status);
- LEAVE('-');
-}
-
-void udi_final_cleanup_req(udi_mgmt_cb_t *cb)
-{
- ENTER("pcb", cb);
- LEAVE('-');
-}
-
-void udi_final_cleanup_ack(udi_mgmt_cb_t *cb)
-{
- ENTER("pcb", cb);
- LEAVE('-');
-}
-
#include <acess.h>
#include <udi.h>
#include <udi_physio.h>
-#include "../udi_internal.h"
-//#include <udi_internal/physio.h>
+#include <udi_internal.h>
+//#include <udi_internal_physio.h>
struct udi_dma_constraints_s
{
* - Bus Bridge Metalanguage
*/
#define DEBUG 1
-#include <acess.h>
#include <udi.h>
#include <udi_physio.h>
-#include "../../udi_internal.h"
+#include <acess.h>
+#include <udi_internal.h>
#define USE_MEI 0
UDI_DL_INDEX_T,
UDI_DL_END
};
+udi_layout_t udi_meta_info__bridge__intr_event_cb[] = {
+ UDI_DL_END
+};
#if USE_MEI
udi_layout_t _noargs_marshal[] = {
* \author John Hodge (thePowersGang)
*/
#define DEBUG 1
-#include <acess.h>
#include <udi.h>
#include <udi_physio.h>
-#include "../../udi_internal.h"
+#include <acess.h>
+#include <udi_internal.h>
typedef void _udi_pio_do_io_op_t(uint32_t child_ID, udi_ubit32_t regset_idx, udi_ubit32_t ofs, size_t len,
void *data, bool isOutput);
+++ /dev/null
-/**
- * \file logging.c
- * \author John Hodge (thePowersGang)
- */
-#include <common.h>
-#include <udi.h>
-#include <udi_physio.h>
-
-// === CODE ===
-void udi_bus_bind_req(udi_bus_bind_cb_t *cb)
-{
-}
-
-void udi_bus_unbind_req(udi_bus_bind_cb_t *cb)
-{
-}
+++ /dev/null
-/**
- * \file queues.c
- * \author John Hodge (thePowersGang)
- *
- * \brief UDI Queue Primatives
- */
-#include <acess.h>
-#include <udi.h>
-
-// === EXPORTS ===
-EXPORT(udi_enqueue);
-EXPORT(udi_dequeue);
-
-// === CODE ===
-void udi_enqueue(udi_queue_t *new_el, udi_queue_t *old_el)
-{
- new_el->next = old_el->next;
- new_el->prev = old_el;
- old_el->next = new_el;
- old_el->next->prev = new_el;
-}
-udi_queue_t *udi_dequeue(udi_queue_t *element)
-{
- element->next->prev = element->prev;
- element->prev->next = element->next;
- return element;
-}
+++ /dev/null
-/**
- * \file strmem.c
- * \author John Hodge (thePowersGang)
- */
-#include <acess.h>
-#include <udi.h>
-
-// === EXPORTS ===
-EXPORTAS(strlen, udi_strlen);
-EXPORTAS(strcat, udi_strcat);
-EXPORTAS(strncat, udi_strncat);
-EXPORTAS(strcmp, udi_strcmp);
-EXPORTAS(strncmp, udi_strncmp);
-EXPORTAS(memcmp, udi_memcmp);
-EXPORTAS(strcpy, udi_strcpy);
-EXPORTAS(strncpy, udi_strncpy);
-EXPORTAS(memcpy, udi_memcpy);
-EXPORTAS(memmove, udi_memmove);
-EXPORT(udi_strncpy_rtrim);
-EXPORTAS(strchr, udi_strchr);
-EXPORTAS(strrchr, udi_strrchr);
-EXPORT(udi_memchr);
-EXPORTAS(memset, udi_memset);
-EXPORT(udi_strtou32);
-EXPORT(udi_snprintf);
-EXPORT(udi_vsnprintf);
-
-// === CODE ===
-char *udi_strcpy(char *s1, const char *s2)
-{
- return strcpy(s1, s2);
-}
-char *udi_strncpy_rtrim(char *s1, const char *s2, udi_size_t n)
-{
- char *dst = s1;
- while( n-- )
- {
- *dst++ = *s2++;
- }
- while( dst > s1 && isspace(*--dst) )
- ;
- dst ++;
- *dst = '\0';
- return s1;
-}
-
-void *udi_memchr(const void *s, udi_ubit8_t c, udi_size_t n)
-{
- const udi_ubit8_t *p = s;
- while(n--)
- {
- if( *p == c )
- return (void*)p;
- p ++;
- }
- return NULL;
-}
-
-udi_ubit32_t udi_strtou32(const char *s, char **endptr, int base)
-{
- return strtoul(s, endptr, base);
-}
-
-udi_size_t udi_snprintf(char *s, udi_size_t max_bytes, const char *format, ...)
-{
- udi_size_t ret;
- va_list args;
- va_start(args, format);
-
- ret = udi_vsnprintf(s, max_bytes, format, args);
-
- va_end(args);
- return ret;
-}
-udi_size_t udi_vsnprintf(char *s, udi_size_t max_bytes, const char *format, va_list ap)
-{
- // TODO: This should support some stuff Acess doesn't
- return vsnprintf(s, max_bytes, format, ap);
-}
+++ /dev/null
-/**
- * \file time.c
- * \author John Hodge (thePowersGang)
- */
-#include <acess.h>
-#include <udi.h>
-
-// === EXPORTS ===
-EXPORT(udi_timer_start);
-EXPORT(udi_timer_start_repeating);
-EXPORT(udi_timer_cancel);
-EXPORT(udi_time_current);
-EXPORT(udi_time_between);
-EXPORT(udi_time_since);
-
-// === CODE ===
-void udi_timer_start(udi_timer_expired_call_t *callback, udi_cb_t *gcb, udi_time_t interval)
-{
- UNIMPLEMENTED();
-}
-void udi_timer_start_repeating(udi_timer_tick_call_t *callback, udi_cb_t *gcb, udi_time_t interval)
-{
- UNIMPLEMENTED();
-}
-void udi_timer_cancel(udi_cb_t *gcb)
-{
- UNIMPLEMENTED();
-}
-
-udi_timestamp_t udi_time_current(void)
-{
- return now();
-}
-udi_time_t udi_time_between(udi_timestamp_t start_time, udi_timestamp_t end_time)
-{
- udi_time_t ret;
- tTime delta = end_time - start_time;
- ret.seconds = delta / 1000;
- ret.nanoseconds = (delta % 1000) * 1000 * 1000;
- return ret;
-}
-udi_time_t udi_time_since(udi_timestamp_t start_time)
-{
- return udi_time_between(start_time, udi_time_current());
-}
+++ /dev/null
-/*
- * Acess2 UDI Layer
- * - By John Hodge (thePowersGang)
- *
- * udi_ma.h
- * - Management Agent
- */
-#ifndef _UDI_MA_H_
-#define _UDI_MA_H_
-
-extern void UDI_MA_BindParents(tUDI_DriverModule *Module);
-extern tUDI_DriverInstance *UDI_MA_CreateInstance(tUDI_DriverModule *DriverModule);
-extern tUDI_DriverRegion *UDI_MA_InitRegion(tUDI_DriverInstance *Inst, udi_ubit16_t Index, udi_ubit16_t Type, size_t RDataSize);
-extern void UDI_MA_BeginEnumeration(tUDI_DriverInstance *Inst);
-
-extern void UDI_MA_AddChild(udi_enumerate_cb_t *cb, udi_index_t ops_idx);
-
-
-extern const udi_cb_init_t cUDI_MgmtCbInitList[];
-
-extern tUDI_DriverModule *gpUDI_LoadedModules;
-
-
-#endif
-