1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - RTC - include
3   File:     fifo.h
4 
5   Copyright 2003-2008 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   $Date::            $
14   $Rev:$
15   $Author:$
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef NITRO_RTC_COMMON_FIFO_H_
19 #define NITRO_RTC_COMMON_FIFO_H_
20 
21 #ifdef  __cplusplus
22 extern "C" {
23 #endif
24 
25 /*===========================================================================*/
26 
27 /*---------------------------------------------------------------------------*
28     Constant Definitions
29  *---------------------------------------------------------------------------*/
30 // Protocol-Related Definitions
31 #define RTC_PXI_COMMAND_MASK                0x00007f00  // Mask for command storage portion
32 #define RTC_PXI_COMMAND_SHIFT               8   // Position of command storage portion
33 #define RTC_PXI_RESULT_BIT_MASK             0x00008000  // Mask for portion indicating PXI's response
34 #define RTC_PXI_RESULT_MASK                 0x000000ff  // Mask for the portion that stores processing results
35 #define RTC_PXI_RESULT_SHIFT                0   // Position of storage portion of processing result
36 
37 // PXI Command Definitions
38 #define RTC_PXI_COMMAND_RESET               0x00        // Reset
39 #define RTC_PXI_COMMAND_SET_HOUR_FORMAT     0x01        // Set the time display format
40 #define RTC_PXI_COMMAND_READ_DATETIME       0x10        // Read date and time
41 #define RTC_PXI_COMMAND_READ_DATE           0x11        // Read date
42 #define RTC_PXI_COMMAND_READ_TIME           0x12        // Read time
43 #define RTC_PXI_COMMAND_READ_PULSE          0x13        // Read the pulse output setting value
44 #define RTC_PXI_COMMAND_READ_ALARM1         0x14        // Read the Alarm 1 setting value
45 #define RTC_PXI_COMMAND_READ_ALARM2         0x15        // Read the Alarm 2 setting value
46 #define RTC_PXI_COMMAND_READ_STATUS1        0x16        // Read the Status 1 register
47 #define RTC_PXI_COMMAND_READ_STATUS2        0x17        // Read the Status 2 register
48 #define RTC_PXI_COMMAND_READ_ADJUST         0x18        // Read frequency steady interrupt register
49 #define RTC_PXI_COMMAND_READ_FREE           0x19        // Read the free register
50 #define RTC_PXI_COMMAND_WRITE_DATETIME      0x20        // Write the date and time
51 #define RTC_PXI_COMMAND_WRITE_DATE          0x21        // Write the date
52 #define RTC_PXI_COMMAND_WRITE_TIME          0x22        // Write the time
53 #define RTC_PXI_COMMAND_WRITE_PULSE         0x23        // Write the pulse output setting value
54 #define RTC_PXI_COMMAND_WRITE_ALARM1        0x24        // Write the Alarm 1 setting
55 #define RTC_PXI_COMMAND_WRITE_ALARM2        0x25        // Write the Alarm 2 setting
56 #define RTC_PXI_COMMAND_WRITE_STATUS1       0x26        // Write to the Status 1 register
57 #define RTC_PXI_COMMAND_WRITE_STATUS2       0x27        // Write to the Status 2 register
58 #define RTC_PXI_COMMAND_WRITE_ADJUST        0x28        // Write to frequency steady interrupt register
59 #define RTC_PXI_COMMAND_WRITE_FREE          0x29        // Write to the free register
60 #define RTC_PXI_COMMAND_INTERRUPT           0x30        // To notify that an alarm interrupt has occurred
61 
62 // Response Definitions
63 typedef enum RTCPxiResult
64 {
65     RTC_PXI_RESULT_SUCCESS = 0,        // Processing successful
66     RTC_PXI_RESULT_INVALID_COMMAND,    // Invalid PXI command
67     RTC_PXI_RESULT_ILLEGAL_STATUS,     // Cannot perform processing because of RTC status
68     RTC_PXI_RESULT_BUSY,               // Processing another request
69     RTC_PXI_RESULT_FATAL_ERROR,        // Processing failed due to some other error
70     RTC_PXI_RESULT_MAX
71 }
72 RTCPxiResult;
73 
74 
75 /*===========================================================================*/
76 
77 #ifdef  __cplusplus
78 }       /* extern "C" */
79 #endif
80 
81 #endif /* NITRO_RTC_COMMON_FIFO_H_ */
82 
83 /*---------------------------------------------------------------------------*
84   End of file
85  *---------------------------------------------------------------------------*/
86