GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> MEM / V5-8-1 > memboot / rad750


Interface   Data Structures   File List   Data Fields   Globals  

MEM_map.h File Reference

Public interface to the Memory Map functions. More...

#include <MEM/MEM.h>

Defines

#define MEM_MAP_ACCESS_READ_32   (0x00000001)
 32-bit read access.
#define MEM_MAP_ACCESS_WRITE_32   (0x00000002)
 32-bit write access.
#define MEM_MAP_ACCESS_READ_16   (0x00000004)
 16-bit read access.
#define MEM_MAP_ACCESS_WRITE_16   (0x00000008)
 16-bit write access.
#define MEM_MAP_ACCESS_READ_8   (0x00000010)
 8-bit read access.
#define MEM_MAP_ACCESS_WRITE_8   (0x00000020)
 8-bit write access.
#define MEM_MAP_ACCESS_READ_ANY
 Any size read access.
#define MEM_MAP_ACCESS_WRITE_ANY
 Any size write access.
#define MEM_MAP_ACCESS_ANY
 Any size read or write access.
#define MEM_MAP_ACCESS_32
 Any 32-bit read or write access.
#define MEM_MAP_ACCESS_16
 Any 16-bit read or write access.
#define MEM_MAP_ACCESS_8
 Any 8-bit read or write access.

Typedefs

typedef unsigned int MEM_mapAccessType
 Memory access type.
typedef void * MEM_mapAccessCb (void *dest_p, const void *source_p, const size_t nbytes, void *context_p, size_t *bytes_moved_p)
 Memory access callback function type.

Functions

void * MEM_mapRWGeneric (void *dest_p, const void *source_p, const size_t nbytes, void *context_p, size_t *bytes_moved_p)
 Generic memory access callback.
void * MEM_mapRead32Swap (void *dest_p, const void *source_p, const size_t nbytes, void *context_p, size_t *bytes_read_p)
 Byte-swapped 32-bit memory read callback.
void * MEM_mapWrite32Swap (void *dest_p, const void *source_p, const size_t nbytes, void *context_p, size_t *bytes_written_p)
 Byte-swapped 32-bit memory write callback.
void * MEM_mapReadBuffer (void *dest_p, const void *offset, const size_t nbytes, void *buf_p, size_t *bytes_read_p)
 Buffer read access.
void * MEM_mapWriteBuffer (void *offset, const void *src_p, const size_t nbytes, void *buf_p, size_t *bytes_written_p)
 Buffer write access.
unsigned int MEM_mapInit (void)
 Start the Memory Map system.
unsigned int MEM_mapAddEntry (const caddr_t start_addr, const size_t num_bytes, const MEM_mapAccessType access_flags, MEM_mapAccessCb *read_cb, MEM_mapAccessCb *write_cb, void *context_p)
 Add an entry to the memory map table.
unsigned int MEM_mapAddPpciEntries (void)
 Add memory map table entries for the PPCI bridge chip.


Detailed Description

Public interface to the Memory Map functions.

This is the public interface to the functions that handle Memory Maps.

  CVS $Id: MEM_map.h,v 1.6 2011/03/29 01:58:52 apw Exp $
  

Define Documentation

#define MEM_MAP_ACCESS_16

Value:

Any 16-bit read or write access.

Referenced by Mem_ValidateMemoryRange().

#define MEM_MAP_ACCESS_32

Value:

Any 32-bit read or write access.

Referenced by MEM_mapAddPpciEntries().

#define MEM_MAP_ACCESS_8

Value:

Any 8-bit read or write access.

Referenced by Mem_ValidateMemoryRange().

#define MEM_MAP_ACCESS_ANY

Value:

Any size read or write access.

#define MEM_MAP_ACCESS_READ_ANY

Value:

Any size read access.

Referenced by MEM_mapAddEntry().

#define MEM_MAP_ACCESS_WRITE_ANY


Typedef Documentation

Memory access callback function type.

A function pointer data type. This represents a function that can be used to access (read or write) memory described in the memory maps.

The parameters for this type of function are:

dest_p Pointer to destination of the memory read or write. source_p Pointer to source of the memory read or write. nbytes Number of bytes to read or write. context_p Pointer to generic context. bytes_moved_p Pointer to location to return number of bytes moved.

The function returns dest_p if no error occurs during the memory access. If an error does occur, though, then the function returns NULL.

Memory access type.

A bitmap combination of the MEM_MAP_ACCESS* values.


Function Documentation

unsigned int MEM_mapAddEntry ( const caddr_t  start_addr,
const size_t  num_bytes,
const MEM_mapAccessType  access_flags,
MEM_mapAccessCb read_cb,
MEM_mapAccessCb write_cb,
void *  context_p 
)

Add an entry to the memory map table.

Add an entry to the memory map table, which defines all the valid locations within the memory address space. Each table entry defines a contiguous region of the memory address space, including the types of accesses allowed to the region and pointers to callback functions that can be used to read and write the region.

Parameters:
start_addr Start address of region.
num_bytes Size of region, in bytes.
access_flags Bitmap of allowed accesses to the region.
read_cb Pointer to callback function for reading from region.
write_cb Pointer to callback function for writing to region.
context_p Generic pointer passed to callback functions.
Returns:
A MEM MSG code.
Add an entry to the memory map table, which defines all the valid locations within the memory address space. Each table entry defines a contiguous region of the memory address space, including the types of accesses allowed to the region and pointers to callback functions that can be used to read and write the region.

Parameters:
start_addr Start address of region.
num_bytes Size of region, in bytes.
access_flags Bitmap of allowed accesses to the region.
read_cb Pointer to callback function for reading from region.
write_cb Pointer to callback function for writing to region.
context_p Generic pointer passed to callback functions.
Returns:
A MEM MSG code.

References _mem_mapEntry::access_flags, _mem_mapEntry::context_p, DIM, MEM_MAP_ACCESS_READ_ANY, MEM_MAP_ACCESS_WRITE_ANY, MEM_MSG, _mem_mapEntry::num_bytes, _mem_mapEntry::read_cb, _mem_mapEntry::start_addr, _mem_mapEntry::valid, and _mem_mapEntry::write_cb.

Referenced by MEM_mapAddPpciEntries().

unsigned int MEM_mapAddPpciEntries ( void   ) 

Add memory map table entries for the PPCI bridge chip.

Add memory map table entries for the registers within the powerPCI bridge chip on the RAD750 board.

Returns:
A MEM MSG code.
Add memory map table entries for the registers within the powerPCI bridge chip on the RAD750 board.

Returns:
A MEM MSG code.

References DIM, MEM_MAP_ACCESS_32, MEM_mapAddEntry(), MEM_mapRead32Swap(), and MEM_mapWrite32Swap().

unsigned int MEM_mapInit ( void   ) 

Start the Memory Map system.

Start the Memory Map system. This function should be called once to initialize the internal state associated with the Memory Map functions.

Returns:
A MEM MSG code.
Start the Memory Map system. This function should be called once to initialize the internal state associated with the Memory Map functions.

Returns:
A MEM MSG code.

References DIM.

void* MEM_mapRead32Swap ( void *  dest_p,
const void *  source_p,
const size_t  nbytes,
void *  context_p,
size_t *  bytes_read_p 
)

Byte-swapped 32-bit memory read callback.

This is a callback function for reading 32-bit words that require byte swapping. Accesses must be a multiple of 32-bits and aligned on a 32-bit boundary.

Parameters:
dest_p Pointer to destination of the read.
source_p Pointer to source of the read.
nbytes Number of bytes to read.
context_p Pointer to generic context (unused).
bytes_read_p Pointer to location to return number of bytes read.
Returns:
dest_p if no error occurred, NULL if an error occurred.
This is a callback function for reading 32-bit words that require byte swapping. Accesses must be a multiple of 32-bits and aligned on a 32-bit boundary.

Parameters:
dest_p Pointer to destination of the read.
source_p Pointer to source of the read.
nbytes Number of bytes to read.
context_p Pointer to generic context (unused).
bytes_read_p Pointer to location to return number of bytes read.
Returns:
dest_p if no error occurred, NULL if an error occurred.

Referenced by MEM_mapAddPpciEntries().

void* MEM_mapReadBuffer ( void *  dest_p,
const void *  offset,
const size_t  nbytes,
void *  buf_p,
size_t *  bytes_read_p 
)

Buffer read access.

This is a callback function for reading values from a buffer. This would be used, for example, to read a snapshot of the CPU register values or the PCI configuration space values which have been captured in a buffer. A pointer to the beginning of this snapshot buffer must be provided as the buf_p parameter.

Parameters:
dest_p Pointer to destination of the buffer read.
offset Offset from buf_p to begin reading.
nbytes Number of bytes to read.
buf_p Pointer to start of buffer.
bytes_read_p Pointer to location to return number of bytes read.
Returns:
dest_p if no error occurred, NULL if an error occurred.
This is a callback function for reading values from a buffer. This would be used, for example, to read a snapshot of the CPU register values or the PCI configuration space values which have been captured in a buffer. A pointer to the beginning of this snapshot buffer must be provided as the buf_p parameter.

Parameters:
dest_p Pointer to destination of the buffer read.
offset Offset from buf_p to begin reading.
nbytes Number of bytes to read.
buf_p Pointer to start of buffer.
bytes_read_p Pointer to location to return number of bytes read.
Returns:
dest_p if no error occurred, NULL if an error occurred.

void* MEM_mapRWGeneric ( void *  dest_p,
const void *  source_p,
const size_t  nbytes,
void *  context_p,
size_t *  bytes_moved_p 
)

Generic memory access callback.

This is a callback function for reading and writing generic memory. It is suitable for RAM or other memory that has no alignment or access restrictions.

Parameters:
dest_p Pointer to destination of the memory read or write.
source_p Pointer to source of the memory read or write.
nbytes Number of bytes to read or write.
context_p Pointer to generic context (unused).
bytes_moved_p Pointer to location to return number of bytes moved.
Returns:
dest_p if no error occurred, NULL if an error occurred.
This is a callback function for reading and writing generic memory. It is suitable for RAM or other memory that has no alignment or access restrictions.

Parameters:
dest_p Pointer to destination of the memory read or write.
source_p Pointer to source of the memory read or write.
nbytes Number of bytes to read or write.
context_p Pointer to generic context (unused).
bytes_moved_p Pointer to location to return number of bytes moved.
Returns:
dest_p if no error occurred, NULL if an error occurred.

void* MEM_mapWrite32Swap ( void *  dest_p,
const void *  source_p,
const size_t  nbytes,
void *  context_p,
size_t *  bytes_written_p 
)

Byte-swapped 32-bit memory write callback.

This is a callback function for writing 32-bit words that require byte swapping. Accesses must be a multiple of 32-bits and aligned on a 32-bit boundary.

Parameters:
dest_p Pointer to destination of the write.
source_p Pointer to source of the write.
nbytes Number of bytes to write.
context_p Pointer to generic context (unused).
bytes_written_p Pointer to location to return num bytes written.
Returns:
dest_p if no error occurred, NULL if an error occurred.
This is a callback function for writing 32-bit words that require byte swapping. Accesses must be a multiple of 32-bits and aligned on a 32-bit boundary.

Parameters:
dest_p Pointer to destination of the write.
source_p Pointer to source of the write.
nbytes Number of bytes to write.
context_p Pointer to generic context (unused).
bytes_written_p Pointer to location to return num bytes written.
Returns:
dest_p if no error occurred, NULL if an error occurred.

Referenced by MEM_mapAddPpciEntries().

void* MEM_mapWriteBuffer ( void *  offset,
const void *  src_p,
const size_t  nbytes,
void *  buf_p,
size_t *  bytes_written_p 
)

Buffer write access.

This is a callback function for writing values to a buffer. A pointer to the beginning of the buffer must be provided as the buf_p parameter.

Parameters:
offset Offset from buf_p to begin writing.
src_p Pointer to source of the buffer write.
nbytes Number of bytes to write.
buf_p Pointer to start of buffer.
bytes_written_p Pointer to location to return num bytes written.
Returns:
offset if no error occurred, NULL if an error occurred.
This is a callback function for writing values to a buffer. A pointer to the beginning of the buffer must be provided as the buf_p parameter.

Parameters:
offset Offset from buf_p to begin writing.
src_p Pointer to source of the buffer write.
nbytes Number of bytes to write.
buf_p Pointer to start of buffer.
bytes_written_p Pointer to location to return num bytes written.
Returns:
offset if no error occurred, NULL if an error occurred.


Generated on Tue Sep 27 15:44:31 2011 by  doxygen 1.5.8