MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / GET_BITS

Function GET_BITS

components/drivers/sdio/dev_mmc.c:46–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44};
45
46rt_inline rt_uint32_t GET_BITS(rt_uint32_t *resp,
47 rt_uint32_t start,
48 rt_uint32_t size)
49{
50 const rt_int32_t __size = size;
51 const rt_uint32_t __mask = (__size < 32 ? 1 << __size : 0) - 1;
52 const rt_int32_t __off = 3 - ((start) / 32);
53 const rt_int32_t __shft = (start) & 31;
54 rt_uint32_t __res;
55
56 __res = resp[__off] >> __shft;
57 if (__size + __shft > 32)
58 __res |= resp[__off - 1] << ((32 - __shft) % 32);
59
60 return __res & __mask;
61}
62
63/*
64 * Given a 128-bit response, decode to our card CSD structure.

Callers 3

mmcsd_parse_csdFunction · 0.70
mmc_get_ext_csdFunction · 0.70
mmc_select_bus_widthFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected