aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/src
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/src')
-rw-r--r--os/hal/src/hal_ee24xx.c1
-rw-r--r--os/hal/src/hal_ee25xx.c1
-rw-r--r--os/hal/src/hal_opamp.c155
-rw-r--r--os/hal/src/hal_usb_hid.c10
-rw-r--r--os/hal/src/usbh/hal_usbh_aoa.c11
-rw-r--r--os/hal/src/usbh/hal_usbh_ftdi.c13
-rw-r--r--os/hal/src/usbh/hal_usbh_msd.c2
7 files changed, 187 insertions, 6 deletions
diff --git a/os/hal/src/hal_ee24xx.c b/os/hal/src/hal_ee24xx.c
index 725258c..1df1b9f 100644
--- a/os/hal/src/hal_ee24xx.c
+++ b/os/hal/src/hal_ee24xx.c
@@ -334,6 +334,7 @@ static size_t read(void *ip, uint8_t *bp, size_t n) {
}
static const struct EepromFileStreamVMT vmt = {
+ (size_t)0,
write,
read,
eepfs_put,
diff --git a/os/hal/src/hal_ee25xx.c b/os/hal/src/hal_ee25xx.c
index 8c35976..2849e66 100644
--- a/os/hal/src/hal_ee25xx.c
+++ b/os/hal/src/hal_ee25xx.c
@@ -383,6 +383,7 @@ static size_t read(void *ip, uint8_t *bp, size_t n) {
}
static const struct EepromFileStreamVMT vmt = {
+ (size_t)0,
write,
read,
eepfs_put,
diff --git a/os/hal/src/hal_opamp.c b/os/hal/src/hal_opamp.c
new file mode 100644
index 0000000..79a5ec8
--- /dev/null
+++ b/os/hal/src/hal_opamp.c
@@ -0,0 +1,155 @@
+/*
+ ChibiOS - Copyright (C) 2006..2019 Giovanni Di Sirio
+ Copyright (C) 2019 Fabien Poussin (fabien.poussin (at) google's mail)
+
+ 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 hal_opamp.c
+ * @brief OPAMP Driver code.
+ *
+ * @addtogroup OPAMP
+ * @{
+ */
+
+#include "hal_opamp.h"
+
+#if HAL_USE_OPAMP || defined(__DOXYGEN__)
+
+
+/*===========================================================================*/
+/* Driver local definitions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver exported variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver local variables and types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver local functions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver exported functions. */
+/*===========================================================================*/
+
+/**
+ * @brief OPAMP Driver initialization.
+ * @note This function is implicitly invoked by @p halInit(), there is
+ * no need to explicitly initialize the driver.
+ *
+ * @init
+ */
+void opampInit(void) {
+
+ opamp_lld_init();
+}
+
+/**
+ * @brief Initializes the standard part of a @p OPAMPDriver structure.
+ *
+ * @param[out] opampp pointer to the @p OPAMPDriver object
+ *
+ * @init
+ */
+void opampObjectInit(OPAMPDriver *opampp) {
+
+ opampp->state = OPAMP_STOP;
+ opampp->config = NULL;
+}
+
+/**
+ * @brief Configures and activates the OPAMP peripheral.
+ *
+ * @param[in] opampp pointer to the @p OPAMPDriver object
+ * @param[in] config pointer to the @p OPAMPConfig object
+ *
+ * @api
+ */
+void opampStart(OPAMPDriver *opampp, const OPAMPConfig *config) {
+
+ osalDbgCheck((opampp != NULL) && (config != NULL));
+
+ osalSysLock();
+ osalDbgAssert((opampp->state == OPAMP_STOP) || (opampp->state == OPAMP_ACTIVE),
+ "invalid state");
+ opampp->config = config;
+ opamp_lld_start(opampp);
+ opampp->state = OPAMP_ACTIVE;
+ osalSysUnlock();
+}
+
+/**
+ * @brief Deactivates the OPAMP peripheral.
+ *
+ * @param[in] opampp pointer to the @p OPAMPDriver object
+ *
+ * @api
+ */
+void opampStop(OPAMPDriver *opampp) {
+
+ osalDbgCheck(opampp != NULL);
+
+ osalSysLock();
+ osalDbgAssert((opampp->state == OPAMP_STOP) || (opampp->state == OPAMP_ACTIVE),
+ "invalid state");
+ opamp_lld_stop(opampp);
+ opampp->state = OPAMP_STOP;
+ osalSysUnlock();
+}
+
+/**
+ * @brief Activates the opamp.
+ *
+ * @param[in] opampp pointer to the @p OPAMPDriver object
+ *
+ * @api
+ */
+void opampEnable(OPAMPDriver *opampp) {
+
+ osalDbgCheck(opampp != NULL);
+
+ osalSysLock();
+ osalDbgAssert(opampp->state == OPAMP_ACTIVE, "invalid state");
+ opamp_lld_enable(opampp);
+ opampp->state = OPAMP_ACTIVE;
+ osalSysUnlock();
+}
+
+/**
+ * @brief Deactivates the opamp.
+ *
+ * @param[in] opampp pointer to the @p OPAMPDriver object
+ *
+ * @api
+ */
+void opampDisable(OPAMPDriver *opampp) {
+
+ osalDbgCheck(opampp != NULL);
+
+ osalSysLock();
+ osalDbgAssert((opampp->state == OPAMP_ACTIVE),
+ "invalid state");
+ opamp_lld_disable(opampp);
+ opampp->state = OPAMP_ACTIVE;
+ osalSysUnlock();
+}
+
+#endif /* HAL_USE_OPAMP */
+
+/** @} */
diff --git a/os/hal/src/hal_usb_hid.c b/os/hal/src/hal_usb_hid.c
index d9d671b..305fe8d 100644
--- a/os/hal/src/hal_usb_hid.c
+++ b/os/hal/src/hal_usb_hid.c
@@ -128,15 +128,23 @@ static size_t readt(void *ip, uint8_t *bp, size_t n, systime_t timeout) {
return ibqReadTimeout(&((USBHIDDriver *)ip)->ibqueue, bp, n, timeout);
}
+static msg_t ctl(void *ip, unsigned int operation, void *arg) {
+ (void)ip;
+ (void)operation;
+ (void)arg;
+ return MSG_OK;
+}
+
static void flush(void *ip) {
obqFlush(&((USBHIDDriver *)ip)->obqueue);
}
static const struct USBHIDDriverVMT vmt = {
+ (size_t)0,
write, read, put, get,
putt, gett, writet, readt,
- flush
+ ctl, flush
};
/**
diff --git a/os/hal/src/usbh/hal_usbh_aoa.c b/os/hal/src/usbh/hal_usbh_aoa.c
index bda93a2..4e1d65d 100644
--- a/os/hal/src/usbh/hal_usbh_aoa.c
+++ b/os/hal/src/usbh/hal_usbh_aoa.c
@@ -509,8 +509,15 @@ static size_t _read(USBHAOAChannel *aoacp, uint8_t *bp, size_t n) {
return _read_timeout(aoacp, bp, n, TIME_INFINITE);
}
+static msg_t _ctl(USBHAOAChannel *ftdipp, unsigned int operation, void *arg) {
+ (void)ftdipp;
+ (void)operation;
+ (void)arg;
+ return MSG_OK;
+}
+
static const struct AOADriverVMT async_channel_vmt = {
- (size_t) 0,
+ (size_t)0,
(size_t (*)(void *, const uint8_t *, size_t))_write,
(size_t (*)(void *, uint8_t *, size_t))_read,
(msg_t (*)(void *, uint8_t))_put,
@@ -519,7 +526,7 @@ static const struct AOADriverVMT async_channel_vmt = {
(msg_t (*)(void *, systime_t))_get_timeout,
(size_t (*)(void *, const uint8_t *, size_t, systime_t))_write_timeout,
(size_t (*)(void *, uint8_t *, size_t, systime_t))_read_timeout,
- (void*) 0 // FIXME: Implement CTL
+ (msg_t (*)(void *, unsigned int, void *))_ctl
};
static void _stop_channelS(USBHAOAChannel *aoacp) {
diff --git a/os/hal/src/usbh/hal_usbh_ftdi.c b/os/hal/src/usbh/hal_usbh_ftdi.c
index 070dbcf..b262256 100644
--- a/os/hal/src/usbh/hal_usbh_ftdi.c
+++ b/os/hal/src/usbh/hal_usbh_ftdi.c
@@ -601,6 +601,13 @@ static size_t _read(USBHFTDIPortDriver *ftdipp, uint8_t *bp, size_t n) {
return _read_timeout(ftdipp, bp, n, TIME_INFINITE);
}
+static msg_t _ctl(USBHFTDIPortDriver *ftdipp, unsigned int operation, void *arg) {
+ (void)ftdipp;
+ (void)operation;
+ (void)arg;
+ return MSG_OK;
+}
+
static void _vt(void *p) {
USBHFTDIPortDriver *const ftdipp = (USBHFTDIPortDriver *)p;
osalSysLockFromISR();
@@ -616,7 +623,7 @@ static void _vt(void *p) {
}
static const struct FTDIPortDriverVMT async_channel_vmt = {
- (size_t) 0,
+ (size_t)0,
(size_t (*)(void *, const uint8_t *, size_t))_write,
(size_t (*)(void *, uint8_t *, size_t))_read,
(msg_t (*)(void *, uint8_t))_put,
@@ -624,8 +631,8 @@ static const struct FTDIPortDriverVMT async_channel_vmt = {
(msg_t (*)(void *, uint8_t, systime_t))_put_timeout,
(msg_t (*)(void *, systime_t))_get_timeout,
(size_t (*)(void *, const uint8_t *, size_t, systime_t))_write_timeout,
- (size_t (*)(void *, uint8_t *, size_t, systime_t))_read_timeout,
- (void*) 0 // FIXME: Implement CTL
+ (size_t (*)(void *, uint8_t *, size_t, systime_t))_read_timeout,
+ (msg_t (*)(void *, unsigned int, void *))_ctl
};
diff --git a/os/hal/src/usbh/hal_usbh_msd.c b/os/hal/src/usbh/hal_usbh_msd.c
index fe97ff0..3d57934 100644
--- a/os/hal/src/usbh/hal_usbh_msd.c
+++ b/os/hal/src/usbh/hal_usbh_msd.c
@@ -516,6 +516,8 @@ static msd_result_t _scsi_perform_transaction(USBHMassStorageLUNDriver *lunp,
if (scsi_requestsense(lunp, &sense) == MSD_RESULT_OK) {
uwarnf("\tMSD: REQUEST SENSE: Sense key=%x, ASC=%02x, ASCQ=%02x",
sense.byte[2] & 0xf, sense.byte[12], sense.byte[13]);
+
+ return MSD_RESULT_OK;
}
}
return MSD_RESULT_FAILED;