Mic 的技术点滴:关于linux, wince 6.0...还有其他牢骚 mic's another world http://www.ootroo.com/zblog

发布新日志

  • uboot debug 工具

    2008-07-31 14:02:48

    遇到需要调试uboot的时候,比如,进入睡眠后不能唤醒,或者压根就不能启动的时候,就需要在底层调试:如果你没有jtag调试工具。而且即使有了,有时候未必能用。


    1. 闪烁LCD背光,通过数出闪烁数目,知道停在什么地方
    led_flash:
        mov    r3,#0x01
        mov     r1, r0
    100:      subs    r1, r1, #1
        @delay loop
        mov     r2, #0xf00000
    101:    subs    r2, r2, #1
        bne    101b    

        @flash the led
        ldr    r0, =rGPBDAT
        eor    r3,r3,#0x20    @gpb5
        str    r3,[r0]    
        teq    r1,#0    
        bne     100b    
        mov    pc,lr


    2.
    ----------------------
            .macro addruart, rx
            mrc    p15, 0, \rx, c1, c0
            tst    \rx, #1
            ldreq    \rx, = S3C2440_PA_UART
            ldrne    \rx, = S3C2440_VA_UART
    #if CONFIG_DEBUG_S3C2440_UART != 0
            add    \rx, \rx, #(S3C2440_UART1_OFF * CONFIG_DEBUG_S3C2440_UART)
    #endif
            .endm

            .macro    senduart,rd,rx
            str    \rd, [\rx, # S3C2440_UTXH ]
            .endm

    ------------------
        .macro    busyuart, rd, rx
            ldr    \rd, [ \rx, # S3C2440_UFCON ]
            tst    \rd, #S3C2440_UFCON_FIFOMODE    @ fifo enabled?
            beq    1001f                @
            @ FIFO enabled...
    1003:
            mrc    p15, 0, \rd, c1, c0
            tst    \rd, #1
            addeq    \rd, \rx, #(S3C2440_PA_GPIO - S3C2440_PA_UART)
            addne    \rd, \rx, #(S3C2440_VA_GPIO - S3C2440_VA_UART)
            bic    \rd, \rd, #0xff000
            ldr    \rd, [ \rd, # S3C2440_GSTATUS1 - S3C2440_GPIOREG(0) ]
            and    \rd, \rd, #0x00ff0000
            teq    \rd, #0x00440000        @ is it 2440?

            ldr    \rd, [ \rx, # S3C2440_UFSTAT ]
            moveq    \rd, \rd, lsr #SHIFT_2440TXF
            tst    \rd, #S3C2440_UFSTAT_TXFULL
            bne    1003b
            b    1002f

    1001:
            @ busy waiting for non fifo
            ldr    \rd, [ \rx, # S3C2440_UTRSTAT ]
            tst    \rd, #S3C2440_UTRSTAT_TXFE
            beq    1001b

    1002:        @ exit busyuart
            .endm


    ---------------------
        .macro    waituart,rd,rx

            ldr    \rd, [ \rx, # S3C2440_UFCON ]
            tst    \rd, #S3C2440_UFCON_FIFOMODE    @ fifo enabled?
            beq    1001f                @
            @ FIFO enabled...
    1003:
            mrc    p15, 0, \rd, c1, c0
            tst    \rd, #1
            addeq    \rd, \rx, #(S3C2440_PA_GPIO - S3C2440_PA_UART)
            addne    \rd, \rx, #(S3C2440_VA_GPIO - S3C2440_VA_UART)
            bic    \rd, \rd, #0xff000
            ldr    \rd, [ \rd, # S3C2440_GSTATUS1 - S3C2440_GPIOREG(0) ]
            and    \rd, \rd, #0x00ff0000
            teq    \rd, #0x00440000        @ is it 2440?

            ldr    \rd, [ \rx, # S3C2440_UFSTAT ]
            andne    \rd, \rd, #S3C2440_UFSTAT_TXMASK
            andeq    \rd, \rd, #S3C2440_UFSTAT_TXMASK
            teq    \rd, #0
            bne    1003b
            b    1002f

    1001:
            @ idle waiting for non fifo
            ldr    \rd, [ \rx, # S3C2440_UTRSTAT ]
            tst    \rd, #S3C2440_UTRSTAT_TXFE
            beq    1001b

    1002:        @ exit busyuart
            .endm




    -----

     ENTRY(printascii)
            addruart r3
            b    2f
    1:        waituart r2, r3
            senduart r1, r3
            busyuart r2, r3
            teq    r1, #'\n'
            moveq    r1, #'\r'
            beq    1b
    2:        teq    r0, #0
            ldrneb    r1, [r0], #1
            teqne    r1, #0
            bne    1b
            mov    pc, lr

  • Poky Platform Build

    2008-07-29 09:00:49

    看起来是一个不错的工具啊!

    "Poky is an open source platform build tool. It is a complete software development environment for the creation of Linux devices. It enables you to design, develop, build, debug, and test a complete, modern, software stack using Linux, the X Window System and GNOME Mobile based application frameworks for both ARM and x86 based platforms. "

    我觉得这个环境对于个人开发者来说是一个好东西,不需要自己花那么多的时间下载那么多的库自己交叉编译、修改脚本....

    改日得下一个试试!

    Screenshots

    当然也可以下载预先编译好的文件
  • fceu如何使用键盘输入

    2008-07-03 15:30:23

    其实并不需要修改任何代码,fceu本身就支持键盘输入。
    ./arm-fceu -inputcfg gamepad1 Mighty Final Fight.nes
    通过设定方向键,select, start, a,b, super a, super b键之后,便可以开始游戏。


    应该说还是比较好用的。

    但是我在玩魂斗罗的时候遇到一个问题,就是两颗键同时按下的时候出现问题。比如玩超级玛丽的时候按跳的同时按前,还是笔直得往上跳。

    所以fceu这个工具要能够使用在板子上完美的使用还是需要做些优化的。

    而且键盘输入还有一个问题,之前在定义的键值不能用,按下一个键,sdl
    static void handle_keyboard(_THIS)函数里居然读到三个按键事件
        nread = read(keyboard_fd, keybuf, BUFSIZ);
        printf("%s nread is 0x%d\n",__FUNCTION__,nread);
    nread的值是3.

    将键值改成KEY_A,KEY_B...等之后,便正常了。
Open Toolbar