[RTEMS Project] #1761: 2kB of memory are lost in the SpaceWire Driver

RTEMS trac trac at rtems.org
Sun Nov 23 17:37:45 UTC 2014


#1761: 2kB of memory are lost in the SpaceWire Driver
----------------------------+-----------------------
 Reporter:  claudiodcsilva  |       Owner:  daniel
     Type:  enhancement     |      Status:  assigned
 Priority:  normal          |   Milestone:  4.11
Component:  bsps            |     Version:  4.10
 Severity:  minor           |  Resolution:
 Keywords:                  |
----------------------------+-----------------------
Changes (by joel.sherrill):

 * owner:  chrisj => daniel


Old description:

> The structure GRSPW_DEV has two members that are the Descriptor Tables
> used for the DMA engines. These members are allocated statically (“char
> _txtable[SPACEWIRE_BDTABLE_SIZE*2];” ) with twice the size they need
> to be. They should have 1024 bytes of size and have 2048. This extra
> size is needed because the descriptor table needs to be “1024 aligned
> (0x400)”.
>
> In the function “grspw_hw_init” these memory areas are passed to the
> function SPW_ALIGN which returns the first aligned address in the
> memory area.  This way the driver is allocating twice the memory
> needed in order to find an aligned base address for the table inside
> the memory area.
>
> For example if the _txtable start address is 0x40000001, the address
> returned by SPW_ALIGN will be 0x40000400 and the used memory area
> will be 0x40000400-0x40000800. Addresses in the range 0x80000001-
> 0x40000399 will not be used, but will remain allocated.
>
> This way we are losing 2kB in the descriptor tables.

New description:

 The structure GRSPW_DEV has two members that are the Descriptor Tables
 used for the DMA engines. These members are allocated statically (“char
 _txtable[SPACEWIRE_BDTABLE_SIZE*2];” ) with twice the size they need
 to be. They should have 1024 bytes of size and have 2048. This extra
 size is needed because the descriptor table needs to be “1024 aligned
 (0x400)”.

 In the function “grspw_hw_init” these memory areas are passed to the
 function SPW_ALIGN which returns the first aligned address in the
 memory area.  This way the driver is allocating twice the memory
 needed in order to find an aligned base address for the table inside
 the memory area.

 For example if the _txtable start address is 0x40000001, the address
 returned by SPW_ALIGN will be 0x40000400 and the used memory area
 will be 0x40000400-0x40000800. Addresses in the range 0x80000001-
 0x40000399 will not be used, but will remain allocated.

 This way we are losing 2kB in the descriptor tables.

--

--
Ticket URL: <http://devel.rtems.org/ticket/1761#comment:5>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list