Skip to content
This repository was archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
[msm] factor out debug code into shared area, make configurable
Browse files Browse the repository at this point in the history
The defines WITH_DEBUG_DCC, WITH_DEBUG_UART, and WITH_DEBUG_FBCON
are used to determine where dputc output goes.  Duplicated code
merged to msm_shared.  Configuration added to project files.
  • Loading branch information
swetland committed Jan 30, 2009
1 parent b3d66d9 commit ddf61a2
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 111 deletions.
3 changes: 1 addition & 2 deletions platform/msm7k/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ OBJS += \
$(LOCAL_DIR)/platform.o \
$(LOCAL_DIR)/interrupts.o \
$(LOCAL_DIR)/mddi.o \
$(LOCAL_DIR)/gpio.o \
$(LOCAL_DIR)/debug.o
$(LOCAL_DIR)/gpio.o

LINKER_SCRIPT += $(BUILDDIR)/system-onesegment.ld

Expand Down
26 changes: 10 additions & 16 deletions platform/msm7k/debug.c → platform/msm_shared/debug.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, Google Inc.
* Copyright (c) 2009, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -35,33 +35,31 @@
#include <dev/fbcon.h>
#include <dev/uart.h>

#define DCC_DEBUG 1
#define DEBUG_UART 3
#define FBCON_DEBUG 1

void _dputc(char c)
{
#if DCC_DEBUG
#if WITH_DEBUG_DCC
if (c == '\n') {
while (dcc_putc('\r') < 0);
}
while (dcc_putc(c) < 0);
#else
uart_putc(DEBUG_UART, c);
#endif

#if FBCON_DEBUG && WITH_DEV_FBCON
#if WITH_DEBUG_UART
uart_putc(0, c);
#endif
#if WITH_DEBUG_FBCON && WITH_DEV_FBCON
fbcon_putc(c);
#endif
}

int dgetc(char *c)
{
int n;
#if DCC_DEBUG
#if WITH_DEBUG_DCC
n = dcc_getc();
#elif WITH_DEBUG_UART
n = uart_getc(0, 0);
#else
n = uart_getc(DEBUG_UART, 0);
n = -1;
#endif
if (n < 0) {
return -1;
Expand All @@ -77,7 +75,3 @@ void platform_halt(void)
for(;;);
}

uint32_t debug_cycle_count(void)
{
return 0;
}
1 change: 1 addition & 0 deletions platform/msm_shared/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ OBJS += \
$(LOCAL_DIR)/uart.o \
$(LOCAL_DIR)/timer.o \
$(LOCAL_DIR)/proc_comm.o \
$(LOCAL_DIR)/debug.o \
$(LOCAL_DIR)/smem.o \
$(LOCAL_DIR)/smem_ptable.o \
$(LOCAL_DIR)/hsusb.o \
Expand Down
90 changes: 0 additions & 90 deletions platform/qsd8k/debug.c

This file was deleted.

1 change: 0 additions & 1 deletion platform/qsd8k/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ OBJS += \
$(LOCAL_DIR)/arch_init.o \
$(LOCAL_DIR)/platform.o \
$(LOCAL_DIR)/interrupts.o \
$(LOCAL_DIR)/debug.o \
$(LOCAL_DIR)/gpio.o \
$(LOCAL_DIR)/lcdc.o

Expand Down
5 changes: 4 additions & 1 deletion project/aboot-surf7k.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# top level project rules for the armemu-test project
# top level project rules for the aboot-surf7k project
#
LOCAL_DIR := $(GET_LOCAL_DIR)

TARGET := surf-msm7k

MODULES += app/aboot

#DEFINES += WITH_DEBUG_DCC=1
DEFINES += WITH_DEBUG_UART=1
DEFINES += WITH_DEBUG_FBCON=1
5 changes: 4 additions & 1 deletion project/aboot-surf8k.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# top level project rules for the armemu-test project
# top level project rules for the aboot-surf8k project
#
LOCAL_DIR := $(GET_LOCAL_DIR)

TARGET := surf-qsd8k

MODULES += app/aboot

#DEFINES += WITH_DEBUG_DCC=1
DEFINES += WITH_DEBUG_UART=1
DEFINES += WITH_DEBUG_FBCON=1

0 comments on commit ddf61a2

Please sign in to comment.