interrupt.c

来自「网络中交换节点的上数据的交换和下行数据分发的硬件实现」· C语言 代码 · 共 36 行

C
36
字号
#include "reg.h"
extern unsigned volatile int  counter_32;
extern unsigned volatile int  counter_256;
extern unsigned volatile int  wng_clk;
extern unsigned volatile int  wng_data;
extern unsigned volatile int  *wng_addr;

void interrupt c_int01(void)
{ 
    unsigned volatile int temp,temp2;
    temp2 = *(unsigned volatile int *)CTL1 & 0x04; //判断当前WNG_CLK是高是低
    
    if(temp2 == 0x04)
      {
       temp =((*(unsigned volatile int *)CTL1 & 0x00000008)>>3) & 1;
       if(counter_32>32)
         {
          counter_32=0;
          *wng_addr = wng_data; 
          if(wng_addr>=(unsigned volatile int *)0x8000e004)     
             wng_addr = (unsigned volatile int *)0x8000D004;
          else wng_addr++;   
         }
       else{
           wng_data = (wng_data<<1) + temp;
           counter_32++;
           }
     
       *(unsigned volatile int *)CTL1  = *(unsigned volatile int *)CTL1 & 0xfffffffb; //置0
      
      }
    else {
          *(unsigned volatile int *)CTL1 = *(unsigned volatile int *)CTL1 | 0x00000004; //置1
          
         }
  }

⌨️ 快捷键说明

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