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

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

?? csp_can.c

?? IAR 平臺ATMEL 的例程, 和說明
?? C
字號:
/*-----------------------------------------------------------------------------
*   EUROPE TECHNOLOGIES Software Support
*------------------------------------------------------------------------------
* The software is delivered "AS IS" without warranty or condition of any
* kind, either express, implied or statutory. This includes without
* limitation any warranty or condition with respect to merchantability or
* fitness for any particular purpose, or against the infringements of
* intellectual property rights of others.
*------------------------------------------------------------------------------
*
* File Name       : csp_can.c
* Description     : Function declarations for Controller Area Network management
* Library Version : 2.00
* Module Version  : 1.XX
*
*       +----- (NEW | MODify | ADD | DELete)                                 
*       |                                                                    
*  No   |   When       Who                What               
*-----+---+----------+------------------+--------------------------------------
* 000  NEW  01/05/99   Patrice VILCHEZ    Creation
* 001  MOD  01/04/01   Olivier MAZUYER    Clean up
* 002  MOD  23/05/01   Tristan BONHOMME   Clean up
* 003  MOD  26/05/01   Patrice VILCHEZ    Set correct ID in SendData function
*                                         Correct SPY mode in ReceiveData
*                                         function
*                                         Use memcpy function in ReceiveData
*                                         function
* 004  MOD  19/11/01   Christophe GARDIN  Clean Up
* 005  MOD  11/04/02   Christophe GARDIN  Add CSP_CANClose function
*----------------------------------------------------------------------------*/

/******************************************************************************
* Include Files
******************************************************************************/
#include "csp.h"


/******************************************************************************
****************************  F U N C T I O N S  ******************************
******************************************************************************/

/******************************************************************************
* Function          : CSP_CANInit
* Description       : Switch on the clock, reset the registers and wait for channels
*                     registers initialization (8 * nb channels * core clock period) 
*                     and configure the CAN module mode 
* Inputs            : <*can> = Pointer to CAN structure
*                     <mode> = Configure the CAN mode
* Functions called  : None
* Returns           : None
******************************************************************************/
void CSP_CANInit(CSP_CAN_T *const can, U32_T mode)
{
   /* Local Variables */
   U16_T i = 0;

   /* Enable CAN Clock */  
   CSP_CAN_SET_ECR(can, CAN);
  
   /* CAN Software Reset */  
   CSP_CAN_SET_CR(can, SWRST);
  
   /* Wait for channels registers initialization */
   /* This avoid using the interrupt that should take more time to process */
   for(i = 0; i < (8u * 32u); i++)
   {
   }

   /* Configure CAN Mode */
   CSP_CAN_SET_MR(can, mode);
}


/******************************************************************************
* Function          : CSP_CANClose
* Description       : Reset and switch off the clock
* Inputs            : <*can> = Pointer to CAN structure
* Functions called  : None
* Returns           : None
******************************************************************************/
void CSP_CANClose(CSP_CAN_T *const can)
{
   /* CAN Software Reset */  
   CSP_CAN_SET_CR(can, SWRST);

   /* Disable CAN Clock */  
   CSP_CAN_SET_DCR(can, CAN);
}


/******************************************************************************
* Function          : CSP_CANConfigInterrupt
* Description       : Configure CAN Interrupts
* Inputs            : <*can>     = Pointer to CAN structure
*                     <int_mode> = Configure the priority level and source type
*                     <int_mask> = Configure which interrupt bits are activated
*                     <callback> = Function called through the assembler interrupt handler
* Functions called  : CSP_GET_INTERRUPT_NUMBER, CSP_GICConfigInterrupt
* Returns           : None
******************************************************************************/
void CSP_CANConfigInterrupt(CSP_CAN_T *const can, 
                            U32_T int_mode, 
                            U32_T int_mask, 
                            U32_T callback)
{
   /* Local Variables */
   U8_T int_num = 0;

   /* Get Peripheral Interrupt Number */
   int_num = CSP_GET_INTERRUPT_NUMBER(can);

   /* Disable and clear all interrupt */
   CSP_CAN_SET_IDR(can, 0xFFFFFFFF);
   CSP_CAN_SET_SIDR(can, 0xFFFFFFFF);
   CSP_CAN_SET_CISR(can, 0xFFFFFFFF);

   /* Interrupt Enable in Peripheral */
   CSP_CAN_SET_IER(can, int_mask);

   /* Configure CAN controller interrupt mode in GIC module */
   CSP_GICConfigInterrupt(int_num, int_mode, callback);
}
                     

/******************************************************************************
* Function          : CSP_CANChannelConfigInterrupt
* Description       : Configure/Enable CAN Channel Interrupt
* Inputs            : <*can>     = Pointer to CAN structure
*                     <channel>  = Channel [0-31] to be configured
*                     <int_mask> = Configure which channel interrupt bits are activated
* Functions called  : None
* Returns           : None
******************************************************************************/
void CSP_CANChannelConfigInterrupt(CSP_CAN_T *const can, 
                                   U8_T channel, 
                                   U32_T int_mask)
{
   /* Set Channel Interrupt Enable */ 
   CSP_CAN_CHANNEL_SET_IER(can, channel, int_mask);

   /* Set Channel Interrupt Source in CAN Controller */
   CSP_CAN_SET_SIER(can, (CSP_CAN_GET_SIMR(can) | (0x1ul << channel)));
}


/******************************************************************************
* Function          : CSP_CANEnable
* Description       : Enable CAN (12 祍 is necessary at 30MHz after an enable 
*                     command to transfer and receive data)
* Inputs            : <*can> = Pointer to CAN structure
* Functions called  : None
* Returns           : None
******************************************************************************/
void CSP_CANEnable(CSP_CAN_T *const can)
{
   /* Enable CAN */
   CSP_CAN_SET_CR(can, CANEN);
}  


/******************************************************************************
* Function          : CSP_CANDisable
* Description       : Disable CAN 
* Inputs            : <*can> = Pointer to CAN structure
* Functions called  : None
* Returns           : None
******************************************************************************/
void CSP_CANDisable(CSP_CAN_T *const can)
{
   /* Disable CAN */
   CSP_CAN_SET_CR(can, CANDIS);
}  


/******************************************************************************
* Function          : CSP_CANReceive
* Description       : Configure a CAN channel to pick up message from the network 
*                     User defines if the message waited is a remote frame or a data frame. 
* Inputs            : <*can>    = Pointer to CAN structure
*                     <channel> = Receiver channel [0-31]
*                     <id>      = Configure the identifier and the remote request
*                     <mask>    = Configure the mask and the remote request 
*                     <control> = Configure the number of byte to receive and 
*                                 the control bits
* Functions called  : None
* Returns           : None
******************************************************************************/
void CSP_CANReceive(CSP_CAN_T *const can, 
                    U8_T channel, 
                    U32_T id,
                    U32_T mask, 
                    U16_T control)
{
   if((control & IDE) == IDE)
   {
      /* Set Id Register (29 bits length) */
      CSP_CAN_CHANNEL_SET_IR(can, channel, (((id & 0x1FFC0000ul) >> 18) | 
                                            ((id & 0x3FFFFul) << 11)) | 
                                             (id & 0xE0000000ul));
      /* Set Mask Register (29 bits length) */
      CSP_CAN_CHANNEL_SET_MSK(can, channel, (((mask & 0x1FFC0000ul) >> 18) | 
                                             ((mask & 0x3FFFFul) << 11)) |
                                              (mask & 0xE0000000ul));
   }                                          
   else
   {
      /* Set Id Register (11 bits length) */
      CSP_CAN_CHANNEL_SET_IR(can, channel, (id & 0xE00007FFul));
      /* Set Mask Register (11 bits length) */
      CSP_CAN_CHANNEL_SET_MSK(can, channel, (mask & 0xE00007FFul));
   }

   /* Set the length and the receive command */
   CSP_CAN_CHANNEL_SET_CR(can, channel, (CHANEN | control));
}


/******************************************************************************
* Function          : CSP_CANTransmit
* Description       : Configure a CAN channel to transmit message on the network. 
*                     The message can be a remote frame or a data frame. 
* Inputs            : <*can>    = Pointer to CAN structure
*                     <channel> = Transmitter channel [0-31]
*                     <id>      = Configure the identifier and the remote request
*                     <*data>   = Pointer to an array where data packet sent is stored
*                     <control> = Configure the number of byte to transmit and
*                                 the control bits
* Functions called  : None
* Returns           : None
******************************************************************************/
void CSP_CANTransmit(CSP_CAN_T *const can, 
                     U8_T channel, 
                     U32_T id, 
                     U8_T *data, 
                     U16_T control)
{
   /* Local Variables */
   U8_T i = 0; 
   U8_T length = (control & 0xF);
   U8_T dra_drb[8] = {0, 0, 0, 0, 0, 0, 0, 0};     /* Clear DRA and DRB */

   /* Set Id Register */
   if((control & IDE) == IDE)
   {
      /* Set Id Register (29 bits length) */
      CSP_CAN_CHANNEL_SET_IR(can, channel, (((id & 0x1FFC0000ul) >> 18) | 
                                            ((id & 0x3FFFFul) << 11)) |
                                             (id & 0xE0000000ul));
   }
   else
   {
      /* Set Id Register (11 bits length) */
      CSP_CAN_CHANNEL_SET_IR(can, channel, (id & 0xE00007FFul));
   }

   /* No copy if remote transmission request */
   if((CSP_CAN_CHANNEL_GET_IR(can, channel) & RTR) == 0)
   {
      /* Copy N bytes in DRA and DRB to Send */
      for(i = 0; i < length; i++)
      {
         dra_drb[i] = data[i];
      }
 
      /* The writing in DRA and DRB must be in 32 bits */
      CSP_CAN_CHANNEL_SET_DRA(can, channel, (*(U32_T*)&dra_drb[0]));
      CSP_CAN_CHANNEL_SET_DRB(can, channel, (*(U32_T*)&dra_drb[4]));
   }
                                       
   /* Set the length and the transmit command */
   CSP_CAN_CHANNEL_SET_CR(can, channel, (CHANEN | PCB | control));
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产91久久久久久久妲己| 午夜激情久久久| 日本女优在线视频一区二区| 国产98色在线|日韩| 欧美精品在线观看一区二区| 99久久精品免费看国产免费软件| 麻豆国产精品官网| 99久久精品一区二区| 欧美一级夜夜爽| 亚洲欧美aⅴ...| 高清国产一区二区三区| 欧美高清精品3d| 一区二区三区在线观看国产| 韩国成人精品a∨在线观看| 日韩午夜精品电影| 久久综合网色—综合色88| 亚洲bt欧美bt精品| 日本高清无吗v一区| 中文无字幕一区二区三区| 国产一区二区在线看| 色综合一区二区| 亚洲欧洲av在线| 不卡大黄网站免费看| 久久精品免视看| 黑人精品欧美一区二区蜜桃| 日韩精品一区二区在线| 蜜臀91精品一区二区三区| 欧美三级日韩在线| 午夜精品爽啪视频| 欧美日韩精品一区二区三区四区| 亚洲日本电影在线| 色综合久久中文综合久久97| 亚洲另类春色国产| 欧美日韩一卡二卡| 日韩高清在线一区| 日韩免费视频一区二区| 激情欧美一区二区| 久久综合网色—综合色88| 国产九色sp调教91| 国产精品久久久久久户外露出| 成人精品在线视频观看| 日韩一区有码在线| 欧亚洲嫩模精品一区三区| 亚洲综合一区二区精品导航| 欧美日韩亚洲综合一区二区三区| 日韩黄色免费网站| 欧美成人激情免费网| 久久99国产精品尤物| 久久欧美一区二区| 成人黄色在线看| 伊人婷婷欧美激情| 欧美一区二区三区男人的天堂| 国模冰冰炮一区二区| 中文字幕一区三区| 欧美人伦禁忌dvd放荡欲情| 蜜桃久久久久久| 国产亚洲一区二区三区四区| 成人av电影在线观看| 午夜电影一区二区三区| 国产三级精品视频| 在线一区二区三区四区五区| 免费成人小视频| 国产精品欧美久久久久一区二区| 99国产精品久| 青青草伊人久久| 1区2区3区欧美| 在线综合视频播放| 成人在线视频一区| 日韩av二区在线播放| 中文字幕av不卡| 91麻豆精品国产无毒不卡在线观看 | 中文成人综合网| 欧美日韩在线精品一区二区三区激情 | 国产一区二区三区香蕉| 亚洲欧美日韩国产成人精品影院 | 日韩欧美中文字幕精品| 成人av网站在线| 九九视频精品免费| 一区二区三区精品久久久| 2023国产精品| 欧美一区二区三区白人| 91蝌蚪国产九色| 国产福利精品一区| 日韩专区一卡二卡| 亚洲日韩欧美一区二区在线| 久久亚洲精华国产精华液| 欧美色视频一区| 成人激情免费网站| 国产一区二区伦理片| 午夜电影网一区| 一区二区三区四区av| 中文字幕视频一区| 久久久精品欧美丰满| 欧美成人高清电影在线| 欧美区一区二区三区| 在线视频观看一区| 99热国产精品| 成人午夜电影小说| 国产99久久久精品| 极品少妇xxxx精品少妇偷拍| 免费成人深夜小野草| 视频一区中文字幕| 亚洲国产一区二区视频| 亚洲一区二区五区| 一区二区三区四区不卡在线 | 亚洲精品日日夜夜| 国产精品午夜久久| 精品粉嫩超白一线天av| 欧美tickling挠脚心丨vk| 日韩三级在线观看| 日韩一区二区电影| 91精品国产免费| 欧美一区二区在线视频| 日韩欧美精品三级| 欧美成人aa大片| 欧美mv和日韩mv的网站| 精品国产乱码久久久久久蜜臀 | 日韩精品一区二区三区swag| 91麻豆精品国产91久久久久久久久 | 国产成人av在线影院| 国产大陆亚洲精品国产| 国产成人亚洲精品狼色在线| 岛国一区二区在线观看| 91在线国产观看| 欧美在线一区二区| 91精品国产色综合久久ai换脸| 欧美一二三四在线| 久久精品视频在线看| 国产精品久久久久久久裸模| 亚洲三级久久久| 天涯成人国产亚洲精品一区av| 日韩av一区二| 国产一区二区三区在线观看免费视频 | 久草中文综合在线| 五月婷婷久久丁香| 日产国产高清一区二区三区| 老色鬼精品视频在线观看播放| 老司机免费视频一区二区| 国产精品一卡二| 色噜噜久久综合| 欧美三级中文字| 日韩亚洲欧美高清| 国产视频视频一区| 亚洲女女做受ⅹxx高潮| 亚洲大片免费看| 国产一区二区不卡| 日本精品一区二区三区四区的功能| 色老汉av一区二区三区| 日韩三级电影网址| 亚洲欧洲精品天堂一级| 免费成人美女在线观看.| 国产精品自拍一区| 在线观看免费亚洲| 精品美女一区二区| 一区二区三区电影在线播| 亚洲精品成人少妇| 久久精品国产在热久久| 波多野结衣亚洲| 91精品国产欧美一区二区18| 亚洲欧洲精品一区二区三区不卡 | 国产**成人网毛片九色 | 在线观看av一区| 久久久www成人免费毛片麻豆| 一区二区三区在线观看动漫| 国产麻豆一精品一av一免费 | 精品av久久707| 亚洲一卡二卡三卡四卡无卡久久| 国产一区二区在线看| 51精品秘密在线观看| 亚洲女人的天堂| 懂色av噜噜一区二区三区av| 日韩一级在线观看| 亚洲免费在线视频一区 二区| 国内精品久久久久影院一蜜桃| 精品视频一区二区不卡| 国产精品久久久久7777按摩| 美女视频一区二区三区| 欧美日韩中文字幕精品| 亚洲三级在线观看| 成人午夜激情影院| 久久精品日产第一区二区三区高清版| 手机精品视频在线观看| 欧洲精品一区二区| 一区二区三区影院| 91蜜桃网址入口| 日韩一区在线免费观看| 成人av动漫在线| 国产精品色噜噜| 成人av资源网站| 国产精品美女一区二区| 国产一区二区电影| 久久在线免费观看| 国产一区二区中文字幕| 久久青草欧美一区二区三区| 国产一区欧美日韩| 亚洲精品在线一区二区| 国产一区二区三区久久悠悠色av| 精品国产乱码久久久久久免费| 久久精品99国产精品日本| 欧美zozozo|