Thursday, December 25, 2008

EDA软件简介

从网上找到的资料整理的, 仅供自己学习了解

Altium
    之前公司叫protel,相应的产品名字也改为Altium Designer
    protel在eda软件家族中的确是最低端的软件之一,制作单面板,两层板尚能得心应手,但是4层就开始感觉到不好用了. 在很多高校里都有开设相关课程,对于高校师生有很多的用户,

Mentor Graphics
    PADS. 前身是powerpcb.
    即powerpcb,在所有低端的pcb软件中最优秀的一款,好用,易上手. 适合大多数中小型企业的需求。

Cadence Design Systems
    orCAD
    orcad的pcb比protel还要差,但是orcad的原理图设计部分capture CIS被业界视为最优秀的原理图工具之一,界面好看,易上手,操作方便,仿真等功能强大
    Allegro
    高速板设计中实际上的工业标准.
    Cadence Design Systems的公司的SPB系列整合上述两款软件:原理图工具采用Orcad CIS或Concept HDL,PCB Layout采用的是Allegro

Wednesday, December 24, 2008

ScribeFire连接blogger失败

前段时间,ScribeFire连接blogger经常失败.  每次失败后, 还会造成我在一小段时间内没法访问我的blogger.  由于ScribeFire更新频率比较高, 我以为是我用的这个版本的ScribeFire有问题, 但这段时间中又升过两三次, 仍然没有解决这个问题. 由于我怀疑不是版本的原因. google 一下好像没人遇到这样的问题. 于是又baidu一下, 这下发现了有网友有类似情况. 他们怀疑是zf封锁的原因.  把API URL 协议由http 变成https  就能解决这个问题. 哎,zf 管的也太严了, 并且还都是黑箱操作, 不给合理的解释.

Tuesday, December 23, 2008

AdSense被拒

AdSense被拒

 虽然我没有报着认真的态度在申请,不过还是不太爽. 重要的一点是没有清楚的说明原因,搞得我努力的方向都没有. 不过从另一个角度讲,说明这还是件比较严肃的事情. 毕竟签扯到钱的事情.
被拒的邮件原文:
======================================================================

非常感谢您对 Google AdSense 感兴趣。在审核您的申请后,我们的专家发现它不
符合我们的计划标准。因此,我们无法批准您参与此计划。

我们相信我们所制定的政策有助于确保发布商和广告客户的 Google 广告的效果。
我们会对所有的发布商进行审核,并且保留拒绝任一申请的权利。随着我们的发
展,我们也许能够将此计划扩大,以接受更多的网页内容更为丰富多彩的网站发布
商。

请注意,我们也许无法回答有关我们决策的具体原因的查询。非常感谢您的理解。

衷心感谢,

Google AdSense 小组敬上
=========================================================================

Saturday, December 13, 2008

windows 访问 ext3分区

由于不久前重装的系统, 所以要访问linux分区需要重新安装驱动. 以前我用的是 Ext2IFS 这个软件. 不过一试, 发现不管用了. 双击linux分区盘符时, 提示格式化. 难道是因为我的linux 分区是ext3, 而Ext2IFS对ext3不支持 的缘故. 不过不应该啊. 我以前应该也用过ext3啊.

反正记不清了,索性换个驱动. google一下, 找到Ext2Fsd. 安装上就可以访问了. 于是其取代 Ext2IFS, 在我的软件仓库中占据一席之地.

Sunday, November 30, 2008

我的个人站点开通

http://sites.google.com/site/dyverin/
很朴素的风格.

推荐一个网站

http://www.picvi.com/
主要是一些搞笑的视频短片.
不过也包含一些性感的, 或恐怖的,或恶心的东西.
如果你反感这些,请慎入.

Monday, November 24, 2008

个人简历



个人概况

名:段寅  性 别:

出生年月:1982.8 : 湖南

历:本科

毕业学校: 北京理工大学

业:自动化

毕业时间: 2005.6

联系方式:(手机) 13683591669

E-mail: duanyin@163.com

英语水平

l 拥有国家英语六级证书,具备良好的英语听说读写能力;

l 能流利阅读英文信息类专业书籍和技术资料.

计算机水平

l 精通c语言

l 熟悉嵌入式实时操作系统和嵌入式linux;

l 熟练使用交叉编译工具和makefile 来建立和开发嵌入式软件工程;

l 熟练使用cvs,svn等版本管理软件

l 丰富的嵌入式软件调试经验

l 熟悉嵌入式板级驱动,可以独立调试pcb

l dvb标准以及mpeg-2 视频压缩标准有比较深的理解.

l 对音视频解码器,网卡,显卡,声卡等复杂设备的驱动都有一定了解,具备移植和跟踪问题的能力

团队管理能力

l 具备管理4人项目小组的经验

项目经历

l 2005.7-2007.7 在jzby从事驱动开发 和系统维护, 主要从事 st 5516,5105,7710 平台(采用st os 20 RTOS)的图形显示相关驱动的维护. 基于这些平台的机顶盒作为公司的成熟产品,在全国很多地方的数字电视整体平移中中标.

l 2007.8- 至今 在jzby担当项目经理职位, 主要负责st 710x平台(采用嵌入式linux)的驱动和系统部分. 基于该平台的机顶盒已开始小批量供货.

Tuesday, November 18, 2008

有感于朋友升级电脑

最近有两个朋友都升级了主机. 配置都是4核+2G内存+512M显卡. 功率最少要400W. 看wsyu效果全开玩使命召唤,那效果真的不错.十分细腻逼真,感觉快达到CG的效果了. 不过个人觉的平面三维动画的效果应该差不多到极限了吧. 真的觉得这样的配置也就玩游戏和大型软件时才会真正体现它的性能. 我不觉在想,以后个人电脑的趋势不会继续朝着简单追求性能的方向的发展, 而是朝差专业细化的方向发展. 玩游戏选择专门的游戏主机. 普通个人电脑采用笔记本. 娱乐(高清视频,卡拉OK)采用家庭媒体中心. 从节能减排的方向上来讲这也是个看起来不太差的选择.

wsyu一口气下了很多以前因为机器玩不了而没下的游戏,现在都玩不过来了.  不过我还是那个理论: 细水长流. 好游戏一年还出不了几个呢. 况且一个人长时间玩这种逼真度很高的游戏,使身体长进间长于亢奋紧张状态中,性情会有所变化.


助焊剂的作用

前两天刷内存片子的时候,总算明白了助焊剂的作用.

用过量的锡刷一遍内存管脚后,很多管脚间有搭锡. 用烙铁带不出来了. 从徐工那找到一瓶助焊剂. 先用助焊剂刷一遍后,再用烙铁一带就把锡带出来了.

查了一下助焊剂的作用,有如下几点,你也能想明白了吧:
a.清洁工件表面,去除表面的氧化物;
b.防止金属表面氧化,在加热过程中,焊剂在金属表面形成一层保护层,以防止氧化;
c.降低焊料的表面张力,使焊料容易润湿和牢固焊接。
  

Monday, November 10, 2008

访问量统计

写博客是写给人看的.  但绝大部分访客是"悄悄的我走了,正如我悄悄的来".  作为主人的我体会不到宾客满至的乐趣. 不过稍加处理,还是能让访客留下点痕迹的.

有些blog站点有访问统计的功能(如我之前用的chinaunix 的),  虽然只有简单的访问量统计, 但博主看到数字的上升, 心中肯定一丝宽慰.

google blog这个站点虽然不提供这个功能, 但提供这个服务的站点还是很多:
Google Analytics 以及 SiteMeter  等.   上这些站点建立帐户后, 把一段代码加入到blog网页模板里就行了. 

我的站点已经加入了这个功能,通过它们提供的访客信息,也许我能知道你是谁哦...

这一段时间的统计量表明,访问量还是很小的. 看来还需要多写出些有价值的文章出来. 

Saturday, November 08, 2008

开始学习verilog

搞驱动搞久了, 很想明白硬件是怎么设计, 怎么工作的.  数字逻辑都是用HDL 语言写出来的.  于是想抽出时间来学习一下...

找了个帖子:iverilog+gtkwave编写verilog , 照着做就能看到波形了, 语法还没来得及学习...  不过至少已经上路了.. dyverin, 加油...


Friday, November 07, 2008

倩女幽魂 观感

最近心情不是十分的平静.电影是安抚心灵的好东西.

重温经典电影<<倩女幽魂>>的想法又一次冒出. 这个电影本人没有收藏, 索性上淘宝上买. 我还是第一次在淘宝上买东西. 得先往支付宝总值. 支付宝竟然不支持中国银行,还好我还有个兴业银行的卡,里面有个百来块. 这才成功往支付宝里冲入100块. 找了家北京的商家(这样不用等太长的快递时间),买了个倩女幽魂三部曲. 一共四十多块. 不敢买便宜的,怕效果不好.

电影第二天就到了.花了两个晚上过了一遍,第一天晚上有点贪心,看了两部.
最好看的还是第一部. 这一部情节简单,就是书生宁采臣与女鬼小倩相爱,与燕赤侠一起对付千年树精,解救小倩的故事.人物也比较简单.没有着意刻画复杂的人性. 燕赤侠眼中只有好人,坏人和鬼, 好人不能杀,坏人和鬼都是该死的. 他就是受不了人世的人心叵测,偏居在雷若寺中.他虽然最终帮助宁采臣解救了小倩. 但并没有改变他的观念. 现实生活中,恐怕也有很多人受不了人的多面性以及事情的复杂性,不自觉的将人简单的区分对待,将事情简单处理.

宁采臣和小倩的爱很彻底. 但我相信这是由于宁采臣的一无所有,无牵无挂以及的小倩的身心受困,所以他们的相爱才能如此彻底,无所顾忌. 毕竟爱是他们的全部. 这样的爱情的确为人所羡慕,但又能被几人所拥有. (我又能在爱情上投入几分?)

鬼的氛围最足,也最符合我所想象的鬼的世界. 鬼的世界与人的世界没有太多冲突,只是晚上发生在无人烟的兰若寺周边. 鬼基本上与常人无异. 恐怖的气氛来源于昏暗的光线,废弃的小屋,坟山,吸血,吸阳气,符文,经文和旁人的表情等来让人联想. 并不靠夸张的实际造型.

结局凄美,让人遗憾. 也许这也是这部影片给我留下深刻印象的原因. 真希望有一天重温这个故事,得到的是一个完美的结局.



Saturday, November 01, 2008

qemu试用

最近学习memtest86, 故需要一台主机作为测试. 自然想到了qemu. 说实话以前还没怎么用过虚拟机软件. 所以还是感觉到新鲜的.

创建硬盘:
qemu-img create -f qcow2 c.img 3G

从cd-rom启动:
qemu -cdrom /dev/cdrom -hda c.img -m 256 -boot d
从iso启动:
qemu -cdrom my_os_install.iso -hda c.img -m 256 -boot d

直接启动整个主机的linux 系统:
sudo qemu -kernel /boot/vmlinuz-2.6.25-14.fc9.i686 -initrd /boot/initrd-2.6.25-14.fc9.i686.img -hda /dev/sda -append "ro root=UUID=b53ebbb4-dc5e-4b04-b88b-93f5c892bb29 rhgb quiet"
警告:
WARNING: unless you know what you do, it is better to only make READ-ONLY accesses to the hard disk otherwise you may corrupt your host data (use the `-snapshot' command line option or modify the device permissions accordingly).

run memtest86 under qemu:
http://www.coreboot.org/Memtest86

Saturday, October 25, 2008

开始试用planner

安装了fedora9,发现菜单里自带了project management 工具planner.  于是准备试着用, 来管理工作上的项目. 当然效果要至少一星期还能出来, 到时我再来写试用心得.

虽然当项目经理已经有很长一段时间(具体多久忘了,一年左右. 问题还是不少, 也许就是因为没有使用项目管理工具的原因. 毕竟工作还是很忙的. 每天在项目管理上没法花太多的时间,造成任务布置下自己都忘了, 没有及时跟踪进度, 并且布置任务没注意设置期),希望这个工具的使用能帮助我更好的当好项目经理这个角色.

Saturday, October 18, 2008

慢性支气管炎

今早跑去海淀医院去看慢性支气管炎的问题.

人很多,干什么都要排队. 所以最好还是早点去.

拍了个肺部的X光(出片等了约一个小时),没啥问题.
医生就开了点药:
消咳喘片 X2
孟鲁司特钠片 X1
一共花了约两百块钱.

希望吃了过后能好起来,跑医院还是很烦的.

Friday, October 17, 2008

我所选的医保定点医院的等级

(这些信息可以http://www.bjld.gov.cn 上查到)
北京市海淀医院 二级甲等
北京市中关村医院 二级甲等
北京市上地医院 二级合格
北京市海淀区清河医院 一级甲等

竟然没有一个三级的,郁闷. 当时无知啊,也许是政策不允许.

Thursday, October 16, 2008

Ptherad Cancelability

Ptherad Cancelability 的标准说明见: POSIX.1 2.9.5 Thread Cancellation.

相关接口有:
int pthread_setcancelstate(int state, int *oldstate);
int pthread_setcanceltype(int type, int *oldtype);
void pthread_testcancel(void);

其中:
pthread_setcancelstate 来控制是否允许 cancel.
pthread_setcanceltype 用来控制 Ptherad Cancelability Type: 有deferred 和 asynchronous 两种. deferred 的实现方式为当调用 pthead_cancel时, 在pthread 管理结构中置上一个标志, pthread调用一些libc库函数时,会默认检测和处理这个标志, 也可以显示调用pthread_testcancel 来检测并处理这个标志. asynchronous 的实现方式为 通过 tgkill 系统调用来发送 SIGCANCEL 信号(此信号不能通过pthead_kill发送,无法通过参数检查).

Sunday, October 05, 2008

成都出差的一些照片

出差接近一个月. 没写下些什么,图省事,只放上些挑选出来的几组照片

2008_0906锦里
2008_0906锦里


2008_0914烷花溪
2008_0914烷花溪


2008_0930峨眉山
2008_0930峨眉山

Saturday, September 27, 2008

体验成都的长途客运服务

第一次来成都,就觉得这个城市还不错. 绿化挺多, 城市也还比较整结. 至少比长沙还是要好些. 前几天从成都去了趟绵阳.又体验到一次成都的好. 我是在昭觉寺坐的车. 到绵阳的车次很密集,不用怎么候车. 进站后,每台车的乘务员站在车前等候乘客. 并且乘务员统一着装. 这个我在其它长途车站没有看到过. 一下感觉这个服务品质肯定不一样. 上车后不一会车就开了. 乘务员先后用中文和英文说了一遍例行的欢迎话语. 我英语水平还没高到能去评价乘务员的英语水平,不过至少说明车站对乘务员的英语水平是有要求的. 然后乘务员给每人乘客发放一小瓶纯净水. 虽然这水可能是企业赞助的,但给人的感觉很好.
我第一次认识到:原来长途客运的服务也是可以做得这样好的.

Monday, September 15, 2008

address space resource

内核中有很多资源,但属于IO资源的有:
#define IORESOURCE_IO        0x00000100    /* Resource type */
#define IORESOURCE_MEM        0x00000200
#define IORESOURCE_IRQ        0x00000400
#define IORESOURCE_DMA        0x00000800

本文我主要研究IORESOURCE_IO IORESOURCE_MEM,及地址空间的管理,涉及的文件只有kernel/resource.c.
这两种资源本质上都是一段地址空间. 只是类型不一样
IORESOURCE_IO 指的是IO地址空间,这个空间从kernel编程上来看,只能通过专门的接口函数才能访问.硬件层面上,cpu需要用特殊指令才能访问或需要用特殊访问方 式才能访问,不能直接用指针来寻址.在PC机上,其指的就是PCI/CPU IO address space.在嵌入式中,基本上没有io address space.
IORESOURCE_MEM 指的是属于外设或者用于和设备通讯的支持直接寻址的地址空间.PC机上,主板上北桥上连的内存都是交给kernel直接管理,或者都是用于软件执行,所以 这部分内存不属于IORESOURCE_MEM, IORESOURCE_MEM主要是指PCI设备的 memory address space. 但在嵌入式上, 主板上的sdram一般是设备与cpu共享的. 故交给kernel直接管理的内存只是一部分.余下的内存以及寄存器空间都作为IORESOURCE_MEM来管理.

只所以需要管理,是 因为像PCI总路线设备的这些地址空间是设备向系统申请的,故是可配置的,并且设备并身可能热插拨或更换,故其变成一种可分配的资源. 故内核用算法来管理分配与释放操作,防止冲突和便于查询维护.但实际PC中,BIOS一般会做分配操作,内核需要是把分配结果添加进来,故提供了注册(或 者叫做添加)接口. 在嵌入式系统中,外设的地址也通常是固定的,只需要添加即可.

这两种资源,内核采用同样的管理算法--二叉树.相当于内核维护两个独立的二叉树. 按地址基地址与地址长度范围作为管理数据.可以添加,分配,释放节点.分配过程中可以避
免空间冲突,添加时可以识别空间冲突.根节点在kernel/resource.c中以全局变量方式定义.根节点用于限制地址空间的范围.

主要接口:
int insert_resource(struct resource *parent, struct resource *new)
int adjust_resource(struct resource *res, unsigned long start, unsigned long size)
int allocate_resource(struct resource *root, struct resource *new,
              unsigned long size,
              unsigned long min, unsigned long max,
              unsigned long align,
              void (*alignf)(void *, struct resource *,
                     unsigned long, unsigned long),
              void *alignf_data)
int release_resource(struct resource *old)
int request_resource(struct resource *root, struct resource *new)

上面的接口对上述4种资源类型都有效,对于IORESOURCE_IO 和 IORESOURCE_MEM这两种资源,使用这两个接口更为方便
request_region(start,n,name)
release_region(start,n)
        io space
request_mem_region(start,n,name)
release_mem_region(start,n)
        mem space

在 /proc 文件系统中,ioports和iomem分别显示系统当前这两种资源.


嵌入式设备的外设一般先作为platform device添加到platform bus上,其主要目的就是向系统注册资源,在platform_add_devices时做,
如:
/* Watchdog timer parameters */
static struct resource wdt_resource[] = {
    /* Watchdog timer only needs a register address */
    [0] = {
        .start = 0xFFC00008,
        .end = 0xFFC00010,
        .flags = IORESOURCE_MEM,
    }
};

struct platform_device wdt_device = {
    .name = "wdt",
    .id = -1,
    .num_resources = ARRAY_SIZE(wdt_resource),
    .resource = wdt_resource,
};
platform_add_devices(wdt_device,1);


故如已知设备的物理地址,并不一定需要request_mem_region,因为这个操作并没有涉及到任何硬件,与软件访问也没有任何关系..但一般还是推荐做.

I/O port 访问流程( 不用mem模拟方式):
request_region()   #在设备驱动模块加载或opn() 函数中进行,物理i/o port地址由pci bios模块分配
inb(),outb()等     #在设备驱动初始化,write(),red(),ioctl() 等函数中进行
relase_region      #在设备驱动模块卸载或release() 函数中进行

I/O port 访问流程( 用mem模拟方式):
request_region()
ioport_map         #在设备驱动模块加载或opn() 函数中进行,物理i/o port地址由pci bios模块分配
ioread8,iowrite8等 #在设备驱动初始化,write(),red(),ioctl() 等函数中进行
ioport_unmap()
relase_region      #在设备驱动模块卸载或release() 函数中进行


request_mem_region
ioremap         #在设备驱动模块加载或opn() 函数中进行,物理i/o port地址由pci bios模块分配
ioread8,iowrite8等 #在设备驱动初始化,write(),red(),ioctl() 等函数中进行
iounmap()
relase_region      #在设备驱动模块卸载或release() 函数中进行

内核如何识别root参数所指定的根文件系统设备

把内核的sysfs配置选择去掉后,发现无法mount根文件系统了. 于是,看内核是怎么识别root参数的,以及其与sysfs的关系.
 root 参数的处理在是do_mount.c的prepare_namespace函数里. 基本原理为:先munt devfs到/dev目录,然后根据root参数中指定的设备文件名字,从devfs中找到设备文件对应的dev对象,这样就可以开始mount操作了. 不过devfs文件系统已被废弃了. 相应的功能由sysfs取代. 逻辑差不多.
  另外 /dev/nfs 并不是实际设备文件,只是根代表文件系统为nfs文件系统. 故处理逻辑中不会用到devfs或sysfs. 所以去掉 sysfs 后,内核仍然能mount 上nfs根文件系统,而无法mount上flash mtd partition上的根文件系统.

(移动)硬盘安装fedora9

拿着公司的笔记本回来装fedora9,发现光驱不能用. 故重新温习了一下硬盘安装linux的操作.
以下为笔记:

是内置硬盘,还是usb移动硬盘,方法都是一样的. 故这里不加区分.

基本原理: 开机BIOS加载硬盘上的引导程序grub,gurb从硬盘上引导一个kernel和简单安装程序. 简单安装程序启动后,此时有足够的设备驱动, 再由你来选择具体安装方式: 硬盘安装(ISO)或网络安装(NFS),并进行相应的配置.

上 面提到的安装程序的kernek和简单安装程序都在ISO文件的isolinux目录下,分别叫vmlinuz和initrd.img. 我们将其解出到硬盘的某个分区上(gurb不支持NTFS文件系统). 简单安装程序不支持NTFS文件系统,所以ISO文件要存放在非NTFS分区上.

因此第一步要安装grub.由于gurb要由 BIOS引导,故gurb要安装在任何可启动的磁盘驱动器上. 如你的内置硬盘,或USB存储介质(如BIOS支持的话). 如果电脑的内置硬盘上已经安装有windows,可以在windows里进行安装gurb. 下载WINGURB,选择grub-install,设备选你的内置硬盘即可. 由于grub支持命令行编辑启动,所以无需配置,只要安装上就行. 重启后即进入到grub启动界面,按c进入命令行模式, 用root命令设定vmlinuxz以及initrd.img所在的分区为root分区. 接着用kernel命令和initrd分别选定 vmlinuxz和initrd.img. 最后输入 boot 即可启动. 配置完语言和键盘后,即选择安装方式,选硬盘安装并且指定好ISO所在分区和目录即开始常规的安装过程.

chroot初探

最初使用chroot这个命令是在 fedora 系列的救援模式下,实现根文件系统由光盘上的文件系统切换到本地硬盘上的文件系统. 最近由于开发中要用到这个命令,故好好看了看文档,加深一下了解.

  这个命令的功能描述为:Run a command with a different root directory. 即在/目录理解成其它目录的环境下运行一个命令. 而我以前将其错误的理解成整个应用环境的功换. chroot下应用执行环境与原来的环境的差别只是/目录的实际物理路径不一样(当然会造成同样的路径所访问到的实际文件不一样)

 不过实际使用中,一般都是这样用chroot:
chroot 目录
 这 种用法后面没有跟一个命令作为参数,chroot会默认执行SHELL环境变量所保存的值作为命令来执行. 由于SHELL这个程序运行起来后不会退出,且会在终端下给出命令提示符,所以整个个命令执行起来后,即陷入,同时出现新shell的提示符,给人的感觉 是切换到新的用户环境. 由于新的shell会重新载入一些环境变量以及初始化脚本,故新环境下坏境变量与原来的环境变量还是有一些差别的.

要测试的话:
新建一个目录,把/bin以及/lib目录拷贝到新目录下,然后就可以chroot到新目录,输入exit即回到原来的环境.

openoffices tip

以前一直习惯于用文本文件来作笔记. 回过头来看这些笔记的时候发现表现力还是不够,或者不够清晰. 于是开始转到openoffice来. 摸索了一阵后,终于可以应付简单的排版了. 以下为备忘:

页面横向纵向设置:
在 Format --> Page 菜单里,  对应英文为Orientation:  Portrait(纵向)  Landscape(横向)

linux用电驴

amule 和 emule 的区别在于 2.1.3的amule不支持upnp端口映射. 故需要要路由器器上去作固定端口映射,速度才上得去.

安装amule:
yum install amule.

所需要做的配置:
1,更新服务器列表
http://www.emule.org.cn/server.met
2,更新 kad 网络
http://www.emule-inside.net/nodes.dat
3,更新用户名前缀
[CHN][VeryCD] 否则连不上 VeryCD 的这个服务器(no1.eserver.emule.org.cn)这 2 个服务器对于国内
用户是相当不错的选择。



浏览器关联:
在地址栏输入 about:config
新建"布尔"
名称为:network.protocol-handler.external.ed2k
值为:true
新建"字符串"
名称为:network.protocol-handler.app.ed2k
值为:/usr/bin/ed2k

shell脚本的路径问题

从网上找到如何从得到shell script的绝对路径的方法:

#! /bin/bash
echo "Path to $(basename $0) is $(readlink -f $0)"

但这种方法只适以子shell方式执行的脚本,不适用于在当前shell中执行的脚本.

难道就没有方法了吗? 

Latex初探

    前段时间要给公司新员工培训linux方面的知识,故使用openoffice来做. 不知道是不是我的版本有问题还是什么原因,设置格式什么的不太好用.当然对于微软的office,我也不太熟悉.

    偶然间在水木上进去到latex的版块,简单了解一下后也就有了想学的冲动. 立刻找资料.但估计这个东西和emacs一样,学习曲线都会是十分陡的. 所以学习笔记先就不在这里记了. 等以后感觉学到某个阶段,再把整理好的笔记补上.

tor

firefox 使用 tor :

1. yum install tor
2. install foxyproxy add-on in firefox
2. restart system or start tor manually
3. configure the autoproxy(firefox add-on) to using tor with specify URL.
4. enjory

yum使用代理

添加 一行:proxy=http://x.x.x.x:x在/etc/yum.conf.

双系统共享邮件

由于工作需要使用linux, 而部分工作又离不开 win(主要是写烦人的文档. ). 故经常两个系统切换.  这就造成 两个问题: 邮件在一个系统下
收了,无法在另一个系统下访问到。 另外一个就是两个系统下的浏览器的bookmark需要手动去同步.

今天终于试验了一下这两者都使用跨平台的软件,分别是firefox和thunderbird. 并且把储存配置文件和数据的目录(profile)指向硬盘的同一个位置.

这里要注意两个平台下的这两个软件的版本最好一致,否则启动时老是要检果插件版本等工作,影响启动速度.

修改firefox profile 路径的方法:
Mozilla Firefox stores all your personal settings, such as bookmarks, passwords and extensions, in a profile. The profile is stored on your hard drive in a profile folder

Move an existing profile or restore a backed up profile

It's possible to move the location of a profile folder. This could be useful if you have a backed up profile folder somewhere
on your hard drive and want to tell Firefox to use that as your profile. This section explains how to do this.

   1. Shut down Firefox completely (File > Exit).
   2. Move the profile folder to the desired location. For example, on Windows XP, move the profile from C:\Documents and Settings\[username]\Application Data\Mozilla\Firefox\Profiles\xxxxxxxx.default to D:\Stuff\MyProfile. If you are reading these instructions because you want to restore a previously backed up profile, this step isn't necessary. Just note the current location of the profile you want to restore.
   3. Open up profiles.ini in a text editor. The file is located in the application data folder for Firefox:
          * On Windows Vista/XP/2000, the path is %AppData%\Mozilla\Firefox\
          * On Windows 95/98/Me, the path is usually C:\WINDOWS\Application Data\Mozilla\Firefox\
          * On Linux, the path is ~/.mozilla/firefox/
          * On Mac OS X, the path is ~/Library/Application Support/Firefox/
   4. In profiles.ini, locate the entry for the profile you've just moved. Change the Path= line to the new location. If you are using a non-relative pathname, the direction of the slashes may be relevant (this is true for Windows XP).
   5. Change IsRelative=1 to IsRelative=0.
   6. Save profiles.ini and restart Firefox.

修改tunderbird profile 的方法差不多.

用 firefox 保存网页中的 flash

http://labnol.blogspot.com./2005/11/save-flash-from-firefox-and-ie.html 里介绍可以这样做:

1. Saving Flash files from Firefox

Firefox for Newbies
a. Click Tools - Page Info
b. Click the Media Tab on the Page Info Windows
c. The media tab has a complete list (with preview) of Images, CSS Files and Shockwave Flash files that were downloaded by the Firefox browser while rendering (loading) the page.
d. Scroll down the list and locate the swf file.
e. Click the "Save As" button. Select some directory on your hard drive and save the file (No need for a third-party plug-in)

Firefox for Geeks and Power Users
a. Type about:blank in the Firefox address bar
b. Now click List cache entries or directly type about:cache?device=disk (Disk cache device)
c. Press Ctrl+F and try to location the flash file by typing some part of website URL or the flash file name or just .swf. After some hit and trial, you should be able to locate the swf file URL
d. Click the SWF URL to open the Cache Entry Information page. Right click on the link and choose "Save link as"

不过Firefox for Newbies 的方法对于我所要的保存的Flash 不管用. 而for Power Users 的方法好像有点麻烦. 有个插件可以帮忙:
cacheviewer

安装完成后,在Firefox浏览器中,点击 工具->CacheViewer,打开下面的窗口,在"搜索"(search)中填入要找的flash的文件名,双击保存就可以了。

thread

A thread may be created as a joinable thread (the default) or as a detached thread. A joinable thread, like a process, is not automatically cleaned up by GNU/Linux when it terminates. Instead, the thread's exit state hangs around in the system (kind of like a zombie process) until another thread calls pthread_join to obtain its return value. Only then are its resources released. A detached thread, in contrast, is cleaned up automatically when it terminates. Because a detached thread is immediately cleaned up, another thread may not synchronize on its completion by using pthread_join or obtain its return value.

When create thread with pthread_create, the attr argument can also be NULL, in which case default attributes are used: the created thread is joinable (not detached) and has an ordinary (not realtime) scheduling policy.

关于linux 实时性的 好文章
http://blog.tom.com/blog/read.php?bloggerid=993876&blogid=57349

compile and debug directfb

First is something about my develpment environment:
[root@localhost bin]# uname -a
Linux localhost.localdomain 2.6.20-1.2952.fc6 #1 SMP Wed May 16 18:59:18 EDT 2007 i686 i686 i386 GNU/Linux
[root@localhost bin]# rpm -qa | grep gcc
libgcc-4.1.1-30
gcc-4.1.1-30
gcc-gfortran-4.1.1-30
gcc-c++-4.1.1-30

1. Enable Frame buffer device dirver in your machine.

DirectFB version: DirectFB-1.0.0 DirectFB-examples-1.0.0
2. DirectFB:
./configure --prefix=/home/dybbuk/study/DirectFB_install/ --enable-x11 --enable-debug
make
make install

3. DirectFB-examples
./configure --prefix=/home/dybbuk/study/DirectFB_install/ DIRECTFB_CFLAGS=-I/home/dybbuk/study/DirectFB_install/include/directfb/ DIRECTFB_LIBS="-L/home/dybbuk/study/DirectFB_install/lib/ -ldirectfb"
make
make install

Test(under char mode):
export $LD_LIBRARY_PATH=/home/dybbuk/study/DirectFB_install/lib/
/home/dybbuk/study/DirectFB_install/bin/df_window

4. deubg:
add a line "system=x11"  in  the /etc/directfbrc file. 
debug directfb application under X.

For more information see the maillist below:


A copy-paste regarding X method. But I don't know a way without X, and with one machine. If u come to know, plz post it :-)
-----------

Use X

Just for the sake of development, DirectFB actually provides an X backend. In that mode, an X window is the directfb screen, and all directfb display goes to that X window. That is convenient, because
  • We can simultaneously work with whatever other X applications we want
  • Much easier to debug,
  • In situations like crashing or hanging up, you can just close the window, or in the worst case, just killall -9 program-name

Using the X backend

If you did not build directfb with --enable-x11 option, you need to rebuild it with that option(the option is given to configure script). Then, in the /etc/directfbrc file, you need to add a new line: system=x11

Then you can run the same directfb application from X

For performance analysis, and final testing, I would recommend using virtual console, and not X, because thats the way directfb will finally work...



Colin Newell wrote:
What is the best way to run a debugger to debug a directfb program?

One choice is to open an xterm into the machine supporting directfb, and
run gdb in the xterm. If you can see the screen of the directfb machine,
and the Xserver's screen you can efficiently debug.

What if you only have the directfb machine to work on?

If I run gdb on a directfb program directly on the machine with
directfb, then as soon as directfb starts up, gdb loses control of the
keyboard and screen (and then I need to actually kill the program via
an xterm). Is there a clever way to allow use of gdb directly on a
machine running directfb?

Any ideas appreciated.

Regards
Colin Newell

_______________________________________________
directfb-users mailing list
directfb-users@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users



mplayer on frame buffer

The mplayer rpm package form livna is compiled without frame buffer output support( 'mplayer -vo help' for a list of output drivers supported).

So recompile mplayer is needed.
1. enable frame buffer device driver in kernel
For FC6, only append vga=791 to kernel parameter when start kernel can enable frame buffer device driver.
run 'fbset -i' to see some infomation about current frame buffer.
[dybbuk@localhost mplayer_fc6]$ cat /proc/cmdline
ro root=LABEL=/ rhgb quiet vga=791

[dybbuk@localhost mplayer_fc6]$ /usr/sbin/fbset -i
mode "1024x768-76"
    # D: 78.653 MHz, H: 59.949 kHz, V: 75.694 Hz
    geometry 1024 768 1024 768 16
    timings 12714 128 32 16 4 128 4
    rgba 5/11,6/5,5/0,0/0
endmode

Frame buffer device information:
    Name        : VESA VGA
    Address     : 0xc0000000
    Size        : 3145728
    Type        : PACKED PIXELS
    Visual      : TRUECOLOR
    XPanStep    : 0
    YPanStep    : 0
    YWrapStep   : 0
    LineLength  : 2048
    Accelerator : No


2. recompile mplayer
Get lattest developent version from the mplayer svn repository. when configure the source tree, check fbdev list in the enabled video output drivers.

3. test
./mplayer -vo fbdev -vf scale=1024:768 ../../The_Code-Linux.avi

Using Directfb:
   
1. Install directfb and driverfb-dev package
2. modify /etc/fb.modes, add the current frame buffer mode as the first mode.
3. reconfigure and recompile mplayer. make sure directfb list in the enabled video output drivers
4. ./mplayer -vo directfb -vf format=bgr16 ../../The_Code-Linux.avi
(without specify bgr16 format, the picture will all messed up with a lot of green. my graphic chipset is intel 945GM ).

RCS 使用初探

借了本书<<LINUX SERVER HACKS>>,以下部分就当做读书笔记
RCS 的作用管理系统文件,并保存修订历史(ps: 在服务器的管理上应该特别有用)

1. 建立RCS仓库
    由于RCS将所有修订版本保存在当前目录下的RCS目录中,故要启动RCS仓库,只需创建该目录即可
    mkdir RCS

2. 加入文件
    仓库建立好了,就可以用了。现在把当前目录下要管理的文件加入到仓库中来
    ci -i Filename
    这条命令会把文件移入到RCS下,并建立这个文件的第一个版本1.1。命令会要你输入初始化说明(以C-d结束). 

3. 登出文件-得到最新版本
    第二条命令把文件移到RCS下了,当前目录就没有这个文件了。这可不行,那就从RCS中登出文件,即得到最新版本。
    co Filename

4. 登出并锁定文件
    如果登出的目的是为了要编辑,那在登出时加锁,以妨其它用户在这段时间更新文件
    co -l Filename

5. 登入并解锁文件
    编辑完成,更新版本吧
    ci -u Filename
    命令会要你加入修订说明。

6. 版本比较
    编辑完成了,想回顾一下自己做了哪些修改
    rcsdiff httpd.conf
    这条命令也就是拿RCS中的版本和当前目录下的版本作比较

更多:
    checkout时加参数-rn.n指定得到n.n版本
    rcsdiff -rn.n -rn.n 比较两个指定版本
   
关于rcs2log的示例在fc5上有错误输出,不知道为什么
sort: invalid option -- 4
Try `sort --help' for more information.
其用法如下:
    rcs2log -v Filename 查看文件的各个版本信息
    rcs2log Filename 查看文件修订记录
   




chipset

chipset
    x86体系上,其是南桥和北桥芯片的构成的,一种chipset即是一组特定的南桥和北桥的集合. 对于移动平台和x86嵌入式平台. 南桥和北桥芯片可能合到一起成为一块芯片. 

硬件反向工程

硬件反向工程(Reverse Engineering RE)


包括以下几种形式:

  • Product tear-downs identify the product, package, internal boards, and components

  • System level analysis analyse operations, signal paths, and interconnections

  • Circuit extraction delayer to transistor level, then extract interconnections and components to create schematics

  • Process analysis examine the structure and materials to see how it is manufactured, and what it is made of.

第一种即常见的拆解和pcb抄板. 第二种则主要是借助逻辑分析仪来分析硬件的工作时序或协议. 第三种则主要是得到集成电路的原理图或硬件逻辑. 第四种则是深入分析晶体管的制造工艺以及进行失效分析等.


硬件反向工程领域知名公司: 国外为ChipWorksSemiconductor Insights(SI),国内有上海圣景微电子和北京芯愿景. (行业介绍可以看:IIC-China:中国两大反向工程公司相见言欢,谜底何在)


集成电路的反向工程领域(相关介绍参见:正确实施反向工程,有利于提高芯片设计技术),通常的操作有:

常的操作有:

  1. 封装去除(decapsulate/decap):

    用酸将封装去除以便提取晶粒

  2. 层次去除(delayer):

    除去已分析的层或无关层

  3. 芯片染色:

    为了区分器件类型,需要对衬底进行染色

  4. 芯片拍照

    用光学显微镜或电子显微镜对芯片进行拍照.

  5. 电路提取

    借助自动化软件对照片进行电路分析提取



封装去除的一些照片:



完全decap以后晶粒(die)放大图:

其中die所在空腔叫 cavity. die边缘连出的线上叫banding wire. die所依附的底座叫substrate. Substrate四周的片状条叫lead frame. Lead frame连到封装上的pin(这点图上没有).



(AMD AM29X305ADC MCU 图片来源于http://diephotos.blogspot.com/,该页面有更多类似精美的图片)



反向工程的全过程介绍: Safenet iKey 2032 In-depth Look Inside (该网站上还有很多类似的反射工程例子)



有关Intel's Prescott die 介绍:
见http://www.chip-architect.com/news/2003_04_20_Looking_at_Intels_Prescott_part2.html


查找资料当中遇到其它一些单词:

Epoxy 环氧树脂,在以前一般是把die直接附着在pcb,这时用epoxydie保护起来. 计算器pcb板上的那团黑色的物质就是(小时候我一直没想明白那里面包着的是什么东西).

Wafer 晶圆

CFI


    CFI 由 jesd68 标准定义. 其标定了设备的 Query interface. 用于得到设备所支持的命令集和参数. 其并没有定义任何命令集.  从Query interface得到的信息有一个16-bit ID code(Algorithm Command Set and Control Interface ID Code),其取值和含义在JEDEC PUBLICATION: jep137b 中规定.
如:
    0001     Intel/Sharp Extended Command Set
    0002     AMD/Fujitsu Standard Command Set
    0020     ST Advanced Architecture   (这个在jep137b中没有列出)

软核,固核,硬核


IP(Intellectual Property)就是常说的知识产权。美国Dataquest咨询公司将半导体产业的IP定义为用于 ASIC、ASSP和PLD等当中,并且是预先设计好的电路模块。IP核模块有行为(Behavior)、结构(Structure)和物理 (Physical)三级不同程度的设计,对应描述功能行为的不同分为三类,即软核(Soft IP Core)、完成结构描述的固核(Firm IP Core)和基于物理描述并经过工艺验证的硬核(Hard IP Core)。

什么是软核?
IP软核通常是用 HDL文本形式提交给用户,它经过RTL级设计优化和功能验证,但其中不含有任何具体的物理信息。据此,用户可以综合出正确的门电路级设计网表,并可以进 行后续的结构设计,具有很大的灵活性,借助于EDA综合工具可以很容易地与其他外部逻辑电路合成一体,根据各种不同半导体工艺,设计成具有不同性能的器 件。软IP内核也称为虚拟组件(VC-Virtual Component)。
Soft Core
An IP Core that is delivered in the form of a hardware description language or schematic diagram.

什么是硬核?
IP硬核是基于半导体工艺的物理设计,已有固定的拓扑布局和具体工艺,并已经过工艺验证,具有可保证的性能。其提供给用户的形式是电路物理结构掩模版图和全套工艺文件,是可以拿来就用的全套技术。
Hard Core
An IP Core that is delivered in the form of a mask set (i.e. a graphical description of the features
and connections in an integrated circuit).

什么是固核?
IP固核的设计程度则是介于软核和硬核之间,除了完成软核所有的设计外,还完成了门级电路综合和时序仿真等设计环节。一般以门级电路网表的形式提供给用户。
Firm Core
An IP Core that is delivered in a way that allows conversion into an integrated circuit design, but
does not allow the design to be easily reverse engineered. It is analogous to a binary or object
file in the field of computer software design.

dot emacs

今天双给我的 .emacs 添加了一点新的内容

;; 向前删除一个单词,相应的把默认绑定的 Kill-region 换到其它键
(global-set-key "\C-w" 'backward-kill-word)
(global-set-key "\C-x\C-k" 'kill-region)
(global-set-key "\C-c\C-k" 'kill-region)

(global-set-key (kbd "M-g") 'goto-line)

;; 当文件被修改后相应文件buffer自动刷新
(global-auto-revert-mode 1)

;; Changes all yes/no questions to y/n type
(defalias 'yes-or-no-p 'y-or-n-p)

;; Scroll down with the cursor,move down the buffer one line at a time, instead of in larger amounts.
(setq scroll-step 1)

;; do not make *~ backup files 实际上我很少用到这个备份文件
(setq make-backup-files nil)


;; displays the time in the status bar
(display-time)


不过没有两个问题没有解决:
1. 第一次woman时,其有个 building completion list of all manual topics 的过程,这个过程还是要耗点时间.有没有办法去掉这个过程?

2. woman一个词时,可能会有很多区的manual命中,有没有可能根据当前buffer mode来自动选择一个区.如
pritnf存在于这几个区:
/usr/share/man/man1/printf.1.gz /usr/share/man/man1p/printf.1p.gz
/usr/share/man/man3/printf.3.gz /usr/share/man/man3p/printf.3p.gz.
当我在c-mode下使用woman printf时,则自动选择man3.

3. dired 模式下,按C可以选择拷贝当前选中的文件夹到其它目录,有没有操作可以拷贝一个其它目录到当前目录.

4. 怎么设置 M-x gdb 时是新开一个frame? 因为我想达到一个窗口编辑编译,一个窗口调试的效果..

Install Emacs23

Get the latest version of emacs:


cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs co -r emacs-unicode-2 emacs


Compile:

$ mkdir output

$ cd output

$ ../emacs/configure --enable-font-backend --with-xft --with-freetype --with-gtk

$ make bootstrap

$ make

then you can run emacs under src directory.

FC6上使用emacs23可以得到以下好处:
1. 中文不会出现方框
2. minibuffer里显示中文目录和文件时不会乱码
3. 字体大小调整速度变快

mpeg ts stream type

mpeg PMT 的 stream type汇总:
H.222总是在修订,增加最新的类型. 以下来源于 H.222.0 (2006) Amendment 2

Value Description
0x00 ITU-T | ISO/IEC Reserved
0x01 ISO/IEC 11172-2 Video
0x02 ITU-T Rec. H.262 | ISO/IEC 13818-2 Video or ISO/IEC 11172-2 constrained parameter video stream
0x03 ISO/IEC 11172-3 Audio
0x04 ISO/IEC 13818-3 Audio
0x05 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 private_sections
0x06 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 PES packets containing private data
0x07 ISO/IEC 13522 MHEG
0x08 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Annex A DSM-CC
0x09 ITU-T Rec. H.222.1
0x0A ISO/IEC 13818-6 type A
0x0B ISO/IEC 13818-6 type B
0x0C ISO/IEC 13818-6 type C
0x0D ISO/IEC 13818-6 type D
0x0E ITU-T Rec. H.222.0 | ISO/IEC 13818-1 auxiliary
0x0F ISO/IEC 13818-7 Audio with ADTS transport syntax
0x10 ISO/IEC 14496-2 Visual
0x11 ISO/IEC 14496-3 Audio with the LATM transport syntax as defined in ISO/IEC 14496-3/Amd.1
0x12 ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in PES packets
0x13 ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in ISO/IEC 14496_sections
0x14 ISO/IEC 13818-6 Synchronized Download Protocol
0x15 Metadata carried in PES packets
0x16 Metadata carried in metadata_sections
0x17 Metadata carried in ISO/IEC 13818-6 Data Carousel
0x18 Metadata carried in ISO/IEC 13818-6 Object Carousel
0x19 Metadata carried in ISO/IEC 13818-6 Synchronized Download Protocol
0x1A IPMP stream (defined in ISO/IEC 13818-11, MPEG-2 IPMP)
0x1B AVC video stream as defined in ITU-T Rec. H.264 | ISO/IEC 14496-10 Video
0x1C ISO/IEC 14496-3 Audio, without using any additional transport syntax, such as DST, ALS and SLS
0x1D ISO/IEC 14496-17 Text
0x1E Auxiliary video stream as defined in ISO/IEC 23002-3
0x1F-0x7E ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Reserved
0x7F IPMP stream
0x80-0xFF User Private

静音

(此文为个人理解,有错误请指出)
硬静音: 通过控制电路,使音频信号一下消失的操作,一般实现为直接断开继电器触点或接地,扬声器一般会发出冲击声.波形如下所示:


软静音: 当要静音时,使音频信号交流分量幅度逐渐归零的过程,可以避免硬静音时的冲击声.波形如下所示:

Video Level

电平(level)

电平是指某一个测量点的电压,电流,功率与基准值的功率,电压,电流的比较值. 常见的是一般是电压电平. 如模拟视频中以差值来表示电平,消隐电平为0v. 即以消隐电平的电压来作为基准值来度量其它电压的相对电压,0.7v的黑电平(实际黑电平的电压为消隐电平的电压加上黑电平的值). 在模拟音频中,比较值以分贝来描述. 这样表示的电平其单位以dbx表示(x为实际物理单位,dbv). 这在模拟音频当中用的比较多. 实际使用时,还有更多的表示方式.但只要记住电平是相对值,谈电平,一定要从语境中找基准值,即电平定义成0的量值.

video level.
在标准里经常使用IRE(Institute of Radio Engineers )来表示video level..


(上图注解: blanking level 中文标准里叫做消隐电平. Black levelblanking level 间的电平叫做setup level. 此图中IRE的定义为:The blanking level refers to 0 IRE and the white level refers to +100 IRE . 在一些资料中也有以sync level作为 0 IRE. )


IRE其实就是个相对百分比量值. 因此在中文标准里IRE数值是带百分号的. GB3174-1995

在各个标准里:

SJ-T 11329-2006 数字电视接收设备接口规范第3部分:复合视频信号接口.pdf

SJ-T 11330-2006 数字电视接收设备接口规范 第4部分:亮度、色度分离视频信号接口.pdf

SJ-T 11333-2006 数字电视接收设备接口规范 第7部分:YPBPR模拟分量视频信号接口

都没对视频信号中的电压作任何限定.


为什么视频信号的电压不重要?

因为视频输入电路一般会隔直钳位电路.

视频分量标准

1. 同步信号出现在哪个分量上

For consumer products, composite sync is present on only the Y channel. For pro-video applications, composite sync is present on all three channels.

2. 同步方式

Tri-level synchro

Bi-level synchro

3.分量国际标准间的基本区别:

* HD formats (Tri-level synchro)

SMPTE274M / EIA-770.3 (1920 x 1080i) @ 60Hz

SMPTE274M / EIA-770.3 (1920 x 1080i) @ 50Hz

SMPTE295M / EIA-770.3 (1920 x 1080i) @ 50Hz

SMPTE296M / EIA-770.3 (1280 x 720p) @ 60Hz

SMPTE296M / EIA-770.3 (1280 x 720p) @ 50Hz

* HD formats (Bi-level synchro)

AS4933 (1280 x 1152i) @ 50Hz

AS4933 (1920 x 1080i) @ 50Hz

* SD progressive formats (ED) (Bi-level synchro)

SMPTE293M / EIA-770.2 (720 x 480p) @ 59.94Hz

ITU-R BT1358 / EIA 770.2 (720 x 576P) @ 50Hz

5. 中国的分量标准

SJ-T 11333-2006 数字电视接收设备接口规范 7部分:YPBPR模拟分量视频信号接口

特点:

1. 其所规定可以支持的视频扫描格式

720X480i@60

720X576i@50

720X576p@50

1920X1080i@50(行频28.125)

1920X1080i@60

1280X720p@60

1280X1080i@50(行频31.25)

2. 同步只出现在Y信号上

3. 标清采用Bi-level synchro, 高清采用 Tri-level synchro

aspect ratio

电视机一般有种:4:3和16:9的.即电视机的aspect ratio.
这个含义是指的是电视机的物理尺寸(或满屏时图像的)的宽高比.
4 :3 = 1.333
16:9 = 1.778
故16:9的电视机要比4:3的电视机看起来更宽一些,16:9的电视机也叫宽屏电视机.

而数据源对图像的大小的描述除了一般讲的图片的宽高外,还有pixel aspect ratio.
图片的宽高一般以pixel为单位. 在pc上,pixel aspect ratio通常是1:1. 则图片宽高像素数的比即是图片正常显示出的来的宽高比.

而实际上在video中,除了描述image的宽高像素量之外(如 720:576),还会描述image的aspect ratio(如4:3或16:9).
4:3的image和 16:9 的image,其pixel aspect ratio 是不一样的

4.3:
x1= (4/3)/(720/576) = 1.066
16:9:
x2=(16/9)/(720/576) = 1.422
x1:x2 = 3/4.

所以16:9 的图看起来是比 4:3的要宽一些. 因为每个像素要宽一些.

如果把 4:3的图直接当 16:9来理解或显示的话, 则图看起来被横向拉长而失真.
要不失真显示的话,必须对数据进行处理.
letter-box:
保持y轴解析度不变,模向按16:9重新采样,则采样数目不足720个,需要以黑色补足720个,所以在16:9屏幕上显示起来左右有黑边.
pan and scan
保持x轴解析度不变,纵向按16:9重新采样,则会多于576个. 一边做法是裁掉上下超出部分,保证采样个数为576个


pc业界图片和显示设备的pixel aspect ratio都是1. 则显示设备当工作在最佳分辨率这下时,其aspect ratio即为分辨率之比.


因此pc上的图放到电视机上显示需要重新采样. 同样电视节目在pc机上播放也需要重新采样. 例如4:3 PAL制电视节目在pc上播放,其正常显示窗口应该为768*576.


pixel aspect ratio:
D1/DV NTSC
(4:3)/(720/480) = 0.889
D1/DV NTSC 16:9
(16:9)/(720/480) = 1.185
D1/DV PAL
(4:3)/(720/576) = 1.066
D1/DV PAL 16:9
(16:9)/(720/576) = 1.422
(这些值和http://en.wikipedia.org/wiki/Pixel_aspect_ratio上的有些出入,不知为什么)

uclibc && nptl

不经意间发现自己使用的uclibc rpm包是带有nptl的. 于是上网查了一下这个nptl的含义.

具体可以看:
Linux threading models compared: LinuxThreads and NPTL
http://www.ibm.com/developerworks/linux/library/l-threading.html

glibc已经默认使用 NPTL. 而uclibc现在官方版本还是使用的linuxthread. 要使用nptl,则需要下载nptl分支:
svn://uclibc.org/branches/uClibc-nptl.

weak symbol

nm的manual里的说明:
When a  weak  defined symbol is linked with a normal defined symbol, the normal defined symbol is used with no error.  When a weak undefined symbol is linked and the symbol is not defined,  the  value of  the  symbol is determined in a system-specific manner without error.  On some systems, upper-case indicates that a default value has been specified.

网上其它有关的说明:
weak symbols can very well exist many or zero times. This will not cause any problem. If no symbol is found, a null one is provided. In case many symbols are found, the first one is taken and used by everybody.
(http://proj-gaudi.web.cern.ch/proj-gaudi/tricks/dynamic_cast.php)

测试程序:
说明:
  1. null为空,固打印了"not found null".
  2. strong函数的定义一处为weak,一处为strong,则链接器选用后者
  3. weak函数的定义两处都为weak,则链接器选用链接器所看到的第一个weak. (固更改链接命令o文件的位置即可得到不同的效果)
  4. 该测试只针对静态链接,对于动态链接效果怎么还末知
--------------------------------------------------
weak.c
--------------------------------------------------
extern void null() __attribute__((weak));
extern void strong() __attribute__((weak));
extern void weak() __attribute__((weak));

void strong()
{
    printf("false strong\n");
}

void weak()
{
    printf("first weak\n");
}

main()
{
    if(!null)
        printf("not found null \n");
    
    strong();
    weak();
}

--------------------------------------------------
strong.c
--------------------------------------------------
void strong()
{
    printf("true strong\n");
}

extern void weak() __attribute__((weak));
void weak()
{
    printf("second weak\n");
}

--------------------------------------------------
Makefile
--------------------------------------------------
.PHONY:clean

CFLAGS := -g -O0

%.o:%.c
    gcc $(CFLAGS) -o $@ -c $^
weak:  weak.o strong.o
#weak:   strong.o weak.o
    gcc $^ -o $@

weak.o: weak.c

strong.o: strong.c

clean:
    rm *.o

--------------------------------------------------
output:
--------------------------------------------------
[dybbuk@localhost tmp]$ ./weak
not found null
true strong
first weak
[dybbuk@localhost tmp]$ nm weak.o
00000028 T main
         w null
         U puts
00000000 W strong
00000014 W weak
[dybbuk@localhost tmp]$ nm strong.o
         U puts
00000000 T strong
00000014 W weak

Macros with a Variable Number of Arguments

Macros with a Variable Number of Arguments.
================================================

In ISO C99, a macro with a variable number of arguments can be defined.

example:
    #define debug(format, ...) fprintf (stderr, format, __VA_ARGS__)

this macro has two parameter:format and ..., as __VA_ARGS__ stands for ... . So the invocation of this macro shall have two arguments acording to ISO C.

So the statement below is invalid.
    debug ("A message");    //only one argument
and it should be:
    debug ("A message",);   //an empty argument

But under GUN C, it is valid.

In the above examples, the compiler would complain though since the expansion of the macro still has the extra comma after the format string. (a error)

To help solve this problem, CPP behaves specially for variable arguments used with the token paste operator, `##'.  If instead you write

    #define debug(format, ...) fprintf (stderr, format, ## __VA_ARGS__)

and if the variable arguments are omitted or empty, the `##' operator
causes the preprocessor to remove the comma before it.


And under GNU C, a more readabel way to refer variabel arguments.

    #define debug(format, args...) fprintf (stderr, format, args).


See gcc info section 5.14 'Macros with a Variable Number of Arguments' for more information.

test code:

#include <stdio.h>

#define DEVICE_NAME "test"
#define dprintk(fmt, ...) \
    do{ \
        if(1) printf(DEVICE_NAME ": " fmt, \
                 ## __VA_ARGS__); \
    }while(0)

#define dprintk1(fmt, ...) \
    do{ \
        if(1) printf(DEVICE_NAME ": " fmt, \
                 __VA_ARGS__); \
    }while(0)

/* 该宏也可以这样实现. 但其实这里回避了问题. 问题的引入是建立在可变参数部分为可以为空的基础上的,函数的可变参数就是这样的*/
#define dprintk2(...) \
    do{ \
        if(1) printf(DEVICE_NAME ": " __VA_ARGS__); \
    }while(0)


int main(void)
{
    dprintk("abc%d\n", 123);
    dprintk("abc\n");
#if 0
    dprintk1("abc%d\n", 123);
    dprintk1("abc\n");//test.c:29: error: expected expression before ')' token

#endif
    dprintk2("abc%d\n", 123);
    dprintk2("abc\n");

    return 0;
    
}

Saturday, August 30, 2008

Friday, August 29, 2008

帮读博同学装数据采集卡linux驱动

同学做个项目遇到点难题,就是一个驱动装不上的问题. 电话里说了几次,QQ上聊了几次,都没有搞定. 今天非催我过去. 索性就答应了. 到那后折腾了一个多小时总算搞定了. 同学夸我半天,不过我觉得没用到很深的知识. 主要都是些日常使用维护操作,以及驱动模块编译加载. 另外就是对PCI总线要有个基本的了解. 同学刚开始一直以为pci数据采集卡的设备型号是pci1710. 还是我通过lspci的输出提醒他设备型号应该是pci1716. 同学的师兄还过来请教我如何用linux通过USB从机器手臂中取数据. 不过我没怎么做过USB,故只能爱莫能助了. 也许是自己技术方面真的水平上去了? 还是他遇到的问题过于简单? 反正我自己还是不断遇到难题,不断感到压力,谁又能帮我解决?

整个母校之旅匆匆而过,但还是有不少感概.校园大体没有什么变化. 印象中中教的电梯还是不错了,但今天一用觉得挺陈旧的了. 又一次走过考研自习时常走的路,让我不免一丝沉重. 大学的四年是我人生最颓废的四年. 四年没有追求的日子,真想时间倒流重新来过. 不过重来我又能有多精彩? 校园依旧,我也依旧. 依旧的把感情深埋,依旧的拒绝挑战,依旧的腼腆. 就算一切重来,你又能改变多少自我.