cim_rtns.h revision f29dbc25
1/*
2 * Copyright (c) 2006 Advanced Micro Devices, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 *
22 * Neither the name of the Advanced Micro Devices, Inc. nor the names of its
23 * contributors may be used to endorse or promote products derived from this
24 * software without specific prior written permission.
25 */
26
27 /*
28  * Cimarron function prototypes.
29  */
30
31#ifndef _cim_rtns_h
32#define _cim_rtns_h
33
34/* INCLUDE USER PARAMETER DEFINITIONS */
35
36#include "cim_parm.h"
37
38/* COMPILER OPTION FOR C++ PROGRAMS */
39
40#ifdef __cplusplus
41extern "C"
42{
43#endif
44
45/*--------------------------*/
46/* CIMARRON MEMORY POINTERS */
47/*--------------------------*/
48
49    extern unsigned char *cim_gp_ptr;
50    extern unsigned char *cim_fb_ptr;
51    extern unsigned char *cim_cmd_base_ptr;
52    extern unsigned char *cim_cmd_ptr;
53    extern unsigned char *cim_vid_ptr;
54    extern unsigned char *cim_vip_ptr;
55    extern unsigned char *cim_vg_ptr;
56
57/*----------------------------------------*/
58/* INITIALIZATION ROUTINE DEFINITIONS     */
59/*----------------------------------------*/
60
61    int init_detect_cpu(unsigned long *cpu_revision,
62        unsigned long *companion_revision);
63    unsigned long init_read_pci(unsigned long address);
64    int init_read_base_addresses(INIT_BASE_ADDRESSES * base_addresses);
65    int init_read_cpu_frequency(unsigned long *cpu_frequency);
66
67/*----------------------------------------*/
68/* GRAPHICS PROCESSOR ROUTINE DEFINITIONS */
69/*----------------------------------------*/
70
71    void gp_set_limit_on_buffer_lead(unsigned long lead);
72    void gp_set_command_buffer_base(unsigned long address,
73        unsigned long start, unsigned long stop);
74    void gp_set_frame_buffer_base(unsigned long address, unsigned long size);
75    void gp_set_bpp(int bpp);
76    void gp_declare_blt(unsigned long flags);
77    void gp_declare_vector(unsigned long flags);
78    void gp_write_parameters(void);
79    void gp_set_raster_operation(unsigned char ROP);
80    void gp_set_alpha_operation(int alpha_operation, int alpha_type,
81        int channel, int apply_alpha, unsigned char alpha);
82    void gp_set_solid_pattern(unsigned long color);
83    void gp_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor,
84        unsigned long data0, unsigned long data1, int transparent, int x,
85        int y);
86    void gp_set_pattern_origin(int x, int y);
87    void gp_set_color_pattern(unsigned long *pattern, int format, int x,
88        int y);
89    void gp_set_mono_source(unsigned long bgcolor, unsigned long fgcolor,
90        int transparent);
91    void gp_set_solid_source(unsigned long color);
92    void gp_set_source_transparency(unsigned long color, unsigned long mask);
93    void gp_program_lut(unsigned long *colors, int full_lut);
94    void gp_set_vector_pattern(unsigned long pattern, unsigned long color,
95        int length);
96    void gp_set_strides(unsigned long dst_stride, unsigned long src_stride);
97    void gp_set_source_format(int format);
98    void gp_pattern_fill(unsigned long dstoffset, unsigned long width,
99        unsigned long height);
100    void gp_screen_to_screen_blt(unsigned long dstoffset,
101        unsigned long srcoffset, unsigned long width,
102        unsigned long height, int flags);
103    void gp_screen_to_screen_convert(unsigned long dstoffset,
104        unsigned long srcoffset, unsigned long width,
105        unsigned long height, int nibble);
106    void gp_color_bitmap_to_screen_blt(unsigned long dstoffset,
107        unsigned long srcx, unsigned long width, unsigned long height,
108        unsigned char *data, long pitch);
109    void gp_color_convert_blt(unsigned long dstoffset, unsigned long srcx,
110        unsigned long width, unsigned long height, unsigned char *data,
111        long pitch);
112    void gp_custom_convert_blt(unsigned long dstoffset, unsigned long srcx,
113        unsigned long width, unsigned long height, unsigned char *data,
114        long pitch);
115    void gp_rotate_blt(unsigned long dstoffset, unsigned long srcoffset,
116        unsigned long width, unsigned long height, int degrees);
117    void gp_mono_bitmap_to_screen_blt(unsigned long dstoffset,
118        unsigned long srcx, unsigned long width, unsigned long height,
119        unsigned char *data, long stride);
120    void gp_text_blt(unsigned long dstoffset, unsigned long width,
121        unsigned long height, unsigned char *data);
122    void gp_mono_expand_blt(unsigned long dstoffset, unsigned long srcoffset,
123        unsigned long srcx, unsigned long width, unsigned long height,
124        int byte_packed);
125    void gp_antialiased_text(unsigned long dstoffset, unsigned long srcx,
126        unsigned long width, unsigned long height, unsigned char *data,
127        long stride, int fourbpp);
128  void gp_blend_mask_blt(unsigned long dstoffset, unsigned long srcx,
129	unsigned long width, unsigned long height, unsigned long,
130        long stride, int operation, int fourbpp);
131  void gp_masked_blt(unsigned long dstoffset, unsigned long width,
132        unsigned long height, unsigned long mono_srcx,
133        unsigned long color_srcx, unsigned char *mono_mask,
134        unsigned char *color_data, long mono_pitch, long color_pitch);
135    void gp_screen_to_screen_masked(unsigned long dstoffset,
136        unsigned long srcoffset, unsigned long width,
137        unsigned long height, unsigned long mono_srcx,
138        unsigned char *mono_mask, long mono_pitch);
139    void gp_bresenham_line(unsigned long dstoffset, unsigned short length,
140        unsigned short initerr, unsigned short axialerr,
141        unsigned short diagerr, unsigned long flags);
142    void gp_line_from_endpoints(unsigned long dstoffset, unsigned long x0,
143        unsigned long y0, unsigned long x1, unsigned long y1, int inclusive);
144
145    int gp_test_blt_pending(void);
146    void gp_wait_blt_pending(void);
147    void gp_wait_until_idle(void);
148    int gp_test_blt_busy(void);
149    void gp_save_state(GP_SAVE_RESTORE * gp_state);
150    void gp_restore_state(GP_SAVE_RESTORE * gp_state);
151
152/*----------------------------------------*/
153/* VIDEO GENERATOR ROUTINE DEFINITIONS    */
154/*----------------------------------------*/
155
156    int vg_delay_milliseconds(unsigned long ms);
157    int vg_set_display_mode(unsigned long src_width, unsigned long src_height,
158        unsigned long dst_width, unsigned long dst_height, int bpp, int hz,
159        unsigned long flags);
160    int vg_set_panel_mode(unsigned long src_width, unsigned long src_height,
161        unsigned long dst_width, unsigned long dst_height,
162        unsigned long panel_width, unsigned long panel_height,
163        int bpp, unsigned long flags);
164    int vg_set_tv_mode(unsigned long *src_width, unsigned long *src_height,
165        unsigned long encoder, unsigned long tvres, int bpp,
166        unsigned long flags, unsigned long h_overscan,
167        unsigned long v_overscan);
168    int vg_set_custom_mode(VG_DISPLAY_MODE * mode_params, int bpp);
169    int vg_set_display_bpp(int bpp);
170    int vg_get_display_mode_index(VG_QUERY_MODE * query);
171    int vg_get_display_mode_information(unsigned int index,
172        VG_DISPLAY_MODE * vg_mode);
173    int vg_get_display_mode_count(void);
174    int vg_get_current_display_mode(VG_DISPLAY_MODE * current_display,
175        int *bpp);
176    int vg_set_scaler_filter_coefficients(long h_taps[][5], long v_taps[][3]);
177    int vg_configure_flicker_filter(unsigned long flicker_strength,
178        int flicker_alpha);
179    int vg_set_clock_frequency(unsigned long frequency,
180        unsigned long pll_flags);
181    int vg_set_border_color(unsigned long border_color);
182    int vg_set_cursor_enable(int enable);
183    int vg_set_mono_cursor_colors(unsigned long bkcolor,
184        unsigned long fgcolor);
185    int vg_set_cursor_position(long xpos, long ypos,
186        VG_PANNING_COORDINATES * panning);
187    int vg_set_mono_cursor_shape32(unsigned long memoffset,
188        unsigned long *andmask, unsigned long *xormask,
189        unsigned long x_hotspot, unsigned long y_hotspot);
190    int vg_set_mono_cursor_shape64(unsigned long memoffset,
191        unsigned long *andmask, unsigned long *xormask,
192        unsigned long x_hotspot, unsigned long y_hotspot);
193    int vg_set_color_cursor_shape(unsigned long memoffset,
194        unsigned char *data, unsigned long width, unsigned long height,
195        long pitch, unsigned long x_hotspot, unsigned long y_hotspot);
196    int vg_pan_desktop(unsigned long x, unsigned long y,
197        VG_PANNING_COORDINATES * panning);
198    int vg_set_display_offset(unsigned long address);
199    int vg_set_display_pitch(unsigned long pitch);
200    int vg_set_display_palette_entry(unsigned long index,
201        unsigned long palette);
202    int vg_set_display_palette(unsigned long *palette);
203    int vg_set_compression_enable(int enable);
204    int vg_configure_compression(VG_COMPRESSION_DATA * comp_data);
205    int vg_test_timing_active(void);
206    int vg_test_vertical_active(void);
207    int vg_wait_vertical_blank(void);
208    int vg_test_even_field(void);
209    int vg_configure_line_interrupt(VG_INTERRUPT_PARAMS * interrupt_info);
210    unsigned long vg_test_and_clear_interrupt(void);
211    unsigned long vg_test_flip_status(void);
212    int vg_save_state(VG_SAVE_RESTORE * vg_state);
213    int vg_restore_state(VG_SAVE_RESTORE * vg_state);
214
215/*----------------------------------------*/
216/* VIDEO GENERATOR READ ROUTINES          */
217/*----------------------------------------*/
218
219    unsigned long vg_read_graphics_crc(int crc_source);
220    unsigned long vg_read_window_crc(int crc_source, unsigned long x,
221        unsigned long y, unsigned long width, unsigned long height);
222    int vg_get_scaler_filter_coefficients(long h_taps[][5], long v_taps[][3]);
223    int vg_get_flicker_filter_configuration(unsigned long *strength,
224        int *flicker_alpha);
225    unsigned long vg_get_display_pitch(void);
226    unsigned long vg_get_frame_buffer_line_size(void);
227    unsigned long vg_get_current_vline(void);
228    unsigned long vg_get_display_offset(void);
229    int vg_get_cursor_info(VG_CURSOR_DATA * cursor_data);
230    int vg_get_display_palette_entry(unsigned long index,
231        unsigned long *entry);
232    unsigned long vg_get_border_color(void);
233    int vg_get_display_palette(unsigned long *palette);
234    int vg_get_compression_info(VG_COMPRESSION_DATA * comp_data);
235    int vg_get_compression_enable(void);
236    int vg_get_valid_bit(int line);
237
238/*----------------------------------------*/
239/* DISPLAY FILTER ROUTINE DEFINITIONS     */
240/*----------------------------------------*/
241
242    int df_set_crt_enable(int crt_output);
243    int df_set_panel_enable(int panel_output);
244    int df_configure_video_source(DF_VIDEO_SOURCE_PARAMS * video_source_odd,
245        DF_VIDEO_SOURCE_PARAMS * video_source_even);
246    int df_set_video_offsets(int even, unsigned long y_offset,
247        unsigned long u_offset, unsigned long v_offset);
248    int df_set_video_scale(unsigned long src_width, unsigned long src_height,
249        unsigned long dst_width, unsigned long dst_height,
250        unsigned long flags);
251    int df_set_video_position(DF_VIDEO_POSITION * video_window);
252    int df_set_video_filter_coefficients(long taps[][4], int phase256);
253    int df_set_video_enable(int enable, unsigned long flags);
254    int df_set_video_color_key(unsigned long key, unsigned long mask,
255        int graphics);
256    int df_set_video_palette(unsigned long *palette);
257    int df_set_video_palette_entry(unsigned long index,
258        unsigned long palette);
259    int df_configure_video_cursor_color_key(DF_VIDEO_CURSOR_PARAMS *
260        cursor_color_key);
261    int df_set_video_cursor_color_key_enable(int enable);
262    int df_configure_alpha_window(int window,
263        DF_ALPHA_REGION_PARAMS * alpha_data);
264    int df_set_alpha_window_enable(int window, int enable);
265    int df_set_no_ck_outside_alpha(int enable);
266    int df_set_video_request(unsigned long x, unsigned long y);
267    int df_set_output_color_space(int color_space);
268    int df_set_output_path(int format);
269    unsigned long df_test_video_flip_status(void);
270    int df_save_state(DF_SAVE_RESTORE * gp_state);
271    int df_restore_state(DF_SAVE_RESTORE * gp_state);
272
273/*----------------------------------------*/
274/*    DISPLAY FILTER READ ROUTINES        */
275/*----------------------------------------*/
276
277    unsigned long df_read_composite_crc(int crc_source);
278    unsigned long df_read_composite_window_crc(unsigned long x,
279        unsigned long y, unsigned long width, unsigned long height,
280        int source);
281    unsigned long df_read_panel_crc(void);
282    int df_get_video_enable(int *enable, unsigned long *flags);
283    int df_get_video_source_configuration(DF_VIDEO_SOURCE_PARAMS *
284        video_source_odd, DF_VIDEO_SOURCE_PARAMS * video_source_even);
285    int df_get_video_position(DF_VIDEO_POSITION * video_window);
286    int df_get_video_scale(unsigned long *x_scale, unsigned long *y_scale);
287    int df_get_video_filter_coefficients(long taps[][4], int *phase256);
288    int df_get_video_color_key(unsigned long *key, unsigned long *mask,
289        int *graphics);
290    int df_get_video_palette_entry(unsigned long index,
291        unsigned long *palette);
292    int df_get_video_palette(unsigned long *palette);
293    int df_get_video_cursor_color_key(DF_VIDEO_CURSOR_PARAMS *
294        cursor_color_key);
295    int df_get_video_cursor_color_key_enable(void);
296    int df_get_alpha_window_configuration(int window,
297        DF_ALPHA_REGION_PARAMS * alpha_data);
298    int df_get_alpha_window_enable(int window);
299    int df_get_video_request(unsigned long *x, unsigned long *y);
300    int df_get_output_color_space(int *color_space);
301
302/*----------------------------------------*/
303/*        MSR ROUTINE DEFINITIONS         */
304/*----------------------------------------*/
305
306    int msr_init_table(void);
307    int msr_create_geodelink_table(GEODELINK_NODE * gliu_nodes);
308    int msr_create_device_list(GEODELINK_NODE * gliu_nodes, int max_devices);
309    int msr_read64(unsigned long device, unsigned long msr_register,
310        Q_WORD * msr_value);
311    int msr_write64(unsigned long device, unsigned long msr_register,
312        Q_WORD * msr_value);
313
314/*----------------------------------------*/
315/*        VIP ROUTINE DEFINITIONS         */
316/*----------------------------------------*/
317
318    int vip_initialize(VIPSETMODEBUFFER * buffer);
319    int vip_update_601_params(VIP_601PARAMS * buffer);
320    int vip_terminate(void);
321    int vip_configure_capture_buffers(int buffer_type,
322        VIPINPUTBUFFER * buffer);
323    int vip_toggle_video_offsets(int buffer_type, VIPINPUTBUFFER * buffer);
324    int vip_max_address_enable(unsigned long max_address, int enable);
325    int vip_set_interrupt_enable(unsigned long mask, int enable);
326    unsigned long vip_get_interrupt_state(void);
327    int vip_set_capture_state(unsigned long state);
328    int vip_set_vsync_error(unsigned long vertical_count,
329        unsigned long window_before, unsigned long window_after, int enable);
330    int vip_configure_fifo(unsigned long fifo_type, unsigned long fifo_size);
331    int vip_set_loopback_enable(int bEnable);
332    int vip_configure_genlock(VIPGENLOCKBUFFER * buffer);
333    int vip_set_genlock_enable(int bEnable);
334    int vip_configure_pages(int page_count, unsigned long page_offset);
335    int vip_set_interrupt_line(int line);
336    int vip_reset(void);
337    int vip_set_subwindow_enable(VIPSUBWINDOWBUFFER * buffer);
338    int vip_reset_interrupt_state(unsigned long interrupt_mask);
339
340    int vip_save_state(VIPSTATEBUFFER * save_buffer);
341    int vip_restore_state(VIPSTATEBUFFER * restore_buffer);
342    int vip_set_power_characteristics(VIPPOWERBUFFER * buffer);
343    int vip_set_priority_characteristics(VIPPRIORITYBUFFER * buffer);
344    int vip_set_debug_characteristics(VIPDEBUGBUFFER * buffer);
345    int vip_test_genlock_active(void);
346    int vip_test_signal_status(void);
347    unsigned long vip_get_current_field(void);
348
349/*----------------------------------------*/
350/*        VIP READ ROUTINES               */
351/*----------------------------------------*/
352
353    int vip_get_current_mode(VIPSETMODEBUFFER * buffer);
354    int vip_get_601_configuration(VIP_601PARAMS * buffer);
355    int vip_get_buffer_configuration(int buffer_type,
356        VIPINPUTBUFFER * buffer);
357    int vip_get_genlock_configuration(VIPGENLOCKBUFFER * buffer);
358    int vip_get_genlock_enable(void);
359    int vip_is_buffer_update_latched(void);
360    unsigned long vip_get_capture_state(void);
361    unsigned long vip_get_current_line(void);
362    unsigned long vip_read_fifo(unsigned long fifo_address);
363    int vip_write_fifo(unsigned long fifo_address, unsigned long fifo_data);
364    int vip_enable_fifo_access(int enable);
365    int vip_get_capability_characteristics(VIPCAPABILITIESBUFFER * buffer);
366    int vip_get_power_characteristics(VIPPOWERBUFFER * buffer);
367    int vip_get_priority_characteristics(VIPPRIORITYBUFFER * buffer);
368
369/*----------------------------------------*/
370/*        VOP ROUTINE DEFINITIONS         */
371/*----------------------------------------*/
372
373    int vop_set_vbi_window(VOPVBIWINDOWBUFFER * buffer);
374    int vop_enable_vbi_output(int enable);
375    int vop_set_configuration(VOPCONFIGURATIONBUFFER * config);
376    int vop_save_state(VOPSTATEBUFFER * save_buffer);
377    int vop_restore_state(VOPSTATEBUFFER * save_buffer);
378
379/*----------------------------------------*/
380/*        VOP READ ROUTINES               */
381/*----------------------------------------*/
382
383    int vop_get_current_mode(VOPCONFIGURATIONBUFFER * config);
384    int vop_get_vbi_configuration(VOPVBIWINDOWBUFFER * buffer);
385    int vop_get_vbi_enable(void);
386    unsigned long vop_get_crc(void);
387    unsigned long vop_read_vbi_crc(void);
388
389/* CLOSE BRACKET FOR C++ COMPLILATION */
390
391#ifdef __cplusplus
392}
393#endif
394
395#endif
396