blob: 8db178f282208bd39c0f8d1f13062c107455ea3c [file] [log] [blame]
adamdunkels9fcf9d62003-09-04 19:46:32 +00001/**
2 * \file
3 * Header file for MSP430 RS232 driver.
4 * \author Adam Dunkels <adam@sics.se>
5 *
6 */
7#ifndef __RS232_H__
8#define __RS232_H__
9
10/* These values were taken from the "rs232.h" include file from cc65,
11 written by Ullrich von Bassewitz. */
12
13#define RS_BAUD_50 0x00
14#define RS_BAUD_110 0x01
15#define RS_BAUD_134_5 0x02
16#define RS_BAUD_300 0x03
17#define RS_BAUD_600 0x04
18#define RS_BAUD_1200 0x05
19#define RS_BAUD_2400 0x06
20#define RS_BAUD_4800 0x07
21#define RS_BAUD_9600 0x08
22#define RS_BAUD_19200 0x09
23#define RS_BAUD_38400 0x0A
24#define RS_BAUD_57600 0x0B
25#define RS_BAUD_115200 0x0C
26#define RS_BAUD_230400 0x0D
27
28#define RS_BITS_5 0x60
29#define RS_BITS_6 0x40
30#define RS_BITS_7 0x20
31#define RS_BITS_8 0x00
32
33#define RS_PAR_NONE 0x00
34#define RS_PAR_ODD 0x20
35#define RS_PAR_EVEN 0x60
36#define RS_PAR_MARK 0xA0
37#define RS_PAR_SPACE 0xE0
38
39#define RS_STOP_1 0x00
40#define RS_STOP_2 0x80
41
42#define RS_ERR_OK 0x00 /* Not an error - relax */
43#define RS_ERR_NOT_INITIALIZED 0x01 /* Module not initialized */
44#define RS_ERR_BAUD_TOO_FAST 0x02 /* Cannot handle baud rate */
45#define RS_ERR_BAUD_NOT_AVAIL 0x03 /* Baud rate not available */
46#define RS_ERR_NO_DATA 0x04 /* Nothing to read */
47#define RS_ERR_OVERFLOW 0x05 /* No room in send buffer */
48#define RS_ERR_INIT_FAILED 0x06 /* Initialization of RS232 routines f
49ailed */
50
51unsigned char rs232_init(char none);
52unsigned char rs232_params(unsigned char params, unsigned char parity);
53unsigned char rs232_get(char *c);
54unsigned char rs232_put(char c);
55
56#endif /* __RS232_H__ */