diff --git a/.cproject b/.cproject index 0fa556809..7fe2b9251 100644 --- a/.cproject +++ b/.cproject @@ -101,61 +101,6 @@ </infoList> </TargetConfig> - - - - rake.bat - - clean - true - false - true - - - rake.bat - - release - true - false - true - - - rake.bat - test:all - true - false - true - - - rake.bat - test:delta - true - false - true - - - rake.bat - clobber - true - false - true - - - rake.bat - verbosity[4] test:all - true - false - true - - - rake.bat - verbosity[4] test:delta - true - false - true - - - @@ -418,4 +363,120 @@ + + + + rake.bat + + clean + true + false + true + + + rake.bat + + clobber + true + false + true + + + rake.bat + + release + true + false + true + + + rake.bat + + test:all + true + false + true + + + rake.bat + + test:delta + true + false + true + + + rake.bat + + verbosity[4] test:all + true + false + true + + + rake.bat + + verbosity[4] test:delta + true + false + true + + + rake.bat + + clean + true + false + true + + + rake.bat + + clobber + true + false + true + + + rake.bat + + release + true + false + true + + + rake.bat + + test:all + true + false + true + + + rake.bat + + test:delta + true + false + true + + + rake.bat + + verbosity[4] test:all + true + false + true + + + rake.bat + + verbosity[4] test:delta + true + false + true + + + diff --git a/.travis.yml b/.travis.yml index abd1c37fb..ab8693369 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ language: c compiler: - gcc -script: cd tests/ && mkdir build && rake test:all \ No newline at end of file +script: cd tests/test && rake test:all && cd ../lpc175x_6x && rake test:all diff --git a/tests/lpc175x_6x/build/readme.md b/tests/lpc175x_6x/build/readme.md new file mode 100644 index 000000000..f525edb1e --- /dev/null +++ b/tests/lpc175x_6x/build/readme.md @@ -0,0 +1 @@ +just a build folder \ No newline at end of file diff --git a/tests/test/support/FreeRTOSConfig.h b/tests/support/FreeRTOSConfig.h similarity index 100% rename from tests/test/support/FreeRTOSConfig.h rename to tests/support/FreeRTOSConfig.h diff --git a/tests/test/support/LPC43xx.h b/tests/support/LPC43xx.h similarity index 100% rename from tests/test/support/LPC43xx.h rename to tests/support/LPC43xx.h diff --git a/tests/test/support/descriptor_test.c b/tests/support/descriptor_test.c similarity index 100% rename from tests/test/support/descriptor_test.c rename to tests/support/descriptor_test.c diff --git a/tests/test/support/descriptor_test.h b/tests/support/descriptor_test.h similarity index 100% rename from tests/test/support/descriptor_test.h rename to tests/support/descriptor_test.h diff --git a/tests/test/support/ehci_controller_fake.c b/tests/support/ehci_controller_fake.c similarity index 100% rename from tests/test/support/ehci_controller_fake.c rename to tests/support/ehci_controller_fake.c diff --git a/tests/test/support/ehci_controller_fake.h b/tests/support/ehci_controller_fake.h similarity index 100% rename from tests/test/support/ehci_controller_fake.h rename to tests/support/ehci_controller_fake.h diff --git a/tests/test/support/tusb_callback.h b/tests/support/tusb_callback.h similarity index 100% rename from tests/test/support/tusb_callback.h rename to tests/support/tusb_callback.h diff --git a/tests/test/support/tusb_config.h b/tests/support/tusb_config.h similarity index 100% rename from tests/test/support/tusb_config.h rename to tests/support/tusb_config.h diff --git a/tests/test/support/type_helper.h b/tests/support/type_helper.h similarity index 81% rename from tests/test/support/type_helper.h rename to tests/support/type_helper.h index f8d5090a0..d0712e4f0 100644 --- a/tests/test/support/type_helper.h +++ b/tests/support/type_helper.h @@ -69,6 +69,26 @@ #define TEST_ASSERT_STATUS( actual )\ TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, (actual) ) + +// log2_of a value is equivalent to its highest set bit's position +#define BITFIELD_OFFSET_OF_MEMBER(struct_type, member, bitfield_member) \ + ({\ + uint32_t value=0;\ + struct_type str;\ + memclr_((void*)&str, sizeof(struct_type));\ + str.member.bitfield_member = 1;\ + memcpy(&value, (void*)&str.member, sizeof(str.member));\ + log2_of( value );\ + }) + +#define BITFIELD_OFFSET_OF_UINT32(struct_type, offset, bitfield_member) \ + ({\ + struct_type str;\ + memclr_(&str, sizeof(struct_type));\ + str.bitfield_member = 1;\ + log2_of( ((uint32_t*) &str)[offset] );\ + }) + #ifdef __cplusplus } #endif diff --git a/tests/test/build/readme.md b/tests/test/build/readme.md new file mode 100644 index 000000000..f525edb1e --- /dev/null +++ b/tests/test/build/readme.md @@ -0,0 +1 @@ +just a build folder \ No newline at end of file diff --git a/tests/project.yml b/tests/test/project.yml similarity index 82% rename from tests/project.yml rename to tests/test/project.yml index 135280b98..5cf2c6104 100644 --- a/tests/project.yml +++ b/tests/test/project.yml @@ -26,17 +26,16 @@ :paths: :test: - +:test/** - - -:test/support :source: - - ../tinyusb/** - - +:../demos/bsp/lpc43xx/** - - +:../demos/device/keyboard/* - - -:../demos/ - - ../vendor/freertos/freertos/Source/* - - ../vendor/freertos/freertos/Source/portable/MSVC-MingW/* + - ../../tinyusb/** + - +:../../demos/bsp/lpc43xx/** + - +:../../demos/device/keyboard/* + - -:../../demos/ + - ../../vendor/freertos/freertos/Source/* + - ../../vendor/freertos/freertos/Source/portable/MSVC-MingW/* :support: - - test/support + - ../support :defines: # in order to add common defines: @@ -59,8 +58,8 @@ #:flags: # :test: # :compile: -# :hid_host: -# - -Dstatic= +# :dcd_lpc175x_6x.c: +# - -DMCU=MCU_LPC175X_6X # Ceedling defaults to using gcc for compiling, linking, etc. # As [:tools] is blank, gcc will be used (so long as it's in your system path) @@ -75,7 +74,6 @@ - :callback - :array #:ignore: :args_only -# :unity_helper_path: test/support/type_helper.h :treat_as: uint8: HEX8 uint16: HEX16 @@ -85,7 +83,7 @@ :plugins: :load_paths: - - vendor/ceedling/plugins + - ../vendor/ceedling/plugins :enabled: #- stdout_pretty_tests_report - stdout_ide_tests_report diff --git a/tests/rakefile.rb b/tests/test/rakefile.rb similarity index 66% rename from tests/rakefile.rb rename to tests/test/rakefile.rb index 563d2e0d3..6b217f931 100644 --- a/tests/rakefile.rb +++ b/tests/test/rakefile.rb @@ -1,4 +1,4 @@ -PROJECT_CEEDLING_ROOT = "vendor/ceedling" +PROJECT_CEEDLING_ROOT = "../vendor/ceedling" load "#{PROJECT_CEEDLING_ROOT}/lib/rakefile.rb" task :default => %w[ test:all release ] diff --git a/tests/test/device/usbd/test_usbd.c b/tests/test/test/device/usbd/test_usbd.c similarity index 100% rename from tests/test/device/usbd/test_usbd.c rename to tests/test/test/device/usbd/test_usbd.c diff --git a/tests/test/host/ehci/test_ehci_init.c b/tests/test/test/host/ehci/test_ehci_init.c similarity index 100% rename from tests/test/host/ehci/test_ehci_init.c rename to tests/test/test/host/ehci/test_ehci_init.c diff --git a/tests/test/host/ehci/test_ehci_isr.c b/tests/test/test/host/ehci/test_ehci_isr.c similarity index 100% rename from tests/test/host/ehci/test_ehci_isr.c rename to tests/test/test/host/ehci/test_ehci_isr.c diff --git a/tests/test/host/ehci/test_ehci_structure.c b/tests/test/test/host/ehci/test_ehci_structure.c similarity index 96% rename from tests/test/host/ehci/test_ehci_structure.c rename to tests/test/test/host/ehci/test_ehci_structure.c index 8298f102a..3ca2f3e45 100644 --- a/tests/test/host/ehci/test_ehci_structure.c +++ b/tests/test/test/host/ehci/test_ehci_structure.c @@ -41,6 +41,7 @@ #include "tusb_option.h" #include "errors.h" #include "binary.h" +#include "type_helper.h" #include "hal.h" #include "hcd.h" @@ -55,26 +56,6 @@ usbh_device_info_t usbh_devices[TUSB_CFG_HOST_DEVICE_MAX+1]; //--------------------------------------------------------------------+ // Setup/Teardown + helper declare //--------------------------------------------------------------------+ - -// log2_of a value is equivalent to its highest set bit's position -#define BITFIELD_OFFSET_OF_MEMBER(struct_type, member, bitfield_member) \ - ({\ - uint32_t value=0;\ - struct_type str;\ - memclr_((void*)&str, sizeof(struct_type));\ - str.member.bitfield_member = 1;\ - memcpy(&value, (void*)&str.member, sizeof(str.member));\ - log2_of( value );\ - }) - -#define BITFIELD_OFFSET_OF_UINT32(struct_type, offset, bitfield_member) \ - ({\ - struct_type str;\ - memclr_(&str, sizeof(struct_type));\ - str.bitfield_member = 1;\ - log2_of( ((uint32_t*) &str)[offset] );\ - }) - void setUp(void) { diff --git a/tests/test/host/ehci/test_ehci_usbh_hcd_integration.c b/tests/test/test/host/ehci/test_ehci_usbh_hcd_integration.c similarity index 100% rename from tests/test/host/ehci/test_ehci_usbh_hcd_integration.c rename to tests/test/test/host/ehci/test_ehci_usbh_hcd_integration.c diff --git a/tests/test/host/ehci/test_pipe_bulk_open.c b/tests/test/test/host/ehci/test_pipe_bulk_open.c similarity index 100% rename from tests/test/host/ehci/test_pipe_bulk_open.c rename to tests/test/test/host/ehci/test_pipe_bulk_open.c diff --git a/tests/test/host/ehci/test_pipe_bulk_xfer.c b/tests/test/test/host/ehci/test_pipe_bulk_xfer.c similarity index 100% rename from tests/test/host/ehci/test_pipe_bulk_xfer.c rename to tests/test/test/host/ehci/test_pipe_bulk_xfer.c diff --git a/tests/test/host/ehci/test_pipe_control_open.c b/tests/test/test/host/ehci/test_pipe_control_open.c similarity index 100% rename from tests/test/host/ehci/test_pipe_control_open.c rename to tests/test/test/host/ehci/test_pipe_control_open.c diff --git a/tests/test/host/ehci/test_pipe_control_xfer.c b/tests/test/test/host/ehci/test_pipe_control_xfer.c similarity index 100% rename from tests/test/host/ehci/test_pipe_control_xfer.c rename to tests/test/test/host/ehci/test_pipe_control_xfer.c diff --git a/tests/test/host/ehci/test_pipe_interrupt_open.c b/tests/test/test/host/ehci/test_pipe_interrupt_open.c similarity index 100% rename from tests/test/host/ehci/test_pipe_interrupt_open.c rename to tests/test/test/host/ehci/test_pipe_interrupt_open.c diff --git a/tests/test/host/ehci/test_pipe_interrupt_xfer.c b/tests/test/test/host/ehci/test_pipe_interrupt_xfer.c similarity index 100% rename from tests/test/host/ehci/test_pipe_interrupt_xfer.c rename to tests/test/test/host/ehci/test_pipe_interrupt_xfer.c diff --git a/tests/test/host/ehci/test_pipe_isochronous_open.c b/tests/test/test/host/ehci/test_pipe_isochronous_open.c similarity index 100% rename from tests/test/host/ehci/test_pipe_isochronous_open.c rename to tests/test/test/host/ehci/test_pipe_isochronous_open.c diff --git a/tests/test/host/hid/hidh_callback.h b/tests/test/test/host/hid/hidh_callback.h similarity index 100% rename from tests/test/host/hid/hidh_callback.h rename to tests/test/test/host/hid/hidh_callback.h diff --git a/tests/test/host/hid/test_hid_host.c b/tests/test/test/host/hid/test_hid_host.c similarity index 100% rename from tests/test/host/hid/test_hid_host.c rename to tests/test/test/host/hid/test_hid_host.c diff --git a/tests/test/host/hid/test_hidh_keyboard.c b/tests/test/test/host/hid/test_hidh_keyboard.c similarity index 100% rename from tests/test/host/hid/test_hidh_keyboard.c rename to tests/test/test/host/hid/test_hidh_keyboard.c diff --git a/tests/test/host/hid/test_hidh_mouse.c b/tests/test/test/host/hid/test_hidh_mouse.c similarity index 100% rename from tests/test/host/hid/test_hidh_mouse.c rename to tests/test/test/host/hid/test_hidh_mouse.c diff --git a/tests/test/host/host_helper.h b/tests/test/test/host/host_helper.h similarity index 100% rename from tests/test/host/host_helper.h rename to tests/test/test/host/host_helper.h diff --git a/tests/test/host/hub/test_hub.c b/tests/test/test/host/hub/test_hub.c similarity index 100% rename from tests/test/host/hub/test_hub.c rename to tests/test/test/host/hub/test_hub.c diff --git a/tests/test/host/integration/test_hidh_keyboard_integrate.c b/tests/test/test/host/integration/test_hidh_keyboard_integrate.c similarity index 100% rename from tests/test/host/integration/test_hidh_keyboard_integrate.c rename to tests/test/test/host/integration/test_hidh_keyboard_integrate.c diff --git a/tests/test/host/msc/test_msc_host.c b/tests/test/test/host/msc/test_msc_host.c similarity index 100% rename from tests/test/host/msc/test_msc_host.c rename to tests/test/test/host/msc/test_msc_host.c diff --git a/tests/test/host/usbh/test_enum_task.c b/tests/test/test/host/usbh/test_enum_task.c similarity index 100% rename from tests/test/host/usbh/test_enum_task.c rename to tests/test/test/host/usbh/test_enum_task.c diff --git a/tests/test/host/usbh/test_usbh.c b/tests/test/test/host/usbh/test_usbh.c similarity index 100% rename from tests/test/host/usbh/test_usbh.c rename to tests/test/test/host/usbh/test_usbh.c diff --git a/tests/test/test_assertion.c b/tests/test/test/test_assertion.c similarity index 100% rename from tests/test/test_assertion.c rename to tests/test/test/test_assertion.c diff --git a/tests/test/test_binary_const.c b/tests/test/test/test_binary_const.c similarity index 100% rename from tests/test/test_binary_const.c rename to tests/test/test/test_binary_const.c diff --git a/tests/test/test_fifo.c b/tests/test/test/test_fifo.c similarity index 100% rename from tests/test/test_fifo.c rename to tests/test/test/test_fifo.c diff --git a/tests/test/test_osal_freeRTOS.c b/tests/test/test/test_osal_freeRTOS.c similarity index 100% rename from tests/test/test_osal_freeRTOS.c rename to tests/test/test/test_osal_freeRTOS.c diff --git a/tests/test/test_osal_none.c b/tests/test/test/test_osal_none.c similarity index 100% rename from tests/test/test_osal_none.c rename to tests/test/test/test_osal_none.c diff --git a/tests/test/test_project_settings.c b/tests/test/test/test_project_settings.c similarity index 100% rename from tests/test/test_project_settings.c rename to tests/test/test/test_project_settings.c diff --git a/tinyusb/device/dcd_lpc175x_6x.c b/tinyusb/device/dcd_lpc175x_6x.c index 47b7a7043..88ecb1529 100644 --- a/tinyusb/device/dcd_lpc175x_6x.c +++ b/tinyusb/device/dcd_lpc175x_6x.c @@ -51,6 +51,7 @@ //--------------------------------------------------------------------+ // MACRO CONSTANT TYPEDEF //--------------------------------------------------------------------+ +STATIC_ dcd_dma_descriptor_t* dcd_udca[32] ATTR_ALIGNED(128) TUSB_CFG_ATTR_USBRAM; //--------------------------------------------------------------------+ // INTERNAL OBJECT & FUNCTION DECLARATION diff --git a/tinyusb/device/dcd_lpc175x_6x.h b/tinyusb/device/dcd_lpc175x_6x.h index e57bfcab1..9786746a5 100644 --- a/tinyusb/device/dcd_lpc175x_6x.h +++ b/tinyusb/device/dcd_lpc175x_6x.h @@ -46,11 +46,49 @@ #ifndef _TUSB_DCD_LPC175X_6X_H_ #define _TUSB_DCD_LPC175X_6X_H_ +#include "common/common.h" + #ifdef __cplusplus extern "C" { #endif +typedef struct +{ + //------------- Word 0 -------------// + uint32_t next; + + //------------- Word 1 -------------// + uint16_t mode : 2; // either normal or ATLE(auto length extraction) + uint16_t is_next_valid : 1; + uint16_t : 1; + uint16_t is_isochronous : 1; // is an iso endpoint + uint16_t max_packet_size : 11; + volatile uint16_t buffer_length; + + //------------- Word 2 -------------// + volatile uint8_t* buffer_start_addr; + + //------------- Word 3 -------------// + volatile uint16_t is_retired : 1; // initialized to zero + volatile uint16_t status : 4; + volatile uint16_t iso_last_packet_valid : 1; + volatile uint16_t atle_is_lsb_extracted : 1; // used in ATLE mode + volatile uint16_t atle_is_msb_extracted : 1; // used in ATLE mode + volatile uint16_t atle_message_length_position : 6; // used in ATLE mode + uint16_t : 2; + volatile uint16_t present_count; // The number of bytes transferred by the DMA engine. The DMA engine updates this field after completing each packet transfer. + + //------------- Word 4 -------------// +// uint32_t iso_packet_size_addr; // iso only, can be omitted for non-iso +} ATTR_ALIGNED(4) dcd_dma_descriptor_t; + +#define DCD_DD_NUM 10 // TODO scale with configure +typedef struct { + dcd_dma_descriptor_t dd[DCD_DD_NUM]; + +}dcd_data_t; + #ifdef __cplusplus } #endif