2410test.c
Upload User: yzchenlin
Upload Date: 2022-03-09
Package Size: 712k
Code Size: 3k
Development Platform:

C/C++

  1. //====================================================================
  2. // File Name : 2410test.c
  3. // Function  : S3C2410 Test Main Menu
  4. // Program   : Shin, On Pil (SOP)
  5. // Date      : May 21, 2002
  6. // Version   : 0.0
  7. // History
  8. //   0.0 : Programming start (February 20,2002) -> SOP
  9. //====================================================================
  10. #include <stdlib.h>
  11. #include <string.h>
  12. //Shin, On Pil
  13. #include "def.h"
  14. #include "2410lib.h"
  15. #include "uart0.h"
  16. void Isr_Init(void);
  17. void HaltUndef(void);
  18. void HaltSwi(void);
  19. void HaltPabort(void);
  20. void HaltDabort(void);
  21. //===================================================================
  22. void Main(void)
  23. {
  24.     
  25.     Led_Display(15);
  26.     ChangeClockDivider(1,1);          // 1:2:4    
  27.     ChangeMPllValue(0xa1,0x3,0x1);    // FCLK=202.8MHz  
  28.     
  29.     Port_Init();
  30.     Isr_Init();
  31.     Uart_Init(0,115200);
  32.     Uart_Select(0);
  33. Uart_Printf("nnSMDK2410 Board (MCU S3C2410) Test Program Ver 1.0(20020521) FCLK = %d Hznn", FCLK);
  34.     Delay(0); //calibrate Delay()
  35.     while(1)
  36.     {     
  37. Led_Display(15);
  38. Delay(10000);        
  39. Test_Uart0_Int();   
  40. Led_Display(0);
  41. Delay(10000);
  42. Led_Display(1);
  43. Delay(10000);
  44. Led_Display(2);
  45. Delay(10000);
  46. Led_Display(4);
  47. Delay(10000);
  48. Led_Display(8);
  49.     }
  50. }
  51. //===================================================================
  52. void Isr_Init(void)
  53. {
  54.     pISR_UNDEF  = (unsigned)HaltUndef;
  55.     pISR_SWI    = (unsigned)HaltSwi;
  56.     pISR_PABORT = (unsigned)HaltPabort;
  57.     pISR_DABORT = (unsigned)HaltDabort;
  58.     
  59.     rINTMOD     = 0x0;                     //All=IRQ mode
  60. //    rINTCON=0x5;                           //Non-vectored,IRQ enable,FIQ disable    
  61.     rINTMSK     = BIT_ALLMSK;              //All interrupt is masked.
  62.     rINTSUBMSK  = BIT_SUB_ALLMSK;          //All sub-interrupt is masked. <- April 01, 2002 SOP
  63. //    rINTSUBMSK  = ~(BIT_SUB_RXD0);         //Enable Rx0 Default value=0x7ff
  64. //    rINTMSK     = ~(BIT_UART0);            //Enable UART0 Default value=0xffffffff    
  65.     
  66. //    pISR_UART0=(unsigned)RxInt;            //pISR_FIQ,pISR_IRQ must be initialized
  67. }
  68. //===================================================================
  69. void HaltUndef(void)
  70. {
  71.     Uart_Printf("Undefined instruction exception.n");
  72.     while(1);
  73. }
  74. //===================================================================
  75. void HaltSwi(void)
  76. {
  77.     Uart_Printf("SWI exception.n");
  78.     while(1);
  79. }
  80. //===================================================================
  81. void HaltPabort(void)
  82. {
  83.     Uart_Printf("Pabort exception.n");
  84.     while(1);
  85. }
  86. //===================================================================
  87. void HaltDabort(void)
  88. {
  89.     Uart_Printf("Dabort exception.n");
  90.     while(1);
  91. }
  92. /*
  93. //=========================
  94.     while(1)
  95.     {
  96.        Led_Display(3);
  97.     }
  98. //=========================    
  99. */
  100. /*
  101. //=========================
  102.     while(1)
  103.     {
  104.        Led_Display(1);
  105.        Delay(1500);   
  106.        Led_Display(2);
  107.        Delay(1500);             
  108.        Led_Display(4);
  109.        Delay(1500);   
  110.        Led_Display(8);
  111.        Delay(1500);                
  112.     }
  113. //=========================   
  114. */