summaryrefslogtreecommitdiffstats
path: root/firmware/debug.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-07-15 19:40:55 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-07-24 21:20:13 +0000
commit092c340a2062fa98b7387fc5fd63578ddae7d0b6 (patch)
tree98ec96946eeb2ae709cb0528cc6998e21bb9b290 /firmware/debug.c
parent17f7cc92c258bc456a27c3e7c5a19c9409851879 (diff)
downloadrockbox-092c340a2062fa98b7387fc5fd63578ddae7d0b6.tar.gz
rockbox-092c340a2062fa98b7387fc5fd63578ddae7d0b6.tar.bz2
rockbox-092c340a2062fa98b7387fc5fd63578ddae7d0b6.zip
[1/4] Remove SH support and all archos targets
This removes all code specific to SH targets Change-Id: I7980523785d2596e65c06430f4638eec74a06061
Diffstat (limited to 'firmware/debug.c')
-rw-r--r--firmware/debug.c193
1 files changed, 0 insertions, 193 deletions
diff --git a/firmware/debug.c b/firmware/debug.c
index bc382335b6..34f89908a3 100644
--- a/firmware/debug.c
+++ b/firmware/debug.c
@@ -30,9 +30,6 @@
#ifdef DEBUG
static char debugmembuf[200];
-#if CONFIG_CPU == SH7034
-static char debugbuf[400];
-#endif
#endif
#include "kernel.h"
@@ -40,194 +37,6 @@ static char debugbuf[400];
#include "debug.h"
#ifdef DEBUG
-#if CONFIG_CPU == SH7034 /* these are still very SH-oriented */
-void debug_init(void)
-{
- /* Clear it all! */
- SSR1 &= ~(SCI_RDRF | SCI_ORER | SCI_PER | SCI_FER);
-
- /* This enables the serial Rx interrupt, to be able to exit into the
- debugger when you hit CTRL-C */
- SCR1 |= 0x40;
- SCR1 &= ~0x80;
- IPRE |= 0xf000; /* Set to highest priority */
-}
-
-static int debug_tx_ready(void)
-{
- return (SSR1 & SCI_TDRE);
-}
-
-static void debug_tx_char(char ch)
-{
- while (!debug_tx_ready())
- {
- ;
- }
-
- /*
- * Write data into TDR and clear TDRE
- */
- TDR1 = ch;
- SSR1 &= ~SCI_TDRE;
-}
-
-static void debug_handle_error(char ssr)
-{
- (void)ssr;
- SSR1 &= ~(SCI_ORER | SCI_PER | SCI_FER);
-}
-
-static int debug_rx_ready(void)
-{
- char ssr;
-
- ssr = SSR1 & ( SCI_PER | SCI_FER | SCI_ORER );
- if ( ssr )
- debug_handle_error ( ssr );
- return SSR1 & SCI_RDRF;
-}
-
-static char debug_rx_char(void)
-{
- char ch;
- char ssr;
-
- while (!debug_rx_ready())
- {
- ;
- }
-
- ch = RDR1;
- SSR1 &= ~SCI_RDRF;
-
- ssr = SSR1 & (SCI_PER | SCI_FER | SCI_ORER);
-
- if (ssr)
- debug_handle_error (ssr);
-
- return ch;
-}
-
-static const char hexchars[] = "0123456789abcdef";
-
-static char highhex(int x)
-{
- return hexchars[(x >> 4) & 0xf];
-}
-
-static char lowhex(int x)
-{
- return hexchars[x & 0xf];
-}
-
-static void putpacket (const char *buffer)
-{
- register int checksum;
-
- const char *src = buffer;
-
- /* Special debug hack. Shut off the Rx IRQ during I/O to prevent the debug
- stub from interrupting the message */
- SCR1 &= ~0x40;
-
- debug_tx_char ('$');
- checksum = 0;
-
- while (*src)
- {
- int runlen;
-
- /* Do run length encoding */
- for (runlen = 0; runlen < 100; runlen ++)
- {
- if (src[0] != src[runlen] || runlen == 99)
- {
- if (runlen > 3)
- {
- int encode;
- /* Got a useful amount */
- debug_tx_char (*src);
- checksum += *src;
- debug_tx_char ('*');
- checksum += '*';
- checksum += (encode = runlen + ' ' - 4);
- debug_tx_char (encode);
- src += runlen;
- }
- else
- {
- debug_tx_char (*src);
- checksum += *src;
- src++;
- }
- break;
- }
- }
- }
-
-
- debug_tx_char ('#');
- debug_tx_char (highhex(checksum));
- debug_tx_char (lowhex(checksum));
-
- /* Wait for the '+' */
- debug_rx_char();
-
- /* Special debug hack. Enable the IRQ again */
- SCR1 |= 0x40;
-}
-
-
-/* convert the memory, pointed to by mem into hex, placing result in buf */
-/* return a pointer to the last char put in buf (null) */
-static char *mem2hex (const char *mem, char *buf, int count)
-{
- int i;
- int ch;
- for (i = 0; i < count; i++)
- {
- ch = *mem++;
- *buf++ = highhex (ch);
- *buf++ = lowhex (ch);
- }
- *buf = 0;
- return (buf);
-}
-
-static void debug(const char *msg)
-{
- debugbuf[0] = 'O';
-
- mem2hex(msg, &debugbuf[1], strlen(msg));
- putpacket(debugbuf);
-}
-#elif defined(HAVE_GDB_API)
-static void *get_api_function(int n)
-{
- struct gdb_api *api = (struct gdb_api *)GDB_API_ADDRESS;
- if (api->magic == GDB_API_MAGIC)
- return api->func[n];
- else
- return NULL;
-}
-
-void breakpoint(void)
-{
- void (*f)(void) = get_api_function(0);
- if (f) (*f)();
-}
-
-static void debug(char *msg)
-{
- void (*f)(char *) = get_api_function(1);
- if (f) (*f)(msg);
-}
-
-void debug_init(void)
-{
-}
-#else /* !SH7034 && !HAVE_GDB_API */
void debug_init(void)
{
}
@@ -236,8 +45,6 @@ static inline void debug(char *msg)
{
(void)msg;
}
-#endif
-
#endif /* end of DEBUG section */
#ifdef __GNUC__