zhangyimb zhangyimb

where to use Hardware semaphores

Discussion created by zhangyimb zhangyimb on Nov 8, 2011
Latest reply on Nov 8, 2011 by zhangyimb zhangyimb

     I am using XGATE in my project. Main Timer Interrupt Flag 1 (TFLG1) and Port T Data Register (PTT)in both s12x_cup and XGATE. They don't process the same timer and the same port, I think when I process PTT in both core ,I must use Hardware semaphores to prevent Unpredictable wrong . I don't know  if I must use   Hardware semaphores during process TFLG1 register? 

example:

//in s12x_cup)   

       while(TEST_SEM(0)){
              SET_SEM(0)        

}
         PTT_PTT0=0;

         
        REL_SEM(0);
    }

// in XGATE

while(!_ssem(0));
       PTT_PT1=1;
      _csem(0);

 

If it is necessary like that :

//in s12x_cup)   

       while(TEST_SEM(1)){
              SET_SEM(1)        

}
         TFLG1=0X01;

         TIE&=(~0x01);

         
        REL_SEM(1);
    }

// in XGATE

while(!_ssem(0));
       TFLG1=0X02;
       TIE&=(~0X02);     

 _csem(0);

 

 thank you.

    Sorry for my bad english.

Outcomes