mirror of https://github.com/ARMmbed/mbed-os.git
M487: Support USBD
parent
0dbf34bf06
commit
b34fd309e3
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,40 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018-2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if defined(TARGET_M451)
|
||||
#define NUMBER_OF_LOGICAL_ENDPOINTS (8)
|
||||
#define NUMBER_OF_PHYSICAL_ENDPOINTS (NUMBER_OF_LOGICAL_ENDPOINTS)
|
||||
#elif defined (TARGET_M480)
|
||||
#if (MBED_CONF_TARGET_USB_DEVICE_HSUSBD == 0)
|
||||
#define NUMBER_OF_LOGICAL_ENDPOINTS (12)
|
||||
#define NUMBER_OF_PHYSICAL_ENDPOINTS (NUMBER_OF_LOGICAL_ENDPOINTS)
|
||||
#else
|
||||
#define NUMBER_OF_LOGICAL_ENDPOINTS (12)
|
||||
#define NUMBER_OF_PHYSICAL_ENDPOINTS (NUMBER_OF_LOGICAL_ENDPOINTS)
|
||||
#endif
|
||||
#elif defined (TARGET_M2351)
|
||||
#define NUMBER_OF_LOGICAL_ENDPOINTS (12)
|
||||
#define NUMBER_OF_PHYSICAL_ENDPOINTS (NUMBER_OF_LOGICAL_ENDPOINTS)
|
||||
#elif defined (TARGET_NANO100)
|
||||
#define NUMBER_OF_LOGICAL_ENDPOINTS (8)
|
||||
#define NUMBER_OF_PHYSICAL_ENDPOINTS (NUMBER_OF_LOGICAL_ENDPOINTS)
|
||||
#elif defined (TARGET_NUC472)
|
||||
#define NUMBER_OF_LOGICAL_ENDPOINTS (12)
|
||||
#define NUMBER_OF_PHYSICAL_ENDPOINTS (NUMBER_OF_LOGICAL_ENDPOINTS)
|
||||
#endif
|
||||
|
||||
#define ALLOW_ALL_EXCEPT_CRTL (USB_EP_ATTR_ALLOW_BULK | USB_EP_ATTR_ALLOW_INT | USB_EP_ATTR_ALLOW_ISO)
|
||||
#define ALLOW_NO_ENDPOINTS 0
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018-2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef USBPHYHW_H
|
||||
#define USBPHYHW_H
|
||||
|
||||
#include "mbed.h"
|
||||
#include "USBPhy.h"
|
||||
|
||||
|
||||
class USBPhyHw : public USBPhy {
|
||||
public:
|
||||
USBPhyHw();
|
||||
virtual ~USBPhyHw();
|
||||
virtual void init(USBPhyEvents *events);
|
||||
virtual void deinit();
|
||||
virtual bool powered();
|
||||
virtual void connect();
|
||||
virtual void disconnect();
|
||||
virtual void configure();
|
||||
virtual void unconfigure();
|
||||
virtual void sof_enable();
|
||||
virtual void sof_disable();
|
||||
virtual void set_address(uint8_t address);
|
||||
virtual void remote_wakeup();
|
||||
virtual const usb_ep_table_t *endpoint_table();
|
||||
|
||||
virtual uint32_t ep0_set_max_packet(uint32_t max_packet);
|
||||
virtual void ep0_setup_read_result(uint8_t *buffer, uint32_t size);
|
||||
virtual void ep0_read(uint8_t *data, uint32_t size);
|
||||
virtual uint32_t ep0_read_result();
|
||||
virtual void ep0_write(uint8_t *buffer, uint32_t size);
|
||||
virtual void ep0_stall();
|
||||
|
||||
virtual bool endpoint_add(usb_ep_t endpoint, uint32_t max_packet, usb_ep_type_t type);
|
||||
virtual void endpoint_remove(usb_ep_t endpoint);
|
||||
virtual void endpoint_stall(usb_ep_t endpoint);
|
||||
virtual void endpoint_unstall(usb_ep_t endpoint);
|
||||
|
||||
virtual bool endpoint_read(usb_ep_t endpoint, uint8_t *data, uint32_t size);
|
||||
virtual uint32_t endpoint_read_result(usb_ep_t endpoint);
|
||||
virtual bool endpoint_write(usb_ep_t endpoint, uint8_t *data, uint32_t size);
|
||||
virtual void endpoint_abort(usb_ep_t endpoint);
|
||||
|
||||
virtual void process();
|
||||
|
||||
private:
|
||||
USBPhyEvents *events;
|
||||
uint8_t *read_buffers[16];
|
||||
uint16_t read_sizes[16];
|
||||
|
||||
bool endpoint_read_core(usb_ep_t endpoint, uint32_t max_packet);
|
||||
bool endpoint_read_result_core(usb_ep_t endpoint, uint8_t *data, uint32_t size, uint32_t *bytesRead);
|
||||
|
||||
|
||||
static void _usbisr(void);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -8537,7 +8537,8 @@
|
|||
"EMAC",
|
||||
"MPU",
|
||||
"WATCHDOG",
|
||||
"RESET_REASON"
|
||||
"RESET_REASON",
|
||||
"USBDEVICE"
|
||||
],
|
||||
"release_versions": ["5"],
|
||||
"bootloader_supported": true,
|
||||
|
|
|
|||
Loading…
Reference in New Issue