repo cleanup

This commit is contained in:
hathach 2018-03-28 13:38:17 +07:00
parent 03582f74b8
commit 604275341e
11 changed files with 14 additions and 42 deletions

View File

@ -76,9 +76,9 @@ tusb_error_t hidh_interface_get_report(uint8_t dev_addr, void * report, hidh_int
{
//------------- parameters validation -------------//
// TODO change to use is configured function
ASSERT_INT (TUSB_DEVICE_STATE_CONFIGURED, tuh_device_get_state(dev_addr), TUSB_ERROR_DEVICE_NOT_READY);
ASSERT_PTR (report, TUSB_ERROR_INVALID_PARA);
ASSERT_FALSE(hcd_pipe_is_busy(p_hid->pipe_hdl), TUSB_ERROR_INTERFACE_IS_BUSY);
ASSERT_INT (TUSB_DEVICE_STATE_CONFIGURED, tuh_device_get_state(dev_addr), TUSB_ERROR_DEVICE_NOT_READY);
ASSERT_PTR (report, TUSB_ERROR_INVALID_PARA);
TU_ASSSERT (!hcd_pipe_is_busy(p_hid->pipe_hdl), TUSB_ERROR_INTERFACE_IS_BUSY);
ASSERT_STATUS( hcd_pipe_xfer(p_hid->pipe_hdl, report, p_hid->report_size, true) ) ;

View File

@ -203,7 +203,7 @@ tusb_error_t mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, tusb_event_t event, u
void const *p_buffer = NULL;
// TODO SCSI data out transfer is not yet supported
ASSERT_FALSE( p_cbw->xfer_bytes > 0 && !BIT_TEST_(p_cbw->dir, 7), TUSB_ERROR_NOT_SUPPORTED_YET);
TU_ASSERT( !(p_cbw->xfer_bytes > 0 && !BIT_TEST_(p_cbw->dir, 7)), TUSB_ERROR_NOT_SUPPORTED_YET);
p_csw->status = tud_msc_scsi_cb(rhport, p_cbw->lun, p_cbw->command, &p_buffer, &p_msc->data_len);

View File

@ -49,10 +49,10 @@ extern "C"
{
#endif
#include "tusb_option.h"
#include <stdbool.h>
#include <stdint.h>
#include "compiler/tusb_compiler.h"
#include "tusb_option.h"
#include "tusb_compiler.h"
#include "tusb_hal.h" // TODO find a way to break hal dependency
@ -108,9 +108,7 @@ extern "C"
//--------------------------------------------------------------------+
#define ASSERT(...) ASSERT_TRUE(__VA_ARGS__)
#define ASSERT_TRUE(condition , error) ASSERT_DEFINE( , (condition), error, "%s", "evaluated to false")
#define ASSERT_FALSE(condition , error) ASSERT_DEFINE( ,!(condition), error, "%s", "evaluated to true")
#define ASSERT_FAILED(error) ASSERT_DEFINE( , false, error, "%s", "FAILED")
#define ASSERT_FAILED_MSG(error, msg) ASSERT_DEFINE( , false, error, "FAILED: %s", msg)
//--------------------------------------------------------------------+
// Pointer Assert
@ -150,32 +148,6 @@ extern "C"
#define ASSERT_HEX_EQUAL(...) ASSERT_XXX_EQUAL("0x%x", __VA_ARGS__)
#define ASSERT_HEX_WITHIN(...) ASSERT_XXX_WITHIN("0x%x", __VA_ARGS__)
//--------------------------------------------------------------------+
// Bin Assert
//--------------------------------------------------------------------+
#define BIN8_PRINTF_PATTERN "%d%d%d%d%d%d%d%d"
#define BIN8_PRINTF_CONVERT(byte) \
((byte) & 0x80 ? 1 : 0), \
((byte) & 0x40 ? 1 : 0), \
((byte) & 0x20 ? 1 : 0), \
((byte) & 0x10 ? 1 : 0), \
((byte) & 0x08 ? 1 : 0), \
((byte) & 0x04 ? 1 : 0), \
((byte) & 0x02 ? 1 : 0), \
((byte) & 0x01 ? 1 : 0)
#define ASSERT_BIN8(...) ASSERT_BIN8_EQUAL(__VA_ARGS__)
#define ASSERT_BIN8_EQUAL(expected, actual, error)\
ASSERT_DEFINE(\
uint8_t exp = (expected); uint8_t act = (actual),\
exp==act,\
error,\
"expected " BIN8_PRINTF_PATTERN ", actual " BIN8_PRINTF_PATTERN, BIN8_PRINTF_CONVERT(exp), BIN8_PRINTF_CONVERT(act) )
//--------------------------------------------------------------------+
// TODO Bit Assert
//--------------------------------------------------------------------+
#ifdef __cplusplus
}

View File

@ -49,7 +49,7 @@
#include <stdbool.h>
#include <stdint.h>
#include "compiler/tusb_compiler.h"
#include "tusb_compiler.h"
//------------- Bit manipulation -------------//
#define BIT_(n) (1U << (n)) ///< n-th Bit

View File

@ -44,7 +44,7 @@
#ifndef _TUSB_TIMEOUT_TTIMER_H_
#define _TUSB_TIMEOUT_TTIMER_H_
#include "compiler/tusb_compiler.h"
#include "tusb_compiler.h"
#ifdef __cplusplus
extern "C" {

View File

@ -62,7 +62,7 @@
#include "tusb_option.h"
//------------- General Header -------------//
#include "compiler/tusb_compiler.h"
#include "tusb_compiler.h"
#include "assertion.h"
#include "verify.h"
#include "binary.h"

View File

@ -73,9 +73,9 @@
#if defined(__GNUC__)
#include "compiler_gcc.h"
#include "compiler/tusb_compiler_gcc.h"
#elif defined __ICCARM__
#include "compiler_iar.h"
#include "compiler/tusb_compiler_iar.h"
#endif
#endif /* _TUSB_COMPILER_H_ */

View File

@ -43,9 +43,9 @@
#ifndef _TUSB_TYPES_H_
#define _TUSB_TYPES_H_
#include "compiler/tusb_compiler.h"
#include <stdbool.h>
#include <stdint.h>
#include "tusb_compiler.h"
#ifdef __cplusplus
extern "C" {

View File

@ -36,10 +36,10 @@
#ifndef VERIFY_H_
#define VERIFY_H_
#include "tusb_option.h"
#include <stdbool.h>
#include <stdint.h>
#include "compiler/tusb_compiler.h"
#include "tusb_option.h"
#include "tusb_compiler.h"
#ifdef __cplusplus
extern "C" {