File: oz263.h

package info (click to toggle)
digitools 1.03-1.2
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, jessie, jessie-kfreebsd, stretch
  • size: 232 kB
  • ctags: 356
  • sloc: ansic: 2,143; makefile: 260; sh: 36
file content (116 lines) | stat: -rw-r--r-- 3,203 bytes parent folder | download | duplicates (3)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
  oz263.h:   Functions for accessing the oz263 chip. Also,
             find and return the SiS96x i2c bus device for
             the digimatrix setpanel program, for both 2.4
             and 2.6 kernels.
  Copyright (c) 2005 Andrew Calkin <calkina@geexbox.org> and
                     Ben Potter <linux@bpuk.org>

  Based heavily on the codebase for the header given directly below,
  and the original setpanel.c code, written by Richard Taylor,
  Ben Potter and Cyril Lacoux.

  Original header:
    i2cbusses: Print the installed i2c busses for both 2.4 and 2.6 kernels.
               Part of user-space programs to access for I2C
               devices.
    Copyright (c) 1999-2003  Frodo Looijaard <frodol@dds.nl> and
                             Mark D. Studebaker <mdsxyz123@yahoo.com>

    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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* Address on the I2C bus of the AudioDJ (OZ268) IC */
#define AUDIODJ_I2C_ADDRESS       0x49

typedef enum _control
{
	SEEK_DOWN = 0,
	SEEK_UP,
	FINE_TUNE_DOWN,
	FINE_TUNE_UP,
	CHANNEL_PREV,
	CHANNEL_NEXT,
	STORE_START,
	STORE_CANCEL,
	STORE_COMMIT
} CONTROL;

typedef enum _radio_mode
{
    OFF_MODE = 0,
    AM_RADIO,
    FM_RADIO,
    CD_MODE,
    HD_MODE
} RADIO_MODE;

/* Dots are in reg 0x06
    0x00 = No Dots.
    0x01 = middle dot
    0x02 = bottom dot
    0x03 = both dots */
typedef enum _dots
{
    DOTS_NONE = 0,
    DOTS_MIDDLE,
    DOTS_BOTTOM,
    DOTS_BOTH
} DOTS;

/* First digit:
   0x80 of 0x00 makes LED not light up for representative mode.

   All digits:
   0x0f = blank
   0x0e = 'C' (2nd Digit = 'D') CD MODE LED
   0x0d = 'P' (2nd Digit = '-') HD MODE LED
   0x0c = '-' (2nd Digit = 'M') Invalid MODE
   0x0b = 'A'                   AM MODE LED
   0x0a = 'F'                   FM MODE LED
   < 0x0a = Number.i
*/

typedef enum _leds
{
    LED_NONE = 0x8f,
    LED_AM = 0x0b,
    LED_FM = 0x0a,
    LED_CD = 0x0e,
    LED_HD = 0x0d,
} LED;


/* Writing to Reg 0x07 does nothing,
   0x08 = PLAY LED, 0x09 = PAUSE LED */
typedef enum _pp
{
    PP_NONE = 0x07,
    PP_PLAY = 0x08,
    PP_PAUSE = 0x09
} PP;


int find_i2c_sis96x(void);
int oz263_write_byte_data(int file, char reg, char data);
int oz263_write_byte(int file, char data);
int oz263_read_byte(int file);
void oz263_radio_control(int file, CONTROL control);
void oz263_radio_mode(int file, RADIO_MODE radio_mode);
void oz263_display(int file, char digits[6], LED led, PP pp,
                       DOTS dots, BOOL reinit);
int oz263_I2C_init(void);
void print_error_msg(void);
int sysfs_i2c_check(FILE *f);