mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
Fix Xduoo X3 bootloader build, and silence all warnings.
Also enable USB bootloader mode Change-Id: I73224c2e694b9941993c89a114b48d2a907e0dfb
This commit is contained in:
parent
35930ddb8d
commit
7e7ca0c858
4 changed files with 136 additions and 6 deletions
|
|
@ -169,3 +169,106 @@ bool dbg_hw_info(void)
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#define CFG_UART_BASE UART1_BASE /* Base of the UART channel */
|
||||
|
||||
void serial_putc (const char c)
|
||||
{
|
||||
volatile u8 *uart_lsr = (volatile u8 *)(CFG_UART_BASE + OFF_LSR);
|
||||
volatile u8 *uart_tdr = (volatile u8 *)(CFG_UART_BASE + OFF_TDR);
|
||||
|
||||
if (c == '\n') serial_putc ('\r');
|
||||
|
||||
/* Wait for fifo to shift out some bytes */
|
||||
while ( !((*uart_lsr & (UARTLSR_TDRQ | UARTLSR_TEMT)) == 0x60) );
|
||||
|
||||
*uart_tdr = (u8)c;
|
||||
}
|
||||
|
||||
void serial_puts (const char *s)
|
||||
{
|
||||
while (*s) {
|
||||
serial_putc (*s++);
|
||||
}
|
||||
}
|
||||
|
||||
void serial_putsf(const char *format, ...)
|
||||
{
|
||||
static char printfbuf[256];
|
||||
int len;
|
||||
unsigned char *ptr;
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
|
||||
ptr = printfbuf;
|
||||
len = vsnprintf(ptr, sizeof(printfbuf), format, ap);
|
||||
va_end(ap);
|
||||
(void)len;
|
||||
|
||||
serial_puts(ptr);
|
||||
serial_putc('\n');
|
||||
}
|
||||
|
||||
void serial_put_hex(unsigned int d)
|
||||
{
|
||||
char c[12];
|
||||
int i;
|
||||
for(i = 0; i < 8;i++)
|
||||
{
|
||||
c[i] = (d >> ((7 - i) * 4)) & 0xf;
|
||||
if(c[i] < 10)
|
||||
c[i] += 0x30;
|
||||
else
|
||||
c[i] += (0x41 - 10);
|
||||
}
|
||||
c[8] = '\n';
|
||||
c[9] = 0;
|
||||
serial_puts(c);
|
||||
|
||||
}
|
||||
void serial_put_dec(unsigned int d)
|
||||
{
|
||||
char c[16];
|
||||
int i;
|
||||
int j = 0;
|
||||
int x = d;
|
||||
|
||||
while (x /= 10)
|
||||
j++;
|
||||
|
||||
for (i = j; i >= 0; i--) {
|
||||
c[i] = d % 10;
|
||||
c[i] += 0x30;
|
||||
d /= 10;
|
||||
}
|
||||
c[j + 1] = '\n';
|
||||
c[j + 2] = 0;
|
||||
serial_puts(c);
|
||||
}
|
||||
|
||||
void serial_dump_data(unsigned char* data, int len)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<len; i++)
|
||||
{
|
||||
unsigned char a = ((*data)>>4) & 0xf;
|
||||
if(a < 10)
|
||||
a += 0x30;
|
||||
else
|
||||
a += (0x41 - 10);
|
||||
serial_putc( a );
|
||||
|
||||
a = (*data) & 0xf;
|
||||
if(a < 10)
|
||||
a += 0x30;
|
||||
else
|
||||
a += (0x41 - 10);
|
||||
serial_putc( a );
|
||||
|
||||
serial_putc( ' ' );
|
||||
|
||||
data++;
|
||||
}
|
||||
|
||||
serial_putc( '\n' );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "cpu.h"
|
||||
|
|
@ -86,11 +86,13 @@ bool button_hold(void)
|
|||
|
||||
int button_read_device(void)
|
||||
{
|
||||
#ifndef BOOTLOADER
|
||||
static bool hold_button = false;
|
||||
bool hold_button_old;
|
||||
|
||||
hold_button_old = hold_button;
|
||||
hold_button = (__gpio_get_pin(PIN_BTN_HOLD) ? true : false);
|
||||
#endif
|
||||
|
||||
int btn = BUTTON_NONE;
|
||||
bool gpio_btn = (__gpio_get_pin(PIN_BTN_POWER) ? false : true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue