2010年3月15日 星期一

SerialPort dianostics under Linux

SerialPort diagnostics under Linux is not so easy as under Windows. Windows SDK supports some useful(but not so safely) API, but Linux not.

External loopback test and baud rate test is very easy while serial redirection not enabled. But serial redirection always through some login messages to UART and make diagnostics failed. The command setterm -msg off would help. But if test failed, the linux API not support CTS or some read to clear commands, and it will affect following serial ports tests.

Internal loopback diagnostics under Linux should use direct IO to access MCR to enable internal loopback.

So, if anyone want to write some serial diagnostoics, he should use inb/outb/inl/outl instead of open/read/write. And it will save time and performance.

2010年1月25日 星期一

Sikuli

Sikuli is a MIT project for picture-driven search. One of my junior colleges Tsung-Hsiang Chang (張琮翔 a.k.a vgod) is the developer.

It's funny and may change the ordinary programming-language thoughts.  Any programmer should try it out, even if you don't know how to program with JAVA or Python.

2010年1月7日 星期四

What is CLOUD?

Here's an interesting traditional chinese article talking about "cloud computing" http://ria.richtechmedia.com/2009/01/19/what-is-a-cloud-%E9%9B%B2%E5%9C%A8%E4%BD%95%E6%96%B9%EF%BC%9F/

2010年1月6日 星期三

Outside the spec

Everytime I write code following the spec, I always realize that there are many things not be told in the specs. It might just some obvious thing that editors take it as a matter of course and needless to write down.

But while programming, those editors-take-it-as-a-matter-of-course things are always the problems with the programmers. Directly following the spec is not enough, the programmers should design many test cases to verify the critical problems, and solve it.

I hate that. I write a program to verify MMX instructions. MMX is a old tech, and the spec is very simple. But it has many "phenomenons" that not in spec, such as carry problem, signed and unsigned behaviors. I thought I'm a little familiar with low-level computing language, but I'm totally defeated by MMX.

I hate coding, period.

2009年12月29日 星期二

Some GCC macro examples for inline assembly (1)

Here is a very simple one:
#define FUNC(func, ret) \
     asm ("asm_func" \
     : "=a" (ret) \
     : "a" (func) \
);
a means ax/eax/rax/r0, and we can exchange a to b,c,d or r to indicate ebx,ecx,edx or any general purpose registers. And we can use %0 to indicate "=a" (ret), it means to output ax/eax/rax to memory space ret pointed, and %1 to indicate "a" (func), move the value of func to ax/eax/rax.

Ref: GCC inline assembly HOWTO.
The external link is very useful, but not latest reference. I will continue showing some example not related with my works.

2009年12月24日 星期四

GCC inline assembly

Assembly is not very friendly. But I should verify many instructions set, such as MMX, SSE, SSE2 and so on. I hate assembly, buuuuuu~

It's a good news that gcc's inline assembly is very helpful. HERE is a very useful HOWTO.

OpenMP over Multicore PC

Now my work is writing a program to verify each core of CPU's instructions. Thus, I should find a way to make sure that the instructions are running on specified core.

MPICH was found firstly, but soon I recognize it works on distributed memory, such as cluster. It's not my goal.

Multicore PC is unified memory system, and OpenMP is a choice for the system. It's bulit-in recently gcc(4.1.1 or later? not sure). Just add option -fopenmp while compiling and have fun with openmp.

2009年12月23日 星期三

useful vim cheat sheet from vgod's blog

Vim cheat sheet.

Divine code from vgod's blog( trad. chinese)

追求神乎其技的程式設計之道  by vgod.

重新啟用

雖然不確定到底會不會用就是了。這邊以後會拿來練習英文 and write some works' notes. I should have some place to put down those notes for future use.

Well, just wait and see.