GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> MEM / V5-8-2 > mem_unit_test / linux-gcc
#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. |
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 MEM_MAP_ACCESS_16 |
#define MEM_MAP_ACCESS_32 |
#define MEM_MAP_ACCESS_8 |
#define MEM_MAP_ACCESS_ANY |
#define MEM_MAP_ACCESS_READ_ANY |
Value:
Any size read access.
#define MEM_MAP_ACCESS_WRITE_ANY |
Value:
Any size write access.
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.
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.
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. |
Referenced by mem_dumpMapAddEntry_wrap(), mem_loadMapAddEntry_wrap(), and mem_mapAddEntry_wrap().
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.
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.
Referenced by mem_dumpMapInit_wrap(), mem_loadMapInit_wrap(), and mem_mapInit_wrap().
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.
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. |
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.
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. |
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.
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. |
Referenced by mem_DumpMemory_test(), mem_DumpWrap_test(), mem_LoadMemory_test(), mem_LoadSize_test(), and mem_MapBuild_test().
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.
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. |
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.
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. |