1 /*---------------------------------------------------------------------------*
2   Project:  Revolution oslog Demo
3   File:     oslogdemo.c
4 
5   Copyright 2008-2009 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12  *---------------------------------------------------------------------------*/
13 
14 #include <revolution.h>
15 #include <revolution/os/OSLog.h>
16 
17 #define NUM_TEST 4
18 
main()19 void main()
20 {
21     int i;
22     s32 ret;
23 
24     // ------------------------------------------------- //
25     // 1. Write to NAND
26     // ------------------------------------------------- //
27 
28     // Set output destination to NAND
29     ret = OSReportDestination( OS_REPORT_NAND );
30     if(ret != OSLOG_RESULT_OK)
31     {
32         OSReport("Can not set destination of OSReport.\n"); // If output destination was not switched appropriately
33     }
34 
35     // Actually output an OSReport
36     for(i=0; i<NUM_TEST; i++)
37     {
38         OSReport("%d: NAND Write\n", i);
39     }
40 
41     // Actually write to NAND
42     ret = OSReportFlush();
43     if(ret != OSLOG_RESULT_OK)
44     {
45         OSReport("Can not write OSReport log to NAND.\n"); // Failed to write to NAND
46     }
47 
48     // ------------------------------------------------- //
49     // 2. Write to serial
50     // ------------------------------------------------- //
51 
52     // Set output destination to SERIAL
53     ret = OSReportDestination( OS_REPORT_SERIAL );
54     if(ret != OSLOG_RESULT_OK)
55     {
56         OSReport("Can not set destination of OSReport.\n");
57     }
58 
59     // Actually output an OSReport
60     for(i=0; i<NUM_TEST; i++)
61     {
62         OSReport("%d: SERIAL Write\n", i); // Failed in writing to SERIAL
63     }
64 
65     // ------------------------------------------------- //
66     // 3. Write to both NAND and SERIAL
67     // ------------------------------------------------- //
68 
69     // Set output destination to output simultaneously to SERIAL and NAND
70     ret = OSReportDestination( OS_REPORT_NAND | OS_REPORT_SERIAL );
71     if(ret != OSLOG_RESULT_OK)
72     {
73         OSReport("Can not set destination of OSReport.\n"); // If output destination was not switched appropriately
74     }
75 
76     // Actually output an OSReport
77     for(i=0; i<NUM_TEST; i++)
78     {
79         OSReport("%d: SERIAL and NAND Write\n", i);
80     }
81 
82     // Actually write to NAND
83     ret = OSReportFlush();
84     if(ret != OSLOG_RESULT_OK)
85     {
86         OSReport("Can not write OSReport log to NAND.\n"); // Failed to write to NAND
87     }
88 }
89 
90