📄 mc13191.h
字号:
/** ###################################################################
** THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
** Filename : MC13191.H
** Project : RTOSDemo
** Processor : MC9S08GT60CFB
** Beantype : SynchroMaster
** Version : Bean 02.213, Driver 01.10, CPU db: 2.87.086
** Compiler : Metrowerks HCS08 C Compiler
** Date/Time : 3/10/2006, 2:35 PM
** Abstract :
** This bean "SynchroMaster" implements MASTER part of synchronous
** serial master-slave communication.
** Settings :
** Synchro type : MASTER
**
** Serial channel : SPI1
**
** Protocol
** Init baud rate : 9_998MHz
** Clock edge : rising
** Width : 8 bits (always)
** Empty character : 0
** Empty char. on input : RECEIVED
**
** Registers
** Input buffer : SPI1D [002D]
** Output buffer : SPI1D [002D]
** Control register : SPI1C1 [0028]
** Mode register : SPI1C2 [0029]
** Baud setting reg. : SPI1BR [002A]
**
**
**
** Used pins :
** ----------------------------------------------------------
** Function | On package | Name
** ----------------------------------------------------------
** Input | 13 | PTE3_MISO1
** Output | 14 | PTE4_MOSI1
** Clock | 15 | PTE5_SPSCK1
** ----------------------------------------------------------
**
** Contents :
** RecvChar - byte MC13191_RecvChar(MC13191_TComData *Chr);
** SendChar - byte MC13191_SendChar(MC13191_TComData Chr);
** CharsInRxBuf - byte MC13191_CharsInRxBuf(word *Chr);
** GetCharsInRxBuf - word MC13191_GetCharsInRxBuf(void);
** SetShiftClockPolarity - byte MC13191_SetShiftClockPolarity(byte Edge);
** SetIdleClockPolarity - byte MC13191_SetIdleClockPolarity(byte Level);
**
** (c) Copyright UNIS, spol. s r.o. 1997-2005
** UNIS, spol. s r.o.
** Jundrovska 33
** 624 00 Brno
** Czech Republic
** http : www.processorexpert.com
** mail : info@processorexpert.com
** ###################################################################*/
#ifndef __MC13191
#define __MC13191
/* MODULE MC13191. */
#include "Cpu.h"
typedef union {
byte err;
struct {
bool OverRun : 1; /* OverRun error flag */
bool RxBufOvf : 1; /* Rx buffer full error flag */
bool FaultErr : 1; /* Fault mode error flag */
}errName;
} MC13191_TError;
#define MC13191_EOF 0 /* Empty character */
#ifndef __BWUserType_MC13191_TComData
#define __BWUserType_MC13191_TComData
typedef byte MC13191_TComData; /* User type for communication. */
#endif
byte MC13191_RecvChar(MC13191_TComData *Chr);
/*
** ===================================================================
** Method : MC13191_RecvChar (bean SynchroMaster)
**
** Description :
** If any data is received, this method returns one
** character, otherwise it returns an error code (it does
** not wait for data).
** DMA mode:
** If DMA controller is available on selected CPU and
** receiver is configured to use DMA controller then this
** method only sets the selected DMA channel. Status of the
** DMA transfer can then be checked using method
** GetCharsInRxBuf. See typical usage for details about
** communication using DMA.
** Parameters :
** NAME - DESCRIPTION
** * Chr - A pointer to the received character
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ERR_RXEMPTY - No data in receiver
** ERR_OVERRUN - Overrun error was detected
** from the last char or block received
** ERR_FAULT - Fault error was detected
** from the last char or block received.
** This error may not be supported on some
** CPUs (see generated code).
** ===================================================================
*/
byte MC13191_SendChar(MC13191_TComData Chr);
/*
** ===================================================================
** Method : MC13191_SendChar (bean SynchroMaster)
**
** Description :
** Sends one character to the channel.
** DMA mode:
** If DMA controller is available on the selected CPU and
** the transmitter is configured to use DMA controller then
** this method only sets the selected DMA channel. The
** status of the DMA transfer can then be checked using
** GetCharsInTxBuf method. See the typical usage for details
** about communication using DMA.
** Parameters :
** NAME - DESCRIPTION
** Chr - Character to send
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ERR_DISABLED - Device is disabled (only
** if output DMA is supported and enabled)
** ERR_TXFULL - Transmitter is full
** ===================================================================
*/
byte MC13191_CharsInRxBuf(word *Chr);
/*
** ===================================================================
** Method : MC13191_CharsInRxBuf (bean SynchroMaster)
**
** Description :
** Returns the number of characters in the input buffer.
** Note: If the Interrupt service is disabled, and the
** Ignore empty character is set to yes, and a character has
** been received, then this method returns 1 although it was
** an empty character.
** (deprecated method)
** DMA mode:
** If DMA controller is available on the selected CPU and
** the receiver is configured to use DMA controller then
** this method returns the number of characters in the
** receive buffer.
** Parameters :
** NAME - DESCRIPTION
** * Chr - A pointer to number of characters in
** the input buffer
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ===================================================================
*/
#define MC13191_GetCharsInRxBuf() ((word) SPI1S_SPRF) /* Return number of chars in the receive buffer */
/*
** ===================================================================
** Method : MC13191_GetCharsInRxBuf (bean SynchroMaster)
**
** Description :
** Returns the number of characters in the input buffer.
** Note: If the Interrupt service is disabled, and the
** Ignore empty character is set to yes, and a character has
** been received, then this method returns 1 although it was
** an empty character.
** DMA mode:
** If DMA controller is available on the selected CPU and
** the receiver is configured to use DMA controller then
** this method returns the number of characters in the
** receive buffer.
** Parameters : None
** Returns :
** --- - Number of characters in the input
** buffer.
** ===================================================================
*/
byte MC13191_SetShiftClockPolarity(byte Edge);
/*
** ===================================================================
** Method : MC13191_SetShiftClockPolarity (bean SynchroMaster)
**
** Description :
** Sets the shift clock polarity at runtime. Output data
** will be shifted on the selected edge polarity.
** Parameters :
** NAME - DESCRIPTION
** Edge - Edge polarity.
** 0-falling edge
** 1-rising edge
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ERR_DISABLED - Device is disabled
** ERR_RANGE - Parameter out of range
** ===================================================================
*/
byte MC13191_SetIdleClockPolarity(byte Level);
/*
** ===================================================================
** Method : MC13191_SetIdleClockPolarity (bean SynchroMaster)
**
** Description :
** Sets the idle clock polarity at runtime. If the
** communication does not run, the clock signal will have
** required level.
** Parameters :
** NAME - DESCRIPTION
** Level - Idle clock polarity:
** 0-low
** 1-high
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ERR_DISABLED - Device is disabled
** ERR_RANGE - Parameter out of range
** ===================================================================
*/
void MC13191_Init(void);
/*
** ===================================================================
** Method : MC13191_Init (bean SynchroMaster)
**
** Description :
** Initializes the associated peripheral(s) and the bean's
** internal variables. The method is called automatically as a
** part of the application initialization code.
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
void MC13191_SetHigh(void);
/*
** ===================================================================
** Method : MC13191_SetHigh (bean SynchroMaster)
**
** Description :
** The method reconfigures the bean and its selected peripheral(s)
** when the CPU is switched to the High speed mode. The method is
** called automatically as s part of the CPU SetHighSpeed method.
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
void MC13191_SetLow(void);
/*
** ===================================================================
** Method : MC13191_SetLow (bean SynchroMaster)
**
** Description :
** The method reconfigures the bean and its selected peripheral(s)
** when the CPU is switched to the Low speed mode. The method is
** called automatically as a part of the CPU SetLowSpeed method.
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
void MC13191_SetSlow(void);
/*
** ===================================================================
** Method : MC13191_SetSlow (bean SynchroMaster)
**
** Description :
** The method reconfigures the bean and its selected peripheral(s)
** when the CPU is switched to the Slow speed mode. The method is
** called automatically as a part of the CPU SetSlowSpeed method.
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
/* END MC13191. */
#endif /* ifndef __MC13191 */
/*
** ###################################################################
**
** This file was created by UNIS Processor Expert 2.97 [03.74]
** for the Freescale HCS08 series of microcontrollers.
**
** ###################################################################
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -