📄 sm1.h
字号:
/** ###################################################################
** THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
** Filename : SM1.H
** Project : Project
** Processor : MC9S08DZ60MLF
** Beantype : SynchroMaster
** Version : Bean 02.270, Driver 01.18, CPU db: 2.87.131
** Compiler : CodeWarrior HCS08 C Compiler
** Date/Time : 2008-12-10, 上午 09:28
** Abstract :
** This bean "SynchroMaster" implements MASTER part of synchronous
** serial master-slave communication.
** Settings :
** Synchro type : MASTER
**
** Serial channel : SPI
**
** Protocol
** Init baud rate : 0_100MHz
** Clock edge : rising
** Width : 8 bits (always)
** Empty character : 0
** Empty char. on input : RECEIVED
**
** Registers
** Input buffer : SPID [$0055]
** Output buffer : SPID [$0055]
** Control register : SPIC1 [$0050]
** Mode register : SPIC2 [$0051]
** Baud setting reg. : SPIBR [$0052]
**
** Priority :
**
** Priority :
**
** Used pins :
** ----------------------------------------------------------
** Function | On package | Name
** ----------------------------------------------------------
** Input | 16 | PTE5_SDA_MISO
** Output | 15 | PTE4_SCL_MOSI
** Clock | 14 | PTE3_SPSCK
** ----------------------------------------------------------
**
** Contents :
** Enable - byte SM1_Enable(void);
** Disable - byte SM1_Disable(void);
** RecvChar - byte SM1_RecvChar(SM1_TComData *Chr);
** SendChar - byte SM1_SendChar(SM1_TComData Chr);
** CharsInRxBuf - byte SM1_CharsInRxBuf(word *Chr);
** GetCharsInRxBuf - word SM1_GetCharsInRxBuf(void);
** CharsInTxBuf - byte SM1_CharsInTxBuf(word *Chr);
** GetCharsInTxBuf - word SM1_GetCharsInTxBuf(void);
** GetError - byte SM1_GetError(SM1_TError *Err);
**
** (c) Copyright UNIS, spol. s r.o. 1997-2006
** UNIS, spol. s r.o.
** Jundrovska 33
** 624 00 Brno
** Czech Republic
** http : www.processorexpert.com
** mail : info@processorexpert.com
** ###################################################################*/
#ifndef __SM1
#define __SM1
/* MODULE SM1. */
#include "Cpu.h"
#define SM1_EOF 0 /* Empty character */
#ifndef __BWUserType_SM1_TComData
#define __BWUserType_SM1_TComData
typedef byte SM1_TComData; /* User type for communication. */
#endif
#ifndef __BWUserType_SM1_TError
#define __BWUserType_SM1_TError
typedef union {
byte err;
struct {
bool OverRun : 1; /* OverRun error flag - the data overflow on the input has been detected. Both hardware detection (if supported) and software detection (when the value of Input buffer size property is 0) is used. */
bool RxBufOvf : 1; /* Rx buffer full error flag - the input circular buffer defined by the Input buffer size property has overrun. */
bool FaultErr : 1; /* Fault mode error flag - only if supported by hardware */
}errName;
} SM1_TError; /* Error flags. For languages which don't support bit access is byte access only to error flags possible. */
#endif
byte SM1_Enable(void);
/*
** ===================================================================
** Method : SM1_Enable (bean SynchroMaster)
**
** Description :
** Enable the bean - it starts send and receive functions.
** Events may be generated ("DisableEvent"/"EnableEvent").
** Parameters : None
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ===================================================================
*/
byte SM1_Disable(void);
/*
** ===================================================================
** Method : SM1_Disable (bean SynchroMaster)
**
** Description :
** Disable the bean - it stops the send and receive
** functions. No events will be generated.
** Parameters : None
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ===================================================================
*/
byte SM1_RecvChar(SM1_TComData *Chr);
/*
** ===================================================================
** Method : SM1_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).
** 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. In
** polling mode, this error code is
** returned only when the hardware supports
** detection of the overrun error.
** 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 SM1_SendChar(SM1_TComData Chr);
/*
** ===================================================================
** Method : SM1_SendChar (bean SynchroMaster)
**
** Description :
** Sends one character to the channel.
** 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 SM1_CharsInRxBuf(word *Chr);
/*
** ===================================================================
** Method : SM1_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)
** 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
** ===================================================================
*/
word SM1_GetCharsInRxBuf(void);
/*
** ===================================================================
** Method : SM1_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.
** Parameters : None
** Returns :
** --- - Number of characters in the input
** buffer.
** ===================================================================
*/
byte SM1_CharsInTxBuf(word *Chr);
/*
** ===================================================================
** Method : SM1_CharsInTxBuf (bean SynchroMaster)
**
** Description :
** Returns the number of characters in the output buffer.
** (deprecated method)
** Parameters :
** NAME - DESCRIPTION
** * Chr - A pointer to the number of characters
** in the output buffer
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ===================================================================
*/
word SM1_GetCharsInTxBuf(void);
/*
** ===================================================================
** Method : SM1_GetCharsInTxBuf (bean SynchroMaster)
**
** Description :
** Returns the number of characters in the output buffer.
** Parameters : None
** Returns :
** --- - Number of characters in the output
** buffer.
** ===================================================================
*/
byte SM1_GetError(SM1_TError *Err);
/*
** ===================================================================
** Method : SM1_GetError (bean SynchroMaster)
**
** Description :
** Returns a set of errors on the channel (errors that
** cannot be returned in given methods). The errors
** accumulate in a set; after calling [GetError] this set is
** returned and cleared.
** Parameters :
** NAME - DESCRIPTION
** * Err - A pointer to the returned set of errors
** Returns :
** --- - Error code (if GetError did not succeed),
** possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ===================================================================
*/
__interrupt void SM1_Interrupt(void);
/*
** ===================================================================
** Method : SM1_Interrupt (bean SynchroMaster)
**
** Description :
** The method services the error interrupt of the selected
** peripheral(s) and eventually invokes the bean's event(s).
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
void SM1_Init(void);
/*
** ===================================================================
** Method : SM1_Init (bean SynchroMaster)
**
** Description :
** Initializes the associated peripheral(s) and the bean 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.
** ===================================================================
*/
/* END SM1. */
#endif /* ifndef __SM1 */
/*
** ###################################################################
**
** This file was created by UNIS Processor Expert 3.01 [03.92]
** for the Freescale HCS08 series of microcontrollers.
**
** ###################################################################
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -