2010年5月26日 星期三

2010年5月13日 星期四

IEEE 802.3ah - OAM

The IEEE 802.3ah, Operations, Administration, and Maintenance (OAM) sublayer, which provides mechanisms useful for monitoring link operation such as remote fault indication and remote loopback control. In general, OAM provides network operators the ability to monitor the health of the network and quickly determine the location of failing links or fault conditions.



Reference:
[1]http://en.wikipedia.org/wiki/OAM
[2]IEEE Std 802.3™-2005
[3]Metro Ethernet Forum. Ethernet in the First Mile Operations, Administration and Maintenance (OAM) – A Tutorial

2010年5月7日 星期五

Watch Dog 看門狗

Watch Dog(看門狗)主要是被設計來當程式發生不可預期的錯誤(程式本身的漏洞, 程式跑進無窮回圈 或 外部信號干擾產生錯誤動作)時用來重置系統的功能,以確保系統穩定,
它是一個timer, 如果enable, 它就會從一定的值倒數, 數到0時就會做reset的動作, 所以系統會固定一段時間touch它一下, 表示系統還活著

Watch Dog要是設計來當程式跑進無窮回圈或誤動作時,用來重置系統即重新啟動的功能.不見得有效!
Watch Dog一般是避免程式有bug造成電硬體有傷害,到一定的時間變會重新Reset,讓設計者能夠發現去解決

Watch Dog is a system block function for reliability. Mostly, watch dog block should be designed with a CPU block and System hardware reset block. It should be programming and enable when system boot up. System CPU will reset watch do timer in a predefined duration, if CPU too busy, the system will be reset by Watch Dog .


Reference:
[1] http://forum.eettaiwan.com/FORUM_POST_1000039157_1200047570_0.HTM

C語言- memcmp() 用法

/* 比較兩個block的內容, Compare two blocks of memory */

int compare_result = 0;
/* 存放function return value, 0: same; else: different */

int length = strlen(str1);
 /* for memcmp(), 要比較長度為多少 */

char str1[] = "abccc";
char str2[] = "abcdc";

compare_result = memcmp(str1, str2, length);
/* 此時 compare_result != 0 */



延伸閱讀
http://www.cplusplus.com/reference/clibrary/cstring/memcmp/

C語言- sprintf() 用法

/* 把argv[1]的string給塞到一個array中 */

/* 假設argv[1] 為存一個string */

#define max_size  55

char aaa[max_size];
sprintf(aaa, "%s", argv[1]);


延伸閱讀
http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/