0.3.1
Free-Running Timer (FRT)

Macros

#define CPU_FRT_CLOCK_DIV_8   0x00
 
#define CPU_FRT_CLOCK_DIV_32   0x01
 
#define CPU_FRT_CLOCK_DIV_128   0x02
 
#define CPU_FRT_CLOCK_DIV_RISING_EDGE   0x03
 Not yet documented.
 
#define CPU_FRT_NTSC_320_8_COUNT_1MS   0x0D1F
 
#define CPU_FRT_NTSC_320_32_COUNT_1MS   0x0348
 
#define CPU_FRT_NTSC_320_128_COUNT_1MS   0x00D2
 
#define CPU_FRT_NTSC_352_8_COUNT_1MS   0x0DFC
 
#define CPU_FRT_NTSC_352_32_COUNT_1MS   0x037F
 
#define CPU_FRT_NTSC_352_128_COUNT_1MS   0x00E0
 
#define CPU_FRT_PAL_320_8_COUNT_1MS   0x0D08
 
#define CPU_FRT_PAL_320_32_COUNT_1MS   0x0342
 
#define CPU_FRT_PAL_320_128_COUNT_1MS   0x00D0
 
#define CPU_FRT_PAL_352_8_COUNT_1MS   0x0DFC
 
#define CPU_FRT_PAL_352_32_COUNT_1MS   0x037F
 
#define CPU_FRT_PAL_352_128_COUNT_1MS   0x00E0
 

Typedefs

typedef void(* cpu_frt_ihr_t) (void)
 Callback type.
 

Functions

static void cpu_frt_count_set (uint16_t count)
 Set the 2-byte FRT tick count.
 
static uint16_t cpu_frt_count_get (void)
 Obtain the current 2-byte FRT tick count.
 
static uint16_t cpu_frt_input_capture_get (void)
 Obtain the ICR value.
 
static uint8_t cpu_frt_interrupt_priority_get (void)
 Obtain the interrupt priority level for CPU-FRT.
 
static void cpu_frt_interrupt_priority_set (uint8_t priority)
 Set the interrupt priority level for CPU-FRT.
 
void cpu_frt_init (uint8_t clock_div)
 Fully initialize the CPU-FRT depending with a specific clock divisor.
 

Detailed Description

Description goes here.

Macro Definition Documentation

◆ CPU_FRT_CLOCK_DIV_8

#define CPU_FRT_CLOCK_DIV_8   0x00
Deprecated:
To be removed and replaced as an enum.

◆ CPU_FRT_CLOCK_DIV_32

#define CPU_FRT_CLOCK_DIV_32   0x01
Deprecated:
To be removed and replaced as an enum.

◆ CPU_FRT_CLOCK_DIV_128

#define CPU_FRT_CLOCK_DIV_128   0x02
Deprecated:
To be removed and replaced as an enum.

◆ CPU_FRT_NTSC_320_8_COUNT_1MS

#define CPU_FRT_NTSC_320_8_COUNT_1MS   0x0D1F

Tick count value representing 1ms for a NTSC machine in 320-mode with a \(\frac{\phi}{8}\) clock divisor.

◆ CPU_FRT_NTSC_320_32_COUNT_1MS

#define CPU_FRT_NTSC_320_32_COUNT_1MS   0x0348

Tick count value representing 1ms for a NTSC machine in 320-mode with a \(\frac{\phi}{32}\) clock divisor.

◆ CPU_FRT_NTSC_320_128_COUNT_1MS

#define CPU_FRT_NTSC_320_128_COUNT_1MS   0x00D2

Tick count value representing 1ms for a NTSC machine in 320-mode with a \(\frac{\phi}{128}\) clock divisor.

◆ CPU_FRT_NTSC_352_8_COUNT_1MS

#define CPU_FRT_NTSC_352_8_COUNT_1MS   0x0DFC

Tick count value representing 1ms for a NTSC machine in 352-mode with a \(\frac{\phi}{8}\) clock divisor.

◆ CPU_FRT_NTSC_352_32_COUNT_1MS

#define CPU_FRT_NTSC_352_32_COUNT_1MS   0x037F

Tick count value representing 1ms for a NTSC machine in 352-mode with a \(\frac{\phi}{32}\) clock divisor.

◆ CPU_FRT_NTSC_352_128_COUNT_1MS

#define CPU_FRT_NTSC_352_128_COUNT_1MS   0x00E0

Tick count value representing 1ms for a NTSC machine in 352-mode with a \(\frac{\phi}{128}\) clock divisor.

◆ CPU_FRT_PAL_320_8_COUNT_1MS

#define CPU_FRT_PAL_320_8_COUNT_1MS   0x0D08

Tick count value representing 1ms for a PAL machine in 320-mode with a \(\frac{\phi}{8}\) clock divisor.

◆ CPU_FRT_PAL_320_32_COUNT_1MS

#define CPU_FRT_PAL_320_32_COUNT_1MS   0x0342

Tick count value representing 1ms for a PAL machine in 320-mode with a \(\frac{\phi}{32}\) clock divisor.

◆ CPU_FRT_PAL_320_128_COUNT_1MS

#define CPU_FRT_PAL_320_128_COUNT_1MS   0x00D0

Tick count value representing 1ms for a PAL machine in 320-mode with a \(\frac{\phi}{128}\) clock divisor.

◆ CPU_FRT_PAL_352_8_COUNT_1MS

#define CPU_FRT_PAL_352_8_COUNT_1MS   0x0DFC

Tick count value representing 1ms for a PAL machine in 352-mode with a \(\frac{\phi}{8}\) clock divisor.

◆ CPU_FRT_PAL_352_32_COUNT_1MS

#define CPU_FRT_PAL_352_32_COUNT_1MS   0x037F

Tick count value representing 1ms for a PAL machine in 352-mode with a \(\frac{\phi}{32}\) clock divisor.

◆ CPU_FRT_PAL_352_128_COUNT_1MS

#define CPU_FRT_PAL_352_128_COUNT_1MS   0x00E0

Tick count value representing 1ms for a PAL machine in 352-mode with a \(\frac{\phi}{128}\) clock divisor.

Typedef Documentation

◆ cpu_frt_ihr_t

typedef void(* cpu_frt_ihr_t) (void)

Function Documentation

◆ cpu_frt_count_set()

static void cpu_frt_count_set ( uint16_t  count)
inlinestatic

Set the 2-byte FRT tick count.

Parameters
countThe 2-byte tick value to set.

◆ cpu_frt_count_get()

static uint16_t cpu_frt_count_get ( void  )
inlinestatic

Obtain the current 2-byte FRT tick count.

Returns
Return the 2-byte FRT tick count.

◆ cpu_frt_input_capture_get()

static uint16_t cpu_frt_input_capture_get ( void  )
inlinestatic

Obtain the ICR value.

When a rising edge or falling edge of the input capture signal is detected, the current FRT tick count value is transferred to the ICR.

Returns
The ICR value.

◆ cpu_frt_interrupt_priority_get()

static uint8_t cpu_frt_interrupt_priority_get ( void  )
inlinestatic

Obtain the interrupt priority level for CPU-FRT.

Returns
The interrupt priority level ranging from 0 to 15.

◆ cpu_frt_interrupt_priority_set()

static void cpu_frt_interrupt_priority_set ( uint8_t  priority)
inlinestatic

Set the interrupt priority level for CPU-FRT.

Parameters
priorityThe priority ranging from 0 to 15.

◆ cpu_frt_init()

void cpu_frt_init ( uint8_t  clock_div)

Fully initialize the CPU-FRT depending with a specific clock divisor.

This function is heavy handed in that it resets the interrupt priority levels for all FRT related interrupts, clears the interrupt handlers, and resets the FRT count.

This function will properly initialize the CPU-FRT on either the master or slave CPU.

Parameters
clock_divThe clock divisor.