Changeset 35d9acb3 in rtems
- Timestamp:
- 01/07/00 18:52:14 (24 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 1d54d3b
- Parents:
- 09e0df6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libcpu/sh/sh7045/sci/sci.c
r09e0df6 r35d9acb3 51 51 #include <rtems/score/iosh7045.h> 52 52 #include <sh/sh7_sci.h> 53 #include <sh/io_types.h> 53 #include <sh/sh7_pfc.h> 54 /* #include <sh/io_types.h> */ 54 55 #include <sh/sci.h> 56 57 #ifndef STANDALONE_EVB 58 #define STANDALONE_EVB 0 59 #endif 60 61 /* 62 * NOTE: Some SH variants have 3 sci devices 63 */ 64 65 #define SCI_MINOR_DEVICES 2 66 67 /* 68 * FIXME: sh7045 register names match Hitachi data book, 69 * but conflict with RTEMS sh7032 usage. 70 */ 71 72 #define SH_SCI_BASE_0 SCI_SMR0 73 #define SH_SCI_BASE_1 SCI_SMR1 74 75 #define SH_SCI_DEF_COMM_0 B9600 | CS8 76 #define SH_SCI_DEF_COMM_1 B38400 | CS8 77 /* #define SH_SCI_DEF_COMM_1 B9600 | CS8 */ 55 78 56 79 struct scidev_t { 57 80 char * name ; 81 unsigned32 addr ; 58 82 rtems_device_minor_number minor ; 59 83 unsigned short opened ; 60 84 tcflag_t cflags ; 61 } sci_device[ 2] =62 { 63 { "/dev/sci0", 0, 0, B9600 | CS8},64 { "/dev/sci1", 1, 0, B9600 | CS8}85 } sci_device[SCI_MINOR_DEVICES] = 86 { 87 { "/dev/sci0", SH_SCI_BASE_0, 0, 0, SH_SCI_DEF_COMM_0 }, 88 { "/dev/sci1", SH_SCI_BASE_1, 1, 0, SH_SCI_DEF_COMM_1 } 65 89 } ; 66 90 67 91 /* local data structures maintain hardware configuration */ 92 #if UNUSED 93 static sci_setup_t sio_param[2]; 94 #endif 95 96 /* imported from scitab.rel */ 68 97 extern int _sci_get_brparms( 69 98 tcflag_t cflag, … … 71 100 unsigned char *brr ); 72 101 73 #if UNUSED 74 static sci_setup_t sio_param[2]; 75 #endif 76 77 /* local functions operate SCI ports 0 and 1 */ 78 /* called from polling routines or ISRs */ 102 /* Translate termios' tcflag_t into sci settings */ 103 static int _sci_set_cflags( 104 struct scidev_t *sci_dev, 105 tcflag_t c_cflag ) 106 { 107 unsigned8 smr ; 108 unsigned8 brr ; 109 110 if ( c_cflag & CBAUD ) 111 { 112 if ( _sci_get_brparms( c_cflag, &smr, &brr ) != 0 ) 113 return -1 ; 114 } 115 116 if ( c_cflag & CSIZE ) 117 { 118 if ( c_cflag & CS8 ) 119 smr &= ~SCI_SEVEN_BIT_DATA; 120 else if ( c_cflag & CS7 ) 121 smr |= SCI_SEVEN_BIT_DATA; 122 else 123 return -1 ; 124 } 125 126 if ( c_cflag & CSTOPB ) 127 smr |= SCI_STOP_BITS_2; 128 else 129 smr &= ~SCI_STOP_BITS_2; 130 131 if ( c_cflag & PARENB ) 132 smr |= SCI_PARITY_ON ; 133 else 134 smr &= ~SCI_PARITY_ON ; 135 136 if ( c_cflag & PARODD ) 137 smr |= SCI_ODD_PARITY ; 138 else 139 smr &= ~SCI_ODD_PARITY; 140 141 write8( smr, sci_dev->addr + SCI_SMR ); 142 write8( brr, sci_dev->addr + SCI_BRR ); 143 144 return 0 ; 145 } 146 147 /* 148 * local functions operate SCI ports 0 and 1 149 * called from polling routines or ISRs 150 */ 79 151 rtems_boolean wrtSCI0(unsigned char ch) 80 152 { … … 243 315 unsigned8 temp8; 244 316 unsigned16 temp16; 245 unsigned char smr ;246 unsigned char brr ;247 317 248 318 unsigned a ;
Note: See TracChangeset
for help on using the changeset viewer.