mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
repo cleanup
This commit is contained in:
parent
03582f74b8
commit
604275341e
@ -76,9 +76,9 @@ tusb_error_t hidh_interface_get_report(uint8_t dev_addr, void * report, hidh_int
|
|||||||
{
|
{
|
||||||
//------------- parameters validation -------------//
|
//------------- parameters validation -------------//
|
||||||
// TODO change to use is configured function
|
// 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_INT (TUSB_DEVICE_STATE_CONFIGURED, tuh_device_get_state(dev_addr), TUSB_ERROR_DEVICE_NOT_READY);
|
||||||
ASSERT_PTR (report, TUSB_ERROR_INVALID_PARA);
|
ASSERT_PTR (report, TUSB_ERROR_INVALID_PARA);
|
||||||
ASSERT_FALSE(hcd_pipe_is_busy(p_hid->pipe_hdl), TUSB_ERROR_INTERFACE_IS_BUSY);
|
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) ) ;
|
ASSERT_STATUS( hcd_pipe_xfer(p_hid->pipe_hdl, report, p_hid->report_size, true) ) ;
|
||||||
|
|
||||||
|
@ -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;
|
void const *p_buffer = NULL;
|
||||||
|
|
||||||
// TODO SCSI data out transfer is not yet supported
|
// 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);
|
p_csw->status = tud_msc_scsi_cb(rhport, p_cbw->lun, p_cbw->command, &p_buffer, &p_msc->data_len);
|
||||||
|
|
||||||
|
@ -49,10 +49,10 @@ extern "C"
|
|||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "tusb_option.h"
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.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
|
#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(...) ASSERT_TRUE(__VA_ARGS__)
|
||||||
#define ASSERT_TRUE(condition , error) ASSERT_DEFINE( , (condition), error, "%s", "evaluated to false")
|
#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(error) ASSERT_DEFINE( , false, error, "%s", "FAILED")
|
||||||
#define ASSERT_FAILED_MSG(error, msg) ASSERT_DEFINE( , false, error, "FAILED: %s", msg)
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// Pointer Assert
|
// Pointer Assert
|
||||||
@ -150,32 +148,6 @@ extern "C"
|
|||||||
#define ASSERT_HEX_EQUAL(...) ASSERT_XXX_EQUAL("0x%x", __VA_ARGS__)
|
#define ASSERT_HEX_EQUAL(...) ASSERT_XXX_EQUAL("0x%x", __VA_ARGS__)
|
||||||
#define ASSERT_HEX_WITHIN(...) ASSERT_XXX_WITHIN("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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "compiler/tusb_compiler.h"
|
#include "tusb_compiler.h"
|
||||||
|
|
||||||
//------------- Bit manipulation -------------//
|
//------------- Bit manipulation -------------//
|
||||||
#define BIT_(n) (1U << (n)) ///< n-th Bit
|
#define BIT_(n) (1U << (n)) ///< n-th Bit
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#ifndef _TUSB_TIMEOUT_TTIMER_H_
|
#ifndef _TUSB_TIMEOUT_TTIMER_H_
|
||||||
#define _TUSB_TIMEOUT_TTIMER_H_
|
#define _TUSB_TIMEOUT_TTIMER_H_
|
||||||
|
|
||||||
#include "compiler/tusb_compiler.h"
|
#include "tusb_compiler.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
#include "tusb_option.h"
|
#include "tusb_option.h"
|
||||||
|
|
||||||
//------------- General Header -------------//
|
//------------- General Header -------------//
|
||||||
#include "compiler/tusb_compiler.h"
|
#include "tusb_compiler.h"
|
||||||
#include "assertion.h"
|
#include "assertion.h"
|
||||||
#include "verify.h"
|
#include "verify.h"
|
||||||
#include "binary.h"
|
#include "binary.h"
|
||||||
|
@ -73,9 +73,9 @@
|
|||||||
|
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
#include "compiler_gcc.h"
|
#include "compiler/tusb_compiler_gcc.h"
|
||||||
#elif defined __ICCARM__
|
#elif defined __ICCARM__
|
||||||
#include "compiler_iar.h"
|
#include "compiler/tusb_compiler_iar.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _TUSB_COMPILER_H_ */
|
#endif /* _TUSB_COMPILER_H_ */
|
@ -43,9 +43,9 @@
|
|||||||
#ifndef _TUSB_TYPES_H_
|
#ifndef _TUSB_TYPES_H_
|
||||||
#define _TUSB_TYPES_H_
|
#define _TUSB_TYPES_H_
|
||||||
|
|
||||||
#include "compiler/tusb_compiler.h"
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include "tusb_compiler.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -36,10 +36,10 @@
|
|||||||
#ifndef VERIFY_H_
|
#ifndef VERIFY_H_
|
||||||
#define VERIFY_H_
|
#define VERIFY_H_
|
||||||
|
|
||||||
#include "tusb_option.h"
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "compiler/tusb_compiler.h"
|
#include "tusb_option.h"
|
||||||
|
#include "tusb_compiler.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user