cpu.h File Reference
CPU Clocking and Interrupts configuration macros and routines.
More...
#include "TIMotorLIB.h"
#include "IQConstants.h"
Go to the source code of this file.
Detailed Description
CPU Clocking and Interrupts configuration macros and routines.
File Name : cpu.h Project : TIMotorLIB
TI Doc:
SPRUFB0 (TMS320x2833x, 2823x System Control and Interrupts)
SPRS439H (TMS320F28335, TMS320F28334, TMS320F28332 TMS320F28235, TMS320F28234, TMS320F28232 Digital Signal Controllers (DSCs))
- Author:
- Pablo Garcia (pgarcia@isa.uniovi.es)
- Date:
- 2007
Definition in file cpu.h.
Define Documentation
#define CPUINHZ |
( |
|
) |
((Uint32)(CPUINMHZ())*(Uint32)1000000) |
#define CPUINMHZ |
( |
|
) |
(OSCCLK*DSP28_PLLCR/1000000) >> (~DSP28_DIVSEL & 0x3) |
CPU frequency in Mhz.
- Todo:
- if DSP28_DIVSEL is set to 0 --> (/4) it does not work
CPU frequency in Hz.
- Todo:
- if DSP28_DIVSEL is set to 0 --> (/4) it does not work
#define DELAY_US |
( |
A |
|
) |
DSP28x_usDelay(((((long double) A * 1000.0L) / (long double)CPU_RATE) - 9.0L) / 5.0L) |
Definition at line 67 of file cpu.h.
#define IDLE asm(" IDLE") |
main oscilator frequency in Mhz
----------------------------------------------------------------------------- Specify the PLL control register (PLLCR) and clock in divide (DIVSEL) value.
if DIVSEL = 0,1: SYSCLKOUT = (OSCCLK * PLLCR)/4 if DIVSEL = 2: SYSCLKOUT = (OSCCLK * PLLCR)/2 -----------------------------------------------------------------------------
- Examples:
- TIMotorLIBExampleHrdw/main.c, and TIMotorLIBExampleSw/main.c.
Definition at line 61 of file cpu.h.
#define SETIDLEMODE (SysCtrlRegs.LPMCR0.bit.LPM=0) |
#define US2CLOCK |
( |
A, |
|
|
PRRSC |
|
) |
( (A / (CPU_RATE / 1000.0L) ) / PRRSC) |
to clock value
Definition at line 179 of file cpu.h.
Function Documentation
static Uint32 CpuInHz |
( |
void |
|
) |
[inline, static] |
returns cpu frequency in Hz. It uses the information stored in cpuConf
- Todo:
- if dsp28_DIVSEL is set to 0 --> (/4) it does not work
Definition at line 212 of file cpu.h.
static Uint16 CpuInMhz |
( |
void |
|
) |
[inline, static] |
returns cpu frequency in Mhz. It uses the information stored in cpuConf
- Todo:
- if dsp28_DIVSEL is set to 0 --> (/4) it does not work
Definition at line 203 of file cpu.h.
This function disables the watchdog timer.
Definition at line 159 of file cpu.c.
void DSP28x_usDelay |
( |
Uint32 |
Count |
) |
|
void EnableInterrupts |
( |
void |
|
) |
|
This function enables the PIE module and CPU interrupts.
Definition at line 123 of file cpu.c.
static _iq HspCLKInMhz |
( |
void |
|
) |
[inline, static] |
returns high speed clock frequency in Mhz. It uses the information stored in cpuConf
- Todo:
- if dsp28_DIVSEL is set to 0 --> (/4) it does not work
Definition at line 221 of file cpu.h.
void InitCPU |
( |
Uint32 |
oscCLK, |
|
|
Uint16 |
dsp28_DIVSEL, |
|
|
Uint16 |
dsp28_PLLCR, |
|
|
Uint16 |
hspCLK, |
|
|
Uint16 |
lspCLK | |
|
) |
| | |
Intit CPU clocks (spru712d pp 47).
- Parameters:
-
| oscCLK | Oscillator frequency in Mhz |
| dsp28_DIVSEL | SYSCLKOUT divider Values: 0, 1 (/4); 2(/2); 3(/1) |
| dsp28_PLLCR | Pll Values: from 0 (bypass) to 10 (x10) |
| hspCLK | High speed clock pre-scaler. This clock is the clock source for:
- ADC
- Values: [0 (reset default=SYSCLKOUT/2), 1, 2, 4, 6, 8, 10, 12, 14]
|
| lspCLK | Low speed clock pre-scaler. This clock is the clock source for:
- SPI, SCI, I2C
- McBSP
- Values: [0 (reset default= SYSCLKOUT/4), 1, 2, 4, 6, 8, 10, 12, 14]
|
Definition at line 30 of file cpu.c.
void InitPeripheralClocks |
( |
void |
|
) |
|
Initializes high speed and low speed clocks.
Definition at line 333 of file cpu.c.
void InitPieCtrl |
( |
void |
|
) |
|
This function initializes the PIE control registers to a known state. All the innterrupt vectors are cleared.
Definition at line 79 of file cpu.c.
void InitPieVectTable |
( |
void |
|
) |
|
PABLO:
- Todo:
- : NOT IMPLEMENTED
void InitPll |
( |
Uint16 |
val, |
|
|
Uint16 |
clkindiv | |
|
) |
| | |
Initializes the PLL.
Definition at line 168 of file cpu.c.
void InitSysCtrl |
( |
void |
|
) |
|
This function initializes the System Control registers to a known state.
- Disables the watchdog
- Set the PLLCR for proper SYSCLKOUT frequency
- Set the pre-scaler for the high and low frequency peripheral clocks
- Enable the clocks to the peripherals
Definition at line 60 of file cpu.c.
static _iq LspCLKInMhz |
( |
void |
|
) |
[inline, static] |
returns low speed clock frequency in Mhz. It uses the information stored in cpuConf
- Todo:
- if dsp28_DIVSEL is set to 0 --> (/4) it does not work
Definition at line 230 of file cpu.h.
This function resets the watchdog timer. Enable this function for using ServiceDog in the application
Definition at line 146 of file cpu.c.
static Uint32 Us2Clock |
( |
Uint16 |
us, |
|
|
Uint16 |
prrsc | |
|
) |
| | [inline, static] |
Variable Documentation
Definition at line 27 of file cpu.c.