Archive for the ‘Uncategorized’ Category.

Lifetouch note – serial console, ac100 image

I’ve managed to get a serial console working with sosboot from the ac100 folks. The display doesn’t work, but you can get a console on the serial port.

photo(7)

In the above image, I’m calling pin 1 the top most pin, when the PCB is installed this is nearest the front of the case.

From the PC perspective (i.e. rx, means PC receving data) the pin signals are as follows:

pin 2: rx
pin 3: tx
pin 4: ground

You can communicate at 115200, 8N1.

You should be able to see a boot message from the Nvidia boot loader (see my previous post). The ac100 kernel from sosboot-r3 also brings up a serial console. I’ve modified sosboot to start the serial on the serial console rather than the display download here: http://41j.com/hackedsosbootr3.img.

That will give you a kernel with serial console but no display/keyboard. The Nvidia kernel (mentioned in previous post) appears to give some display functionality, but no keyboard and no serial port.

Update: Here’s an image with a working display and serial (the original android kernel) it runs a console on the serial port: here

Serial dump

Dmesg/cpuinfo/lsusb

[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 2.6.38.3 (gilles@woody) (gcc version 4.4.5 (Debian 4.4.5-8) ) #4 SMP PREEMPT Thu Jul 21 02:27:22 CEST 2011
[    0.000000] CPU: ARMv7 Processor [411fc090] revision 0 (ARMv7), cr=10c5387f
[    0.000000] CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine: Toshiba AC100 / Dynabook AZ
[    0.000000] PreMemHdl    0 00000008 1fe76000 00177640 0000000a 
[    0.000000] FRAMEBUFFER    00000018 00010000 00177640 101a880a 01e00320 02010640 00000000 00000007 
[    0.000000] DISPLAY        0000000c 00000000 00000000 00000301 00000006 
[    0.000000] PreMemHdl    1 00000008 1fe61000 00002000 00000016 
[    0.000000] CHIPSHMOO      00000048 00010001 00000000 00000014 00000014 000005ac 000005c0 00000028 000005e8 00000028 00000610 00000018 00000628 0000002c 00010002 c435ae6e 000003f2 00000000 00000000 00000006 
[    0.000000] PreMemHdl    2 00000008 1fe5eff0 00002000 00000005 
[    0.000000] WARMBOOT       00000004 00010002 00000000 
[    0.000000] Memory policy: ECC disabled, Data cache writealloc
[    0.000000] On node 0 totalpages: 98304
[    0.000000] free_area_init_node: node 0, pgdat c06889c0, node_mem_map c0706000
[    0.000000]   Normal zone: 768 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 97536 pages, LIFO batch:31
[    0.000000] Tegra Revision: A03 prime SKU: 8 CPU Process: 1 Core Process: 2 Speedo ID: 1
[    0.000000] Unable to set clock hclk to rate 120000000: -22
[    0.000000] Unable to set clock pclk to rate 60000000: -22
[    0.000000] PERCPU: Embedded 8 pages/cpu @c0a0b000 s8928 r8192 d15648 u32768
[    0.000000] pcpu-alloc: s8928 r8192 d15648 u32768 alloc=8*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 97536
[    0.000000] Kernel command line: mem=384M@0M nvmem=128M@384M vmalloc=256M video=tegrafb console=ttyS0,115200n8 usbcore.old_scheme_first=1 no_console_suspend tegraboot=sdmmc tegrapart=pt:600:80:800,bootloader:680:400:800,fdt:1180:12c00:800,recovery:13d80:a00:800,boot:14800:1000:800,mbr:b80:200:800,system:15880:18000:800,cache:2d900:12c00:800,misc:d80:400:800,staging:40580:1f400:800,userdata:5fa00:35b600:800 
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] allocated 1966080 bytes of page_cgroup
[    0.000000] please try 'cgroup_disable=memory' option if you don't want memory cgroups
[    0.000000] Memory: 384MB = 384MB total
[    0.000000] Memory: 378208k/378208k available, 15008k reserved, 0K highmem
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     DMA     : 0xffc00000 - 0xffe00000   (   2 MB)
[    0.000000]     vmalloc : 0xd8800000 - 0xfe000000   ( 600 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xd8000000   ( 384 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .init : 0xc0008000 - 0xc0038000   ( 192 kB)
[    0.000000]       .text : 0xc0038000 - 0xc063d8fc   (6167 kB)
[    0.000000]       .data : 0xc063e000 - 0xc068b0c8   ( 309 kB)
[    0.000000] SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] Preemptable hierarchical RCU implementation.
[    0.000000] 	RCU-based detection of stalled CPUs is disabled.
[    0.000000] 	Verbose stalled-CPUs detection is disabled.
[    0.000000] NR_IRQS:448
[    0.000000] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 4294967ms
[    0.000000] Console: colour dummy device 80x30
[    0.000099] Calibrating delay loop... 1992.29 BogoMIPS (lpj=9961472)
[    0.270040] pid_max: default: 32768 minimum: 301
[    0.270196] Security Framework initialized
[    0.270230] AppArmor: AppArmor initialized
[    0.270299] Mount-cache hash table entries: 512
[    0.270895] Initializing cgroup subsys ns
[    0.270908] ns_cgroup deprecated: consider using the 'clone_children' flag without the ns_cgroup.
[    0.270920] Initializing cgroup subsys cpuacct
[    0.270963] Initializing cgroup subsys memory
[    0.270996] Initializing cgroup subsys devices
[    0.271053] CPU: Testing write buffer coherency: ok
[    0.271201] Calibrating local timer... 249.93MHz, setting to 2.50MHz.
[    0.330074] hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 7 counters available
[    0.331060] CPU1: Booted secondary processor
[    0.332881] Brought up 2 CPUs
[    0.332891] SMP: Total of 2 processors activated (2011.59 BogoMIPS).
[    0.333277] devtmpfs: initialized
[    0.335975] print_constraints: dummy: 
[    0.336188] NET: Registered protocol family 16
[    0.336880] host1x bus init
[    0.340470] EMC table: ramd_id: 0, tegra_sku_id 8
[    0.340573] hw-breakpoint: found 6 breakpoint and 1 watchpoint registers.
[    0.340583] hw-breakpoint: 1 breakpoint(s) reserved for watchpoint single-step.
[    0.340602] hw-breakpoint: maximum watchpoint size is 4 bytes.
[    0.340785] tegra_iovmm_register: added iovmm-gart
[    0.349383] bio: create slab <bio-0> at 0
[    0.349906] vgaarb: loaded
[    0.349968] i2c-core: driver [tps6586x] using legacy suspend method
[    0.349977] i2c-core: driver [tps6586x] using legacy resume method
[    0.350193] SCSI subsystem initialized
[    0.350422] usbcore: registered new interface driver usbfs
[    0.350488] usbcore: registered new interface driver hub
[    0.350584] usbcore: registered new device driver usb
[    0.351621] tps6586x 4-0034: VERSIONCRC is 2c
[    0.351838] tps6586x-regulator tps6586x-regulator.0: Probing reulator 0
[    0.352572] print_constraints: REG-SM_0: 725 <--> 1200 mV at 1275 mV fast normal 
[    0.352731] tps6586x-regulator tps6586x-regulator.1: Probing reulator 1
[    0.353467] print_constraints: REG-SM_1: 725 <--> 1200 mV at 1000 mV fast normal 
[    0.353615] tps6586x-regulator tps6586x-regulator.2: Probing reulator 2
[    0.354606] print_constraints: REG-SM_2: 3000 <--> 3700 mV at 3700 mV fast normal 
[    0.354784] tps6586x-regulator tps6586x-regulator.3: Probing reulator 3
[    0.355366] print_constraints: REG-LDO_0: 1250 <--> 3300 mV at 1250 mV fast normal 
[    0.355529] tps6586x-regulator tps6586x-regulator.4: Probing reulator 4
[    0.356505] print_constraints: REG-LDO_1: 725 <--> 1100 mV at 1100 mV fast normal 
[    0.356666] tps6586x-regulator tps6586x-regulator.5: Probing reulator 5
[    0.357248] print_constraints: REG-LDO_2: 725 <--> 1200 mV at 1275 mV fast normal 
[    0.357407] tps6586x-regulator tps6586x-regulator.6: Probing reulator 6
[    0.358243] print_constraints: REG-LDO_3: 1250 <--> 3300 mV at 3300 mV fast normal 
[    0.358421] tps6586x-regulator tps6586x-regulator.7: Probing reulator 7
[    0.359406] print_constraints: REG-LDO_4: 1700 <--> 1800 mV at 1800 mV fast normal 
[    0.359596] tps6586x-regulator tps6586x-regulator.8: Probing reulator 8
[    0.360040] print_constraints: REG-LDO_5: 1250 <--> 2850 mV at 2850 mV fast normal 
[    0.360227] tps6586x-regulator tps6586x-regulator.9: Probing reulator 9
[    0.360809] print_constraints: REG-LDO_6: 1250 <--> 2850 mV at 2850 mV fast normal 
[    0.360986] tps6586x-regulator tps6586x-regulator.10: Probing reulator 10
[    0.361573] print_constraints: REG-LDO_7: 1250 <--> 3300 mV at 3300 mV fast normal 
[    0.361720] tps6586x-regulator tps6586x-regulator.11: Probing reulator 11
[    0.362312] print_constraints: REG-LDO_8: 1250 <--> 1800 mV at 1800 mV fast normal 
[    0.362468] tps6586x-regulator tps6586x-regulator.12: Probing reulator 12
[    0.362876] print_constraints: REG-LDO_9: 1250 <--> 2850 mV at 2850 mV fast normal 
[    0.363575] NetLabel: Initializing
[    0.363583] NetLabel:  domain hash size = 128
[    0.363590] NetLabel:  protocols = UNLABELED CIPSOv4
[    0.363625] NetLabel:  unlabeled traffic allowed by default
[    0.365210] Switching to clocksource timer_us
[    0.365266] Switched to NOHz mode on CPU #0
[    0.365291] Switched to NOHz mode on CPU #1
[    0.373137] AppArmor: AppArmor Filesystem Enabled
[    0.373627] tegra-nvmap tegra-nvmap: created carveout iram (256KiB)
[    0.373744] tegra-nvmap tegra-nvmap: created carveout generic-0 (53248KiB)
[    0.383382] NET: Registered protocol family 2
[    0.383626] IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.384391] TCP established hash table entries: 16384 (order: 5, 131072 bytes)
[    0.384639] TCP bind hash table entries: 16384 (order: 5, 196608 bytes)
[    0.384926] TCP: Hash tables configured (established 16384 bind 16384)
[    0.384937] TCP reno registered
[    0.384951] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.384979] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.385484] NET: Registered protocol family 1
[    0.385515] PCI: CLS 0 bytes, default 32
[    0.385683] Trying to unpack rootfs image as initramfs...
[    0.413991] Freeing initrd memory: 2340K
[    0.414120] PMU: registered new PMU device of type 0
[    0.415035] audit: initializing netlink socket (disabled)
[    0.415099] type=2000 audit(8.409:1): initialized
[    0.484780] VFS: Disk quotas dquot_6.5.2
[    0.485259] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.487245] NTFS driver 2.1.30 [Flags: R/W].
[    0.487701] NILFS version 2 loaded
[    0.488576] Btrfs loaded
[    0.488597] msgmni has been set to 743
[    0.489644] io scheduler noop registered (default)
[    0.489653] io scheduler deadline registered
[    0.489732] io scheduler cfq registered
[    0.490005] >>> backlight_enable
[    0.490193] regulator avdd_lvds already enabled
[    0.491663] tegra_grhost tegra_grhost: initialized
[    0.491852] host1x: tegradc tegradc
[    0.505327] tegradc tegradc.0: probed
[    0.521629] Console: switching to colour frame buffer device 128x37
[    0.541019] tegradc tegradc.0: probed
[    0.541033] host1x: tegradc tegradc
[    0.541651] nvhdcp: using "always on" policy.
[    0.541948] tegradc tegradc.1: probed
[    0.542228] tegradc tegradc.1: probed
[    0.542681] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    1.065465] serial8250.0: ttyS0 at MMIO 0x70006000 (irq = 68) is a XScale
[    1.860881] console [ttyS0] enabled
[    2.015405] serial8250.0: ttyS1 at MMIO 0x70006300 (irq = 122) is a XScale
[    2.175407] Initialized tegra uart driver
[    2.180060] brd: module loaded
[    2.183841] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    2.209323] ulpi_phy_power_on: ulpi write failed
[    2.213934] tegra-ehci tegra-ehci.1: Failed to power on the phy
[    2.219870] tegra-ehci: probe of tegra-ehci.1 failed with error -110
[    2.229823] tegra-ehci tegra-ehci.2: Tegra EHCI Host Controller
[    2.235845] tegra-ehci tegra-ehci.2: new USB bus registered, assigned bus number 1
[    2.315272] tegra-ehci tegra-ehci.2: irq 129, io mem 0xc5008000
[    2.335260] tegra-ehci tegra-ehci.2: USB 2.0 started, EHCI 1.00
[    2.341224] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    2.348013] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.355243] usb usb1: Product: Tegra EHCI Host Controller
[    2.360633] usb usb1: Manufacturer: Linux 2.6.38.3 ehci_hcd
[    2.366201] usb usb1: SerialNumber: tegra-ehci.2
[    2.371262] hub 1-0:1.0: USB hub found
[    2.375020] hub 1-0:1.0: 1 port detected
[    2.379237] Initializing USB Mass Storage driver...
[    2.384179] usbcore: registered new interface driver usb-storage
[    2.390186] USB Mass Storage support registered.
[    2.394877] usbcore: registered new interface driver libusual
[    2.400623] NVidia Tegra High-Speed USB SOC Device Controller driver (Apr 20, 2007)
[    2.413851] mousedev: PS/2 mouse device common for all mice
[    2.419868] tps6586x-rtc tps6586x-rtc.0: no IRQ specified, wakeup is disabled
[    2.495426] tps6586x-rtc tps6586x-rtc.0: rtc core: registered tps6586x-rtc as rtc0
[    2.503363] cpuidle: using governor ladder
[    2.507642] cpuidle: using governor menu
[    2.511584] sdhci: Secure Digital Host Controller Interface driver
[    2.517763] sdhci: Copyright(c) Pierre Ossman
[    2.522173] mmc0: Invalid maximum block size, assuming 512 bytes
[    2.528302] Registered led device: mmc0::
[    2.528490] mmc0: SDHCI controller on platform [sdhci-tegra.3] using ADMA
[    2.535426] mmc1: Invalid maximum block size, assuming 512 bytes
[    2.541544] Registered led device: mmc1::
[    2.541668] mmc1: SDHCI controller on platform [sdhci-tegra.0] using ADMA
[    2.548628] Registered led device: wifi-led
[    2.548922] usbcore: registered new interface driver usbhid
[    2.554485] usbhid: USB HID core driver
[    2.619433] mmc0: new high speed MMC card at address 0001
[    2.625319] mmcblk0: mmc0:0001 M8G2EM 7.46 GiB 
[    2.631998] tegrapart_partition: state->bdev->bd_disk->disk_name = mmcblk0
[    2.638876] parse_tegrapart: tegrapart=pt:600:80:800,bootloader:680:400:800,fdt:1180:12c00:800,recovery:13d80:a00:800,boot:14800:1000:800,mbr:b80:200:800,system:15880:18000:800,cache:2d900:12c00:800,misc:d80:400:800,staging:40580:1f400:800,userdata:5fa00:35b600:800
[    2.662344] parse_tegrapart: part #1 [pt] start=26664 size=6144
[    2.668267] parse_tegrapart: part #2 [bootloa] start=26664 size=6656
[    2.674611] parse_tegrapart: part #3 [fdt] start=26664 size=17920
[    2.680704] parse_tegrapart: part #4 [recover] start=26664 size=325120
[    2.687230] parse_tegrapart: part #5 [boot] start=26664 size=335872
[    2.693488] parse_tegrapart: mbr start=-1067759355
[    2.698276] tegra_msdos_parse: mbr_offset=11776
[    2.714089] tegra_msdos_parse: slot 1, start=2048 size=4096
[    2.719686] tegra_msdos_parse: put_partition
[    2.723958] tegra_msdos_parse: slot 2, start=6144 size=307200
[    2.729711] tegra_msdos_parse: put_partition
[    2.733977] tegra_msdos_parse: slot 3, start=313344 size=10240
[    2.739814] tegra_msdos_parse: put_partition
[    2.744080] tegra_msdos_parse: slot 4, start=323584 size=15360576
[    2.750177] tegra_msdos_parse: slot 4 extended partition
[    2.755494]  <
[    2.756984] tegra_msdos_parse_extended: read part sector, start=11776+323584 size=15360576
[    2.767278] tegra_msdos_parse_extended: put_partition 9 start=11776+324096 size=16384
[    2.775113] tegra_msdos_parse_extended: done with this sector
[    2.780885] tegra_msdos_parse_extended: extended part slot 2
[    2.786560] tegra_msdos_parse_extended: read part sector, start=11776+340480 size=393728
[    2.795825] tegra_msdos_parse_extended: put_partition 10 start=11776+340992 size=393216
[    2.803826] tegra_msdos_parse_extended: done with this sector
[    2.809592] tegra_msdos_parse_extended: extended part slot 2
[    2.815264] tegra_msdos_parse_extended: read part sector, start=11776+734208 size=307712
[    2.824549] tegra_msdos_parse_extended: put_partition 11 start=11776+734720 size=307200
[    2.832574] tegra_msdos_parse_extended: done with this sector
[    2.838334] tegra_msdos_parse_extended: extended part slot 2
[    2.843989] tegra_msdos_parse_extended: read part sector, start=11776+1041920 size=512512
[    2.853356] tegra_msdos_parse_extended: put_partition 12 start=11776+1042432 size=512000
[    2.861538] tegra_msdos_parse_extended: done with this sector
[    2.867307] tegra_msdos_parse_extended: extended part slot 2
[    2.872962] tegra_msdos_parse_extended: read part sector, start=11776+1554432 size=14080512
[    2.882509] tegra_msdos_parse_extended: put_partition 13 start=11776+1554944 size=14080000
[    2.890795] tegra_msdos_parse_extended: done with this sector
[    2.896554] tegra_msdos_parse_extended: done
[    2.900819]  >
[    2.902487] tegra_msdos_parse: done
[    2.905983]  mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13
[    4.555294] nvec nvec.2: timeout waiting for sync write to complete
[    4.564287] input: NVEC keyboard as /devices/virtual/input/input0
[    4.570918] Registered led device: nvec-led
[    4.571260] oprofile: using arm/armv7-ca9
[    4.576376] TCP cubic registered
[    4.580691] NET: Registered protocol family 10
[    4.587875] NET: Registered protocol family 17
[    4.592469] Registering the dns_resolver key type
[    4.597229] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 1
[    4.605020] ThumbEE CPU extension supported.
[    4.609387] Registering SWP/SWPB emulation handler
[    4.621225] registered taskstats version 1
[    4.626035] regulator_init_complete: REG-LDO_6: disabling
[    4.632499] tps6586x-rtc tps6586x-rtc.0: setting system clock to 2009-01-01 22:36:55 UTC (1230849415)
[    4.642054] Freeing init memory: 192K
[    7.555315] nvec nvec.2: timeout waiting for ec transfer
[   12.555292] nvec nvec.2: timeout waiting for ec transfer
[   17.555293] nvec nvec.2: timeout waiting for ec transfer
[   22.555292] nvec nvec.2: timeout waiting for ec transfer
[   27.555295] nvec nvec.2: timeout waiting for ec transfer
[   32.555291] nvec nvec.2: timeout waiting for ec transfer
[   37.555292] nvec nvec.2: timeout waiting for ec transfer
[   42.555296] nvec nvec.2: timeout waiting for ec transfer
[   47.555311] nvec nvec.2: timeout waiting for ec transfer
[   52.555288] nvec nvec.2: timeout waiting for ec transfer
[   57.555291] nvec nvec.2: timeout waiting for ec transfer
[   62.555291] nvec nvec.2: timeout waiting for ec transfer
[   67.555295] nvec nvec.2: timeout waiting for ec transfer
[   72.555291] nvec nvec.2: timeout waiting for ec transfer
[   77.555290] nvec nvec.2: timeout waiting for ec transfer
[   82.555291] nvec nvec.2: timeout waiting for ec transfer
[   87.555291] nvec nvec.2: timeout waiting for ec transfer
[   92.555291] nvec nvec.2: timeout waiting for ec transfer
[   97.555294] nvec nvec.2: timeout waiting for ec transfer
[  102.555292] nvec nvec.2: timeout waiting for ec transfer
[  107.555294] nvec nvec.2: timeout waiting for ec transfer
[  112.555290] nvec nvec.2: timeout waiting for ec transfer
[  117.555294] nvec nvec.2: timeout waiting for ec transfer
[  122.555293] nvec nvec.2: timeout waiting for ec transfer
[  127.555291] nvec nvec.2: timeout waiting for ec transfer
[  132.555314] nvec nvec.2: timeout waiting for ec transfer
[  137.555289] nvec nvec.2: timeout waiting for ec transfer
[  142.555294] nvec nvec.2: timeout waiting for ec transfer
[  147.555298] nvec nvec.2: timeout waiting for ec transfer
[  152.555293] nvec nvec.2: timeout waiting for ec transfer
[  157.555290] nvec nvec.2: timeout waiting for ec transfer
[  162.555289] nvec nvec.2: timeout waiting for ec transfer
[  167.555295] nvec nvec.2: timeout waiting for ec transfer
[  172.555292] nvec nvec.2: timeout waiting for ec transfer
[  177.555290] nvec nvec.2: timeout waiting for ec transfer
[  182.555291] nvec nvec.2: timeout waiting for ec transfer
[  187.555309] nvec nvec.2: timeout waiting for ec transfer
[  192.555292] nvec nvec.2: timeout waiting for ec transfer
[  197.555292] nvec nvec.2: timeout waiting for ec transfer
[  202.555293] nvec nvec.2: timeout waiting for ec transfer
[  207.555292] nvec nvec.2: timeout waiting for ec transfer
[  212.555290] nvec nvec.2: timeout waiting for ec transfer
[  217.555290] nvec nvec.2: timeout waiting for ec transfer
[  222.555290] nvec nvec.2: timeout waiting for ec transfer
[  227.555296] nvec nvec.2: timeout waiting for ec transfer
[  232.555290] nvec nvec.2: timeout waiting for ec transfer
[  237.555291] nvec nvec.2: timeout waiting for ec transfer
[  242.555295] nvec nvec.2: timeout waiting for ec transfer
[  247.555291] nvec nvec.2: timeout waiting for ec transfer
[  252.555292] nvec nvec.2: timeout waiting for ec transfer
[  257.555296] nvec nvec.2: timeout waiting for ec transfer
[  262.555291] nvec nvec.2: timeout waiting for ec transfer
[  267.555291] nvec nvec.2: timeout waiting for ec transfer
[  272.555294] nvec nvec.2: timeout waiting for ec transfer
[  277.555292] nvec nvec.2: timeout waiting for ec transfer
[  282.555292] nvec nvec.2: timeout waiting for ec transfer
[  287.555294] nvec nvec.2: timeout waiting for ec transfer
[  292.555291] nvec nvec.2: timeout waiting for ec transfer
[  297.555291] nvec nvec.2: timeout waiting for ec transfer
[  302.555290] nvec nvec.2: timeout waiting for ec transfer
[  307.555291] nvec nvec.2: timeout waiting for ec transfer
[  312.555294] nvec nvec.2: timeout waiting for ec transfer
[  317.555295] nvec nvec.2: timeout waiting for ec transfer
[  322.555296] nvec nvec.2: timeout waiting for ec transfer
[  327.555290] nvec nvec.2: timeout waiting for ec transfer
[  332.555289] nvec nvec.2: timeout waiting for ec transfer
[  337.555290] nvec nvec.2: timeout waiting for ec transfer
[  342.555291] nvec nvec.2: timeout waiting for ec transfer
[  347.555291] nvec nvec.2: timeout waiting for ec transfer
[  352.555293] nvec nvec.2: timeout waiting for ec transfer
[  357.555291] nvec nvec.2: timeout waiting for ec transfer
[  362.555292] nvec nvec.2: timeout waiting for ec transfer
[  367.555291] nvec nvec.2: timeout waiting for ec transfer
[  372.555291] nvec nvec.2: timeout waiting for ec transfer
[  377.555291] nvec nvec.2: timeout waiting for ec transfer
[  382.555290] nvec nvec.2: timeout waiting for ec transfer
[  387.555293] nvec nvec.2: timeout waiting for ec transfer
[  392.555294] nvec nvec.2: timeout waiting for ec transfer
[  397.555291] nvec nvec.2: timeout waiting for ec transfer
[  402.555293] nvec nvec.2: timeout waiting for ec transfer
[  407.555291] nvec nvec.2: timeout waiting for ec transfer
[  412.555289] nvec nvec.2: timeout waiting for ec transfer
[  417.555293] nvec nvec.2: timeout waiting for ec transfer
[  422.555289] nvec nvec.2: timeout waiting for ec transfer
[  427.555290] nvec nvec.2: timeout waiting for ec transfer
[  432.555292] nvec nvec.2: timeout waiting for ec transfer
[  437.555290] nvec nvec.2: timeout waiting for ec transfer
[  442.555293] nvec nvec.2: timeout waiting for ec transfer
[  447.555292] nvec nvec.2: timeout waiting for ec transfer
[  452.555292] nvec nvec.2: timeout waiting for ec transfer
[  457.555292] nvec nvec.2: timeout waiting for ec transfer
[  462.555291] nvec nvec.2: timeout waiting for ec transfer
[  467.555291] nvec nvec.2: timeout waiting for ec transfer
[  472.555308] nvec nvec.2: timeout waiting for ec transfer
[  477.555291] nvec nvec.2: timeout waiting for ec transfer
[  482.555291] nvec nvec.2: timeout waiting for ec transfer
[  487.555291] nvec nvec.2: timeout waiting for ec transfer
[  492.555291] nvec nvec.2: timeout waiting for ec transfer
[  497.555290] nvec nvec.2: timeout waiting for ec transfer
[  502.555295] nvec nvec.2: timeout waiting for ec transfer
[  507.555292] nvec nvec.2: timeout waiting for ec transfer
[  512.555289] nvec nvec.2: timeout waiting for ec transfer
[  517.555291] nvec nvec.2: timeout waiting for ec transfer
[  522.555291] nvec nvec.2: timeout waiting for ec transfer
[  527.555292] nvec nvec.2: timeout waiting for ec transfer
[  532.555290] nvec nvec.2: timeout waiting for ec transfer
[  537.555290] nvec nvec.2: timeout waiting for ec transfer
[  542.555289] nvec nvec.2: timeout waiting for ec transfer
[  547.555292] nvec nvec.2: timeout waiting for ec transfer
[  552.555290] nvec nvec.2: timeout waiting for ec transfer
[  557.555291] nvec nvec.2: timeout waiting for ec transfer
[  562.555291] nvec nvec.2: timeout waiting for ec transfer
[  567.555295] nvec nvec.2: timeout waiting for ec transfer
[  572.555294] nvec nvec.2: timeout waiting for ec transfer
[  577.555292] nvec nvec.2: timeout waiting for ec transfer
[  582.555291] nvec nvec.2: timeout waiting for ec transfer
[  587.555291] nvec nvec.2: timeout waiting for ec transfer
[  592.555290] nvec nvec.2: timeout waiting for ec transfer
[  597.555290] nvec nvec.2: timeout waiting for ec transfer
[  602.555710] nvec nvec.2: timeout waiting for ec transfer
[  607.554862] nvec nvec.2: timeout waiting for ec transfer
[  612.556315] nvec nvec.2: timeout waiting for ec transfer
[  617.556108] nvec nvec.2: timeout waiting for ec transfer
[  622.554936] nvec nvec.2: timeout waiting for ec transfer
[  627.555975] nvec nvec.2: timeout waiting for ec transfer
[  632.555822] nvec nvec.2: timeout waiting for ec transfer
[  637.555643] nvec nvec.2: timeout waiting for ec transfer
[  642.557033] nvec nvec.2: timeout waiting for ec transfer
[  647.555468] nvec nvec.2: timeout waiting for ec transfer
[  652.556082] nvec nvec.2: timeout waiting for ec transfer
[  657.555886] nvec nvec.2: timeout waiting for ec transfer
[  662.556455] nvec nvec.2: timeout waiting for ec transfer
[  667.556484] nvec nvec.2: timeout waiting for ec transfer
[  672.556487] nvec nvec.2: timeout waiting for ec transfer
[  677.556114] nvec nvec.2: timeout waiting for ec transfer
[  682.555636] nvec nvec.2: timeout waiting for ec transfer
[  687.555930] nvec nvec.2: timeout waiting for ec transfer
[  692.556232] nvec nvec.2: timeout waiting for ec transfer
[  697.556265] nvec nvec.2: timeout waiting for ec transfer
[  702.555626] nvec nvec.2: timeout waiting for ec transfer
[  707.555728] nvec nvec.2: timeout waiting for ec transfer
[  712.557396] nvec nvec.2: timeout waiting for ec transfer
[  717.555185] nvec nvec.2: timeout waiting for ec transfer
[  722.555816] nvec nvec.2: timeout waiting for ec transfer
[  727.556101] nvec nvec.2: timeout waiting for ec transfer
[  732.555779] nvec nvec.2: timeout waiting for ec transfer
[  737.555343] nvec nvec.2: timeout waiting for ec transfer
[  742.555670] nvec nvec.2: timeout waiting for ec transfer
[  747.555381] nvec nvec.2: timeout waiting for ec transfer
[  752.555402] nvec nvec.2: timeout waiting for ec transfer
[  757.556032] nvec nvec.2: timeout waiting for ec transfer
[  762.554762] nvec nvec.2: timeout waiting for ec transfer
[  767.555007] nvec nvec.2: timeout waiting for ec transfer
[  772.555822] nvec nvec.2: timeout waiting for ec transfer
[  777.555762] nvec nvec.2: timeout waiting for ec transfer
[  782.560918] nvec nvec.2: timeout waiting for ec transfer
[  787.559174] nvec nvec.2: timeout waiting for ec transfer
[  792.568210] nvec nvec.2: timeout waiting for ec transfer
[  797.563865] nvec nvec.2: timeout waiting for ec transfer
[  802.569226] nvec nvec.2: timeout waiting for ec transfer
[  807.567204] nvec nvec.2: timeout waiting for ec transfer
[  812.566176] nvec nvec.2: timeout waiting for ec transfer
[  817.578836] nvec nvec.2: timeout waiting for ec transfer
[  822.574822] nvec nvec.2: timeout waiting for ec transfer
[  827.575959] nvec nvec.2: timeout waiting for ec transfer
[  832.579498] nvec nvec.2: timeout waiting for ec transfer
[  837.586241] nvec nvec.2: timeout waiting for ec transfer
[  842.585382] nvec nvec.2: timeout waiting for ec transfer
[  847.585323] nvec nvec.2: timeout waiting for ec transfer
[  852.585467] nvec nvec.2: timeout waiting for ec transfer
[  857.585665] nvec nvec.2: timeout waiting for ec transfer
[  862.586255] nvec nvec.2: timeout waiting for ec transfer
[  867.585434] nvec nvec.2: timeout waiting for ec transfer
[  872.585655] nvec nvec.2: timeout waiting for ec transfer
[  877.585285] nvec nvec.2: timeout waiting for ec transfer
/ # cat /pr/ # cat /proc/[  882.585390] nvec nvec.2: timeout waiting for ec transfer
cpu/ # cat /proc/cpu
cat: read error: Is a directory
/ # / # cat /proc/cpui/ # cat /proc/cpuinfo 
Processor	: ARMv7 Processor rev 0 (v7l)
processor	: 0
BogoMIPS	: 1992.29

processor	: 1
BogoMIPS	: 19.30

Features	: swp half thumb fastmult vfp edsp thumbee vfpv3 vfpv3d16 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x1
CPU part	: 0xc09
CPU revision	: 0

Hardware	: Toshiba AC100 / Dynabook AZ
Revision	: 0000
Serial		: 0000000000000000
/ # [  887.585416] nvec nvec.2: timeout waiting for ec transfer
[  892.585535] nvec nvec.2: timeout waiting for ec transfer
lsusb
Bus 001 Device 001: ID 1d6b:0002

Lifetouch note notes

Accessing APX Mode

lifenote touch apx

There’s a unplaced switch just above the Nvidia Tegra 250 CPU shield (see image above). Connect pins 3 and 4 of SW2 while pressing the power button to enable APX mode.

Flashing a partition using nvflash

nvflash –bl /usr/lib/nvflash/fastboot.bin –download 11 ./lubuntu-12.10-preinstalled-desktop-armhf+ac100.bootimg

The Lifetouch note appears to have the LNX partition on partition 11, not 6 as the ac100.

Note: The ac100 bootimage does NOT work. The screen does some funky stuff, but nothing to indicate that it’s actually booting a kernel. (update: The SOSBoot kernel boots and the serial console works, but not the display.)

Partition table

The partition table can be dumped with nvflash –bl –getpartitiontable , mine is as follows:

PartitionId=2
Name=BCT
DeviceId=18
StartSector=0
NumSectors=1536
BytesPerSector=2048


PartitionId=3
Name=PT
DeviceId=18
StartSector=1536
NumSectors=128
BytesPerSector=2048


PartitionId=4
Name=EBT
DeviceId=18
StartSector=1664
NumSectors=1024
BytesPerSector=2048


PartitionId=5
Name=NVC
DeviceId=18
StartSector=2688
NumSectors=256
BytesPerSector=2048


PartitionId=6
Name=MBR
DeviceId=18
StartSector=2944
NumSectors=512
BytesPerSector=2048


PartitionId=7
Name=MSC
DeviceId=18
StartSector=3456
NumSectors=1024
BytesPerSector=2048


PartitionId=8
Name=MFG
DeviceId=18
StartSector=4480
NumSectors=76800
BytesPerSector=2048


PartitionId=9
Name=SOS
DeviceId=18
StartSector=81280
NumSectors=2560
BytesPerSector=2048


PartitionId=10
Name=ER1
DeviceId=18
StartSector=83840
NumSectors=128
BytesPerSector=2048


PartitionId=11
Name=LNX
DeviceId=18
StartSector=83968
NumSectors=4096
BytesPerSector=2048


PartitionId=12
Name=ER2
DeviceId=18
StartSector=88064
NumSectors=128
BytesPerSector=2048


PartitionId=13
Name=APP
DeviceId=18
StartSector=88192
NumSectors=98304
BytesPerSector=2048


PartitionId=14
Name=ER3
DeviceId=18
StartSector=186496
NumSectors=128
BytesPerSector=2048


PartitionId=15
Name=CAC
DeviceId=18
StartSector=186624
NumSectors=76800
BytesPerSector=2048


PartitionId=16
Name=ER4
DeviceId=18
StartSector=263424
NumSectors=128
BytesPerSector=2048


PartitionId=17
Name=USP
DeviceId=18
StartSector=263552
NumSectors=128000
BytesPerSector=2048


PartitionId=18
Name=ER5
DeviceId=18
StartSector=391552
NumSectors=128
BytesPerSector=2048


PartitionId=19
Name=UDA
DeviceId=18
StartSector=391680
NumSectors=3520000
BytesPerSector=2048

nvflash output

nvflash --bl /usr/lib/nvflash/fastboot.bin --download 11 ./ubuntu-12.04-preinstalled-desktop-armhf+ac100.bootimg
Nvflash started 
rcm version 0X20001                                
System Information:                               
   chip name: t20                                 
   chip id: 0x20 major: 1 minor: 3                        
   chip sku: 0x8                                  
   chip uid: XXXXXX                   
   macrovision: disabled                          
   hdcp: enabled                                  
   sbk burned: false                                       
   dk burned: false                                                      
   boot device: emmc                                                                     
   operating mode: 3                                                                                        
   device config strap: 0                                              
   device config fuse: 0                           
   sdram config strap: 0                                           
                                                                   
downloading bootloader -- load address: 0x108000 entry point: 0x108000                                  
sending file: /usr/lib/nvflash/fastboot.bin                                                  
| 940112/940112 bytes sent  
/usr/lib/nvflash/fastboot.bin sent successfully                
waiting for bootloader to initialize                                                             
bootloader downloaded successfully                                
sending file: ./ubuntu-12.04-preinstalled-desktop-armhf+ac100.bootimg                   
/ 8388608/8388608 bytes sent                                                                       
./ubuntu-12.04-preinstalled-desktop-armhf+ac100.bootimg sent successfully

PCB Images:

Bootable kernel

Kernel from: http://developer.download.nvidia.com/assets/mobile/files/tegra-linux-12.alpha.1.0.tar.gz

Boot image built with: ./bootloader/mkbootimg –kernel ./kernel/zImage –ramdisk NONE -o ~/m.img –cmdline “debug mem=128M”

Update: sosboot and probably other ac100 kernel boot and show data on the serial port.

Serial Port

There’s a 3.3v level serial port located under the SD Card slot (see additional post). No connector is mounted, you’ll need to solder one. The output is as follows:

**********Aos DebugSemiHosting Initialized*******                           
---------------------------------------------------                         
ODM CPU freq request beyond SOC limit                                       
ADJUSTED CLOCKS:                                                            
MC clock is set to 333000 KHz                                               
EMC clock is set to 666000 KHz (DDR clock is at 333000 KHz)                 
PLLX0 clock is set to 1000000 KHz                                           
PLLC0 clock is set to 600000 KHz                                            
CPU clock is set to 1000000 KHz                                             
System and AVP clock is set to 240000 KHz                                   
GraphicsHost clock is set to 108000 KHz                                     
3D clock is set to 111000 KHz                                               
2D clock is set to 111000 KHz                                               
Epp clock is set to 111000 KHz                                              
Mpe clock is set to 111000 KHz                                              
Vde clock is set to 240000 KHz                                              
DTT: TMON initialization failed                                             
Bootloader version: eng.NEC.20110609.091639                                 
                                                                            
                                                                            
I2C Slave is *New*                                                          
***NVEC:Received Spurious Response from EC.Checking for android ota recovery
                                                                            
OS will cold boot in 0 seconds if no input is detected                      
                                                                            
Key driver not found.. Booting OS                                           
                                                                            
Cold-booting Linux                                                          

Source code

There’s a source code release by NEC. I’ve uploaded it here.

Framebuffer notes

From the NEC source release:

  // these values are just defaults. they will be over-written with th
  // correct values from the boot args.                               
  .var = {                                                            
    .xres   = 800,                                                    
    .yres   = 480,                                                    
    .xres_virtual = 800,                                              
    .yres_virtual = 480,                                              
    .bits_per_pixel = 16,                                             
    .red    = {11, 5, 0},                                             
    .green    = {5, 6, 0},                                            
    .blue   = {0, 5, 0},                                              
    .transp   = {0, 0, 0},                                            
    .activate = FB_ACTIVATE_NOW,                                      
    .height   = -1,                                                   
    .width    = -1,                                                   
    .pixclock = 24500,                                                
    .left_margin  = 0,                                                
    .right_margin = 0,                                                
    .upper_margin = 0,                                                
    .lower_margin = 0,                                                
    .hsync_len  = 0,                                                  
    .vsync_len  = 0,                                                  
    .vmode    = FB_VMODE_NONINTERLACED,                               
  },                                                                  

AC100 config, patch to use different display:

--- marvin-2.6.38.8-oc/arch/arm/mach-tegra/board-paz00-panel.c.old	2011-09-19 19:33:24.000000000 +0100
+++ marvin-2.6.38.8-oc/arch/arm/mach-tegra/board-paz00-panel.c	2011-12-29 23:56:45.588167000 +0000
@@ -251,7 +251,7 @@
 	{
 		.name	= "fbmem",
 		.start	= 0x1fd95000,
-		.end	= 0x1fd95000 + 0x26B000 - 1,   // 2.4 MB @ 509 MB
+		.end	= 0x1fd95000 + 0x384000 - 1,   // 2.4 MB @ 509 MB
 		.flags	= IORESOURCE_MEM,
 	},
 };
@@ -279,15 +279,15 @@
 
 static struct tegra_dc_mode paz00_panel_modes[] = {
 	{
-		.pclk = 42430000,
+		.pclk = 71735520,
 		.h_ref_to_sync = 4,
 		.v_ref_to_sync = 2,
 		.h_sync_width = 136,
 		.v_sync_width = 4,
 		.h_back_porch = 138,
 		.v_back_porch = 21,
-		.h_active = 1024,
-		.v_active = 600,
+		.h_active = 1280,
+		.v_active = 720,
 		.h_front_porch = 34,
 		.v_front_porch = 4,
 	},
@@ -295,8 +295,8 @@
 
 static struct tegra_fb_data paz00_fb_data = {
 	.win		= 0,
-	.xres		= 1024,
-	.yres		= 600,
+	.xres		= 1280,
+	.yres		= 720,
 	.bits_per_pixel	= 16,
 };
 

Building a debian package for gromacs 4.0.5 under Ubuntu 12.04

I based my build on this set of instructions. These notes are mostly to remind me what I had to do to build this particular package, and the issues I ran into. There maybe omissions, this is mostly from memory.

gromacs itself seems to contain a half working deb package build system, with some missing files. There is a debian package for the current version of gromacs (4.5.5 IIRC), it might be better to take the debian config files from this. The configuration file below also added a suffix to gromacs commands, so both 4.5.5 and 4.0.5 can be installed concurrently.

0. Do not do this on an NFS drive with root squashing, install tries to change the file ownership to root and breaks. Install build-essentials and a bunch of other things (see above URL).
1. Rename the gromacs tarball to gromacs_4.0.5.orig.tar.gz
2. Untar it (tar -xvf gromacs_4.0.5.orig.tar.gz).
3. cd gromacs-4.0.5
4. mkdir debian
5. mkdir debian/source
6. touch debian/copyright
7. Create debian/compat, should contain the single number 8.
8. Use the following to create a changelog:

dch --create -v 4.0.5-1 --package gromacs405

9. Create a file debian/rules with the following contents (this is a makefile, spaces at the start of lines need to be tab characters):

#!/usr/bin/make -f
%:
        dh $@

override_dh_auto_configure:
        dh_auto_configure -- --program-suffix=405 --prefix=/usr --docdir=/usr/share/gromacs405 --includedir=/usr/include/gromacs405 --htmldir=/usr/share/gromacs405 --datadir=/usr/share/gromacs405 --enable-static=no --libdir=/usr/lib/gromacs405

override_dh_auto_install:
        $(MAKE) DESTDIR=$$(pwd)/debian/gromacs405 install

override_dh_install:
        sed -i "/dependency_libs/ s/'.*'/''/" `find . -name '*.la'`
        dh_install

10. Create a file debian/source/format with the following contents:

3.0 (quilt)

11. Run this to build everything:

debuild -us -uc

12. Your deb should be built.

Progressive PNG rendering using libpng, quick example

Here’s a quick, complete example of progressive (interlaced) PNG rendering using libpng. It’s based on the example in the libpng manual, but filled out so it’s a complete program:

#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>

#define PNG_DEBUG 3
#include <png.h>

int width, height;
int pixel_depth;

png_structp png_ptr;
png_infop   info_ptr;
png_bytep * row_pointers;

/* This function is called (as set by png_set_progressive_read_fn() above) when enough data has been supplied so all of the header has been read.  */
void info_callback(png_structp png_ptr, png_infop info) {
/* Do any setup here, including setting any of the transformations mentioned in the Reading PNG files section. For now, you _must_ call either png_start_read_image() or png_read_update_info() after all the transformations are set (even if you don’t set any). You may start getting rows before png_process_data() returns, so this is your last chance to prepare for that.  */

  printf("image height %u\n",info->height);
  printf("image width  %u\n",info->width );
  printf("pixel depth  %u\n",info->pixel_depth);

  width  = info->width;
  height = info->height;
  pixel_depth = info->pixel_depth;

  row_pointers = malloc(sizeof(png_bytep *) * info->height);
  for(size_t n=0;n<info->height;n++) {
    row_pointers[n] = malloc(info->rowbytes);
  }

  png_start_read_image(png_ptr);
}

int get_pixel(char *row,int pixel_depth,int idx) {

  int pos  = pixel_depth*idx;

  int byte = pos/8;
  int bit  = pos-((pos/8)*8);

  int value = 0;
  for(int n=0;n<pixel_depth;n++) {
    value = value << 1;
    if(row[byte] & (1 << (8-bit))) value |= (value + 1);
    bit++;
    if(bit > 8) {bit=0; byte++;}
  }
  return value;
}

/* This function is called when each row of image data is complete */
void row_callback(png_structp png_ptr, png_bytep new_row, png_uint_32 row_num, int pass) {
  /* If the image is interlaced, and you turned on the interlace handler, this function will be called for every row in every pass. Some of these rows will not be changed from the previous pass. When the row is not changed, the new_row variable will be NULL. The rows and passes are called in order, so you don’t really need the row_num and pass, but I’m supplying them because it may make your life easier.  For the non-NULL rows of interlaced images, you must call png_progressive_combine_row() passing in the row and the old row. You can call this function for NULL rows (it will just return) and for non-interlaced images (it just does the memcpy for you) if it will make the code easier. Thus, you can just do this for all cases: */

  printf("read line: %u: ",row_num);
  png_progressive_combine_row(png_ptr, row_pointers[row_num], new_row);
  for(int n=0;n<width;n++) {
    int pixel = get_pixel(row_pointers[row_num],pixel_depth,n);
    if(pixel == 0) printf("0"); else printf("1");
  }
  printf("\n");
  /* where old_row is what was displayed for previously for the row. Note that the first pass (pass == 0, really) will completely cover the old row, so the rows do not have to be initialized. After the first pass (and only for interlaced images), you will have to pass the current row, and the function will combine the old row and the new row.  */
}


int file_end=0;
void end_callback(png_structp png_ptr, png_infop info) {
/* This function is called after the whole image has been read, including any chunks after the image (up to and including the IEND). You will usually have the same info chunk as you had in the header, although some data may have been added to the comments and time fields.  Most people won’t do much here, perhaps setting a flag that marks the image as finished.  */
  printf("processing complete\n");
  file_end=1;
}

/* An example code fragment of how you would initialize the progressive reader in your application. */
int initialize_png_reader() {
  png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, (png_voidp)NULL,NULL,NULL);
  if(!png_ptr) return 1;
  info_ptr = png_create_info_struct(png_ptr);
  if(!info_ptr) {
    png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
    return 1;
  }
  if(setjmp(png_jmpbuf(png_ptr))) {
    png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
    return 1;
  }
  /* This one’s new. You can provide functions to be called when the header info is valid, when each row is completed, and when the image is finished. If you aren’t using all functions, you can specify NULL parameters. Even when all three functions are NULL, you need to call png_set_progressive_read_fn(). You can use any struct as the user_ptr (cast to a void pointer for the function call), and retrieve the pointer from inside the callbacks using the function png_get_progressive_ptr(png_ptr); which will return a void pointer, which you have to cast appropriately.  */
  png_set_progressive_read_fn(png_ptr, (void *)NULL, info_callback, row_callback, end_callback);
  return 0;
}

/* A code fragment that you call as you receive blocks of data */
int process_data(png_bytep buffer, png_uint_32 length) {
  if (setjmp(png_jmpbuf(png_ptr))) {
    png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
    return 1;
  }
  /* This one’s new also. Simply give it a chunk of data from the file stream (in order, of course). On machines with segmented memory models machines, don’t give it any more than 28 64K. The library seems to run fine with sizes of 4K. Although you can give it much less if necessary (I assume you can give it chunks of 1 byte, I haven’t tried less then 256 bytes yet). When this function returns, you may want to display any rows that were generated in the row callback if you don’t already do so there.  */
  png_process_data(png_ptr, info_ptr, buffer, length);
  return 0;
}

int main(int argc, char **argv) {
  initialize_png_reader();

  FILE *fp = fopen("test.png", "rb");

  char buffer[1025];
  for(;;) {
    int length = fread(buffer,1,1024,fp);
    process_data(buffer,length);
    if(file_end) break;
  }
  fclose(fp);

  return 0;
}

It’s C99 C and maybe compiled with:

gcc -std=gnu99 png.c -lpng 

Here’s a copy of test.png which you can use with this example: http://41j.com/blog/wp-content/uploads/2012/12/test.png. It was created using imagemagick as follows:

convert -interlace PNG input.png test.png