User guide
CIF Peripheral Model - SimpleTimer
CoMET Version 5.9 – Tutorial 121
#include "vastdef.h"
#include "tspi.h"
#include "printf_to_tspi.h"
/* This section copied from SimpleTimer.h */
/* SimpleTimer register offsets. This section copied from SimpleTimer.h */
#define GTR_OFFSET 0x00000000 /* General Timer Register */
#define TER_OFFSET 0x00000008 /* Timer Enable Register */
#define TIER_OFFSET 0x00000010 /* Timer Interrupt Enable Register */
#define TIFR_OFFSET 0x00000018 /* Timer Interrupt Flag Register */
#define MTR1_OFFSET 0x00000028 /* Match Timer Register 1 */
#define MTR2_OFFSET 0x00000030 /* Match Timer Register 2 */
#define TER_ENABLE_1 0x01
#define TER_ENABLE_2 0x02
#define TER_ENABLE_ALL (TER_ENABLE_1 | TER_ENABLE_2)
#define TER_ENABLE_NONE 0x00
#define TIER_ENABLE_1 0x01
#define TIER_ENABLE_2 0x02
#define TIER_ENABLE_NONE 0x00
#define TIER_ENABLE_ALL (TIER_ENABLE_1 | TIER_ENABLE_2)
#define TIFR_SET_1 0x01
#define TIFR_SET_2 0x02
#define TIFR_SET_ALL (TIFR_SET_1 | TIFR_SET_2)
#define TIFR_SET_NONE 0x00
#define MTR_1 1 // id for MTR1
#define MTR_2 2 // id for MTR2
#define MTR_ALL 3 // id for both MTR1 and MTR2
/* End section copied from SimpleTimer.h */
#define SIMPLETIMER1_BASE 0x90000000 /* Base address of SimpleTimer1
instance */
#define GTR_PTR (SIMPLETIMER1_BASE + GTR_OFFSET) /* General Timer Register
*/
#define TER_PTR (SIMPLETIMER1_BASE + TER_OFFSET) /* Timer Enable Register
*/
#define TIER_PTR (SIMPLETIMER1_BASE + TIER_OFFSET) /* Timer Interrupt Enable
Register */
#define TIFR_PTR (SIMPLETIMER1_BASE + TIFR_OFFSET) /* Timer Interrupt Flag
Register */
#define MTR1_PTR (SIMPLETIMER1_BASE + MTR1_OFFSET) /* Match Timer Register 1
*/
#define MTR2_PTR (SIMPLETIMER1_BASE + MTR2_OFFSET) /* Match Timer Register 2
*/
#define MATCH_TEST_VALUE 0x0000FF00
#define MAX_INTERRUPTS 3
#define MAX_LOOPS 1
void setSimpleTimerTime(tWord32 time);
tWord32 getSimpleTimerTime();
void setSimpleTimerMtr(tWord32 time, tInt8 mtrId);
tWord32 getSimpleTimerMtr(tInt8 mtrId);
void enableMtr(tInt8 mtrId);
void disableMtr(tInt8 mtrId);
void deAssertInterrupt(tInt8 mtrId);