![]() |
This is Unofficial EPICS BASE Doxygen Site
|
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "dbDefs.h"
#include "epicsMutex.h"
#include "errlog.h"
#include "ellLib.h"
#include "devLibVME.h"
#include "devLibVMEImpl.h"
Go to the source code of this file.
Classes | |
struct | rangeItem |
Macros | |
#define | NO_DEVLIB_COMPAT |
#define | SUCCESS 0 |
Functions | |
long | devBusToLocalAddr (epicsAddressType addrType, size_t busAddr, volatile void **ppLocalAddress) |
Translate a bus address to a pointer the CPU can use. More... | |
long | devRegisterAddress (const char *pOwnerName, epicsAddressType addrType, size_t base, size_t size, volatile void **ppPhysicalAddress) |
Register a bus address range with a name. More... | |
long | devReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue) |
Probe the bus for reading from a specific address. More... | |
long | devWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValue) |
Probe the bus for writing to a specific address. More... | |
long | devUnregisterAddress (epicsAddressType addrType, size_t baseAddress, const char *pOwnerName) |
Release a bus address range previously registered. More... | |
long | devAllocAddress (const char *pOwnerName, epicsAddressType addrType, size_t size, unsigned alignment, volatile void **pLocalAddress) |
Allocate and register an unoccupied address block. More... | |
long | devAddressMap (void) |
Print a map of registered bus addresses. More... | |
long | devNoResponseProbe (epicsAddressType addrType, size_t base, size_t size) |
Read-probe a range of bus addresses, looking for empty space. More... | |
long | devConnectInterruptVME (unsigned vectorNumber, void(*pFunction)(void *), void *parameter) |
Connect an ISR up to a VME interrupt vector. More... | |
long | devDisconnectInterruptVME (unsigned vectorNumber, void(*pFunction)(void *)) |
Disconnect an ISR from its VME interrupt vector. More... | |
int | devInterruptInUseVME (unsigned level) |
Determine if a VME interrupt vector is in use. More... | |
long | devEnableInterruptLevelVME (unsigned level) |
Enable a VME interrupt level onto the CPU. More... | |
long | devDisableInterruptLevelVME (unsigned level) |
Disable a VME interrupt level. More... | |
long | devConnectInterrupt (epicsInterruptType intType, unsigned vectorNumber, void(*pFunction)(void *), void *parameter) |
long | devDisconnectInterrupt (epicsInterruptType intType, unsigned vectorNumber, void(*pFunction)(void *)) |
long | devEnableInterruptLevel (epicsInterruptType intType, unsigned level) |
long | devDisableInterruptLevel (epicsInterruptType intType, unsigned level) |
long | locationProbe (epicsAddressType addrType, char *pLocation) |
void * | devLibA24Calloc (size_t size) |
calloc() for VME drivers that support DMA. More... | |
void * | devLibA24Malloc (size_t size) |
malloc() for VME drivers that support DMA. More... | |
void | devLibA24Free (void *pBlock) |
free() for VME drivers that support DMA. More... | |
Variables | |
const char * | epicsAddressTypeName [] |
A string representation of each of the bus address types. More... | |
int | devLibA24Debug = 0 |
#define NO_DEVLIB_COMPAT |
Definition at line 31 of file devLibVME.c.
#define SUCCESS 0 |
Definition at line 137 of file devLibVME.c.
long devAddressMap | ( | void | ) |
Print a map of registered bus addresses.
Display a table of registsred bus address ranges, including the owner of each registered address.
Definition at line 737 of file devLibVME.c.
long devAllocAddress | ( | const char * | pOwnerName, |
epicsAddressType | addrType, | ||
size_t | size, | ||
unsigned | alignment, | ||
volatile void ** | pLocalAddress | ||
) |
Allocate and register an unoccupied address block.
Asks devLib to allocate an address block of a particular address type. This is useful for devices that appear in more than one address space and can program the base address of one window using registers found in another window. As with devRegisterAddress() this call also converts the new base address into a pointer in the CPU address space for the driver to use (see devBusToLocalAddr()).
pOwnerName | Name of a driver that will own this range. |
addrType | The bus address type. |
size | Number of bytes to be allocated. |
alignment | How many low bits in the address must all be zero. |
pLocalAddress | Where to put the CPU pointer. |
Definition at line 604 of file devLibVME.c.
long devBusToLocalAddr | ( | epicsAddressType | addrType, |
size_t | busAddr, | ||
volatile void ** | ppLocalAddr | ||
) |
Translate a bus address to a pointer the CPU can use.
Given a bus address, returns a pointer to that location in the CPU's memory map, or an error if direct access isn't currently possible.
addrType | The bus address type. |
busAddr | Bus address to be translated. |
*ppLocalAddr | Where to put the CPU pointer. |
Definition at line 142 of file devLibVME.c.
long devConnectInterrupt | ( | epicsInterruptType | intType, |
unsigned | vectorNumber, | ||
void(*)(void *) | pFunction, | ||
void * | parameter | ||
) |
Definition at line 992 of file devLibVME.c.
long devConnectInterruptVME | ( | unsigned | vectorNumber, |
void(*)(void *) | pFunction, | ||
void * | parameter | ||
) |
Connect an ISR up to a VME interrupt vector.
Interrupt Service Routines (ISRs) are normally written in C, and get passed a context parameter given with them to this connection routine.
There are many restrictions on the routines that an ISR may call; see epicsEvent.h, epicsInterrupt.h, epicsMessageQueue.h, epicsRingBytes.h, epicsRingPointer.h and epicsTime.h for some APIs known to be suitable. It is safest just to trigger a high-priority task to handle any complex work that must happen as a result of the interrupt.
vectorNumber | VME interrupt vector number. |
pFunction | The ISR to be called. |
parameter | Context parameter for the ISR. |
Definition at line 911 of file devLibVME.c.
long devDisableInterruptLevel | ( | epicsInterruptType | intType, |
unsigned | level | ||
) |
Definition at line 1080 of file devLibVME.c.
long devDisableInterruptLevelVME | ( | unsigned | level | ) |
Disable a VME interrupt level.
This routine is the reverse of devEnableInterruptLevelVME().
level | VMEbus interrupt level to disable, 1-7. |
Definition at line 973 of file devLibVME.c.
long devDisconnectInterrupt | ( | epicsInterruptType | intType, |
unsigned | vectorNumber, | ||
void(*)(void *) | pFunction | ||
) |
Definition at line 1023 of file devLibVME.c.
long devDisconnectInterruptVME | ( | unsigned | vectorNumber, |
void(*)(void *) | pFunction | ||
) |
Disconnect an ISR from its VME interrupt vector.
Device drivers may disconnect an ISR they connected earlier using this routine. In addition to taking the vectorNumber
the ISR itself is required and used as a check to prevent a driver from inadvertently removing an interrupt handler that it didn't install.
On a PowerPC target running VxWorks, this routine will always return with an error status.
vectorNumber | VME interrupt vector number. |
pFunction | The ISR to be disconnected. |
Definition at line 929 of file devLibVME.c.
long devEnableInterruptLevel | ( | epicsInterruptType | intType, |
unsigned | level | ||
) |
Definition at line 1053 of file devLibVME.c.
long devEnableInterruptLevelVME | ( | unsigned | level | ) |
Enable a VME interrupt level onto the CPU.
The VMEbus allows multiple CPU boards to be installed in the same backplane. When this is done, the differente VME interrupt levels must be assigned to the CPUs since they cannot be shared. This routine tells the VME interface that it should connect interrupts from the indicated interrupt level to a CPU interrupt line.
level | VMEbus interrupt level to enable, 1-7. |
Definition at line 959 of file devLibVME.c.
int devInterruptInUseVME | ( | unsigned | vectorNumber | ) |
Determine if a VME interrupt vector is in use.
On a PowerPC target running VxWorks this routine will always return false, indicating that a vector is unused.
vectorNumber | Interrupt vector number. |
Definition at line 945 of file devLibVME.c.
void* devLibA24Calloc | ( | size_t | size | ) |
calloc() for VME drivers that support DMA.
Allocate and zero-fill a block of memory of a given size from a region that can be accessed from the VMEbus in the A24 address space.
size | How many bytes to allocate and zero. |
Definition at line 1125 of file devLibVME.c.
void devLibA24Free | ( | void * | pBlock | ) |
free() for VME drivers that support DMA.
Free a block of memory that was allocated using either devLibA24Malloc() or devLibA24Calloc().
pBlock | Block to be released. |
Definition at line 1149 of file devLibVME.c.
void* devLibA24Malloc | ( | size_t | size | ) |
malloc() for VME drivers that support DMA.
Allocate memory of a given size from a region that can be accessed from the VMEbus in the A24 address space.
size | How many bytes to allocate |
Definition at line 1138 of file devLibVME.c.
long devNoResponseProbe | ( | epicsAddressType | addrType, |
size_t | base, | ||
size_t | size | ||
) |
Read-probe a range of bus addresses, looking for empty space.
Verifies that no device responds at any naturally aligned addresses within the given range. Tries to read every aligned address at every word size between char and long over the entire range, returning success only if none of the reads succeed.
addrType | The bus address type. |
base | First address base to probe. |
size | Range of bus addresses to test, in bytes. |
Definition at line 847 of file devLibVME.c.
long devReadProbe | ( | unsigned | wordSize, |
volatile const void * | ptr, | ||
void * | pValueRead | ||
) |
Probe the bus for reading from a specific address.
Performs a bus-error-safe wordSize
atomic read from a specific address and returns an error if this caused a bus error.
wordSize | The word size to read: 1, 2, 4 or 8 bytes. |
ptr | Pointer to the location in the CPU's memory map to read. |
pValueRead | Where to put the value read. |
Definition at line 268 of file devLibVME.c.
long devRegisterAddress | ( | const char * | pOwnerName, |
epicsAddressType | addrType, | ||
size_t | logicalBaseAddress, | ||
size_t | size, | ||
volatile void ** | pPhysicalAddress | ||
) |
Register a bus address range with a name.
The devLib code keeps a list of all bus address ranges registered with this routine and returns an error if a later call attempts to register any addresses that overlap with a range already registered. The call to registering a range also converts the given base address into a pointer in the CPU address space for the driver to use (see devBusToLocalAddr()).
pOwnerName | Name of a driver that will own this range. |
addrType | The bus address type. |
logicalBaseAddress | The bus start address. |
size | Number of bytes to reserve. |
pPhysicalAddress | Where to put the converted CPU pointer. |
Definition at line 193 of file devLibVME.c.
long devUnregisterAddress | ( | epicsAddressType | addrType, |
size_t | logicalBaseAddress, | ||
const char * | pOwnerName | ||
) |
Release a bus address range previously registered.
Release an address range that was previously registered by a call to devRegisterAddress() or devAllocAddress().
addrType | The bus address type. |
logicalBaseAddress | The bus start address. |
pOwnerName | The name of the driver that owns this range. |
Definition at line 467 of file devLibVME.c.
long devWriteProbe | ( | unsigned | wordSize, |
volatile void * | ptr, | ||
const void * | pValueWritten | ||
) |
Probe the bus for writing to a specific address.
Performs a bus-error-safe wordSize
atomic write to a specific address and returns an error if this caused a bus error.
wordSize | The word size to write: 1, 2, 4 or 8 bytes. |
ptr | Pointer to the location in the CPU's memory map to write to. |
pValueWritten | The value to write. |
Definition at line 288 of file devLibVME.c.
long locationProbe | ( | epicsAddressType | addrType, |
char * | pLocation | ||
) |
Definition at line 1107 of file devLibVME.c.
int devLibA24Debug = 0 |
Definition at line 1123 of file devLibVME.c.
const char* epicsAddressTypeName[] |
A string representation of each of the bus address types.
Definition at line 66 of file devLibVME.c.