[elektro] AVR ASM
Bali Zoltan
eltexto at freemail.hu
Fri Jul 31 12:55:33 CEST 2009
Hali !
Le tudná nekem forditani valaki ezeket tiszta ASM-re ?
Nem ismerem a GCC lelkivilágát és most hirtelen nem is akarom megismerni.
Az C interface-t meg tudom csinálni. Csak az asm kellene. Tudom pár sor,
és sejtem is, de ez a sok sallang zavar meg valahogy.
static inline void delayloop16(uint16_t count)
{
asm volatile ( "cp %A0,__zero_reg__ \n\t" \
"cpc %B0,__zero_reg__ \n\t" \
"breq L_Exit_%= \n\t" \
"L_LOOP_%=: \n\t" \
"sbiw %0,1 \n\t" \
"brne L_LOOP_%= \n\t" \
"L_Exit_%=: \n\t" \
: "=w" (count)
: "0" (count)
);
}
void delayloop32(uint32_t loops)
{
__asm__ volatile ( "cp %A0,__zero_reg__ \n\t" \
"cpc %B0,__zero_reg__ \n\t" \
"cpc %C0,__zero_reg__ \n\t" \
"cpc %D0,__zero_reg__ \n\t" \
"breq L_Exit_%= \n\t" \
"L_LOOP_%=: \n\t" \
"subi %A0,1 \n\t" \
"sbci %B0,0 \n\t" \
"sbci %C0,0 \n\t" \
"sbci %D0,0 \n\t" \
"brne L_LOOP_%= \n\t" \
"L_Exit_%=: \n\t" \
: "=w" (loops) \
: "0" (loops) \
); \
return;
}
Köszi
Üdv. Zoli
More information about the Elektro
mailing list