作者归档:raywill

又逢情人节

题记:
 今天,你收到玫瑰了么?也许你没有,不要不开心。也许,有个人在心中为你培育了一个盛开的玫瑰园。
         —2006.2.14

一年之后的今天,再也写不出这样的文字了。潘多拉的魔盒一旦开启,谁又能逃过它的伤害?

今年的情人节不写心情,涂些杂七杂八的东西罢。

韩剧写爱情,虽然大多时候很夸张,但在那种理想的剧情之中还是蕴涵着很多的爱情道理。这两天消灭掉的《我的名字叫金三顺》中,三顺的爱情实在是危险,论容颜没有熙真漂亮,论主止没有熙真淑女,而且三石又是众多职员暗恋的对象。很多次她的爱情都濒临着死亡,但她对爱情大胆、执着、坚持,最终赢得了只属于她的真爱。曾经我没有坚持,甚至没有尝试过坚持。

爱情这个话题,对于拥有它的人,渴望它的人都是艳丽的,对于不再期待它的人却是灰色的,那种沉闷的灰色让人在深夜里感到窒息!

当然,上帝是公平的。当你失去爱情,他会让你体验些其他一些新鲜的东西 😀
曾经我以为爱情最重要的是心的靠近、对对方性格的认同,却忽略了在生活中去表现、实证、增进彼此的感情。Distance是一个原因,但更重要的原因是我的无知。来者可追,如果还有下一次,我总不能犯下同样的错误,于是我在尽力学习。这一年有陪过不同的人做不同的事:逛街,溜超市,吃麦当劳,吃西餐,逛大学,乱侃;有在朋友生病时送去关切,难过时送去问候,成功时送去祝贺。很多都是未曾经历过的,算是丰富了人生的体验吧。同时还断了网,减少上网时间,减少了KK时间。

然而,这些新的体验却是有形无神的,过后的悲哀却是只能自己体会。
正如06年的总结中说:“情感中少了一种叫严肃的元素,溜进来了一种叫无谓的东西,‘玩世不恭’也许可以用来形容这种状态。生活,缺少了那样一种牵挂,是悲哀的。”

07年该结束这种玩世不恭了,有些东西尝试一次就足够了~!

难怪专门有个情人节,爱情,是个神奇的东西!无论得到与否,只要曾经触碰过,都会被它改变,人生体验因此而丰富。

好啦好啦,不扯了,烤红苕去咯 *^_____________^*

情人节~RayWill在此祝福天下有情人终成眷属~

有点小无聊:)

日子过的有些无聊了。

不愁电影看,总看却没多大意思。
花了两天时间看完了30集的《太极宗师》,情节实在很简单,回想一下还真不知道怎么拖成了30集!下面应该看《兄弟连》了。Bobo推荐了《神探狄仁杰》,这个看完了就去看看去。
还准备跑跑车,不过没人陪,还是不玩了。

在家的其它时间就看看书,帮家里偶尔搭把手,父母真的是很辛苦!唉~

比较有意思的是可以烤红薯,烤糍粑,烤腊肉 🙂 偶而写写书法消遣下~
昨天的腊肉,那真是一个色香俱全,除了有一点点小咸。嘿嘿。

今天弄到了几块三夹板,心血来潮准备用它们来做个小木房子。现在还处在设计阶段,还没有一个比较好的创意的说。不能太复杂了,否则肯定是心有余而力不足了。

过些天还是多找找人玩吧,一个人玩不出名堂。

—————————-
世上三宗难,吃饭读书玩!

 

Plan for Winter

1. Maray FileSystem

2. Eat!Sleep!Help Dad and Mom.

3. Compile Linux Software, including Linux Kernel and some software like gcc.

4. English Verbal

5. Read Articles

6. Computer Architecture, esp. BUS and IO Dev.

Have a nice day, Ray~!

DMA

DMA,远远超出了预计的难度。失败告终。代之以IO Port Introduction。

这个一定要弄明白,从PCI,IDE这些东西看起,踏踏实实地建立整个框架概念!

Fighting!

A Sample DMA transfer


很想知道硬盘DMA的详细资料,却总找不到。到处都是下面这个关于Floppy的:(


  

24.3.1. A Sample DMA transfer

Here is an example of the steps that occur to cause and perform a DMA transfer. In this example, the floppy disk controller (FDC) has just read a byte from a diskette and wants the DMA to place it in memory at location 0x00123456. The process begins by the FDC asserting the DRQ2 signal (the DRQ line for DMA channel 2) to alert the DMA controller.

The DMA controller will note that the DRQ2 signal is asserted. The DMA controller will then make sure that DMA channel 2 has been programmed and is unmasked (enabled). The DMA controller also makes sure that none of the other DMA channels are active or want to be active and have a higher priority. Once these checks are complete, the DMA asks the CPU to release the bus so that the DMA may use the bus. The DMA requests the bus by asserting the HRQ signal which goes to the CPU.

The CPU detects the HRQ signal, and will complete executing the current instruction. Once the processor has reached a state where it can release the bus, it will. Now all of the signals normally generated by the CPU (-MEMR, -MEMW, -IOR, -IOW and a few others) are placed in a tri-stated condition (neither high or low) and then the CPU asserts the HLDA signal which tells the DMA controller that it is now in charge of the bus.

Depending on the processor, the CPU may be able to execute a few additional instructions now that it no longer has the bus, but the CPU will eventually have to wait when it reaches an instruction that must read something from memory that is not in the internal processor cache or pipeline.

Now that the DMA “is in charge”, the DMA activates its -MEMR, -MEMW, -IOR, -IOW output signals, and the address outputs from the DMA are set to 0x3456, which will be used to direct the byte that is about to transferred to a specific memory location.

The DMA will then let the device that requested the DMA transfer know that the transfer is commencing. This is done by asserting the -DACK signal, or in the case of the floppy disk controller, -DACK2 is asserted.

The floppy disk controller is now responsible for placing the byte to be transferred on the bus Data lines. Unless the floppy controller needs more time to get the data byte on the bus (and if the peripheral does need more time it alerts the DMA via the READY signal), the DMA will wait one DMA clock, and then de-assert the -MEMW and -IOR signals so that the memory will latch and store the byte that was on the bus, and the FDC will know that the byte has been transferred.

Since the DMA cycle only transfers a single byte at a time, the FDC now drops the DRQ2 signal, so the DMA knows that it is no longer needed. The DMA will de-assert the -DACK2 signal, so that the FDC knows it must stop placing data on the bus.

The DMA will now check to see if any of the other DMA channels have any work to do. If none of the channels have their DRQ lines asserted, the DMA controller has completed its work and will now tri-state the -MEMR, -MEMW, -IOR, -IOW and address signals.

Finally, the DMA will de-assert the HRQ signal. The CPU sees this, and de-asserts the HOLDA signal. Now the CPU activates its -MEMR, -MEMW, -IOR, -IOW and address lines, and it resumes executing instructions and accessing main memory and the peripherals.

For a typical floppy disk sector, the above process is repeated 512 times, once for each byte. Each time a byte is transferred, the address register in the DMA is incremented and the counter in the DMA that shows how many bytes are to be transferred is decremented.

When the counter reaches zero, the DMA asserts the EOP signal, which indicates that the counter has reached zero and no more data will be transferred until the DMA controller is reprogrammed by the CPU. This event is also called the Terminal Count (TC). There is only one EOP signal, and since only DMA channel can be active at any instant, the DMA channel that is currently active must be the DMA channel that just completed its task.

If a peripheral wants to generate an interrupt when the transfer of a buffer is complete, it can test for its -DACKn signal and the EOP signal both being asserted at the same time. When that happens, it means the DMA will not transfer any more information for that peripheral without intervention by the CPU. The peripheral can then assert one of the interrupt signals to get the processors’ attention. In the PC architecture, the DMA chip itself is not capable of generating an interrupt. The peripheral and its associated hardware is responsible for generating any interrupt that occurs. Subsequently, it is possible to have a peripheral that uses DMA but does not use interrupts.

It is important to understand that although the CPU always releases the bus to the DMA when the DMA makes the request, this action is invisible to both applications and the operating systems, except for slight changes in the amount of time the processor takes to execute instructions when the DMA is active. Subsequently, the processor must poll the peripheral, poll the registers in the DMA chip, or receive an interrupt from the peripheral to know for certain when a DMA transfer has completed.


单原点最短路径(采用Dijskra算法)

太浮躁,不塌实,一知半解。
写出的程序在白云上被攻的体无完肤。

自以为Dij算法理解清楚了,实际上还是没有完全领会要领,明白是对两个集合操作,却不清楚到底要不断更新哪个数据:一知半解!

花了好大力气,终于把这段程序搞定了,看起来还算舒服。

发此文自励之,万万要克服一知半解的坏毛病!


/*<br /> File name: Dij.c<br /> Description: 寻找最短路径,采用Dijskra算法<br /> */</p> <p>#include <stdio.h></p> <p>#define N 5<br /> #define O 1</p> <p>//集合标志<br /> #define S 0<br /> #define R 1</p> <p>#define INF 0xFFFF</p> <p>int Near[N]; //V0到其他点的最短距离<br /> int path[N];</p> <p>void Dij(int A[][N],int path[])<br /> {<br /> int i,j;<br /> int n=N;<br /> int v;<br /> int shortest;<br /> int bitmap[N]; //集合标志</p> <p> for(i=0;i<n></n><n></n><n><=shortest){ v=j; //记录下最近点的下标 shortest=Near[j]; //记录下最短距离 } } } bitmap[v]=S; //将在V中找到的离S最近的v点取出加入到S集合中 //更新V0到S集合所有点的距离 for(j=0;j</n><n>< Near[j]){ Near[j]=shortest+A[v][j]; //更新V0到R集合中所有点的路径长度 //求取路径 path[j]=v;//记录下是谁指向j节点,这个记录是不断更新的,直到最后一次才能确定 } } } } } void print_path(int path[],int i) { printf("COST(%d to %d) = %dt",O+1,i+1,path[i]); //print path O->i</p> <p> if(path[i]==-1) { printf(&#8220;**n&#8221;);return; }<br /> while(1){<br /> printf(&#8220;%d&#8221;,i+1);<br /> i=path[i];<br /> if(i==path[i]){<br /> printf(&#8220;<-%d",O+1); break; } printf("<-"); }; printf("n"); } int main() { int s[N][N]={ {0,2,1,INF,INF}, {INF,0,INF,1,3}, {INF,2,0,INF,5}, {INF,INF,INF,0,1}, {INF,INF,INF,INF,0} }; int i,j; printf("Orignal Martixn"); for(j=0;j</n><n></n><n></n><n></n></stdio.h>

笑话一则

有一隻貓發現了一隻老鼠….
於是餓虎撲羊般衝向老鼠要把他吃掉
可是後來貓卻被這隻老鼠吃掉…..
為什麼???
因為
老虎 老鼠 傻傻分不清楚