at91rm3400 ATMEL Corporation, at91rm3400 Datasheet - Page 56

no-image

at91rm3400

Manufacturer Part Number
at91rm3400
Description
Atmel Advanced At91 Arm Microcontroller
Manufacturer
ATMEL Corporation
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
at91rm3400-AU-002
Manufacturer:
Atmel
Quantity:
10 000
Using a Service
Opening a Service
Overloading a Method
56
AT91RM3400
Method pointers in the service structure are initialized to the default methods defined in the
AT91 service. Other fields in the service structure are initialized to default values or with the
arguments of the function AT91F_Open_<Service>.
In summary, an application must know what the service structure is and where the function
AT91F_Open_<Service> is.
The default function AT91F_Open_<Service> may be redefined by the application or com-
prised in an application-defined function. See Section .
The entry point to a service is established by initializing the service structure. An open function
is associated with each service structure, except for the ROM Entry Service (see Section ).
Thus, only the functions AT91F_Open_<service> are visible from the user side. Access to
the service methods is made via function pointers in the service structure.
The function AT91F_Open_<service> has at least one argument: a pointer to the service
structure that must be allocated elsewhere. It returns a pointer to the base service structure
or a pointer to this service structure.
The function AT91F_Open_<service> initializes all data members and method pointers. All
function pointers in the service structure are set to the service’s functions.
The advantage of this method is to offer a single entry point for a service. The methods of a
service are initialized by the open function and each member can be overloaded.
Default methods are defined for all services provided in ROM. These methods may not be
adapted to a project requirement. It is possible to overload default methods by methods
defined in the project.
A me th o d i s a p o in te r t o a f u nc t io n . T h i s po i nt er i s i ni t i al i z ed b y t h e fu n c ti o n
AT91F_Open_<Service>. To overload one or several methods in a service, the function
pointer must be updated to the new method.
It is possible to overload just one method of a service or all the methods of a service. In this
latter case, the functionality of the service is user-defined, but still works on the same data
structure.
Note:
// Allocation of the service structure
AT91S_Pipe pipe;
// Opening of the service
AT91PS_Pipe pPipe = AT91F_OpenPipe(&pipe, …);
Calling the default function AT91F_Open_<Service> ensures that all methods and data are
initialized.
1790A–ATARM–11/03

Related parts for at91rm3400