mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
dcd_msp430x5xx: Setup packets are now received successfully (with delay).
This commit is contained in:
parent
d2e4af5a7b
commit
550e8215f3
@ -35,6 +35,8 @@
|
|||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
/* MACRO TYPEDEF CONSTANT ENUM
|
/* MACRO TYPEDEF CONSTANT ENUM
|
||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
|
#define USB_BUF_PTR(_x) (uint8_t *) ((uint16_t) _x)
|
||||||
|
|
||||||
// usbpllir_mirror and usbmaintl_mirror can be added later if needed.
|
// usbpllir_mirror and usbmaintl_mirror can be added later if needed.
|
||||||
static volatile uint16_t usbiepie_mirror = 0;
|
static volatile uint16_t usbiepie_mirror = 0;
|
||||||
static volatile uint16_t usboepie_mirror = 0;
|
static volatile uint16_t usboepie_mirror = 0;
|
||||||
@ -46,7 +48,19 @@ uint8_t _setup_packet[8];
|
|||||||
|
|
||||||
static void bus_reset(void)
|
static void bus_reset(void)
|
||||||
{
|
{
|
||||||
|
// Enable the control EP 0. Also enable Indication Enable- a guard flag
|
||||||
|
// separate from the Interrupt Enable mask.
|
||||||
|
USBOEPCNF_0 |= (UBME | USBIIE);
|
||||||
|
USBIEPCNF_0 |= (UBME | USBIIE);
|
||||||
|
|
||||||
|
// Enable interrupts for this endpoint.
|
||||||
|
USBOEPIE |= BIT0;
|
||||||
|
USBIEPIE |= BIT0;
|
||||||
|
|
||||||
|
// Clear NAK so packets can be received.
|
||||||
|
// Dedicated buffers in hardware for SETUP and EP0, no setup needed.
|
||||||
|
USBOEPCNT_0 &= ~NAK;
|
||||||
|
USBIEPCNT_0 &= ~NAK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -180,11 +194,28 @@ void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr)
|
|||||||
|
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
|
|
||||||
static void handle_setup_packet(void)
|
static void receive_packet(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void transmit_packet(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handle_setup_packet(void)
|
||||||
|
{
|
||||||
|
volatile uint8_t * setup_buf = &USBSUBLK;
|
||||||
|
|
||||||
|
for(int i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
_setup_packet[i] = setup_buf[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
dcd_event_setup_received(0, (uint8_t*) &_setup_packet[0], true);
|
||||||
|
}
|
||||||
|
|
||||||
void __attribute__ ((interrupt(USB_UBM_VECTOR))) USB_UBM_ISR(void)
|
void __attribute__ ((interrupt(USB_UBM_VECTOR))) USB_UBM_ISR(void)
|
||||||
{
|
{
|
||||||
// Setup is special- reading USBVECINT to handle setup packets is done to
|
// Setup is special- reading USBVECINT to handle setup packets is done to
|
||||||
@ -209,6 +240,14 @@ void __attribute__ ((interrupt(USB_UBM_VECTOR))) USB_UBM_ISR(void)
|
|||||||
case USBVECINT_SETUP_PACKET_RECEIVED:
|
case USBVECINT_SETUP_PACKET_RECEIVED:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case USBVECINT_INPUT_ENDPOINT0:
|
||||||
|
transmit_packet();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case USBVECINT_OUTPUT_ENDPOINT0:
|
||||||
|
receive_packet();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user