mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-22 19:42:40 -05:00
minor style/comment policing
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14936 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
03f45d3aff
commit
f8ada4b9c1
5 changed files with 37 additions and 35 deletions
|
|
@ -32,4 +32,4 @@ int rtc_read_datetime(unsigned char* buf)
|
||||||
spi_block_transfer(SPI_target_RX5X348AB,
|
spi_block_transfer(SPI_target_RX5X348AB,
|
||||||
&command, 1, buf, 7);
|
&command, 1, buf, 7);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ int button_read_device(void)
|
||||||
btn |= BUTTON_POWER;
|
btn |= BUTTON_POWER;
|
||||||
|
|
||||||
uart1_heartbeat();
|
uart1_heartbeat();
|
||||||
while (uartAvailable())
|
while (uart1_available())
|
||||||
{
|
{
|
||||||
if (uart1_getch(&c))
|
if (uart1_getch(&c))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ struct SPI_info {
|
||||||
volatile unsigned short *clrreg;
|
volatile unsigned short *clrreg;
|
||||||
int bit;
|
int bit;
|
||||||
};
|
};
|
||||||
#define reg(a) (PHY_IO_BASE+a)
|
#define reg(a) ((volatile unsigned short *)(PHY_IO_BASE+a))
|
||||||
struct SPI_info spi_targets[] =
|
struct SPI_info spi_targets[] =
|
||||||
{
|
{
|
||||||
[SPI_target_TSC2100] = { reg(0x0594), reg(0x058E), GIO_TS_ENABLE },
|
[SPI_target_TSC2100] = { reg(0x0594), reg(0x058E), GIO_TS_ENABLE },
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,8 @@
|
||||||
static unsigned char uart1buffer[MAX_UART_BUFFER];
|
static unsigned char uart1buffer[MAX_UART_BUFFER];
|
||||||
int uart1read = 0, uart1write = 0, uart1count = 0;
|
int uart1read = 0, uart1write = 0, uart1count = 0;
|
||||||
|
|
||||||
void do_checksums(char *data, int len, char *xor, char *add)
|
/*
|
||||||
|
static void do_checksums(char *data, int len, char *xor, char *add)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
*xor = data[0];
|
*xor = data[0];
|
||||||
|
|
@ -39,6 +40,7 @@ void do_checksums(char *data, int len, char *xor, char *add)
|
||||||
*add += data[i];
|
*add += data[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void uart_init(void)
|
void uart_init(void)
|
||||||
{
|
{
|
||||||
|
|
@ -60,46 +62,50 @@ void uart_init(void)
|
||||||
IO_INTC_EINT0 |= (1<<IRQ_UART1);
|
IO_INTC_EINT0 |= (1<<IRQ_UART1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void uartPutc(char ch) {
|
void uart1_putc(char ch)
|
||||||
// Wait for room in FIFO
|
{
|
||||||
|
/* Wait for room in FIFO */
|
||||||
while ((IO_UART1_TFCR & 0x3f) >= 0x20);
|
while ((IO_UART1_TFCR & 0x3f) >= 0x20);
|
||||||
|
|
||||||
// Write character
|
/* Write character */
|
||||||
IO_UART1_DTRR=ch;
|
IO_UART1_DTRR=ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unsigned integer to ASCII hexadecimal conversion
|
/* Unsigned integer to ASCII hexadecimal conversion */
|
||||||
void uartPutHex(unsigned int n) {
|
void uart1_putHex(unsigned int n)
|
||||||
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 8; i != 0; i--) {
|
for (i = 8; i != 0; i--) {
|
||||||
unsigned int digit = n >> 28;
|
unsigned int digit = n >> 28;
|
||||||
uartPutc(digit >= 10 ? digit - 10 + 'A' : digit + '0');
|
uart1_putc(digit >= 10 ? digit - 10 + 'A' : digit + '0');
|
||||||
n <<= 4;
|
n <<= 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void uartPuts(const char *str) {
|
void uart1_puts(const char *str)
|
||||||
|
{
|
||||||
char ch;
|
char ch;
|
||||||
while ((ch = *str++) != '\0') {
|
while ((ch = *str++) != '\0') {
|
||||||
uartPutc(ch);
|
uart1_putc(ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void uartGets(char *str, unsigned int size) {
|
void uart1_gets(char *str, unsigned int size)
|
||||||
|
{
|
||||||
for (;;) {
|
for (;;) {
|
||||||
char ch;
|
char ch;
|
||||||
|
|
||||||
// Wait for FIFO to contain something
|
/* Wait for FIFO to contain something */
|
||||||
while ((IO_UART1_RFCR & 0x3f) == 0);
|
while ((IO_UART1_RFCR & 0x3f) == 0);
|
||||||
|
|
||||||
// Read character
|
/* Read character */
|
||||||
ch = (char)IO_UART1_DTRR;
|
ch = (char)IO_UART1_DTRR;
|
||||||
|
|
||||||
// Echo character back
|
/* Echo character back */
|
||||||
IO_UART1_DTRR=ch;
|
IO_UART1_DTRR=ch;
|
||||||
|
|
||||||
// If CR, also echo LF, null-terminate, and return
|
/* If CR, also echo LF, null-terminate, and return */
|
||||||
if (ch == '\r') {
|
if (ch == '\r') {
|
||||||
IO_UART1_DTRR='\n';
|
IO_UART1_DTRR='\n';
|
||||||
if (size) {
|
if (size) {
|
||||||
|
|
@ -108,7 +114,7 @@ void uartGets(char *str, unsigned int size) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append to buffer
|
/* Append to buffer */
|
||||||
if (size) {
|
if (size) {
|
||||||
*str++ = ch;
|
*str++ = ch;
|
||||||
--size;
|
--size;
|
||||||
|
|
@ -116,17 +122,17 @@ void uartGets(char *str, unsigned int size) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int uartPollch(unsigned int ticks) {
|
int uart1_pollch(unsigned int ticks)
|
||||||
|
{
|
||||||
while (ticks--) {
|
while (ticks--) {
|
||||||
if (IO_UART1_RFCR & 0x3f) {
|
if (IO_UART1_RFCR & 0x3f) {
|
||||||
return IO_UART1_DTRR & 0xff;
|
return IO_UART1_DTRR & 0xff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool uartAvailable(void)
|
bool uart1_available(void)
|
||||||
{
|
{
|
||||||
return uart1count > 0;
|
return uart1count > 0;
|
||||||
}
|
}
|
||||||
|
|
@ -134,14 +140,7 @@ bool uartAvailable(void)
|
||||||
void uart1_heartbeat(void)
|
void uart1_heartbeat(void)
|
||||||
{
|
{
|
||||||
char data[5] = {0x11, 0x30, 0x11^0x30, 0x11+0x30, '\0'};
|
char data[5] = {0x11, 0x30, 0x11^0x30, 0x11+0x30, '\0'};
|
||||||
uartPuts(data);
|
uart1_puts(data);
|
||||||
}
|
|
||||||
|
|
||||||
void uartSendData(char* data, int len)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for(i=0;i<len;i++)
|
|
||||||
uartPutc(data[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool uart1_getch(char *c)
|
bool uart1_getch(char *c)
|
||||||
|
|
@ -161,12 +160,14 @@ void UART1(void)
|
||||||
{
|
{
|
||||||
if (IO_UART1_RFCR & 0x3f)
|
if (IO_UART1_RFCR & 0x3f)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (uart1count >= MAX_UART_BUFFER)
|
if (uart1count >= MAX_UART_BUFFER)
|
||||||
panicf("UART1 buffer overflow");
|
panicf("UART1 buffer overflow");
|
||||||
|
*/
|
||||||
uart1buffer[uart1write] = IO_UART1_DTRR & 0xff;
|
uart1buffer[uart1write] = IO_UART1_DTRR & 0xff;
|
||||||
uart1write = (uart1write+1) % MAX_UART_BUFFER;
|
uart1write = (uart1write+1) % MAX_UART_BUFFER;
|
||||||
uart1count++;
|
uart1count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
IO_INTC_IRQ0 = (1<<IRQ_UART1);
|
IO_INTC_IRQ0 = (1<<IRQ_UART1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,12 @@
|
||||||
void uart_init(void);
|
void uart_init(void);
|
||||||
bool uart1_getch(char *c);
|
bool uart1_getch(char *c);
|
||||||
void uart1_heartbeat(void);
|
void uart1_heartbeat(void);
|
||||||
|
bool uart1_available(void);
|
||||||
|
|
||||||
void uartPuts(const char *str);
|
void uart1_puts(const char *str);
|
||||||
void uartGets(char *str, unsigned int size);
|
void uart1_gets(char *str, unsigned int size);
|
||||||
int uartPollch(unsigned int ticks);
|
int uart1_pollch(unsigned int ticks);
|
||||||
void uartPutc(char ch);
|
void uart1_putc(char ch);
|
||||||
void uartPutHex(unsigned int n);
|
void uart1_putHex(unsigned int n);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue