malloc to ensure storage place

Hello,

I'm working with the ethernet MAC from the AT91RM9200 controller. I'm able to get a interrupt if I receive a packets - with the code example from atmel.

The packets are stored from the storage address 0x20010000 (external sdram) - 8 buffers a 1536 bits. How can I protect this storage place for the ethernet buffers?

typedef struct _AT91S_TdDescriptor {
        unsigned int addr;
        unsigned int size;
}AT91S_TdDescriptor, *AT91PS_TdDescriptor;
AT91PS_TdDescriptor tdList = (AT91PS_TdDescriptor)AT91C_EMAC_TDLIST_BASE;

(ptr must be word-aligned)

and here's the initialization of the buffers.

for (i = 0; i < NB_ETH_RX_PACKETS; ++i)
        {
                tdList[i].addr = ((unsigned int) (pRxPacket + (i * ETH_PACKET_SIZE))) & 0xFFFFFFFC;
                tdList[i].size = 0;
        }

There's no variable of the struct or anything else. The only thing I tell the MAC is the pointer for the received frames.

But is this code not realy unsafe? Is it possible to use malloc to ensure the storage place for the buffers?

Johannes

Parents Reply Children
No data
More questions in this forum