Define systick's registers
This commit is contained in:
parent
fb1c11132f
commit
7ba9063d02
90
drv/stk_regs.h
Normal file
90
drv/stk_regs.h
Normal file
@ -0,0 +1,90 @@
|
||||
/** @file stk_regs.h
|
||||
* Module defining systick (STK) registers.
|
||||
*
|
||||
* Mainly made to be used by the stk module. It is recommanded to go through
|
||||
* the functions provided by that module instead of directly using the registers
|
||||
* defined here.
|
||||
*/
|
||||
|
||||
#ifndef _STK_REGS_H_
|
||||
#define _STK_REGS_H_
|
||||
|
||||
//--includes--------------------------------------------------------------------
|
||||
|
||||
#include "reg.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
//--type definitions------------------------------------------------------------
|
||||
|
||||
#define STK_BASE_ADDRESS 0xE000E010
|
||||
|
||||
union STK_CTRL {
|
||||
struct __attribute__((packed)) {
|
||||
uint32_t ENABLE:1;
|
||||
uint32_t TICKINT:1;
|
||||
uint32_t CLKSOURCE:1;
|
||||
uint32_t reserved1:13;
|
||||
uint32_t COUNTFLAG:1;
|
||||
uint32_t reserved2:15;
|
||||
};
|
||||
uint32_t word;
|
||||
};
|
||||
|
||||
#define STK_CTRL_ENABLE reg_def( 0, 1)
|
||||
#define STK_CTRL_TICKINT reg_def( 1, 1)
|
||||
#define STK_CTRL_CLKSOURCE reg_def( 2, 1)
|
||||
#define STK_CTRL_reserved reg_def( 3, 13)
|
||||
#define STK_CTRL_COUNTFLAG reg_def(16, 1)
|
||||
#define STK_CTRL_reserved2 reg_def(17, 15)
|
||||
|
||||
union STK_LOAD {
|
||||
struct __attribute__((packed)) {
|
||||
uint32_t RELOAD:24;
|
||||
uint32_t reserved1:8;
|
||||
};
|
||||
uint32_t word;
|
||||
};
|
||||
|
||||
#define STK_LOAD_RELOAD reg_def( 0, 24)
|
||||
#define STK_LOAD_reserved1 reg_def(24, 8)
|
||||
|
||||
union STK_VAL {
|
||||
struct __attribute__((packed)) {
|
||||
uint32_t CURRENT:24;
|
||||
uint32_t reserved1:8;
|
||||
};
|
||||
uint32_t word;
|
||||
};
|
||||
|
||||
#define STK_VAL_CURRENT reg_def( 0, 24)
|
||||
#define STK_VAL_reserved1 reg_def(24, 8)
|
||||
|
||||
union STK_CALIB {
|
||||
struct __attribute__((packed)) {
|
||||
uint32_t TENMS:24;
|
||||
uint32_t reserved1:6;
|
||||
uint32_t SKEW:1;
|
||||
uint32_t NOREF:1;
|
||||
};
|
||||
uint32_t word;
|
||||
};
|
||||
|
||||
#define STK_CALIB_RELOAD reg_def( 0, 24)
|
||||
#define STK_CALIB_reserved1 reg_def(24, 6)
|
||||
#define STK_CALIB_SKEW reg_def(30, 1)
|
||||
#define STK_CALIB_NOREF reg_def(31, 1)
|
||||
|
||||
struct __attribute__((packed)) STK {
|
||||
union STK_CTRL CTRL;
|
||||
union STK_LOAD LOAD;
|
||||
union STK_VAL VAL;
|
||||
union STK_CALIB CALIB;
|
||||
};
|
||||
|
||||
|
||||
//--functions-------------------------------------------------------------------
|
||||
|
||||
#endif //_STK_REGS_H_
|
||||
|
||||
Loading…
Reference in New Issue
Block a user