Part Number: TMS320F280049C
Hi,
In the C2000 DriverLib, file sysctrl.c, function "SysCtl_setClock()" I can see the following code:
//
// Set divider to produce slower output frequency to limit current
// increase.
//
divSel = (uint16_t)(config & SYSCTL_SYSDIV_M) >> SYSCTL_SYSDIV_S;
EALLOW;
if(divSel != (126U / 2U))
{
HWREGH(CLKCFG_BASE + SYSCTL_O_SYSCLKDIVSEL) =
(HWREGH(CLKCFG_BASE + SYSCTL_O_SYSCLKDIVSEL) &
~(uint16_t)SYSCTL_SYSCLKDIVSEL_PLLSYSCLKDIV_M) |
(divSel + 1U);
}
else
{
HWREGH(CLKCFG_BASE + SYSCTL_O_SYSCLKDIVSEL) =
(HWREGH(CLKCFG_BASE + SYSCTL_O_SYSCLKDIVSEL) &
~(uint16_t)SYSCTL_SYSCLKDIVSEL_PLLSYSCLKDIV_M) | divSel;
}
EDIS;
Question 1: Why setting PLLSYSCLKDIV to (divsel+1) only in the special case of (divsel != 63) prior to setting it to divsel later?
Question 2: Why is there a typecast "(uint16_t)" and later when setting PLLSYSCLKDIV to divsel (section under "Set the divider to user value") there is no typecast?
Regards,
Patrick