[Cbe-oss-dev] [PATCH 02/10]MARS/core: Workload module split make headers public

Kazunori Asayama asayama at sm.sony.co.jp
Fri Nov 21 13:29:42 EST 2008


Yuji Mano wrote:
> This moves some of the internal headers needed to implement workload modules
> into public headers.
> 
> Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>
> 
> ---
>  core/include/common/mars/mutex_types.h    |   13 
>  core/include/common/mars/workload_types.h |  120 +++++++
>  core/include/host/mars/workload_queue.h   |   90 +++++
>  core/include/mpu/mars/dma.h               |  493 ++++++++++++++++++++++++++++++
>  core/src/common/mutex_internal_types.h    |   54 ---
>  core/src/common/workload_internal_types.h |   64 ---
>  core/src/host/lib/workload_queue.h        |   90 -----
>  core/src/mpu/lib/dma.h                    |  493 ------------------------------
>  core/src/mpu/lib/workload_types.h         |  139 --------
>  9 files changed, 716 insertions(+), 840 deletions(-)
> 
> --- a/core/include/common/mars/mutex_types.h
> +++ b/core/include/common/mars/mutex_types.h
(snip)
>  /**
>   * \ingroup group_mars_mutex
>   * \brief MARS mutex structure
>   *
>   * An instance of this structure must be created when using the MARS Mutex API.
>   */
> -struct mars_mutex;
> +struct mars_mutex {
> +	uint32_t lock;
> +	uint8_t pad[124];
> +} __attribute__((aligned(MARS_MUTEX_ALIGN)));

It seems to be unnecessary to make mars_mutex structure public, since
workload module implementation doesn't access any member of mars_mutex
directly.

> --- /dev/null
> +++ b/core/include/common/mars/workload_types.h
(snip)
> +#define MARS_WORKLOAD_ID_NONE			0xffff	/* workload id none */
> +
> +#define MARS_WORKLOAD_TYPE_NONE			0x00	/* workload undefined */
> +#define MARS_WORKLOAD_TYPE_TASK			0x01	/* workload type */
> +
> +#define MARS_WORKLOAD_STATE_NONE		0x00	/* workload undefined */
> +#define MARS_WORKLOAD_STATE_ADDING		0x01	/* adding now */
> +#define MARS_WORKLOAD_STATE_REMOVING		0x02	/* removing now */
> +#define MARS_WORKLOAD_STATE_SCHEDULING		0x03	/* scheduling now */
> +#define MARS_WORKLOAD_STATE_READY		0x04	/* ready to schedule */
> +#define MARS_WORKLOAD_STATE_WAITING		0x05	/* waiting for sync */
> +#define MARS_WORKLOAD_STATE_RUNNING		0x06	/* currently running */
> +#define MARS_WORKLOAD_STATE_FINISHED		0x07	/* not allow schedule */
> +
> +#define MARS_WORKLOAD_PRIORITY_MIN		0x00	/* minimum priority */
> +#define MARS_WORKLOAD_PRIORITY_MAX		0xff	/* maximum priority */
> +
> +#define MARS_WORKLOAD_COUNTER_MIN		0x0000	/* minimum counter */
> +#define MARS_WORKLOAD_COUNTER_MAX		0xffff	/* maximum counter */
> +
> +#define MARS_WORKLOAD_SIGNAL_OFF		0x0	/* signal set off */
> +#define MARS_WORKLOAD_SIGNAL_ON			0x1	/* signal set on */
> +
> +#define MARS_WORKLOAD_MODULE_SIZE		16	/* size of 16 bytes */
> +#define MARS_WORKLOAD_MODULE_ALIGN		16	/* align to 16 bytes */
> +#define MARS_WORKLOAD_MODULE_ELF_VADDR		0x10000 /* elf vaddr */
> +
> +#define MARS_WORKLOAD_CONTEXT_SIZE		128	/* size of 128 bytes */
> +#define MARS_WORKLOAD_CONTEXT_ALIGN		128	/* align to 128 bytes */
> +
> +/*
> + * MARS workload queue block bits
> + * ----------------------------------------------------------------------------
> + * |[63...60]|[59...56]|[55....48]|[  47  ]|[46....32]|[31.....16]|[15......0]|
> + * ----------------------------------------------------------------------------
> + * |  4-bits |  4-bits |  8-bits  |  1-bit |  15-bits |  16-bits  |  16-bits  |
> + * ----------------------------------------------------------------------------
> + * |   TYPE  |  STATE  | PRIORITY | SIGNAL | RESERVED |  WAIT_ID  |  COUNTER  |
> + * ----------------------------------------------------------------------------
> + */
> +#define MARS_BITS_SIZE				64
> +
> +#define MARS_BITS_SHIFT_TYPE			60
> +#define MARS_BITS_SHIFT_STATE			56
> +#define MARS_BITS_SHIFT_PRIORITY		48
> +#define MARS_BITS_SHIFT_SIGNAL			47
> +#define MARS_BITS_SHIFT_WAIT_ID			16
> +#define MARS_BITS_SHIFT_COUNTER			0
> +
> +#define MARS_BITS_MASK_TYPE			0xf000000000000000ULL
> +#define MARS_BITS_MASK_STATE			0x0f00000000000000ULL
> +#define MARS_BITS_MASK_PRIORITY			0x00ff000000000000ULL
> +#define MARS_BITS_MASK_SIGNAL			0x0000800000000000ULL
> +#define MARS_BITS_MASK_WAIT_ID			0x00000000ffff0000ULL
> +#define MARS_BITS_MASK_COUNTER			0x000000000000ffffULL
> +
> +#define MARS_BITS_GET(bits, name)  \
> +	((*(bits) & MARS_BITS_MASK_##name) >> MARS_BITS_SHIFT_##name)
> +
> +#define MARS_BITS_SET(bits, name, val) \
> +	(*bits) = ((*(bits) & ~MARS_BITS_MASK_##name) | \
> +		((uint64_t)(val) << MARS_BITS_SHIFT_##name))

Should these definitions be public?

-- 
(ASAYAMA Kazunori
  (asayama at sm.sony.co.jp))
t



More information about the cbe-oss-dev mailing list