Go to the source code of this file.
Defines | |
#define | A32_CHUNK 0x00FFFFFF |
Functions | |
mvme_size_t | FullWsze (int am) |
int | vmic_mmap (MVME_INTERFACE *mvme, mvme_addr_t vme_addr, mvme_size_t size) |
int | vmic_unmap (MVME_INTERFACE *mvme, mvme_addr_t vmE_addr, mvme_size_t size) |
mvme_addr_t | vmic_mapcheck (MVME_INTERFACE *mvme, mvme_addr_t vme_addr, mvme_size_t n_bytes) |
int | mvme_open (MVME_INTERFACE **mvme, int index) |
int | mvme_close (MVME_INTERFACE *mvme) |
int | mvme_sysreset (MVME_INTERFACE *mvme) |
int | mvme_read (MVME_INTERFACE *mvme, void *dst, mvme_addr_t vme_addr, mvme_size_t n_bytes) |
DWORD | mvme_read_value (MVME_INTERFACE *mvme, mvme_addr_t vme_addr) |
int | mvme_write (MVME_INTERFACE *mvme, mvme_addr_t vme_addr, void *src, mvme_size_t n_bytes) |
int | mvme_write_value (MVME_INTERFACE *mvme, mvme_addr_t vme_addr, DWORD value) |
int | mvme_set_am (MVME_INTERFACE *mvme, int am) |
int EXPRT | mvme_get_am (MVME_INTERFACE *mvme, int *am) |
int | mvme_set_dmode (MVME_INTERFACE *mvme, int dmode) |
int | mvme_get_dmode (MVME_INTERFACE *mvme, int *dmode) |
int | mvme_set_blt (MVME_INTERFACE *mvme, int mode) |
int | mvme_get_blt (MVME_INTERFACE *mvme, int *mode) |
int | mvme_interrupt_generate (MVME_INTERFACE *mvme, int level, int vector, void *info) |
int | mvme_interrupt_attach (MVME_INTERFACE *mvme, int level, int vector, void(*isr)(int, void *, void *), void *info) |
int | mvme_interrupt_detach (MVME_INTERFACE *mvme, int level, int vector, void *info) |
int | mvme_interrupt_enable (MVME_INTERFACE *mvme, int level, int vector, void *info) |
int | mvme_interrupt_disable (MVME_INTERFACE *mvme, int level, int vector, void *info) |
Variables | |
vme_bus_handle_t | bus_handle |
vme_interrupt_handle_t | int_handle |
sigevent | event |
sigaction | handler_act |
INT_INFO | int_info |
int | vmicvme_max_dma_nbytes = DEFAULT_DMA_NBYTES |
#define A32_CHUNK 0x00FFFFFF |
mvme_size_t FullWsze | ( | int | am | ) |
Return the largest window size based on the address modifier. For A32, VMIC cannot map a full 32bit address space. We map it in chunks of 16 Mbytes instead
Definition at line 44 of file vmicvme.c.
Referenced by mvme_open(), and vmic_mapcheck().
00044 { 00045 switch (am & 0xF0) { 00046 case 0x00: 00047 return A32_CHUNK; // map A32 space in chunks of 16Mibytes 00048 case 0x30: 00049 return 0xFFFFFF; // map all of the A24 address space: 16Mibytes 00050 case 0x20: 00051 return 0xFFFF; // map all of the A16 address space: 64kibytes 00052 default: 00053 return 0; 00054 } 00055 }
int mvme_write_value | ( | MVME_INTERFACE * | mvme, | |
mvme_addr_t | vme_addr, | |||
DWORD | value | |||
) |
Write single data to VME bus.
*mvme | VME structure | |
vme_addr | destination address (VME location). | |
value | data to write to the VME address. |
Definition at line 436 of file vmicvme.c.
00437 { 00438 mvme_addr_t addr; 00439 00440 addr = vmic_mapcheck(mvme, vme_addr, 4); 00441 00442 /* Perform write */ 00443 if (mvme->dmode == MVME_DMODE_D8) 00444 *((char *)addr) = (char) (value & 0xFF); 00445 else if (mvme->dmode == MVME_DMODE_D16) 00446 *((WORD *)addr) = (WORD) (value & 0xFFFF); 00447 else if (mvme->dmode == MVME_DMODE_D32) 00448 *((DWORD *)addr) = value; 00449 00450 return MVME_SUCCESS; 00451 }
mvme_addr_t vmic_mapcheck | ( | MVME_INTERFACE * | mvme, | |
mvme_addr_t | vme_addr, | |||
mvme_size_t | n_bytes | |||
) |
Retrieve mapped address from mapped table. Check if the given address belongs to an existing map. If not will create a new map based on the address, current address modifier and the given size in bytes.
*mvme | VME structure | |
nbytes | requested transfer size. |
Definition at line 705 of file vmicvme.c.
Referenced by mvme_read(), mvme_read_value(), mvme_write(), and mvme_write_value().
00706 { 00707 int j; 00708 VME_TABLE *table; 00709 mvme_addr_t addr; 00710 table = (VME_TABLE *) mvme->table; 00711 /* Extract window handle from table based on the VME address to read */ 00712 for (j=0; table[j].valid; j++) { 00713 /* Check for the proper am */ 00714 if (mvme->am != table[j].am) 00715 continue; 00716 /* Check the vme address range */ 00717 if ((vme_addr >= table[j].low) && ((vme_addr+n_bytes) < table[j].high)) { 00718 /* valid range */ 00719 break; 00720 } 00721 } 00722 // scan table 00723 /* Check if handle found or need to create new one */ 00724 if (!table[j].valid) { 00725 /* Adjust vme_addr start point (split in quarters) */ 00726 if (vme_addr > A32_CHUNK) 00727 addr = vme_addr & (~A32_CHUNK); 00728 else 00729 addr = 0x00000000; 00730 /* Create a new window */ 00731 if (vmic_mmap(mvme, addr, FullWsze(mvme->am)) != MVME_SUCCESS) { 00732 perror("cannot create vme map window"); 00733 abort(); // cannot return anything! 00734 } 00735 } 00736 /* Get index in table in case new mapping has been requested */ 00737 for (j=0; table[j].valid; j++) { 00738 /* Check for the proper am */ 00739 if (mvme->am != table[j].am) 00740 continue; 00741 /* Check the vme address range */ 00742 if ((vme_addr >= table[j].low) && ((vme_addr+n_bytes) < table[j].high)) { 00743 /* valid range */ 00744 break; 00745 } 00746 } // scan table 00747 if (!table[j].valid) { 00748 perror("Map not found"); 00749 abort(); // cannot return anything! 00750 } 00751 addr = (mvme_addr_t) (table[j].ptr) + (mvme_addr_t) (vme_addr - table[j].low); 00752 return addr; 00753 }
int vmic_mmap | ( | MVME_INTERFACE * | mvme, | |
mvme_addr_t | vme_addr, | |||
mvme_size_t | n_bytes | |||
) |
VME Memory map, uses the driver MVME_INTERFACE for storing the map information.
*mvme | VME structure | |
vme_addr | source address (VME location). | |
n_bytes | data to write |
Definition at line 598 of file vmicvme.c.
Referenced by mvme_open(), and vmic_mapcheck().
00599 { 00600 int j; 00601 void *phys_addr = NULL; 00602 VME_TABLE *table; 00603 00604 table = (VME_TABLE *) mvme->table; 00605 00606 /* Find new slot */ 00607 j=0; 00608 while (table[j].valid) j++; 00609 00610 if (j < MAX_VME_SLOTS) { 00611 /* Create a new window */ 00612 table[j].low = vme_addr; 00613 table[j].am = ((mvme->am == 0) ? MVME_AM_DEFAULT : mvme->am); 00614 table[j].nbytes = n_bytes; 00615 00616 /* Create master window */ 00617 if(0 > vme_master_window_create( (vme_bus_handle_t )mvme->handle 00618 , &(table[j].wh) 00619 , table[j].low 00620 , table[j].am 00621 , table[j].nbytes 00622 , VME_CTL_PWEN 00623 , NULL) ) { 00624 perror("Error creating the window"); 00625 return(MVME_ACCESS_ERROR); 00626 } 00627 00628 /* Create the mapped window */ 00629 if(NULL == (table[j].ptr = (DWORD *)vme_master_window_map((vme_bus_handle_t )mvme->handle, table[j].wh, 0) ) ) { 00630 perror("Error mapping the window"); 00631 vme_master_window_release( (vme_bus_handle_t )mvme->handle 00632 , table[j].wh ); 00633 00634 /* Cleanup slot */ 00635 table[j].wh = 0; 00636 return(MVME_ACCESS_ERROR); 00637 } 00638 00639 if (NULL == (phys_addr = vme_master_window_phys_addr ((vme_bus_handle_t )mvme->handle, table[j].wh))) 00640 { 00641 perror ("vme_master_window_phys_addr"); 00642 } 00643 fprintf(stderr, "vmic_mmap: Mapped VME AM 0x%02x addr 0x%08x size 0x%08x at address %p\n", table[j].am, (int)vme_addr, (int)n_bytes, phys_addr); 00644 table[j].valid = 1; 00645 table[j].high = (table[j].low + table[j].nbytes); 00646 } 00647 else { 00648 /* No more slot available */ 00649 return(MVME_ACCESS_ERROR); 00650 } 00651 00652 return(MVME_SUCCESS); 00653 }
int vmic_unmap | ( | MVME_INTERFACE * | mvme, | |
mvme_addr_t | vme_addr, | |||
mvme_size_t | size | |||
) |
Unmap VME region. VME Memory map, uses the driver MVME_INTERFACE for storing the map information.
*mvme | VME structure | |
nbytes | requested transfer size. |
Definition at line 663 of file vmicvme.c.
00664 { 00665 int j; 00666 VME_TABLE *table; 00667 table = (VME_TABLE *) mvme->table; 00668 /* Search for map window */ 00669 for (j=0; table[j].valid; j++) { 00670 /* Check the vme address range */ 00671 if ((vme_addr == table[j].low) && ((vme_addr+size) == table[j].high)) { 00672 /* window found */ 00673 break; 00674 } 00675 } 00676 if (!table[j].valid) { 00677 /* address not found => nothing to do */ 00678 return(MVME_SUCCESS); 00679 } 00680 /* Remove map */ 00681 if (table[j].ptr) { 00682 if (0 > vme_master_window_unmap ((vme_bus_handle_t )mvme->handle, table[j].wh)) { 00683 perror ("vme_master_window_unmap"); 00684 return(ERROR); 00685 } 00686 if (0 > vme_master_window_release ((vme_bus_handle_t )mvme->handle, table[j].wh)) { 00687 perror ("vme_master_window_release"); 00688 return(ERROR); 00689 } 00690 } 00691 /* Cleanup slot */ 00692 table[j].wh = 0; 00693 return(MVME_SUCCESS); 00694 }
vme_bus_handle_t bus_handle |
struct sigevent event |
Definition at line 24 of file vmicvme.c.
Referenced by ascii_log_open(), bk_close(), bk_create(), bk_iterate(), bk_locate(), cm_msg(), and cm_msg1().
struct sigaction handler_act |
vme_interrupt_handle_t int_handle |
Definition at line 27 of file vmicvme.c.
Referenced by mvme_interrupt_attach(), mvme_interrupt_detach(), and myisr().
int vmicvme_max_dma_nbytes = DEFAULT_DMA_NBYTES |