Rev 3234 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3234 | Rev 3844 | ||
---|---|---|---|
Line 24... | Line 24... | ||
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | /** @addtogroup mips32 |
29 | /** @addtogroup mips32 |
30 | * @{ |
30 | * @{ |
31 | */ |
31 | */ |
32 | /** @file |
32 | /** @file |
33 | */ |
33 | */ |
34 | 34 | ||
Line 56... | Line 56... | ||
56 | .write = msim_write, |
56 | .write = msim_write, |
57 | .read = msim_do_read, |
57 | .read = msim_do_read, |
58 | }; |
58 | }; |
59 | 59 | ||
60 | /** Putchar that works with MSIM & gxemul */ |
60 | /** Putchar that works with MSIM & gxemul */ |
61 | void msim_write(chardev_t *dev, const char ch) |
61 | void msim_write(chardev_t *dev, const char ch, bool silent) |
62 | { |
62 | { |
- | 63 | if (!silent) |
|
63 | *((char *) MSIM_VIDEORAM) = ch; |
64 | *((char *) MSIM_VIDEORAM) = ch; |
64 | } |
65 | } |
65 | 66 | ||
66 | /* Called from getc(). */ |
67 | /* Called from getc(). */ |
67 | void msim_enable(chardev_t *dev) |
68 | void msim_enable(chardev_t *dev) |
68 | { |
69 | { |
Line 78... | Line 79... | ||
78 | #include <print.h> |
79 | #include <print.h> |
79 | /** Read character using polling, assume interrupts disabled */ |
80 | /** Read character using polling, assume interrupts disabled */ |
80 | static char msim_do_read(chardev_t *dev) |
81 | static char msim_do_read(chardev_t *dev) |
81 | { |
82 | { |
82 | char ch; |
83 | char ch; |
83 | 84 | ||
84 | while (1) { |
85 | while (1) { |
85 | ch = *((volatile char *) MSIM_KBD_ADDRESS); |
86 | ch = *((volatile char *) MSIM_KBD_ADDRESS); |
86 | if (ch) { |
87 | if (ch) { |
87 | if (ch == '\r') |
88 | if (ch == '\r') |
88 | return '\n'; |
89 | return '\n'; |
Line 99... | Line 100... | ||
99 | if ((irq->notif_cfg.notify) && (irq->notif_cfg.answerbox)) |
100 | if ((irq->notif_cfg.notify) && (irq->notif_cfg.answerbox)) |
100 | ipc_irq_send_notif(irq); |
101 | ipc_irq_send_notif(irq); |
101 | else { |
102 | else { |
102 | char ch = 0; |
103 | char ch = 0; |
103 | 104 | ||
104 | ch = *((char *) MSIM_KBD_ADDRESS); |
105 | ch = *((char *) MSIM_KBD_ADDRESS); |
105 | if (ch =='\r') |
106 | if (ch =='\r') |
106 | ch = '\n'; |
107 | ch = '\n'; |
107 | if (ch == 0x7f) |
108 | if (ch == 0x7f) |
108 | ch = '\b'; |
109 | ch = '\b'; |
109 | chardev_push_character(&console, ch); |
110 | chardev_push_character(&console, ch); |
110 | } |
111 | } |
111 | } |
112 | } |
112 | 113 | ||
113 | static irq_ownership_t msim_claim(void) |
114 | static irq_ownership_t msim_claim(void) |
114 | { |
115 | { |