70 lines
2.5 KiB
C
70 lines
2.5 KiB
C
/**
|
|
******************************************************************************
|
|
* @file can_comm.h
|
|
* @author MCD Application Team
|
|
* @version V1.0.0
|
|
* @date 05/12/2011
|
|
* @brief This file contains all the functions prototypes for the bscu_comm.c
|
|
* file.
|
|
******************************************************************************
|
|
* @copy
|
|
*
|
|
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
|
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
|
|
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
|
|
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
|
|
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
|
|
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
|
*
|
|
* <h2><center>© COPYRIGHT 2009 STMicroelectronics</center></h2>
|
|
*/
|
|
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
#ifndef _PL455_H_
|
|
#define _PL455_H_
|
|
|
|
#include "sys.h"
|
|
|
|
// User defines
|
|
#define FRMWRT_SGL_R 0x00 // single device write with response
|
|
#define FRMWRT_SGL_NR 0x10 // single device write without response
|
|
#define FRMWRT_GRP_R 0x20 // group broadcast with response
|
|
#define FRMWRT_GRP_NR 0x30 // group broadcast without response
|
|
#define FRMWRT_ALL_R 0x60 // general broadcast with response
|
|
#define FRMWRT_ALL_NR 0x70 // general broadcast without response
|
|
|
|
#define TOTALBOARDS 1
|
|
#define BAUDRATE 250000
|
|
|
|
// Function Prototypes
|
|
void setSendFunc(void (*FuncPtrS)(uint8_t *, uint16_t));
|
|
void setRecvFunc(uint8_t (*FuncPtrR)(uint8_t *, uint16_t));
|
|
|
|
void pl455_gpio_Init(void);
|
|
void CommClear(void);
|
|
void CommReset(void);
|
|
void pl455_wakeup(void);
|
|
uint8_t GetFaultStat(void);
|
|
|
|
int WriteReg(uint8_t bID, uint16_t wAddr, uint64_t dwData, uint8_t bLen, uint8_t bWriteType);
|
|
|
|
//void ResetPL455();
|
|
//void WakePL455();
|
|
|
|
//uint16_t B2SWORD(uint16_t wIN);
|
|
//uint32_t B2SDWORD(uint32_t dwIN);
|
|
//uint32_t B2SINT24(uint32_t dwIN24);
|
|
|
|
int WriteReg(uint8_t bID, uint16_t wAddr, uint64_t dwData, uint8_t bLen, uint8_t bWriteType);
|
|
int ReadReg(uint8_t bID, uint16_t wAddr, void * pData, uint8_t bLen, uint32_t dwTimeOut);
|
|
|
|
int WriteFrame(uint8_t bID, uint16_t wAddr, uint8_t * pData, uint8_t bLen, uint8_t bWriteType);
|
|
int ReadFrameReq(uint8_t bID, uint16_t wAddr, uint8_t bByteToReturn);
|
|
int WaitRespFrame(uint8_t *pFrame, uint8_t bLen, uint32_t dwTimeOut);
|
|
|
|
//void delayms(uint16_t ms);
|
|
//void delayus(uint16_t us);
|
|
|
|
#endif /* PL455_H_ */
|
|
//EOF
|