⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 board.h

📁 基于16位单片机的符合osek标准的操作系统
💻 H
字号:
/* board.h - header for Motorola Barracuda EVB. */
 
/* 
 * 
 * Copyright (c) 2002 by 3SOFT GmbH
 * - all rights reserved -
 *
 * 3SOFT GmbH
 * Phone: +49 (0)9131 7701 0
 * Frauenweiherstr. 14, 91058 Erlangen
 * GERMANY
 *
*/

/* 
modification history
--------------------
02b,30jul02,drothler changed boardGetTimeInNsRTI()
02a,29jun01,drothler changed address
01a,30oct00,cs   written
*/

#ifndef __BOARD_H
#define __BOARD_H

#define BOARD_CPU_FREQ_MHZ 	2	
#define BOARD_CPU_FREQ_HZ 	2000000

#define BOARD_OSC_FREQ_MHZ 	4
#define BOARD_OSC_FREQ_HZ 	4000000

#define BOARD_TCNT_PRESCALER    2


/***************************************************************************/
/* Important Note for Integration of OSEKTime & Flexray                    */
/*                                                                         */
/* On of these makros must be defined for usage of OSEKTime with Flexray   */
/* Beware of arithmetik overflows !!                                       */
/* TTPRESCALER is the  Prescale Value calculated from BOARD_TCNT_PRESCALER */


/* The slow version is working for  all combinations of PERIPHERAL_CLOCK_MHZ and TTPRESCALER */
#define OSEKOSNS2TICKS(ns) ((ttTickType)((long)PERIPHERAL_CLOCK_MHZ*(long)(ns))/(1000 * TTPRESCALER))
#define OSEKOSMUS2TICKS(mus) ((ttTickType)((long)PERIPHERAL_CLOCK_MHZ*(long)(mus))/(TTPRESCALER))


/*  If Communication round and PERIPHERAL_CLOCK_MHZ is rather small this should work */
/*
#define OSEKOSNS2TICKS(ns) ((ttTickType)(PERIPHERAL_CLOCK_MHZ*(ns))/(1000 * TTPRESCALER))
#define OSEKOSMUS2TICKS(mus) ((ttTickType)(PERIPHERAL_CLOCK_MHZ*(mus))/(TTPRESCALER))
*/

/* If PERIPHERAL_CLOCK_MHZ / TTPRESCALER has no fractional part the following makro is ok : */
/*
#define OSEKOSNS2TICKS(ns) ((ttTickType)(PERIPHERAL_CLOCK_MHZ/TTPRESCALER*(ns))/(1000))
#define OSEKOSMUS2TICKS(mus) ((ttTickType)(PERIPHERAL_CLOCK_MHZ/TTPRESCALER*(mus)))
*/





#ifndef HC12_IO_BASE_ADR
#define HC12_IO_BASE_ADR	(0x0000) /* overlap with Flash */
#endif
#ifndef HC12_RAM_BASE_ADR
#define HC12_RAM_BASE_ADR	(0x0000)
#endif
#ifndef HC12_EEPROM_BASE_ADR
#define HC12_EEPROM_BASE_ADR	(0x0000)
#endif

/* If you want to hide macros for register names (e.g. PORTA, TCNT, TIOS) remove the following line. */
#define INCLUDE_RegNames

/* If you want to use real functions for the OSEK API, uncomment the following.
   This may lead to less performance but less code size. */
/* #define INCLUDE_RealOSEKFunctions */

/* Includes can be forced to be local by defining INCLUDE_LocalInclude: */
/* #define INCLUDE_LocalInclude */

/* support for real-time clock */

/* Setup of RTI. Used if RTI is selected as system counter. */

/* 4 Bits (Bits 3-0) of RTICTL : */
#define BOARD_RTICTL_MODULUS		0
/* 3 Bits (Bits 6-4) of RTICTL : */
#define BOARD_RTICTL_PRESCALE		7

#define boardGetTimeInNsRTI()	((1000/BOARD_OSC_FREQ_MHZ)*(BOARD_RTICTL_MODULUS+1)*(2^(10+BOARD_RTICTL_PRESCALE-1)))

/* You can define the LEDS_xxx macros if your HW have LEDs */

#define LEDS_SET(x) (PORTB = ~(x)) 
#define LEDS_INIT() (DDRB = 0xff)
#define LEDS_SET1(x) (PORTA = ~(x)) 
#define LEDS_INIT1() (DDRA = 0xff)

/* external declarations for the startup-routine. */
 
#ifdef __HIWARE__
extern void near boardInvalidInterrupt(void);
#ifdef INCLUDE_VectorTable
extern void near boardStartup(void);
#else
extern void __interrupt 0 boardStartup(void);
#endif
#endif
#ifdef __COSMIC__
#define INCLUDE_VectorTable
extern @near @interrupt void boardStartup(void);
extern @near void boardInvalidInterrupt(void);
#endif

#endif /* board.h */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -