* device/include/pic16/adc.h,
[fw/sdcc] / device / lib / pic16 / libio / adc / adcbusy.c
index 5328c31456a07512f1d0c547272af5a92bd83c5f..cb9c5b167ff099996326d7f2a53fcea4234e7b10 100644 (file)
@@ -1,10 +1,23 @@
 
 #include <pic18fregs.h>
-
 #include <adc.h>
 
 
-char adc_busy(void)
+char adc_busy(void) __naked
 {
-       return (ADCON0bits.GO == 1);
+#if 0
+  return (ADCON0bits.GO);
+#else
+  __asm
+    movlw       0x00
+#if defined(__SDCC_ADC_STYLE2455)
+    btfsc       _ADCON0bits, 0
+#else /* all other devices */
+    btfsc       _ADCON0bits, 2
+#endif
+    addlw       0x01
+    return
+  __endasm;
+#endif
 }
+