rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions
shared_params.h File Reference

Functions

void SharedParamsInit (void)
 Initializes the shared RAM parameters module.
 
bool SharedParamsReadByIndex (uint32_t idx, uint8_t *value)
 Reads a data byte from the shared parameter buffer at the specified index.
 
bool SharedParamsWriteByIndex (uint32_t idx, uint8_t value)
 Writes a data byte to the shared parameter buffer at the specified index.
 

Function Documentation

◆ SharedParamsInit()

void SharedParamsInit ( void  )

Initializes the shared RAM parameters module.

Returns
none.

Definition at line 83 of file shared_params.c.

84{
85 uint32_t byteIdx;
86
87 /* The shared parameter buffer does not get initialized by the C-startup code. Another
88 * previously running program could have initialized it, in which case it is ready
89 * for use and nothing more needs to be done.
90 */
92 {
93 /* The shared parameter buffer was not yet initialized by a running program. This
94 * typically happens after a cold reset where the RAM contents were lost. In this
95 * case we need to explicitly configure and initialize it, since the C-startup code
96 * was configured to not do this.
97 *
98 * The initialization consists of setting the buffer identifier, zeroing the
99 * actual parameter data and updating the checksum at the end.
100 */
101 sharedParamsBuffer.identifier = SHARED_PARAMS_BUFFER_ID;
102 for (byteIdx=0; byteIdx < SHARED_PARAMS_CFG_BUFFER_DATA_LEN; byteIdx++)
103 {
104 sharedParamsBuffer.data[byteIdx] = 0;
105 }
107 }
108} /*** end of SharedParamsInit ***/
static void SharedParamsWriteChecksum(void)
Calculates and writes the checksum into the buffer.
static bool SharedParamsValidateBuffer(void)
Validates the shared parameter buffer contents by looking at the table identifier and verifying its c...

Referenced by jump_to_openblt(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SharedParamsReadByIndex()

bool SharedParamsReadByIndex ( uint32_t  idx,
uint8_t *  value 
)

Reads a data byte from the shared parameter buffer at the specified index.

Parameters
idxIndex into the parameter data array. A valid value is between 0 and (SHARED_PARAMS_CFG_BUFFER_DATA_LEN - 1).
valuePointer to where the read data value is stored.
Returns
True if successful, false otherwise.

Definition at line 119 of file shared_params.c.

120{
121 bool result = false;
122
123 /* Only continue if the buffer and the specified parameters are valid. */
125 (idx < SHARED_PARAMS_CFG_BUFFER_DATA_LEN) &&
126 (value != NULL) )
127 {
128 /* Read the value and update the result. */
129 *value = sharedParamsBuffer.data[idx];
130 result = true;
131 }
132 /* Give the result back to the caller. */
133 return result;
134} /*** end of SharedParamsReadByIndex ***/

Referenced by checkIfRebootIntoOpenBltRequested(), and checkIfResetLoop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SharedParamsWriteByIndex()

bool SharedParamsWriteByIndex ( uint32_t  idx,
uint8_t  value 
)

Writes a data byte to the shared parameter buffer at the specified index.

Parameters
idxIndex into the parameter data array. A valid value is between 0 and (SHARED_PARAMS_CFG_BUFFER_DATA_LEN - 1).
valueValue to write.
Returns
True if successful, false otherwise.

Definition at line 145 of file shared_params.c.

146{
147 bool result = false;
148
149 /* Only continue if the buffer and the specified parameters are valid. */
151 (idx < SHARED_PARAMS_CFG_BUFFER_DATA_LEN) )
152 {
153 /* Write the value. */
154 sharedParamsBuffer.data[idx] = value;
155 /* Update the checksum since the contents were just changed. */
157 /* Update the result. */
158 result = true;
159 #if CORTEX_MODEL == 7
160 // If we have a cache, drop the relevant cache lines.
161 SCB_CleanDCache_by_Addr((uint32_t*)&sharedParamsBuffer, sizeof(sharedParamsBuffer));
162 #endif
163 }
164 /* Give the result back to the caller. */
165 return result;
166} /*** end of SharedParamsWriteByIndex ***/

Referenced by checkIfRebootIntoOpenBltRequested(), checkIfResetLoop(), jump_to_openblt(), and tryResetWatchdog().

Here is the call graph for this function:
Here is the caller graph for this function:

Go to the source code of this file.