This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How can I allocate a nocache memory block, and this block can be used by others ??


Dear All,

    I want to allocate a non-cache memory for my nic driver,  and it uses
the logic address CYGMEM_SECTION_pci_window_VIR (from 0x10000000 to
0x11000000) and physical
address CYGMEM_SECTION_pci_window_PHY (from 0x0f000000 to 0x10000000).
But I find that the nocache buffer is used by others when I transfer file
with xmodem in RedBoot.

How can I allocate a nocache memory block, and this block can be used by
others ??

Thank you~


Steven Cheng


                                                                    [NIC
nocache buffer]
log addr        0x0  ...    0x10000000  |  0x10000000 ... 0x11000000 | ....
----------------------------------------------------------------------------
-------------------------
phy addr       0x0  ...    0x10000000  |  0x0f000000 ... 0x10000000 | .....



-------------- Memory Map definition

#define CYGMEM_REGION_ram (0)
#define CYGMEM_REGION_ram_SIZE (0x10000000)
.....
#define _EOM (CYGMEM_REGION_ram+CYGMEM_REGION_ram_SIZE)
#define CYGMEM_SECTION_pci_window_SIZE            (0x01000000)
#define _PCI_MAP      CYGMEM_SECTION_pci_window_SIZE
#define CYGARC_PHYSICAL_ADDRESS(x) ((x) - _PCI_MAP)
#define CYGARC_UNCACHED_ADDRESS(x) ((x) + _PCI_MAP)

#define CYGMEM_SECTION_pci_window_VIR             (_EOM )
#define CYGMEM_SECTION_pci_window_PHY
CYGARC_PHYSICAL_ADDRESS(_EOM )

CYGARC_MEMDESC_TABLE CYGBLD_ATTRIB_WEAK = {
 // Mapping for the Cogent PX development boards
    CYGARC_MEMDESC_NOCACHE( 0x70000000, 0x10000000 ), // FLASH region,
    CYGARC_MEMDESC_NOCACHE( 0xf0000000, 0x10000000 ), // PCI space, LEDS,
control
    CYGARC_MEMDESC_CACHE( CYGMEM_REGION_ram, CYGMEM_REGION_ram_SIZE), //
Main memory
 // Main memory, mapped non-cacheable for PCI use
    CYGARC_MEMDESC_NOCACHE_PA(CYGMEM_SECTION_pci_window_VIR,
                              CYGMEM_SECTION_pci_window_PHY,
                              CYGMEM_SECTION_pci_window_SIZE),
    CYGARC_MEMDESC_TABLE_END
};


-------------- NIC driver nocache buffer

#define ICX_ETH_MEM_BASE    CYGMEM_SECTION_pci_window_VIR
#define ICX_ETH1_RX_BUF_BASE    ICX_ETH_MEM_BASE
#define ICX_ETH1_TX_BUF_BASE    (ICX_ETH1_RX_BUF_BASE+RX_BUF_TOT_LEN)

------------- xxx_ram.ldi
MEMORY
{
    ram : ORIGIN = 0, LENGTH = 0x10000000
}

SECTIONS
{
    SECTIONS_BEGIN
    CYG_LABEL_DEFN(__reserved_vectors) = 0; . =
CYG_LABEL_DEFN(__reserved_vectors) + 0x3000;
    CYG_LABEL_DEFN(__reserved_vsr_table) = ALIGN (0x10); . =
CYG_LABEL_DEFN(__reserved_vsr_table) + 0x200;
    CYG_LABEL_DEFN(__reserved_virtual_table) = ALIGN (0x10); . =
CYG_LABEL_DEFN(__reserved_virtual_table) + 0x100;
    CYG_LABEL_DEFN(__reserved_for_rom) = ALIGN (0x10); . =
CYG_LABEL_DEFN(__reserved_for_rom) + 0x3cd00;
    SECTION_vectors (ram, ALIGN (0x10), LMA_EQ_VMA)
    SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_rodata1 (ram, ALIGN (0x8), LMA_EQ_VMA)
    SECTION_rodata (ram, ALIGN (0x8), LMA_EQ_VMA)
    SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA)
    SECTION_data (ram, ALIGN (0x8), LMA_EQ_VMA)
    SECTION_sbss (ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA)
    CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
    SECTIONS_END
}


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]