⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c6201_hw.c

📁 tms320c6201下的UCOS
💻 C
📖 第 1 页 / 共 2 页
字号:
   timer_reg = (volatile TIMER_REG  *)TIMER0_CTRL_ADDR;


   clock_cycles = (float)TenthsOfMicroseconds * 1e-7 * CLOCK_PER_SEC ; 

    timer_reg->Control  = 0; /* Hold it */
    timer_reg->Control  = 0;
    timer_reg->Period     = clock_cycles / 2    ;		    /* SET DELAY TIME		    */
/*-----------------**
**  9   CLKSRC = 1  CPU clock / 4 **
**  8   C/P    = 1  Clock mode **
**  7   /HLD   = 1  Allowed to count **
**  6   GO     = 1  Here we go **
**-----------------*/
    timer_reg->Control  = (1<<6) +(1<<7) + (1<<8) + (1<<9) ;
    timer_reg->Control  = (1<<6) +(1<<7) + (1<<8) + (1<<9);
       return (NO_ERROR);
}    


MSGS  
C6201_Processor_Setup( void)
{
   
/*************************************************************
 *                                                           *
 * Timer Null, Used for stressing the interrupt handlers and debugging 
 * purposes
 *************************************************************/
    C6201_Set_Up_TIMER_0_In_TenthsOfMicroseconds( 500 )  ;
   
/*************************************************************
 *                                                           *
 * Timer One is used for the System Clock
 *                                                           *
 *************************************************************/
   C6201_Set_Up_TIMER_Tick_In_TenthsOfMicroseconds( 10000 )   ;

/*************************************************************
 *                                                           *
 * Interrupts
   D E F A U L T 
   The reset initializes the interrupt multiplexer
   so that Timer Interrupt 0 is INT14
   so that Timer Interrupt 1 is INT15
   We will be using timer int 1 for the system clock
   
    I do not like the supporting libraries that comes with the system.
    It is better to have full control over the software.           
   
 *                                                           *
 *************************************************************/

  /* M A P   SERIAL RECEIVE INTERRUPTS INTO THE Interrupt multiplexer
             SERIAL Port 0 RECEIVE at interrupt level 5
             SERIAL Port 0 RECEIVE at interrupt level 6
  
             Default 5 is External pin 5
             Default 6 is External pin 6
             These are not used. They can be remapped.
  */             
  /* set Interrupt select 5 to McBsp 0 receive int */
  /* set Interrupt select 6 to McBsp 1 receive int */
  
  /* Set the positions 5 and 6 to null */
   *( (volatile unsigned int*) INTR_MULTIPLEX_LOW_ADDR)  &= ( ~(0xf<<INTSEL5)
                                                         &    ~(0xf<<INTSEL6) ) ;
  
  /* set Interrupt select 5 to McBsp 0 receive int */
  /* set Interrupt select 6 to McBsp 1 receive int */
   *( (volatile unsigned int*) INTR_MULTIPLEX_LOW_ADDR) |= (ISN_RINT0<<INTSEL5)
                                                         | (ISN_RINT1<<INTSEL6) ;

       return (NO_ERROR);
    
}    
	
    







/******************************************************************************
*                                                                            
* function    : McBsp_Receive_0_Interrupt
* description : 
*                                                                            
* dependencies: Setup in the interrupt vector : c6inthnd.asm
*                                               os_cpu_a.asm                             
*                                                                            
*  Input      : None
*  Output     : None
* history     :                                                              
* return value : 
* Cost  :                                                                     
*                                                                            
******************************************************************************/
void interrupt
McBsp_Receive_0_Interrupt( void)            /* Interrupt  5, Not Used */
{
}   

interrupt void 
McBsp_Receive_1_Interrupt( void)            /* Interrupt  6, Not Used  */
{
}   


/******************************************************************************
*                                                                            
* function    : HostPortInterrupt(void )      DSPINT
* description : HostPortInterrupt interrupt handler
*                                                                            
*               Acts on an interrupt when the Host issues an interrupt
*                                                                            
* dependencies: Setup in the interrupt vector : c6inthnd.asm
*                                               os_cpu_a.asm                             
*                                                                            
*  Input      : None
*  Output     : None
* history     :                                                              
* return value : 
* Cost  :                                                                     
*                                                                            
******************************************************************************/
  /* do not declare this with the 
     ordinary interrupt keyword 
     or #pragma interrupt () ; */
     
void 
HostPortInterrupt(void)                     /* Interrupt 13, Not Used  */
{
   c6201_Save()   ; /* C6201 runtime saving of task registers */
   
   OSIntEnter() ;
   
   OSMboxPost( MailBox->ForTheHostPortInterrupt, (void *)1);
   /* Reset the host port interrupt bit */
   OSIntExit()  ;
   c6201_Restor() ; /* C6201 runtime popping of task registers */
}	


/******************************************************************************
*                                                                            
* function    : PCIControllerInterrupt_Handler
* description : 
*                                                                            
*               Acts on an interrupt when the Host issues an interrupt
*                                                                            
* dependencies: Setup in the interrupt vector : c6inthnd.asm
*                                               os_cpu_a.asm                             
*                                                                            
*  Input      : None
*  Output     : None
* history     :                                                              
* return value : 
* Cost  :                                                                     
*                                                                            
******************************************************************************/
  /* do not declare this with the 
     ordinary interrupt keyword 
     or #pragma interrupt () ; */
     

void 
PCIControllerInterrupt_Handler(void)        /* Interrupt  4, Not Used  */
{
   c6201_Save()   ; /* C6201 runtime saving of task registers */
   OSIntEnter() ;
   
/*   OSMboxPost( MailBox->ForThePCIControllerInterrupt, (void *)1  );*/
   OSIntExit()  ;
   
   c6201_Restor() ; /* C6201 runtime popping of task registers */
}	

/******************************************************************************
*                                                                            
* function    : HostPCIRegister_Interrupt
* description : NMI interrupt connected to memory-mapped control register on the 
*                   PCI bus. Triggered by the host.                                                             
*                                                                            
* dependencies: Setup in the interrupt vector : c6inthnd.asm
*                                               os_cpu_a.asm                             
*                                                                            
*  Input      : None
*  Output     : None
* history     :                                                              
* return value : 
* Cost  :                                                                     
*                                                                            
******************************************************************************/
  /* do not declare this with the 
     ordinary interrupt keyword 
     or #pragma interrupt () ; */
     
void 
HostPCIRegister_Interrupt(void)             /*  Interrupt 1 NMI, Not Used  */
{
   c6201_Save()   ; /* C6201 runtime saving of task registers */

   OSIntEnter() ;
   
   OSIntExit()  ;
   
   c6201_Restor() ; /* C6201 runtime popping of task registers */
}	


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -