页次: 1
Verifying Checksum ... Bad Data CRC
ERROR: can't get kernel image!
SCRIPT FAILED: continuing...
starting USB...
怀疑你的卡有问题, 换张卡。
感觉楼主的问题和这个有点类似: https://bbs.csdn.net/topics/50226141
我在OnDraw()中,有大量的图形计算,所以每次当移动窗口,
或者被窗口覆盖的时候就要重新进行这部分的图形计算,
我觉得很是浪费,有什么办法解决啊???我在VIEW中画的图很大很大,超过了客户区,因此使用了
CScrollView,所以每次我拖动滚动条时都会重新画一遍整个
计算复杂的图,速度暴慢,请DX出出点子啊~~~~~~~~
一个回答:
不要直接写在OnDraw()里,
至少也要加个条件判断一下是否需要重画
这个回答比较靠谱:
用多线程,启动一个线程单独用于计算,
在OnDraw里面向这个线程PostThreadMessage,
传进一些基本的参数,然后在线程里面计算,计算完,
再把需要的结果用PostMessage传递回来,
在消息处理函数中完成绘图。比如说,如果你是在客户区显示位图,并要对位图进行一些计算操作,
那么就把位图的数据指针传到计算线程里,计算之后,
再把位图数据指针传递回来,然后简单的调用
Bitblt之类的函数就可以画图了,效率应该会有提高的。
error: unrecognized command line option ‘--with-arch=armv5te’; did you mean ‘-march=armv5te’?
root@osboxes:/work/Lichee/helloword/emWin/Sample/GUIDemo# make
/work/Lichee/helloword/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc --with-arch=armv5te -MD -O2 -D__Gui_NumBytes__=512000 -I. -I../../Config -I../../Include -Itslib -c Application/GUIDEMO_Automotive.c -o Application/GUIDEMO_Automotive.o
arm-linux-gnueabi-gcc: error: unrecognized command line option ‘--with-arch=armv5te’; did you mean ‘-march=armv5te’?
Makefile:34: recipe for target 'Application/GUIDEMO_Automotive.o' failed
make: *** [Application/GUIDEMO_Automotive.o] Error 1
‘--with-arch=armv5te’ ====> ‘-march=armv5te’
BL8531CB3TR50 : https://item.szlcsc.com/98996.html
H8118A50M5R: https://item.szlcsc.com/402171.html
都是 sot23-5 封装的, 引脚也一样。
https://www.bandwagonhost.net/5573.html
今年双十一,搬瓦工没有任何优惠活动。不过去年双十一参加活动到期的主机,今天可以续费。
发现连续两次用sendevent 发送x,y绝对坐标, 这样触发才比较精确,否则有可能变成了长按。
./sendevent /dev/input/event1 1 330 1
./sendevent /dev/input/event1 3 0 2558
./sendevent /dev/input/event1 3 1 357
./sendevent /dev/input/event1 0 0 0
./sendevent /dev/input/event1 3 0 2558
./sendevent /dev/input/event1 3 1 365
./sendevent /dev/input/event1 0 0 0
./sendevent /dev/input/event1 1 330 0
./sendevent /dev/input/event1 0 0 0
./sendevent /dev/input/event1 1 330 1
./sendevent /dev/input/event1 3 0 1246
./sendevent /dev/input/event1 3 1 376
./sendevent /dev/input/event1 0 0 0
./sendevent /dev/input/event1 3 0 1246
./sendevent /dev/input/event1 3 1 376
./sendevent /dev/input/event1 0 0 0
./sendevent /dev/input/event1 1 330 0
./sendevent /dev/input/event1 0 0 0
解决 V3s Linux 显示 starting kernel ... 就没有然后的问题 (earlyprintk): https://whycan.cn/t_2402.html
https://github.com/spack/spack/issues/8152
sudo apt-get install install flex
https://news.newseed.cn/p/1356256
比如《陈翔六点半之铁头无敌》已由短视频走向电影。该片上线8小时会员有效观影人次破96万,票房分账收益336万,56小时票房分账破1000万,打破网大票房分账记录。这透露出,短视频IP与网大的互带存在巨大市场潜力。
https://www.newseed.cn/invest/35951
短视频剧《陈翔六点半》获BAI千万级人民币A轮融资
可能你的电脑有多个 pacman, 而你执行的不是应该执行的那个。
下载一个 everything
https://www.voidtools.com/zh-cn/downloads/
https://www.voidtools.com/Everything-1.4.1.935.x64.zip
查一下电脑是不是真有几个 pacman.exe, 执行对应的那个。
那时候还没有积分制度, 我上传了文件,今天打开看了一下,居然也要积分。
账号因为csdn自己的问题, 造成用户泄露, 当年的号无法登陆。
虽然不能用爱发电,但是也不能广告乱飞吧.
https://bbs.csdn.net/topics/392453448
哈喽,社区的各位小伙伴:
感谢各位小伙伴在过去5年里对我们CSDN社区CODE平台的支持以及建议
为了方便各位小伙伴,迁移出相关的代码:
我们将延期至2018年10月31日彻底关闭CODE服务, 迁移过渡时间从今天就可以开始啦。
代码迁移请从git接口,方便大家导出存放在CODE中的完整代码。
对于没有其他代码托管平台账号的用户,建议先将代码克隆到本地(支持SSH和HTTPS),便于以后管理维护。
码云平台一键迁移:https://my.oschina.net/gitosc/blog/1534891
再次感谢大家对此次社区工作的理解和配合。
CSDN
2018.9.26
5.2的内核已经合并了这个更改了,后续应该是不用手动更改了
是说这个吗: https://whycan.cn/t_2896.html
转载地址: http://greedyhao.cc/2019/07/26/工作-Linux-2019-07-26-drm设备不工作/
日期: 2019-07-26
作者: greedyhao
代码: https://github.com/greedyhao/linux/tree/nano-5.2-flash
代码: https://github.com/greedyhao/linux/tree/nano-5.2-tf
找到树莓派的开机自动修复ext4 https://raspberrypi.stackexchange.com/questions/61723/raspberry-pi-3-and-raspbian-jessie-how-to-run-fsck-at-boot
但是有一个问题, 根文件系统都挂载不上, 怎么调用命令修复了, 又是一个鸡生蛋,蛋生鸡的问题了。
进来做一下友情链接: https://whycan.cn/t_2920.html#p24036
刚刚VMWware Ubuntu18.04 挂了, 开机提示硬盘出错, 吓傻我了: https://whycan.cn/t_2909.html
无意中找到一个同样问题的朋友
[ 1.562498] sun6i-rtc 1c20400.rtc: setting system clock to 1970-01-01 00:02:34 UTC (154)
[ 1.570912] vcc3v0: disabling
[ 1.573892] vcc5v0: disabling
[ 1.576917] ALSA device list:
[ 1.579885] No soundcards found.
[ 1.591285] List of all partitions:
[ 1.594832] b300 122880 mmcblk0
[ 1.594838] driver: mmcblk
[ 1.601736] b301 16384 mmcblk0p1 ad68a8dc-01
[ 1.601739]
[ 1.608561] b302 105472 mmcblk0p2 ad68a8dc-02
[ 1.608563]
[ 1.615369] No filesystem could mount root, tried:
[ 1.615373] ext3
[ 1.620242] ext2
[ 1.622163] ext4
[ 1.624084] vfat
[ 1.626019]
[ 1.629435] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,2)
[ 1.637863] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.13.16-licheepi-zero+ #26
[ 1.645245] Hardware name: Allwinner sun8i Family
[ 1.649982] [<c010e514>] (unwind_backtrace) from [<c010b1b8>] (show_stack+0x10/0x14)
[ 1.657731] [<c010b1b8>] (show_stack) from [<c065bb04>] (dump_stack+0x88/0x9c)
[ 1.664958] [<c065bb04>] (dump_stack) from [<c011b48c>] (panic+0xdc/0x248)
[ 1.671835] [<c011b48c>] (panic) from [<c0901250>] (mount_block_root+0x220/0x268)
[ 1.679313] [<c0901250>] (mount_block_root) from [<c09013b8>] (mount_root+0x120/0x128)
[ 1.687224] [<c09013b8>] (mount_root) from [<c0901510>] (prepare_namespace+0x150/0x198)
[ 1.695222] [<c0901510>] (prepare_namespace) from [<c0900e08>] (kernel_init_freeable+0x1c0/0x1d0)
[ 1.704090] [<c0900e08>] (kernel_init_freeable) from [<c066d554>] (kernel_init+0x8/0x110)
[ 1.712265] [<c066d554>] (kernel_init) from [<c0107538>] (ret_from_fork+0x14/0x3c)
[ 1.719837] Rebooting in 5 seconds..
再来一个, 比如evtest 采集到的按下按键是以下数据:
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "1c22800.lradc"
Supported events:
Event type 0 (Sync)
Event type 1 (Key)
Event code 114 (VolumeDown)
Event code 115 (VolumeUp)
Event code 352 (Ok)
Event code 353 (Select)
Testing ... (interrupt to exit)
Event: time 228.055444, type 1 (Key), code 352 (Ok), value 1
Event: time 228.055444, -------------- Report Sync ------------
Event: time 228.251432, type 1 (Key), code 352 (Ok), value 0
Event: time 228.251432, -------------- Report Sync ------------
那么sendevent模拟事件注入:
./sendevent /dev/input/event0 1 352 1;./sendevent /dev/input/event0 0 0 0
./sendevent /dev/input/event0 1 352 0;./sendevent /dev/input/event0 0 0 0
仍然妥妥的
终于搞定, 原来并没有问题, 而是命令没有发全:
正确的姿势是, 先用 evtest 记录按键或者触摸屏的触发记录
比如这个是按下电阻屏某个点:
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 330 (BTN_TOUCH)
Event type 3 (EV_ABS)
Event code 0 (ABS_X)
Value 0
Min 0
Max 4095
Fuzz 32
Event code 1 (ABS_Y)
Value 0
Min 0
Max 4095
Fuzz 16
Properties:
Testing ... (interrupt to exit)
Event: time 13499.431064, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
Event: time 13499.431064, type 3 (EV_ABS), code 0 (ABS_X), value 2558
Event: time 13499.431064, type 3 (EV_ABS), code 1 (ABS_Y), value 357
Event: time 13499.431064, -------------- SYN_REPORT ------------
Event: time 13499.483417, type 3 (EV_ABS), code 1 (ABS_Y), value 365
Event: time 13499.483417, -------------- SYN_REPORT ------------
Event: time 13499.524761, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0
Event: time 13499.524761, -------------- SYN_REPORT ------------
这样模拟发送就妥妥的了:
./sendevent /dev/input/event1 1 330 1
./sendevent /dev/input/event1 3 0 2558
./sendevent /dev/input/event1 3 1 357
./sendevent /dev/input/event1 0 0 0
./sendevent /dev/input/event1 3 1 365
./sendevent /dev/input/event1 0 0 0
./sendevent /dev/input/event1 1 330 0
./sendevent /dev/input/event1 0 0 0
sendevent.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <fcntl.h>
#include <sys/ioctl.h>
//#include <linux/input.h> // this does not compile
#include <errno.h>
extern char *optarg;
extern int optind, optopt, opterr;
// from <linux/input.h>
struct input_event {
struct timeval time;
uint16_t type;
uint16_t code;
int32_t value;
};
#define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */
#define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */
#define EVIOCGKEYCODE _IOR('E', 0x04, int[2]) /* get keycode */
#define EVIOCSKEYCODE _IOW('E', 0x04, int[2]) /* set keycode */
#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */
#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */
#define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */
#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global keystate */
#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */
#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */
#define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */
#define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */
#define EVIOCGABS(abs) _IOR('E', 0x40 + abs, struct input_absinfo) /* get abs value/limits */
#define EVIOCSABS(abs) _IOW('E', 0xc0 + abs, struct input_absinfo) /* set abs value/limits */
#define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect)) /* send a force effect to a force feedback device */
#define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */
#define EVIOCGEFFECTS _IOR('E', 0x84, int) /* Report number of effects playable at the same time */
#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */
// end <linux/input.h>
int main(int argc, char *argv[])
{
int i;
int fd;
int ret;
int version;
struct input_event event;
if(argc != 5) {
fprintf(stderr, "use: %s device type code value\n", argv[0]);
return 1;
}
fd = open(argv[1], O_RDWR);
if(fd < 0) {
fprintf(stderr, "could not open %s, %s\n", argv[optind], strerror(errno));
return 1;
}
if (ioctl(fd, EVIOCGVERSION, &version)) {
fprintf(stderr, "could not get driver version for %s, %s\n", argv[optind], strerror(errno));
return 1;
}
memset(&event, 0, sizeof(event));
event.type = atoi(argv[2]);
event.code = atoi(argv[3]);
event.value = atoi(argv[4]);
ret = write(fd, &event, sizeof(event));
if(ret < sizeof(event)) {
fprintf(stderr, "write event failed, %s\n", strerror(errno));
return -1;
}
return 0;
}
getevent.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <dirent.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/inotify.h>
#include <limits.h>
#include <sys/poll.h>
#include <linux/input.h> // this does not compile
#include <errno.h>
extern char *optarg;
extern int optind, optopt, opterr;
static struct pollfd *ufds;
static char **device_names;
static int nfds;
enum {
PRINT_DEVICE_ERRORS = 1U << 0,
PRINT_DEVICE = 1U << 1,
PRINT_DEVICE_NAME = 1U << 2,
PRINT_DEVICE_INFO = 1U << 3,
PRINT_VERSION = 1U << 4,
PRINT_POSSIBLE_EVENTS = 1U << 5,
};
static int print_possible_events(int fd)
{
uint8_t *bits = NULL;
ssize_t bits_size = 0;
const char* label;
int i, j, k;
int res, res2;
printf(" events:\n");
for(i = 0; i <= EV_MAX; i++) {
int count = 0;
while(1) {
res = ioctl(fd, EVIOCGBIT(i, bits_size), bits);
if(res < bits_size)
break;
bits_size = res + 16;
bits = realloc(bits, bits_size * 2);
if(bits == NULL) {
fprintf(stderr, "failed to allocate buffer of size %d\n", bits_size);
return 1;
}
}
res2 = 0;
switch(i) {
case EV_SYN:
label = "SYN";
break;
case EV_KEY:
res2 = ioctl(fd, EVIOCGKEY(res), bits + bits_size);
label = "KEY";
break;
case EV_REL:
label = "REL";
break;
case EV_ABS:
label = "ABS";
break;
case EV_MSC:
label = "MSC";
break;
case EV_LED:
res2 = ioctl(fd, EVIOCGLED(res), bits + bits_size);
label = "LED";
break;
case EV_SND:
res2 = ioctl(fd, EVIOCGSND(res), bits + bits_size);
label = "SND";
break;
case EV_SW:
res2 = ioctl(fd, EVIOCGSW(bits_size), bits + bits_size);
label = "SW ";
break;
case EV_REP:
label = "REP";
break;
case EV_FF:
label = "FF ";
break;
case EV_PWR:
label = "PWR";
break;
default:
res2 = 0;
label = "???";
}
for(j = 0; j < res; j++) {
for(k = 0; k < 8; k++)
if(bits[j] & 1 << k) {
char down;
if(j < res2 && (bits[j + bits_size] & 1 << k))
down = '*';
else
down = ' ';
if(count == 0)
printf(" %s (%04x):", label, i);
else if((count & 0x7) == 0 || i == EV_ABS)
printf("\n ");
printf(" %04x%c", j * 8 + k, down);
if(i == EV_ABS) {
struct input_absinfo abs;
if(ioctl(fd, EVIOCGABS(j * 8 + k), &abs) == 0) {
printf(" value %d, min %d, max %d, fuzz %d flat %d", abs.value, abs.minimum, abs.maximum, abs.fuzz, abs.flat);
}
}
count++;
}
}
if(count)
printf("\n");
}
free(bits);
return 0;
}
static int open_device(const char *device, int print_flags)
{
int version;
int fd;
struct pollfd *new_ufds;
char **new_device_names;
char name[80];
char location[80];
char idstr[80];
struct input_id id;
fd = open(device, O_RDWR);
if(fd < 0) {
if(print_flags & PRINT_DEVICE_ERRORS)
fprintf(stderr, "could not open %s, %s\n", device, strerror(errno));
return -1;
}
if(ioctl(fd, EVIOCGVERSION, &version)) {
if(print_flags & PRINT_DEVICE_ERRORS)
fprintf(stderr, "could not get driver version for %s, %s\n", device, strerror(errno));
return -1;
}
if(ioctl(fd, EVIOCGID, &id)) {
if(print_flags & PRINT_DEVICE_ERRORS)
fprintf(stderr, "could not get driver id for %s, %s\n", device, strerror(errno));
return -1;
}
name[sizeof(name) - 1] = '\0';
location[sizeof(location) - 1] = '\0';
idstr[sizeof(idstr) - 1] = '\0';
if(ioctl(fd, EVIOCGNAME(sizeof(name) - 1), &name) < 1) {
//fprintf(stderr, "could not get device name for %s, %s\n", device, strerror(errno));
name[0] = '\0';
}
if(ioctl(fd, EVIOCGPHYS(sizeof(location) - 1), &location) < 1) {
//fprintf(stderr, "could not get location for %s, %s\n", device, strerror(errno));
location[0] = '\0';
}
if(ioctl(fd, EVIOCGUNIQ(sizeof(idstr) - 1), &idstr) < 1) {
//fprintf(stderr, "could not get idstring for %s, %s\n", device, strerror(errno));
idstr[0] = '\0';
}
new_ufds = realloc(ufds, sizeof(ufds[0]) * (nfds + 1));
if(new_ufds == NULL) {
fprintf(stderr, "out of memory\n");
return -1;
}
ufds = new_ufds;
new_device_names = realloc(device_names, sizeof(device_names[0]) * (nfds + 1));
if(new_device_names == NULL) {
fprintf(stderr, "out of memory\n");
return -1;
}
device_names = new_device_names;
if(print_flags & PRINT_DEVICE)
printf("add device %d: %s\n", nfds, device);
if(print_flags & PRINT_DEVICE_INFO)
printf(" bus: %04x\n"
" vendor %04x\n"
" product %04x\n"
" version %04x\n",
id.bustype, id.vendor, id.product, id.version);
if(print_flags & PRINT_DEVICE_NAME)
printf(" name: \"%s\"\n", name);
if(print_flags & PRINT_DEVICE_INFO)
printf(" location: \"%s\"\n"
" id: \"%s\"\n", location, idstr);
if(print_flags & PRINT_VERSION)
printf(" version: %d.%d.%d\n",
version >> 16, (version >> 8) & 0xff, version & 0xff);
if(print_flags & PRINT_POSSIBLE_EVENTS) {
print_possible_events(fd);
}
ufds[nfds].fd = fd;
ufds[nfds].events = POLLIN;
device_names[nfds] = strdup(device);
nfds++;
return 0;
}
int close_device(const char *device, int print_flags)
{
int i;
for(i = 1; i < nfds; i++) {
if(strcmp(device_names[i], device) == 0) {
int count = nfds - i - 1;
if(print_flags & PRINT_DEVICE)
printf("remove device %d: %s\n", i, device);
free(device_names[i]);
memmove(device_names + i, device_names + i + 1, sizeof(device_names[0]) * count);
memmove(ufds + i, ufds + i + 1, sizeof(ufds[0]) * count);
nfds--;
return 0;
}
}
if(print_flags & PRINT_DEVICE_ERRORS)
fprintf(stderr, "remote device: %s not found\n", device);
return -1;
}
static int read_notify(const char *dirname, int nfd, int print_flags)
{
int res;
char devname[PATH_MAX];
char *filename;
char event_buf[512];
int event_size;
int event_pos = 0;
struct inotify_event *event;
res = read(nfd, event_buf, sizeof(event_buf));
if(res < (int)sizeof(*event)) {
if(errno == EINTR)
return 0;
fprintf(stderr, "could not get event, %s\n", strerror(errno));
return 1;
}
//printf("got %d bytes of event information\n", res);
strcpy(devname, dirname);
filename = devname + strlen(devname);
*filename++ = '/';
while(res >= (int)sizeof(*event)) {
event = (struct inotify_event *)(event_buf + event_pos);
//printf("%d: %08x \"%s\"\n", event->wd, event->mask, event->len ? event->name : "");
if(event->len) {
strcpy(filename, event->name);
if(event->mask & IN_CREATE) {
open_device(devname, print_flags);
}
else {
close_device(devname, print_flags);
}
}
event_size = sizeof(*event) + event->len;
res -= event_size;
event_pos += event_size;
}
return 0;
}
static int scan_dir(const char *dirname, int print_flags)
{
char devname[PATH_MAX];
char *filename;
DIR *dir;
struct dirent *de;
dir = opendir(dirname);
if(dir == NULL)
return -1;
strcpy(devname, dirname);
filename = devname + strlen(devname);
*filename++ = '/';
while((de = readdir(dir))) {
if(de->d_name[0] == '.' &&
(de->d_name[1] == '\0' ||
(de->d_name[1] == '.' && de->d_name[2] == '\0')))
continue;
strcpy(filename, de->d_name);
open_device(devname, print_flags);
}
closedir(dir);
return 0;
}
static void usage(int argc, char *argv[])
{
fprintf(stderr, "Usage: %s [-t] [-n] [-s switchmask] [-S] [-v [mask]] [-p] [-q] [-c count] [-r] [device]\n", argv[0]);
fprintf(stderr, " -t: show time stamps\n");
fprintf(stderr, " -n: don't print newlines\n");
fprintf(stderr, " -s: print switch states for given bits\n");
fprintf(stderr, " -S: print all switch states\n");
fprintf(stderr, " -v: verbosity mask (errs=1, dev=2, name=4, info=8, vers=16, pos. events=32)\n");
fprintf(stderr, " -p: show possible events (errs, dev, name, pos. events)\n");
fprintf(stderr, " -q: quiet (clear verbosity mask)\n");
fprintf(stderr, " -c: print given number of events then exit\n");
fprintf(stderr, " -r: print rate events are received\n");
}
int main(int argc, char *argv[])
{
int c;
int i;
int res;
int pollres;
int get_time = 0;
int print_device = 0;
char *newline = "\n";
uint16_t get_switch = 0;
struct input_event event;
int version;
int print_flags = PRINT_DEVICE_ERRORS | PRINT_DEVICE | PRINT_DEVICE_NAME;
int print_flags_set = 0;
int dont_block = -1;
int event_count = 0;
int sync_rate = 0;
int64_t last_sync_time = 0;
const char *device = NULL;
const char *device_path = "/dev/input";
opterr = 0;
do {
c = getopt(argc, argv, "tns:Sv::pqc:rh");
if (c == EOF)
break;
switch (c) {
case 't':
get_time = 1;
break;
case 'n':
newline = "";
break;
case 's':
get_switch = strtoul(optarg, NULL, 0);
if(dont_block == -1)
dont_block = 1;
break;
case 'S':
get_switch = ~0;
if(dont_block == -1)
dont_block = 1;
break;
case 'v':
if(optarg)
print_flags = strtoul(optarg, NULL, 0);
else
print_flags |= PRINT_DEVICE | PRINT_DEVICE_NAME | PRINT_DEVICE_INFO | PRINT_VERSION;
print_flags_set = 1;
break;
case 'p':
print_flags = PRINT_DEVICE_ERRORS | PRINT_DEVICE | PRINT_DEVICE_NAME | PRINT_POSSIBLE_EVENTS;
print_flags_set = 1;
if(dont_block == -1)
dont_block = 1;
break;
case 'q':
print_flags = 0;
print_flags_set = 1;
break;
case 'c':
event_count = atoi(optarg);
dont_block = 0;
break;
case 'r':
sync_rate = 1;
break;
case '?':
fprintf(stderr, "%s: invalid option -%c\n",
argv[0], optopt);
case 'h':
usage(argc, argv);
exit(1);
}
} while (1);
if(dont_block == -1)
dont_block = 0;
if (optind + 1 == argc) {
device = argv[optind];
optind++;
}
if (optind != argc) {
usage(argc, argv);
exit(1);
}
nfds = 1;
ufds = calloc(1, sizeof(ufds[0]));
ufds[0].fd = inotify_init();
ufds[0].events = POLLIN;
if(device) {
if(!print_flags_set)
print_flags = PRINT_DEVICE_ERRORS;
res = open_device(device, print_flags);
if(res < 0) {
return 1;
}
}
else {
print_device = 1;
res = inotify_add_watch(ufds[0].fd, device_path, IN_DELETE | IN_CREATE);
if(res < 0) {
fprintf(stderr, "could not add watch for %s, %s\n", device_path, strerror(errno));
return 1;
}
res = scan_dir(device_path, print_flags);
if(res < 0) {
fprintf(stderr, "scan dir failed for %s\n", device_path);
return 1;
}
}
if(get_switch) {
for(i = 1; i < nfds; i++) {
uint16_t sw;
res = ioctl(ufds[i].fd, EVIOCGSW(1), &sw);
if(res < 0) {
fprintf(stderr, "could not get switch state, %s\n", strerror(errno));
return 1;
}
sw &= get_switch;
printf("%04x%s", sw, newline);
}
}
if(dont_block)
return 0;
while(1) {
pollres = poll(ufds, nfds, -1);
//printf("poll %d, returned %d\n", nfds, pollres);
if(ufds[0].revents & POLLIN) {
read_notify(device_path, ufds[0].fd, print_flags);
}
for(i = 1; i < nfds; i++) {
if(ufds[i].revents) {
if(ufds[i].revents & POLLIN) {
res = read(ufds[i].fd, &event, sizeof(event));
if(res < (int)sizeof(event)) {
fprintf(stderr, "could not get event\n");
return 1;
}
if(get_time) {
printf("%ld-%ld: ", event.time.tv_sec, event.time.tv_usec);
}
if(print_device)
printf("%s: ", device_names[i]);
printf("%04x %04x %08x", event.type, event.code, event.value);
if(sync_rate && event.type == 0 && event.code == 0) {
int64_t now = event.time.tv_sec * 1000000LL + event.time.tv_usec;
if(last_sync_time)
printf(" rate %lld", 1000000LL / (now - last_sync_time));
last_sync_time = now;
}
printf("%s", newline);
if(event_count && --event_count == 0)
return 0;
}
}
}
}
return 0;
}
改了几行代码, 通过编译, 试了一下, 居然可以了.
Ubuntu 模拟鼠标中键上下滚动:
sudo ./sendevent /dev/input/event3 2 8 -1
sudo ./sendevent /dev/input/event3 2 8 1
@ubuntu:/disk2/licheepi/linux$ sudo ./getevent /dev/input/event3
0002 0008 ffffffff
0000 0000 00000000
0002 0008 00000001
0000 0000 00000000
居然可以用了
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <fcntl.h>
#include <sys/ioctl.h>
//#include <linux/input.h> // this does not compile
#include <errno.h>
// from <linux/input.h>
struct input_event {
struct timeval time;
__u16 type;
__u16 code;
__s32 value;
};
#define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */
#define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */
#define EVIOCGKEYCODE _IOR('E', 0x04, int[2]) /* get keycode */
#define EVIOCSKEYCODE _IOW('E', 0x04, int[2]) /* set keycode */
#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */
#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */
#define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */
#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global keystate */
#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */
#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */
#define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */
#define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */
#define EVIOCGABS(abs) _IOR('E', 0x40 + abs, struct input_absinfo) /* get abs value/limits */
#define EVIOCSABS(abs) _IOW('E', 0xc0 + abs, struct input_absinfo) /* set abs value/limits */
#define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect)) /* send a force effect to a force feedback device */
#define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */
#define EVIOCGEFFECTS _IOR('E', 0x84, int) /* Report number of effects playable at the same time */
#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */
// end <linux/input.h>
int sendevent_main(int argc, char *argv[])
{
int i;
int fd;
int ret;
int version;
struct input_event event;
if(argc != 5) {
fprintf(stderr, "use: %s device type code value\n", argv[0]);
return 1;
}
fd = open(argv[1], O_RDWR);
if(fd < 0) {
fprintf(stderr, "could not open %s, %s\n", argv[optind], strerror(errno));
return 1;
}
if (ioctl(fd, EVIOCGVERSION, &version)) {
fprintf(stderr, "could not get driver version for %s, %s\n", argv[optind], strerror(errno));
return 1;
}
memset(&event, 0, sizeof(event));
event.type = atoi(argv[2]);
event.code = atoi(argv[3]);
event.value = atoi(argv[4]);
ret = write(fd, &event, sizeof(event));
if(ret < sizeof(event)) {
fprintf(stderr, "write event failed, %s\n", strerror(errno));
return -1;
}
return 0;
}
https://github.com/joneschrisg/android-system-core/blob/master/toolbox/sendevent.c
网上复制的代码怎么都没搞定
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\msobj140.dll"
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\mspdb140.dll"
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\mspdbcore.dll"
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\mspdbsrv.exe"
上面四个文件复制到:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86\"
即可以解决问题。
1>------ 已启动全部重新生成: 项目: ConsoleApplication1, 配置: Debug Win32 ------
1>pch.cpp
1>ConsoleApplication1.cpp
1>LINK : fatal error LNK1101: MSPDB140.DLL 的版本不正确;请重新检查此产品的安装
1>已完成生成项目“ConsoleApplication1.vcxproj”的操作 - 失败。
========== 全部重新生成: 成功 0 个,失败 1 个,跳过 0 个 ==========
一开始试了各种方法, google 全英文搜索, 各种英文网站上面的方案都没有解决
直到后来看到这个帖子:
https://my.oschina.net/shou1156226/blog/809847
【错误】
Link1171:无法加载mspdb140.dll
【解决】1. 找到VS2015 IDE的安装目录,以本人电脑上的目录为例:
D:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
2.将IDE目录中的msobj140.dll, mspdb140.dll, mspdbcore.dll, mspdbsrv.exe四个文件复制到VC的bin目录下覆盖原有文件,以本人电脑为例:
D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
3.打开VS2015 新建一个C++的win32 控制台程序试一下是否还出现Link1171错误
4.如果还出现这个错误,请将VC/bin目录加入到系统环境变量Path中用分号隔开,重启计算机。
按照一步一步终于搞定。
是这个吗:
https://github.com/espressif/esp-iot-solution
你试一试这样:
export IOT_SOLUTION_PATH="D:/lin_work/esp32_work/esp32_prj/esp/esp-iot-solution/"
虽然 bash 识别 /d/lin_work 这种格式, 但是其他软件未必识别, 个人猜测。
15楼图有问题,兼容性不够。
FP6xxxx系列,可以这样用。
如果是GT系列,RST必须是IO口,由于存在两组IIC通讯地址,上电需要靠这RST和INT两条线的时序确定。
怪不得, 还以为我的 GT911 触摸屏 精神分裂了,
i2c_detect 检测, 有时候启动是 0x14, 有时候是 0x5d,
然后再看 @xm1994 的 dts 代码,
https://github.com/summershrimp/opendeck-linux/commit/eb7a274d02b52a02198e3b2726df822eed0f36c8
发现 rst 引脚也接上了
晕哥 说:感谢楼主热心分享!
参考链接1: http://nano.lichee.pro/build_sys/build_flash.html
参考链接2: 核心板原理图 Lichee_nano.pdf (第一版)
参考链接3: 核心板原理图 lichee_nano_new.pdf (第二版 ns2009)
参考链接4: 底板原理图 lpi-nano-dock.pdfhttps://whycan.cn/files/members/1574/2019-08-17_090528.png
请问这种接口的 GT911 电容触摸屏哪里可以买到?
就是这种:
https://detail.tmall.com/item.htm?id=561493224626
优屏旗舰店 选 stc 5099
我当时买得早, 现在荔枝派好像不卖这种电容屏了。
1. CONFIG_MTD_BLOCK 这个有没有勾选?
2. bootargs 加 root=/linuxrc
3. jffs2 文件系统有问题:
[ 3.840645] jffs2: Cowardly refusing to erase blocks on filesystem with no valid JFFS2 nodes
[ 3.849120] jffs2: empty_blocks 0, bad_blocks 0, c->nr_blocks 175
[ 3.855382] VFS: Cannot open root device "31:03" or unknown-block(31,3): error -5
晕哥 说:1. 你的tar命令不支持压缩, 可能是 busybox 里面的 tar 本来就不支持压缩, 或者是编译的时候某些选项未勾
2. 没有生成分区
1. busybox 确实没有z这个选项可以选
2. 怎么能生成呢?
1. 试一试 buildroot 里面的 tar, 应该有带压缩的全功能选项
2. 生成 mtd:
https://whycan.cn/t_2179.html
https://whycan.cn/t_2170.html
可以做这玩意吗: https://whycan.cn/t_1079.html
挂载成功:
# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 11776 4524 7252 38% /
devtmpfs 19268 0 19268 0% /dev
tmpfs 27972 0 27972 0% /dev/shm
tmpfs 27972 324 27648 1% /tmp
tmpfs 27972 12 27960 0% /run
/dev/mmcblk0p1 1920672 32 1920640 0% /mnt/sdcard
/dev/sda1 16334 9108 7226 56% /mnt/usb
借花献佛参考这个: https://emlinuxwork.blogspot.com/2016/06/made-sd-card-usb-mass-storage-automount.html (可能要番蔷)
buildroot 生成根文件系统之后,
修改 /etc/mdev.conf, 末尾添加:
sd[a-z][0-9] 0:0 660 */etc/init.d/automount.sh
mmcblk[0-9]p[0-9] 0:0 660 */etc/init.d/automount.sh
新建文件 /etc/init.d/automount.sh
#!/bin/sh
/bin/touch /var/plog
if [ "$MDEV" == "" ]; then
echo "automount unknow error!" >> /var/plog
exit 1
elif [ "$MDEV" == "mmcblk0p1" ]; then
mmtype=sdcard
elif [ "$MDEV" == "sda1" ]; then
mmtype=usb
else
echo "automount unknow dev:" >> /var/plog
echo $MDEV >> /var/plog
exit 1
fiecho $mmtype >> /var/plog
case "$ACTION" in
add|"")
echo “Add device $MDEV” >> /var/plog
mkdir -p /mnt/$mmtype
mount -t vfat /dev/$MDEV /mnt/$mmtype
;;
remove)
echo “remove device $MDEV” >> /var/plog
umount /mnt/$mmtype
rm /mnt/$mmtype -rf
;;
esac
倍稳II型血糖仪家用免调码2型仪器配桶装试纸条针头糖尿病人检测
【在售价】29.90 元
【券后价】9.90元
-----------------
【立即领券】点击链接即可领券购买: https://s.click.taobao.com/8v4oW5w
【立即下单】点击链接立即下单: https://s.click.taobao.com/js2oW5w
根据手册, 写了一个简单的 LDROM/APROM 切换的程序:
#include "N76E003.h"
#include "SFR_Macro.h"
#include "Function_define.h"
#include "Common.h"
#include "Delay.h"
#if LDROM
#define LED_FLASH_MS 30
#elif APROM
#define LED_FLASH_MS 500
#endif
void main (void)
{
UINT16 t;
Set_All_GPIO_Quasi_Mode;
while(1)
{
t++;
#if LDROM
if(t > 10) break;
#elif APROM
if(t > 5) break;
#endif
clr_GPIO1;
P0 = 0x00;
P2 = 0x00;
P1 = 0x00;
Timer0_Delay1ms(LED_FLASH_MS);
P0 = 0xff;
P2 = 0xff;
P1 = 0xff;
set_GPIO1;
Timer0_Delay1ms(LED_FLASH_MS);
}
#if LDROM
clr_BS;
#elif APROM
set_BS;
#endif
set_SWRST;
while(1);
}
NULINK 烧录软件下载: https://whycan.cn/t_2569.html
工程配置和烧录:
/*---------------------------------------------------------------------------------------------------------*/
/* */
/* Copyright(c) 2017 Nuvoton Technology Corp. All rights reserved. */
/* */
/*---------------------------------------------------------------------------------------------------------*/
//***********************************************************************************************************
// Nuvoton Technoledge Corp.
// Website: http://www.nuvoton.com
// E-Mail : MicroC-8bit@nuvoton.com
// Date : Apr/21/2017
//***********************************************************************************************************
//***********************************************************************************************************
// File Function: N76E003 CONFIG program demo code
//***********************************************************************************************************
#include "N76E003.h"
#include "Common.h"
#include "Delay.h"
#include "SFR_Macro.h"
#include "Function_define.h"
/*
Since the DATAFLASH is in the APROM. Program command is same as program APROM
*/
#define PAGE_ERASE_CF 0xE2
#define BYTE_READ_CF 0xC0
#define BYTE_PROGRAM_CF 0xE1
#define ERASE_ALL_CF 0xE2
#define ERASE_FAIL 0x70
#define PROGRAM_FAIL 0x71
#define IAPFF_FAIL 0x72
#define IAP_PASS 0x00
/********************************************************************************************
Following IAP command register is also define in SFR_Macro.h
#define set_IAPEN BIT_TMP=EA;EA=0;TA=0xAA;TA=0x55;CHPCON |= SET_BIT0 ;EA=BIT_TMP
#define clr_IAPEN BIT_TMP=EA;EA=0;TA=0xAA;TA=0x55;CHPCON &= ~SET_BIT0;EA=BIT_TMP
#define set_CFUEN BIT_TMP=EA;EA=0;TA=0xAA;TA=0x55;IAPUEN|=SET_BIT2;EA=BIT_TMP
#define clr_CFUEN BIT_TMP=EA;EA=0;TA=0xAA;TA=0x55;IAPUEN&=~SET_BIT2;EA=BIT_TMP
**********************************************************************************************/
void IAP_ERROR_LED(void)
{
while (1)
{
clr_P03;
Timer0_Delay1ms(100);
set_P03;
Timer0_Delay1ms(100);
}
}
//-----------------------------------------------------------------------------------------------------------/
void Trigger_IAP(void)
{
set_IAPGO; //trigger IAP
if((CHPCON&SET_BIT6)==SET_BIT6) // if fail flag is set, toggle error LED and IAP stop
{
clr_IAPFF;
IAP_ERROR_LED();
}
}
/*
WARNING:
No matter read or writer, when IAPFF is set 1,
this step process is fail. DATA should be ignore.
*/
//-----------------------------------------------------------------------------------------------------------/
/*****************************************************************************************************************
Write CONFIG subroutine:
******************************************************************************************************************/
void Erase_All_Config(void)
{
set_IAPEN; // Enable IAP function
IAPAL = 0x00;
IAPAH = 0x00;
IAPFD = 0xFF;
IAPCN = ERASE_ALL_CF;
set_CFUEN; // Enable CONFIG writer bit
set_IAPGO; //trigger IAP
while((CHPCON&SET_BIT6)==SET_BIT6); //check IAPFF (CHPCON.6)
clr_CFUEN;
clr_IAPEN;
}
UINT8 Read_Config(UINT8 cfg)
{
UINT8 value = 0;
set_IAPEN; // Enable IAP function
IAPAL = cfg;
IAPAH = 0x00;
IAPCN = BYTE_READ_CF;
set_CFUEN; // Enable CONFIG writer bit
set_IAPGO; //trigger IAP
value = IAPFD;
while((CHPCON&SET_BIT6)==SET_BIT6); //check IAPFF (CHPCON.6)
clr_CFUEN;
clr_IAPEN;
return value;
}
void Write_Config(UINT8 cfg, UINT8 value)
{
set_IAPEN; // Enable IAP function
IAPAL = cfg;
IAPAH = 0x00;
IAPFD = value;
IAPCN = BYTE_PROGRAM_CF;
set_CFUEN; // Enable CONFIG writer bit
set_IAPGO; //trigger IAP
while((CHPCON&SET_BIT6)==SET_BIT6); //check IAPFF (CHPCON.6)
clr_CFUEN;
clr_IAPEN;
}
//-----------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------
void main (void)
{
UINT8 cfg0, cfg1, cfg2, cfg4;
//读熔丝位
cfg0 = Read_Config(0);
cfg1 = Read_Config(1);
cfg2 = Read_Config(2);
cfg4 = Read_Config(4);
//擦除熔丝位
Erase_All_Config();
//编程熔丝位
Write_Config(0, cfg0);
Write_Config(1, cfg1);
Write_Config(2, cfg2);
Write_Config(4, 0x0F);
while(1);
}
//-----------------------------------------------------------------------------------------------------------
void Erase_All_Config(void)
{
set_IAPEN; // Enable IAP function
IAPAL = 0x00;
IAPAH = 0x00;
IAPFD = 0xFF;
IAPCN = ERASE_ALL_CF;
set_CFUEN; // Enable CONFIG writer bit
set_IAPGO; //trigger IAP
while((CHPCON&SET_BIT6)==SET_BIT6); //check IAPFF (CHPCON.6)
clr_CFUEN;
clr_IAPEN;
}UINT8 Read_Config(UINT8 cfg)
{
UINT8 value = 0;
set_IAPEN; // Enable IAP function
IAPAL = cfg;
IAPAH = 0x00;
IAPCN = BYTE_READ_CF;
set_CFUEN; // Enable CONFIG writer bit
set_IAPGO; //trigger IAP
value = IAPFD;
while((CHPCON&SET_BIT6)==SET_BIT6); //check IAPFF (CHPCON.6)
clr_CFUEN;
clr_IAPEN;
return value;
}void Write_Config(UINT8 cfg, UINT8 value)
{
set_IAPEN; // Enable IAP function
IAPAL = cfg;
IAPAH = 0x00;
IAPFD = value;
IAPCN = BYTE_PROGRAM_CF;
set_CFUEN; // Enable CONFIG writer bit
set_IAPGO; //trigger IAP
while((CHPCON&SET_BIT6)==SET_BIT6); //check IAPFF (CHPCON.6)
clr_CFUEN;
clr_IAPEN;
}void main (void)
{
UINT8 cfg0, cfg1, cfg2, cfg4;
//读熔丝位
cfg0 = Read_Config(0);
cfg1 = Read_Config(1);
cfg2 = Read_Config(2);
cfg4 = Read_Config(4);
//擦除熔丝位
Erase_All_Config();
//编程熔丝位
Write_Config(0, cfg0);
Write_Config(1, cfg1);
Write_Config(2, cfg2);
Write_Config(4, 0x0F);
while(1);
}
终于把狗屎一样的 SDK 改好看一点了
UINT8 Read_Config(UINT8 cfg)
{
UINT8 value = 0;
set_IAPEN; // Enable IAP function
IAPAL = cfg;
IAPAH = 0x00;
IAPCN = BYTE_READ_CF;
set_CFUEN; // Enable CONFIG writer bit
set_IAPGO; //trigger IAP
value = IAPFD;
while((CHPCON&SET_BIT6)==SET_BIT6); //check IAPFF (CHPCON.6)
clr_CFUEN;
clr_IAPEN;
return value;
}
void main (void)
{
UINT8 cfg0, cfg1, cfg2, cfg4;
cfg0 = Read_Config(0);
cfg1 = Read_Config(1);
cfg2 = Read_Config(2);
cfg4 = Read_Config(4);
}
这样可以把各熔丝位读出来了。
全部代码:
/*---------------------------------------------------------------------------------------------------------*/
/* */
/* Copyright(c) 2017 Nuvoton Technology Corp. All rights reserved. */
/* */
/*---------------------------------------------------------------------------------------------------------*/
//***********************************************************************************************************
// Nuvoton Technoledge Corp.
// Website: http://www.nuvoton.com
// E-Mail : MicroC-8bit@nuvoton.com
// Date : Apr/21/2017
//***********************************************************************************************************
//***********************************************************************************************************
// File Function: N76E003 CONFIG program demo code
//***********************************************************************************************************
#include "N76E003.h"
#include "Common.h"
#include "Delay.h"
#include "SFR_Macro.h"
#include "Function_define.h"
/*
Since the DATAFLASH is in the APROM. Program command is same as program APROM
*/
#define PAGE_ERASE_CF 0xE2
#define BYTE_READ_CF 0xC0
#define BYTE_PROGRAM_CF 0xE1
#define ERASE_ALL_CF 0xE2
#define ERASE_FAIL 0x70
#define PROGRAM_FAIL 0x71
#define IAPFF_FAIL 0x72
#define IAP_PASS 0x00
/********************************************************************************************
Following IAP command register is also define in SFR_Macro.h
#define set_IAPEN BIT_TMP=EA;EA=0;TA=0xAA;TA=0x55;CHPCON |= SET_BIT0 ;EA=BIT_TMP
#define clr_IAPEN BIT_TMP=EA;EA=0;TA=0xAA;TA=0x55;CHPCON &= ~SET_BIT0;EA=BIT_TMP
#define set_CFUEN BIT_TMP=EA;EA=0;TA=0xAA;TA=0x55;IAPUEN|=SET_BIT2;EA=BIT_TMP
#define clr_CFUEN BIT_TMP=EA;EA=0;TA=0xAA;TA=0x55;IAPUEN&=~SET_BIT2;EA=BIT_TMP
**********************************************************************************************/
void IAP_ERROR_LED(void)
{
while (1)
{
clr_P03;
Timer0_Delay1ms(100);
set_P03;
Timer0_Delay1ms(100);
}
}
//-----------------------------------------------------------------------------------------------------------/
void Trigger_IAP(void)
{
set_IAPGO; //trigger IAP
if((CHPCON&SET_BIT6)==SET_BIT6) // if fail flag is set, toggle error LED and IAP stop
{
clr_IAPFF;
IAP_ERROR_LED();
}
}
/*
WARNING:
No matter read or writer, when IAPFF is set 1,
this step process is fail. DATA should be ignore.
*/
//-----------------------------------------------------------------------------------------------------------/
/*****************************************************************************************************************
Write CONFIG subroutine:
******************************************************************************************************************/
void Erase_All_Config(void)
{
set_IAPEN; // Enable IAP function
IAPAL = 0x00;
IAPAH = 0x00;
IAPFD = 0xFF;
IAPCN = ERASE_ALL_CF;
set_CFUEN; // Enable CONFIG writer bit
set_IAPGO; //trigger IAP
while((CHPCON&SET_BIT6)==SET_BIT6); //check IAPFF (CHPCON.6)
clr_CFUEN;
clr_IAPEN;
}
UINT8 Read_Config(UINT8 cfg)
{
UINT8 value = 0;
set_IAPEN; // Enable IAP function
IAPAL = cfg;
IAPAH = 0x00;
IAPCN = BYTE_READ_CF;
set_CFUEN; // Enable CONFIG writer bit
set_IAPGO; //trigger IAP
value = IAPFD;
while((CHPCON&SET_BIT6)==SET_BIT6); //check IAPFF (CHPCON.6)
clr_CFUEN;
clr_IAPEN;
return value;
}
void Enable_WDT_Reset_Config(void)
{
set_IAPEN; // Enable IAP function
IAPAL = 0x04;
IAPAH = 0x00;
IAPFD = 0x5F;
IAPCN = BYTE_PROGRAM_CF;
set_CFUEN; // Enable CONFIG writer bit
set_IAPGO; //trigger IAP
while((CHPCON&SET_BIT6)==SET_BIT6); //check IAPFF (CHPCON.6)
clr_CFUEN;
clr_IAPEN;
}
//-----------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------
void main (void)
{
UINT8 cfg0, cfg1, cfg2, cfg4;
cfg0 = Read_Config(0);
cfg1 = Read_Config(1);
cfg2 = Read_Config(2);
cfg4 = Read_Config(4);
Set_All_GPIO_Quasi_Mode;
//---------toggle GPIO1---------
clr_GPIO1;
Timer0_Delay1ms(100);
set_GPIO1;
Timer0_Delay1ms(100);
clr_GPIO1;
Timer0_Delay1ms(100);
set_GPIO1;
Timer0_Delay1ms(100);
//---------end toggle GPIO1---------
Erase_All_Config();
Enable_WDT_Reset_Config();
while(1);
}
//-----------------------------------------------------------------------------------------------------------
//擦除 CONFIG0/1/2/4
void Erase_All_Config(void)
{
set_IAPEN;// Enable IAP function
IAPAL = 0x00;
IAPAH = 0x00;
IAPFD = 0xFF;
IAPCN = ERASE_ALL_CF;
set_CFUEN; // Enable CONFIG writer bit
set_IAPGO; //trigger IAP
while((CHPCON&SET_BIT6)==SET_BIT6); //check IAPFF (CHPCON.6)
clr_CFUEN;
clr_IAPEN;
}//编程 CONFIG4
void Enable_WDT_Reset_Config(void)
{
set_IAPEN; // Enable IAP function
IAPAL = 0x04;
IAPAH = 0x00;
IAPFD = 0x5F;
IAPCN = BYTE_PROGRAM_CF;
set_CFUEN; // Enable CONFIG writer bit
set_IAPGO; //trigger IAP
while((CHPCON&SET_BIT6)==SET_BIT6); //check IAPFF (CHPCON.6)
clr_CFUEN;
clr_IAPEN;
}
main 函数调用:
void main (void)
{
Erase_All_Config();
Enable_WDT_Reset_Config();
while(1);
}
这样先擦除, 再编程, 就OK, 想写多少就写多少, 编程前, 先把这四个熔丝位保存起来, 擦除后写回去。
void Enable_WDT_Reset_Config(void)
{
set_IAPEN; // Enable IAP function
IAPAL = 0x04;
IAPAH = 0x00;
IAPFD = 0x0F;
IAPCN = BYTE_PROGRAM_CF;
set_CFUEN; // Enable CONFIG writer bit
set_IAPGO; //trigger IAP
while((CHPCON&SET_BIT6)==SET_BIT6); //check IAPFF (CHPCON.6)
clr_CFUEN;
clr_IAPEN;
}
CONFIG.4 熔丝位设置成 0x0F 倒是没什么问题
但是我设置成 0xFF, 就不行了。
https://github.com/zanaster/fbtft
https://github.com/zanaster/fbtft/blob/master/fb_st7565.c
https://github.com/zanaster/fbtft/blob/master/fb_st7735r.c
参考这些简单的SPI黑白液晶驱动, 按套路照葫芦画瓢,淘宝上面各种ST7565液晶挺多。
gigadevice.c
macronix.c
micron.c
toshiba.c
winbond.c
https://github.com/torvalds/linux/tree/master/drivers/mtd/nand/spi
[ 1.729441] ALSA device list:
[ 1.732429] #0: Loopback 1
[ 1.740730] Freeing unused kernel memory: 1024K
[ 1.805151] mmc0: host does not support reading read-only switch, assuming write-enable
[ 1.826963] mmc0: new high speed SD card at address 0001
[ 1.842553] mmcblk0: mmc0:0001 MS 1.83 GiB
[ 1.856988] mmcblk0: p1
can't open /dev/null: No such file or directory
can't open /dev/null: No such file or directory
can't open /dev/null: No such file or directory
can't open /dev/null: No such file or directory
Starting syslogd: OK
Starting klogd: OK
Starting mdev...
[ 5.436642] musb-sunxi 1c13000.usb: Invalid or missing 'dr_mode' property
[ 5.443491] musb-sunxi: probe of 1c13000.usb failed with error -22
Initializing random number generator... done.
Starting network: OKWelcome to Buildroot
buildroot login:
Welcome to Buildroot
buildroot login: root
#
# modprobe g_serial
[ 59.417855] udc-core: couldn't find an available UDC - added [g_serial] to list of pending drivers
#
f1c100s 主线 Linux 的 usb 出现这个 missing 'dr_mode' property 问题, 请问应该怎么解决?
https://github.com/Lichee-Pi/linux/commits/nano-4.14-exp
https://github.com/Lichee-Pi/linux/commit/44874751dbc7e112de0c78cbfb0479574cdb2332
发现 nano-4.14-exp 这个分支已经改好了 ^_^
clk: sunxi-ng: suniv: fix USB PHY gate clock bit offset
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
http://linux-sunxi.org/Mainline_U-Boot
看起来 u-boot 还没有 适配 V3s 的 usb
参考这个帖子: https://whycan.cn/t_2297.html
上面有脚本检测到是 sdboot (sd卡启动) 读 首分区的 uEnv.txt, 然后再把这个文件 env import 到到环境变量中去, 完成了从 uEnv.txt 环境配置。
arch/arm/mach-zynq/slcr.c 通过电阻跳线在寄存器读出启动 bootstrap 状态:
u32 zynq_slcr_get_boot_mode(void)
{
/* Get the bootmode register value */
return readl(&slcr_base->boot_mode);
}
board/xilinx/zynq/board.c 根据读到的启动选项设置环境变量 modeboot:
int board_late_init(void)
{
switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
case ZYNQ_BM_NOR:
setenv("modeboot", "norboot");
break;
case ZYNQ_BM_SD:
setenv("modeboot", "sdboot");
break;
case ZYNQ_BM_JTAG:
setenv("modeboot", "jtagboot");
break;
default:
setenv("modeboot", "");
break;
}
return 0;
}
include/configs/zynq-common.h 启动环境变量 preboot
/* enable preboot to be loaded before CONFIG_BOOTDELAY */
#define CONFIG_PREBOOT
include/configs/zynq-common.h 设置其他环境变量, 启动入口是 preboot 这个脚本:
/* Default environment */
#ifndef CONFIG_EXTRA_ENV_SETTINGS
#define CONFIG_EXTRA_ENV_SETTINGS \
"fit_image=fit.itb\0" \
"load_addr=0x2000000\0" \
"fit_size=0x800000\0" \
"flash_off=0x100000\0" \
"nor_flash_off=0xE2100000\0" \
"fdt_high=0x20000000\0" \
"initrd_high=0x20000000\0" \
"loadbootenv_addr=0x2000000\0" \
"bootenv=uEnv.txt\0" \
"bootenv_dev=mmc\0" \
"loadbootenv=load ${bootenv_dev} 0 ${loadbootenv_addr} ${bootenv}\0" \
"importbootenv=echo Importing environment from ${bootenv_dev} ...; " \
"env import -t ${loadbootenv_addr} $filesize\0" \
"bootenv_existence_test=test -e ${bootenv_dev} 0 /${bootenv}\0" \
"setbootenv=if env run bootenv_existence_test; then " \
"if env run loadbootenv; then " \
"env run importbootenv; " \
"fi; " \
"fi; \0" \
"sd_loadbootenv=set bootenv_dev mmc && " \
"run setbootenv \0" \
"usb_loadbootenv=set bootenv_dev usb && usb start && run setbootenv \0" \
"preboot=if test $modeboot = sdboot; then " \
"run sd_loadbootenv; " \
"echo Checking if uenvcmd is set ...; " \
"if test -n $uenvcmd; then " \
"echo Running uenvcmd ...; " \
"run uenvcmd; " \
"fi; " \
"fi; \0" \
"norboot=echo Copying FIT from NOR flash to RAM... && " \
"cp.b ${nor_flash_off} ${load_addr} ${fit_size} && " \
"bootm ${load_addr}\0" \
"sdboot=echo Copying FIT from SD to RAM... && " \
"load mmc 0 ${load_addr} ${fit_image} && " \
"bootm ${load_addr}\0" \
"jtagboot=echo TFTPing FIT to RAM... && " \
"tftpboot ${load_addr} ${fit_image} && " \
"bootm ${load_addr}\0" \
"usbboot=if usb start; then " \
"echo Copying FIT from USB to RAM... && " \
"load usb 0 ${load_addr} ${fit_image} && " \
"bootm ${load_addr}; fi\0" \
DFU_ALT_INFO
#endif
页次: 1