SANEI 1.3.1.74-c434
Macros | Functions
sanei_lm983x.h File Reference

Interface files for the NS LM9831/2/3 USB chip. More...

Go to the source code of this file.

Macros

#define sanei_lm983x_read_byte(fd, reg, value)    sanei_lm983x_read (fd, reg, value, 1, 0)
 Read one data byte from a specific LM983x register. More...
 

Functions

void sanei_lm983x_init (void)
 Initialize sanei_lm983x. More...
 
SANE_Status sanei_lm983x_write_byte (SANE_Int fd, SANE_Byte reg, SANE_Byte value)
 Write one data byte to a specific LM983x register. More...
 
SANE_Status sanei_lm983x_write (SANE_Int fd, SANE_Byte reg, SANE_Byte *buffer, SANE_Word len, SANE_Bool increment)
 Write one or more data bytes to one or more specific LM983x registers. More...
 
SANE_Status sanei_lm983x_read (SANE_Int fd, SANE_Byte reg, SANE_Byte *buffer, SANE_Word len, SANE_Bool increment)
 Read one or more data bytes from one ore more specific LM983x registers. More...
 
SANE_Bool sanei_lm983x_reset (SANE_Int fd)
 Reset the LM983x chip. More...
 

Detailed Description

Interface files for the NS LM9831/2/3 USB chip.

The National Semiconductor LM9831, LM9832, and LM9833 chips are used in many USB scanners. Examples include Plustek and Mustek devices.

See also
sanei_usb.h

Macro Definition Documentation

◆ sanei_lm983x_read_byte

#define sanei_lm983x_read_byte (   fd,
  reg,
  value 
)     sanei_lm983x_read (fd, reg, value, 1, 0)

Read one data byte from a specific LM983x register.

Parameters
fd- device file descriptor (SANE_Int)
reg- number of register (SANE_Byte)
value- byte value to be written (SANE_Byte *)
Returns
The SANE status code for the operation (SANE_Status):
  • SANE_STATUS_GOOD - on success
  • SANE_STATUS_IO_ERROR - system write function failed
  • SANE_STATUS_INVAL - register out of range

Function Documentation

◆ sanei_lm983x_init()

void sanei_lm983x_init ( void  )

Initialize sanei_lm983x.

Currently, this function only enables the debugging functionality.

◆ sanei_lm983x_write_byte()

SANE_Status sanei_lm983x_write_byte ( SANE_Int  fd,
SANE_Byte  reg,
SANE_Byte  value 
)

Write one data byte to a specific LM983x register.

Parameters
fd- device file descriptor
reg- number of register
value- byte value to be written
Returns
  • SANE_STATUS_GOOD - on success
  • SANE_STATUS_IO_ERROR - system write function failed
  • SANE_STATUS_INVAL - register out of range

◆ sanei_lm983x_write()

SANE_Status sanei_lm983x_write ( SANE_Int  fd,
SANE_Byte  reg,
SANE_Byte *  buffer,
SANE_Word  len,
SANE_Bool  increment 
)

Write one or more data bytes to one or more specific LM983x registers.

Parameters
fd- device file descriptor
reg- number of start-register
buffer- buffer to be written
len- number of bytes to be written
increment- SANE_TRUE enables the autoincrement of the register value during the write cycle, SANE_FALSE disables this
Returns
  • SANE_STATUS_GOOD - on success
  • SANE_STATUS_IO_ERROR - system read function failed
  • SANE_STATUS_INVAL - register out of range or len field was 0

◆ sanei_lm983x_read()

SANE_Status sanei_lm983x_read ( SANE_Int  fd,
SANE_Byte  reg,
SANE_Byte *  buffer,
SANE_Word  len,
SANE_Bool  increment 
)

Read one or more data bytes from one ore more specific LM983x registers.

Parameters
fd- device file descriptor
reg- number of start-register
buffer- buffer to receive the data
len- number of bytes to receive
increment- SANE_TRUE enables the autoincrement of the register value during the read cylce, SANE_FALSE disables this
Returns
  • SANE_STATUS_GOOD - on success
  • SANE_STATUS_IO_ERROR - system read function failed
  • SANE_STATUS_INVAL - register out of range
  • SANE_STATUS_EOF - if nothing can't be read

◆ sanei_lm983x_reset()

SANE_Bool sanei_lm983x_reset ( SANE_Int  fd)

Reset the LM983x chip.

Parameters
fd- device file descriptor
Returns
  • SANE_TRUE - reset successfully done
  • SANE_FALSE - reset failed