mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 19:36:35 +08:00
SAMA5: Enable the 32.768 crystal if SCHED_TICKLESS is selected
This commit is contained in:
@@ -20,6 +20,11 @@ config SAMA5D3XPLAINED_528MHZ
|
|||||||
|
|
||||||
endchoice # CPU Frequency
|
endchoice # CPU Frequency
|
||||||
|
|
||||||
|
config SAMA5D3XPLAINED_SLOWCLOCK
|
||||||
|
bool
|
||||||
|
default y if SCHED_TICKLESS
|
||||||
|
default n if !SCHED_TICKLESS
|
||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "SAMA5D3-Xplained DRAM Type"
|
prompt "SAMA5D3-Xplained DRAM Type"
|
||||||
default SAMA5D3XPLAINED_MT47H128M16RT
|
default SAMA5D3XPLAINED_MT47H128M16RT
|
||||||
|
|||||||
@@ -2392,7 +2392,8 @@ Tickless OS
|
|||||||
NOTE: In most cases, the slow clock will be used as the timer/counter
|
NOTE: In most cases, the slow clock will be used as the timer/counter
|
||||||
input. You should enable the 32.768KHz crystal for the slow clock by
|
input. You should enable the 32.768KHz crystal for the slow clock by
|
||||||
calling sam_sckc_enable(). Otherwise, you will be doing all system
|
calling sam_sckc_enable(). Otherwise, you will be doing all system
|
||||||
timing using the RC clock!
|
timing using the RC clock! UPDATE: This will now be selected by default
|
||||||
|
when you configure for TICKLESS support.
|
||||||
|
|
||||||
SAMA5 Timer Usage
|
SAMA5 Timer Usage
|
||||||
-----------------
|
-----------------
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include "sam_sckc.h"
|
||||||
#include "sama5d3-xplained.h"
|
#include "sama5d3-xplained.h"
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
@@ -67,6 +68,12 @@
|
|||||||
|
|
||||||
void sam_boardinitialize(void)
|
void sam_boardinitialize(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SAMA5D3XPLAINED_SLOWCLOCK
|
||||||
|
/* Enable the external slow clock */
|
||||||
|
|
||||||
|
sam_sckc_enable(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Configure SPI chip selects if 1) SPI is enable, and 2) the weak function
|
/* Configure SPI chip selects if 1) SPI is enable, and 2) the weak function
|
||||||
* sam_spiinitialize() has been brought into the link.
|
* sam_spiinitialize() has been brought into the link.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -248,6 +248,11 @@ config SAMA5D3xEK_OV2640_DEMO
|
|||||||
|
|
||||||
endif # VIDEO_OV2640
|
endif # VIDEO_OV2640
|
||||||
|
|
||||||
|
config SAMA5D3xEK_SLOWCLOCK
|
||||||
|
bool
|
||||||
|
default y if SCHED_TICKLESS
|
||||||
|
default n if !SCHED_TICKLESS
|
||||||
|
|
||||||
if AUDIO_WM8904
|
if AUDIO_WM8904
|
||||||
|
|
||||||
config SAMA5D3xEK_WM8904_I2CFREQUENCY
|
config SAMA5D3xEK_WM8904_I2CFREQUENCY
|
||||||
@@ -266,6 +271,7 @@ choice
|
|||||||
|
|
||||||
config SAMA5D3xEK_WM8904_SRCMAIN
|
config SAMA5D3xEK_WM8904_SRCMAIN
|
||||||
bool "Main Clock (12MHz)"
|
bool "Main Clock (12MHz)"
|
||||||
|
select SAMA5D3xEK_SLOWCLOCK
|
||||||
|
|
||||||
config SAMA5D3xEK_WM8904_SRCSCK
|
config SAMA5D3xEK_WM8904_SRCSCK
|
||||||
bool "Slow XTAL (32.768KHz)"
|
bool "Slow XTAL (32.768KHz)"
|
||||||
|
|||||||
@@ -2708,7 +2708,8 @@ Tickless OS
|
|||||||
NOTE: In most cases, the slow clock will be used as the timer/counter
|
NOTE: In most cases, the slow clock will be used as the timer/counter
|
||||||
input. You should enable the 32.768KHz crystal for the slow clock by
|
input. You should enable the 32.768KHz crystal for the slow clock by
|
||||||
calling sam_sckc_enable(). Otherwise, you will be doing all system
|
calling sam_sckc_enable(). Otherwise, you will be doing all system
|
||||||
timing using the RC clock!
|
timing using the RC clock! UPDATE: This will now be selected by default
|
||||||
|
when you configure for TICKLESS support.
|
||||||
|
|
||||||
SAMA5 Timer Usage
|
SAMA5 Timer Usage
|
||||||
-----------------
|
-----------------
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include "sam_sckc.h"
|
||||||
#include "sama5d3x-ek.h"
|
#include "sama5d3x-ek.h"
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
@@ -60,13 +61,19 @@
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* All SAMA5 architectures must provide the following entry point. This entry
|
* All SAMA5 architectures must provide the following entry point. This entry
|
||||||
* point is called early in the intitialization -- after all memory has been
|
* point is called early in the initialization -- after all memory has been
|
||||||
* configured and mapped but before any devices have been initialized.
|
* configured and mapped but before any devices have been initialized.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
void sam_boardinitialize(void)
|
void sam_boardinitialize(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SAMA5D3xEK_SLOWCLOCK
|
||||||
|
/* Enable the external slow clock */
|
||||||
|
|
||||||
|
sam_sckc_enable(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Configure SPI chip selects if 1) SPI is enable, and 2) the weak function
|
/* Configure SPI chip selects if 1) SPI is enable, and 2) the weak function
|
||||||
* sam_spiinitialize() has been brought into the link.
|
* sam_spiinitialize() has been brought into the link.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -56,7 +56,6 @@
|
|||||||
#include "sam_pio.h"
|
#include "sam_pio.h"
|
||||||
#include "sam_twi.h"
|
#include "sam_twi.h"
|
||||||
#include "sam_ssc.h"
|
#include "sam_ssc.h"
|
||||||
#include "sam_sckc.h"
|
|
||||||
#include "sam_pck.h"
|
#include "sam_pck.h"
|
||||||
|
|
||||||
#include "sama5d3x-ek.h"
|
#include "sama5d3x-ek.h"
|
||||||
@@ -293,9 +292,10 @@ int sam_wm8904_initialize(int minor)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_SAMA5D3xEK_WM8904_SRCSCK
|
#ifdef CONFIG_SAMA5D3xEK_WM8904_SRCSCK
|
||||||
/* Drive the DAC with the slow clock (32.768 KHz) */
|
/* Drive the DAC with the slow clock (32.768 KHz). The slow clock was
|
||||||
|
* enabled in sam_boot.c if needed.
|
||||||
|
*/
|
||||||
|
|
||||||
sam_sckc_enable(true);
|
|
||||||
(void)sam_pck_configure(PCK0, PCKSRC_SCK, BOARD_SLOWCLK_FREQUENCY);
|
(void)sam_pck_configure(PCK0, PCKSRC_SCK, BOARD_SLOWCLK_FREQUENCY);
|
||||||
#else
|
#else
|
||||||
/* Drive the DAC with the main clock (12 MHz) */
|
/* Drive the DAC with the main clock (12 MHz) */
|
||||||
|
|||||||
@@ -268,6 +268,11 @@ config SAMA5D4EK_CHANNEL
|
|||||||
Selects the PWM channel number that will be used to perform the PWM
|
Selects the PWM channel number that will be used to perform the PWM
|
||||||
test. See apps/examples/pwm.
|
test. See apps/examples/pwm.
|
||||||
|
|
||||||
|
config SAMA5D4EK_SLOWCLOCK
|
||||||
|
bool
|
||||||
|
default y if SCHED_TICKLESS
|
||||||
|
default n if !SCHED_TICKLESS
|
||||||
|
|
||||||
if AUDIO_WM8904
|
if AUDIO_WM8904
|
||||||
|
|
||||||
config SAMA5D4EK_WM8904_I2CFREQUENCY
|
config SAMA5D4EK_WM8904_I2CFREQUENCY
|
||||||
@@ -289,6 +294,7 @@ config SAMA5D4EK_WM8904_SRCMAIN
|
|||||||
|
|
||||||
config SAMA5D4EK_WM8904_SRCSCK
|
config SAMA5D4EK_WM8904_SRCSCK
|
||||||
bool "Slow XTAL (32.768KHz)"
|
bool "Slow XTAL (32.768KHz)"
|
||||||
|
select SAMA5D4EK_SLOWCLOCK
|
||||||
|
|
||||||
endchoice # WM8904 MCLK source
|
endchoice # WM8904 MCLK source
|
||||||
endif # AUDIO_WM8904
|
endif # AUDIO_WM8904
|
||||||
|
|||||||
@@ -3172,7 +3172,14 @@ Tickless OS
|
|||||||
NOTE: In most cases, the slow clock will be used as the timer/counter
|
NOTE: In most cases, the slow clock will be used as the timer/counter
|
||||||
input. You should enable the 32.768KHz crystal for the slow clock by
|
input. You should enable the 32.768KHz crystal for the slow clock by
|
||||||
calling sam_sckc_enable(). Otherwise, you will be doing all system
|
calling sam_sckc_enable(). Otherwise, you will be doing all system
|
||||||
timing using the RC clock!
|
timing using the RC clock! UPDATE: This will now be selected by default
|
||||||
|
when you configure for TICKLESS support.
|
||||||
|
|
||||||
|
UPDATE: As of this writing (2014-8-11), the Tickless support is
|
||||||
|
functional. However, the timing for all delays appears to be half the
|
||||||
|
duration that it should be. I don't see anything wrong with the setup
|
||||||
|
and I am suspecting that there may be something I don't understand about
|
||||||
|
the counting frequency.
|
||||||
|
|
||||||
SAMA5 Timer Usage
|
SAMA5 Timer Usage
|
||||||
-----------------
|
-----------------
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include "sam_sckc.h"
|
||||||
#include "sama5d4-ek.h"
|
#include "sama5d4-ek.h"
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
@@ -60,13 +61,19 @@
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* All SAMA5 architectures must provide the following entry point. This entry
|
* All SAMA5 architectures must provide the following entry point. This entry
|
||||||
* point is called early in the intitialization -- after all memory has been
|
* point is called early in the initialization -- after all memory has been
|
||||||
* configured and mapped but before any devices have been initialized.
|
* configured and mapped but before any devices have been initialized.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
void sam_boardinitialize(void)
|
void sam_boardinitialize(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SAMA5D4EK_SLOWCLOCK
|
||||||
|
/* Enable the external slow clock */
|
||||||
|
|
||||||
|
sam_sckc_enable(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Configure SPI chip selects if 1) SPI is enable, and 2) the weak function
|
/* Configure SPI chip selects if 1) SPI is enable, and 2) the weak function
|
||||||
* sam_spiinitialize() has been brought into the link.
|
* sam_spiinitialize() has been brought into the link.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -56,7 +56,6 @@
|
|||||||
#include "sam_pio.h"
|
#include "sam_pio.h"
|
||||||
#include "sam_twi.h"
|
#include "sam_twi.h"
|
||||||
#include "sam_ssc.h"
|
#include "sam_ssc.h"
|
||||||
#include "sam_sckc.h"
|
|
||||||
#include "sam_pck.h"
|
#include "sam_pck.h"
|
||||||
|
|
||||||
#include "sama5d4-ek.h"
|
#include "sama5d4-ek.h"
|
||||||
@@ -293,9 +292,10 @@ int sam_wm8904_initialize(int minor)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_SAMA5D4EK_WM8904_SRCSCK
|
#ifdef CONFIG_SAMA5D4EK_WM8904_SRCSCK
|
||||||
/* Drive the DAC with the slow clock (32.768 KHz) */
|
/* Drive the DAC with the slow clock (32.768 KHz). The slow clock was
|
||||||
|
* enabled in sam_boot.c if needed.
|
||||||
|
*/
|
||||||
|
|
||||||
sam_sckc_enable(true);
|
|
||||||
(void)sam_pck_configure(PCK2, PCKSRC_SCK, BOARD_SLOWCLK_FREQUENCY);
|
(void)sam_pck_configure(PCK2, PCKSRC_SCK, BOARD_SLOWCLK_FREQUENCY);
|
||||||
#else
|
#else
|
||||||
/* Drive the DAC with the main clock (12 MHz) */
|
/* Drive the DAC with the main clock (12 MHz) */
|
||||||
|
|||||||
Reference in New Issue
Block a user