Basic vanilla C boilerplate for STM32L100xC (Discovery L100C). Uses GCC. This was some class project without much practical use
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
__attribute__((always_inline))
|
|
|
|
inline uint32_t __RBIT(uint32_t value)
|
|
|
|
{
|
|
|
|
register uint32_t result;
|
|
|
|
|
|
|
|
__asm__ volatile("rbit %0, %1" : "=r"(result) : "r"(value));
|
|
|
|
return (result);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
__attribute__((always_inline))
|
|
|
|
inline void patch_register(io32_t reg, uint32_t mask, uint32_t replacement)
|
|
|
|
{
|
|
|
|
*reg &= ~mask;
|
|
|
|
*reg |= replacement << __CTZ(mask);
|
|
|
|
}
|