test.c

来自「generic driver for s3c2440 under linux」· C语言 代码 · 共 64 行

C
64
字号
//============================================================================// Name        : test_camera.cpp// Author      :// Version     :// Copyright   : Your copyright notice// Description : Hello World in C, Ansi-style//============================================================================#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <sys/types.h>#include <sys/mman.h>#include <fcntl.h>#include <sys/ioctl.h>#include <sys/stat.h>#include <time.h>#include <linux/delay.h>#include <poll.h>#include <signal.h>#define DIMENS 100int main(void) {	static int fd;	int i;	struct pollfd poll_data;	int valoare;	unsigned char bval;    unsigned char buffer[DIMENS];    int citit;    fd = open("/dev/PORTJ", O_RDWR);    if (fd < 0)    {         printf("Eroare open portj\n");         return -1;    } while(1){    //citit=read(fd , &valoare , DIMENS);	valoare=0;    citit=read(fd , &valoare , 4);    printf("Valoare = %x\n", valoare);    //citit=read(fd , &bval , 1);    //printf("Valoare = %x\n", bval);  	getchar();}    close(fd);	puts("Hello World!!!");	return EXIT_SUCCESS;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?