11.30.2006

劣等財

劣等財

因為目前的經濟能力不足以買心中想要的東西,所買的替代物 (?)

Notes on CCIR 656 (BT.656)

CCIR656 - BT.656

基於Recommandation 601
Considering:
  1. 世界的電視標準已經建立,有525 (NTSC) 和625 (PAL)兩種掃描線。
  2. 需要一個共通的標準方便設備商在世界交換資料(也就是在525和625間轉換)。
  3. 因為2,有關的digitial television單位已經同意encoding parameter需要有一個標準(recommandation 601)。
  4. 要達到Recommandation 601的目的,需要對data stream和interface作規範。
  5. 這個規範必須要再525和625間有共通性。
  6. that in practical implementation of Recommendation 601 it is desirable that interface be defined in both serial and parallel forms.
  7. that digital television signal produced by these interfaces must be a potential source of interface to other services, and due notice must be taken of No.964 of the Radio Regulation.
1.Introduction

這份Recommendation說明了digital television設備如何在5252和625的interface連接,並且符合4:2:2的encoding parameters.


Part I

COMMON SIGNAL FORMAT OF THE INTERFACES

1.General description of the interfaces

這個interface用來作為一個單向的資料介面。
資料的傳輸利用8bit的資料來傳輸,要傳送的資料有:
video data
timing reference codes
ancillary data
identification codes

2.Video data

2.1 Coding characteristics

符合Recommendation 601,資料中field-blanking的部分在525和625不同,如下表:
625 525
_______________________________________________________
V-digital field blanking Start Line 624 Line 1
Field 1 (V = 1) Finish Line 23 Line 10 (V = 0)
___________________________________ Start Line 311 Line 264
Field 2 (V = 1) Finish Line 336 Line 273 (V = 0)
_______________________________________________________
F-digital field
identification
Field 1 (F = 0) Line 1 Line 4
Field 2 (F = 1) Line 313 Line 266
______________________________________________________
這部分看不懂

2.2 Video data format

8 bit資料中的0和255 (0xFF)預留為identification用,不能用來代表資料。
video data word轉換為17M words/s的data stream,並且依照Cb, Y, Cr, Y, Cb, Y, Cr, etc.
其中Cb, Y, Cr代表相鄰兩pixle的 ?

2.3 Timing relationship between video data and analogue synchronizing waveform

2.3.1 Line interval

digital active line從analog line synchronzing pluse 的leading edge後的第244 word(525 standard), 或是264 word (625 standard)開始,this line being specified between half-amplitude points.

2.3.2 Field interval

digital line的開始同時也是digital field的開始:the digital field starts 32 words(in 525 line) and 24 words (625 line) prior to the lines indicated in Table I

2.4 Video timing reference codes (SAV, EAV)

有兩個地方有timing reference code :每個data block的開始(Start of Active Video, SAV),和結尾(End of Active Video, EAV)。

Timing reference code由4個word組成: FF 00 00 XY (hex form)
FF 00 不能表示data,就是預留給timging reference code。
FF 00 00 是固定的Timing reference code開頭,
第四個byte的bit定義field 2的identification,內容如下(Timeing reference codes)

Table II Video timing reference codes

Bit No.
word (MSB) 7 6 5 4 3 2 1 0 (LSB)
_____________________________________________________
First 1 1 1 1 1 1 1 1
_____________________________________________________
Second 0 0 0 0 0 0 0 0
_____________________________________________________
Third 0 0 0 0 0 0 0 0
_____________________________________________________
Fourth 1 F V H P3 P2 P1 P0
_____________________________________________________
F = 0 during field 1, 1 during field 2 V = 0 elsewhere, 1 during field
blanking
H = 0 in SAV, 1 in EAV
P0, P1, P2, P3: protection bits (see Table III).
MSB: most significant bit.
LSB: least significant bit.
其中P0,P1,P2,P3和F,V,H的資料有關,從下表
Protection bits

Bit No. 7 6 5 4 3 2 1 0
___________________________________________________
Function Fixed 1 F V H P3 P2 P1 P0
___________________________________________________
0 1 0 0 0 0 0 0 0 1 1 0 0 1 1 1 0 1
2 1 0 1 0 1 0 1 1
3 1 0 1 1 0 1 1 0
4 1 1 0 0 0 1 1 1
5 1 1 0 1 1 0 1 0
6 1 1 1 0 1 1 0 0
7 1 1 1 1 0 0 0 1
___________________________________________________


可以用P0~P3可以correct 1 bit的error和detect出2bit的error。

2.5 Ancillary Data

Ancillary Data必須要預先準備,並且同步的插入multiplex的blanking interval。
Ancillary Data是7 bit,LSB是用來作odd parity用。

2.6 Data words during blanking

data stream中不用作timing reference code和ancillary data的部分是blanking interval,必須填入以下的sequence : 80 10 80 10, etc. (hex form).這相當於是空白時的Cb, Y, Cr, Y的直。


Part II

BIT-PARALLEL INTERFACE

1.General description of the interface

介面是8 bit data和一個clk pin,
----------------------------------------------------------------------------------------------------------
以下是google所得資料
BT.656 (CCIR656)
規範一個Video資料傳輸的時序和格式,其資料格式符合BT.601 (CCIR601)所規定的Y.Cb.Cr 4:2:2方式。
BT.656定義了:
blanking
embedded sync words
video multiplexing format
for both parallel and serial interface

intersil : BT.656 Video Interface for ICs

使用 8 or 10 bit data 傳送YCbCr,使用27MHz的clock作同步
用特殊的data 代表同步信號,不必使用另外的HSYNC, VSYNC,BLABK 信號。
輔助資料可以放在blanking interval中
00和FF不得使用,作為特殊標記(EAV,SAV用)
SAV (Start Active Video)和EAV (End Active Vidwo)的code是 FF.00.00l.XY
XY的bit用來標示SAV,EAV,during Vertical Blanking,Field 1 or 2.

每一條掃描線都要以SAV開頭,EAV結尾:
EAV.Blanking.SAV.Line Data.EAV....

規定一條掃描線有720點。
因為採用4:2:2的格式,所以傳送序列;
Cb0.Y0.Cr0. Y1. Cb2.Y2.Cr2. Y3. Cb4.Y4.Cr4....
所以一條掃描線720點的資料總需要
Y : 720
Cb : 720/2
Cr : 720/2
共1440 byte的資料。

在傳送Video Frame時採用交錯的方式,先送Even line的field,在送Odd line的field,
總line no依照PAL/NTSC格式而有不同。
除了每一條line之前會有一段的blanking外,一個field的開頭幾條scan line也是blanking。

----------------------------------------------------------------------------------------------------------

以下是"Video Demystified"上的BT.656 說明 (Chapter 6.Digital Video Interface)

Ran out of space in ROM for ***.exe.

上次的makeimg error : "Ran out of space in ROM for ***.exe"。
問 Loyal 後,他給的答案:

給的rom image size 太小,所以要修改config.bib 中

#define NANDIMGLEN 00F00000

將 00F00000 改大就可以。

注意不要超出,影響到別人。
奇怪的是config.bib 出現在三個地方:
  • platform\yourplatform\cesysgen\files
  • platform\yourplatform\files
改platform\yourplatform\files下的config.bib,要作sysgen ..check "copy files to release direcory".

sysgen 後,可以檢查一下最後reldir 下的config.bib 有沒有跟著改掉。

11.29.2006

Headphone socket diagram


很常看到phone jack 的電路圖:
這種jack 是可以偵測插入動作的,利用 pin 4。
沒插入時,會和pin 2 短路,
一旦插入earphone 後,就會和2斷開。變成open。
利用這兩種狀態來detect earphone有沒有插入。

11.27.2006

Philip USB 2.0 : ISP1583/2 - Initialize

reset後,可以先read Chip ID (70h),datasheet說
byte 0 : version = 0x30
byte 1 : ID - low byte = 0x82
byte 2: ID - high byte = 0x15

所以讀起來就是 0x158230。 (雖然是1583,chip id 也是1582)。
確認bus timing and chip connectin OK。

然後作 register 初始化設定:

ModeReg (0Ch) = 0x0208; DMA Clock ON. Global INT enable
IntConfig (10h) = 0x54; INT on all ACK. NYET
IntEnable(14h) = 0x00000979; IEP0TX. IEP0SETUP. IEDMA. IEHS_STA. IERESM. IEUSP. IEBRST.
DmaConfig(38h) = 0x2201; ATA_Mode. PIOMode1. 8-bit.
DmaIntEnable (54h) = 0x00000979 : ?
DmaConfig
DmaIntEnable

初始 使用到的Endpoint
一部分要分成FULL_SPEED, High_SPEED 的 FIFO buffer size不同

EndpointIndex = 4 : Endpoint Index = 4, direction = 0 (out)
MaxPacksize = 0x0040 : 1 packet per microframe. fifo size : 64 bytes - for Full Speed
// = 0x0200 : 1 packet per microframe. fifo size : 512 bytes - for High Speed
EndpointIndex = 5 : Endpoint Index = 4, dircetion = 1 (in )
MaxPacksize = 0x0040
// = 0x0200

EndpointIndex = 4
EndpointType = 0x0016 : No Empty Packet. Disable. Double Buffer. Bulk.
EndpintIndex = 5
EndpointType = 0x0016

EndpointIndex = 4
EndpointType |= 0x08 : Enable Endpoint
EndpointIndex = 5
EndpointType |= 0x08


DmaEndpoint = 2
EndpointIndex = 5
ControlFunction ?

Address = 0x80 : enable device and clear device address to 0x00 (un-assigned value)

新中文編碼..

這一期 OSSF 電子報有一篇專欄 將中文編碼說得很清楚,附上例子很容易讓人了解。

中文編碼,一字一碼不方便的原因是 限制了 新字 的創造。
---- 所謂的"新字",就是由原有的部首或偏旁組成。

所以,"新"編碼是不是就是先將所有部首,偏旁 編碼起來,再用這些 部首,偏旁 來作所有 文字 的編碼 ?

聽起來好像是 以前聽過的 中文基因,就是倉頡 發明人的新計畫,好像還有設計一顆自行引擎,自動產生字型。

11.23.2006

Philip USB 2.0 : ISP1583/2

每次...
  • System Powerup
  • bus-reset event
  • 由full-speed 轉為 high-speed
都要作Initialize:
  • Mode Register
  • Interrupt Configuration Register
  • Interrupt Enable Register
  • DMA Configuration Register
  • DMA Hardware Register
  • Endpoint (A lot Registers)
其中 Initialize Endpoint..

即使不是所有的Endpoint都要用到,還是要將所有Endpoint都Initialize :
  • 設定每一個Endpoint 的 MaxPacketSize
  • 設定每一個Endpoint 的 Type,並且Enable。
    不能同時將同一個的Endpoint的MaxPacketSize,Type 設定好並且Enable後,再作下一個?
Source Code:
SourceCode中,HighByte和LowByte好像是相反的 : BigEnding ?

Mode = 0x0802; 有點問題,bit 10-12是reserved,竟然有值。
應該是0x0208
IntConfig = 0x54;
CDBGMOD =01.(Int on all ACK),
DDBGMODIN =01 (Int on ACK),
DDBGMODOUT=01 (Int on ACK and NYET)
IntEnable = 0x79090000; 有點問題..bit 26-31 是reserved,竟然有值

Endpoint Config : 只有Config Endpoint 4.5

EndPointIndex = 4;
MaxPackSize = 0x4000;
EndPointIndex = 5;
MaxPackSize = 0x4000;

EndPointIndex = 4;
Type = 0x1600;

Enumeration Process


USB 的 enumeration 動作可以區分為3個stages:
  • SETUP token with data IN stage
  • SETUP token with data OUT stage
  • SETUP token with no data stage

真倒楣,CS, RD, WR, ADD 都正確,但是DATA就是不會動作,main cpu board : smdk2440 的address/data bus又通過一個CPLD,無法知道是不是要對他做什麼動作。
DATA BUS好像是Lock起來一樣,一直維持在High/Low。
ANDY 說:
  • BWSCON 的 ST2 (因為用CS2),要設為1 : Using UB/LB
  • BWSCON 的 WS2(因為用CS2),要設為0 : Wait disable。
查UB/LB 是用在muti-byte width (>8 bit)時使用的,主要是在write動作,要指示target address是哪一個byte 的signal。
WS 是外部wait signal,用來延長access cycle time。

11.22.2006

Philip USB 2.0 : ISP1583/2

ISP 1582 的Access Mode 只有 Generic Processor Mode。bus寬度是16 bit。當要存取sigle byte時,請自動將high byte捨棄。
這一點值得商榷,因為demo電路從A0開始連接,所以是byte addressable。要測試看看對奇數位址read時,是不是也OK。
因為內部register的address都是偶數,所以即使沒有bank selection (enable) pin也沒有關係。

和USB 的Endpoint相關的register只有一組,利用Endpoint index register來決定mapping到哪一個endpoint(有一點像PIC的 bank selection register)。


Address Register (00h)

在power-on reset,soft reset 和 bus reset 後,DEVADDR[6:0]會被clear。
在power-on reset,soft reset 後 DEVEN 會clear,bus reset後會set。


Endpoint Index Register (2Ch)

決定以下registers mapping到哪一個endpoint:
  • Buffer Length
  • Buffer Status
  • Control Function
  • Data Port
  • Endpoint MaxPackSize
  • Endpoint Type
DMA Register也有一個Endpoint index register,這兩個 index register不可以同時指到同一個endpoint (chip's bug ?)

Endpoint 0 有 兩個buffer : SETUP,Data。Index Register 的EP0SETUP 可以用來決定是要對哪一個buffer動作。
在存取其他Endpoint時,EP0SETUP 要是0。


Control Function Register (28)


用來控制該Endpoint的狀態:
  • CLBUF : Clear RX Buffer (FIFO ?)。
    平時不用作,因為在對FIFO作read動作時,會自動紀錄FIFO 剩餘資料的長度,當==0時也就自動clear了。
    這個bit只有在需要強制將RX buffer清除時才有用。
  • VENDP : 強制將FIFO 內的資料送到SIE中,等待in token 後送出。
    平時不用作,因為每次wirte FIFO,FIFO counter 會自動增加,當FIFO counter = MaxPacketSize時,就會自動將FIFO data送到SIE中。
    這個bit只有在送出 data length < MaxPacketSize 的資料時,才需要設定。
  • DSEN : 將 controller設定為DATA Stage,處於這個Stage時,controller會follow In/Out Token 的內容動作,
    否則,
    Controller會回應NAK給所有Token,直到programmer 主動回應SETUP Command為止。
    然後呢?回應SETUP Command後,programmer需不需要自己設定DSEN這個bit呢?還是controller會自行改變?
  • STATUS : Status Acknowledge,這個bit決定SETUP command 中STATUS Stage的動作。
    0 : 回應NAK
    1 : 回應一個空packet 給IN Token,回應 ACK給OUT token。
    當Status Stage結束時,這個bit會被自動clear。
  • STALL : Stall Endpoint,中斷這個Endpoint的動作。
    任意中斷傳送會導致NRZ 邏輯錯誤,所以每次中斷後, 要再恢復時,要reset 這個endpoint : disable - enable 這個endpoint 一次。


Data Port Register (20h)

提供該Endpoint 內部 FIFO 的對外介面(對這個register作讀取就等於對該Endpoint的FIFO讀取)。
Endpoint FIFO 的寬度是16bit,所以每次R/W,FIFO count 會自動+-2。

如果是Write動作,當FIFO counter == MaxPacketSze,就會自動將FiFO 的內容送到SIE controller去,等待USB 的IN Token 進來後,自動送出。
同理。
如果是Read動作,當FIFO couter == 0,在下一個 OUT token 時,就會將USB 資料自動放到FIFO中。


Buffer Length Register (1Ch)

內含Endpoint的PacketSize (DATACOUNT)。
這個register很奇怪,好像是用來"validate" 每次pacjet sent。剛剛的register說道,當FIFO counter == MaxPacketSize 時,就會自動validate和送出。
所以要傳送一個MaxPacketSize 整數倍的資料長度時,是OK的。
但是如果...MaxPacketSize 設為64,要傳送 510 bytes的資料,那在最後一個packet時,記得要將Buffer Length Register設為62,這樣FIFO才不會一直等FIFO counter == 64 才送出。
不能改MaxPacketSize嗎?

EndPoint MaxPacketSize register (04h)

這是所有endpoint共用的一個register,決定除了endpoint 0以外,所有endpoint的MaxPacketSize (這就是為甚麼每個Endpoint還要有一個 BufferLength Register的原因了)。


Interrupt register (18h)

Endpoint0 ~7 每個Endpoint都有TX/RX兩個 interrupt.
另外 Endpoint0 還有一個獨有的 SETUP interrupt : 代表收到 SETUP Token
VBUS : vbus is on.
DMA : DMA status register 有改變
HS_STAT : 正由full_speed 轉為 high_speed
RESUME : 正由 active 轉為suspend
PSOF : ?


Frame Number Register (74h)

從上一個SOF (Start Of Frame) 到現在,共收到幾個frame,microframe。


Unlock Device Register (7Ch)

為了避免ISP1582 在suspened 時,register 的資料被塗改(?),
當 Mode Register中的 PWRON bit 是 0 的時候,所以write 的動作都是無效的。
配合這個動作,當chip resume,作第一次write 之前,要先作個Unlock 動作:寫入AA37h 到Unlock Device Register。

接下來的說明有點奇怪..

當ModeRegister的PWRON=1時,chip 有power,RD_N,WR_N,CS_N 都正常動作。所以可以直接對chip 作write動作。 不需要作Unlock。

當ModeRegister的PWRON=0時,chip 沒有power,RD_N,WR_N,CS_N都是floating,這時候chip處於suspend狀態,這時如果要作write動作,就要先作Unlock。
又說是resume時要下,又說PWRON時不用作。又說在no power時要作,所以?到底什麼時候要作?
還有..RD_N, CS_N也是floating,所以read動作也沒效呀,怎摩會在Write之前才要作?
再挑剔一點,如果RD.WR,CS都floating,那連Unlock command也寫不進去呀。


Test Mode Regster (84h)

可以強制設定USB D+/- 的pin腳High/Low。作測試用。

Bus Timing..

整個read/write cycle (CS enabled time) min = 50ns。

SVN worklog - check SMDK2440A BSP.

SVN 是一個filesystem,具有history record的filesystem。
使用SVN,就像是對一個folder動作:將資料copy 到folder中,讓SVN幫你紀錄資料的變更,需要時,將SVN的資料copy 出來使用。
因為有history record功能,所以可以將任一時間的 folder "狀態" copy 出來。

利用這樣的功能,作source code的version control。

SVN 的 verison control 方式是利用folder的方式。
一個project 的source code分成三種狀態:
trunk : code developement history
tag : 特殊 狀態的snapshot。
release : releaes 的snapshot。
branch : 需要作branch 可以用這個,也可以跟tag 一起用。

所以在要利用SVN 管理一個project時,要先在SVN 的repository 中create 三個folder。
在SVN repository 中Creat Folder 沒有那麼直接:
  • 在Repository Folder中 New 個 folder : WINCE500_VSS0611
  • 在WINCE500_VSS0611處案右鍵,選"Create Repository"。
這樣,就create了一個Repository,預計給WINCE500_VSS0611用。
  • 另外在其他無關的的地方create 一個folder,裡面create三個sub folder : trunk, release, tag。
  • 在這個無關的folder 上按右鍵,選"import",URL 指定到WINCE500_VSS0611。
這樣,就藉由 "import" 動作,在WINCE500_VSS0611這個repoitory 內create了三個folder : trunk, release, tag。

接下來就可以將source code加到WINCE500_VSS0611:
  • 只要加入platform/smdk2440 這個folder,但是裡面有很多file 是不需要的,所以按右鍵,選"Setting",有一個ignore-list,加入以下字串,中間用space隔開:
    *.exe *.str *.lin *.exp *.pdb *.bin *.nb0 *.mac *.obj *.old *.bak *.dll *.map *.rel *.sre *.a *.log *.db

  • 在 SMDK2440A按右鍵,選check out,url 是repository 的WINCE500_VSS0611\trunk
  • check out後是空的,現在要加入檔案,同樣在SMDK2440A按右鍵,選Add。出現一些list,check 一下,有沒有你不要check in 的file,把他uncheck。
  • 右鍵,commit
以上就把SMDK2440A 這個folder commit 進WINCE500_VSS0611\trunk 中了。
可以開始修改source code,覺得需要record一下state時,就在該file(或是整個SMDK2440A)commit。

修改一陣子,若是覺得OK,要紀錄一下,就在SMDK2440A按右鍵,選branch/tag,URL 選WINCE500_VSS0611\Release\0.0.1 (0.0.1自己選)。
SVN會把目前的snapshot copy到Release\0.0.1 這個folder中。
這時候,若是要繼續改,記得要 "switch " 回trunk。

11.21.2006

A different thought to ..

....當我們釐清問題後,就會發現公眾WiFi的目標使用者是非常小的一群人。必須具備筆記型電腦,經常在戶外而且有上網需求,戶外活動範圍必須經常在大馬路邊才有良好訊號。

典型的想像,這種人無非是電腦玩家及業務員。我們應當心安理得的說:目前能有這麼多公眾WiFi付費用戶真是足堪告慰。然而,我們居然為了服務這種小眾而鋪設人口覆蓋率超過 90%的WiFi無線基地台?!
這句話應該是錯的,他沒有考慮到越來越多的portable device都具有Wifi能力,所以接下來的推論也都....

配合目前各種資訊網站,擁有這些Wifi ready, portable裝置的人很容易而且隨時取得附近有哪些好吃,好玩的資訊,甚至在公車亭打wifi phone..
像這類使用方式,唯一要考慮的就是 費率,職不值得為了這些 時間 花錢申請Wifly 服務。
所以...
台北市目前的公眾WiFi包月大約近 400元台幣,如果降到 200元能不能使付費用戶數量大幅提升?老實講,在筆者實地使用過後,並不太有信心。而這個價格對服務提供者來說,也實在太傷了。
200塊對公車通勤族來說,可能還是太貴。
不過要是家裏也可以用同樣的線路上網的話,200 可能就可以接受。

當然,200/month 所得到的品質當然不能讓你 打online game,看網路電視,但是則足夠用來上msn, google, 拍賣,和blogging。

這樣,應該會有很多低頻寬使用者 會心動吧...

try coLinux

即使在作CE的東西,Linux 還是需要的,因為有很多driver 可以參考Linux的source code。(用Google Code Search 就可以知道open source的資源有多少...)

實際上不需要另外download debian image,因為安裝coLinux 0.6.4 時就會有一個rootfs選項,選Debian就會自動download。
但是也只有負責download,沒有解開和設定xml。
安裝在c:\colinux下比較方便,不用改default.colinux.xml。
解開debian image (變成1G),rename成root_fs (這樣就符合xml 設定)。

開啟cmd:
 c:\coLinux\colinux-daemon.exe -c default.colinux.xml
就可以看到colinux啟動了..

嗯,interface果然很醜,follow letoh 的好了,加上 "-t nt",就會用原cmd視窗,login root 的password也真的是root。

所以follow letoh 的作法,用NAT(Windows的網路共享)。
  • 將Windows上實際接到網路的interface設定分享。
  • 將接到coLinux的interface設定IP 為192.168.0.1, 255.255.255.0 default GW 和DNS 跟實際網路介面的default GW一樣(ipconfig/all)。
這樣就不用修改任何colinux的網路設定。
內建的editor 不是vi, 使用editor 可以啟動該editor。

修改 apt.conf,設定proxy, follow 以前的說明,加入Proxy.
從 /usr/share/doc/apt/examples下copy過來。

copy完後,在 "Acquire" 那個{ } section中,加上:
Http
{
Proxy "http://10.3.3.194:8888";
};
OK。可以apt-get update了。
第一件事 : install vi..
apt-get update,apt-get upgrad後已經有一堆要upgrade了。
follow letoh 作法,用testing,apt-get update 會有error。出現
"E:Dynamic MMap ran out of room"
Google說,在apt.conf加一行
APT::Cache-Limit 10000000;
就OK了。

adduser charles

source.list 改用這邊的內容:
deb http://ftp.tw.debian.org/debian/ etch main contrib non-free
deb-src http://ftp.tw.debian.org/debian/ etch main contrib non-free
deb http://security.debian.org/ etch/updates main contrib non-free
deb-src http://security.debian.org/ etch/updates main contrib non-free
再apt-get update..

openssh 的安裝,用 apt-get install openssh 沒有找到,有些link說要加入 http://non-us.debian.org 也沒用(甚至404)。所以用 apt-cache search openssh 。發現兩個package: openssh-server, openssh-client。
  • 安裝 openssh-server,出現要temporily remove e2fsprogs,, error。說要加上APT::Force-LoopBreak; 加入後依然無效。
  • 手動remove e2fsprogs - 掛點,path 失效。
  • 安裝 openssh-server - 一樣失敗。
  • 再install e2fsprogs.. 失敗。
只好重新untar debian root_fs,重頭再來..
嗯,改 apt-get install ssh .. .從安裝列表中竟然還是看到有openssh-server, openssh-client...
結果? 一樣Fail ,不過,從 這裡 install 時加上 -o APT::Force-Loopbreak=true 可以繼續安裝..
結果,一樣,remove e2fsprogs 後,出現 找不到rc.d。
這裡這裡 有作法 (就是作一個假的rc.d騙過dpkg.)
cp /bin/false /tmp
cd /tmp
ln -s false update-rc.d
export PATH=$PATH:/tmp
然後就可以 install sysv-rc 然後會要用
apt-get -f install
將所有package 修好。
這樣就OK了 ?
restart,還是沒看到ssh的蹤跡,
再install 一次 ssh,OK。安裝成功。
ps -aux 已經可以看到ssh。

但是實際登入會失敗,close connection,到/var/log/auth.log看,好像是PAM的關係..
@_@.. 怎麼這麼複雜...
update..

由於letoh 的協助(詳見"留言"),我去download了 1.5G 版本的debian image (正確的說是1.6G)。
一樣,照著安裝,然後把 sources.list的 unstable 改成 stable 後,就可以安裝ssh 了。

如果不把unstable 改成stable的話,連裝個vim 都會出現e2fsprogs 的問題喔。

看看這個1.5G版本的root image,sourcces.list有一個不一樣:
deb http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free
跟openssh 的安裝網頁說得一樣,要加上non-us site。
所以apt-cache search 可以看到ssh (openssh)。 這樣也就可以安裝 sshd了。

在此感謝letoh的協助。

其他相關的還有..

sudo : 安裝完sudo 後,要
 export VISUAL="vi"
然後用visudo 編輯..
User_Alias ADMINS = charles
ADMINS ALL=ALL
將charles 加入admin中。
然後sudo 會出現cannot resolve.. gethostbyname..要新增一個 /etc/hosts 內含..
 127.0.0.1  colinux
還要把charles加到root group (?)

lynx 不能連出去,因為dns和proxy都沒設, proxy要設是用環境變數:
 export http_proxy="http://10.1.1.242:3128"
如果嫌麻煩,可以寫在home的.profile中。

這一個rootfs真的和loteh說的一樣,沒有shadow password,要轉成使用shadow,follow letoh 的說明:
#touch shadow
#pwconv
這樣pwconv就會將password convert成shadow。

使用這一個 rootfs ,也可以follow letoh's instruction,改為 testing,然後用 apt-get update,apt-get dist-upgrade 升級到testing。
但是 non-us 和 security 都還是stable,否則會找不到feed。
過程中有找不到feed得情況,不知道是連線中斷還是真的找不到,加上 --fix-missing 後OK。
--是連線的問題,在 X32上就OK。

Root Disk size太小,Tony 找到windows mode tools - toporesize.
http://www.henrynestler.com/colinux/tools/

11.19.2006

gmail new "function" ? track DHL


只要在mail 中出現9位數字,右邊就會出現 "Track DHL package"。

SigmaDesigns

業務經理
徐偉強
0935595824

周文國
0922970982

美商SigmaDesigns
台北縣汐止新台五路一段79號8樓5之8 (遠東世界中心C棟)
02-2698-2066

系統設計顧問
鄭博文
0910092512

11.17.2006

另一個web msg 的選擇


叫 wablet ,也是綜合式的,提供web base 的login 和管理介面,和其他web base messager不一樣的的地方是 提供一個 link,可以貼在自己的網頁上,讓人可以經由wablet 連上你,不用特地去開啟msn。

Install GIVEIO.SYS in XP

Nelson try 出來GiveIO 在XP上的 安裝方式:
安裝順序 giveioio.inf

For Windows* 2000, use the following procedure:
1) Login as administrator
2) Copy the giveio.sys file to %systemroot%\system32\drivers.
3) Choose Control Panel, and choose Add/Remove Hardware.
4) Select 'Add/Troubleshoot a device'
5) Select 'Add a new device' and choose Next, and select 'No, I want to select the hardware from a list'
6) Select Other devices and choose 'Have Disk...'.
7) Choose 'Browse...', locate the folder where giveio.inf file.
8) Complete the remained process.

實際安裝流程
1) Login as administrator
2) Copy the giveio.sys file to C:\WINDOWS\system32\drivers.
3) 開啟控制台 -> 新增硬體 -> 下一步 -> 是,我已連結硬體 -> 新增硬體裝置 ->
安裝我從清單中手動選取的硬體(建議選項)(M) -> 下一步 ->連接埠(COM和LPT) ->
從磁片安裝 -> 從磁片安裝(選擇gvioio.inf ) -> 下一步 完成
原來以前2000的instdrv已經不能用了。

SVN . add files and reverse back

CE 的source 實在太多了,obj (lib) 和source 又都混在一起,所以要用version control實在很麻煩。

把全部都check-in 幾乎不可能。
所以想...當有修改時,再把那個file check-in。
但是這樣又會有問題,因為revision 無法回溯修改,所以若是reverse (update) back,會造成後來加入的file 被刪除。
這樣跟我要的動作不符。


原project 中有10 files : 1 ~ 10.

先將1,2 加入,commit。 - 1
modify 1,commit。 - 2
將3加入,commit。 - 3
modify 3,commit。- 4
將4加入,commit。 - 5

reverse back to revision 2,導致 3, 4 被detect 掉。
所以要手動將一個file,一個file的 "reverse back to revision .. 當初加入的revision"。
然後..再commit一次,這一次commit算是重新tag 一次file。

之後,要回到以前的state,就reverse 到這個revision,然後依照需要再手動update 個別的file .... ? 這還不是一樣 ?

所以?還是全部check in 好啦 !! (?)

11.15.2006

build platform and Version control

CE的建構環境很糟糕,source, obj, lib, configure file 都混在一起,所以沒有辦法和versioncontrol 配合得很好。

像linux 平台的package (甚至linux kernel),source 和 working directory 是分開的,所以在commit 時,可以很清楚的將整個source directory 都commit 進去。commit 時也不會花很多時間filter binary file。

Private folder won't auto build..

在Catalog 新增Battery Driver後,"build and sysgen" 或 "Build and sysgen current BSP" 都出現coredll.def 中export 的幾個 Battery Relative Function unsolved.

rebuild BSP driver中Battery driver部份,說 找不到coredll.dll (因為上次沒有build成功)。

這時候,要到 private\....\core 下,build -c,force rebuild。

之後,再 sysgen 就 OK了。

當初由PowerManagement Miminum 改到Full時也一樣,build backlight driver時一直complain找不到 GetSystemPowerStatusEx2 ,一樣,rebuild core 後OK。

再到bsp 的battery driver處build也ok (其實這一步已經不用作了)。

所以,如果有新增category item,但是sysgen 卻complain 該item的function 找不到,大概就是要手動到 coredll 去build...

11.14.2006

Use SVN for Personal SourceCode control

其實自己寫code也有版本控制需求,否則一天到晚copy rename 也很浪費時間(空間),但是用到VSS又有點麻煩,也不適合個人使用。所以就用SVN。
安裝部份,為了怕麻煩,所以裝SVN就好,不裝apache。ref link : http://blog.yam.com/jaceju/archives/2150759.html
(為了避免lost,已將內容copy 到notes中)

安裝svn-win32-1.4.2
安裝其實很linux style,就是解開zip,放到硬碟裡,然後把folder的bin 加到系統的path中。
為了將repository folder區分開來,所以新增一個folder: C:\Repository,用來存放d repository用。

因為沒有安裝apache,所以create repository 都要用command line:
到C:\Repository下,svnadmin create test01
這樣就create一個"test01"的repository。

在C:\Repository下會產生一個test01 folder,conf folder裡面會有一些設定:
svnserv.conf , passwd, authz. 每個repository 都可以分別設定r/w權限。

client端為了方便,可以安裝TortoiseSVN,安裝完後,會跟shell整合在一起,所以用起來比較方便,但是shell 反應會比較慢。
使用上..

CE 中最常變更的就是platform 下的*.bib, *.reg。

  • 在repostory create mimicpc folder (project). 修改conf 下檔站,設好權限。
  • 在WINCE500 右鍵, checkout 選 svn://localhost/mimicpc
    這時候只有將WINCE500 和 mimicpc repository sync,沒有加入任何source。
  • 到WINCE500,對platform 右鍵,選"Add" 之後再"Commit",會等一陣子,將WINCE500下所有sorce都列出,讓你選擇實際要Add 的哪幾個file。
    可以選deselect all,然後再將platform.bib check - 這樣就只有platform.bib會被 commit。不用將整個folder都checkin。
  • SVN會將該folder的root folder 也 commit in,也就是說會perserve source hierichy。
之後,只要每次有修改source前,就把該file "Add" 就可以。
每次build success 也不要忘記 commit。

這樣,就可以任意修改,也可以隨時找回任一次的修改內容。

* 這樣作有一個壞處,因為file 是一點一點加進去的,SVN 會紀錄file加進去的時機,所以如果回到某一個file 還沒加進去的revision,SVN反而會把那一個file 刪掉。

如果是這樣,就要手動,用View Repository 把那個file "save as" 回來... 當然,你要知道有哪些file被刪掉才行。



採用incremental approach 開發(修改),每次修改一個不在svn control 的source時,記得將他Add and Commit 一次",之後修改過N次都不用處理,直到某一function 完成(build and test OK) 時,才將整個project commit。


有時候,update folder 時會出現"Not Authorize to open root of edit operation"。
這是一個buf,只要在該reposfitory folder的conf\svnserve.conf 中,有:
 anon-access = read
允許anonymouse read,同時在conf\authz 中[\] 有
 * = r
允許guest read,就會出現這個message。
所以..把svnserv.conf中anon-access=read comment掉就可以。
但是注意,[\]要加入 " * = r "

要將某個file 回到前面的revision:
  • 用 "Show Log" 列出 該file相關的revision history
  • 選擇你要的revision
  • 然後 "Revert to this revision"
這樣該file 就會顯示"not sync" (modified) 的狀態,如果要回到最新,要用"revert"。

要到任一個revision,一樣,用Show Log,然後 update to the revision

MEMO - Timer 相關..

搞了這麼久,好像又回到原點。
難道是 active thread number ?
還是 timer timeup ?
還是 memory usage ?

今天try一下timer有關的issue..

  1. RTC ? poweroff時停止RTC,PowerOn時回存。
  2. timer ? suspend時還繼續動作嗎?如果有,stop, save value, restore on resume.
  3. ? trace GetTickCount( ) code ?
  4. reschedule, schedule time-slice consume (?)

但是實際作還是...growup.. 從tinykernel 開始加東西...
from mimicpcXX 的codebase 開始 (修改過kernel, 加入monitor kernel thread..和poweroff button 偵測)。

11.13.2006

GPIO (Input) Driver : Automatic Singal on Interrupt

今天Jerry 寄了一個 gpio driver給我看,是很有趣的作法,這是作input用的GPIO。

一般 driver implement read function ,然後用polling 的方式,
這個driver則implement Write function ,
write 要接收signal 的process 的pid,然後driver在detect 到gpio pin level change 就會signal 該pid。


該gpio (實際上應該只有gpinput)的source 約略是:

module input function :
 program 好peripherial register,設定好pin function--
....
reguest_irq(IRQ_GPIO, gpinput_handler, SA_INTERRUPT, "gpinput");
interrupt handler 的內容是:
 偵測input pin..
if (pin0)
sys_kill(targetpid, SIGUSR1);
else if(pin1)
sys_kill(targetpid, SIGUSR2);
else if(pin2)
sys_kill(targetpid, SIGUSER3);
else...
targetpid 這個variale是由 write operation 設定的..
  ....
targetpid = atoi(buffer);
....
實際上IOCTL 的argument "buffer" 不能直接拿來用,要先copy_from_user( )複製到kernal space後,才能存取,atoi 也要用kernel 的funciton ,不能直接呼叫。


配合這樣的driver就可以先set sig hanelder,再用
 file = open("/dev/gpinput",O_RDRW);

char pidstr[20];
itoa(pidstr, getpid());
write(file, pidstr, strlen(pidstr));
來接收gpinput 送出的signal了。

完全用GNU/Linux工作

這裡看到的文章,大部分還好,有同感的是這段:
最重要的是,你用慣了的UNIX工具,它們可以伴隨你一生,而不會那麼容易變化或消失。你可以永遠不用再換另外的工具了。除非那個工具比你這個好的太多,而且可以完全模擬你現在的工具。

我們實驗室一個60多歲的老師,用vi, cc, make, ...都幾十年了,他以前的經驗絕對沒有白費,而且教會了我們一批又一批的學生。vi 伴隨著 UNIX 的最初發行而誕生,直到今天還是世界上頭兩號編輯器之一!有些人的 FVWM 配置文件已經用了 10 多年,現在完全不經修改還可以用。

看看 Windows 的工具,你從 Borland C++ 換到 VC, 就必需適應新的環境:菜單不同了,顏色不同了,按鈕不同了,幫助信息不同了,熱鍵不同了,編譯器參數,調試器功能也不同了,...... 那個時候恐怕花要花你很多時間去適應。當你剛剛適應了 VC, 你又要換成 VJ, PowerBuilder, C++Builder, ...

很多windows程序員都是這樣,開頭在dos下用Turbo C, 然後是 Borland C, VC, C++ Builder, ......不斷追趕微軟的潮流。而且微軟的SDK, MFC, .NET ...... 什麼都在不斷變化,不斷出問題,又不斷的在修改...... Windows 程序員不得不買又厚又重的 Microsoft Press 的書籍,看了才一個月,又過時了。今天你才學會了寫 VxD,明天你就必須用 WDM 了。你不得不註冊 MSDN 才能趕上 Microsoft 的步伐。很多人說:"計算機是貴族的專業。" 這就是微軟一手造成的。

這些東西才是沒完沒了的浪費大家的時間和金錢的。這是是浪費生命!我們為什麼不使用從誕生就那麼一致和完美的 UNIX?你需要理解先進工具的設計理念。UNIX 的工具就像我們用的汽車,它的離合器,油門,剎車,方向盤,後視鏡,永遠都在同樣的位置。用慣了的話,你對你的汽車的每一個部件都會瞭如指掌,甚至你自己都可以修車了。這難道不好嗎?
用MS的IDE,熟習的速度比不上IDE改版的速度,而每次改版,可以沿用的東西也不多。有改得比較好嗎? 也沒有 (應該說是原來做得太爛了)。 所以software programmer(對,programmer,也就是真正動手coding的人) 投資生命在MS上真是一項浪費。

那你就不要用MS呀!

也沒辦法,因為coding 的人不做MS沒有飯吃 Q_Q

11.12.2006

天哪...男的不帥,女的不美,劇情不知所云.... 這 是在作辛酸的?

11.10.2006

La Fonera is comming

親愛的HEMIDEMI朋友們,

在此要向所有熱愛 FON的朋友們致歉。

謝謝您們之前以行動支持FON社群,我們將如之前所承諾的,免費贈送一台La Fonera無線路由器!
也將在 12月初FON 台灣中文網站正式成立時,就會開始寄送La Fonera給大家。

謝謝您們的耐心等候及對FON的支持!

想知道fon在台灣的的最新消息,請點閱我們已恢復運作的部落格 http://blog.yam.com/twfon

FON Taiwan
本來以為大概沒有了,反正當初沒想到真的會得到。
結果,還真的會送勒。

Lucky !

iThome about FON ...

iThome 說有關FON :
不過,某些網路服務供應商認為用戶如果在未經同意下,加入FON社群並分享自己的頻寬,可能違反服務協議。例如Time Warner cable發言人Maureen Huff便指出,這跟小偷無異,就好像Cable用戶把線分給隔壁鄰居,以讓鄰居可以看免費電影一樣,很明顯是不對的行為。

Maureen Huff還說,如果發現有用戶非法分享頻寬,那麼該公司可能會切斷其網路服務。
這根本跟看第四台不一樣,我們申請ADSL是買"頻寬"。又不是買內容(音樂,電影)。
ISP怎能規定我裝ADSL是要給自己用 還是好心的給隔壁用。

這樣的比喻根本不對。

Computer Hangs After 49.7 Days

這大概是很古老的問題,但是為發生也蠻有趣的,在 MS的 knowedge base
有人的pc持續工作49天後,就停止工作了(當機,沒反應)。

回答:

這是Vtdapi.vxd 造成的,換掉這個VXD就可以了。

真有趣,為甚麼是49天呢?

因為Windows有一個system api :
DWORD GetTickCount(void)
會傳回從開機開始,每1 ms +1的 tick count, DWORD 的最大值是..

4,294,967.296 s = 71582.78827 min = 1193.046471 hr = 49.7103 days

所以....過了49天後,這個值就歸0了... 這就是當機的原因 @_@

這個題目在2004年好像很熱門,google一下就可以知道,有些甚至牽拖到LA機場管制49天當機的事件上。(據說當時機器是使用Windows)。

GetTickCount( ) 是一個popular 的function (?),尤其是在embedded system上,目前在CE上還是有這個function 可以用,也有同樣的問題: 49 天overflow。

所以CE blog有特別說出這個function 的使用方法: 用來計算差值,不要拿絕對值來使用。
也就是說,像以下這樣,用vu:
DWORD starttime = GetTickCount();
.....
.....
if( GetTickCount( ) - starttime >100)
dosomething...
就不會有roll over問題,
因為 unsigned :
0 - 0xFFFFFFFF = 1
所以,只要不要超過49x2天(約),計算上就不會有問題。

CE 系統為了讓"粗心"的programmer 及早發現這個問題,
將GetTickCount( )的初始值設在2 min 後overflow。
所以 如果你的機器 發生 "謎樣的2 min 死亡" 事件,就該查察 是否有哪裡 用了 GetTickCount( )這個function 了。

但是... 10 sec 當機的原因是什麼?

11.09.2006

Difference #4: Kernel / OAL Separation

CE6 有一項對OEM而言,很大的進步, 但對application developers 來說沒有影響.
在 CE5 , kernel 和OAL 是Link 在一起,成 nk.exe.
CE6 將二者分開成 oal.exe (which ends up getting renamed to nk.exe) 和 kernel.dll.
另外 Kernel Independent Transport Layer (KITL) 也獨立成 kitl.dll.
這樣的改變要是為了讓Update 更方便,
以往當MS release一個kernel patch,OEM 必須要重新link整個nk.exe.
現在 OEM 只要換掉image中的 kernel.dll 就好了.
另外一個好處是,統一規定了 kernel, OAL 和 KITL 間的介面.
這三個components藉由交換 function pointers ,variable values table 讓彼此呼叫對方提供的function.

We tried to simplify this change as much as possible, to ease porting of CE5 OALs to CE6. We hid the existence of the function pointer tables inside wrapper functions that the OAL can use, so that exactly the same set of functions are available to the OAL. Anecdotal experience from our beta partners said that BSP porting to CE6 took them mostly between one day and one month. Travis Hobrla, a member of our BSP team, developed an awesome demo for MEDC 2006 (Mobile & Embedded DevCon) where he ported the CE5 CEPC OAL to CE6 in about 15 minutes. If you are an OEM, your experiences may vary, but we don’t anticipate it being too painful. It was our goal to make it an easy port. The main area where people will have to make big changes is if their OAL called kernel APIs that we did not intend to expose to the OAL. Since in CE5 the kernel and OAL were linked together, some people found that they could call kernel functions if they knew the function signatures (which they could get from our shared source code). In CE6 those people will have to move that functionality out of the OAL, into a kernel mode driver.

11.08.2006

Linux base, Open platform Mobile Phone by FIC


FIC (大眾?) 推出Linux Base 的GSM Phone (?)。
今天LinuxDeviceEngagedSlashGear 的新聞,雖然說得跟真的一樣,但是只有圖片,沒有實機照,SlashGear竟然還有一些fancy的User interface instructions:

這有點像是Apple的touchpad專利。

據LinuxDevice.com的報導,FIC 這隻手機預計採用雙系統,可以選擇Windows Mobile或是Linux OpenMoKo。
OpenMoKo是"Open Source In Mobile"的一個計畫。(但是卻google不到任何消息)
採用雙OS的原因是可以降低Cost,大概是因為光出Linux Phone的量不會很大吧,由於OpenMoKo必須用 open source 的application ,所以Neo 1973 出貨時只有內建一些基本的application,像撥號軟體,SMS, mail agent..,user 買回家後,可以用類似OpenZaurus, familiar Linux的apt-get 的安裝介面,由Feed安裝程式,據說大部分OpenZaurus, familiar Linux的package都可以安裝。

FIC希望藉由OpenMoKo做出像Nokia的Maemo platform一樣的ecosystem。FIC會直接銷售Neo 1973,讓客戶自行選擇營運商(也就是SIM card)。

Hardware :
  • S3C2410
  • 128M RAM/64M Flash
  • 2.8" VGA touch screen
  • A-GPS
  • 雙頻GSM/GPRS module (FIC 自己做的,TI ARM 7 + Nucleus offer standard UART AT command)
  • 可由USB充電
  • MicroSD (up to 1G)
OpenMoKo:
  • Linux 2.6.17 (to be 18)
  • GTK+ 2.x
OpenMoKo有對Linux Kernel 作patch,加上GSM multiplexing (也就是同時在radio 封包上承載voice/data 資料)的能力。

Neo 1973 base on OpenMoKo,將release所有的interface,SDK,供User Customize。是一個Open system的手機。

繼GreenPhone後又一個Open platform手機,希望真的可以買得到...

Update :

OpenMoKo : http://www.openmoko.com/press/index.html

該去download他的presentatio pdf,,,,
"a phone for a true geek , think they can change the world with technology"
"Wooh ! a Absolute Open Phone."

OpenMoKo 建在 X11, GTK+ 2上,kdriver上。提供 core, net , UI, PIM 幾個 application framework。
當然,也可以run x11 的application。

該手機的概念在利用完全open 的平台提供既有的Linux application和大量的 open source programmer (geeker)在上面工作。

後續:

知名人士的猜測,從規格和目前已經血流成河的手機市場來看,這個產品應該只是為了創造話題。搭上最近熱門的 linux 熱潮。 實際會不會上市,還不一定。

NAND Flash

NAND Flash 使用類似HD一樣的操作方式來動作,他和MCU 的interface是 8(some use 16) 條 command/Data/Address 控制線(稱為IO),配上CLE/ALE/CE/RE/WE 控制線來辨別目前IO 傳遞的內容。

NAND Flash 內存放資料的方式,也和HD類似,是以塊狀的方式存放,但是和HD不一樣的是,NAND Flash 保有Nor Flash 的特性,只能一塊一塊的erase。

NAND Flash 內的儲存單位有一些名稱:

Block : 最大的單位,也是erase的單位。
Pages: 內部buffer讀取的單位,一個Block有64 個Pages。

一個Page 內含 2k Bytes 的一般data,和額外64 bytes 的輔助資料空間。
雖然有這樣的區分,但是實際上2k和64 bytes之間並沒有區動作,64 byte的功能是讓programmer自行運用的。一般用來存放ECC,或是wearing 資料..
NAND Flash 內部和HD一樣 有一個buffer,buffer大小剛好是一個pages,buffer作為NAND Flash 內部儲存元件與外界溝通的空間,所有 data I/O 動作都要藉由buffer完成:
  • 讀取動作:下command要求buffer將某一pages的內容讀入buffer,MCU再一一將buffer的資料讀出。
  • 寫入動作:先告訴buffer要作write動作,接著輸入1個page的資料,完成後,請buffer將資料寫入(某一)page。
和NOR Flash 一樣,寫入的動作需要先作erase,Erase將所有data bit社為1,program是把bit 清為0。
programming guid 有說明:也可以不做erase 動作,只要你知道你要寫入的區域都是1111..也就是未曾使用過的區域。
同樣的,寫入資料時,"1"應視為"don't change",也就是不改變該bit內容的意思。
MCU Interface Protocol

如前所述,靠著CLE/ALE/RE/WE 來決定IOx8 的內容
  • CLE : Command Latch Enable - 目前IOx8的內容是command
  • ALE:Address Latch Enable - 目前IOx8的內容是Address
  • RE : Read Enable - 目前IOx8 作read 動作
  • WE: Write Enable - 目前IOx8 作write動作
RE/WE除了指示IOx8 的"方向"外,同時作 latch 的signal。
Protocol 區分為以下幾段:
  1. Command : 送出Command Code,表示目前的操作
  2. Address : 該Command 操作的 Address
  3. Data : 資料
  4. Command : 第二個command,通常代表command確認,結束。
不是所有的動作都需要有這四段,有些動作不需要Address,有些不需要Data。

Address

Address的指定方式和內部構造一樣,分為 Block Index (address), Pages Index (address) 和 Byte Address。 分別指定:第幾個Block,該Block中的第幾個Pages,和該Page中的第幾個Byte。
由於IO只有8條,所以address要分成多次輸入:
  1. Byte Address 0-7
  2. Byte Address 8-11
  3. Page Address 0-5 + Block Address 0 -1
  4. Block Address 2-9
  5. Block Address 10
這5個Address不是每一個command都需要,有些需要1, 2,有些需要4,5,有些command不需要Address資料。

以下針對各動作的protocol說明

Read
  1. 送出Command 00h
  2. 送出要讀取的Address ,如:的3個block,的100個pages的第34 bytes開始。-
  3. 送出Command 30h - Read Confirm
  4. 等NAND buffer將該page的資料讀進buffer中
  5. 每一個RE依序輸出一個byte的資料,從Address指定的位置開始,可以讀任意個,但是只能在同一個page中,當讀取超出該page時,會讀到錯的資料。
Random Read

在剛剛的Read 過程中,RE輸出data的階段,如果想跳到同一個pages的其他位置去讀取,可以在用 Command 05 插入RE的讀取動作中,修改讀取的address:
  1. RE.....
  2. Command 05h
  3. Address - 2 cycles就可以,因為限定在同一個page中,所以不用送pages 和block address。
  4. Command E0h - Confirm
  5. RE...從新的位置開始讀取...
Write (Program)

和Read 類似,對整個page動作:
  1. Command 80h
  2. Address - 5 cycles, 指定從block-pages-start address開始..
  3. Data - 開始輸入要write的資料, WE clock..依次輸入...
  4. Command 10h - Confirm
Command 80h 會將NAND Flash 內部的buffer 清為FFh,接下來的Address,代表你要對從哪一個Block的哪一個page的哪一個位址開始"修改資料",然後data cycle 就開始從那個位置開始將buffer的data update成你輸入的data。
Random input

和Random Read一樣,在輸入資料的階段 WR...,可以用Command 85 + 2 Address cycle 改變要輸入的位址,接著繼續輸入資料。


以上可以看出 NAND Flash 內部buffer有一個pointer,代表buffer R/W的位址,每次R/W後會自動+1, 85h command就是更動該pointer資料的command。
Technorati 要的Claim Link : Technorati Profile...待會刪掉..

11.07.2006

Program 的execution image : EXE, DLL, STACK, HEAP, UNUSED..
沒有virtual memory 的machine,因為各section 內不可中斷,所以一些object (DLL, heap) unload, load 後,就會出現memory fragementation。

section 內不可中斷: STACK 內用來存放stack ,當STACK用"滿"時,也就是pointer 頂到了在他前面的DLL section,不可能跳過這些區域,由未使用的UNUSED section 中,再找一塊memory 出來,當作是STACK,繼續工作。因為UNUSED Section 和STACK Section 並不連續,stack pointer沒辦法工作。

範例是用DLL來作比喻:假設DLL section load有兩個DLL : DLL1, DLL2,當DLL2 不需要使用了,program unload DLL2,然後load另一個DLL : DLL3,如果DLL 3 < DLL2,則可以順利的load到原DLL 2 空出來的區域,但是當DLL3 > DLL2時,DLL2 空出來的區域就浪費掉了。

使用virtial memory 的machine,同樣的 execution image : memory 的管理以4k 為單位,可以任意mapping到pysical memory中,所以即使physical memory 上兩塊不連續的區域,都可以藉由virtial memory translation 讓他們在virutal memory space中是連續的(一個接在另一個的後面),所以memory fragementation 最大不會超過4k。

11.06.2006

sysgen ,,, build - 不會作platform.bat 的dependent check

CEBUILD 有一個custom platform prebuild bat : <platform_name>.bat

這個bat檔會在所有build動作之前執行,所以會被用來宣告很多define, undefine function。
platform src 再follow 這個define 作condition compile。

但是

很愚蠢的是...如果修改了這個 bat 檔,執行sysgen (當然不會build)和用command line到 platform Src 下任何一個folder 作 "build" 動作,該 build program 並不會 "察覺" 到 batch file已經變更,必須要要compile source。

所以,必須要"手動",到改動batch file 相關定義有關的地方下 "build -c" (-c 是force clean),強制re compile,才行。

也就是說... source depnendency 是手動check 的 ( !!!! 沒有source depnendency check,加上close source, ... 又有人說"Build and Sysgen" + check "Clean befor Build" 會讓private folder的code掛掉 !!! 那,programmer又怎能保證 source module間的一致 ???? )


據Robert 所說,platform..bat 內所設定的environment variable 只和platform folder內的source code有關係,所以修改過 platform ...bat後,到platform 下作"build -c" 才是最保險的作法。

再來,build 只有作compile,沒有link,所以做完build -c 後,要sysgen重新link

OEMIoControl

debug 時,log 有:
OEMIoControl: Unsupported Code 0x10100fc - device 0x0101 func 63
所以查一下 OEMIoControl: http://msdn.microsoft.com/library/
default.asp?url=/library/en-us/wcedsn40/html/cmrefOEMIoControl.asp

OEMIoControl是OAL implement的,當 device driver或application 呼叫 KernelIoControl( )這個Kernel Sevice Function 時,kernel就會呼叫OEMIoControl,另外,SystemParametersInfo( )這個function call 也會呼叫OEMIoControl( ),由OAL 負責傳回system information。

既然名稱是IOCTL,參數也跟Linux 的IOCTRL一樣,是用function number配上structure pointer來傳遞參數。

OEMIoControl 是OAL 實做的,不是device driver,device driver。Device Driver實做的Io Control會是 Dll export的介面,不需要由kernel 呼叫。

Wiindows CE 6.0 Open Source (?)

今天在 jservOpen Source 新聞看到這個消息: CE 6.0 將開放原始碼。

開放的Source Code有多少呢? 依照 jserv 文章的link到 WindowsForDevice.com 的文章看,是 100 % (!)。但是其他的新聞都沒有說明是100%,只有說是比5.0多56%。

WindowsForDevice.com 的說明比較仔細,share source code只要在VS (6.0 的Platform builder 已經成為Visual Studio 2005的一個plug-in)的catalog item,如果該item是"private",則會出現一個License Agreement dialog要求你確認。
-- 所以,不用像5.0一樣要到MS網站去申請( 還不知道什麼時候會回覆)。

依照說明,open 的方式是BSD-like,也就是說,可以任意修改,不必附source code給customer,也不用 "交回" MS。 但是 jserv說,該license尚未獲得 OSI 認可。

c|net也有新聞說明 6.0 open source ,並且說是"完全" 開放。新聞中有一句話:

WinCE嵌入式系統產品平均開發時間為8個月,若以Linux開發則平均得拉長至14個月;此外WinCE具有各式各樣的模組,在Linux上可能得自行開發或另外授權,事實上Linux不見得免費或比較便宜,嵌入式系統廠商必須以上市時間等整體開發成本為考量。
如果embedded system design 就像一般軟體樣,只要東西拉一拉, build, rom 化 就OK的話,他說得倒是不錯。但是 embedded system 花最多時間的地方是在處理embedded system 的hardware 限制上,產品的prototype是很快,但是debug時間就要很長,當然你也可以就接受產品有那麼點defect,然後就上市,但是那看起來就會是有點"半吊子"的東西。

而在Debug 的時後,有source code跟沒source code的差別 有多大,應該是不用說明了,沒有source code 的東西,就算有一堆文件,也比不上有source code的東西 來的好用。
這一點有多重要?我有一次面試一家CE base 產品的公司,唯一的題目就是"一個沒有source code的東西如果有問題,要怎麼作 ? "

-- 我還真不知道怎麼作呢,只有一次同事使用pSXS的經驗,利用proxy + snipper 找出原來問題在pSXS沒有open 出來的IP Stack 上。還有一次用sample clip 證明是vendor 沒有release出來的decoder的問題,還有用B廠家的code+A廠家的library 輸出debug message,證明A vendor沒有release的module中parameter有錯誤。

但是證明了問題出在沒有open source的code上,新的感覺是如何呢?
當然是非常,非常的不好。
覺得浪費了自己的生命在非常無聊的事情上,
尤其是知道世界上有open 的source code有一大堆都研究不完了,
卻還要浪費生命為這些寫的爛又不release的code作debug.....
但是source open 出來終算是好事一件,光是這一點就想趕快切到6.0去。否則,依照慣例,MS的產品至少要到QFE出了兩月份後才能用。
這一篇,很明顯的,是一篇抱怨文 :P

11.02.2006

Usefule EXE in "SDK\BIN\I386"

CE的 "\SDK\BIN\I386" 里有很多有用的program,像errlook.exe就是error code的翻譯程式,當執行win32 program出現error code時,輸入error code,就會顯示eror code的名稱(中文的喔)。
像 執行 remote debug 時出現 Error Code : 126,查的結果是:"找不到指定的模組"。

Suspend/Resume

Suspend 狀態是將 CPU 中,所有週邊和cpu core的clock ,power 都停掉,只留下
  • DRAM refresh
  • RTC
  • INT
三個部份還有動作,這樣的目的是要減少電源消耗,同時盡量維持執行狀態。
讓裝置回到正常狀態的方式有
  • 外部中斷
  • RTC TimerUp (也是中斷)
從PowerOff中恢復後,要盡量讓系統回到當初power Off的狀態。

Suspend/Recover的動作有一點像Task Switch,就是Stack Frame的操作:在斷電前將StackFrame保存在固定的地方,Recover時到那個地方拿回Stack Frame回存,動作跟TaskSwitch一模一樣。

CE 的Suspend/Resume 動作 需要driver的配合,所以所有Driver都要implement (and export) PowerUp/PowerDown function。另外GUI 的部份也要response to WM_XX 這個power state change message。

在PUBLIC\COMMON\OAK\DRIVERS\PM\MDD\pmresume.cpp 的comment中有說明:
Application (Drvier) 中不可以直接呼叫 PowerOffSystem( )來suspend system,要藉由 SetSystemPowerState ( ) 這個 Win32 funtion 來轉換 power status 到 suspend/resume 狀態才行。 因為 SetSystemPowerState( ) 在呼叫PowerOffSystem( ) 之前,還會呼叫PM 的function 一一呼叫所有Device 的 PowerOn/PowerDown function,還會post necessary message to GWES server,最後才呼叫PowerOffSystem( )將所有cpu core關閉。
SetSystemPowerState()是一個手套,會去呼叫PlatformSetSystemPowerState(),

11.01.2006

CEC 和Platform Builder

PUBLIC\COMMON\OAK\CATALOG\ 目錄下都是PlatformBuilder 使用的設定資料。
  • CEC : 所有的 *.cec 檔案,所有import 進platform builder的cec都會有一份備份在這裡。這些cec file 可以作為create cec 物件的參考。
  • NewPlatformWizard : PlatformBuilder - New Platform 時幾個building template 的內容,在這些file中可以看出各template額外設定的Build Option, SYSGEN Variable。這些都是在platform builder中看不到的(尤其是SYSGEN_XXX變數)。
*.CEC是platform builder的元件定義檔(其實也很不完全,只有定義出一些該元件需要的資料),在Platform Builder中提供CEC Edit 工具來修改,Create CEC檔。

Goupe 的階層在CEC中使用類似目錄字串的方式表示(以"\"區分)。

CEC Editor的使用很不直觀,有些是要新增,修改property後,該item才會重新"落"在適當的階層下。還有先找個"地方"新增item完後,再edit property,或是按右鍵,讓隸屬於某一個item (造成item dependency)。

"Parent Node Require This Groupe" 就是dependency (?)

使用CEC Editor時,可以開啟一個複雜的CEC,然後New一個測試 File,用"右鍵"試試使用方法。

這個功能比較有用的地方在於 能知道 Catalog 中item 與該source code所在位置。(Catalog與SYSGEN_VAR 的關係在PB中就會自動顯示)。

由於 各Item間有dependency存在,所以在 Edit Platform時,有時後只有選一個item,卻有很多其他item被自動加入,這是PlatformBuilder依照該Item的dependency自動加進去的,在Platform Builder的 OSDesignView中有小小的icon,可以用來區分這是你選擇加入的還是因為depends on other item而被加入的:

上面兩個圖示,一個下面有小小的紅色檢箭頭就是你選擇加入的,沒有小小箭頭的就是因為dependency 加入的。

Workspace的description file : *.pbxml 只有紀錄 你選擇加入的item,dependent item沒有紀錄,但是在每次open Workspace時,platform builder會再自動依照該item 的CEC描述加入需要的item。
(所以修改過CEC file,要重新open一次workspace)