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

📄 target.h

📁 采用MC13213做的在SMAC协议基础上的发送程序,可作为点对点实验中的END DEVICE.
💻 H
📖 第 1 页 / 共 2 页
字号:
/************************************************************************************
* The global header file containing platform specific definitions for
* the embedded platform
*
* Author(s): Thomas O. Jensen
*
* (c) Copyright 2004, Freescale, Inc.  All rights reserved.
*
* Freescale Confidential Proprietary
* Digianswer Confidential
*
* No part of this document must be reproduced in any form - including copied,
* transcribed, printed or by any electronic means - without specific written
* permission from Freescale.
*
* Last Inspected:
* Last Tested:
************************************************************************************/

#ifndef _TARGET_SPECIFIC_H_
#define _TARGET_SPECIFIC_H_

//LR #include "gb60_io.h"
#include "FunctionalityDefines.h"

//**********************************************************************************
// Compiler warning removal pragmas
//**********************************************************************************

#define PLACE_CONST_SEG(segment) CONST_SEG segment
#define RESTORE_CONST_SEG CONST_SEG DEFAULT

#define PLACE_DATA_SEG(segment) DATA_SEG segment
#define RESTORE_DATA_SEG DATA_SEG DEFAULT

#define INLINE_NEXT_FUNCTION INLINE

#define Unreferenced_c            C5703
#define ConditionAlwaysTrue_c     C4000
#define ConditionAlwaysFalse_c    C4001
#define AssignmentInCondition_c   C5909
#define UnusedResultOfFunction_c  C1420
#define NonStandardConversion_c   C1805
#define InlineFunctionCall_c      C4301
#define RemovedDeadCode_c         C5660
#define ResultNotUsed_c           C4002
#define RecursiveFunctionCall_c   C1855

#define DISABLE_WARNING(msg) MESSAGE DISABLE msg
#define RESTORE_WARNING(msg) MESSAGE DEFAULT msg


//**********************************************************************************
// Define target Hardware platform:
//**********************************************************************************

#if !(defined(TARGET_DIG527_1) || defined(TARGET_DIG528_1) || defined(TARGET_DIG536_1) || defined(TARGET_DIG536_2) || defined(TARGET_DIG534_1) || defined(TARGET_DIG538_1) || defined(TARGET_AXIOM_GB60) )
// Enable target platform
//#define TARGET_DIG527_1
//#define TARGET_DIG528_1
#define TARGET_DIG528_2
//#define TARGET_DIG536_1 // SARD
//#define TARGET_DIG536_2 // SARD
//#define TARGET_DIG534_1
//#define TARGET_DIG538_1 // with module DIG537
//#define TARGET_AXIOM_GB60
#endif


//**********************************************************************************

#ifdef TARGET_AXIOM_GB60
  #define HWAssertAbelReset        PTDD &= ~0x80;    // Reset = 0;
  #define HWDeAssertAbelReset      PTDD |=  0x80;    // Reset = 1;

  #define RxTxDisable              PTDD &= ~0x40;    // RxTxEnable = 0;
  #define RxTxEnable               PTDD |=  0x40;    // RxTxEnable = 1;

  #define AttEnable                PTDD |=  0x20;    // PTD5
  #define AttDisable               PTDD &= ~0x20;

  #define LED1ON  PTFD &= ~0x01;                      // PTF0
  #define LED1OFF PTFD |= 0x01;
  #define LED1TOGGLE PTFD ^= 0x01;

  #define LED2ON  PTFD &= ~0x02;                      // PTF1
  #define LED2OFF PTFD |= 0x02;
  #define LED2TOGGLE PTFD ^= 0x02;

  #define LED3ON  PTFD &= ~0x04;                      // PTF2
  #define LED3OFF PTFD |= 0x04;
  #define LED3TOGGLE PTFD ^= 0x04;

  #define LED4ON  PTFD &= ~0x08;                      // PTF3
  #define LED4OFF PTFD |= 0x08;
  #define LED4TOGGLE PTFD ^= 0x08;

#define IsAbelActive()   (PTBD & (1<<4))
#ifdef I_AM_A_SNIFFER
  #define IsAbelCrcOk()    (0)
#else
  #define IsAbelCrcOk()    (PTBD & (1<<5))
#endif
#define IsAbelCcaBusy()  (PTBD & (1<<5))

#ifdef ANTENNE_SWITCH_ENABLED
  #define ENABLE_ANTENNESWITCH_PINS PTBDD |= 0xC0;
  #define RX_ANTENNE_ENABLED PTBD |= 0x40; PTBD &= ~0x80;
  #define TX_ANTENNE_ENABLED PTBD |= 0x80; PTBD &= ~0x40;
#else
  #define ENABLE_ANTENNESWITCH_PINS
  #define RX_ANTENNE_ENABLED
  #define TX_ANTENNE_ENABLED
#endif

// UART interface select SCI1
#define SELECT_SCI1

  // Setup Port B for ABEL GPIO 1+2
#define  ABEL_GPIO1    (1<<4)
#define  ABEL_GPIO2    (1<<5)

#define  mSETUP_PORT_A  PTAPE = 0x00;\
                        PTASE = 0x00;\
                        PTADD = 0x00;        //All Port A input

#define  mSETUP_PORT_B  PTBDD &= ~(ABEL_GPIO1 | ABEL_GPIO2); // Clear GPIO1 and GPIO2

#define  mSETUP_PORT_C    PTCD = 0x00;\
                        PTCPE = 0x00;\
                        PTCDD = 0x63;

#define  mSETUP_PORT_D  PTDPE = 0x00;\
                        PTDSE = 0x00;\
                        PTDDD = 0x01 | 0x20 | 0x40 | 0x80;


#endif TARGET_AXIOM_GB60

//**********************************************************************************

#ifdef TARGET_DIG527_1
  #define HWAssertAbelReset        PTDD &= ~0x80;    // Reset = 0;
  #define HWDeAssertAbelReset      PTDD |=  0x80;    // Reset = 1;

  #define RxTxDisable              PTDD &= ~0x40;    // RxTxEnable = 0;
  #define RxTxEnable               PTDD |=  0x40;    // RxTxEnable = 1;

 //  #define LED1ON  PTDD &= 0xFE;
//  #define LED1OFF PTDD |= 0x01;
//  #define LED1TOGGLE PTDD ^= 0x01;

  #define LED1ON  PTFD &= 0xFE;
  #define LED1OFF PTFD |= 0x01;
  #define LED1TOGGLE PTFD ^= 0x01;

  #define LED2ON  PTDD &= ~0x08;
  #define LED2OFF PTDD |= 0x08;
  #define LED2TOGGLE PTDD ^= 0x08;

  #define LED3ON  
  #define LED3OFF 
  #define LED3TOGGLE 

  #define LED4ON  
  #define LED4OFF 
  #define LED4TOGGLE 
  
      // UART interface select SCI1
    #define SELECT_SCI1
//    #define SELECT_SCI2

      // Setup Port B for ABEL GPIO 1+2
    #define  ABEL_GPIO1    (1<<4)
    #define  ABEL_GPIO2    (1<<5)
  
    #define ANTENNE_SWITCH_ENABLED
    #ifdef ANTENNE_SWITCH_ENABLED
      #define ENABLE_ANTENNESWITCH_PINS PTBDD |= 0xC0;
      #define RX_ANTENNE_ENABLED PTBD |= 0x40; PTBD &= ~0x80;
      #define TX_ANTENNE_ENABLED PTBD |= 0x80; PTBD &= ~0x40;
    #else
      #define ENABLE_ANTENNESWITCH_PINS
      #define RX_ANTENNE_ENABLED
      #define TX_ANTENNE_ENABLED
    #endif

      
    #define IsAbelActive()   (PTBD & (1<<4))
    #ifdef I_AM_A_SNIFFER
      #define IsAbelCrcOk()    (0)
    #else
      #define IsAbelCrcOk()    (PTBD & (1<<5))
    #endif
    #define IsAbelCcaBusy()  (PTBD & (1<<5))
    
    #define USE_LOW_POWER
#define mENTER_LOWPOWER  SIMOPT |= 0x20;PMCSC2 &=  ~0x02;__asm STOP;

#ifdef FLASH_LIB_ENABLED
  #define USE_NVM_QUICK_START
#endif FLASH_LIB_ENABLED                 

  
#endif

/*

#ifdef TARGET_DIG527_1
  #define HWAssertAbelReset        PTDD &= ~0x80;    // Reset = 0;
  #define HWDeAssertAbelReset      PTDD |=  0x80;    // Reset = 1;

  #define RxTxDisable              PTDD &= ~0x40;    // RxTxEnable = 0;
  #define RxTxEnable               PTDD |=  0x40;    // RxTxEnable = 1;

  #define LED1ON  PTDD &= 0xFE;
  #define LED1OFF PTDD |= 0x01;
  #define LED1TOGGLE PTDD ^= 0x01;

  #define LED2ON  PTDD &= 0xFD;
  #define LED2OFF PTDD |= 0x02;
  #define LED2TOGGLE PTDD ^= 0x02;

  #define LED3ON  PTDD &= 0xF7;
  #define LED3OFF PTDD |= 0x08;
  #define LED3TOGGLE PTDD ^= 0x08;

  #define LED4ON  PTDD &= 0xEF;
  #define LED4OFF PTDD |= 0x10;
  #define LED4TOGGLE PTDD ^= 0x10;
#endif TARGET_DIG527_1

*/


//**********************************************************************************

#ifdef TARGET_DIG528_1
  #define HWAssertAbelReset        PTBD &= ~0x02;    // Reset = 0;
  #define HWDeAssertAbelReset      PTBD |=  0x02;    // Reset = 1;

  #define RxTxEnable               PTBD |=  0x08;    // RxTxEnable = 1 (PTB3);
  #define RxTxDisable              PTBD &= ~0x08;    // RxTxEnable = 0 (PTB3);

  #define AttEnable                PTBD |=  0x04;    // PTB2
  #define AttDisable               PTBD &= ~0x04;

  #define AntSwRx                  PTBD &= ~0x40;    // PTB6
  #define AntSwTx                  PTBD |=  0x40;

  #define LED1ON  PTDD &= 0xFE;
  #define LED1OFF PTDD |= 0x01;
  #define LED1TOGGLE PTDD ^= 0x01;

  #define LED2ON  PTDD &= 0xFD;
  #define LED2OFF PTDD |= 0x02;
  #define LED2TOGGLE PTDD ^= 0x02;

  #define LED3ON  PTDD &= 0xF7;
  #define LED3OFF PTDD |= 0x08;
  #define LED3TOGGLE PTDD ^= 0x08;

  #define LED4ON  PTDD &= 0xEF;
  #define LED4OFF PTDD |= 0x10;
  #define LED4TOGGLE PTDD ^= 0x10;

  #define cPTADD_PortAIOsetup 0x00;

#define IsAbelActive()   (PTBD & (1<<4))
#ifdef I_AM_A_SNIFFER
  #define IsAbelCrcOk()    (0)
#else
  #define IsAbelCrcOk()    (PTBD & (1<<5))
#endif
#define IsAbelCcaBusy()  (PTBD & (1<<5))

#define ANTENNE_SWITCH_ENABLED

#ifdef ANTENNE_SWITCH_ENABLED
  #define ENABLE_ANTENNESWITCH_PINS PTBDD |= 0xC0;
  #define RX_ANTENNE_ENABLED PTBD &= ~0x40;     // PTB6 = 0
  #define TX_ANTENNE_ENABLED PTBD |= 0x40;      // PTB6 = 1
#else
  #define ENABLE_ANTENNESWITCH_PINS
  #define RX_ANTENNE_ENABLED
  #define TX_ANTENNE_ENABLED
#endif

// UART interface select SCI1 or SCI2- enable one
#define SELECT_SCI1
#define SELECT_SCI2

  // Setup Port B for ABEL GPIO 1+2
#define ABEL_GPIO1    (1<<4)
#define ABEL_GPIO2    (1<<5)

#define ABEL_RESET_PIN        (1<<1)
#define ABEL_ATT_PIN        (1<<2)
#define ABEL_RxTx_PIN       (1<<3)
#define ABEL_ANT_SWITCH_PIN (1<<6)

// The switches
#define mSWITCH1_MASK 0x10
#define mSWITCH2_MASK 0x20
#define mSWITCH3_MASK 0x40
#define mSWITCH4_MASK 0x80
#define mSWITCH_MASK 0xF0
#define mSWITCH_PORT_GET ((PTAD & mSWITCH_MASK) ^ mSWITCH_MASK)

#define  mSETUP_PORT_A  PTAPE = 0xF0;\
                        PTADD = 0x00;        //All Port A input

#define  mSETUP_PORT_B  PTBDD = (ABEL_RESET_PIN | ABEL_ATT_PIN | ABEL_RxTx_PIN | ABEL_ANT_SWITCH_PIN);

#define  mSETUP_PORT_C    PTCD = 0x00;\
                        PTCPE = 0x00;\
                        PTCDD = 0x63;

#define  mSETUP_PORT_D  PTDPE = 0x00;\
                        PTDDD = (0x01 | 0x02| 0x08 | 0x10);


#define USE_LOW_POWER
#define mENTER_LOWPOWER  SIMOPT |= 0x20;PMCSC2 &=  ~0x02;__asm STOP;

#if defined FLASH_LIB_ENABLED || defined BOOTLOADER_ENABLED
  #define USE_NVM_QUICK_START
#endif defined FLASH_LIB_ENABLED || defined BOOTLOADER_ENABLED                


#endif TARGET_DIG528_1

//**********************************************************************************

#ifdef TARGET_DIG534_1

  #define FTDI_USB

  #define HWAssertAbelReset        PTBDD |=  0x02; PTBD &= ~0x02;    // Reset = 0;
  #define HWDeAssertAbelReset      PTBDD |=  0x02; PTBD |=  0x02;    // Reset = 1;
//  #define HWAssertAbelReset        PTBD &= ~0x02;    // Reset = 0;
//  #define HWDeAssertAbelReset      PTBD |=  0x02;    // Reset = 1;

  #define RxTxEnable               PTBD |=  0x08;    // RxTxEnable = 1 (PTB3);
  #define RxTxDisable              PTBD &= ~0x08;    // RxTxEnable = 0 (PTB3);

  #define AttEnable                PTBD |=  0x04;    // PTB2
  #define AttDisable               PTBD &= ~0x04;

  #define AntSwRx                  PTBD &= ~0x40;    // PTB6
  #define AntSwTx                  PTBD |=  0x40;

   #define cPTADD_PortAIOsetup 0x00;

  #define GREEN_LED_OFF PTDD |= 0x08;
  #define GREEN_LED_ON  PTDD &= ~0x08;
  #define GREEN_LED_TOGGLE PTDD ^= 0x08;

  #define RED_LED_OFF PTDD |= 0x10;
  #define RED_LED_ON  PTDD &= ~0x10;
  #define RED_LED_TOGGLE PTDD ^= 0x10;


#ifdef SYSTEM_CLOCK_16MHZ
#define CompareHighValue 0x09;
#define CompareLowValue 0x00;
#endif

#ifdef SYSTEM_CLOCK_8MHZ
#define CompareHighValue 0x04;
#define CompareLowValue 0x80;
#endif


#define  mRestartLockTimer  TPM1C0SC &= 0x3f; \
                            TPM1C0VH = CompareHighValue; \
                            TPM1C0VL = CompareLowValue; \
                            TPM1CNTL = 0; \
                            TPM1C0SC = 0x50;

#define IsAbelActive()   (PTBD & (1<<4))
#define IsAbelCrcOk()    (PTBD & (1<<5))
//#define IsAbelCrcOk()    (0)
#define IsAbelCcaBusy()  (PTBD & (1<<5))

#define ANTENNE_SWITCH_ENABLED

#ifdef ANTENNE_SWITCH_ENABLED
  #define ENABLE_ANTENNESWITCH_PINS PTBDD |= 0x40;
  #define RX_ANTENNE_ENABLED PTBD &= ~0x40;     // PTB6 = 0
  #define TX_ANTENNE_ENABLED PTBD |= 0x40;      // PTB6 = 1
#else
  #define ENABLE_ANTENNESWITCH_PINS
  #define RX_ANTENNE_ENABLED
  #define TX_ANTENNE_ENABLED
#endif

// UART interface select SCI1 or SCI2- enable one
#define SELECT_SCI1
//#define SELECT_SCI2

  // Setup Port B for ABEL GPIO 1+2
#define ABEL_GPIO1    (1<<4)
#define ABEL_GPIO2    (1<<5)

#define ABEL_RESET_PIN        (1<<1)
#define ABEL_ATT_PIN        (1<<2)
#define ABEL_RxTx_PIN       (1<<3)
#define ABEL_ANT_SWITCH_PIN (1<<6)


#define  mSETUP_PORT_A  PTAPE = 0x00;\
                        PTASE = 0x00;\
                        PTADD = 0x00;        //All Port A input

#define  mSETUP_PORT_B  PTBDD = (ABEL_RESET_PIN | ABEL_ATT_PIN | ABEL_RxTx_PIN | ABEL_ANT_SWITCH_PIN);
  // Setup port B
  //PTBDD = 0x08; //Bit 3 as ouput. Bit 3 is RxTxEnable. Obs bit 1 is Reset, but is controlled within HWAssertAbelReset/HWDeAssertAbelReset
  // Setup Port B for ABEL GPIO 1+2
  //  PTBDD &= ~((1<<4) | (1<<5)); // Clear bit 4+5 PTB4 = GPIO1, PTB5 = GPIO2


#define  mSETUP_PORT_C    PTCD = 0x00;\
                        PTCPE = 0x00;\
                        PTCDD = 0x63;

#define  mSETUP_PORT_D  PTDPE = 0x00;\
                        PTDSE = 0x00;\
                        PTDDD = 0x00 | 0x08 | 0x10;  // Port 3,4 as output
                        //PTDDD = (0x01 | 0x02| 0x08 | 0x10);


#endif TARGET_DIG534_1

//**********************************************************************************

#ifdef TARGET_DIG536_1
    // UART interface select SCI1
    #define SELECT_SCI1

    #define HWAssertAbelReset        PTCD &= ~0x10;    // Reset = 0;
    #define HWDeAssertAbelReset      PTCD |=  0x10;    // Reset = 1;

    #define RxTxEnable               PTCD |=  0x08;    // RxTxEnable = 1 (PTC3);
    #define RxTxDisable              PTCD &= ~0x08;    // RxTxDisable = 0 (PTC3);  

    #define AttEnable                PTCD |=  0x04;    // PTC2
    #define AttDisable               PTCD &= ~0x04;

    #define LED1_PIN  (1<<0)
    #define LED2_PIN  (1<<1)
    #define LED3_PIN  (1<<3)
    #define LED4_PIN  (1<<4)

    #define LED1ON  PTDD &= 0xFE;
    #define LED1OFF PTDD |= 0x01;
    #define LED1TOGGLE PTDD ^= 0x01;

    #define LED2ON  PTDD &= 0xFD;
    #define LED2OFF PTDD |= 0x02;
    #define LED2TOGGLE PTDD ^= 0x02;

    #define LED3ON  PTDD &= 0xF7;
    #define LED3OFF PTDD |= 0x08;
    #define LED3TOGGLE PTDD ^= 0x08;

    #define LED4ON  PTDD &= 0xEF;

⌨️ 快捷键说明

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