18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci *  Copyright (C) 2005 Mike Isely <isely@pobox.com>
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci#ifndef __PVRUSB2_HDW_H
78c2ecf20Sopenharmony_ci#define __PVRUSB2_HDW_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/usb.h>
108c2ecf20Sopenharmony_ci#include <linux/videodev2.h>
118c2ecf20Sopenharmony_ci#include <media/v4l2-dev.h>
128c2ecf20Sopenharmony_ci#include "pvrusb2-io.h"
138c2ecf20Sopenharmony_ci#include "pvrusb2-ctrl.h"
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/* Private internal control ids, look these up with
178c2ecf20Sopenharmony_ci   pvr2_hdw_get_ctrl_by_id() - these are NOT visible in V4L */
188c2ecf20Sopenharmony_ci#define PVR2_CID_STDCUR 2
198c2ecf20Sopenharmony_ci#define PVR2_CID_STDAVAIL 3
208c2ecf20Sopenharmony_ci#define PVR2_CID_INPUT 4
218c2ecf20Sopenharmony_ci#define PVR2_CID_AUDIOMODE 5
228c2ecf20Sopenharmony_ci#define PVR2_CID_FREQUENCY 6
238c2ecf20Sopenharmony_ci#define PVR2_CID_HRES 7
248c2ecf20Sopenharmony_ci#define PVR2_CID_VRES 8
258c2ecf20Sopenharmony_ci#define PVR2_CID_CROPL 9
268c2ecf20Sopenharmony_ci#define PVR2_CID_CROPT 10
278c2ecf20Sopenharmony_ci#define PVR2_CID_CROPW 11
288c2ecf20Sopenharmony_ci#define PVR2_CID_CROPH 12
298c2ecf20Sopenharmony_ci#define PVR2_CID_CROPCAPPAN 13
308c2ecf20Sopenharmony_ci#define PVR2_CID_CROPCAPPAD 14
318c2ecf20Sopenharmony_ci#define PVR2_CID_CROPCAPBL 15
328c2ecf20Sopenharmony_ci#define PVR2_CID_CROPCAPBT 16
338c2ecf20Sopenharmony_ci#define PVR2_CID_CROPCAPBW 17
348c2ecf20Sopenharmony_ci#define PVR2_CID_CROPCAPBH 18
358c2ecf20Sopenharmony_ci#define PVR2_CID_STDDETECT 19
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci/* Legal values for the INPUT state variable */
388c2ecf20Sopenharmony_ci#define PVR2_CVAL_INPUT_TV 0
398c2ecf20Sopenharmony_ci#define PVR2_CVAL_INPUT_DTV 1
408c2ecf20Sopenharmony_ci#define PVR2_CVAL_INPUT_COMPOSITE 2
418c2ecf20Sopenharmony_ci#define PVR2_CVAL_INPUT_SVIDEO 3
428c2ecf20Sopenharmony_ci#define PVR2_CVAL_INPUT_RADIO 4
438c2ecf20Sopenharmony_ci#define PVR2_CVAL_INPUT_MAX PVR2_CVAL_INPUT_RADIO
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_cienum pvr2_config {
468c2ecf20Sopenharmony_ci	pvr2_config_empty,    /* No configuration */
478c2ecf20Sopenharmony_ci	pvr2_config_mpeg,     /* Encoded / compressed video */
488c2ecf20Sopenharmony_ci	pvr2_config_vbi,      /* Standard vbi info */
498c2ecf20Sopenharmony_ci	pvr2_config_pcm,      /* Audio raw pcm stream */
508c2ecf20Sopenharmony_ci	pvr2_config_rawvideo, /* Video raw frames */
518c2ecf20Sopenharmony_ci};
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_cienum pvr2_v4l_type {
548c2ecf20Sopenharmony_ci	pvr2_v4l_type_video,
558c2ecf20Sopenharmony_ci	pvr2_v4l_type_vbi,
568c2ecf20Sopenharmony_ci	pvr2_v4l_type_radio,
578c2ecf20Sopenharmony_ci};
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci/* Major states that we can be in:
608c2ecf20Sopenharmony_ci *
618c2ecf20Sopenharmony_ci *  DEAD - Device is in an unusable state and cannot be recovered.  This
628c2ecf20Sopenharmony_ci *  can happen if we completely lose the ability to communicate with it
638c2ecf20Sopenharmony_ci *  (but it might still on the bus).  In this state there's nothing we can
648c2ecf20Sopenharmony_ci *  do; it must be replugged in order to recover.
658c2ecf20Sopenharmony_ci *
668c2ecf20Sopenharmony_ci *  COLD - Device is in an unusable state, needs microcontroller firmware.
678c2ecf20Sopenharmony_ci *
688c2ecf20Sopenharmony_ci *  WARM - We can communicate with the device and the proper
698c2ecf20Sopenharmony_ci *  microcontroller firmware is running, but other device initialization is
708c2ecf20Sopenharmony_ci *  still needed (e.g. encoder firmware).
718c2ecf20Sopenharmony_ci *
728c2ecf20Sopenharmony_ci *  ERROR - A problem prevents capture operation (e.g. encoder firmware
738c2ecf20Sopenharmony_ci *  missing).
748c2ecf20Sopenharmony_ci *
758c2ecf20Sopenharmony_ci *  READY - Device is operational, but not streaming.
768c2ecf20Sopenharmony_ci *
778c2ecf20Sopenharmony_ci *  RUN - Device is streaming.
788c2ecf20Sopenharmony_ci *
798c2ecf20Sopenharmony_ci */
808c2ecf20Sopenharmony_ci#define PVR2_STATE_NONE 0
818c2ecf20Sopenharmony_ci#define PVR2_STATE_DEAD 1
828c2ecf20Sopenharmony_ci#define PVR2_STATE_COLD 2
838c2ecf20Sopenharmony_ci#define PVR2_STATE_WARM 3
848c2ecf20Sopenharmony_ci#define PVR2_STATE_ERROR 4
858c2ecf20Sopenharmony_ci#define PVR2_STATE_READY 5
868c2ecf20Sopenharmony_ci#define PVR2_STATE_RUN 6
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci/* Translate configuration enum to a string label */
898c2ecf20Sopenharmony_ciconst char *pvr2_config_get_name(enum pvr2_config);
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_cistruct pvr2_hdw;
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci/* Create and return a structure for interacting with the underlying
948c2ecf20Sopenharmony_ci   hardware */
958c2ecf20Sopenharmony_cistruct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
968c2ecf20Sopenharmony_ci				 const struct usb_device_id *devid);
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci/* Perform second stage initialization, passing in a notification callback
998c2ecf20Sopenharmony_ci   for when the master state changes. */
1008c2ecf20Sopenharmony_ciint pvr2_hdw_initialize(struct pvr2_hdw *,
1018c2ecf20Sopenharmony_ci			void (*callback_func)(void *),
1028c2ecf20Sopenharmony_ci			void *callback_data);
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci/* Destroy hardware interaction structure */
1058c2ecf20Sopenharmony_civoid pvr2_hdw_destroy(struct pvr2_hdw *);
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci/* Return true if in the ready (normal) state */
1088c2ecf20Sopenharmony_ciint pvr2_hdw_dev_ok(struct pvr2_hdw *);
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci/* Return small integer number [1..N] for logical instance number of this
1118c2ecf20Sopenharmony_ci   device.  This is useful for indexing array-valued module parameters. */
1128c2ecf20Sopenharmony_ciint pvr2_hdw_get_unit_number(struct pvr2_hdw *);
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci/* Get pointer to underlying USB device */
1158c2ecf20Sopenharmony_cistruct usb_device *pvr2_hdw_get_dev(struct pvr2_hdw *);
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci/* Retrieve serial number of device */
1188c2ecf20Sopenharmony_ciunsigned long pvr2_hdw_get_sn(struct pvr2_hdw *);
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci/* Retrieve bus location info of device */
1218c2ecf20Sopenharmony_ciconst char *pvr2_hdw_get_bus_info(struct pvr2_hdw *);
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci/* Retrieve per-instance string identifier for this specific device */
1248c2ecf20Sopenharmony_ciconst char *pvr2_hdw_get_device_identifier(struct pvr2_hdw *);
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci/* Called when hardware has been unplugged */
1278c2ecf20Sopenharmony_civoid pvr2_hdw_disconnect(struct pvr2_hdw *);
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci/* Sets v4l2_dev of a video_device struct */
1308c2ecf20Sopenharmony_civoid pvr2_hdw_set_v4l2_dev(struct pvr2_hdw *, struct video_device *);
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci/* Get the number of defined controls */
1338c2ecf20Sopenharmony_ciunsigned int pvr2_hdw_get_ctrl_count(struct pvr2_hdw *);
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci/* Retrieve a control handle given its index (0..count-1) */
1368c2ecf20Sopenharmony_cistruct pvr2_ctrl *pvr2_hdw_get_ctrl_by_index(struct pvr2_hdw *,unsigned int);
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci/* Retrieve a control handle given its internal ID (if any) */
1398c2ecf20Sopenharmony_cistruct pvr2_ctrl *pvr2_hdw_get_ctrl_by_id(struct pvr2_hdw *,unsigned int);
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci/* Retrieve a control handle given its V4L ID (if any) */
1428c2ecf20Sopenharmony_cistruct pvr2_ctrl *pvr2_hdw_get_ctrl_v4l(struct pvr2_hdw *,unsigned int ctl_id);
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci/* Retrieve a control handle given its immediate predecessor V4L ID (if any) */
1458c2ecf20Sopenharmony_cistruct pvr2_ctrl *pvr2_hdw_get_ctrl_nextv4l(struct pvr2_hdw *,
1468c2ecf20Sopenharmony_ci					    unsigned int ctl_id);
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci/* Commit all control changes made up to this point */
1498c2ecf20Sopenharmony_ciint pvr2_hdw_commit_ctl(struct pvr2_hdw *);
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci/* Return a bit mask of valid input selections for this device.  Mask bits
1528c2ecf20Sopenharmony_ci * will be according to PVR_CVAL_INPUT_xxxx definitions. */
1538c2ecf20Sopenharmony_ciunsigned int pvr2_hdw_get_input_available(struct pvr2_hdw *);
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci/* Return a bit mask of allowed input selections for this device.  Mask bits
1568c2ecf20Sopenharmony_ci * will be according to PVR_CVAL_INPUT_xxxx definitions. */
1578c2ecf20Sopenharmony_ciunsigned int pvr2_hdw_get_input_allowed(struct pvr2_hdw *);
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci/* Change the set of allowed input selections for this device.  Both
1608c2ecf20Sopenharmony_ci   change_mask and change_valu are mask bits according to
1618c2ecf20Sopenharmony_ci   PVR_CVAL_INPUT_xxxx definitions.  The change_mask parameter indicate
1628c2ecf20Sopenharmony_ci   which settings are being changed and the change_val parameter indicates
1638c2ecf20Sopenharmony_ci   whether corresponding settings are being set or cleared. */
1648c2ecf20Sopenharmony_ciint pvr2_hdw_set_input_allowed(struct pvr2_hdw *,
1658c2ecf20Sopenharmony_ci			       unsigned int change_mask,
1668c2ecf20Sopenharmony_ci			       unsigned int change_val);
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci/* Return name for this driver instance */
1698c2ecf20Sopenharmony_ciconst char *pvr2_hdw_get_driver_name(struct pvr2_hdw *);
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci/* Mark tuner status stale so that it will be re-fetched */
1728c2ecf20Sopenharmony_civoid pvr2_hdw_execute_tuner_poll(struct pvr2_hdw *);
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci/* Return information about the tuner */
1758c2ecf20Sopenharmony_ciint pvr2_hdw_get_tuner_status(struct pvr2_hdw *,struct v4l2_tuner *);
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci/* Return information about cropping capabilities */
1788c2ecf20Sopenharmony_ciint pvr2_hdw_get_cropcap(struct pvr2_hdw *, struct v4l2_cropcap *);
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci/* Query device and see if it thinks it is on a high-speed USB link */
1818c2ecf20Sopenharmony_ciint pvr2_hdw_is_hsm(struct pvr2_hdw *);
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci/* Return a string token representative of the hardware type */
1848c2ecf20Sopenharmony_ciconst char *pvr2_hdw_get_type(struct pvr2_hdw *);
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci/* Return a single line description of the hardware type */
1878c2ecf20Sopenharmony_ciconst char *pvr2_hdw_get_desc(struct pvr2_hdw *);
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci/* Turn streaming on/off */
1908c2ecf20Sopenharmony_ciint pvr2_hdw_set_streaming(struct pvr2_hdw *,int);
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci/* Find out if streaming is on */
1938c2ecf20Sopenharmony_ciint pvr2_hdw_get_streaming(struct pvr2_hdw *);
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_ci/* Retrieve driver overall state */
1968c2ecf20Sopenharmony_ciint pvr2_hdw_get_state(struct pvr2_hdw *);
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci/* Configure the type of stream to generate */
1998c2ecf20Sopenharmony_ciint pvr2_hdw_set_stream_type(struct pvr2_hdw *, enum pvr2_config);
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_ci/* Get handle to video output stream */
2028c2ecf20Sopenharmony_cistruct pvr2_stream *pvr2_hdw_get_video_stream(struct pvr2_hdw *);
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci/* Enable / disable retrieval of CPU firmware or prom contents.  This must
2058c2ecf20Sopenharmony_ci   be enabled before pvr2_hdw_cpufw_get() will function.  Note that doing
2068c2ecf20Sopenharmony_ci   this may prevent the device from running (and leaving this mode may
2078c2ecf20Sopenharmony_ci   imply a device reset). */
2088c2ecf20Sopenharmony_civoid pvr2_hdw_cpufw_set_enabled(struct pvr2_hdw *,
2098c2ecf20Sopenharmony_ci				int mode, /* 0=8KB FX2, 1=16KB FX2, 2=PROM */
2108c2ecf20Sopenharmony_ci				int enable_flag);
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci/* Return true if we're in a mode for retrieval CPU firmware */
2138c2ecf20Sopenharmony_ciint pvr2_hdw_cpufw_get_enabled(struct pvr2_hdw *);
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci/* Retrieve a piece of the CPU's firmware at the given offset.  Return
2168c2ecf20Sopenharmony_ci   value is the number of bytes retrieved or zero if we're past the end or
2178c2ecf20Sopenharmony_ci   an error otherwise (e.g. if firmware retrieval is not enabled). */
2188c2ecf20Sopenharmony_ciint pvr2_hdw_cpufw_get(struct pvr2_hdw *,unsigned int offs,
2198c2ecf20Sopenharmony_ci		       char *buf,unsigned int cnt);
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_ci/* Retrieve a previously stored v4l minor device number */
2228c2ecf20Sopenharmony_ciint pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *,enum pvr2_v4l_type index);
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci/* Store a v4l minor device number */
2258c2ecf20Sopenharmony_civoid pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *,
2268c2ecf20Sopenharmony_ci				     enum pvr2_v4l_type index,int);
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci/* The following entry points are all lower level things you normally don't
2298c2ecf20Sopenharmony_ci   want to worry about. */
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ci/* Issue a command and get a response from the device.  LOTS of higher
2328c2ecf20Sopenharmony_ci   level stuff is built on this. */
2338c2ecf20Sopenharmony_ciint pvr2_send_request(struct pvr2_hdw *,
2348c2ecf20Sopenharmony_ci		      void *write_ptr,unsigned int write_len,
2358c2ecf20Sopenharmony_ci		      void *read_ptr,unsigned int read_len);
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_ci/* Slightly higher level device communication functions. */
2388c2ecf20Sopenharmony_ciint pvr2_write_register(struct pvr2_hdw *, u16, u32);
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci/* Call if for any reason we can't talk to the hardware anymore - this will
2418c2ecf20Sopenharmony_ci   cause the driver to stop flailing on the device. */
2428c2ecf20Sopenharmony_civoid pvr2_hdw_render_useless(struct pvr2_hdw *);
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ci/* Set / clear 8051's reset bit */
2458c2ecf20Sopenharmony_civoid pvr2_hdw_cpureset_assert(struct pvr2_hdw *,int);
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ci/* Execute a USB-commanded device reset */
2488c2ecf20Sopenharmony_civoid pvr2_hdw_device_reset(struct pvr2_hdw *);
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_ci/* Reset worker's error trapping circuit breaker */
2518c2ecf20Sopenharmony_ciint pvr2_hdw_untrip(struct pvr2_hdw *);
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci/* Execute hard reset command (after this point it's likely that the
2548c2ecf20Sopenharmony_ci   encoder will have to be reconfigured).  This also clears the "useless"
2558c2ecf20Sopenharmony_ci   state. */
2568c2ecf20Sopenharmony_ciint pvr2_hdw_cmd_deep_reset(struct pvr2_hdw *);
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_ci/* Execute simple reset command */
2598c2ecf20Sopenharmony_ciint pvr2_hdw_cmd_powerup(struct pvr2_hdw *);
2608c2ecf20Sopenharmony_ci
2618c2ecf20Sopenharmony_ci/* Order decoder to reset */
2628c2ecf20Sopenharmony_ciint pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *);
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci/* Direct manipulation of GPIO bits */
2658c2ecf20Sopenharmony_ciint pvr2_hdw_gpio_get_dir(struct pvr2_hdw *hdw,u32 *);
2668c2ecf20Sopenharmony_ciint pvr2_hdw_gpio_get_out(struct pvr2_hdw *hdw,u32 *);
2678c2ecf20Sopenharmony_ciint pvr2_hdw_gpio_get_in(struct pvr2_hdw *hdw,u32 *);
2688c2ecf20Sopenharmony_ciint pvr2_hdw_gpio_chg_dir(struct pvr2_hdw *hdw,u32 msk,u32 val);
2698c2ecf20Sopenharmony_ciint pvr2_hdw_gpio_chg_out(struct pvr2_hdw *hdw,u32 msk,u32 val);
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci/* This data structure is specifically for the next function... */
2728c2ecf20Sopenharmony_cistruct pvr2_hdw_debug_info {
2738c2ecf20Sopenharmony_ci	int big_lock_held;
2748c2ecf20Sopenharmony_ci	int ctl_lock_held;
2758c2ecf20Sopenharmony_ci	int flag_disconnected;
2768c2ecf20Sopenharmony_ci	int flag_init_ok;
2778c2ecf20Sopenharmony_ci	int flag_ok;
2788c2ecf20Sopenharmony_ci	int fw1_state;
2798c2ecf20Sopenharmony_ci	int flag_decoder_missed;
2808c2ecf20Sopenharmony_ci	int flag_tripped;
2818c2ecf20Sopenharmony_ci	int state_encoder_ok;
2828c2ecf20Sopenharmony_ci	int state_encoder_run;
2838c2ecf20Sopenharmony_ci	int state_decoder_run;
2848c2ecf20Sopenharmony_ci	int state_decoder_ready;
2858c2ecf20Sopenharmony_ci	int state_usbstream_run;
2868c2ecf20Sopenharmony_ci	int state_decoder_quiescent;
2878c2ecf20Sopenharmony_ci	int state_pipeline_config;
2888c2ecf20Sopenharmony_ci	int state_pipeline_req;
2898c2ecf20Sopenharmony_ci	int state_pipeline_pause;
2908c2ecf20Sopenharmony_ci	int state_pipeline_idle;
2918c2ecf20Sopenharmony_ci	int cmd_debug_state;
2928c2ecf20Sopenharmony_ci	int cmd_debug_write_len;
2938c2ecf20Sopenharmony_ci	int cmd_debug_read_len;
2948c2ecf20Sopenharmony_ci	int cmd_debug_write_pend;
2958c2ecf20Sopenharmony_ci	int cmd_debug_read_pend;
2968c2ecf20Sopenharmony_ci	int cmd_debug_timeout;
2978c2ecf20Sopenharmony_ci	int cmd_debug_rstatus;
2988c2ecf20Sopenharmony_ci	int cmd_debug_wstatus;
2998c2ecf20Sopenharmony_ci	unsigned char cmd_code;
3008c2ecf20Sopenharmony_ci};
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci/* Non-intrusively retrieve internal state info - this is useful for
3038c2ecf20Sopenharmony_ci   diagnosing lockups.  Note that this operation is completed without any
3048c2ecf20Sopenharmony_ci   kind of locking and so it is not atomic and may yield inconsistent
3058c2ecf20Sopenharmony_ci   results.  This is *purely* a debugging aid. */
3068c2ecf20Sopenharmony_civoid pvr2_hdw_get_debug_info_unlocked(const struct pvr2_hdw *hdw,
3078c2ecf20Sopenharmony_ci				      struct pvr2_hdw_debug_info *);
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ci/* Intrusively retrieve internal state info - this is useful for
3108c2ecf20Sopenharmony_ci   diagnosing overall driver state.  This operation synchronizes against
3118c2ecf20Sopenharmony_ci   the overall driver mutex - so if there are locking problems this will
3128c2ecf20Sopenharmony_ci   likely hang!  This is *purely* a debugging aid. */
3138c2ecf20Sopenharmony_civoid pvr2_hdw_get_debug_info_locked(struct pvr2_hdw *hdw,
3148c2ecf20Sopenharmony_ci				    struct pvr2_hdw_debug_info *);
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_ci/* Report out several lines of text that describes driver internal state.
3178c2ecf20Sopenharmony_ci   Results are written into the passed-in buffer. */
3188c2ecf20Sopenharmony_ciunsigned int pvr2_hdw_state_report(struct pvr2_hdw *hdw,
3198c2ecf20Sopenharmony_ci				   char *buf_ptr,unsigned int buf_size);
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_ci/* Cause modules to log their state once */
3228c2ecf20Sopenharmony_civoid pvr2_hdw_trigger_module_log(struct pvr2_hdw *hdw);
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_ci/* Cause encoder firmware to be uploaded into the device.  This is normally
3258c2ecf20Sopenharmony_ci   done autonomously, but the interface is exported here because it is also
3268c2ecf20Sopenharmony_ci   a debugging aid. */
3278c2ecf20Sopenharmony_ciint pvr2_upload_firmware2(struct pvr2_hdw *hdw);
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci#endif /* __PVRUSB2_HDW_H */
330