1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - HW - include
3   File:     lcd.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:: 2008-09-18#$
14   $Rev: 8573 $
15   $Author: okubata_ryoma $
16 
17  *---------------------------------------------------------------------------*/
18 
19 #ifndef NITRO_HW_COMMON_LCD_H_
20 #define NITRO_HW_COMMON_LCD_H_
21 
22 #ifdef  __cplusplus
23 extern "C" {
24 #endif
25 
26 /*===========================================================================*/
27 
28 /*---------------------------------------------------------------------------*
29     Constant Definitions
30  *---------------------------------------------------------------------------*/
31 // Number of horizontal dots
32 #define HW_LCD_WIDTH                256 // The number of dots of the display screen width
33 #define HW_LCD_HBLANK               99 // The number of dots in the H-blank interval
34 #define HW_LCD_COLUMNS              ( HW_LCD_WIDTH + HW_LCD_HBLANK )
35 
36 // The number of vertical lines
37 #define HW_LCD_HEIGHT               192 // The number of lines in the display screen height
38 #define HW_LCD_VBLANK               71 // The number of lines in the V-blank interval
39 #define HW_LCD_LINES                ( HW_LCD_HEIGHT + HW_LCD_VBLANK )
40 
41 // LCD clock
42 #define HW_LCD_CLOCK                33513982    // 33.513982 MHz
43 #define HW_LCD_CLOCK_PER_DOT        6  // 6 frequency divisions for LCD clock
44 
45 // H cycle ( 63.5556us )
46 #define HW_LCD_H_CYCLE_NS           ((u32)( 1000000000ULL * HW_LCD_COLUMNS * HW_LCD_CLOCK_PER_DOT / HW_LCD_CLOCK ))
47 #define HW_LCD_H_CYCLE_US           ((u32)(    1000000ULL * HW_LCD_COLUMNS * HW_LCD_CLOCK_PER_DOT / HW_LCD_CLOCK ))
48 #define HW_LCD_H_CYCLE_MS           ((u32)(       1000ULL * HW_LCD_COLUMNS * HW_LCD_CLOCK_PER_DOT / HW_LCD_CLOCK )
49 
50 // V cycle ( 16.7151ms )
51 #define HW_LCD_V_CYCLE_NS           ((u32)( 1000000000ULL * HW_LCD_LINES * HW_LCD_COLUMNS * HW_LCD_CLOCK_PER_DOT / HW_LCD_CLOCK ))
52 #define HW_LCD_V_CYCLE_US           ((u32)(    1000000ULL * HW_LCD_LINES * HW_LCD_COLUMNS * HW_LCD_CLOCK_PER_DOT / HW_LCD_CLOCK ))
53 #define HW_LCD_V_CYCLE_MS           ((u32)(       1000ULL * HW_LCD_LINES * HW_LCD_COLUMNS * HW_LCD_CLOCK_PER_DOT / HW_LCD_CLOCK ))
54 
55 // The time required to scan n lines
56 #define HW_LCD_LINES_CYCLE_NS(n)    ((u32)( 1000000000ULL * (n) * HW_LCD_COLUMNS * HW_LCD_CLOCK_PER_DOT / HW_LCD_CLOCK ))
57 #define HW_LCD_LINES_CYCLE_US(n)    ((u32)(    1000000ULL * (n) * HW_LCD_COLUMNS * HW_LCD_CLOCK_PER_DOT / HW_LCD_CLOCK ))
58 #define HW_LCD_LINES_CYCLE_MS(n)    ((u32)(       1000ULL * (n) * HW_LCD_COLUMNS * HW_LCD_CLOCK_PER_DOT / HW_LCD_CLOCK ))
59 
60 
61 /*===========================================================================*/
62 
63 #ifdef  __cplusplus
64 }       /* extern "C" */
65 #endif
66 
67 #endif /* NITRO_HW_COMMON_LCD_H_ */
68 
69 /*---------------------------------------------------------------------------*
70   End of file
71  *---------------------------------------------------------------------------*/
72