Revision 9ff1b5ea801f742b0b576eae2f8d86efd0efca1f authored by Eosm Developer on 01 January 2017, 15:18:08 UTC, committed by Eosm Developer on 01 January 2017, 15:18:08 UTC
1 parent deeaeb1
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
Computing file changes ...