mirror of https://github.com/ARMmbed/mbed-os.git
Merge branch 'master' of https://github.com/mbedmicro/mbed
Conflicts: workspace_tools/targets.pypull/1170/head
commit
c4bf11cb6a
|
|
@ -668,8 +668,10 @@ void USBHAL::usbisr(void) {
|
|||
if (LPC_USB->DEVCMDSTAT & DSUS_C) {
|
||||
// Suspend status changed
|
||||
LPC_USB->DEVCMDSTAT = devCmdStat | DSUS_C;
|
||||
if((LPC_USB->DEVCMDSTAT & DSUS) != 0) {
|
||||
if (LPC_USB->DEVCMDSTAT & DSUS) {
|
||||
suspendStateChanged(1);
|
||||
} else {
|
||||
suspendStateChanged(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -677,8 +679,6 @@ void USBHAL::usbisr(void) {
|
|||
// Bus reset
|
||||
LPC_USB->DEVCMDSTAT = devCmdStat | DRES_C;
|
||||
|
||||
suspendStateChanged(0);
|
||||
|
||||
// Disable endpoints > 0
|
||||
disableEndpoints();
|
||||
|
||||
|
|
|
|||
|
|
@ -141,15 +141,15 @@ public:
|
|||
*
|
||||
* @param address 8/10 bit I2c slave address
|
||||
* @param tx_buffer The TX buffer with data to be transfered
|
||||
* @param tx_length The length of TX buffer
|
||||
* @param tx_length The length of TX buffer in bytes
|
||||
* @param rx_buffer The RX buffer which is used for received data
|
||||
* @param rx_length The length of RX buffer
|
||||
* @param rx_length The length of RX buffer in bytes
|
||||
* @param event The logical OR of events to modify
|
||||
* @param callback The event callback function
|
||||
* @param repeated Repeated start, true - do not send stop at end
|
||||
* @return Zero if the transfer has started, or -1 if I2C peripheral is busy
|
||||
*/
|
||||
int transfer(int address, char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, const event_callback_t& callback, int event = I2C_EVENT_TRANSFER_COMPLETE, bool repeated = false);
|
||||
int transfer(int address, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, const event_callback_t& callback, int event = I2C_EVENT_TRANSFER_COMPLETE, bool repeated = false);
|
||||
|
||||
/** Abort the on-going I2C transfer
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -115,48 +115,21 @@ public:
|
|||
*
|
||||
* @param tx_buffer The TX buffer with data to be transfered. If NULL is passed,
|
||||
* the default SPI value is sent
|
||||
* @param tx_length The length of TX buffer
|
||||
* @param tx_length The length of TX buffer in bytes
|
||||
* @param rx_buffer The RX buffer which is used for received data. If NULL is passed,
|
||||
* received data are ignored
|
||||
* @param rx_length The length of RX buffer
|
||||
* @param rx_length The length of RX buffer in bytes
|
||||
* @param callback The event callback function
|
||||
* @param event The logical OR of events to modify
|
||||
* @param event The logical OR of events to modify. Look at spi hal header file for SPI events.
|
||||
* @return Zero if the transfer has started, or -1 if SPI peripheral is busy
|
||||
*/
|
||||
virtual int transfer(uint8_t *tx_buffer, int tx_length, uint8_t *rx_buffer, int rx_length, const event_callback_t& callback, int event = SPI_EVENT_COMPLETE) {
|
||||
return transfer(tx_buffer, tx_length, rx_buffer, rx_length, 8, callback, event);
|
||||
}
|
||||
|
||||
/** Start non-blocking SPI transfer using 16bit buffers.
|
||||
*
|
||||
* @param tx_buffer The TX buffer with data to be transfered. If NULL is passed,
|
||||
* the default SPI value is sent
|
||||
* @param tx_length The length of TX buffer
|
||||
* @param rx_buffer The RX buffer which is used for received data. If NULL is passed,
|
||||
* received data are ignored
|
||||
* @param rx_length The length of RX buffer
|
||||
* @param callback The event callback function
|
||||
* @param event The logical OR of events to modify
|
||||
* @return Zero if the transfer has started, or -1 if SPI peripheral is busy
|
||||
*/
|
||||
virtual int transfer(uint16_t *tx_buffer, int tx_length, uint16_t *rx_buffer, int rx_length, const event_callback_t& callback, int event = SPI_EVENT_COMPLETE) {
|
||||
return transfer(tx_buffer, tx_length, rx_buffer, rx_length, 16, callback, event);
|
||||
}
|
||||
|
||||
/** Start non-blocking SPI transfer using 32bit buffers.
|
||||
*
|
||||
* @param tx_buffer The TX buffer with data to be transfered. If NULL is passed,
|
||||
* the default SPI value is sent
|
||||
* @param tx_length The length of TX buffer
|
||||
* @param rx_buffer The RX buffer which is used for received data. If NULL is passed,
|
||||
* received data are ignored
|
||||
* @param rx_length The length of RX buffer
|
||||
* @param callback The event callback function
|
||||
* @param event The logical OR of events to modify
|
||||
* @return Zero if the transfer has started, or -1 if SPI peripheral is busy
|
||||
*/
|
||||
virtual int transfer(uint32_t *tx_buffer, int tx_length, uint32_t *rx_buffer, int rx_length, const event_callback_t& callback, int event = SPI_EVENT_COMPLETE) {
|
||||
return transfer((void *)tx_buffer, tx_length, (void *)rx_buffer, rx_length, 32, callback, event);
|
||||
template<typename Type>
|
||||
int transfer(const Type *tx_buffer, int tx_length, Type *rx_buffer, int rx_length, const event_callback_t& callback, int event = SPI_EVENT_COMPLETE) {
|
||||
if (spi_active(&_spi)) {
|
||||
return queue_transfer(tx_buffer, tx_length, rx_buffer, rx_length, sizeof(Type)*8, callback, event);
|
||||
}
|
||||
start_transfer(tx_buffer, tx_length, rx_buffer, rx_length, sizeof(Type)*8, callback, event);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Abort the on-going SPI transfer, and continue with transfer's in the queue if any.
|
||||
|
|
@ -188,45 +161,45 @@ protected:
|
|||
*
|
||||
* @param tx_buffer The TX buffer with data to be transfered. If NULL is passed,
|
||||
* the default SPI value is sent
|
||||
* @param tx_length The length of TX buffer
|
||||
* @param tx_length The length of TX buffer in bytes
|
||||
* @param rx_buffer The RX buffer which is used for received data. If NULL is passed,
|
||||
* received data are ignored
|
||||
* @param rx_length The length of RX buffer
|
||||
* @param rx_length The length of RX buffer in bytes
|
||||
* @param bit_width The buffers element width
|
||||
* @param callback The event callback function
|
||||
* @param event The logical OR of events to modify
|
||||
* @return Zero if the transfer has started or was added to the queue, or -1 if SPI peripheral is busy/buffer is full
|
||||
*/
|
||||
int transfer(void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event);
|
||||
int transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tx_buffer The TX buffer with data to be transfered. If NULL is passed,
|
||||
* the default SPI value is sent
|
||||
* @param tx_length The length of TX buffer
|
||||
* @param tx_length The length of TX buffer in bytes
|
||||
* @param rx_buffer The RX buffer which is used for received data. If NULL is passed,
|
||||
* received data are ignored
|
||||
* @param rx_length The length of RX buffer
|
||||
* @param rx_length The length of RX buffer in bytes
|
||||
* @param bit_width The buffers element width
|
||||
* @param callback The event callback function
|
||||
* @param event The logical OR of events to modify
|
||||
* @return Zero if a transfer was added to the queue, or -1 if the queue is full
|
||||
*/
|
||||
int queue_transfer(void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event);
|
||||
int queue_transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event);
|
||||
|
||||
/** Configures a callback, spi peripheral and initiate a new transfer
|
||||
*
|
||||
* @param tx_buffer The TX buffer with data to be transfered. If NULL is passed,
|
||||
* the default SPI value is sent
|
||||
* @param tx_length The length of TX buffer
|
||||
* @param tx_length The length of TX buffer in bytes
|
||||
* @param rx_buffer The RX buffer which is used for received data. If NULL is passed,
|
||||
* received data are ignored
|
||||
* @param rx_length The length of RX buffer
|
||||
* @param rx_length The length of RX buffer in bytes
|
||||
* @param bit_width The buffers element width
|
||||
* @param callback The event callback function
|
||||
* @param event The logical OR of events to modify
|
||||
*/
|
||||
void start_transfer(void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event);
|
||||
void start_transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event);
|
||||
|
||||
#if TRANSACTION_QUEUE_SIZE_SPI
|
||||
|
||||
|
|
|
|||
|
|
@ -131,20 +131,20 @@ public:
|
|||
/** Begin asynchronous write using 8bit buffer. The completition invokes registered TX event callback
|
||||
*
|
||||
* @param buffer The buffer where received data will be stored
|
||||
* @param length The buffer length
|
||||
* @param length The buffer length in bytes
|
||||
* @param callback The event callback function
|
||||
* @param event The logical OR of TX events
|
||||
*/
|
||||
int write(uint8_t *buffer, int length, const event_callback_t& callback, int event = SERIAL_EVENT_TX_COMPLETE);
|
||||
int write(const uint8_t *buffer, int length, const event_callback_t& callback, int event = SERIAL_EVENT_TX_COMPLETE);
|
||||
|
||||
/** Begin asynchronous write using 16bit buffer. The completition invokes registered TX event callback
|
||||
*
|
||||
* @param buffer The buffer where received data will be stored
|
||||
* @param length The buffer length
|
||||
* @param length The buffer length in bytes
|
||||
* @param callback The event callback function
|
||||
* @param event The logical OR of TX events
|
||||
*/
|
||||
int write(uint16_t *buffer, int length, const event_callback_t& callback, int event = SERIAL_EVENT_TX_COMPLETE);
|
||||
int write(const uint16_t *buffer, int length, const event_callback_t& callback, int event = SERIAL_EVENT_TX_COMPLETE);
|
||||
|
||||
/** Abort the on-going write transfer
|
||||
*/
|
||||
|
|
@ -153,7 +153,7 @@ public:
|
|||
/** Begin asynchronous reading using 8bit buffer. The completition invokes registred RX event callback.
|
||||
*
|
||||
* @param buffer The buffer where received data will be stored
|
||||
* @param length The buffer length
|
||||
* @param length The buffer length in bytes
|
||||
* @param callback The event callback function
|
||||
* @param event The logical OR of RX events
|
||||
* @param char_match The matching character
|
||||
|
|
@ -163,7 +163,7 @@ public:
|
|||
/** Begin asynchronous reading using 16bit buffer. The completition invokes registred RX event callback.
|
||||
*
|
||||
* @param buffer The buffer where received data will be stored
|
||||
* @param length The buffer length
|
||||
* @param length The buffer length in bytes
|
||||
* @param callback The event callback function
|
||||
* @param event The logical OR of RX events
|
||||
* @param char_match The matching character
|
||||
|
|
@ -190,7 +190,7 @@ public:
|
|||
|
||||
protected:
|
||||
void start_read(void *buffer, int buffer_size, char buffer_width, const event_callback_t& callback, int event, unsigned char char_match);
|
||||
void start_write(void *buffer, int buffer_size, char buffer_width, const event_callback_t& callback, int event);
|
||||
void start_write(const void *buffer, int buffer_size, char buffer_width, const event_callback_t& callback, int event);
|
||||
void interrupt_handler_asynch(void);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#define MBED_TIMEREVENT_H
|
||||
|
||||
#include "ticker_api.h"
|
||||
#include "us_ticker_api.h"
|
||||
|
||||
namespace mbed {
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#ifndef MBED_H
|
||||
#define MBED_H
|
||||
|
||||
#define MBED_LIBRARY_VERSION 100
|
||||
#define MBED_LIBRARY_VERSION 101
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ void I2C::stop(void) {
|
|||
|
||||
#if DEVICE_I2C_ASYNCH
|
||||
|
||||
int I2C::transfer(int address, char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, const event_callback_t& callback, int event, bool repeated)
|
||||
int I2C::transfer(int address, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, const event_callback_t& callback, int event, bool repeated)
|
||||
{
|
||||
if (i2c_active(&_i2c)) {
|
||||
return -1; // transaction ongoing
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ int SPI::write(int value) {
|
|||
|
||||
#if DEVICE_SPI_ASYNCH
|
||||
|
||||
int SPI::transfer(void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event)
|
||||
int SPI::transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event)
|
||||
{
|
||||
if (spi_active(&_spi)) {
|
||||
return queue_transfer(tx_buffer, tx_length, rx_buffer, rx_length, bit_width, callback, event);
|
||||
|
|
@ -108,12 +108,12 @@ int SPI::set_dma_usage(DMAUsage usage)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int SPI::queue_transfer(void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event)
|
||||
int SPI::queue_transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event)
|
||||
{
|
||||
#if TRANSACTION_QUEUE_SIZE_SPI
|
||||
transaction_t t;
|
||||
|
||||
t.tx_buffer = tx_buffer;
|
||||
t.tx_buffer = const_cast<void *>(tx_buffer);
|
||||
t.tx_length = tx_length;
|
||||
t.rx_buffer = rx_buffer;
|
||||
t.rx_length = rx_length;
|
||||
|
|
@ -132,7 +132,7 @@ int SPI::queue_transfer(void *tx_buffer, int tx_length, void *rx_buffer, int rx_
|
|||
#endif
|
||||
}
|
||||
|
||||
void SPI::start_transfer(void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event)
|
||||
void SPI::start_transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event)
|
||||
{
|
||||
aquire();
|
||||
_callback = callback;
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ void SerialBase::set_flow_control(Flow type, PinName flow1, PinName flow2) {
|
|||
|
||||
#if DEVICE_SERIAL_ASYNCH
|
||||
|
||||
int SerialBase::write(uint8_t *buffer, int length, const event_callback_t& callback, int event)
|
||||
int SerialBase::write(const uint8_t *buffer, int length, const event_callback_t& callback, int event)
|
||||
{
|
||||
if (serial_tx_active(&_serial)) {
|
||||
return -1; // transaction ongoing
|
||||
|
|
@ -119,7 +119,7 @@ int SerialBase::write(uint8_t *buffer, int length, const event_callback_t& callb
|
|||
return 0;
|
||||
}
|
||||
|
||||
int SerialBase::write(uint16_t *buffer, int length, const event_callback_t& callback, int event)
|
||||
int SerialBase::write(const uint16_t *buffer, int length, const event_callback_t& callback, int event)
|
||||
{
|
||||
if (serial_tx_active(&_serial)) {
|
||||
return -1; // transaction ongoing
|
||||
|
|
@ -128,7 +128,7 @@ int SerialBase::write(uint16_t *buffer, int length, const event_callback_t& call
|
|||
return 0;
|
||||
}
|
||||
|
||||
void SerialBase::start_write(void *buffer, int buffer_size, char buffer_width, const event_callback_t& callback, int event)
|
||||
void SerialBase::start_write(const void *buffer, int buffer_size, char buffer_width, const event_callback_t& callback, int event)
|
||||
{
|
||||
_tx_callback = callback;
|
||||
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask);
|
|||
* @param handler The I2C IRQ handler to be set
|
||||
* @param hint DMA hint usage
|
||||
*/
|
||||
void i2c_transfer_asynch(i2c_t *obj, void *tx, size_t tx_length, void *rx, size_t rx_length, uint32_t address, uint32_t stop, uint32_t handler, uint32_t event, DMAUsage hint);
|
||||
void i2c_transfer_asynch(i2c_t *obj, const void *tx, size_t tx_length, void *rx, size_t rx_length, uint32_t address, uint32_t stop, uint32_t handler, uint32_t event, DMAUsage hint);
|
||||
|
||||
/** The asynchronous IRQ handler
|
||||
* @param obj The I2C object which holds the transfer information
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, Pi
|
|||
* @param hint A suggestion for how to use DMA with this transfer
|
||||
* @return Returns number of data transfered, or 0 otherwise
|
||||
*/
|
||||
int serial_tx_asynch(serial_t *obj, void *tx, size_t tx_length, uint8_t tx_width, uint32_t handler, uint32_t event, DMAUsage hint);
|
||||
int serial_tx_asynch(serial_t *obj, const void *tx, size_t tx_length, uint8_t tx_width, uint32_t handler, uint32_t event, DMAUsage hint);
|
||||
|
||||
/** Begin asynchronous RX transfer (enable interrupt for data collecting)
|
||||
* The used buffer is specified in the serial object - rx_buff
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ uint8_t spi_get_module(spi_t *obj);
|
|||
* @param[in] handler SPI interrupt handler
|
||||
* @param[in] hint A suggestion for how to use DMA with this transfer
|
||||
*/
|
||||
void spi_master_transfer(spi_t *obj, void *tx, size_t tx_length, void *rx, size_t rx_length, uint8_t bit_width, uint32_t handler, uint32_t event, DMAUsage hint);
|
||||
void spi_master_transfer(spi_t *obj, const void *tx, size_t tx_length, void *rx, size_t rx_length, uint8_t bit_width, uint32_t handler, uint32_t event, DMAUsage hint);
|
||||
|
||||
/** The asynchronous IRQ handler
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
/* mbed Microcontroller Library - stackheap
|
||||
* Copyright (C) 2009-2011 ARM Limited. All rights reserved.
|
||||
*
|
||||
* Setup a fixed single stack/heap memory model,
|
||||
* between the top of the RW/ZI region and the stackpointer
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
|
||||
extern void exit(int return_code);
|
||||
|
||||
int _kill(int pid, int sig) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void _exit(int status) {
|
||||
exit(status);
|
||||
}
|
||||
|
||||
int _getpid(void) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
@ -426,7 +426,7 @@ void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask)
|
|||
* @param handler The I2C IRQ handler to be set
|
||||
* @param hint DMA hint usage
|
||||
*/
|
||||
void i2c_transfer_asynch(i2c_t *obj, void *tx, size_t tx_length, void *rx, size_t rx_length, uint32_t address, uint32_t stop, uint32_t handler, uint32_t event, DMAUsage hint)
|
||||
void i2c_transfer_asynch(i2c_t *obj, const void *tx, size_t tx_length, void *rx, size_t rx_length, uint32_t address, uint32_t stop, uint32_t handler, uint32_t event, DMAUsage hint)
|
||||
{
|
||||
I2C_TransferReturn_TypeDef retval;
|
||||
if(i2c_active(obj)) return;
|
||||
|
|
@ -440,7 +440,7 @@ void i2c_transfer_asynch(i2c_t *obj, void *tx, size_t tx_length, void *rx, size_
|
|||
if((tx_length > 0) && (rx_length == 0)) {
|
||||
obj->i2c.xfer.flags = I2C_FLAG_WRITE;
|
||||
//Store buffer info
|
||||
obj->i2c.xfer.buf[0].data = tx;
|
||||
obj->i2c.xfer.buf[0].data = (void *)tx;
|
||||
obj->i2c.xfer.buf[0].len = (uint16_t) tx_length;
|
||||
} else if ((tx_length == 0) && (rx_length > 0)) {
|
||||
obj->i2c.xfer.flags = I2C_FLAG_READ;
|
||||
|
|
@ -450,7 +450,7 @@ void i2c_transfer_asynch(i2c_t *obj, void *tx, size_t tx_length, void *rx, size_
|
|||
} else if ((tx_length > 0) && (rx_length > 0)) {
|
||||
obj->i2c.xfer.flags = I2C_FLAG_WRITE_READ;
|
||||
//Store buffer info
|
||||
obj->i2c.xfer.buf[0].data = tx;
|
||||
obj->i2c.xfer.buf[0].data = (void *)tx;
|
||||
obj->i2c.xfer.buf[0].len = (uint16_t) tx_length;
|
||||
obj->i2c.xfer.buf[1].data = rx;
|
||||
obj->i2c.xfer.buf[1].len = (uint16_t) rx_length;
|
||||
|
|
|
|||
|
|
@ -1262,14 +1262,14 @@ void serial_set_char_match(serial_t *obj, uint8_t char_match)
|
|||
* @param hint A suggestion for how to use DMA with this transfer
|
||||
* @return Returns number of data transfered, or 0 otherwise
|
||||
*/
|
||||
int serial_tx_asynch(serial_t *obj, void *tx, size_t tx_length, uint8_t tx_width, uint32_t handler, uint32_t event, DMAUsage hint)
|
||||
int serial_tx_asynch(serial_t *obj, const void *tx, size_t tx_length, uint8_t tx_width, uint32_t handler, uint32_t event, DMAUsage hint)
|
||||
{
|
||||
// Check that a buffer has indeed been set up
|
||||
MBED_ASSERT(tx != (void*)0);
|
||||
if(tx_length == 0) return 0;
|
||||
|
||||
// Set up buffer
|
||||
serial_tx_buffer_set(obj, tx, tx_length, tx_width);
|
||||
serial_tx_buffer_set(obj, (void *)tx, tx_length, tx_width);
|
||||
|
||||
// Set up events
|
||||
serial_tx_enable_event(obj, SERIAL_EVENT_TX_ALL, false);
|
||||
|
|
|
|||
|
|
@ -399,15 +399,12 @@ uint8_t spi_active(spi_t *obj)
|
|||
}
|
||||
}
|
||||
|
||||
void spi_buffer_set(spi_t *obj, void *tx, uint32_t tx_length, void *rx, uint32_t rx_length, uint8_t bit_width)
|
||||
void spi_buffer_set(spi_t *obj, const void *tx, uint32_t tx_length, void *rx, uint32_t rx_length, uint8_t bit_width)
|
||||
{
|
||||
uint32_t i;
|
||||
uint16_t *tx_ptr = (uint16_t *) tx;
|
||||
|
||||
tx_length *= (bit_width >> 3);
|
||||
rx_length *= (bit_width >> 3);
|
||||
|
||||
obj->tx_buff.buffer = tx;
|
||||
obj->tx_buff.buffer = (void *)tx;
|
||||
obj->rx_buff.buffer = rx;
|
||||
obj->tx_buff.length = tx_length;
|
||||
obj->rx_buff.length = rx_length;
|
||||
|
|
@ -761,7 +758,7 @@ static void spi_master_dma_channel_setup(spi_t *obj, void* callback)
|
|||
* * tx_length: how many bytes will get sent.
|
||||
* * rx_length: how many bytes will get received. If > tx_length, TX will get padded with n lower bits of SPI_FILL_WORD.
|
||||
******************************************/
|
||||
static void spi_activate_dma(spi_t *obj, void* rxdata, void* txdata, int tx_length, int rx_length)
|
||||
static void spi_activate_dma(spi_t *obj, void* rxdata, const void* txdata, int tx_length, int rx_length)
|
||||
{
|
||||
/* DMA descriptors */
|
||||
DMA_CfgDescr_TypeDef rxDescrCfg;
|
||||
|
|
@ -822,7 +819,7 @@ static void spi_activate_dma(spi_t *obj, void* rxdata, void* txdata, int tx_leng
|
|||
true,
|
||||
false,
|
||||
(obj->spi.bits <= 8 ? (void *)&(obj->spi.spi->TXDATA) : (void *)&(obj->spi.spi->TXDOUBLE)), //When frame size > 9, point to TXDOUBLE
|
||||
(txdata == 0 ? &fill_word : txdata), // When there is nothing to transmit, point to static fill word
|
||||
(txdata == 0 ? &fill_word : (void *)txdata), // When there is nothing to transmit, point to static fill word
|
||||
(obj->spi.bits <= 8 ? tx_length - 1 : (tx_length / 2) - 1)); // When using TXDOUBLE, recalculate transfer length
|
||||
} else {
|
||||
/* Frame size == 9 */
|
||||
|
|
@ -860,7 +857,7 @@ static void spi_activate_dma(spi_t *obj, void* rxdata, void* txdata, int tx_leng
|
|||
true,
|
||||
false,
|
||||
(void *)&(obj->spi.spi->TXDATAX), //When frame size > 9, point to TXDOUBLE
|
||||
(txdata == 0 ? &fill_word : txdata), // When there is nothing to transmit, point to static fill word
|
||||
(txdata == 0 ? &fill_word : (void *)txdata), // When there is nothing to transmit, point to static fill word
|
||||
(tx_length / 2) - 1); // When using TXDOUBLE, recalculate transfer length
|
||||
}
|
||||
}
|
||||
|
|
@ -882,7 +879,7 @@ static void spi_activate_dma(spi_t *obj, void* rxdata, void* txdata, int tx_leng
|
|||
* If the previous transfer has kept the channel, that channel will continue to get used.
|
||||
*
|
||||
********************************************************************/
|
||||
void spi_master_transfer_dma(spi_t *obj, void *txdata, void *rxdata, int tx_length, int rx_length, void* cb, DMAUsage hint)
|
||||
void spi_master_transfer_dma(spi_t *obj, const void *txdata, void *rxdata, int tx_length, int rx_length, void* cb, DMAUsage hint)
|
||||
{
|
||||
/* Init DMA here to include it in the power figure */
|
||||
dma_init();
|
||||
|
|
@ -930,7 +927,7 @@ void spi_master_transfer_dma(spi_t *obj, void *txdata, void *rxdata, int tx_leng
|
|||
* @param[in] handler SPI interrupt handler
|
||||
* @param[in] hint A suggestion for how to use DMA with this transfer
|
||||
*/
|
||||
void spi_master_transfer(spi_t *obj, void *tx, size_t tx_length, void *rx, size_t rx_length, uint8_t bit_width, uint32_t handler, uint32_t event, DMAUsage hint)
|
||||
void spi_master_transfer(spi_t *obj, const void *tx, size_t tx_length, void *rx, size_t rx_length, uint8_t bit_width, uint32_t handler, uint32_t event, DMAUsage hint)
|
||||
{
|
||||
if( spi_active(obj) ) return;
|
||||
|
||||
|
|
@ -951,11 +948,6 @@ void spi_master_transfer(spi_t *obj, void *tx, size_t tx_length, void *rx, size_
|
|||
spi_enable_event(obj, SPI_EVENT_ALL, false);
|
||||
spi_enable_event(obj, event, true);
|
||||
|
||||
/* Be tricky on how we handle increased bit widths in the buffer... Handling on byte-basis */
|
||||
// div 8 = shift right 3
|
||||
tx_length = tx_length * (bit_width >> 3);
|
||||
rx_length = rx_length * (bit_width >> 3);
|
||||
|
||||
// Set the sleep mode
|
||||
blockSleepMode(SPI_LEAST_ACTIVE_SLEEPMODE);
|
||||
|
||||
|
|
|
|||
|
|
@ -540,7 +540,7 @@ static void packet_rx(void* pvParameters) {
|
|||
/* Wait for receive task to wakeup */
|
||||
sys_arch_sem_wait(&k64f_enet->RxReadySem, 0);
|
||||
|
||||
if ((bdPtr[idx].control & kEnetRxBdEmpty) == 0) {
|
||||
while ((bdPtr[idx].control & kEnetRxBdEmpty) == 0) {
|
||||
k64f_enetif_input(k64f_enet->netif, idx);
|
||||
idx = (idx + 1) % ENET_RX_RING_LEN;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ OFFICIAL_MBED_LIBRARY_BUILD = (
|
|||
('MAXWSNENV', ('ARM', 'GCC_ARM', 'IAR')),
|
||||
('MAX32600MBED', ('ARM', 'GCC_ARM', 'IAR')),
|
||||
|
||||
('WIZwiki_W7500', ('ARM', 'uARM')),
|
||||
('WIZWIKI_W7500', ('ARM', 'uARM')),
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1273,7 +1273,7 @@ class EFM32HG_STK3400(Target):
|
|||
|
||||
##WIZnet
|
||||
|
||||
class WIZwiki_W7500(Target):
|
||||
class WIZWIKI_W7500(Target):
|
||||
def __init__(self):
|
||||
Target.__init__(self)
|
||||
self.core = "Cortex-M0"
|
||||
|
|
@ -1409,7 +1409,7 @@ TARGETS = [
|
|||
EFM32HG_STK3400(),
|
||||
|
||||
### WIZnet ###
|
||||
WIZwiki_W7500(),
|
||||
WIZWIKI_W7500(),
|
||||
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue