sr: Made hwcap const

This commit is contained in:
Joel Holdsworth 2012-05-07 13:57:43 +01:00
parent 2715c0b86b
commit 915f7cc87a
13 changed files with 26 additions and 24 deletions

View File

@ -375,7 +375,8 @@ SR_API int sr_dev_trigger_set(struct sr_dev *dev, int probenum,
*/
SR_API gboolean sr_dev_has_hwcap(const struct sr_dev *dev, int hwcap)
{
int *hwcaps, i;
const int *hwcaps;
int i;
sr_spew("dev: %s: requesting hwcap %d", __func__, hwcap);

View File

@ -42,7 +42,7 @@ struct sr_analog_sample {
struct sr_analog_probe probes[];
};
static int hwcaps[] = {
static const int hwcaps[] = {
SR_HWCAP_SAMPLERATE,
SR_HWCAP_LIMIT_SAMPLES,
SR_HWCAP_CONTINUOUS,
@ -207,7 +207,7 @@ static int hw_dev_status_get(int dev_index)
return SR_ST_ACTIVE;
}
static int *hw_hwcap_get_all(void)
static const int *hw_hwcap_get_all(void)
{
return hwcaps;
}

View File

@ -88,7 +88,7 @@ static struct sr_samplerates samplerates = {
supported_samplerates,
};
static int hwcaps[] = {
static const int hwcaps[] = {
SR_HWCAP_LOGIC_ANALYZER,
SR_HWCAP_SAMPLERATE,
SR_HWCAP_CAPTURE_RATIO,
@ -801,7 +801,7 @@ static int hw_dev_status_get(int dev_index)
return SR_ST_NOT_FOUND;
}
static int *hw_hwcap_get_all(void)
static const int *hw_hwcap_get_all(void)
{
return hwcaps;
}

View File

@ -128,7 +128,7 @@ static struct sr_samplerates samplerates = {
};
/* Note: Continuous sampling is not supported by the hardware. */
static int hwcaps[] = {
static const int hwcaps[] = {
SR_HWCAP_LOGIC_ANALYZER,
SR_HWCAP_SAMPLERATE,
SR_HWCAP_LIMIT_MSEC, /* TODO: Not yet implemented. */
@ -753,7 +753,7 @@ static int hw_dev_status_get(int dev_index)
return sdi->status;
}
static int *hw_hwcap_get_all(void)
static const int *hw_hwcap_get_all(void)
{
sr_spew("la8: Returning list of device capabilities.");

View File

@ -76,7 +76,7 @@ struct context {
GTimer *timer;
};
static int hwcaps[] = {
static const int hwcaps[] = {
SR_HWCAP_LOGIC_ANALYZER,
SR_HWCAP_DEMO_DEV,
SR_HWCAP_SAMPLERATE,
@ -226,7 +226,7 @@ static int hw_dev_status_get(int dev_index)
return SR_ST_ACTIVE;
}
static int *hw_hwcap_get_all(void)
static const int *hw_hwcap_get_all(void)
{
return hwcaps;
}

View File

@ -70,7 +70,7 @@ static const struct fx2lafw_profile supported_fx2[] = {
{ 0, 0, 0, 0, 0, 0, 0 }
};
static int hwcaps[] = {
static const int hwcaps[] = {
SR_HWCAP_LOGIC_ANALYZER,
SR_HWCAP_SAMPLERATE,
@ -584,7 +584,7 @@ static int hw_dev_status_get(int dev_index)
return sdi->status;
}
static int *hw_hwcap_get_all(void)
static const int *hw_hwcap_get_all(void)
{
return hwcaps;
}

View File

@ -37,7 +37,7 @@
#define NUM_PROBES 8
static int hwcaps[] = {
static const int hwcaps[] = {
SR_HWCAP_LOGIC_ANALYZER,
// SR_HWCAP_OSCILLOSCOPE,
// SR_HWCAP_PAT_GENERATOR,
@ -650,7 +650,7 @@ static int hw_dev_status_get(int dev_index)
return sdi->status;
}
static int *hw_hwcap_get_all(void)
static const int *hw_hwcap_get_all(void)
{
return hwcaps;
}

View File

@ -46,7 +46,7 @@
#define O_NONBLOCK FIONBIO
#endif
static int hwcaps[] = {
static const int hwcaps[] = {
SR_HWCAP_LOGIC_ANALYZER,
SR_HWCAP_SAMPLERATE,
SR_HWCAP_CAPTURE_RATIO,
@ -602,7 +602,7 @@ static int hw_dev_status_get(int dev_index)
return sdi->status;
}
static int *hw_hwcap_get_all(void)
static const int *hw_hwcap_get_all(void)
{
return hwcaps;
}

View File

@ -65,7 +65,7 @@ static model_t zeroplus_models[] = {
{0x7016, "LAP-C(162000)", 16, 2048, 200},
};
static int hwcaps[] = {
static const int hwcaps[] = {
SR_HWCAP_LOGIC_ANALYZER,
SR_HWCAP_SAMPLERATE,
SR_HWCAP_PROBECONFIG,
@ -566,7 +566,7 @@ static int hw_dev_status_get(int dev_index)
return SR_ST_NOT_FOUND;
}
static int *hw_hwcap_get_all(void)
static const int *hw_hwcap_get_all(void)
{
return hwcaps;
}

View File

@ -276,7 +276,8 @@ SR_PRIV void sr_serial_dev_inst_free(struct sr_serial_dev_inst *serial)
*/
SR_API gboolean sr_driver_hwcap_exists(struct sr_dev_driver *driver, int hwcap)
{
int *hwcaps, i;
const int *hwcaps;
int i;
if (!driver) {
sr_err("hwdriver: %s: driver was NULL", __func__);
@ -304,7 +305,7 @@ SR_API gboolean sr_driver_hwcap_exists(struct sr_dev_driver *driver, int hwcap)
* @return A pointer to a struct with information about the parameter, or NULL
* if the capability was not found.
*/
SR_API struct sr_hwcap_option *sr_hw_hwcap_get(int hwcap)
SR_API const struct sr_hwcap_option *sr_hw_hwcap_get(int hwcap)
{
int i;

View File

@ -41,7 +41,7 @@ struct session_vdev {
static char *sessionfile = NULL;
static GSList *dev_insts = NULL;
static int hwcaps[] = {
static const int hwcaps[] = {
SR_HWCAP_CAPTUREFILE,
SR_HWCAP_CAPTURE_UNITSIZE,
0,
@ -193,7 +193,7 @@ static int hw_dev_open(int dev_index)
return SR_OK;
}
static void *hw_dev_info_get(int dev_index, int dev_info_id)
static const void *hw_dev_info_get(int dev_index, int dev_info_id)
{
struct session_vdev *vdev;
void *info;
@ -226,7 +226,7 @@ static int hw_dev_status_get(int dev_index)
* @return A pointer to the (hardware) capabilities of this virtual session
* driver. This could be NULL, if no such capabilities exist.
*/
static int *hw_hwcap_get_all(void)
static const int *hw_hwcap_get_all(void)
{
return hwcaps;
}

View File

@ -74,7 +74,7 @@ SR_API int sr_filter_probes(int in_unitsize, int out_unitsize,
SR_API struct sr_dev_driver **sr_driver_list(void);
SR_API int sr_driver_init(struct sr_dev_driver *driver);
SR_API gboolean sr_driver_hwcap_exists(struct sr_dev_driver *driver, int hwcap);
SR_API struct sr_hwcap_option *sr_hw_hwcap_get(int hwcap);
SR_API const struct sr_hwcap_option *sr_hw_hwcap_get(int hwcap);
/*--- session.c -------------------------------------------------------------*/

View File

@ -465,7 +465,7 @@ struct sr_dev_driver {
int (*dev_close) (int dev_index);
void *(*dev_info_get) (int dev_index, int dev_info_id);
int (*dev_status_get) (int dev_index);
int *(*hwcap_get_all) (void);
const int *(*hwcap_get_all) (void);
int (*dev_config_set) (int dev_index, int hwcap, void *value);
int (*dev_acquisition_start) (int dev_index, void *session_dev_id);
int (*dev_acquisition_stop) (int dev_index, void *session_dev_id);