373a8c32b2
git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@55 9fe90eed-be63-e94b-8204-d34ff4c2ff93
107 lines
3.2 KiB
C
107 lines
3.2 KiB
C
/* ---------------------------------------------------------------------------
|
|
* bus.h - v0.1 (c) 2007 Micro-key bv
|
|
* ---------------------------------------------------------------------------
|
|
* Micro-key bv
|
|
* Industrieweg 28, 9804 TG Noordhorn
|
|
* Postbus 92, 9800 AB Zuidhorn
|
|
* The Netherlands
|
|
* Tel: +31 594 503020
|
|
* Fax: +31 594 505825
|
|
* Email: support@microkey.nl
|
|
* Web: www.microkey.nl
|
|
* ---------------------------------------------------------------------------
|
|
* Description: RS485 interface.
|
|
* ---------------------------------------------------------------------------
|
|
* Version(s): 0.1, 10-09-2007, Marcel Mulder.
|
|
* Creation.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
#ifndef __BUS_H__
|
|
#define __BUS_H__
|
|
|
|
/** \file bus.h
|
|
\brief RS485 (UART) interface.
|
|
*/
|
|
/* ---------------------------------------------------------------------------
|
|
* System include files.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
#include "lpc23xx.h"
|
|
#include "types.h"
|
|
#include "uart.h"
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Application include files.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Constant and macro definitions.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Type definitions.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
typedef enum
|
|
{
|
|
BUS1, /**< First RS485 port*/
|
|
BUS2 /**< Second RS485 port*/
|
|
} t_bus_devices;
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Variable declarations.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Function declarations.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
/** \brief Initialize of serial bus interface.*/
|
|
void busInit (
|
|
t_bus_devices device
|
|
);
|
|
|
|
/** \brief Write data of a certain length to a serial bus.*/
|
|
void busWrite (
|
|
t_bus_devices device,
|
|
UINT16 length, /**< Lengh of data in bytes */
|
|
UINT8 * data /**< Pointer to data */
|
|
);
|
|
|
|
/** \brief Reads data from serial bus.
|
|
\retval Lengt of received data in bytes*/
|
|
UINT16 busRead (
|
|
t_bus_devices device,
|
|
UINT8 * data /**< Pointer to data */
|
|
);
|
|
|
|
/** \brief Get byte from serial bus.
|
|
\retval bool Returns true if there was data */
|
|
BOOLEAN busGet(
|
|
t_bus_devices device,
|
|
UINT8 * byte /**< Pointer to byte to return data*/
|
|
);
|
|
|
|
/** \brief Send byte to serial bus. */
|
|
void busPut(
|
|
t_bus_devices device,
|
|
UINT8 value /**< Byte to send*/
|
|
);
|
|
|
|
/** \brief Flush serial bus buffers. */
|
|
void busFlush(
|
|
t_bus_devices device
|
|
);
|
|
|
|
/** \brief Check if receive buffers is empty.
|
|
\retval bool Returns true if recieve buffer is empty
|
|
*/
|
|
BOOLEAN busEmpty(
|
|
t_bus_devices device
|
|
);
|
|
|
|
#endif /* __BUS_H__ */
|