Chinaunix首页 | 论坛 | 博客
  • 博客访问: 800541
  • 博文数量: 124
  • 博客积分: 1927
  • 博客等级: 上尉
  • 技术积分: 932
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-31 14:06
文章分类

全部博文(124)

文章存档

2018年(5)

2017年(2)

2016年(6)

2015年(4)

2014年(24)

2013年(7)

2012年(11)

2011年(13)

2010年(52)

我的朋友

分类: LINUX

2010-09-08 15:29:51

  1. //*----------------------------------------------------------------------------    
  2. //*         ATMEL Microcontroller Software Support  -  ROUSSET  -    
  3. //*----------------------------------------------------------------------------    
  4. //* The software is delivered "AS IS" without warranty or condition of any    
  5. //* kind, either express, implied or statutory. This includes without    
  6. //* limitation any warranty or condition with respect to merchantability or    
  7. //* fitness for any particular purpose, or against the infringements of    
  8. //* intellectual property rights of others.    
  9. //*----------------------------------------------------------------------------    
  10. //* File Name           : init.c    
  11. //* Object              : Low level initialisations written in C    
  12. //* Creation            : ODi   06/26/2002    
  13. //*    
  14. //*----------------------------------------------------------------------------    
  15.    
  16. #include "AT91RM9200.h"    
  17. #include "lib_AT91RM9200.h"    
  18.    
  19. #define AT91C_MASTER_CLOCK 60000000 // Processor clock set by the loader: 60MHz    
  20. //*----------------------------------------------------------------------------    
  21. //* \fn    AT91F_DBGU_Printk    
  22. //* \brief This function is used to send a string through the DBGU channel (Very low level debugging)    
  23. //*----------------------------------------------------------------------------    
  24. void AT91F_DBGU_Printk(   
  25.     char *buffer) // \arg pointer to a string ending by \0    
  26. {   
  27.     while(*buffer != '\0') {   
  28.         while (!AT91F_US_TxReady((AT91PS_USART)AT91C_BASE_DBGU));   
  29.         AT91F_US_PutChar((AT91PS_USART)AT91C_BASE_DBGU, *buffer++);   
  30.     }   
  31. }   
  32.    
  33. //*----------------------------------------------------------------------------    
  34. //* \fn    AT91F_LowLevelInit    
  35. //* \brief This function performs very low level HW initialization    
  36. //*----------------------------------------------------------------------------    
  37. void AT91F_LowLevelInit()   
  38. {   
  39.    
  40.     // Open PIO for DBGU    
  41.     AT91F_DBGU_CfgPIO();   
  42.        
  43.     // Configure DBGU    
  44.     AT91F_US_Configure (   
  45.         (AT91PS_USART) AT91C_BASE_DBGU,          // DBGU base address    
  46.         AT91C_MASTER_CLOCK,            // 60 MHz    
  47.         AT91C_US_ASYNC_MODE ,        // mode Register to be programmed    
  48.         115200 ,                   // baudrate to be programmed    
  49.         0);                        // timeguard to be programmed    
  50.    
  51.     // Enable Transmitter    
  52.     AT91F_US_EnableTx((AT91PS_USART) AT91C_BASE_DBGU);   
  53.     AT91F_US_EnableRx((AT91PS_USART) AT91C_BASE_DBGU);   
  54.    
  55.     AT91F_DBGU_Printk("AT91F_LowLevelInit()\n\r");   
  56. }   
  57.    
阅读(1267) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~