Dear all,
I made the attached additions to the Heurikon Nitro60
vxWorks BSP in order to get DVX 2502 A24 DMAs working. Most
of this code isnt Heurikon specific (excepting tests which verify
that the A24 available pool is within 2MB of sysMemTop()).
The API here follows the model developed by John Winans of APS
for the mv167.
All comments appreciated.
Jeff
--
/******************************************************************************
*
* hk nitro 60 specific A24 memory management routines - joh 9-4-96
*
* A user may call sysA24MapRam() to allocate a block of system ram
* available to VME A24 of the specified size which is non-cacheable.
* If space is available, then a memory pool is created for future use
* by device drivers via devLibA24Malloc() and devLibA24Free().
*
* sysA24MapRam() should be called early during the system boot in
* order to guarantee that the allocation will occur in the upper two
* megs of system ram since:
* 1) this is all that can be seen by VME A24 within the hk nitro 60.
* 2) wrs free memory allocation occurs from the top of pool down.
* A warning message is printed if a suitable block of memory cannot
* be allocated.
*
******************************************************************************/
static PART_ID a24DmaPartId = NULL;
/*
* hk nitro sysA24MapRam()
* joh 9-4-96
*
*/
STATUS sysA24MapRam(unsigned long size)
{
void *pBufDMA;
/*
* only one init allowed
*/
if (a24DmaPartId != NULL){
fprintf(stderr,
"sysA24MapRam: attempt to initialize twice was ignored\n");
return(ERROR);
}
/*
* verify that we can get a non-cacheable region
*/
if (!CACHE_DMA_IS_WRITE_COHERENT() ||
!CACHE_DMA_IS_READ_COHERENT()) {
fprintf(stderr,
"sysA24MapRam: Warning - unable to create non-cacheable region\n");
return ERROR;
}
/*
* clip to 2MB boundary
*/
if (size >= 0x200000)
{ /* Maximum size is 2MB clip it */
fprintf(stderr,
"sysA24MapRam: Warning - hk nitro A24 pool clipped to 2MB\n");
size = 0x200000;
}
/*
* Allocate the non-cacheable region
*/
pBufDMA = cacheDmaMalloc( (size_t) size);
if (pBufDMA==NULL) {
fprintf(stderr,
"sysA24MapRam: Warning - unable to allocate non-cacheable region\n");
return ERROR;
}
/*
* Memory must be in the upper 2 Megs inorder to be available
* on VME A24
*/
if (pBufDMA < (void *) (sysMemTop() - 0x200000) ) {
fprintf(stderr,
"sysA24MapRam: Warning - unable to allocate within A24 accessable window\n");
cacheDmaFree(pBufDMA);
return ERROR;
}
#ifdef EPICS_DEBUG
printf("sysA24MapRam: buf =%8.8lX size = %8.8lX\n");
#endif
/*
* Build A24 memory pool
*/
a24DmaPartId = memPartCreate(pBufDMA, size);
if (a24DmaPartId == NULL)
{
cacheDmaFree(pBufDMA);
return ERROR;
}
return(OK);
}
/*
* hk nitro sysA24Malloc()
* joh 9-4-96
*
*/
void *sysA24Malloc(unsigned long size)
{
if (a24DmaPartId == NULL)
return(NULL);
return memPartAlloc(a24DmaPartId, (size_t) size);
}
/*
* hk nitro sysA24Free()
* joh 9-4-96
*
*/
STATUS sysA24Free(void *pBlock)
{
if (a24DmaPartId == NULL)
return(ERROR);
return memPartFree(a24DmaPartId, pBlock);
}
______________________________________________________________________
Jeffrey O. Hill Internet [email protected]
LANL MS H820 Voice 505 665 1831
Los Alamos, NM 87545 USA FAX 505 665 5107
- Navigate by Date:
- Prev:
PC GPIB performance watson
- Next:
R3.13.0.beta2 now available Marty Kraimer
- Index:
1994
1995
<1996>
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
PC GPIB performance watson
- Next:
Re: A24 DMA into the hk nitro 60 Nick Rees
- Index:
1994
1995
<1996>
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|