git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2787 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
4844936fde
commit
43bb4bfedb
|
@ -110,7 +110,7 @@
|
|||
* USB endpoints are the objects that the application uses to exchange
|
||||
* data with the host. There are two kind of endpoints:
|
||||
* - <b>IN</b> endpoints are used by the application to transmit data to
|
||||
* the host.
|
||||
* the host.<br>
|
||||
* - <b>OUT</b> endpoints are used by the application to receive data from
|
||||
* the host.
|
||||
* .
|
||||
|
@ -118,10 +118,98 @@
|
|||
* - <b>Packet Mode</b>. In this mode the driver invokes a callback each
|
||||
* time a packet has been received or transmitted. This mode is especially
|
||||
* suited for those applications handling continuous streams of data.
|
||||
* <br><br>
|
||||
* States diagram for OUT endpoints in packet mode:
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true",
|
||||
width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
disabled [label="EP_DISABLED\nDisabled", style="bold"];
|
||||
receiving [label="EP_BUSY\nReceiving Packet"];
|
||||
idle [label="EP_IDLE\nPacket in Buffer"];
|
||||
|
||||
disabled -> receiving [label="\usbInitEndpointI()"];
|
||||
receiving -> idle [label="\npacket received\n>out_cb<"];
|
||||
idle -> receiving [label="\nusbReadPacketI()"];
|
||||
receiving -> disabled [label="\nUSB RESET\nusbDisableEndpointsI()"];
|
||||
idle -> disabled [label="\nUSB RESET\nusbDisableEndpointsI()"];
|
||||
}
|
||||
* @enddot
|
||||
* <br><br>
|
||||
* States diagram for IN endpoints in packet mode:
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true",
|
||||
width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
disabled [label="EP_DISABLED\nDisabled", style="bold"];
|
||||
transmitting [label="EP_BUSY\nSending Packet"];
|
||||
idle [label="EP_IDLE\nBuffer Empty"];
|
||||
|
||||
disabled -> idle [label="\usbInitEndpointI()"];
|
||||
idle -> transmitting [label="\nusbWritePacketI()"];
|
||||
transmitting -> idle [label="\npacket sent\n>in_cb<"];
|
||||
transmitting -> disabled [label="\nUSB RESET\nusbDisableEndpointsI()"];
|
||||
idle -> disabled [label="\nUSB RESET\nusbDisableEndpointsI()"];
|
||||
}
|
||||
* @enddot
|
||||
* <br><br>
|
||||
* - <b>Transaction Mode</b>. In this mode the driver invokes a callback
|
||||
* only after a large, potentially multi-packet, transfer has been
|
||||
* completed, a callback is invoked only at the end of the transfer.
|
||||
* <br><br>
|
||||
* States diagram for OUT endpoints in transaction mode:
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true",
|
||||
width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
disabled [label="EP_DISABLED\nDisabled", style="bold"];
|
||||
receiving [label="EP_BUSY\nReceiving"];
|
||||
idle [label="EP_IDLE\nReady"];
|
||||
|
||||
disabled -> idle [label="\usbInitEndpointI()"];
|
||||
idle -> receiving [label="\usbStartReceiveI()"];
|
||||
receiving -> receiving [label="\nmore packets"];
|
||||
receiving -> idle [label="\nreception end\n>out_cb<"];
|
||||
receiving -> disabled [label="\nUSB RESET\nusbDisableEndpointsI()"];
|
||||
idle -> disabled [label="\nUSB RESET\nusbDisableEndpointsI()"];
|
||||
}
|
||||
* @enddot
|
||||
* <br><br>
|
||||
* States diagram for IN endpoints in transaction mode:
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true",
|
||||
width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
disabled [label="EP_DISABLED\nDisabled", style="bold"];
|
||||
transmitting [label="EP_BUSY\nTransmitting"];
|
||||
idle [label="EP_IDLE\nReady"];
|
||||
|
||||
disabled -> idle [label="\usbInitEndpointI()"];
|
||||
idle -> transmitting [label="\nusbStartTransmitI()"];
|
||||
transmitting -> transmitting [label="\nmore packets"];
|
||||
transmitting -> idle [label="\ntransmission end\n>in_cb<"];
|
||||
transmitting -> disabled [label="\nUSB RESET\nusbDisableEndpointsI()"];
|
||||
idle -> disabled [label="\nUSB RESET\nusbDisableEndpointsI()"];
|
||||
}
|
||||
* @enddot
|
||||
* <br><br>
|
||||
* .
|
||||
* An important difference in the two modes is that there is a dedicated
|
||||
* endpoint buffer in packet mode while in transaction mode the application
|
||||
* specifies its own buffer for the whole transfer.
|
||||
*
|
||||
* @subsection usb_2_3 USB Callbacks
|
||||
* The USB driver uses callbacks in order to interact with the application.
|
||||
* There are several kind of callbacks to be handled:
|
||||
|
|
|
@ -93,10 +93,6 @@ CH_IRQ_HANDLER(DMA1_Ch1_IRQHandler) {
|
|||
void adc_lld_init(void) {
|
||||
|
||||
#if STM32_ADC_USE_ADC1
|
||||
/* ADC reset, ensures reset state in order to avoid trouble with JTAGs.*/
|
||||
RCC->APB2RSTR = RCC_APB2RSTR_ADC1RST;
|
||||
RCC->APB2RSTR = 0;
|
||||
|
||||
/* Driver initialization.*/
|
||||
adcObjectInit(&ADCD1);
|
||||
ADCD1.ad_adc = ADC1;
|
||||
|
|
|
@ -165,10 +165,6 @@ CH_IRQ_HANDLER(CAN1_SCE_IRQHandler) {
|
|||
void can_lld_init(void) {
|
||||
|
||||
#if STM32_CAN_USE_CAN1
|
||||
/* CAN reset, ensures reset state in order to avoid trouble with JTAGs.*/
|
||||
RCC->APB1RSTR = RCC_APB1RSTR_CAN1RST;
|
||||
RCC->APB1RSTR = 0;
|
||||
|
||||
/* Driver initialization.*/
|
||||
canObjectInit(&CAND1);
|
||||
CAND1.cd_can = CAN1;
|
||||
|
|
|
@ -31,25 +31,15 @@
|
|||
#if HAL_USE_PAL || defined(__DOXYGEN__)
|
||||
|
||||
#if STM32_HAS_GPIOG
|
||||
#define APB2_RST_MASK (RCC_APB2RSTR_IOPARST | RCC_APB2RSTR_IOPBRST | \
|
||||
RCC_APB2RSTR_IOPCRST | RCC_APB2RSTR_IOPDRST | \
|
||||
RCC_APB2RSTR_IOPERST | RCC_APB2RSTR_IOPFRST | \
|
||||
RCC_APB2RSTR_IOPGRST | RCC_APB2RSTR_AFIORST);
|
||||
#define APB2_EN_MASK (RCC_APB2ENR_IOPAEN | RCC_APB2ENR_IOPBEN | \
|
||||
RCC_APB2ENR_IOPCEN | RCC_APB2ENR_IOPDEN | \
|
||||
RCC_APB2ENR_IOPEEN | RCC_APB2ENR_IOPFEN | \
|
||||
RCC_APB2ENR_IOPGEN | RCC_APB2ENR_AFIOEN)
|
||||
#elif STM32_HAS_GPIOE
|
||||
#define APB2_RST_MASK (RCC_APB2RSTR_IOPARST | RCC_APB2RSTR_IOPBRST | \
|
||||
RCC_APB2RSTR_IOPCRST | RCC_APB2RSTR_IOPDRST | \
|
||||
RCC_APB2RSTR_IOPERST | RCC_APB2RSTR_AFIORST);
|
||||
#define APB2_EN_MASK (RCC_APB2ENR_IOPAEN | RCC_APB2ENR_IOPBEN | \
|
||||
RCC_APB2ENR_IOPCEN | RCC_APB2ENR_IOPDEN | \
|
||||
RCC_APB2ENR_IOPEEN | RCC_APB2ENR_AFIOEN)
|
||||
#else
|
||||
#define APB2_RST_MASK (RCC_APB2RSTR_IOPARST | RCC_APB2RSTR_IOPBRST | \
|
||||
RCC_APB2RSTR_IOPCRST | RCC_APB2RSTR_IOPDRST | \
|
||||
RCC_APB2RSTR_AFIORST)
|
||||
#define APB2_EN_MASK (RCC_APB2ENR_IOPAEN | RCC_APB2ENR_IOPBEN | \
|
||||
RCC_APB2ENR_IOPCEN | RCC_APB2ENR_IOPDEN | \
|
||||
RCC_APB2ENR_AFIOEN)
|
||||
|
@ -91,11 +81,8 @@ void _pal_lld_init(const PALConfig *config) {
|
|||
RCC->APB2ENR |= APB2_EN_MASK;
|
||||
|
||||
/*
|
||||
* Resets the GPIO ports and AFIO.
|
||||
* Initial GPIO setup.
|
||||
*/
|
||||
RCC->APB2RSTR = APB2_RST_MASK;
|
||||
RCC->APB2RSTR = 0;
|
||||
|
||||
GPIOA->ODR = config->PAData.odr;
|
||||
GPIOA->CRH = config->PAData.crh;
|
||||
GPIOA->CRL = config->PAData.crl;
|
||||
|
|
|
@ -218,8 +218,6 @@ void spi_lld_init(void) {
|
|||
dummytx = 0xFFFF;
|
||||
|
||||
#if STM32_SPI_USE_SPI1
|
||||
RCC->APB2RSTR = RCC_APB2RSTR_SPI1RST;
|
||||
RCC->APB2RSTR = 0;
|
||||
spiObjectInit(&SPID1);
|
||||
SPID1.spd_thread = NULL;
|
||||
SPID1.spd_spi = SPI1;
|
||||
|
@ -228,8 +226,6 @@ void spi_lld_init(void) {
|
|||
#endif
|
||||
|
||||
#if STM32_SPI_USE_SPI2
|
||||
RCC->APB1RSTR = RCC_APB1RSTR_SPI2RST;
|
||||
RCC->APB1RSTR = 0;
|
||||
spiObjectInit(&SPID2);
|
||||
SPID2.spd_thread = NULL;
|
||||
SPID2.spd_spi = SPI2;
|
||||
|
@ -238,8 +234,6 @@ void spi_lld_init(void) {
|
|||
#endif
|
||||
|
||||
#if STM32_SPI_USE_SPI3
|
||||
RCC->APB1RSTR = RCC_APB1RSTR_SPI3RST;
|
||||
RCC->APB1RSTR = 0;
|
||||
spiObjectInit(&SPID3);
|
||||
SPID3.spd_thread = NULL;
|
||||
SPID3.spd_spi = SPI3;
|
||||
|
|
|
@ -438,8 +438,6 @@ CH_IRQ_HANDLER(USART3_IRQHandler) {
|
|||
void uart_lld_init(void) {
|
||||
|
||||
#if STM32_UART_USE_USART1
|
||||
RCC->APB2RSTR = RCC_APB2RSTR_USART1RST;
|
||||
RCC->APB2RSTR = 0;
|
||||
uartObjectInit(&UARTD1);
|
||||
UARTD1.ud_usart = USART1;
|
||||
UARTD1.ud_dmap = STM32_DMA1;
|
||||
|
@ -449,8 +447,6 @@ void uart_lld_init(void) {
|
|||
#endif
|
||||
|
||||
#if STM32_UART_USE_USART2
|
||||
RCC->APB1RSTR = RCC_APB1RSTR_USART2RST;
|
||||
RCC->APB1RSTR = 0;
|
||||
uartObjectInit(&UARTD2);
|
||||
UARTD2.ud_usart = USART2;
|
||||
UARTD2.ud_dmap = STM32_DMA1;
|
||||
|
@ -460,8 +456,6 @@ void uart_lld_init(void) {
|
|||
#endif
|
||||
|
||||
#if STM32_UART_USE_USART3
|
||||
RCC->APB1RSTR = RCC_APB1RSTR_USART3RST;
|
||||
RCC->APB1RSTR = 0;
|
||||
uartObjectInit(&UARTD3);
|
||||
UARTD3.ud_usart = USART3;
|
||||
UARTD3.ud_dmap = STM32_DMA1;
|
||||
|
|
|
@ -322,10 +322,6 @@ CH_IRQ_HANDLER(USB_LP_IRQHandler) {
|
|||
*/
|
||||
void usb_lld_init(void) {
|
||||
|
||||
/* USB reset, ensures reset state in order to avoid trouble with JTAGs.*/
|
||||
RCC->APB1RSTR = RCC_APB1RSTR_USBRST;
|
||||
RCC->APB1RSTR = 0;
|
||||
|
||||
/* Driver initialization.*/
|
||||
usbObjectInit(&USBD1);
|
||||
}
|
||||
|
|
|
@ -107,6 +107,8 @@
|
|||
- NEW: Implemented the new IO_TRANSMISSION_END event in the STM32 serial
|
||||
driver.
|
||||
- NEW: Added explicit reset of all peripherals inside the STM32 HAL driver.
|
||||
Removed the separate resets on initialization from the various other
|
||||
drivers saving significant space.
|
||||
- OPT: Removed TIMx reset on system startup in the STM32 PWM driver, the
|
||||
timers are already reset on driver startup.
|
||||
- CHANGE: The functions chEvtSignal() and chEvtSignalI() have been renamed
|
||||
|
|
2
todo.txt
2
todo.txt
|
@ -19,6 +19,8 @@ Within 2.3.x (hopefully)
|
|||
* Improvements to the message passing mechanism in order to allow "delayed,
|
||||
out of order, responses".
|
||||
* New device driver models: GPT.
|
||||
- Add UART4 support to the STM32 UART driver.
|
||||
- Add ADC3 support to the STM32 ADC driver.
|
||||
? Make thread functions return void and add a CH_THREAD macro for threads
|
||||
declaration in order to hide compiler-specific optimizations for thread
|
||||
functions.
|
||||
|
|
Loading…
Reference in New Issue