cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
wavemasta
Visitor
Visitor
4,212 Views
Registered: ‎08-15-2008

Reading from DCR bus

Please does anyone know how to use the assembly macro for

 

 asm volatile int mfdcr(rn) {
% con rn
! "r3"
  mfdcr r3, rn
}

 

I am looking for an example of how to use this in reading from a DCR bus.

 

Thanks! 

0 Kudos
2 Replies
morphiend
Explorer
Explorer
4,201 Views
Registered: ‎08-14-2007

Well as obvious as this sounds, here's a C example using the 'macro' you provided. (BTW, where did that macro come from?)

 

---- begin ----- dcr_read.c -----

 

asm volatile int mfdcr(rn) {

% con rn

! "r3"

   mfdcr r3, rn

}

 

#define DCR_REGISTER  10

 

int main() {

   int dcr_value;

   

   dcr_value = mfdcr(DCR_REG);

   printf("register value: %d\n", dcr_value);

   return 0;

}

 

------ end ------ dcr_test.c

 

In this example the DCR_REG define is garbage. You need to replace it with whatever DCR register you want to read from.

0 Kudos
ryserp
Xilinx Employee
Xilinx Employee
4,191 Views
Registered: ‎07-31-2008

Inline assembly macros are defined in xpseudo_asm.h (xpseudo_asm_gcc.h).

 

0 Kudos