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 SET_VIDEO_STD 800
32
#define SET_PIXEL_FORMAT 1000
33
#define ENABLE_CIF_RESOLUTION 1001
36
#define PIXEL_FRMT_422 4
37
#define PIXEL_FRMT_411 5
38
#define PIXEL_FRMT_Y8 6
39
#define ALL_DECODERS 752
44
int cif_resolution_enable;
48
} downstream_user_struct;
53
printf("\n*********************************\n");
54
printf("Sample Usage: ./set d 1 standard NTSC format 422 7 resolution 320 7\n");
55
printf(" device_id Device ID (1 and above) for MultiCard\n");
56
printf(" standard Video Standard (PAL/NTSC)\n");
57
printf(" format Output Pixel Format (422 or 411) for specific decoder (e.g. 7)\n");
58
printf(" resolution 352/320 for CIF and 720 for D1 resolution for specific decoder (e.g. 7)\n");
61
int main(int argc, char** argv)
65
int i = 1, j = 0, k = 0, len = 0;
69
int decoder_input = 0;
70
int device_id = 0, video_id = 11;
72
char *device_str[4] = {"/dev/video11", "/dev/video23", "/dev/video35", "/dev/video47"};
78
if(argc < 3 || (tolower(*(argv[1])) != 'd') )
84
sscanf(argv[2], "%d", &device_id );
87
if( device_id <= 0 || device_id > 4 )
93
printf("\n********************************* \n");
95
if((fp = open(device_str[device_id-1], O_RDWR)) == -1)
97
printf("Error: cannot open device file %s !\n", device_str[device_id-1]);
101
printf("Device %s open for IOCTL successfully!\n", device_str[device_id-1]);
104
for( ; i < argc; i++)
107
mode_temp = tolower(temp2[0]);
108
param_temp = argv[i+1];
115
downstream_user_struct arguments;
116
char * temp = param_temp;
117
arguments.vid_stdname = (tolower(temp[0]) == 'p') ? "PAL" : "NTSC";
118
arguments.command = SET_VIDEO_STD;
120
printf("User parameters: vid_stdname = %s, command = %d \n", arguments.vid_stdname, arguments.command);
122
if((ioctl(fp, arguments.command, (char *) &arguments)) == -1)
123
printf("Error: ioctl FAILED!\n");
129
sscanf(param_temp, "%d", &pixel_format );
130
sscanf(argv[i+2], "%d", &decoder_input ); i++;
132
if( pixel_format < 411 || pixel_format > 422)
135
if( decoder_input < 0 )
136
decoder_input = ALL_DECODERS;
138
downstream_user_struct arguments;
139
arguments.pixel_format = (pixel_format == 411) ? PIXEL_FRMT_411 : PIXEL_FRMT_422;
140
arguments.decoder_select = decoder_input;
141
arguments.command = SET_PIXEL_FORMAT;
143
printf("User parameters: pixel_format = %d, decoder_input = %d, command = %d \n", arguments.pixel_format, arguments.decoder_select, arguments.command);
145
if((ioctl(fp, arguments.command, (char *) &arguments)) == -1)
146
printf("Error: ioctl FAILED!\n");
152
sscanf(param_temp, "%d", &width_input );
153
sscanf(argv[i+2], "%d", &decoder_input ); i++;
155
if( width_input < 320 || width_input > 352 )
158
if( decoder_input < 0 )
159
decoder_input = ALL_DECODERS;
161
downstream_user_struct arguments;
162
arguments.cif_resolution_enable = (width_input == 320 || width_input == 352) ? 1 : 0;
163
arguments.cif_width = width_input;
164
arguments.decoder_select = decoder_input;
165
arguments.command = ENABLE_CIF_RESOLUTION;
167
printf("User parameters: cif_resolution_enable = %d, decoder_input = %d, command = %d \n", arguments.cif_resolution_enable, arguments.decoder_select, arguments.command);
170
if((ioctl(fp, arguments.command, (char *) &arguments)) == -1)
171
printf("Error: ioctl FAILED!\n");
176
printf("Please verify the options are correct!\n");
184
printf("********************************* \n\n");