Functions

/home/sindre/dev_uclinux/suzaku_shared/hwos_sw/libhwos/hvmemptr.h File Reference

[Hardware OS Virtual Memory Pointer Interface] Functionality for virtual BRAM pointers. More...

#include "hstructures.h"

Go to the source code of this file.

Functions

struct hvmemptrhvmemptr_create (struct hlelement *entry, int size)
 Create a pointer to virtual BRAM memory.
int hvmemptr_set (struct hvmemptr *pointer, struct hlelement *entry, int size)
 Point the virtual pointer to the given BRAM-entry.
struct hlelementhvmemptr_get_bramentry (struct hvmemptr *pointer)
 Get the list element pointing to physical address in BRAM.
int hvmemptr_get_size (struct hvmemptr *pointer)
 Get the size of the data pointed to by pointer.

Detailed Description

[Hardware OS Virtual Memory Pointer Interface] Functionality for virtual BRAM pointers.

Author (2011): Sindre Hansen

Definition in file hvmemptr.h.


Function Documentation

struct hvmemptr* hvmemptr_create ( struct hlelement entry,
int  size 
) [read]

Create a pointer to virtual BRAM memory.

Parameters:
entry List element maintained by the hvmem-module. The element's data field contains address to the physical BRAM-memory.
size The size (in bytes) of the data the pointer points to.
Returns:
Virtual pointer pointing to nothing. NULL on failure.

Definition at line 12 of file hvmemptr.c.

{
        struct hvmemptr* pointer = calloc(1, sizeof(struct hvmemptr));
        pointer->bramentry = entry;
        pointer->size = size;

        return pointer;
}

struct hlelement* hvmemptr_get_bramentry ( struct hvmemptr pointer  )  [read]

Get the list element pointing to physical address in BRAM.

Parameters:
pointer Virtual pointer.
Returns:
List element maintained by the hvmem-module. The element's data field contains address to the physical BRAM-memory. NULL on failure.

Definition at line 22 of file hvmemptr.c.

{
        if (pointer == NULL)
                return NULL;
        
        return pointer->bramentry;
}

int hvmemptr_get_size ( struct hvmemptr pointer  ) 

Get the size of the data pointed to by pointer.

Parameters:
pointer Virtual pointer.
size The size (in bytes) of the data the pointer points to. Negative on failure.

Definition at line 42 of file hvmemptr.c.

{
        if (pointer == NULL)
                return -1;

        return pointer->size;
}

int hvmemptr_set ( struct hvmemptr pointer,
struct hlelement entry,
int  size 
)

Point the virtual pointer to the given BRAM-entry.

Parameters:
pointer Virtual pointer.
entry List element maintained by the hvmem-module. The element's data field contains address to the physical BRAM-memory.
size The size (in bytes) of the data the pointer points to.
Returns:
0 on success. Negative on failure.

Definition at line 31 of file hvmemptr.c.

{
        if (pointer == NULL)
                return -1;
        
        pointer->bramentry = entry;
        pointer->size = size;

        return 0;
}

 All Data Structures Files Functions Variables Enumerations Enumerator Defines