亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? can_ccp.c

?? ccp
?? C
字號:
/*****************************************************************************
| Project Name: C C P - Driver adapter
|    File Name: CAN_CCP.C
|
|  Description: 
|   CCP driver customization module
|   This module is just an example how to adapt the CCP driver
|   It may be modified 
|       !!! Please contact Vector for Support !!!
|
|  Contains:
|   - Examples for indication, confirmation and pretransmit functions
|     for the vector CAN driver.
|   - Examples for FLASH programming, EEPROM programming, CalPage switching
|
|-----------------------------------------------------------------------------
|               C O P Y R I G H T
|-----------------------------------------------------------------------------
| Copyright (c)  2001-2002 by Vector Informatik GmbH.     All rights reserved.
|-----------------------------------------------------------------------------
|               A U T H O R   I D E N T I T Y
|-----------------------------------------------------------------------------
| Initials     Name                      Company
| --------     ---------------------     -------------------------------------
|    Ds        Sven Deckardt             Vector Informatik GmbH
|    Hp        Armin Happel              Vector Informatik GmbH
|    Za        Rainer Zaiser             Vector Informatik GmbH
|-----------------------------------------------------------------------------
|               R E V I S I O N   H I S T O R Y
|-----------------------------------------------------------------------------
|  Date        Ver  Author  Description
| ----------  ----  ------  --------------------------------------------------
| 2002-04-17  1.00   Hp     Setting-up version and commonise the header with 
|                           CANbedded software modules.
|***************************************************************************/

#define CCP_CAN_INTERNAL


#include "can_inc.h"
#include "ccp.h"

#ifdef C_ENABLE_CCP

#define CCP_CAN_ADAPTER_VERSION  0x0100


/*----------------------------------------------------------------------------*/

#ifdef CCP_WRITE_EEPROM
  #include "eeprom.h"
#endif

/*----------------------------------------------------------------------------*/

#ifdef CCP_CALPAGE
  CCP_BYTE ccpCalPage = 0;
#endif


/******************************************************************************/
/* The following functions are the interface between CCP and the CAN driver   */
/******************************************************************************/

/*----------------------------------------------------------------------------*/
/* Indication function for rx message CRO */
void CCP_CRO_Indication(CanReceiveHandle rcvObject)
{
  rcvObject = rcvObject; /* Avoid compiler warning */

  /* CCP message received, data has been copied */
  /* Argument is pointer to copied data */

  /* Handle CCP commands on application level in ccpBackground */
  #ifdef CCP_CMD_NOT_IN_INTERRUPT

    ccp.SendStatus |= CCP_CMD_PENDING;

  // Handle CCP commands on CAN interrupt level
  #else

    /* Copy to a CCP_DWORD aligned location */
    /* This code may be removed, if CCP_RX_DATA_PTR is CCP_DWORD aligned */
    #ifdef C_CPUTYPE_32BIT
      
      {
        CCP_DWORD c[2];
        ((CCP_BYTEPTR)&c)[0] = CCP_RX_DATA_PTR[0];
        ((CCP_BYTEPTR)&c)[1] = CCP_RX_DATA_PTR[1];
        ((CCP_BYTEPTR)&c)[2] = CCP_RX_DATA_PTR[2];
        ((CCP_BYTEPTR)&c)[3] = CCP_RX_DATA_PTR[3];
        ((CCP_BYTEPTR)&c)[4] = CCP_RX_DATA_PTR[4];
        ((CCP_BYTEPTR)&c)[5] = CCP_RX_DATA_PTR[5];
        ((CCP_BYTEPTR)&c)[6] = CCP_RX_DATA_PTR[6];
        ((CCP_BYTEPTR)&c)[7] = CCP_RX_DATA_PTR[7];
        ccpCommand((CCP_BYTEPTR)&c);
      }
    #else

      ccpCommand(CCP_RX_DATA_PTR);

    #endif

  #endif
}

/*----------------------------------------------------------------------------*/
/* Confirmation function of tx message CCP_DTO is configured in generation tool */
void CCP_DTO_Confirmation(CanTransmitHandle tmtObject)
{
  tmtObject = tmtObject; /* Avoid compiler warning */

  ccpSendCallBack();
}

/*----------------------------------------------------------------------------*/
/* Transmit the CCP message */
/* Id is CCP_DTO_ID, which is configured at compile time */
void ccpSend( CCP_BYTEPTR msg )
{
  CCP_TX_DATA_PTR[0] = msg[0];
  CCP_TX_DATA_PTR[1] = msg[1];
  CCP_TX_DATA_PTR[2] = msg[2];
  CCP_TX_DATA_PTR[3] = msg[3];
  CCP_TX_DATA_PTR[4] = msg[4];
  CCP_TX_DATA_PTR[5] = msg[5];
  CCP_TX_DATA_PTR[6] = msg[6];
  CCP_TX_DATA_PTR[7] = msg[7];

  #ifdef C_ENABLE_TRANSMIT_QUEUE

    if (CanTransmit(CCP_TX_HANDLE)!=kCanTxOk) {
      /* Fatal Error, should never fail */
      ccpInit();
    }

  #else

    #ifndef C_DISABLE_TRANSMIT_QUEUE
      #error CAN driver transmit queue must be enabled or disabled
    #endif

    if (CanTransmit(CCP_TX_HANDLE)!=kCanTxOk) {

      /* Set transmission request flag */
      ccp.SendStatus |= CCP_TX_PENDING;
    }

  #endif

}

/*----------------------------------------------------------------------------*/
/* Perform backgound calculation if needed */

void ccpUserBackground( void ) {

  /* Try to retransmit if CAN driver transmit queue is not enabled */
  #ifdef C_DISABLE_TRANSMIT_QUEUE

    if( ccp.SendStatus & CCP_TX_PENDING) {
      if (CanTransmit(CCP_TX_HANDLE)==kCanTxOk) {
        ccp.SendStatus &= ~CCP_TX_PENDING;
      }
    }

  #endif

  /* Check if a pending EEPROM write access is finished */
  #ifdef CCP_WRITE_EEPROM

    void ccpCheckPendingEEPROM( void );
    ccpCheckPendingEEPROM();

  #endif

  /* ... */
  /* Insert any other user actions here */
  /* Call ccpSendCrm() to finish pending EEPROM or FLASH cycles */

}

/******************************************************************************/
/* The following functions must be individually implemented if required       */
/* There are samples available for C16x, HC12, SH7055                              */
/******************************************************************************/

/*----------------------------------------------------------------------------*/

/*
ccpGetPointer

Convert a memory address from CCP 8/32bit into a C pointer
used for memory transfers like DNLOAD, UPLOAD (MTA)
*/

#ifndef ccpGetPointer
CCP_MTABYTEPTR ccpGetPointer( CCP_BYTE addr_ext, CCP_DWORD addr )
{

  addr_ext = addr_ext; /* Avoid compiler warning */

  /* Example C16x: DDP1 used for CCP_RAM/CCP_ROM selection */
  #if defined(CANBOX) || defined(PHYTEC_MM167)
    #ifdef CCP_CALPAGE
      if (ccpCalPage==1 && addr>=0x14000 && addr<0x18000) { /* CALRAM */
        return (CCP_MTABYTEPTR) ( addr + 0x30000UL );
      }
    #endif
  #endif

  return (CCP_MTABYTEPTR) addr;
}
#endif


/*
ccpGetDaqPointer

Convert a memory address from CCP 8/32bit into a address
stored in the ODT entries for DAQ.

This is for reducing memory space used for DAQ lists.
For example on a 32 bit microcontroller, a DAQ pointer may be stored as 16 bit
value. DAQ will add the base address CCP_DAQ_BASE_ADDR before dereferencing the
pointer. This will limit data acquisition to a single 64K memory range, but it
will save 50% memory used for DAQ lists.

Note: It must be possible to calculate the final address for DAQ like
 value = * (CCP_DAQ_BASE_ADDR + addr);
*/

#ifdef CCP_DAQ_BASE_ADDR
CCP_DAQBYTEPTR ccpGetDaqPointer( CCP_BYTE addr_ext, CCP_DWORD addr )
{
  return (CCP_DAQBYTEPTR)( ccpGetPointer(addr_ext,addr) - CCP_DAQ_BASE_ADDR );
}
#endif



/*----------------------------------------------------------------------------*/
/* Check addresses for valid write access */
/* Used only if Write Protection is required */
/* Returns false if access denied */
#ifdef CCP_WRITE_PROTECTION
CCP_BYTE ccpCheckWriteAccess( CCP_MTABYTEPTR a, CCP_BYTE s )
{
  // Protect CCP
  if (a+s>=(CCP_MTABYTEPTR)&ccp && a<(CCP_MTABYTEPTR)&ccp+sizeof(ccp)) {
    return 0;
  }

  return 1;
}
#endif


/*----------------------------------------------------------------------------*/
/* Flash Kernel Download */
/* Used only of Download of the Flash Kernel is required */
#ifdef CCP_BOOTLOADER_DOWNLOAD

CCP_BYTE ccpDisableNormalOperation( CCP_MTABYTEPTR a, CCP_WORD s ) {

  a = a; /* Avoid compiler warning */
  s = s;

  /* CANape attempts to download the flash kernel to CCP_RAM */
  /* Address is a */
  /* Size is s bytes */

  /* ... */

  // return 0; // Refused
  return 1; // Ok
}

#endif

/*----------------------------------------------------------------------------*/
/* Example: Flash Programming */
/* Used only if integrated Flash Programming is required */

#ifdef CCP_PROGRAM

#include "flash.h"

void ccpFlashClear( CCP_MTABYTEPTR a, CCP_DWORD size )
{
  #if defined(CANBOX) || defined(PHYTEC_MM167)
    #ifdef CCP_CALPAGE
      if (a>=(CCP_MTABYTEPTR)0x40000) a -= 0x30000; /* Compensate CCP_RAM/CCP_ROM mapping */
    #endif
  #endif

  #ifndef CCP_BOOTLOADER
    CCP_DISABLE_INTERRUPT;
    flashEraseBlock(a);
    CCP_ENABLE_INTERRUPT;
  #endif
}

#ifndef CCP_BOOTLOADER
CCP_BYTE ccpFlashProgramm( CCP_BYTEPTR data, CCP_MTABYTEPTR a, CCP_BYTE size )
{
  #if defined(CANBOX) || defined(PHYTEC_MM167)
    #ifdef CCP_CALPAGE
      if (a>=(CCP_MTABYTEPTR)0x40000) a -= 0x30000; /* Compensate CCP_RAM/CCP_ROM mapping */
    #endif
  #endif

  if (size==0) { /* End of programing sequence */

    /* Software Reset */
    #ifdef C_COMP_TASKING_C16X
      #pragma asm
        srst
      #pragma endasm
    #endif
  }

  while (size>0) {
    CCP_DISABLE_INTERRUPT;
    flashByteWrite(a,*data);
    CCP_ENABLE_INTERRUPT;
    data++;
    a++;
    size--;
  }

  return CCP_WRITE_OK;
}

#endif
#endif

/*----------------------------------------------------------------------------*/
/* Example: Calibration CCP_RAM/CCP_ROM Selection */
/* Used if Flash Programming is required */

#if defined(CCP_CALPAGE) || defined(CCP_PROGRAM)

CCP_DWORD ccpGetCalPage( void )
{
  return (CCP_DWORD)ccpCalPage;
}

void ccpSetCalPage( CCP_DWORD a )
{
  ccpCalPage = (CCP_BYTE)a;

  #if defined(CANBOX) || defined(PHYTEC_MM167)
    if (ccpCalPage==1) { /* CCP_RAM */
      #pragma asm
        mov DPP1,#11h
      #pragma endasm
    } else {             /* CCP_ROM */
      #pragma asm
        mov DPP1,#05h
      #pragma endasm
    }
  #endif

}

void ccpInitCalPage( void ) {

  #if defined(CANBOX) || defined(PHYTEC_MM167)
    #define CALROM_ADDR 0x14000
    #define CALRAM_ADDR 0x44000
    huge unsigned char *p1 = (huge unsigned char *)CALROM_ADDR;
    huge unsigned char *p2 = (huge unsigned char *)CALRAM_ADDR;
    unsigned int i;
    for (i=0;i<0x4000;i++) {
      *p2++ = *p1++;
    }
  #endif
}

#endif

/*----------------------------------------------------------------------------*/
/* Example: Seed&Key*/
/* Used only if Seed&Key is required */

#ifdef CCP_SEED_KEY

CCP_BYTE ccpResourceMask = 0;
CCP_DWORD ccpLastSeed = 0;

CCP_DWORD ccpGetSeed( CCP_BYTE resourceMask )
{
  ccpResourceMask = resourceMask;

  /* Generate a seed */

  /* Example: */
  /* Optimum would be a number which never appears twice */
 #ifdef CCP_TIMESTAMPING
   ccpLastSeed = ccpGetTimestamp() * ccpGetTimestamp();
   return ccpLastSeed;
 #endif

  return 0;
}

CCP_BYTE ccpUnlock( CCP_BYTE *key )
{
  /* Check the key */

  /* Example: */
  ccpLastSeed = (ccpLastSeed>>5) | (ccpLastSeed<<23);
  ccpLastSeed *= 7;
  ccpLastSeed ^= 0x26031961;
  if ( *(CCP_DWORD*)key != ccpLastSeed ) {
    return 0;
  }

  /* Reset resource protection bit */
  return ccpResourceMask;
}

#endif


/*----------------------------------------------------------------------------*/
/* Example: EEPROM write access */
/* Used only if required */

#ifdef CCP_WRITE_EEPROM

/* Pending EEPROM write cycle */
CCP_BYTE ccpEEPROMState = 0;

/* EEPROM write */
/* Return values for ccpCheckWriteEEPROM:
   CCP_WRITE_OK      - EEPROM written
   CCP_WRITE_DENIED  - This address is not in EEPROM
   CCP_WRITE_PENDING - EEPROM write in progress, call ccpSendCrm() when done
   CCP_WRITE_ERROR   - EEPROM write failed
*/
CCP_BYTE ccpCheckWriteEEPROM( CCP_MTABYTEPTR addr, CCP_BYTE size, CCP_BYTEPTR data )
{
  /* Check address for EEPROM */
  if (addr<EEPROM_START || addr>EEPROM_END) {

    /* Not EEPROM */
    /* Let the CCP driver perform a standard CCP_RAM write access */
    return CCP_WRITE_DENIED;
  }

  /* Alternative 1: */
  /* Initiate EEPROM write */
  /* When finished, call ccpSendCrm() */
  #ifdef C_CLIENT_BMWAG

    #if EEBUFFER<5
      #error CCP will need at least 5 Entries in EEBuffer
    #endif
    if (EECheckBuffer()>EEBUFFER_MAX-size) return CCP_WRITE_ERROR;
    while (size--) {
      if (E_OK!=EEAddByte((unsigned int) addr++,*data++)) return CCP_WRITE_ERROR;
    }

    ccpEEPROMState = CCP_WRITE_PENDING;
    return CCP_WRITE_PENDING;

  /* Alternative 2: */
  /* Write to EEPROM here and wait until finished */
  #else

    eeWrite(addr,data,size);
    return CCP_WRITE_OK;

  #endif


}

/* Check for EEPROM write finished */
void ccpCheckPendingEEPROM( void ) {

  #ifdef C_CLIENT_BMWAG

    if (ccpEEPROMState==CCP_WRITE_PENDING) {
      if (EECheckBuffer()==0) {
        ccpSendCrm();
        ccpEEPROMState = 0;
      }
    }

  #endif
}

#endif


#ifdef CCP_READ_EEPROM

/* EEPROM read */
/* Return values for ccpCheckReadEEPROM:
   0 (FALSE)    - This address is not in EEPROM
   1 (TRUE)     - EEPROM read
*/
CCP_BYTE ccpCheckReadEEPROM( CCP_MTABYTEPTR addr, CCP_BYTE size, CCP_BYTEPTR data )
{

  /* Read EEPROM */
  #ifdef C_CLIENT_BMWAG

    /* Check address for EEPROM */
    if (addr<EEPROM_START || addr>EEPROM_END) {

      /* Not EEPROM */
      /* Let the CCP driver perform a standard CCP_RAM read access */
      return 0;
    }

    while (size-->0) {
      *data++ = EEReadByte(addr++);
    }

    return 1;

  #else

    return 0;

  #endif

}

#endif


#endif /* C_ENABLE_CCP */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品亚洲一区二区在线播放| 国产精品99久久久久久久女警| 国模娜娜一区二区三区| 一本大道久久a久久精品综合| 久久综合中文字幕| 日韩成人午夜精品| 91精品国产欧美一区二区| 亚洲精品一二三区| 91蜜桃网址入口| 亚洲激情av在线| 在线观看免费视频综合| 亚洲女性喷水在线观看一区| caoporen国产精品视频| 国产精品欧美一级免费| 北条麻妃一区二区三区| 亚洲国产成人午夜在线一区| 国产成人精品网址| 综合色中文字幕| 欧美在线免费观看视频| 日韩国产欧美在线观看| 欧美大肚乱孕交hd孕妇| 成人免费不卡视频| 亚洲精品亚洲人成人网在线播放| 在线一区二区三区| 伦理电影国产精品| 国产三级一区二区| 日本精品免费观看高清观看| 美女爽到高潮91| 欧美激情一区不卡| 欧美美女bb生活片| 国产一区二区三区在线看麻豆| 国产欧美日本一区视频| 欧美在线免费视屏| 成人小视频免费观看| 一区二区在线观看av| 2024国产精品视频| 欧美日韩在线精品一区二区三区激情 | 成人av免费网站| 亚洲精品国产a| 国产偷v国产偷v亚洲高清| 欧洲一区在线电影| 国产成人精品三级麻豆| 日本午夜精品视频在线观看| 亚洲精品日韩一| 欧美国产精品久久| 久久精品水蜜桃av综合天堂| 欧美肥妇free| 成人午夜又粗又硬又大| 天堂久久一区二区三区| 久久亚洲综合av| 精品福利一区二区三区| 欧美一区二区三区播放老司机| 在线精品视频一区二区| 色伊人久久综合中文字幕| 国产黄人亚洲片| 国产精品自在欧美一区| 国产精品资源在线看| 精品一区二区在线播放| 国产精品一卡二卡| 国产99久久久国产精品| 高清国产一区二区| 99久久伊人精品| 成人av在线资源| 欧美另类一区二区三区| 欧美日本在线播放| 久久久综合精品| 亚洲欧洲日韩在线| 婷婷综合另类小说色区| 毛片一区二区三区| 丁香婷婷综合五月| 欧美日韩三级一区二区| 欧美福利视频一区| 久久久综合精品| 一区二区三区在线不卡| 国产在线麻豆精品观看| av电影在线观看不卡| 91 com成人网| 国产精品久久久久久户外露出| 亚洲综合区在线| 久久99久久99小草精品免视看| 99国产精品久久久久久久久久 | 欧美视频一区二区三区在线观看| 欧美一区二区三区白人| 国产精品天美传媒| 久久国产麻豆精品| 欧美日韩亚洲综合一区二区三区| 中文字幕免费观看一区| 青椒成人免费视频| 欧美午夜精品免费| 1区2区3区欧美| av亚洲精华国产精华精| 精品处破学生在线二十三| 五月开心婷婷久久| 欧美性videosxxxxx| 亚洲色图第一区| 成人手机在线视频| 国产网红主播福利一区二区| 久久99精品久久久久久| 欧美午夜片在线看| 亚洲图片欧美一区| 91在线精品秘密一区二区| 国产日韩三级在线| 成人小视频免费观看| 国产精品毛片无遮挡高清| 国产69精品一区二区亚洲孕妇 | 欧美精品三级日韩久久| 亚洲欧美日韩国产另类专区| 国产91在线观看| 国产精品欧美久久久久无广告| 国产成人鲁色资源国产91色综 | 成人黄色片在线观看| 国产精品美日韩| 99久久精品免费| 日韩中文字幕麻豆| 久久综合给合久久狠狠狠97色69| 国产成人在线电影| 亚洲靠逼com| 日韩亚洲电影在线| 成人av在线观| 午夜精品久久久久久久99樱桃| 日韩欧美卡一卡二| 成人18精品视频| 日韩高清一区在线| 国产日产精品1区| 欧美色综合天天久久综合精品| 日韩精品视频网站| 日韩美女视频一区二区| 精品日韩99亚洲| 在线免费视频一区二区| 国产精品1区二区.| 天堂久久久久va久久久久| 国产精品毛片无遮挡高清| 久久久久99精品一区| 欧美日韩国产综合草草| 97久久超碰国产精品电影| 丝瓜av网站精品一区二区 | 日韩一级完整毛片| 色网综合在线观看| 成人午夜在线免费| 国产精品一区三区| 麻豆精品视频在线| 男女男精品视频网| 日韩中文欧美在线| 亚洲r级在线视频| 伊人婷婷欧美激情| 国产精品看片你懂得| 欧美韩国日本综合| 国产精品久久久久久久久免费桃花| 日韩午夜在线播放| 日韩免费视频一区| 日韩女优电影在线观看| 欧美一区二区三区人| 欧美一区二区私人影院日本| 欧美性猛交xxxxxxxx| 亚洲欧美激情小说另类| 国产精品久久久久久久久免费丝袜| 欧美一区二区久久| 久久综合狠狠综合久久综合88| www激情久久| 国产精品乱码人人做人人爱| 一区二区中文视频| 午夜欧美电影在线观看| 六月丁香婷婷久久| 99在线热播精品免费| 欧美日韩精品福利| 久久久99精品免费观看不卡| 国产精品乱码妇女bbbb| 亚洲高清三级视频| 久久超碰97中文字幕| 国产精品一二三区在线| 91成人免费电影| 久久午夜老司机| 一区二区成人在线观看| 麻豆一区二区三| 91原创在线视频| 欧美videos中文字幕| 日韩美女视频一区二区| 日韩电影一区二区三区四区| 国产ts人妖一区二区| 欧美日韩一区二区在线观看| 国产香蕉久久精品综合网| 一区二区三区精品久久久| 国产成人亚洲综合色影视| 欧美亚洲国产一卡| 国产精品久久久久久亚洲毛片| 免费看日韩a级影片| 91国偷自产一区二区使用方法| 久久只精品国产| 韩国成人福利片在线播放| 欧美久久久久久久久| 亚洲精品久久7777| av在线不卡网| 国产精品白丝在线| av中文字幕不卡| 亚洲欧美一区二区三区极速播放| 看片的网站亚洲| 精品国产一区二区三区久久久蜜月| 午夜精品久久久久久久| 欧美日韩国产一级| 日本免费新一区视频|