At startup, set peripheral clock PBCLK as defined by busdiv option

in kernel configuration file.
This commit is contained in:
Sergey
2015-02-14 20:20:19 -08:00
parent d5c97a9b19
commit 9bbe938e48
2 changed files with 27 additions and 5 deletions

View File

@@ -105,7 +105,7 @@ main()
register struct fs *fs = NULL;
char inbuf[4];
char inch;
int s __attribute__((unused));
int s __attribute__((unused));
startup();
printf ("\n%s", version);
@@ -218,12 +218,12 @@ retry:
printf ("user mem = %u kbytes\n", MAXMEM / 1024);
if(minor(rootdev)==0)
{
printf ("root dev = rd%d (%d,%d)\n",
printf ("root dev = rd%d (%d,%d)\n",
major(rootdev),
major(rootdev), minor(rootdev)
);
} else {
printf ("root dev = rd%d%c (%d,%d)\n",
printf ("root dev = rd%d%c (%d,%d)\n",
major(rootdev), 'a'+minor(rootdev)-1,
major(rootdev), minor(rootdev)
);
@@ -291,12 +291,12 @@ retry:
if(minor(swapdev)==0)
{
printf ("swap dev = rd%d (%d,%d)\n",
printf ("swap dev = rd%d (%d,%d)\n",
major(swapdev),
major(swapdev), minor(swapdev)
);
} else {
printf ("swap dev = rd%d%c (%d,%d)\n",
printf ("swap dev = rd%d%c (%d,%d)\n",
major(swapdev), 'a'+minor(swapdev)-1,
major(swapdev), minor(swapdev)
);

View File

@@ -337,8 +337,30 @@ startup()
*dest1++ = *src1++;
}
#endif
#endif /* __MPLABX__ */
/*
* Setup peripheral bus clock divisor.
*/
unsigned osccon = OSCCON & ~PIC32_OSCCON_PBDIV_MASK;
#if BUS_DIV == 1
osccon |= PIC32_OSCCON_PBDIV_1;
#elif BUS_DIV == 2
osccon |= PIC32_OSCCON_PBDIV_2;
#elif BUS_DIV == 4
osccon |= PIC32_OSCCON_PBDIV_4;
#elif BUS_DIV == 8
osccon |= PIC32_OSCCON_PBDIV_8;
#else
#error Incorrect BUS_DIV value!
#endif
/* Unlock access to OSCCON register */
SYSKEY = 0;
SYSKEY = 0xaa996655;
SYSKEY = 0x556699aa;
OSCCON = osccon;
/*
* Setup UART registers.
* Compute the divisor for 115.2 kbaud.