포럼 회원으로 등록하신분만 다운로드가 가능합니다. 최대 업로드 가능한 용량은 20MB 입니다.

간단하게 작성해 보았습니다.

320x240 16bpp를 target으로 했는데, 제 동작할지는 의문이네요......ㅎㅎ

실제로 잘 동작하던 소스에서 발췌만 한 겁니다. 혹 컴파일 안되더라도 몇가지만 수정하시면 될겁니다.
raw format으로 capture가 되니, display쪽은 따로 작성해 주셔야 할겁니다.

s3c24x0 자료실의 logodisp 라는 프로그램이 아마도 있을텐데, 그거 참조하시면 도움이 될겁니다.

그럼....


#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <stdio.h>
#include <sys/mman.h>
#include <errno.h>
#include <math.h>

#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/videodev.h>


#if 1
    #define gprintf(fmt, x... ) printf( "%s: " fmt, __FUNCTION__ , ## x)
#else
    #define gprintf(x...) do { } while (0)
#endif


#define VID_WIDTH      320 /* Default Width */
#define VID_HEIGHT     240 /* Default Height */



#define FB_DEV0     "/dev/fb0" /* Device Name */
//#define FB_DEV2     "/dev/fb2" /* Device Name */

char fb_device[] = FB_DEV0;


int main (int argc, char *argv[])
{
    int fd_fb;
    struct fb_var_screeninfo fbvar;
    struct fb_fix_screeninfo fbfix;
    char *frame_buffer;
    int y, format;
   
   
    int captured = 0;

    fd_fb = open(fb_device, O_RDWR);
    if (fd_fb < 0)
    {
        perror("fbdev open");
        return 0;
    }
    memset(&fbvar, 0, sizeof(fbvar));
    memset(&fbfix, 0, sizeof(fbfix));
    ioctl(fd_fb, FBIOGET_VSCREENINFO, &fbvar);
    ioctl(fd_fb, FBIOGET_FSCREENINFO, &fbfix);

    frame_buffer = (char *) mmap(0, fbfix.smem_len, PROT_READ | PROT_WRITE,MAP_SHARED, fd_fb, 0);
   
    {
        unsigned char r, g, b;
        unsigned short *ghc, data;
        FILE *out;
        int i, j;
       
        out = fopen("./320x240_16bpp.raw", "wb");
        if( out == NULL )
        {
            printf("fopen errorn");
            exit(1);
        }
           
        fwrite(frame_buffer, 320*240*2, 1, out);                   
       
        fclose(out);
    }
               

    return 0;
}



고현철

2009.03.30 00:27:53
*.32.117.22

맨 밑에 return 0 하기전에 framebuffer umap이랑 fb close를 안 했네요......ㅎㅎ
List of Articles
번호 제목 글쓴이 날짜 조회 수sort
53 find 명령어 활용법 고현철 2009-01-30 6272
52 vi 사용법 - block 지정 고현철 2009-01-30 6303
51 유용한 ARM 어셈블리 (if, for, do_while, switch) 김재훈 2009-01-31 6332
50 우분투 리눅스 8.10 네트워크 수동 설정 방법 [2] 김재훈 2009-03-23 6367
49 Embedded Linux Debugging HowTo file 김재훈 2009-04-27 6396
48 iconv euckr_to_utf8 고현철 2009-01-30 6418
47 SDL tslib initialize 고현철 2009-04-09 6426
46 wxWidget hello unix example file 고도리 2008-07-18 6494
45 wxWidget odbc file 고도리 2008-07-18 6565
44 windows/linux에서 작업했던 tutorial입니다. file 고도리 2008-07-18 6626
43 펌웨어 프로그래밍 팁 - atoi() 함수 구현 김재훈 2009-01-31 6806
42 devcpp howto입니다.(devcpp/wxWidget/SDL) file 고도리 2008-07-18 6915
41 wxWidget sample program 올리기 - windows/linux file 고도리 2008-07-18 6935
40 Teach Yourself Shell Programming in 24 Hours file 김재훈 2009-05-17 7081
39 The GNU C Library Reference Manual (한글판) file [3] 김재훈 2009-04-19 7186
38 Linux C++ Programming HowTo file 김재훈 2009-04-26 7193
37 Linux application에서의 clock과 system timer설정 고도리 2011-08-15 7383
36 ARM Developer Suiite (ADS) 메뉴얼 모음 file 김재훈 2009-03-31 7397
35 GStreamer On TI DaVinci and OMAP Platform 강좌 .... 장석원 2009-04-27 7416
34 wxDevcpp를 이용한 windows용 tutorial입니다. file 고도리 2008-07-18 7421

사용자 로그인