#ifndef lib_callbacks_h #define lib_callbacks_h /* Cesar project {{{ * * Copyright (C) 2012 Spidcom * * <<>> * * }}} */ /** * \file lib/callbacks.h * \brief Macro to use to register callbacks. * \ingroup lib */ #if defined (ECOS) && ECOS && defined (__sparc__) /** * Insert the callback function in the variable in section callback * \param f the function. * \return the variable to the pointed function. */ # define CALLBACK(f) \ ({ static typeof (f) * volatile p \ __attribute__ ((section (".callbacks"))) = &(f); \ p; }) #else /* !defined (ECOS) && ECOS && (__sparc__) */ /** * Return the callback function * \param f the function. * \return the variable to the pointed function. */ # define CALLBACK(f) (f) #endif #endif /* lib_callbacks_h */