mirror of https://github.com/rusefi/ChibiOS.git
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1881 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
d49704990d
commit
3621ac37b0
|
@ -1,6 +1,6 @@
|
|||
|
||||
<ApplicationBuild Header="ch" Extern=".\ch.rapp" Path=".\ch.rapp" OutputFile="..\STM8S-STM8S208-RC/bin\ch.aof" sate="2" >
|
||||
<Group Header="kernel" Marker="-1" OutputFile="" sate="96" >
|
||||
<ApplicationBuild Header="ch" Extern=".\ch.rapp" Path=".\ch.rapp" OutputFile="..\STM8S-STM8S208-RC/bin\ch.aof" sate="98" >
|
||||
<Group Header="kernel" Marker="-1" OutputFile="" sate="0" >
|
||||
<NodeC Path="..\..\os\kernel\src\chcond.c" Header="chcond.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\chcond.obj" sate="0" />
|
||||
<NodeC Path="..\..\os\kernel\src\chdebug.c" Header="chdebug.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\chdebug.obj" sate="0" />
|
||||
<NodeC Path="..\..\os\kernel\src\chevents.c" Header="chevents.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\chevents.obj" sate="0" />
|
||||
|
@ -10,15 +10,15 @@
|
|||
<Set Header="RCST7" >
|
||||
<Section Header="Model" >
|
||||
<Property Header="GlobalMemory" Value="" Removable="1" />
|
||||
|
||||
|
||||
</Section>
|
||||
|
||||
|
||||
</Set>
|
||||
|
||||
|
||||
</Config>
|
||||
|
||||
|
||||
</Options>
|
||||
|
||||
|
||||
</NodeC>
|
||||
<NodeC Path="..\..\os\kernel\src\chlists.c" Header="chlists.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\chlists.obj" sate="0" />
|
||||
<NodeC Path="..\..\os\kernel\src\chmboxes.c" Header="chmboxes.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\chmboxes.obj" sate="0" />
|
||||
|
@ -34,15 +34,15 @@
|
|||
<Set Header="RCST7" >
|
||||
<Section Header="Model" >
|
||||
<Property Header="GlobalMemory" Value="" Removable="1" />
|
||||
|
||||
|
||||
</Section>
|
||||
|
||||
|
||||
</Set>
|
||||
|
||||
|
||||
</Config>
|
||||
|
||||
|
||||
</Options>
|
||||
|
||||
|
||||
</NodeC>
|
||||
<NodeC Path="..\..\os\kernel\src\chsem.c" Header="chsem.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\chsem.obj" sate="0" />
|
||||
<NodeC Path="..\..\os\kernel\src\chsys.c" Header="chsys.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\chsys.obj" sate="0" />
|
||||
|
@ -53,17 +53,17 @@
|
|||
<Set Header="RCST7" >
|
||||
<Section Header="Model" >
|
||||
<Property Header="GlobalMemory" Value="" Removable="1" />
|
||||
|
||||
|
||||
</Section>
|
||||
|
||||
|
||||
</Set>
|
||||
|
||||
|
||||
</Config>
|
||||
|
||||
|
||||
</Options>
|
||||
|
||||
|
||||
</NodeC>
|
||||
|
||||
|
||||
</Group>
|
||||
<Group Header="test" Marker="-1" OutputFile="" sate="0" >
|
||||
<NodeC Path="..\..\test\test.c" Header="test.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\test.obj" sate="0" />
|
||||
|
@ -78,11 +78,11 @@
|
|||
<NodeC Path="..\..\test\testqueues.c" Header="testqueues.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\testqueues.obj" sate="0" />
|
||||
<NodeC Path="..\..\test\testsem.c" Header="testsem.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\testsem.obj" sate="0" />
|
||||
<NodeC Path="..\..\test\testthd.c" Header="testthd.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\testthd.obj" sate="0" />
|
||||
|
||||
|
||||
</Group>
|
||||
<Group Header="port" Marker="-1" OutputFile="" sate="0" >
|
||||
<NodeC Path="..\..\os\ports\RC\STM8\chcore.c" Header="chcore.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\chcore.obj" sate="0" />
|
||||
|
||||
|
||||
</Group>
|
||||
<Group Header="hal" Marker="-1" OutputFile="" sate="0" >
|
||||
<NodeC Path="..\..\os\hal\src\adc.c" Header="adc.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\adc.obj" sate="0" />
|
||||
|
@ -97,33 +97,33 @@
|
|||
<NodeC Path="..\..\os\hal\platforms\STM8\hal_lld.c" Header="hal_lld.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\hal_lld.obj" sate="0" />
|
||||
<NodeC Path="..\..\os\hal\platforms\STM8\serial_lld.c" Header="serial_lld.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\serial_lld.obj" sate="0" />
|
||||
<NodeC Path="..\..\os\hal\platforms\STM8\pal_lld.c" Header="pal_lld.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\pal_lld.obj" sate="0" />
|
||||
|
||||
</Group>
|
||||
<Group Header="board" Marker="-1" OutputFile="" sate="96" >
|
||||
<NodeC Path="..\..\boards\RAISONANCE_REVA_STM8S\board.c" Header="board.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\board.obj" sate="0" />
|
||||
|
||||
</Group>
|
||||
<Group Header="board" Marker="-1" OutputFile="" sate="0" >
|
||||
<NodeC Path="..\..\boards\RAISONANCE_REVA_STM8S\board.c" Header="board.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\board.obj" sate="0" />
|
||||
|
||||
</Group>
|
||||
<NodeC Path=".\main.c" Header="main.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\main.obj" sate="0" />
|
||||
<Options>
|
||||
<Config Header="Standard" >
|
||||
<Set Header="ApplicationBuild" >
|
||||
<Section Header="General" >
|
||||
<Property Header="TargetFamily" Value="ST7" />
|
||||
|
||||
|
||||
</Section>
|
||||
<Section Header="Directories" >
|
||||
<Property Header="IncDir" Value="$(RkitInc);$(RkitInc)\ST7;..\..\os\kernel\include;..\..\os\ports\RC\STM8;..\..\os\hal\include;..\..\os\hal\platforms\STM8;..\..\boards\RAISONANCE_REVA_STM8S;..\..\test" Removable="1" />
|
||||
<Property Header="OutDir" Value="$(ApplicationDir)/bin" Removable="1" />
|
||||
<Property Header="ListDir" Value="$(ApplicationDir)/lst" Removable="1" />
|
||||
<Property Header="LinkerOutputDir" Value="Output Directory" Removable="1" />
|
||||
|
||||
|
||||
</Section>
|
||||
|
||||
|
||||
</Set>
|
||||
<Set Header="Target" >
|
||||
<Section Header="ProcessorST7" >
|
||||
<Property Header="Processor" Value="STM8S208MB" Removable="1" />
|
||||
|
||||
|
||||
</Section>
|
||||
<Section Header="ToolSetST7" >
|
||||
<Property Header="BuildToolSetST7" Value="ST7\RaisonanceTools.config" Removable="1" />
|
||||
|
@ -134,33 +134,33 @@
|
|||
<Section Header="DebugST7" >
|
||||
<Property Header="Startup" Value="1" Removable="1" />
|
||||
<Property Header="DebugTool_STM8" Value="RLINK_STM8" Removable="1" />
|
||||
|
||||
|
||||
</Section>
|
||||
|
||||
</Set>
|
||||
<Set Header="RCST7" >
|
||||
<Section Header="CodeGen" >
|
||||
<Property Header="ENUMTYPE" Value="ET(CHAR)" Removable="1" />
|
||||
|
||||
|
||||
</Section>
|
||||
<Section Header="Model" >
|
||||
<Property Header="GlobalMemory" Value="DGC(DATA)" Removable="1" />
|
||||
<Property Header="ModelP" Value="STM8(SMALL)" Removable="1" />
|
||||
|
||||
|
||||
</Section>
|
||||
<Section Header="OPTIM" >
|
||||
<Property Header="OTLEVEL" Value="3" Removable="1" />
|
||||
<Property Header="SPEEDSIZE" Value="SPEED" Removable="1" />
|
||||
|
||||
|
||||
</Section>
|
||||
|
||||
|
||||
</Set>
|
||||
<Set Header="MAST7" >
|
||||
<Section Header="Set" >
|
||||
<Property Header="Defines" Value="STM8S208RB" Removable="1" />
|
||||
|
||||
|
||||
</Section>
|
||||
|
||||
|
||||
</Set>
|
||||
</Config>
|
||||
</Options>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
<Project Header="Project 'ch'" Path=".\ch.rprj" Project="Yes" OutputFile="" sate="96" ActiveApp="ch" >
|
||||
<ApplicationBuild Header="ch" Extern=".\ch.rapp" Path=".\ch.rapp" OutputFile="..\STM8S-STM8S208-RC/bin\ch.aof" sate="2" />
|
||||
<ApplicationBuild Header="ch" Extern=".\ch.rapp" Path=".\ch.rapp" OutputFile="..\STM8S-STM8S208-RC/bin\ch.aof" sate="98" />
|
||||
</Project>
|
|
@ -18,8 +18,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @file AT91SAM7/serial_lld.c
|
||||
* @brief AT91SAM7 low level serial driver code.
|
||||
* @file AT91SAM7/serial_lld.c
|
||||
* @brief AT91SAM7 low level serial driver code.
|
||||
*
|
||||
* @addtogroup AT91SAM7_SERIAL
|
||||
* @{
|
||||
*/
|
||||
|
@ -77,9 +78,10 @@ static const SerialConfig default_config = {
|
|||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief USART initialization.
|
||||
* @brief USART initialization.
|
||||
*
|
||||
* @param[in] sdp communication channel associated to the USART
|
||||
* @param[in] sdp communication channel associated to the USART
|
||||
* @param[in] config the architecture-dependent serial driver configuration
|
||||
*/
|
||||
static void usart_init(SerialDriver *sdp, const SerialConfig *config) {
|
||||
AT91PS_USART u = sdp->usart;
|
||||
|
@ -104,8 +106,9 @@ static void usart_init(SerialDriver *sdp, const SerialConfig *config) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief USART de-initialization.
|
||||
* @param[in] u pointer to an USART I/O block
|
||||
* @brief USART de-initialization.
|
||||
*
|
||||
* @param[in] u pointer to an USART I/O block
|
||||
*/
|
||||
static void usart_deinit(AT91PS_USART u) {
|
||||
|
||||
|
@ -118,9 +121,10 @@ static void usart_deinit(AT91PS_USART u) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Error handling routine.
|
||||
* @param[in] err USART CSR register value
|
||||
* @param[in] sdp communication channel associated to the USART
|
||||
* @brief Error handling routine.
|
||||
*
|
||||
* @param[in] err USART CSR register value
|
||||
* @param[in] sdp communication channel associated to the USART
|
||||
*/
|
||||
static void set_error(SerialDriver *sdp, AT91_REG csr) {
|
||||
sdflags_t sts = 0;
|
||||
|
@ -142,9 +146,9 @@ static void set_error(SerialDriver *sdp, AT91_REG csr) {
|
|||
__attribute__((noinline))
|
||||
#endif
|
||||
/**
|
||||
* @brief Common IRQ handler.
|
||||
* @brief Common IRQ handler.
|
||||
*
|
||||
* @param[in] sdp communication channel associated to the USART
|
||||
* @param[in] sdp communication channel associated to the USART
|
||||
*/
|
||||
static void serve_interrupt(SerialDriver *sdp) {
|
||||
uint32_t csr;
|
||||
|
@ -222,7 +226,7 @@ CH_IRQ_HANDLER(USART1IrqHandler) {
|
|||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* Low level serial driver initialization.
|
||||
* @brief Low level serial driver initialization.
|
||||
*/
|
||||
void sd_lld_init(void) {
|
||||
|
||||
|
@ -250,9 +254,12 @@ void sd_lld_init(void) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Low level serial driver configuration and (re)start.
|
||||
* @brief Low level serial driver configuration and (re)start.
|
||||
*
|
||||
* @param[in] sdp pointer to a @p SerialDriver object
|
||||
* @param[in] sdp pointer to a @p SerialDriver object
|
||||
* @param[in] config the architecture-dependent serial driver configuration.
|
||||
* If this parameter is set to @p NULL then a default
|
||||
* configuration is used.
|
||||
*/
|
||||
void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
|
||||
|
||||
|
@ -281,11 +288,11 @@ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Low level serial driver stop.
|
||||
* @brief Low level serial driver stop.
|
||||
* @details De-initializes the USART, stops the associated clock, resets the
|
||||
* interrupt vector.
|
||||
*
|
||||
* @param[in] sdp pointer to a @p SerialDriver object
|
||||
* @param[in] sdp pointer to a @p SerialDriver object
|
||||
*/
|
||||
void sd_lld_stop(SerialDriver *sdp) {
|
||||
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @file AT91SAM7/serial_lld.h
|
||||
* @brief AT91SAM7 low level serial driver header.
|
||||
* @file AT91SAM7/serial_lld.h
|
||||
* @brief AT91SAM7 low level serial driver header.
|
||||
*
|
||||
* @addtogroup AT91SAM7_SERIAL
|
||||
* @{
|
||||
*/
|
||||
|
@ -38,32 +39,32 @@
|
|||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief UART0 driver enable switch.
|
||||
* @brief UART0 driver enable switch.
|
||||
* @details If set to @p TRUE the support for USART1 is included.
|
||||
* @note The default is @p TRUE.
|
||||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(USE_SAM7_USART0) || defined(__DOXYGEN__)
|
||||
#define USE_SAM7_USART0 TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief UART1 driver enable switch.
|
||||
* @brief UART1 driver enable switch.
|
||||
* @details If set to @p TRUE the support for USART2 is included.
|
||||
* @note The default is @p TRUE.
|
||||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(USE_SAM7_USART1) || defined(__DOXYGEN__)
|
||||
#define USE_SAM7_USART1 TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief UART1 interrupt priority level setting.
|
||||
* @brief UART1 interrupt priority level setting.
|
||||
*/
|
||||
#if !defined(SAM7_USART0_PRIORITY) || defined(__DOXYGEN__)
|
||||
#define SAM7_USART0_PRIORITY (AT91C_AIC_PRIOR_HIGHEST - 2)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief UART2 interrupt priority level setting.
|
||||
* @brief UART2 interrupt priority level setting.
|
||||
*/
|
||||
#if !defined(SAM7_USART1_PRIORITY) || defined(__DOXYGEN__)
|
||||
#define SAM7_USART1_PRIORITY (AT91C_AIC_PRIOR_HIGHEST - 2)
|
||||
|
@ -78,30 +79,30 @@
|
|||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Serial Driver condition flags type.
|
||||
* @brief Serial Driver condition flags type.
|
||||
*/
|
||||
typedef uint32_t sdflags_t;
|
||||
|
||||
/**
|
||||
* @brief AT91SAM7 Serial Driver configuration structure.
|
||||
* @brief AT91SAM7 Serial Driver configuration structure.
|
||||
* @details An instance of this structure must be passed to @p sdStart()
|
||||
* in order to configure and start a serial driver operations.
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Bit rate.
|
||||
* @brief Bit rate.
|
||||
* @details This is written to the US_BRGR register of the appropriate AT91S_USART
|
||||
*/
|
||||
uint32_t sc_speed;
|
||||
/**
|
||||
* @brief Initialization value for the MR register.
|
||||
* @brief Initialization value for the MR register.
|
||||
* @details This is written to the US_MR register of the appropriate AT91S_USART
|
||||
*/
|
||||
uint32_t sc_mr;
|
||||
} SerialConfig;
|
||||
|
||||
/**
|
||||
* @brief @p SerialDriver specific data.
|
||||
* @brief @p SerialDriver specific data.
|
||||
*/
|
||||
#define _serial_driver_data \
|
||||
_base_asynchronous_channel_data \
|
||||
|
|
|
@ -69,15 +69,16 @@ static const SerialConfig default_config = {
|
|||
* @details This function must be invoked with interrupts disabled.
|
||||
*
|
||||
* @param[in] sdp pointer to a @p SerialDriver object
|
||||
* @param[in] config the architecture-dependent serial driver configuration
|
||||
*/
|
||||
static void esci_init(SerialDriver *sdp) {
|
||||
static void esci_init(SerialDriver *sdp, const SerialConfig *config) {
|
||||
volatile struct ESCI_tag *escip = sdp->escip;
|
||||
uint8_t mode = sdp->config->sc_mode;
|
||||
uint8_t mode = config->sc_mode;
|
||||
|
||||
escip->CR2.R = 0; /* MDIS off. */
|
||||
escip->CR1.R = 0;
|
||||
escip->LCR.R = 0;
|
||||
escip->CR1.B.SBR = SPC563_SYSCLK / (16 * sdp->config->sc_speed);
|
||||
escip->CR1.B.SBR = SPC563_SYSCLK / (16 * config->sc_speed);
|
||||
if (mode & SD_MODE_LOOPBACK)
|
||||
escip->CR1.B.LOOPS = 1;
|
||||
switch (mode & SD_MODE_PARITY) {
|
||||
|
@ -267,12 +268,15 @@ void sd_lld_init(void) {
|
|||
* @brief Low level serial driver configuration and (re)start.
|
||||
*
|
||||
* @param[in] sdp pointer to a @p SerialDriver object
|
||||
* @param[in] config the architecture-dependent serial driver configuration.
|
||||
* If this parameter is set to @p NULL then a default
|
||||
* configuration is used.
|
||||
*/
|
||||
void sd_lld_start(SerialDriver *sdp) {
|
||||
void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
|
||||
|
||||
if (sdp->config == NULL)
|
||||
sdp->config = &default_config;
|
||||
esci_init(sdp);
|
||||
if (config == NULL)
|
||||
config = &default_config;
|
||||
esci_init(sdp, config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -117,8 +117,6 @@ typedef struct {
|
|||
_base_asynchronous_channel_data \
|
||||
/* Driver state.*/ \
|
||||
sdstate_t state; \
|
||||
/* Current configuration data.*/ \
|
||||
const SerialConfig *config; \
|
||||
/* Input queue.*/ \
|
||||
InputQueue iqueue; \
|
||||
/* Output queue.*/ \
|
||||
|
@ -154,7 +152,7 @@ extern SerialDriver SD2;
|
|||
extern "C" {
|
||||
#endif
|
||||
void sd_lld_init(void);
|
||||
void sd_lld_start(SerialDriver *sdp);
|
||||
void sd_lld_start(SerialDriver *sdp, const SerialConfig *config);
|
||||
void sd_lld_stop(SerialDriver *sdp);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @file STM32/serial_lld.c
|
||||
* @brief STM32 low level serial driver code.
|
||||
* @file STM32/serial_lld.c
|
||||
* @brief STM32 low level serial driver code.
|
||||
*
|
||||
* @addtogroup STM32_SERIAL
|
||||
* @{
|
||||
*/
|
||||
|
@ -78,10 +79,11 @@ static const SerialConfig default_config =
|
|||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief USART initialization.
|
||||
* @brief USART initialization.
|
||||
* @details This function must be invoked with interrupts disabled.
|
||||
*
|
||||
* @param[in] sdp pointer to a @p SerialDriver object
|
||||
* @param[in] sdp pointer to a @p SerialDriver object
|
||||
* @param[in] config the architecture-dependent serial driver configuration
|
||||
*/
|
||||
static void usart_init(SerialDriver *sdp, const SerialConfig *config) {
|
||||
USART_TypeDef *u = sdp->usart;
|
||||
|
@ -107,10 +109,10 @@ static void usart_init(SerialDriver *sdp, const SerialConfig *config) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief USART de-initialization.
|
||||
* @brief USART de-initialization.
|
||||
* @details This function must be invoked with interrupts disabled.
|
||||
*
|
||||
* @param[in] u pointer to an USART I/O block
|
||||
* @param[in] u pointer to an USART I/O block
|
||||
*/
|
||||
static void usart_deinit(USART_TypeDef *u) {
|
||||
|
||||
|
@ -122,8 +124,8 @@ static void usart_deinit(USART_TypeDef *u) {
|
|||
/**
|
||||
* @brief Error handling routine.
|
||||
*
|
||||
* @param[in] sdp pointer to a @p SerialDriver object
|
||||
* @param[in] sr USART SR register value
|
||||
* @param[in] sdp pointer to a @p SerialDriver object
|
||||
* @param[in] sr USART SR register value
|
||||
*/
|
||||
static void set_error(SerialDriver *sdp, uint16_t sr) {
|
||||
sdflags_t sts = 0;
|
||||
|
@ -144,9 +146,9 @@ static void set_error(SerialDriver *sdp, uint16_t sr) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Common IRQ handler.
|
||||
* @brief Common IRQ handler.
|
||||
*
|
||||
* @param[in] sdp communication channel associated to the USART
|
||||
* @param[in] sdp communication channel associated to the USART
|
||||
*/
|
||||
static void serve_interrupt(SerialDriver *sdp) {
|
||||
USART_TypeDef *u = sdp->usart;
|
||||
|
@ -281,7 +283,7 @@ CH_IRQ_HANDLER(Vector114) {
|
|||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* Low level serial driver initialization.
|
||||
* @brief Low level serial driver initialization.
|
||||
*/
|
||||
void sd_lld_init(void) {
|
||||
|
||||
|
@ -314,9 +316,12 @@ void sd_lld_init(void) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Low level serial driver configuration and (re)start.
|
||||
* @brief Low level serial driver configuration and (re)start.
|
||||
*
|
||||
* @param[in] sdp pointer to a @p SerialDriver object
|
||||
* @param[in] sdp pointer to a @p SerialDriver object
|
||||
* @param[in] config the architecture-dependent serial driver configuration.
|
||||
* If this parameter is set to @p NULL then a default
|
||||
* configuration is used.
|
||||
*/
|
||||
void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
|
||||
|
||||
|
@ -366,11 +371,11 @@ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Low level serial driver stop.
|
||||
* @brief Low level serial driver stop.
|
||||
* @details De-initializes the USART, stops the associated clock, resets the
|
||||
* interrupt vector.
|
||||
*
|
||||
* @param[in] sdp pointer to a @p SerialDriver object
|
||||
* @param[in] sdp pointer to a @p SerialDriver object
|
||||
*/
|
||||
void sd_lld_stop(SerialDriver *sdp) {
|
||||
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @file STM32/serial_lld.h
|
||||
* @brief STM32 low level serial driver header.
|
||||
* @file STM32/serial_lld.h
|
||||
* @brief STM32 low level serial driver header.
|
||||
*
|
||||
* @addtogroup STM32_SERIAL
|
||||
* @{
|
||||
*/
|
||||
|
@ -38,27 +39,27 @@
|
|||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief USART1 driver enable switch.
|
||||
* @brief USART1 driver enable switch.
|
||||
* @details If set to @p TRUE the support for USART1 is included.
|
||||
* @note The default is @p FALSE.
|
||||
* @note The default is @p FALSE.
|
||||
*/
|
||||
#if !defined(USE_STM32_USART1) || defined(__DOXYGEN__)
|
||||
#define USE_STM32_USART1 TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USART2 driver enable switch.
|
||||
* @brief USART2 driver enable switch.
|
||||
* @details If set to @p TRUE the support for USART2 is included.
|
||||
* @note The default is @p TRUE.
|
||||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(USE_STM32_USART2) || defined(__DOXYGEN__)
|
||||
#define USE_STM32_USART2 TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USART3 driver enable switch.
|
||||
* @brief USART3 driver enable switch.
|
||||
* @details If set to @p TRUE the support for USART3 is included.
|
||||
* @note The default is @p FALSE.
|
||||
* @note The default is @p FALSE.
|
||||
*/
|
||||
#if !defined(USE_STM32_USART3) || defined(__DOXYGEN__)
|
||||
#define USE_STM32_USART3 TRUE
|
||||
|
@ -67,18 +68,18 @@
|
|||
|
||||
#if defined(STM32F10X_HD) || defined(STM32F10X_CL) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief UART4 driver enable switch.
|
||||
* @brief UART4 driver enable switch.
|
||||
* @details If set to @p TRUE the support for UART4 is included.
|
||||
* @note The default is @p FALSE.
|
||||
* @note The default is @p FALSE.
|
||||
*/
|
||||
#if !defined(USE_STM32_UART4) || defined(__DOXYGEN__)
|
||||
#define USE_STM32_UART4 TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief UART5 driver enable switch.
|
||||
* @brief UART5 driver enable switch.
|
||||
* @details If set to @p TRUE the support for UART5 is included.
|
||||
* @note The default is @p FALSE.
|
||||
* @note The default is @p FALSE.
|
||||
*/
|
||||
#if !defined(USE_STM32_USART3) || defined(__DOXYGEN__)
|
||||
#define USE_STM32_UART5 TRUE
|
||||
|
@ -86,21 +87,21 @@
|
|||
#endif
|
||||
|
||||
/**
|
||||
* @brief USART1 interrupt priority level setting.
|
||||
* @brief USART1 interrupt priority level setting.
|
||||
*/
|
||||
#if !defined(STM32_USART1_PRIORITY) || defined(__DOXYGEN__)
|
||||
#define STM32_USART1_PRIORITY 12
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USART2 interrupt priority level setting.
|
||||
* @brief USART2 interrupt priority level setting.
|
||||
*/
|
||||
#if !defined(STM32_USART2_PRIORITY) || defined(__DOXYGEN__)
|
||||
#define STM32_USART2_PRIORITY 12)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USART3 interrupt priority level setting.
|
||||
* @brief USART3 interrupt priority level setting.
|
||||
*/
|
||||
#if !defined(STM32_USART3_PRIORITY) || defined(__DOXYGEN__)
|
||||
#define STM32_USART3_PRIORITY 12
|
||||
|
@ -108,14 +109,14 @@
|
|||
|
||||
#if defined(STM32F10X_HD) || defined(STM32F10X_CL) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief UART4 interrupt priority level setting.
|
||||
* @brief UART4 interrupt priority level setting.
|
||||
*/
|
||||
#if !defined(STM32_UART4_PRIORITY) || defined(__DOXYGEN__)
|
||||
#define STM32_UART4_PRIORITY 12
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief UART5 interrupt priority level setting.
|
||||
* @brief UART5 interrupt priority level setting.
|
||||
*/
|
||||
#if !defined(STM32_UART5_PRIORITY) || defined(__DOXYGEN__)
|
||||
#define STM32_UART5_PRIORITY 12
|
||||
|
@ -131,18 +132,17 @@
|
|||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Serial Driver condition flags type.
|
||||
* @brief Serial Driver condition flags type.
|
||||
*/
|
||||
typedef uint32_t sdflags_t;
|
||||
|
||||
/**
|
||||
* @brief STM32 Serial Driver configuration structure.
|
||||
* @brief STM32 Serial Driver configuration structure.
|
||||
* @details An instance of this structure must be passed to @p sdStart()
|
||||
* in order to configure and start a serial driver operations.
|
||||
*
|
||||
* @note This structure content is architecture dependent, each driver
|
||||
* implementation defines its own version and the custom static
|
||||
* initializers.
|
||||
* @note This structure content is architecture dependent, each driver
|
||||
* implementation defines its own version and the custom static
|
||||
* initializers.
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
|
@ -164,7 +164,7 @@ typedef struct {
|
|||
} SerialConfig;
|
||||
|
||||
/**
|
||||
* @brief @p SerialDriver specific data.
|
||||
* @brief @p SerialDriver specific data.
|
||||
*/
|
||||
#define _serial_driver_data \
|
||||
_base_asynchronous_channel_data \
|
||||
|
|
|
@ -278,21 +278,24 @@ void sd_lld_init(void) {
|
|||
* @brief Low level serial driver configuration and (re)start.
|
||||
*
|
||||
* @param[in] sdp pointer to a @p SerialDriver object
|
||||
* @param[in] config the architecture-dependent serial driver configuration.
|
||||
* If this parameter is set to @p NULL then a default
|
||||
* configuration is used.
|
||||
*/
|
||||
void sd_lld_start(SerialDriver *sdp) {
|
||||
void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
|
||||
|
||||
if (sdp->config == NULL)
|
||||
sdp->config = &default_config;
|
||||
if (config == NULL)
|
||||
config = &default_config;
|
||||
|
||||
#if USE_STM8_UART1
|
||||
if (&SD1 == sdp) {
|
||||
uart1_init(sdp->config);
|
||||
uart1_init(config);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#if USE_STM8_UART3
|
||||
if (&SD3 == sdp) {
|
||||
uart3_init(sdp->config);
|
||||
uart3_init(config);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -105,8 +105,6 @@ typedef struct {
|
|||
_base_asynchronous_channel_data \
|
||||
/* Driver state.*/ \
|
||||
sdstate_t state; \
|
||||
/* Current configuration data.*/ \
|
||||
const SerialConfig *config; \
|
||||
/* Input queue.*/ \
|
||||
InputQueue iqueue; \
|
||||
/* Output queue.*/ \
|
||||
|
@ -146,7 +144,7 @@ extern SerialDriver SD3;
|
|||
extern "C" {
|
||||
#endif
|
||||
void sd_lld_init(void);
|
||||
void sd_lld_start(SerialDriver *sdp);
|
||||
void sd_lld_start(SerialDriver *sdp, const SerialConfig *config);
|
||||
void sd_lld_stop(SerialDriver *sdp);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -216,14 +216,17 @@ void sd_lld_init(void) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Low level serial driver configuration and (re)start.
|
||||
* @brief Low level serial driver configuration and (re)start.
|
||||
*
|
||||
* @param[in] sdp pointer to a @p SerialDriver object
|
||||
* @param[in] sdp pointer to a @p SerialDriver object
|
||||
* @param[in] config the architecture-dependent serial driver configuration.
|
||||
* If this parameter is set to @p NULL then a default
|
||||
* configuration is used.
|
||||
*/
|
||||
void sd_lld_start(SerialDriver *sdp) {
|
||||
void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
|
||||
|
||||
if (sdp->config == NULL)
|
||||
sdp->config = &default_config;
|
||||
if (config == NULL)
|
||||
config = &default_config;
|
||||
|
||||
#if USE_WIN32_SERIAL1
|
||||
if (sdp == &SD1)
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @file Win32/serial_lld.h
|
||||
* @brief Win32 low level simulated serial driver header.
|
||||
* @file Win32/serial_lld.h
|
||||
* @brief Win32 low level simulated serial driver header.
|
||||
*
|
||||
* @addtogroup WIN32_SERIAL
|
||||
* @{
|
||||
*/
|
||||
|
@ -34,41 +35,41 @@
|
|||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Serial buffers size.
|
||||
* @brief Serial buffers size.
|
||||
* @details Configuration parameter, you can change the depth of the queue
|
||||
* buffers depending on the requirements of your application.
|
||||
* buffers depending on the requirements of your application.
|
||||
*/
|
||||
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
|
||||
#define SERIAL_BUFFERS_SIZE 1024
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief SD1 driver enable switch.
|
||||
* @brief SD1 driver enable switch.
|
||||
* @details If set to @p TRUE the support for SD1 is included.
|
||||
* @note The default is @p TRUE.
|
||||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(USE_WIN32_SERIAL1) || defined(__DOXYGEN__)
|
||||
#define USE_WIN32_SERIAL1 TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief SD2 driver enable switch.
|
||||
* @brief SD2 driver enable switch.
|
||||
* @details If set to @p TRUE the support for SD2 is included.
|
||||
* @note The default is @p TRUE.
|
||||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(USE_WIN32_SERIAL2) || defined(__DOXYGEN__)
|
||||
#define USE_WIN32_SERIAL2 TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Listen port for SD1.
|
||||
* @brief Listen port for SD1.
|
||||
*/
|
||||
#if !defined(SD1_PORT) || defined(__DOXYGEN__)
|
||||
#define SD1_PORT 29001
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Listen port for SD2.
|
||||
* @brief Listen port for SD2.
|
||||
*/
|
||||
#if !defined(SD2_PORT) || defined(__DOXYGEN__)
|
||||
#define SD2_PORT 29002
|
||||
|
@ -83,31 +84,28 @@
|
|||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* Serial Driver condition flags type.
|
||||
* @brief Serial Driver condition flags type.
|
||||
*/
|
||||
typedef uint32_t sdflags_t;
|
||||
|
||||
/**
|
||||
* @brief Generic Serial Driver configuration structure.
|
||||
* @brief Generic Serial Driver configuration structure.
|
||||
* @details An instance of this structure must be passed to @p sdStart()
|
||||
* in order to configure and start a serial driver operations.
|
||||
*
|
||||
* @note This structure content is architecture dependent, each driver
|
||||
* implementation defines its own version and the custom static
|
||||
* initializers.
|
||||
* @note This structure content is architecture dependent, each driver
|
||||
* implementation defines its own version and the custom static
|
||||
* initializers.
|
||||
*/
|
||||
typedef struct {
|
||||
} SerialConfig;
|
||||
|
||||
/**
|
||||
* @brief @p SerialDriver specific data.
|
||||
* @brief @p SerialDriver specific data.
|
||||
*/
|
||||
#define _serial_driver_data \
|
||||
_base_asynchronous_channel_data \
|
||||
/* Driver state.*/ \
|
||||
sdstate_t state; \
|
||||
/* Current configuration data.*/ \
|
||||
const SerialConfig *config; \
|
||||
/* Input queue.*/ \
|
||||
InputQueue iqueue; \
|
||||
/* Output queue.*/ \
|
||||
|
@ -143,7 +141,7 @@ extern SerialDriver SD2;
|
|||
extern "C" {
|
||||
#endif
|
||||
void sd_lld_init(void);
|
||||
void sd_lld_start(SerialDriver *sdp);
|
||||
void sd_lld_start(SerialDriver *sdp, const SerialConfig *config);
|
||||
void sd_lld_stop(SerialDriver *sdp);
|
||||
bool_t sd_lld_interrupt_pending(void);
|
||||
#ifdef __cplusplus
|
||||
|
|
Loading…
Reference in New Issue