source: trunk/libs/newlib/src/libgloss/rs6000/mbx-outbyte.c @ 595

Last change on this file since 595 was 444, checked in by satin@…, 7 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.5 KB
Line 
1/*
2 * mbx-outbyte.c -- outbyte function for targets using the eppcbug monitor
3 *
4 * Copyright (c) 1998 Cygnus Support
5 *
6 * The authors hereby grant permission to use, copy, modify, distribute,
7 * and license this software and its documentation for any purpose, provided
8 * that existing copyright notices are retained in all copies and that this
9 * notice is included verbatim in any distributions. No written agreement,
10 * license, or royalty fee is required for any of the authorized uses.
11 * Modifications to this software may be copyrighted by their authors
12 * and need not follow the licensing terms described here, provided that
13 * the new terms are clearly indicated on the first page of each file where
14 * they apply.
15 */
16
17#include "ppc-asm.h"
18
19static int sendbyte(char c)
20{
21    struct {
22        unsigned clun;
23        unsigned dlun;
24        char     *data;
25        unsigned len;
26        unsigned rsrvd;
27        char     buf[4];
28    } ipb, *inpb;
29
30    struct {
31        int status;
32        int cnt;
33    } opb, *outpb;
34
35    inpb = &ipb;
36    outpb = &opb;
37
38    inpb->clun = 0;
39    inpb->dlun = 0;
40    inpb->data = ipb.buf;
41    inpb->len  = 1;
42    inpb->rsrvd = 0;
43    inpb->buf[0] = c;
44
45    asm volatile (
46        "mr  3,%0\n"
47        "mr  4,%1\n"
48        "li  10,0x201\n"
49        "sc"
50        : /* no outputs */
51        : "r" (inpb), "r" (outpb)
52        : "3", "4", "10"
53    );
54
55    return (outpb->status == 0 && outpb->cnt == 1);
56}
57
58#define GDB_QUOTE_OUTBYTES 1
59
60void outbyte(char c)
61{
62#ifdef GDB_QUOTE_OUTBYTES
63    /*
64     *  GDB monitor.c will echo characters quoted with ^O
65     */
66    while (!sendbyte('\017')) ;
67#endif
68    while (!sendbyte(c)) ;
69}
70
71
Note: See TracBrowser for help on using the repository browser.