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

📄 target.c

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

/*         File: target.c                                                   
 *  Description: Target specifics for Star12
 */

#include "lin.h"
#include "target.h"

/* l_u8 LD_SERIAL[4] = {0x12, 0x34, 0x56, 0x78}; */


/* **************************************************************************
 * init_environment
 */
void init_environment(void)
{
} /* init_environment */

/* **************************************************************************
 * init_target
 */
void init_target (void)
{
  /* Setup free-running us counter */
  TSCR |= 0x80;     /* Enable counter */
  TMSK2 &= 0xf8;
  TMSK2 |= 0x03;    /* prescale with 8 */

} /* init_target*/

/* ************************************************************************ 
 * l_get_us_counter
 */
l_u16 l_get_us_counter (void)
{
  l_u16 tmp;

  tmp = TCNT;
  return (tmp);

} /* l_get_us_counter */

/* ************************************************************************ 
 * l_sys_irq_restore
 */
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 CCRvalue;
  
  /* Get and set the I flag in the CCR value */
  asm 
  {
		TFR 	CCR,A			; transfer CCR to Ackumulator													
		STAA	CCRvalue  ; store CCR			
		ORCC	#$10		  ; disable interrupts 	
  }

  /* Get the I value */
  CCRvalue &= 0x10;

  return CCRvalue;
} /* v_ctl_ints_disable */

⌨️ 快捷键说明

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