📄 struct_caches.h
字号:
#ifndef CAN_READ_CACHE#define CAN_READ_CACHE#include<pthread.h>//this is the video cache#define VIDEO_CACHE_SIZE 16*160*120/8 #define VIDEO_PER_LINE_CACHE_SIZE 16*160/8#define VIDEO_CACHE_NUM 5#define VIDEO_CACHE_PER_LINE_NUM 5//this is the audio cache which is owned by the kernel model and the door model#define AUDIO_CACHE_SIZE 4096#define AUDIO_CACHE_NUM 2//this is the log cache#define LOG_CACHE_SIZE sizeof(int)#define LOG_CACHE_NUM 10//this is the command cache#define CMD_CACHE_SIZE (sizeof(int)) #define CMD_CACHE_NUM 10/**here is the bit map of data[0] for frame control*///this is candy type#define CONT 0x10#define CMD_T (1)#define LOG_T (2)#define VIDEO_T (4)#define AUDIO_T (8)//this is the candy source#define KER_M (1<<5)#define DOOR_M (2<<5)#define HOME_M (4<<5)#define PDA_M 4<<6 //this is not part of candy map so this is bigger than a byte can hold //should have int type#define KER_BOARD_CHANNELS 6#define ALL_KER_CHS 6#define KER_VIDEO_CH 0#define KER_AUDIO_CH 1#define KER_LOG_H_CH 2#define KER_LOG_D_CH 3#define KER_CMD_H_CH 4#define KER_CMD_D_CH 5//#define KER_CMD_P_CH 6 this is a stupid error//common model can dispatcher define#define USR_BOARD_CHANNELS 1#define USR_CMD_CH 0// DOOR model can dispatcher channels define#define DOOR_BOARD_CHANNELS 2#define ALL_DOOR_CHS 2#define DOOR_CMD_CH 0#define DOOR_AUDIO_CH 1//#define DOOR_VIDEO_CH 2//and dest is data[1]/**bit map end ----dd YslayerY*/struct cache{ cache * next; char * data; //when it is cmd type,this pointer should contain integer it self int pos; bool cont; int size; };structcaches{ pthread_mutex_t lock; //this is the lock we should use when we need to //modify the store queue or the read queue pthread_mutex_t reader_lock; //this is used so that timer awakened read slots should never compete pthread_cond_t not_full;//wait tree pthread_cond_t not_empty; cache * queue; cache * store_head; cache * store_end; cache * read_head; cache * read_end; int cache_max;};#define CHANNELS KER_BOARD_CHANNELSstructdispatcher{ pthread_mutex_t lock; int resouce; //it means the room for the read thread to data in caches channel[CHANNELS];};////this is another choice for cache for use of command and log transformation,but now not useful////for void of muti-type of cache and easystructcacheS{ cacheS * next; int data;};structcachesS{ pthread_mutex_t lock; pthread_cond_t not_full; cacheS * queue; cacheS * store_head; cacheS * store_end; cacheS * read_head; cacheS * read_end;};structdispatcherS{ pthread_mutex_t lock; int resource; cachesS channel[CHANNELS]; // this pay attention};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -