Update code due to new rules
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (c) 2017-2019 by Löwenware Ltd
|
||||
* Please, refer LICENSE file for legal information
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/**
|
||||
* @file timer.c
|
||||
* @author Ilja Kartašov <ik@lowenware.com>
|
||||
* @brief
|
||||
*
|
||||
* @see https://lowenware.com/
|
||||
*/
|
||||
|
||||
#include <aarch64/aarch64.h>
|
||||
#include <aarch64/bcm2837.h>
|
||||
#include "timer.h"
|
||||
#include "log.h"
|
||||
|
||||
const unsigned int m_interval = 200000;
|
||||
unsigned int m_current = 0;
|
||||
|
||||
void
|
||||
k_timer_init(void)
|
||||
{
|
||||
m_current = aarch64_get32r(TIMER_CLO);
|
||||
m_current += m_interval;
|
||||
aarch64_set32r(TIMER_C1, m_current);
|
||||
}
|
||||
|
||||
void
|
||||
k_timer_irq_handler(void)
|
||||
{
|
||||
m_current += m_interval;
|
||||
aarch64_set32r(TIMER_C1, m_current);
|
||||
aarch64_set32r(TIMER_CS, TIMER_CS_M1);
|
||||
k_logs("Timer: ");
|
||||
k_logu(m_current, 10);
|
||||
k_logs("\r\n");
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (c) 2017-2019 by Löwenware Ltd
|
||||
* Please, refer LICENSE file for legal information
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/**
|
||||
* @file timer.h
|
||||
* @author Ilja Kartašov <ik@lowenware.com>
|
||||
* @brief
|
||||
*
|
||||
* @see https://lowenware.com/
|
||||
*/
|
||||
|
||||
#ifndef TIMER_H_8D327261_47D6_4832_8DC5_31BF1614A21F
|
||||
#define TIMER_H_8D327261_47D6_4832_8DC5_31BF1614A21F
|
||||
|
||||
void
|
||||
k_timer_init(void);
|
||||
|
||||
void
|
||||
k_timer_irq_handler(void);
|
||||
|
||||
#endif /* !TIMER_H */
|
||||
Reference in New Issue
Block a user