pull/1178/head
hjjeon0608 2015-06-11 09:59:34 +09:00
commit 5a4ce3c600
16 changed files with 68 additions and 48 deletions

View File

@ -149,7 +149,7 @@ public:
* @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
*/

View File

@ -123,7 +123,7 @@ public:
* @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(uint8_t *tx_buffer, int tx_length, uint8_t *rx_buffer, int rx_length, const event_callback_t& callback, int event = SPI_EVENT_COMPLETE) {
virtual int transfer(const 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);
}
@ -139,7 +139,7 @@ public:
* @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) {
virtual int transfer(const 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);
}
@ -155,7 +155,7 @@ public:
* @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) {
virtual int transfer(const 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);
}
@ -197,7 +197,7 @@ protected:
* @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);
/**
*
@ -212,7 +212,7 @@ protected:
* @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
*
@ -226,7 +226,7 @@ protected:
* @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

View File

@ -135,7 +135,7 @@ public:
* @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
*
@ -144,7 +144,7 @@ public:
* @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
*/
@ -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

View File

@ -16,7 +16,7 @@
#ifndef MBED_H
#define MBED_H
#define MBED_LIBRARY_VERSION 100
#define MBED_LIBRARY_VERSION 101
#include "platform.h"

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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
*

View File

@ -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;

View File

@ -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);

View File

@ -399,7 +399,7 @@ 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;
@ -407,7 +407,7 @@ void spi_buffer_set(spi_t *obj, void *tx, uint32_t tx_length, void *rx, uint32_t
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 +761,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 +822,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 +860,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 +882,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 +930,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;

View File

@ -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')),
)

View File

@ -231,6 +231,7 @@ if __name__ == '__main__':
_opts_mut_reset_type=opts.mut_reset_type,
_opts_jobs=opts.jobs,
_opts_waterfall_test=opts.waterfall_test,
_opts_consolidate_waterfall_test=opts.consolidate_waterfall_test,
_opts_extend_test_timeout=opts.extend_test_timeout)
# Runs test suite in CLI mode

View File

@ -179,6 +179,7 @@ class SingleTestRunner(object):
_opts_mut_reset_type=None,
_opts_jobs=None,
_opts_waterfall_test=None,
_opts_consolidate_waterfall_test=None,
_opts_extend_test_timeout=None):
""" Let's try hard to init this object
"""
@ -236,6 +237,7 @@ class SingleTestRunner(object):
self.opts_mut_reset_type = _opts_mut_reset_type
self.opts_jobs = _opts_jobs if _opts_jobs is not None else 1
self.opts_waterfall_test = _opts_waterfall_test
self.opts_consolidate_waterfall_test = _opts_consolidate_waterfall_test
self.opts_extend_test_timeout = _opts_extend_test_timeout
self.opts_clean = _clean
@ -485,18 +487,21 @@ class SingleTestRunner(object):
)
# Add detailed test result to test summary structure
if target not in self.test_summary_ext[toolchain][target]:
self.test_summary_ext[toolchain][target][test_id] = { 0: {
'single_test_result' : self.TEST_RESULT_BUILD_FAILED,
'single_test_output' : '',
'target_name' : target,
'toolchain_name' : toolchain,
'test_id' : test_id,
'test_description' : 'Toolchain build failed',
'elapsed_time' : 0,
'duration' : 0,
'copy_method' : None
}}
if test_id not in self.test_summary_ext[toolchain][target]:
self.test_summary_ext[toolchain][target][test_id] = []
self.test_summary_ext[toolchain][target][test_id].append({ 0: {
'single_test_result' : self.TEST_RESULT_BUILD_FAILED,
'single_test_output' : '',
'target_name' : target,
'target_name_unique': target,
'toolchain_name' : toolchain,
'test_id' : test_id,
'test_description' : 'Toolchain build failed',
'elapsed_time' : 0,
'duration' : 0,
'copy_method' : None
}})
continue
if self.opts_only_build_tests:
@ -537,7 +542,15 @@ class SingleTestRunner(object):
if target not in self.test_summary_ext[toolchain][target]:
if test_id not in self.test_summary_ext[toolchain][target]:
self.test_summary_ext[toolchain][target][test_id] = []
self.test_summary_ext[toolchain][target][test_id].append(detailed_test_results)
append_test_result = detailed_test_results
# If waterfall and consolidate-waterfall options are enabled,
# only include the last test result in the report.
if self.opts_waterfall_test and self.opts_consolidate_waterfall_test:
append_test_result = {0: detailed_test_results[len(detailed_test_results) - 1]}
self.test_summary_ext[toolchain][target][test_id].append(append_test_result)
test_suite_properties['skipped'] = ', '.join(test_suite_properties['skipped'])
self.test_suite_properties_ext[target][toolchain] = test_suite_properties
@ -1835,6 +1848,12 @@ def get_default_test_options_parser():
dest='test_global_loops_value',
help='Set global number of test loops per test. Default value is set 1')
parser.add_option('', '--consolidate-waterfall',
dest='consolidate_waterfall_test',
default=False,
action="store_true",
help='Used with --waterfall option. Adds only one test to report reflecting outcome of waterfall test.')
parser.add_option('-W', '--waterfall',
dest='waterfall_test',
default=False,