board.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * File : board.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006, RT-Thread Develop Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://openlab.rt-thread.com/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2006-10-08 Bernard add board.h to this bsp
  13. */
  14. #ifndef __BOARD_H__
  15. #define __BOARD_H__
  16. #include <rthw.h>
  17. #include <rtthread.h>
  18. // These are defined in standard header (at91sam7x256.h) of realview MDK.
  19. //#define AT91C_US_RXRDY ((unsigned int) 0x1 << 0) /* US RXRDY Interrupt */
  20. //#define AT91C_US_TXRDY ((unsigned int) 0x1 << 1) /* US TXRDY Interrupt */
  21. //#define AT91C_US_RSTRX ((unsigned int) 0x1 << 2) /* US Reset Receiver */
  22. //#define AT91C_US_RSTTX ((unsigned int) 0x1 << 3) /* US Reset Transmitter */
  23. //#define AT91C_US_RXEN ((unsigned int) 0x1 << 4) /* US Receiver Enable */
  24. //#define AT91C_US_RXDIS ((unsigned int) 0x1 << 5) /* US Receiver Disable */
  25. //#define AT91C_US_TXEN ((unsigned int) 0x1 << 6) /* US Transmitter Enable */
  26. //#define AT91C_US_TXDIS ((unsigned int) 0x1 << 7) /* US Transmitter Disable */
  27. //#define AT91C_US_RSTSTA ((unsigned int) 0x1 << 8) /* US Reset Status Bits */
  28. //
  29. //#define AT91C_US_USMODE_NORMAL ((unsigned int) 0x0) /* USAR) Normal */
  30. //#define AT91C_US_USMODE_RS485 ((unsigned int) 0x1) /* USAR) RS485 */
  31. //#define AT91C_US_USMODE_HWHSH ((unsigned int) 0x2) /* USAR) Hardware Handshaking */
  32. //#define AT91C_US_USMODE_MODEM ((unsigned int) 0x3) /* USAR) Modem */
  33. //#define AT91C_US_USMODE_ISO7816_0 ((unsigned int) 0x4) /* USAR) ISO7816 protocol: T = 0 */
  34. //#define AT91C_US_USMODE_ISO7816_1 ((unsigned int) 0x6) /* USAR) ISO7816 protocol: T = 1 */
  35. //#define AT91C_US_USMODE_IRDA ((unsigned int) 0x8) /* USAR) IrDA */
  36. //#define AT91C_US_USMODE_SWHSH ((unsigned int) 0xC) /* USAR) Software Handshaking */
  37. //
  38. //#define AT91C_US_CLKS_CLOCK ((unsigned int) 0x0 << 4) /* USAR) Clock */
  39. //#define AT91C_US_CLKS_FDIV1 ((unsigned int) 0x1 << 4) /* USAR) fdiv1 */
  40. //#define AT91C_US_CLKS_SLOW ((unsigned int) 0x2 << 4) /* USAR) slow_clock (ARM) */
  41. //#define AT91C_US_CLKS_EXT ((unsigned int) 0x3 << 4) /* USAR) External (SCK) */
  42. //
  43. //#define AT91C_US_CHRL_5_BITS ((unsigned int) 0x0 << 6) /* USAR) Character Length: 5 bits */
  44. //#define AT91C_US_CHRL_6_BITS ((unsigned int) 0x1 << 6) /* USAR) Character Length: 6 bits */
  45. //#define AT91C_US_CHRL_7_BITS ((unsigned int) 0x2 << 6) /* USAR) Character Length: 7 bits */
  46. //#define AT91C_US_CHRL_8_BITS ((unsigned int) 0x3 << 6) /* USAR) Character Length: 8 bits */
  47. //
  48. //#define AT91C_US_PAR_EVEN ((unsigned int) 0x0 << 9) /* DBGU Even Parity */
  49. //#define AT91C_US_PAR_ODD ((unsigned int) 0x1 << 9) /* DBGU Odd Parity */
  50. //#define AT91C_US_PAR_SPACE ((unsigned int) 0x2 << 9) /* DBGU Parity forced to 0 (Space) */
  51. //#define AT91C_US_PAR_MARK ((unsigned int) 0x3 << 9) /* DBGU Parity forced to 1 (Mark) */
  52. //#define AT91C_US_PAR_NONE ((unsigned int) 0x4 << 9) /* DBGU No Parity */
  53. //#define AT91C_US_PAR_MULTI_DROP ((unsigned int) 0x6 << 9) /* DBGU Multi-drop mode */
  54. //
  55. //#define AT91C_US_NBSTOP_1_BIT ((unsigned int) 0x0 << 12) /* USART 1 stop bit */
  56. //#define AT91C_US_NBSTOP_15_BIT ((unsigned int) 0x1 << 12) /* USART Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits */
  57. //#define AT91C_US_NBSTOP_2_BIT ((unsigned int) 0x2 << 12) /* USART 2 stop bits */
  58. #define MCK 48054857
  59. #define BR 115200 /* Baud Rate */
  60. #define BRD (MCK/16/BR) /* Baud Rate Divisor */
  61. void rt_hw_board_led_on(int n);
  62. void rt_hw_board_led_off(int n);
  63. void rt_hw_board_init(void);
  64. #endif