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

📄 target.c

📁 MC68HC908GR60A LIN-BUS源码(编译环境:CodeWarriorV3.1)
💻 C
字号:
/* ************************************************************************ */
/*                                                                          */
/*                  Volcano Communications technologies AB                  */
/*                            All rights reserved                           */
/*                                                                          */
/* ************************************************************************ */

/*         File: target.c                                                   */
/*  Description: Target specific functions for COS08SCI LTP example appli-  */
/*               cation                                                     */
/*                                                                          */

#include "target.h"

/* ************************************************************************ */
/* Perform initialisation of development system (if any)                    */
void init_environment(void)
{
} /* init_environment */

/* ************************************************************************ */
/* Perform initialisation of target. Initialise a free running counter at   */
/* 1Mhz.                                                                    */
void init_target(void)
{
  /* Initialize the Timebase interface module 1 */
  TIMERSC = INITTIMER;    /* Reset timer set prescaler */
/* # prescaler value of 4 when Mon08Cyclone clock is used */
/* # prescaler value of 2 when 8MHz clock source is used */  
  
  TIMERMOD = 0xFFFF;	  /* Disable modulo conter  */

  /* Enable LIN GZ48 EVB*/
  /*DDRB = 0xFF;
  PTB = 0x20;*/
  
  /* Enable LIN */
  DDRE = 0x04;
  PTE  = 0x04;

} /* init_target*/

/* ************************************************************************ */
/* Read timer channel A (free running counter at 1Mhz) and return current   */
/* value.                                                                   */
l_u16 l_get_us_counter (void)
{

volatile l_u16 tmp;

  tmp = TIMERCNTH;
  tmp = (tmp << 8) | TIMERCNTL;
  return(tmp);

} /* l_get_us_counter */

/* ************************************************************************ */
/* Restores interrupt level to the previous level, as indicated by the in-  */
/* put previous. On the hc08 family the interrupt level can only be either */
/* "interrupts enabled" or "interrupts disabled".                           */
void l_sys_irq_restore(l_irqmask previous)
{
  if (previous)
  {
    asm sei;  /* disable_interrupt */
  }
  else
  {
    asm cli;  /* enable_interrupt */
  }
} /* v_ctl_ints_restore */



/* ************************************************************************ */
/* Disable interrupts, and return the previous value of the interrupt le-   */
/* vel.                                                                     */
l_irqmask l_sys_irq_disable(void)
{
    l_irqmask x;
    
	asm sei; /* disable_interrupt */	
	x = __isflag_int_enabled();

	return(x);
    
} /* v_ctl_ints_disable */

⌨️ 快捷键说明

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