/**
 * @file driver_task.h
 * @brief Internal <t-base driver tasks declarations
 * @author Viacheslav Vovchenko (v.vovchenko@samsung.com)
 * @date Created Oct 3, 2016
 * @par In Samsung Ukraine R&D Center (SURC) under a contract between
 * @par LLC "Samsung Electronics Ukraine Company" (Kiev, Ukraine) and
 * @par "Samsung Elecrtronics Co", Ltd (Seoul, Republic of Korea)
 * @par Copyright: (c) Samsung Electronics Co, Ltd 2015. All rights reserved.
 *
 * This software is proprietary of Samsung Electronics.
 * No part of this software, either material or conceptual may be copied
 * or distributed, transmitted, transcribed, stored in a retrieval system
 * or translated into any human or computer language in any form by any means,
 * electronic, mechanical, manual or otherwise, or disclosed to third parties
 * without the express written permission of Samsung Electronics.
 */

#ifndef DRIVER_TASK_H_
#define DRIVER_TASK_H_

#include <drStd.h>

/* Thread numbers */
#define DRIVER_THREAD_NO_EXCH (1)
#define DRIVER_THREAD_NO_IPCH (2)
#define DRIVER_THREAD_NO_DCIH (3)

/* Priority definitions */
#define IPCH_PRIORITY (MAX_PRIORITY - 1)
#define DCIH_PRIORITY (MAX_PRIORITY - 2)

#define STACK_DBG_INIT_VALUE (0xCC)

#define THREADID_THREADNO_SHIFT (16)
#define THREADID_TASKID_MASK    ((1 << THREADID_THREADNO_SHIFT) - 1)
#define THREADID_THREADNO_MASK  (~THREADID_TASKID_MASK)
#define GET_THREADNO(threadid)  (threadid >> THREADID_THREADNO_SHIFT)

#define THREAD_STACK_SIZE (0x1000 * 10)

uint32_t *GetIpchStackTop(void);
uint32_t *GetDcihStackTop(void);

void InitIpch(void);
void InitDcih(void);

_NORETURN void ExchLoop(void);
_NORETURN void IpchLoop(void);
_NORETURN void DcihLoop(void);

#endif  /* DRIVER_TASK_H_*/
