ChibiOS/HAL 9.0.0
hal_serial_lld.c
Go to the documentation of this file.
1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17/**
18 * @file hal_serial_lld.c
19 * @brief PLATFORM serial subsystem low level driver source.
20 *
21 * @addtogroup SERIAL
22 * @{
23 */
24
25#include "hal.h"
26
27#if (HAL_USE_SERIAL == TRUE) || defined(__DOXYGEN__)
28
29/*===========================================================================*/
30/* Driver local definitions. */
31/*===========================================================================*/
32
33/*===========================================================================*/
34/* Driver exported variables. */
35/*===========================================================================*/
36
37/** @brief USART1 serial driver identifier.*/
38#if (PLATFORM_SERIAL_USE_USART1 == TRUE) || defined(__DOXYGEN__)
40#endif
41
42/*===========================================================================*/
43/* Driver local variables and types. */
44/*===========================================================================*/
45
46/**
47 * @brief Driver default configuration.
48 */
50 38400
51};
52
53/*===========================================================================*/
54/* Driver local functions. */
55/*===========================================================================*/
56
57/*===========================================================================*/
58/* Driver interrupt handlers. */
59/*===========================================================================*/
60
61/*===========================================================================*/
62/* Driver exported functions. */
63/*===========================================================================*/
64
65/**
66 * @brief Low level serial driver initialization.
67 *
68 * @notapi
69 */
70void sd_lld_init(void) {
71
72#if PLATFORM_SERIAL_USE_USART1 == TRUE
73 sdObjectInit(&SD1, NULL, notify1);
74#endif
75}
76
77/**
78 * @brief Low level serial driver configuration and (re)start.
79 *
80 * @param[in] sdp pointer to a @p SerialDriver object
81 * @param[in] config the architecture-dependent serial driver configuration.
82 * If this parameter is set to @p NULL then a default
83 * configuration is used.
84 *
85 * @notapi
86 */
87void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
88
89 if (config == NULL) {
90 config = &default_config;
91 }
92
93 if (sdp->state == SD_STOP) {
94#if PLATFORM_SERIAL_USE_USART1 == TRUE
95 if (&SD1 == sdp) {
96
97 }
98#endif
99 }
100 /* Configures the peripheral.*/
101 (void)config; /* Warning suppression, remove this.*/
102}
103
104/**
105 * @brief Low level serial driver stop.
106 * @details De-initializes the USART, stops the associated clock, resets the
107 * interrupt vector.
108 *
109 * @param[in] sdp pointer to a @p SerialDriver object
110 *
111 * @notapi
112 */
114
115 if (sdp->state == SD_READY) {
116#if PLATFORM_SERIAL_USE_USART1 == TRUE
117 if (&SD1 == sdp) {
118
119 }
120#endif
121 }
122}
123
124#endif /* HAL_USE_SERIAL == TRUE */
125
126/** @} */
SerialDriver SD1
USART1 serial driver identifier.
struct hal_serial_driver SerialDriver
Structure representing a serial driver.
Definition hal_serial.h:97
void sdObjectInit(SerialDriver *sdp, qnotify_t inotify, qnotify_t onotify)
Initializes a generic serial driver object.
Definition hal_serial.c:157
struct hal_serial_config SerialConfig
PLATFORM Serial Driver configuration structure.
void sd_lld_start(SerialDriver *sdp, const SerialConfig *config)
Low level serial driver configuration and (re)start.
void sd_lld_init(void)
Low level serial driver initialization.
static const SerialConfig default_config
Driver default configuration.
void sd_lld_stop(SerialDriver *sdp)
Low level serial driver stop.
@ SD_STOP
Definition hal_serial.h:90
@ SD_READY
Definition hal_serial.h:91
HAL subsystem header.