画PCB可以看一下!!
2012-10-21 11:07
ARM攒机指南-开篇经常有人说,现在做手机芯片就像搭积木,买点IP,连一下,后端外包。等芯片回来,上电,起操作系统,大功告成。这么简单,要不我们也来动手攒一颗吧。不过在攒机之前,我们还是先要把基础概念捋顺了。评价一颗芯片,着眼点主要是功能,性能,功耗和价格。功能,是看芯片内部有什么运算模块,比如处理器,浮点器,编解码器,数字信号处理器,图形加速器,网络加速器等,还要看提供了...
2021-08-09 07:12
本帖最后由 michael_llh 于 2016-9-30 17:50 编辑 使用syslog来记录相应的调试信息,这个是我们在大型程序中会用到的一种调试方法,我们在单片机这种层面上我们会用到所谓的单步调试,但是到了Linux系统层面,我们是没有办法这样子去单步调试的,除了直接使用printf直观的打印相应的系统信息以为,我们还会使用log这样的方式来进行调试,相信大家在使用电脑软件的过程也会遇到这样的概念,这里我们来看下如何使用我们的Linux的syslog。首先我们需要看一下syslog的相关函数:#include void openlog(const char *ident, int option, int facility);void syslog(int priority, const char *format, ...);void closelog(void);我们需要包含一个syslog的头文件,相关的函数有三个。一般情况下Linux系统的话log文件是存放在我们的/var/log/messages的目录下面,这是一般情况下,针对不同的发行版会有出入,在ubuntu环境下是存放在我们的/usr/log/syslog这个目录下面。之前我们提到过一个守护进程,syslogd这个进程,就是来维护和提供相应的syslog服务的。那么我们可以通过Linux的系统API openlog打开一个通道和我们的syslog连接,这样我们就可以向syslogd发送消息,然后syslogd这个进程会接收我们的消息,写到相应的日志文件系统中。下面我们通过实际代码测试一下:首先我们需要使用openlog函数:void openlog(const char *ident, int option, int facility);第一个参数:标识符,可以写我们自己能够识别的程序标记第二个参数:LOG_CONS:Write directly to system console if there is an error while sending to system logger.LOG_NDELAY:Open the connection immediately (normally, the connection is opened when the first message is logged).LOG_NOWAIT:Don'twait for child processes that may have been created while logging the message.(The GNU C library does not create a child process, so this option has no effect on Linux.)LOG_ODELAY:The converse of LOG_NDELAY; opening of the connection isdelayeduntilsyslog()iscalled. (This is the default, and need not be specified.)LOG_PERROR:(Not in POSIX.1-2001 or POSIX.1-2008.)Print to stderr as well.LOG_PID:Include PID with each message.第三个参数:LOG_AUTH security/authorization messagesLOG_AUTHPRIVsecurity/authorization messages (private)LOG_CRON clock daemon (cron and at)LOG_DAEMONsystem daemons without separate facility valueLOG_FTPftp daemonLOG_KERN kernel messages (these can't be generated from user processes)LOG_LOCAL0 through LOG_LOCAL7reserved for local useLOG_LPRline printer subsystemLOG_MAIL mail subsystemLOG_NEWS USENET news subsystemLOG_SYSLOGmessages generated internally by syslogd(8)LOG_USER (default)generic user-level messages这些内容的话man手册当中都有提到,这里复制出来方便大家查看,具体的话就不翻译了。第二个函数的话就是syslog,写入我们的log信息了。void syslog(int priority, const char *format, ...);第一个参数:priority就是一个优先级的意思,就是我们可以设定syslog的等级,比如说警告啊,或者是严重警告,需要立即处理等等这种的。LOG_EMERGsystem is unusableLOG_ALERTaction must be taken immediatelyLOG_CRIT critical conditionsLOG_ERRerror conditionsLOG_WARNING warning conditionsLOG_NOTICEnormal, but significant, conditionLOG_INFO informational messageLOG_DEBUGdebug-level message第二个参数:这里就可以写入一个log的字符串了。第三个参数:三个。。。表示的是可变参数,和printf是类似的可变参数。下面我们看下程序实现:#include #include int main(void){openlog("log_test", LOG_PID | LOG_CONS, LOG_USER);syslog(LOG_INFO, "this is a test log info.");closelog();return 0;}之后使用cat /var/log/syslog进行查看。
2016-09-28 23:45
通信网络的一个整体结构,大致包括:骨干网、核心网、城域网、接入网,其中接入网又分为无线接入和有线接入,以及承载网。 听起来很复杂,我们再分解来看看。 从最靠近用户端开始
2023-08-03 17:25
1、ORCAD软件打开原理图,选中原理图的根目录,点击Tools-Creat Netlist,或者是点击菜单栏上N的图标,如下图所示,即可产生网标。2、Allegro第一方网表如上图操作以后。弹出
2018-11-05 15:04
对于IP我们知道它是一个32位的字符串,通常我们使用的是点分十进制来进行表示,但是在实际编程当中我们应该如何去写呢?其实Linux当中提供了几个转换函数我们可以很轻松很方便的实现IP地址的转化,具体我们来看下: in_addr_t inet_addr(const char *cp); 函数原型如上: 传入参数:就是一个IP的点分十进制的字符串 返回值:in_addr_t是一个十六进制的数字。参考程序:#include #include #include #include #define IP_addr "192.168.1.1"int main(void){in_addr_t ip_result = 0;ip_result = inet_addr(IP_addr);// 结果为0x101a8c0,也就是我们将点分十进制转化成16进制printf("0x%x\n",ip_result);return 0;}下面我们看一下另外一个函数:#include #include #include #include #define IP_addr "192.168.1.1"int main(void){int ret = 0;struct in_addr addr = {0};ret = inet_pton(AF_INET, IP_addr, &addr);if (ret != 1){ printf("inet_pton error\n"); return -1;}printf("addr = 0x%x.\n", addr.s_addr);return 0;}以及从16进制转换到点分十进制:#include #include #include #include #define IP_addr "192.168.1.1"int main(void){struct in_addr addr = {0};char buf[50] = {0};addr.s_addr = 0x101a8c0;inet_ntop(AF_INET, &addr, buf, sizeof(buf));printf("ip addr = %s.\n", buf);return 0;}
2016-10-29 17:23
ad官网培训教程
2016-04-14 17:41
配网流程概述配网协议配网承载层(Provisioning Bearer)配网协议(Provisioning Protocol)流程详解发送Beacon信号邀请交换公共密
2021-07-22 08:53
以太网简介以太网(Ethernet)是互联网技术的一种,由于它是在组网技术中占的比例最高,很多人直接把以太网理解为互联网。以太网是指遵守IEEE802.3标准组成的局域
2021-08-09 08:57
什么是以太网? 而今,许多人都认为以太网即是指因特网。实际上,虽然这两个概念的确有关联,但以太网只是一种接口规范(IEEE 802.3),包含定义了开放式系统互联(OSI)模型物理和数据链路层的许多
2022-11-18 06:56