Subversion Repositories freemyipod

Rev

Rev 687 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 687 Rev 704
Line 46... Line 46...
46
{
46
{
47
    while (UFSTAT & BIT(9)) sleep(100);
47
    while (UFSTAT & BIT(9)) sleep(100);
48
    UTXH = byte;
48
    UTXH = byte;
49
}
49
}
50
 
50
 
-
 
51
void uart_sputc(char byte)
-
 
52
{
-
 
53
    while (UFSTAT & BIT(9));
-
 
54
    UTXH = byte;
-
 
55
}
-
 
56
 
51
void uart_puts(const char* string)
57
void uart_puts(const char* string)
52
{
58
{
53
    char byte;
59
    char byte;
54
    while (byte = *string++) uart_putc(byte);
60
    while (byte = *string++) uart_putc(byte);
55
}
61
}
56
 
62
 
-
 
63
void uart_sputs(const char* string)
-
 
64
{
-
 
65
    char byte;
-
 
66
    while (byte = *string++) uart_sputc(byte);
-
 
67
}
-
 
68
 
57
void uart_write(const char* string, size_t length)
69
void uart_write(const char* string, size_t length)
-
 
70
 
58
{
71
{
59
    while (length--) uart_putc(*string++);
72
    while (length--) uart_putc(*string++);
60
}
73
}
61
 
74
 
-
 
75
void uart_swrite(const char* string, size_t length)
-
 
76
 
-
 
77
{
-
 
78
    while (length--) uart_sputc(*string++);
-
 
79
}
-
 
80
 
62
int uart_getc(int timeout)
81
int uart_getc(int timeout)
63
{
82
{
64
    int byte = -1;
83
    int byte = -1;
65
    long starttime = USEC_TIMER;
84
    long starttime = USEC_TIMER;
66
    while (!(UFSTAT & BITRANGE(0, 3)) && !TIMEOUT_EXPIRED(starttime, timeout)) sleep(100);
85
    while (!(UFSTAT & BITRANGE(0, 3)) && !TIMEOUT_EXPIRED(starttime, timeout)) sleep(100);