index eeaccb43df923dd97d43e9fd2febde863224bc1d..a9fe72d4e64b868a4f921b8e93c6532a314089ec 100644 (file)
#include <stdio.h>
-/**
- * -------------------------------------------------------------------------
- *
- * Dynamic memory management functions. The parameters
- * are similar to standard c functions.
- *
- *-------------------------------------------------------------------------
- **/
-
-/**
- * env_allocate_memory
- *
- * Allocates memory with the given size.
- *
- * @param size - size of memory to allocate
- *
- * @return - pointer to allocated memory
- */
-void *env_allocate_memory(unsigned int size);
-
-/**
- * env_free_memory
- *
- * Frees memory pointed by the given parameter.
- *
- * @param ptr - pointer to memory to free
- */
-void env_free_memory(void *ptr);
-
-/**
- *-----------------------------------------------------------------------------
- *
- * Functions to convert physical address to virtual address and vice versa.
- *
- *-----------------------------------------------------------------------------
- */
-
-/**
- * env_map_vatopa
- *
- * Converts logical address to physical address
- *
- * @param address - pointer to logical address
- *
- * @return - physical address
- */
-unsigned long env_map_vatopa(void *address);
-
-/**
- * env_map_patova
- *
- * Converts physical address to logical address
- *
- * @param address - pointer to physical address
- *
- * @return - logical address
- *
- */
-void *env_map_patova(unsigned long address);
-
-/**
- *-----------------------------------------------------------------------------
- *
- * Abstractions for OS lock primitives.
- *
- *-----------------------------------------------------------------------------
- */
-
-/**
- * env_create_sync_lock
- *
- * Creates a synchronization lock primitive. It is used
- * when signal has to be sent from the interrupt context to main
- * thread context.
- *
- * @param lock - pointer to created sync lock object
- * @param state - initial state , lock or unlocked
- *
- * @returns - status of function execution
- */
-#define LOCKED 0
-#define UNLOCKED 1
-
-int env_create_sync_lock(void **lock, int state);
-
-/**
- * env_create_sync_lock
- *
- * Deletes given sync lock object.
- *
- * @param lock - sync lock to delete.
- *
- */
-
-void env_delete_sync_lock(void *lock);
-
-/**
- * env_acquire_sync_lock
- *
- * Tries to acquire the sync lock.
- *
- * @param lock - sync lock to acquire.
- */
-void env_acquire_sync_lock(void *lock);
-
-/**
- * env_release_sync_lock
- *
- * Releases synchronization lock.
- *
- * @param lock - sync lock to release.
- */
-void env_release_sync_lock(void *lock);
-
/**
* env_sleep_msec
*
*/
void env_sleep_msec(int num_msec);
-/**
- * env_disable_interrupts
- *
- * Disables system interrupts
- *
- */
-void env_disable_interrupts();
-
-/**
- * env_restore_interrupts
- *
- * Enables system interrupts
- *
- */
-void env_restore_interrupts();
-
-/**
- * env_register_isr
- *
- * Registers interrupt handler for the given interrupt vector.
- *
- * @param vector - interrupt vector number
- * @param data - private data
- * @param isr - interrupt handler
- */
-
-void env_register_isr(int vector, void *data,
- void (*isr) (int vector, void *data));
-/**
- * env_register_isr_shared
- *
- * Registers interrupt handler for the given shared interrupt vector.
- *
- * @param vector - interrupt vector number
- * @param data - private data
- * @param isr - interrupt handler
- * @oaram name - interrup handler name
- * @param shared - if the interrupt is a shared interrupt
- */
-
-void env_register_isr_shared(int vector, void *data,
- void (*isr) (int vector, void *data),
- char *name,
- int shared);
-
-void env_update_isr(int vector, void *data,
- void (*isr) (int vector, void *data),
- char *name,
- int shared);
-
-/**
- * env_enable_interrupt
- *
- * Enables the given interrupt.
- *
- * @param vector - interrupt vector number
- * @param priority - interrupt priority
- * @param polarity - interrupt polarity
- */
-
-void env_enable_interrupt(unsigned int vector, unsigned int priority,
- unsigned int polarity);
-
-/**
- * env_disable_interrupt
- *
- * Disables the given interrupt.
- *
- * @param vector - interrupt vector number
- */
-
-void env_disable_interrupt(unsigned int vector);
-
-/**
- * env_map_memory
- *
- * Enables memory mapping for given memory region.
- *
- * @param pa - physical address of memory
- * @param va - logical address of memory
- * @param size - memory size
- * param flags - flags for cache/uncached and access type
- *
- * Currently only first byte of flag parameter is used and bits mapping is defined as follow;
- *
- * Cache bits
- * 0x0000_0001 = No cache
- * 0x0000_0010 = Write back
- * 0x0000_0100 = Write through
- * 0x0000_x000 = Not used
- *
- * Memory types
- *
- * 0x0001_xxxx = Memory Mapped
- * 0x0010_xxxx = IO Mapped
- * 0x0100_xxxx = Shared
- * 0x1000_xxxx = TLB
- */
-
-/* Macros for caching scheme used by the shared memory */
-#define UNCACHED (1 << 0)
-#define WB_CACHE (1 << 1)
-#define WT_CACHE (1 << 2)
-
-/* Memory Types */
-#define MEM_MAPPED (1 << 4)
-#define IO_MAPPED (1 << 5)
-#define SHARED_MEM (1 << 6)
-#define TLB_MEM (1 << 7)
-
-void env_map_memory(unsigned int pa, unsigned int va, unsigned int size,
- unsigned int flags);
-
/**
* env_get_timestamp
*
*/
unsigned long long env_get_timestamp(void);
-/**
- * env_disable_cache
- *
- * Disables system caches.
- *
- */
-void env_disable_cache(void);
-
-/**
- * env_flush_invalidate_all_caches
- *
- * Flush and Invalidate all caches.
- *
- */
-void env_flush_invalidate_all_caches(void);
-
-typedef void LOCK;
-
#endif /* _ENV_H_ */