diff options
author | Chris Cain <cjcain@us.ibm.com> | 2017-07-19 12:33:10 -0500 |
---|---|---|
committer | Martha Broyles <mbroyles@us.ibm.com> | 2017-07-19 17:07:34 -0400 |
commit | b09f435f779579755acbbaa5286e0679a1fd5833 (patch) | |
tree | 24ceeacd62e00f570af731c53a8c17ffc06ac66c /src | |
parent | 67f48d4762cb76729fbff9063ef561de1118797d (diff) | |
download | talos-occ-b09f435f779579755acbbaa5286e0679a1fd5833.tar.gz talos-occ-b09f435f779579755acbbaa5286e0679a1fd5833.zip |
Use correct timebase and fix overflow check in busy_wait
Change-Id: I5ba3581d465ea466e855cf80c9f52d5ba1277ee0
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/43334
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: William A. Bryan <wilbryan@us.ibm.com>
Reviewed-by: Martha Broyles <mbroyles@us.ibm.com>
Diffstat (limited to 'src')
-rwxr-xr-x | src/occ_405/occbuildname.c | 2 | ||||
-rw-r--r-- | src/occ_gpe0/gpe_util.c | 19 |
2 files changed, 9 insertions, 12 deletions
diff --git a/src/occ_405/occbuildname.c b/src/occ_405/occbuildname.c index c285868..ae60fe0 100755 --- a/src/occ_405/occbuildname.c +++ b/src/occ_405/occbuildname.c @@ -34,6 +34,6 @@ volatile const char G_occ_buildname[16] __attribute__((section(".buildname"))) = #else -volatile const char G_occ_buildname[16] __attribute__((section(".buildname"))) = /*<BuildName>*/ "op_occ_170630a\0" /*</BuildName>*/ ; +volatile const char G_occ_buildname[16] __attribute__((section(".buildname"))) = /*<BuildName>*/ "op_occ_170719a\0" /*</BuildName>*/ ; #endif diff --git a/src/occ_gpe0/gpe_util.c b/src/occ_gpe0/gpe_util.c index 72a0288..b2540de 100644 --- a/src/occ_gpe0/gpe_util.c +++ b/src/occ_gpe0/gpe_util.c @@ -133,15 +133,16 @@ int wait_spi_completion(GpeErrorStruct *error, uint32_t reg, uint8_t timeout) * * Description: a counting loop to simulate sleep calls, and is ISR safe. * - * Inputs: t_microseconds: time to sleep in microseconds + * Inputs: i_microseconds: time to sleep in microseconds * * return: none * * End Function Specification */ +extern gpe_shared_data_t * G_gpe_shared_data; -void busy_wait(uint32_t t_microseconds) +void busy_wait(uint32_t i_microseconds) { uint32_t start_decrementer_value; // The decrementer register value at the beginning uint32_t end_decrementer_value; // The decrementer register value at the end @@ -150,20 +151,16 @@ void busy_wait(uint32_t t_microseconds) MFDEC(start_decrementer_value); // get the decrementer register value at the beginning current_decrementer_value = start_decrementer_value; - // multiply the delay time by the 37.5 MHz external clock frequency. - // I believe that the ppe42_mullw macro works fine, but the - // compiler parameter settings seems broken. - // @todo: This is a temporary fix, use external frequency directive. - duration = (t_microseconds << 5) - + (t_microseconds << 2) - + (t_microseconds) - + (t_microseconds >> 1); + // multiply the delay time by the external clock frequency. + duration = i_microseconds * (G_gpe_shared_data->nest_freq_div / 1000000); // Calculate the decrementer register value at the end of the busy wait period end_decrementer_value = start_decrementer_value - duration; - if(start_decrementer_value < end_decrementer_value); // decrementer overflows during the busy wait? + if(start_decrementer_value < end_decrementer_value) // decrementer overflows during the busy wait? { + PK_TRACE("busy_wait: overflow! start=0x%08X, end=0x%08X, duration=%d", + start_decrementer_value, end_decrementer_value, duration); MFDEC(current_decrementer_value); while(current_decrementer_value < end_decrementer_value) // Wait until Decrementer overflows MFDEC(current_decrementer_value); |