build: W600-SDK importiert, Firmware-Build und Hello am EVK
Docker-Build mit gcc-arm-none-eabi 4.9-2014q4 (statt Homebrew-Cask) verwendet, Dockerfile/tools/docker.sh dafür aus Task 13 vorgezogen. cmake/sdk.cmake schont gcc 4.9 (kennt -fcommon/-Wno-error=... nicht). Zwei zusätzliche SDK-Stubs (EarlyInit, pre_gpio_config) in src/sys/sdk_stubs.c ergänzt, siehe sdk/PATCHES.md.
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
|
||||
#ifndef BITOPS_H
|
||||
#define BITOPS_H
|
||||
|
||||
#include "wm_osal.h"
|
||||
|
||||
/*
|
||||
* These functions are the basis of our bit ops.
|
||||
*
|
||||
* First, the atomic bitops. These use native endian.
|
||||
*/
|
||||
static __inline void set_bit(unsigned int bit, volatile unsigned long *p)
|
||||
{
|
||||
u32 cpu_sr;
|
||||
unsigned long mask = 1 << (bit & 31);
|
||||
|
||||
p += bit >> 5;
|
||||
|
||||
cpu_sr = tls_os_set_critical();
|
||||
*p |= mask;
|
||||
tls_os_release_critical(cpu_sr);
|
||||
}
|
||||
|
||||
static __inline void clear_bit(unsigned int bit, volatile unsigned long *p)
|
||||
{
|
||||
u32 cpu_sr;
|
||||
unsigned long mask = 1 << (bit & 31);
|
||||
|
||||
p += bit >> 5;
|
||||
|
||||
cpu_sr = tls_os_set_critical();
|
||||
*p &= ~mask;
|
||||
tls_os_release_critical(cpu_sr);
|
||||
}
|
||||
|
||||
static __inline void change_bit(unsigned int bit, volatile unsigned long *p)
|
||||
{
|
||||
u32 cpu_sr;
|
||||
unsigned long mask = 1 << (bit & 31);
|
||||
|
||||
p += bit >> 5;
|
||||
|
||||
cpu_sr = tls_os_set_critical();
|
||||
*p ^= mask;
|
||||
tls_os_release_critical(cpu_sr);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
test_and_set_bit(unsigned int bit, volatile unsigned long *p)
|
||||
{
|
||||
u32 cpu_sr;
|
||||
unsigned int res;
|
||||
unsigned long mask = 1 << (bit & 31);
|
||||
|
||||
p += bit >> 5;
|
||||
|
||||
cpu_sr = tls_os_set_critical();
|
||||
res = *p;
|
||||
*p = res | mask;
|
||||
tls_os_release_critical(cpu_sr);
|
||||
|
||||
return res & mask;
|
||||
}
|
||||
|
||||
static __inline int
|
||||
test_and_clear_bit(unsigned int bit, volatile unsigned long *p)
|
||||
{
|
||||
u32 cpu_sr;
|
||||
unsigned int res;
|
||||
unsigned long mask = 1 << (bit & 31);
|
||||
|
||||
p += bit >> 5;
|
||||
|
||||
cpu_sr = tls_os_set_critical();
|
||||
res = *p;
|
||||
*p = res & ~mask;
|
||||
tls_os_release_critical(cpu_sr);
|
||||
|
||||
return res & mask;
|
||||
}
|
||||
|
||||
static __inline int
|
||||
test_bit(unsigned int bit, volatile unsigned long *p)
|
||||
{
|
||||
u32 cpu_sr;
|
||||
unsigned int res;
|
||||
unsigned long mask = 1 << (bit & 31);
|
||||
|
||||
p += bit >> 5;
|
||||
|
||||
cpu_sr = tls_os_set_critical();
|
||||
res = *p;
|
||||
tls_os_release_critical(cpu_sr);
|
||||
|
||||
return res & mask;
|
||||
}
|
||||
|
||||
static __inline int
|
||||
test_and_change_bit(unsigned int bit, volatile unsigned long *p)
|
||||
{
|
||||
u32 cpu_sr;
|
||||
unsigned int res;
|
||||
unsigned long mask = 1 << (bit & 31);
|
||||
|
||||
p += bit >> 5;
|
||||
|
||||
cpu_sr = tls_os_set_critical();
|
||||
res = *p;
|
||||
*p = res ^ mask;
|
||||
tls_os_release_critical(cpu_sr);
|
||||
|
||||
return res & mask;
|
||||
}
|
||||
|
||||
|
||||
#endif /* BITOPS_H */
|
||||
Reference in New Issue
Block a user