Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
(ARM).Porting TCP-IP programmer's guide.Ver 1.4.pdf
Скачиваний:
31
Добавлен:
23.08.2013
Размер:
2.79 Mб
Скачать

ARM-specific Functions

10.8lswap.s

You need to include lswap.s only if you are implementing a little-endian system. When using the Internet Protocol (IP), all protocol data larger than a single byte is transmitted on the network in network byte order (big-endian mode). If your system is operating in little-endian mode, all 16-bit and 32-bit quantities that are sent or received must be byte swapped from network byte order to little-endian. For 16-bit quantities, you can use a simple macro, for example:

#define htons(s) ((u_short)(((u_short)(s) >> 8) | ((u_short)(s) << 8)))

However, for 32-bit quantities, it is more efficient to call the lswap() function. This file, lswap.s, contains implementations of lswap() for both ARM and Thumb.

10-12

Copyright © 1998 and 1999 ARM Limited. All rights reserved.

ARM DUI 0079B

ARM-specific Functions

10.9mmu.s

If your hardware supports unaligned access trapping, you may want to enable it by calling SetupAbort().

The SetupAbort() function contains code to write to the coprocessor registers to enable unaligned access trapping. This code sample is provided in ARM code only.

ARM DUI 0079B

Copyright © 1998 and 1999 ARM Limited. All rights reserved.

10-13

ARM-specific Functions

10.10olicom.c

This file implements the Olicom Ethernet driver. The Ethernet kit that is available for the PID card uses an Olicom Ethercom Ethernet PCMCIA PC-Card. This PC-Card supports both 10-baseT and 10-base2 operation through the use of different drop cables. No changes to the source are required to support these different media options. The olicom.c file uses functions in pcmcia.c and 82595.c to facilitate its operation.

The olicom_card_handler() function is a callback from the PCMCIA card services functions in pcmcia.c. It is called when a card insertion is detected, either as a real insertion or when the card services functions are first initialized.

The prep_olicom() function is called from the prep_ifaces() function (see prep_ifaces() on page 4-12) in ipport.c. In turn, this is called from the ip_startup code in startup.c. The prep_olicom() function has the same API as the prep_ifaces() function and performs the same task (that is, filling in an entry in the nets[ ] table for the Olicom driver).

The other operation that prep_olicom() performs is to detect the physical hardware and configure it into the system. This is achieved by calling the pcmia_setup() function, which will scan the PCMCIA slots for inserted cards and call the olicom_card_handler() callback to complete the task.

The API for the other functions (olicom_init(), olicom_pkt_send(), olicom_close(), and olicom_stats()) is documented in Network interfaces on page 4-15.

10-14

Copyright © 1998 and 1999 ARM Limited. All rights reserved.

ARM DUI 0079B

ARM-specific Functions

10.11pcmcia.c

This file implements both PC-Card slot services and PC-Card card services functions. They should not be called directly other than through a device driver. This file implements the following functions:

pcmcia_find_tuple()

pcmcia_irq()

pcmcia_mapio()

pcmcia_setup()

vadem_dump().

ARM DUI 0079B

Copyright © 1998 and 1999 ARM Limited. All rights reserved.

10-15