Changed to use stdint types.
This commit is contained in:
@@ -23,15 +23,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/* Type definitions for shorter and nicer code */
|
||||
typedef int8_t s8;
|
||||
typedef int16_t s16;
|
||||
typedef int32_t s32;
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
typedef uint64_t u64;
|
||||
|
||||
/* This must be placed around external function declaration for C++
|
||||
* support. */
|
||||
#ifdef __cplusplus
|
||||
@@ -56,10 +47,10 @@ typedef uint64_t u64;
|
||||
|
||||
|
||||
/* Generic memory-mapped I/O accessor functions */
|
||||
#define MMIO8(addr) (*(volatile u8 *)(addr))
|
||||
#define MMIO16(addr) (*(volatile u16 *)(addr))
|
||||
#define MMIO32(addr) (*(volatile u32 *)(addr))
|
||||
#define MMIO64(addr) (*(volatile u64 *)(addr))
|
||||
#define MMIO8(addr) (*(volatile uint8_t *)(addr))
|
||||
#define MMIO16(addr) (*(volatile uint16_t *)(addr))
|
||||
#define MMIO32(addr) (*(volatile uint32_t *)(addr))
|
||||
#define MMIO64(addr) (*(volatile uint64_t *)(addr))
|
||||
|
||||
/* Generic bit definition */
|
||||
#define BIT0 (1<<0)
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#define FPB_REMAP MMIO32(FPB_BASE + 4)
|
||||
|
||||
/* Flash Patch Comparator (FPB_COMPx) */
|
||||
#define FPB_COMP (volatile u32 *)(FPB_BASE + 8)
|
||||
#define FPB_COMP (volatile uint32_t *)(FPB_BASE + 8)
|
||||
|
||||
/* TODO: PID, CID */
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
/* --- ITM registers ------------------------------------------------------- */
|
||||
|
||||
/* Stimulus Port x (ITM_STIM[x]) */
|
||||
#define ITM_STIM ((volatile u32*)(ITM_BASE))
|
||||
#define ITM_STIM ((volatile uint32_t*)(ITM_BASE))
|
||||
|
||||
/* Trace Enable ports (ITM_TER[x]) */
|
||||
#define ITM_TER ((volatile u32*)(ITM_BASE + 0xE00))
|
||||
#define ITM_TER ((volatile uint32_t*)(ITM_BASE + 0xE00))
|
||||
|
||||
/* Trace Privilege (ITM_TPR) */
|
||||
#define ITM_TPR MMIO32(ITM_BASE + 0xE40)
|
||||
|
||||
@@ -118,15 +118,15 @@ IRQ numbers -3 and -6 to -9 are reserved
|
||||
|
||||
BEGIN_DECLS
|
||||
|
||||
void nvic_enable_irq(u8 irqn);
|
||||
void nvic_disable_irq(u8 irqn);
|
||||
u8 nvic_get_pending_irq(u8 irqn);
|
||||
void nvic_set_pending_irq(u8 irqn);
|
||||
void nvic_clear_pending_irq(u8 irqn);
|
||||
u8 nvic_get_active_irq(u8 irqn);
|
||||
u8 nvic_get_irq_enabled(u8 irqn);
|
||||
void nvic_set_priority(u8 irqn, u8 priority);
|
||||
void nvic_generate_software_interrupt(u16 irqn);
|
||||
void nvic_enable_irq(uint8_t irqn);
|
||||
void nvic_disable_irq(uint8_t irqn);
|
||||
uint8_t nvic_get_pending_irq(uint8_t irqn);
|
||||
void nvic_set_pending_irq(uint8_t irqn);
|
||||
void nvic_clear_pending_irq(uint8_t irqn);
|
||||
uint8_t nvic_get_active_irq(uint8_t irqn);
|
||||
uint8_t nvic_get_irq_enabled(uint8_t irqn);
|
||||
void nvic_set_priority(uint8_t irqn, uint8_t priority);
|
||||
void nvic_generate_software_interrupt(uint16_t irqn);
|
||||
|
||||
void WEAK reset_handler(void);
|
||||
void WEAK nmi_handler(void);
|
||||
|
||||
@@ -366,14 +366,14 @@
|
||||
BEGIN_DECLS
|
||||
|
||||
struct scb_exception_stack_frame {
|
||||
u32 r0;
|
||||
u32 r1;
|
||||
u32 r2;
|
||||
u32 r3;
|
||||
u32 r12;
|
||||
u32 lr;
|
||||
u32 pc;
|
||||
u32 xpsr;
|
||||
uint32_t r0;
|
||||
uint32_t r1;
|
||||
uint32_t r2;
|
||||
uint32_t r3;
|
||||
uint32_t r12;
|
||||
uint32_t lr;
|
||||
uint32_t pc;
|
||||
uint32_t xpsr;
|
||||
} __packed;
|
||||
|
||||
#define SCB_GET_EXCEPTION_STACK_FRAME(f) \
|
||||
@@ -384,7 +384,7 @@ struct scb_exception_stack_frame {
|
||||
|
||||
void scb_reset_core(void) __attribute__((noreturn, naked));
|
||||
void scb_reset_system(void) __attribute__((noreturn, naked));
|
||||
void scb_set_priority_grouping(u32 prigroup);
|
||||
void scb_set_priority_grouping(uint32_t prigroup);
|
||||
|
||||
/* TODO: */
|
||||
|
||||
|
||||
@@ -29,15 +29,15 @@
|
||||
|
||||
/* --- Exclusive load and store instructions ------------------------------- */
|
||||
|
||||
u32 __ldrex(volatile u32 *addr);
|
||||
u32 __strex(u32 val, volatile u32 *addr);
|
||||
uint32_t __ldrex(volatile uint32_t *addr);
|
||||
uint32_t __strex(uint32_t val, volatile uint32_t *addr);
|
||||
void __dmb(void);
|
||||
|
||||
/* --- Convenience functions ----------------------------------------------- */
|
||||
|
||||
/* Here we implement some simple synchronisation primatives. */
|
||||
|
||||
typedef u32 mutex_t;
|
||||
typedef uint32_t mutex_t;
|
||||
|
||||
#define MUTEX_UNLOCKED 0
|
||||
#define MUTEX_LOCKED 1
|
||||
|
||||
@@ -95,17 +95,17 @@ LGPL License Terms @ref lgpl_license
|
||||
|
||||
BEGIN_DECLS
|
||||
|
||||
void systick_set_reload(u32 value);
|
||||
u32 systick_get_reload(void);
|
||||
u32 systick_get_value(void);
|
||||
void systick_set_clocksource(u8 clocksource);
|
||||
void systick_set_reload(uint32_t value);
|
||||
uint32_t systick_get_reload(void);
|
||||
uint32_t systick_get_value(void);
|
||||
void systick_set_clocksource(uint8_t clocksource);
|
||||
void systick_interrupt_enable(void);
|
||||
void systick_interrupt_disable(void);
|
||||
void systick_counter_enable(void);
|
||||
void systick_counter_disable(void);
|
||||
u8 systick_get_countflag(void);
|
||||
uint8_t systick_get_countflag(void);
|
||||
|
||||
u32 systick_get_calib(void);
|
||||
uint32_t systick_get_calib(void);
|
||||
|
||||
END_DECLS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user