From: John Hodge Date: Sat, 5 Oct 2013 09:28:53 +0000 (+0800) Subject: Modules/UDI - Moved UDI headers to /UDI/include X-Git-Tag: rel0.15~138 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=9e64659133d3c12fb6e315ae8de74d9b912f90dd;p=tpg%2Facess2.git Modules/UDI - Moved UDI headers to /UDI/include --- diff --git a/KernelLand/Modules/Interfaces/UDI/Makefile b/KernelLand/Modules/Interfaces/UDI/Makefile index 68155a9f..a895de43 100644 --- a/KernelLand/Modules/Interfaces/UDI/Makefile +++ b/KernelLand/Modules/Interfaces/UDI/Makefile @@ -1,7 +1,7 @@ # # -CPPFLAGS = -I./include +CPPFLAGS = -I../../../../UDI/include # - UDI Library Files LIB_OBJS := logging.o strmem.o imc.o mem.o buf.o cb.o diff --git a/KernelLand/Modules/Interfaces/UDI/include/physio/dma.h b/KernelLand/Modules/Interfaces/UDI/include/physio/dma.h deleted file mode 100644 index 90976343..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/physio/dma.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - */ -#ifndef _UDI_PHYSIO_DMA_H_ -#define _UDI_PHYSIO_DMA_H_ - -//typedef struct udi_dma_handle_s *udi_dma_handle_t; -//#define UDI_NULL_DMA_HANDLE NULL - -extern void udi_dma_limits(udi_dma_limits_t *dma_limits); - -typedef void udi_dma_prepare_call_t(udi_cb_t *gcb, udi_dma_handle_t new_dma_handle); -typedef void udi_dma_buf_map_call_t(udi_cb_t *gcb, udi_scgth_t *scgth, udi_boolean_t complete, udi_status_t status); -typedef void udi_dma_mem_alloc_call_t(udi_cb_t *gcb, udi_dma_handle_t new_dma_handle, void *mem_ptr, udi_size_t actual_gap, udi_boolean_t single_element, udi_scgth_t *scgth, udi_boolean_t must_swap); -typedef void udi_dma_sync_call_t(udi_cb_t *gcb); -typedef void udi_dma_scgth_sync_call_t(udi_cb_t *gcb); -typedef void udi_dma_mem_to_buf_call_t(udi_cb_t *gcb, udi_buf_t *new_dst_buf); - -/** - * \name Values for flags (udi_dma_prepare, udi_dma_buf_map) - * \{ - */ -#define UDI_DMA_OUT (1U<<2) -#define UDI_DMA_IN (1U<<3) -#define UDI_DMA_REWIND (1U<<4) -#define UDI_DMA_BIG_ENDIAN (1U<<5) -#define UDI_DMA_LITTLE_ENDIAN (1U<<6) -#define UDI_DMA_NEVERSWAP (1U<<7) -/** - * \} - */ - -extern void udi_dma_prepare(udi_dma_prepare_call_t *callback, udi_cb_t *gcb, - udi_dma_constraints_t constraints, udi_ubit8_t flags); - -extern void udi_dma_buf_map(udi_dma_buf_map_call_t *callback, udi_cb_t *gcb, udi_dma_handle_t dma_handle, - udi_buf_t *buf, udi_size_t offset, udi_size_t len, udi_ubit8_t flags); - -extern udi_buf_t *udi_dma_buf_unmap(udi_dma_handle_t dma_handle, udi_size_t new_buf_size); - -extern void udi_dma_mem_alloc(udi_dma_mem_alloc_call_t *callback, udi_cb_t *gcb, - udi_dma_constraints_t constraints, udi_ubit8_t flags, - udi_ubit16_t nelements, udi_size_t element_size, udi_size_t max_gap); - -extern void udi_dma_sync(udi_dma_sync_call_t *callback, udi_cb_t *gcb, udi_dma_handle_t dma_handle, - udi_size_t offset, udi_size_t len, udi_ubit8_t flags); - -extern void udi_dma_scgth_sync(udi_dma_scgth_sync_call_t *callback, udi_cb_t *gcb, udi_dma_handle_t dma_handle); - -extern void udi_dma_mem_barrier(udi_dma_handle_t dma_handle); - -extern void udi_dma_free(udi_dma_handle_t dma_handle); - -extern void udi_dma_mem_to_buf(udi_dma_mem_to_buf_call_t *callback, udi_cb_t *gcb, udi_dma_handle_t dma_handle, - udi_size_t src_off, udi_size_t src_len, udi_buf_t *dst_buf); - -#endif - diff --git a/KernelLand/Modules/Interfaces/UDI/include/physio/dma_const.h b/KernelLand/Modules/Interfaces/UDI/include/physio/dma_const.h deleted file mode 100644 index 85da58a5..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/physio/dma_const.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * - */ -#ifndef _UDI_DMA_CONST_H_ -#define _UDI_DMA_CONST_H_ - -typedef void udi_dma_constraints_attr_set_call_t(udi_cb_t *gcb, udi_dma_constraints_t new_constraints, udi_status_t status); - -/** - * \name Flags for udi_dma_constraints_attr_set - * \{ - */ -#define UDI_DMA_CONSTRAINTS_COPY (1U<<0) -/** - * \} - */ - -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); - -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); - -#endif diff --git a/KernelLand/Modules/Interfaces/UDI/include/physio/meta_bus.h b/KernelLand/Modules/Interfaces/UDI/include/physio/meta_bus.h deleted file mode 100644 index f1af116f..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/physio/meta_bus.h +++ /dev/null @@ -1,74 +0,0 @@ -/** - * \file physio/meta_bus.h - */ -#ifndef _PHYSIO_META_BUS_H_ -#define _PHYSIO_META_BUS_H_ - -#include -#include - -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 2 - -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 diff --git a/KernelLand/Modules/Interfaces/UDI/include/physio/meta_intr.h b/KernelLand/Modules/Interfaces/UDI/include/physio/meta_intr.h deleted file mode 100644 index 506eb0c8..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/physio/meta_intr.h +++ /dev/null @@ -1,100 +0,0 @@ -/** - * \file physio/meta_intr.h - */ -#ifndef _PHYSIO_META_INTR_H_ -#define _PHYSIO_META_INTR_H_ - -#include -#include -#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 diff --git a/KernelLand/Modules/Interfaces/UDI/include/physio/pci.h b/KernelLand/Modules/Interfaces/UDI/include/physio/pci.h deleted file mode 100644 index 44496d61..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/physio/pci.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - */ -#ifndef _UDI_PHYSIO_PCI_H_ -#define _UDI_PHYSIO_PCI_H_ - -#define UDI_PCI_CONFIG_SPACE 255 -#define UDI_PCI_BAR_0 0 -#define UDI_PCI_BAR_1 1 -#define UDI_PCI_BAR_2 2 -#define UDI_PCI_BAR_3 3 -#define UDI_PCI_BAR_4 4 -#define UDI_PCI_BAR_5 5 - -#endif - diff --git a/KernelLand/Modules/Interfaces/UDI/include/physio/pio.h b/KernelLand/Modules/Interfaces/UDI/include/physio/pio.h deleted file mode 100644 index aabc97f8..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/physio/pio.h +++ /dev/null @@ -1,164 +0,0 @@ -/** - * \file physio/pio.h - */ -#ifndef _PHYSIO_PIO_H_ -#define _PHYSIO_PIO_H_ - -#include -#include -typedef _udi_handle_t udi_pio_handle_t; -/* Null handle value for udi_pio_handle_t */ -#define UDI_NULL_PIO_HANDLE _NULL_HANDLE - -typedef void udi_pio_map_call_t(udi_cb_t *gcb, udi_pio_handle_t new_pio_handle); - -typedef const struct { - udi_ubit8_t pio_op; - udi_ubit8_t tran_size; - udi_ubit16_t operand; -} udi_pio_trans_t; - -/** - * \brief Values for tran_size - */ -enum { - UDI_PIO_1BYTE, - UDI_PIO_2BYTE, - UDI_PIO_4BYTE, - UDI_PIO_8BYTE, - UDI_PIO_16BYTE, - UDI_PIO_32BYTE, -}; -/** - * \brief Register numbers in pio_op - */ -enum { - UDI_PIO_R0, - UDI_PIO_R1, - UDI_PIO_R2, - UDI_PIO_R3, - UDI_PIO_R4, - UDI_PIO_R5, - UDI_PIO_R6, - UDI_PIO_R7, -}; -// Addressing modes -#define UDI_PIO_DIRECT 0x00 -#define UDI_PIO_SCRATCH 0x08 -#define UDI_PIO_BUF 0x10 -#define UDI_PIO_MEM 0x18 -// Class A opcodes -#define UDI_PIO_IN 0x00 -#define UDI_PIO_OUT 0x20 -#define UDI_PIO_LOAD 0x40 -#define UDI_PIO_STORE 0x60 -// Class B opcodes -#define UDI_PIO_LOAD_IMM 0x80 -#define UDI_PIO_CSKIP 0x88 -#define UDI_PIO_IN_IND 0x90 -#define UDI_PIO_OUT_IND 0x98 -#define UDI_PIO_SHIFT_LEFT 0xA0 -#define UDI_PIO_SHIFT_RIGHT 0xA8 -#define UDI_PIO_AND 0xB0 -#define UDI_PIO_AND_IMM 0xB8 -#define UDI_PIO_OR 0xC0 -#define UDI_PIO_OR_IMM 0xC8 -#define UDI_PIO_XOR 0xD0 -#define UDI_PIO_ADD 0xD8 -#define UDI_PIO_ADD_IMM 0xE0 -#define UDI_PIO_SUB 0xE8 -// Class C opcodes -#define UDI_PIO_BRANCH 0xF0 -#define UDI_PIO_LABEL 0xF1 -#define UDI_PIO_REP_IN_IND 0xF2 -#define UDI_PIO_REP_OUT_IND 0xF3 -#define UDI_PIO_DELAY 0xF4 -#define UDI_PIO_BARRIER 0xF5 -#define UDI_PIO_SYNC 0xF6 -#define UDI_PIO_SYNC_OUT 0xF7 -#define UDI_PIO_DEBUG 0xF8 -#define UDI_PIO_END 0xFE -#define UDI_PIO_END_IMM 0xFF -// Values for UDI_PIO_DEBUG's operand -#define UDI_PIO_TRACE_OPS_NONE 0 -#define UDI_PIO_TRACE_OPS1 1 -#define UDI_PIO_TRACE_OPS2 2 -#define UDI_PIO_TRACE_OPS3 3 -#define UDI_PIO_TRACE_REGS_NONE (0U<<2) -#define UDI_PIO_TRACE_REGS1 (1U<<2) -#define UDI_PIO_TRACE_REGS2 (2U<<2) -#define UDI_PIO_TRACE_REGS3 (3U<<2) -#define UDI_PIO_TRACE_DEV_NONE (0U<<4) -#define UDI_PIO_TRACE_DEV1 (1U<<4) -#define UDI_PIO_TRACE_DEV2 (2U<<4) -#define UDI_PIO_TRACE_DEV3 (3U<<4) -// Values for conditional operations -#define UDI_PIO_Z 0 // reg == 0 -#define UDI_PIO_NZ 1 // reg != 0 -#define UDI_PIO_NEG 2 // reg < 0 (signed) -#define UDI_PIO_NNEG 3 // reg >= 0 (signed) - -#define UDI_PIO_REP_ARGS(mode,mem_reg,mem_stride,pio_reg,pio_stride,cnt_reg) \ - ((mode)|(mem_reg)|((mem_stride)<<5)|((pio_reg)<<7)|((pio_stride)<<10)|((cnt_reg)<<13)) - -//! \brief PIO Handle Layout Element Type Code -#define UDI_DL_PIO_HANDLE_T 200 - -/** - * \name PIO Handle Allocation and Initialisation - * \{ - */ - -/** - * \name Values for pio_attributes of udi_pio_map - * \{ - */ -#define UDI_PIO_STRICTORDER (1U<<0) -#define UDI_PIO_UNORDERED_OK (1U<<1) -#define UDI_PIO_MERGING_OK (1U<<2) -#define UDI_PIO_LOADCACHING_OK (1U<<3) -#define UDI_PIO_STORECACHING_OK (1U<<4) -#define UDI_PIO_BIG_ENDIAN (1U<<5) -#define UDI_PIO_LITTLE_ENDIAN (1U<<6) -#define UDI_PIO_NEVERSWAP (1U<<7) -#define UDI_PIO_UNALIGNED (1U<<8) -/** - * \} - */ - -extern void udi_pio_map(udi_pio_map_call_t *callback, udi_cb_t *gcb, - udi_ubit32_t regset_idx, udi_ubit32_t base_offset, udi_ubit32_t length, - udi_pio_trans_t *trans_list, udi_ubit16_t list_length, - udi_ubit16_t pio_attributes, udi_ubit32_t pace, udi_index_t serialization_domain); - -extern void udi_pio_unmap(udi_pio_handle_t pio_handle); - -extern udi_ubit32_t udi_pio_atmic_sizes(udi_pio_handle_t pio_handle); - -extern void udi_pio_abort_sequence(udi_pio_handle_t pio_handle, udi_size_t scratch_requirement); - -/** - * \} - */ - -/** - * \name PIO Access Service Calls - * \{ - */ -typedef void udi_pio_trans_call_t(udi_cb_t *gcb, udi_buf_t *new_buf, udi_status_t status, udi_ubit16_t result); - -extern void udi_pio_trans(udi_pio_trans_call_t *callback, udi_cb_t *gcb, - udi_pio_handle_t pio_handle, udi_index_t start_label, - udi_buf_t *buf, void *mem_ptr); - -typedef void udi_pio_probe_call_t(udi_cb_t *gcb, udi_status_t status); - -extern void udi_pio_probe(udi_pio_probe_call_t *callback, udi_cb_t *gcb, - udi_pio_handle_t pio_handle, void *mem_ptr, udi_ubit32_t pio_offset, - udi_ubit8_t tran_size, udi_ubit8_t direction); - -/** - * \} - */ - -#endif diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi.h b/KernelLand/Modules/Interfaces/UDI/include/udi.h deleted file mode 100644 index 0e097d75..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/udi.h +++ /dev/null @@ -1,127 +0,0 @@ -/** - * \file udi.h - */ -#ifndef _UDI_H_ -#define _UDI_H_ - -#include -#include - -typedef int8_t udi_sbit8_t; /* signed 8-bit: -2^7..2^7-1 */ -typedef int16_t udi_sbit16_t; /* signed 16-bit: -2^15..2^15-1 */ -typedef int32_t udi_sbit32_t; /* signed 32-bit: -2^31..2^31-1 */ -typedef uint8_t udi_ubit8_t; /* unsigned 8-bit: 0..28-1 */ -typedef uint16_t udi_ubit16_t; /* unsigned 16-bit: 0..216-1 */ -typedef uint32_t udi_ubit32_t; /* unsigned 32-bit: 0..232-1 */ - -#ifndef NULL -# define NULL ((void*)0) -#endif - -#if UDI_ABI_is_ia32 -#include "udi/arch/x86.h" -#else -#error "Unknown UDI ABI" -#endif - -/** - * \name Values and Flags for udi_status_t - * \{ - */ -#define UDI_STATUS_CODE_MASK 0x0000FFFF -#define UDI_STAT_META_SPECIFIC 0x00008000 -#define UDI_SPECIFIC_STATUS_MASK 0x00007FFF -#define UDI_CORRELATE_OFFSET 16 -#define UDI_CORRELATE_MASK 0xFFFF0000 -/* Common Status Values */ -#define UDI_OK 0 -#define UDI_STAT_NOT_SUPPORTED 1 -#define UDI_STAT_NOT_UNDERSTOOD 2 -#define UDI_STAT_INVALID_STATE 3 -#define UDI_STAT_MISTAKEN_IDENTITY 4 -#define UDI_STAT_ABORTED 5 -#define UDI_STAT_TIMEOUT 6 -#define UDI_STAT_BUSY 7 -#define UDI_STAT_RESOURCE_UNAVAIL 8 -#define UDI_STAT_HW_PROBLEM 9 -#define UDI_STAT_NOT_RESPONDING 10 -#define UDI_STAT_DATA_UNDERRUN 11 -#define UDI_STAT_DATA_OVERRUN 12 -#define UDI_STAT_DATA_ERROR 13 -#define UDI_STAT_PARENT_DRV_ERROR 14 -#define UDI_STAT_CANNOT_BIND 15 -#define UDI_STAT_CANNOT_BIND_EXCL 16 -#define UDI_STAT_TOO_MANY_PARENTS 17 -#define UDI_STAT_BAD_PARENT_TYPE 18 -#define UDI_STAT_TERMINATED 19 -#define UDI_STAT_ATTR_MISMATCH 20 -/** - * \} - */ - -/** - * \name Data Layout Specifiers - * \{ - */ -typedef const udi_ubit8_t udi_layout_t; -/* Specific-Length Layout Type Codes */ -#define UDI_DL_UBIT8_T 1 -#define UDI_DL_SBIT8_T 2 -#define UDI_DL_UBIT16_T 3 -#define UDI_DL_SBIT16_T 4 -#define UDI_DL_UBIT32_T 5 -#define UDI_DL_SBIT32_T 6 -#define UDI_DL_BOOLEAN_T 7 -#define UDI_DL_STATUS_T 8 -/* Abstract Element Layout Type Codes */ -#define UDI_DL_INDEX_T 20 -/* Opaque Handle Element Layout Type Codes */ -#define UDI_DL_CHANNEL_T 30 -#define UDI_DL_ORIGIN_T 32 -/* Indirect Element Layout Type Codes */ -#define UDI_DL_BUF 40 -#define UDI_DL_CB 41 -#define UDI_DL_INLINE_UNTYPED 42 -#define UDI_DL_INLINE_DRIVER_TYPED 43 -#define UDI_DL_MOVABLE_UNTYPED 44 -/* Nested Element Layout Type Codes */ -#define UDI_DL_INLINE_TYPED 50 -#define UDI_DL_MOVABLE_TYPED 51 -#define UDI_DL_ARRAY 52 -#define UDI_DL_END 0 -/** - * \} - */ - - -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; - -// === INCLUDE SUB-SECTIONS === -#include "udi/cb.h" // Control Blocks -#include "udi/time.h" // Timer Services -#include "udi/log.h" // Logging -#include "udi/attr.h" // Attributes -#include "udi/strmem.h" // String/Memory -#include "udi/queues.h" // Queues -#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 diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi/arch/x86.h b/KernelLand/Modules/Interfaces/UDI/include/udi/arch/x86.h deleted file mode 100644 index 4608aa36..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/udi/arch/x86.h +++ /dev/null @@ -1,60 +0,0 @@ - -#ifndef _UDI_ARCH_x86_H_ -#define _UDI_ARCH_x86_H_ - -typedef udi_ubit8_t udi_boolean_t; /* 0=False; 1..28-1=True */ -#define FALSE 0 -#define TRUE 1 - -typedef uint32_t udi_size_t; /* buffer size */ -typedef udi_ubit8_t udi_index_t; /* zero-based index type */ - -typedef void *_udi_handle_t; -#define _NULL_HANDLE ((void*)0) - -/* Channel Handle */ -typedef _udi_handle_t *udi_channel_t; -#define UDI_NULL_CHANNEL _NULL_HANDLE - -/** - * \brief Buffer Path - */ -typedef _udi_handle_t udi_buf_path_t; -#define UDI_NULL_BUF_PATH _NULL_HANDLE - -typedef _udi_handle_t udi_origin_t; -#define UDI_NULL_ORIGIN _NULL_HANDLE - -typedef int64_t udi_timestamp_t; - -#define UDI_HANDLE_IS_NULL(handle, handle_type) (handle == NULL) -#define UDI_HANDLE_ID(handle, handle_type) ((uint32_t)handle) - -/** - * \name va_arg wrapper - * \{ - */ -#define UDI_VA_ARG(pvar, type, va_code) va_arg(pvar,type) -#define UDI_VA_UBIT8_T -#define UDI_VA_SBIT8_T -#define UDI_VA_UBIT16_T -#define UDI_VA_SBIT16_T -#define UDI_VA_UBIT32_T -#define UDI_VA_SBIT32_T -#define UDI_VA_BOOLEAN_T -#define UDI_VA_INDEX_T -#define UDI_VA_SIZE_T -#define UDI_VA_STATUS_T -#define UDI_VA_CHANNEL_T -#define UDI_VA_ORIGIN_T -#define UDI_VA_POINTER -/** - * \} - */ - -/** - * \brief Status Type - */ -typedef udi_ubit32_t udi_status_t; - -#endif diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi/attr.h b/KernelLand/Modules/Interfaces/UDI/include/udi/attr.h deleted file mode 100644 index 729f4698..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/udi/attr.h +++ /dev/null @@ -1,54 +0,0 @@ -/** - * \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 - -#define UDI_ATTR32_SET(aval, v) \ - { udi_ubit32_t vtmp = (v); \ - (aval)[0] = (vtmp) & 0xff; \ - (aval)[1] = ((vtmp) >> 8) & 0xff; \ - (aval)[2] = ((vtmp) >> 16) & 0xff; \ - (aval)[3] = ((vtmp) >> 24) & 0xff; } -#define UDI_ATTR32_GET(aval) \ - ((aval)[0] + ((aval)[1] << 8) + \ - ((aval)[2] << 16) + ((aval)[3] << 24)) -#define UDI_ATTR32_INIT(v) \ - { (v) & 0xff, ((v) >> 8) & 0xff, \ - ((v) >> 16) & 0xff, ((v) >> 24) & 0xff } - -/** - * \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 diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi/buf.h b/KernelLand/Modules/Interfaces/UDI/include/udi/buf.h deleted file mode 100644 index e82651f3..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/udi/buf.h +++ /dev/null @@ -1,105 +0,0 @@ -/** - * \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; - udi_ubit8_t 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 diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi/cb.h b/KernelLand/Modules/Interfaces/UDI/include/udi/cb.h deleted file mode 100644 index cd8ea1b1..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/udi/cb.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * \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 Source-usable value - */ - 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 diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi/imc.h b/KernelLand/Modules/Interfaces/UDI/include/udi/imc.h deleted file mode 100644 index e5b3f3bb..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/udi/imc.h +++ /dev/null @@ -1,92 +0,0 @@ -/** - * \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 diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi/init.h b/KernelLand/Modules/Interfaces/UDI/include/udi/init.h deleted file mode 100644 index a4d9142b..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/udi/init.h +++ /dev/null @@ -1,299 +0,0 @@ -/** - * \file udi_init.h - */ -#ifndef _UDI_INIT_H_ -#define _UDI_INIT_H_ - -/** - * \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; -} __attribute__((packed)); - - -/** - * \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 <>_<>_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; -} __attribute__((packed)); - -/** - * \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; -} __attribute__((packed)); - -/** - * \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 diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi/log.h b/KernelLand/Modules/Interfaces/UDI/include/udi/log.h deleted file mode 100644 index bc28735e..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/udi/log.h +++ /dev/null @@ -1,81 +0,0 @@ -/** - * \file udi_log.h - */ -#ifndef _UDI_LOG_H_ -#define _UDI_LOG_H_ - -/** - * \brief Trace Event - */ -typedef udi_ubit32_t udi_trevent_t; - -/** - * \name Values for udi_trevent_t - * \note Taken from UDI Spec 1.01 - * \{ - */ -/* Common Trace Events */ -#define UDI_TREVENT_LOCAL_PROC_ENTRY (1U<<0) -#define UDI_TREVENT_LOCAL_PROC_EXIT (1U<<1) -#define UDI_TREVENT_EXTERNAL_ERROR (1U<<2) -/* Common Metalanguage-Selectable Trace Events */ -#define UDI_TREVENT_IO_SCHEDULED (1U<<6) -#define UDI_TREVENT_IO_COMPLETED (1U<<7) -/* Metalanguage-Specific Trace Events */ -#define UDI_TREVENT_META_SPECIFIC_1 (1U<<11) -#define UDI_TREVENT_META_SPECIFIC_2 (1U<<12) -#define UDI_TREVENT_META_SPECIFIC_3 (1U<<13) -#define UDI_TREVENT_META_SPECIFIC_4 (1U<<14) -#define UDI_TREVENT_META_SPECIFIC_5 (1U<<15) -/* Driver-Specific Trace Events */ -#define UDI_TREVENT_INTERNAL_1 (1U<<16) -#define UDI_TREVENT_INTERNAL_2 (1U<<17) -#define UDI_TREVENT_INTERNAL_3 (1U<<18) -#define UDI_TREVENT_INTERNAL_4 (1U<<19) -#define UDI_TREVENT_INTERNAL_5 (1U<<20) -#define UDI_TREVENT_INTERNAL_6 (1U<<21) -#define UDI_TREVENT_INTERNAL_7 (1U<<22) -#define UDI_TREVENT_INTERNAL_8 (1U<<23) -#define UDI_TREVENT_INTERNAL_9 (1U<<24) -#define UDI_TREVENT_INTERNAL_10 (1U<<25) -#define UDI_TREVENT_INTERNAL_11 (1U<<26) -#define UDI_TREVENT_INTERNAL_12 (1U<<27) -#define UDI_TREVENT_INTERNAL_13 (1U<<28) -#define UDI_TREVENT_INTERNAL_14 (1U<<29) -#define UDI_TREVENT_INTERNAL_15 (1U<<30) -/* Logging Event */ -#define UDI_TREVENT_LOG (1U<<31) - -/** - * \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 -/** - * \} - */ - -extern void udi_trace_write(udi_init_context_t *init_context, - udi_trevent_t trace_event, udi_index_t meta_idx, - udi_ubit32_t msgnum, ...); - -extern 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, ... ); - -extern void udi_assert(udi_boolean_t expr); - -extern void udi_debug_break(udi_init_context_t *init_context, const char *message); - -extern void udi_debug_printf(const char *format, ...); - -#endif diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi/mei.h b/KernelLand/Modules/Interfaces/UDI/include/udi/mei.h deleted file mode 100644 index ef764054..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/udi/mei.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Acess2 UDI Layer - * - By John Hodge (thePowersGang) - * - * include/udi/mei.h - * - Metalanguage-to-Environment Interface - */ -#ifndef _UDI__MEI_H_ -#define _UDI__MEI_H_ - -typedef const struct udi_mei_init_s udi_mei_init_t; -typedef const struct udi_mei_ops_vec_template_s udi_mei_ops_vec_template_t; -typedef const struct uid_mei_op_template_s uid_mei_op_template_t; - -typedef udi_ubit8_t udi_mei_enumeration_rank_func_t(udi_ubit32_t attr_device_match, void **attr_value_list); -typedef void udi_mei_direct_stub_t(udi_op_t *op, udi_cb_t *gcb, va_list arglist); -typedef void udi_mei_backend_stub_t(udi_op_t *op, udi_cb_t *gcb, void *marshal_space); - -struct udi_mei_init_s -{ - udi_mei_ops_vec_template_t *ops_vec_template_list; - udi_mei_enumeration_rank_func_t *mei_enumeration_rank; -}; - -struct udi_mei_ops_vec_template_s -{ - udi_index_t meta_ops_num; - udi_ubit8_t relationship; - const udi_mei_op_template_t *op_template_list; -}; -// Flags for `relationship` -#define UDI_MEI_REL_INITIATOR (1U<<0) -#define UDI_MEI_REL_BIND (1U<<1) -#define UDI_MEI_REL_EXTERNAL (1U<<2) -#define UDI_MEI_REL_INTERNAL (1U<<3) -#define UDI_MEI_REL_SINGLE (1U<<4) - -struct uid_mei_op_template_s -{ - const char *op_name; - udi_ubit8_t op_category; - udi_ubit8_t op_flags; - udi_index_t meta_cb_num; - udi_index_t completion_ops_num; - udi_index_t completion_vec_idx; - udi_index_t exception_ops_num; - udi_index_t exception_vec_idx; - udi_mei_direct_stub_t *direct_stub; - udi_mei_backend_stub_t *backend_stub; - udi_layout_t *visible_layout; - udi_layout_t *marshal_layout; -}; -/* Values for op_category */ -#define UDI_MEI_OPCAT_REQ 1 -#define UDI_MEI_OPCAT_ACK 2 -#define UDI_MEI_OPCAT_NAK 3 -#define UDI_MEI_OPCAT_IND 4 -#define UDI_MEI_OPCAT_RES 5 -#define UDI_MEI_OPCAT_RDY 6 -/* Values for op_flags */ -#define UDI_MEI_OP_ABORTABLE (1U<<0) -#define UDI_MEI_OP_RECOVERABLE (1U<<1) -#define UDI_MEI_OP_STATE_CHANGE (1U<<2) -/* Maximum Sizes For Control Block Layouts */ -#define UDI_MEI_MAX_VISIBLE_SIZE 2000 -#define UDI_MEI_MAX_MARSHAL_SIZE 4000 - -#define _UDI_MEI_FIRST(lst, ...) lst -#define _UDI_MEI_OTHER(lst, ...) __VA_ARGS__ -#define _UDI_MEI_VARG(type,name,vatype) \ - type name = UDI_VA_ARG(arglist, type, vatype); -#define _UDI_MEI_VARGS0() -#define _UDI_MEI_VARGS1(args,argt,argva) \ - _UDI_MEI_VARG(_UDI_MEI_FIRST(argt), _UDI_MEI_FIRST(args),_UDI_MEI_FIRST(argva)) -#define _UDI_MEI_VARGS2(args,argt,argva) \ - _UDI_MEI_VARG(_UDI_MEI_FIRST(argt), _UDI_MEI_FIRST(args),_UDI_MEI_FIRST(argva)) \ - _UDI_MEI_VARGS1( _UDI_MEI_OTHER(argt), _UDI_MEI_OTHER(args), _UDI_MEI_OTHER(argva) ) - -#define UDI_MEI_STUBS(op_name, cb_type, argc, args, arg_types, arg_va_list, meta_ops_num, vec_idx) \ - void op_name(cb_type *cb, _UDI_ARG_LIST_##argc args ) {\ - udi_mei_call(UDI_GCB(cb), &udi_mei_info, meta_ops_num, vec_idx, args);\ - }\ - void op_name##_direct(udi_op_t *op, udi_cb_t *gcb, va_lis arglist) {\ - _UDI_MEI_VARGS##argc(args ,## arg_types ,## arg_va_list)\ - (*(op_name##_op_t)op)(UDI_MCB(gcb, cb_type) ,## args);\ - }\ - void op_name##_backend(udi_op_t *op, udi_cb_t *gcb, void *marshal_space) {\ - } - -#endif - diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi/mem.h b/KernelLand/Modules/Interfaces/UDI/include/udi/mem.h deleted file mode 100644 index d29f25ed..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/udi/mem.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * \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 diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi/meta_gio.h b/KernelLand/Modules/Interfaces/UDI/include/udi/meta_gio.h deleted file mode 100644 index d1cf86fd..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/udi/meta_gio.h +++ /dev/null @@ -1,120 +0,0 @@ -/** - * \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 diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi/meta_mgmt.h b/KernelLand/Modules/Interfaces/UDI/include/udi/meta_mgmt.h deleted file mode 100644 index a913552a..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/udi/meta_mgmt.h +++ /dev/null @@ -1,162 +0,0 @@ -/** - * \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); - -extern void udi_usage_ind(udi_usage_cb_t *cb, udi_ubit8_t resource_level); -/** - * \} - */ - -typedef void udi_usage_res_op_t(udi_usage_cb_t *cb); - -extern void udi_usage_res(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); -extern void udi_enumerate_req(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 -extern void udi_enumerate_ack(udi_enumerate_cb_t *cb, udi_ubit8_t enumeration_result, udi_index_t ops_idx); -/** - * \} - */ - -/** - * \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 diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi/queues.h b/KernelLand/Modules/Interfaces/UDI/include/udi/queues.h deleted file mode 100644 index c19ec952..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/udi/queues.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * \file udi_queues.h - * \brief Queue Management Utility Functions - */ -#ifndef _UDI_QUEUES_H_ -#define _UDI_QUEUES_H_ - -typedef struct udi_queue udi_queue_t; - -struct udi_queue -{ - struct udi_queue *next; - struct udi_queue *prev; -}; - -extern void udi_enqueue(udi_queue_t *new_el, udi_queue_t *old_el); -extern udi_queue_t *udi_dequeue(udi_queue_t *element); - -#define UDI_QUEUE_INIT(listhead) ((listhead)->next = (listhead)->prev = (listhead)) -#define UDI_QUEUE_EMPTY(listhead) ((listhead)->next == (listhead)->prev) -// TODO: other queue macros - -#endif - diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi/strmem.h b/KernelLand/Modules/Interfaces/UDI/include/udi/strmem.h deleted file mode 100644 index b5de131c..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/udi/strmem.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * \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, ...); -extern udi_size_t udi_vsnprintf(char *s, udi_size_t max_bytes, const char *format, va_list ap); - - - -#endif diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi/time.h b/KernelLand/Modules/Interfaces/UDI/include/udi/time.h deleted file mode 100644 index 2654ce84..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/udi/time.h +++ /dev/null @@ -1,22 +0,0 @@ - -#ifndef _UDI_TIME_H_ -#define _UDI_TIME_H_ - -typedef struct { - udi_ubit32_t seconds; - udi_ubit32_t nanoseconds; -} udi_time_t; - -typedef void udi_timer_expired_call_t(udi_cb_t *gcb); -typedef void udi_timer_tick_call_t(udi_cb_t *gcb, udi_ubit32_t missed); - -extern void udi_timer_start(udi_timer_expired_call_t *callback, udi_cb_t *gcb, udi_time_t interval); -extern void udi_timer_start_repeating(udi_timer_tick_call_t *callback, udi_cb_t *gcb, udi_time_t interval); -extern void udi_timer_cancel(udi_cb_t *gcb); - -extern udi_timestamp_t udi_time_current(void); -extern udi_time_t udi_time_between(udi_timestamp_t start_time, udi_timestamp_t end_time); -extern udi_time_t udi_time_since(udi_timestamp_t start_time); - -#endif - diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi_nic.h b/KernelLand/Modules/Interfaces/UDI/include/udi_nic.h deleted file mode 100644 index 169a81bf..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/udi_nic.h +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Acess2 UDI Environment (NIC Bindings) - * - By John Hodge (thePowersGang) - * - * udi_nic.h - * - NIC Bindings core - */ -#ifndef _UDI_NIC_H_ -#define _UDI_NIC_H_ - -// === CBs === -#define UDI_NIC_STD_CB_NUM 1 -#define UDI_NIC_BIND_CB_NUM 2 -#define UDI_NIC_CTRL_CB_NUM 3 -#define UDI_NIC_STATUS_CB_NUM 4 -#define UDI_NIC_INFO_CB_NUM 5 -#define UDI_NIC_TX_CB_NUM 6 -#define UDI_NIC_RX_CB_NUM 7 - -typedef struct { - udi_cb_t gcb; -} udi_nic_cb_t; - -#define UDI_NIC_MAC_ADDRESS_SIZE 20 -// Media type -#define UDI_NIC_ETHER 0 -#define UDI_NIC_TOKEN 1 -#define UDI_NIC_FASTETHER 2 -#define UDI_NIC_GIGETHER 3 -#define UDI_NIC_VGANYLAN 4 -#define UDI_NIC_FDDI 5 -#define UDI_NIC_ATM 6 -#define UDI_NIC_FC 7 -#define UDI_NIC_MISCMEDIA 0xff -// capabilities -#define UDI_NIC_CAP_TX_IP_CKSUM (1U<<0) -#define UDI_NIC_CAP_TX_TCP_CKSUM (1U<<1) -#define UDI_NIC_CAP_TX_UDP_CKSUM (1U<<2) -#define UDI_NIC_CAP_MCAST_LOOPBK (1U<<3) -#define UDI_NIC_CAP_BCAST_LOOPBK (1U<<4) -// capabilities (requests) -#define UDI_NIC_CAP_USE_TX_CKSUM (1U<<30) -#define UDI_NIC_CAP_USE_RX_CKSUM (1U<<31) -typedef struct { - udi_cb_t gcb; - udi_ubit8_t media_type; - udi_ubit32_t min_pdu_size; - udi_ubit32_t max_pdu_size; - udi_ubit32_t rx_hw_threshold; - udi_ubit32_t capabilities; - udi_ubit8_t max_perfect_multicast; - udi_ubit8_t max_total_multicast; - udi_ubit8_t mac_addr_len; - udi_ubit8_t mac_addr[UDI_NIC_MAC_ADDRESS_SIZE]; -} udi_nic_bind_cb_t; - -// commands -#define UDI_NIC_ADD_MULTI 1 -#define UDI_NIC_DEL_MULTI 2 -#define UDI_NIC_ALLMULTI_ON 3 -#define UDI_NIC_ALLMULTI_OFF 4 -#define UDI_NIC_GET_CURR_MAC 5 -#define UDI_NIC_SET_CURR_MAC 6 -#define UDI_NIC_GET_FACT_MAC 7 -#define UDI_NIC_PROMISC_ON 8 -#define UDI_NIC_PROMISC_OFF 9 -#define UDI_NIC_HW_RESET 10 -#define UDI_NIC_BAD_RXPKT 11 -typedef struct { - udi_cb_t gcb; - udi_ubit8_t command; - udi_ubit32_t indicator; - udi_buf_t *data_buf; -} udi_nic_ctrl_cb_t; - -// event -#define UDI_NIC_LINK_DOWN 0 -#define UDI_NIC_LINK_UP 1 -#define UDI_NIC_LINK_RESET 2 -typedef struct { - udi_cb_t gcb; - udi_ubit8_t event; -} udi_nic_status_cb_t; - -typedef struct { - udi_cb_t gcb; - udi_boolean_t interface_is_active; - udi_boolean_t link_is_active; - udi_boolean_t is_full_duplex; - udi_ubit32_t link_mbps; - udi_ubit32_t link_bps; - udi_ubit32_t tx_packets; - udi_ubit32_t rx_packets; - udi_ubit32_t tx_errors; - udi_ubit32_t rx_errors; - udi_ubit32_t tx_discards; - udi_ubit32_t rx_discards; - udi_ubit32_t tx_underrun; - udi_ubit32_t rx_overrun; - udi_ubit32_t collisions; -} udi_nic_info_cb_t; - -typedef struct udi_nic_tx_cb_s { - udi_cb_t gcb; - struct udi_nic_tx_cb_s *chain; - udi_buf_t *tx_buf; - udi_boolean_t completion_urgent; -} udi_nic_tx_cb_t; - -// rx_status -#define UDI_NIC_RX_BADCKSUM (1U<<0) -#define UDI_NIC_RX_UNDERRUN (1U<<1) -#define UDI_NIC_RX_OVERRUN (1U<<2) -#define UDI_NIC_RX_DRIBBLE (1U<<3) -#define UDI_NIC_RX_FRAME_ERR (1U<<4) -#define UDI_NIC_RX_MAC_ERR (1U<<5) -#define UDI_NIC_RX_OTHER_ERR (1U<<7) -// addr_match -#define UDI_NIC_RX_UNKNOWN 0 -#define UDI_NIC_RX_EXACT 1 -#define UDI_NIC_RX_HASH 2 -#define UDI_NIC_RX_BROADCAST 3 -// rx_valid -#define UDI_NIC_RX_GOOD_IP_CKSUM (1U<<0) -#define UDI_NIC_RX_GOOD_TCP_CKSUM (1U<<1) -#define UDI_NIC_RX_GOOD_UDP_CKSUM (1U<<2) -typedef struct udi_nic_rx_cb_s { - udi_cb_t gcb; - struct udi_nic_rx_cb_s *chain; - udi_buf_t *rx_buf; - udi_ubit8_t rx_status; - udi_ubit8_t addr_match; - udi_ubit8_t rx_valid; -} udi_nic_rx_cb_t; - -// === Function Types === -// - Control -typedef void udi_nd_bind_req_op_t(udi_nic_bind_cb_t *cb, udi_index_t tx_chan_index, udi_index_t rx_chan_index); -typedef void udi_nsr_bind_ack_op_t(udi_nic_bind_cb_t *cb, udi_status_t status); -typedef void udi_nd_unbind_req_op_t(udi_nic_cb_t *cb); -typedef void udi_nsr_unbind_ack_op_t(udi_nic_cb_t *cb, udi_status_t status); -typedef void udi_nd_enable_req_op_t(udi_nic_cb_t *cb); -typedef void udi_nsr_enable_ack_op_t(udi_nic_cb_t *cb, udi_status_t status); -typedef void udi_nd_disable_req_op_t(udi_nic_cb_t *cb); -typedef void udi_nsr_disable_ack_op_t(udi_nic_cb_t *cb, udi_status_t status); -typedef void udi_nd_ctrl_req_op_t(udi_nic_ctrl_cb_t *cb); -typedef void udi_nsr_ctrl_ack_op_t(udi_nic_ctrl_cb_t *cb, udi_status_t status); -typedef void udi_nsr_status_ind_op_t(udi_nic_status_cb_t *cb); -typedef void udi_nd_info_req_op_t(udi_nic_info_cb_t *cb, udi_boolean_t reset_statistics); -typedef void udi_nsr_info_ack_op_t(udi_nic_info_cb_t *cb); -// - TX -typedef void udi_nsr_tx_rdy_op_t(udi_nic_tx_cb_t *cb); -typedef void udi_nd_tx_req_op_t(udi_nic_tx_cb_t *cb); -typedef void udi_nd_exp_tx_req_op_t(udi_nic_tx_cb_t *cb); -// - RX -typedef void udi_nsr_rx_ind_op_t(udi_nic_rx_cb_t *cb); -typedef void udi_nsr_exp_rx_ind_op_t(udi_nic_rx_cb_t *cb); -typedef void udi_nd_rx_rdy_op_t(udi_nic_rx_cb_t *cb); - -// === Functions === -// - Control -extern udi_nd_bind_req_op_t udi_nd_bind_req; -extern udi_nsr_bind_ack_op_t udi_nsr_bind_ack; -extern udi_nd_unbind_req_op_t udi_nd_unbind_req; -extern udi_nsr_unbind_ack_op_t udi_nsr_unbind_ack; -extern udi_nd_enable_req_op_t udi_nd_enable_req; -extern udi_nsr_enable_ack_op_t udi_nsr_enable_ack; -extern udi_nd_disable_req_op_t udi_nd_disable_req; -extern udi_nsr_disable_ack_op_t udi_nsr_disable_ack; -extern udi_nd_ctrl_req_op_t udi_nd_ctrl_req; -extern udi_nsr_ctrl_ack_op_t udi_nsr_ctrl_ack; -extern udi_nsr_status_ind_op_t udi_nsr_status_ind; -extern udi_nd_info_req_op_t udi_nd_info_req; -extern udi_nsr_info_ack_op_t udi_nsr_info_ack; -// - TX -extern udi_nsr_tx_rdy_op_t udi_nsr_tx_rdy; -extern udi_nd_tx_req_op_t udi_nd_tx_req; -extern udi_nd_exp_tx_req_op_t udi_nd_exp_tx_req; -// - RX -extern udi_nsr_rx_ind_op_t udi_nsr_rx_ind; -extern udi_nsr_exp_rx_ind_op_t udi_nsr_exp_rx_ind; -extern udi_nd_rx_rdy_op_t udi_nd_rx_rdy; - -// === Op Lists == -#define UDI_ND_CTRL_OPS_NUM 1 -#define UDI_ND_TX_OPS_NUM 2 -#define UDI_ND_RX_OPS_NUM 3 -#define UDI_NSR_CTRL_OPS_NUM 4 -#define UDI_NSR_TX_OPS_NUM 5 -#define UDI_NSR_RX_OPS_NUM 6 - -typedef const struct { - udi_channel_event_ind_op_t *channel_event_ind_op; - udi_nd_bind_req_op_t *nd_bind_req_op; - udi_nd_unbind_req_op_t *nd_unbind_req_op; - udi_nd_enable_req_op_t *nd_enable_req_op; - udi_nd_disable_req_op_t *nd_disable_req_op; - udi_nd_ctrl_req_op_t *nd_ctrl_req_op; - udi_nd_info_req_op_t *nd_info_req_op; -} udi_nd_ctrl_ops_t; - -typedef const struct { - udi_channel_event_ind_op_t *channel_event_ind_op; - udi_nd_tx_req_op_t *nd_tx_req_op; - udi_nd_exp_tx_req_op_t *nd_exp_tx_req_op; -} udi_nd_tx_ops_t; - -typedef const struct { - udi_channel_event_ind_op_t *channel_event_ind_op; - udi_nd_rx_rdy_op_t *nd_rx_rdy_op; -} udi_nd_rx_ops_t; - -typedef const struct { - udi_channel_event_ind_op_t *channel_event_ind_op; - udi_nsr_bind_ack_op_t *nsr_bind_ack_op; - udi_nsr_unbind_ack_op_t *nsr_unbind_ack_op; - udi_nsr_enable_ack_op_t *nsr_enable_ack_op; - udi_nsr_ctrl_ack_op_t *nsr_ctrl_ack_op; - udi_nsr_info_ack_op_t *nsr_info_ack_op; - udi_nsr_status_ind_op_t *nsr_status_ind_op; -} udi_nsr_ctrl_ops_t; - -typedef const struct { - udi_channel_event_ind_op_t *channel_event_ind_op; - udi_nsr_tx_rdy_op_t *nsr_tx_rdy_op; -} udi_nsr_tx_ops_t; - -typedef const struct { - udi_channel_event_ind_op_t *channel_event_ind_op; - udi_nsr_rx_ind_op_t *nsr_rx_ind_op; - udi_nsr_exp_rx_ind_op_t *nsr_exp_rx_ind_op; -} udi_nsr_rx_ops_t; - -#endif - diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi_pci.h b/KernelLand/Modules/Interfaces/UDI/include/udi_pci.h deleted file mode 100644 index f65c6fd5..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/udi_pci.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Acess2 UDI Layer - * - By John Hodge (thePowersGang) - * - * include/udi_pci.h - * - PCI Bus Binding - */ -#ifndef _UDI_PCI_H_ -#define _UDI_PCI_H_ - -#ifndef _UDI_PHYSIO_H_ -# error "udi_pci.h requires udi_physio.h" -#endif - -#define UDI_PCI_CONFIG_SPACE 255 -#define UDI_PCI_BAR_0 0 -#define UDI_PCI_BAR_1 1 -#define UDI_PCI_BAR_2 2 -#define UDI_PCI_BAR_3 3 -#define UDI_PCI_BAR_4 4 -#define UDI_PCI_BAR_5 5 - -#endif - diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi_physio.h b/KernelLand/Modules/Interfaces/UDI/include/udi_physio.h deleted file mode 100644 index f5c3ab15..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/udi_physio.h +++ /dev/null @@ -1,133 +0,0 @@ -/** - * \file udi_physio.h - */ -#ifndef _UDI_PHYSIO_H_ -#define _UDI_PHYSIO_H_ - -#include - -//#ifndef UDI_PHYSIO_VERSION -//# error "UDI_PHYSIO_VERSION must be defined" -//#endif - -// === TYPEDEFS === -// DMA Core -typedef _udi_handle_t udi_dma_handle_t; -#define UDI_NULL_DMA_HANDLE _NULL_HANDLE -typedef uint64_t 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 === -#include -#include -#include -#include -#include "physio/pio.h" - -#include "physio/pci.h" - -#endif diff --git a/KernelLand/Modules/Interfaces/UDI/include/udi_scsi.h b/KernelLand/Modules/Interfaces/UDI/include/udi_scsi.h deleted file mode 100644 index 234ab857..00000000 --- a/KernelLand/Modules/Interfaces/UDI/include/udi_scsi.h +++ /dev/null @@ -1,134 +0,0 @@ -/** - * \file udi_scsi.h - * \brief UDI SCSI Bindings - */ -#ifndef _UDI_SCSI_H_ -#define _UDI_SCSI_H_ - -typedef struct { - udi_cb_t gcb; - udi_ubit16_t events; -} udi_scsi_bind_cb_t; - -#define UDI_SCSI_BIND_CB_NUM 1 - -/* SCSI Events */ -#define UDI_SCSI_EVENT_AEN (1U<<0) -#define UDI_SCSI_EVENT_TGT_RESET (1U<<1) -#define UDI_SCSI_EVENT_BUS_RESET (1U<<2) -#define UDI_SCSI_EVENT_UNSOLICITED_RESELECT (1U<<3) - -typedef struct { - udi_cb_t gcb; - udi_buf_t *data_buf; - udi_ubit32_t timeout; - udi_ubit16_t flags; - udi_ubit8_t attribute; - udi_ubit8_t cdb_len; - udi_ubit8_t *cdb_ptr; -} udi_scsi_io_cb_t; -/* Control Block Group Number */ -#define UDI_SCSI_IO_CB_NUM 2 -/* I/O Request Flags */ -#define UDI_SCSI_DATA_IN (1U<<0) -#define UDI_SCSI_DATA_OUT (1U<<1) -#define UDI_SCSI_NO_DISCONNECT (1U<<2) -/* SCSI Task Attributes */ -#define UDI_SCSI_SIMPLE_TASK 1 -#define UDI_SCSI_ORDERED_TASK 2 -#define UDI_SCSI_HEAD_OF_Q_TASK 3 -#define UDI_SCSI_ACA_TASK 4 -#define UDI_SCSI_UNTAGGED_TASK 5 - -typedef struct { - udi_status_t req_status; - udi_ubit8_t scsi_status; - udi_ubit8_t sense_status; -} udi_scsi_status_t; - -typedef struct { - udi_cb_t gcb; - udi_ubit8_t ctrl_func; - udi_ubit16_t queue_depth; -} udi_scsi_ctl_cb_t; -/* Values for ctrl_func */ -#define UDI_SCSI_CTL_ABORT_TASK_SET 1 -#define UDI_SCSI_CTL_CLEAR_TASK_SET 2 -#define UDI_SCSI_CTL_LUN_RESET 3 -#define UDI_SCSI_CTL_TGT_RESET 4 -#define UDI_SCSI_CTL_BUS_RESET 5 -#define UDI_SCSI_CTL_CLEAR_ACA 6 -#define UDI_SCSI_CTL_SET_QUEUE_DEPTH 7 -/* Control Block Group Number */ -#define UDI_SCSI_CTL_CB_NUM 3 - -typedef struct { - udi_cb_t gcb; - udi_ubit8_t event; - udi_buf_t *aen_data_buf; -} udi_scsi_event_cb_t; -/* Control Block Group Number */ -#define UDI_SCSI_EVENT_CB_NUM 4 - -typedef void udi_scsi_bind_ack_op_t(udi_scsi_bind_cb_t *cb, udi_ubit32_t hd_timeout_increase, udi_status_t status); -typedef void udi_scsi_unbind_ack_op_t(udi_scsi_bind_cb_t *cb); -typedef void udi_scsi_io_ack_op_t(udi_scsi_io_cb_t *cb); -typedef void udi_scsi_io_nak_op_t(udi_scsi_io_cb_t *cb); -typedef void udi_scsi_ctl_ack_op_t(udi_scsi_ctl_cb_t *cb, udi_status_t status); -typedef void udi_scsi_event_ind_op_t(udi_scsi_event_cb_t *cb); - -typedef void udi_scsi_bind_req_op_t(udi_scsi_bind_cb_t *cb, - udi_ubit16_t bind_flags, udi_ubit16_t queue_depth, - udi_ubit16_t max_sense_len, udi_ubit16_t aen_buf_size); -typedef void udi_scsi_unbind_req_op_t(udi_scsi_bind_cb_t *cb); -typedef void udi_scsi_io_req_op_t(udi_scsi_io_cb_t *cb); -typedef void udi_scsi_ctl_req_op_t(udi_scsi_ctl_cb_t *cb); -typedef void udi_scsi_event_res_op_t(udi_scsi_event_cb_t *cb); - -typedef const struct { - udi_channel_event_ind_op_t *channel_event_ind_op; - udi_scsi_bind_ack_op_t *bind_ack_op; - udi_scsi_unbind_ack_op_t *unbind_ack_op; - udi_scsi_io_ack_op_t *io_ack_op; - udi_scsi_io_nak_op_t *io_nak_op; - udi_scsi_ctl_ack_op_t *ctl_ack_op; - udi_scsi_event_ind_op_t *event_ind_op; -} udi_scsi_pd_ops_t; - -#define UDI_SCSI_PD_OPS_NUM 1 - -typedef const struct { - udi_channel_event_ind_op_t *channel_event_ind_op; - udi_scsi_bind_req_op_t *bind_req_op; - udi_scsi_unbind_req_op_t *unbind_req_op; - udi_scsi_io_req_op_t *io_req_op; - udi_scsi_ctl_req_op_t *ctl_req_op; - udi_scsi_event_res_op_t *event_res_op; -} udi_scsi_hd_ops_t; - -#define UDI_SCSI_HD_OPS_NUM 2 - -/* Bind Flags */ -#define UDI_SCSI_BIND_EXCLUSIVE (1U<<0) -#define UDI_SCSI_TEMP_BIND_EXCLUSIVE (1U<<1) - -extern void udi_scsi_bind_req(udi_scsi_bind_cb_t *cb, - udi_ubit16_t bind_flags, udi_ubit16_t queue_depth, - udi_ubit16_t max_sense_len, udi_ubit16_t aen_buf_size); -extern void udi_scsi_bind_ack(udi_scsi_bind_cb_t *cb, udi_ubit32_t hd_timeout_increase, udi_status_t status); -extern void udi_scsi_unbind_req(udi_scsi_bind_cb_t *cb); -extern void udi_scsi_unbind_ack(udi_scsi_bind_cb_t *cb); - -extern void udi_scsi_io_req(udi_scsi_io_cb_t *cb); -extern void udi_scsi_io_ack(udi_scsi_io_cb_t *cb); -extern void udi_scsi_io_nak(udi_scsi_io_cb_t *cb, udi_scsi_status_t status, udi_buf_t *sense_buf); -extern void udi_scsi_ctl_req(udi_scsi_ctl_cb_t *cb); -extern void udi_scsi_ctl_ack(udi_scsi_ctl_cb_t *cb, udi_status_t status); -extern void udi_scsi_event_ind(udi_scsi_event_cb_t *cb); -extern udi_scsi_event_ind_op_t udi_scsi_event_ind_unused; -extern void udi_scsi_event_res(udi_scsi_event_cb_t *cb); -extern void udi_scsi_inquiry_to_string(const udi_ubit8_t *inquiry_data, udi_size_t inquiry_len, char *str); - - -#endif - diff --git a/KernelLand/Modules/Makefile.tpl b/KernelLand/Modules/Makefile.tpl index 98d0760c..a5ea222a 100644 --- a/KernelLand/Modules/Makefile.tpl +++ b/KernelLand/Modules/Makefile.tpl @@ -75,7 +75,7 @@ obj-$(_SUFFIX)/%.o: %.c Makefile $(CFGFILES) @echo --- $(CC) -o $@ @mkdir -p $(dir $@) @$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< - @$(CC) -M $(CPPFLAGS) -MT $@ -o obj-$(_SUFFIX)/$*.d $< + @$(CC) -M $(CPPFLAGS) -MT $@ -MP -o obj-$(_SUFFIX)/$*.d $< -include $(DEPFILES) # vim: ft=make diff --git a/UDI/include/physio/dma.h b/UDI/include/physio/dma.h new file mode 100644 index 00000000..90976343 --- /dev/null +++ b/UDI/include/physio/dma.h @@ -0,0 +1,57 @@ +/* + */ +#ifndef _UDI_PHYSIO_DMA_H_ +#define _UDI_PHYSIO_DMA_H_ + +//typedef struct udi_dma_handle_s *udi_dma_handle_t; +//#define UDI_NULL_DMA_HANDLE NULL + +extern void udi_dma_limits(udi_dma_limits_t *dma_limits); + +typedef void udi_dma_prepare_call_t(udi_cb_t *gcb, udi_dma_handle_t new_dma_handle); +typedef void udi_dma_buf_map_call_t(udi_cb_t *gcb, udi_scgth_t *scgth, udi_boolean_t complete, udi_status_t status); +typedef void udi_dma_mem_alloc_call_t(udi_cb_t *gcb, udi_dma_handle_t new_dma_handle, void *mem_ptr, udi_size_t actual_gap, udi_boolean_t single_element, udi_scgth_t *scgth, udi_boolean_t must_swap); +typedef void udi_dma_sync_call_t(udi_cb_t *gcb); +typedef void udi_dma_scgth_sync_call_t(udi_cb_t *gcb); +typedef void udi_dma_mem_to_buf_call_t(udi_cb_t *gcb, udi_buf_t *new_dst_buf); + +/** + * \name Values for flags (udi_dma_prepare, udi_dma_buf_map) + * \{ + */ +#define UDI_DMA_OUT (1U<<2) +#define UDI_DMA_IN (1U<<3) +#define UDI_DMA_REWIND (1U<<4) +#define UDI_DMA_BIG_ENDIAN (1U<<5) +#define UDI_DMA_LITTLE_ENDIAN (1U<<6) +#define UDI_DMA_NEVERSWAP (1U<<7) +/** + * \} + */ + +extern void udi_dma_prepare(udi_dma_prepare_call_t *callback, udi_cb_t *gcb, + udi_dma_constraints_t constraints, udi_ubit8_t flags); + +extern void udi_dma_buf_map(udi_dma_buf_map_call_t *callback, udi_cb_t *gcb, udi_dma_handle_t dma_handle, + udi_buf_t *buf, udi_size_t offset, udi_size_t len, udi_ubit8_t flags); + +extern udi_buf_t *udi_dma_buf_unmap(udi_dma_handle_t dma_handle, udi_size_t new_buf_size); + +extern void udi_dma_mem_alloc(udi_dma_mem_alloc_call_t *callback, udi_cb_t *gcb, + udi_dma_constraints_t constraints, udi_ubit8_t flags, + udi_ubit16_t nelements, udi_size_t element_size, udi_size_t max_gap); + +extern void udi_dma_sync(udi_dma_sync_call_t *callback, udi_cb_t *gcb, udi_dma_handle_t dma_handle, + udi_size_t offset, udi_size_t len, udi_ubit8_t flags); + +extern void udi_dma_scgth_sync(udi_dma_scgth_sync_call_t *callback, udi_cb_t *gcb, udi_dma_handle_t dma_handle); + +extern void udi_dma_mem_barrier(udi_dma_handle_t dma_handle); + +extern void udi_dma_free(udi_dma_handle_t dma_handle); + +extern void udi_dma_mem_to_buf(udi_dma_mem_to_buf_call_t *callback, udi_cb_t *gcb, udi_dma_handle_t dma_handle, + udi_size_t src_off, udi_size_t src_len, udi_buf_t *dst_buf); + +#endif + diff --git a/UDI/include/physio/dma_const.h b/UDI/include/physio/dma_const.h new file mode 100644 index 00000000..85da58a5 --- /dev/null +++ b/UDI/include/physio/dma_const.h @@ -0,0 +1,27 @@ +/* + * + */ +#ifndef _UDI_DMA_CONST_H_ +#define _UDI_DMA_CONST_H_ + +typedef void udi_dma_constraints_attr_set_call_t(udi_cb_t *gcb, udi_dma_constraints_t new_constraints, udi_status_t status); + +/** + * \name Flags for udi_dma_constraints_attr_set + * \{ + */ +#define UDI_DMA_CONSTRAINTS_COPY (1U<<0) +/** + * \} + */ + +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); + +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); + +#endif diff --git a/UDI/include/physio/meta_bus.h b/UDI/include/physio/meta_bus.h new file mode 100644 index 00000000..f1af116f --- /dev/null +++ b/UDI/include/physio/meta_bus.h @@ -0,0 +1,74 @@ +/** + * \file physio/meta_bus.h + */ +#ifndef _PHYSIO_META_BUS_H_ +#define _PHYSIO_META_BUS_H_ + +#include +#include + +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 2 + +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 diff --git a/UDI/include/physio/meta_intr.h b/UDI/include/physio/meta_intr.h new file mode 100644 index 00000000..506eb0c8 --- /dev/null +++ b/UDI/include/physio/meta_intr.h @@ -0,0 +1,100 @@ +/** + * \file physio/meta_intr.h + */ +#ifndef _PHYSIO_META_INTR_H_ +#define _PHYSIO_META_INTR_H_ + +#include +#include +#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 diff --git a/UDI/include/physio/pci.h b/UDI/include/physio/pci.h new file mode 100644 index 00000000..44496d61 --- /dev/null +++ b/UDI/include/physio/pci.h @@ -0,0 +1,15 @@ +/* + */ +#ifndef _UDI_PHYSIO_PCI_H_ +#define _UDI_PHYSIO_PCI_H_ + +#define UDI_PCI_CONFIG_SPACE 255 +#define UDI_PCI_BAR_0 0 +#define UDI_PCI_BAR_1 1 +#define UDI_PCI_BAR_2 2 +#define UDI_PCI_BAR_3 3 +#define UDI_PCI_BAR_4 4 +#define UDI_PCI_BAR_5 5 + +#endif + diff --git a/UDI/include/physio/pio.h b/UDI/include/physio/pio.h new file mode 100644 index 00000000..aabc97f8 --- /dev/null +++ b/UDI/include/physio/pio.h @@ -0,0 +1,164 @@ +/** + * \file physio/pio.h + */ +#ifndef _PHYSIO_PIO_H_ +#define _PHYSIO_PIO_H_ + +#include +#include +typedef _udi_handle_t udi_pio_handle_t; +/* Null handle value for udi_pio_handle_t */ +#define UDI_NULL_PIO_HANDLE _NULL_HANDLE + +typedef void udi_pio_map_call_t(udi_cb_t *gcb, udi_pio_handle_t new_pio_handle); + +typedef const struct { + udi_ubit8_t pio_op; + udi_ubit8_t tran_size; + udi_ubit16_t operand; +} udi_pio_trans_t; + +/** + * \brief Values for tran_size + */ +enum { + UDI_PIO_1BYTE, + UDI_PIO_2BYTE, + UDI_PIO_4BYTE, + UDI_PIO_8BYTE, + UDI_PIO_16BYTE, + UDI_PIO_32BYTE, +}; +/** + * \brief Register numbers in pio_op + */ +enum { + UDI_PIO_R0, + UDI_PIO_R1, + UDI_PIO_R2, + UDI_PIO_R3, + UDI_PIO_R4, + UDI_PIO_R5, + UDI_PIO_R6, + UDI_PIO_R7, +}; +// Addressing modes +#define UDI_PIO_DIRECT 0x00 +#define UDI_PIO_SCRATCH 0x08 +#define UDI_PIO_BUF 0x10 +#define UDI_PIO_MEM 0x18 +// Class A opcodes +#define UDI_PIO_IN 0x00 +#define UDI_PIO_OUT 0x20 +#define UDI_PIO_LOAD 0x40 +#define UDI_PIO_STORE 0x60 +// Class B opcodes +#define UDI_PIO_LOAD_IMM 0x80 +#define UDI_PIO_CSKIP 0x88 +#define UDI_PIO_IN_IND 0x90 +#define UDI_PIO_OUT_IND 0x98 +#define UDI_PIO_SHIFT_LEFT 0xA0 +#define UDI_PIO_SHIFT_RIGHT 0xA8 +#define UDI_PIO_AND 0xB0 +#define UDI_PIO_AND_IMM 0xB8 +#define UDI_PIO_OR 0xC0 +#define UDI_PIO_OR_IMM 0xC8 +#define UDI_PIO_XOR 0xD0 +#define UDI_PIO_ADD 0xD8 +#define UDI_PIO_ADD_IMM 0xE0 +#define UDI_PIO_SUB 0xE8 +// Class C opcodes +#define UDI_PIO_BRANCH 0xF0 +#define UDI_PIO_LABEL 0xF1 +#define UDI_PIO_REP_IN_IND 0xF2 +#define UDI_PIO_REP_OUT_IND 0xF3 +#define UDI_PIO_DELAY 0xF4 +#define UDI_PIO_BARRIER 0xF5 +#define UDI_PIO_SYNC 0xF6 +#define UDI_PIO_SYNC_OUT 0xF7 +#define UDI_PIO_DEBUG 0xF8 +#define UDI_PIO_END 0xFE +#define UDI_PIO_END_IMM 0xFF +// Values for UDI_PIO_DEBUG's operand +#define UDI_PIO_TRACE_OPS_NONE 0 +#define UDI_PIO_TRACE_OPS1 1 +#define UDI_PIO_TRACE_OPS2 2 +#define UDI_PIO_TRACE_OPS3 3 +#define UDI_PIO_TRACE_REGS_NONE (0U<<2) +#define UDI_PIO_TRACE_REGS1 (1U<<2) +#define UDI_PIO_TRACE_REGS2 (2U<<2) +#define UDI_PIO_TRACE_REGS3 (3U<<2) +#define UDI_PIO_TRACE_DEV_NONE (0U<<4) +#define UDI_PIO_TRACE_DEV1 (1U<<4) +#define UDI_PIO_TRACE_DEV2 (2U<<4) +#define UDI_PIO_TRACE_DEV3 (3U<<4) +// Values for conditional operations +#define UDI_PIO_Z 0 // reg == 0 +#define UDI_PIO_NZ 1 // reg != 0 +#define UDI_PIO_NEG 2 // reg < 0 (signed) +#define UDI_PIO_NNEG 3 // reg >= 0 (signed) + +#define UDI_PIO_REP_ARGS(mode,mem_reg,mem_stride,pio_reg,pio_stride,cnt_reg) \ + ((mode)|(mem_reg)|((mem_stride)<<5)|((pio_reg)<<7)|((pio_stride)<<10)|((cnt_reg)<<13)) + +//! \brief PIO Handle Layout Element Type Code +#define UDI_DL_PIO_HANDLE_T 200 + +/** + * \name PIO Handle Allocation and Initialisation + * \{ + */ + +/** + * \name Values for pio_attributes of udi_pio_map + * \{ + */ +#define UDI_PIO_STRICTORDER (1U<<0) +#define UDI_PIO_UNORDERED_OK (1U<<1) +#define UDI_PIO_MERGING_OK (1U<<2) +#define UDI_PIO_LOADCACHING_OK (1U<<3) +#define UDI_PIO_STORECACHING_OK (1U<<4) +#define UDI_PIO_BIG_ENDIAN (1U<<5) +#define UDI_PIO_LITTLE_ENDIAN (1U<<6) +#define UDI_PIO_NEVERSWAP (1U<<7) +#define UDI_PIO_UNALIGNED (1U<<8) +/** + * \} + */ + +extern void udi_pio_map(udi_pio_map_call_t *callback, udi_cb_t *gcb, + udi_ubit32_t regset_idx, udi_ubit32_t base_offset, udi_ubit32_t length, + udi_pio_trans_t *trans_list, udi_ubit16_t list_length, + udi_ubit16_t pio_attributes, udi_ubit32_t pace, udi_index_t serialization_domain); + +extern void udi_pio_unmap(udi_pio_handle_t pio_handle); + +extern udi_ubit32_t udi_pio_atmic_sizes(udi_pio_handle_t pio_handle); + +extern void udi_pio_abort_sequence(udi_pio_handle_t pio_handle, udi_size_t scratch_requirement); + +/** + * \} + */ + +/** + * \name PIO Access Service Calls + * \{ + */ +typedef void udi_pio_trans_call_t(udi_cb_t *gcb, udi_buf_t *new_buf, udi_status_t status, udi_ubit16_t result); + +extern void udi_pio_trans(udi_pio_trans_call_t *callback, udi_cb_t *gcb, + udi_pio_handle_t pio_handle, udi_index_t start_label, + udi_buf_t *buf, void *mem_ptr); + +typedef void udi_pio_probe_call_t(udi_cb_t *gcb, udi_status_t status); + +extern void udi_pio_probe(udi_pio_probe_call_t *callback, udi_cb_t *gcb, + udi_pio_handle_t pio_handle, void *mem_ptr, udi_ubit32_t pio_offset, + udi_ubit8_t tran_size, udi_ubit8_t direction); + +/** + * \} + */ + +#endif diff --git a/UDI/include/udi.h b/UDI/include/udi.h new file mode 100644 index 00000000..e4ddb94b --- /dev/null +++ b/UDI/include/udi.h @@ -0,0 +1,127 @@ +/** + * \file udi.h + */ +#ifndef _UDI_H_ +#define _UDI_H_ + +#include +#include + +typedef int8_t udi_sbit8_t; /* signed 8-bit: -2^7..2^7-1 */ +typedef int16_t udi_sbit16_t; /* signed 16-bit: -2^15..2^15-1 */ +typedef int32_t udi_sbit32_t; /* signed 32-bit: -2^31..2^31-1 */ +typedef uint8_t udi_ubit8_t; /* unsigned 8-bit: 0..28-1 */ +typedef uint16_t udi_ubit16_t; /* unsigned 16-bit: 0..216-1 */ +typedef uint32_t udi_ubit32_t; /* unsigned 32-bit: 0..232-1 */ + +#ifndef NULL +# define NULL ((void*)0) +#endif + +#if UDI_ABI_is_ia32 +#include "udi/arch/ia32.h" +#else +#error "Unknown UDI ABI" +#endif + +/** + * \name Values and Flags for udi_status_t + * \{ + */ +#define UDI_STATUS_CODE_MASK 0x0000FFFF +#define UDI_STAT_META_SPECIFIC 0x00008000 +#define UDI_SPECIFIC_STATUS_MASK 0x00007FFF +#define UDI_CORRELATE_OFFSET 16 +#define UDI_CORRELATE_MASK 0xFFFF0000 +/* Common Status Values */ +#define UDI_OK 0 +#define UDI_STAT_NOT_SUPPORTED 1 +#define UDI_STAT_NOT_UNDERSTOOD 2 +#define UDI_STAT_INVALID_STATE 3 +#define UDI_STAT_MISTAKEN_IDENTITY 4 +#define UDI_STAT_ABORTED 5 +#define UDI_STAT_TIMEOUT 6 +#define UDI_STAT_BUSY 7 +#define UDI_STAT_RESOURCE_UNAVAIL 8 +#define UDI_STAT_HW_PROBLEM 9 +#define UDI_STAT_NOT_RESPONDING 10 +#define UDI_STAT_DATA_UNDERRUN 11 +#define UDI_STAT_DATA_OVERRUN 12 +#define UDI_STAT_DATA_ERROR 13 +#define UDI_STAT_PARENT_DRV_ERROR 14 +#define UDI_STAT_CANNOT_BIND 15 +#define UDI_STAT_CANNOT_BIND_EXCL 16 +#define UDI_STAT_TOO_MANY_PARENTS 17 +#define UDI_STAT_BAD_PARENT_TYPE 18 +#define UDI_STAT_TERMINATED 19 +#define UDI_STAT_ATTR_MISMATCH 20 +/** + * \} + */ + +/** + * \name Data Layout Specifiers + * \{ + */ +typedef const udi_ubit8_t udi_layout_t; +/* Specific-Length Layout Type Codes */ +#define UDI_DL_UBIT8_T 1 +#define UDI_DL_SBIT8_T 2 +#define UDI_DL_UBIT16_T 3 +#define UDI_DL_SBIT16_T 4 +#define UDI_DL_UBIT32_T 5 +#define UDI_DL_SBIT32_T 6 +#define UDI_DL_BOOLEAN_T 7 +#define UDI_DL_STATUS_T 8 +/* Abstract Element Layout Type Codes */ +#define UDI_DL_INDEX_T 20 +/* Opaque Handle Element Layout Type Codes */ +#define UDI_DL_CHANNEL_T 30 +#define UDI_DL_ORIGIN_T 32 +/* Indirect Element Layout Type Codes */ +#define UDI_DL_BUF 40 +#define UDI_DL_CB 41 +#define UDI_DL_INLINE_UNTYPED 42 +#define UDI_DL_INLINE_DRIVER_TYPED 43 +#define UDI_DL_MOVABLE_UNTYPED 44 +/* Nested Element Layout Type Codes */ +#define UDI_DL_INLINE_TYPED 50 +#define UDI_DL_MOVABLE_TYPED 51 +#define UDI_DL_ARRAY 52 +#define UDI_DL_END 0 +/** + * \} + */ + + +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; + +// === INCLUDE SUB-SECTIONS === +#include "udi/cb.h" // Control Blocks +#include "udi/time.h" // Timer Services +#include "udi/log.h" // Logging +#include "udi/attr.h" // Attributes +#include "udi/strmem.h" // String/Memory +#include "udi/queues.h" // Queues +#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 diff --git a/UDI/include/udi/arch/ia32.h b/UDI/include/udi/arch/ia32.h new file mode 100644 index 00000000..4608aa36 --- /dev/null +++ b/UDI/include/udi/arch/ia32.h @@ -0,0 +1,60 @@ + +#ifndef _UDI_ARCH_x86_H_ +#define _UDI_ARCH_x86_H_ + +typedef udi_ubit8_t udi_boolean_t; /* 0=False; 1..28-1=True */ +#define FALSE 0 +#define TRUE 1 + +typedef uint32_t udi_size_t; /* buffer size */ +typedef udi_ubit8_t udi_index_t; /* zero-based index type */ + +typedef void *_udi_handle_t; +#define _NULL_HANDLE ((void*)0) + +/* Channel Handle */ +typedef _udi_handle_t *udi_channel_t; +#define UDI_NULL_CHANNEL _NULL_HANDLE + +/** + * \brief Buffer Path + */ +typedef _udi_handle_t udi_buf_path_t; +#define UDI_NULL_BUF_PATH _NULL_HANDLE + +typedef _udi_handle_t udi_origin_t; +#define UDI_NULL_ORIGIN _NULL_HANDLE + +typedef int64_t udi_timestamp_t; + +#define UDI_HANDLE_IS_NULL(handle, handle_type) (handle == NULL) +#define UDI_HANDLE_ID(handle, handle_type) ((uint32_t)handle) + +/** + * \name va_arg wrapper + * \{ + */ +#define UDI_VA_ARG(pvar, type, va_code) va_arg(pvar,type) +#define UDI_VA_UBIT8_T +#define UDI_VA_SBIT8_T +#define UDI_VA_UBIT16_T +#define UDI_VA_SBIT16_T +#define UDI_VA_UBIT32_T +#define UDI_VA_SBIT32_T +#define UDI_VA_BOOLEAN_T +#define UDI_VA_INDEX_T +#define UDI_VA_SIZE_T +#define UDI_VA_STATUS_T +#define UDI_VA_CHANNEL_T +#define UDI_VA_ORIGIN_T +#define UDI_VA_POINTER +/** + * \} + */ + +/** + * \brief Status Type + */ +typedef udi_ubit32_t udi_status_t; + +#endif diff --git a/UDI/include/udi/attr.h b/UDI/include/udi/attr.h new file mode 100644 index 00000000..729f4698 --- /dev/null +++ b/UDI/include/udi/attr.h @@ -0,0 +1,54 @@ +/** + * \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 + +#define UDI_ATTR32_SET(aval, v) \ + { udi_ubit32_t vtmp = (v); \ + (aval)[0] = (vtmp) & 0xff; \ + (aval)[1] = ((vtmp) >> 8) & 0xff; \ + (aval)[2] = ((vtmp) >> 16) & 0xff; \ + (aval)[3] = ((vtmp) >> 24) & 0xff; } +#define UDI_ATTR32_GET(aval) \ + ((aval)[0] + ((aval)[1] << 8) + \ + ((aval)[2] << 16) + ((aval)[3] << 24)) +#define UDI_ATTR32_INIT(v) \ + { (v) & 0xff, ((v) >> 8) & 0xff, \ + ((v) >> 16) & 0xff, ((v) >> 24) & 0xff } + +/** + * \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 diff --git a/UDI/include/udi/buf.h b/UDI/include/udi/buf.h new file mode 100644 index 00000000..e82651f3 --- /dev/null +++ b/UDI/include/udi/buf.h @@ -0,0 +1,105 @@ +/** + * \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; + udi_ubit8_t 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 diff --git a/UDI/include/udi/cb.h b/UDI/include/udi/cb.h new file mode 100644 index 00000000..cd8ea1b1 --- /dev/null +++ b/UDI/include/udi/cb.h @@ -0,0 +1,77 @@ +/** + * \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 Source-usable value + */ + 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 diff --git a/UDI/include/udi/imc.h b/UDI/include/udi/imc.h new file mode 100644 index 00000000..e5b3f3bb --- /dev/null +++ b/UDI/include/udi/imc.h @@ -0,0 +1,92 @@ +/** + * \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 diff --git a/UDI/include/udi/init.h b/UDI/include/udi/init.h new file mode 100644 index 00000000..a4d9142b --- /dev/null +++ b/UDI/include/udi/init.h @@ -0,0 +1,299 @@ +/** + * \file udi_init.h + */ +#ifndef _UDI_INIT_H_ +#define _UDI_INIT_H_ + +/** + * \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; +} __attribute__((packed)); + + +/** + * \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 <>_<>_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; +} __attribute__((packed)); + +/** + * \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; +} __attribute__((packed)); + +/** + * \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 diff --git a/UDI/include/udi/log.h b/UDI/include/udi/log.h new file mode 100644 index 00000000..bc28735e --- /dev/null +++ b/UDI/include/udi/log.h @@ -0,0 +1,81 @@ +/** + * \file udi_log.h + */ +#ifndef _UDI_LOG_H_ +#define _UDI_LOG_H_ + +/** + * \brief Trace Event + */ +typedef udi_ubit32_t udi_trevent_t; + +/** + * \name Values for udi_trevent_t + * \note Taken from UDI Spec 1.01 + * \{ + */ +/* Common Trace Events */ +#define UDI_TREVENT_LOCAL_PROC_ENTRY (1U<<0) +#define UDI_TREVENT_LOCAL_PROC_EXIT (1U<<1) +#define UDI_TREVENT_EXTERNAL_ERROR (1U<<2) +/* Common Metalanguage-Selectable Trace Events */ +#define UDI_TREVENT_IO_SCHEDULED (1U<<6) +#define UDI_TREVENT_IO_COMPLETED (1U<<7) +/* Metalanguage-Specific Trace Events */ +#define UDI_TREVENT_META_SPECIFIC_1 (1U<<11) +#define UDI_TREVENT_META_SPECIFIC_2 (1U<<12) +#define UDI_TREVENT_META_SPECIFIC_3 (1U<<13) +#define UDI_TREVENT_META_SPECIFIC_4 (1U<<14) +#define UDI_TREVENT_META_SPECIFIC_5 (1U<<15) +/* Driver-Specific Trace Events */ +#define UDI_TREVENT_INTERNAL_1 (1U<<16) +#define UDI_TREVENT_INTERNAL_2 (1U<<17) +#define UDI_TREVENT_INTERNAL_3 (1U<<18) +#define UDI_TREVENT_INTERNAL_4 (1U<<19) +#define UDI_TREVENT_INTERNAL_5 (1U<<20) +#define UDI_TREVENT_INTERNAL_6 (1U<<21) +#define UDI_TREVENT_INTERNAL_7 (1U<<22) +#define UDI_TREVENT_INTERNAL_8 (1U<<23) +#define UDI_TREVENT_INTERNAL_9 (1U<<24) +#define UDI_TREVENT_INTERNAL_10 (1U<<25) +#define UDI_TREVENT_INTERNAL_11 (1U<<26) +#define UDI_TREVENT_INTERNAL_12 (1U<<27) +#define UDI_TREVENT_INTERNAL_13 (1U<<28) +#define UDI_TREVENT_INTERNAL_14 (1U<<29) +#define UDI_TREVENT_INTERNAL_15 (1U<<30) +/* Logging Event */ +#define UDI_TREVENT_LOG (1U<<31) + +/** + * \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 +/** + * \} + */ + +extern void udi_trace_write(udi_init_context_t *init_context, + udi_trevent_t trace_event, udi_index_t meta_idx, + udi_ubit32_t msgnum, ...); + +extern 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, ... ); + +extern void udi_assert(udi_boolean_t expr); + +extern void udi_debug_break(udi_init_context_t *init_context, const char *message); + +extern void udi_debug_printf(const char *format, ...); + +#endif diff --git a/UDI/include/udi/mei.h b/UDI/include/udi/mei.h new file mode 100644 index 00000000..ef764054 --- /dev/null +++ b/UDI/include/udi/mei.h @@ -0,0 +1,91 @@ +/* + * Acess2 UDI Layer + * - By John Hodge (thePowersGang) + * + * include/udi/mei.h + * - Metalanguage-to-Environment Interface + */ +#ifndef _UDI__MEI_H_ +#define _UDI__MEI_H_ + +typedef const struct udi_mei_init_s udi_mei_init_t; +typedef const struct udi_mei_ops_vec_template_s udi_mei_ops_vec_template_t; +typedef const struct uid_mei_op_template_s uid_mei_op_template_t; + +typedef udi_ubit8_t udi_mei_enumeration_rank_func_t(udi_ubit32_t attr_device_match, void **attr_value_list); +typedef void udi_mei_direct_stub_t(udi_op_t *op, udi_cb_t *gcb, va_list arglist); +typedef void udi_mei_backend_stub_t(udi_op_t *op, udi_cb_t *gcb, void *marshal_space); + +struct udi_mei_init_s +{ + udi_mei_ops_vec_template_t *ops_vec_template_list; + udi_mei_enumeration_rank_func_t *mei_enumeration_rank; +}; + +struct udi_mei_ops_vec_template_s +{ + udi_index_t meta_ops_num; + udi_ubit8_t relationship; + const udi_mei_op_template_t *op_template_list; +}; +// Flags for `relationship` +#define UDI_MEI_REL_INITIATOR (1U<<0) +#define UDI_MEI_REL_BIND (1U<<1) +#define UDI_MEI_REL_EXTERNAL (1U<<2) +#define UDI_MEI_REL_INTERNAL (1U<<3) +#define UDI_MEI_REL_SINGLE (1U<<4) + +struct uid_mei_op_template_s +{ + const char *op_name; + udi_ubit8_t op_category; + udi_ubit8_t op_flags; + udi_index_t meta_cb_num; + udi_index_t completion_ops_num; + udi_index_t completion_vec_idx; + udi_index_t exception_ops_num; + udi_index_t exception_vec_idx; + udi_mei_direct_stub_t *direct_stub; + udi_mei_backend_stub_t *backend_stub; + udi_layout_t *visible_layout; + udi_layout_t *marshal_layout; +}; +/* Values for op_category */ +#define UDI_MEI_OPCAT_REQ 1 +#define UDI_MEI_OPCAT_ACK 2 +#define UDI_MEI_OPCAT_NAK 3 +#define UDI_MEI_OPCAT_IND 4 +#define UDI_MEI_OPCAT_RES 5 +#define UDI_MEI_OPCAT_RDY 6 +/* Values for op_flags */ +#define UDI_MEI_OP_ABORTABLE (1U<<0) +#define UDI_MEI_OP_RECOVERABLE (1U<<1) +#define UDI_MEI_OP_STATE_CHANGE (1U<<2) +/* Maximum Sizes For Control Block Layouts */ +#define UDI_MEI_MAX_VISIBLE_SIZE 2000 +#define UDI_MEI_MAX_MARSHAL_SIZE 4000 + +#define _UDI_MEI_FIRST(lst, ...) lst +#define _UDI_MEI_OTHER(lst, ...) __VA_ARGS__ +#define _UDI_MEI_VARG(type,name,vatype) \ + type name = UDI_VA_ARG(arglist, type, vatype); +#define _UDI_MEI_VARGS0() +#define _UDI_MEI_VARGS1(args,argt,argva) \ + _UDI_MEI_VARG(_UDI_MEI_FIRST(argt), _UDI_MEI_FIRST(args),_UDI_MEI_FIRST(argva)) +#define _UDI_MEI_VARGS2(args,argt,argva) \ + _UDI_MEI_VARG(_UDI_MEI_FIRST(argt), _UDI_MEI_FIRST(args),_UDI_MEI_FIRST(argva)) \ + _UDI_MEI_VARGS1( _UDI_MEI_OTHER(argt), _UDI_MEI_OTHER(args), _UDI_MEI_OTHER(argva) ) + +#define UDI_MEI_STUBS(op_name, cb_type, argc, args, arg_types, arg_va_list, meta_ops_num, vec_idx) \ + void op_name(cb_type *cb, _UDI_ARG_LIST_##argc args ) {\ + udi_mei_call(UDI_GCB(cb), &udi_mei_info, meta_ops_num, vec_idx, args);\ + }\ + void op_name##_direct(udi_op_t *op, udi_cb_t *gcb, va_lis arglist) {\ + _UDI_MEI_VARGS##argc(args ,## arg_types ,## arg_va_list)\ + (*(op_name##_op_t)op)(UDI_MCB(gcb, cb_type) ,## args);\ + }\ + void op_name##_backend(udi_op_t *op, udi_cb_t *gcb, void *marshal_space) {\ + } + +#endif + diff --git a/UDI/include/udi/mem.h b/UDI/include/udi/mem.h new file mode 100644 index 00000000..d29f25ed --- /dev/null +++ b/UDI/include/udi/mem.h @@ -0,0 +1,38 @@ +/** + * \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 diff --git a/UDI/include/udi/meta_gio.h b/UDI/include/udi/meta_gio.h new file mode 100644 index 00000000..d1cf86fd --- /dev/null +++ b/UDI/include/udi/meta_gio.h @@ -0,0 +1,120 @@ +/** + * \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 diff --git a/UDI/include/udi/meta_mgmt.h b/UDI/include/udi/meta_mgmt.h new file mode 100644 index 00000000..a913552a --- /dev/null +++ b/UDI/include/udi/meta_mgmt.h @@ -0,0 +1,162 @@ +/** + * \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); + +extern void udi_usage_ind(udi_usage_cb_t *cb, udi_ubit8_t resource_level); +/** + * \} + */ + +typedef void udi_usage_res_op_t(udi_usage_cb_t *cb); + +extern void udi_usage_res(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); +extern void udi_enumerate_req(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 +extern void udi_enumerate_ack(udi_enumerate_cb_t *cb, udi_ubit8_t enumeration_result, udi_index_t ops_idx); +/** + * \} + */ + +/** + * \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 diff --git a/UDI/include/udi/queues.h b/UDI/include/udi/queues.h new file mode 100644 index 00000000..c19ec952 --- /dev/null +++ b/UDI/include/udi/queues.h @@ -0,0 +1,24 @@ +/** + * \file udi_queues.h + * \brief Queue Management Utility Functions + */ +#ifndef _UDI_QUEUES_H_ +#define _UDI_QUEUES_H_ + +typedef struct udi_queue udi_queue_t; + +struct udi_queue +{ + struct udi_queue *next; + struct udi_queue *prev; +}; + +extern void udi_enqueue(udi_queue_t *new_el, udi_queue_t *old_el); +extern udi_queue_t *udi_dequeue(udi_queue_t *element); + +#define UDI_QUEUE_INIT(listhead) ((listhead)->next = (listhead)->prev = (listhead)) +#define UDI_QUEUE_EMPTY(listhead) ((listhead)->next == (listhead)->prev) +// TODO: other queue macros + +#endif + diff --git a/UDI/include/udi/strmem.h b/UDI/include/udi/strmem.h new file mode 100644 index 00000000..b5de131c --- /dev/null +++ b/UDI/include/udi/strmem.h @@ -0,0 +1,45 @@ +/** + * \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, ...); +extern udi_size_t udi_vsnprintf(char *s, udi_size_t max_bytes, const char *format, va_list ap); + + + +#endif diff --git a/UDI/include/udi/time.h b/UDI/include/udi/time.h new file mode 100644 index 00000000..2654ce84 --- /dev/null +++ b/UDI/include/udi/time.h @@ -0,0 +1,22 @@ + +#ifndef _UDI_TIME_H_ +#define _UDI_TIME_H_ + +typedef struct { + udi_ubit32_t seconds; + udi_ubit32_t nanoseconds; +} udi_time_t; + +typedef void udi_timer_expired_call_t(udi_cb_t *gcb); +typedef void udi_timer_tick_call_t(udi_cb_t *gcb, udi_ubit32_t missed); + +extern void udi_timer_start(udi_timer_expired_call_t *callback, udi_cb_t *gcb, udi_time_t interval); +extern void udi_timer_start_repeating(udi_timer_tick_call_t *callback, udi_cb_t *gcb, udi_time_t interval); +extern void udi_timer_cancel(udi_cb_t *gcb); + +extern udi_timestamp_t udi_time_current(void); +extern udi_time_t udi_time_between(udi_timestamp_t start_time, udi_timestamp_t end_time); +extern udi_time_t udi_time_since(udi_timestamp_t start_time); + +#endif + diff --git a/UDI/include/udi_nic.h b/UDI/include/udi_nic.h new file mode 100644 index 00000000..169a81bf --- /dev/null +++ b/UDI/include/udi_nic.h @@ -0,0 +1,235 @@ +/* + * Acess2 UDI Environment (NIC Bindings) + * - By John Hodge (thePowersGang) + * + * udi_nic.h + * - NIC Bindings core + */ +#ifndef _UDI_NIC_H_ +#define _UDI_NIC_H_ + +// === CBs === +#define UDI_NIC_STD_CB_NUM 1 +#define UDI_NIC_BIND_CB_NUM 2 +#define UDI_NIC_CTRL_CB_NUM 3 +#define UDI_NIC_STATUS_CB_NUM 4 +#define UDI_NIC_INFO_CB_NUM 5 +#define UDI_NIC_TX_CB_NUM 6 +#define UDI_NIC_RX_CB_NUM 7 + +typedef struct { + udi_cb_t gcb; +} udi_nic_cb_t; + +#define UDI_NIC_MAC_ADDRESS_SIZE 20 +// Media type +#define UDI_NIC_ETHER 0 +#define UDI_NIC_TOKEN 1 +#define UDI_NIC_FASTETHER 2 +#define UDI_NIC_GIGETHER 3 +#define UDI_NIC_VGANYLAN 4 +#define UDI_NIC_FDDI 5 +#define UDI_NIC_ATM 6 +#define UDI_NIC_FC 7 +#define UDI_NIC_MISCMEDIA 0xff +// capabilities +#define UDI_NIC_CAP_TX_IP_CKSUM (1U<<0) +#define UDI_NIC_CAP_TX_TCP_CKSUM (1U<<1) +#define UDI_NIC_CAP_TX_UDP_CKSUM (1U<<2) +#define UDI_NIC_CAP_MCAST_LOOPBK (1U<<3) +#define UDI_NIC_CAP_BCAST_LOOPBK (1U<<4) +// capabilities (requests) +#define UDI_NIC_CAP_USE_TX_CKSUM (1U<<30) +#define UDI_NIC_CAP_USE_RX_CKSUM (1U<<31) +typedef struct { + udi_cb_t gcb; + udi_ubit8_t media_type; + udi_ubit32_t min_pdu_size; + udi_ubit32_t max_pdu_size; + udi_ubit32_t rx_hw_threshold; + udi_ubit32_t capabilities; + udi_ubit8_t max_perfect_multicast; + udi_ubit8_t max_total_multicast; + udi_ubit8_t mac_addr_len; + udi_ubit8_t mac_addr[UDI_NIC_MAC_ADDRESS_SIZE]; +} udi_nic_bind_cb_t; + +// commands +#define UDI_NIC_ADD_MULTI 1 +#define UDI_NIC_DEL_MULTI 2 +#define UDI_NIC_ALLMULTI_ON 3 +#define UDI_NIC_ALLMULTI_OFF 4 +#define UDI_NIC_GET_CURR_MAC 5 +#define UDI_NIC_SET_CURR_MAC 6 +#define UDI_NIC_GET_FACT_MAC 7 +#define UDI_NIC_PROMISC_ON 8 +#define UDI_NIC_PROMISC_OFF 9 +#define UDI_NIC_HW_RESET 10 +#define UDI_NIC_BAD_RXPKT 11 +typedef struct { + udi_cb_t gcb; + udi_ubit8_t command; + udi_ubit32_t indicator; + udi_buf_t *data_buf; +} udi_nic_ctrl_cb_t; + +// event +#define UDI_NIC_LINK_DOWN 0 +#define UDI_NIC_LINK_UP 1 +#define UDI_NIC_LINK_RESET 2 +typedef struct { + udi_cb_t gcb; + udi_ubit8_t event; +} udi_nic_status_cb_t; + +typedef struct { + udi_cb_t gcb; + udi_boolean_t interface_is_active; + udi_boolean_t link_is_active; + udi_boolean_t is_full_duplex; + udi_ubit32_t link_mbps; + udi_ubit32_t link_bps; + udi_ubit32_t tx_packets; + udi_ubit32_t rx_packets; + udi_ubit32_t tx_errors; + udi_ubit32_t rx_errors; + udi_ubit32_t tx_discards; + udi_ubit32_t rx_discards; + udi_ubit32_t tx_underrun; + udi_ubit32_t rx_overrun; + udi_ubit32_t collisions; +} udi_nic_info_cb_t; + +typedef struct udi_nic_tx_cb_s { + udi_cb_t gcb; + struct udi_nic_tx_cb_s *chain; + udi_buf_t *tx_buf; + udi_boolean_t completion_urgent; +} udi_nic_tx_cb_t; + +// rx_status +#define UDI_NIC_RX_BADCKSUM (1U<<0) +#define UDI_NIC_RX_UNDERRUN (1U<<1) +#define UDI_NIC_RX_OVERRUN (1U<<2) +#define UDI_NIC_RX_DRIBBLE (1U<<3) +#define UDI_NIC_RX_FRAME_ERR (1U<<4) +#define UDI_NIC_RX_MAC_ERR (1U<<5) +#define UDI_NIC_RX_OTHER_ERR (1U<<7) +// addr_match +#define UDI_NIC_RX_UNKNOWN 0 +#define UDI_NIC_RX_EXACT 1 +#define UDI_NIC_RX_HASH 2 +#define UDI_NIC_RX_BROADCAST 3 +// rx_valid +#define UDI_NIC_RX_GOOD_IP_CKSUM (1U<<0) +#define UDI_NIC_RX_GOOD_TCP_CKSUM (1U<<1) +#define UDI_NIC_RX_GOOD_UDP_CKSUM (1U<<2) +typedef struct udi_nic_rx_cb_s { + udi_cb_t gcb; + struct udi_nic_rx_cb_s *chain; + udi_buf_t *rx_buf; + udi_ubit8_t rx_status; + udi_ubit8_t addr_match; + udi_ubit8_t rx_valid; +} udi_nic_rx_cb_t; + +// === Function Types === +// - Control +typedef void udi_nd_bind_req_op_t(udi_nic_bind_cb_t *cb, udi_index_t tx_chan_index, udi_index_t rx_chan_index); +typedef void udi_nsr_bind_ack_op_t(udi_nic_bind_cb_t *cb, udi_status_t status); +typedef void udi_nd_unbind_req_op_t(udi_nic_cb_t *cb); +typedef void udi_nsr_unbind_ack_op_t(udi_nic_cb_t *cb, udi_status_t status); +typedef void udi_nd_enable_req_op_t(udi_nic_cb_t *cb); +typedef void udi_nsr_enable_ack_op_t(udi_nic_cb_t *cb, udi_status_t status); +typedef void udi_nd_disable_req_op_t(udi_nic_cb_t *cb); +typedef void udi_nsr_disable_ack_op_t(udi_nic_cb_t *cb, udi_status_t status); +typedef void udi_nd_ctrl_req_op_t(udi_nic_ctrl_cb_t *cb); +typedef void udi_nsr_ctrl_ack_op_t(udi_nic_ctrl_cb_t *cb, udi_status_t status); +typedef void udi_nsr_status_ind_op_t(udi_nic_status_cb_t *cb); +typedef void udi_nd_info_req_op_t(udi_nic_info_cb_t *cb, udi_boolean_t reset_statistics); +typedef void udi_nsr_info_ack_op_t(udi_nic_info_cb_t *cb); +// - TX +typedef void udi_nsr_tx_rdy_op_t(udi_nic_tx_cb_t *cb); +typedef void udi_nd_tx_req_op_t(udi_nic_tx_cb_t *cb); +typedef void udi_nd_exp_tx_req_op_t(udi_nic_tx_cb_t *cb); +// - RX +typedef void udi_nsr_rx_ind_op_t(udi_nic_rx_cb_t *cb); +typedef void udi_nsr_exp_rx_ind_op_t(udi_nic_rx_cb_t *cb); +typedef void udi_nd_rx_rdy_op_t(udi_nic_rx_cb_t *cb); + +// === Functions === +// - Control +extern udi_nd_bind_req_op_t udi_nd_bind_req; +extern udi_nsr_bind_ack_op_t udi_nsr_bind_ack; +extern udi_nd_unbind_req_op_t udi_nd_unbind_req; +extern udi_nsr_unbind_ack_op_t udi_nsr_unbind_ack; +extern udi_nd_enable_req_op_t udi_nd_enable_req; +extern udi_nsr_enable_ack_op_t udi_nsr_enable_ack; +extern udi_nd_disable_req_op_t udi_nd_disable_req; +extern udi_nsr_disable_ack_op_t udi_nsr_disable_ack; +extern udi_nd_ctrl_req_op_t udi_nd_ctrl_req; +extern udi_nsr_ctrl_ack_op_t udi_nsr_ctrl_ack; +extern udi_nsr_status_ind_op_t udi_nsr_status_ind; +extern udi_nd_info_req_op_t udi_nd_info_req; +extern udi_nsr_info_ack_op_t udi_nsr_info_ack; +// - TX +extern udi_nsr_tx_rdy_op_t udi_nsr_tx_rdy; +extern udi_nd_tx_req_op_t udi_nd_tx_req; +extern udi_nd_exp_tx_req_op_t udi_nd_exp_tx_req; +// - RX +extern udi_nsr_rx_ind_op_t udi_nsr_rx_ind; +extern udi_nsr_exp_rx_ind_op_t udi_nsr_exp_rx_ind; +extern udi_nd_rx_rdy_op_t udi_nd_rx_rdy; + +// === Op Lists == +#define UDI_ND_CTRL_OPS_NUM 1 +#define UDI_ND_TX_OPS_NUM 2 +#define UDI_ND_RX_OPS_NUM 3 +#define UDI_NSR_CTRL_OPS_NUM 4 +#define UDI_NSR_TX_OPS_NUM 5 +#define UDI_NSR_RX_OPS_NUM 6 + +typedef const struct { + udi_channel_event_ind_op_t *channel_event_ind_op; + udi_nd_bind_req_op_t *nd_bind_req_op; + udi_nd_unbind_req_op_t *nd_unbind_req_op; + udi_nd_enable_req_op_t *nd_enable_req_op; + udi_nd_disable_req_op_t *nd_disable_req_op; + udi_nd_ctrl_req_op_t *nd_ctrl_req_op; + udi_nd_info_req_op_t *nd_info_req_op; +} udi_nd_ctrl_ops_t; + +typedef const struct { + udi_channel_event_ind_op_t *channel_event_ind_op; + udi_nd_tx_req_op_t *nd_tx_req_op; + udi_nd_exp_tx_req_op_t *nd_exp_tx_req_op; +} udi_nd_tx_ops_t; + +typedef const struct { + udi_channel_event_ind_op_t *channel_event_ind_op; + udi_nd_rx_rdy_op_t *nd_rx_rdy_op; +} udi_nd_rx_ops_t; + +typedef const struct { + udi_channel_event_ind_op_t *channel_event_ind_op; + udi_nsr_bind_ack_op_t *nsr_bind_ack_op; + udi_nsr_unbind_ack_op_t *nsr_unbind_ack_op; + udi_nsr_enable_ack_op_t *nsr_enable_ack_op; + udi_nsr_ctrl_ack_op_t *nsr_ctrl_ack_op; + udi_nsr_info_ack_op_t *nsr_info_ack_op; + udi_nsr_status_ind_op_t *nsr_status_ind_op; +} udi_nsr_ctrl_ops_t; + +typedef const struct { + udi_channel_event_ind_op_t *channel_event_ind_op; + udi_nsr_tx_rdy_op_t *nsr_tx_rdy_op; +} udi_nsr_tx_ops_t; + +typedef const struct { + udi_channel_event_ind_op_t *channel_event_ind_op; + udi_nsr_rx_ind_op_t *nsr_rx_ind_op; + udi_nsr_exp_rx_ind_op_t *nsr_exp_rx_ind_op; +} udi_nsr_rx_ops_t; + +#endif + diff --git a/UDI/include/udi_pci.h b/UDI/include/udi_pci.h new file mode 100644 index 00000000..f65c6fd5 --- /dev/null +++ b/UDI/include/udi_pci.h @@ -0,0 +1,24 @@ +/* + * Acess2 UDI Layer + * - By John Hodge (thePowersGang) + * + * include/udi_pci.h + * - PCI Bus Binding + */ +#ifndef _UDI_PCI_H_ +#define _UDI_PCI_H_ + +#ifndef _UDI_PHYSIO_H_ +# error "udi_pci.h requires udi_physio.h" +#endif + +#define UDI_PCI_CONFIG_SPACE 255 +#define UDI_PCI_BAR_0 0 +#define UDI_PCI_BAR_1 1 +#define UDI_PCI_BAR_2 2 +#define UDI_PCI_BAR_3 3 +#define UDI_PCI_BAR_4 4 +#define UDI_PCI_BAR_5 5 + +#endif + diff --git a/UDI/include/udi_physio.h b/UDI/include/udi_physio.h new file mode 100644 index 00000000..f5c3ab15 --- /dev/null +++ b/UDI/include/udi_physio.h @@ -0,0 +1,133 @@ +/** + * \file udi_physio.h + */ +#ifndef _UDI_PHYSIO_H_ +#define _UDI_PHYSIO_H_ + +#include + +//#ifndef UDI_PHYSIO_VERSION +//# error "UDI_PHYSIO_VERSION must be defined" +//#endif + +// === TYPEDEFS === +// DMA Core +typedef _udi_handle_t udi_dma_handle_t; +#define UDI_NULL_DMA_HANDLE _NULL_HANDLE +typedef uint64_t 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 === +#include +#include +#include +#include +#include "physio/pio.h" + +#include "physio/pci.h" + +#endif diff --git a/UDI/include/udi_scsi.h b/UDI/include/udi_scsi.h new file mode 100644 index 00000000..234ab857 --- /dev/null +++ b/UDI/include/udi_scsi.h @@ -0,0 +1,134 @@ +/** + * \file udi_scsi.h + * \brief UDI SCSI Bindings + */ +#ifndef _UDI_SCSI_H_ +#define _UDI_SCSI_H_ + +typedef struct { + udi_cb_t gcb; + udi_ubit16_t events; +} udi_scsi_bind_cb_t; + +#define UDI_SCSI_BIND_CB_NUM 1 + +/* SCSI Events */ +#define UDI_SCSI_EVENT_AEN (1U<<0) +#define UDI_SCSI_EVENT_TGT_RESET (1U<<1) +#define UDI_SCSI_EVENT_BUS_RESET (1U<<2) +#define UDI_SCSI_EVENT_UNSOLICITED_RESELECT (1U<<3) + +typedef struct { + udi_cb_t gcb; + udi_buf_t *data_buf; + udi_ubit32_t timeout; + udi_ubit16_t flags; + udi_ubit8_t attribute; + udi_ubit8_t cdb_len; + udi_ubit8_t *cdb_ptr; +} udi_scsi_io_cb_t; +/* Control Block Group Number */ +#define UDI_SCSI_IO_CB_NUM 2 +/* I/O Request Flags */ +#define UDI_SCSI_DATA_IN (1U<<0) +#define UDI_SCSI_DATA_OUT (1U<<1) +#define UDI_SCSI_NO_DISCONNECT (1U<<2) +/* SCSI Task Attributes */ +#define UDI_SCSI_SIMPLE_TASK 1 +#define UDI_SCSI_ORDERED_TASK 2 +#define UDI_SCSI_HEAD_OF_Q_TASK 3 +#define UDI_SCSI_ACA_TASK 4 +#define UDI_SCSI_UNTAGGED_TASK 5 + +typedef struct { + udi_status_t req_status; + udi_ubit8_t scsi_status; + udi_ubit8_t sense_status; +} udi_scsi_status_t; + +typedef struct { + udi_cb_t gcb; + udi_ubit8_t ctrl_func; + udi_ubit16_t queue_depth; +} udi_scsi_ctl_cb_t; +/* Values for ctrl_func */ +#define UDI_SCSI_CTL_ABORT_TASK_SET 1 +#define UDI_SCSI_CTL_CLEAR_TASK_SET 2 +#define UDI_SCSI_CTL_LUN_RESET 3 +#define UDI_SCSI_CTL_TGT_RESET 4 +#define UDI_SCSI_CTL_BUS_RESET 5 +#define UDI_SCSI_CTL_CLEAR_ACA 6 +#define UDI_SCSI_CTL_SET_QUEUE_DEPTH 7 +/* Control Block Group Number */ +#define UDI_SCSI_CTL_CB_NUM 3 + +typedef struct { + udi_cb_t gcb; + udi_ubit8_t event; + udi_buf_t *aen_data_buf; +} udi_scsi_event_cb_t; +/* Control Block Group Number */ +#define UDI_SCSI_EVENT_CB_NUM 4 + +typedef void udi_scsi_bind_ack_op_t(udi_scsi_bind_cb_t *cb, udi_ubit32_t hd_timeout_increase, udi_status_t status); +typedef void udi_scsi_unbind_ack_op_t(udi_scsi_bind_cb_t *cb); +typedef void udi_scsi_io_ack_op_t(udi_scsi_io_cb_t *cb); +typedef void udi_scsi_io_nak_op_t(udi_scsi_io_cb_t *cb); +typedef void udi_scsi_ctl_ack_op_t(udi_scsi_ctl_cb_t *cb, udi_status_t status); +typedef void udi_scsi_event_ind_op_t(udi_scsi_event_cb_t *cb); + +typedef void udi_scsi_bind_req_op_t(udi_scsi_bind_cb_t *cb, + udi_ubit16_t bind_flags, udi_ubit16_t queue_depth, + udi_ubit16_t max_sense_len, udi_ubit16_t aen_buf_size); +typedef void udi_scsi_unbind_req_op_t(udi_scsi_bind_cb_t *cb); +typedef void udi_scsi_io_req_op_t(udi_scsi_io_cb_t *cb); +typedef void udi_scsi_ctl_req_op_t(udi_scsi_ctl_cb_t *cb); +typedef void udi_scsi_event_res_op_t(udi_scsi_event_cb_t *cb); + +typedef const struct { + udi_channel_event_ind_op_t *channel_event_ind_op; + udi_scsi_bind_ack_op_t *bind_ack_op; + udi_scsi_unbind_ack_op_t *unbind_ack_op; + udi_scsi_io_ack_op_t *io_ack_op; + udi_scsi_io_nak_op_t *io_nak_op; + udi_scsi_ctl_ack_op_t *ctl_ack_op; + udi_scsi_event_ind_op_t *event_ind_op; +} udi_scsi_pd_ops_t; + +#define UDI_SCSI_PD_OPS_NUM 1 + +typedef const struct { + udi_channel_event_ind_op_t *channel_event_ind_op; + udi_scsi_bind_req_op_t *bind_req_op; + udi_scsi_unbind_req_op_t *unbind_req_op; + udi_scsi_io_req_op_t *io_req_op; + udi_scsi_ctl_req_op_t *ctl_req_op; + udi_scsi_event_res_op_t *event_res_op; +} udi_scsi_hd_ops_t; + +#define UDI_SCSI_HD_OPS_NUM 2 + +/* Bind Flags */ +#define UDI_SCSI_BIND_EXCLUSIVE (1U<<0) +#define UDI_SCSI_TEMP_BIND_EXCLUSIVE (1U<<1) + +extern void udi_scsi_bind_req(udi_scsi_bind_cb_t *cb, + udi_ubit16_t bind_flags, udi_ubit16_t queue_depth, + udi_ubit16_t max_sense_len, udi_ubit16_t aen_buf_size); +extern void udi_scsi_bind_ack(udi_scsi_bind_cb_t *cb, udi_ubit32_t hd_timeout_increase, udi_status_t status); +extern void udi_scsi_unbind_req(udi_scsi_bind_cb_t *cb); +extern void udi_scsi_unbind_ack(udi_scsi_bind_cb_t *cb); + +extern void udi_scsi_io_req(udi_scsi_io_cb_t *cb); +extern void udi_scsi_io_ack(udi_scsi_io_cb_t *cb); +extern void udi_scsi_io_nak(udi_scsi_io_cb_t *cb, udi_scsi_status_t status, udi_buf_t *sense_buf); +extern void udi_scsi_ctl_req(udi_scsi_ctl_cb_t *cb); +extern void udi_scsi_ctl_ack(udi_scsi_ctl_cb_t *cb, udi_status_t status); +extern void udi_scsi_event_ind(udi_scsi_event_cb_t *cb); +extern udi_scsi_event_ind_op_t udi_scsi_event_ind_unused; +extern void udi_scsi_event_res(udi_scsi_event_cb_t *cb); +extern void udi_scsi_inquiry_to_string(const udi_ubit8_t *inquiry_data, udi_size_t inquiry_len, char *str); + + +#endif +