aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-11-04 10:51:23 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-11-04 10:51:23 +0000
commit476270c2ab91169a8e731562b0e68b86602e0d77 (patch)
tree08407b10b44bea3e84b37b6796da967229c02571 /os/hal/ports
parent5626d9925ff6fafabac43ae65c38a290fd2c0db6 (diff)
downloadChibiOS-476270c2ab91169a8e731562b0e68b86602e0d77.tar.gz
ChibiOS-476270c2ab91169a8e731562b0e68b86602e0d77.tar.bz2
ChibiOS-476270c2ab91169a8e731562b0e68b86602e0d77.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7475 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports')
-rw-r--r--os/hal/ports/simulator/st_lld.c67
-rw-r--r--os/hal/ports/simulator/st_lld.h141
-rw-r--r--os/hal/ports/simulator/win32/hal_lld.c10
-rw-r--r--os/hal/ports/simulator/win32/platform.mk3
-rw-r--r--os/hal/ports/simulator/win32/serial_lld.c4
-rw-r--r--os/hal/ports/simulator/win32/serial_lld.h4
6 files changed, 219 insertions, 10 deletions
diff --git a/os/hal/ports/simulator/st_lld.c b/os/hal/ports/simulator/st_lld.c
new file mode 100644
index 000000000..d6768ddf9
--- /dev/null
+++ b/os/hal/ports/simulator/st_lld.c
@@ -0,0 +1,67 @@
+/*
+ ChibiOS/RT - Copyright (C) 2006-2014 Giovanni Di Sirio
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/**
+ * @file st_lld.c
+ * @brief PLATFORM ST subsystem low level driver source.
+ *
+ * @addtogroup ST
+ * @{
+ */
+
+#include "hal.h"
+
+#if (OSAL_ST_MODE != OSAL_ST_MODE_NONE) || defined(__DOXYGEN__)
+
+/*===========================================================================*/
+/* Driver local definitions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver exported variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver local types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver local variables and types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver local functions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver interrupt handlers. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver exported functions. */
+/*===========================================================================*/
+
+/**
+ * @brief Low level ST driver initialization.
+ *
+ * @notapi
+ */
+void st_lld_init(void) {
+}
+
+#endif /* OSAL_ST_MODE != OSAL_ST_MODE_NONE */
+
+/** @} */
diff --git a/os/hal/ports/simulator/st_lld.h b/os/hal/ports/simulator/st_lld.h
new file mode 100644
index 000000000..b5de30a6d
--- /dev/null
+++ b/os/hal/ports/simulator/st_lld.h
@@ -0,0 +1,141 @@
+/*
+ ChibiOS/RT - Copyright (C) 2006-2014 Giovanni Di Sirio
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/**
+ * @file st_lld.h
+ * @brief PLATFORM ST subsystem low level driver header.
+ * @details This header is designed to be include-able without having to
+ * include other files from the HAL.
+ *
+ * @addtogroup ST
+ * @{
+ */
+
+#ifndef _ST_LLD_H_
+#define _ST_LLD_H_
+
+/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver data structures and types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void st_lld_init(void);
+#ifdef __cplusplus
+}
+#endif
+
+/*===========================================================================*/
+/* Driver inline functions. */
+/*===========================================================================*/
+
+/**
+ * @brief Returns the time counter value.
+ *
+ * @return The counter value.
+ *
+ * @notapi
+ */
+static inline systime_t st_lld_get_counter(void) {
+
+ return (systime_t)0;
+}
+
+/**
+ * @brief Starts the alarm.
+ * @note Makes sure that no spurious alarms are triggered after
+ * this call.
+ *
+ * @param[in] time the time to be set for the first alarm
+ *
+ * @notapi
+ */
+static inline void st_lld_start_alarm(systime_t time) {
+
+ (void)time;
+}
+
+/**
+ * @brief Stops the alarm interrupt.
+ *
+ * @notapi
+ */
+static inline void st_lld_stop_alarm(void) {
+
+}
+
+/**
+ * @brief Sets the alarm time.
+ *
+ * @param[in] time the time to be set for the next alarm
+ *
+ * @notapi
+ */
+static inline void st_lld_set_alarm(systime_t time) {
+
+ (void)time;
+}
+
+/**
+ * @brief Returns the current alarm time.
+ *
+ * @return The currently set alarm time.
+ *
+ * @notapi
+ */
+static inline systime_t st_lld_get_alarm(void) {
+
+ return (systime_t)0;
+}
+
+/**
+ * @brief Determines if the alarm is active.
+ *
+ * @return The alarm status.
+ * @retval false if the alarm is not active.
+ * @retval true is the alarm is active
+ *
+ * @notapi
+ */
+static inline bool st_lld_is_alarm_active(void) {
+
+ return false;
+}
+
+#endif /* _ST_LLD_H_ */
+
+/** @} */
diff --git a/os/hal/ports/simulator/win32/hal_lld.c b/os/hal/ports/simulator/win32/hal_lld.c
index a42815c0c..555e749a0 100644
--- a/os/hal/ports/simulator/win32/hal_lld.c
+++ b/os/hal/ports/simulator/win32/hal_lld.c
@@ -64,7 +64,7 @@ void hal_lld_init(void) {
printf("QueryPerformanceFrequency() error");
exit(1);
}
- slice.QuadPart /= CH_FREQUENCY;
+ slice.QuadPart /= CH_CFG_ST_FREQUENCY;
QueryPerformanceCounter(&nextcnt);
nextcnt.QuadPart += slice.QuadPart;
@@ -79,10 +79,10 @@ void _sim_check_for_interrupts(void) {
#if HAL_USE_SERIAL
if (sd_lld_interrupt_pending()) {
- dbg_check_lock();
+ _dbg_check_lock();
if (chSchIsPreemptionRequired())
chSchDoReschedule();
- dbg_check_unlock();
+ _dbg_check_unlock();
return;
}
#endif
@@ -100,10 +100,10 @@ void _sim_check_for_interrupts(void) {
CH_IRQ_EPILOGUE();
- dbg_check_lock();
+ _dbg_check_lock();
if (chSchIsPreemptionRequired())
chSchDoReschedule();
- dbg_check_unlock();
+ _dbg_check_unlock();
}
}
diff --git a/os/hal/ports/simulator/win32/platform.mk b/os/hal/ports/simulator/win32/platform.mk
index 8136324e7..842309c62 100644
--- a/os/hal/ports/simulator/win32/platform.mk
+++ b/os/hal/ports/simulator/win32/platform.mk
@@ -1,7 +1,8 @@
# List of all the Win32 platform files.
PLATFORMSRC = ${CHIBIOS}/os/hal/ports/simulator/win32/hal_lld.c \
${CHIBIOS}/os/hal/ports/simulator/win32/serial_lld.c \
- ${CHIBIOS}/os/hal/ports/simulator/pal_lld.c
+ ${CHIBIOS}/os/hal/ports/simulator/pal_lld.c \
+ ${CHIBIOS}/os/hal/ports/simulator/st_lld.c
# Required include directories
PLATFORMINC = ${CHIBIOS}/os/hal/ports/simulator/win32 \
diff --git a/os/hal/ports/simulator/win32/serial_lld.c b/os/hal/ports/simulator/win32/serial_lld.c
index 7cf1e5b66..e33499f1f 100644
--- a/os/hal/ports/simulator/win32/serial_lld.c
+++ b/os/hal/ports/simulator/win32/serial_lld.c
@@ -133,7 +133,7 @@ static bool inint(SerialDriver *sdp) {
/*
* Input.
*/
- int n = recv(sdp->com_data, data, sizeof(data), 0);
+ int n = recv(sdp->com_data, (char *)data, sizeof(data), 0);
switch (n) {
case 0:
closesocket(sdp->com_data);
@@ -174,7 +174,7 @@ static bool outint(SerialDriver *sdp) {
if (n < 0)
return FALSE;
data[0] = (uint8_t)n;
- n = send(sdp->com_data, data, sizeof(data), 0);
+ n = send(sdp->com_data, (char *)data, sizeof(data), 0);
switch (n) {
case 0:
closesocket(sdp->com_data);
diff --git a/os/hal/ports/simulator/win32/serial_lld.h b/os/hal/ports/simulator/win32/serial_lld.h
index 22fb36b8f..ba49bd671 100644
--- a/os/hal/ports/simulator/win32/serial_lld.h
+++ b/os/hal/ports/simulator/win32/serial_lld.h
@@ -99,9 +99,9 @@ typedef struct {
/* Driver state.*/ \
sdstate_t state; \
/* Input queue.*/ \
- InputQueue iqueue; \
+ input_queue_t iqueue; \
/* Output queue.*/ \
- OutputQueue oqueue; \
+ output_queue_t oqueue; \
/* Input circular buffer.*/ \
uint8_t ib[SERIAL_BUFFERS_SIZE]; \
/* Output circular buffer.*/ \