![]() |
S32 SDK
|
The following lines describe our recommendations of usage for the S32 SDK header files that are supposed to improve both code reuse and code portability.
It presents typical use cases such as:
Any assignment of a hard coded value is highly discouraged. It is recommended the usage of variables or macros for code consistency and reuse reasons.
Information contained in the Header Files:
This method is used to change the value of the entire register.
Should be used only when the previous value doesn't matter.
General form:
Example:
This method is used for initializing a bit or bit-field.
The benefit of using this method is that modifications of register addresses or bit-field offsets will not require code changes when this method is used.
General form:
Example:
This method is used to perform a bitwise OR between a bit-field and a given value.
General form:
Example:
This method is used for clearing a bit-field in a register.
For registers where there is at least one w1c bit please see section 8.
General form:
Example:
This method is used for reading the value of a bit-field from a register.
General form:
Example:
This method is used for clearing / setting a value to a bit in a register taking into consideration the previous value.
For w1c bits please consult section 8.
General form:
Example:
When a register has at least one W1C bit different approaches are suggested depending on each particular case:
clearing a w1c bit in registers where there are only w1c bits
For this case it is recommended that the bit mask is written at the register address.
General form:
Example:
clearing a w1c bit in registers where there are also "normal" bits
For this case it is recommended that a read-modify-write method is used with the mask of the bit-field that will leave the values of the other bits unchanged.
General form:
Example:
clearing a "normal" bit-field in registers where there are also w1c bits
For this case it is recommended that a special mask is applied to the register. The mask should be created by applying an AND operation between the negated mask of the bit-field that is intended to be cleared and the negated masks of all the w1c bit-fields.
General form:
Example:
setting a "normal" bit-field in registers where there are also w1c bits
For this case it is recommended that a clearing is done as in the previous step and then the bit-field is set as in step 3
General form:
Example:
Example:
Enable WakeUp interrupt for instance = 0