Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - How to embed (PPC405) assembly in C function: Page 1 of 3 (3 Items)
   
How to embed (PPC405) assembly in C function  
Hi:

I need to read some hardware special purpose registers that can only accessed using assembly instructions. Would anyone 
have some code snippets that would illustrate doing this. I do have some example macros taken from the IPL code that 
look like the following:

#define set_dcr(dcr,val) 					\
		__asm__ __volatile__( 				\
			".ifdef PPC_CPUOP_ENABLED;"		\
			".cpu 403;"						\
			".endif;"						\
			"mtdcr %0,%1" 					\
			: : "i" (dcr), "r" (val) )

But 1) I need to embed several instructions and 2) not clear on the above syntax .

thanks

PS

Here is the assembly I"m trying to embed

loop:
  mftbu Rx
  mftb Ry
  mftbu Rz
  cmpw Rz, Rx
  bne loop

Note I realize I'll have to find some vacant registers to use for Rx, Ry and Rz