~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/ppc/syslib/ppc4xx_kgdb.c

Version: ~ [ linux-5.9.1 ] ~ [ linux-5.8.16 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.72 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.152 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.202 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.240 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.240 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #include <linux/config.h>
  2 #include <linux/types.h>
  3 #include <asm/ibm4xx.h>
  4 #include <linux/kernel.h>
  5 
  6 
  7 
  8 #define LSR_DR          0x01 /* Data ready */
  9 #define LSR_OE          0x02 /* Overrun */
 10 #define LSR_PE          0x04 /* Parity error */
 11 #define LSR_FE          0x08 /* Framing error */
 12 #define LSR_BI          0x10 /* Break */
 13 #define LSR_THRE        0x20 /* Xmit holding register empty */
 14 #define LSR_TEMT        0x40 /* Xmitter empty */
 15 #define LSR_ERR         0x80 /* Error */
 16 
 17 #include <platforms/4xx/ibm_ocp.h>
 18 
 19 extern struct NS16550* COM_PORTS[];
 20 #ifndef NULL
 21 #define NULL 0x00
 22 #endif
 23 
 24 static volatile struct NS16550 *kgdb_debugport = NULL;
 25 
 26 volatile struct NS16550 *
 27 NS16550_init(int chan)
 28 {
 29         volatile struct NS16550 *com_port;
 30         int quot;
 31 #ifdef BASE_BAUD
 32         quot = BASE_BAUD / 9600;
 33 #else
 34         quot = 0x000c; /* 0xc = 9600 baud (on a pc) */
 35 #endif
 36 
 37         com_port = (struct NS16550 *) COM_PORTS[chan];
 38 
 39         com_port->lcr = 0x00;
 40         com_port->ier = 0xFF;
 41         com_port->ier = 0x00;
 42         com_port->lcr = com_port->lcr | 0x80; /* Access baud rate */
 43         com_port->dll = ( quot & 0x00ff ); /* 0xc = 9600 baud */
 44         com_port->dlm = ( quot & 0xff00 ) >> 8;
 45         com_port->lcr = 0x03; /* 8 data, 1 stop, no parity */
 46         com_port->mcr = 0x00; /* RTS/DTR */
 47         com_port->fcr = 0x07; /* Clear & enable FIFOs */
 48 
 49         return( com_port );
 50 }
 51 
 52 
 53 void
 54 NS16550_putc(volatile struct NS16550 *com_port, unsigned char c)
 55 {
 56         while ((com_port->lsr & LSR_THRE) == 0)
 57                 ;
 58         com_port->thr = c;
 59         return;
 60 }
 61 
 62 unsigned char
 63 NS16550_getc(volatile struct NS16550 *com_port)
 64 {
 65         while ((com_port->lsr & LSR_DR) == 0)
 66                 ;
 67         return (com_port->rbr);
 68 }
 69 
 70 unsigned char
 71 NS16550_tstc(volatile struct NS16550 *com_port)
 72 {
 73         return ((com_port->lsr & LSR_DR) != 0);
 74 }
 75 
 76 
 77 #if defined(CONFIG_KGDB_TTYS0)
 78 #define KGDB_PORT 0
 79 #elif defined(CONFIG_KGDB_TTYS1)
 80 #define KGDB_PORT 1
 81 #elif defined(CONFIG_KGDB_TTYS2)
 82 #define KGDB_PORT 2
 83 #elif defined(CONFIG_KGDB_TTYS3)
 84 #define KGDB_PORT 3
 85 #else
 86 #error "invalid kgdb_tty port"
 87 #endif
 88 
 89 void putDebugChar( unsigned char c )
 90 {
 91         if ( kgdb_debugport == NULL )
 92                 kgdb_debugport = NS16550_init(KGDB_PORT);
 93         NS16550_putc( kgdb_debugport, c );
 94 }
 95 
 96 int getDebugChar( void )
 97 {
 98         if (kgdb_debugport == NULL)
 99                 kgdb_debugport = NS16550_init(KGDB_PORT);
100 
101         return(NS16550_getc(kgdb_debugport));
102 }
103 
104 void kgdb_interruptible(int enable)
105 {
106         return;
107 }
108 
109 void putDebugString(char* str)
110 {
111         while (*str != '\0') {
112                 putDebugChar(*str);
113                 str++;
114         }
115         putDebugChar('\r');
116         return;
117 }
118 
119 void
120 kgdb_map_scc(void)
121 {
122         printk("kgdb init \n");
123         kgdb_debugport = NS16550_init(KGDB_PORT);
124 }
125 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp