DCON Testing/lang-ko: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 3: Line 3:
이 페이지는 오픈 펌웨어가 [[DCON]]과 작동하는 방법을 설명합니다. 자세한 사항은 [[Open Firmware|오픈 펌웨어]]와 [[OFW FAQ]]를 참조하십시오.
이 페이지는 오픈 펌웨어가 [[DCON]]과 작동하는 방법을 설명합니다. 자세한 사항은 [[Open Firmware|오픈 펌웨어]]와 [[OFW FAQ]]를 참조하십시오.


집중적인 디버깅을 위해, 저는 시리얼 컨솔를 사용하여 로그 결과를 파일에 오려 붙이는 것을 추천합니다. 시리얼 컨솔을 얻는 가장 쉬운 방법은 키보드를 빼 놓으면 됩니다. 잊었으면, "com1 io" 를 타이핑하면, 시리얼로 넘어갑니다. 세팅은 8,n,1 no flow control 입니다.
집중적인 디버깅을 위해, 저는 시리얼 컨솔를 사용하여 로그 결과를 파일에 오려 붙이는 것을 추천합니다. 시리얼 컨솔을 얻는 가장 쉬운 방법은 키보드를 빼 놓으면 됩니다. 잊었으면, "com1 io" 를 타이핑하면, 시리얼로 넘어갑니다. 세팅은 115200,8,n,1 no flow control 입니다.
== [[FORTH|Forth]]를 위한 일반적 셋업 ==
== [[FORTH|Forth]]를 위한 일반적 셋업 ==



Latest revision as of 02:29, 16 April 2007

  번역근원 DCON Testing 원문  
  english | 한국어   +/- 차이  
  • 참고: 기술적인 자료의 번역을 위해 여러분의 도움을 기대합니다. www.laptop.org 사이트와 이 사이트의 메인 페이지들은 대부분 번역되었으나, 나머지는 한글 요약만을 제공하고 있습니다. 어느 페이지든 추가 번역이 필요하면, XO Korea의 번역 섹션에 메시지를 남겨 주시기 바라며, 모자라는 번역 부분을 채워주실 손길을 기다리고 있습니다.
  • Note: Some core pages have been fully translated, and others are provided with summaries. If you need more translation, please leave a message onto the discussion page of this, or that of XO Korea.


이 페이지는 오픈 펌웨어가 DCON과 작동하는 방법을 설명합니다. 자세한 사항은 오픈 펌웨어OFW FAQ를 참조하십시오.

집중적인 디버깅을 위해, 저는 시리얼 컨솔를 사용하여 로그 결과를 파일에 오려 붙이는 것을 추천합니다. 시리얼 컨솔을 얻는 가장 쉬운 방법은 키보드를 빼 놓으면 됩니다. 잊었으면, "com1 io" 를 타이핑하면, 시리얼로 넘어갑니다. 세팅은 115200,8,n,1 no flow control 입니다.

Forth를 위한 일반적 셋업

To get to FORTH, just hit a key during the 6-second countdown that occurs just before autobooting. If you have a keyboard attached, hit the key thereon; otherwise do it on the serial console. The countdown period begins roughly 12 seconds after reset; the count is displayed on the console.

Note that with this method, by the time that you get to the FORTH prompt, the devices, including DCON, the screen, and the USB subsystem, have already been probed and initialized. So if you need to alter the normal probe/init sequence, you'll need to use the early debug method below.

Forth로의 이른 접근

To get to Forth as early as possible so you can debug device startup problems, you must use a serial console, and you must be quick. Reset the target board and hover over the 'i' key on the serial console. About 7 seconds after reset, you'll see the message:

Forthmacs Type 'i' to interrupt stand-init sequence

At this point you have 2 seconds to type that 'i' in order to get control. You can type a lot of 'i's if you want.

DCON-specific Tips

The DCON device driver is in the device node /dcon . The DCON driver lets you perform SMBUS accesses to the DCON registers. During normal startup, it is responsible for probing the DCON and doing some initial register setup. Note that the display driver is separate from the DCON driver. To change the patterns displayed on the screen, you would need to use the display driver.

정상 시동 뒤의 DCON 엑세스

If you have used the "Normal startup" method above, to get into the DCON driver and interact with it, type

ok select /dcon

In this scenario, the DCON will have already been initialized during the normal startup sequence. But modulo that prior initialization, you can still play with the DCON and change settings. The commands for that are listed in the DCON Commands section.

이른 DCON 엑세스

If you use the "Early Access to Forth" method, you can get control of the DCON initialization sequence from the outset. Assuming that you are at the early access Forth prompt:

ok dev /dcon ok debug ?version Stepper keys: <space> Down Up Continue Forth Go Help ? See $tring Quit ok resume

The "dev /dcon" command gets you into the namespace of the DCON driver, without actually running any code therein. "debug ?version" attaches the debugger to the "?version" method, which is the first method that actually touches the DCON hardware. It doesn't run the debugger just yet; think of it as setting a breakpoint on the "?version" routine. The "Stepper keys ..." line is a message briefly listing the main debugger keystroke commands. "resume" restarts the OFW startup sequence to initialize any hardware that must be initialized prior to the DCON. You should see several lines of init messages, then:

Install console

?version ( 1e10a1c )

0 []

You are now in the Forth debugger. The [] in the above display shows where the cursor is. The ": ?version ..." line shows that the the debugger has just been entered at the beginning of the "?version" method, and that the stack currently has a single number on it - 0x1e10a1c . The next line, the one that the cursor is on, shows that the next Forth word to be executed is the number "0".


Forth 디버그 구동

The Forth single-step debugger responds to single-key commands. The main ones are:

  • <space> - execute the word to the left of the cursor and stop at the next word, i.e. single-step
  • d - go Down and debug inside the command to the left of the cursor (only works if that command is a colon definition; you can't go down into, for example, a constant)
  • u - go Up, finishing the execution of the word the debugger is attached to, and debug the caller
  • s - See (i.e. decompile) the word you are debugging, so you can look at the context of where you are
  • f - Forth - temporarily suspend the debugger, saving all the context, and go to an ok prompt so you can execute Forth commands
  • g - Go - turn off the debugger and resume normal execution

Memorize Up, Down, Forth, See.

. The next section describes the structure of the DCON init sequence and the DCON-related Forth commands. Armed with that info, you can either continue using the debugger to single-step through the routine, or type 'f' to bail out to the ok prompt and type individual commands.

Forth commands for DCON

Forth stack diagram notation: ( a b -- c ) means that the Forth word expects two arguments "a" and "b" on the stack when it starts execution - "b" on the top of the stack, "a" underneath that. It pops them off the stack, uses them, and pushes a single result "c". Similarly, ( -- ) means no net stack effect - the word doesn't look at anything that is already on the stack, and doesn't leave anything new there.

Low level DCON access primitives

smb-on ( -- ) enables the SMBUS hardware in preparation for DCON register access. It is done automatically when you start the DCON driver, so you probably won't need to run it explicitly.

smb-off ( -- ) disables the SMBUS hardware. You probably won't need to do this explicitly.

dcon@ ( reg# -- w ) pops a register number from the stack, reads that DCON register (via SMBUS), and pushes the 16-bit contents of that register back onto the stack. Example usage:

ok 0 dcon@ . \ Reads DCON register 0. The "." pops the result from the stack and displays it.

dcon! ( w reg# -- w ) pops a register number from the stack, then pops a 16-bit value, and stores that value into that DCON register (via SMBUS). Example usage:

ok e040 3a dcon! \ Writes 0xe040 to DCON register 0x3a. Note that, in OFW, the default number base is hex.

gpio@ ( reg# -- n ) reads the 32-bit value from the GPIO register reg# (reg# is an offset from the GPIO block base address; OFW takes care of adding in the base address so you don't have to worry about what it is).

gpio! ( n reg# -- ) writes a 32-bit value to the GPIO register reg#.

gpio-data@ ( -- n ) reads the GPIO Read Back Low register (0x30), i.e. the one that reads the values of GPIO pins 0-15. "gpio-data@" is equivalent to "30 gpio@". Note that the GPIO setup is complicated, and in order to read a pin value, you have to enable reading it. Fortunately, most of that is taken care of by some canned setup sequences; see dcon-init in a later section.

사전 패키지된 DCON 레지스터 엑세스 단어들

mode! ( mode -- ) sets the DCON mode register (register 1). Example:

ok 69 mode! \ Monochrome mode ok 89 mode! \ Color mode

hres! ( hres -- ) sets the DCON horizontal resolution register (register 2). Examples:

ok 458 hres! \ Sets the horizontal resolution to 0x458 ok d# 1200 hres! \ Note that you can precede a number with "d# " to make it decimal ok h# 458 hres! \ You can also be explicit about the hex interpretation

htotal! ( htotal -- ) sets the DCON horizontal total register (register 3). Example: d# 1256 htotal!

hsync! ( sync -- ) sets the DCON horizontal sync register (register 4). Example: h# 1808 hsync!

vres! ( vres -- ) sets the DCON vertical resolution register (register 5). Example: d# 900 vres!

vtotal! ( htotal -- ) sets the DCON vertical total register (register 6). Example: d# 912 vtotal!

vsync! ( sync -- ) sets the DCON vertical sync register (register 7). Example: h# 403 vsync!

timeout! ( to -- ) sets the DCON timeout register (register 8). Example: ffff timeout!

scanint! ( si -- ) sets the DCON scanint register (register9). Example: 0 scanint!

bright! ( level -- ) sets the brightness level (register 0xa). Example: 0 bright! f bright!

dcon-load ( -- ) sets the 0x800 GPIO bit (the DCONLOAD bit, GPIO bit 11)

dcon-unload ( -- ) clears the 0x800 GPIO bit (the DCONLOAD bit, GPIO bit 11)

dcon-blnk ( -- flag ) returns a flag that is nonzero if the 0x1000 GPIO bit is set (DCONBLNK, GPIO bit 12)

dcon-stat ( -- n ) Returns the DCON status in the 2 LSBs. This reads GPIO bits 5 and 6, and shifts them down to bits 0 and 1 of the return value on the stack.

Canned init sequences

dcon-init ( -- ) sets up a bunch of GPIO control registers so the right bits are inputs and outputs, then executes dcon-load (described above).

dcon-enable ( -- ) turn on the DCON using the "standard" enable sequence, involving accesses to DCON register 0xb, 1, and the SDRAM registers. You can see the exact sequence by typing "see dcon-enable" ("see" is Open Firmware's general-purpose decompiler).

dcon-probe? ( -- flag ) is the overall DCON startup/init method. It returns true if a DCON is present, otherwise false. It is a little complicated because it does things like doing most of the work only once (if you call it a second time it will just return the flag that says whether or not the DCON is there). But the basic sequence is: try to read the DCON ID from register 0. If that works, call dcon-init and dcon-enable .

Merge-arrows.gif
It has been suggested that this article or section be merged with [[:{{{1}}}|{{{1}}}]]. (Discuss)