summaryrefslogtreecommitdiff
path: root/drivers/char/ftimer.h
blob: 7ee985a1b4765cacb192cebd6063f71213abe5c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 * drivers/char/ftimer.h
 *
 * Copyright (C) 2012 Freescale Semiconductor, Inc.  All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */


struct mvf_ftm_request{
	unsigned long	 clocksource;
	unsigned long	 divider;
	unsigned short	 start;
	unsigned short	 end;
};

typedef enum {
	FMT0,
	FMT1,
	FMT_AVAILABLE_CHANNEL
} ftm_channel;


//	clock source
#define FTM_PARAM_CLK_NOCLOCK		0x00
#define FTM_PARAM_CLK_SYSTEMCLOCK	0x01
#define FTM_PARAM_CLK_FIXEDFREQ		0x02
#define FTM_PARAM_CLK_EXTERNAL		0x03

//	divider
#define FTM_PARAM_DIV_BY_1			0x00
#define FTM_PARAM_DIV_BY_2			0x01
#define FTM_PARAM_DIV_BY_4			0x02
#define FTM_PARAM_DIV_BY_8			0x03
#define FTM_PARAM_DIV_BY_16			0x04
#define FTM_PARAM_DIV_BY_32			0x05
#define FTM_PARAM_DIV_BY_64			0x06
#define FTM_PARAM_DIV_BY_128		0x07

int ftm_alloc_timer( ftm_channel ch);
int ftm_free_timer( int timer_handle);
int ftm_enable_timer( int timer_handle);
int ftm_disable_timer( int timer_handle);
int ftm_read_counter( int timer_handle, unsigned long *counter);
int ftm_param_set( int timer_handle, struct mvf_ftm_request *req, void (*event_handler)(int));