Exemple #1
0
PyMODINIT_FUNC

initlogi(void)
{
	(void) Py_InitModule("logi", logiMethods);
	logi_open();
}
Exemple #2
0
int logi_read(unsigned char * buffer, unsigned int length, unsigned int address){
	int count = 0 ;
	if(fd == 0){
		logi_open();
	}
	count = pread(fd, buffer, length, address);
	return count ;
}
Exemple #3
0
int logi_read(unsigned char * buffer, unsigned int length, unsigned int address){
	unsigned int tr_size = 0;
	int count = 0 ;
	if(fd == 0){
		logi_open();
	}
	while(count < length){
		tr_size = (length-count) < 4094 ? (length-count) : 4094 ;
		if(logipi_read(((address+count)), &buffer[count], tr_size, 1) < 0) return 0 ;
		count = count + tr_size ;
	}
	return count ;
}
Exemple #4
0
int main(int argc, char ** argv){
	//unsigned char * inputImage ;
	//long start_time, end_time ;
	//double diff_time ;
	//struct timespec cpu_time ;
	//FILE * jpeg_fd ;
	//FILE * raw_file ;
	//int i,j, res ;
	//unsigned int pos = 0 ;
	//unsigned short int cmd_buffer[4];
	//unsigned short int reg_buffer[6];
	//unsigned char image_buffer[(320*240)] ; //monochrome frame buffer
	//unsigned short fifo_state, fifo_data ;

	int i;
	//unsigned char tmp_buffer[16];
	unsigned char * tmp_buffer;

	if(logi_open() < 0){
		printf("Error liblogi \n");
		return -1 ;
	}

	wb_rd(0x0000);

	//logi_read(&tmp_buffer, 16, 0x00000000);

	//for(i = 0 ; i < 16 ; i +=1){
	//	printf("%d \n", tmp_buffer[i]);
	//}

	//jpeg_fd  = fopen("./grabbed_frame.jpg", "w");
	//if(jpeg_fd == NULL){
	//	perror("Error opening output file");
	//	exit(EXIT_FAILURE);
	//}
	//printf("output file openened \n");
	//printf("loading input file : %s \n", argv[1]);
	//res = read_jpeg_file( argv[1], &inputImage);
	//if(res < 0){
	//	perror("Error opening input file");
	//	exit(EXIT_FAILURE);
	//}

	//configuring for gauss->sobel->hysteresis->dilate->erode->output
//	reg_buffer[0] = GAUSS_SOURCE_FIFO ;
//	reg_buffer[1] = SOBEL_SOURCE_GAUSS ;
//	reg_buffer[2] = ERODE_SOURCE_DILATE ;
//	reg_buffer[3] = DILATE_SOURCE_HYST ;
//	reg_buffer[4] = HYST_SOURCE_SOBEL ;
//	reg_buffer[5] = OUTPUT_SOURCE_ERODE ;
//	logi_write(reg_buffer, 12, REG_ADDR);
//	printf("issuing reset to fifo \n");
//	cmd_buffer[1] = 0;
//	cmd_buffer[2] = 0 ;
//	logi_write(cmd_buffer, 6, FIFO_CMD_ADDR);
//	logi_read(cmd_buffer, 6, FIFO_CMD_ADDR);
//	printf("fifo size : %d, free: %d, available : %d \n", cmd_buffer[0],cmd_buffer[1], cmd_buffer[2]);
//	clock_gettime(CLOCK_REALTIME, &cpu_time);
//	start_time = cpu_time.tv_nsec ;
//	 for(i = 0 ; i < IMAGE_HEIGHT ; i +=LINE_BURST){
//		logi_write(&inputImage[(i*IMAGE_WIDTH)], IMAGE_WIDTH*LINE_BURST, 0x0000);
//		do{
//			logi_read(cmd_buffer, 6, FIFO_CMD_ADDR);
//			//printf("fifo size : %d, free: %d, available : %d \n", cmd_buffer[0],cmd_buffer[1], cmd_buffer[2]);
//		}while((cmd_buffer[2]*2) < IMAGE_WIDTH*LINE_BURST);
//		logi_read(&image_buffer[(i*IMAGE_WIDTH)], IMAGE_WIDTH*LINE_BURST, 0x0000);
//        }
//	clock_gettime(CLOCK_REALTIME, &cpu_time);
//	end_time = cpu_time.tv_nsec ;
//	diff_time = end_time - start_time ;
//	diff_time = diff_time/1000000000 ;
//	printf("transffered %d bytes in %f s : %f B/s \n", IMAGE_WIDTH * IMAGE_HEIGHT, diff_time, (IMAGE_WIDTH * IMAGE_HEIGHT)/diff_time);
	//write_jpegfile(image_buffer, 320, 240, jpeg_fd, 100);
	logi_close();
	//fclose(jpeg_fd);
	return 0 ;
}