title: inline asm - how to read and set cpsr
body: <p>I'm trying to read <code>cpsr</code> and set <code>cpsr</code> with these function. however these functions works fine in <strong>eclipse</strong> but i have problem using them in <code>keil uvision 4</code>.  </p>
  
  <pre><code>static inline unsigned __get_cpsr(void)
  {
      unsigned long retval;
      asm volatile (" mrs %0, cpsr" : "=r" (retval) :  );
      return retval;
  }
  
  static inline void __set_cpsr(unsigned val)
  {
      asm volatile (" msr cpsr, %0":  :"r" (val));
  }
  </code></pre>
  
  <p>and i get this error:</p>
  
  <pre><code>error:  #65: expected a ";"
  error:  #20: identifier "asm" is undefined
  </code></pre>
  
  <p>so i used <strong><code>__inline</code></strong> and <strong><code>__asm</code></strong> and now i get this error:</p>
  
  <pre><code>source\main.c(94): error:  #18: expected a ")"
  source\main.c(94): error:  #18: expected a ")"
  </code></pre>
  
  <p>Any idea on how to fix it? or what is the steps to move these functions in a separate <code>asm file</code> which seems to be a solution, but unfortunatly i'm not familiar with assembly very much</p>