13 compiler specific adjustments, Compiler specific adjustments – Motorola USB08 User Manual

Page 57

Advertising
background image

Software Module Descriptions

Compiler Specific Adjustments

USB08 Evaluation Board

Designer Reference Manual

MOTOROLA

Software Module Descriptions

57

USB peripheral module arrives. As soon as the data has arrived, the next
character is taken from the buffer and the read index is incremented.
Since we are dealing with a ring buffer, this index, if it overflows beyond
the upper buffer border, is set back to the lower buffer border (index 0).

The size of the receiving ring buffer is specified by the macro
MAX_RXBUF_SIZE. The selected value has to be a power-of-two
number.

The transmission function putUSB() uses another buffer area which is
independent of the receive buffer including index variables for read and
write access. Again, the buffer size is specified using a macro
(MAX_TXBUF_SIZE). Concerning the size, the restriction on
power-of-two numbers applies here as well.

The character handed over to putUSB() is placed into the buffer. If the
buffer is full, the routine waits until the send buffer again is able to store
data. After placing the character into the send buffer, the access index
variable is updated.

Interrupt-controlled implementation of these functions is performed in
the background of the microcontroller application:

Filling of the receive buffer

Sending of the characters in the send buffer via the USB

For this purpose, an interrupt-controlled USB handler was implemented
and can be used in many other applications without any changes. The
principle of operation and the places of possible or necessary
modifications are described in detail in

Section 4. Universal Serial Bus

(USB) Interface

.

3.13 Compiler Specific Adjustments

The source text modules were written and translated with the M68HC08
Cosmic C Compiler. This compiler supports the complete language
scope available for ANSI-C. The porting of the firmware to another
M68HC08 ANSI-C compiler should be possible without any problems,

Advertising