aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2017-11-05 07:45:14 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2017-11-05 07:45:14 +0000
commit66905f3fb2a92d770d643c4e70ef04e42477701b (patch)
tree4286e162f02bd6804b1dcb413a5e3d62c21f42a5 /os
parent5547e99922a8c44ac5d8ffd1e1a82793413630d3 (diff)
downloadChibiOS-66905f3fb2a92d770d643c4e70ef04e42477701b.tar.gz
ChibiOS-66905f3fb2a92d770d643c4e70ef04e42477701b.tar.bz2
ChibiOS-66905f3fb2a92d770d643c4e70ef04e42477701b.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10950 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/hal/ports/simulator/console.c12
-rw-r--r--os/hal/ports/simulator/hal_pal_lld.h75
2 files changed, 79 insertions, 8 deletions
diff --git a/os/hal/ports/simulator/console.c b/os/hal/ports/simulator/console.c
index c4ff21f9d..5dd193e16 100644
--- a/os/hal/ports/simulator/console.c
+++ b/os/hal/ports/simulator/console.c
@@ -113,9 +113,19 @@ static size_t _readt(void *ip, uint8_t *bp, size_t n, systime_t time) {
return fread(bp, 1, n, stdin);
}
+static msg_t _ctl(void *ip, unsigned int operation, void *arg) {
+
+ (void)ip;
+ (void)operation;
+ (void)arg;
+
+ return MSG_OK;
+}
+
static const struct BaseChannelVMT vmt = {
_write, _read, _put, _get,
- _putt, _gett, _writet, _readt
+ _putt, _gett, _writet, _readt,
+ _ctl
};
/*===========================================================================*/
diff --git a/os/hal/ports/simulator/hal_pal_lld.h b/os/hal/ports/simulator/hal_pal_lld.h
index 487cbbbdb..2051f67f9 100644
--- a/os/hal/ports/simulator/hal_pal_lld.h
+++ b/os/hal/ports/simulator/hal_pal_lld.h
@@ -16,16 +16,16 @@
/**
* @file hal_pal_lld.h
- * @brief Win32 simulator low level PAL driver header.
+ * @brief Simulator low level PAL driver header.
*
- * @addtogroup WIN32_PAL
+ * @addtogroup SIMULATOR_PAL
* @{
*/
#ifndef HAL_PAL_LLD_H
#define HAL_PAL_LLD_H
-#if HAL_USE_PAL || defined(__DOXYGEN__)
+#if (HAL_USE_PAL == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Unsupported modes and specific modes */
@@ -87,9 +87,40 @@ typedef struct {
/**
* @brief Whole port mask.
- * @brief This macro specifies all the valid bits into a port.
+ * @details This macro specifies all the valid bits into a port.
*/
-#define PAL_WHOLE_PORT ((ioportmask_t)0xFFFFFFFF)
+#define PAL_WHOLE_PORT ((ioportmask_t)0xFFFFFFFFU)
+/** @} */
+
+/**
+ * @name Line handling macros
+ * @{
+ */
+/**
+ * @brief Forms a line identifier.
+ * @details A port/pad pair are encoded into an @p ioline_t type. The encoding
+ * of this type is platform-dependent.
+ */
+#define PAL_LINE(port, pad) \
+ ((ioline_t)((uint32_t)(port)) | ((uint32_t)(pad)))
+
+/**
+ * @brief Decodes a port identifier from a line identifier.
+ */
+#define PAL_PORT(line) \
+ ((sim_vio_port_t *)(((uint32_t)(line)) & 0xFFFFFFF0U))
+
+/**
+ * @brief Decodes a pad identifier from a line identifier.
+ */
+#define PAL_PAD(line) \
+ ((uint32_t)((uint32_t)(line) & 0x0000000FU))
+
+/**
+ * @brief Value identifying an invalid line.
+ */
+#define PAL_NOLINE 0U
+/** @} */
/**
* @brief Digital I/O port sized unsigned type.
@@ -102,9 +133,19 @@ typedef uint32_t ioportmask_t;
typedef uint32_t iomode_t;
/**
+ * @brief Type of an I/O line.
+ */
+typedef uint32_t ioline_t;
+
+/**
* @brief Port Identifier.
*/
-typedef sim_vio_port_t *ioportid_t;
+typedef sim_vio_port_t * ioportid_t;
+
+/**
+ * @brief Type of an pad identifier.
+ */
+typedef uint32_t iopadid_t;
/*===========================================================================*/
/* I/O Ports Identifiers. */
@@ -172,6 +213,7 @@ typedef sim_vio_port_t *ioportid_t;
* @brief Pads group mode setup.
* @details This function programs a pads group belonging to the same port
* with the specified mode.
+ * @note Programming an unknown or unsupported mode is silently ignored.
*
* @param[in] port port identifier
* @param[in] mask group mask
@@ -183,6 +225,25 @@ typedef sim_vio_port_t *ioportid_t;
#define pal_lld_setgroupmode(port, mask, offset, mode) \
_pal_lld_setgroupmode(port, mask << offset, mode)
+/**
+ * @brief Returns a PAL event structure associated to a pad.
+ *
+ * @param[in] port port identifier
+ * @param[in] pad pad number within the port
+ *
+ * @notapi
+ */
+#define pal_lld_get_pad_event(port, pad) NULL; (void)(port); (void)pad
+
+/**
+ * @brief Returns a PAL event structure associated to a line.
+ *
+ * @param[in] line line identifier
+ *
+ * @notapi
+ */
+#define pal_lld_get_line_event(line) NULL; (void)line
+
#if !defined(__DOXYGEN__)
extern sim_vio_port_t vio_port_1;
extern sim_vio_port_t vio_port_2;
@@ -199,7 +260,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_PAL */
+#endif /* HAL_USE_PAL == TRUE */
#endif /* HAL_PAL_LLD_H */