summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo C2014-11-25 10:47:55 +0100
committerLeo C2014-11-25 10:47:55 +0100
commitc79c80b49dcde54add2e9ba323c9d07033723f52 (patch)
treefbf980c28880e9ed948d8d21feb8d98707d28eda
parent1222f338a23212010c7e2d0d7c3a2861e42fa8df (diff)
downloadz180-stamp-c79c80b49dcde54add2e9ba323c9d07033723f52.zip
Enable pullups on all gpio pins. cleanup
-rw-r--r--avr/cmd_help.c23
-rw-r--r--avr/command.c13
-rw-r--r--avr/command_tbl.c2
-rw-r--r--avr/con-utils.c3
-rw-r--r--avr/main.c4
-rw-r--r--avr/z180-serv.c19
6 files changed, 11 insertions, 53 deletions
diff --git a/avr/cmd_help.c b/avr/cmd_help.c
index b42fc87..8f81b2d 100644
--- a/avr/cmd_help.c
+++ b/avr/cmd_help.c
@@ -7,26 +7,3 @@ command_ret_t do_help(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
const int len = cmd_tbl_item_count();
return _do_help(cmd_tbl, len, cmdtp, flag, argc, argv);
}
-
-
-#if 0
-
-U_BOOT_CMD(
- help, CONFIG_SYS_MAXARGS, 1, do_help,
- "print command description/usage",
- "\n"
- " - print brief description of all commands\n"
- "help command ...\n"
- " - print detailed usage of 'command'"
-);
-
-/* This does not use the U_BOOT_CMD macro as ? can't be used in symbol names */
-ll_entry_declare(cmd_tbl_t, question_mark, cmd) = {
- "?", CONFIG_SYS_MAXARGS, 1, do_help,
- "alias for 'help'",
-#ifdef CONFIG_SYS_LONGHELP
- ""
-#endif /* CONFIG_SYS_LONGHELP */
-};
-
-#endif
diff --git a/avr/command.c b/avr/command.c
index bb88794..c080527 100644
--- a/avr/command.c
+++ b/avr/command.c
@@ -6,7 +6,6 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#include <stdio.h>
#include "config.h"
#include "print-utils.h"
@@ -35,7 +34,7 @@ int strcmp_PP(const FLASH char *s1, const FLASH char *s2)
{
unsigned char c1, c2;
- while ((c1 = *(const FLASH unsigned char *)s1++)
+ while ((c1 = *(const FLASH unsigned char *)s1++)
== (c2 = *(const FLASH unsigned char *)s2++))
if (c1 == 0)
return 0;
@@ -43,9 +42,9 @@ int strcmp_PP(const FLASH char *s1, const FLASH char *s2)
return c1 - c2;
}
-int cmpstringp(const void *p1, const void *p2)
+int cmpstring_PP(const void *p1, const void *p2)
{
- return strcmp_PP((*(const FLASH cmd_tbl_t **) p1)->name,
+ return strcmp_PP((*(const FLASH cmd_tbl_t **) p1)->name,
(*(const FLASH cmd_tbl_t **) p2)->name);
}
@@ -87,7 +86,7 @@ command_ret_t _do_help(cmd_tbl_t *cmd_start, int cmd_items, cmd_tbl_t * cmdtp,
}
/* Sort command list */
- qsort(cmd_array, cmd_items, sizeof (cmd_tbl_t *), cmpstringp);
+ qsort(cmd_array, cmd_items, sizeof (cmd_tbl_t *), cmpstring_PP);
/* print short help (usage) */
for (i = 0; i < cmd_items; i++) {
@@ -98,10 +97,10 @@ command_ret_t _do_help(cmd_tbl_t *cmd_start, int cmd_items, cmd_tbl_t * cmdtp,
return CMD_RET_FAILURE;
if (usage == NULL)
continue;
-#ifdef GCC_BUG_61443
+#ifdef GCC_BUG_61443
print_usage_line(cmd_array[i]->name, max_len, usage);
#else
- printf_P(PSTR("%-" stringify(8) /*FIXME*/ "S - %S\n"),
+ printf_P(PSTR("%-" stringify(8) /*FIXME*/ "S - %S\n"),
cmd_array[i]->name, usage);
#endif
}
diff --git a/avr/command_tbl.c b/avr/command_tbl.c
index 6b53fad..61c61a6 100644
--- a/avr/command_tbl.c
+++ b/avr/command_tbl.c
@@ -190,7 +190,7 @@ CMD_TBL_ITEM(
"addr1 addr2 count"
),
CMD_TBL_ITEM(
- base, 2, 1, do_mem_base,
+ base, 2, 0, do_mem_base,
"print or set address offset",
"\n"
" - print address offset for memory commands\n"
diff --git a/avr/con-utils.c b/avr/con-utils.c
index b8017ed..f4023ff 100644
--- a/avr/con-utils.c
+++ b/avr/con-utils.c
@@ -15,7 +15,7 @@ uint_fast8_t tstc(void)
int my_getchar(uint_fast8_t waitforchar)
{
int c;
-
+
do {
bg_shed();
c = serial_getc();
@@ -92,4 +92,3 @@ void clear_ctrlc(void)
{
ctrlc_was_pressed = 0;
}
-
diff --git a/avr/main.c b/avr/main.c
index af082a3..7e832bf 100644
--- a/avr/main.c
+++ b/avr/main.c
@@ -19,6 +19,7 @@
#include "env.h"
#include "z180-serv.h"
#include "spi.h"
+#include "gpio.h"
static uint8_t mcusr;
@@ -229,7 +230,8 @@ int main(void)
{
setup_avr();
z80_setup_bus();
-
+ for (int i = 0; i < GPIO_MAX; i++)
+ gpio_config(i, INPUT_PULLUP);
env_init();
if (reset_reason_is_power_on())
diff --git a/avr/z180-serv.c b/avr/z180-serv.c
index a920465..e3bca16 100644
--- a/avr/z180-serv.c
+++ b/avr/z180-serv.c
@@ -218,22 +218,6 @@ void restart_z180_serv(void)
/*--------------------------------------------------------------------------*/
-#if 0
-void dump_mem(const FLASH uint8_t *addr, uint32_t len)
-{
- DBG_P(1, "hdrom dump:");
- while (len) {
- DBG_P(1, "\n %.5x:", addr);
- for (unsigned i = 0; i<16; i++)
- DBG_P(1, " %.2x", *addr++);
- len -= len > 16 ? 16 : len;
- }
- DBG_P(1, "\n");
-}
-#endif
-/*--------------------------------------------------------------------------*/
-
-
const FLASH uint8_t iniprog[] = {
0xAF, // xor a
0xED, 0x39, 0x36, // out0 (rcr),a ;disable DRAM refresh
@@ -283,6 +267,3 @@ const FLASH uint8_t test1[] = {
0x00, // db 0 ;dst
0x00, 0x00, // dw 0 ;count (64k)
};
-
-
-