Skip to content

Commit c763263

Browse files
committed
am64/am24: gp_timer: Code cleanup
- Remove void* config pointer - Use absolute pointer types and enable multiple functions to perform different timer config operations. Fixes: SITSW-7155 Signed-off-by: Nithyaa shri R B <[email protected]>
1 parent cae26fc commit c763263

File tree

4 files changed

+352
-203
lines changed

4 files changed

+352
-203
lines changed

docs_src/docs/api_guide/doxy_samples/drivers/Gp_timer_sample.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ void gptimer_free_run_no_interrupt(void)
5858
uint32_t conifgMode;
5959
conifgMode = GPTIMER_MODE_CONFIG_FREE_RUN;
6060

61-
GPTIMER_setTimerConfigMode(gGpTimerHandle, conifgMode,
62-
(void *)NULL);
61+
GPTIMER_setFreeRunMode(gGpTimerHandle);
6362
/* Start the Timer */
6463
GPTIMER_start(gGpTimerHandle);
6564

@@ -83,8 +82,7 @@ void gptimer_free_run_interrupt(void)
8382

8483
SemaphoreP_constructBinary(&overflowSemObj, 0);
8584

86-
GPTIMER_setTimerConfigMode(gGpTimerHandle, conifgMode,
87-
(void *)NULL);
85+
GPTIMER_setFreeRunMode(gGpTimerHandle);
8886
/* Add Callback */
8987
GPTIMER_setCallbackFxn(gGpTimerHandle, overflowCallback, NULL, NULL);
9088
/* Start the Timer */
@@ -116,8 +114,7 @@ void gptimer_output_compare_interrupt(void)
116114
conifgMode = GPTIMER_MODE_CONFIG_OUTPUT_COMPARE;
117115
compareConfig.cntCompareValComp = (0x017D7840U);
118116

119-
GPTIMER_setTimerConfigMode(gGpTimerHandle, conifgMode,
120-
(void *)(&compareConfig));
117+
GPTIMER_setOpCompareMode(gGpTimerHandle, &compareConfig);
121118
/* Add Callback */
122119
GPTIMER_setCallbackFxn(gGpTimerHandle, NULL, compareMatchCallback, NULL);
123120
/* Start the TImer */
@@ -151,8 +148,7 @@ void gptimer_input_capture_interrupt(void)
151148
inputCaptureConfig.captureMode = GPTIMER_INPUT_CAPTURE_MODE_SECOND;
152149
inputCaptureConfig.captureEventMode = GPTIMER_INPUT_CAPTURE_EVENT_EDGE;
153150

154-
GPTIMER_setTimerConfigMode(gGpTimerHandle, conifgMode,
155-
(void *)(&inputCaptureConfig));
151+
GPTIMER_setIpCaptureMode(gGpTimerHandle, &inputCaptureConfig);
156152
/* Add Callback */
157153
GPTIMER_setCallbackFxn(gGpTimerHandle, NULL, NULL, CaptureCallbackUser);
158154
/* Start the Timer */
@@ -179,8 +175,7 @@ void gptimer_pwm_gen(void)
179175
pwmConfig.cntCompareValPWM = 4294954795,
180176
pwmConfig.outputModulationType = GPTIMER_PWM_OUT_PIN_MODULATION_TOGGLE,
181177

182-
GPTIMER_setTimerConfigMode(gGpTimerHandle, conifgMode,
183-
(void *)(&pwmConfig));
178+
GPTIMER_setPWMGenMode(gGpTimerHandle, &pwmConfig);
184179

185180
/* Start the Timer */
186181
GPTIMER_start(gGpTimerHandle);

0 commit comments

Comments
 (0)