aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
authorDiego Ismirlian <dismirlian (at) google's mail.com>2017-10-29 17:52:54 -0300
committerDiego Ismirlian <dismirlian (at) google's mail.com>2017-10-29 17:52:54 -0300
commitf4cf7e5591c47b978d2141486fe7f98400c3c5bc (patch)
tree5deb523e6f9e4a605d629d35fb889be29b52be81 /os/hal
parentdecde2ca4c21220f6daab0880de08cd974dd62ef (diff)
parenta0089c14daa3c5c9ef6e0e30b26efaae2ccda128 (diff)
downloadChibiOS-Contrib-f4cf7e5591c47b978d2141486fe7f98400c3c5bc.tar.gz
ChibiOS-Contrib-f4cf7e5591c47b978d2141486fe7f98400c3c5bc.tar.bz2
ChibiOS-Contrib-f4cf7e5591c47b978d2141486fe7f98400c3c5bc.zip
Merge branch 'master' of https://github.com/ChibiOS/ChibiOS-Contrib
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/include/hal_usb_msd.h3
-rw-r--r--os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.c6
-rw-r--r--os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.h36
-rw-r--r--os/hal/src/hal_usb_msd.c22
4 files changed, 57 insertions, 10 deletions
diff --git a/os/hal/include/hal_usb_msd.h b/os/hal/include/hal_usb_msd.h
index fcc2cf2..0fe03e4 100644
--- a/os/hal/include/hal_usb_msd.h
+++ b/os/hal/include/hal_usb_msd.h
@@ -172,7 +172,8 @@ extern "C" {
void msdObjectInit(USBMassStorageDriver *msdp);
void msdStart(USBMassStorageDriver *msdp, USBDriver *usbp,
BaseBlockDevice *blkdev, uint8_t *blkbuf,
- const scsi_inquiry_response_t *scsi_inquiry_response);
+ const scsi_inquiry_response_t *scsi_inquiry_response,
+ const scsi_unit_serial_number_inquiry_response_t *serialInquiry);
void msdStop(USBMassStorageDriver *msdp);
bool msd_request_hook(USBDriver *usbp);
#ifdef __cplusplus
diff --git a/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.c b/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.c
index 98defed..126959f 100644
--- a/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.c
+++ b/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.c
@@ -359,6 +359,7 @@ void spi_lld_stop(SPIDriver *spip)
}
}
+#if (SPI_SELECT_MODE == SPI_SELECT_MODE_LLD) || defined(__DOXYGEN__)
/**
* @brief Asserts the slave select signal and prepares for transfers.
*
@@ -368,7 +369,7 @@ void spi_lld_stop(SPIDriver *spip)
*/
void spi_lld_select(SPIDriver *spip)
{
- palClearPad(spip->config->ssport, spip->config->sspad);
+ /* No implementation on Tiva.*/
}
/**
@@ -381,8 +382,9 @@ void spi_lld_select(SPIDriver *spip)
*/
void spi_lld_unselect(SPIDriver *spip)
{
- palSetPad(spip->config->ssport, spip->config->sspad);
+ /* No implementation on Tiva.*/
}
+#endif
/**
* @brief Ignores data on the SPI bus.
diff --git a/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.h b/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.h
index 64560eb..4dcf6db 100644
--- a/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.h
+++ b/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.h
@@ -165,6 +165,10 @@
#define TIVA_UDMA_REQUIRED
#endif
+#if SPI_SELECT_MODE == SPI_SELECT_MODE_LLD
+#error "SPI_SELECT_MODE_LLD not supported by this driver"
+#endif
+
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
@@ -189,16 +193,34 @@ typedef struct {
/**
* @brief Operation complete callback or @p NULL.
*/
- spicallback_t end_cb;
- /* End of the mandatory fields.*/
+ spicallback_t end_cb;
+#if (SPI_SELECT_MODE == SPI_SELECT_MODE_LINE) || defined(__DOXYGEN__)
+ /**
+ * @brief The chip select line.
+ */
+ ioline_t ssline;
+#endif
+#if (SPI_SELECT_MODE == SPI_SELECT_MODE_PORT) || defined(__DOXYGEN__)
+ /**
+ * @brief The chip select port.
+ */
+ ioportid_t ssport;
/**
- * @brief The chip select line port.
+ * @brief The chip select port mask.
*/
- ioportid_t ssport;
+ uint8fast_t ssmask;
+#endif
+#if (SPI_SELECT_MODE == SPI_SELECT_MODE_PAD) || defined(__DOXYGEN__)
/**
- * @brief The chip select line pad number.
+ * @brief The chip select port.
*/
- uint16_t sspad;
+ ioportid_t ssport;
+ /**
+ * @brief The chip select pad number.
+ */
+ uint_fast8_t sspad;
+#endif
+ /* End of the mandatory fields.*/
/**
* @brief SSI CR0 initialization data.
*/
@@ -289,8 +311,10 @@ extern "C" {
void spi_lld_init(void);
void spi_lld_start(SPIDriver *spip);
void spi_lld_stop(SPIDriver *spip);
+#if (SPI_SELECT_MODE == SPI_SELECT_MODE_LLD) || defined(__DOXYGEN__)
void spi_lld_select(SPIDriver *spip);
void spi_lld_unselect(SPIDriver *spip);
+#endif
void spi_lld_ignore(SPIDriver *spip, size_t n);
void spi_lld_exchange(SPIDriver *spip, size_t n,
const void *txbuf, void *rxbuf);
diff --git a/os/hal/src/hal_usb_msd.c b/os/hal/src/hal_usb_msd.c
index 6cc5386..564bad0 100644
--- a/os/hal/src/hal_usb_msd.c
+++ b/os/hal/src/hal_usb_msd.c
@@ -84,6 +84,19 @@ static const scsi_inquiry_response_t default_scsi_inquiry_response = {
{'v',CH_KERNEL_MAJOR+'0','.',CH_KERNEL_MINOR+'0'}
};
+/**
+ * @brief Hardcoded default SCSI unit serial number inquiry response structure.
+ */
+static const scsi_unit_serial_number_inquiry_response_t default_scsi_unit_serial_number_inquiry_response =
+{
+ 0x00,
+ 0x80,
+ 0x00,
+ 0x08,
+ "00000000"
+};
+
+
/*===========================================================================*/
/* Driver local functions. */
/*===========================================================================*/
@@ -373,7 +386,8 @@ void msdStop(USBMassStorageDriver *msdp) {
*/
void msdStart(USBMassStorageDriver *msdp, USBDriver *usbp,
BaseBlockDevice *blkdev, uint8_t *blkbuf,
- const scsi_inquiry_response_t *inquiry) {
+ const scsi_inquiry_response_t *inquiry,
+ const scsi_unit_serial_number_inquiry_response_t *serialInquiry) {
osalDbgCheck((msdp != NULL) && (usbp != NULL)
&& (blkdev != NULL) && (blkbuf != NULL));
@@ -393,6 +407,12 @@ void msdStart(USBMassStorageDriver *msdp, USBDriver *usbp,
else {
msdp->scsi_config.inquiry_response = inquiry;
}
+ if (NULL == serialInquiry) {
+ msdp->scsi_config.unit_serial_number_inquiry_response = &default_scsi_unit_serial_number_inquiry_response;
+ }
+ else {
+ msdp->scsi_config.unit_serial_number_inquiry_response = serialInquiry;
+ }
msdp->scsi_config.blkbuf = blkbuf;
msdp->scsi_config.blkdev = blkdev;
msdp->scsi_config.transport = &msdp->scsi_transport;