Commit Graph

20 Commits

Author SHA1 Message Date
Paul Fleischer b876b72b39 lm4f: Add control over UART FIFOs 2013-06-02 18:05:49 -07:00
Alexandru Gagniuc 4535a4c9b6 lm4f: Implement GPIO interrupt control
Implement an API to specifiy the interrupt trigger for GPIO pins, and
control interrupts. This completes the GPIO API.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-06-02 16:16:46 -07:00
Alexandru Gagniuc f53839f33f lm4f: Implement GPIO configuration and control
Everything needed to set up and control the GPIO pins is implemented,
EXCEPT setting up interrupts. This is the subject of a subsequent patch.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-06-02 16:16:46 -07:00
Alexandru Gagniuc de55bbc46e lm4f: "Pretty-ize" the look of Doxygen comments in gpio.c/.h
Put the Doxygen blocks in well-formatted C comments. This looks better
and is less distracting than putting them in unformatted comments.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-06-02 16:16:46 -07:00
Alexandru Gagniuc 2184eb2b13 lm4f: Improve read/write endpoint performance
Modify lm4f_ep_read/write_packet() to take advantage of 32-bit and 16-bit
accesses to the USB FIFO, as opposed to using only 8-bit accesses. This
change increases endpoint performance in a number of configurations.

On the host side, we use usb_bulk_bench to test
https://github.com/mrnuke/usb_bulk_bench

With the following invocations:

usb_bulk_bench -d c03e:b007 -a -t 64 -q 32 -e [ep] [-I/-O]

On the device side, we use the usb_bulk_dev example:

https://github.com/mrnuke/libopencm3-examples/tree/stellaris
The example is in: examples/lm4f/stellaris-ek-lm4f120xl/usb_bulk_dev

(This example will be available in libopencm3-examples in the near future)

The endpoints configuration is the following:
* EP1 OUT - interrupt driven RX endpoint
* EP2 IN  - interrupt driven TX endpoint
* EP3 OUT - polled RX endpoint
* EP4 IN  - polled TX endpoint
* EP5 OUT - polled RX endpoint with unaligned buffer
* EP6 IN  - polled TX endpoint with unaligned buffer

We test the speed in each configuration, using different system clock
frequencies. We run the tests once without the patch applied, and once with
the patch applied. The results are given below:

Before patch (numbers in KiB/s):
freq:	80 MHz	57 MHz	40 MHz	30 MHz	20 MHz	16 MHz
EP1	562	562	562	562	562	550
EP2	936	872	812	812	687	625
EP3	1062	890	700	600	562	562
EP4	900	812	812	750	625	562
EP5	1062	890	700	600	562	562
EP6	930	812	812	750	625	562

With patch  (numbers in KiB/s):
freq:	80 MHz	57 MHz	40 MHz	30 MHz	20 MHz	16 MHz
EP1	1062	1062	1062	690	562	562
EP2	1125	936	936	936	870	812
EP3	1062	960	750	750	562	562
EP4	936	936	870	870	770	700
EP5	1062	900	700	630	562	562
EP6	930	930	870	870	740	650

Percent change in speed (*):
freq:	80 MHz	57 MHz	40 MHz	30 MHz	20 MHz	16 MHz
EP1	89.0	89.0	89.0	22.8	0.0	2.2
EP2	20.2	7.3	15.3	15.3	26.6	29.9
EP3	0.0	7.9	7.1	25.0	0.0	0.0
EP4	4.0	15.3	7.1	16.0	23.2	24.6
EP5	0.0	1.1	0.0	5.0	0.0	0.0
EP6	0.0	14.5	7.1	16.0	18.4	15.7

(*) Numbers given as percent change relative to speed before applying this
patch.

We see throughput increases across the board.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-05-20 17:52:33 -05:00
Alexandru Gagniuc 9d46103ced lm4f: Add functions for controlling USB interrupts
Add functions to enable and disable USB interrupts, and document how to
use these functions to run usbd_poll() from the usb ISR.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-05-16 01:36:17 -05:00
Alexandru Gagniuc ad048f7d5a lm4f: Add doxygen documentation for the USB driver
Add minimal documentation for the USB driver. The internal functions and
structs are excluded.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-05-16 01:36:10 -05:00
Alexandru Gagniuc 2fda5282ab lm4f: Implement a basic USB driver
Implement a basic driver for the LM4F USB controller. The driver is in a
basic form. DMA is not yet implemented. Double-buffering is supported by
the hardware, but is not yet implemented

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-05-15 18:17:48 -05:00
Alexandru Gagniuc 5507e14cd4 lm4f: Implement DMA enable/disable functions for the UART
Add basic rx/tx_dma_enable/disable functionality.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-05-10 14:20:12 -07:00
Alexandru Gagniuc a8fc67d569 lm4f: Implement UART interrupt control
Add a complete API for controlling the UART interrupts.
Doxygen documentation with inline code examples is also provided in this patch.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-05-10 14:20:11 -07:00
Alexandru Gagniuc 8112861b60 lm4f: Add basic UART implementation
Add basic functionality needed to setup the UART and send/recieve data.
Interrupts, DMA, and more advanced features are not implemented in this patch.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-05-10 14:20:11 -07:00
Alexandru Gagniuc f4eca5400e lm4f: Properly set PLL divisor
rcc_set_pll_divisor() would take the number we wanted to divide the 400MHz
clock and put it directly in the RCC2 register. This caused the clock to always
be one speed tier slower than expected. The value of the divisor must be
decremented by 1, so a divisor of 5 will be written as 4 in the RCC2.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-05-07 02:05:47 -05:00
Ken Sarkies 1627cd60c3 Documentation structures added to place the non-STM32 families into the documentation tree.
Actual documentation has not been added. Volunteers?
2013-04-14 15:30:02 +02:00
Ken Sarkies e2022f5884 Repair to documentation (most documented files)
to remove errors, duplications and inconsistencies.
File lib/stm32/f1/pwr.c - all code removed as it duplicates that in common/pwr_common.c
Remaining changes do not affect code. Compiles OK.
TODO efm32 has no code so generates no modules
TODO F2 needs pwr.c
TODO L1 needs dma.h and dma.c
2013-03-07 11:14:06 +10:30
Piotr Esden-Tempski b0233ae6fb Added more warning CFLAGS to all makefiles. 2013-02-26 16:42:20 -08:00
Alexandru Gagniuc 7957cffaa3 lm4f: Add API for controlling the system run clock sources
Add an abstraction layer to handle the clock control for the run time clock on
LM4F (RCC). Sleep and deep-sleep clock configuration is not handled.

Complete documentation for the clock control API is included in doxygen-style
comments, and is included in [doc].

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

Conflicts:
	lib/lm4f/Makefile
2013-01-09 00:39:20 -06:00
Alexandru Gagniuc 03d04ad10a lm4f: Add API for enabling/disabling peripherals clock source
The enum definitions are specified in the form
 31:5 register offset from SYSCTL_BASE for the clock register
 4:0  bit offset for the given peripheral

The names have the form [clock_type]_[periph_type]_[periph_number]
Where clock_type is
     RCC for run clock
     SCC for sleep clock
     DCC for deep-sleep clock

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-01-09 00:37:50 -06:00
Alexandru Gagniuc c1381bf54a lm4f: Compile with FPU support
Specify the -mfloat-abi=hard and -mfpu=fpv4-sp-d16 flags so that FPU
is enabled by default.
While this compiles with FPU support, in order to use the floating point types,
the FPU must be explicitly enabled at runtime.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-31 01:35:27 -06:00
Alexandru Gagniuc b2ac2ffc4b lm4f: Remove erroneous references to lm3s
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-31 01:35:27 -06:00
Alexandru Gagniuc 326c945b55 lm4f: Add lm4f support files copied from lm3s
Create lm4f code infrastructure from the lm3s infrastructure.

As far as the interrupt table is concerned, don't create an irq.yaml. Just
include the LM3S nvic.h. The LM3S vector table seems to be compatible with the
LM4F

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-31 01:35:25 -06:00