I have 2 functions:
Code: Select all
// Port 32A helpers
#define PORT32A_PEEK(X) {asm("peek %0, res[%1]":"=r"(X):"r"(XS1_PORT_32A));}
#define PORT32A_OUT(X) {asm("out res[%0], %1"::"r"(XS1_PORT_32A),"r"(X));}
static void OutF0(unsigned s){
unsigned tmp;
PORT32A_PEEK(tmp);
if(s) tmp |= 0x08; else tmp &= (~0x08);
PORT32A_OUT(tmp);
}
//
static void OutF1(unsigned s){
unsigned tmp;
PORT32A_PEEK(tmp);
if(s) tmp |= 0x10; else tmp &= (~0x10);
PORT32A_OUT(tmp);
}
Code: Select all
OutF0(a);
OutF1(b)
But, when I put a small delay between the calls - it starts to work!
Code: Select all
OutF0(a);
t :> time; time += 20; t when timerafter(time) :> int _; // 200ns delay
OutF1(b)
- why it happened?
- is this solution with timer is good, or there is(are) another, more preferable solution(s)?