memory.h

Ir a la documentación de este archivo.
00001 #ifndef __MEMORY_H__
00002 #define __MEMORY_H__
00003 
00004 /*
00005   This code is free software; you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 2, or (at your option)
00008    any later version.
00009    
00010    This code is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014 */
00015 
00028 #include <tipos.h>
00029 
00034 #ifndef I_HAVE_BANK0
00035         #warning "I_HAVE_BANK0 no definido. fue definido automaticamente"
00036         #define I_HAVE_BANK0
00037 #endif
00038 
00039 #ifndef I_HAVE_BANK1
00040         #warning "I_HAVE_BANK1 no definido. Definir si se desea usar"
00041 #endif
00042 
00043 #ifndef I_HAVE_BANK2
00044         #warning "I_HAVE_BANK2 no definido. Definir si se desea usar"
00045 #endif
00046 
00047 #ifndef I_HAVE_BANK3
00048         #warning "I_HAVE_BANK3 no definido. Definir si se desea usar"
00049 #endif
00050 
00051 #ifdef I_HAVE_BANK0
00052 
00057 BYTE memory_bank0(void)
00058 {
00059         BYTE dato;
00060         __asm__ __volatile__ ("BANKSEL b1_used");
00061         __asm__ __volatile__ ("MOVF    b1_used,0");
00062         __asm__ __volatile__ ("BANKSEL b1_total");
00063         __asm__ __volatile__ ("SUBWF   b1_total,0");
00064         __asm__ __volatile__ ("BANKSEL F_REG");
00065         __asm__ __volatile__ ("MOVWF %0":"=v" (dato));
00066         return dato;
00067 }
00068 #endif
00069 
00070 #ifdef I_HAVE_BANK1
00071 
00076 BYTE memory_bank1(void)
00077 {
00078         BYTE dato;
00079         __asm__ __volatile__ ("BANKSEL b2_used");
00080         __asm__ __volatile__ ("MOVF    b2_used,0");
00081         __asm__ __volatile__ ("BANKSEL b2_total");
00082         __asm__ __volatile__ ("SUBWF   b2_total,0");
00083         __asm__ __volatile__ ("BANKSEL F_REG");
00084         __asm__ __volatile__ ("MOVWF %0":"=v" (dato));
00085         return dato;
00086 }
00087 #endif
00088 
00089 #ifdef I_HAVE_BANK2
00090 
00095 BYTE memory_bank2(void)
00096 {
00097         BYTE dato;
00098         __asm__ __volatile__ ("BANKSEL b3_used");
00099         __asm__ __volatile__ ("MOVF    b3_used,0");
00100         __asm__ __volatile__ ("BANKSEL b3_total");
00101         __asm__ __volatile__ ("SUBWF   b3_total,0");
00102         __asm__ __volatile__ ("BANKSEL F_REG");
00103         __asm__ __volatile__ ("MOVWF %0":"=v" (dato));
00104         return dato;
00105 }
00106 #endif
00107 
00108 #ifdef I_HAVE_BANK3
00109 
00114 BYTE memory_bank3(void)
00115 {
00116         BYTE dato;
00117         __asm__ __volatile__ ("BANKSEL b4_used");
00118         __asm__ __volatile__ ("MOVF    b4_used,0");
00119         __asm__ __volatile__ ("BANKSEL b4_total");
00120         __asm__ __volatile__ ("SUBWF   b4_total,0");
00121         __asm__ __volatile__ ("BANKSEL F_REG");
00122         __asm__ __volatile__ ("MOVWF %0":"=v" (dato));
00123         return dato;
00124 }
00125 #endif
00126 
00132 BYTE memory_bank_all(void)
00133 {
00134         int16 data=0;
00135         
00136         #ifdef I_HAVE_BANK0
00137         data+=memory_bank0();
00138         #endif
00139 
00140         #ifdef I_HAVE_BANK1
00141         data+=memory_bank1();
00142         #endif
00143 
00144         #ifdef I_HAVE_BANK2
00145         data+=memory_bank2();
00146         #endif
00147 
00148         #ifdef I_HAVE_BANK3
00149         data+=memory_bank3();
00150         #endif
00151         
00152         return data;
00153 }
00154 
00155 #endif

Generado el Thu Jan 8 00:55:37 2009 para pic-gcc-library por  doxygen 1.5.1