Ktam3874/pitx software guide – Kontron KTAM3874-pITX User Manual

Page 60

Advertising
background image

KTD-S0057-I

Page 56 Linux® Programming Examples (DebianTM)


KTAM3874/pITX Software Guide


#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>

/****** Do not forget to enable TIMER4 to TIMER7 in U-Boot Setup ******/
#define TIMER4_BASE_ADDR

0x48044000

#define TIMER5_BASE_ADDR

0x48046000

#define TIMER6_BASE_ADDR

0x48048000

#define TIMER7_BASE_ADDR

0x4804A000

#define TIMER_BASE

TIMER4_BASE_ADDR

/* Register definitions */
#define TIOCP_CFG

0x10

#define TCLR

0x38

#define TCRR

0x3C

#define TLDR

0x40

#define TTGR

0x44

#define TMAR

0x4C

#define TSICR

0x54

/* Register bits */
#define TIOCP_SOFTRES

0x01

#define TIOCP_SMARTIDLE

0x08

#define TCLR_ST

0x01

#define TCLR_AR

0x02

#define TCLR_CE

0x40

#define TCLR_SCPWM

0x80

#define TCLR_TRGOVFLMAT

0x800

#define TCLR_TRG

0xC00

#define TCLR_PT

0x1000


#define TCLR_GPOCFG

0x4000

#define TSICR_SFT

0x02

#define TSICR_POSTED

0x04

#define RESET_TIMEOUT

100000

#define STOP_TIMEOUT

2000000

/* Frequency related definitions */
#define FREQ_VAL

1024 /* VAL = 128 approx. 155 kHz - VAL = 1024 approx. 20 kHz */

#define RELOAD_VAL

0xFFFFFFFF - FREQ_VAL

#define DUTY_MAX

255

#define MAP_SIZE

4096UL

#define MAP_MASK

(MAP_SIZE - 1)

static int fd;
static void *virt_addr;
static void *map_base;

Advertising
This manual is related to the following products: