Skip to content

Instantly share code, notes, and snippets.

View lp6m's full-sized avatar
🏠
Working from home

Yasuhiro Nitta lp6m

🏠
Working from home
  • Kyoto -> Tokyo -> Osaka
  • 11:25 (UTC +09:00)
  • X @lp6m1
View GitHub Profile
@lp6m
lp6m / yuv.py
Created September 10, 2018 01:42
Convert Raw YUYV image from PCam 5C to png
#coding:utf-8
#usage: python yuv.py input_rawdata.dat output_filename.png
from PIL import Image
import sys
f = open(sys.argv[1],"rb")
outfile = sys.argv[2]
WIDTH = 1920
HEIGHT = 1080
im = Image.new("RGB", (WIDTH, HEIGHT))
@lp6m
lp6m / pcam_ubuntu_zybo.cpp
Last active December 5, 2023 12:08
Get image from PCam 5C on Ubuntu running on ZYBO-Z7-20
/*
Target board: ZYBO Z7-20
Kernel&Circuit:https://github.com/Digilent/Petalinux-Zybo-Z7-20
Distribution: Ubuntu 16.04
https://rcn-ee.com/rootfs/eewiki/minfs/ubuntu-16.04.3-minimal-armhf-2017-10-07.tar.xz
Thanks to @hokim.
Xilinx Form: https://forums.xilinx.com/t5/Embedded-Linux/can-t-get-image-from-PCam-5C-on-Ubuntu-running-on-ZYBO-Z7-20/m-p/882879#M28057
Before run this code, you must run the following commands.
@lp6m
lp6m / ubuntu_pcam.cpp
Created August 18, 2018 12:16
Get PCam 5C image from ubuntu running on ZYBO-Z720
/*
before run this code, you should run the following commands.
media-ctl -d /dev/media0 -V '"ov5640 2-003c":0 [fmt:UYVY/'1920x1080'@1/'15' field:none]'
media-ctl -d /dev/media0 -V '"43c60000.mipi_csi2_rx_subsystem":0 [fmt:UYVY/'1920x1080' field:none]'
*/
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
adv7604
block
brd
cadence_wdt
can
can_gw
configfs
cpufreq
cpuidle
cryptomgr
adv7604
block
brd
cadence_wdt
can
can_gw
configfs
cpufreq
cpuidle
cryptomgr
Booting Linux on physical CPU 0x0
Linux version 4.9.0-xilinx-v2017.4 (lp6m@lp6m-UX390UAK) (gcc version 6.2.1 20161016 (Linaro GCC 6.2-2016.11)) #1 SMP PREEMPT Fri Aug 10 10:39:29 JST 2018
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
OF: fdt: Machine model: Zynq Zybo Z7 Development Board
bootconsole [earlycon0] enabled
Memory policy: Data cache writealloc
cma: Reserved 128 MiB at 0x38000000
On node 0 totalpages: 262144
free_area_init_node: node 0, pgdat c0a3aa00, node_mem_map ef7f7000
[ 0.000000] bootconsole [earlycon0] enabled
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] cma: Reserved 128 MiB at 0x38000000
[ 0.000000] On node 0 totalpages: 262144
[ 0.000000] free_area_init_node: node 0, pgdat c0a3aa00, node_mem_map ef7f7000
[ 0.000000] Normal zone: 1536 pages used for memmap
[ 0.000000] Normal zone: 0 pages reserved
[ 0.000000] Normal zone: 196608 pages, LIFO batch:31
[ 0.000000] HighMem zone: 65536 pages, LIFO batch:15
[ 0.000000] random: fast init done
@lp6m
lp6m / AR50826.c
Last active April 5, 2018 07:47
AR# 50826 Zynq-7000 Example Design - Cache coherent CDMA transfers from block RAM to OCM https://www.xilinx.com/support/answers/50826.html
//AR# 50826 Zynq-7000 Example Design - Cache coherent CDMA transfers from block RAM to OCM
//https://www.xilinx.com/support/answers/50826.html
//comment added
//modified Xil_SetTlbAttributes parameter
#include <xil_printf.h>
#include <xil_cache.h>
#include <stdlib.h>
#include <stdio.h>
#include <xuartps.h>
#include "xil_mmu.h"
@lp6m
lp6m / make_cookie.rb
Created December 29, 2016 16:46
2016/12/30修正バージョン(Windowsでも動作)
@lp6m
lp6m / yahoo_box_download.rb
Created December 29, 2016 16:45
2016/12/30修正バージョン(Windowsでも動作)
#Yahoo! Box Downloader
require 'mechanize'
require 'nokogiri'
require 'kconv'
require 'scanf'
require 'date'
require 'uri'
require 'json'
require 'erb'
require 'net/http'