diff options
| author | hathach <[email protected]> | 2019-05-15 18:21:41 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-05-15 18:21:41 +0700 |
| commit | c4b153925012e7c4fe28c745e5022820798a160d (patch) | |
| tree | 01c7d3ee839746922ddade2a372310c6fa055999 /src/class | |
| parent | 449a631a4a888146e8f68b6960f7fdb579fc5edf (diff) | |
| parent | 6e9324e29c3c2cc7ae36c0d7cbdb037e92ec9614 (diff) | |
Merge pull request #66 from hathach/develop
support makefile device example for all boards
Diffstat (limited to 'src/class')
| -rw-r--r-- | src/class/audio/audio.h | 2 | ||||
| -rw-r--r-- | src/class/cdc/cdc.h | 2 | ||||
| -rw-r--r-- | src/class/cdc/cdc_device.c | 6 | ||||
| -rw-r--r-- | src/class/cdc/cdc_device.h | 2 | ||||
| -rw-r--r-- | src/class/cdc/cdc_host.c | 2 | ||||
| -rw-r--r-- | src/class/cdc/cdc_host.h | 2 | ||||
| -rw-r--r-- | src/class/cdc/cdc_rndis.h | 2 | ||||
| -rw-r--r-- | src/class/cdc/cdc_rndis_host.c | 4 | ||||
| -rw-r--r-- | src/class/cdc/cdc_rndis_host.h | 2 | ||||
| -rw-r--r-- | src/class/custom/custom_device.c | 2 | ||||
| -rw-r--r-- | src/class/custom/custom_device.h | 2 | ||||
| -rw-r--r-- | src/class/custom/custom_host.c | 2 | ||||
| -rw-r--r-- | src/class/custom/custom_host.h | 2 | ||||
| -rw-r--r-- | src/class/hid/hid.h | 2 | ||||
| -rw-r--r-- | src/class/hid/hid_device.c | 2 | ||||
| -rw-r--r-- | src/class/hid/hid_device.h | 2 | ||||
| -rw-r--r-- | src/class/hid/hid_host.c | 4 | ||||
| -rw-r--r-- | src/class/hid/hid_host.h | 2 | ||||
| -rw-r--r-- | src/class/midi/midi.h | 2 | ||||
| -rw-r--r-- | src/class/midi/midi_device.c | 2 | ||||
| -rw-r--r-- | src/class/midi/midi_device.h | 2 | ||||
| -rw-r--r-- | src/class/msc/msc.h | 2 | ||||
| -rw-r--r-- | src/class/msc/msc_device.c | 19 | ||||
| -rw-r--r-- | src/class/msc/msc_device.h | 2 | ||||
| -rw-r--r-- | src/class/msc/msc_host.c | 14 | ||||
| -rw-r--r-- | src/class/msc/msc_host.h | 2 |
26 files changed, 45 insertions, 44 deletions
diff --git a/src/class/audio/audio.h b/src/class/audio/audio.h index 8ef9389a5..c655e79e2 100644 --- a/src/class/audio/audio.h +++ b/src/class/audio/audio.h @@ -1,7 +1,7 @@ /*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/cdc/cdc.h b/src/class/cdc/cdc.h index a764f15d2..200f6eaae 100644 --- a/src/class/cdc/cdc.h +++ b/src/class/cdc/cdc.h @@ -1,7 +1,7 @@ /*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/cdc/cdc_device.c b/src/class/cdc/cdc_device.c index 7a0380e6b..81ce2e432 100644 --- a/src/class/cdc/cdc_device.c +++ b/src/class/cdc/cdc_device.c @@ -1,7 +1,7 @@ /*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -99,7 +99,7 @@ static void _prep_out_transaction (uint8_t itf) bool tud_cdc_n_connected(uint8_t itf)
{
// DTR (bit 0) active is considered as connected
- return tud_ready() && TU_BIT_TEST(_cdcd_itf[itf].line_state, 0);
+ return tud_ready() && tu_bit_test(_cdcd_itf[itf].line_state, 0);
}
uint8_t tud_cdc_n_get_line_state (uint8_t itf)
@@ -358,7 +358,7 @@ bool cdcd_control_request(uint8_t rhport, tusb_control_request_t const * request usbd_control_status(rhport, request);
// Invoke callback
- if ( tud_cdc_line_state_cb) tud_cdc_line_state_cb(itf, TU_BIT_TEST(request->wValue, 0), TU_BIT_TEST(request->wValue, 1));
+ if ( tud_cdc_line_state_cb) tud_cdc_line_state_cb(itf, tu_bit_test(request->wValue, 0), tu_bit_test(request->wValue, 1));
break;
default: return false; // stall unsupported request
diff --git a/src/class/cdc/cdc_device.h b/src/class/cdc/cdc_device.h index 18d6f842f..44fd9215f 100644 --- a/src/class/cdc/cdc_device.h +++ b/src/class/cdc/cdc_device.h @@ -1,7 +1,7 @@ /*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/cdc/cdc_host.c b/src/class/cdc/cdc_host.c index 75c805152..b64d4a1fe 100644 --- a/src/class/cdc/cdc_host.c +++ b/src/class/cdc/cdc_host.c @@ -1,7 +1,7 @@ /*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/cdc/cdc_host.h b/src/class/cdc/cdc_host.h index 7a302eb0f..59ad2bfa8 100644 --- a/src/class/cdc/cdc_host.h +++ b/src/class/cdc/cdc_host.h @@ -1,7 +1,7 @@ /*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/cdc/cdc_rndis.h b/src/class/cdc/cdc_rndis.h index 70f76604b..e0f129fe3 100644 --- a/src/class/cdc/cdc_rndis.h +++ b/src/class/cdc/cdc_rndis.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/src/class/cdc/cdc_rndis_host.c b/src/class/cdc/cdc_rndis_host.c index 587e9ddc8..c604aef4a 100644 --- a/src/class/cdc/cdc_rndis_host.c +++ b/src/class/cdc/cdc_rndis_host.c @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -43,7 +43,7 @@ CFG_TUSB_MEM_SECTION static uint8_t msg_notification[CFG_TUSB_HOST_DEVICE_MAX][8]; CFG_TUSB_MEM_SECTION ATTR_ALIGNED(4) static uint8_t msg_payload[RNDIS_MSG_PAYLOAD_MAX]; -STATIC_VAR rndish_data_t rndish_data[CFG_TUSB_HOST_DEVICE_MAX]; +static rndish_data_t rndish_data[CFG_TUSB_HOST_DEVICE_MAX]; // TODO Microsoft requires message length for any get command must be at least 4096 bytes diff --git a/src/class/cdc/cdc_rndis_host.h b/src/class/cdc/cdc_rndis_host.h index 24becee07..170cb3b0e 100644 --- a/src/class/cdc/cdc_rndis_host.h +++ b/src/class/cdc/cdc_rndis_host.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/src/class/custom/custom_device.c b/src/class/custom/custom_device.c index 04921259f..18aea94cc 100644 --- a/src/class/custom/custom_device.c +++ b/src/class/custom/custom_device.c @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/src/class/custom/custom_device.h b/src/class/custom/custom_device.h index 704ecb23a..02cdba7e5 100644 --- a/src/class/custom/custom_device.h +++ b/src/class/custom/custom_device.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/src/class/custom/custom_host.c b/src/class/custom/custom_host.c index 488e26b20..a4f04af31 100644 --- a/src/class/custom/custom_host.c +++ b/src/class/custom/custom_host.c @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/src/class/custom/custom_host.h b/src/class/custom/custom_host.h index cf612a40b..2ca16222a 100644 --- a/src/class/custom/custom_host.h +++ b/src/class/custom/custom_host.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/src/class/hid/hid.h b/src/class/hid/hid.h index 7c702f4de..902c01ef5 100644 --- a/src/class/hid/hid.h +++ b/src/class/hid/hid.h @@ -1,7 +1,7 @@ /*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/hid/hid_device.c b/src/class/hid/hid_device.c index 1c971a606..9089ac6b5 100644 --- a/src/class/hid/hid_device.c +++ b/src/class/hid/hid_device.c @@ -1,7 +1,7 @@ /*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/hid/hid_device.h b/src/class/hid/hid_device.h index f838e6fad..be7999770 100644 --- a/src/class/hid/hid_device.h +++ b/src/class/hid/hid_device.h @@ -1,7 +1,7 @@ /*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/hid/hid_host.c b/src/class/hid/hid_host.c index 5aabbc01f..91a441af2 100644 --- a/src/class/hid/hid_host.c +++ b/src/class/hid/hid_host.c @@ -1,7 +1,7 @@ /*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -111,7 +111,7 @@ bool tuh_hid_keyboard_is_busy(uint8_t dev_addr) //--------------------------------------------------------------------+
#if CFG_TUH_HID_MOUSE
-STATIC_VAR hidh_interface_info_t mouseh_data[CFG_TUSB_HOST_DEVICE_MAX]; // does not have addr0, index = dev_address-1
+static hidh_interface_info_t mouseh_data[CFG_TUSB_HOST_DEVICE_MAX]; // does not have addr0, index = dev_address-1
//------------- Public API -------------//
bool tuh_hid_mouse_is_mounted(uint8_t dev_addr)
diff --git a/src/class/hid/hid_host.h b/src/class/hid/hid_host.h index 8fa974c92..50eabba3e 100644 --- a/src/class/hid/hid_host.h +++ b/src/class/hid/hid_host.h @@ -1,7 +1,7 @@ /*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/midi/midi.h b/src/class/midi/midi.h index 0c26c1889..ee318f788 100644 --- a/src/class/midi/midi.h +++ b/src/class/midi/midi.h @@ -1,7 +1,7 @@ /*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/midi/midi_device.c b/src/class/midi/midi_device.c index 5ba111a22..e834e0632 100644 --- a/src/class/midi/midi_device.c +++ b/src/class/midi/midi_device.c @@ -1,7 +1,7 @@ /*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/midi/midi_device.h b/src/class/midi/midi_device.h index a43514044..84f4c57bd 100644 --- a/src/class/midi/midi_device.h +++ b/src/class/midi/midi_device.h @@ -1,7 +1,7 @@ /*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/msc/msc.h b/src/class/msc/msc.h index bdf906b45..95fac6598 100644 --- a/src/class/msc/msc.h +++ b/src/class/msc/msc.h @@ -1,7 +1,7 @@ /*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/msc/msc_device.c b/src/class/msc/msc_device.c index c486d5e04..2fd3d44a1 100644 --- a/src/class/msc/msc_device.c +++ b/src/class/msc/msc_device.c @@ -1,7 +1,7 @@ /*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -80,7 +80,8 @@ static inline uint32_t rdwr10_get_lba(uint8_t const command[]) uint32_t lba;
memcpy(&lba, &p_rdwr10->lba, 4);
- return __be2n(lba);
+ // lba is in Big Endian format
+ return tu_ntohl(lba);
}
static inline uint16_t rdwr10_get_blockcount(uint8_t const command[])
@@ -92,7 +93,7 @@ static inline uint16_t rdwr10_get_blockcount(uint8_t const command[]) uint16_t block_count;
memcpy(&block_count, &p_rdwr10->block_count, 2);
- return __be2n_16(block_count);
+ return tu_ntohs(block_count);
}
//--------------------------------------------------------------------+
@@ -238,8 +239,8 @@ int32_t proc_builtin_scsi(uint8_t lun, uint8_t const scsi_cmd[16], uint8_t* buff {
scsi_read_capacity10_resp_t read_capa10;
- read_capa10.last_lba = ENDIAN_BE(block_count-1);
- read_capa10.block_size = ENDIAN_BE(block_size);
+ read_capa10.last_lba = tu_htonl(block_count-1);
+ read_capa10.block_size = tu_htonl(block_size);
resplen = sizeof(read_capa10);
memcpy(buffer, &read_capa10, resplen);
@@ -272,8 +273,8 @@ int32_t proc_builtin_scsi(uint8_t lun, uint8_t const scsi_cmd[16], uint8_t* buff if ( _mscd_itf.sense_key == 0 ) tud_msc_set_sense(lun, SCSI_SENSE_NOT_READY, 0x04, 0x00);
}else
{
- read_fmt_capa.block_num = ENDIAN_BE(block_count);
- read_fmt_capa.block_size_u16 = ENDIAN_BE16(block_size);
+ read_fmt_capa.block_num = tu_htonl(block_count);
+ read_fmt_capa.block_size_u16 = tu_htons(block_size);
resplen = sizeof(read_fmt_capa);
memcpy(buffer, &read_fmt_capa, resplen);
@@ -390,7 +391,7 @@ bool mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t // For other SCSI commands
// 1. OUT : queue transfer (invoke app callback after done)
// 2. IN & Zero: Process if is built-in, else Invoke app callback. Skip DATA if zero length
- if ( (p_cbw->total_bytes > 0 ) && !TU_BIT_TEST(p_cbw->dir, 7) )
+ if ( (p_cbw->total_bytes > 0 ) && !tu_bit_test(p_cbw->dir, 7) )
{
// queue transfer
TU_ASSERT( dcd_edpt_xfer(rhport, p_msc->ep_out, _mscd_buf, p_msc->total_len) );
@@ -439,7 +440,7 @@ bool mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t case MSC_STAGE_DATA:
// OUT transfer, invoke callback if needed
- if ( !TU_BIT_TEST(p_cbw->dir, 7) )
+ if ( !tu_bit_test(p_cbw->dir, 7) )
{
if ( SCSI_CMD_WRITE_10 != p_cbw->command[0] )
{
diff --git a/src/class/msc/msc_device.h b/src/class/msc/msc_device.h index 1baf2d19a..cf228dad9 100644 --- a/src/class/msc/msc_device.h +++ b/src/class/msc/msc_device.h @@ -1,7 +1,7 @@ /*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/msc/msc_host.c b/src/class/msc/msc_host.c index bb12c52d7..d2a1a00f7 100644 --- a/src/class/msc/msc_host.c +++ b/src/class/msc/msc_host.c @@ -1,7 +1,7 @@ /*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -232,8 +232,8 @@ tusb_error_t tuh_msc_read10(uint8_t dev_addr, uint8_t lun, void * p_buffer, uin scsi_read10_t cmd_read10 =
{
.cmd_code = SCSI_CMD_READ_10,
- .lba = __n2be(lba),
- .block_count = tu_u16_le2be(block_count)
+ .lba = tu_htonl(lba),
+ .block_count = tu_htons(block_count)
};
memcpy(p_msch->cbw.command, &cmd_read10, p_msch->cbw.cmd_len);
@@ -258,8 +258,8 @@ tusb_error_t tuh_msc_write10(uint8_t dev_addr, uint8_t lun, void const * p_buffe scsi_write10_t cmd_write10 =
{
.cmd_code = SCSI_CMD_WRITE_10,
- .lba = __n2be(lba),
- .block_count = tu_u16_le2be(block_count)
+ .lba = tu_htonl(lba),
+ .block_count = tu_htons(block_count)
};
memcpy(p_msch->cbw.command, &cmd_write10, p_msch->cbw.cmd_len);
@@ -372,8 +372,8 @@ bool msch_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *it TU_ASSERT(osal_semaphore_wait(msch_sem_hdl, SCSI_XFER_TIMEOUT));
}
- p_msc->last_lba = __be2n( ((scsi_read_capacity10_resp_t*)msch_buffer)->last_lba );
- p_msc->block_size = (uint16_t) __be2n( ((scsi_read_capacity10_resp_t*)msch_buffer)->block_size );
+ p_msc->last_lba = tu_ntohl( ((scsi_read_capacity10_resp_t*)msch_buffer)->last_lba );
+ p_msc->block_size = (uint16_t) tu_ntohl( ((scsi_read_capacity10_resp_t*)msch_buffer)->block_size );
p_msc->is_initialized = true;
diff --git a/src/class/msc/msc_host.h b/src/class/msc/msc_host.h index 1edce82c5..da817fbe2 100644 --- a/src/class/msc/msc_host.h +++ b/src/class/msc/msc_host.h @@ -1,7 +1,7 @@ /*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
|
