diff options
Diffstat (limited to 'libddekit/include')
-rw-r--r-- | libddekit/include/dde.h | 14 | ||||
-rw-r--r-- | libddekit/include/ddekit/assert.h | 23 | ||||
-rw-r--r-- | libddekit/include/ddekit/condvar.h | 53 | ||||
-rw-r--r-- | libddekit/include/ddekit/debug.h | 8 | ||||
-rw-r--r-- | libddekit/include/ddekit/initcall.h | 42 | ||||
-rw-r--r-- | libddekit/include/ddekit/inline.h | 2 | ||||
-rw-r--r-- | libddekit/include/ddekit/interrupt.h | 57 | ||||
-rw-r--r-- | libddekit/include/ddekit/lock.h | 83 | ||||
-rw-r--r-- | libddekit/include/ddekit/memory.h | 144 | ||||
-rw-r--r-- | libddekit/include/ddekit/panic.h | 16 | ||||
-rw-r--r-- | libddekit/include/ddekit/pci.h | 199 | ||||
-rw-r--r-- | libddekit/include/ddekit/pgtab.h | 86 | ||||
-rw-r--r-- | libddekit/include/ddekit/printf.h | 35 | ||||
-rw-r--r-- | libddekit/include/ddekit/resources.h | 14 | ||||
-rw-r--r-- | libddekit/include/ddekit/semaphore.h | 50 | ||||
-rw-r--r-- | libddekit/include/ddekit/thread.h | 145 | ||||
-rw-r--r-- | libddekit/include/ddekit/timer.h | 59 | ||||
-rw-r--r-- | libddekit/include/ddekit/types.h | 22 |
18 files changed, 0 insertions, 1052 deletions
diff --git a/libddekit/include/dde.h b/libddekit/include/dde.h deleted file mode 100644 index 12f8a81a..00000000 --- a/libddekit/include/dde.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef l4_ddekit_h -#define l4_ddekit_h - -/* FIXME if this is ddekit.h, it should be moved into dde/ddekit/include/ddekit.h (also - * all headers under include/ddekit) */ - -/** - * Initialize the DDE. Must be called before any other DDE function. - * - * FIXME revisit this one - */ -void ddekit_init(void); - -#endif diff --git a/libddekit/include/ddekit/assert.h b/libddekit/include/ddekit/assert.h deleted file mode 100644 index 5d593662..00000000 --- a/libddekit/include/ddekit/assert.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef _ddekit_assert_h -#define _ddekit_assert_h - -#include "ddekit/printf.h" -#include "ddekit/panic.h" - -/** \file ddekit/assert.h */ - -/** Assert that an expression is true and panic if not. - * \ingroup DDEKit_util - */ -#define Assert(expr) do \ - { \ - if (!(expr)) { \ - ddekit_print("\033[31;1mDDE: Assertion failed: "#expr"\033[0m\n"); \ - ddekit_printf(" File: %s:%d\n",__FILE__,__LINE__); \ - ddekit_printf(" Function: %s()\n", __FUNCTION__); \ - ddekit_panic("Assertion failed."); \ - }} while (0); - -#endif - -#define assert Assert diff --git a/libddekit/include/ddekit/condvar.h b/libddekit/include/ddekit/condvar.h deleted file mode 100644 index 129a718d..00000000 --- a/libddekit/include/ddekit/condvar.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef _ddekit_condvar_h -#define _ddekit_condvar_h - -/** \file ddekit/condvar.h */ -#include "ddekit/lock.h" - -struct ddekit_condvar; -typedef struct ddekit_condvar ddekit_condvar_t; - -/** Initialize conditional variable. - * - * \ingroup DDEKit_synchronization - */ -ddekit_condvar_t * ddekit_condvar_init(void); - -/** Uninitialize conditional variable. - * - * \ingroup DDEKit_synchronization - */ -void ddekit_condvar_deinit(ddekit_condvar_t *cvp); - -/** Wait on a conditional variable. - * - * \ingroup DDEKit_synchronization - */ -void ddekit_condvar_wait(ddekit_condvar_t *cvp, ddekit_lock_t *mp); - -/** Wait on a conditional variable at most until a timeout expires. - * - * \ingroup DDEKit_synchronization - * - * \param cvp pointer to condvar - * \param mp lock - * \param timo timeout in ms - * - * \return 0 success - * \return !=0 timeout - */ -int ddekit_condvar_wait_timed(ddekit_condvar_t *cvp, ddekit_lock_t *mp, int timo); - -/** Send signal to the next one waiting for condvar. - * - * \ingroup DDEKit_synchronization - */ -void ddekit_condvar_signal(ddekit_condvar_t *cvp); - -/** Send signal to all threads waiting for condvar. - * - * \ingroup DDEKit_synchronization - */ -void ddekit_condvar_broadcast(ddekit_condvar_t *cvp); - -#endif diff --git a/libddekit/include/ddekit/debug.h b/libddekit/include/ddekit/debug.h deleted file mode 100644 index 79a8e7b5..00000000 --- a/libddekit/include/ddekit/debug.h +++ /dev/null @@ -1,8 +0,0 @@ -#define DDEBUG_QUIET 0 -#define DDEBUG_ERR 1 -#define DDEBUG_WARN 2 -#define DDEBUG_INFO 3 -#define DDEBUG_VERBOSE 4 - -#define DDEBUG_MEM DDEBUG_INFO - diff --git a/libddekit/include/ddekit/initcall.h b/libddekit/include/ddekit/initcall.h deleted file mode 100644 index 6befa31c..00000000 --- a/libddekit/include/ddekit/initcall.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef _ddekit_initcall_h -#define _ddekit_initcall_h - -// from l4/sys/compiler.h -#if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ >= 4 -#define L4_STICKY(x) __attribute__((used)) x -#else -#define L4_STICKY(x) __attribute__((unused)) x -#endif - -#define l4str(s) #s - -// from dde_linux/ARCH-x86/ctor.h -typedef void (*l4ddekit_initcall_t)(void); - -#define __l4ddekit_initcall(p) \ - __attribute__ ((__section__ (".l4dde_ctors." #p))) - -/** Define a function to be a DDEKit initcall. - * - * Define a function to be a DDEKit initcall. This function will then be placed - * in a separate linker section of the binary (called .l4dde_ctors). The L4Env - * construction mechanism will execute all constructors in this section during - * application startup. - * - * This is the right place to place Linux' module_init functions & Co. - * - * \param fn function - */ -#define DDEKIT_INITCALL(fn) DDEKIT_CTOR(fn, 1) - -#define DDEKIT_CTOR(fn, prio) \ - l4ddekit_initcall_t \ - L4_STICKY(__l4ddekit_initcall_##fn) \ - __l4ddekit_initcall(prio) = (void *)fn - -/** - * Runs all registered initcalls. - */ -void ddekit_do_initcalls(void); - -#endif diff --git a/libddekit/include/ddekit/inline.h b/libddekit/include/ddekit/inline.h deleted file mode 100644 index e59a5c68..00000000 --- a/libddekit/include/ddekit/inline.h +++ /dev/null @@ -1,2 +0,0 @@ -#define INLINE __inline__ __attribute__((always_inline)) - diff --git a/libddekit/include/ddekit/interrupt.h b/libddekit/include/ddekit/interrupt.h deleted file mode 100644 index 3f789210..00000000 --- a/libddekit/include/ddekit/interrupt.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * \brief Hardware-interrupt subsystem - * \author Thomas Friebel <tf13@os.inf.tu-dresden.de> - * \author Christian Helmuth <ch12@os.inf.tu-dresden.de> - * \date 2007-01-26 - * - * DDEKit supports registration of one handler function per interrupt. If any - * specific DDE implementation needs to register more than one handler, - * multiplexing has to be implemented there! - */ - -#ifndef _ddekit_interrupt_h -#define _ddekit_interrupt_h - -#include "ddekit/thread.h" - -#define DDEKIT_IRQ_PRIO 2 - -/** - * Attach to hardware interrupt - * - * \param irq IRQ number to attach to - * \param shared set to 1 if interrupt sharing is supported; set to 0 - * otherwise - * \param thread_init called just after DDEKit internal init and before any - * other function - * \param handler IRQ handler for interrupt irq - * \param priv private token (argument for thread_init and handler) - * - * \return pointer to interrupt thread created - */ -ddekit_thread_t *ddekit_interrupt_attach(int irq, int shared, - void(*thread_init)(void *), - void(*handler)(void *), void *priv); - -/** - * Detach from a previously attached interrupt. - * - * \param irq IRQ number - */ -void ddekit_interrupt_detach(int irq); - -/** - * Block interrupt. - * - * \param irq IRQ number to block - */ -void ddekit_interrupt_disable(int irq); - -/** - * Enable interrupt. - * - * \param irq IRQ number to block - */ -void ddekit_interrupt_enable(int irq); - -#endif diff --git a/libddekit/include/ddekit/lock.h b/libddekit/include/ddekit/lock.h deleted file mode 100644 index dd398b38..00000000 --- a/libddekit/include/ddekit/lock.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef _ddekit_lock_h -#define _ddekit_lock_h - -struct ddekit_lock; - -/** Initialize a DDEKit lock. - * - * \ingroup DDEKit_synchronization - */ -void _ddekit_lock_init (struct ddekit_lock **mtx); - -/** Uninitialize a DDEKit lock. - * - * \ingroup DDEKit_synchronization - */ -void _ddekit_lock_deinit (struct ddekit_lock **mtx); - -/** Acquire a lock. - * - * \ingroup DDEKit_synchronization - */ -void _ddekit_lock_lock (struct ddekit_lock **mtx); - -/** Acquire a lock, non-blocking. - * - * \ingroup DDEKit_synchronization - */ -int _ddekit_lock_try_lock(struct ddekit_lock **mtx); - -/** Unlock function. - * - * \ingroup DDEKit_synchronization - */ -void _ddekit_lock_unlock (struct ddekit_lock **mtx); - -/** Get lock owner. - * - * \ingroup DDEKit_synchronization - */ -int _ddekit_lock_owner(struct ddekit_lock **mtx); - -// definition of ddekit_lock_t -typedef struct ddekit_lock *ddekit_lock_t; - -// common prototypes -static void ddekit_lock_init_locked(ddekit_lock_t *mtx); -static void ddekit_lock_init_unlocked(ddekit_lock_t *mtx); -#define ddekit_lock_init ddekit_lock_init_unlocked -static void ddekit_lock_deinit (ddekit_lock_t *mtx); -static void ddekit_lock_lock (ddekit_lock_t *mtx); -static int ddekit_lock_try_lock(ddekit_lock_t *mtx); // returns 0 on success, != 0 if it would block -static void ddekit_lock_unlock (ddekit_lock_t *mtx); - -// inline implementation or inline call to non-inline implementation -#include "ddekit/inline.h" - -static INLINE void ddekit_lock_init_unlocked(ddekit_lock_t *mtx) { - _ddekit_lock_init(mtx); -} - -static INLINE void ddekit_lock_init_locked(ddekit_lock_t *mtx) { - _ddekit_lock_init(mtx); - _ddekit_lock_lock(mtx); -} - -static INLINE void ddekit_lock_deinit(ddekit_lock_t *mtx) { - _ddekit_lock_deinit(mtx); -} -static INLINE void ddekit_lock_lock(ddekit_lock_t *mtx) { - _ddekit_lock_lock(mtx); -} -static INLINE int ddekit_lock_try_lock(ddekit_lock_t *mtx) { - return _ddekit_lock_try_lock(mtx); -} -static INLINE void ddekit_lock_unlock(ddekit_lock_t *mtx) { - _ddekit_lock_unlock(mtx); -} - -static INLINE int ddekit_lock_owner(ddekit_lock_t *mtx) { - return _ddekit_lock_owner(mtx); -} - -#endif diff --git a/libddekit/include/ddekit/memory.h b/libddekit/include/ddekit/memory.h deleted file mode 100644 index 051a4d9e..00000000 --- a/libddekit/include/ddekit/memory.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * \brief Memory subsystem - * \author Thomas Friebel <tf13@os.inf.tu-dresden.de> - * \author Christian Helmuth <ch12@os.inf.tu-dresden.de> - * \date 2006-11-03 - */ - -#ifndef _ddekit_memory_h -#define _ddekit_memory_h - - -/******************* - ** Slab facility ** - *******************/ - -struct ddekit_slab; - -/** - * Store user pointer in slab cache - * - * \param slab pointer to slab cache - * \param data user pointer - */ -void ddekit_slab_set_data(struct ddekit_slab * slab, void *data); - -/** - * Read user pointer from slab cache - * - * \param slab pointer to slab cache - * - * \return stored user pointer or 0 - */ -void *ddekit_slab_get_data(struct ddekit_slab * slab); - -/** - * Allocate slab in slab cache - * - * \param slab pointer to slab cache - * - * \return pointer to allocated slab - */ -void *ddekit_slab_alloc(struct ddekit_slab * slab); - -/** - * Deallocate slab in slab cache - * - * \param slab pointer to slab cache - * \param objp pointer to allocated slab - */ -void ddekit_slab_free(struct ddekit_slab * slab, void *objp); - -/** - * Setup page cache for all slabs - * - * \param pages maximal number of memory pages - * - * If 'pages' is too low, memory pages may be given back to the memory server - * (dm_phys) and just to be allocated again later. This hits performance (but - * saves memory). Increase 'pages' to avoid this thrashing-like effect. - * - * If the maximal number of unused pages is exceeded, subsequent deallocation - * will be freed at the memory server. This page cache caches pages from all - * slabs. - */ -void ddekit_slab_setup_page_cache(unsigned pages); - -/** - * Destroy slab cache - * - * \param slab pointer to slab cache structure - */ -void ddekit_slab_destroy(struct ddekit_slab * slab); - -/** - * Initialize slab cache - * - * \param size size of cache objects - * \param contiguous make this slab use physically contiguous memory - * - * \return pointer to new slab cache or 0 on error - */ -struct ddekit_slab * ddekit_slab_init(unsigned size, int contiguous); - - -/********************** - ** Memory allocator ** - **********************/ - -/** - * Allocate large memory block - * - * \param size block size - * \return pointer to new memory block - * - * Allocations via this allocator may be slow (because memory servers are - * involved) and should be used only for large (i.e., > page size) blocks. If - * allocations/deallocations are relatively dynamic this may not be what you - * want. - * - * Allocated blocks have valid virt->phys mappings and are physically - * contiguous. - */ -void *ddekit_large_malloc(int size); - -/** - * Free large memory block - * - * \param p pointer to memory block - */ -void ddekit_large_free(void *p); - -/** FIXME - * contig_malloc() is the lowest-level allocator interface one could implement. - * we should consider to provide vmalloc() too. */ -void *ddekit_contig_malloc( - unsigned long size, - unsigned long low, unsigned long high, - unsigned long alignment, unsigned long boundary -); - - -/***************************** - ** Simple memory allocator ** - *****************************/ - -/** - * Allocate memory block via simple allocator - * - * \param size block size - * \return pointer to new memory block - * - * The blocks allocated via this allocator CANNOT be used for DMA or other - * device operations, i.e., there exists no virt->phys mapping. - */ -void *ddekit_simple_malloc(unsigned size); - -/** - * Free memory block via simple allocator - * - * \param p pointer to memory block - */ -void ddekit_simple_free(void *p); - -#endif diff --git a/libddekit/include/ddekit/panic.h b/libddekit/include/ddekit/panic.h deleted file mode 100644 index 1468675f..00000000 --- a/libddekit/include/ddekit/panic.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _ddekit_panic_h -#define _ddekit_panic_h - -/** \defgroup DDEKit_util */ - -/** Panic - print error message and enter the kernel debugger. - * \ingroup DDEKit_util - */ -void ddekit_panic(char *fmt, ...) __attribute__((noreturn)); - -/** Print a debug message. - * \ingroup DDEKit_util - */ -void ddekit_debug(char *fmt, ...); - -#endif diff --git a/libddekit/include/ddekit/pci.h b/libddekit/include/ddekit/pci.h deleted file mode 100644 index 5a5fd29b..00000000 --- a/libddekit/include/ddekit/pci.h +++ /dev/null @@ -1,199 +0,0 @@ -#ifndef _ddekit_pci_h -#define _ddekit_pci_h - -#include "ddekit/types.h" - -/** \defgroup DDEKit_pci */ - -/** Our version of PCI_ANY_ID */ -#define DDEKIT_PCI_ANY_ID (~0) - -/** Copy of L4IO_PCIDEV_RES */ -#define DDEKIT_PCIDEV_RES 12 - -struct ddekit_pci_dev; - -/** PCI resource descriptor. Copied from generic_io. - * - * XXX! - */ -typedef struct ddekit_pci_resource { - unsigned long start; - unsigned long end; - unsigned long flags; -} ddekit_pci_res_t; - -void ddekit_pci_init(void); - -int ddekit_pci_get_device(int nr, int *bus, int *slot, int *func); - -int ddekit_pci_read(int bus, int slot, int func, int pos, int len, ddekit_uint32_t *val); -int ddekit_pci_write(int bus, int slot, int func, int pos, int len, ddekit_uint32_t val); - -/** Read byte from PCI config space. - * - * \ingroup DDEKit_pci - * - * \param bus bus ID - * \param slot slot # - * \param func function # - * \param pos offset in config space - * \retval val read value - * - * \return 0 success - */ -int ddekit_pci_readb (int bus, int slot, int func, int pos, ddekit_uint8_t *val); - -/** Read word from PCI config space. - * - * \ingroup DDEKit_pci - * - * \param bus bus ID - * \param slot slot # - * \param func function # - * \param pos offset in config space - * \retval val read value - * - * \return 0 success - */ -int ddekit_pci_readw (int bus, int slot, int func, int pos, ddekit_uint16_t *val); - -/** Read dword from PCI config space. - * - * \ingroup DDEKit_pci - * - * \param bus bus ID - * \param slot slot # - * \param func function # - * \param pos offset in config space - * \retval val read value - * - * \return 0 success - */ -int ddekit_pci_readl (int bus, int slot, int func, int pos, ddekit_uint32_t *val); - -/** Write byte to PCI config space. - * - * \ingroup DDEKit_pci - * - * \param bus bus ID - * \param slot slot # - * \param func function # - * \param pos offset in config space - * \retval val value to write - * - * \return 0 success - */ -int ddekit_pci_writeb(int bus, int slot, int func, int pos, ddekit_uint8_t val); - -/** Write word to PCI config space. - * - * \ingroup DDEKit_pci - * - * \param bus bus ID - * \param slot slot # - * \param func function # - * \param pos offset in config space - * \retval val value to write - * - * \return 0 success - */ -int ddekit_pci_writew(int bus, int slot, int func, int pos, ddekit_uint16_t val); - -/** Write word to PCI config space. - * - * \ingroup DDEKit_pci - * - * \param bus bus ID - * \param slot slot # - * \param func function # - * \param pos offset in config space - * \retval val value to write - * - * \return 0 success - */ -int ddekit_pci_writel(int bus, int slot, int func, int pos, ddekit_uint32_t val); - -/** Find a PCI device. - * - * \ingroup DDEKit_pci - * - * \param bus pointer to bus number or \ref DDEKIT_PCI_ANY_ID - * \param slot pointer to slot number (devfn >> DEVFN_SLOTSHIFT) or \ref DDEKIT_PCI_ANY_ID - * \param func pointer to func number (devfc & DEVFN_FUNCMASK) or \ref DDEKIT_PCI_ANY_ID - * \param start search device list only behind this device (excluding it!), NULL - * searches whole device list - * - * \retval bus bus number - * \retval slot slot number - * \retval func function number - * - * \return device a valid PCI device - * \return NULL if no device found - */ -struct ddekit_pci_dev * -ddekit_pci_find_device(int *bus, int *slot, int *func, struct ddekit_pci_dev *start); - -/** Enable PCI device - * \ingroup DDEKit_pci - */ -int ddekit_pci_enable_device(struct ddekit_pci_dev *dev); - -/** Disable PCI device - * \ingroup DDEKit_pci - */ -int ddekit_pci_disable_device(struct ddekit_pci_dev *dev); - -/** Enable bus-mastering for device. - * \ingroup DDEKit_pci - */ -void ddekit_pci_set_master(struct ddekit_pci_dev *dev); - -/** Get device vendor ID. - * \ingroup DDEKit_pci - */ -unsigned short ddekit_pci_get_vendor(struct ddekit_pci_dev *dev); - -/** Get device ID. - * \ingroup DDEKit_pci - */ -unsigned short ddekit_pci_get_device_id(struct ddekit_pci_dev *dev); - -/** Get device subvendor ID. - * \ingroup DDEKit_pci - */ -unsigned short ddekit_pci_get_sub_vendor(struct ddekit_pci_dev *dev); - -/** Get subdevice ID. - * \ingroup DDEKit_pci - */ -unsigned short ddekit_pci_get_sub_device(struct ddekit_pci_dev *dev); - -/** Get device class ID. - * \ingroup DDEKit_pci - */ -unsigned ddekit_pci_get_dev_class(struct ddekit_pci_dev *dev); - -/** Get device's IRQ number. - * \ingroup DDEKit_pci - */ -unsigned long ddekit_pci_get_irq(struct ddekit_pci_dev *dev); - -/** Get device name. - * \ingroup DDEKit_pci - */ -char *ddekit_pci_get_name(struct ddekit_pci_dev *dev); - -/** Get device's slot name. - * \ingroup DDEKit_pci - */ -char *ddekit_pci_get_slot_name(struct ddekit_pci_dev *dev); - -/** Get one of the device's resources. - * \ingroup DDEKit_pci - */ -ddekit_pci_res_t *ddekit_pci_get_resource(struct ddekit_pci_dev *dev, unsigned int idx); - -int ddekit_pci_irq_enable(int bus, int slot, int func, int pin, int *irq); - -#endif // _ddekit_pci_h diff --git a/libddekit/include/ddekit/pgtab.h b/libddekit/include/ddekit/pgtab.h deleted file mode 100644 index 8964b713..00000000 --- a/libddekit/include/ddekit/pgtab.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * \brief Virtual page-table facility - * \author Thomas Friebel <tf13@os.inf.tu-dresden.de> - * \author Christian Helmuth <ch12@os.inf.tu-dresden.de> - * \date 2006-11-03 - */ - -#ifndef _ddekit_pgtab_h -#define _ddekit_pgtab_h - -#include "ddekit/types.h" - -/* FIXME Region types may be defined by pgtab users. Do we really need them - * here? */ -enum ddekit_pgtab_type -{ - PTE_TYPE_OTHER, PTE_TYPE_LARGE, PTE_TYPE_UMA, PTE_TYPE_CONTIG -}; - - -/** - * Set virtual->physical mapping for VM region - * - * \param virt virtual start address for region - * \param phys physical start address for region - * \param pages number of pages in region - * \param type pgtab type for region - */ -void ddekit_pgtab_set_region(void *virt, ddekit_addr_t phys, int pages, int type); - - -/** - * Set virtual->physical mapping for VM region given a specific size in bytes. - * - * Internally, DDEKit manages regions with pages. However, DDEs do not need to tangle - * with the underlying mechanism and therefore can use this function that takes care - * of translating a size to an amount of pages. - */ -void ddekit_pgtab_set_region_with_size(void *virt, ddekit_addr_t phys, int size, int type); - - -/** - * Clear virtual->physical mapping for VM region - * - * \param virt virtual start address for region - * \param type pgtab type for region - */ -void ddekit_pgtab_clear_region(void *virt, int type); - -/** - * Get physical address for virtual address - * - * \param virt virtual address - * - * \return physical address - */ -ddekit_addr_t ddekit_pgtab_get_physaddr(const void *virt); - -/** - * Get virtual address for physical address - * - * \param physical physical address - * - * \return virtual address - */ -ddekit_addr_t ddekit_pgtab_get_virtaddr(const ddekit_addr_t physical); - -/** - * Get type of VM region. - * - * \param virt virtual address - - * \return VM region type - */ -int ddekit_pgtab_get_type(const void *virt); - -/** - * Get size of VM region. - * - * \param virt virtual address - * - * \return VM region size (in bytes) - */ -int ddekit_pgtab_get_size(const void *virt); - -#endif diff --git a/libddekit/include/ddekit/printf.h b/libddekit/include/ddekit/printf.h deleted file mode 100644 index 6dafa18d..00000000 --- a/libddekit/include/ddekit/printf.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef _ddekit_print_h -#define _ddekit_print_h - -#include <stdarg.h> - -/** Print message. - * \ingroup DDEKit_util - */ -int ddekit_print(const char *); - -/** Print message with format. - * \ingroup DDEKit_util - */ -int ddekit_printf(const char *fmt, ...); - -/** Print message with format list. - * \ingroup DDEKit_util - */ -int ddekit_vprintf(const char *fmt, va_list va); - -void dump_stack(void); - -/** Log function and message. - * \ingroup DDEKit_util - */ -#define ddekit_log(doit, msg...) \ - do { \ - if (doit) { \ - ddekit_printf("%s(): ", __func__); \ - ddekit_printf(msg); \ - ddekit_printf("\n"); \ - } \ - } while(0); - -#endif diff --git a/libddekit/include/ddekit/resources.h b/libddekit/include/ddekit/resources.h deleted file mode 100644 index 657295a0..00000000 --- a/libddekit/include/ddekit/resources.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _ddekit_resources_h -#define _ddekit_resources_h - -#include "ddekit/types.h" - -int ddekit_request_dma(int nr); -int ddekit_release_dma(int nr); -int ddekit_request_io (ddekit_addr_t start, ddekit_addr_t count); -int ddekit_release_io (ddekit_addr_t start, ddekit_addr_t count); -int ddekit_request_mem(ddekit_addr_t start, ddekit_addr_t count, ddekit_addr_t *vaddr); -int ddekit_release_mem(ddekit_addr_t start, ddekit_addr_t count); -long ddekit_random (void); - -#endif diff --git a/libddekit/include/ddekit/semaphore.h b/libddekit/include/ddekit/semaphore.h deleted file mode 100644 index c959919d..00000000 --- a/libddekit/include/ddekit/semaphore.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef _ddekit_semaphore_h -#define _ddekit_semaphore_h - -/** \defgroup DDEKit_synchronization */ - -struct ddekit_sem; -typedef struct ddekit_sem ddekit_sem_t; - -/** Initialize DDEKit semaphore. - * - * \ingroup DDEKit_synchronization - * - * \param value initial semaphore counter - */ -ddekit_sem_t *ddekit_sem_init(int value); - -/** Uninitialize semaphore. - * - * \ingroup DDEKit_synchronization - */ -void ddekit_sem_deinit(ddekit_sem_t *sem); - -/** Semaphore down method. */ -void ddekit_sem_down(ddekit_sem_t *sem); - -/** Semaphore down method, non-blocking. - * - * \ingroup DDEKit_synchronization - * - * \return 0 success - * \return !=0 would block - */ -int ddekit_sem_down_try(ddekit_sem_t *sem); - -/** Semaphore down with timeout. - * - * \ingroup DDEKit_synchronization - * - * \return 0 success - * \return !=0 would block - */ -int ddekit_sem_down_timed(ddekit_sem_t *sem, int timo); - -/** Semaphore up method. - * - * \ingroup DDEKit_synchronization - */ -void ddekit_sem_up(ddekit_sem_t *sem); - -#endif diff --git a/libddekit/include/ddekit/thread.h b/libddekit/include/ddekit/thread.h deleted file mode 100644 index 8ed52013..00000000 --- a/libddekit/include/ddekit/thread.h +++ /dev/null @@ -1,145 +0,0 @@ -#ifndef _ddekit_thread_h -#define _ddekit_thread_h - -/** \defgroup DDEKit_threads */ - -#include "ddekit/lock.h" - -struct ddekit_thread; -typedef struct ddekit_thread ddekit_thread_t; - -/** Create thread - * - * \ingroup DDEKit_threads - * - * Create a new thread running the specified thread function with the specified - * arguments. The thread is assigned the given internal name. - * - * Additionally, DDEKit threads possess a thread-local storage area where they - * may store arbitrary data. - * - * \param fun thread function - * \param arg optional argument to thread function, set to NULL if not needed - * \param name internal thread name - */ -ddekit_thread_t *ddekit_thread_create(void (*fun)(void *), void *arg, const char *name); - -/** Reference to own DDEKit thread id. - * - * \ingroup DDEKit_threads - */ -ddekit_thread_t *ddekit_thread_myself(void); - -/** Initialize thread with given name. - * - * \ingroup DDEKit_threads - * - * This function may be used by threads that were not created using - * \ref ddekit_thread_create. This enables such threads to be handled as if they - * were DDEKit threads. - */ -ddekit_thread_t *ddekit_thread_setup_myself(const char *name); - -/** Get TLS data for a specific thread. - * - * \ingroup DDEKit_threads - * - * \return Pointer to TLS data of this thread. - */ -void *ddekit_thread_get_data(ddekit_thread_t *thread); - -/** Get TLS data for current thread. - * - * \ingroup DDEKit_threads - * - * Same as calling \ref ddekit_thread_get_data with \ref ddekit_thread_myself - * as parameter. - * - * \return Pointer to TLS data of current thread. - */ -void *ddekit_thread_get_my_data(void); - -/** Set TLS data for specific thread. - * - * \ingroup DDEKit_threads - * - * \param thread DDEKit thread - * \param data pointer to thread data - */ -void ddekit_thread_set_data(ddekit_thread_t *thread, void *data); - -/** Set TLS data for current thread. - * - * \ingroup DDEKit_threads - * - * \param data pointer to thread data - */ -void ddekit_thread_set_my_data(void *data); - -/** Sleep for some miliseconds. - * - * \ingroup DDEKit_threads - * - * \param msecs time to sleep in ms. - */ -void ddekit_thread_msleep(unsigned long msecs); - -/** Sleep for some microseconds. - * - * \ingroup DDEKit_threads - * - * \param usecs time to sleep in µs. - */ -void ddekit_thread_usleep(unsigned long usecs); - -/** Sleep for some nanoseconds. - * - * \ingroup DDEKit_threads - * - * \param usecs time to sleep in ns. - */ -void ddekit_thread_nsleep(unsigned long nsecs); - -/** Sleep until a lock becomes unlocked. - * - * \ingroup DDEKit_threads - */ -void ddekit_thread_sleep(ddekit_lock_t *lock); - -/** Wakeup a waiting thread. - * - * \ingroup DDEKit_threads - */ -void ddekit_thread_wakeup(ddekit_thread_t *thread); - -/** Terminate a thread - * - * \ingroup DDEKit_threads - */ -void ddekit_thread_exit(void) __attribute__((noreturn)); - -/** Get the name, a thread registered with DDEKit. - * - * \ingroup DDEKit_threads - */ -const char *ddekit_thread_get_name(ddekit_thread_t *thread); - -/** Hint that this thread is done and may be scheduled somehow. - * - * \ingroup DDEKit_threads - */ -void ddekit_thread_schedule(void); - -/** Hint that this thread is done and may be scheduled somehow. - * - * \ingroup DDEKit_threads - */ -void ddekit_yield(void); - -/** Initialize DDEKit thread subsystem. - * - * \ingroup DDEKit_threads - */ -void ddekit_init_threads(void); - -#endif diff --git a/libddekit/include/ddekit/timer.h b/libddekit/include/ddekit/timer.h deleted file mode 100644 index 387f2078..00000000 --- a/libddekit/include/ddekit/timer.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef _ddekit_timer_h -#define _ddekit_timer_h - -#include "ddekit/thread.h" - -#define jiffies (fetch_jiffies()) -#define HZ 100 - -enum -{ - DDEKIT_INVALID_TIMER_ID = -1, -}; - -/** \defgroup DDEKit_timer - * - * Timer subsystem - * - * DDEKit provides a generic timer implementation that enables users - * to execute a function with some arguments after a certain period - * of time. DDEKit therefore starts a timer thread that executes these - * functions and keeps track of the currently running timers. - */ - -/** Add a timer event. After the absolute timeout has expired, function fn - * is called with args as arguments. - * - * \ingroup DDEKit_timer - * - * \return >=0 valid timer ID - * \return < 0 error - */ -int ddekit_add_timer(void (*fn)(void *), void *args, unsigned long timeout); - -/** Delete timer with the corresponding timer id. - * - * \ingroup DDEKit_timer - */ -int ddekit_del_timer(int timer); - -/** Check whether a timer is pending - * - * \ingroup DDEKit_timer - * - * Linux needs this. - */ -int ddekit_timer_pending(int timer); - -/** Initialization function, startup timer thread - * - * \ingroup DDEKit_timer - */ -void ddekit_init_timers(void); - -/** Get the timer thread. - */ -ddekit_thread_t *ddekit_get_timer_thread(void); -extern unsigned long fetch_jiffies (void); - -#endif diff --git a/libddekit/include/ddekit/types.h b/libddekit/include/ddekit/types.h deleted file mode 100644 index 83d92c65..00000000 --- a/libddekit/include/ddekit/types.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * \brief Types for ddekit (x86 version) - * \author Thomas Friebel <tf13@os.inf.tu-dresden.de> - * \author Christian Helmuth <ch12@os.inf.tu-dresden.de> - * \date 2006-11-09 - * - * FIXME This is definitely arch-dependent! Move to ARCH-something - */ - -#ifndef _DDEKIT_TYPES_H -#define _DDEKIT_TYPES_H - -typedef signed char ddekit_int8_t; -typedef unsigned char ddekit_uint8_t; -typedef signed short int ddekit_int16_t; -typedef unsigned short int ddekit_uint16_t; -typedef signed int ddekit_int32_t; -typedef unsigned int ddekit_uint32_t; - -typedef unsigned long ddekit_addr_t; - -#endif |