X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=carlfw%2Finclude%2Fio.h;h=5bdc821a30eca60a2c824781b68c5d4988a43d2a;hb=b16e4b8d1a59abc67e1e7f2f4a5d297fbac6ee73;hp=1186af61aa1a372814155b4d988b5a392a33e1b1;hpb=774528bd28331a1f3dd26ed8976f03cf224dfd4e;p=carl9170fw.git diff --git a/carlfw/include/io.h b/carlfw/include/io.h index 1186af6..5bdc821 100644 --- a/carlfw/include/io.h +++ b/carlfw/include/io.h @@ -10,8 +10,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #ifndef __CARL9170FW_IO_H @@ -81,13 +80,11 @@ static inline __inline uint32_t readl_async(const volatile void *addr) uint32_t i = 0, read, tmp; read = readl(addr); - while (i++ < 10) { + do { + tmp = read; tmp = readl(addr); - if (tmp == read) - break; - else - read = tmp; - } + i++; + } while (tmp != read && i <= 10); return read; } @@ -152,4 +149,9 @@ static inline __inline void orb(const volatile uint32_t addr, const volatile uin setb(addr, getb(addr) | val); } +static inline __inline uint16_t getw(const volatile uint32_t addr) +{ + return readw((const volatile void *) addr); +} + #endif /* __CARL9170FW_IO_H */