Use const to improve optimization
This commit is contained in:
parent
22833e5ec7
commit
02d04c7e9d
|
@ -393,12 +393,27 @@ void divaStreamingWakeup (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void capi_DivaStreamLock (void)
|
unsigned int capi_DivaStreamingGetStreamInUse(const struct capi_pvt* i)
|
||||||
|
{
|
||||||
|
unsigned int ret = 0;
|
||||||
|
|
||||||
|
capi_DivaStreamLock();
|
||||||
|
if ((i != NULL) && (i->diva_stream_entry != NULL) &&
|
||||||
|
(i->diva_stream_entry->diva_stream_state == DivaStreamActive) &&
|
||||||
|
(i->diva_stream_entry->diva_stream != NULL)) {
|
||||||
|
ret = i->diva_stream_entry->diva_stream->get_tx_in_use (i->diva_stream_entry->diva_stream);
|
||||||
|
}
|
||||||
|
capi_DivaStreamUnLock();
|
||||||
|
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
void capi_DivaStreamLock(void)
|
||||||
{
|
{
|
||||||
cc_mutex_lock(&stream_write_lock);
|
cc_mutex_lock(&stream_write_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void capi_DivaStreamUnLock (void)
|
void capi_DivaStreamUnLock(void)
|
||||||
{
|
{
|
||||||
cc_mutex_unlock(&stream_write_lock);
|
cc_mutex_unlock(&stream_write_lock);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ extern void capi_DivaStreamingStreamNotUsed(struct capi_pvt *i, byte streamComma
|
||||||
extern void capi_DivaStreamingRemoveInfo(struct capi_pvt *i);
|
extern void capi_DivaStreamingRemoveInfo(struct capi_pvt *i);
|
||||||
extern void capi_DivaStreamingRemove(struct capi_pvt *i);
|
extern void capi_DivaStreamingRemove(struct capi_pvt *i);
|
||||||
extern void divaStreamingWakeup(void);
|
extern void divaStreamingWakeup(void);
|
||||||
|
extern unsigned int capi_DivaStreamingGetStreamInUse(const struct capi_pvt* i);
|
||||||
extern void capi_DivaStreamLock(void);
|
extern void capi_DivaStreamLock(void);
|
||||||
extern void capi_DivaStreamUnLock (void);
|
extern void capi_DivaStreamUnLock (void);
|
||||||
extern void capi_DivaStreamingDisable (void);
|
extern void capi_DivaStreamingDisable (void);
|
||||||
|
|
|
@ -46,9 +46,9 @@ typedef struct _diva_streaming_idi_host_ifc_w_access {
|
||||||
int (*write)(struct _diva_streaming_idi_host_ifc_w* ifc, const void* data, dword data_length);
|
int (*write)(struct _diva_streaming_idi_host_ifc_w* ifc, const void* data, dword data_length);
|
||||||
int (*write_indirect)(struct _diva_streaming_idi_host_ifc_w* ifc, dword lo, dword hi, dword length);
|
int (*write_indirect)(struct _diva_streaming_idi_host_ifc_w* ifc, dword lo, dword hi, dword length);
|
||||||
int (*update_remote)(struct _diva_streaming_idi_host_ifc_w* ifc);
|
int (*update_remote)(struct _diva_streaming_idi_host_ifc_w* ifc);
|
||||||
dword (*get_in_use)(struct _diva_streaming_idi_host_ifc_w* ifc);
|
dword (*get_in_use)(const struct _diva_streaming_idi_host_ifc_w* ifc);
|
||||||
dword (*get_free)(struct _diva_streaming_idi_host_ifc_w* ifc);
|
dword (*get_free)(const struct _diva_streaming_idi_host_ifc_w* ifc);
|
||||||
dword (*get_length)(struct _diva_streaming_idi_host_ifc_w* ifc);
|
dword (*get_length)(const struct _diva_streaming_idi_host_ifc_w* ifc);
|
||||||
byte (*description)(struct _diva_streaming_idi_host_ifc_w* ifc, byte* dst, byte max_length);
|
byte (*description)(struct _diva_streaming_idi_host_ifc_w* ifc, byte* dst, byte max_length);
|
||||||
int (*init)(struct _diva_streaming_idi_host_ifc_w* ifc, dword version, dword counter);
|
int (*init)(struct _diva_streaming_idi_host_ifc_w* ifc, dword version, dword counter);
|
||||||
diva_streaming_idi_result_t (*sync)(struct _diva_streaming_idi_host_ifc_w* ifc, dword ident);
|
diva_streaming_idi_result_t (*sync)(struct _diva_streaming_idi_host_ifc_w* ifc, dword ident);
|
||||||
|
|
|
@ -50,9 +50,9 @@ static int ack_rx_data (struct _diva_streaming_idi_host_ifc_w* ifc, dword length
|
||||||
static int write_data (struct _diva_streaming_idi_host_ifc_w* ifc, const void* data, dword data_length);
|
static int write_data (struct _diva_streaming_idi_host_ifc_w* ifc, const void* data, dword data_length);
|
||||||
static int write_indirect (struct _diva_streaming_idi_host_ifc_w* ifc, dword lo, dword hi, dword length);
|
static int write_indirect (struct _diva_streaming_idi_host_ifc_w* ifc, dword lo, dword hi, dword length);
|
||||||
static int update_remote (struct _diva_streaming_idi_host_ifc_w* ifc);
|
static int update_remote (struct _diva_streaming_idi_host_ifc_w* ifc);
|
||||||
static dword get_in_use (struct _diva_streaming_idi_host_ifc_w* ifc);
|
static dword get_in_use (const struct _diva_streaming_idi_host_ifc_w* ifc);
|
||||||
static dword get_free (struct _diva_streaming_idi_host_ifc_w* ifc);
|
static dword get_free (const struct _diva_streaming_idi_host_ifc_w* ifc);
|
||||||
static dword get_length (struct _diva_streaming_idi_host_ifc_w* ifc);
|
static dword get_length (const struct _diva_streaming_idi_host_ifc_w* ifc);
|
||||||
static void write_buffer (diva_streaming_idi_host_ifc_w_t* ifc, const void* data, dword data_length);
|
static void write_buffer (diva_streaming_idi_host_ifc_w_t* ifc, const void* data, dword data_length);
|
||||||
static void update_write_buffer (diva_streaming_idi_host_ifc_w_t* ifc);
|
static void update_write_buffer (diva_streaming_idi_host_ifc_w_t* ifc);
|
||||||
static diva_streaming_idi_result_t set_trace_ident (struct _diva_streaming_idi_host_ifc_w* ifc);
|
static diva_streaming_idi_result_t set_trace_ident (struct _diva_streaming_idi_host_ifc_w* ifc);
|
||||||
|
@ -413,15 +413,15 @@ static int update_remote (struct _diva_streaming_idi_host_ifc_w* ifc) {
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
static dword get_in_use (struct _diva_streaming_idi_host_ifc_w* ifc) {
|
static dword get_in_use (const struct _diva_streaming_idi_host_ifc_w* ifc) {
|
||||||
return (ifc->state.used_length);
|
return (ifc->state.used_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
static dword get_free (struct _diva_streaming_idi_host_ifc_w* ifc) {
|
static dword get_free (const struct _diva_streaming_idi_host_ifc_w* ifc) {
|
||||||
return (ifc->state.free_length);
|
return (ifc->state.free_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
static dword get_length (struct _diva_streaming_idi_host_ifc_w* ifc) {
|
static dword get_length (const struct _diva_streaming_idi_host_ifc_w* ifc) {
|
||||||
return (ifc->state.length);
|
return (ifc->state.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,8 +60,8 @@ static diva_streaming_idi_result_t diva_stream_manager_wakeup (struct _diva_stre
|
||||||
static const byte* diva_stream_manager_description (struct _diva_stream* ifc);
|
static const byte* diva_stream_manager_description (struct _diva_stream* ifc);
|
||||||
static diva_streaming_idi_result_t diva_stream_manager_sync_req (struct _diva_stream* ifc, dword ident);
|
static diva_streaming_idi_result_t diva_stream_manager_sync_req (struct _diva_stream* ifc, dword ident);
|
||||||
static diva_streaming_idi_result_t diva_stream_flush (struct _diva_stream* ifc);
|
static diva_streaming_idi_result_t diva_stream_flush (struct _diva_stream* ifc);
|
||||||
static dword diva_stream_get_tx_free (struct _diva_stream* ifc);
|
static dword diva_stream_get_tx_free (const struct _diva_stream* ifc);
|
||||||
static dword diva_stream_get_tx_in_use (struct _diva_stream* ifc);
|
static dword diva_stream_get_tx_in_use (const struct _diva_stream* ifc);
|
||||||
static void diva_notify_os_resource_removed (struct _diva_stream* ifc);
|
static void diva_notify_os_resource_removed (struct _diva_stream* ifc);
|
||||||
|
|
||||||
diva_streaming_idi_result_t diva_stream_create (struct _diva_stream** ifc,
|
diva_streaming_idi_result_t diva_stream_create (struct _diva_stream** ifc,
|
||||||
|
@ -231,14 +231,14 @@ static diva_streaming_idi_result_t diva_stream_flush (struct _diva_stream* ifc)
|
||||||
return (pI->tx_ifc->update_remote (pI->tx) == 0 ? DivaStreamingIdiResultOK : DivaStreamingIdiResultError);
|
return (pI->tx_ifc->update_remote (pI->tx) == 0 ? DivaStreamingIdiResultOK : DivaStreamingIdiResultError);
|
||||||
}
|
}
|
||||||
|
|
||||||
static dword diva_stream_get_tx_free (struct _diva_stream* ifc) {
|
static dword diva_stream_get_tx_free (const struct _diva_stream* ifc) {
|
||||||
diva_stream_manager_t* pI = DIVAS_CONTAINING_RECORD(ifc, diva_stream_manager_t, ifc);
|
diva_stream_manager_t* pI = DIVAS_CONTAINING_RECORD(ifc, diva_stream_manager_t, ifc);
|
||||||
|
|
||||||
return (pI->tx_ifc->get_free (pI->tx));
|
return (pI->tx_ifc->get_free (pI->tx));
|
||||||
}
|
}
|
||||||
|
|
||||||
static dword diva_stream_get_tx_in_use (struct _diva_stream* ifc) {
|
static dword diva_stream_get_tx_in_use (const struct _diva_stream* ifc) {
|
||||||
diva_stream_manager_t* pI = DIVAS_CONTAINING_RECORD(ifc, diva_stream_manager_t, ifc);
|
const diva_stream_manager_t* pI = DIVAS_CONTAINING_RECORD(ifc, const diva_stream_manager_t, ifc);
|
||||||
|
|
||||||
return (pI->tx_ifc->get_in_use (pI->tx));
|
return (pI->tx_ifc->get_in_use (pI->tx));
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,8 @@ typedef struct _diva_stream {
|
||||||
const byte* (*description)(struct _diva_stream* ifc);
|
const byte* (*description)(struct _diva_stream* ifc);
|
||||||
diva_streaming_idi_result_t (*sync)(struct _diva_stream* ifc, dword ident);
|
diva_streaming_idi_result_t (*sync)(struct _diva_stream* ifc, dword ident);
|
||||||
diva_streaming_idi_result_t (*flush_stream)(struct _diva_stream* ifc);
|
diva_streaming_idi_result_t (*flush_stream)(struct _diva_stream* ifc);
|
||||||
dword (*get_tx_free)(struct _diva_stream* ifc);
|
dword (*get_tx_free)(const struct _diva_stream* ifc);
|
||||||
dword (*get_tx_in_use)(struct _diva_stream* ifc);
|
dword (*get_tx_in_use)(const struct _diva_stream* ifc);
|
||||||
void (*notify_os_resource_removed)(struct _diva_stream* ifc);
|
void (*notify_os_resource_removed)(struct _diva_stream* ifc);
|
||||||
} diva_stream_t;
|
} diva_stream_t;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue