반응형 Embedded16 [Kernel Porting-8] H-Smart4412 LCD 작동하기 작업 환경 -메인 OS : Windows 8.1K(Intel Core i5-4590) -작업 OS : Ubuntu 14.04 64bit(VirtualBox) -장 비 명 : H-Smart4412 1. lcd.c - scanf로 입력 받아 lcd에 띄우기 #include #include #include #include #define clcd "/dev/clcd" int main() { int clcd_d; char buf[10]; if((clcd_d = open(clcd,O_RDWR)) < 0) { perror("open"); exit(1); } scanf("%s",buf); write(clcd_d,&buf,strlen(buf)); close(clcd_d); return 0; } 2016. 12. 26. [Kernel Porting-7] H-Smart4412 Dip Switch 작동하기 작업 환경 -메인 OS : Windows 8.1K(Intel Core i5-4590) -작업 OS : Ubuntu 14.04 64bit(VirtualBox) -장 비 명 : H-Smart4412 1. dipsw.c - Dip Switch 작동 값 출력 #include #include #include #include #define dip "/dev/dipsw" int main() { int dip_d; unsigned char c; if((dip_d = open(dip,O_RDWR)) < 0) { perror("open"); exit(1); } while(1) { while(1) { read(dip_d,&c,sizeof(c)); if(c) break; } printf("%d\n",c); return 0; .. 2016. 12. 26. [Device Driver-3] Device Driver 등록 및 실행 작업 환경 -메인 OS : Windows 8.1K(Intel Core i5-4590) -작업 OS : Ubuntu 14.04 64bit(VirtualBox) -장 비 명 : H-Smart4412 1. skeleton.c - Device Driver 뼈대 작성 #include #include #include #include #define DEV_NAME "SKELETON" MODULE_LICENSE("GNU"); int test_major = 0; int result; int skeleton_open(struct inode *inode, struct file *filp); int skeleton_release(struct inode *inode, struct file *filp); ssize_t skele.. 2016. 12. 26. [Device Driver-2] kernel 등록 및 실행 작업 환경 -메인 OS : Windows 8.1K(Intel Core i5-4590) -작업 OS : Ubuntu 14.04 64bit(VirtualBox) -장 비 명 : H-Smart4412 1. hellocall.c - Kernel에서 Hello - sys call 출력 #include asmlinkage long sys_hellocall() { printk("Hello -sys call \n"); return 0; } 생성 후 /Smart4412/Development/Source/Kernel/kernel_4412/kernel 로 복사 2. Kernel에 코드 등록 cd /Smart4412/Development/Source/Kernel/kernel_4412/kernel vi Makefile obj-.. 2016. 12. 26. 이전 1 2 3 4 다음 반응형