This commit is contained in:
joan 2016-05-01 11:28:56 +01:00
parent c8c19be97a
commit 09adafce0c
2 changed files with 15 additions and 5 deletions

View File

@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/> For more information, please refer to <http://unlicense.org/>
*/ */
/* pigpio version 51 */ /* pigpio version 52 */
/* include ------------------------------------------------------- */ /* include ------------------------------------------------------- */
@ -1144,6 +1144,7 @@ static struct timespec libStarted;
static uint32_t reportedLevel = 0; static uint32_t reportedLevel = 0;
static int waveClockInited = 0; static int waveClockInited = 0;
static int PWMClockInited = 0;
static volatile gpioStats_t gpioStats; static volatile gpioStats_t gpioStats;
@ -7551,6 +7552,7 @@ int initInitialise(void)
DBG(DBG_STARTUP, ""); DBG(DBG_STARTUP, "");
waveClockInited = 0; waveClockInited = 0;
PWMClockInited = 0;
clock_gettime(CLOCK_REALTIME, &libStarted); clock_gettime(CLOCK_REALTIME, &libStarted);
@ -8958,6 +8960,7 @@ int gpioWaveTxSend(unsigned wave_id, unsigned wave_mode)
stopHardwarePWM(); stopHardwarePWM();
initClock(0); /* initialise secondary clock */ initClock(0); /* initialise secondary clock */
waveClockInited = 1; waveClockInited = 1;
PWMClockInited = 0;
} }
p = rawWaveCBAdr(waveInfo[wave_id].topCB); p = rawWaveCBAdr(waveInfo[wave_id].topCB);
@ -9194,6 +9197,7 @@ int gpioWaveChain(char *buf, unsigned bufSize)
stopHardwarePWM(); stopHardwarePWM();
initClock(0); /* initialise secondary clock */ initClock(0); /* initialise secondary clock */
waveClockInited = 1; waveClockInited = 1;
PWMClockInited = 0;
} }
dmaOut[DMA_CS] = DMA_CHANNEL_RESET; dmaOut[DMA_CS] = DMA_CHANNEL_RESET;
@ -11413,12 +11417,17 @@ int gpioHardwarePWM(
old_PWM_CTL = pwmReg[PWM_CTL] & old_PWM_CTL = pwmReg[PWM_CTL] &
(PWM_CTL_PWEN1 | PWM_CTL_MSEN1 | PWM_CTL_PWEN2 | PWM_CTL_MSEN2); (PWM_CTL_PWEN1 | PWM_CTL_MSEN1 | PWM_CTL_PWEN2 | PWM_CTL_MSEN2);
if (!PWMClockInited)
{
pwmReg[PWM_CTL] = 0; pwmReg[PWM_CTL] = 0;
myGpioDelay(10); myGpioDelay(10);
initHWClk(CLK_PWMCTL, CLK_PWMDIV, CLK_CTL_SRC_PLLD, 2, 0, 0); initHWClk(CLK_PWMCTL, CLK_PWMDIV, CLK_CTL_SRC_PLLD, 2, 0, 0);
PWMClockInited = 1;
}
if (pwm == 0) if (pwm == 0)
{ {
pwmReg[PWM_RNG1] = real_range; pwmReg[PWM_RNG1] = real_range;
@ -11657,6 +11666,7 @@ unsigned gpioHardwareRevision(void)
if (sscanf(buf+10, "%x%c", &rev, &term) == 2) if (sscanf(buf+10, "%x%c", &rev, &term) == 2)
{ {
if (term != '\n') rev = 0; if (term != '\n') rev = 0;
else rev &= 0xFFFFFF; /* mask out warranty bit */
} }
} }
} }

View File

@ -31,7 +31,7 @@ For more information, please refer to <http://unlicense.org/>
#include <stdint.h> #include <stdint.h>
#include <pthread.h> #include <pthread.h>
#define PIGPIO_VERSION 51 #define PIGPIO_VERSION 52
/*TEXT /*TEXT