页次: 1
感谢楼主分享, 一楼那个重置 root 密码的命令行可以用.
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
mysql>
mysql> select authentication_string from user;
+-------------------------------------------+
| authentication_string |
+-------------------------------------------+
| |
| *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| *384DF59F36979048940D28EE1FB7B068A79D5FDD |
+-------------------------------------------+
4 rows in set (0.00 sec)
mysql>
mysql>
mysql> select User,authentication_string from user;
+------------------+-------------------------------------------+
| User | authentication_string |
+------------------+-------------------------------------------+
| root | |
| mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| debian-sys-maint | *384DF59F36979048940D28EE1FB7B068A79D5FDD |
+------------------+-------------------------------------------+
4 rows in set (0.00 sec)
mysql> UPDATE mysql.user SET authentication_string = PASSWORD('whycan') WHERE user = 'root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> select authentication_string from user;
+-------------------------------------------+
| authentication_string |
+-------------------------------------------+
| *FAFBF4B590C56408440484A17E27C30A2635F64A |
| *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| *384DF59F36979048940D28EE1FB7B068A79D5FDD |
+-------------------------------------------+
4 rows in set (0.00 sec)
$ sudo mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.31-0ubuntu0.18.04.1 (Ubuntu)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> UPDATE mysql.user SET authentication_string = PASSWORD('whycan') WHERE user = 'root';
Query OK, 0 rows affected, 1 warning (0.01 sec)
Rows matched: 1 Changed: 0 Warnings: 1
mysql> UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE user = 'root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> exit
Bye
Ubuntu18.04安装mysql默认是没有密码设置的菜单, 装好之后mysql是空密码.
跑完上面的命令之后, 执行 service apache2 restart 就可以使用新密码了.
1. f1c100s linux bsp 到licheepi nano logo 信息显示 <starting USB No controllers found>介决办法
2. git clone https://github.com/Icenowy/u-boot.git -b f1c100s-spiflash 加快下载速度办法
ARCH=arm make menuconfig
把USB选项都关了就行.
在朋友推荐下, 买了两根16G的DDR4 1.2V内存条,可以组成双通.
又忘记怎么拆机了, 赶紧打开视频看下: https://www.bilibili.com/video/BV1Xs411A7jz
跑3个vmware + ubuntu 18.04妥妥的, 浏览器窗口秒开.
zImage或者dtb 有问题或者不完整, 用这个逐个替换: https://whycan.cn/t_3400.html#p47841
https://www.zhihu.com/question/374518368
来自微盟官网的消息,微盟的业务系统数据库(包括主备)遭遇其公司运维人员的删除。目前微盟技术团队正在努力恢复数据,但数据恢复较慢。目前对新用户服务已经恢复正常,但老用户数据官方预计要到2月28日才有结果。
微盟这次事故有点大,
腾讯云差点因此背锅,
还好在腾讯云的帮助下恢复了比较早的备份数据,
据说微店用户一片哀嚎。
真是没想到一个上市公司,管理如此混乱,
我相信微盟不是最后一个。
https://www.zhihu.com/question/374518368
来自微盟官网的消息,微盟的业务系统数据库(包括主备)遭遇其公司运维人员的删除。目前微盟技术团队正在努力恢复数据,但数据恢复较慢。目前对新用户服务已经恢复正常,但老用户数据官方预计要到2月28日才有结果。
你好,晕哥,请问楼主的那个参考程序,如何在win7的环境下用什么工具编译啊
https://whycan.cn/t_3649.html#p33367
编译软件下载: https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update
Linux 编译软件下载: gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2
编译软件可以用上面的gcc, windows/linux 版本都有,
make 在 linux自带, windows 的 msys 软件包也带 make.
https://www.raspberrypi.org/forums/viewtopic.php?t=120785
http://blog.davidou.org/archives/1018
现在我想把屏幕旋转 90/270度, 死活没搞定, 参考上面两个链接, 修改 /boot/config.txt
display_rotate=1
lcd_rotate=1
这两种设置都不行。
Debian GNU/Linux 8 awfans ttyS0
awfans login: [ 15.660271] random: crng init done
[ 25.520351] pcmanfm invoked oom-killer: gfp_mask=0x14200ca(GFP_HIGHUSER_MOVABLE), nodemask=0, order=0, oom_score_adj=0
[ 25.531304] CPU: 0 PID: 311 Comm: pcmanfm Not tainted 4.10.2-licheepi-zero+ #15
[ 25.538608] Hardware name: Allwinner sun8i Family
[ 25.543348] [<c010e2fc>] (unwind_backtrace) from [<c010b098>] (show_stack+0x10/0x14)
[ 25.551092] [<c010b098>] (show_stack) from [<c035abe4>] (dump_stack+0x84/0x98)
[ 25.558318] [<c035abe4>] (dump_stack) from [<c01ee010>] (dump_header.constprop.4+0x6c/0x190)
[ 25.566755] [<c01ee010>] (dump_header.constprop.4) from [<c01aca20>] (oom_kill_process+0x310/0x4fc)
[ 25.575793] [<c01aca20>] (oom_kill_process) from [<c01acef4>] (out_of_memory+0xec/0x430)
[ 25.583877] [<c01acef4>] (out_of_memory) from [<c01b13ac>] (__alloc_pages_nodemask+0xa64/0xa84)
[ 25.592568] [<c01b13ac>] (__alloc_pages_nodemask) from [<c01d15b4>] (handle_mm_fault+0x718/0x9b0)
[ 25.601437] [<c01d15b4>] (handle_mm_fault) from [<c0113cb4>] (do_page_fault+0x2b4/0x380)
[ 25.609522] [<c0113cb4>] (do_page_fault) from [<c01012d8>] (do_DataAbort+0x3c/0xbc)
[ 25.617171] [<c01012d8>] (do_DataAbort) from [<c010bedc>] (__dabt_usr+0x3c/0x40)
[ 25.624556] Exception stack(0xc319dfb0 to 0xc319dff8)
[ 25.629603] dfa0: 00000044 000000ff 00000044 b5ebe078
[ 25.637772] dfc0: 0000007f b5396003 000000ff 0000033c b5b80000 b5b7e804 00001e00 000017fc
[ 25.645938] dfe0: b6a29569 beeda4f0 b5ebc747 b5ebc748 80070030 ffffffff
[ 25.652650] Mem-Info:
[ 25.654946] active_anon:9777 inactive_anon:1043 isolated_anon:0
[ 25.654946] active_file:49 inactive_file:54 isolated_file:0
[ 25.654946] unevictable:0 dirty:0 writeback:0 unstable:0
[ 25.654946] slab_reclaimable:590 slab_unreclaimable:1281
[ 25.654946] mapped:139 shmem:1666 pagetables:221 bounce:0
[ 25.654946] free:229 free_pcp:4 free_cma:0
[ 25.686918] Node 0 active_anon:39108kB inactive_anon:4172kB active_file:196kB inactive_file:216kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:556kB dirty:0kB writeback:0kB shmem:6664kB writeback_tmp:0kB unstable:0kB pages_scanned:1736 all_unreclaimable? yes
[ 25.711157] Normal free:916kB min:924kB low:1152kB high:1380kB active_anon:39108kB inactive_anon:4172kB active_file:196kB inactive_file:216kB unevictable:0kB writepending:0kB present:64036kB managed:54652kB mlocked:0kB slab_reclaimable:2360kB slab_unreclaimable:5124kB kernel_stack:632kB pagetables:884kB bounce:0kB free_pcp:16kB local_pcp:16kB free_cma:0kB
[ 25.742568] lowmem_reserve[]: 0 0 0
[ 25.746075] Normal: 83*4kB (UE) 73*8kB (UE) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 916kB
[ 25.757229] 1773 total pagecache pages
[ 25.760978] 0 pages in swap cache
[ 25.764288] Swap cache stats: add 0, delete 0, find 0/0
[ 25.769521] Free swap = 0kB
[ 25.772396] Total swap = 0kB
[ 25.775287] 16009 pages RAM
[ 25.778076] 0 pages HighMem/MovableOnly
[ 25.781904] 2346 pages reserved
[ 25.785053] [ pid ] uid tgid total_vm rss nr_ptes nr_pmds swapents oom_score_adj name
[ 25.793586] [ 80] 0 80 1845 175 6 0 0 0 systemd-journal
[ 25.803078] [ 91] 0 91 2446 108 5 0 0 -1000 systemd-udevd
[ 25.812390] [ 217] 0 217 1635 115 8 0 0 -1000 sshd
[ 25.820923] [ 218] 0 218 12499 313 15 0 0 0 NetworkManager
[ 25.830319] [ 220] 0 220 9653 338 12 0 0 0 ModemManager
[ 25.839543] [ 221] 0 221 714 47 5 0 0 0 cron
[ 25.848074] [ 225] 0 225 774 66 4 0 0 0 systemd-logind
[ 25.857471] [ 227] 105 227 1177 111 6 0 0 -900 dbus-daemon
[ 25.866609] [ 237] 0 237 8394 139 10 0 0 0 polkitd
[ 25.875399] [ 239] 0 239 496 30 5 0 0 0 agetty
[ 25.884087] [ 244] 0 244 451 29 4 0 0 0 agetty
[ 25.892793] [ 249] 0 249 10405 133 12 0 0 0 lightdm
[ 25.901583] [ 255] 0 255 8148 1385 16 0 0 0 Xorg
[ 25.910112] [ 268] 0 268 6676 150 11 0 0 0 lightdm
[ 25.918901] [ 276] 0 276 1031 173 5 0 0 0 systemd
[ 25.927690] [ 279] 0 279 1570 346 5 0 0 0 (sd-pam)
[ 25.936566] [ 282] 0 282 6219 230 12 0 0 0 lxsession
[ 25.945529] [ 297] 0 297 728 49 4 0 0 0 ssh-agent
[ 25.954478] [ 306] 0 306 4222 377 12 0 0 0 openbox
[ 25.963269] [ 308] 0 308 6370 219 12 0 0 0 lxpolkit
[ 25.972147] [ 310] 0 310 9938 513 17 0 0 0 lxpanel
[ 25.980935] [ 311] 0 311 9087 4005 21 0 0 0 pcmanfm
[ 25.989724] [ 318] 0 318 728 49 5 0 0 0 ssh-agent
[ 25.998688] [ 322] 0 322 3527 65 6 0 0 0 menu-cached
[ 26.007841] Out of memory: Kill process 311 (pcmanfm) score 285 or sacrifice child
[ 26.015442] Killed process 311 (pcmanfm) total-vm:36348kB, anon-rss:16004kB, file-rss:16kB, shmem-rss:0kB
[ 26.609096] oom_reaper: reaped process 311 (pcmanfm), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
Debian GNU/Linux 8 awfans ttyS0
发现一启动就出现爆内存错误.
然后我把TF卡插回电脑ubuntu, 用gparted添加一个128M swap分区,
修改 /etc/fstab
/dev/mmcblk0p1 /boot vfat noatime 0 1
/dev/mmcblk0p2 / ext4 noatime 0 1
/dev/mmcblk0p3 swap swap defaults 0 0
proc /proc proc defaults 0 0
重新插入V3s启动:
[ 3.546466] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ 4.568043] Adding 131068k swap on /dev/mmcblk0p3. Priority:-1 extents:1 across:131068k SS
[ 4.637629] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
现在没有内存错误了.
https://www.maketecheasier.com/enable-autologin-lightdm/
修改这个文件: /etc/lightdm/lightdm.conf
autologin-guest=false
autologin-user=root
autologin-user-timeout=0
就可以自动启动到桌面了
TF卡用的是晕哥同款金弓达32G: https://whycan.cn/t_3091.html#p26065
#cat /etc/fstab:
/dev/mmcblk0p1 /boot vfat noatime 0 1
/dev/mmcblk0p2 / ext4 noatime 0 1
#/dev/mmcblk0p3 swap swap defaults 0 0
proc /proc proc defaults 0 0
root@licheepi:~# grep swap -r /etc/
/etc/init/networking.conf: check_network_swap() {
/etc/init/networking.conf: [ -e /proc/swaps ] || return 0
/etc/init/networking.conf: log_warning_msg "not deconfiguring network interfaces: network swap still mounted."
/etc/init/networking.conf: done < /proc/swaps
/etc/init/networking.conf: check_network_swap
/etc/init.d/checkfs.sh:. /lib/init/swap-functions.sh
/etc/init.d/checkfs.sh: # Execute swapon command again, in case there are lvm
/etc/init.d/checkfs.sh: # or md swap partitions. fsck can suck RAM.
/etc/init.d/checkfs.sh: swaponagain 'lvm and md'
/etc/init.d/mountall.sh:. /lib/init/swap-functions.sh
/etc/init.d/mountall.sh: # Execute swapon command again, in case we want to swap to
/etc/init.d/mountall.sh: swaponagain 'swapfile'
/etc/init.d/mountall.sh: # Remount tmpfs filesystems; with increased VM after swapon,
/etc/init.d/mountall.sh: # mount a tmpfs on /tmp. We can now also determine swap size
/etc/init.d/checkroot.sh: # Activate the swap device(s) in /etc/fstab. This needs to be done
/etc/init.d/checkroot.sh: [ "$VERBOSE" = no ] || log_warning_msg "Not activating swap as requested via bootoption noswap."
/etc/init.d/checkroot.sh: if [ "$swap_on_lv" = yes ]
/etc/init.d/checkroot.sh: [ "$VERBOSE" = no ] || log_warning_msg "Not activating swap on logical volume."
/etc/init.d/checkroot.sh: elif [ "$swap_on_file" = yes ]
/etc/init.d/checkroot.sh: [ "$VERBOSE" = no ] || log_warning_msg "Not activating swap on swapfile."
/etc/init.d/checkroot.sh: log_action_begin_msg "Activating swap"
/etc/init.d/checkroot.sh: swapon -a -e >/dev/null 2>&1
/etc/init.d/checkroot.sh: log_daemon_msg "Activating swap"
/etc/init.d/checkroot.sh: swapon -a -v
/etc/init.d/checkroot.sh: # If / is read-write or swap is enabled, this script have done
/etc/init.d/checkroot.sh: swapon=false
/etc/init.d/checkroot.sh: if [ -f /proc/swaps ] ; then
/etc/init.d/checkroot.sh: if [ "$(cat /proc/swaps |grep -v ^Filename)" ] ; then
/etc/init.d/checkroot.sh: swapon=true
/etc/init.d/checkroot.sh: if [ true = "$rootrw" ] || [ true = "$swapon" ] ; then
/etc/init.d/umountfs:# Short-Description: Turn off swap and unmount all local file systems.
/etc/init.d/umountfs: # swap, to avoid running out of memory if the tmpfs filesystems
/etc/init.d/umountfs: # Deactivate swap
/etc/init.d/umountfs: log_action_begin_msg "Deactivating swap"
/etc/init.d/umountfs: swapoff -a >/dev/null
/etc/init.d/umountfs: log_daemon_msg "Will now deactivate swap"
/etc/init.d/umountfs: swapoff -a -v
/etc/init.d/networking:check_network_swap() {
/etc/init.d/networking: [ -e /proc/swaps ] || return 0
/etc/init.d/networking: log_warning_msg "not deconfiguring network interfaces: network swap still mounted."
/etc/init.d/networking: done < /proc/swaps
/etc/init.d/networking: check_network_swap
/etc/fstab:#/dev/mmcblk0p3 swap swap defaults 0 0
/proc/swaps 这文件啥也没有:
root@licheepi:~# cat /proc/swaps
Filename
从上面看起来好像并没有启用 swap 文件.
root@LicheePi:~# ps -Af
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 08:05 ? 00:00:03 /sbin/init earlyprintk
root 2 0 0 08:05 ? 00:00:00 [kthreadd]
root 4 2 0 08:05 ? 00:00:00 [kworker/0:0H]
root 5 2 0 08:05 ? 00:00:00 [kworker/u2:0]
root 6 2 0 08:05 ? 00:00:00 [ksoftirqd/0]
root 7 2 0 08:05 ? 00:00:00 [rcu_sched]
root 8 2 0 08:05 ? 00:00:00 [rcu_bh]
root 9 2 0 08:05 ? 00:00:00 [migration/0]
root 10 2 0 08:05 ? 00:00:00 [lru-add-drain]
root 11 2 0 08:05 ? 00:00:00 [cpuhp/0]
root 12 2 0 08:05 ? 00:00:00 [kdevtmpfs]
root 13 2 0 08:05 ? 00:00:00 [netns]
root 14 2 0 08:05 ? 00:00:00 [oom_reaper]
root 15 2 0 08:05 ? 00:00:00 [writeback]
root 16 2 0 08:05 ? 00:00:00 [kcompactd0]
root 17 2 0 08:05 ? 00:00:00 [crypto]
root 18 2 0 08:05 ? 00:00:00 [bioset]
root 19 2 0 08:05 ? 00:00:00 [kblockd]
root 20 2 0 08:05 ? 00:00:00 [cfg80211]
root 22 2 0 08:05 ? 00:00:00 [watchdogd]
root 23 2 0 08:05 ? 00:00:00 [rpciod]
root 24 2 0 08:05 ? 00:00:00 [xprtiod]
root 25 2 0 08:05 ? 00:00:02 [kswapd0]
root 26 2 0 08:05 ? 00:00:00 [vmstat]
root 27 2 0 08:05 ? 00:00:00 [bioset]
root 28 2 0 08:05 ? 00:00:00 [nfsiod]
root 53 2 0 08:05 ? 00:00:00 [irq/23-sunxi-mm]
root 56 2 0 08:05 ? 00:00:00 [bioset]
root 57 2 0 08:05 ? 00:00:02 [mmcqd/0]
root 58 2 0 08:05 ? 00:00:00 [kworker/0:1H]
root 59 2 0 08:05 ? 00:00:00 [jbd2/mmcblk0p2-]
root 60 2 0 08:05 ? 00:00:00 [ext4-rsv-conver]
root 75 2 0 08:05 ? 00:00:00 [kworker/u2:1]
root 79 1 0 08:05 ? 00:00:00 /lib/systemd/systemd-journald
root 91 1 0 08:05 ? 00:00:00 /lib/systemd/systemd-udevd
root 217 1 0 08:06 ? 00:00:00 /usr/sbin/sshd -D
root 218 1 0 08:06 ? 00:00:00 /usr/sbin/NetworkManager --no-da
root 220 1 0 08:06 ? 00:00:00 /usr/sbin/ModemManager
root 223 1 0 08:06 ? 00:00:00 /usr/sbin/cron -f
root 225 1 0 08:06 ? 00:00:00 /lib/systemd/systemd-logind
message+ 227 1 0 08:06 ? 00:00:00 /usr/bin/dbus-daemon --system --
root 237 1 0 08:06 ? 00:00:00 /usr/lib/policykit-1/polkitd --n
root 240 1 0 08:06 tty1 00:00:00 /sbin/agetty --noclear tty1 linu
root 244 1 0 08:06 ttyS0 00:00:00 /bin/login --
root 248 1 0 08:06 ? 00:00:00 /usr/sbin/lightdm
root 254 248 1 08:06 tty7 00:00:22 /usr/bin/X :0 -seat seat0 -auth
root 268 248 0 08:06 ? 00:00:00 lightdm --session-child 17 20
lightdm 272 1 0 08:06 ? 00:00:00 /lib/systemd/systemd --user
lightdm 275 272 0 08:06 ? 00:00:00 (sd-pam)
lightdm 278 268 1 08:06 ? 00:00:18 /usr/sbin/lightdm-gtk-greeter
root 285 1 0 08:06 ? 00:00:00 /lib/systemd/systemd --user
root 288 285 0 08:06 ? 00:00:00 (sd-pam)
root 293 244 0 08:06 ttyS0 00:00:00 -bash
root 298 248 0 08:06 ? 00:00:00 lightdm --session-child 13 20
root 303 2 0 08:16 ? 00:00:02 [kworker/0:2]
root 315 2 0 08:21 ? 00:00:00 [kworker/0:0]
root 316 2 0 08:26 ? 00:00:00 [kworker/0:1]
root 317 293 4 08:28 ttyS0 00:00:00 ps -Af
这个不知道怎么可以做到如此精简
root@LicheePi:~# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 1047676 906040 70368 93% /
devtmpfs 26812 0 26812 0% /dev
tmpfs 27324 0 27324 0% /dev/shm
tmpfs 27324 6668 20656 25% /run
tmpfs 5120 0 5120 0% /run/lock
tmpfs 27324 0 27324 0% /sys/fs/cgroup
/dev/mmcblk0p1 16334 4300 12034 27% /boot
tmpfs 5468 0 5468 0% /run/user/106
tmpfs 5468 0 5468 0% /run/user/0
http://zero.lichee.pro/%E8%B4%A1%E7%8C%AE/article%201.html
rootfs-minX.tar.gz debian(包含桌面系统)
这个带桌面的 debian 压缩后才 200M 左右, 怎么做到的?
建议看下Android源码里的,hardware/ril/reference-ril,很有参考价值。
是这个吗? https://github.com/mozilla-b2g/android-hardware-ril/tree/master/reference-ril
brd: module loaded
nuc970 mtd nand driver version: 20160331
NAND device: Manufacturer ID: 0xef, Chip ID: 0xf1 (Winbond NAND 128MiB 3,3V 8-bit), 128MiB, page size: 2048, OOB size: 64
nand: SMRA size 64, 32
Bad block table found at page 65472, version 0x01
Bad block table found at page 65408, version 0x01
感觉确实是 nand 驱动出问题了
参考 https://whycan.cn/t_2294.html
编译一个 qt analogclock demo:
cd /opt/buildroot-2019.08-hf/output/build/qt5base-5.12.4/examples/widgets/widgets/analogclock
/opt/buildroot-2019.08-hf/output/host/bin/qmake analogclock.pro
make
###复制到文件系统###
cp analogclock /opt/buildroot-2019.08-hf/output/target/usr/bin/
配置文件下载: buildroot_201908_hf_20190911A_config.tgz
wget https://buildroot.org/downloads/buildroot-2019.08.tar.gz
mkdir /opt/buildroot-2019.08-hf -p
tar xvf buildroot-2019.08.tar.gz -C /opt/buildroot-2019.08-hf
cd /opt/buildroot-2019.08-hf
wget https://whycan.cn/files/members/713/buildroot_201908_hf_20190911A_config.tgz
tar xvf buildroot_201908_hf_20190911A_config.tgz -C /opt/buildroot-2019.08-hf
make menuconfig ###退出/保存
make ###编译
官方代码仓库: https://code.opensource.huaweicloud.com/HarmonyOS/OpenArkCompiler/
gitee 镜像代码仓库: https://gitee.com/harmonyos/OpenArkCompiler
官方网站: https://www.openarkcompiler.cn/
华为方舟编译器正式开源 脱离 GitHub 实现自主托管: https://www.cnbeta.com/articles/tech/887529.htm
抄个PyQt 程序玩玩: https://build-system.fman.io/pyqt5-tutorial
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QVBoxLayout
app = QApplication([])
window = QWidget()
layout = QVBoxLayout()
layout.addWidget(QPushButton('Top'))
layout.addWidget(QPushButton('Bottom'))
window.setLayout(layout)
window.show()
app.exec_()
跑起来了:
|█████████████████████ | 32.7MB 15kB/s eta 0
|█████████████████████ | 32.7MB 15kB/s eta 0
|█████████████████████ | 32.7MB 15kB/s eta 0
|█████████████████████ | 32.7MB 15kB/s eta 0
|█████████████████████ | 32.7MB 19kB/s eta 0
|█████████████████████ | 32.7MB 19kB/s eta 0
|█████████████████████ | 32.7MB 17kB/s eta 0
|█████████████████████ | 32.8MB 14kB/s eta 0
|█████████████████████ | 32.8MB 14kB/s eta 0
|█████████████████████ | 32.8MB 14kB/s eta 0
|█████████████████████ | 32.8MB 16kB/s eta 0
|█████████████████████ | 32.8MB 16kB/s eta 0
|█████████████████████ | 32.8MB 16kB/s eta 0
|█████████████████████ | 32.8MB 14kB/s eta 0
|█████████████████████ | 32.8MB 14kB/s eta 0
|█████████████████████ | 32.8MB 14kB/s eta 0
|█████████████████████ | 32.8MB 15kB/s eta 0
|█████████████████████ | 32.9MB 15kB/s eta 0
|█████████████████████ | 32.9MB 20kB/s eta 0
|█████████████████████ | 32.9MB 20kB/s eta 0
|█████████████████████ | 32.9MB 20kB/s eta 0
|█████████████████████ | 32.9MB 15kB/s eta 0
|█████████████████████ | 32.9MB 12kB/s eta 0
|█████████████████████ | 32.9MB 12kB/s eta 0
|█████████████████████ | 32.9MB 12kB/s eta 0
|█████████████████████ | 32.9MB 12kB/s eta 0
|█████████████████████ | 33.0MB 12kB/s eta 0
|█████████████████████ | 33.0MB 10kB/s eta 0
|█████████████████████ | 33.0MB 10kB/s eta 0
|█████████████████████ | 33.0MB 7.9kB/s eta
|█████████████████████ | 33.0MB 7.4kB/s eta
|█████████████████████ | 33.0MB 7.7kB/s eta
|█████████████████████ | 33.0MB 7.7kB/s eta
|█████████████████████ | 33.0MB 7.7kB/s eta
|█████████████████████ | 33.0MB 7.7kB/s eta
|█████████████████████ | 33.0MB 9.2kB/s eta
|█████████████████████ | 33.1MB 9.2kB/s eta
|█████████████████████ | 33.1MB 9.2kB/s eta
|█████████████████████ | 33.1MB 10kB/s eta 0
|█████████████████████ | 33.1MB 10kB/s eta 0
|█████████████████████ | 33.1MB 10kB/s eta 0
|█████████████████████ | 33.1MB 10kB/s eta 0
|█████████████████████ | 33.1MB 29kB/s eta 0
|█████████████████████ | 33.1MB 29kB/s eta 0
|█████████████████████ | 33.1MB 24kB/s eta 0
|█████████████████████ | 33.1MB 24kB/s eta 0
|█████████████████████▌ | 33.2MB 24kB/s eta
|█████████████████████▌ | 33.2MB 24kB/s eta
|█████████████████████▌ | 33.2MB 26kB/s eta
|█████████████████████▌ | 33.2MB 26kB/s eta
|█████████████████████▌ | 33.2MB 26kB/s eta
|█████████████████████▌ | 33.2MB 21kB/s eta
|█████████████████████▌ | 33.2MB 21kB/s eta
|█████████████████████▌ | 33.2MB 19kB/s eta
|█████████████████████▌ | 33.2MB 19kB/s eta
|█████████████████████▌ | 33.2MB 19kB/s eta
|█████████████████████▌ | 33.3MB 22kB/s eta
|█████████████████████▌ | 33.3MB 22kB/s eta
|█████████████████████▌ | 33.3MB 22kB/s eta
|█████████████████████▌ | 33.3MB 19kB/s eta
|█████████████████████▌ | 33.3MB 19kB/s eta
|█████████████████████▌ | 33.3MB 17kB/s eta
|█████████████████████▌ | 33.3MB 17kB/s eta
|█████████████████████▌ | 33.3MB 16kB/s eta
|█████████████████████▌ | 33.3MB 16kB/s eta
|█████████████████████▌ | 33.4MB 16kB/s eta
|█████████████████████▌ | 33.4MB 16kB/s eta
|█████████████████████▌ | 33.4MB 16kB/s eta
|█████████████████████▌ | 33.4MB 14kB/s eta
|█████████████████████▌ | 33.4MB 14kB/s eta
|█████████████████████▌ | 33.4MB 14kB/s eta
|█████████████████████▌ | 33.4MB 15kB/s eta
|█████████████████████▌ | 33.4MB 15kB/s eta
|█████████████████████▌ | 33.4MB 16kB/s eta
|█████████████████████▌ | 33.4MB 16kB/s eta
|█████████████████████▌ | 33.5MB 14kB/s eta
|█████████████████████▌ | 33.5MB 14kB/s eta
|█████████████████████▌ | 33.5MB 14kB/s eta
|█████████████████████▌ | 33.5MB 14kB/s eta
|█████████████████████▌ | 33.5MB 14kB/s eta
|█████████████████████▌ | 33.5MB 19kB/s eta
|█████████████████████▌ | 33.5MB 16kB/s eta
|█████████████████████▌ | 33.5MB 16kB/s eta
|█████████████████████▌ | 33.5MB 15kB/s eta
|█████████████████████▌ | 33.5MB 15kB/s eta
|█████████████████████▌ | 33.6MB 15kB/s eta
|█████████████████████▌ | 33.6MB 12kB/s eta
|█████████████████████▌ | 33.6MB 12kB/s eta
|█████████████████████▌ | 33.6MB 11kB/s eta
|█████████████████████▌ | 33.6MB 11kB/s eta
|█████████████████████▌ | 33.6MB 8.4kB/s eta
|█████████████████████▌ | 33.6MB 8.4kB/s eta
|█████████████████████▌ | 33.6MB 8.4kB/s eta
|█████████████████████▌ | 33.6MB 10kB/s eta
|█████████████████████▌ | 33.6MB 9.0kB/s eta
|█████████████████████▌ | 33.7MB 9.0kB/s eta
|█████████████████████▌ | 33.7MB 9.0kB/s eta
|██████████████████████ | 33.7MB 9.0kB/s eta
|██████████████████████ | 33.7MB 9.0kB/s eta
|██████████████████████ | 33.7MB 9.0kB/s eta
|██████████████████████ | 33.7MB 23kB/s eta
|██████████████████████ | 33.7MB 23kB/s eta
|██████████████████████ | 33.7MB 19kB/s eta
|██████████████████████ | 33.7MB 19kB/s eta
|██████████████████████ | 33.8MB 19kB/s eta
|██████████████████████ | 33.8MB 19kB/s eta
|██████████████████████ | 33.8MB 25kB/s eta
|██████████████████████ | 33.8MB 25kB/s eta
|██████████████████████ | 33.8MB 22kB/s eta
|██████████████████████ | 33.8MB 16kB/s eta
|██████████████████████ | 33.8MB 15kB/s eta
|██████████████████████ | 33.8MB 15kB/s eta
|██████████████████████ | 33.8MB 15kB/s eta
|██████████████████████ | 33.8MB 15kB/s eta
|██████████████████████ | 33.9MB 18kB/s eta
|██████████████████████ | 33.9MB 18kB/s eta
|██████████████████████ | 33.9MB 16kB/s eta
|██████████████████████ | 33.9MB 16kB/s eta
|██████████████████████ | 33.9MB 14kB/s eta
|██████████████████████ | 33.9MB 14kB/s eta
|██████████████████████ | 33.9MB 14kB/s eta
|██████████████████████ | 33.9MB 19kB/s eta
|██████████████████████ | 33.9MB 19kB/s eta
|██████████████████████ | 33.9MB 12kB/s eta
|██████████████████████ | 34.0MB 12kB/s eta
|██████████████████████ | 34.0MB 11kB/s eta
|██████████████████████ | 34.0MB 11kB/s eta
|██████████████████████ | 34.0MB 11kB/s eta
|██████████████████████ | 34.0MB 11kB/s eta
|██████████████████████ | 34.0MB 11kB/s eta
|██████████████████████ | 34.0MB 11kB/s eta
|██████████████████████ | 34.0MB 11kB/s eta
|██████████████████████ | 34.0MB 11kB/s eta
|██████████████████████ | 34.0MB 11kB/s eta
|██████████████████████ | 34.1MB 14kB/s eta
|██████████████████████ | 34.1MB 14kB/s eta
|██████████████████████ | 34.1MB 14kB/s eta
|██████████████████████ | 34.1MB 16kB/s eta
|██████████████████████ | 34.1MB 16kB/s eta
|██████████████████████ | 34.1MB 16kB/s eta
|██████████████████████ | 34.1MB 14kB/s eta
|██████████████████████ | 34.1MB 14kB/s eta
|██████████████████████ | 34.1MB 14kB/s eta
|██████████████████████ | 34.2MB 14kB/s eta
|██████████████████████ | 34.2MB 14kB/s eta
|██████████████████████ | 34.2MB 14kB/s eta
|██████████████████████ | 34.2MB 17kB/s eta
|██████████████████████ | 34.2MB 17kB/s eta
|██████████████████████ | 34.2MB 13kB/s eta
|██████████████████████ | 34.2MB 13kB/s eta
|██████████████████████ | 34.2MB 13kB/s eta
|██████████████████████ | 34.2MB 13kB/s eta
|██████████████████████ | 34.2MB 16kB/s eta
|██████████████████████ | 34.3MB 16kB/s eta
|██████████████████████ | 34.3MB 16kB/s eta
|██████████████████████ | 34.3MB 14kB/s eta
|██████████████████████ | 34.3MB 13kB/s eta
|██████████████████████ | 34.3MB 13kB/s eta
|██████████████████████ | 34.3MB 13kB/s eta
|██████████████████████ | 34.3MB 17kB/s eta
|██████████████████████ | 34.3MB 16kB/s eta
|██████████████████████ | 34.3MB 10kB/s eta
|██████████████████████ | 34.3MB 10kB/s eta
|██████████████████████ | 34.4MB 10kB/s eta
|██████████████████████ | 34.4MB 10kB/s eta
|██████████████████████ | 34.4MB 12kB/s eta
|██████████████████████ | 34.4MB 12kB/s eta
|██████████████████████ | 34.4MB 12kB/s eta
|██████████████████████ | 34.4MB 12kB/s eta
|██████████████████████ | 34.4MB 14kB/s eta
|██████████████████████ | 34.4MB 14kB/s eta
|██████████████████████ | 34.4MB 14kB/s eta
|██████████████████████ | 34.4MB 14kB/s eta
|██████████████████████ | 34.5MB 23kB/s eta
|██████████████████████ | 34.5MB 23kB/s eta
|██████████████████████ | 34.5MB 25kB/s eta
|██████████████████████ | 34.5MB 25kB/s eta
|██████████████████████ | 34.5MB 25kB/s eta
|██████████████████████ | 34.5MB 21kB/s eta
|██████████████████████ | 34.5MB 21kB/s eta
|██████████████████████ | 34.5MB 21kB/s eta
|██████████████████████ | 34.5MB 21kB/s eta
|██████████████████████ | 34.5MB 21kB/s eta
|██████████████████████ | 34.6MB 21kB/s eta
|██████████████████████ | 34.6MB 21kB/s eta
|██████████████████████ | 34.6MB 21kB/s eta
|██████████████████████ | 34.6MB 21kB/s eta
|██████████████████████ | 34.6MB 21kB/s eta
|██████████████████████ | 34.6MB 21kB/s eta
|██████████████████████ | 34.6MB 21kB/s eta
|██████████████████████ | 34.6MB 21kB/s eta
|██████████████████████ | 34.6MB 19kB/s eta
|██████████████████████ | 34.7MB 19kB/s eta
|██████████████████████ | 34.7MB 19kB/s eta
|██████████████████████ | 34.7MB 19kB/s eta
|██████████████████████ | 34.7MB 19kB/s eta
|██████████████████████ | 34.7MB 18kB/s eta
|██████████████████████ | 34.7MB 18kB/s eta
|██████████████████████▌ | 34.7MB 18kB/s eta
|██████████████████████▌ | 34.7MB 18kB/s eta
|██████████████████████▌ | 34.7MB 18kB/s eta
|██████████████████████▌ | 34.7MB 24kB/s eta
|██████████████████████▌ | 34.8MB 15kB/s eta
|██████████████████████▌ | 34.8MB 15kB/s eta
|██████████████████████▌ | 34.8MB 15kB/s eta
|██████████████████████▌ | 34.8MB 15kB/s eta
|██████████████████████▌ | 34.8MB 15kB/s eta
0:15:54ERROR: Exception:
Traceback (most recent call last):
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_vendor\urllib3\response.py", line 397, in _error_catcher
yield
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_vendor\urllib3\response.py", line 479, in read
data = self._fp.read(amt)
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read
data = self.__fp.read(amt)
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\http\client.p
y", line 457, in read
n = self.readinto(b)
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\http\client.p
y", line 501, in readinto
n = self.fp.readinto(b)
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\socket.py", l
ine 589, in readinto
return self._sock.recv_into(b)
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\ssl.py", line
1071, in recv_into
return self.read(nbytes, buffer)
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\ssl.py", line
929, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_internal\cli\base_command.py", line 188, in main
status = self.run(options, args)
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_internal\commands\install.py", line 345, in run
resolver.resolve(requirement_set)
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_internal\legacy_resolve.py", line 196, in resolve
self._resolve_one(requirement_set, req)
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_internal\legacy_resolve.py", line 359, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_internal\legacy_resolve.py", line 307, in _get_abstract_dist_for
self.require_hashes
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_internal\operations\prepare.py", line 199, in prepare_linked_requirement
progress_bar=self.progress_bar
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_internal\download.py", line 1064, in unpack_url
progress_bar=progress_bar
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_internal\download.py", line 924, in unpack_http_url
progress_bar)
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_internal\download.py", line 1152, in _download_http_url
_download_url(resp, link, content_file, hashes, progress_bar)
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_internal\download.py", line 861, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_internal\utils\hashes.py", line 75, in check_against_chunks
for chunk in chunks:
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_internal\download.py", line 829, in written_chunks
for chunk in chunks:
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_internal\utils\ui.py", line 156, in iter
for x in it:
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_internal\download.py", line 818, in resp_read
decode_content=False):
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_vendor\urllib3\response.py", line 531, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_vendor\urllib3\response.py", line 496, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\contextlib.py
", line 130, in __exit__
self.gen.throw(type, value, traceback)
File "c:\users\xiaona\appdata\local\programs\python\python37\lib\site-packages
\pip\_vendor\urllib3\response.py", line 402, in _error_catcher
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files
.pythonhosted.org', port=443): Read timed out.
项目地址: https://github.com/zohead/fbvnc
克隆之后直接 make 即可.
服务器可以使用 tightvnc 测试:
https://www.tightvnc.com/download.php
https://item.jd.com/3714590.html
京东速度就是快,
晚上下单, 上午就收到了.
花了28块 + 6 元 运费, 把拆下来的 5400转的机械盘改装成USB移动硬盘, 然后把数据拷回 ssd 硬盘.
我这里执行就直接出错了:
root@ubuntu:~# timedatectl set-timezone Asia/Shanghai
Failed to get D-Bus connection: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
执行 dbus-daemon --system 搞定:
root@ubuntu:~# dbus-daemon --system
root@ubuntu:~#
root@ubuntu:~# timedatectl set-timezone Asia/Shanghai
root@ubuntu:~# date
Fri Feb 8 09:01:12 CST 2019
今天晚上回到家, 发现 WIFI 连不上了,
一番观察之后, 在系统设备里面发现是启动失败,
无论如何重启都没有用。
https://downloadcenter.intel.com/product/125192/Intel-Wireless-AC-9462
https://downloadmirror.intel.com/28503/a08/WiFi_20.110.0_PROSet64_Win10.exe
终于换台电脑, 把上面的驱动下载下来重装才好。
v3s使用ADC按键,怎么用驱动实现检测按键按下?
https://github.com/Lichee-Pi/linux/blob/zero-4.13.y/drivers/input/keyboard/sun4i-lradc-keys.c
/*
* Allwinner sun4i low res adc attached tablet keys driver
*
* Copyright (C) 2014 Hans de Goede <hdegoede@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/*
* Allwinnner sunxi SoCs have a lradc which is specifically designed to have
* various (tablet) keys (ie home, back, search, etc). attached to it using
* a resistor network. This driver is for the keys on such boards.
*
* There are 2 channels, currently this driver only supports channel 0 since
* there are no boards known to use channel 1.
*/
#include <linux/err.h>
#include <linux/init.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#define LRADC_CTRL 0x00
#define LRADC_INTC 0x04
#define LRADC_INTS 0x08
#define LRADC_DATA0 0x0c
#define LRADC_DATA1 0x10
/* LRADC_CTRL bits */
#define FIRST_CONVERT_DLY(x) ((x) << 24) /* 8 bits */
#define CHAN_SELECT(x) ((x) << 22) /* 2 bits */
#define CONTINUE_TIME_SEL(x) ((x) << 16) /* 4 bits */
#define KEY_MODE_SEL(x) ((x) << 12) /* 2 bits */
#define LEVELA_B_CNT(x) ((x) << 8) /* 4 bits */
#define HOLD_EN(x) ((x) << 6)
#define LEVELB_VOL(x) ((x) << 4) /* 2 bits */
#define SAMPLE_RATE(x) ((x) << 2) /* 2 bits */
#define ENABLE(x) ((x) << 0)
/* LRADC_INTC and LRADC_INTS bits */
#define CHAN1_KEYUP_IRQ BIT(12)
#define CHAN1_ALRDY_HOLD_IRQ BIT(11)
#define CHAN1_HOLD_IRQ BIT(10)
#define CHAN1_KEYDOWN_IRQ BIT(9)
#define CHAN1_DATA_IRQ BIT(8)
#define CHAN0_KEYUP_IRQ BIT(4)
#define CHAN0_ALRDY_HOLD_IRQ BIT(3)
#define CHAN0_HOLD_IRQ BIT(2)
#define CHAN0_KEYDOWN_IRQ BIT(1)
#define CHAN0_DATA_IRQ BIT(0)
struct sun4i_lradc_keymap {
u32 voltage;
u32 keycode;
};
struct sun4i_lradc_data {
struct device *dev;
struct input_dev *input;
void __iomem *base;
struct regulator *vref_supply;
struct sun4i_lradc_keymap *chan0_map;
u32 chan0_map_count;
u32 chan0_keycode;
u32 vref;
};
static irqreturn_t sun4i_lradc_irq(int irq, void *dev_id)
{
struct sun4i_lradc_data *lradc = dev_id;
u32 i, ints, val, voltage, diff, keycode = 0, closest = 0xffffffff;
ints = readl(lradc->base + LRADC_INTS);
/*
* lradc supports only one keypress at a time, release does not give
* any info as to which key was released, so we cache the keycode.
*/
if (ints & CHAN0_KEYUP_IRQ) {
input_report_key(lradc->input, lradc->chan0_keycode, 0);
lradc->chan0_keycode = 0;
}
if ((ints & CHAN0_KEYDOWN_IRQ) && lradc->chan0_keycode == 0) {
val = readl(lradc->base + LRADC_DATA0) & 0x3f;
voltage = val * lradc->vref / 63;
for (i = 0; i < lradc->chan0_map_count; i++) {
diff = abs(lradc->chan0_map[i].voltage - voltage);
if (diff < closest) {
closest = diff;
keycode = lradc->chan0_map[i].keycode;
}
}
lradc->chan0_keycode = keycode;
input_report_key(lradc->input, lradc->chan0_keycode, 1);
}
input_sync(lradc->input);
writel(ints, lradc->base + LRADC_INTS);
return IRQ_HANDLED;
}
static int sun4i_lradc_open(struct input_dev *dev)
{
struct sun4i_lradc_data *lradc = input_get_drvdata(dev);
int error;
error = regulator_enable(lradc->vref_supply);
if (error)
return error;
/* lradc Vref internally is divided by 2/3 */
lradc->vref = regulator_get_voltage(lradc->vref_supply) * 2 / 3;
/*
* Set sample time to 4 ms / 250 Hz. Wait 2 * 4 ms for key to
* stabilize on press, wait (1 + 1) * 4 ms for key release
*/
writel(FIRST_CONVERT_DLY(2) | LEVELA_B_CNT(1) | HOLD_EN(1) |
SAMPLE_RATE(0) | ENABLE(1), lradc->base + LRADC_CTRL);
writel(CHAN0_KEYUP_IRQ | CHAN0_KEYDOWN_IRQ, lradc->base + LRADC_INTC);
return 0;
}
static void sun4i_lradc_close(struct input_dev *dev)
{
struct sun4i_lradc_data *lradc = input_get_drvdata(dev);
/* Disable lradc, leave other settings unchanged */
writel(FIRST_CONVERT_DLY(2) | LEVELA_B_CNT(1) | HOLD_EN(1) |
SAMPLE_RATE(2), lradc->base + LRADC_CTRL);
writel(0, lradc->base + LRADC_INTC);
regulator_disable(lradc->vref_supply);
}
static int sun4i_lradc_load_dt_keymap(struct device *dev,
struct sun4i_lradc_data *lradc)
{
struct device_node *np, *pp;
int i;
int error;
np = dev->of_node;
if (!np)
return -EINVAL;
lradc->chan0_map_count = of_get_child_count(np);
if (lradc->chan0_map_count == 0) {
dev_err(dev, "keymap is missing in device tree\n");
return -EINVAL;
}
lradc->chan0_map = devm_kmalloc_array(dev, lradc->chan0_map_count,
sizeof(struct sun4i_lradc_keymap),
GFP_KERNEL);
if (!lradc->chan0_map)
return -ENOMEM;
i = 0;
for_each_child_of_node(np, pp) {
struct sun4i_lradc_keymap *map = &lradc->chan0_map[i];
u32 channel;
error = of_property_read_u32(pp, "channel", &channel);
if (error || channel != 0) {
dev_err(dev, "%s: Inval channel prop\n", pp->name);
return -EINVAL;
}
error = of_property_read_u32(pp, "voltage", &map->voltage);
if (error) {
dev_err(dev, "%s: Inval voltage prop\n", pp->name);
return -EINVAL;
}
error = of_property_read_u32(pp, "linux,code", &map->keycode);
if (error) {
dev_err(dev, "%s: Inval linux,code prop\n", pp->name);
return -EINVAL;
}
i++;
}
return 0;
}
static int sun4i_lradc_probe(struct platform_device *pdev)
{
struct sun4i_lradc_data *lradc;
struct device *dev = &pdev->dev;
int i;
int error;
lradc = devm_kzalloc(dev, sizeof(struct sun4i_lradc_data), GFP_KERNEL);
if (!lradc)
return -ENOMEM;
error = sun4i_lradc_load_dt_keymap(dev, lradc);
if (error)
return error;
lradc->vref_supply = devm_regulator_get(dev, "vref");
if (IS_ERR(lradc->vref_supply))
return PTR_ERR(lradc->vref_supply);
lradc->dev = dev;
lradc->input = devm_input_allocate_device(dev);
if (!lradc->input)
return -ENOMEM;
lradc->input->name = pdev->name;
lradc->input->phys = "sun4i_lradc/input0";
lradc->input->open = sun4i_lradc_open;
lradc->input->close = sun4i_lradc_close;
lradc->input->id.bustype = BUS_HOST;
lradc->input->id.vendor = 0x0001;
lradc->input->id.product = 0x0001;
lradc->input->id.version = 0x0100;
__set_bit(EV_KEY, lradc->input->evbit);
for (i = 0; i < lradc->chan0_map_count; i++)
__set_bit(lradc->chan0_map[i].keycode, lradc->input->keybit);
input_set_drvdata(lradc->input, lradc);
lradc->base = devm_ioremap_resource(dev,
platform_get_resource(pdev, IORESOURCE_MEM, 0));
if (IS_ERR(lradc->base))
return PTR_ERR(lradc->base);
error = devm_request_irq(dev, platform_get_irq(pdev, 0),
sun4i_lradc_irq, 0,
"sun4i-a10-lradc-keys", lradc);
if (error)
return error;
error = input_register_device(lradc->input);
if (error)
return error;
return 0;
}
static const struct of_device_id sun4i_lradc_of_match[] = {
{ .compatible = "allwinner,sun4i-a10-lradc-keys", },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, sun4i_lradc_of_match);
static struct platform_driver sun4i_lradc_driver = {
.driver = {
.name = "sun4i-a10-lradc-keys",
.of_match_table = of_match_ptr(sun4i_lradc_of_match),
},
.probe = sun4i_lradc_probe,
};
module_platform_driver(sun4i_lradc_driver);
MODULE_DESCRIPTION("Allwinner sun4i low res adc attached tablet keys driver");
MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
MODULE_LICENSE("GPL");
1. 下载 live555源代码:
#wget http://www.live555.com/liveMedia/public/live.2013.04.30.tar.gz
2. 编译源代码:
#tar xvf live.2013.04.30.tar.gz
#./genMakefiles linux
#make -j10
3.运行mediaserver
~/live/mediaServer$ ./live555MediaServer
4. 建立fifo
~/live/mediaServer$ mkfifo test.m4e
~/live/mediaServer$ chmod u+rw test.m4e
5.设计软件,采集video数据,编码成xvid,写入fifo
/home/avr32/live/mediaServer/test.m4e
编译命令:
gcc -o testx ubuntu_encode_usb_camera.c -lxvidcore
运行testx
#testx
7. vlc打开网址:
vlc rtsp://127.0.0.1:8554/test.m4e
ubuntu_encode_usb_camera.c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <linux/videodev2.h>
#include "xvid.h"
#define WRITE_PIPE_AS_FILE 1
#define FRAMERATE_INCR 1001
#define SMALL_EPS (1e-10)
#define VIDEO "/dev/video0"
#define INDEX 0
#define IOCTL(fd, req, addr ) \
((-1==ioctl(fd,req,addr))?(perror(#req),close(fd),exit(EXIT_FAILURE)):0)
static float ARG_FRAMERATE = 25.00f;
static int ARG_QUALITY = 4;
static int ARG_MAXKEYINTERVAL = 250;
static char * ARG_OUTPUTFILE= "/home/avr32/live/mediaServer/test.m4e";
//static char * ARG_OUTPUTFILE= "test.m4e";
#if WRITE_PIPE_AS_FILE
static int fp = 0;
#else
static FILE * fp = NULL;
#endif
static int done = 0;
static const int motion_presets[] = {
/* quality 0 */
0,
/* quality 1 */
XVID_ME_ADVANCEDDIAMOND16,
/* quality 2 */
XVID_ME_ADVANCEDDIAMOND16 | XVID_ME_HALFPELREFINE16,
/* quality 3 */
XVID_ME_ADVANCEDDIAMOND16 | XVID_ME_HALFPELREFINE16 |
XVID_ME_ADVANCEDDIAMOND8 | XVID_ME_HALFPELREFINE8,
/* quality 4 */
XVID_ME_ADVANCEDDIAMOND16 | XVID_ME_HALFPELREFINE16 |
XVID_ME_ADVANCEDDIAMOND8 | XVID_ME_HALFPELREFINE8 |
XVID_ME_CHROMA_PVOP | XVID_ME_CHROMA_BVOP,
/* quality 5 */
XVID_ME_ADVANCEDDIAMOND16 | XVID_ME_HALFPELREFINE16 |
XVID_ME_ADVANCEDDIAMOND8 | XVID_ME_HALFPELREFINE8 |
XVID_ME_CHROMA_PVOP | XVID_ME_CHROMA_BVOP,
/* quality 6 */
XVID_ME_ADVANCEDDIAMOND16 | XVID_ME_HALFPELREFINE16 | XVID_ME_EXTSEARCH16 |
XVID_ME_ADVANCEDDIAMOND8 | XVID_ME_HALFPELREFINE8 | XVID_ME_EXTSEARCH8 |
XVID_ME_CHROMA_PVOP | XVID_ME_CHROMA_BVOP,
};
static const int vop_presets[] = {
/* quality 0 */
0,
/* quality 1 */
0,
/* quality 2 */
XVID_VOP_HALFPEL,
/* quality 3 */
XVID_VOP_HALFPEL | XVID_VOP_INTER4V,
/* quality 4 */
XVID_VOP_HALFPEL | XVID_VOP_INTER4V,
/* quality 5 */
XVID_VOP_HALFPEL | XVID_VOP_INTER4V |
XVID_VOP_TRELLISQUANT,
/* quality 6 */
XVID_VOP_HALFPEL | XVID_VOP_INTER4V |
XVID_VOP_TRELLISQUANT | XVID_VOP_HQACPRED,
};
static int XDIM=640,YDIM=480;
static use_assembler = 0;
static void *enc_handle = NULL;
static int enc_init(int use_assembler);
static int enc_main(unsigned char *image,
unsigned char *bitstream,
int *key,
int *stats_type,
int *stats_quant,
int *stats_length,
int stats[3]);
static int enc_stop();
//signal act method defination
static void clean(int signum)
{
done=1;
}
int
main(int argc,char *argv[])
{
//register SIGINT action method ,to save the m4u file
signal(SIGINT,clean);
int fd;
struct v4l2_capability cap;
struct v4l2_format format;
struct v4l2_requestbuffers reqbuf;
struct v4l2_buffer buffer;
struct v4l2_input input;
int index=0,i;
for (i=1; i< argc; i++) {
if (strcmp("-asm", argv[i]) == 0 ) {
use_assembler = 1;
}else if(strcmp("-f", argv[i]) == 0 && i < argc -1){
i++;
ARG_OUTPUTFILE = argv[i];
}else if(strcmp("-i", argv[i]) == 0 && i < argc -1){
i++;
index = atoi(argv[i]);
} else if(strcmp("-w", argv[i]) == 0 && i < argc -1){
i++;
XDIM = atoi(argv[i]);
} else if(strcmp("-h", argv[i]) == 0 && i < argc -1){
i++;
YDIM = atoi(argv[i]);
}
}
//init capture card
fd = open(VIDEO,O_RDWR);
if(fd<0)
{
perror("Can't open /dev/video device");
exit(errno);
}
//if card can't support video capture and by means of steamio,exit
IOCTL(fd, VIDIOC_QUERYCAP, &cap);
if ( !(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)
&&!(cap.capabilities & V4L2_CAP_STREAMING))
{
fprintf(stderr, "Couldn't use the card \n");
exit(3);
}
//query input and select the desired input
IOCTL(fd, VIDIOC_G_INPUT, &index);
input.index = index;
IOCTL(fd, VIDIOC_ENUMINPUT, &input);
printf ("Current input: Index %i,Name %s\n", index,input.name);
for(i=0;;i++)
{
if(i!=index)
{
input.index = i;
if(-1==ioctl(fd, VIDIOC_ENUMINPUT, &input))
break;
else
printf ("Other input: Index %i,Name %s\n",i,input.name);
}
}
IOCTL(fd, VIDIOC_S_INPUT, &index);
//get current video format,set the desired format
format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
IOCTL(fd,VIDIOC_G_FMT,&format);
#if 1
format.fmt.pix.width = XDIM;
format.fmt.pix.height = YDIM;
format.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
format.fmt.pix.field = V4L2_FIELD_ANY;//V4L2_FIELD_INTERLACED
IOCTL(fd,VIDIOC_S_FMT,&format);
#endif
XDIM = format.fmt.pix.width;
printf("Gotten width %d\n",XDIM);
YDIM = format.fmt.pix.height;
printf("Gotten height %d\n",YDIM);
//let driver get the buffers
reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
reqbuf.memory = V4L2_MEMORY_MMAP;
reqbuf.count = 4;
IOCTL(fd,VIDIOC_REQBUFS,&reqbuf );
if (reqbuf.count < 4)
{
printf ("Not enough buffer memory for driver\n");
exit (5);
}
//mmap the driver's buffer to application address
//create relative buffers struct to be used by mmap
struct
{
void * start;
size_t length;
} buffers[reqbuf.count];
//mmap the driver's kernel buffer into application
for (i=0;i<reqbuf.count;i++)
{
buffer.type = reqbuf.type;
buffer.index =i ;
//query the status of one buffer ,mmap the driver buffer
IOCTL(fd,VIDIOC_QUERYBUF,&buffer);
buffers[i].length = buffer.length;
buffers[i].start = mmap (NULL,buffer.length,
PROT_READ | PROT_WRITE,
MAP_SHARED,
fd,buffer.m.offset);
if (buffers[i].start == MAP_FAILED)
{
close(fd);
perror ("mmap");
exit(errno);
}
}
//begin video capture
IOCTL(fd,VIDIOC_STREAMON,&reqbuf.type);
//enqueue all driver buffers
for (i=0;i<reqbuf.count;i++)
{
buffer.type = reqbuf.type;
buffer.index = i;
IOCTL(fd,VIDIOC_QUERYBUF, &buffer);
IOCTL(fd,VIDIOC_QBUF,&buffer);
}
//init xvid
int result;
result = enc_init(1);
if(result!=0)
{
fprintf(stderr, "Encore INIT problem, return value %d\n", result);
goto clean_all;
}
//get mem of mpg4 frame
uint8_t *mp4_buffer = NULL;
mp4_buffer = (unsigned char *) malloc(XDIM*YDIM);
if (mp4_buffer==NULL)
{
fprintf(stderr,"malloc error");
goto clean_all;
}
int key;
int stats_type;
int stats_quant;
int stats_length;
int sse[3];
//create store mp4 file
#if WRITE_PIPE_AS_FILE
fp= open(ARG_OUTPUTFILE, O_WRONLY);
#else
fp= fopen(ARG_OUTPUTFILE, "wb");
#endif
if (fp== NULL) {
perror("Error opening output file.");
exit(-1);
}
//main loop ,frame capture,compressed
i = 0;
int outbytes,m4v_size;
while(!done)
{
//dequeue one frame
buffer.type = reqbuf.type;
buffer.index = i;
IOCTL(fd, VIDIOC_QUERYBUF, &buffer);
IOCTL(fd, VIDIOC_DQBUF, &buffer);
/*debug info
printf("current frame's unix time seconds :%d\n",buffer.timestamp.tv_sec);
printf("current frame's unix time mcicoseconds :%d\n",buffer.timestamp.tv_usec);
*/
//compress a frame
m4v_size = enc_main((uint8_t *)buffers[i].start,
mp4_buffer+16,
&key, &stats_type,&stats_quant, &stats_length, sse);
//store into output file
#if WRITE_PIPE_AS_FILE
outbytes = write(fp, mp4_buffer, m4v_size);
#else
outbytes = fwrite(mp4_buffer, 1, m4v_size, fp);
#endif
if(outbytes != m4v_size)
{
fprintf(stderr,"Error writing the m4u file\n");
exit(7);
}
//enqueue one frame
buffer.type = reqbuf.type;
buffer.index = i;
IOCTL(fd, VIDIOC_QUERYBUF, &buffer );
IOCTL(fd, VIDIOC_QBUF, &buffer );
i++;
if( i >= reqbuf.count )
i = 0;
}
clean_all:
#if WRITE_PIPE_AS_FILE
close(fp);
#else
fclose(fp);
#endif
enc_stop();
//stop capture
IOCTL(fd, VIDIOC_STREAMOFF, &reqbuf.type );
//unmmap the apllication buffer
for (i=0;i<reqbuf.count;i++)
munmap (buffers[i].start,buffers[i].length);
//release the dynamic mem
close(fd);
return 0;
}
int
enc_init(int use_assembler)
{
int xerr;
//xvid_plugin_cbr_t cbr;
xvid_plugin_single_t single;
xvid_plugin_2pass1_t rc2pass1;
xvid_plugin_2pass2_t rc2pass2;
//xvid_plugin_fixed_t rcfixed;
xvid_enc_plugin_t plugins[7];
xvid_gbl_init_t xvid_gbl_init;
xvid_enc_create_t xvid_enc_create;
/*------------------------------------------------------------------------
* XviD core initialization
*----------------------------------------------------------------------*/
/* Set version -- version checking will done by xvidcore */
memset(&xvid_gbl_init, 0, sizeof(xvid_gbl_init));
xvid_gbl_init.version = XVID_VERSION;
xvid_gbl_init.debug = 0;
/* Do we have to enable ASM optimizations ? */
if (use_assembler) {
xvid_gbl_init.cpu_flags = 0;
}
/* Initialize XviD core -- Should be done once per __process__ */
xvid_global(NULL, XVID_GBL_INIT, &xvid_gbl_init, NULL);
/*------------------------------------------------------------------------
* XviD encoder initialization
*----------------------------------------------------------------------*/
/* Version again */
memset(&xvid_enc_create, 0, sizeof(xvid_enc_create));
xvid_enc_create.version = XVID_VERSION;
/* Width and Height of input frames */
xvid_enc_create.width = XDIM;
xvid_enc_create.height = YDIM;
xvid_enc_create.profile = XVID_PROFILE_S_L3;
/* init plugins */
xvid_enc_create.zones = NULL;
xvid_enc_create.num_zones = 0;
xvid_enc_create.plugins = NULL;
xvid_enc_create.num_plugins = 0;
/* No fancy thread tests */
xvid_enc_create.num_threads = 0;
/* Frame rate - Do some quick float fps = fincr/fbase hack */
if ((ARG_FRAMERATE - (int) ARG_FRAMERATE) < SMALL_EPS) {
xvid_enc_create.fincr = 1;
xvid_enc_create.fbase = (int) ARG_FRAMERATE;
} else {
xvid_enc_create.fincr = FRAMERATE_INCR;
xvid_enc_create.fbase = (int) (FRAMERATE_INCR * ARG_FRAMERATE);
}
/* Maximum key frame interval */
if (ARG_MAXKEYINTERVAL > 0) {
xvid_enc_create.max_key_interval = ARG_MAXKEYINTERVAL;
}else {
xvid_enc_create.max_key_interval = (int) ARG_FRAMERATE *10;
}
/* Bframes settings */
xvid_enc_create.max_bframes = 0;
xvid_enc_create.bquant_ratio = 150;
xvid_enc_create.bquant_offset = 100;
/* Dropping ratio frame -- we don't need that */
xvid_enc_create.frame_drop_ratio = 0;
/* Global encoder options */
xvid_enc_create.global = 0;
/* I use a small value here, since will not encode whole movies, but short clips */
xerr = xvid_encore(NULL, XVID_ENC_CREATE, &xvid_enc_create, NULL);
/* Retrieve the encoder instance from the structure */
enc_handle = xvid_enc_create.handle;
return (xerr);
}
int
enc_main(unsigned char *image,
unsigned char *bitstream,
int *key,
int *stats_type,
int *stats_quant,
int *stats_length,
int sse[3])
{
int ret;
xvid_enc_frame_t xvid_enc_frame;
xvid_enc_stats_t xvid_enc_stats;
/* Version for the frame and the stats */
memset(&xvid_enc_frame, 0, sizeof(xvid_enc_frame));
xvid_enc_frame.version = XVID_VERSION;
memset(&xvid_enc_stats, 0, sizeof(xvid_enc_stats));
xvid_enc_stats.version = XVID_VERSION;
/* Bind output buffer */
xvid_enc_frame.bitstream = bitstream;
xvid_enc_frame.length = -1;
/* Initialize input image fields */
if (image) {
xvid_enc_frame.input.plane[0] = image;
xvid_enc_frame.input.csp = XVID_CSP_YUY2;
xvid_enc_frame.input.stride[0] = XDIM*2;
} else {
xvid_enc_frame.input.csp = XVID_CSP_NULL;
}
/* Set up core's general features */
xvid_enc_frame.vol_flags = 0;
/* Set up core's general features */
xvid_enc_frame.vop_flags = vop_presets[ARG_QUALITY];
/* Frame type -- let core decide for us */
xvid_enc_frame.type = XVID_TYPE_AUTO;
/* Force the right quantizer -- It is internally managed by RC plugins */
xvid_enc_frame.quant = 3;
/* Set up motion estimation flags */
xvid_enc_frame.motion = motion_presets[ARG_QUALITY];
/* We don't use special matrices */
xvid_enc_frame.quant_intra_matrix = NULL;
xvid_enc_frame.quant_inter_matrix = NULL;
/* Encode the frame */
ret = xvid_encore(enc_handle, XVID_ENC_ENCODE, &xvid_enc_frame,
&xvid_enc_stats);
*key = (xvid_enc_frame.out_flags & XVID_KEYFRAME);
*stats_type = xvid_enc_stats.type;
*stats_quant = xvid_enc_stats.quant;
*stats_length = xvid_enc_stats.length;
sse[0] = xvid_enc_stats.sse_y;
sse[1] = xvid_enc_stats.sse_u;
sse[2] = xvid_enc_stats.sse_v;
return (ret);
}
int
enc_stop()
{
int xerr;
/* Destroy the encoder instance */
xerr = xvid_encore(enc_handle, XVID_ENC_DESTROY, NULL, NULL);
return (xerr);
}
路人甲 说:对,按照上面的步骤一步一步,可以把 Ethernet 搞定。
没有必要从愚蠢的答案,如果你不能为这个主题贡献一些有意义的东西,你的评论不受欢迎。
Update: 以太网安装文章产生:
.... /opt/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc: 1: /opt/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc: ELF: not found /opt/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc: 1: /opt/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc: Syntax error: Unterminated quoted string Kbuild:20: recipe for target 'kernel/bounds.s' failed make[1]: *** [kernel/bounds.s] Error 2 Makefile:1061: recipe for target 'prepare0' failed make: *** [prepare0] Error 2
https://whycan.cn/t_864.html#p3468
是不是你的系统是 64bit, gcc 是 32bit 的
试一试下面的命令:
sudo apt-get install lsb-core
apt-get install lib32z1 lib32ncurses5
apt-get install lib32stdc++6
感觉你这个编译器不对,我是用xboot指定的5.3.1版
http://pan.baidu.com/s/1dDtssIt
我试一试这个.
把 driver/fb-f1c100s.c 的 include <stdlib.h> 屏蔽起来,
上面的错误没有了,
新的链接错误:
root@ubuntu:~/minimal_f1c100s# make CROSS_COMPILE=arm-linux-gnueabi-
LINK build/firmware.elf
arm-linux-gnueabi-gcc -T f1c100s.ld -nostdlib -Wl,--cref,-Map=build/firmware.elf.map -o build/firmware.elf build/main.o build/machine/sys-clock.o build/machine/sys-dram.o build/machine/sys-uart.o build/machine/sys-copyself.o build/machine/sys-spi-flash.o build/machine/sys-mmu.o build/machine/exception.o build/driver/gpio-f1c100s.o build/driver/pwm-f1c100s.o build/driver/reset-f1c100s.o build/lib/malloc.o build/lib/dma.o build/driver/clk-f1c100s-pll.o build/driver/fb-f1c100s.o build/machine/start.o build/arch/arm32/lib/memcpy.o build/arch/arm32/lib/memset.o -lgcc
build/lib/malloc.o: In function `insert_free_block':
/root/minimal_f1c100s/lib/malloc.c:387: undefined reference to `__assert_fail'
/root/minimal_f1c100s/lib/malloc.c:393: undefined reference to `__assert_fail'
build/lib/malloc.o: In function `block_split':
/root/minimal_f1c100s/lib/malloc.c:424: undefined reference to `__assert_fail'
/root/minimal_f1c100s/lib/malloc.c:428: undefined reference to `__assert_fail'
/root/minimal_f1c100s/lib/malloc.c:426: undefined reference to `__assert_fail'
build/lib/malloc.o:/root/minimal_f1c100s/lib/malloc.c:461: more undefined references to `__assert_fail' follow
/usr/lib/gcc-cross/arm-linux-gnueabi/5/libgcc.a(_dvmd_lnx.o): In function `__aeabi_ldiv0':
(.text+0x8): undefined reference to `raise'
collect2: error: ld returned 1 exit status
Makefile:78: recipe for target 'build/firmware.elf' failed
make: *** [build/firmware.elf] Error 1
然后换 arm-linux-gnueabihf-gcc 还是一样的错误:
arm-linux-gnueabihf-gcc -Imachine/include -Iarch/arm32/include -Idriver/include -Ilib -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -O3 -ffreestanding -std=gnu99 -D__ARM32_ARCH__=5 -D__ARM926EJS__ -c -MD -o build/driver/fb-f1c100s.o driver/fb-f1c100s.c
In file included from /usr/arm-linux-gnueabihf/include/stdlib.h:42:0,
from driver/fb-f1c100s.c:26:
/usr/arm-linux-gnueabihf/include/bits/waitstatus.h:71:37: error: operator '==' has no right operand
# if __BYTE_ORDER == __LITTLE_ENDIAN
^
/usr/arm-linux-gnueabihf/include/bits/waitstatus.h:86:37: error: operator '==' has no right operand
# if __BYTE_ORDER == __LITTLE_ENDIAN
^
make: *** [build/driver/fb-f1c100s.o] Error 1
请问楼主你的 arm-eabi-gcc 是通过什么方式装到Linux 上面的?
我用 arm-none-linux-gnueabi-
make 后出错:
arm-none-linux-gnueabi-gcc -Imachine/include -Iarch/arm32/include -Idriver/include -Ilib -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -O3 -ffreestanding -std=gnu99 -D__ARM32_ARCH__=5 -D__ARM926EJS__ -c -MD -o build/driver/fb-f1c100s.o driver/fb-f1c100s.c
In file included from /usr/local/arm-2014.05/arm-none-linux-gnueabi/libc/usr/include/stdlib.h:42:0,
from driver/fb-f1c100s.c:26:
/usr/local/arm-2014.05/arm-none-linux-gnueabi/libc/usr/include/bits/waitstatus.h:71:37: error: operator '==' has no right operand
# if __BYTE_ORDER == __LITTLE_ENDIAN
^
/usr/local/arm-2014.05/arm-none-linux-gnueabi/libc/usr/include/bits/waitstatus.h:86:37: error: operator '==' has no right operand
# if __BYTE_ORDER == __LITTLE_ENDIAN
^
make: *** [build/driver/fb-f1c100s.o] Error 1
这种方式不错,相当于直接操作寄存器了, 速度肯定快
类似这个帖子吧:
https://whycan.cn/t_1450.html
全志S3手册V0.2: Allwinner_S3_Datasheet_V0_2.pdf (索智S3手册)
S3 系统配置手册: S3_System_Configuration_Manual.pdf
S3 开发板规格书: SC1615S_Development_board_specifications_20171031.pdf
diff --git a/arch/arm/dts/sun8i-v3s-licheepi-zero.dts b/arch/arm/dts/sun8i-v3s-licheepi-zero.dts
index 3aec3eb..14376f1 100644
--- a/arch/arm/dts/sun8i-v3s-licheepi-zero.dts
+++ b/arch/arm/dts/sun8i-v3s-licheepi-zero.dts
@@ -50,11 +50,12 @@
aliases {
serial0 = &uart0;
+ serial2 = &uart2;
spi0 = &spi0;
};
chosen {
- stdout-path = "serial0:115200n8";
+ stdout-path = "serial2:115200n8";
};
};
@@ -77,6 +78,12 @@
status = "okay";
};
+&uart2 {
+ pinctrl-0 = <&uart2_pins_a>;
+ pinctrl-names = "default";
+ status = "okay";
+};
+
&usb_otg {
dr_mode = "otg";
status = "okay";
diff --git a/arch/arm/dts/sun8i-v3s.dtsi b/arch/arm/dts/sun8i-v3s.dtsi
index 8ab3021..f3ebbc6 100644
--- a/arch/arm/dts/sun8i-v3s.dtsi
+++ b/arch/arm/dts/sun8i-v3s.dtsi
@@ -214,6 +214,12 @@
bias-pull-up;
};
+
+ uart2_pins_a: uart2@0 {
+ pins = "PB0", "PB1";
+ function = "uart2";
+ bias-pull-up;
+ };
mmc0_pins_a: mmc0@0 {
pins = "PF0", "PF1", "PF2", "PF3",
"PF4", "PF5";
diff --git a/include/configs/sun8i.h b/include/configs/sun8i.h
index 6ac42ac..d5b545f 100644
--- a/include/configs/sun8i.h
+++ b/include/configs/sun8i.h
@@ -27,6 +27,14 @@
#define CONFIG_SUNXI_USB_PHYS 2
#endif
+
+#define CONFIG_BOOTCOMMAND "sf probe 0 108000000; " \
+ "sf read 0x41000000 0x0F0000 0x010000; " \
+ "sf read 0x41010000 0x300000 0x800000; " \
+ "bootz 0x41010000 - 0x41000000"
+
+#define CONFIG_BOOTARGS "console=ttyS2,115200 earlyprintk panic=5 rootwait mtdparts=spi32766.0:960k(uboot),64k(dtb),1M(background),1M(animation),8M(kernel),-(appendfs) root=/dev/ram0 rdinit=/init vt.global_cursor_default=0"
+
/*
* Include common sunxi configuration where most the settings are
*/
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index fcecd0b..2b0d9ca 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -274,7 +274,7 @@ extern int soft_i2c_gpio_scl;
#endif
#ifndef CONFIG_CONS_INDEX
-#define CONFIG_CONS_INDEX 1 /* UART0 */
+#define CONFIG_CONS_INDEX 3 /* UART0 */
#endif
#ifdef CONFIG_REQUIRE_SERIAL_CONSOLE
U-Boot 2017.01-rc2-00073-gdd6e874-dirty (Jul 21 2018 - 09:56:51 +0800) Allwinner Technology
CPU: Allwinner V3s (SUN8I 1681)
Model: Lichee Pi Zero
DRAM: 64 MiB
MMC: SUNXI SD/MMC: 0
SF: Detected mx25l12805 with page size 256 Bytes, erase size 64 KiB, total 16 MiB
*** Warning - bad CRC, using default environment
Setting up a 800x480 lcd console (overscan 0x0)
dotclock: 33000kHz = 33000kHz: (1 * 3MHz * 66) / 6
In: serial@01c28800
Out: serial@01c28800
Err: serial@01c28800
Net: No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot: 2 1 0
SF: Detected mx25l12805 with page size 256 Bytes, erase size 64 KiB, total 16 MiB
device 0 offset 0x100000, size 0x10000
SF: 65536 bytes @ 0x100000 Read: OK
device 0 offset 0x110000, size 0x600000
SF: 6291456 bytes @ 0x110000 Read: OK
=>
uboot 终于启动了.
修改了这两个文件:
modified: arch/arm/dts/sun8i-v3s-licheepi-zero.dts
/*
* Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
*
* This file is dual-licensed: you can use it either under the terms
* of the GPL or the X11 license, at your option. Note that this dual
* licensing only applies to this file, and not this project as a
* whole.
*
* a) This file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Or, alternatively,
*
* b) Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
/dts-v1/;
#include "sun8i-v3s.dtsi"
#include "sunxi-common-regulators.dtsi"
/ {
model = "Lichee Pi Zero";
compatible = "licheepi,licheepi-zero", "allwinner,sun8i-v3s";
aliases {
serial0 = &uart0;
serial2 = &uart2;
spi0 = &spi0;
ethernet0 = &emac;
};
chosen {
stdout-path = "serial2:115200n8";
};
};
&emac {
phy = <&phy0>;
phy-mode = "mii";
allwinner,use-internal-phy;
allwinner,leds-active-low;
status = "okay";
phy0: ethernet-phy@0 {
reg = <1>;
};
};
&mmc0 {
pinctrl-0 = <&mmc0_pins_a>;
pinctrl-names = "default";
broken-cd;
bus-width = <4>;
vmmc-supply = <®_vcc3v3>;
status = "okay";
};
&spi0 {
status = "okay";
};
&uart0 {
pinctrl-0 = <&uart0_pins_a>;
pinctrl-names = "default";
status = "okay";
};
&uart2 {
pinctrl-0 = <&uart2_pins_a>;
pinctrl-names = "default";
status = "okay";
};
&usb_otg {
dr_mode = "otg";
status = "okay";
};
&usbphy {
usb0_id_det-gpio = <&pio 5 6 GPIO_ACTIVE_HIGH>;
status = "okay";
};
modified: arch/arm/dts/sun8i-v3s.dtsi
/*
* Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
*
* This file is dual-licensed: you can use it either under the terms
* of the GPL or the X11 license, at your option. Note that this dual
* licensing only applies to this file, and not this project as a
* whole.
*
* a) This file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Or, alternatively,
*
* b) Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include <dt-bindings/clock/sun8i-v3s-ccu.h>
#include <dt-bindings/reset/sun8i-v3s-ccu.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/pinctrl/sun4i-a10.h>
/ {
#address-cells = <1>;
#size-cells = <1>;
interrupt-parent = <&gic>;
cpus {
#address-cells = <1>;
#size-cells = <0>;
cpu@0 {
compatible = "arm,cortex-a7";
device_type = "cpu";
reg = <0>;
clocks = <&ccu CLK_CPU>;
};
};
timer {
compatible = "arm,armv7-timer";
interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
<GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
<GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
<GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
};
clocks {
#address-cells = <1>;
#size-cells = <1>;
ranges;
osc24M: osc24M_clk {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <24000000>;
clock-output-names = "osc24M";
};
osc32k: osc32k_clk {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <32768>;
clock-output-names = "osc32k";
};
};
soc {
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <1>;
ranges;
dma: dma-controller@01c02000 {
compatible = "allwinner,sun8i-v3s-dma";
reg = <0x01c02000 0x1000>;
interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ccu CLK_BUS_DMA>;
resets = <&ccu RST_BUS_DMA>;
#dma-cells = <1>;
};
syscon: syscon@01c00000 {
compatible = "allwinner,sun8i-h3-syscon","syscon";
reg = <0x01c00000 0x34>;
};
mmc0: mmc@01c0f000 {
compatible = "allwinner,sun7i-a20-mmc";
reg = <0x01c0f000 0x1000>;
clocks = <&ccu CLK_BUS_MMC0>,
<&ccu CLK_MMC0>,
<&ccu CLK_MMC0_OUTPUT>,
<&ccu CLK_MMC0_SAMPLE>;
clock-names = "ahb",
"mmc",
"output",
"sample";
resets = <&ccu RST_BUS_MMC0>;
reset-names = "ahb";
interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};
mmc1: mmc@01c10000 {
compatible = "allwinner,sun7i-a20-mmc";
reg = <0x01c10000 0x1000>;
clocks = <&ccu CLK_BUS_MMC1>,
<&ccu CLK_MMC1>,
<&ccu CLK_MMC1_OUTPUT>,
<&ccu CLK_MMC1_SAMPLE>;
clock-names = "ahb",
"mmc",
"output",
"sample";
resets = <&ccu RST_BUS_MMC1>;
reset-names = "ahb";
interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};
mmc2: mmc@01c11000 {
compatible = "allwinner,sun7i-a20-mmc";
reg = <0x01c11000 0x1000>;
clocks = <&ccu CLK_BUS_MMC2>,
<&ccu CLK_MMC2>,
<&ccu CLK_MMC2_OUTPUT>,
<&ccu CLK_MMC2_SAMPLE>;
clock-names = "ahb",
"mmc",
"output",
"sample";
resets = <&ccu RST_BUS_MMC2>;
reset-names = "ahb";
interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};
usb_otg: usb@01c19000 {
compatible = "allwinner,sun8i-h3-musb";
reg = <0x01c19000 0x0400>;
clocks = <&ccu CLK_BUS_OTG>;
resets = <&ccu RST_BUS_OTG>;
interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "mc";
phys = <&usbphy 0>;
phy-names = "usb";
extcon = <&usbphy 0>;
status = "disabled";
};
usbphy: phy@01c19400 {
compatible = "allwinner,sun8i-v3s-usb-phy";
reg = <0x01c19400 0x2c>,
<0x01c1a800 0x4>;
reg-names = "phy_ctrl",
"pmu0";
clocks = <&ccu CLK_USB_PHY0>;
clock-names = "usb0_phy";
resets = <&ccu RST_USB_PHY0>;
reset-names = "usb0_reset";
status = "disabled";
#phy-cells = <1>;
};
ccu: clock@01c20000 {
compatible = "allwinner,sun8i-v3s-ccu";
reg = <0x01c20000 0x400>;
clocks = <&osc24M>, <&osc32k>;
clock-names = "hosc", "losc";
#clock-cells = <1>;
#reset-cells = <1>;
};
rtc: rtc@01c20400 {
compatible = "allwinner,sun6i-a31-rtc";
reg = <0x01c20400 0x54>;
interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
};
pio: pinctrl@01c20800 {
compatible = "allwinner,sun8i-v3s-pinctrl";
reg = <0x01c20800 0x400>;
interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>;
clock-names = "apb", "hosc", "losc";
gpio-controller;
#gpio-cells = <3>;
interrupt-controller;
#interrupt-cells = <3>;
emac_rgmii_pins: emac0@0 {
allwinner,pins = "PD0", "PD1", "PD2", "PD3",
"PD4", "PD5", "PD7",
"PD8", "PD9", "PD10",
"PD12", "PD13", "PD15",
"PD16", "PD17";
allwinner,function = "emac";
allwinner,drive = <SUN4I_PINCTRL_40_MA>;
allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
};
uart0_pins_a: uart0@0 {
pins = "PB8", "PB9";
function = "uart0";
bias-pull-up;
};
uart2_pins_a: uart2@0 {
pins = "PB0", "PB1";
function = "uart2";
bias-pull-up;
};
mmc0_pins_a: mmc0@0 {
pins = "PF0", "PF1", "PF2", "PF3",
"PF4", "PF5";
function = "mmc0";
drive-strength = <30>;
bias-pull-up;
};
spi0_pins: spi0 {
pins = "PC0", "PC1", "PC2", "PC3";
function = "spi0";
};
};
timer@01c20c00 {
compatible = "allwinner,sun4i-a10-timer";
reg = <0x01c20c00 0xa0>;
interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&osc24M>;
};
wdt0: watchdog@01c20ca0 {
compatible = "allwinner,sun6i-a31-wdt";
reg = <0x01c20ca0 0x20>;
interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
};
uart0: serial@01c28000 {
compatible = "snps,dw-apb-uart";
reg = <0x01c28000 0x400>;
interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&ccu CLK_BUS_UART0>;
resets = <&ccu RST_BUS_UART0>;
status = "disabled";
};
uart1: serial@01c28400 {
compatible = "snps,dw-apb-uart";
reg = <0x01c28400 0x400>;
interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&ccu CLK_BUS_UART1>;
resets = <&ccu RST_BUS_UART1>;
status = "disabled";
};
uart2: serial@01c28800 {
compatible = "snps,dw-apb-uart";
reg = <0x01c28800 0x400>;
interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&ccu CLK_BUS_UART2>;
resets = <&ccu RST_BUS_UART2>;
status = "disabled";
};
spi0: spi@1c68000 {
compatible = "allwinner,sun8i-h3-spi";
reg = <0x01c68000 0x1000>;
interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_SPI0>;
clock-names = "ahb", "mod";
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins>;
resets = <&ccu RST_BUS_SPI0>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};
emac: ethernet@1c30000 {
compatible = "allwinner,sun8i-h3-emac";
reg = <0x01c30000 0x104>, <0x01c00030 0x4>;
reg-names = "emac", "syscon";
interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
resets = <&ccu RST_BUS_EMAC>, <&ccu RST_BUS_EPHY>;
reset-names = "ahb", "ephy";
clocks = <&ccu CLK_BUS_EMAC>, <&ccu CLK_BUS_EPHY>;
clock-names = "ahb", "ephy";
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
};
gic: interrupt-controller@01c81000 {
compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
reg = <0x01c81000 0x1000>,
<0x01c82000 0x1000>,
<0x01c84000 0x2000>,
<0x01c86000 0x2000>;
interrupt-controller;
#interrupt-cells = <3>;
interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
};
};
};
但是发现串口2并没有数据输出.
git clone https://github.com/Lichee-Pi/u-boot.git -b v3s-spi-experimental
代码是上面这里下载到的.
默认是从 PB8,PB9 这组 UART0 输出的,
我现在想改到 PB0, PB1 这组 UART2 输出,
应该如何做到呢?
以下由 @哇酷小二 2021-02-10 添加
------------------------------------
相关链接:
荔枝派zero V3S u-boot调试信息从UART1(PE21/PE22)输出没有成功,还遗留什么没有修改? (修改成功,方案在8楼)
http://whycan.com/t_1624.html
spi flash 手册: https://www.winbond.com/resource-files/w25n01gv%20revg%20032116.pdf
立创商城链接: https://item.szlcsc.com/90048.html (有点小贵)
https://github.com/vamanea/mtd-utils/blob/master/flashcp.c
https://raw.githubusercontent.com/vamanea/mtd-utils/master/flashcp.c
接下来要把这个 flashcp 源码嵌到自己应用中去了。
用于在线刷机,
不能中途拔电源。
对, 是主线 Linux 4.13-y
[ 0.000000] Kernel command line: console=ttySl,115200 earlyprintk panic=5 rootwait mtdparts=spi32766.0:960k(uboot)ro,64k(dtb)ro,1M(ext1)ro,1M(ext2),6M(kernel)ro,-(fs) root=/dev/ram0 rdinit=/init vt.global_cursor_default=0
# cat /proc/mtd
dev: size erasesize name
mtd0: 000f0000 00010000 "uboot"
mtd1: 00010000 00010000 "dtb"
mtd2: 00100000 00010000 "ext1"
mtd3: 00100000 00010000 "ext2"
mtd4: 00800000 00010000 "kernel"
mtd5: 01500000 00010000 "fs"
http://www.eet-china.com/news/article/201706211552
ofo小黄车启用NB-IoT智能锁,拆开一看呵呵了
看来要不了多久就会有大量的 M26 涌入二手市场。
rst:0x1 (POWERON_RESET),boot:0x3f (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:5536
ho 0 tail 12 room 4
load:0x40078000,len:0
load:0x40078000,len:13756
entry 0x40078fb4
I (30) boot: ESP-IDF v3.0-rc1-257-g489e98cf-dirty 2nd stage bootloader
I (30) boot: compile time 21:58:53
I (33) boot: Enabling RNG early entropy source...
I (36) boot: SPI Speed : 40MHz
I (40) boot: SPI Mode : DIO
I (44) boot: SPI Flash Size : 8MB
I (48) boot: Partition Table:
I (52) boot: ## Label Usage Type ST Offset Length
I (59) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (67) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (74) boot: 2 factory factory app 00 00 00010000 00100000
I (82) boot: End of partition table
I (86) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x1d4c0 (120000) map
I (137) esp_image: segment 1: paddr=0x0002d4e8 vaddr=0x3ffb0000 size=0x02b28 ( 11048) load
I (141) esp_image: segment 2: paddr=0x00030018 vaddr=0x400d0018 size=0x7fe70 (523888) map
0x400d0018: _stext at ??:?I (327) esp_image: segment 3: paddr=0x000afe90 vaddr=0x3ffb2b28 size=0x006ec ( 1772) load
I (328) esp_image: segment 4: paddr=0x000b0584 vaddr=0x40080000 size=0x00400 ( 1024) load
0x40080000: _iram_start at C:/esp-adf/esp-idf/components/freertos/xtensa_vectors.S:1685I (334) esp_image: segment 5: paddr=0x000b098c vaddr=0x40080400 size=0x1282c ( 75820) load
I (374) esp_image: segment 6: paddr=0x000c31c0 vaddr=0x400c0000 size=0x00000 ( 0) load
I (385) boot: Loaded app from partition at offset 0x10000
I (385) boot: Disabling RNG early entropy source...
I (386) cpu_start: Pro cpu up.
I (389) cpu_start: Starting app cpu, entry point is 0x40080ff8
0x40080ff8: call_start_cpu1 at C:/esp-adf/esp-idf/components/esp32/cpu_start.c:215I (0) cpu_start: App cpu up.
I (400) heap_init: Initializing. RAM available for dynamic allocation:
I (407) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (413) heap_init: At 3FFB9568 len 00026A98 (154 KiB): DRAM
I (419) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (425) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (432) heap_init: At 40092C2C len 0000D3D4 (52 KiB): IRAM
I (438) cpu_start: Pro cpu start user code
I (120) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (148) BAIDU_SPEECH_EXAMPLE: [ 0 ] Start and wait for Wi-Fi network
I (148) wifi: wifi firmware version: 7ff2a2a
I (148) wifi: config NVS flash: enabled
I (158) wifi: config nano formating: disabled
I (158) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUS
E
I (168) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUS
E
I (198) wifi: Init dynamic tx buffer num: 32
I (198) wifi: Init data frame dynamic rx buffer num: 32
I (198) wifi: Init management frame dynamic rx buffer num: 32
I (208) wifi: wifi driver task: 3ffc0d80, prio:23, stack:4096
I (208) wifi: Init static rx buffer num: 10
I (208) wifi: Init dynamic rx buffer num: 32
I (218) wifi: wifi power manager task: 0x3ffc59c0 prio: 21 stack: 2560
I (248) phy: phy_version: 366.0, ba9923d, Dec 29 2017, 14:25:06, 0, 0
I (248) wifi: mode : sta (30:ae:a4:46:ac:a8)
I (618) wifi: n:3 0, o:1 0, ap:255 255, sta:3 0, prof:1
I (1598) wifi: state: init -> auth (b0)
I (1598) wifi: state: auth -> assoc (0)
I (1608) wifi: state: assoc -> run (10)
I (1708) wifi: connected with lingtel.cn, channel 3
I (2608) event: sta ip: 192.168.9.124, mask: 255.255.255.0, gw: 192.168.9.1
I (2608) BAIDU_SPEECH_EXAMPLE: [ 1 ] Start audio codec chip
I (2618) ES8388_DRIVER: init,out:02, in:00
I (2628) gpio: GPIO[21]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (2628) AUDIO_HAL: Codec mode is 2, Ctrl:1
I (2638) BAIDU_SPEECH_EXAMPLE: [2.0] Create audio pipeline for playback
I (2638) BAIDU_SPEECH_EXAMPLE: [2.1] Create http stream to read data
I (2648) BAIDU_SPEECH_EXAMPLE: [2.2] Create i2s stream to write data to codec chip
I (2658) I2S: DMA Malloc info, datalen=blocksize=1200, dma_buf_count=3
I (2658) I2S: DMA Malloc info, datalen=blocksize=1200, dma_buf_count=3
I (2668) I2S: APLL: Req RATE: 44100, real rate: 43945.016, BITS: 16, CLKM: 1, BCK: 8, MCLK: 1128
9966.924, SCLK: 1406240.500000, diva: 1, divb: 0
I (2678) BAIDU_SPEECH_EXAMPLE: [2.3] Create mp3 decoder to decode mp3 file
I (2688) BAIDU_SPEECH_EXAMPLE: [2.4] Register all elements to audio pipeline
I (2698) BAIDU_SPEECH_EXAMPLE: [2.5] Link it together http_stream-->mp3_decoder-->i2s_stream-->[
codec_chip]
I (2708) BAIDU_SPEECH_EXAMPLE: [2.6] Setup uri (http as http_stream, mp3 as mp3 decoder, and def
ault output is i2s)
I (2718) BAIDU_SPEECH_EXAMPLE: [ 4 ] Setup event listener
I (2728) BAIDU_SPEECH_EXAMPLE: [4.1] Listening event from all elements of pipeline
I (2738) BAIDU_SPEECH_EXAMPLE: [4.2] Listening event from peripherals
I (2738) BAIDU_SPEECH_EXAMPLE: [ 5 ] Start audio_pipeline
I (2748) AUDIO_ELEMENT: [http] Element task created
I (2748) AUDIO_ELEMENT: [mp3] Element task created
I (2758) AUDIO_ELEMENT: [i2s] Element task created
I (2758) AUDIO_PIPELINE: Func:audio_pipeline_run, Line:253, MEM Total:182768 BytesW (2768) AUDIO_ELEMENT: [http] RESUME:Element has not running,state:3,task_run:1
I (2778) AUDIO_ELEMENT: [http] AEL_MSG_CMD_RESUME,state:3
W (2798) AUDIO_ELEMENT: [mp3] RESUME:Element has not running,state:3,task_run:1
I (2798) AUDIO_ELEMENT: [mp3] AEL_MSG_CMD_RESUME,state:3
I (2798) MP3_DECODER: MP3 opened
W (2808) AUDIO_ELEMENT: [i2s] RESUME:Element has not running,state:3,task_run:1
I (2808) AUDIO_ELEMENT: [i2s] AEL_MSG_CMD_RESUME,state:3
I (2818) I2S_STREAM: AUDIO_STREAM_WRITER
I (2828) AUDIO_PIPELINE: Pipeline started
I (3658) I2S: APLL: Req RATE: 16000, real rate: 15999.022, BITS: 16, CLKM: 1, BCK: 8, MCLK: 4096
000.000, SCLK: 511968.718750, diva: 1, divb: 0
W (3658) AUDIO_ELEMENT: [i2s] RESUME:Element has not running,state:3,task_run:1
I (3668) AUDIO_ELEMENT: [i2s] AEL_MSG_CMD_RESUME,state:3
I (3668) I2S_STREAM: AUDIO_STREAM_WRITER
I (3818) BAIDU_AUTH: Access token=24.a4b6e6b604319fd37c097fae886a687f.2592000.1527689504.282335-11175544
I (4108) HTTP_STREAM: Content-Type = application/json
W (4108) HTTP_STREAM: No more data,errno:9
I (4108) AUDIO_ELEMENT: IN-[http] AEL_IO_DONE,0
I (4118) AUDIO_ELEMENT: IN-[mp3] AEL_IO_DONE,-2
Encountered error reading when MP3 init
E (4118) AUDIO_ELEMENT: [mp3] AEL_STATUS_ERROR_OPEN
I (4128) MP3_DECODER: Closed
E (4128) AUDIO_ELEMENT: [mp3] AEL_MSG_CMD_ERROR
W (4148) AUDIO_ELEMENT: IN-[i2s] AEL_IO_ABORT
W (4368) BAIDU_SPEECH_EXAMPLE: [ * ] Stop event received
I (4368) BAIDU_SPEECH_EXAMPLE: [ 6 ] Stop audio_pipeline
I (4368) AUDIO_PIPELINE: audio_pipeline_unlinked
I (4388) wifi: state: run -> init (0)
I (4388) wifi: n:3 0, o:3 0, ap:255 255, sta:3 0, prof:1
W (4388) PERIPH_WIFI: Wi-Fi disconnected from SSID lingtel.cn, auto-reconnect enabled, reconnect after 5000 ms
I (4398) wifi: flush txq
I (4398) wifi: stop sw txq
I (4398) wifi: lmac stop hw txq
I (4398) wifi: Deinit lldesc rx mblock:10
E (9398) wifi: esp_wifi_connect 858 wifi is not init
https://github.com/espressif/esp-adf/tree/master/examples/cloud_services/pipeline_baidu_speech_mp3
参考链接: LyraT 乐鑫官方ESP32开发板入坑记录
官方文档: LyraT 开发板介绍
原理图: esp32-lyrat-v4-schematic.pdf
AP5056手册: AP5056.pdf
//=======================================================================================
/*T1捕获中断*/
#pragma vector= ITC_IRQ_TIM1_CAPCOM+2
__interrupt void TIM1_CAP_COM(void)
{
Ulong Rn01,Rn02; Uchar i;
/*========================数据处理=================================================*/
IrInter.Rn++; //上升沿或下降沿捕获标志
if(IrInter.Rn==1)//120170707
{
IrInter.PeriT1=TIM1_GetCounter(); //读捕获值(上升沿)
Rn01=IrInter.Update; //溢出次数
IrInter.Update=0; //清溢出次数
Rn01<<=16;
IrInter.PeriT1+=Rn01;
IrInter.PeriTa=IrInter.PeriT1-IrInter.PeriT2; //得出低电平时间
TIM1_ICInit(TIM1_CHANNEL_3, //通道1
TIM1_ICPOLARITY_FALLING, //下降沿触发
TIM1_ICSELECTION_DIRECTTI, //IC1映射在TI1FP1上
TIM1_ICPSC_DIV1, //捕捉1分频
0x00); //滤波0
}
else if(IrInter.Rn==2)//0
{
IrInter.Rn=0;
IrInter.PeriT2=TIM1_GetCounter(); //读捕获值(下降沿)
Rn02=IrInter.Update; //溢出次数
IrInter.Update=0; //清溢出次数
Rn02<<=16;
IrInter.PeriT2+=Rn02;
IrInter.PeriTb=IrInter.PeriT2-IrInter.PeriT1; //得出高电平时间
TIM1_ICInit(TIM1_CHANNEL_3, //通道1
TIM1_ICPOLARITY_RISING, //上升沿触发
TIM1_ICSELECTION_DIRECTTI, //IC1映射在TI1FP1上
TIM1_ICPSC_DIV1, //捕捉1分频
0x00); //滤波0
}
//==============================解码处理================================================== IrInter.Rn==1才是接收了正确的Ta,Tb
if(/*(WorkStateBit.Bit.IrInStatEn==1)&&*/(IrInter.Rn==1)&&(IrInter.PeriTb>280)&&(IrInter.PeriTb<350)&&(IrInter.PeriTa>8000)&&(IrInter.PeriTa<11000)) //判头码 170 255 5950 6300
{//开始
IrInter.HeadCode=1; //正确接收到头码
IrInter.DataPiont=(Uchar*)&Irdata.DM1; //取指针地址
IrInter.Ri0=0; //计每个字节位数
IrInter.Ri1=0; //计字节数
}
//--------------------------头码正确-------------------------------------------------------
else if((IrInter.HeadCode==1)&&(IrInter.Rn==1)&&(IrInter.PeriTb>280)&&(IrInter.PeriTb<1200)) //检数据时间译码
{
if(IrInter.PeriTb>800)//500(1000)
{*IrInter.DataPiont|=Db[IrInter.Ri0];} //高为1
else
{*IrInter.DataPiont&=~Db[IrInter.Ri0];}//低为0
if(++IrInter.Ri0 >=8) //收够8位数据指针加1,进1个字节
{
IrInter.Ri0=0; //接收计位数
IrInter.Ri1++; //接收计字节数
IrInter.DataPiont++; //接收指针加1
if(IrInter.Ri1 ==3)//收够3个字节(看数据长度来修改)
{
Tx=~Tx;
IrInter.DataPiont=(Uchar*)&Irdata.DM1; //取缓存指针地址
IrInter.Rn01++; //每次接收3个数据包
switch (IrInter.Rn01)
{
case 1: IrInter.DataPiontA=(Uchar*)&IrdataA.DM1; //取数据A指针地址
; break;
case 2: IrInter.DataPiontA=(Uchar*)&IrdataA.DM1+4; //取数据A指针地址+4
; break;
case 3: IrInter.Rn01=0;
IrInter.DataPiontA=(Uchar*)&IrdataA.DM1+8; //取数据A指针地址+8
; break;
}
for(i=0;i<3;i++) //
{
*IrInter.DataPiontA++=*IrInter.DataPiont++; //将缓存数据存入寄存器
}
if((IrdataA.DM1==IrdataA.DM5)&&(IrdataA.DM2==IrdataA.DM6)&&(IrdataA.DM3==IrdataA.DM7))
{
if((IrdataA.DM1==IrdataA.DM9)&&(IrdataA.DM2==IrdataA.DM10)&&(IrdataA.DM3==IrdataA.DM11))
{
IrInter.Receive_OK=1; //3个包接收OK
//WorkStateBit.Bit.IrInStatEn=0; //关接收
IrEep.IrRn++;
IrEep.KongTime=0;
if((IrXueXiBit.Bit.KongBit==1)&&(WorkStateBit.Bit.ZhengChangRunEn==1)&&(IrdataA.DM1==IrdataB.DM1)&&(IrdataA.DM2==IrdataB.DM2)&&(IrdataA.DM3==IrdataB.DM3))
{
Moto.Rn++;
IrXueXiBit.Bit.KongBit=0;
MotoStateBit.Bit.YiChuLi=1;
}
}
}
IrInter.HeadCode=0; //清头码标志
}
}
}
//================================================================================
/*-------------------------------------------------------------------------*/
TIM1_ClearITPendingBit(TIM1_IT_CC3); //清除捕获比较3中断标志
}
//================================================================================
参考链接: 动态更改i2c速度
I've connected two peripherals to the I2C bus on a PI. the first is a microchip PIC, which will happily operate with a clock speed of 1.5MHz, and the second is an LCD display which would prefer 100kHz. I wish to change the clock frequency per transaction between calls to the write() system call.
something like:
ioctl(bus, I2C_SET_SPEED, 1500000)
ioctl(bus, I2C_SLAVE, PICAddress)
write(i2c,PICBytes,20)
ioctl(bus, I2C_SET_SPEED, 400000)
ioctl(bus, I2C_SLAVE, LCDAddress)
write(i2c,PICBytes,20)Can anyone point me at the correct ioctl call? (changing the frequency using /sys/module/i2c_bcm2708/parameters/baudrate and a string doesn't seem like a good plan!)
上面是帖主的想法, 想在应用层动态改变速度.
不要这样做,无论如何,I2c只能达到400kHz。
即使在400 kHz的高速传输也会对较慢的设备产生影响,因为它会得到乱码数据并认为它是有效数据。
如果你必须有两种速度,使用两个不同的i2c控制器,一个在400kHz,一个在100kHz
在运行中更改速度时,I2C总线必须静止。如果不是,那么内核就会恐慌。使用两组 i2c 总线,并保持各自的速度不变是我的建议。
上面是其中两个回答,google自动翻译。
刚刚搜了一下,大部分soc的sdk都没有实现在应用程序接口设置i2c总线速度,
参考链接1: bus speed of /dev/i2c-2 on imx6q
look for IMX_I2C_BIT_RATE in drivers/i2c/busses/i2c-imx.c
how it's set depends a lot on the driver is written and on how new/old the kernel is, for example look at arch/arm/mach-davinci/board-da830-evm.c and you'll find
static struct davinci_i2c_platform_data da830_evm_i2c_0_pdata = {
.bus_freq = 100, /* kHz */
.bus_delay = 0, /* usec */
};so the speed is set in platform code and the driver takes it from there.
on a newer kernel you may be using devicetree and the i2c speed would be set there rather than platform code. example on BeagleBone Black
in arch/arm/boot/dts/am335x-bone.dts&i2c1 {
status = "okay";
clock-frequency = <400000>;other drivers may even have a module parameter you can set when you load the module.
In summary, there are many different ways it can be done
IMX在设备树初始化I2C速度
参考链接2: [url=https://www.raspberrypi.org/forums/viewtopic.php?t=77584]
SOLVED: I2C clock speed / performance[/url]
modprobe i2c_bcm2708 baudrate=1200000
树莓派sdk在装载驱动设置i2c速度
全志正式发布V5系列新一代编码处理器,迈向双目智能影像市场
2017年6月23日
2017年6月20日中国深圳——珠海全志科技股份有限公司(300458)在全志科技生态合作伙伴大会APC 2017上正式发布V5系列智能编码处理器,支持双目摄像,并加入最新一代HawkView 5.0图像处理器与4K Smart H.265 视频编码器,进一步提高运动相机、安防监控应用场景的画质水平,帮助客户打造更具市场竞争力的智能创新产品。
全志科技事业三部总经理王新荣表示:“相较前一代产品,Allwinner V5实现了智能视觉的一大跨越,不仅在图像效果及图形处理进行了大幅改进提升,实现了星光夜视降噪,全景机内拼接等特色功能,并结合未来智能发展趋势,通过硬件化智能检测引擎(人脸)及提供4核高速运算能力,给用户带来效果更好、更智能的视觉产品及应用。”
图1: 全志科技在APC2017发布V5
V5芯片采用的HawkView 5.0图像处理引擎,其集成了2D/3D智能降噪、帧宽动态合成、锐化增强、特定色彩增强等图像前处理技术,结合各类影像场景需求,对每一帧画面进行精细还原。
图2:V5芯片精细还原每一帧画面
如今,运动相机、安防监控市场对流媒体清晰度的要求不断提高,从1080P提升到4K。画质体验得到大幅度升级,但清晰度的提升带来传输带宽与码率的考验也变得愈发严苛。V5芯片率先引入4K 30fps Smart H.265 智能码率压缩技术,与支持16x16宏块的H.264编码算法相比,H.265最高支持64x64宏块,突破性实现了同等画质下传输带宽减半、存储空间减半,并且完美兼容H.264编码,实现了流媒体4K超清升级!
图3:监控场景下V5芯片可提供4K高清细节
V5芯片支持双摄像头接口以及独立双ISP引擎,融合同步拼接技术,实现超广角180度/全景360度拼接。通过双目机内拼接实现全景高清视频、6K全景图片拍照,无须借助后端(如手机等),同时帧级同步技术保证拼接处无缝过渡,即可还原最真实的眼前世界,适用于从行业到消费领域的多方面应用!
此外,全志科技开发的硬件化智能加速算法,配合V5芯片高性能的4核CPU运算能力来满足各类智能算法拓展需求,可实现人脸检测、周界防御、景深分析等功能,并支持双目景深图的实时生成,通过软硬结合的方式来帮助客户实现产品前端智能化。
图4:V5芯片创新加入人脸检测等功能
V5芯片配备了完整的的输入输出相关接口,具备丰富的可拓展性,同时提供标准Linux SDK、及完整开发套件(EVB、文档、图像调试工具),帮助开发者上手开发,快速打造更智能、更创新的运动相机、安防监控等热门应用领域的解决方案!
关于全志
全志科技(Allwinner Technology,股票代码300458) 成立于2007年,研发总部设于中国珠海, 在深圳、西安、北京、上海、杭州设有研发中心或办事处,是领先的智能应用处理器SoC和智能模拟芯片设计厂商。
凭借卓越的研发团队及技术实力,全志科技在超高清视频编解码、高性能CPU/GPU多核整合、先进工艺的高集成度、超低功耗等方面处于业界领先水平,产品领域覆盖车联网、智能硬件、智能家电、服务机器人、无人机、虚拟现实、平板电脑、OTT盒子、移动互联网设备以及智能电源管理等。
至目前,全志科技与ARM、Google、Microsoft等国际公司形成良好合作关系,已成为中国智能应用处理器主流供应商之一,并从多媒体M(Multimedia) 、模拟A(Analog) 、网络N(Network) 、服务S(Service)不同维度全面拥抱大视频战略。
2017年6月全志allwinner V5 方案, 目标市场形成记录仪, 运动相机
http://www.allwinnertech.com/index.php?c=news&a=index&id=246
V5有双ISP
V5的软件架构和海思是一样的,ISP可以自己写算法
海康的相机 海思的基本都没有用海思的isp
#include <minigui/common.h>
#include <minigui/minigui.h>
#include <minigui/gdi.h>
#include <minigui/window.h>
#include <minigui/control.h>
#define IDC_MYBUTTON 100
#define IDC_MYBUTTON2 110
int (*old_button_proc) (hWnd, message, wParam, lParam);
static int MybuttonWindowProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
int temp;
temp = (*old_button_proc) (hWnd, message, wParam, lParam);
switch(message)
{
case MSG_CREATE:
{
SetWindowBkColor(hWnd, COLOR_red);
}
break;
case MSG_SETFOCUS:{
SetWindowBkColor(hWnd, COLOR_red);
}break;
case MSG_KILLFOCUS:
{
SetWindowBkColor(hWnd, COLOR_darkgray);
}break;
}
return(temp);
}
//注册自定义控件
BOOL RegisterMybutton (void)
{
WNDCLASS WndClass;
WndClass.spClassName = CTRL_BUTTON;
GetWindowClassInfo(&WndClass);
old_button_proc = WndClass.WinProc;
WndClass.spClassName = "mybutton";
WndClass.dwStyle = 0;
WndClass.dwExStyle = 0;
WndClass.hCursor = GetSystemCursor(0);
WndClass.iBkColor = PIXEL_lightgray;
WndClass.WinProc = MybuttonWindowProc;
return RegisterWindowClass (&WndClass);
}
/* main windoww proc */
static int CaptureWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case MSG_CREATE:
RegisterMybutton();//使用前,注册自定义控件
//创建自定义按钮控件
CreateWindow ("mybutton", "", WS_VISIBLE | WS_CHILD, IDC_MYBUTTON,
10, 95, 200, 20, hWnd, 0);
break;
case MSG_CLOSE:
DestroyAllControls (hWnd);
DestroyMainWindow (hWnd);
PostQuitMessage (hWnd);
return 0;
}
return DefaultMainWinProc(hWnd, message, wParam, lParam);
}
int MiniGUIMain (int args, const char* arg[])
{
MSG Msg;
HWND hMainWnd;
MAINWINCREATE CreateInfo;
#ifdef _MGRM_PROCESSES
JoinLayer(NAME_DEF_LAYER , "capture" , 0 , 0);
#endif
CreateInfo.dwStyle = WS_VISIBLE | WS_BORDER | WS_CAPTION;
CreateInfo.dwExStyle = WS_EX_NONE;
CreateInfo.spCaption = "using mouse capture demo";
CreateInfo.hMenu = 0;
CreateInfo.hCursor = GetSystemCursor(0);
CreateInfo.hIcon = 0;
CreateInfo.MainWindowProc = CaptureWinProc;
CreateInfo.lx = 0;
CreateInfo.ty = 0;
CreateInfo.rx = 320;
CreateInfo.by = 240;
CreateInfo.iBkColor = COLOR_lightwhite;
CreateInfo.dwAddData = 0;
CreateInfo.hHosting = HWND_DESKTOP;
hMainWnd = CreateMainWindow (&CreateInfo);
if (hMainWnd == HWND_INVALID)
return -1;
ShowWindow(hMainWnd, SW_SHOWNORMAL);
while (GetMessage(&Msg, hMainWnd)) {
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
MainWindowThreadCleanup (hMainWnd);
return 0;
}
#ifndef _LITE_VERSION
#include <minigui/dti.c>
#endif #include <minigui/common.h>
#include <minigui/minigui.h>
#include <minigui/gdi.h>
#include <minigui/window.h>
#include <minigui/control.h>
#define IDC_MYBUTTON 100
#define IDC_MYBUTTON2 110
int (*old_button_proc) (hWnd, message, wParam, lParam);
static int MybuttonWindowProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
int temp;
temp = (*old_button_proc) (hWnd, message, wParam, lParam);
switch(message)
{
case MSG_CREATE:
{
SetWindowBkColor(hWnd, COLOR_red);
}
break;
case MSG_SETFOCUS:{
SetWindowBkColor(hWnd, COLOR_red);
}break;
case MSG_KILLFOCUS:
{
SetWindowBkColor(hWnd, COLOR_darkgray);
}break;
}
return(temp);
}
//注册自定义控件
BOOL RegisterMybutton (void)
{
WNDCLASS WndClass;
WndClass.spClassName = CTRL_BUTTON;
GetWindowClassInfo(&WndClass);
old_button_proc = WndClass.WinProc;
WndClass.spClassName = "mybutton";
WndClass.dwStyle = 0;
WndClass.dwExStyle = 0;
WndClass.hCursor = GetSystemCursor(0);
WndClass.iBkColor = PIXEL_lightgray;
WndClass.WinProc = MybuttonWindowProc;
return RegisterWindowClass (&WndClass);
}
/* main windoww proc */
static int CaptureWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case MSG_CREATE:
RegisterMybutton();//使用前,注册自定义控件
//创建自定义按钮控件
CreateWindow ("mybutton", "", WS_VISIBLE | WS_CHILD, IDC_MYBUTTON,
10, 95, 200, 20, hWnd, 0);
break;
case MSG_CLOSE:
DestroyAllControls (hWnd);
DestroyMainWindow (hWnd);
PostQuitMessage (hWnd);
return 0;
}
return DefaultMainWinProc(hWnd, message, wParam, lParam);
}
int MiniGUIMain (int args, const char* arg[])
{
MSG Msg;
HWND hMainWnd;
MAINWINCREATE CreateInfo;
#ifdef _MGRM_PROCESSES
JoinLayer(NAME_DEF_LAYER , "capture" , 0 , 0);
#endif
CreateInfo.dwStyle = WS_VISIBLE | WS_BORDER | WS_CAPTION;
CreateInfo.dwExStyle = WS_EX_NONE;
CreateInfo.spCaption = "using mouse capture demo";
CreateInfo.hMenu = 0;
CreateInfo.hCursor = GetSystemCursor(0);
CreateInfo.hIcon = 0;
CreateInfo.MainWindowProc = CaptureWinProc;
CreateInfo.lx = 0;
CreateInfo.ty = 0;
CreateInfo.rx = 320;
CreateInfo.by = 240;
CreateInfo.iBkColor = COLOR_lightwhite;
CreateInfo.dwAddData = 0;
CreateInfo.hHosting = HWND_DESKTOP;
hMainWnd = CreateMainWindow (&CreateInfo);
if (hMainWnd == HWND_INVALID)
return -1;
ShowWindow(hMainWnd, SW_SHOWNORMAL);
while (GetMessage(&Msg, hMainWnd)) {
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
MainWindowThreadCleanup (hMainWnd);
return 0;
}
#ifndef _LITE_VERSION
#include <minigui/dti.c>
#endif
代码是这个, MiniGUI的自定义button代码
本站下载1: Beyond_Compare-zh-4.1.6.21095.rar
本站下载2: UltraCompare.rar
typedef enum tag_DISP_CMD {
/* ----disp global---- */
DISP_CMD_VERSION = 0x00,
DISP_CMD_RESERVE1 = 0x01,
/* fail when the value is 0x02 in linux,why??? */
DISP_CMD_SET_BKCOLOR = 0x3f,
DISP_CMD_GET_BKCOLOR = 0x03,
DISP_CMD_SET_COLORKEY = 0x04,
DISP_CMD_GET_COLORKEY = 0x05,
DISP_CMD_SET_PALETTE_TBL = 0x06,
DISP_CMD_GET_PALETTE_TBL = 0x07,
DISP_CMD_SCN_GET_WIDTH = 0x08,
DISP_CMD_SCN_GET_HEIGHT = 0x09,
DISP_CMD_GET_OUTPUT_TYPE = 0x0a,
DISP_CMD_SET_EXIT_MODE = 0x0c,
DISP_CMD_SET_GAMMA_TABLE = 0x0d,
DISP_CMD_GAMMA_CORRECTION_ON = 0x0e,
DISP_CMD_GAMMA_CORRECTION_OFF = 0x0f,
DISP_CMD_START_CMD_CACHE = 0x10,
DISP_CMD_EXECUTE_CMD_AND_STOP_CACHE = 0x11,
DISP_CMD_SET_BRIGHT = 0x12,
DISP_CMD_SET_CONTRAST = 0x13,
DISP_CMD_SET_SATURATION = 0x14,
DISP_CMD_GET_BRIGHT = 0x16,
DISP_CMD_GET_CONTRAST = 0x17,
DISP_CMD_GET_SATURATION = 0x18,
DISP_CMD_ENHANCE_ON = 0x1a,
DISP_CMD_ENHANCE_OFF = 0x1b,
DISP_CMD_GET_ENHANCE_EN = 0x1c,
DISP_CMD_CLK_ON = 0x1d,
DISP_CMD_CLK_OFF = 0x1e,
/*
* when the screen is not used to display(lcd/tv/vga/hdmi) directly,
* maybe capture the screen and scaler to dram, or as a layer of
* another screen
*/
DISP_CMD_SET_SCREEN_SIZE = 0x1f,
DISP_CMD_CAPTURE_SCREEN = 0x20, /* caputre screen and scaler to dram */
DISP_CMD_DE_FLICKER_ON = 0x21,
DISP_CMD_DE_FLICKER_OFF = 0x22,
DISP_CMD_SET_HUE = 0x23,
DISP_CMD_GET_HUE = 0x24,
DISP_CMD_DRC_OFF = 0x25,
DISP_CMD_GET_DRC_EN = 0x26,
DISP_CMD_DE_FLICKER_SET_WINDOW = 0x27,
DISP_CMD_DRC_SET_WINDOW = 0x28,
DISP_CMD_DRC_ON = 0x29,
DISP_CMD_GET_DE_FLICKER_EN = 0x2a,
/* ----layer---- */
DISP_CMD_LAYER_REQUEST = 0x40,
DISP_CMD_LAYER_RELEASE = 0x41,
DISP_CMD_LAYER_OPEN = 0x42,
DISP_CMD_LAYER_CLOSE = 0x43,
DISP_CMD_LAYER_SET_FB = 0x44,
DISP_CMD_LAYER_GET_FB = 0x45,
DISP_CMD_LAYER_SET_SRC_WINDOW = 0x46,
DISP_CMD_LAYER_GET_SRC_WINDOW = 0x47,
DISP_CMD_LAYER_SET_SCN_WINDOW = 0x48,
DISP_CMD_LAYER_GET_SCN_WINDOW = 0x49,
DISP_CMD_LAYER_SET_PARA = 0x4a,
DISP_CMD_LAYER_GET_PARA = 0x4b,
DISP_CMD_LAYER_ALPHA_ON = 0x4c,
DISP_CMD_LAYER_ALPHA_OFF = 0x4d,
DISP_CMD_LAYER_GET_ALPHA_EN = 0x4e,
DISP_CMD_LAYER_SET_ALPHA_VALUE = 0x4f,
DISP_CMD_LAYER_GET_ALPHA_VALUE = 0x50,
DISP_CMD_LAYER_CK_ON = 0x51,
DISP_CMD_LAYER_CK_OFF = 0x52,
DISP_CMD_LAYER_GET_CK_EN = 0x53,
DISP_CMD_LAYER_SET_PIPE = 0x54,
DISP_CMD_LAYER_GET_PIPE = 0x55,
DISP_CMD_LAYER_TOP = 0x56,
DISP_CMD_LAYER_BOTTOM = 0x57,
DISP_CMD_LAYER_GET_PRIO = 0x58,
DISP_CMD_LAYER_SET_SMOOTH = 0x59,
DISP_CMD_LAYER_GET_SMOOTH = 0x5a,
DISP_CMD_LAYER_SET_BRIGHT = 0x5b, /* brightness */
DISP_CMD_LAYER_SET_CONTRAST = 0x5c, /* contrast */
DISP_CMD_LAYER_SET_SATURATION = 0x5d, /* saturation */
DISP_CMD_LAYER_SET_HUE = 0x5e, /* hue, chroma */
DISP_CMD_LAYER_GET_BRIGHT = 0x5f,
DISP_CMD_LAYER_GET_CONTRAST = 0x60,
DISP_CMD_LAYER_GET_SATURATION = 0x61,
DISP_CMD_LAYER_GET_HUE = 0x62,
DISP_CMD_LAYER_ENHANCE_ON = 0x63,
DISP_CMD_LAYER_ENHANCE_OFF = 0x64,
DISP_CMD_LAYER_GET_ENHANCE_EN = 0x65,
DISP_CMD_LAYER_VPP_ON = 0x67,
DISP_CMD_LAYER_VPP_OFF = 0x68,
DISP_CMD_LAYER_GET_VPP_EN = 0x69,
DISP_CMD_LAYER_SET_LUMA_SHARP_LEVEL = 0x6a,
DISP_CMD_LAYER_GET_LUMA_SHARP_LEVEL = 0x6b,
DISP_CMD_LAYER_SET_CHROMA_SHARP_LEVEL = 0x6c,
DISP_CMD_LAYER_GET_CHROMA_SHARP_LEVEL = 0x6d,
DISP_CMD_LAYER_SET_WHITE_EXTEN_LEVEL = 0x6e,
DISP_CMD_LAYER_GET_WHITE_EXTEN_LEVEL = 0x6f,
DISP_CMD_LAYER_SET_BLACK_EXTEN_LEVEL = 0x70,
DISP_CMD_LAYER_GET_BLACK_EXTEN_LEVEL = 0x71,
/* ----scaler---- */
DISP_CMD_SCALER_REQUEST = 0x80,
DISP_CMD_SCALER_RELEASE = 0x81,
DISP_CMD_SCALER_EXECUTE = 0x82,
/* ----hwc---- */
DISP_CMD_HWC_OPEN = 0xc0,
DISP_CMD_HWC_CLOSE = 0xc1,
DISP_CMD_HWC_SET_POS = 0xc2,
DISP_CMD_HWC_GET_POS = 0xc3,
DISP_CMD_HWC_SET_FB = 0xc4,
DISP_CMD_HWC_SET_PALETTE_TABLE = 0xc5,
/* ----video---- */
DISP_CMD_VIDEO_START = 0x100,
DISP_CMD_VIDEO_STOP = 0x101,
DISP_CMD_VIDEO_SET_FB = 0x102,
DISP_CMD_VIDEO_GET_FRAME_ID = 0x103,
DISP_CMD_VIDEO_GET_DIT_INFO = 0x104,
/* ----lcd---- */
DISP_CMD_LCD_ON = 0x140,
DISP_CMD_LCD_OFF = 0x141,
DISP_CMD_LCD_SET_BRIGHTNESS = 0x142,
DISP_CMD_LCD_GET_BRIGHTNESS = 0x143,
DISP_CMD_LCD_CPUIF_XY_SWITCH = 0x146,
DISP_CMD_LCD_CHECK_OPEN_FINISH = 0x14a,
DISP_CMD_LCD_CHECK_CLOSE_FINISH = 0x14b,
DISP_CMD_LCD_SET_SRC = 0x14c,
DISP_CMD_LCD_USER_DEFINED_FUNC = 0x14d,
/* ----tv---- */
DISP_CMD_TV_ON = 0x180,
DISP_CMD_TV_OFF = 0x181,
DISP_CMD_TV_SET_MODE = 0x182,
DISP_CMD_TV_GET_MODE = 0x183,
DISP_CMD_TV_AUTOCHECK_ON = 0x184,
DISP_CMD_TV_AUTOCHECK_OFF = 0x185,
DISP_CMD_TV_GET_INTERFACE = 0x186,
DISP_CMD_TV_SET_SRC = 0x187,
DISP_CMD_TV_GET_DAC_STATUS = 0x188,
DISP_CMD_TV_SET_DAC_SOURCE = 0x189,
DISP_CMD_TV_GET_DAC_SOURCE = 0x18a,
/* ----hdmi---- */
DISP_CMD_HDMI_ON = 0x1c0,
DISP_CMD_HDMI_OFF = 0x1c1,
DISP_CMD_HDMI_SET_MODE = 0x1c2,
DISP_CMD_HDMI_GET_MODE = 0x1c3,
DISP_CMD_HDMI_SUPPORT_MODE = 0x1c4,
DISP_CMD_HDMI_GET_HPD_STATUS = 0x1c5,
DISP_CMD_HDMI_SET_SRC = 0x1c6,
/* ----vga---- */
DISP_CMD_VGA_ON = 0x200,
DISP_CMD_VGA_OFF = 0x201,
DISP_CMD_VGA_SET_MODE = 0x202,
DISP_CMD_VGA_GET_MODE = 0x203,
DISP_CMD_VGA_SET_SRC = 0x204,
/* ----sprite---- */
DISP_CMD_SPRITE_OPEN = 0x240,
DISP_CMD_SPRITE_CLOSE = 0x241,
DISP_CMD_SPRITE_SET_FORMAT = 0x242,
DISP_CMD_SPRITE_GLOBAL_ALPHA_ENABLE = 0x243,
DISP_CMD_SPRITE_GLOBAL_ALPHA_DISABLE = 0x244,
DISP_CMD_SPRITE_GET_GLOBAL_ALPHA_ENABLE = 0x252,
DISP_CMD_SPRITE_SET_GLOBAL_ALPHA_VALUE = 0x245,
DISP_CMD_SPRITE_GET_GLOBAL_ALPHA_VALUE = 0x253,
DISP_CMD_SPRITE_SET_ORDER = 0x246,
DISP_CMD_SPRITE_GET_TOP_BLOCK = 0x250,
DISP_CMD_SPRITE_GET_BOTTOM_BLOCK = 0x251,
DISP_CMD_SPRITE_SET_PALETTE_TBL = 0x247,
DISP_CMD_SPRITE_GET_BLOCK_NUM = 0x259,
DISP_CMD_SPRITE_BLOCK_REQUEST = 0x248,
DISP_CMD_SPRITE_BLOCK_RELEASE = 0x249,
DISP_CMD_SPRITE_BLOCK_OPEN = 0x257,
DISP_CMD_SPRITE_BLOCK_CLOSE = 0x258,
DISP_CMD_SPRITE_BLOCK_SET_SOURCE_WINDOW = 0x25a,
DISP_CMD_SPRITE_BLOCK_GET_SOURCE_WINDOW = 0x25b,
DISP_CMD_SPRITE_BLOCK_SET_SCREEN_WINDOW = 0x24a,
DISP_CMD_SPRITE_BLOCK_GET_SCREEN_WINDOW = 0x24c,
DISP_CMD_SPRITE_BLOCK_SET_FB = 0x24b,
DISP_CMD_SPRITE_BLOCK_GET_FB = 0x24d,
DISP_CMD_SPRITE_BLOCK_SET_PARA = 0x25c,
DISP_CMD_SPRITE_BLOCK_GET_PARA = 0x25d,
DISP_CMD_SPRITE_BLOCK_SET_TOP = 0x24e,
DISP_CMD_SPRITE_BLOCK_SET_BOTTOM = 0x24f,
DISP_CMD_SPRITE_BLOCK_GET_PREV_BLOCK = 0x254,
DISP_CMD_SPRITE_BLOCK_GET_NEXT_BLOCK = 0x255,
DISP_CMD_SPRITE_BLOCK_GET_PRIO = 0x256,
/* ----framebuffer---- */
DISP_CMD_FB_REQUEST = 0x280,
DISP_CMD_FB_RELEASE = 0x281,
DISP_CMD_FB_GET_PARA = 0x282,
DISP_CMD_GET_DISP_INIT_PARA = 0x283,
/* ---for Displayer Test -------- */
DISP_CMD_MEM_REQUEST = 0x2c0,
DISP_CMD_MEM_RELASE = 0x2c1,
DISP_CMD_MEM_GETADR = 0x2c2,
DISP_CMD_MEM_SELIDX = 0x2c3,
DISP_CMD_SUSPEND = 0x2d0,
DISP_CMD_RESUME = 0x2d1,
DISP_CMD_PRINT_REG = 0x2e0,
/* ---pwm -------- */
DISP_CMD_PWM_SET_PARA = 0x300,
DISP_CMD_PWM_GET_PARA = 0x301,
} __disp_cmd_t;
从代码上看 sunxi_disp_ioctl.h,感觉就是显示控制的.
DISP_CMD_LCD_ON
DISP_CMD_LCD_OFF
从字面理解就是液晶的开和关.
DISP_CMD_TV_ON
DISP_CMD_TV_OFF
从字面理解就是CVBS输出的开和关.
从
页次: 1