Search
Project
General
Profile
Sign in
Register
Home
Projects
Redmine shortcuts
Search
:
MityDSP-L138 (ARM9 Based Platforms)
All Projects
Mity CPU Platforms
»
MityDSP-L138 (ARM9 Based Platforms)
Overview
Activity
Wiki
Forums
Download (1.48 KB)
LCD configuration
» fbfill.cpp
Simple frame buffer test pattern generator -
Tim Iskander
, 09/22/2010 01:49 PM
/**
* \file fbfill.cpp
* very simple VGA frame buffer pattern fill
* to compile:
* /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-g++ -o fbfill fbfill.cpp
*
* 2010 (c) Critical Link LLC. This file is licensed under
* the terms of the GNU General Public License version 2. This program
* is licensed "as is" without any warranty of any kind, whether express
* or implied.
*
*/
#include
<stdio.h>
int
main
(
int
argc
,
char
**
argv
)
{
int
w
=
640
;
int
h
=
480
;
int
s
=
h
/
(
8
*
sizeof
(
unsigned
short
));
unsigned
short
bitlane
=
0
;
const
char
*
devname
=
"/dev/fb"
;
FILE
*
fp
=
NULL
;
// un-blank the display
fp
=
fopen
(
"/sys/devices/platform/da8xx_lcdc.0/graphics/fb0/blank"
,
"w"
);
if
(
fp
)
{
fwrite
(
"1
\n
"
,
2
,
1
,
fp
);
fclose
(
fp
);
}
printf
(
"opening %s
\n
"
,
devname
);
fp
=
fopen
(
devname
,
"w"
);
if
(
!
fp
)
{
perror
(
devname
);
return
(
2
);
}
unsigned
short
*
pdata
=
new
unsigned
short
[
w
];
for
(
int
xx
=
0
;
xx
<
(
w
);
++
xx
)
{
pdata
[
xx
]
=
0xFFFF
;
}
fwrite
(
pdata
,
2
,
w
,
fp
);
for
(
int
yy
=
1
;
yy
<
(
h
-
1
);
++
yy
)
{
pdata
[
0
]
=
0xFFFF
;
for
(
int
xx
=
1
;
xx
<
(
w
-
1
);
++
xx
)
{
pdata
[
xx
]
=
1
<<
bitlane
;
}
pdata
[
w
-
1
]
=
0xFFFF
;
fwrite
(
pdata
,
2
,
w
,
fp
);
if
(
yy
&&
(
yy
%
s
==
0
))
++
bitlane
;
}
for
(
int
xx
=
0
;
xx
<
(
w
);
++
xx
)
{
pdata
[
xx
]
=
0xFFFF
;
}
fwrite
(
pdata
,
2
,
w
,
fp
);
delete
[]
pdata
;
return
0
;
}
« Previous
1
2
3
4
5
…
11
Next »
(3-3/11)
Go to top
Loading...