CircleOS
1
Main Page
Related Pages
Data Structures
Files
File List
Globals
Z:
Repository
Circle
OS
Hardware
Open4
STM32
STM3242x
inc
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
;
33
u16
mCompressionMethod
;
34
u8*
mData
;
35
u16
mWidth
;
36
u16
mHeight
;
37
u16
mBitPerPixel
;
38
u16
mNumberOfColorInPalette
;
39
u8*
mColorTable
;
40
}
tBmpDescriptor
;
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
;
63
short
int
mCurrentRect_relpos_x
;
64
short
int
mCurrentRect_relpos_y
;
65
short
int
mCurrentRect_transparency
;
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
{
79
color32_t
*
mBitmap
;
80
color32_t
mARGB_Cst
;
81
}
mData
;
82
83
//Memory management. The object are created in
84
void
*
mNextObject
;
85
unsigned
mSize
;
86
unsigned
mSizeGraph
;
87
union
88
{
89
color32_t
mDynamicImage
[1];
90
tBmpDescriptor
mBmpDesc
;
91
}
mContents
;
92
}
tDMA2D_Object
;
93
94
typedef
tDMA2D_Object
*
tDMA2D_pObject
;
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;
105
tDMA2D_pObject
mObjectTable [
MAX_DMA2D_OBJECT
];
106
int
mObjectCount
;
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
115
typedef
tDMA2D_Screen
*
tDMA2D_pScreen
;
116
117
enum
SELECT_MODE
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;
136
u32
mDefaultColor
;
137
}
tTrans
;
138
139
/* Global variables ---------------------------------------------------------*/
140
extern
tDMA2D_Screen
LCD_ScreenImage
[
MAX_DMA2D_SCREEN
];
141
extern
int
DisplayedScreen
;
142
extern
int
AddressedScreen
;
143
extern
tDMA2D_pObject
SelectedObject
;
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 );
167
void
DMA2D_ObjectDelete
(
tDMA2D_pObject
obj );
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 );
174
int
DMA2D_ObjectSelect
(
tDMA2D_pObject
obj );
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 );
180
u32
DMA2D_ObjectGetImage
(
tDMA2D_pObject
obj );
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 );
187
u32
DMA2D_ObjectTransformReverse
(
tDMA2D_pObject
obj_dest,
tDMA2D_pObject
obj_src,
tFctObjXY
fct );
188
void
DMA2D_SDRAM_SwitchToBank
(
int
bank );
189
192
enum
CD_DMA2D_FCT
193
{
194
CD_SCREENINIT
= 0,
195
CD_UPDATE
= 1,
196
CD_UNUSED_2
= 2,
197
CD_SCREENCLEAR
= 3,
198
CD_SCREENSELECT
= 4,
199
CD_SCREENSETDIRTY
= 5,
200
CD_SCREENREDRAW
= 6,
201
CD_SCREENCOPY
= 7,
202
CD_SCREENUNUSED
= 8,
203
CD_OBJECTCREATE
= 9,
204
CD_OBJECTDELETE
= 10,
205
CD_OBJECTSETTOSCREEN
= 11,
206
CD_OBJECTASSIGNBITMAP
= 12,
207
CD_OBJECTSETPARTIAL
= 13,
208
CD_OBJECTMOVE
= 14,
209
CD_OBJECTSETVISIBLE
= 15,
210
CD_OBJECTSELECT
= 16,
211
CD_OBJECTSETTRANSPARENCY
= 17,
212
CD_OBJECTGETPIXEL
= 18,
213
CD_OBJECTGETINTERSECTION
= 19,
214
CD_OBJECTGETPOS
= 20,
215
CD_OBJECTGETSIZE
= 21,
216
CD_OBJECTFIND
= 22,
217
CD_OBJECTGETIMAGE
= 23,
218
CD_OBJECTSETOFFSET
= 24,
219
CD_OBJECTPOPZ
= 25,
220
CD_OBJECTPUSHZ
= 26,
221
CD_OBJECTSETFOREGROUND
= 27,
222
CD_OBJECTSETBACKGROUND
= 28,
223
CD_SETTRANSFORM
= 29,
224
CD_OBJECTTRANSFORM
= 30,
225
CD_OBJECTTRANSFORMREVERSE
= 31,
226
CD_SDRAMBANKSWITCH
= 32,
227
};