EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: struck sis3316 digitizer ADC data transfer with RTEMS
From: "Geon-Yeong Mun" <[email protected]>
To: <[email protected]>
Date: Fri, 30 Jan 2015 00:05:23 +0900
Hello,

I am trying to develop the epics driver for struck sis3316 with RTEMS.
But, I have difficulty in doing transfer the ADC data using DMA.
The below code is my code. There is no error. But returned data does not
match expected data. 
or, who has sis3316 driver with RTEMS and MVME6100?

void sis3316::dmaIsr(void *pParam)
{
	sis3316 *digi = (sis3316*)pParam;
	digi->incTriggerCount();

	epicsUInt32 nCh = 0;
	digi->m_pMq->send(&nCh,sizeof(epicsUInt32));
	//scanIoRequest(digi->m_ioScanData);
}


int sis3316::readDmaChannelPreviousBankDataBuffer(epicsUInt32
bank2_read_flag, epicsUInt32 channel_no
				, epicsUInt32 max_read_nof_words,
epicsUInt32 * dma_got_no_of_words, epicsUInt32 *uint_adc_buffer)
{
	epicsUInt32 addr;
	epicsUInt32 data;
	epicsUInt32 previous_bank_addr_value;
	epicsUInt32 req_nof_32bit_words;
	epicsUInt32 got_nof_32bit_words;
	epicsUInt32 memory_bank_offset_addr;
	epicsUInt32 max_poll_counter;

	addr = 0x1120 + ((channel_no & 0x3) *4) + (((channel_no >> 2) &
0x3) * 0x1000);
	
	max_poll_counter = 10000;
	*dma_got_no_of_words = 0;
	do{
		previous_bank_addr_value = NAT_READ32(m_regs,addr);
		--max_poll_counter;
		if(max_poll_counter == 0)
		{
			epicsPrintf("Error: max_poll_counter =
0x%08x\n",max_poll_counter);
			return 0x900;
		}
	} while(((previous_bank_addr_value & 0x1000000) >> 24) !=
bank2_read_flag);

	if((previous_bank_addr_value & 0xffffff) == 0){ // no data sampled!
		*dma_got_no_of_words = 0;
		epicsPrintf("ERROR: no data sampled!\n");
		return 0;
	}

	if(bank2_read_flag == 1)
		memory_bank_offset_addr = 0x01000000;
	else
		memory_bank_offset_addr = 0x00000000;

	if((channel_no & 0x1) != 0x1)
		memory_bank_offset_addr = memory_bank_offset_addr +
0x00000000;
	else
		memory_bank_offset_addr = memory_bank_offset_addr +
0x02000000;

	if((channel_no & 0x2) != 0x2)
		memory_bank_offset_addr = memory_bank_offset_addr +
0x00000000;
	else
		memory_bank_offset_addr = memory_bank_offset_addr +
0x10000000;


	// start readout FSM
	addr = 0x80 + (((channel_no >> 2) & 0x3) * 4);
	data = 0x80000000 + memory_bank_offset_addr;
	NAT_WRITE32(m_regs,addr,data);
		
	// readout
	addr = 0x100000 + (((channel_no >> 2) & 0x3) * 0x100000);
	req_nof_32bit_words = previous_bank_addr_value & 0xffffff; //
req_nof_32bit_words = 0x5f4
	assert(req_nof_32bit_words == 0x5f4);
	if(req_nof_32bit_words > max_read_nof_words)
		req_nof_32bit_words = max_read_nof_words;

#ifdef __rtems__

	if(m_head != 0)
		BSP_VMEDmaListDestroy(m_head);

	assert(addr == ( (epicsUInt32)(&m_regs->data[channel_no][0])-
(epicsUInt32)(m_regs)));

	//m_head =
BSP_VMEDmaListDescriptorSetup(0,0xf,VME_AM_EXT_SUP_BLT,(uint32_t)uint_adc_bu
ffer, (uint32_t)(epicsUInt32)(m_regs),1024);
	m_head =
BSP_VMEDmaListDescriptorSetup(0,0xf,VME_AM_EXT_SUP_BLT,(uint32_t)uint_adc_bu
ffer, (uint32_t)&m_regs->data[channel_no][0],((req_nof_32bit_words+1) &
0xfffffe));
	if(!(m_head))
		epicsPrintf("ERROR: DMA list not initialize\n");
	BSP_VMEDmaListStart(0,m_head);

	epicsUInt32 nCh;
	m_pMq->receive(&nCh,sizeof(epicsUInt32));

#endif
	// reset FSM again
	addr = 0x80 + (((channel_no >> 2) & 0x3) * 4); // ch0일때, 0x80
	data = 0x00000000;
	NAT_WRITE32(m_regs,addr,data);
	return 0;
}

Best regards,
Geon-Yeong Mun


----------------------------------------------------------------------------
-----------------
Geon-Yeong Mun
Pohang Accelerator Laboratory
San 31 Hyoja-Dong, Nam-Gu, Pohang, 790-784, Korea
Phone: +82-54-279-1098
Handy: +82-10-4164-2260
Fax: +82-54-279-1799







Replies:
Re: struck sis3316 digitizer ADC data transfer with RTEMS Michael Davidsaver

Navigate by Date:
Prev: Re: Problems with CA Florian Feldbauer
Next: Re: struck sis3316 digitizer ADC data transfer with RTEMS Michael Davidsaver
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: DLS ethercat release 4-1 available ronaldo.mercado
Next: Re: struck sis3316 digitizer ADC data transfer with RTEMS Michael Davidsaver
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 16 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·