Browse Source

add HS0636 beep

Signed-off-by: ninglichen <ninglichen@loongson.cn>
master
ninglichen 5 years ago
committed by Chong Qiao
parent
commit
feea644ff2
  1. 54
      Targets/LS2K/ls2k/start.S

54
Targets/LS2K/ls2k/start.S

@ -591,7 +591,11 @@ cp0_main:
bal tlb_init
nop
#ifdef HS0636
bal HS0636_beep_on
#else
bal beep_on
#endif
nop
li a0, 0x8000
1:
@ -2073,9 +2077,57 @@ LEAF(tgt_getchar)
END(tgt_getchar)
#ifndef BEEP_GPIO
#define BEEP_GPIO 35
#define BEEP_GPIO 39
#endif
LEAF(HS0636_beep_on)
//enable output
li t1, 0xbfe10500 + BEEP_GPIO*4/32
li v1, (1<<(BEEP_GPIO&31))
lw t0, 0(t1)
or t0, v1
xor t0, v1
sw t0, 0(t1)
li t1, 0xbfe10510 + BEEP_GPIO*4/32
li a1, 0x80
222:
li v1, (1<<(BEEP_GPIO&31))
lw t0, 0(t1)
or t0, v1
xor t0, v1
sw t0, 0(t1)
li a0, 0xd
1:
addiu a0, -1
nop
bnez a0, 1b
nop
li v1, (1<<(BEEP_GPIO&31))
lw t0, 0(t1)
or t0, v1
sw t0, 0(t1)
li a0, 0xd
1:
addiu a0, -1
nop
bnez a0, 1b
nop
addiu a1, -1
nop
bnez a1, 222b
nop
jr ra
nop
END(HS0636_beep_on)
LEAF(beep_on)
/* enable gpio35 output */
li t1, 0xbfe10500 + BEEP_GPIO*4/32

Loading…
Cancel
Save