mirror of https://github.com/ARMmbed/mbed-os.git
[RZ/A1H] * Some fields for RZ/A1H changed as "private". * Some function moved into USBHAL_RZA1H.cpp. * Interrupts registration routine returned to the original sample code.
parent
9a8a75e827
commit
d517c2863b
|
@ -1869,33 +1869,35 @@ uint16_t usb0_function_get_inbuf (uint16_t pipe)
|
||||||
* Arguments : uint8_t level ;interrupt level
|
* Arguments : uint8_t level ;interrupt level
|
||||||
* Return Value : none
|
* Return Value : none
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
#if 0
|
||||||
void usb0_function_setting_interrupt (uint8_t level)
|
void usb0_function_setting_interrupt (uint8_t level)
|
||||||
{
|
{
|
||||||
IRQn_Type d0fifo_dmaintid;
|
uint16_t d0fifo_dmaintid;
|
||||||
IRQn_Type d1fifo_dmaintid;
|
uint16_t d1fifo_dmaintid;
|
||||||
|
|
||||||
InterruptHandlerRegister(USBI0_IRQn, usb0_function_interrupt);
|
R_INTC_RegistIntFunc(INTC_ID_USBI0, usb0_function_interrupt);
|
||||||
GIC_SetPriority(USBI0_IRQn, level);
|
R_INTC_SetPriority(INTC_ID_USBI0, level);
|
||||||
GIC_EnableIRQ(USBI0_IRQn);
|
R_INTC_Enable(INTC_ID_USBI0);
|
||||||
|
|
||||||
d0fifo_dmaintid = Userdef_USB_usb0_function_d0fifo_dmaintid();
|
d0fifo_dmaintid = Userdef_USB_usb0_function_d0fifo_dmaintid();
|
||||||
|
|
||||||
if (d0fifo_dmaintid != 0xFFFF)
|
if (d0fifo_dmaintid != 0xFFFF)
|
||||||
{
|
{
|
||||||
InterruptHandlerRegister(d0fifo_dmaintid, usb0_function_dma_interrupt_d0fifo);
|
R_INTC_RegistIntFunc(d0fifo_dmaintid, usb0_function_dma_interrupt_d0fifo);
|
||||||
GIC_SetPriority(d0fifo_dmaintid, level);
|
R_INTC_SetPriority(d0fifo_dmaintid, level);
|
||||||
GIC_EnableIRQ(d0fifo_dmaintid);
|
R_INTC_Enable(d0fifo_dmaintid);
|
||||||
}
|
}
|
||||||
|
|
||||||
d1fifo_dmaintid = Userdef_USB_usb0_function_d1fifo_dmaintid();
|
d1fifo_dmaintid = Userdef_USB_usb0_function_d1fifo_dmaintid();
|
||||||
|
|
||||||
if (d1fifo_dmaintid != 0xFFFF)
|
if (d1fifo_dmaintid != 0xFFFF)
|
||||||
{
|
{
|
||||||
InterruptHandlerRegister(d1fifo_dmaintid, usb0_function_dma_interrupt_d1fifo);
|
R_INTC_RegistIntFunc(d1fifo_dmaintid, usb0_function_dma_interrupt_d1fifo);
|
||||||
GIC_SetPriority(d1fifo_dmaintid, level);
|
R_INTC_SetPriority(d1fifo_dmaintid, level);
|
||||||
GIC_EnableIRQ(d1fifo_dmaintid);
|
R_INTC_Enable(d1fifo_dmaintid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Function Name: usb0_function_reset_module
|
* Function Name: usb0_function_reset_module
|
||||||
|
|
|
@ -77,6 +77,7 @@ Private global variables and functions
|
||||||
* : ; 12MHz ; USBFCLOCK_EXTAL_12MHZ
|
* : ; 12MHz ; USBFCLOCK_EXTAL_12MHZ
|
||||||
* Return Value : none
|
* Return Value : none
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
#if 0
|
||||||
void usb0_api_function_init (uint8_t int_level, uint16_t mode, uint16_t clockmode)
|
void usb0_api_function_init (uint8_t int_level, uint16_t mode, uint16_t clockmode)
|
||||||
{
|
{
|
||||||
volatile uint8_t dummy_buf;
|
volatile uint8_t dummy_buf;
|
||||||
|
@ -94,6 +95,7 @@ void usb0_api_function_init (uint8_t int_level, uint16_t mode, uint16_t clockmod
|
||||||
usb0_function_InitModule(mode); /* select USB Function and Interrupt Enable */
|
usb0_function_InitModule(mode); /* select USB Function and Interrupt Enable */
|
||||||
/* Detect USB Device to attach or detach */
|
/* Detect USB Device to attach or detach */
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Function Name: usb0_api_function_IsConfigured
|
* Function Name: usb0_api_function_IsConfigured
|
||||||
|
|
|
@ -67,11 +67,6 @@ public:
|
||||||
bool getEndpointStallState(unsigned char endpoint);
|
bool getEndpointStallState(unsigned char endpoint);
|
||||||
uint32_t endpointReadcore(uint8_t endpoint, uint8_t *buffer);
|
uint32_t endpointReadcore(uint8_t endpoint, uint8_t *buffer);
|
||||||
|
|
||||||
#if defined(TARGET_RZ_A1H)
|
|
||||||
static USBHAL * instance;
|
|
||||||
static void _usbisr(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TARGET_RZ_A1H
|
#ifdef TARGET_RZ_A1H
|
||||||
uint32_t EP2PIPE(uint8_t endpoint);
|
uint32_t EP2PIPE(uint8_t endpoint);
|
||||||
void usb0_function_save_request(void);
|
void usb0_function_save_request(void);
|
||||||
|
@ -126,10 +121,8 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void usbisr(void);
|
void usbisr(void);
|
||||||
#if !defined(TARGET_RZ_A1H)
|
|
||||||
static void _usbisr(void);
|
static void _usbisr(void);
|
||||||
static USBHAL * instance;
|
static USBHAL * instance;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TARGET_RZ_A1H
|
#ifdef TARGET_RZ_A1H
|
||||||
IRQn_Type int_id; /* interrupt ID */
|
IRQn_Type int_id; /* interrupt ID */
|
||||||
|
|
|
@ -30,6 +30,7 @@ extern "C"
|
||||||
#include "iodefine.h"
|
#include "iodefine.h"
|
||||||
}
|
}
|
||||||
#include "USBHAL.h"
|
#include "USBHAL.h"
|
||||||
|
#include "usb0_function.h"
|
||||||
//#include "USBRegs_RZ_A1H.h"
|
//#include "USBRegs_RZ_A1H.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,15 +145,6 @@ static uint8_t recv_buffer[MAX_PACKET_SIZE_EPBULK];
|
||||||
volatile static uint16_t recv_error;
|
volatile static uint16_t recv_error;
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
void usb0_function_interrupt(uint32_t int_sense)
|
|
||||||
{
|
|
||||||
USBHAL::instance->_usbisr();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*EP2PIPE converter is for pipe1, pipe3 and pipe6 only.*/
|
/*EP2PIPE converter is for pipe1, pipe3 and pipe6 only.*/
|
||||||
|
@ -178,12 +170,6 @@ USBHAL::USBHAL(void)
|
||||||
/* ---- P4_1 : P4_1 (USB0_EN for GR-PEACH) ---- */
|
/* ---- P4_1 : P4_1 (USB0_EN for GR-PEACH) ---- */
|
||||||
usb0_en = new DigitalOut(P4_1, 1);
|
usb0_en = new DigitalOut(P4_1, 1);
|
||||||
|
|
||||||
#if 0 /* This setting is same as a routine in usb0_api_function_init */
|
|
||||||
CPG.STBCR7 &= ~(1u<<0u);
|
|
||||||
volatile uint8_t dummy8;
|
|
||||||
dummy8 = CPG.STBCR7;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* some constants */
|
/* some constants */
|
||||||
int_id = USBI0_IRQn;
|
int_id = USBI0_IRQn;
|
||||||
int_level = ( 2 << 3 );
|
int_level = ( 2 << 3 );
|
||||||
|
@ -233,8 +219,60 @@ USBHAL::USBHAL(void)
|
||||||
/* Clear pipe table */
|
/* Clear pipe table */
|
||||||
usb0_function_clear_pipe_tbl();
|
usb0_function_clear_pipe_tbl();
|
||||||
|
|
||||||
/* Initialize USB IP */
|
/******************************************************************************
|
||||||
usb0_api_function_init(int_level, mode, clock_mode);
|
* Function Name: usb0_api_function_init
|
||||||
|
* Description : Initializes the USB module in the USB function mode.
|
||||||
|
*****************************************************************************/
|
||||||
|
/* The clock of USB0 modules is permitted */
|
||||||
|
CPG.STBCR7 &= ~(CPG_STBCR7_MSTP71);
|
||||||
|
volatile uint8_t dummy8;
|
||||||
|
dummy8 = CPG.STBCR7;
|
||||||
|
|
||||||
|
{
|
||||||
|
/******************************************************************************
|
||||||
|
* Function Name: usb0_function_setting_interrupt
|
||||||
|
* Description : Sets the USB module interrupt level.
|
||||||
|
*****************************************************************************/
|
||||||
|
#if 0 /*DMA is not supported*/
|
||||||
|
IRQn_Type d0fifo_dmaintid;
|
||||||
|
IRQn_Type d1fifo_dmaintid;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
InterruptHandlerRegister(int_id, &_usbisr);
|
||||||
|
GIC_SetPriority(int_id, int_level);
|
||||||
|
GIC_EnableIRQ(int_id);
|
||||||
|
|
||||||
|
#if 0 /*DMA is not supported*/
|
||||||
|
d0fifo_dmaintid = Userdef_USB_usb0_function_d0fifo_dmaintid();
|
||||||
|
if (d0fifo_dmaintid != 0xFFFF)
|
||||||
|
{
|
||||||
|
InterruptHandlerRegister(d0fifo_dmaintid, usb0_function_dma_interrupt_d0fifo);
|
||||||
|
GIC_SetPriority(d0fifo_dmaintid, int_level);
|
||||||
|
GIC_EnableIRQ(d0fifo_dmaintid);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0 /*DMA is not supported*/
|
||||||
|
d1fifo_dmaintid = Userdef_USB_usb0_function_d1fifo_dmaintid();
|
||||||
|
if (d1fifo_dmaintid != 0xFFFF)
|
||||||
|
{
|
||||||
|
InterruptHandlerRegister(d1fifo_dmaintid, usb0_function_dma_interrupt_d1fifo);
|
||||||
|
GIC_SetPriority(d1fifo_dmaintid, int_level);
|
||||||
|
GIC_EnableIRQ(d1fifo_dmaintid);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/*****************************************************************************/
|
||||||
|
}
|
||||||
|
|
||||||
|
/* reset USB module with setting tranciever and HSE=1 */
|
||||||
|
usb0_function_reset_module(clock_mode);
|
||||||
|
|
||||||
|
/* clear variables */
|
||||||
|
usb0_function_init_status();
|
||||||
|
|
||||||
|
/* select USB Function and Interrupt Enable */
|
||||||
|
/* Detect USB Device to attach or detach */
|
||||||
|
usb0_function_InitModule(mode);
|
||||||
|
|
||||||
{
|
{
|
||||||
uint16_t buf;
|
uint16_t buf;
|
||||||
|
|
Loading…
Reference in New Issue