微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > GNU ARM汇编--(六)s3c2440的时钟控制

GNU ARM汇编--(六)s3c2440的时钟控制

时间:11-26 来源:互联网 点击:

  1. divN_UPLL = 0

    UPLL是48M

    HdivN = 01

    PdivN = 1

    FCLK : HCLK : PCLK = 1:2:4

    datasheet读懂了,写出汇编就很容易了,添加了时钟设置的流水灯如下:

    [cpp]view plaincopy

    1. .equGPBCON,0x56000010
    2. .equGPBDAT,0x56000014
    3. .equGPB5_out,(1<(5*2))
    4. .equGPB6_out,(1<(6*2))
    5. .equGPB7_out,(1<(7*2))
    6. .equGPB8_out,(1<(8*2))
    7. .equGPBVALUE,(GPB5_out|GPB6_out|GPB7_out|GPB8_out)
    8. .equLOCKTIME,0x4c000000
    9. .equMPLLCON,0x4c000004
    10. .equUPLLCON,0x4c000008
    11. .equM_Mdiv,92
    12. .equM_Pdiv,1
    13. .equM_Sdiv,1
    14. .equU_Mdiv,56
    15. .equU_Pdiv,2
    16. .equU_Sdiv,2
    17. .equCLKdivN,0x4c000014
    18. .equdivN_UPLL,0
    19. .equHdivN,1
    20. .equPdivN,1@FCLK:HCLK:PCLK=1:2:4
    21. .global_main
    22. _main:
    23. ldrr0,=GPBCON
    24. ldrr1,=0x15400
    25. strr1,[r0]
    26. @blclock_setup
    27. ldrr2,=GPBDAT
    28. ldrr1,=0x1c0
    29. strr1,[r2]
    30. bldelay
    31. ledloop:
    32. ldrr1,=0x1c0
    33. strr1,[r2]
    34. bldelay
    35. ldrr1,=0x1a0
    36. strr1,[r2]
    37. bldelay
    38. ldrr1,=0x160
    39. strr1,[r2]
    40. bldelay
    41. ldrr1,=0x0e0
    42. strr1,[r2]
    43. bldelay
    44. bledloop
    45. clock_setup:
    46. ldrr0,=LOCKTIME
    47. ldrr1,=0xffffffff
    48. strr1,[r0]
    49. ldrr0,=CLKdivN
    50. ldrr1,=(divN_UPLL<3)|(HdivN<1)|(PdivN<0)
    51. strr1,[r0]
    52. ldrr0,=UPLLCON
    53. ldrr1,=(U_Mdiv<12)|(U_Pdiv<4)|(U_Sdiv<0)@Fin=12MUPLL=48M
    54. strr1,[r0]
    55. nop
    56. nop
    57. nop
    58. nop
    59. nop
    60. nop
    61. nop
    62. ldrr0,=MPLLCON
    63. ldrr1,=(M_Mdiv<12)|(M_Pdiv<4)|(M_Sdiv<0)@Fin=12MFCLK=400M
    64. strr1,[r0]
    65. movpc,lr
    66. delay:
    67. @ldrr3,=0xffffffff
    68. ldrr3,=0xfffff
    69. delay1:
    70. subr3,r3,#1
    71. cmpr3,#0x0
    72. bnedelay1
    73. movpc,lr


    [cpp]view plaincopy

    1. 在注释掉blclock_setup与不注释的条件对比,流水灯跑的速度明显不一样了.在正确设置时钟后,后面的各个设备模块才可以正确运作.

    就写到这里了~~~

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top