Andes Workshop http://forum.andestech.com/ |
|
inline assembly的example http://forum.andestech.com/viewtopic.php?f=16&t=585 |
Page 1 of 1 |
Author: | cindy [ Wed Jun 06, 2012 6:15 pm ] |
Post subject: | inline assembly的example |
例如demo-int裡的檔案ag101_16mb.h, 有幾個example。您可以用asm這個key word來搜尋。 如 Code: #define NDS32_SET_BITS(addr, mask) \ __asm__ __volatile__(\ " sethi $r1, hi20(%1) \n\t" \ " ori $r1, $r1, lo12(%1) \n\t" \ " sethi $r2, hi20(%0) \n\t" \ " ori $r2, $r2, lo12(%0) \n\t" \ " lwi $r0, [$r2] \n\t" \ " or $r0, $r0, $r1 \n\t" \ " sw $r0, [$r2] \n\t" \ ::"i"(addr),"i"(mask):"$r0", "$r1", "$r2") Code: #define NDS32_REG_WAIT4_BIT_ON(addr, mask) \ __asm__ __volatile__(\ " sethi $r1, hi20(%1) \n\t" \ " ori $r1, $r1, lo12(%1) \n\t" \ " sethi $r2, hi20(%0) \n\t" \ " ori $r2, $r2, lo12(%0) \n\t" \ "1: lwi $r0, [$r2] \n\t" \ " and $r0, $r0, $r1 \n\t" \ " beqz $r0, 1b \n\t" \ ::"i"(addr),"i"(mask):"$r0", "$r1", "$r2") Inline assembly的用法, 請參考文件programming guide的19.9. Inline Assembly Programming的說明。 |
Author: | jonathan [ Fri Dec 08, 2017 3:42 pm ] |
Post subject: | Re: inline assembly的example |
The AndeSight V3.0.0 programing guide V1.6 is shown on the 19.10 section. Please refer to the following attached file. Attachment:
|
Page 1 of 1 | All times are UTC + 8 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |