Cleanup and refactoring of the STM32w port
This is a general cleanup of things like code style issues and code structure of the STM32w port to make it more like the rest of Contiki is structured.
This commit is contained in:
parent
12b3d02ba1
commit
a5046e83c7
118 changed files with 4470 additions and 4281 deletions
|
@ -1,3 +1,9 @@
|
|||
/**
|
||||
* \addtogroup mb851-platform
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010, STMicroelectronics.
|
||||
* All rights reserved.
|
||||
|
@ -27,8 +33,6 @@
|
|||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki OS
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -41,43 +45,53 @@
|
|||
#ifndef __RTIMER_ARCH_H__
|
||||
#define __RTIMER_ARCH_H__
|
||||
|
||||
#define RTIMER_ARCH_RES_341US 0
|
||||
#define RTIMER_ARCH_RES_171US 1
|
||||
#define RTIMER_ARCH_RES_85US 2
|
||||
|
||||
#include "contiki-conf.h"
|
||||
#include "sys/clock.h"
|
||||
|
||||
#ifdef RTIMER_ARCH_CONF_RESOLUTION
|
||||
#define RTIMER_ARCH_RESOLUTION RTIMER_ARCH_CONF_RESOLUTION
|
||||
#else /* RTIMER_ARCH_CONF_RESOLUTION */
|
||||
#define RTIMER_ARCH_RESOLUTION RTIMER_ARCH_RES_171US
|
||||
#endif /* RTIMER_ARCH_CONF_RESOLUTION */
|
||||
|
||||
//#define RT_RESOLUTION RES_85US
|
||||
#ifdef RT_CONF_RESOLUTION
|
||||
#define RT_RESOLUTION RT_CONF_RESOLUTION
|
||||
#else
|
||||
#define RT_RESOLUTION RES_171US
|
||||
#endif
|
||||
/*
|
||||
* If it was possible to define a custom size for the rtimer_clock_t
|
||||
* type: typedef unsigned long long rtimer_clock_t; Only 48 bit are
|
||||
* used. It's enough for hundreds of years.
|
||||
*/
|
||||
#if RTIMER_ARCH_RESOLUTION == RTIMER_ARCH_RES_341US
|
||||
/* CK_CNT = PCLK/4096 = 12 MHz/4096 = 2929.6875 Hz */
|
||||
#define RTIMER_ARCH_PRESCALER 12
|
||||
/* One tick: 341.33 us. Using this value we will delay about 9.22 sec
|
||||
after a day. */
|
||||
#define RTIMER_ARCH_SECOND 2930
|
||||
#endif /* RTIMER_ARCH_RESOLUTION == RTIMER_ARCH_RES_341US */
|
||||
|
||||
#define RES_341US 0
|
||||
#define RES_171US 1
|
||||
#define RES_85US 2
|
||||
#if RTIMER_ARCH_RESOLUTION == RTIMER_ARCH_RES_171US
|
||||
/* CK_CNT = PCLK/2048 = 12 MHz/2048 = 5859.375 Hz */
|
||||
#define RTIMER_ARCH_PRESCALER 11
|
||||
/* One tick: 170.66 us. Using this value we will advance about 5.53
|
||||
sec after a day. */
|
||||
#define RTIMER_ARCH_SECOND 5859
|
||||
#endif /* RTIMER_ARCH_RESOLUTION == RTIMER_ARCH_RES_171US */
|
||||
|
||||
// If it was possible to define a custom size for the rtimer_clock_t type:
|
||||
//typedef unsigned long long rtimer_clock_t; // Only 48 bit are used. It's enough for hundreds of years.
|
||||
|
||||
#if RT_RESOLUTION == RES_341US
|
||||
#define RT_PRESCALER 12 // CK_CNT = PCLK/4096 = 12 MHz/4096 = 2929.6875 Hz
|
||||
#define RTIMER_ARCH_SECOND 2930 // One tick: 341.33 us. Using this value we will delay about 9.22 sec after a day.
|
||||
#endif /* RT_RESOLUTION == RES_341US */
|
||||
|
||||
#if RT_RESOLUTION == RES_171US
|
||||
#define RT_PRESCALER 11 // CK_CNT = PCLK/2048 = 12 MHz/2048 = 5859.375 Hz
|
||||
#define RTIMER_ARCH_SECOND 5859 // One tick: 170.66 us. Using this value we will advance about 5.53 sec after a day.
|
||||
#endif /* RT_RESOLUTION == RES_171US */
|
||||
|
||||
#if RT_RESOLUTION == RES_85US
|
||||
#define RT_PRESCALER 10 // CK_CNT = PCLK/2048 = 12 MHz/2048 = 5859.375 Hz
|
||||
#define RTIMER_ARCH_SECOND 11719 // One tick: 85.33 us. Using this value we will delay about 1.84 sec after a day.
|
||||
#endif /* RT_RESOLUTION == RES_85US */
|
||||
#if RTIMER_ARCH_RESOLUTION == RTIMER_ARCH_RES_85US
|
||||
/* CK_CNT = PCLK/2048 = 12 MHz/2048 = 5859.375 Hz */
|
||||
#define RTIMER_ARCH__PRESCALER 10
|
||||
/* One tick: 85.33 us. Using this value we will delay about 1.84 sec
|
||||
after a day. */
|
||||
#define RTIMER_ARCH_SECOND 11719
|
||||
#endif /* RTIMER_ARCH_RESOLUTION == RTIMER_ARCH_RES_85US */
|
||||
|
||||
rtimer_clock_t rtimer_arch_now(void);
|
||||
//#define rtimer_arch_now() clock_time()
|
||||
|
||||
void rtimer_arch_disable_irq(void);
|
||||
|
||||
void rtimer_arch_enable_irq(void);
|
||||
|
||||
#endif /* __RTIMER_ARCH_H__ */
|
||||
/** @} */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue