| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: sdmmcreg.h,v 1.7 2011/02/13 07:25:56 nonaka Exp $ */ | | 1 | /* $NetBSD: sdmmcreg.h,v 1.8 2012/01/27 03:07:21 matt Exp $ */ |
2 | /* $OpenBSD: sdmmcreg.h,v 1.4 2009/01/09 10:55:22 jsg Exp $ */ | | 2 | /* $OpenBSD: sdmmcreg.h,v 1.4 2009/01/09 10:55:22 jsg Exp $ */ |
3 | | | 3 | |
4 | /* | | 4 | /* |
5 | * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> | | 5 | * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> |
6 | * | | 6 | * |
7 | * Permission to use, copy, modify, and distribute this software for any | | 7 | * Permission to use, copy, modify, and distribute this software for any |
8 | * purpose with or without fee is hereby granted, provided that the above | | 8 | * purpose with or without fee is hereby granted, provided that the above |
9 | * copyright notice and this permission notice appear in all copies. | | 9 | * copyright notice and this permission notice appear in all copies. |
10 | * | | 10 | * |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| @@ -327,24 +327,24 @@ __bitfield(uint32_t *src, int start, int | | | @@ -327,24 +327,24 @@ __bitfield(uint32_t *src, int start, int |
327 | if (start < 0 || len < 0 || len > 32) | | 327 | if (start < 0 || len < 0 || len > 32) |
328 | return 0; | | 328 | return 0; |
329 | | | 329 | |
330 | dst = 0; | | 330 | dst = 0; |
331 | mask = len % 32 ? UINT_MAX >> (32 - (len % 32)) : UINT_MAX; | | 331 | mask = len % 32 ? UINT_MAX >> (32 - (len % 32)) : UINT_MAX; |
332 | shift = 0; | | 332 | shift = 0; |
333 | | | 333 | |
334 | while (len > 0) { | | 334 | while (len > 0) { |
335 | sp = (uint8_t *)src + start / 8; | | 335 | sp = (uint8_t *)src + start / 8; |
336 | bs = start % 8; | | 336 | bs = start % 8; |
337 | bc = 8 - bs; | | 337 | bc = 8 - bs; |
338 | if (bc > len) | | 338 | if (bc > len) |
339 | bc = len; | | 339 | bc = len; |
340 | dst |= (*sp++ >> bs) << shift; | | 340 | dst |= (*sp >> bs) << shift; |
341 | shift += bc; | | 341 | shift += bc; |
342 | start += bc; | | 342 | start += bc; |
343 | len -= bc; | | 343 | len -= bc; |
344 | } | | 344 | } |
345 | | | 345 | |
346 | dst &= mask; | | 346 | dst &= mask; |
347 | return (int)dst; | | 347 | return (int)dst; |
348 | } | | 348 | } |
349 | | | 349 | |
350 | #endif /* _SDMMCREG_H_ */ | | 350 | #endif /* _SDMMCREG_H_ */ |