2
* Driver for the Conexant CX25821 PCIe bridge
4
* Copyright (C) 2009 Conexant Systems Inc.
5
* Authors <hiep.huynh@conexant.com>, <shu.lin@conexant.com>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27
#include <linux/errno.h>
28
#include <linux/ioctl.h>
31
#define MEDUSA_READ 910
32
#define MEDUSA_WRITE 911
37
int cif_resolution_enable;
43
}downstream_user_struct;
48
printf("\n*********************************\n");
49
printf("Sample Usage: ./medusa d 1 r 0x01\n");
50
printf("Sample Usage: ./medusa d 1 w 0x0 0x2\n");
51
printf(" d device_id Device ID (1 and above) for MultiCard\n");
52
printf(" r Read Medusa register\n");
53
printf(" w Write Medusa register\n");
56
int main(int argc, char** argv)
60
int i = 1, j = 0, k = 0, len = 0;
63
int register_addr = 0;
66
int device_id = 0, video_id = 11;
68
char *device_str[4] = {"/dev/video11", "/dev/video23", "/dev/video35", "/dev/video47"};
74
if(argc < 5 || (tolower(*(argv[1])) != 'd') )
80
sscanf(argv[2], "%d", &device_id );
83
if( device_id <= 0 || device_id > 4 )
89
printf("\n********************************* \n");
91
if((fp = open(device_str[device_id-1], O_RDWR)) == -1)
93
printf("Error: cannot open device file %s !\n", device_str[device_id-1]);
97
printf("Device %s open for IOCTL successfully!\n", device_str[device_id-1]);
100
for( ; i < argc; i++)
103
mode_temp = tolower(temp2[0]);
104
param_temp = argv[i+1];
111
downstream_user_struct arguments;
113
sscanf(param_temp, "%x", ®ister_addr );
115
arguments.reg_address = register_addr;
116
arguments.command = MEDUSA_READ;
118
printf("Read parameters: read register = 0x%x, command = %d \n", arguments.reg_address, arguments.command);
120
if((ioctl(fp, arguments.command, (char *) &arguments)) == -1)
121
printf("Error: ioctl FAILED!\n");
122
printf("Reg 0x%x = 0x%x\n", arguments.reg_address, arguments.reg_data);
128
downstream_user_struct arguments;
130
sscanf(param_temp, "%x", ®ister_addr );
131
sscanf(argv[i+2], "%x", &write_value );
134
arguments.command = MEDUSA_WRITE;
135
arguments.reg_address = register_addr;
136
arguments.reg_data = write_value;
138
printf("Write parameters: write register = 0x%x, write_value = 0x%x, command = %d \n", arguments.reg_address, arguments.reg_data, arguments.command);
140
if((ioctl(fp, arguments.command, (char *) &arguments)) == -1)
141
printf("Error: ioctl FAILED!\n");
146
printf("Please verify the options are correct!\n");
154
printf("********************************* \n\n");