CircleOS  1
dma2d_graphic.h
Go to the documentation of this file.
1 /****************** COPYRIGHT (C) 2007-2013 RAISONANCE S.A.S. *****************/
10 /******************************************************************************/
11 
12 /* Includes ------------------------------------------------------------------*/
13 
16 
17 /* Private define ------------------------------------------------------------*/
18 #define MAX_DMA2D_SCREEN 2
19 #define MAX_DMA2D_OBJECT 256
20 
21 #define TEST_BEFORE_TRANSFER 0
22 #define TEST_AFTER_TRANSFER (!TEST_BEFORE_TRANSFER)
23 
24 #define OBJECT_SINGLE_MEMORY_POOL_SIZE (1024*512)
25 
26 /* Private types -------------------------------------------------------------*/
27 typedef u32 color32_t;
28 typedef u8 tpixel24[3];
29 
30 typedef struct sdbmp
31 {
32  u16* mBmpFile;
34  u8* mData;
35  u16 mWidth;
36  u16 mHeight;
41 
42 typedef struct sDMA2D_Object
43 {
44  short int mX[MAX_DMA2D_SCREEN], mY[MAX_DMA2D_SCREEN]; //<! Current position on screen
45  short int mZOrder[MAX_DMA2D_SCREEN]; //<! z_order (index) for each screen where the object is used.
46  struct
47  {
48  int mIsVisible: 1;
49  int mIsRdonly: 1;
50  int mIsPartial: 1;
51  int mIsDirty: 1;
52  int mIsCst: 1;
53  int mFormat: 8;
54  unsigned mAlpha: 8;
55  int mScreenCnt: 3;
56  int mIsDeleted: 1;
57  } mStatus;
58 
59  short int mCurrentRect_x;
60  short int mCurrentRect_y;
61  short int mCurrentRect_width;
62  short int mCurrentRect_height;
66 
67  //Source of the object
68  short int mWidthTotal;
69  short int mHeightTotal;
70 
71  //Part definition
72  short int mWidthUsed;
73  short int mHeightUsed;
74  short int mOffsX;
75  short int mOffsY;
76 
77  union
78  {
81  } mData;
82 
83  //Memory management. The object are created in
84  void* mNextObject;
85  unsigned mSize;
86  unsigned mSizeGraph;
87  union
88  {
91  } mContents;
92 } tDMA2D_Object;
93 
95 
96 typedef struct
97 {
98  struct
99  {
100  int mIsSelected: 1;
101  int mIsDirty: 1;
102  int mWantUpdate: 1;
103  int mOrientation: 2;
104  } mStatus;
107  union
108  {
109  tpixel24 mVerView [PHYS_SCREEN_HEIGHT] [PHYS_SCREEN_WIDTH];
110  tpixel24 mHorView [PHYS_SCREEN_WIDTH] [PHYS_SCREEN_HEIGHT];
111  tpixel24 mArray [PHYS_SCREEN_HEIGHT* PHYS_SCREEN_WIDTH];
112  } mScreenImage;
113 } tDMA2D_Screen;
114 
116 
118 {
119  SELNONE = 0,
120  SELADDR = 1,
121  SELDISP = 2,
122  SELFULL = 3
123 };
124 
125 /* ======================================================== *
126  * The DMA2D_ObjectTransform() is a generic function that *
127  * needs to be associated with the transform functions. *
128  * The tTrans structure defines the the transform that *
129  * will be applied. */
130 typedef int ( *tFctXY )( int x, int y ); // A transform consists into a couple (Fx,Fy) of tFctXY
131 typedef int ( *tFctObjXY )( tDMA2D_pObject obj, int x, int y ); //For the ObjectTransformReverse
132 typedef struct
133 {
134  tFctXY mFctX;
135  tFctXY mFctY;
137 } tTrans;
138 
139 /* Global variables ---------------------------------------------------------*/
141 extern int DisplayedScreen;
142 extern int AddressedScreen;
144 extern coord_t Xmin ;
145 extern coord_t Xmax ;
146 extern coord_t Ymin ;
147 extern coord_t Ymax ;
148 /* switch from on mode to the other by a local ModeLCDAccess variable*/ //NK130708
149 extern enum tModeLCDAccess DMALCD_ModeLCDAccess;
150 extern int LCD_ScreenDirty;
151 extern u16 DMALCD_Register_Table [];
152 
153 /* Public functions ---------------------------------------------------------*/
154 // First general and screen functions.
155 void DMA2D_ScreenInit( void );
156 void DMA2D_Update( void );
157 void DMA2D_SetDrawingMode( int mode, void* obj );
158 void DMA2D_ScreenClear( unsigned int screen, int del );
159 void DMA2D_ScreenSelect( unsigned int screen, enum SELECT_MODE mode );
160 void DMA2D_ScreenSetDirty( unsigned int screen );
161 void DMA2D_ScreenRedraw( unsigned int screen );
162 void DMA2D_ScreenCopy( unsigned int dest, unsigned int src );
163 void DMA2D_Rotate( Rotate_H12_V_Match_TypeDef old_orientation, Rotate_H12_V_Match_TypeDef new_orientation );
164 
165 // Then object specific functions
166 tDMA2D_pObject DMA2D_ObjectCreate( int width, int height, int rdonly );
168 int DMA2D_ObjectSetToScreen( tDMA2D_pObject obj, unsigned int screen );
169 int DMA2D_ObjectAssignBitmap( tDMA2D_pObject obj, void* pbitmap, int format );
170 int DMA2D_ObjectSetPartial( tDMA2D_pObject obj, int width, int height );
171 int DMA2D_ObjectSetOffset( tDMA2D_pObject obj, int offsx, int offsy );
172 int DMA2D_ObjectMove( tDMA2D_pObject obj, int x, int y );
173 void DMA2D_ObjectSetVisible( tDMA2D_pObject obj, int mode );
175 void DMA2D_ObjectSetTransparency( tDMA2D_pObject obj, int transparency );
176 color32_t DMA2D_ObjectGetPixel( tDMA2D_pObject obj, int x, int y );
177 u32 DMA2D_ObjectGetIntersection( unsigned int screen, tDMA2D_pObject obj1, tDMA2D_pObject obj2 );
178 tDMA2D_pObject DMA2D_ObjectFind( unsigned int screen, int x, int y );
179 int DMA2D_ObjectGetPos( tDMA2D_pObject obj, unsigned int screen );
181 int DMA2D_ObjectPushZ( tDMA2D_pObject obj, unsigned int screen );
182 int DMA2D_ObjectPopZ( tDMA2D_pObject obj, unsigned int screen );
183 int DMA2D_ObjectSetForeground( tDMA2D_pObject obj, unsigned int screen );
184 int DMA2D_ObjectSetBackground( tDMA2D_pObject obj, unsigned int screen );
185 void DMA2D_SetTransform( tFctXY fct_X, tFctXY fct_Y ); // To define the current transform action
186 u32 DMA2D_ObjectTransform( tDMA2D_pObject obj_dest, tDMA2D_pObject obj_src, tTrans* trsf );
188 void DMA2D_SDRAM_SwitchToBank( int bank );
189 
193 {
227 };