Skip to content

Commit a245e08

Browse files
committed
Merge pull request #175 from mithro/endings-fix
firmware/lm32: Make all strings end in \r\n rather then just \n.
2 parents 496105f + 102c226 commit a245e08

File tree

12 files changed

+124
-124
lines changed

12 files changed

+124
-124
lines changed

firmware/lm32/ci.c

+44-44
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void print_board_dna(void) {
2828
for(i=0; i<CSR_DNA_ID_SIZE; i++) {
2929
printf("%02x", MMPTR(CSR_DNA_ID_ADDR+4*i));
3030
}
31-
printf("\n");
31+
printf("\r\n");
3232
}
3333

3434
static void help_video_matrix(void)
@@ -121,8 +121,8 @@ static void help(void)
121121

122122
static void version(void)
123123
{
124-
printf("gateware revision: %08x\n", identifier_revision_read());
125-
printf("firmware revision: %08x, built "__DATE__" "__TIME__"\n", MSC_GIT_ID);
124+
printf("gateware revision: %08x\r\n", identifier_revision_read());
125+
printf("firmware revision: %08x, built "__DATE__" "__TIME__"\r\n", MSC_GIT_ID);
126126
}
127127

128128
static void reboot(void)
@@ -132,7 +132,7 @@ static void reboot(void)
132132

133133
static void status_enable(void)
134134
{
135-
printf("Enabling status\n");
135+
printf("Enabling status\r\n");
136136
status_enabled = 1;
137137
#ifdef ENCODER_BASE
138138
encoder_bandwidth_nbytes_clear_write(1);
@@ -141,7 +141,7 @@ static void status_enable(void)
141141

142142
static void status_disable(void)
143143
{
144-
printf("Disabling status\n");
144+
printf("Disabling status\r\n");
145145
status_enabled = 0;
146146
}
147147

@@ -154,15 +154,15 @@ static void status_print(void)
154154
"input0: %dx%d",
155155
hdmi_in0_resdetection_hres_read(),
156156
hdmi_in0_resdetection_vres_read());
157-
printf("\n");
157+
printf("\r\n");
158158
#endif
159159

160160
#ifdef CSR_HDMI_IN1_BASE
161161
printf(
162162
"input1: %dx%d",
163163
hdmi_in1_resdetection_hres_read(),
164164
hdmi_in1_resdetection_vres_read());
165-
printf("\n");
165+
printf("\r\n");
166166
#endif
167167

168168
#ifdef CSR_HDMI_OUT0_BASE
@@ -176,7 +176,7 @@ static void status_print(void)
176176
processor_get_source_name(processor_hdmi_out0_source));
177177
else
178178
printf("off");
179-
printf("\n");
179+
printf("\r\n");
180180
#endif
181181

182182
#ifdef CSR_HDMI_OUT1_BASE
@@ -190,7 +190,7 @@ static void status_print(void)
190190
processor_get_source_name(processor_hdmi_out1_source));
191191
else
192192
printf("off");
193-
printf("\n");
193+
printf("\r\n");
194194
#endif
195195

196196
#ifdef ENCODER_BASE
@@ -207,7 +207,7 @@ static void status_print(void)
207207
encoder_bandwidth_nbytes_clear_write(1);
208208
} else
209209
printf("off");
210-
printf("\n");
210+
printf("\r\n");
211211
#endif
212212
printf("ddr: ");
213213
debug_ddr();
@@ -220,37 +220,37 @@ static void status_service(void)
220220
if(elapsed(&last_event, identifier_frequency_read())) {
221221
if(status_enabled) {
222222
status_print();
223-
printf("\n");
223+
printf("\r\n");
224224
}
225225
}
226226
}
227227

228228
static void video_matrix_list(void)
229229
{
230-
printf("Video sources:\n");
230+
printf("Video sources:\r\n");
231231
#ifdef CSR_HDMI_IN0_BASE
232-
printf("input0: %s\n", HDMI_IN0_MNEMONIC);
232+
printf("input0: %s\r\n", HDMI_IN0_MNEMONIC);
233233
puts(HDMI_IN0_DESCRIPTION);
234234
#endif
235235
#ifdef CSR_HDMI_IN1_BASE
236-
printf("input1: %s\n", HDMI_IN1_MNEMONIC);
236+
printf("input1: %s\r\n", HDMI_IN1_MNEMONIC);
237237
puts(HDMI_IN1_DESCRIPTION);
238238
#endif
239-
printf("pattern:\n");
240-
printf(" Video pattern\n");
239+
printf("pattern:\r\n");
240+
printf(" Video pattern\r\n");
241241
puts(" ");
242-
printf("Video sinks:\n");
242+
printf("Video sinks:\r\n");
243243
#ifdef CSR_HDMI_OUT0_BASE
244-
printf("output0: %s\n", HDMI_OUT0_MNEMONIC);
244+
printf("output0: %s\r\n", HDMI_OUT0_MNEMONIC);
245245
puts(HDMI_OUT0_DESCRIPTION);
246246
#endif
247247
#ifdef CSR_HDMI_OUT1_BASE
248-
printf("output1: %s\n", HDMI_OUT1_MNEMONIC);
248+
printf("output1: %s\r\n", HDMI_OUT1_MNEMONIC);
249249
puts(HDMI_OUT1_DESCRIPTION);
250250
#endif
251251
#ifdef ENCODER_BASE
252-
printf("encoder:\n");
253-
printf(" JPEG Encoder\n");
252+
printf("encoder:\r\n");
253+
printf(" JPEG Encoder\r\n");
254254
#endif
255255
puts(" ");
256256
}
@@ -260,24 +260,24 @@ static void video_matrix_connect(int source, int sink)
260260
if(source >= 0 && source <= VIDEO_IN_PATTERN)
261261
{
262262
if(sink >= 0 && sink <= VIDEO_OUT_HDMI_OUT1) {
263-
printf("Connecting %s to output%d\n", processor_get_source_name(source), sink);
263+
printf("Connecting %s to output%d\r\n", processor_get_source_name(source), sink);
264264
if(sink == VIDEO_OUT_HDMI_OUT0)
265265
#ifdef CSR_HDMI_OUT0_BASE
266266
processor_set_hdmi_out0_source(source);
267267
#else
268-
printf("hdmi_out0 is missing.\n");
268+
printf("hdmi_out0 is missing.\r\n");
269269
#endif
270270
else if(sink == VIDEO_OUT_HDMI_OUT1)
271271
#ifdef CSR_HDMI_OUT1_BASE
272272
processor_set_hdmi_out1_source(source);
273273
#else
274-
printf("hdmi_out1 is missing.\n");
274+
printf("hdmi_out1 is missing.\r\n");
275275
#endif
276276
processor_update();
277277
}
278278
#ifdef ENCODER_BASE
279279
else if(sink == VIDEO_OUT_ENCODER) {
280-
printf("Connecting %s to encoder\n", processor_get_source_name(source));
280+
printf("Connecting %s to encoder\r\n", processor_get_source_name(source));
281281
processor_set_encoder_source(source);
282282
processor_update();
283283
}
@@ -291,18 +291,18 @@ static void video_mode_list(void)
291291
int i;
292292

293293
processor_list_modes(mode_descriptors);
294-
printf("Available video modes:\n");
294+
printf("Available video modes:\r\n");
295295
for(i=0;i<PROCESSOR_MODE_COUNT;i++)
296-
printf("mode %d: %s\n", i, &mode_descriptors[i*PROCESSOR_MODE_DESCLEN]);
297-
printf("\n");
296+
printf("mode %d: %s\r\n", i, &mode_descriptors[i*PROCESSOR_MODE_DESCLEN]);
297+
printf("\r\n");
298298
}
299299

300300
static void video_mode_set(int mode)
301301
{
302302
char mode_descriptors[PROCESSOR_MODE_COUNT*PROCESSOR_MODE_DESCLEN];
303303
if(mode < PROCESSOR_MODE_COUNT) {
304304
processor_list_modes(mode_descriptors);
305-
printf("Setting video mode to %s\n", &mode_descriptors[mode*PROCESSOR_MODE_DESCLEN]);
305+
printf("Setting video mode to %s\r\n", &mode_descriptors[mode*PROCESSOR_MODE_DESCLEN]);
306306
config_set(CONFIG_KEY_RESOLUTION, mode);
307307
processor_start(mode);
308308
}
@@ -313,15 +313,15 @@ static void hdp_toggle(int source)
313313
#if defined(CSR_HDMI_IN0_BASE) || defined(CSR_HDMI_IN1_BASE)
314314
int i;
315315
#endif
316-
printf("Toggling HDP on output%d\n", source);
316+
printf("Toggling HDP on output%d\r\n", source);
317317
#ifdef CSR_HDMI_IN0_BASE
318318
if(source == VIDEO_IN_HDMI_IN0) {
319319
hdmi_in0_edid_hpd_en_write(0);
320320
for(i=0; i<65536; i++);
321321
hdmi_in0_edid_hpd_en_write(1);
322322
}
323323
#else
324-
printf("hdmi_in0 is missing.\n");
324+
printf("hdmi_in0 is missing.\r\n");
325325
#endif
326326
#ifdef CSR_HDMI_IN1_BASE
327327
if(source == VIDEO_IN_HDMI_IN1) {
@@ -330,55 +330,55 @@ static void hdp_toggle(int source)
330330
hdmi_in1_edid_hpd_en_write(1);
331331
}
332332
#else
333-
printf("hdmi_in1 is missing.\n");
333+
printf("hdmi_in1 is missing.\r\n");
334334
#endif
335335
}
336336

337337
#ifdef CSR_HDMI_OUT0_BASE
338338
static void output0_on(void)
339339
{
340-
printf("Enabling output0\n");
340+
printf("Enabling output0\r\n");
341341
hdmi_out0_fi_enable_write(1);
342342
}
343343

344344
static void output0_off(void)
345345
{
346-
printf("Disabling output0\n");
346+
printf("Disabling output0\r\n");
347347
hdmi_out0_fi_enable_write(0);
348348
}
349349
#endif
350350

351351
#ifdef CSR_HDMI_OUT1_BASE
352352
static void output1_on(void)
353353
{
354-
printf("Enabling output1\n");
354+
printf("Enabling output1\r\n");
355355
hdmi_out1_fi_enable_write(1);
356356
}
357357

358358
static void output1_off(void)
359359
{
360-
printf("Disabling output1\n");
360+
printf("Disabling output1\r\n");
361361
hdmi_out1_fi_enable_write(0);
362362
}
363363
#endif
364364

365365
#ifdef ENCODER_BASE
366366
static void encoder_on(void)
367367
{
368-
printf("Enabling encoder\n");
368+
printf("Enabling encoder\r\n");
369369
encoder_enable(1);
370370
}
371371

372372
static void encoder_configure_quality(int quality)
373373
{
374-
printf("Setting encoder quality to %d\n", quality);
374+
printf("Setting encoder quality to %d\r\n", quality);
375375
encoder_set_quality(quality);
376376
}
377377

378378

379379
static void encoder_off(void)
380380
{
381-
printf("Disabling encoder\n");
381+
printf("Disabling encoder\r\n");
382382
encoder_enable(0);
383383
}
384384
#endif
@@ -409,7 +409,7 @@ static void debug_ddr(void)
409409
burstbits = (2*DFII_NPHASES) << DFII_PIX_DATA_SIZE;
410410
rdb = (nr*f >> (24 - log2(burstbits)))/1000000ULL;
411411
wrb = (nw*f >> (24 - log2(burstbits)))/1000000ULL;
412-
printf("read:%5dMbps write:%5dMbps all:%5dMbps\n", rdb, wrb, rdb + wrb);
412+
printf("read:%5dMbps write:%5dMbps all:%5dMbps\r\n", rdb, wrb, rdb + wrb);
413413
}
414414

415415
static char *readstr(void)
@@ -434,7 +434,7 @@ static char *readstr(void)
434434
case '\r':
435435
case '\n':
436436
s[ptr] = 0x00;
437-
putsnonl("\n");
437+
putsnonl("\r\n");
438438
ptr = 0;
439439
return s;
440440
default:
@@ -529,7 +529,7 @@ void ci_service(void)
529529
else if(strcmp(token, "pattern") == 0)
530530
source = VIDEO_IN_PATTERN;
531531
else
532-
printf("Unknown video source: '%s'\n", token);
532+
printf("Unknown video source: '%s'\r\n", token);
533533

534534
/* get video sink */
535535
token = get_token(&str);
@@ -541,7 +541,7 @@ void ci_service(void)
541541
else if(strcmp(token, "encoder") == 0)
542542
sink = VIDEO_OUT_ENCODER;
543543
else
544-
printf("Unknown video sink: '%s'\n", token);
544+
printf("Unknown video sink: '%s'\r\n", token);
545545

546546
if (source >= 0 && sink >= 0)
547547
video_matrix_connect(source, sink);
@@ -656,7 +656,7 @@ void ci_service(void)
656656
}
657657
#endif
658658
if(found == 0)
659-
printf("%s port has no EDID capabilities\n", token);
659+
printf("%s port has no EDID capabilities\r\n", token);
660660
} else
661661
help_debug();
662662
} else {

firmware/lm32/edid.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void get_monitor_name(const void *buf, char *name)
128128

129129
name[MAX_MONITOR_NAME_LEN] = 0;
130130
memcpy(name, &data_block[5], MAX_MONITOR_NAME_LEN);
131-
c = strchr(name, '\n');
131+
c = strchr(name, '\r\n');
132132
if(c)
133133
*c = 0;
134134
}

firmware/lm32/encoder.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ int encoder_set_quality(int quality) {
154154
encoder_quality = quality;
155155
break;
156156
default:
157-
printf("Unsupported encoder quality (50, 75, 85 or 100)\n");
157+
printf("Unsupported encoder quality (50, 75, 85 or 100)\r\n");
158158
return 0;
159159
}
160160
return 1;

0 commit comments

Comments
 (0)