On Wed, 20 Mar 2002, Tim Waugh wrote:
> On Wed, Mar 20, 2002 at 02:29:26PM +0900, Myunghyun Lee wrote:
>
> > mode = IEEE1284_DEVICEID;
> > ioctl(fd, PPNEGOT, &mode);
> >
> > MFG:Winbond;MDL:W99200F;CLS:MEDIA;DES:WINBOND VIDEO ENCODER;
>
> Really you should use
>
> mode = IEEE1284_MODE_NIBBLE | IEEE1284_DEVICEID;
>
> (Device ID can be read in any reverse-capable mode.)
>
> > But I cannot read register value from W99200F.
> > Following is a read sequence.
> >
> > I negotiated to EPP before.
> >
> > set data direction to OUTPUT
> > set all control lines to HIGH
> > output address
> > set [Write] and [Address Strobe] to LOW
> > wait until [Wait] is HIGH ------------> Wait isn't changed to HIGH
> > set [Write] and [Address Strobe] to HIGH
> >
> > set data direction to OUTPUT
> > set [Write] and [Data Strobe] to Low
> > wait until [Wait] is HIGH ------------> Wait isn't changed to HIGH
> > read data
> > set [Write] and [Data Strobe] to HIGH
>
> How are you trying to do this? By hand, or with read()?
>
> Tim.
> */
>
I will write my code in brief below:
Is it OK?
read_pp() is a read function.
I thik that the problem is Wait never go to HIGH.
Please give me your help.
int pp_set_high(int fd, unsigned char sel)
{
struct ppdev_frob_struct frob;
unsigned char byte;
byte = ~sel;
frob.mask = sel;
frob.val = byte;
if(ioctl(fd, PPFCONTROL, &frob) == -1)
{
perror("PPFCONTROL");
return -1;
}
return sel;
}
int pp_set_low(int fd, unsigned char sel)
{
struct ppdev_frob_struct frob;
frob.mask = sel;
frob.val = sel;
if(ioctl(fd, PPFCONTROL, &frob) == -1)
{
perror("PPFCONTROL");
return -1;
}
return sel;
}
int pp_set_dir(int fd, unsigned char dir)
{
if(ioctl(fd, PPDATADIR, &dir) == -1)
{
perror("PPDATADIR");
return -1;
}
return dir;
}
unsigned char read_pp(int fd, unsigned char addr)
{
pp_set_dir(fd, DIR_OUTPUT);
pp_set_high(fd, PARPORT_CONTROL_STROBE+PARPORT_CONTROL_SELECT+PARPORT_CONTROL_AU
TOFD);
/* Results are same using write() and ioctl() */
write(fd, &addr, 1);
//ioctl(fd, PPWDATA, &addr);
/* signal Write and Address Strobe to LOW */
pp_set_low(fd, PARPORT_CONTROL_STROBE+PARPORT_CONTROL_SELECT);
/************************************************/
/******** Wait until Wait goes to HIGH **********/
/******** But Wait never go to HIGH *************/
/************************************************/
cnt = 0;
do{
if(ioctl(fd, PPRSTATUS, &byte) == -1)
{
perror("PPFCONTROL");
return 0;
}
if(cnt >= 100) printf("count over1.\n");
cnt++;
} while(!(byte & PARPORT_STATUS_BUSY));
pp_set_high(fd, PARPORT_CONTROL_STROBE+PARPORT_CONTROL_SELECT);
pp_set_dir(fd, DIR_INPUT);
pp_set_low(fd, PARPORT_CONTROL_STROBE+PARPORT_CONTROL_AUTOFD);
/************************************************/
/******** Wait until Wait goes to HIGH **********/
/******** But Wait never go to HIGH *************/
/************************************************/
cnt = 0;
do{
if(ioctl(fd, PPRSTATUS, &byte) == -1)
{
perror("PPFCONTROL");
return 0;
}
if(cnt >= 100) printf("count over1.\n");
cnt++;
} while(!(byte & PARPORT_STATUS_BUSY));
read(fd, &data, 1);
//ioctl(fd, PPRDATA, &data);
}
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Myunghyun Lee mailto:mhlee@eztcp.com
Sollae Systems Co., Ltd. http://www.eztcp.com
TEL:+82-32-437-2346, FAX:+82-32-437-2347
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-- To unsubscribe, send mail to: linux-parport-request@torque.net --
-- with the single word "unsubscribe" in the body of the message. --
This archive was generated by hypermail 2b29 : Wed Mar 20 2002 - 21:15:26 EST