교육지원 IT시스템 선진화

Size: px
Start display at page:

Download "교육지원 IT시스템 선진화"

Transcription

1 Module 9: Framebuffer programming ESP30076 임베디드시스템프로그래밍 (Embedded System Programming) 조윤석 전산전자공학부

2 주차별목표 프레임버퍼알아보기 프레임버퍼이해하기 프레임버퍼제어하기 간단한프레임버퍼프로그래밍 프레임버퍼라이브러리만들기 프레임버퍼라이브러리용기본함수만들기 프레임버퍼에 BMP 이미지출력하기 2

3 프레임버퍼 (Frame buffer) Frame buffer (FB) 는그래픽하드웨어를추상화 (abstraction) 해줌 일반적으로 FB 는비디오하드웨어에있는 frame buffer 를표현함 FB 를사용하면응용소프트웨어에서는미리정의되어진인터페이스를통해그래픽하드웨어에손쉽게 access 하여그래픽요소를표현할수있음 따라서소프트웨어개발자는하드웨어레지스터나컨트롤러등의저수준특성에대한지식이없어도됨. Frame buffer driver User level application 에서손쉽게 frame buffer 를사용할수있도록지원하는 device driver 3

4 프레임버퍼 (Frame buffer) LCD 에데이터를출력하는과정 4

5 프레임버퍼 (Frame buffer) 제어 프레임버퍼구조체 Frame buffer 와관련된헤더파일은 linux/fb.h 에정의되어있음 fb_fix_screeninfo Frame buffer 의총메모리에대한정보등을가지고있음 프레임버퍼와관련된고정된 (fix) 정보를관리 fb_var_screeninfo Resolution, bpp (bit per pixel) 등에대한정보를가지고있음 프레임버퍼와관련된가변정보들을가지고있음 5

6 프레임버퍼 (Frame buffer) 제어 프레임버퍼구조체 6 fb_fix_screeninfo struct fb_fix_screeninfo { char id[16];/* identification string eg "TT Builtin" */ unsigned long smem_start; /* Start of frame buffer mem */ /* (physical address) */ u32 smem_len; /* Length of frame buffer mem */ u32 type;/* see FB_TYPE_* */ u32 type_aux; /* Interleave for interleaved Planes */ u32 visual; /* see FB_VISUAL_* */ u16 xpanstep; /* zero if no hardware panning */ u16 ypanstep; /* zero if no hardware panning */ u16 ywrapstep; /* zero if no hardware ywrap */ u32 line_length; /* length of a line in bytes */ unsigned long mmio_start; /* Start of Memory Mapped I/O */ ; /* (physical address) */ u32 mmio_len; /* Length of Memory Mapped I/O */ u32 accel; /* Type of acceleration available */ u16 reserved[3]; /* Reserved for future compatibility */

7 프레임버퍼 (Frame buffer) 제어 프레임버퍼구조체 fb_var_screeninfo struct fb_var_screeninfo { u32 xres; /* visible resolution */ u32 yres; u32 xres_virtual; /* virtual resolution */ u32 yres_virtual; u32 xoffset; /* offset from virtual to visible */ */ u32 yoffset; /* resolution */ u32 bits_per_pixel; /* guess what */ u32 grayscale; /*!= 0 Graylevels instead of colors */ struct fb_bitfield red; /* bitfield in fbmem if true color, */ struct fb_bitfield green; /* else only length is significant struct fb_bitfield blue; struct fb_bitfieldtransp; /* transparency */ 7

8 프레임버퍼 (Frame buffer) 제어 프레임버퍼구조체 fb_var_screeninfo ; u32 nonstd; /*!= 0 Non standard pixel format */ u32 activate; /* see FB_ACTIVATE_* */ u32 height; /* height of picture in mm */ u32 width; /* width of picture in mm */ u32 accel_flags; /* acceleration flags (hints) */ /* Timing: All values in pixclocks, except pixclock (of course) */ u32 pixclock; /* pixel clock in ps (pico seconds) */ u32 left_margin; /* time from sync to picture */ u32 right_margin; /* time from picture to sync */ u32 upper_margin; /* time from sync to picture */ u32 lower_margin; u32 hsync_len; /* length of horizontal sync */ u32 vsync_len; /* length of vertical sync */ u32 sync;/* see FB_SYNC_* */ u32 vmode; /* see FB_VMODE_* */ u32 reserved[6]; /* Reserved for future compatibility */ 8

9 프레임버퍼 (Frame buffer) 제어 프레임버퍼구조체 프레임버퍼구조체의값들을변경할수도있음 프레임버퍼장치의기본정보는시스템콜 ioctl() 을사용하여읽어오거나변경할수있음 ioctl() 함수의옵션들은 linux/fb.h 헤더파일내에선언되어있음 9 /* ioctls 0x46 is 'F'*/ #define FBIOGET_VSCREENINFO #define FBIOPUT_VSCREENINFO #define FBIOGET_FSCREENINFO #define FBIOGETCMAP 0x4604 #define FBIOPUTCMAP 0x4605 #define FBIOPAN_DISPLAY 0x ( 생략 ) #define FBIOPUT_MODEINFO 0x4617 #define FBIOGET_DISPINFO 0x4618 0x4600 0x4601 0x4602

10 프레임버퍼 (Frame buffer) 제어 프레임버퍼구조체 ioctl() 함수를이용하여시스템콜을통해커널이관리하고있는프레임버퍼정보를가지고오거나프레임버퍼설정을변경하는내용을적용하는예시 ioctl_ret = ioctl(fb_fd, FBIOGET_VSCREENINFO, &fbvar); ioctl_ret = ioctl(fb_fd, FBIOGET_FSCREENINFO, &fbfix); fbvar.bits_per_pixel = 8; ioctl_ret = ioctl(fb_fd, FBIOPUT_VSCREENINFO, &fbvar); 10

11 LCD 정보를읽어오는프로그램작성 LCD 정보읽어오기 프레임버퍼드라이버로부터설정된 LCD 정보를읽어오거나변경하려면 ioctl() 을사용 ioctl() 을사용하여 LCD 정보를읽어오고, 일부내용을변경하여적용하는프로그램을작성해보기 드라이버에접근하여스크린과관련된고정정보와가변정보를읽어온다음, 해상도와컬러색상수 (bits per pixel; bpp) 그리고프레임버퍼메모리의크기를화면에출력 컬러색상수를변경하여드라이버에변경된내용을반영해보기 11

12 LCD 정보를읽어오는프로그램작성 LCD 정보읽어오기 프로그램작성하기 mkdir /root/work/fb mkdir /root/work/fb/fb_information cd /root/work/fb/fb_information vi fbinfo.c 12

13 LCD 정보를읽어오는프로그램작성 LCD 정보읽어오기 fbinfo.c /* Framebuffer information display FILE : fbinfo.c */ #include <stdio.h> #include <fcntl.h> /* for O_RDWR */ #include <sys/ioctl.h> /* for ioctl */ #include <linux/fb.h> /* frame buffer header */ #define FBDEVFILE "/dev/fb0" int main(int argc, char* argv) { int fb_fd; int ioctl_ret; struct fb_var_screeninfo fbvar; struct fb_fix_screeninfo fbfix; fb_fd = open(fbdevfile, O_RDWR); // open the device node for frame buffer 13

14 LCD 정보를읽어오는프로그램작성 LCD 정보읽어오기 fbinfo.c if(fb_fd<0){ perror(fbdevfile); return -1; ioctl_ret = ioctl(fb_fd, FBIOGET_VSCREENINFO, &fbvar); if(ioctl_ret< 0 ){ perror("fb dev ioctl(vscreeninfo GET)"); return -1; ioctl_ret = ioctl(fb_fd, FBIOGET_FSCREENINFO, &fbfix); if(ioctl_ret< 0 ){ perror("error: fbdevioctl(fscreeninfo GET)"); return -1; 14

15 LCD 정보를읽어오는프로그램작성 LCD 정보읽어오기 fbinfo.c 15 // x-resolution and y-resolution printf("resolution: X = %d, Y = %d\n", fbvar.xres, fbvar.yres); //virtual x-resolution and y-resolution printf("virtual resolution: VX = %d, VY=%d\n", fbvar.xres_virtual, fbvar.yres_virtual); // color bits per pixel printf("original BPP = %d\n", fbvar.bits_per_pixel); //the size of total frame buffer memory printf("length of frame buffer memory = %d\n", fbfix.smem_len); // set bpp value to 16 (Hardware Dependent) fbvar.bits_per_pixel = 16; ioctl_ret = ioctl(fb_fd, FBIOPUT_VSCREENINFO, &fbvar); // write to driver if(ioctl_ret< 0 ){ perror("fbdevioctl(vscreeninfo PUT)"); return -1;

16 LCD 정보를읽어오는프로그램작성 LCD 정보읽어오기 fbinfo.c 16 /* get new information for fbvar */ ioctl_ret = ioctl(fb_fd, FBIOGET_VSCREENINFO, &fbvar); if(ioctl_ret< 0 ){ perror("fbdevioctl(vscreeninfo GET)"); return -1; printf("changed BPP = %d\n", fbvar.bits_per_pixel); // set the value of BPP to 32 fbvar.bits_per_pixel = 32; ioctl_ret = ioctl(fb_fd, FBIOPUT_VSCREENINFO, &fbvar); // write to driver if(ioctl_ret< 0 ){ perror("fbdevioctl(vscreeninfo PUT)"); return -1; close(fb_fd); return 0; /* end of main() */

17 LCD 정보를읽어오는프로그램작성 LCD 정보읽어오기 호스트컴퓨터에서크로스컴파일러를사용하여타겟용으로컴파일 arm-linux-gcc o fb_info fbinfo.c 호스트컴퓨터와타겟보드끼리 NFS 연결후타겟보드에서프로그램실행하기 17

18 프레임버퍼를사용하여 LCD 화면제어 LCD 화면에가장기본적인데이터를출력해보자 점찍기, 선그리기, 삼각형그리기, 원그리기등 이를위해서는다음의내용을알아야함 사용하는 LCD의해상도 (resolution) 위치에대한좌표계산방법 BPP 정보와픽셀에쓸데이터만드는방법 데이터를 FB에 writing하는방법등 18

19 프레임버퍼를사용하여 LCD 화면제어 RGB-565 데이터구조 RBG-565 의경우색상표현을쉽게하기위하여각각바이트로표현된 R, G, B 값을받아들인다음, 가중치가낮은 LSB 쪽의값을각각 3, 2, 3 비트버려서총 16 비트의컬러를생성 get_color16() 함수는바이트로표현된 R, G, B 의값을받아들여 16 비트의컬러를생성한다. unsigned short get_color16(unsigned char r, unsigned char g, unsigned char b) { return (unsigned short)(((r>>3)<<11) ((g>>2)<<5) (b>>3)); 19

20 프레임버퍼를사용하여 LCD 화면제어 Achro-210T 보드의 TFT-LCD( 해상도 ) 해상도에서의픽셀좌표정보 20

21 프레임버퍼를사용하여 LCD 화면제어 RGB-888 데이터구조 RGB-888 구조에서사용되는픽셀의색상정보를쉽게생성할수있도록 get_color24() 함수를설계하기 함수는각각바이트로선언된 r, g, b 값을받아들여위구조체의색상필드에위치하도록하고, 최상위 8 비트는 0 으로설정한 함수에서반환되는최종값은 r, g, b 값으로구성된 24 비트의값 unsigned int get_color24 (unsigned char r, unsigned char g, unsigned char b) { return (unsigned int)((0x ) (r<<16) (g<<8) b)); 21

22 프레임버퍼를사용하여 LCD 화면제어 Achro-210T 보드의 TFT-LCD 화면해상도 22

23 프레임버퍼를사용하여 LCD 화면제어 LCD 화면에서의픽셀좌표표시예 23

24 프레임버퍼를사용하여 LCD 화면제어 프레임버퍼메모리위치환산 24

25 프레임버퍼를사용하여 LCD 화면제어 주어진좌표 (xp, yp) 로부터프레임버퍼메모리의위치를계산하는함수 fb_memloc() 을설계하기 long fb_memloc(unsigned int xp, unsigned int yp) { if ((xp > fbvar.xres) (yp > fbvar.yres) ) { printf("the coordinate (%d, %d) is out of range!!!\n", xp, yp); exit(1); return((offset_t)(fbvar.xres * yp + xp) * (fbvar.bits_per_pixel/8) ); 25

26 프레임버퍼를사용하여 LCD 화면제어 프레임버퍼사용하기 프레임버퍼메모리접근은 /dev/fb 파일을열어서생성된파일기술자 (file descriptor) 를통해서접근 파일기술자는 int 형태로표현되며, 입력및출력처리에대한저수준의인터페이스를제공 파일기술자를사용하여메모리또는파일내의위치를변경할때사용하는함수는 lseek() 함수형식 : off_t lseek(int fd, off_t offset, int start_flag); typedef long off_t; 26

27 프레임버퍼제어 파일기술자위치이동하기 파일기술자위치이동예 lseek (fd, (off_t)100, SEEK_CUR) lseek (fd, offset, SEEK_SET) 27

28 간단한프레임버퍼프로그래밍 -LCD 화면에점찍는프로그램작성 LCD 화면에점찍기 LCD 화면에 4 개의점을찍는프로그램을만들어보기 좌표 (10, 10) 에빨간색점, 좌표 (100, 50) 에는초록색점, 좌표 (50, 100) 에는파란색점, 좌표 (100, 100) 에는흰색점을표시 데이터타입을일목요연하게보이게하기위해몇개의타입을 typedef 를사용하여재정의 typedef unsigned char u8; typedef unsigned int u32; typedef long offset_t; 28

29 간단한프레임버퍼프로그래밍 -LCD 화면에점찍는프로그램작성 LCD 화면에점찍기 프로그램작성하기 cd ~/work/fb/ 프레임버퍼관련은 ~/work/fb 에서수행 vi drawdot.c 29

30 간단한프레임버퍼프로그래밍 -LCD 화면에점찍는프로그램작성 LCD 화면에점찍기 drawdot.c /* Drawing dots filename: drawdot.c */ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <sys/ioctl.h> #include <linux/fb.h> #define FBDEVFILE "/dev/fb 30

31 간단한프레임버퍼프로그래밍 -LCD 화면에점찍는프로그램작성 LCD 화면에점찍기 drawdot.c typedef unsigned char u8; typedef unsigned int u32; typedef long offset_t; u32 get_color32(u8 a, u8 r, u8 g, u8 b); offset_t fb_memloc(u32 xp, u32 yp); void drawdot(u32 xp, u32 yp, u32 color); int fb_fd; // file descriptor struct fb_var_screeninfo fbvar; struct fb_fix_screeninfo fbfix; 31

32 간단한프레임버퍼프로그래밍 -LCD 화면에점찍는프로그램작성 LCD 화면에점찍기 drawdot.c 32 /* make pixel color from a, r, g, b (BPP=32-bit)*/ u32 get_color32(u8 a, u8 r, u8 g, u8 b) { return ((u32) ( (a<<24) (r<<16) (g<<8) b)); /* get the location of framebuffer memory from the coordinate */ offset_t fb_memloc(u32 xp, u32 yp) { if ((xp > fbvar.xres) (yp > fbvar.yres) ) { printf("the coordinate (%d, %d) is out of range!!!\n", xp, yp); exit(1); return((offset_t)(fbvar.xres * yp + xp) * (fbvar.bits_per_pixel/8));

33 간단한프레임버퍼프로그래밍 -LCD 화면에점찍는프로그램작성 LCD 화면에점찍기 drawdot.c /* Put the pixel color data on (xp, yp) */ void drawdot(u32 xp, u32 yp, u32 color) { offset_t offset_value; offset_value = fb_memloc(xp, yp); if( lseek(fb_fd, offset_value, SEEK_SET) < 0 ) { perror("lseek error in fbdev...\n"); exit(1); write(fb_fd, &color, sizeof(fbvar.bits_per_pixel)); 33

34 간단한프레임버퍼프로그래밍 -LCD 화면에점찍는프로그램작성 LCD 화면에점찍기 drawdot.c int main(int argc, char *argv[]) { int ioctl_ret; u32 pixel_data; // open the device for frame buffer fb_fd = open(fbdevfile, O_RDWR); if (fb_fd < 0 ) { perror("framebuffer device open error.."); return -1; // get current screen information ioctl_ret = ioctl(fb_fd, FBIOGET_VSCREENINFO, &fbvar); 34

35 간단한프레임버퍼프로그래밍 -LCD 화면에점찍는프로그램작성 LCD 화면에점찍기 drawdot.c if(ioctl_ret < 0) { perror("error: fb dev ioctl(vscreeninfo GET)"); return -1; ioctl_ret = ioctl(fb_fd, FBIOGET_FSCREENINFO, &fbfix); if(ioctl_ret < 0) { perror("error: fb dev ioctl(fscreeninfo GET)"); return -1; if (fbvar.bits_per_pixel!= 32 ) { // check if bpp is 32 printf("bpp is not 32...\n"); return -1; 35

36 간단한프레임버퍼프로그래밍 -LCD 화면에점찍는프로그램작성 LCD 화면에점찍기 drawdot.c drawdot(10, 10, get_color32(0, 255, 0, 0)); // Put red point on (0,0) drawdot(100, 50, get_color32(0, 0, 255, 0)); // Green point on (100,50) drawdot(50, 100, get_color32(0, 0, 0, 255)); // Blue point on (50, 100) drawdot(100, 100, get_color32(0, 255, 255, 255)); // White point on (100,100) close(fb_fd); return 0; 36

37 간단한프레임버퍼프로그래밍 -LCD 화면에점찍는프로그램작성 LCD 화면에점찍기 컴파일하기 arm-linux-gcc -o drawdot drawdot.c 타겟보드에서실행하기 cd nfs/work/fb 실행화면 37

38 간단한프레임버퍼프로그래밍 -LCD 화면에선그리는프로그램작성 LCD 화면에선그리기 LCD 화면에선을그리는프로그램을작성하기 간단히프로그램을하기위해 drawline() 함수를설계 drawline() 함수는두개의좌표를받아들이고두좌표사이에선을그리는함수 프로그램작성하기 vi drawline.c 38

39 간단한프레임버퍼프로그래밍 -LCD 화면에선그리는프로그램작성 LCD 화면에선그리기 drawline.c /* Drawing lines filename: drawline.c */ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <sys/ioctl.h> #include <linux/fb.h> #define FBDEVFILE "/dev/fb" #define MIN(X, Y) ((X) < (Y)? (X):(Y)) #define MAX(X, Y) ((X) > (Y)? (X):(Y)) typedef unsigned char u8; typedef unsigned int u32; typedef long offset_t; 39

40 간단한프레임버퍼프로그래밍 -LCD 화면에선그리는프로그램작성 LCD 화면에선그리기 drawline.c u32 get_color32(u8 a, u8 r, u8 g, u8 b); offset_t fb_memloc(u32 xp, u32 yp); void drawdot(u32 xp, u32 yp, u32 color); void drawline(u32 x1, u32 y1, u32 x2, u32 y2); int fb_fd; // file descriptor struct fb_var_screeninfo fbvar; struct fb_fix_screeninfo fbfix; /* make pixel color data from a, r, g, b (BPP=32-bit) */ u32 get_color32(u8 a, u8 r, u8 g, u8 b) { return ((u32) ( (a<<24) (r<<16) (g<<8) b)); 40

41 간단한프레임버퍼프로그래밍 -LCD 화면에선그리는프로그램작성 LCD 화면에선그리기 drawline.c /* get the location of framebuffer memory from the coordinate */ offset_t fb_memloc(u32 xp, u32 yp) { if ((xp > fbvar.xres) (yp > fbvar.yres) ) { printf("the coordinate (%d, %d) is out of range!!!\n", xp, yp); exit(1); return((offset_t)(fbvar.xres * yp + xp) * (fbvar.bits_per_pixel/8) ); 41

42 간단한프레임버퍼프로그래밍 -LCD 화면에선그리는프로그램작성 LCD 화면에선그리기 drawline.c /* Put the pixel color data on (xp, yp) */ void drawdot(u32 xp, u32 yp, u32 color) { offset_t offset_value; offset_value = fb_memloc(xp, yp); if ( lseek(fb_fd, offset_value, SEEK_SET) < 0 ) { perror("lseek error in fbdev...\n"); exit(1); write(fb_fd, &color, sizeof(fbvar.bits_per_pixel)); 42

43 간단한프레임버퍼프로그래밍 -LCD 화면에선그리는프로그램작성 LCD 화면에선그리기 drawline.c /* Put the pixel data from (x1, y1) to (x2, y2) */ void drawline(u32 x1, u32 y1, u32 x2, u32 y2) { int dx, dy; int xstart, xend, ystart, yend; u32 i, j; dx = x2 - x1; dy = y2 - y1; xstart = MIN(x1, x2); xend = MAX(x1, x2); ystart = MIN(y1, y2); yend = MAX(y1, y2); if ( xstart < 0 ystart < 0 xend > fbvar.xres yend > fbvar.yres ) { printf("out of Range!!! (xstart=%d, ystart=%d, xend=%d, yend=%d\n", xstart, ystart, xend, yend); return; 43

44 간단한프레임버퍼프로그래밍 -LCD 화면에선그리는프로그램작성 LCD 화면에선그리기 drawline.c 44 if ( dx == 0 ) { // vertical line for ( i=ystart; i<=yend; i++) { drawdot(x1, i, get_color32(0, 255, 255, 255)); else if ( dy == 0 ) { // horizontal line for ( i=xstart; i<=xend; i++ ) { drawdot(i, y1, get_color32(0, 255, 255, 255)); else if ( dx > 0 ) { // negative slope (-1) for ( i=x1, j=y1; i<=x2; i++, j++) { drawdot(i, j, get_color32(0, 255, 255, 255)); else if ( dx < 0 ) { //positive slope (+1) for ( i=x1, j=y1; j<=y2; i--, j++) { drawdot(i, j, get_color32(0, 255, 255, 255)); /* end of drawline() */

45 간단한프레임버퍼프로그래밍 -LCD 화면에선그리는프로그램작성 LCD 화면에선그리기 drawline.c int main(int argc, char *argv[]) { int ioctl_ret, x, y; offset_t offset_value; u32 pixel_data; // open the device for frame buffer fb_fd = open(fbdevfile, O_RDWR); if (fb_fd < 0 ) { perror("framebuffer device open error.."); return -1; // get current screen information ioctl_ret = ioctl(fb_fd, FBIOGET_VSCREENINFO, &fbvar); if(ioctl_ret < 0) { perror("error: fb dev ioctl(vscreeninfo GET)"); return -1; 45

46 간단한프레임버퍼프로그래밍 -LCD 화면에선그리는프로그램작성 LCD 화면에선그리기 drawline.c ioctl_ret = ioctl(fb_fd, FBIOGET_FSCREENINFO, &fbfix); if(ioctl_ret < 0) { perror("error: fb dev ioctl(fscreeninfo GET)"); return -1; if (fbvar.bits_per_pixel!= 32 ) { // check if bpp is 32 printf("bpp is not 32...\n"); return -1; /* clearing LCD with black color */ for ( x=0; x < fbvar.xres; x++ ) { for ( y=0; y < fbvar.yres; y++ ) { drawdot(x, y, get_color32(0,0,0,0)); 46

47 간단한프레임버퍼프로그래밍 -LCD 화면에선그리는프로그램작성 LCD 화면에선그리기 drawline.c // draw the white line of width 10 on the top of LCD for ( y=0; y < 10; y++ ) { for ( x=0; x < fbvar.xres; x++ ) { drawdot(x, y, get_color32(0,255,255,255)); // draw the white line of width on the bottom of LCD for ( y=fbvar.yres-10; y < fbvar.yres; y++ ) { for ( x=0; x < fbvar.xres; x++ ) { drawdot(x, y, get_color32(0,255,255,255)); 47

48 간단한프레임버퍼프로그래밍 -LCD 화면에선그리는프로그램작성 LCD 화면에선그리기 drawline.c // draw rectangular drawline(100,100,100,200); /* left vertical line( ) */ drawline(100,100,200,100); /* upper horizontal line( ) */ drawline(200,100,200,200); /* right vertical line( ) */ drawline(200,200,100,200); /* lower horizontal line(_) */ drawline(100,100,200,200); /* \ */ drawline(200,100,100,200); /* / */ close(fb_fd); return 0; 48

49 간단한프레임버퍼프로그래밍 -LCD 화면에선그리는프로그램작성 LCD 화면에선그리기 컴파일하기 arm-linux-gcc -o drawline drawline.c 타겟보드에서실행하기 실행화면 49

50 간단한프레임버퍼프로그래밍 -LCD 화면을지우는프로그램작성 화면지우기 LCD 전체화면을지울필요가있는데, 전체화면을지우는방법은특정색상으로화면의모든픽셀들을채우는것 이를위해서 fb_clear() 함수를설계하기 프로그램작성 vi fb_clear.c 50

51 간단한프레임버퍼프로그래밍 -LCD 화면을지우는프로그램작성 화면지우기 fb_clear.c /* Clearing LCD filename: fb_clear.c */ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <sys/ioctl.h> #include <linux/fb.h> #define FBDEVFILE "/dev/fb typedef unsigned char u8; typedef unsigned int u32; typedef unsigned long offset_t; 51

52 간단한프레임버퍼프로그래밍 -LCD 화면을지우는프로그램작성 화면지우기 fb_clear.c u32 get_color32(u8 a, u8 r, u8 g, u8 b); offset_t fb_memloc(u32 xp, u32 yp); void drawdot(u32 xp, u32 yp, u32 color); void fb_clear(u32 color); int fb_fd; // file descriptor struct fb_var_screeninfo fbvar; struct fb_fix_screeninfo fbfix; /* make pixel color data from a, r, g, b (BPP=32-bit) */ u32 get_color32(u8 a, u8 r, u8 g, u8 b) { return ((u32) ( (a<<24) (r<<16) (g <<8) b)); 52

53 간단한프레임버퍼프로그래밍 -LCD 화면을지우는프로그램작성 화면지우기 fb_clear.c /* get the location of framebuffer memory from the coordinate */ offset_t fb_memloc(u32 xp, u32 yp) { if ((xp > fbvar.xres) (yp > fbvar.yres) ) { printf("the coordinate (%d, %d) is out of range!!!\n", xp, yp); exit(1); return ((offset_t)(fbvar.xres*yp+xp) * (fbvar.bits_per_pixel/8)); 53

54 간단한프레임버퍼프로그래밍 -LCD 화면을지우는프로그램작성 화면지우기 fb_clear.c /* Put the pixel color data on (xp, yp) */ void drawdot(u32 xp, u32 yp, u32 color) { offset_t offset_value; offset_value = fb_memloc(xp, yp); if ( lseek(fb_fd, offset_value, SEEK_SET) < 0 ) { perror("lseek error in fbdev...\n"); exit(1); write(fb_fd, &color, sizeof(fbvar.bits_per_pixel)); 54

55 간단한프레임버퍼프로그래밍 -LCD 화면을지우는프로그램작성 화면지우기 fb_clear.c /* clear LCD using drawdot function */ void fb_clear(u32 color) { int x, y; for(x = 0; x < fbvar.xres; x++){ for(y = 0; y < fbvar.yres; y++){ drawdot(x, y, color); 55

56 간단한프레임버퍼프로그래밍 -LCD 화면을지우는프로그램작성 화면지우기 fb_clear.c int main(int argc, char *argv[]) { int ioctl_ret; // return value //open the device for frame buffer fb_fd = open (FBDEVFILE, O_RDWR); if(fb_fd < 0) { perror("framebuffer device open error.."); return -1; // get current screen information ioctl_ret = ioctl(fb_fd, FBIOGET_VSCREENINFO, &fbvar); if(ioctl_ret <0) { perror("error : fb dev ioctl(vscreeninfo GET)"); return -1; 56

57 간단한프레임버퍼프로그래밍 -LCD 화면을지우는프로그램작성 화면지우기 fb_clear.c ioctl_ret = ioctl(fb_fd, FBIOGET_FSCREENINFO, &fbfix); if(ioctl_ret <0) { perror("error : fb dev ioctl(fscreeninfo GET)"); return -1; if(fbvar.bits_per_pixel!= 32 ) { // check if bpp is 32 printf("bpp is not 32!!!\n"); return -1; // clearing LCD with black color fb_clear(get_color32(0, 0, 0, 0)); close(fb_fd); return 0; 57

58 간단한프레임버퍼프로그래밍 -LCD 화면을지우는프로그램작성 화면지우기 컴파일하기 arm-linux-gcc -o fb_clear fb_clear.c 타겟보드에서실행하기 실행화면 58

59 프레임버퍼라이브러리용기본함수만들기 LCD 정보읽어오기 (get_fbinfo) /* get frame buffer information */ int get_fbinfo(int fb_fd) { int ioctl_ret; // return value // get current screen information ioctl_ret = ioctl(fb_fd, FBIOGET_VSCREENINFO, &fbvar); if(ioctl_ret < 0) { perror("error : fb dev ioctl(vscreeninfo GET)"); return -1; ioctl_ret = ioctl(fb_fd, FBIOGET_FSCREENINFO, &fbfix); if(ioctl_ret < 0) { perror("error : fb dev ioctl(fscreeninfo GET)"); return -1; if(fbvar.bits_per_pixel!= 32) { // check if bpp is 32 printf("bpp is not 32!!! \n"); exit(1); return ioctl_ret; 59

60 프레임버퍼라이브러리용기본함수만들기 점 (fb_dot) /* Put the pixel color data on (xp, yp) with width */ void fb_dot(u32 xp, u32 yp, u32 width, u32 color) { offset_t offset_value; int i, j; for(i = 0; i < width; i++){ for(j = 0; j < width; j++){ offset_value = fb_memloc(xp+i, yp+j); if(lseek(fb_fd, offset_value, SEEK_SET) < 0){ perror("lseek error in fbdev...\n"); return ; write(fb_fd, &color, sizeof(fbvar.bits_per_pixel)); 60

61 프레임버퍼라이브러리용기본함수만들기 전체화면색칠하기 (fb_clear) /* clear LCD using fb_dot function */ void fb_clear(u32 color) { int x, y; for(x = 0; x < fbvar.xres; x++){ for(y = 0; y < fbvar.yres; y++){ fb_dot(x, y, 1, color); 61

62 프레임버퍼라이브러리용기본함수만들기 직선 (fb_line) fb_line 함수에서의각인자와의관계 62

63 프레임버퍼라이브러리용기본함수만들기 직선 (fb_line) /* draw either horizontal or vertical line from (x1, y1) to (x2, y2) */ void fb_line(u32 x1, u32 y1, u32 x2, u32 y2, u32 width, u32 color) { int x, y; int iter, i; if(y1 == y2){ /* horizontal line */ iter = ceil((x2 - x1) / (float)width); for(x=x1, i = 0; i < iter; i++){ fb_dot(x, y1, width, color); x += width; if( (x+width) > x2){ x = x2 - width; 63

64 프레임버퍼라이브러리용기본함수만들기 사각형 (fb_rect) fb_rect 함수와 fb_rect2 함수인자와의관계 64

65 프레임버퍼라이브러리용기본함수만들기 사각형 (fb_rect) /* draw rectangular with the top-left and the bottom-right coordinates */ void fb_rect(u32 x1, u32 y1, u32 x2, u32 y2, u32 width, u32 color) { fb_line(x1, y1, x2, y1, width, color); /* upper horizontal line( ) */ fb_line(x1, y2-width, x2, y2-width, width, color); /* lower horizontal line(_) */ fb_line(x1, y1, x1, y2, width, color); /* left vertical line( ) */ fb_line(x2-width, y1, x2-width, y2, width, color); /* right vertical line( ) */ /* draw rectangular with the top-left coordinate and both lengths of it */ void fb_rect2(u32 x, u32 y, u32 h_len, u32 v_len, u32 width, u32 color) { fb_line(x, y, x+h_len, y, width, color); /* upper horizontal line( ) */ fb_line(x, y+v_len-width, x+h_len, y+v_len-width, width, color); /* lower horizontal line(_) */ fb_line(x, y, x, y+v_len, width, color); /* left vertical line( ) */ fb_line(x+h_len-width, y, x+h_len-width, y+v_len, width, color); /* right vertical line( ) */ 65

66 프레임버퍼라이브러리용기본함수만들기 삼각형 (fb_triangle) fb_triangle 함수인자와의관계 66

67 프레임버퍼라이브러리용기본함수만들기 삼각형 (fb_triangle) /* draw triangle with the top coordinate and height */ void fb_triangle(u32 x, u32 y, u32 width, u32 height, u32 color) { int i; for(i = 0; i <= height; i++){ fb_dot(x-i, y+i, width, color); fb_dot(x+i, y+i, width, color); for(i = 0; i < (2*height); i += width){ fb_dot(x-height+i, y+height, width, color); 67

68 프레임버퍼라이브러리용기본함수만들기 원 (fb_circle) fb_circle 함수인자와의관계 68

69 프레임버퍼라이브러리용기본함수만들기 원 (fb_circle) /* draw circle with the center and radius */ void fb_circle(u32 xp, u32 yp, u32 r, u32 color) { int i, j; offset_t offset_value; for(i = 0; i < 2*r + 2; i++){ for(j = 0; j < 2*r + 2; j++){ if(r*r > ( (i-r)*(i-r) + (j-r)*(j-r))){ offset_value = fb_memloc(i+xp, j+yp); if ( lseek(fb_fd, offset_value, SEEK_SET) < 0) { perror("lseek error in fbdev...\n"); return; write(fb_fd, &color, sizeof(fbvar.bits_per_pixel)); 69

70 프레임버퍼용라이브러리만들기 프레임버퍼용헤더파일 (fb_header.h) fb_header.h 헤더파일은프레임버퍼용라이브러리에포함되는함수들의함수원형 (function prototype) 선언과필요한데이터타입들과헤더파일등의정보로구성 프레임버퍼용라이브러리생성및테스트는루트홈디렉토리 (/root) 하위의 mylib 에서하는것으로가정 헤더파일만들기 mkdir /root/mylib cd /root/mylib vi fb_header.h 70

71 프레임버퍼용라이브러리만들기 프레임버퍼용헤더파일 (fb_header.h) fb_header.h #include <linux/fb.h> #include <math.h> #define FBDEVFILE "/dev/fb typedef unsigned char u8; typedef unsigned int u32; typedef unsigned long offset_t; int get_fbinfo(int fb_fd); u32 get_color32(u8 a, u8 r, u8 g, u8 b); offset_t fb_memloc(u32 xp, u32 yp); void fb_dot(u32 xp, u32 yp, u32 width, u32 color); void fb_clear(u32 color); void fb_line(u32 x1, u32 y1, u32 x2, u32 y2, u32 width, u32 color); void fb_rect(u32 x1, u32 y1, u32 x2, u32 y2, u32 width, u32 color); void fb_rect2(u32 x, u32 y, u32 h_len, u32 v_len, u32 width, u32 color); void fb_triangle(u32 x, u32 y, u32 width, u32 height, u32 color); void fb_circle(u32 xp, u32 yp, u32 size, u32 color); 71 int fb_fd; // file descriptor struct fb_var_screeninfo fbvar; struct fb_fix_screeninfo fbfix;

72 프레임버퍼용라이브러리만들기 프레임버퍼용라이브러리파일 (fb_mlib.c) 앞에서설계한점, 선, 사각형, 삼각형, 원등의프레임버퍼용기본함수들을라이브러리로만들어보기 fb_mlib.c 파일만들기 vi fb_mlib.c 72

73 프레임버퍼용라이브러리만들기 프레임버퍼용라이브러리파일 (fb_mlib.c) fb_mlib.c 73 #include "./fb_header.h" /* get frame buffer information */ int get_fbinfo(int fb_fd) { int ioctl_ret; // return value // get current screen information ioctl_ret = ioctl(fb_fd, FBIOGET_VSCREENINFO, &fbvar); if(ioctl_ret < 0) { perror("error : fb dev ioctl(vscreeninfo GET)"); return -1; ioctl_ret = ioctl(fb_fd, FBIOGET_FSCREENINFO, &fbfix); if(ioctl_ret < 0) { perror("error : fb dev ioctl(fscreeninfo GET)"); return -1; if(fbvar.bits_per_pixel!= 32) { // check if bpp is 32 printf("bpp is not 32!!! \n"); exit(1); return ioctl_ret;

74 프레임버퍼용라이브러리만들기 프레임버퍼용라이브러리파일 (fb_mlib.c) fb_mlib.c /* make pixel color data from a, r, g, b (BPP=32-bit) */ u32 get_color32(u8 a, u8 r, u8 g, u8 b) { return ((u32) ( (a<<24) (r<<16) (g <<8) b)); /* get the location of framebuffer memory from the coordinate */ offset_t fb_memloc(u32 xp, u32 yp) { if ((xp > fbvar.xres) (yp > fbvar.yres) ) { printf("the coordinate (%d, %d) is out of range!!!\n", xp, yp); exit(1); return ((offset_t)(fbvar.xres*yp+xp) * (fbvar.bits_per_pixel/8)); 74

75 프레임버퍼용라이브러리만들기 프레임버퍼용라이브러리파일 (fb_mlib.c) fb_mlib.c /* Put the pixel color data on (xp, yp) with width */ void fb_dot(u32 xp, u32 yp, u32 width, u32 color) { offset_t offset_value; int i, j; for(i = 0; i < width; i++){ for(j = 0; j < width; j++){ offset_value = fb_memloc(xp+i, yp+j); if(lseek(fb_fd, offset_value, SEEK_SET) < 0){ perror("lseek error in fbdev...\n"); return ; write(fb_fd, &color, sizeof(fbvar.bits_per_pixel)); 75

76 프레임버퍼용라이브러리만들기 프레임버퍼용라이브러리파일 (fb_mlib.c) fb_mlib.c /* clear LCD using fb_dot function */ void fb_clear(u32 color) { int x, y; for(x = 0; x < fbvar.xres; x++){ for(y = 0; y < fbvar.yres; y++){ fb_dot(x, y, 1, color); 76

77 프레임버퍼용라이브러리만들기 프레임버퍼용라이브러리파일 (fb_mlib.c) fb_mlib.c /* draw either horizontal or vertical line from (x1, y1) to (x2, y2) */ void fb_line(u32 x1, u32 y1, u32 x2, u32 y2, u32 width, u32 color) { int x, y; int iter, i; if(y1 == y2){ /* horizontal line */ iter = ceil((x2 - x1) / (float)width); for(x=x1, i = 0; i < iter; i++){ fb_dot(x, y1, width, color); x += width; if( (x+width) > x2){ x = x2 - width; 77

78 프레임버퍼용라이브러리만들기 프레임버퍼용라이브러리파일 (fb_mlib.c) fb_mlib.c if(x1 == x2){ /* vertical line */ iter = ceil((y2 - y1) / (float)width); for(y=y1,i = 0; i < iter; i++){ fb_dot(x1, y, width, color); y += width; if( (y+width) > y2){ y = y2 - width; /* draw rectangular with the top-left and the bottom-right coordinates */ void fb_rect(u32 x1, u32 y1, u32 x2, u32 y2, u32 width, u32 color) { fb_line(x1, y1, x2, y1, width, color); /* upper horizontal line( ) */ fb_line(x1, y2-width, x2, y2-width, width, color); /* lower horizontal line(_) */ fb_line(x1, y1, x1, y2, width, color); /* left vertical line( ) */ fb_line(x2-width, y1, x2-width, y2, width, color); /* right vertical line( ) */ 78

79 프레임버퍼용라이브러리만들기 프레임버퍼용라이브러리파일 (fb_mlib.c) fb_mlib.c 79 /* draw rectangular with the left-top coordinate and both lengths of it */ void fb_rect2(u32 x, u32 y, u32 h_len, u32 v_len, u32 width, u32 color) { fb_line(x, y, x+h_len, y, width, color); /* upper horizontal line( ) */ fb_line(x, y+v_len-width, x+h_len, y+v_len-width, width, color); /* lower horizontal line(_) */ fb_line(x, y, x, y+v_len, width, color); /* left vertical line( ) */ fb_line(x+h_len-width, y, x+h_len-width, y+v_len, width, color); /* right vertical line( ) */ /* draw triangle with the top coordinate and height */ void fb_triangle(u32 x, u32 y, u32 height, u32 width, u32 color) { int i; for(i = 0; i <= height; i++){ fb_dot(x-i, y+i, width, color); fb_dot(x+i, y+i, width, color); for(i = 0; i < (2*height); i += width){ fb_dot(x-height+i, y+height, width, color);

80 프레임버퍼용라이브러리만들기 프레임버퍼용라이브러리파일 (fb_mlib.c) fb_mlib.c /* draw circle with the center and radius */ void fb_circle(u32 xp, u32 yp, u32 r, u32 color) { int i, j; offset_t offset_value; for(i = 0; i < 2*r + 2; i++){ for(j = 0; j < 2*r + 2; j++){ if(r*r > ( (i-r)*(i-r) + (j-r)*(j-r))){ offset_value = fb_memloc(i+xp, j+yp); if ( lseek(fb_fd, offset_value, SEEK_SET) < 0) { perror("lseek error in fbdev...\n"); return; write(fb_fd, &color, sizeof(fbvar.bits_per_pixel)); 80

81 프레임버퍼용라이브러리만들기 프레임버퍼용라이브러리만들기 라이브러리로만들고자하는소스파일을옵션 c를사용하여바이너리파일 (.o) 로컴파일하기 arm-linux-gcc -c fb_mlib.c ls 합계 16 4 fb_header.h* 4 fb_mlib.c* 8 fb_mlib.o 아카이브라이브러리파일생성 root@esp-desktop:~/mylib# ar -r /root/work/mylib/libmyfb.a /root/work/mylib/fb_mlib.o ar: creating /root/mylib/libmyfb.a 라이브러리내에인덱스만들기 root@esp-desktop:~/mylib# ranlib /root/mylib/libmyfb.a 81

82 프레임버퍼용라이브러리만들기 프레임버퍼라이브러리를이용하여도형그리기 생성된라이브러리 (libmyfb.a) 와헤더파일 (fb_header.h) 을사용하면, 프레임버퍼에여러가지도형들을손쉽게출력가능 라이브러리를사용하여 LCD 에여러가지도형출력하기 테스트파일명은 fblib_test.c 파일생성하기 vi fblib_test.c 82

83 프레임버퍼용라이브러리만들기 프레임버퍼라이브러리를이용하여도형그리기 fblib_test.c #include "./fb_header.h" int main(int argc, char *argv[]) { int ioctl_ret, x, y; // return value offset_t offset_value; u32 pixel_data; //open the device node for frame buffer fb_fd = open (FBDEVFILE, O_RDWR); if(fb_fd < 0) { perror("framebuffer device open error.."); return -1; /* get current screen information */ ioctl_ret = get_fbinfo(fb_fd); // clearing LCD with black color fb_clear(get_color32(0, 0, 0, 0)); // draw a white boundary line of width 10 fb_line(0, 0, fbvar.xres-10, 0, 10, get_color32(0, 255, 255, 255)); fb_line(0, fbvar.yres-10, fbvar.xres-10, fbvar.yres-10, 10, get_color32(0, 255, 255, 255)); /* - */ 83

84 프레임버퍼용라이브러리만들기 프레임버퍼라이브러리를이용하여도형그리기 fblib_test.c 84 fb_line(0, 0, 0, fbvar.yres, 10, get_color32(0, 255, 255, 255)); /* */ fb_line(fbvar.xres-10, 0, fbvar.xres-10, fbvar.yres, 10, get_color32(0, 255, 255, 255)); /* */ // draw Rectangular with the left-top and the right-bottom coordinates fb_rect(50, 50, 150, 150, 10, get_color32(0, 255, 255, 255)); // draw Rectangular with (xp, yp) and both lengths of it fb_rect2(200, 50, 100, 200, 10, get_color32(0, 128, 128, 128)); // draw Triangle with one coordinate and height fb_triangle(150, 250, 100, 20, get_color32(0, 255, 255, 255)); // draw horizontal lines fb_line(450, 50, 750, 50, 10, get_color32(0, 255, 0, 0)); fb_line(450, 100, 750, 100, 20, get_color32(0, 0, 255, 0)); fb_line(450, 150, 750, 150, 30, get_color32(0, 0, 0, 255)); // draw vertical lines fb_line(450, 240, 450, 400, 10, get_color32(0, 255, 0, 0)); fb_line(550, 240, 550, 400, 20, get_color32(0, 0, 255, 0)); fb_line(650, 240, 650, 400, 30, get_color32(0, 0, 0, 255)); // draw Circle with a center and radius fb_circle(300, 300, 30, get_color32(0, 255, 255, 255)); close(fb_fd); return 0;

85 프레임버퍼용라이브러리만들기 프레임버퍼라이브러리를이용하여도형그리기 컴파일하기 arm-linux-gcc -o fblib_test fblib_test.c -L/root/work/mylib -lmyfb -lm ls 합계 44 4 fb_header.h* 4 fb_mlib.c* 8 fb_mlib.o 16 fblib_test* 4 fblib_test.c* 8 libmyfb.a 타겟보드에서실행하기 root@achro210t:~# cd nfs/mylib/ root@achro210t:~/nfs/mylib#./fblib_test 85

86 프레임버퍼용라이브러리만들기 프레임버퍼라이브러리를이용하여도형그리기 결과화면 86

87 BMP Header BMP 헤더 BMP 헤더 파일정보를가지고있는헤더인 BITMAPFILEHEADER 이미지의정보를가지고있는 BITMAPINFOHEADER BITMAPFILEHEADER bftype : 비트맵타입을나타냄 'BM' nfsize : 해당이미지파일의크기 bfreserved1 : 예약된공간 bfreserved2 : 예약된공간 bfoffbit : 실제픽셀정보공간까지의거리 87

88 BMP Header BMP 헤더 BITMAPINFOHEADER bisize : 이구조체를저장하기위한바이트수 (Default : 40Byte, 확장형 DIB 사용시변동 ) biwidth : 비트맵의가로크기 ( 픽셀단위 ) biheight : 비트맵의세로크기 ( 픽셀단위 ) biplane : 디스플레이시필요한플레인수 (Always : 1) bibitcount : 한픽셀을표현하기위한비트수 bicompression : 압축유형 (Default : BI_RGB - 비압축 ) bisizeimage : 픽셀데이터를저장하기위한공간 bixpelspermeter : 가로해상도 biypelspermeter : 세로해상도 bicirused : 실제사용되는색상수 (Default 0 : bibitcount 에서지정한모든색상사용 ) biclrimportant : 화면에표현하기위한색상의인덱스 (Default 0 : 모든색상 ) 88

89 BMP Header BMP 헤더 비트맵파일헤더 (BITMAPFILEHEADER) 89

90 BMP Header BMP 헤더 비트맵정보헤더 (BITMAPINFOHEADER) 90

91 BMP Header BMP 헤더 비트맵파일헤더구조체 typedef struct tagbitmapfileheader{ short bftype; int bfsize; short bfreserved1; short bfreserved2; int bfoffbits; attribute (( packed )) BITMAPFILEHEADER; 91

92 BMP Header BMP 헤더 비트맵정보헤더구조체 typedef struct tagbitmapinfoheader{ int bisize; long biwidth; long biheight; short biplanes; short bibitcount; int bicompression; int bisizeimage; long bixpelspermeter; long biypelspermeter; int biclrused; int biclrimportant; attribute (( packed )) BITMAPINFOHEADER; 92

93 BMP 정보출력프로그램작성 BMP 헤더의정보를이용하여 bmp 파일의정보를읽어출력하는프로그램을작성하기 Bmp 헤더파일생성하기 mkdir BMP cd BMP vi bmp_header.h 93

94 BMP 정보출력프로그램작성 bmp_header.h /* Bmp File display to Frame-buffer example * FILE : bmp_header.h */ #ifndef _BMPINFO_ #define _BMPINFO_ // display area size #define WIDTH 800 #define HEIGHT 480 // make type definition - windows type typedef unsigned short U16; typedef unsigned short WORD; typedef unsigned int DWORD; typedef unsigned int LONG; typedef unsigned char BYTE; 94

95 BMP 정보출력프로그램작성 bmp_header.h // make type definition - bmp file header typedef struct tagbitmapfileheader{ WORD bftype; DWORD bfsize; WORD bfreserved1; WORD bfreserved2; DWORD bfoffbits; attribute((packed))bitmapfileheader; 95

96 BMP 정보출력프로그램작성 bmp_header.h 96 // make type definition - bmp image infomation header typedef struct tagbitmapinfoheader{ DWORD bisize; LONG biwidth; LONG biheight; WORD biplanes; WORD bibitcount; DWORD bicompression; DWORD bisizeimage; LONG bixpelspermeter; LONG biypelspermeter; DWORD biclrused; DWORD biclrimportant; attribute((packed)) BITMAPINFOHEADER; /* other mathod : Group Attribute Packed Mathod #pragma pack(1) or pragma pack() */ #endif

97 BMP 정보출력프로그램작성 정보출력프로그램작성하기 vi bmp_info.c bmp_info.c 97 /* Bmp File display to Frame-buffer example * FILE : bmp_info.c */ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <string.h> #include <sys/ioctl.h> #include <sys/types.h> #include <linux/fb.h> #include "bmp_header.h" int main(int argc, char **argv) { BITMAPFILEHEADER BmpFileHd; BITMAPINFOHEADER BmpInfoHd; size_t retval;

98 BMP 정보출력프로그램작성 bmp_info.c int fb_fd; // Framebuffer discriptor struct fb_var_screeninfo fvs; FILE *read_fp=null; if(argc!=2){ // Argument check printf("usage : %s [FileName]\n",argv[0]); return -1; if ((read_fp = fopen(argv[1],"rb")) == NULL) { // File Open printf("file Open Error\n"); exit(1); // File Read - Bmp File Header fread(&bmpfilehd, sizeof(bitmapfileheader), 1, read_fp); if(bmpfilehd.bftype!=0x4d42) { printf("not Bitmap file or Unsupport Bitmap file\n"); exit(1); 98

99 BMP 정보출력프로그램작성 bmp_info.c printf("* BMP File Header - \n"); printf(" Type : 0x%04X\n", BmpFileHd.bfType); printf(" Size : %d\n", BmpFileHd.bfSize); printf(" Offbits : %d\n", BmpFileHd.bfOffBits); // File Read - Bmp Image infomation header fread(&bmpinfohd, sizeof(bitmapinfoheader), 1, read_fp); 99

100 BMP 정보출력프로그램작성 bmp_info.c printf("* BMP Info Header - \n"); printf(" FIleName : %s\n",argv[1]); printf(" Infosize : %d\n", BmpInfoHd.biSize); printf(" Width : %d\n", BmpInfoHd.biWidth); printf(" Height : %d\n", BmpInfoHd.biHeight); printf(" Planes : %d\n", BmpInfoHd.biplanes); printf(" Bitcount : %d\n", BmpInfoHd.biBitCount); printf(" Compressin : %d\n", BmpInfoHd.biCompression); printf(" Sizeimage : %d\n", BmpInfoHd.biSizeImage); printf(" XPelsPerMeter : %d\n", BmpInfoHd.biXPelsPerMeter); printf(" YPelsPerMeter : %d\n", BmpInfoHd.biYPelsPerMeter); printf(" ClrUsed : %d\n", BmpInfoHd.biClrUsed); printf(" ClrImportant : %d\n", BmpInfoHd.biClrImportant); fclose(read_fp); return 0; 100

101 BMP 정보출력프로그램작성 컴파일하기 arm-linux-gcc -o bmp_info bmp_info.c bmp 파일이미지정보출력 101

디지털영상처리3

디지털영상처리3 비트맵개요 BMP 파일의이해실제 BMP 파일의분석 BMP 파일을화면에출력 } 비트맵 (bitmap) 윈도우즈에서영상을표현하기위해사용되는윈도우즈 GDI(Graphic Device Interface) 오브젝트의하나 } 벡터그래픽 (vector graphics) 점, 선, 면등의기본적인그리기도구를이용하여그림을그리는방식 } 윈도우즈 GDI(Graphic Device

More information

슬라이드 1

슬라이드 1 BMP 파일구조 김성영교수 금오공과대학교 컴퓨터공학부 학습목표 BMP 파일의구조및그특징을설명할수있다. 파일헤더및비트맵정보헤더의주요필드를구분하고그역할을설명할수있다. C언어를사용하여 BMP 파일을처리할수있다. 2 BMP 파일구조 File Header (BITMAPFILEHEADER) Bitmap Info. Header (BITMAPINFOHEADER) Headers

More information

디지털영상처리3

디지털영상처리3 비트맵 BMP 파일의 실제 BMP 파일의 BMP 파일을 화면에 개요 이해 분석 출력 } 비트맵 (bitmap) 윈도우즈에서영상을표현하기위해사용되는윈도우즈 GDI(Graphic Device Interface) 오브젝트의하나 } 벡터그래픽 (vector graphics) 점, 선, 면등의기본적인그리기도구를이용하여그림을그리는방식 } 윈도우즈 GDI(Graphic

More information

BMP 파일 처리

BMP 파일 처리 BMP 파일처리 김성영교수 금오공과대학교 컴퓨터공학과 학습내용 영상반전프로그램제작 2 Inverting images out = 255 - in 3 /* 이프로그램은 8bit gray-scale 영상을입력으로사용하여반전한후동일포맷의영상으로저장한다. */ #include #include #define WIDTHBYTES(bytes)

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 KeyPad Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 에는 16 개의 Tack Switch 를사용하여 4 행 4 열의 Keypad 가장착 4x4 Keypad 2 KeyPad 를제어하기위하여 FPGA 내부에 KeyPad controller 가구현 KeyPad controller 16bit 로구성된

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Web server porting 2 Jo, Heeseung Web 을이용한 LED 제어 Web 을이용한 LED 제어프로그램 web 에서데이터를전송받아타겟보드의 LED 를조작하는프로그램을작성하기위해다음과같은소스파일을생성 2 Web 을이용한 LED 제어 LED 제어프로그램작성 8bitled.html 파일을작성 root@ubuntu:/working/web# vi

More information

슬라이드 1

슬라이드 1 / 유닉스시스템개요 / 파일 / 프로세스 01 File Descriptor file file descriptor file type unix 에서의파일은단지바이트들의나열임 operating system 은파일에어떤포맷도부과하지않음 파일의내용은바이트단위로주소를줄수있음 file descriptor 는 0 이나양수임 file 은 open 이나 creat 로 file

More information

<4D F736F F F696E74202D20B8AEB4AABDBA20BFC0B7F920C3B3B8AEC7CFB1E22E BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20B8AEB4AABDBA20BFC0B7F920C3B3B8AEC7CFB1E22E BC8A3C8AF20B8F0B5E55D> 리눅스 오류처리하기 2007. 11. 28 안효창 라이브러리함수의오류번호얻기 errno 변수기능오류번호를저장한다. 기본형 extern int errno; 헤더파일 라이브러리함수호출에실패했을때함수예 정수값을반환하는함수 -1 반환 open 함수 포인터를반환하는함수 NULL 반환 fopen 함수 2 유닉스 / 리눅스 라이브러리함수의오류번호얻기 19-1

More information

chap7.key

chap7.key 1 7 C 2 7.1 C (System Calls) Unix UNIX man Section 2 C. C (Library Functions) C 1975 Dennis Ritchie ANSI C Standard Library 3 (system call). 4 C?... 5 C (text file), C. (binary file). 6 C 1. : fopen( )

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-Segment Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 6-Digit 7-Segment LED controller 16비트로구성된 2개의레지스터에의해제어 SEG_Sel_Reg(Segment

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-Segment Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 6-Digit 7-Segment LED Controller 16비트로구성된 2개의레지스터에의해제어 SEG_Sel_Reg(Segment

More information

교육지원 IT시스템 선진화

교육지원 IT시스템 선진화 Module 16: ioctl 을활용한 LED 제어디바이스드라이버 ESP30076 임베디드시스템프로그래밍 (Embedded System Programming) 조윤석 전산전자공학부 주차별목표 ioctl() 을활용법배우기 커널타이머와 ioctl 을활용하여 LED 제어용디바이스드라이브작성하기 2 IOCTL 을이용한드라이버제어 ioctl() 함수활용 어떤경우에는읽는용도로만쓰고,

More information

untitled

untitled Step Motor Device Driver Embedded System Lab. II Step Motor Step Motor Step Motor source Embedded System Lab. II 2 open loop, : : Pulse, 1 Pulse,, -, 1 +5%, step Step Motor (2),, Embedded System Lab. II

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Text-LCD Device Control - Device driver Jo, Heeseung M3 모듈에장착되어있는 Tedxt LCD 장치를제어하는 App 을개발 TextLCD 는영문자와숫자일본어, 특수문자를표현하는데사용되는디바이스 HBE-SM5-S4210 의 TextLCD 는 16 문자 *2 라인을 Display 할수있으며, 이 TextLCD 를제어하기위하여

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-SEGMENT DEVICE CONTROL - DEVICE DRIVER Jo, Heeseung 디바이스드라이버구현 : 7-SEGMENT HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 디바이스드라이버구현 : 7-SEGMENT 6-Digit 7-Segment LED

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Network Programming Jo, Heeseung Network 실습 네트워크프로그래밍 멀리떨어져있는호스트들이서로데이터를주고받을수있도록프로그램을구현하는것 파일과는달리데이터를주고받을대상이멀리떨어져있기때문에소프트웨어차원에서호스트들간에연결을해주는장치가필요 이러한기능을해주는장치로소켓이라는인터페이스를많이사용 소켓프로그래밍이란용어와네트워크프로그래밍이랑용어가같은의미로사용

More information

K&R2 Reference Manual 번역본

K&R2 Reference Manual 번역본 typewriter structunion struct union if-else if if else if if else if if if if else else ; auto register static extern typedef void char short int long float double signed unsigned const volatile { } struct

More information

Microsoft PowerPoint - lab14.pptx

Microsoft PowerPoint - lab14.pptx Mobile & Embedded System Lab. Dept. of Computer Engineering Kyung Hee Univ. Keypad Device Control in Embedded Linux HBE-SM5-S4210 에는 16 개의 Tack Switch 를사용하여 4 행 4 열의 Keypad 가장착되어있다. 2 Keypad Device Driver

More information

Microsoft PowerPoint - [2009] 02.pptx

Microsoft PowerPoint - [2009] 02.pptx 원시데이터유형과연산 원시데이터유형과연산 원시데이터유형과연산 숫자데이터유형 - 숫자데이터유형 원시데이터유형과연산 표준입출력함수 - printf 문 가장기본적인출력함수. (stdio.h) 문법 ) printf( Test printf. a = %d \n, a); printf( %d, %f, %c \n, a, b, c); #include #include

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Web server porting 2 Jo, Heeseung Web 을이용한 LED 제어 Web 을이용한 LED 제어프로그램 web 에서데이터를전송받아타겟보드의 LED 를조작하는프로그램을작성하기위해다음과같은소스파일을생성 2 Web 을이용한 LED 제어 LED 제어프로그램작성 8bitled.html 파일을작성 root@ubuntu:/working/web# vi

More information

Microsoft PowerPoint - chap13-입출력라이브러리.pptx

Microsoft PowerPoint - chap13-입출력라이브러리.pptx #include int main(void) int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; 1 학습목표 스트림의 기본 개념을 알아보고,

More information

Microsoft PowerPoint - 3ÀÏ°_º¯¼ö¿Í »ó¼ö.ppt

Microsoft PowerPoint - 3ÀÏ°_º¯¼ö¿Í »ó¼ö.ppt 변수와상수 1 변수란무엇인가? 변수 : 정보 (data) 를저장하는컴퓨터내의특정위치 ( 임시저장공간 ) 메모리, register 메모리주소 101 번지 102 번지 변수의크기에따라 주로 byte 단위 메모리 2 기본적인변수형및변수의크기 변수의크기 해당컴퓨터에서는항상일정 컴퓨터마다다를수있음 short

More information

< E20C6DFBFFEBEEE20C0DBBCBAC0BB20C0A7C7D12043BEF0BEEE20492E707074>

< E20C6DFBFFEBEEE20C0DBBCBAC0BB20C0A7C7D12043BEF0BEEE20492E707074> Chap #2 펌웨어작성을위한 C 언어 I http://www.smartdisplay.co.kr 강의계획 Chap1. 강의계획및디지털논리이론 Chap2. 펌웨어작성을위한 C 언어 I Chap3. 펌웨어작성을위한 C 언어 II Chap4. AT89S52 메모리구조 Chap5. SD-52 보드구성과코드메모리프로그래밍방법 Chap6. 어드레스디코딩 ( 매핑 ) 과어셈블리어코딩방법

More information

Microsoft PowerPoint - ch10 - 이진트리, AVL 트리, 트리 응용 pm0600

Microsoft PowerPoint - ch10 - 이진트리, AVL 트리, 트리 응용 pm0600 균형이진탐색트리 -VL Tree delson, Velskii, Landis에의해 1962년에제안됨 VL trees are balanced n VL Tree is a binary search tree such that for every internal node v of T, the heights of the children of v can differ by at

More information

C++-¿Ïº®Çؼ³10Àå

C++-¿Ïº®Çؼ³10Àå C C++. (preprocessor directives), C C++ C/C++... C++, C. C++ C. C C++. C,, C++, C++., C++.,.. #define #elif #else #error #if #itdef #ifndef #include #line #pragma #undef #.,.,. #include #include

More information

API 매뉴얼

API 매뉴얼 PCI-DIO12 API Programming (Rev 1.0) Windows, Windows2000, Windows NT and Windows XP are trademarks of Microsoft. We acknowledge that the trademarks or service names of all other organizations mentioned

More information

슬라이드 1

슬라이드 1 -Part3- 제 4 장동적메모리할당과가변인 자 학습목차 4.1 동적메모리할당 4.1 동적메모리할당 4.1 동적메모리할당 배울내용 1 프로세스의메모리공간 2 동적메모리할당의필요성 4.1 동적메모리할당 (1/6) 프로세스의메모리구조 코드영역 : 프로그램실행코드, 함수들이저장되는영역 스택영역 : 매개변수, 지역변수, 중괄호 ( 블록 ) 내부에정의된변수들이저장되는영역

More information

Microsoft PowerPoint - chap12-고급기능.pptx

Microsoft PowerPoint - chap12-고급기능.pptx #include int main(void) int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; 1 학습목표 가 제공하는 매크로 상수와 매크로

More information

Microsoft PowerPoint - IOControl [호환 모드]

Microsoft PowerPoint - IOControl [호환 모드] 목차 Input/Output Control I/O Control Mechanism mmap function munmap function RAM Area Access LED Control 4 digits 7 Segment Control Text LCD Control 1 2 I/O Control Mechanism (1) I/O Control Mechanism (2)

More information

chap8.PDF

chap8.PDF 8 Hello!! C 2 3 4 struct - {...... }; struct jum{ int x_axis; int y_axis; }; struct - {...... } - ; struct jum{ int x_axis; int y_axis; }point1, *point2; 5 struct {....... } - ; struct{ int x_axis; int

More information

<4D F736F F F696E74202D B3E22032C7D0B1E220C0A9B5B5BFECB0D4C0D3C7C1B7CEB1D7B7A1B9D620C1A638B0AD202D20C7C1B7B9C0D320BCD3B5B5C0C720C1B6C0FD>

<4D F736F F F696E74202D B3E22032C7D0B1E220C0A9B5B5BFECB0D4C0D3C7C1B7CEB1D7B7A1B9D620C1A638B0AD202D20C7C1B7B9C0D320BCD3B5B5C0C720C1B6C0FD> 2006 년 2 학기윈도우게임프로그래밍 제 8 강프레임속도의조절 이대현 한국산업기술대학교 오늘의학습내용 프레임속도의조절 30fps 맞추기 스프라이트프레임속도의조절 프레임속도 (Frame Rate) 프레임속도란? 얼마나빨리프레임 ( 일반적으로하나의완성된화면 ) 을만들어낼수있는지를나타내는척도 일반적으로초당프레임출력횟수를많이사용한다. FPS(Frame Per Sec)

More information

歯9장.PDF

歯9장.PDF 9 Hello!! C printf() scanf() getchar() putchar() gets() puts() fopen() fclose() fprintf() fscant() fgetc() fputs() fgets() gputs() fread() fwrite() fseek() ftell() I/O 2 (stream) C (text stream) : `/n'

More information

본 강의에 들어가기 전

본 강의에 들어가기 전 C 기초특강 종합과제 과제내용 구조체를이용하여교과목이름과코드를파일로부터입력받아관리 구조체를이용하여학생들의이름, 학번과이수한교과목의코드와점수를파일로부터입력 학생개인별총점, 평균계산 교과목별이수학생수, 총점및평균을계산 결과를파일에저장하는프로그램을작성 2 Makefile OBJS = score_main.o score_input.o score_calc.o score_print.o

More information

Microsoft PowerPoint - chap02-C프로그램시작하기.pptx

Microsoft PowerPoint - chap02-C프로그램시작하기.pptx #include int main(void) { int num; printf( Please enter an integer "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; } 1 학습목표 을 작성하면서 C 프로그램의

More information

임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과

임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과 임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과 System call table and linkage v Ref. http://www.ibm.com/developerworks/linux/library/l-system-calls/ - 2 - Young-Jin Kim SYSCALL_DEFINE 함수

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Sensor Device Jo, Heeseung Sensor 실습 HBE-SM5-S4210 에는근접 / 가속도 / 컴파스센서가장착 각센서들을사용하기위한디바이스드라이버와어플리케이션을작성 2 근접 (Proximity) 센서 HBE-SM5-S4210 Camera Module 근접센서디바이스 근접센서는사물이다른사물에접촉되기이전에가까이접근하였는지를검출할목적으로사용 일반적으로생활에서자동문이나엘리베이터,

More information

슬라이드 1

슬라이드 1 2007 년 2 학기윈도우게임프로그래밍 제 7 강프레임속도의조절 이대현 핚국산업기술대학교 학습내용 프레임속도의조절 30fps 맞추기 스프라이트프레임속도의조절 프레임속도 (Frame Rate) 프레임속도란? 얼마나빨리프레임 ( 일반적으로하나의완성된화면 ) 을만들어낼수있는지를나타내는척도 일반적으로초당프레임출력횟수를많이사용핚다. FPS(Frame Per Sec)

More information

강의10

강의10 Computer Programming gdb and awk 12 th Lecture 김현철컴퓨터공학부서울대학교 순서 C Compiler and Linker 보충 Static vs Shared Libraries ( 계속 ) gdb awk Q&A Shared vs Static Libraries ( 계속 ) Advantage of Using Libraries Reduced

More information

10.

10. 10. 10.1 10.2 Library Routine: void perror (char* str) perror( ) str Error 0 10.3 10.3 int fd; /* */ fd = open (filename, ) /*, */ if (fd = = -1) { /* */ } fcnt1 (fd, ); /* */ read (fd, ); /* */ write

More information

제12장 파일 입출력

제12장 파일 입출력 제 4 장파일입출력 리눅스시스템프로그래밍 청주대학교전자공학과 한철수 1 시스템호출 (system call) 파일 (file) 임의접근 (random access) 주요학습내용 2 4.1 절 커널의역할 (kernel) 커널 (kernel) 은운영체제의핵심부분으로서, 하드웨어를운영관리하는여러가지서비스를제공함 파일관리 (File management) 디스크 프로세스관리

More information

untitled

untitled while do-while for break continue while( ) ; #include 0 i int main(void) int meter; int i = 0; while(i < 3) meter = i * 1609; printf("%d %d \n", i, meter); i++; return 0; i i< 3 () 0 (1)

More information

KEY 디바이스 드라이버

KEY 디바이스 드라이버 KEY 디바이스드라이버 임베디드시스템소프트웨어 I (http://et.smu.ac.kr et.smu.ac.kr) 차례 GPIO 및 Control Registers KEY 하드웨어구성 KEY Driver 프로그램 key-driver.c 시험응용프로그램 key-app.c KEY 디바이스드라이버 11-2 GPIO(General-Purpose Purpose I/O)

More information

Microsoft PowerPoint - ch07 - 포인터 pm0415

Microsoft PowerPoint - ch07 - 포인터 pm0415 2015-1 프로그래밍언어 7. 포인터 (Pointer), 동적메모리할당 2015 년 4 월 4 일 교수김영탁 영남대학교공과대학정보통신공학과 (Tel : +82-53-810-2497; Fax : +82-53-810-4742 http://antl.yu.ac.kr/; E-mail : ytkim@yu.ac.kr) Outline 포인터 (pointer) 란? 간접참조연산자

More information

À©µµ³×Æ®¿÷ÇÁ·Î±×·¡¹Ö4Àå_ÃÖÁ¾

À©µµ³×Æ®¿÷ÇÁ·Î±×·¡¹Ö4Àå_ÃÖÁ¾ P a 02 r t Chapter 4 TCP Chapter 5 Chapter 6 UDP Chapter 7 Chapter 8 GUI C h a p t e r 04 TCP 1 3 1 2 3 TCP TCP TCP [ 4 2] listen connect send accept recv send recv [ 4 1] PC Internet Explorer HTTP HTTP

More information

Microsoft Word doc

Microsoft Word doc 2. 디바이스드라이버 [ DIO ] 2.1. 개요 타겟보드의데이터버스를이용하여 LED 및스위치동작을제어하는방법을설명하겠다. 2.2. 회로도 2.3. 준비조건 ARM 용크로스컴파일러가설치되어있어야한다. 하드웨어적인점검을하여정상적인동작을한다고가정한다. NFS(Network File System) 를사용할경우에는 NFS가마운트되어있어야한다. 여기서는소스전문을포함하지않았다.

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 4 장파일 컴퓨터과학과박환수 1 2 4.1 시스템호출 컴퓨터시스템구조 유닉스커널 (kernel) 하드웨어를운영관리하여다음과같은서비스를제공 파일관리 (File management) 프로세스관리 (Process management) 메모리관리 (Memory management) 통신관리 (Communication management) 주변장치관리 (Device

More information

목차 제 1 장 inexio Touch Driver소개... 3 1.1 소개 및 주요 기능... 3 1.2 제품사양... 4 제 2 장 설치 및 실행... 5 2.1 설치 시 주의사항... 5 2.2 설치 권고 사양... 5 2.3 프로그램 설치... 6 2.4 하드웨

목차 제 1 장 inexio Touch Driver소개... 3 1.1 소개 및 주요 기능... 3 1.2 제품사양... 4 제 2 장 설치 및 실행... 5 2.1 설치 시 주의사항... 5 2.2 설치 권고 사양... 5 2.3 프로그램 설치... 6 2.4 하드웨 최종 수정일: 2010.01.15 inexio 적외선 터치스크린 사용 설명서 [Notes] 본 매뉴얼의 정보는 예고 없이 변경될 수 있으며 사용된 이미지가 실제와 다를 수 있습니다. 1 목차 제 1 장 inexio Touch Driver소개... 3 1.1 소개 및 주요 기능... 3 1.2 제품사양... 4 제 2 장 설치 및 실행... 5 2.1 설치 시

More information

1217 WebTrafMon II

1217 WebTrafMon II (1/28) (2/28) (10 Mbps ) Video, Audio. (3/28) 10 ~ 15 ( : telnet, ftp ),, (4/28) UDP/TCP (5/28) centralized environment packet header information analysis network traffic data, capture presentation network

More information

중간고사

중간고사 중간고사 예제 1 사용자로부터받은두개의숫자 x, y 중에서큰수를찾는알고리즘을의사코드로작성하시오. Step 1: Input x, y Step 2: if (x > y) then MAX

More information

The Pocket Guide to TCP/IP Sockets: C Version

The Pocket Guide to  TCP/IP Sockets: C Version 인터넷프로토콜 5 장 데이터송수신 (3) 1 파일전송메시지구성예제 ( 고정크기메시지 ) 전송방식 : 고정크기 ( 바이너리전송 ) 필요한전송정보 파일이름 ( 최대 255 자 => 255byte 의메모리공간필요 ) 파일크기 (4byte 의경우최대 4GB 크기의파일처리가능 ) 파일내용 ( 가변길이, 0~4GB 크기 ) 메시지구성 FileName (255bytes)

More information

슬라이드 1

슬라이드 1 프로세싱 광운대학교로봇학부박광현 프로세싱실행 2 C:\processing-3.2.1 폴더 창나타내기 실행 정지 3 폭 높이 600 400 도형그리기 배경칠하기 5 background(255, 255, 255); R G B background(255, 0, 0); background(255, 122, 0); 선그리기 6 background(255, 122, 0);

More information

K_R9000PRO_101.pdf

K_R9000PRO_101.pdf GV-R9000 PRO Radeon 9000 PRO Upgrade your Life REV 101 GV-R9000 PRO - 2-2002 11 1 12 ATi Radeon 9000 PRO GPU 64MB DDR SDRAM 275MHz DirectX 81 SMARTSHADER ATI SMOOTHVISION 3D HYDRAVISION ATI CATLYST DVI-I

More information

untitled

untitled - -, (insert) (delete) - - (insert) (delete) (top ) - - (insert) (rear) (delete) (front) A A B top A B C top push(a) push(b) push(c) A B top pop() top A B D push(d) top #define MAX_STACK_SIZE 100 int

More information

6주차.key

6주차.key 6, Process concept A program in execution Program code PCB (process control block) Program counter, registers, etc. Stack Heap Data section => global variable Process in memory Process state New Running

More information

<4D F736F F F696E74202D20BBB7BBB7C7D15F FBEDFB0A3B1B3C0B05FC1A638C0CFC2F72E BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20BBB7BBB7C7D15F FBEDFB0A3B1B3C0B05FC1A638C0CFC2F72E BC8A3C8AF20B8F0B5E55D> 뻔뻔한 AVR 프로그래밍 The Last(8 th ) Lecture 유명환 ( yoo@netplug.co.kr) INDEX 1 I 2 C 통신이야기 2 ATmega128 TWI(I 2 C) 구조분석 4 ATmega128 TWI(I 2 C) 실습 : AT24C16 1 I 2 C 통신이야기 I 2 C Inter IC Bus 어떤 IC들간에도공통적으로통할수있는 ex)

More information

Microsoft PowerPoint - chap10-함수의활용.pptx

Microsoft PowerPoint - chap10-함수의활용.pptx #include int main(void) { int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; } 1 학습목표 중 값에 의한 전달 방법과

More information

윤성우의 열혈 TCP/IP 소켓 프로그래밍

윤성우의 열혈 TCP/IP 소켓 프로그래밍 C 프로그래밍프로젝트 Chap 22. 구조체와사용자정의자료형 1 2013.10.10. 오병우 컴퓨터공학과 구조체의정의 (Structure) 구조체 하나이상의기본자료형을기반으로사용자정의자료형 (User Defined Data Type) 을만들수있는문법요소 배열 vs. 구조체 배열 : 한가지자료형의집합 구조체 : 여러가지자료형의집합 사용자정의자료형 struct

More information

11장 포인터

11장 포인터 Dynamic Memory and Linked List 1 동적할당메모리의개념 프로그램이메모리를할당받는방법 정적 (static) 동적 (dynamic) 정적메모리할당 프로그램이시작되기전에미리정해진크기의메모리를할당받는것 메모리의크기는프로그램이시작하기전에결정 int i, j; int buffer[80]; char name[] = data structure"; 처음에결정된크기보다더큰입력이들어온다면처리하지못함

More information

vi 사용법

vi 사용법 네트워크프로그래밍 6 장과제샘플코드 - 1:1 채팅 (udp 버전 ) 과제 서버에서먼저 bind 하고그포트를다른사람에게알려줄것 클라이언트에서알려준포트로접속 서로간에키보드입력을받아상대방에게메시지전송 2 Makefile 1 SRC_DIR =../../common 2 COM_OBJS = $(SRC_DIR)/addressUtility.o $(SRC_DIR)/dieWithMessage.o

More information

Microsoft PowerPoint - chap11-포인터의활용.pptx

Microsoft PowerPoint - chap11-포인터의활용.pptx #include int main(void) int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; 1 학습목표 포인터를 사용하는 다양한 방법에

More information

adfasdfasfdasfasfadf

adfasdfasfdasfasfadf C 4.5 Source code Pt.3 ISL / 강한솔 2019-04-10 Index Tree structure Build.h Tree.h St-thresh.h 2 Tree structure *Concpets : Node, Branch, Leaf, Subtree, Attribute, Attribute Value, Class Play, Don't Play.

More information

untitled

untitled 자료형 기본자료형 : char, int, float, double 등 파생자료형 : 배열, 열거형, 구조체, 공용체 vs struct 구조체 _ 태그 _ 이름 자료형멤버 _ 이름 ; 자료형멤버 _ 이름 ;... ; struct student int number; // char name[10]; // double height; // ; // x값과 y값으로이루어지는화면의좌표

More information

<322EBCF8C8AF28BFACBDC0B9AEC1A6292E687770>

<322EBCF8C8AF28BFACBDC0B9AEC1A6292E687770> 연습문제해답 5 4 3 2 1 0 함수의반환값 =15 5 4 3 2 1 0 함수의반환값 =95 10 7 4 1-2 함수의반환값 =3 1 2 3 4 5 연습문제해답 1. C 언어에서의배열에대하여다음중맞는것은? (1) 3차원이상의배열은불가능하다. (2) 배열의이름은포인터와같은역할을한다. (3) 배열의인덱스는 1에서부터시작한다. (4) 선언한다음, 실행도중에배열의크기를변경하는것이가능하다.

More information

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CBED0C3E0C7C1B7CEB1D7B7A55C D616E2E637070>

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CBED0C3E0C7C1B7CEB1D7B7A55C D616E2E637070> #include "stdafx.h" #include "Huffman.h" 1 /* 비트의부분을뽑아내는함수 */ unsigned HF::bits(unsigned x, int k, int j) return (x >> k) & ~(~0

More information

Microsoft PowerPoint - ch09 - 연결형리스트, Stack, Queue와 응용 pm0100

Microsoft PowerPoint - ch09 - 연결형리스트, Stack, Queue와 응용 pm0100 2015-1 프로그래밍언어 9. 연결형리스트, Stack, Queue 2015 년 5 월 4 일 교수김영탁 영남대학교공과대학정보통신공학과 (Tel : +82-53-810-2497; Fax : +82-53-810-4742 http://antl.yu.ac.kr/; E-mail : ytkim@yu.ac.kr) 연결리스트 (Linked List) 연결리스트연산 Stack

More information

이번장에서학습할내용 동적메모리란? malloc() 와 calloc() 연결리스트 파일을이용하면보다많은데이터를유용하고지속적으로사용및관리할수있습니다. 2

이번장에서학습할내용 동적메모리란? malloc() 와 calloc() 연결리스트 파일을이용하면보다많은데이터를유용하고지속적으로사용및관리할수있습니다. 2 제 17 장동적메모리와연결리스트 유준범 (JUNBEOM YOO) Ver. 2.0 jbyoo@konkuk.ac.kr http://dslab.konkuk.ac.kr 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 이번장에서학습할내용 동적메모리란? malloc() 와 calloc() 연결리스트 파일을이용하면보다많은데이터를유용하고지속적으로사용및관리할수있습니다.

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 1 12 장파이프 2 12.1 파이프 파이프원리 $ who sort 파이프 3 물을보내는수도파이프와비슷 한프로세스는쓰기용파일디스크립터를이용하여파이프에데이터를보내고 ( 쓰고 ) 다른프로세스는읽기용파일디스크립터를이용하여그파이프에서데이터를받는다 ( 읽는다 ). 한방향 (one way) 통신 파이프생성 파이프는두개의파일디스크립터를갖는다. 하나는쓰기용이고다른하나는읽기용이다.

More information

Microsoft PowerPoint - Chapter_09.pptx

Microsoft PowerPoint - Chapter_09.pptx 프로그래밍 1 1 Chapter 9. Structures May, 2016 Dept. of software Dankook University http://embedded.dankook.ac.kr/~baeksj 구조체의개념 (1/4) 2 (0,0) 구조체 : 다양한종류의데이터로구성된사용자정의데이터타입 복잡한자료를다루는것을편하게해줌 예 #1: 정수로이루어진 x,

More information

Chapter #01 Subject

Chapter #01  Subject Device Driver March 24, 2004 Kim, ki-hyeon 목차 1. 인터럽트처리복습 1. 인터럽트복습 입력검출방법 인터럽트방식, 폴링 (polling) 방식 인터럽트서비스등록함수 ( 커널에등록 ) int request_irq(unsigned int irq, void(*handler)(int,void*,struct pt_regs*), unsigned

More information

KNK_C_05_Pointers_Arrays_structures_summary_v02

KNK_C_05_Pointers_Arrays_structures_summary_v02 Pointers and Arrays Structures adopted from KNK C Programming : A Modern Approach 요약 2 Pointers and Arrays 3 배열의주소 #include int main(){ int c[] = {1, 2, 3, 4}; printf("c\t%p\n", c); printf("&c\t%p\n",

More information

C 언어 프로그래밊 과제 풀이

C 언어 프로그래밊 과제 풀이 과제풀이 (1) 홀수 / 짝수판정 (1) /* 20094123 홍길동 20100324 */ /* even_or_odd.c */ /* 정수를입력받아홀수인지짝수인지판정하는프로그램 */ int number; printf(" 정수를입력하시오 => "); scanf("%d", &number); 확인 주석문 가필요한이유 printf 와 scanf 쌍

More information

슬라이드 1

슬라이드 1 마이크로컨트롤러 2 (MicroController2) 2 강 ATmega128 의 external interrupt 이귀형교수님 학습목표 interrupt 란무엇인가? 기본개념을알아본다. interrupt 중에서가장사용하기쉬운 external interrupt 의사용방법을학습한다. 1. Interrupt 는왜필요할까? 함수동작을추가하여실행시키려면? //***

More information

<4D F736F F F696E74202D20B8B6C0CCC5A9B7CEC7C1B7CEBCBCBCAD202839C1D6C2F7207E203135C1D6C2F >

<4D F736F F F696E74202D20B8B6C0CCC5A9B7CEC7C1B7CEBCBCBCAD202839C1D6C2F7207E203135C1D6C2F > 10주차 문자 LCD 의인터페이스회로및구동함수 Next-Generation Networks Lab. 5. 16x2 CLCD 모듈 (HY-1602H-803) 그림 11-18 19 핀설명표 11-11 번호 분류 핀이름 레벨 (V) 기능 1 V SS or GND 0 GND 전원 2 V Power DD or V CC +5 CLCD 구동전원 3 V 0 - CLCD 명암조절

More information

버퍼오버플로우-왕기초편 10. 메모리를 Hex dump 뜨기 앞서우리는버퍼오버플로우로인해리턴어드레스 (return address) 가변조될수있음을알았습니다. 이제곧리턴어드레스를원하는값으로변경하는실습을해볼것인데요, 그전에앞서, 메모리에저장된값들을살펴보는방법에대해배워보겠습

버퍼오버플로우-왕기초편 10. 메모리를 Hex dump 뜨기 앞서우리는버퍼오버플로우로인해리턴어드레스 (return address) 가변조될수있음을알았습니다. 이제곧리턴어드레스를원하는값으로변경하는실습을해볼것인데요, 그전에앞서, 메모리에저장된값들을살펴보는방법에대해배워보겠습 앞서우리는버퍼오버플로우로인해리턴어드레스 (return address) 가변조될수있음을알았습니다. 이제곧리턴어드레스를원하는값으로변경하는실습을해볼것인데요, 그전에앞서, 메모리에저장된값들을살펴보는방법에대해배워보겠습니다. 여러분모두 Windows 에서 hex editor(hex dump, hex viewer) 라는것을사용해보셨을겁니다. 바로바이너리파일을 16 진수

More information

0. 표지에이름과학번을적으시오. (6) 1. 변수 x, y 가 integer type 이라가정하고다음빈칸에 x 와 y 의계산결과값을적으시오. (5) x = (3 + 7) * 6; x = 60 x = (12 + 6) / 2 * 3; x = 27 x = 3 * (8 / 4

0. 표지에이름과학번을적으시오. (6) 1. 변수 x, y 가 integer type 이라가정하고다음빈칸에 x 와 y 의계산결과값을적으시오. (5) x = (3 + 7) * 6; x = 60 x = (12 + 6) / 2 * 3; x = 27 x = 3 * (8 / 4 Introduction to software design 2012-1 Final 2012.06.13 16:00-18:00 Student ID: Name: - 1 - 0. 표지에이름과학번을적으시오. (6) 1. 변수 x, y 가 integer type 이라가정하고다음빈칸에 x 와 y 의계산결과값을적으시오. (5) x = (3 + 7) * 6; x = 60 x

More information

Poison null byte Excuse the ads! We need some help to keep our site up. List 1 Conditions 2 Exploit plan 2.1 chunksize(p)!= prev_size (next_chunk(p) 3

Poison null byte Excuse the ads! We need some help to keep our site up. List 1 Conditions 2 Exploit plan 2.1 chunksize(p)!= prev_size (next_chunk(p) 3 Poison null byte Excuse the ads! We need some help to keep our site up. List 1 Conditions 2 Exploit plan 2.1 chunksize(p)!= prev_size (next_chunk(p) 3 Example 3.1 Files 3.2 Source code 3.3 Exploit flow

More information

Microsoft PowerPoint APUE(File InO).pptx

Microsoft PowerPoint APUE(File InO).pptx Linux/UNIX Programming 문양세강원대학교 IT대학컴퓨터과학전공 강의목표및내용 강의목표 파일의특성을이해한다. 파일을열고닫는다. 파일로부터데이터를읽고쓴다. 기타파일제어함수를익힌다. 강의내용 파일구조 (UNIX 파일은어떤구조일까?) 파일관련시스템호출 시스템호출의효율과구조 Page 2 What is a File? A file is a contiguous

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 System Software Experiment 1 Lecture 5 - Array Spring 2019 Hwansoo Han (hhan@skku.edu) Advanced Research on Compilers and Systems, ARCS LAB Sungkyunkwan University http://arcs.skku.edu/ 1 배열 (Array) 동일한타입의데이터가여러개저장되어있는저장장소

More information

Microsoft PowerPoint APUE(File InO)

Microsoft PowerPoint APUE(File InO) Linux/UNIX Programming 문양세강원대학교 IT특성화대학컴퓨터과학전공 강의목표및내용 강의목표 파일의특성을이해한다. 파일을열고닫는다. 파일로부터데이터를읽고쓴다. 기타파일제어함수를익힌다. 강의내용 파일구조 (UNIX 파일은어떤구조일까?) 파일관련시스템호출 시스템호출의효율과구조 Page 2 What is a File? A file is a contiguous

More information

컴파일러

컴파일러 YACC 응용예 Desktop Calculator 7/23 Lex 입력 수식문법을위한 lex 입력 : calc.l %{ #include calc.tab.h" %} %% [0-9]+ return(number) [ \t] \n return(0) \+ return('+') \* return('*'). { printf("'%c': illegal character\n",

More information

별지제 호서식 연구결과보고서 과제명 소속소방산업기술연구소연구책임자권성필 연구기간 연구목표 연구배경

별지제 호서식 연구결과보고서 과제명 소속소방산업기술연구소연구책임자권성필 연구기간 연구목표 연구배경 별지제 호서식 연구결과보고서 과제명 소속소방산업기술연구소연구책임자권성필 연구기간 연구목표 연구배경 연구내용 β β 연구결과 참고문헌 붙임 ρ ρ α ρ α ρ α ρ α α α α ρ α α α ρ α α α β α αβ α α αβ αβ β ρ exp max αβ αβ α α αβ α exp κ π max P r Δ ρ δ max

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 LED Device Control - mmap() Jo, Heeseung 디바이스제어 디바이스제어 HBE-SM5-S4210 에장착된 Peripheral 들은다양한인터페이스로연결되어있음 베이스보드에있는 LED 와 7-Segment 는 GPIO 로직접 CPU 에연결 M3 모듈인 FPGA 모듈은 FPGA 에의해서제어되며 CPU 와호스트버스로연결되어있어서프로그램에서는메모리인터페이스로인식

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 WEB SERVER PORTING 1 Jo, Heeseung 웹서버포팅 HBE-SM5-S4210 를임베디드웹서버로사용할수있도록웹서버를올리는작업 임베디드서버에널리쓰이는웹서버들중 GoAhead 라는웹서버를포팅 CGI 프로그램을이용하여웹에서 HBE-SM5-S4210 의 LED, 7- Segment, TextLCD 를제어실습 2 Goahead webserver 소스를다운받거나제공된

More information

목차 포인터의개요 배열과포인터 포인터의구조 실무응용예제 C 2

목차 포인터의개요 배열과포인터 포인터의구조 실무응용예제 C 2 제 8 장. 포인터 목차 포인터의개요 배열과포인터 포인터의구조 실무응용예제 C 2 포인터의개요 포인터란? 주소를변수로다루기위한주소변수 메모리의기억공간을변수로써사용하는것 포인터변수란데이터변수가저장되는주소의값을 변수로취급하기위한변수 C 3 포인터의개요 포인터변수및초기화 * 변수데이터의데이터형과같은데이터형을포인터 변수의데이터형으로선언 일반변수와포인터변수를구별하기위해

More information

untitled

untitled if( ) ; if( sales > 2000 ) bonus = 200; if( score >= 60 ) printf(".\n"); if( height >= 130 && age >= 10 ) printf(".\n"); if ( temperature < 0 ) printf(".\n"); // printf(" %.\n \n", temperature); // if(

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 (Host) set up : Linux Backend RS-232, Ethernet, parallel(jtag) Host terminal Target terminal : monitor (Minicom) JTAG Cross compiler Boot loader Pentium Redhat 9.0 Serial port Serial cross cable Ethernet

More information

Microsoft PowerPoint - chap03-변수와데이터형.pptx

Microsoft PowerPoint - chap03-변수와데이터형.pptx #include int main(void) { int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num %d\n", num); return 0; } 1 학습목표 의 개념에 대해 알아본다.

More information

1장. 유닉스 시스템 프로그래밍 개요

1장.  유닉스 시스템 프로그래밍 개요 Unix 프로그래밍및실습 7 장. 시그널 - 과제보충 응용과제 1 부모프로세스는반복해서메뉴를출력하고사용자로부터주문을받아자식프로세스에게주문내용을알린다. (SIGUSR1) ( 일단주문을받으면음식이완료되기전까지 SIGUSR1 을제외한다른시그널은모두무시 ) timer 자식프로세스는주문을받으면조리를시작한다. ( 일단조리를시작하면음식이완성되기전까지 SIGALARM 을제외한다른시그널은모두무시

More information

Microsoft PowerPoint - Chapter8.pptx

Microsoft PowerPoint - Chapter8.pptx Computer Engineering g Programming g 2 제 8 장함수 Lecturer: JUNBEOM YOO jbyoo@konkuk.ac.kr 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 이번장에서학습할내용 모듈화 함수의개념, 역할 함수작성방법 반환값 인수전달 규모가큰프로그램은전체문제를보다단순하고이해하기쉬운함수로나누어서프로그램을작성하여야합니다.

More information

Microsoft PowerPoint - a10.ppt [호환 모드]

Microsoft PowerPoint - a10.ppt [호환 모드] Structure Chapter 10: Structures t and Macros Structure 관련된변수들의그룹으로이루어진자료구조 template, pattern field structure를구성하는변수 (cf) C언어의 struct 프로그램의 structure 접근 entire structure 또는 individual fields Structure는

More information

61 62 63 64 234 235 p r i n t f ( % 5 d :, i+1); g e t s ( s t u d e n t _ n a m e [ i ] ) ; if (student_name[i][0] == \ 0 ) i = MAX; p r i n t f (\ n :\ n ); 6 1 for (i = 0; student_name[i][0]!= \ 0&&

More information

Microsoft Word - Network Programming_NewVersion_01_.docx

Microsoft Word - Network Programming_NewVersion_01_.docx 10. Unix Domain Socket 105/113 10. Unix Domain Socket 본절에서는 Unix Domain Socket(UDS) 에대한개념과이에대한실습을수행하고, 이와동시에비신뢰적인통신시스템의문제점에대해서분석하도록한다. 이번실습의목표는다음과같다. 1. Unix Domain Socket의사용법을익히고, IPC에대해서실습 2. TCP/IP의응용계층과전달계층의동작을구현및실습

More information

(Asynchronous Mode) ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 -

(Asynchronous Mode) ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 - (Asynchronous Mode) - - - ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 - UART (Univ ers al As y nchronous Receiver / T rans mitter) 8250A 8250A { COM1(3F8H). - Line Control Register

More information

; struct point p[10] = {{1, 2, {5, -3, {-3, 5, {-6, -2, {2, 2, {-3, -3, {-9, 2, {7, 8, {-6, 4, {8, -5; for (i = 0; i < 10; i++){ if (p[i].x > 0 && p[i

; struct point p[10] = {{1, 2, {5, -3, {-3, 5, {-6, -2, {2, 2, {-3, -3, {-9, 2, {7, 8, {-6, 4, {8, -5; for (i = 0; i < 10; i++){ if (p[i].x > 0 && p[i ; struct point p; printf("0이아닌점의좌표를입력하시오 : "); scanf("%d %d", &p.x, &p.y); if (p.x > 0 && p.y > 0) printf("1사분면에있다.\n"); if (p.x < 0 && p.y > 0) printf("2사분면에있다.\n"); if (p.x < 0 && p.y < 0) printf("3사분면에있다.\n");

More information

untitled

untitled 1 hamks@dongguk.ac.kr (goal) (abstraction), (modularity), (interface) (efficient) (robust) C Unix C Unix (operating system) (network) (compiler) (machine architecture) 1 2 3 4 5 6 7 8 9 10 ANSI C Systems

More information

chap 5: Trees

chap 5: Trees 5. Threaded Binary Tree 기본개념 n 개의노드를갖는이진트리에는 2n 개의링크가존재 2n 개의링크중에 n + 1 개의링크값은 null Null 링크를다른노드에대한포인터로대체 Threads Thread 의이용 ptr left_child = NULL 일경우, ptr left_child 를 ptr 의 inorder predecessor 를가리키도록변경

More information

쉽게 풀어쓴 C 프로그래밍

쉽게 풀어쓴 C 프로그래밍 제 5 장생성자와접근제어 1. 객체지향기법을이해한다. 2. 클래스를작성할수있다. 3. 클래스에서객체를생성할수있다. 4. 생성자를이용하여객체를초기화할수 있다. 5. 접근자와설정자를사용할수있다. 이번장에서만들어볼프로그램 생성자 생성자 (constructor) 는초기화를담당하는함수 생성자가필요한이유 #include using namespace

More information

Lab 3. 실습문제 (Single linked list)_해답.hwp

Lab 3. 실습문제 (Single linked list)_해답.hwp Lab 3. Singly-linked list 의구현 실험실습일시 : 2009. 3. 30. 담당교수 : 정진우 담당조교 : 곽문상 보고서제출기한 : 2009. 4. 5. 학과 : 학번 : 성명 : 실습과제목적 : 이론시간에배운 Singly-linked list를실제로구현할수있다. 실습과제내용 : 주어진소스를이용해 Singly-linked list의각함수를구현한다.

More information

Microsoft PowerPoint - 08-C-App-19-Quick-Preprocessor

Microsoft PowerPoint - 08-C-App-19-Quick-Preprocessor 19. 전처리와분할컴파일 순천향대학교컴퓨터학부이상정 1 학습내용 전처리명령어 #include #define 기호상수 const 분할컴파일 순천향대학교컴퓨터학부이상정 2 전처리과정 전처리 (preprocessor) 전처리명령어는 # 기호로시작 #incldue #define 순천향대학교컴퓨터학부이상정 3 #include (1) 지정된파일을프로그램에삽입 꺽쇠괄호는포함할파일을컴파일러에설정되어있는특정디렉토리에서검색

More information

Microsoft PowerPoint - chap01-C언어개요.pptx

Microsoft PowerPoint - chap01-C언어개요.pptx #include int main(void) { int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; } 1 학습목표 프로그래밍의 기본 개념을

More information