26,10 → 26,10 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
|
/** @addtogroup arm32 |
/** @addtogroup arm32 |
* @{ |
*/ |
/** @file |
/** @file |
* @brief Declarations of functions implemented in assembly. |
*/ |
|
36,6 → 36,7 |
#ifndef KERN_arm32_ASM_H_ |
#define KERN_arm32_ASM_H_ |
|
#include <typedefs.h> |
#include <arch/types.h> |
#include <arch/stack.h> |
#include <config.h> |
46,19 → 47,50 |
{ |
} |
|
static inline void pio_write_8(ioport8_t *port, uint8_t v) |
{ |
*port = v; |
} |
|
static inline void pio_write_16(ioport16_t *port, uint16_t v) |
{ |
*port = v; |
} |
|
static inline void pio_write_32(ioport32_t *port, uint32_t v) |
{ |
*port = v; |
} |
|
static inline uint8_t pio_read_8(ioport8_t *port) |
{ |
return *port; |
} |
|
static inline uint16_t pio_read_16(ioport16_t *port) |
{ |
return *port; |
} |
|
static inline uint32_t pio_read_32(ioport32_t *port) |
{ |
return *port; |
} |
|
/** Return base address of current stack. |
* |
* |
* Return the base address of the current stack. |
* The stack is assumed to be STACK_SIZE bytes long. |
* The stack must start on page boundary. |
* |
*/ |
static inline uintptr_t get_stack_base(void) |
{ |
uintptr_t v; |
asm volatile ( |
"and %0, sp, %1\n" |
: "=r" (v) |
: "r" (~(STACK_SIZE - 1)) |
"and %[v], sp, %[size]\n" |
: [v] "=r" (v) |
: [size] "r" (~(STACK_SIZE - 1)) |
); |
return v; |
} |