Search
lxdream.org :: lxdream/src/serial.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/serial.h
changeset 561:533f6b478071
prev19:9da7a8e38f9d
next736:a02d1475ccfd
author nkeynes
date Tue Jan 01 05:08:38 2008 +0000 (12 years ago)
branchlxdream-mmu
permissions -rw-r--r--
last change Enable Id keyword on all source files
file annotate diff log raw
nkeynes@19
     1
/**
nkeynes@561
     2
 * $Id$
nkeynes@19
     3
 * External interface to the dreamcast serial port, implemented by 
nkeynes@19
     4
 * sh4/scif.c
nkeynes@19
     5
 *
nkeynes@19
     6
 * Copyright (c) 2005 Nathan Keynes.
nkeynes@19
     7
 *
nkeynes@19
     8
 * This program is free software; you can redistribute it and/or modify
nkeynes@19
     9
 * it under the terms of the GNU General Public License as published by
nkeynes@19
    10
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@19
    11
 * (at your option) any later version.
nkeynes@19
    12
 *
nkeynes@19
    13
 * This program is distributed in the hope that it will be useful,
nkeynes@19
    14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@19
    15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@19
    16
 * GNU General Public License for more details.
nkeynes@19
    17
 */
nkeynes@19
    18
#ifndef dream_serial_H
nkeynes@19
    19
#define dream_serial_H 1
nkeynes@19
    20
nkeynes@19
    21
#include <stdint.h>
nkeynes@19
    22
nkeynes@19
    23
#ifdef __cplusplus
nkeynes@19
    24
extern "C" {
nkeynes@19
    25
#endif
nkeynes@19
    26
nkeynes@19
    27
#define SERIAL_8BIT        0x00
nkeynes@19
    28
#define SERIAL_7BIT        0x40
nkeynes@19
    29
#define SERIAL_PARITY_OFF  0x00
nkeynes@19
    30
#define SERIAL_PARITY_EVEN 0x20
nkeynes@19
    31
#define SERIAL_PARITY_ODD  0x30
nkeynes@19
    32
#define SERIAL_1STOPBIT    0x00
nkeynes@19
    33
#define SERIAL_2STOPBITS   0x08
nkeynes@19
    34
nkeynes@19
    35
typedef struct serial_device {
nkeynes@19
    36
    void (*set_line_speed)(uint32_t bps);
nkeynes@19
    37
    void (*set_line_params)(int flags);
nkeynes@19
    38
    void (*receive_data)(uint8_t value);
nkeynes@19
    39
} *serial_device_t;
nkeynes@19
    40
nkeynes@19
    41
void serial_attach_device( serial_device_t dev );
nkeynes@19
    42
void serial_detach_device( );
nkeynes@19
    43
nkeynes@19
    44
void serial_transmit_data( char *data, int length );
nkeynes@19
    45
void serial_transmit_break( void );
nkeynes@19
    46
nkeynes@19
    47
#ifdef __cplusplus
nkeynes@19
    48
}
nkeynes@19
    49
#endif
nkeynes@19
    50
nkeynes@19
    51
#endif
.