Browse Source

r655@Knoppix: root | 2008-02-19 08:21:57 +0800

add poweroff support,ohci has bug,if not OUTPUT_TO_BOTH,should delay(1000) in interrupt handler,why?


git-svn-id: file:///svn/pmon-all/pmon-all@199 214b0138-1524-0410-9122-e5cb4b5bc56c
master
cpu 17 years ago
parent
commit
a3f04fbce4
  1. 14
      Targets/Bonito2fdev/Bonito/mycmd.c
  2. 16
      Targets/Bonito2fdev/Bonito/tgt_machdep.c
  3. 2
      lib/libc/arch/mips/Makefile.inc
  4. 4
      lib/libc/arch/mips/poweroff.c
  5. 12
      lib/libc/arch/mips/reboot.c
  6. 18
      pmon/cmds/miscmds.c
  7. 3
      sys/dev/usb/usb-ohci.c

14
Targets/Bonito2fdev/Bonito/mycmd.c

@ -669,11 +669,25 @@ static const Cmd Cmds[] =
{0, 0}
};
#ifdef DEVBD2F_SM502
int power_button_poll(void *unused)
{
int cause;
volatile int *p=0xbfe0011c;
asm("mfc0 %0,$13":"=r"(cause));
if(cause&(1<<10))tgt_poweroff();
return 0;
}
#endif
static void init_cmd __P((void)) __attribute__ ((constructor));
static void
init_cmd()
{
#ifdef DEVBD2F_SM502
tgt_poll_register(1, power_button_poll, 0);
#endif
cmdlist_expand(Cmds, 1);
}

16
Targets/Bonito2fdev/Bonito/tgt_machdep.c

@ -544,18 +544,14 @@ tgt_poweroff()
while(1);
}
#else
#elif defined(DEVBD2F_SM502)
void
tgt_reboot()
tgt_poweroff()
{
void (*longreach) __P((void));
longreach = (void *)0xbfc00000;
(*longreach)();
while(1);
volatile int *p=0xbfe0011c;
p[1]&=~1;
p[0]&=~1;
p[0]|=1;
}
#endif

2
lib/libc/arch/mips/Makefile.inc

@ -59,4 +59,4 @@ SRCS+= argvize.c atob.c atof.c atoi.c atol.c bzero.c bcmp.c calloc.c \
cfgetospeed.c cfmakeraw.c cfsetispeed.c cfsetospeed.c \
cfsetspeed.c ulmin.c lmin.c ioctl.c filefs.c parseurl.c
SRCS+= longjmp.S ovbcopy.S
SRCS+= longjmp.S ovbcopy.S poweroff.c reboot.c

4
lib/libc/arch/mips/poweroff.c

@ -0,0 +1,4 @@
void tgt_poweroff()
{
printf("arch does not support poweroff\n");
}

12
lib/libc/arch/mips/reboot.c

@ -0,0 +1,12 @@
void
tgt_reboot()
{
void (*longreach) (void);
longreach = (void *)0xbfc00000;
(*longreach)();
while(1);
}

18
pmon/cmds/miscmds.c

@ -115,6 +115,16 @@ cmd_reboot (ac, av)
return(0); /* Shut up gcc */
}
int
cmd_poweroff (ac, av)
int ac;
char *av[];
{
printf ("poweroff...\n");
tgt_poweroff();
return(0);
}
static const Cmd Cmds[] =
{
{"Misc"},
@ -126,6 +136,14 @@ static const Cmd Cmds[] =
0,
"reboot system",
cmd_reboot, 1, 99, 0},
{"poweroff", "",
0,
"reboot system",
cmd_poweroff, 1, 99, 0},
{"halt", "",
0,
"reboot system",
cmd_poweroff, 1, 99, 0},
{0, 0}
};

3
sys/dev/usb/usb-ohci.c

@ -1886,6 +1886,9 @@ static int hc_interrupt (void *hc_data)
stat = dl_done_list (ohci, dl_reverse_done_list (ohci));
printf("td index=%x/%x\n", td->index, urb_priv(0,td).length);
} else {
#ifndef OUTPUT_TO_BOTH
delay(1000);//fixme
#endif
stat = dl_done_list (ohci, dl_reverse_done_list (ohci));
}

Loading…
Cancel
Save