cim_rtns.h revision 04007eba
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#endif
43
44/*--------------------------*/
45/* CIMARRON MEMORY POINTERS */
46/*--------------------------*/
47
48    extern unsigned char *cim_gp_ptr;
49    extern unsigned char *cim_fb_ptr;
50    extern unsigned char *cim_cmd_base_ptr;
51    extern unsigned char *cim_cmd_ptr;
52    extern unsigned char *cim_vid_ptr;
53    extern unsigned char *cim_vip_ptr;
54    extern unsigned char *cim_vg_ptr;
55
56/*----------------------------------------*/
57/* INITIALIZATION ROUTINE DEFINITIONS     */
58/*----------------------------------------*/
59
60    int init_detect_cpu(unsigned long *cpu_revision,
61                        unsigned long *companion_revision);
62    unsigned long init_read_pci(unsigned long address);
63    int init_read_base_addresses(INIT_BASE_ADDRESSES * base_addresses);
64    int init_read_cpu_frequency(unsigned long *cpu_frequency);
65
66/*----------------------------------------*/
67/* GRAPHICS PROCESSOR ROUTINE DEFINITIONS */
68/*----------------------------------------*/
69
70    void gp_set_limit_on_buffer_lead(unsigned long lead);
71    void gp_set_command_buffer_base(unsigned long address,
72                                    unsigned long start, unsigned long stop);
73    void gp_set_frame_buffer_base(unsigned long address, unsigned long size);
74    void gp_set_bpp(int bpp);
75    void gp_declare_blt(unsigned long flags);
76    void gp_declare_vector(unsigned long flags);
77    void gp_write_parameters(void);
78    void gp_set_raster_operation(unsigned char ROP);
79    void gp_set_alpha_operation(int alpha_operation, int alpha_type,
80                                int channel, int apply_alpha,
81                                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,
85                             int transparent, int x, 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, int y);
88    void gp_set_mono_source(unsigned long bgcolor, unsigned long fgcolor,
89                            int transparent);
90    void gp_set_solid_source(unsigned long color);
91    void gp_set_source_transparency(unsigned long color, unsigned long mask);
92    void gp_program_lut(unsigned long *colors, int full_lut);
93    void gp_set_vector_pattern(unsigned long pattern, unsigned long color,
94                               int length);
95    void gp_set_strides(unsigned long dst_stride, unsigned long src_stride);
96    void gp_set_source_format(int format);
97    void gp_pattern_fill(unsigned long dstoffset, unsigned long width,
98                         unsigned long height);
99    void gp_screen_to_screen_blt(unsigned long dstoffset,
100                                 unsigned long srcoffset, unsigned long width,
101                                 unsigned long height, int flags);
102    void gp_screen_to_screen_convert(unsigned long dstoffset,
103                                     unsigned long srcoffset,
104                                     unsigned long width, unsigned long height,
105                                     int nibble);
106    void gp_color_bitmap_to_screen_blt(unsigned long dstoffset,
107                                       unsigned long srcx, unsigned long width,
108                                       unsigned long height,
109                                       unsigned char *data, long pitch);
110    void gp_color_convert_blt(unsigned long dstoffset, unsigned long srcx,
111                              unsigned long width, unsigned long height,
112                              unsigned char *data, long pitch);
113    void gp_custom_convert_blt(unsigned long dstoffset, unsigned long srcx,
114                               unsigned long width, unsigned long height,
115                               unsigned char *data, long pitch);
116    void gp_rotate_blt(unsigned long dstoffset, unsigned long srcoffset,
117                       unsigned long width, unsigned long height, int degrees);
118    void gp_mono_bitmap_to_screen_blt(unsigned long dstoffset,
119                                      unsigned long srcx, unsigned long width,
120                                      unsigned long height, unsigned char *data,
121                                      long stride);
122    void gp_text_blt(unsigned long dstoffset, unsigned long width,
123                     unsigned long height, unsigned char *data);
124    void gp_mono_expand_blt(unsigned long dstoffset, unsigned long srcoffset,
125                            unsigned long srcx, unsigned long width,
126                            unsigned long height, int byte_packed);
127    void gp_antialiased_text(unsigned long dstoffset, unsigned long srcx,
128                             unsigned long width, unsigned long height,
129                             unsigned char *data, long stride, int fourbpp);
130    void gp_blend_mask_blt(unsigned long dstoffset, unsigned long srcx,
131                           unsigned long width, unsigned long height,
132                           unsigned long, long stride, int operation,
133                           int fourbpp);
134    void gp_masked_blt(unsigned long dstoffset, unsigned long width,
135                       unsigned long height, unsigned long mono_srcx,
136                       unsigned long color_srcx, unsigned char *mono_mask,
137                       unsigned char *color_data, long mono_pitch,
138                       long color_pitch);
139    void gp_screen_to_screen_masked(unsigned long dstoffset,
140                                    unsigned long srcoffset,
141                                    unsigned long width, unsigned long height,
142                                    unsigned long mono_srcx,
143                                    unsigned char *mono_mask, long mono_pitch);
144    void gp_bresenham_line(unsigned long dstoffset, unsigned short length,
145                           unsigned short initerr, unsigned short axialerr,
146                           unsigned short diagerr, unsigned long flags);
147    void gp_line_from_endpoints(unsigned long dstoffset, unsigned long x0,
148                                unsigned long y0, unsigned long x1,
149                                unsigned long y1, int inclusive);
150
151    int gp_test_blt_pending(void);
152    void gp_wait_blt_pending(void);
153    void gp_wait_until_idle(void);
154    int gp_test_blt_busy(void);
155    void gp_save_state(GP_SAVE_RESTORE * gp_state);
156    void gp_restore_state(GP_SAVE_RESTORE * gp_state);
157
158/*----------------------------------------*/
159/* VIDEO GENERATOR ROUTINE DEFINITIONS    */
160/*----------------------------------------*/
161
162    int vg_delay_milliseconds(unsigned long ms);
163    int vg_set_display_mode(unsigned long src_width, unsigned long src_height,
164                            unsigned long dst_width, unsigned long dst_height,
165                            int bpp, int hz, unsigned long flags);
166    int vg_set_panel_mode(unsigned long src_width, unsigned long src_height,
167                          unsigned long dst_width, unsigned long dst_height,
168                          unsigned long panel_width, unsigned long panel_height,
169                          int bpp, unsigned long flags);
170    int vg_set_tv_mode(unsigned long *src_width, unsigned long *src_height,
171                       unsigned long encoder, unsigned long tvres, int bpp,
172                       unsigned long flags, unsigned long h_overscan,
173                       unsigned long v_overscan);
174    int vg_set_custom_mode(VG_DISPLAY_MODE * mode_params, int bpp);
175    int vg_set_display_bpp(int bpp);
176    int vg_get_display_mode_index(VG_QUERY_MODE * query);
177    int vg_get_display_mode_information(unsigned int index,
178                                        VG_DISPLAY_MODE * vg_mode);
179    int vg_get_display_mode_count(void);
180    int vg_get_current_display_mode(VG_DISPLAY_MODE * current_display,
181                                    int *bpp);
182    int vg_set_scaler_filter_coefficients(long h_taps[][5], long v_taps[][3]);
183    int vg_configure_flicker_filter(unsigned long flicker_strength,
184                                    int flicker_alpha);
185    int vg_set_clock_frequency(unsigned long frequency,
186                               unsigned long pll_flags);
187    int vg_set_border_color(unsigned long border_color);
188    int vg_set_cursor_enable(int enable);
189    int vg_set_mono_cursor_colors(unsigned long bkcolor, unsigned long fgcolor);
190    int vg_set_cursor_position(long xpos, long ypos,
191                               VG_PANNING_COORDINATES * panning);
192    int vg_set_mono_cursor_shape32(unsigned long memoffset,
193                                   unsigned long *andmask,
194                                   unsigned long *xormask,
195                                   unsigned long x_hotspot,
196                                   unsigned long y_hotspot);
197    int vg_set_mono_cursor_shape64(unsigned long memoffset,
198                                   unsigned long *andmask,
199                                   unsigned long *xormask,
200                                   unsigned long x_hotspot,
201                                   unsigned long y_hotspot);
202    int vg_set_color_cursor_shape(unsigned long memoffset, unsigned char *data,
203                                  unsigned long width, unsigned long height,
204                                  long pitch, unsigned long x_hotspot,
205                                  unsigned long y_hotspot);
206    int vg_pan_desktop(unsigned long x, unsigned long y,
207                       VG_PANNING_COORDINATES * panning);
208    int vg_set_display_offset(unsigned long address);
209    int vg_set_display_pitch(unsigned long pitch);
210    int vg_set_display_palette_entry(unsigned long index,
211                                     unsigned long palette);
212    int vg_set_display_palette(unsigned long *palette);
213    int vg_set_compression_enable(int enable);
214    int vg_configure_compression(VG_COMPRESSION_DATA * comp_data);
215    int vg_test_timing_active(void);
216    int vg_test_vertical_active(void);
217    int vg_wait_vertical_blank(void);
218    int vg_test_even_field(void);
219    int vg_configure_line_interrupt(VG_INTERRUPT_PARAMS * interrupt_info);
220    unsigned long vg_test_and_clear_interrupt(void);
221    unsigned long vg_test_flip_status(void);
222    int vg_save_state(VG_SAVE_RESTORE * vg_state);
223    int vg_restore_state(VG_SAVE_RESTORE * vg_state);
224
225/*----------------------------------------*/
226/* VIDEO GENERATOR READ ROUTINES          */
227/*----------------------------------------*/
228
229    unsigned long vg_read_graphics_crc(int crc_source);
230    unsigned long vg_read_window_crc(int crc_source, unsigned long x,
231                                     unsigned long y, unsigned long width,
232                                     unsigned long height);
233    int vg_get_scaler_filter_coefficients(long h_taps[][5], long v_taps[][3]);
234    int vg_get_flicker_filter_configuration(unsigned long *strength,
235                                            int *flicker_alpha);
236    unsigned long vg_get_display_pitch(void);
237    unsigned long vg_get_frame_buffer_line_size(void);
238    unsigned long vg_get_current_vline(void);
239    unsigned long vg_get_display_offset(void);
240    int vg_get_cursor_info(VG_CURSOR_DATA * cursor_data);
241    int vg_get_display_palette_entry(unsigned long index, unsigned long *entry);
242    unsigned long vg_get_border_color(void);
243    int vg_get_display_palette(unsigned long *palette);
244    int vg_get_compression_info(VG_COMPRESSION_DATA * comp_data);
245    int vg_get_compression_enable(void);
246    int vg_get_valid_bit(int line);
247
248/*----------------------------------------*/
249/* DISPLAY FILTER ROUTINE DEFINITIONS     */
250/*----------------------------------------*/
251
252    int df_set_crt_enable(int crt_output);
253    int df_set_panel_enable(int panel_output);
254    int df_configure_video_source(DF_VIDEO_SOURCE_PARAMS * video_source_odd,
255                                  DF_VIDEO_SOURCE_PARAMS * video_source_even);
256    int df_set_video_offsets(int even, unsigned long y_offset,
257                             unsigned long u_offset, unsigned long v_offset);
258    int df_set_video_scale(unsigned long src_width, unsigned long src_height,
259                           unsigned long dst_width, unsigned long dst_height,
260                           unsigned long flags);
261    int df_set_video_position(DF_VIDEO_POSITION * video_window);
262    int df_set_video_filter_coefficients(long taps[][4], int phase256);
263    int df_set_video_enable(int enable, unsigned long flags);
264    int df_set_video_color_key(unsigned long key, unsigned long mask,
265                               int graphics);
266    int df_set_video_palette(unsigned long *palette);
267    int df_set_video_palette_entry(unsigned long index, unsigned long palette);
268    int df_configure_video_cursor_color_key(DF_VIDEO_CURSOR_PARAMS *
269                                            cursor_color_key);
270    int df_set_video_cursor_color_key_enable(int enable);
271    int df_configure_alpha_window(int window,
272                                  DF_ALPHA_REGION_PARAMS * alpha_data);
273    int df_set_alpha_window_enable(int window, int enable);
274    int df_set_no_ck_outside_alpha(int enable);
275    int df_set_video_request(unsigned long x, unsigned long y);
276    int df_set_output_color_space(int color_space);
277    int df_set_output_path(int format);
278    unsigned long df_test_video_flip_status(void);
279    int df_save_state(DF_SAVE_RESTORE * gp_state);
280    int df_restore_state(DF_SAVE_RESTORE * gp_state);
281
282/*----------------------------------------*/
283/*    DISPLAY FILTER READ ROUTINES        */
284/*----------------------------------------*/
285
286    unsigned long df_read_composite_crc(int crc_source);
287    unsigned long df_read_composite_window_crc(unsigned long x,
288                                               unsigned long y,
289                                               unsigned long width,
290                                               unsigned long height,
291                                               int source);
292    unsigned long df_read_panel_crc(void);
293    int df_get_video_enable(int *enable, unsigned long *flags);
294    int df_get_video_source_configuration(DF_VIDEO_SOURCE_PARAMS *
295                                          video_source_odd,
296                                          DF_VIDEO_SOURCE_PARAMS *
297                                          video_source_even);
298    int df_get_video_position(DF_VIDEO_POSITION * video_window);
299    int df_get_video_scale(unsigned long *x_scale, unsigned long *y_scale);
300    int df_get_video_filter_coefficients(long taps[][4], int *phase256);
301    int df_get_video_color_key(unsigned long *key, unsigned long *mask,
302                               int *graphics);
303    int df_get_video_palette_entry(unsigned long index, unsigned long *palette);
304    int df_get_video_palette(unsigned long *palette);
305    int df_get_video_cursor_color_key(DF_VIDEO_CURSOR_PARAMS *
306                                      cursor_color_key);
307    int df_get_video_cursor_color_key_enable(void);
308    int df_get_alpha_window_configuration(int window,
309                                          DF_ALPHA_REGION_PARAMS * alpha_data);
310    int df_get_alpha_window_enable(int window);
311    int df_get_video_request(unsigned long *x, unsigned long *y);
312    int df_get_output_color_space(int *color_space);
313
314/*----------------------------------------*/
315/*        MSR ROUTINE DEFINITIONS         */
316/*----------------------------------------*/
317
318    int msr_init_table(void);
319    int msr_create_geodelink_table(GEODELINK_NODE * gliu_nodes);
320    int msr_create_device_list(GEODELINK_NODE * gliu_nodes, int max_devices);
321    int msr_read64(unsigned long device, unsigned long msr_register,
322                   Q_WORD * msr_value);
323    int msr_write64(unsigned long device, unsigned long msr_register,
324                    Q_WORD * msr_value);
325
326/*----------------------------------------*/
327/*        VIP ROUTINE DEFINITIONS         */
328/*----------------------------------------*/
329
330    int vip_initialize(VIPSETMODEBUFFER * buffer);
331    int vip_update_601_params(VIP_601PARAMS * buffer);
332    int vip_terminate(void);
333    int vip_configure_capture_buffers(int buffer_type, VIPINPUTBUFFER * buffer);
334    int vip_toggle_video_offsets(int buffer_type, VIPINPUTBUFFER * buffer);
335    int vip_max_address_enable(unsigned long max_address, int enable);
336    int vip_set_interrupt_enable(unsigned long mask, int enable);
337    unsigned long vip_get_interrupt_state(void);
338    int vip_set_capture_state(unsigned long state);
339    int vip_set_vsync_error(unsigned long vertical_count,
340                            unsigned long window_before,
341                            unsigned long window_after, int enable);
342    int vip_configure_fifo(unsigned long fifo_type, unsigned long fifo_size);
343    int vip_set_loopback_enable(int bEnable);
344    int vip_configure_genlock(VIPGENLOCKBUFFER * buffer);
345    int vip_set_genlock_enable(int bEnable);
346    int vip_configure_pages(int page_count, unsigned long page_offset);
347    int vip_set_interrupt_line(int line);
348    int vip_reset(void);
349    int vip_set_subwindow_enable(VIPSUBWINDOWBUFFER * buffer);
350    int vip_reset_interrupt_state(unsigned long interrupt_mask);
351
352    int vip_save_state(VIPSTATEBUFFER * save_buffer);
353    int vip_restore_state(VIPSTATEBUFFER * restore_buffer);
354    int vip_set_power_characteristics(VIPPOWERBUFFER * buffer);
355    int vip_set_priority_characteristics(VIPPRIORITYBUFFER * buffer);
356    int vip_set_debug_characteristics(VIPDEBUGBUFFER * buffer);
357    int vip_test_genlock_active(void);
358    int vip_test_signal_status(void);
359    unsigned long vip_get_current_field(void);
360
361/*----------------------------------------*/
362/*        VIP READ ROUTINES               */
363/*----------------------------------------*/
364
365    int vip_get_current_mode(VIPSETMODEBUFFER * buffer);
366    int vip_get_601_configuration(VIP_601PARAMS * buffer);
367    int vip_get_buffer_configuration(int buffer_type, VIPINPUTBUFFER * buffer);
368    int vip_get_genlock_configuration(VIPGENLOCKBUFFER * buffer);
369    int vip_get_genlock_enable(void);
370    int vip_is_buffer_update_latched(void);
371    unsigned long vip_get_capture_state(void);
372    unsigned long vip_get_current_line(void);
373    unsigned long vip_read_fifo(unsigned long fifo_address);
374    int vip_write_fifo(unsigned long fifo_address, unsigned long fifo_data);
375    int vip_enable_fifo_access(int enable);
376    int vip_get_capability_characteristics(VIPCAPABILITIESBUFFER * buffer);
377    int vip_get_power_characteristics(VIPPOWERBUFFER * buffer);
378    int vip_get_priority_characteristics(VIPPRIORITYBUFFER * buffer);
379
380/*----------------------------------------*/
381/*        VOP ROUTINE DEFINITIONS         */
382/*----------------------------------------*/
383
384    int vop_set_vbi_window(VOPVBIWINDOWBUFFER * buffer);
385    int vop_enable_vbi_output(int enable);
386    int vop_set_configuration(VOPCONFIGURATIONBUFFER * config);
387    int vop_save_state(VOPSTATEBUFFER * save_buffer);
388    int vop_restore_state(VOPSTATEBUFFER * save_buffer);
389
390/*----------------------------------------*/
391/*        VOP READ ROUTINES               */
392/*----------------------------------------*/
393
394    int vop_get_current_mode(VOPCONFIGURATIONBUFFER * config);
395    int vop_get_vbi_configuration(VOPVBIWINDOWBUFFER * buffer);
396    int vop_get_vbi_enable(void);
397    unsigned long vop_get_crc(void);
398    unsigned long vop_read_vbi_crc(void);
399
400/* CLOSE BRACKET FOR C++ COMPLILATION */
401
402#ifdef __cplusplus
403}
404#endif
405#endif
406