knet_rs232.c File Reference

This module is the low-level communication layer between the KoreBot Library and the Linux Operating System. More...

Include dependency graph for knet_rs232.c:

Go to the source code of this file.

Functions

static struct knet_dev_sknet_rs232_open (struct knet_bus_s *bus, knet_ext_t ext, knet_mod_t mod, const char *dev_name, int argc, char *argv[])
static void knet_rs232_close (knet_bus_t *bus, knet_dev_t *dev)
static int knet_rs232_read (knet_bus_t *bus, knet_dev_t *dev, char *buf, unsigned int len)
static int knet_rs232_write (knet_bus_t *bus, knet_dev_t *dev, const char *buf, unsigned int len)
int knet_rs232_init (knet_bus_t *bus, int argc, char *argv[])


Detailed Description

This module is the low-level communication layer between the KoreBot Library and the Linux Operating System.

RS-232 Communication Adaptor for K-Net

Author:
CÚdric Gaudin (K-Team SA)
Note:
Copyright (C) 2004 K-TEAM SA
Bug:
none discovered.
Todo:
nothing.

Definition in file knet_rs232.c.


Function Documentation

static void knet_rs232_close ( knet_bus_t bus,
knet_dev_t dev 
) [static]

This function closes an RS-232 device.

Parameters:
bus K-Net RS-232 bus descriptor
dev K-Net RS-232 device descriptor
Remarks:
This function is NOT exported outside this module.

Definition at line 157 of file knet_rs232.c.

References knet_rs232_s::fd, knet_dev_s::info, and kb_free.

Referenced by knet_rs232_init().

int knet_rs232_init ( knet_bus_t bus,
int  argc,
char *  argv[] 
)

This function initializes the RS-232 layer.

Parameters:
bus K-Net Bus Descriptor
argc number of elements in argv
argv string used as initialization parameters
Returns:
An error code:
  • <0 on error - error code
  • >=0 on success - number of devices found on the bus

Definition at line 63 of file knet_rs232.c.

References knet_bus_s::close, knet_bus_s::exit, knet_rs232_close(), knet_rs232_open(), knet_rs232_read(), knet_rs232_write(), knet_bus_s::open, knet_bus_s::read, knet_bus_s::transfer, and knet_bus_s::write.

Referenced by knet_init().

Here is the call graph for this function:

static struct knet_dev_s * knet_rs232_open ( struct knet_bus_s bus,
knet_ext_t  ext,
knet_mod_t  mod,
const char *  name,
int  argc,
char *  argv[] 
) [static, read]

This function opens a given device on the RS-232 Bus

Parameters:
bus K-Net RS-232 bus descriptor
ext K-Net Extension Id (not used)
mod K-Net Module Id (not used)
name K-Net device name
Returns:
A Pointer to a KNet Device Descriptor or NULL in case of error.
Remarks:
This function is NOT exported outside this module.

Definition at line 88 of file knet_rs232.c.

References knet_rs232_s::fd, fd, knet_dev_s::info, KB_ALLOC, kb_error(), KB_ERROR_FILEOPEN, KB_ERROR_NODEVFOUNDSTR, knet_bus_find_device_by_name(), knet_device_create(), and knet_rs232_s::tios.

Referenced by knet_rs232_init().

Here is the call graph for this function:

static int knet_rs232_read ( knet_bus_t bus,
knet_dev_t dev,
char *  buf,
unsigned int  len 
) [static]

This function reads data from an RS-232 device.

Parameters:
bus K-Net RS-232 bus descriptor
dev K-Net RS-232 device descriptor
buf Pointer to the buffer that will receive the data
len Size of the buffer
Returns:
A value:
  • <0 on error
  • >=0 on success, number of bytes read
Remarks:
This function is NOT exported outside this module.

Definition at line 187 of file knet_rs232.c.

References knet_rs232_s::fd, and knet_dev_s::info.

Referenced by knet_rs232_init().

static int knet_rs232_write ( knet_bus_t bus,
knet_dev_t dev,
const char *  buf,
unsigned int  len 
) [static]

This function writes data to an RS-232 device.

Parameters:
bus K-Net RS-232 bus descriptor
dev K-Net RS-232 device descriptor
buf Pointer to the buffer that contains the data to be written
len Number of the bytes in the buffer
Returns:
A value:
  • <0 on error
  • >=0 on success, number of byte written
Remarks:
This function is NOT exported outside this module.

Definition at line 216 of file knet_rs232.c.

References knet_rs232_s::fd, and knet_dev_s::info.

Referenced by knet_rs232_init().


Generated on Wed Dec 15 11:49:29 2010 for KoreBot Library by  doxygen 1.5.5