Combine ram_usb[01] into a single region.

Assign usb_bulk_buffer symbol to ram_usb origin, instead of hard-coding a pointer in C.
Change declaration of usb_bulk_buffer from a pointer to an array.
This commit is contained in:
Jared Boone
2014-01-11 17:07:49 -08:00
parent 10e379f492
commit ba2cc32ac6
6 changed files with 23 additions and 14 deletions

View File

@ -33,14 +33,15 @@ MEMORY
ram_sleep (rwx) : ORIGIN = 0x10088000, LENGTH = 8K ram_sleep (rwx) : ORIGIN = 0x10088000, LENGTH = 8K
ram_m0 (rwx) : ORIGIN = 0x20000000, LENGTH = 28K ram_m0 (rwx) : ORIGIN = 0x20000000, LENGTH = 28K
ram_shared (rwx) : ORIGIN = 0x20007000, LENGTH = 4K ram_shared (rwx) : ORIGIN = 0x20007000, LENGTH = 4K
ram_usb0 (rwx) : ORIGIN = 0x20008000, LENGTH = 16K ram_usb (rwx) : ORIGIN = 0x20008000, LENGTH = 32K
ram_usb1 (rwx) : ORIGIN = 0x2000c000, LENGTH = 16K /* ram_usb: USB buffer. Straddles two blocks of RAM
/* ram_usb[01]: USB buffer. Straddles two blocks of RAM
* to get performance benefit of having two USB buffers addressable * to get performance benefit of having two USB buffers addressable
* simultaneously (on two different buses of the AHB multilayer matrix) * simultaneously (on two different buses of the AHB multilayer matrix)
*/ */
} }
usb_bulk_buffer = ORIGIN(ram_usb);
/* Include the common ld script. */ /* Include the common ld script. */
INCLUDE libopencm3_lpc43xx.ld INCLUDE libopencm3_lpc43xx.ld

View File

@ -34,14 +34,15 @@ MEMORY
ram_sleep (rwx) : ORIGIN = 0x10088000, LENGTH = 8K ram_sleep (rwx) : ORIGIN = 0x10088000, LENGTH = 8K
ram_m0 (rwx) : ORIGIN = 0x20000000, LENGTH = 28K ram_m0 (rwx) : ORIGIN = 0x20000000, LENGTH = 28K
ram_shared (rwx) : ORIGIN = 0x20007000, LENGTH = 4K ram_shared (rwx) : ORIGIN = 0x20007000, LENGTH = 4K
ram_usb0 (rwx) : ORIGIN = 0x20008000, LENGTH = 16K ram_usb (rwx) : ORIGIN = 0x20008000, LENGTH = 32K
ram_usb1 (rwx) : ORIGIN = 0x2000c000, LENGTH = 16K /* ram_usb: USB buffer. Straddles two blocks of RAM
/* ram_usb[01]: USB buffer. Straddles two blocks of RAM
* to get performance benefit of having two USB buffers addressable * to get performance benefit of having two USB buffers addressable
* simultaneously (on two different buses of the AHB multilayer matrix) * simultaneously (on two different buses of the AHB multilayer matrix)
*/ */
} }
usb_bulk_buffer = ORIGIN(ram_usb);
/* Include the common ld script. */ /* Include the common ld script. */
INCLUDE libopencm3_lpc43xx_rom_to_ram.ld INCLUDE libopencm3_lpc43xx_rom_to_ram.ld

View File

@ -33,14 +33,15 @@ MEMORY
ram_sleep (rwx) : ORIGIN = 0x10090000, LENGTH = 8K ram_sleep (rwx) : ORIGIN = 0x10090000, LENGTH = 8K
ram_m0 (rwx) : ORIGIN = 0x20000000, LENGTH = 28K ram_m0 (rwx) : ORIGIN = 0x20000000, LENGTH = 28K
ram_shared (rwx) : ORIGIN = 0x20007000, LENGTH = 4K ram_shared (rwx) : ORIGIN = 0x20007000, LENGTH = 4K
ram_usb0 (rwx) : ORIGIN = 0x20008000, LENGTH = 16K ram_usb (rwx) : ORIGIN = 0x20008000, LENGTH = 32K
ram_usb1 (rwx) : ORIGIN = 0x2000c000, LENGTH = 16K /* ram_usb: USB buffer. Straddles two blocks of RAM
/* ram_usb[01]: USB buffer. Straddles two blocks of RAM
* to get performance benefit of having two USB buffers addressable * to get performance benefit of having two USB buffers addressable
* simultaneously (on two different buses of the AHB multilayer matrix) * simultaneously (on two different buses of the AHB multilayer matrix)
*/ */
} }
usb_bulk_buffer = ORIGIN(ram_usb);
/* Include the common ld script. */ /* Include the common ld script. */
INCLUDE libopencm3_lpc43xx.ld INCLUDE libopencm3_lpc43xx.ld

View File

@ -34,14 +34,15 @@ MEMORY
ram_sleep (rwx) : ORIGIN = 0x10090000, LENGTH = 8K ram_sleep (rwx) : ORIGIN = 0x10090000, LENGTH = 8K
ram_m0 (rwx) : ORIGIN = 0x20000000, LENGTH = 28K ram_m0 (rwx) : ORIGIN = 0x20000000, LENGTH = 28K
ram_shared (rwx) : ORIGIN = 0x20007000, LENGTH = 4K ram_shared (rwx) : ORIGIN = 0x20007000, LENGTH = 4K
ram_usb0 (rwx) : ORIGIN = 0x20008000, LENGTH = 16K ram_usb (rwx) : ORIGIN = 0x20008000, LENGTH = 32K
ram_usb1 (rwx) : ORIGIN = 0x2000c000, LENGTH = 16K /* ram_usb: USB buffer. Straddles two blocks of RAM
/* ram_usb[01]: USB buffer. Straddles two blocks of RAM
* to get performance benefit of having two USB buffers addressable * to get performance benefit of having two USB buffers addressable
* simultaneously (on two different buses of the AHB multilayer matrix) * simultaneously (on two different buses of the AHB multilayer matrix)
*/ */
} }
usb_bulk_buffer = ORIGIN(ram_usb);
/* Include the common ld script. */ /* Include the common ld script. */
INCLUDE libopencm3_lpc43xx_rom_to_ram.ld INCLUDE libopencm3_lpc43xx_rom_to_ram.ld

View File

@ -22,6 +22,11 @@
#include "usb_bulk_buffer.h" #include "usb_bulk_buffer.h"
uint8_t* const usb_bulk_buffer = (uint8_t*)0x20008000; /* Address of usb_bulk_buffer is set in ldscripts. If you change the name of this
* variable, it won't be where it needs to be in the processor's address space,
* unless you also adjust the ldscripts.
*/
uint8_t usb_bulk_buffer[32768];
const uint32_t usb_bulk_buffer_mask = 32768 - 1; const uint32_t usb_bulk_buffer_mask = 32768 - 1;
volatile uint32_t usb_bulk_buffer_offset = 0; volatile uint32_t usb_bulk_buffer_offset = 0;

View File

@ -25,7 +25,7 @@
#include <stdint.h> #include <stdint.h>
extern uint8_t* const usb_bulk_buffer; extern uint8_t usb_bulk_buffer[32768];
extern const uint32_t usb_bulk_buffer_mask; extern const uint32_t usb_bulk_buffer_mask;
extern volatile uint32_t usb_bulk_buffer_offset; extern volatile uint32_t usb_bulk_buffer_offset;