📄 freescale
字号:
/** ###################################################################
** THIS COMPONENT MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
** Filename : Master_SPI.H
** Project : Power_Monitor
** Processor : MC9S08JM60CLHE
** Component : SynchroMaster
** Version : Component 02.322, Driver 01.26, CPU db: 3.00.046
** Compiler : CodeWarrior HCS08 C Compiler
** Date/Time : 2010-1-23, 16:39
** Abstract :
** This bean "SynchroMaster" implements MASTER part of synchronous
** serial master-slave communication.
** Settings :
** Synchro type : MASTER
**
** Serial channel : SPI1
**
** Protocol
** Init baud rate : 4MHz
** Clock edge : rising
** Width : 8 bits
** Empty character : 0
** Empty char. on input : RECEIVED
**
** Registers
** Input buffer : SPI1DL [$0055]
** Output buffer : SPI1DL [$0055]
** Control register : SPI1C1 [$0050]
** Mode register : SPI1C2 [$0051]
** Baud setting reg. : SPI1BR [$0052]
**
** Priority :
**
** Priority :
**
** Used pins :
** ----------------------------------------------------------
** Function | On package | Name
** ----------------------------------------------------------
** Input | 17 | PTE4_MISO1
** Output | 18 | PTE5_MOSI1
** Clock | 19 | PTE6_SPSCK1
** ----------------------------------------------------------
**
** Contents :
** RecvChar - byte Master_SPI_RecvChar(Master_SPI_TComData *Chr);
** SendChar - byte Master_SPI_SendChar(Master_SPI_TComData Chr);
** RecvBlock - byte Master_SPI_RecvBlock(Master_SPI_TComData *Ptr, word Size, word *Rcv);
** SendBlock - byte Master_SPI_SendBlock(Master_SPI_TComData *Ptr, word Size, word *Snd);
** ClearRxBuf - byte Master_SPI_ClearRxBuf(void);
** ClearTxBuf - byte Master_SPI_ClearTxBuf(void);
** GetCharsInRxBuf - word Master_SPI_GetCharsInRxBuf(void);
** GetCharsInTxBuf - word Master_SPI_GetCharsInTxBuf(void);
** GetError - byte Master_SPI_GetError(Master_SPI_TError *Err);
**
** Copyright : 1997 - 2009 Freescale Semiconductor, Inc. All Rights Reserved.
**
** http : www.freescale.com
** mail : support@freescale.com
** ###################################################################*/
#ifndef __Master_SPI
#define __Master_SPI
/* MODULE Master_SPI. */
#include "Cpu.h"
#define Master_SPI_EOF 0x00 /* Empty character */
#ifndef __BWUserType_Master_SPI_TComData
#define __BWUserType_Master_SPI_TComData
typedef byte Master_SPI_TComData; /* User type for communication. */
#endif
#ifndef __BWUserType_Master_SPI_TError
#define __BWUserType_Master_SPI_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;
} Master_SPI_TError; /* Error flags. For languages which don't support bit access is byte access only to error flags possible. */
#endif
#define Master_SPI_INP_BUF_SIZE 0x08 /* Input buffer size */
#define Master_SPI_OUT_BUF_SIZE 0x10 /* Output buffer size */
extern byte Master_SPI_OutLen; /* Length of the output buffer content */
extern byte Master_SPI_InpLen; /* Length of the input buffer content */
byte Master_SPI_RecvChar(Master_SPI_TComData *Chr);
/*
** ===================================================================
** Method : Master_SPI_RecvChar (component 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 Master_SPI_SendChar(Master_SPI_TComData Chr);
/*
** ===================================================================
** Method : Master_SPI_SendChar (component 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 Master_SPI_RecvBlock(Master_SPI_TComData *Ptr,word Size,word *Rcv);
/*
** ===================================================================
** Method : Master_SPI_RecvBlock (component SynchroMaster)
**
** Description :
** If any data received, this method returns the block of the
** data and its length (and incidental error), otherwise it
** returns error code (it does not wait for data).
** If less than requested number of characters is received only
** the available data is copied from the receive buffer to the
** user specified destination and the ERR_EXEMPTY value is
** returned.
** This method is available only if non-zero length of input
** buffer is defined.
** Parameters :
** NAME - DESCRIPTION
** * Ptr - A pointer to the block of received data
** Size - The size of the block
** * Rcv - Pointer to a variable where an actual
** number of copied characters is stored
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ERR_RXEMPTY - It was not possible to read
** requested number of bytes from the buffer
** 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 Master_SPI_SendBlock(Master_SPI_TComData * Ptr,word Size,word *Snd);
/*
** ===================================================================
** Method : Master_SPI_SendBlock (component SynchroMaster)
**
** Description :
** Send a block of characters to the channel. This method is
** only available if a non-zero length of output buffer is
** defined.
** Parameters :
** NAME - DESCRIPTION
** * Ptr - Pointer to the block of data to send
** Size - Size of the block
** * Snd - Pointer to number of data that are sent
** (moved to buffer)
** 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 - It was not possible to send
** requested number of bytes
** ===================================================================
*/
byte Master_SPI_ClearRxBuf(void);
/*
** ===================================================================
** Method : Master_SPI_ClearRxBuf (component SynchroMaster)
**
** Description :
** Clears the receive buffer. This method is available only if
** a non-zero length of input buffer is defined.
** Parameters : None
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ===================================================================
*/
byte Master_SPI_ClearTxBuf(void);
/*
** ===================================================================
** Method : Master_SPI_ClearTxBuf (component SynchroMaster)
**
** Description :
** Clears the transmit buffer. This method is only available if
** a non-zero length of output buffer is defined.
** Parameters : None
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ===================================================================
*/
#define Master_SPI_GetCharsInRxBuf() ((word) Master_SPI_InpLen) /* Return number of chars in the receive buffer */
/*
** ===================================================================
** Method : Master_SPI_GetCharsInRxBuf (component 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.
** ===================================================================
*/
#define Master_SPI_GetCharsInTxBuf() ((word) Master_SPI_OutLen) /* Return number of chars in the transmit buffer */
/*
** ===================================================================
** Method : Master_SPI_GetCharsInTxBuf (component SynchroMaster)
**
** Description :
** Returns the number of characters in the output buffer.
** Parameters : None
** Returns :
** --- - Number of characters in the output buffer.
** ===================================================================
*/
byte Master_SPI_GetError(Master_SPI_TError *Err);
/*
** ===================================================================
** Method : Master_SPI_GetError (component 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 Master_SPI_Interrupt(void);
/*
** ===================================================================
** Method : Master_SPI_Interrupt (component 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 Master_SPI_Init(void);
/*
** ===================================================================
** Method : Master_SPI_Init (component 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 Master_SPI. */
#endif /* ifndef __Master_SPI */
/*
** ###################################################################
**
** This file was created by Processor Expert 3.07 [04.34]
** for the Freescale HCS08 series of microcontrollers.
**
** ###################################################################
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -