[sane-devel] Re: GL841 genesys.h

Philipp Schmid Philipp8288@web.de
Sat, 07 May 2005 08:37:06 +0200


Hi Stef,

>On Fri, May 06, 2005 at 01:06:59PM +0200, Philipp Schmid wrote:
>  
>
>>Hi Stef,
>>
>>as the regs of the gl841 are different I propose to define two macros in 
>>genesys.h to the bits if it is necessary. One for the gl841 and one for 
>>the gl646 context of this bits. e.g.
>>
>>#define REG01_COMPENB    0x08    //gl646
>>#define REG01_M16DRAM    0x08    //gl841
>>
>>Bye,
>>   Philipp
>>
>>
>>    
>>
>
>	Hello,
>
>	what I recommend is to move *ALL* registers defines out of genesys_low.h to
>their corresponding low level files since they are different. Only use them in 
>genesys_gl841.c or genesys_gl646.c . 
>
You recommend to #define this bits at the top of genesys_gl841/646.c and 
to #undef them at the bottom?

>If a functions in genesys.c need some
>of them, we should use a helper function that calls one specialized function.
>
>	For instance I'll turn code like:
>
>	if (genesys_read_reg_from_set (reg, 0x04) & REG04_FILTER)
>  
>
...

>	right define would be used in gl646_filter_bit/gl841_filter_bit .
>	
>	into:
>
>	if (genesys_filter_bit (dev, reg, 0x04))
>
>	with:
>	SANE_Byte genesys_filter_bit(Genesys_Device *dev,
>				     Genesys_Register_Set *reg,
>				     SANE_Byte addr)
>	{
>		switch(dev->model->asic_type)
>		{
>			case GENESYS_GL646:
>				return gl646_filter_bit(dev,reg);
>			case GENESYS_GL841:
>				return gl841_filter_bit(dev,reg);
>		}
>	}
>
>	glXXX_filter_bit will do the register search and test bit in a specific way.
>
>
>	There are quite a few functions like that to add. 
>
>Regards,
>	Stef
>  
>
So this functions are individual for each register access of functions 
in genesys.c.

I think this is a good solution. I've just started to adapt gl841_print 
registers and /* writeable registers */. But I have to read the 
documentation of CVS until I put them into it.

Bye,
Philipp