PropWare
C++ objects and CMake build system for Parallax Propeller
Home
Download
Getting Started
Documentation
Reference
About
Related Links
Namespace List
Class List
File List
Examples
Build System
File List
File Members
propsideworkspace
Propeller GCC Demos
graphics
tv.h
Go to the documentation of this file.
1
6
#ifndef __TV_H__
7
#define __TV_H__
8
9
#include <stdint.h>
10
14
typedef
volatile
struct
TV_struct
15
{
16
uint32_t status ;
// 0/1/2 = off/visible/invisible read-only
17
uint32_t enable ;
// 0/? = off/on write-only
18
uint32_t pins ;
// %ppmmm = pins write-only
19
uint32_t mode ;
// %ccinp = chroma,interlace,ntsc/pal,swap write-only
20
uint32_t
screen
;
// pointer to screen (words) write-only
21
uint32_t colors ;
// pointer to colors (longs) write-only
22
uint32_t ht ;
// horizontal tiles write-only
23
uint32_t vt ;
// vertical tiles write-only
24
uint32_t hx ;
// horizontal cell expansion write-only
25
uint32_t vx ;
// vertical cell expansion write-only
26
uint32_t ho ;
// horizontal offset write-only
27
uint32_t vo ;
// vertical offset write-only
28
uint32_t broadcast ;
// broadcast frequency (Hz) write-only
29
uint32_t auralcog ;
// aural fm cog write-only
30
}
TV_t
;
31
35
#define TV_BASEBAND_PIN(pin) ((pin & 0x38) << 1) | (((pin & 4) == 4) ? 0x5 : 0)
36
42
int
TV_start
(
TV_t
* tvptr);
43
47
void
TV_stop
(
void
);
48
49
50
/*
51
''
52
''___
53
''VAR 'TV parameters - 14 contiguous longs
54
''
55
'' long tv_status '0/1/2 = off/invisible/visible read-only
56
'' long tv_enable '0/non-0 = off/on write-only
57
'' long tv_pins '%pppmmmm = pin group, pin group mode write-only
58
'' long tv_mode '%tccip = tile,chroma,interlace,ntsc/pal write-only
59
'' long tv_screen 'pointer to screen (words) write-only
60
'' long tv_colors 'pointer to colors (longs) write-only
61
'' long tv_ht 'horizontal tiles write-only
62
'' long tv_vt 'vertical tiles write-only
63
'' long tv_hx 'horizontal tile expansion write-only
64
'' long tv_vx 'vertical tile expansion write-only
65
'' long tv_ho 'horizontal offset write-only
66
'' long tv_vo 'vertical offset write-only
67
'' long tv_broadcast 'broadcast frequency (Hz) write-only
68
'' long tv_auralcog 'aural fm cog write-only
69
''
70
''The preceding VAR section may be copied into your code.
71
''After setting variables, do start(@tv_status) to start driver.
72
''
73
''All parameters are reloaded each superframe, allowing you to make live
74
''changes. To minimize flicker, correlate changes with tv_status.
75
''
76
''Experimentation may be required to optimize some parameters.
77
''
78
''Parameter descriptions:
79
'' _________
80
'' tv_status
81
''
82
'' driver sets this to indicate status:
83
'' 0: driver disabled (tv_enable = 0 or CLKFREQ < requirement)
84
'' 1: currently outputting invisible sync data
85
'' 2: currently outputting visible screen data
86
'' _________
87
'' tv_enable
88
''
89
'' 0: disable (pins will be driven low, reduces power)
90
'' non-0: enable
91
'' _______
92
'' tv_pins
93
''
94
'' bits 6..4 select pin group:
95
'' %000: pins 7..0
96
'' %001: pins 15..8
97
'' %010: pins 23..16
98
'' %011: pins 31..24
99
'' %100: pins 39..32
100
'' %101: pins 47..40
101
'' %110: pins 55..48
102
'' %111: pins 63..56
103
''
104
'' bits 3..0 select pin group mode:
105
'' %0000: %0000_0111 - baseband
106
'' %0001: %0000_0111 - broadcast
107
'' %0010: %0000_1111 - baseband + chroma
108
'' %0011: %0000_1111 - broadcast + aural
109
'' %0100: %0111_0000 broadcast -
110
'' %0101: %0111_0000 baseband -
111
'' %0110: %1111_0000 broadcast + aural -
112
'' %0111: %1111_0000 baseband + chroma -
113
'' %1000: %0111_0111 broadcast baseband
114
'' %1001: %0111_0111 baseband broadcast
115
'' %1010: %0111_1111 broadcast baseband + chroma
116
'' %1011: %0111_1111 baseband broadcast + aural
117
'' %1100: %1111_0111 broadcast + aural baseband
118
'' %1101: %1111_0111 baseband + chroma broadcast
119
'' %1110: %1111_1111 broadcast + aural baseband + chroma
120
'' %1111: %1111_1111 baseband + chroma broadcast + aural
121
'' -----------------------------------------------------------
122
'' active pins top nibble bottom nibble
123
''
124
'' the baseband signal nibble is arranged as:
125
'' bit 3: chroma signal for s-video (attach via 560-ohm resistor)
126
'' bits 2..0: baseband video (sum 270/560/1100-ohm resistors to form 75-ohm 1V signal)
127
''
128
'' the broadcast signal nibble is arranged as:
129
'' bit 3: aural subcarrier (sum 560-ohm resistor into network below)
130
'' bits 2..0: visual carrier (sum 270/560/1100-ohm resistors to form 75-ohm 1V signal)
131
'' _______
132
'' tv_mode
133
''
134
'' bit 4 selects between 16x16 and 16x32 pixel tiles:
135
'' 0: 16x16 pixel tiles (tileheight = 16)
136
'' 1: 16x32 pixel tiles (tileheight = 32)
137
''
138
'' bit 3 controls chroma mixing into broadcast:
139
'' 0: mix chroma into broadcast (color)
140
'' 1: strip chroma from broadcast (black/white)
141
''
142
'' bit 2 controls chroma mixing into baseband:
143
'' 0: mix chroma into baseband (composite color)
144
'' 1: strip chroma from baseband (black/white or s-video)
145
''
146
'' bit 1 controls interlace:
147
'' 0: progressive scan (243 display lines for NTSC, 286 for PAL)
148
'' less flicker, good for motion
149
'' 1: interlaced scan (486 display lines for NTSC, 572 for PAL)
150
'' doubles the vertical display lines, good for text
151
''
152
'' bit 0 selects NTSC or PAL format
153
'' 0: NTSC
154
'' 3016 horizontal display ticks
155
'' 243 or 486 (interlaced) vertical display lines
156
'' CLKFREQ must be at least 14_318_180 (4 * 3_579_545 Hz)*
157
'' 1: PAL
158
'' 3692 horizontal display ticks
159
'' 286 or 572 (interlaced) vertical display lines
160
'' CLKFREQ must be at least 17_734_472 (4 * 4_433_618 Hz)*
161
''
162
'' * driver will disable itself while CLKFREQ is below requirement
163
'' _________
164
'' tv_screen
165
''
166
'' pointer to words which define screen contents (left-to-right, top-to-bottom)
167
'' number of words must be tv_ht * tv_vt
168
'' each word has two bitfields: a 6-bit colorset ptr and a 10-bit pixelgroup ptr
169
'' bits 15..10: select the colorset* for the associated pixel tile
170
'' bits 9..0: select the pixelgroup** address %ppppppppppcccc00 (p=address, c=0..15)
171
''
172
'' * colorsets are longs which each define four 8-bit colors
173
''
174
'' ** pixelgroups are <tileheight> longs which define (left-to-right, top-to-bottom) the 2-bit
175
'' (four color) pixels that make up a 16x16 or a 32x32 pixel tile
176
'' _________
177
'' tv_colors
178
''
179
'' pointer to longs which define colorsets
180
'' number of longs must be 1..64
181
'' each long has four 8-bit fields which define colors for 2-bit (four color) pixels
182
'' first long's bottom color is also used as the screen background color
183
'' 8-bit color fields are as follows:
184
'' bits 7..4: chroma data (0..15 = blue..green..red..)*
185
'' bit 3: controls chroma modulation (0=off, 1=on)
186
'' bits 2..0: 3-bit luminance level:
187
'' values 0..1: reserved for sync - don't use
188
'' values 2..7: valid luminance range, modulation adds/subtracts 1 (beware of 7)
189
'' value 0 may be modulated to produce a saturated color toggling between levels 1 and 7
190
''
191
'' * because of TV's limitations, it doesn't look good when chroma changes abruptly -
192
'' rather, use luminance - change chroma only against a black or white background for
193
'' best appearance
194
'' _____
195
'' tv_ht
196
''
197
'' horizontal number pixel tiles - must be at least 1
198
'' practical limit is 40 for NTSC, 50 for PAL
199
'' _____
200
'' tv_vt
201
''
202
'' vertical number of pixel tiles - must be at least 1
203
'' practical limit is 13 for NTSC, 15 for PAL (26/30 max for interlaced NTSC/PAL)
204
'' _____
205
'' tv_hx
206
''
207
'' horizontal tile expansion factor - must be at least 3 for NTSC, 4 for PAL
208
''
209
'' make sure 16 * tv_ht * tv_hx + ||tv_ho + 32 is less than the horizontal display ticks
210
'' _____
211
'' tv_vx
212
''
213
'' vertical tile expansion factor - must be at least 1
214
''
215
'' make sure <tileheight> * tv_vt * tv_vx + ||tv_vo + 1 is less than the display lines
216
'' _____
217
'' tv_ho
218
''
219
'' horizontal offset in ticks - pos/neg value (0 for centered image)
220
'' shifts the display right/left
221
'' _____
222
'' tv_vo
223
''
224
'' vertical offset in lines - pos/neg value (0 for centered image)
225
'' shifts the display up/down
226
'' ____________
227
'' tv_broadcast
228
''
229
'' broadcast frequency expressed in Hz (ie channel 2 is 55_250_000)
230
'' if 0, modulator is turned off - saves power
231
''
232
'' broadcasting requires CLKFREQ to be at least 16_000_000
233
'' while CLKFREQ is below 16_000_000, modulator will be turned off
234
'' ___________
235
'' tv_auralcog
236
''
237
'' selects cog to supply aural fm signal - 0..7
238
'' uses ctra pll output from selected cog
239
''
240
'' in NTSC, the offset frequency must be 4.5MHz and the max bandwidth +-25KHz
241
'' in PAL, the offset frequency and max bandwidth vary by PAL type
242
*/
243
244
#endif
245
// __TV_H__
246
247
/*
248
* Port of Chip Gracy's TV.spin
249
*
250
'' ***************************************
251
'' * TV Driver v1.1 *
252
'' * Author: Chip Gracey *
253
'' * Copyright (c) 2004 Parallax, Inc. *
254
'' * See end of file for terms of use. *
255
'' ***************************************
256
*
257
+------------------------------------------------------------------------------------------------------------------------------+
258
¦ TERMS OF USE: MIT License ¦
259
+------------------------------------------------------------------------------------------------------------------------------¦
260
¦Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation ¦
261
¦files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, ¦
262
¦modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software¦
263
¦is furnished to do so, subject to the following conditions: ¦
264
¦ ¦
265
¦The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.¦
266
¦ ¦
267
¦THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE ¦
268
¦WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR ¦
269
¦COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ¦
270
¦ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ¦
271
+------------------------------------------------------------------------------------------------------------------------------+
272
*/
TV_start
int TV_start(TV_t *tvptr)
Definition:
tv.c:17
TV_struct
Definition:
tv.h:14
TV_stop
void TV_stop(void)
TV_t
volatile struct TV_struct TV_t
screen
Definition:
badgetools.h:1610
Generated on Sat Aug 27 2016 00:58:10 for PropWare by
1.8.12