EnglishJapanese Reload Front page List of pages Search Recent changes RSS of recent changes

Back to FronEnd page

Readout routine for VMIVME

Readout driver

The main program is babildrv.c . babildrv for VMIVME is not well finalized (still under development).

SVA041

The functions in SVA041 is the same as VMIVME.

Map and unmap

VMIVME has the method of mapped VME access. To use this mapped access, the creation of a map window and a DMA window are required. In startup.c and stop.c, there are map() and unmap() functions.

univ_init_window(BASEADDR, SIZE, AM, MAPID)

Create mapping window. MAPID is the identifier number of this map. The maximum MAPID number is 8. So, &color(red,white){only 8 windows are available} at the same time. To use a large number of modules, module's addresses should be closed. For example, to crate 1 window for 4 modules, base addresses are 0x10010000, 0x10020000, 0x10030000, 0x10040000. In this case, SIZE should be 0x40000, then you can access these 4 modules.

univ_end_window(NUM)

Close a MAP window. Please note that, if occupy 8 mapping windows in babildrv, cmdvme cannot access to modules having non-mapped address in babildrv. In other words, even if 8 mapping windows are occupied by babildrv, cmdvme can access to modules having address mapped by babildrv.

univ_init_dma(ADDR, SIZE, DMAID)

Create a DMA window. DMAID is the identifier number of DMA map. The maximum DMAID number is 20. This DMAID can be set a different number with MAPID, however it is recommended to set the same number with MAPID.

univ_end_dma(DMAID)

Close a DMA window.

startup.c

void map(void){
  univ_init_window(DALIADCMAPBASE, DALIADCMAPSIZE, A32, DALIADCMAPN);

  univ_init_window(DALIT1_ADDR, REGSIZE, A32, DALIT1_MAPN);
  univ_init_window(DALIT2_ADDR, REGSIZE, A32, DALIT2_MAPN);
  univ_init_window(PPACT_ADDR, REGSIZE, A32, PPACT_MAPN);

  univ_init_dma(DALIT1_ADDR, DMASIZE, DALIT1_MAPN);
  univ_init_dma(DALIT2_ADDR, DMASIZE, DALIT2_MAPN);
  univ_init_dma(PPACT_ADDR, DMASIZE, PPACT_MAPN);

  univ_init_window(LUPO1_ADDR, REGSIZE, A32, LUPO1_MAPN);
  univ_init_window(LUPO2_ADDR, REGSIZE, A32, LUPO2_MAPN);

  univ_init_window(SCRADDR, REGSIZE, A32, SCR_MAPN);
}

void startup(void){
  short val;
  /* Startup Function */

  vme_define_intlevel(INTLEVEL);

  scrinit();

  // Interrupt delay 20ns step
  val = 1000; // 20us;
  vlupots_intdelay_map(LUPO2_MAPN, val);
  vlupots_enable_interrupt_map(LUPO2_MAPN);

  vlupots_clear_map(LUPO2_MAPN);

  vlupots_pulse_map(LUPO2_MAPN, 1);

  rpv130_level(RPV130,0x00);
}

stop.c

void unmap(void){
  univ_end_dma(DALIT1_MAPN);
  univ_end_dma(DALIT2_MAPN);
  univ_end_dma(PPACT_MAPN);

  univ_end_window(DALIADCMAPN);

  univ_end_window(DALIT1_MAPN);
  univ_end_window(DALIT2_MAPN);
  univ_end_window(PPACT_MAPN);

  univ_end_window(LUPO1_MAPN);
  univ_end_window(LUPO2_MAPN);

  univ_end_window(SCR_MAPN);
}
 
void stop(void){
  vlupots_disable_interrupt_map(LUPO2_MAPN);
  vlupots_clear_map(LUPO2_MAPN);

  rpv130_output(RPV130,OPRPVBUFFCL);

  rpv130_level(RPV130,0x80);

}

Readout with mapped window

evt.c

void evt(void){
  /* Event */

  init_event();

  init_segment(SEGIDGEN(DALI, F8, B2SCALER, C24));
  vlupotrg_clk_map(LUPO1_MAPN);
  end_segment();

  //DALI
  init_segment(SEGIDGEN(DALI, F8, DALIA, V785));
  v785_multi_map_segdata(DALIADCOFF1, DALIADCMAPN);
  v785_multi_map_segdata(DALIADCOFF2, DALIADCMAPN);
  v785_multi_map_segdata(DALIADCOFF3, DALIADCMAPN);
  v785_multi_map_segdata(DALIADCOFF4, DALIADCMAPN);
  v785_multi_map_segdata(DALIADCOFF5, DALIADCMAPN);
  v785_multi_map_segdata(DALIADCOFF6, DALIADCMAPN);
  end_segment();

  init_segment(SEGIDGEN(DALI, F8, DALIT, V1190C));
  v1190_map_dma_segdata(DALIT1_MAPN);
  v1190_map_dma_segdata(DALIT2_MAPN);
  end_segment();

  init_segment(SEGIDGEN(DALI, F8, PPACT, V1190C));
  v1190_map_dma_segdata(PPACT_MAPN);
  end_segment();

  v1190_map_clear(DALIT1_MAPN);
  v1190_map_clear(DALIT2_MAPN);
  v1190_map_clear(PPACT_MAPN);
  vlupots_clear_map(LUPO2_MAPN);
} 

v785_multi_map_segdata is readout function for multiple V785 modules in 1 window. In map() function, univ_init_window(DALIADCMAPBASE, DALIADCMAPSIZE, A32, DALIADCMAPN) create a large window for 6 V785 modules. Their addresses are 0x40010000, 0x40020000, 0x40030000, 0x40040000, 0x40050000 and 0x40060000. Address information is given in bbmodules.h as follow:

// DALI
#define DALIADCMAPBASE 0x40000000
#define DALIADCMAPSIZE 0x00080000
#define DALIADCMAPN    1
#define DALIADCOFF1    0x00010000
#define DALIADCOFF2    0x00020000
#define DALIADCOFF3    0x00030000
#define DALIADCOFF4    0x00040000
#define DALIADCOFF5    0x00050000
#define DALIADCOFF6    0x00060000
Last-modified: Thu, 14 May 2015 23:03:19 HADT (2322d)