Using the Driver
9
Using the Driver
9.1
General Conventions
While the driver is performing a service, the busy status flag is set. After any request by the application
for the driver to perform a service, the application must verify the busy flag is cleared to determine when
the service has completed. This is illustrated in Figure 6.
If the driver is busy, calls to any service (excluding Echo_DriverStatus()) may corrupt the request and
result in unspecified behavior. Exceptions to this rule, such as the ability to double buffer transmitted
messages using overlapped calls to Echo_SendMessage(), are detailed in the documentation for that service
(see Section 9.3, “Transmitting Messages”).
Invoke driver service
No
Yes
Busy = 1?
Figure 6. Driver Busy Flag Paradigm
The error flag indicates if any error occurred during the processing of a request. Sources of error include:
•
•
•
•
timeout from the receive states
attempting to read RSSI without the module enabled
attempting to call Echo_SendData()when not in transmit mode
or calling Echo_ChangeConfig()with illegal parameters
Errors may also occur when the Tx or Rx state machines are corrupted, indicating some problem outside
the driver’s control. To clear an error or timeout, call the Echo_ClearError()service.
9.2
Setup and Initialization
Before the driver can be used, some initial set up is necessary. This is performed in the Echo_Initialize()
service. Consequently, Echo_Initialize()must be called before using any other driver service.
After the driver has been initialized, Echo must be enabled before any messages can be sent or received or
before any function on Echo can be used. Echo can be configured while disabled. A typical start up
sequence is shown in Figure 7.
Software Drivers for MC33696, Rev. 1
12
Freescale Semiconductor