Subversion Repositories freemyipod

Rev

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

Rev 59 Rev 85
Line 49... Line 49...
49
}
49
}
50
 
50
 
51
void cputc_internal(unsigned int consoles, char string) ICODE_ATTR;
51
void cputc_internal(unsigned int consoles, char string) ICODE_ATTR;
52
void cputc_internal(unsigned int consoles, char string)
52
void cputc_internal(unsigned int consoles, char string)
53
{
53
{
-
 
54
#ifdef HAVE_LCD
54
    if (consoles & 1) lcdconsole_putc(string, 0, -1);
55
    if (consoles & 1) lcdconsole_putc(string, 0, -1);
-
 
56
#endif
-
 
57
#ifdef HAVE_USB
55
    if (consoles & 2) dbgconsole_putc(string);
58
    if (consoles & 2) dbgconsole_putc(string);
-
 
59
#endif
56
}
60
}
57
 
61
 
58
static int cprfunc(void* ptr, unsigned char letter)
62
static int cprfunc(void* ptr, unsigned char letter)
59
{
63
{
60
    struct for_cprintf* pr = (struct for_cprintf*)ptr;
64
    struct for_cprintf* pr = (struct for_cprintf*)ptr;
Line 102... Line 106...
102
}
106
}
103
 
107
 
104
void cputs(unsigned int consoles, const char* string)
108
void cputs(unsigned int consoles, const char* string)
105
{
109
{
106
    mutex_lock(&console_mutex, TIMEOUT_BLOCK);
110
    mutex_lock(&console_mutex, TIMEOUT_BLOCK);
-
 
111
#ifdef HAVE_LCD
107
    if (consoles & 1) lcdconsole_puts(string, 0, -1);
112
    if (consoles & 1) lcdconsole_puts(string, 0, -1);
-
 
113
#endif
-
 
114
#ifdef HAVE_USB
108
    if (consoles & 2) dbgconsole_puts(string);
115
    if (consoles & 2) dbgconsole_puts(string);
-
 
116
#endif
109
    mutex_unlock(&console_mutex);
117
    mutex_unlock(&console_mutex);
110
}
118
}
111
 
119
 
112
void cwrite(unsigned int consoles, const char* string, size_t length)
120
void cwrite(unsigned int consoles, const char* string, size_t length)
113
{
121
{
114
    mutex_lock(&console_mutex, TIMEOUT_BLOCK);
122
    mutex_lock(&console_mutex, TIMEOUT_BLOCK);
-
 
123
#ifdef HAVE_LCD
115
    if (consoles & 1) lcdconsole_write(string, length, 0, -1);
124
    if (consoles & 1) lcdconsole_write(string, length, 0, -1);
-
 
125
#endif
-
 
126
#ifdef HAVE_USB
116
    if (consoles & 2) dbgconsole_write(string, length);
127
    if (consoles & 2) dbgconsole_write(string, length);
-
 
128
#endif
117
    mutex_unlock(&console_mutex);
129
    mutex_unlock(&console_mutex);
118
}
130
}
119
 
131
 
120
void cflush(unsigned int consoles)
132
void cflush(unsigned int consoles)
121
{
133
{
122
    mutex_lock(&console_mutex, TIMEOUT_BLOCK);
134
    mutex_lock(&console_mutex, TIMEOUT_BLOCK);
-
 
135
#ifdef HAVE_LCD
123
    if (consoles & 1) lcdconsole_update();
136
    if (consoles & 1) lcdconsole_update();
-
 
137
#endif
124
    mutex_unlock(&console_mutex);
138
    mutex_unlock(&console_mutex);
125
}
139
}
126
 
140
 
127
int cgetc(unsigned int consoles, int timeout)
141
int cgetc(unsigned int consoles, int timeout)
128
{
142
{
129
    int result;
143
    int result;
130
    mutex_lock(&console_readmutex, TIMEOUT_BLOCK);
144
    mutex_lock(&console_readmutex, TIMEOUT_BLOCK);
-
 
145
#ifdef HAVE_USB
131
    if ((consoles & 2) && (result = dbgconsole_getc(timeout)) != -1) return result;
146
    if ((consoles & 2) && (result = dbgconsole_getc(timeout)) != -1) return result;
-
 
147
#endif
132
    mutex_unlock(&console_mutex);
148
    mutex_unlock(&console_mutex);
133
}
149
}
134
 
150
 
135
int cread(unsigned int consoles, char* buffer, size_t length, int timeout)
151
int cread(unsigned int consoles, char* buffer, size_t length, int timeout)
136
{
152
{
137
    int result;
153
    int result;
138
    mutex_lock(&console_readmutex, TIMEOUT_BLOCK);
154
    mutex_lock(&console_readmutex, TIMEOUT_BLOCK);
-
 
155
#ifdef HAVE_USB
139
    if ((consoles & 2) && (result = dbgconsole_read(buffer, length, timeout))) return result;
156
    if ((consoles & 2) && (result = dbgconsole_read(buffer, length, timeout))) return result;
-
 
157
#endif
140
    mutex_unlock(&console_mutex);
158
    mutex_unlock(&console_mutex);
141
}
159
}
142
 
160
 
143
void creada(unsigned int consoles, char* buffer, size_t length, int timeout)
161
void creada(unsigned int consoles, char* buffer, size_t length, int timeout)
144
{
162
{
145
    int result;
163
    int result;
146
    mutex_lock(&console_readmutex, TIMEOUT_BLOCK);
164
    mutex_lock(&console_readmutex, TIMEOUT_BLOCK);
147
    while (length)
165
    while (length)
148
    {
166
    {
-
 
167
#ifdef HAVE_USB
149
        if (length && (consoles & 2) && (result = dbgconsole_read(buffer, length, timeout)))
168
        if (length && (consoles & 2) && (result = dbgconsole_read(buffer, length, timeout)))
150
        {
169
        {
151
            buffer = &buffer[result];
170
            buffer = &buffer[result];
152
            length -= result;
171
            length -= result;
153
        }
172
        }
-
 
173
#endif
154
    }
174
    }
155
    mutex_unlock(&console_mutex);
175
    mutex_unlock(&console_mutex);
156
}
176
}