view packages/devs/serial/rs232/common/current/include/rs232.ht @ 0:3111d98ba7b3 ecos-v1_1-release

Initial commit of eCos version 1.1
author jlarmour
date Tue, 11 May 1999 11:16:07 +0000
parents
children
line wrap: on
line source

#ifndef CYGONCE_DEVS_SERIAL_RS232_COMMON_RS232_HT
#define CYGONCE_DEVS_SERIAL_RS232_COMMON_RS232_HT

//==========================================================================
//
//	rs232.ht
//
//	Template file for rs232 serial device
//
//==========================================================================
//####COPYRIGHTBEGIN####
//
// -------------------------------------------
// The contents of this file are subject to the Cygnus eCos Public License
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License.  You may obtain a copy of the License at
// http://sourceware.cygnus.com/ecos
// 
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the
// License for the specific language governing rights and limitations under
// the License.
// 
// The Original Code is eCos - Embedded Cygnus Operating System, released
// September 30, 1998.
// 
// The Initial Developer of the Original Code is Cygnus.  Portions created
// by Cygnus are Copyright (C) 1998 Cygnus Solutions.  All Rights Reserved.
// -------------------------------------------
//
//####COPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): 	proven
// Contributors:	proven
// Date:	1998-04-22
// Purpose:	Internals to a configured device serial rs232 class.
// Description:	This file contains the INTERNALS of a C++ class.
//              This file is included inside the declaration of the C++ class.
// Usage:	#include <devs/serial/rs232/common/rs232.ht>
//
//####DESCRIPTIONEND####
//
//==========================================================================

/*
 * Some of these fields will be accessed by some ISR routines. Any field 
 * that is modified by an ISR routine must be declared volatile.
 */
#ifdef CYG_DEVICE_INTERNAL

    protected:
    // Read 
    Cyg_IORB         * volatile	read_buffer;

    // Only needed for interrupt mode
    #ifdef CYG_DEVICE_SERIAL_RS232_KMODE_INTERRUPT
    Cyg_Queuet<Cyg_IORB, CYG_DEVICE_SERIAL_RS232_READ_BUFFERS>
                                read_buffers;
    #ifdef CYG_DEVICE_SERIAL_RS232_READ_BUFFERS_LL
    Cyg_IORB         * volatile	read_buffers_ll_first;
    Cyg_IORB         * volatile	read_buffers_ll_last;
    #endif

    #ifndef CYG_DEVICE_SERIAL_RS232_ONE_VECTOR
    Cyg_Interrupt		read_interrupt;
    #endif

    #ifdef CYG_DEVICE_SERIAL_RS232_FLOW_CONTROL
//    volatile cyg_ucount32	read_throttle;
//    cyg_uint8			read_throttle_size; // this can be made configurable
//    cyg_uint8			read_throttle_free;
//    cyg_uint8			read_throttle_queued;
//    char			read_throttle_buffer[256];
    #endif
    #endif

    #ifdef CYG_DEVICE_SERIAL_RS232_READ_MODES
    cyg_uint8 			read_mode;
    cyg_uint8			read_mode_eob_count;
    const char *		read_mode_eob_chars;
//    cyg_uint8			read_mode_translate_char;
//    cyg_uint8			read_mode_escape_next_char;

    #endif

    // These are actually routines in disguize
    static cyg_ISR	        read_isr;
    static cyg_DSR	        read_dsr;

    // Write
    Cyg_IORB         * volatile	write_buffer;		

    // Only needed for interrupt mode
    #ifdef CYG_DEVICE_SERIAL_RS232_KMODE_INTERRUPT
    Cyg_Queuet<Cyg_IORB, CYG_DEVICE_SERIAL_RS232_WRITE_BUFFERS>
				write_buffers;    
    #ifdef CYG_DEVICE_SERIAL_RS232_WRITE_BUFFERS_LL
    Cyg_IORB         * volatile	write_buffers_ll_first;
    Cyg_IORB         * volatile write_buffers_ll_last;
    #endif

    #ifndef CYG_DEVICE_SERIAL_RS232_ONE_VECTOR
    Cyg_Interrupt		write_interrupt;
    #endif
    #endif

    // These are actually routines in disguize
    static cyg_ISR	        write_isr;
    static cyg_DSR	        write_dsr;

    #ifdef CYG_DEVICE_SERIAL_RS232_WRITE_MODES
    cyg_uint8 			write_mode;
    volatile cyg_int8		write_char;
    #endif

    // Generic
    #ifdef CYG_DEVICE_SERIAL_RS232_KMODE_INTERRUPT
    #ifdef CYG_DEVICE_SERIAL_RS232_ONE_VECTOR
    Cyg_Interrupt		both_interrupt;
    static cyg_ISR	        both_isr;
    static cyg_DSR	        both_dsr;
    #endif
    cyg_uint8			kmode;
    #endif

    #ifdef CYG_DEVICE_SERIAL_RS232_MUTEX
    Cyg_Mutex			mutex;
    #endif

#endif  // CYG_DEVICE_INTERNAL
#endif  // CYGONCE_DEVS_SERIAL_RS232_COMMON_RS232_HT
// End of rs232.ht