URL
https://opencores.org/ocsvn/pci/pci/trunk
Subversion Repositories pci
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 102 to Rev 103
- ↔ Reverse comparison
Rev 102 → Rev 103
/trunk/apps/sw/driver/pci_bridge32_test.h
0,0 → 1,82
// definition of maximum test application command length |
#define MAX_COMMAND_LEN 100 |
#define MAX_DESCRIPTION_LEN 1000 |
#define NUM_OF_COMMANDS 15 |
|
char GSA_COMMANDS [NUM_OF_COMMANDS][MAX_COMMAND_LEN] = { |
"help", |
"quit", |
"set_pci_region", |
"write", |
"read", |
"target_write", |
"dump", |
"master_read", |
"master_buf_fill", |
"master_write", |
"master_chk_write", |
"target_chk_write", |
"target_programmed_tests", |
"set_wb_region", |
"master_programmed_tests" |
} ; |
|
char GSA_COMMAND_DESCRIPTIONS [NUM_OF_COMMANDS][MAX_DESCRIPTION_LEN] = { |
"Displays basic command and parameter reference.", |
"Exits the program.", |
"Selects one of 6 bridge pci address regions <region> for subsequent accesses.", |
"Writes 32 bit word <value> to specified offset <offset> and performs read-back.", |
"Reads data from the specified offset <offset>.", |
"Initiates <number of transactions> write transactions with <transaction size> size. It starts from specified offset<offset>. <pattern> selects the pattern to write to on-board buffer.", |
"Reads 32 words from specified offset<offset>.", |
"Configures master to read data from the system memory buffer. Reads start at specified offset <offset>, using <number of transactions> read operations of size <transaction size>.", |
"Fills system buffer with the specified pattern <pattern>.", |
"Writes contents of device's RAM on specified offset to system memory. Writes start at specified offset <offset>, using <number of transactions> write operations of size <transaction size>.", |
"Checks <size> words of data in system memory from offset <offset> against a specified pattern <pattern>.", |
"Checks data in onboard buffer from offset <offset> against a specified pattern. Buffer is read with <number of transactions> transactions of size <transaction size>.", |
"Performs arround 2M read/write transactions through target. Writes write pseudo random data, reads check the data.", |
"Enables WISHBONE image <image[1:5]> for subsequent PCI Master accesses. The command doesn't check for implemented WB images!", |
"Executes the master test program code written in the function in the pci_bridge32_test.c file!" |
} ; |
|
char GSA_PARAMETERS [NUM_OF_COMMANDS][MAX_COMMAND_LEN] = { |
"", |
"", |
"<region[0:5]>", |
"<offset> <value>", |
"<offset>", |
"<starting offset> <number of transactions> <transaction size> <pattern>", |
"<offset>", |
"<offset> <number of transactions> <transaction size>", |
"<pattern>", |
"<offset> <number of transactions> <transaction size>", |
"<offset> <size> <pattern>", |
"<offset> <number of transactions> <transaction size> <pattern>", |
"", |
"<image[1:5]>", |
"" |
} ; |
|
#define GET_CMD(i) (GSA_COMMANDS[i]) |
#define GET_CMD_DES(i) (GSA_COMMAND_DESCRIPTIONS[i]) |
#define GET_CMD_PARMS(i) (GSA_PARAMETERS[i]) |
|
#define SYS_BUFFER_SIZE (4096) |
#define SPARTAN_BOARD_BUFFER_SIZE (1024) |
|
#define TARGET_BUFFER_SIZE (1024) |
|
#define MASTER_TRANS_SIZE_OFFSET (0x1000) |
#define MASTER_TRANS_COUNT_OFFSET (0x1004) |
#define MASTER_OP_CODE_OFFSET (0x1008) |
#define MASTER_ADDR_REG_OFFSET (0x100c) |
#define TARGET_BURST_TRANS_CNT_OFFSET (0x1010) |
#define TARGET_TEST_SIZE_OFFSET (0x1014) |
#define TARGET_TEST_START_ADR_OFFSET (0x1018) |
#define TARGET_TEST_START_DATA_OFFSET (0x101C) |
#define TARGET_TEST_ERR_REP_OFFSET (0x1020) |
#define MASTER_NUM_OF_WB_OFFSET (0x1024) |
#define MASTER_NUM_OF_PCI_OFFSET (0x1028) |
#define MASTER_TEST_SIZE_OFFSET (0x102C) |
#define MASTER_TEST_START_DATA_OFFSET (0x1030) |
#define MASTER_TEST_DATA_ERROR_OFFSET (0x1034) |
/trunk/apps/sw/driver/spartan_kint.h
1,7 → 1,7
#include <linux/ioctl.h> |
|
#define SPARTAN_IOC_NUM 'S' |
#define SPARTAN_IOC_MAX_NUM 10 |
#define SPARTAN_IOC_MAX_NUM 11 |
|
#define SPARTAN_IOC_CURRESGET _IO(SPARTAN_IOC_NUM, 1) // read current resource - (0 = none) |
#define SPARTAN_IOC_CURRESSET _IO(SPARTAN_IOC_NUM, 2) // set current resource |
12,7 → 12,8
#define SPARTAN_IOC_VIDEO_BASE _IOR(SPARTAN_IOC_NUM, 7, base) // read video buffer phyisical base address |
#define SPARTAN_IOC_VIDEO_VBASE _IOR(SPARTAN_IOC_NUM, 8, base) // read video buffer virtual base address |
#define SPARTAN_IOC_VIDEO_SIZE _IOR(SPARTAN_IOC_NUM, 9, base_size) // read video buffer size |
#define SPARTAN_IOC_SET_VIDEO_BUFF _IO(SPARTAN_IOC_NUM, 10) |
#define SPARTAN_IOC_SET_VIDEO_BUFF _IO(SPARTAN_IOC_NUM, 10) // fill video buffer |
#define SPARTAN_IOC_GET_VIDEO_BUFF _IO(SPARTAN_IOC_NUM, 11) // copy video buffer to user space |
|
|
#define SPARTAN_P_IMG_CTRL1_ADDR 0x110 |
/trunk/apps/sw/driver/spartan_drv.c
1,11 → 1,8
|
#define __KERNEL__ |
#define MODULE |
|
#include <linux/module.h> |
#include <linux/errno.h> |
#include <linux/kernel.h> |
#include <linux/pci.h> |
#include <linux/wrapper.h> |
|
#include <asm/uaccess.h> |
#include <spartan_kint.h> //IOCTL definitions |
19,15 → 16,20
#define OC_PCI_VENDOR 0x1895 |
#define OC_PCI_DEVICE 0x0001 |
#endif |
#ifdef __OC_TEST__ |
#define OC_PCI_VENDOR 0x1895 |
#define OC_PCI_DEVICE 0x0001 |
#define __VGA__ |
#endif |
|
// if someone wants specific major number assigned to spartan board - specify it here |
// if 0 is used, kernel assigns it automaticaly |
#ifdef __SDRAM__ |
#define REQUESTED_MAJOR 243 |
#define REQUESTED_MAJOR 0 |
#endif |
|
#ifdef __VGA__ |
#define REQUESTED_MAJOR 244 |
#define REQUESTED_MAJOR 0 |
#endif |
|
// if compiling module for kernel 2.4 - leave this defined |
50,8 → 52,12
#define SPARTAN_IO_MAPPED 1 |
|
#ifdef __VGA__ |
#define VIDEO_SZ (640*480) |
#ifdef __OC_TEST__ |
#define VIDEO_SZ (16384) |
#else |
#define VIDEO_SZ (640*480) |
#endif |
#endif |
|
// structure for holding board information |
// (6 base addresses, mapping, page etc. |
236,6 → 242,12
} |
|
return 0; |
case SPARTAN_IOC_GET_VIDEO_BUFF: |
for(i = 0; i < VIDEO_SZ; i++) { |
put_user(*((char *)(pspartan_dev.video_vbase + i)), ((char *)(arg + i))) ; |
} |
|
return 0 ; |
#endif |
default: |
return -EINVAL ; |
309,7 → 321,9
unsigned long offset = pspartan_dev.offset ; |
int resource_num = pspartan_dev.current_resource ; |
int i; |
int value; |
unsigned int value; |
unsigned int *kern_buf ; |
unsigned int *kern_buf_tmp ; |
|
unsigned long size = pspartan_dev.base_size[resource_num] ; |
int result ; |
329,15 → 343,24
if ((result = verify_area(VERIFY_WRITE, buf, actual_count))) |
return result ; |
|
kern_buf = kmalloc(actual_count, GFP_KERNEL | GFP_DMA) ; |
kern_buf_tmp = kern_buf ; |
if (kern_buf <= 0) |
return 0 ; |
|
memcpy_fromio(kern_buf, current_address, actual_count) ; |
i = actual_count/4; |
while(i--) { |
|
value = readl(current_address); |
put_user(value, ((int *)buf)); |
// value = readl(current_address); |
value = *(kern_buf) ; |
put_user(value, ((unsigned int *)buf)); |
buf += 4; |
current_address += 4; |
++kern_buf ; |
// current_address += 4; |
} |
|
kfree(kern_buf_tmp); |
pspartan_dev.offset = pspartan_dev.offset + actual_count ; |
|
*(offset_out) = pspartan_dev.offset ; |
356,6 → 379,8
int value; |
unsigned long size = pspartan_dev.base_size[resource_num] ; |
int result ; |
int *kern_buf ; |
int *kern_buf_tmp ; |
|
if (pspartan_dev.current_resource < 0) |
return -ENODEV ; |
372,13 → 397,24
if ((result = verify_area(VERIFY_READ, buf, actual_count))) |
return result ; |
|
kern_buf = kmalloc(actual_count, GFP_KERNEL | GFP_DMA) ; |
kern_buf_tmp = kern_buf ; |
if (kern_buf <= 0) |
return 0 ; |
|
i = actual_count/4; |
while(i--) { |
get_user(value, ((int *)buf)); |
writel(value, current_address); |
//writel(value, current_address); |
*kern_buf = value ; |
buf += 4; |
current_address += 4; |
//current_address += 4; |
++kern_buf ; |
} |
|
memcpy_toio(current_address, kern_buf_tmp, actual_count) ; |
kfree(kern_buf_tmp) ; |
|
pspartan_dev.offset = pspartan_dev.offset + actual_count ; |
|
*(offset_out) = pspartan_dev.offset ; |
596,3 → 632,5
return ; |
} |
} |
|
MODULE_LICENSE("GPL") ; |
/trunk/apps/sw/driver/pci_bridge32_test
0,0 → 1,183
+
+ ¨ ¬ ° ´ ¸ ¼ À Ä È Ì
+ Ð Ô Ø Ü à U‰åƒìè9 èÏ èš' ÉÃÿ5 ÿ%¤ ÿ%¨h éàÿÿÿÿ%¬h éÐÿÿÿÿ%°h éÀÿÿÿÿ%´h é°ÿÿÿÿ%¸h é ÿÿÿÿ%¼h( éÿÿÿÿ%Àh0 é€ÿÿÿÿ%Äh8 épÿÿÿÿ%Èh@ é`ÿÿÿÿ%ÌhH éPÿÿÿÿ%ÐhP é@ÿÿÿÿ%ÔhX é0ÿÿÿÿ%Øh` é ÿÿÿÿ%Ühh éÿÿÿÿ%àhp é ÿÿÿ 1í^‰áƒäðPTRh€¬h„QVh°†è7ÿÿÿô‰öU‰åSPè [þ‘ ‹ƒH …ÀtÿЋ]üÉÉöU‰åƒì‹LÐ…ÒuI‹HЋ…Àtt&