Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:43

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /*
0004  *
0005  *  COPYRIGHT (c) 1989-1999.
0006  *  On-Line Applications Research Corporation (OAR).
0007  *
0008  * Redistribution and use in source and binary forms, with or without
0009  * modification, are permitted provided that the following conditions
0010  * are met:
0011  * 1. Redistributions of source code must retain the above copyright
0012  *    notice, this list of conditions and the following disclaimer.
0013  * 2. Redistributions in binary form must reproduce the above copyright
0014  *    notice, this list of conditions and the following disclaimer in the
0015  *    documentation and/or other materials provided with the distribution.
0016  *
0017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0018  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0020  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0021  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0022  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0023  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0024  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0025  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0026  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0027  * POSSIBILITY OF SUCH DAMAGE.
0028  */
0029 
0030 #ifndef _MC68681_H_
0031 #define _MC68681_H_
0032 
0033 #include <rtems/termiostypes.h>
0034 
0035 #ifdef __cplusplus
0036 extern "C" {
0037 #endif
0038 
0039 /*
0040  *  These are just used in the interface between this driver and
0041  *  the read/write register routines when accessing the first
0042  *  control port.
0043  */
0044 
0045 #define MC68681_STATUS          1
0046 #define MC68681_RX_BUFFER       3
0047 
0048 #define MC68681_MODE            0
0049 #define MC68681_CLOCK_SELECT    1
0050 #define MC68681_COMMAND         2
0051 #define MC68681_TX_BUFFER       3
0052 
0053 /*
0054  *  Data Port bit map configuration
0055  *
0056  *   D0      : Baud Rate Set Selection
0057  *   D1 - D2 : Extended Baud Rate Setting
0058  */
0059 
0060 #define MC68681_DATA_BAUD_RATE_SET_1      0  /* ACR[7] = 0 */
0061 #define MC68681_DATA_BAUD_RATE_SET_2      1  /* ACR[7] = 1 */
0062 
0063 #define MC68681_XBRG_IGNORED              (0 << 1)
0064 #define MC68681_XBRG_ENABLED              (1 << 1)
0065 #define MC68681_XBRG_DISABLED             (2 << 1)
0066 #define MC68681_XBRG_MASK                 (3 << 1)
0067 
0068 /*
0069  *  Custom baud rate table information
0070  */
0071 
0072 typedef unsigned char mc68681_baud_t;
0073 typedef mc68681_baud_t mc68681_baud_table_t[RTEMS_TERMIOS_NUMBER_BAUD_RATES];
0074 
0075 #define MC68681_BAUD_NOT_VALID 0xFF
0076 
0077 extern mc68681_baud_t
0078     mc68681_baud_rate_table[4][RTEMS_TERMIOS_NUMBER_BAUD_RATES];
0079 
0080 
0081 /*
0082  * Driver function table
0083  */
0084 
0085 extern const console_fns mc68681_fns;
0086 extern const console_fns mc68681_fns_polled;
0087 
0088 /*
0089  * Default register access routines
0090  */
0091 
0092 uint8_t   mc68681_get_register(     /* registers are at 1 byte boundaries */
0093   uintptr_t   ulCtrlPort,           /*   and accessed as bytes            */
0094   uint8_t     ucRegNum
0095 );
0096 
0097 void  mc68681_set_register(
0098   uintptr_t   ulCtrlPort,
0099   uint8_t     ucRegNum,
0100   uint8_t     ucData
0101 );
0102 
0103 uint8_t   mc68681_get_register_2(   /* registers are at 2 byte boundaries */
0104   uintptr_t   ulCtrlPort,           /*   and accessed as bytes            */
0105   uint8_t     ucRegNum
0106 );
0107 
0108 void  mc68681_set_register_2(
0109   uintptr_t   ulCtrlPort,
0110   uint8_t     ucRegNum,
0111   uint8_t     ucData
0112 );
0113 
0114 uint8_t   mc68681_get_register_4(   /* registers are at 4 byte boundaries */
0115   uintptr_t   ulCtrlPort,           /*   and accessed as bytes            */
0116   uint8_t     ucRegNum
0117 );
0118 
0119 void  mc68681_set_register_4(
0120   uintptr_t   ulCtrlPort,
0121   uint8_t     ucRegNum,
0122   uint8_t     ucData
0123 );
0124 
0125 uint8_t   mc68681_get_register_8(   /* registers are at 8 byte boundaries */
0126   uintptr_t   ulCtrlPort,           /*   and accessed as bytes            */
0127   uint8_t     ucRegNum
0128 );
0129 
0130 void  mc68681_set_register_8(
0131   uintptr_t   ulCtrlPort,
0132   uint8_t     ucRegNum,
0133   uint8_t     ucData
0134 );
0135 
0136 
0137 #ifdef __cplusplus
0138 }
0139 #endif
0140 
0141 #endif /* _MC68681_H_ */