포럼 회원으로 등록하신분만 다운로드가 가능합니다. 최대 업로드 가능한 용량은 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 wxWidget sample program 올리기 - windows/linux file 고도리 2008-07-18 6935
52 devcpp howto입니다.(devcpp/wxWidget/SDL) file 고도리 2008-07-18 6915
51 펌웨어 프로그래밍 팁 - atoi() 함수 구현 김재훈 2009-01-31 6801
50 windows/linux에서 작업했던 tutorial입니다. file 고도리 2008-07-18 6626
49 wxWidget odbc file 고도리 2008-07-18 6565
48 wxWidget hello unix example file 고도리 2008-07-18 6494
47 SDL tslib initialize 고현철 2009-04-09 6426
46 iconv euckr_to_utf8 고현철 2009-01-30 6418
45 Embedded Linux Debugging HowTo file 김재훈 2009-04-27 6396
44 우분투 리눅스 8.10 네트워크 수동 설정 방법 [2] 김재훈 2009-03-23 6367
43 유용한 ARM 어셈블리 (if, for, do_while, switch) 김재훈 2009-01-31 6332
42 vi 사용법 - block 지정 고현철 2009-01-30 6303
41 find 명령어 활용법 고현철 2009-01-30 6272
40 VirtualBox 설치 및 환경 설정 가이드 file 김재훈 2009-03-23 6267
39 ARM 7 강좌를 다른 분이 편집한 자료 같네요. file [2] 황순일 2007-12-13 6228
38 펌웨어 프로그래밍 팁 - atox() 함수 구현 김재훈 2009-01-31 6209
37 limxml2 라이브러리를 이용해서 어트리뷰트 값을 가져오는 방법 고현철 2009-01-30 6208
36 유용한 ARM 어셈블리 분기 명령어 시리즈 #2 김재훈 2009-01-31 6146
35 우분투 리눅스 8.10 업데이트 서버 변경 방법 김재훈 2009-03-23 6144
34 응용프로그램 컴파일 시 "config.h"가 없다고 나오는 경우 [1] 김재훈 2009-02-18 6137

사용자 로그인