Revision 259d8546b3bee62e1ca8107653d2c45105255ceb authored by alex@thinkpad on 02 September 2017, 20:32:31 UTC, committed by alex@thinkpad on 02 September 2017, 20:32:31 UTC
1 parent 6cc5138
util.h
#ifndef __UTIL_H__
#define __UTIL_H__
/**
* @brief decrease variable at given address with interrupts disabled
* @param value pointer to value to decrease
*/
void util_atomic_dec(uint32_t *value);
/**
* @brief increase variable at given address with interrupts disabled
* @param value pointer to value to increase
*/
void util_atomic_inc(uint32_t *value);
/* macros from: http://gareus.org/wiki/embedding_resources_in_executables */
/**
* @brief macros to access resource data that has been added using objcopy or ld
*/
#define EXTLD(NAME) \
extern const unsigned char _binary_ ## NAME ## _start[]; \
extern const unsigned char _binary_ ## NAME ## _end[]
#define LDVAR(NAME) _binary_ ## NAME ## _start
#define LDLEN(NAME) ((_binary_ ## NAME ## _end) - (_binary_ ## NAME ## _start))
/* simple binary search */
/* crit returns negative if the tested value is too high, positive if too low, 0 if perfect */
typedef int (*CritFunc)(int);
int bin_search(int lo, int hi, CritFunc crit);
#endif
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...