/*******************************************************************/ | |
/************************* File Description ************************/ | |
/*******************************************************************/ | |
/* File Name: $Workfile: hmx_uprade_system.h $ | |
* Version: $Revision: 1.0 $ | |
* Original Author: Yang Hyun Uk $ | |
* Current Author: $Author: huyang@humaxdigital.com $ | |
* Date: $Date: 2011.09.30 | |
* File Description: Upgrade APIs | |
* Module: | |
* Remarks: | |
*/ | |
/** | |
* @author Hyunuk Yang(huyang@humaxdigital.com) | |
* @date 30 Sept 2011 | |
*/ | |
/** | |
* @note | |
* Copyright (C) 2011 Humax Corporation. All Rights Reserved. <br> | |
* This software is the confidential and proprietary information | |
* of Humax Corporation. You may not use or distribute this software | |
* except in compliance with the terms and conditions of any applicable license | |
* agreement in writing between Humax Corporation and you. | |
*/ | |
/*@{*/ | |
/** | |
* @file hmx_upgrade_system.h | |
*/ | |
/*******************************************************************/ | |
/**************************** Header Files**************************/ | |
/*******************************************************************/ | |
/* Start Including Header Files */ | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <pthread.h> | |
#include <errno.h> | |
#include <assert.h> | |
#include <sys/queue.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
/* End Including Headers*/ | |
/*******************************************************************/ | |
/************************ Extern variables *************************/ | |
/*******************************************************************/ | |
/* Start Extern variablee */ | |
/* End Extern variable */ | |
/*******************************************************************/ | |
/************************ Macro Definition *************************/ | |
/*******************************************************************/ | |
/* Start Macro definition */ | |
#define HMX_TASK_CheckCallback() | |
#define HMX_OK 0 | |
#define HMX_ERROR 1 | |
#define HMX_TIMEOUT 2 | |
#define HMX_INVALID_ID 3 | |
#define HMX_ALLOC_ERROR 4 | |
#define HMX_NO_MSG 5 | |
#define HMX_CREATE_ERROR 10 | |
#define HMX_DESTROY_ERROR 11 | |
#define HMX_LOCK_ERROR 12 | |
#define HMX_UNLOCK_ERROR 13 | |
#define HMX_TIME_INFINITE 14 | |
#define HMX_INVALID_CLOCK 15 | |
#define HMX_MSG_FULL 17 | |
#define TRUE 1 | |
#define FALSE 0 | |
#define HMX_TASK_PTHREAD_STACK_MIN (16*1024) | |
#define HMX_TASK_PTHREAD_DEFAULT_PRIO SCHED_RR | |
#define HMX_TASK_STACK_OVERHEAD_SIZE 0x2000 | |
#define HMX_TASK_GUARD_SIZE 16 | |
/* End Macro definition */ | |
/*******************************************************************/ | |
/****************************** typedef ****************************/ | |
/*******************************************************************/ | |
/* Start typedef */ | |
//////////////////////////////////////////////////////////////////// | |
// Task Priority Set | |
//////////////////////////////////////////////////////////////////// | |
/* | |
ÁÖÀÇ»çÇ× | |
Priority¸¦ Áõ°¡ ½ÃŲ´Ù¸é VK_MSG_PRIORITYÀÇ °ªµµ °°ÀÌ Áõ°¡ ½ÃÄÑ¾ß ÇÑ´Ù. | |
VK_MSG_PRIORITYÀÇ °ªÀº Ç×»ó priorityÀÇ °ª º¸´Ù 1 ¸¹¾Æ¾ß ±×·¡¾ß Urgent msg¸¦ ó¸® ÇÑ´Ù. | |
*/ | |
/* Basic Priority Set */ | |
#define BASE_PRIORITY 60 | |
#define HIGHEST_PRIORITY 108 | |
#define PRIORITY_INCREMENT 1 | |
//temp :: Never use | |
#define USER_PRIORITY0 BASE_PRIORITY // 60 | |
#define USER_PRIORITY1 (BASE_PRIORITY + PRIORITY_INCREMENT*1) | |
#define USER_PRIORITY2 (BASE_PRIORITY + PRIORITY_INCREMENT*2) | |
#define USER_PRIORITY3 (BASE_PRIORITY + PRIORITY_INCREMENT*3) | |
#define USER_PRIORITY4 (BASE_PRIORITY + PRIORITY_INCREMENT*4) | |
//ÀÏ´Ü default priority·Î 6¹ø »ç¿ë 50À» ±âÁØÀ¸·Î 8ÀÌ Àû´çÇÒ µí. | |
#define USER_PRIORITY5 (BASE_PRIORITY + PRIORITY_INCREMENT*5) | |
#define USER_PRIORITY6 (BASE_PRIORITY + PRIORITY_INCREMENT*6) | |
#define USER_PRIORITY7 (BASE_PRIORITY + PRIORITY_INCREMENT*7) | |
#define USER_PRIORITY8 (BASE_PRIORITY + PRIORITY_INCREMENT*8) | |
#define USER_PRIORITY9 (BASE_PRIORITY + PRIORITY_INCREMENT*9) | |
#define USER_PRIORITY10 (BASE_PRIORITY + PRIORITY_INCREMENT*10) // 80 | |
#define USER_PRIORITY11 (BASE_PRIORITY + PRIORITY_INCREMENT*11) | |
#define USER_PRIORITY12 (BASE_PRIORITY + PRIORITY_INCREMENT*12) | |
//temp :: for the highest DD | |
#define USER_PRIORITY13 (BASE_PRIORITY + PRIORITY_INCREMENT*13) | |
#define USER_PRIORITY14 (BASE_PRIORITY + PRIORITY_INCREMENT*14) | |
//USER_PRIORITY15´Â »ç¿ëÇÏÁö ¸» °Í..... //20071011 TestByPooh | |
//Only task priority adjust | |
#define USER_PRIORITY15 HIGHEST_PRIORITY | |
//MSG_PRIORITYÀÇ °ªÀº Task PriorityÀÇ °¹¼öº¸´Ù 1°³ ¸¹¾Æ¾ß ÇÑ´Ù. | |
typedef enum | |
{ | |
MSG_PRIORITY0, | |
MSG_PRIORITY1, | |
MSG_PRIORITY2, | |
MSG_PRIORITY3, | |
MSG_PRIORITY4, | |
MSG_PRIORITY5, | |
MSG_PRIORITY6, | |
MSG_PRIORITY7, | |
MSG_PRIORITY8, | |
MSG_PRIORITY9, | |
MSG_PRIORITY10, | |
MSG_PRIORITY11, | |
MSG_PRIORITY12, | |
MSG_PRIORITY13, | |
MSG_PRIORITY14, | |
MSG_PRIORITY15, | |
MSG_PRIORITY16, | |
MSG_PRIORITY_MAX //ÃÖ»óÀ§ÀÇ PRIORITY´Â Urgent·Î »ç¿ëÇÔ.. | |
}HMX_MSG_PRIORITY; | |
typedef enum | |
{ | |
HMX_SUSPENDTYPE_FIFO, | |
HMX_SUSPENDTYPE_PRIORITY, | |
HMX_SUSPENDTYPE_MAX | |
}HMX_SUSPENDTYPE; | |
/* End typedef */ | |
/*******************************************************************/ | |
/******************** global function prototype ********************/ | |
/*******************************************************************/ | |
/* Start global function prototypes */ | |
/* End global function prototypes */ | |
struct HMX_TASK_arg { | |
pthread_mutex_t lock_; | |
pthread_cond_t cond_; | |
unsigned long priority_; | |
unsigned long stackSize_; | |
int IsJoinable; | |
int start; | |
unsigned long *pucTaskStack; | |
unsigned long *pulStackStartAddress; | |
void (*start_func_)(void *); | |
void *arg_; | |
#if defined(CONFIG_DEBUG) | |
pid_t pid; | |
pid_t tid; | |
#endif | |
#if defined(CONFIG_DEBUG) | |
int thread_id; | |
#endif | |
char name[32]; | |
}; | |
struct HMX_TASK { | |
pthread_t task_; | |
struct HMX_TASK_arg targ_; | |
}; | |
struct HMX_MSG_element | |
{ | |
void *data; | |
struct HMX_MSG_element *next; | |
struct HMX_MSG_element *prev; | |
}; | |
struct HMX_MSG_queue | |
{ | |
pthread_mutex_t q_lock_; | |
pthread_cond_t q_not_empty_; | |
pthread_cond_t q_not_full_; | |
unsigned long curr_msg_count_; | |
unsigned long msg_size_; | |
unsigned long msg_count_; | |
unsigned long bitmap_count[MSG_PRIORITY_MAX]; | |
unsigned char bitmap[MSG_PRIORITY_MAX]; | |
unsigned char suspend_type_; | |
void *pPool; | |
void *pDataPool; | |
int writer_count_; | |
int reader_count_; | |
struct HMX_MSG_element *temp_head; | |
struct HMX_MSG_element *temp_tail; | |
struct HMX_MSG_element *head[MSG_PRIORITY_MAX]; | |
struct HMX_MSG_element *tail[MSG_PRIORITY_MAX]; | |
#if defined(CONFIG_DEBUG) | |
unsigned long sendTick; | |
unsigned long receiveTick; | |
unsigned long lastSendTick; | |
unsigned long lastReceiveTick; | |
char name[32]; | |
TAILQ_ENTRY(HMX_MSG_queue) entries; | |
#endif | |
}; | |
#if defined(VK_MSG_DEBUG) | |
TAILQ_HEAD(listhead, HMX_MSG_queue) msg_q_list_head; | |
#endif | |
#if defined(CONFIG_DEBUG) | |
unsigned long tickForVkDebug; | |
#endif | |
/*@}*/ |