Skip to content

Commit

Permalink
staging: tidspbridge: Change macros to static inline functions in io_sm
Browse files Browse the repository at this point in the history
This patch change to macros to static inline functions, these
macros are used to perform write/read operations in shared memory

Signed-off-by: Armando Uribe <x0095078@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Armando Uribe authored and Greg Kroah-Hartman committed Jul 26, 2010
1 parent 9e34248 commit c18c9c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
22 changes: 14 additions & 8 deletions drivers/staging/tidspbridge/core/io_sm.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,17 @@ static int register_shm_segs(struct io_mgr *hio_mgr,
struct cod_manager *cod_man,
u32 dw_gpp_base_pa);

static inline void set_chnl_free(struct shm *sm, u32 chnl)
{
sm->host_free_mask &= ~(1 << chnl);
}

static inline void set_chnl_busy(struct shm *sm, u32 chnl)
{
sm->host_free_mask |= 1 << chnl;
}


/*
* ======== bridge_io_create ========
* Create an IO manager object.
Expand Down Expand Up @@ -818,8 +829,7 @@ void io_cancel_chnl(struct io_mgr *hio_mgr, u32 chnl)
sm = hio_mgr->shared_mem;

/* Inform DSP that we have no more buffers on this channel */
IO_AND_VALUE(pio_mgr->hbridge_context, struct shm, sm, host_free_mask,
(~(1 << chnl)));
set_chnl_free(sm, chnl);

sm_interrupt_dsp(pio_mgr->hbridge_context, MBX_PCPY_CLASS);
func_end:
Expand Down Expand Up @@ -994,8 +1004,7 @@ void io_request_chnl(struct io_mgr *io_manager, struct chnl_object *pchnl,
DBC_ASSERT((pchnl->dw_state == CHNL_STATEREADY) ||
(pchnl->dw_state == CHNL_STATEEOS));
/* Indicate to the DSP we have a buffer available for input */
IO_OR_VALUE(io_manager->hbridge_context, struct shm, sm,
host_free_mask, (1 << pchnl->chnl_id));
set_chnl_busy(sm, pchnl->chnl_id);
*mbx_val = MBX_PCPY_CLASS;
} else if (io_mode == IO_OUTPUT) {
/*
Expand Down Expand Up @@ -1156,10 +1165,7 @@ static void input_chnl(struct io_mgr *pio_mgr, struct chnl_object *pchnl,
if (!pchnl->pio_requests)
goto func_end;
if (LST_IS_EMPTY(pchnl->pio_requests)) {
IO_AND_VALUE(pio_mgr->hbridge_context,
struct shm, sm,
host_free_mask,
~(1 << pchnl->chnl_id));
set_chnl_free(sm, pchnl->chnl_id);
}
clear_chnl = true;
notify_client = true;
Expand Down
3 changes: 0 additions & 3 deletions drivers/staging/tidspbridge/include/dspbridge/io_sm.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
#define DSP_FIELD_ADDR(type, field, base, wordsize) \
((((s32)&(((type *)0)->field)) / wordsize) + (u32)base)

#define IO_OR_VALUE(context, type, base, field, value) (base->field |= value)
#define IO_AND_VALUE(context, type, base, field, value) (base->field &= value)

#ifdef CONFIG_TIDSPBRIDGE_DVFS
/* The maximum number of OPPs that are supported */
extern s32 dsp_max_opps;
Expand Down

0 comments on commit c18c9c9

Please sign in to comment.