[444] | 1 | /* w89k-io.c -- I/O code for the Winbond Cougar board. |
---|
| 2 | * |
---|
| 3 | * Copyright (c) 1995 Cygnus Support |
---|
| 4 | * |
---|
| 5 | * The authors hereby grant permission to use, copy, modify, distribute, |
---|
| 6 | * and license this software and its documentation for any purpose, provided |
---|
| 7 | * that existing copyright notices are retained in all copies and that this |
---|
| 8 | * notice is included verbatim in any distributions. No written agreement, |
---|
| 9 | * license, or royalty fee is required for any of the authorized uses. |
---|
| 10 | * Modifications to this software may be copyrighted by their authors |
---|
| 11 | * and need not follow the licensing terms described here, provided that |
---|
| 12 | * the new terms are clearly indicated on the first page of each file where |
---|
| 13 | * they apply. |
---|
| 14 | */ |
---|
| 15 | #include "w89k.h" |
---|
| 16 | |
---|
| 17 | void zylons(); |
---|
| 18 | void led_putnum(); |
---|
| 19 | void delay(); |
---|
| 20 | |
---|
| 21 | /* |
---|
| 22 | * outbyte -- shove a byte out the serial port. We wait till the byte |
---|
| 23 | */ |
---|
| 24 | void |
---|
| 25 | outbyte (byte) |
---|
| 26 | unsigned char byte; |
---|
| 27 | { |
---|
| 28 | while ((inp(COM1_LSR) & TRANSMIT) == 0x0) ; |
---|
| 29 | |
---|
| 30 | outp (COM1_DATA, byte); |
---|
| 31 | |
---|
| 32 | return; |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | /* |
---|
| 36 | * inbyte -- get a byte from the serial port |
---|
| 37 | */ |
---|
| 38 | unsigned char |
---|
| 39 | inbyte () |
---|
| 40 | { |
---|
| 41 | while ((inp(COM1_LSR) & RECEIVE) == 0x0) ; |
---|
| 42 | |
---|
| 43 | return (inp(COM1_DATA)); |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | /* |
---|
| 47 | * led_putnum -- print a hex number on the LED. the value of num must be a byte. |
---|
| 48 | * The max number 15, since the front panel only has 4 LEDs. |
---|
| 49 | */ |
---|
| 50 | void |
---|
| 51 | led_putnum ( num ) |
---|
| 52 | char num; |
---|
| 53 | { |
---|
| 54 | print ("Sorry, no LED's on the WinBond W89k board, using putnum instead\r\n"); |
---|
| 55 | putnum (num); |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | /* |
---|
| 59 | * zylons -- draw a rotating pattern. NOTE: this function never returns. |
---|
| 60 | */ |
---|
| 61 | void |
---|
| 62 | zylons() |
---|
| 63 | { |
---|
| 64 | print ("Sorry, no LED's on the WinBond W89k board\r\n"); |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | void |
---|
| 68 | delay (x) |
---|
| 69 | int x; |
---|
| 70 | { |
---|
| 71 | int y = 17; |
---|
| 72 | while (x-- !=0) |
---|
| 73 | y = y^2; |
---|
| 74 | } |
---|