/*
** ###################################################################
**
**     THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
**
**     Filename  : CAN1.H
**
**     Project   : Full1
** 
**     Processor : MC68HC908AZ60MFU
**
**     Beantype  : MotorolaCAN
**
**     Version   : Bean 02.193, Driver 01.02, CPU db: 2.81.019
**
**     Compiler  : Metrowerks HC08 C Compiler V-5.0.13
**
**     Date/Time : 2.4.2002, 9:36
**
**     Abstract  :
**
**         This bean "MotorolaCAN" implements an CAN serial channel.
**
**     Settings  :
**
**         CAN channel                 : CAN
**
**         Protocol
**             Time segment 1          : 7
**             Time segment 2          : 3
**             RSJ                     : 1
**
**             Recieve accept. code    : 0
**             Recieve accept. mask    : 0
**
**
**
**     Contents  :
**
**         SetAcceptanceCode - byte CAN1_SetAcceptanceCode(dword Mask);
**         SetAcceptanceMask - byte CAN1_SetAcceptanceMask(dword Mask);
**         SetAcceptanceMode - byte CAN1_SetAcceptanceMode(byte Mode);
**         SendFrame         - byte CAN1_SendFrame(byte BufferNum,dword MessageID,byte FrameType,byte Length,by
**         ReadFrame         - byte CAN1_ReadFrame(dword *MessageID,byte *FrameType,byte *FrameFormat,byte *Len
**         GetStateTX        - byte CAN1_GetStateTX(byte BufferNum,bool *State);
**         GetStateRX        - byte CAN1_GetStateRX(void);
**         GetError          - byte CAN1_GetError(void);
**
**
**     (c) Copyright UNIS, spol. s r.o. 1997-2002
**
**     UNIS, spol. s r.o.
**     Jundrovska 33
**     624 00 Brno
**     Czech Republic
**
**     http      : www.processorexpert.com
**     mail      : info@processorexpert.com
**
** ###################################################################
*/

#ifndef __CAN1
#define __CAN1

#include "Cpu.h"

/*Include shared modules, which are used for whole project*/
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
#include "PE_Timer.h"
#include "PE_Cnvrt.h"

/* MODULE CAN1. */


/* User constants */

/* Message filterring */
#define SINGLE_32_FILTER   0
#define TWO_16_FILTER      1
#define FOUR_8_FILTER      2
#define FILTER_CLOSED      3

/* Frame formats */
#define STANDARD_FORMAT    0
#define EXTENDED_FORMAT    1

/* Frame types   */
#define DATA_FRAME         0
#define REMOTE_FRAME       1

/* Global variables */

byte CAN1_SetAcceptanceMode(byte Mode);
/*
** ===================================================================
**     Method      :  CAN1_SetAcceptanceMode (bean MotorolaCAN)
**
**     Description :
**         Set a content of the acceptance mode register.
**     Parameters  :
**         NAME            - DESCRIPTION
**         Mode            - Acceptance mode.
**                           Supported modes: 
**                           SINGLE_32_FILTER - Single 32-bit
**                           acceptance filter
**                           TWO_16_FILTER - Two 16-bit acceptance
**                           filter
**                           FOUR_8_FILTER - Four 8-bit acceptance
**                           filter
**                           FILTER_CLOSED - Filter closed
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
**                           ERR_DISABLED - This bean is disabled by
**                           user
** ===================================================================
*/

#define CAN1_GetStateRX()   CRFLG_RXF
/*
** ===================================================================
**     Method      :  CAN1_GetStateRX (bean MotorolaCAN)
**
**     Description :
**         Return a value of the reception complete flag.
**     Parameters  : None
**     Returns     :
**         ---             - Gets state of the receiver.
**                           0 - Receiver is empty
**                           1 - Receiver is full 
** ===================================================================
*/

byte CAN1_SetAcceptanceCode(dword Mask);
/*
** ===================================================================
**     Method      :  CAN1_SetAcceptanceCode (bean MotorolaCAN)
**
**     Description :
**         Set acceptance code register.
**     Parameters  :
**         NAME            - DESCRIPTION
**         Mask            - Mask could be 11-bit for standard
**                           frame or 29-bit for extended frame
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
**                           ERR_DISABLED - This bean is disabled by
**                           user
** ===================================================================
*/

byte CAN1_GetError(void);
/*
** ===================================================================
**     Method      :  CAN1_GetError (bean MotorolaCAN)
**
**     Description :
**         Return a content of the receiver flag register.
**     Parameters  : None
**     Returns     :
**         ---             - Meaning of returned 8 bits:
**                           Bit 0 - Receive buffer full
**                           Bit 1 - Overrun
**                           Bit 2 - Bus-Off
**                           Bit 3 - Transmitter error passive
**                           Bit 4 - Receiver error passive
**                           Bit 5 - Transmitter warning
**                           Bit 6 - Receiver warning
**                           Bit 7 - Wakeup
** ===================================================================
*/

void CAN1_SetHigh(void);
/*
** ===================================================================
**     Method      :  CAN1_SetHigh (bean MotorolaCAN)
**
**     Description :
**         This method is internal. It is used by Processor Expert
**         only.
** ===================================================================
*/

byte CAN1_SendFrame(byte BufferNum,dword MessageID,byte FrameType,byte Length,byte *Data);
/*
** ===================================================================
**     Method      :  CAN1_SendFrame (bean MotorolaCAN)
**
**     Description :
**         Send a frame.
**     Parameters  :
**         NAME            - DESCRIPTION
**         BufferNum       - Number of the buffer (0..2)
**         MessageID       - Identification of the
**                           message
**         FrameType       - Type of frame
**                           DATA_FRAME - data frame
**                           REMOTE_FRAME - remote frame
**         Length          - Length of the frame in bytes (0..
**                           8)
**       * Data            - Pointer to data 
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
**                           ERR_DISABLED - This bean is disabled by
**                           user
**                           ERR_VALUE - Some parameter is out of
**                           possible range
** ===================================================================
*/

byte CAN1_ReadFrame(dword *MessageID,byte *FrameType,byte *FrameFormat,byte *Length,byte *Data);
/*
** ===================================================================
**     Method      :  CAN1_ReadFrame (bean MotorolaCAN)
**
**     Description :
**         Read a frame.
**     Parameters  :
**         NAME            - DESCRIPTION
**       * MessageID       - Identification of message
**       * FrameType       - Type of frame
**                           DATA_FRAME - data frame
**                           REMOTE_FRAME - remote frame
**       * FrameFormat     - Format of frame
**                           STANDARD_FRAME - standard frame 11-bits
**                           EXTENDED_FRAME - extended frame 29-bits
**       * Length          - Length of the frame
**       * Data            - Pointer to the buffer for received
**                           data
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
**                           ERR_DISABLED - This bean is disabled by
**                           user
** ===================================================================
*/

void CAN1_Init(void);
/*
** ===================================================================
**     Method      :  CAN1_Init (bean MotorolaCAN)
**
**     Description :
**         This method is internal. It is used by Processor Expert
**         only.
** ===================================================================
*/

byte CAN1_GetStateTX(byte BufferNum,bool *State);
/*
** ===================================================================
**     Method      :  CAN1_GetStateTX (bean MotorolaCAN)
**
**     Description :
**         Return a value of the transmission complete flag of given
**         buffer.
**     Parameters  :
**         NAME            - DESCRIPTION
**         BufferNum       - Number of the buffer
**       * State           - Value of transmission complete flag
**                           of the given buffer. FALSE - message
**                           buffer is empty; TRUE - message buffer
**                           isn't empty.
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
**                           ERR_DISABLED - This bean is disabled by
**                           user
**                           ERR_VALUE - Some parameter is out of
**                           possible range
** ===================================================================
*/

byte CAN1_SetAcceptanceMask(dword Mask);
/*
** ===================================================================
**     Method      :  CAN1_SetAcceptanceMask (bean MotorolaCAN)
**
**     Description :
**         Set the acceptance mask registers.
**     Parameters  :
**         NAME            - DESCRIPTION
**         Mask            - Mask could be 11-bit for standard
**                           frame or 29-bit for extended frame
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
**                           ERR_DISABLED - This bean is disabled by
**                           user
** ===================================================================
*/



/* END CAN1. */

#endif /* ifndef __CAN1 */
/*
** ###################################################################
**
**     This file was created by UNIS Processor Expert 02.84 for 
**     the Motorola HC08 series of microcontrollers.
**
** ###################################################################
*/
