Services and Utilities
Normative
The shared services a driver reports through and relies on: logging, critical sections, the interrupt-definition macro, and the standard memory utilities. These are the services the module pages forward-reference (for the CAN example, the Expected interfaces group in API Reference). Keywords per Requirement Keywords.
Logging (Log Manager)
Drivers report development and runtime errors — and informational events — through the Log Manager.
LogM_LogLevel (via LogM.h):
Level |
Value |
Meaning |
|---|---|---|
|
|
Confirmation that things work as expected. |
|
|
Something worth reporting happened; not critical. |
|
|
Development error — wrong usage (e.g. a bad parameter). |
|
|
Runtime error — a critical runtime condition. |
LogM_Report (via LogM.h) — the service used to log an event:
void LogM_Report(LogM_LogLevel logLevel, uint16 moduleId,
uint8 instanceId, uint8 apiId, uint8 eventId);
Parameter |
Meaning |
|---|---|
|
Log level matching the event (see above). |
|
Module id of the caller (see Module identifiers). |
|
Zero-based instance index; |
|
Id of the API reporting the event. |
|
Event (error) id. |
Synchronous and reentrant. Because of the five parameters, an implementation may provide
LogM_Report as a macro or LOCAL_INLINE wrapper that packs the ids and forwards to an
optimized backend, as long as the external signature is unchanged.
Critical sections
Available via SchM_<Mip>.h. A driver brackets a region needing exclusive access; the integrator
supplies the implementation. Both are synchronous and reentrant.
Service |
Meaning |
|---|---|
|
Enter exclusive control; nothing preempts the driver operation after this call. |
|
Leave exclusive control. |
Keep exclusive regions as short as possible to minimise interrupt latency and blocking of time-critical operations.
Interrupt definition (ISR macro)
Available via Os.h. Interrupt service routines MUST be defined with the ISR() macro,
which hides the compiler/OS-specific handler keyword:
#include "Os.h"
ISR(<IsrName>)
{
/* interrupt handling code */
}
Standard memory utilities
Available via Std_Lib.h. Common buffer helpers shared across modules. They may access the buffer
in several access sizes (byte/2-byte/4-byte) for performance, so they MUST NOT be used on buffers
with access-size restrictions (e.g. some HW peripheral buffers). Std_MemCmp / Std_MemCheck
are not constant-time and are unsuitable for security-critical comparison.
Function |
Meaning |
|---|---|
|
Copy |
|
Clear |
|
Fill |
|
Compare; |
|
|
An implementation may realise these by reusing existing compiler/platform functions (e.g. a macro
mapping Std_MemSet to memset) or an inline wrapper.