Dear John,
the solution you gave in the previous post, gives an intermediate
wrong output value. This cause errors if we dont'have an enable bit.
For example for program an RF parrallel attenuator...
http://www.hittite.com/product_info/product_specs/attenuators/hmc472lp4.pdf
I think that the following code can solve the problem in the correct
way, but i dont know how to add this as driver.
I have no idea on how to compile the "gpio_syscalls.c" and make the
function work.
Any help? how can i call this function?
Thanks
Gabriele
asmlinkage void sys_gpiosetbyte(unsigned char port, unsigned int bits,
int value){
switch(port){
case 'G':
case 'g':
if((bits & 0x0000FF00)==0x0000FF00){
port_g_data_shadow &= ~bits;
value = (value << 8);
*R_PORT_G_DATA = port_g_data_shadow |= value;
};
if((bits & 0x00FF0000)==0x00FF0000){
port_g_data_shadow &= ~bits;
value = (value << 16);
*R_PORT_G_DATA = port_g_data_shadow |= value;
};
break;
case 'A':
case 'a':
case 'B':
case 'b':
break;
}
}
--- In [email protected], John Crispin <[EMAIL PROTECTED]> wrote:
>
> gpiosetbits(PORTG, (value << 8) & 0xff00);
> gpioclearbits(PORTG, (~value << 8) & 0xff00);
>
> should do the job then
>
>
>
> Quoting f_lamme <[EMAIL PROTECTED]>:
>
> > But this way I move all the 32 bits.
> > I need to move only these 8
> > PG8-PG15
> >
> > --- In [email protected], John Crispin <john@> wrote:
> >>
> >> hi
> >>
> >> gpiosetbits(PORTG, (value << 8) & 0xffffff00);
> >> gpioclearbits(PORTG, (~value << 8) & 0xffffff00);
> >>
> >>
> >> although the & 0xffffff00 bit is not really needed, it is just for
> > sanity
> >>
> >> john
> >>
> >> > if (value&0x01)
> >> > gpiosetbits(PORTG, PG8);
> >> > else
> >> > gpioclearbits(PORTG, PG8);
> >> > if (value&0x02)
> >> > gpiosetbits(PORTG, PG9);
> >> > else
> >> > gpioclearbits(PORTG, PG9);
> >> > if (value&0x04)
> >> > gpiosetbits(PORTG, PG10);
> >> > else
> >> > gpioclearbits(PORTG, PG10);
> >> > if (value&0x08)
> >> > gpiosetbits(PORTG, PG11);
> >> > else
> >> > gpioclearbits(PORTG, PG11);
> >> > if (value&0x10)
> >> > gpiosetbits(PORTG, PG12);
> >> > else
> >> > gpioclearbits(PORTG, PG12);
> >> > if (value&0x20)
> >> > gpiosetbits(PORTG, PG13);
> >> > else
> >> > gpioclearbits(PORTG, PG13);
> >> > if (value&0x40)
> >> > gpiosetbits(PORTG, PG14);
> >> > else
> >> > gpioclearbits(PORTG, PG14);
> >> > if (value&0x80)
> >> > gpiosetbits(PORTG, PG15);
> >> > else
> >> > gpioclearbits(PORTG, PG15);
> >> > // cs e clk
> >> > gpioclearbits(PORTG, PG1);
> >> > gpiosetbits(PORTG, PG3);
> >> > gpioclearbits(PORTG, PG3);
> >> > if (clk==1)
> >> > {
> >> > gpiosetbits(PORTG, PG3);
> >> > gpioclearbits(PORTG, PG3);
> >> > }
> >> > gpiosetbits(PORTG, PG1);
> >> >
> >> > }
> >> > the problem and the slowness with which the byte is sent
because the
> >> > byte is sent bit per bit.
> >> > Does a way exist to send a whole byte?
> >> > I excuse but I do not speak English very well
> >> >
> >> >
> >>
> >
> >
> >
>