1 /*
2 ********************************************************************************
3 *                                    eMOD
4 *                   the Easy Portable/Player Develop Kits
5 *                               mod_duckweed sub-system
6 *                          (module name, e.g.mpeg4 decoder plug-in) module
7 *
8 *          (c) Copyright 2010-2012, Allwinner Microelectronic Co., Ltd.
9 *                              All Rights Reserved
10 *
11 * File   : webcam_linklist_manager.h
12 * Version: V1.0
13 * By     : Eric_wang
14 * Date   : 2010-1-4
15 * Description:
16 ********************************************************************************
17 */
18 #ifndef _WEBCAM_LINKLIST_MANAGER_H_
19 #define _WEBCAM_LINKLIST_MANAGER_H_
20 #include "typedef.h"
21 #include "drv_webcam.h"
22 
23 //链表实现方式2
24 /*******************************************************************************
25 关于 链表实现方式2 的说明:
26 (1). 一个线程vdrv_task() 和一个中断处理程序webcam_irq_handle()会操作2个链表full2和free2
27      因此需要做互斥。
28 (2). 考虑到ISR是不会被打断的,所以只需要对vdrv_task()操作涉及的函数做互斥处理就行了
29     full2_insert( isr ), wt
30     full2_delete( vdrv_task ), rd
31     free2_insert( vdrv_task ), wt
32     free2_delete( isr ), rd
33 
34     所以,只需要对full2_delete()和free2_insert()做互斥处理就行了。所谓互斥,也就是
35     在处理前,把一些可能会被改变的变量记下来而已。
36 *******************************************************************************/
37 
38 #define FRMID_CNT (WEBCAM_BUFFER_NUM+1)
39 
40 typedef enum{
41     WEBCAM_LISTTYPE_FREE = 0,
42     WEBCAM_LISTTYPE_FULL = 1,
43 } WEBCAM_LINKLIST_TYPE;
44 typedef struct tag_WEBCAM_LINKLIST_MANAGER __webcam_linklist_manager_t;
45 typedef void    (*WEBCAM_LINKLIST_MANAGER_Initial)     (__webcam_linklist_manager_t *thiz, WEBCAM_LINKLIST_TYPE type);
46 typedef __s32   (*WEBCAM_LINKLIST_MANAGER_Insert)      (__webcam_linklist_manager_t *thiz, __s32 frame_id);
47 typedef __s32   (*WEBCAM_LINKLIST_MANAGER_Delete)      (__webcam_linklist_manager_t *thiz);
48 typedef __s32   (*WEBCAM_LINKLIST_MANAGER_Exit)        (__webcam_linklist_manager_t *thiz);
49 typedef struct tag_WEBCAM_LINKLIST_MANAGER
50 {
51     WEBCAM_LINKLIST_TYPE list_type;
52     __s32 frmid_array[FRMID_CNT];  //存index号的数组,  index是__webcam_frame_t webcam_frame[WEBCAM_BUFFER_NUM]的index
53     __s32 wt;
54     __s32 rd;
55     WEBCAM_LINKLIST_MANAGER_Initial    initial;
56     WEBCAM_LINKLIST_MANAGER_Insert     insert_element;
57     WEBCAM_LINKLIST_MANAGER_Delete     delete_element;
58     WEBCAM_LINKLIST_MANAGER_Exit       exit;
59 } __webcam_linklist_manager_t; //只允许使用WEBCAM_BUFFER_NUM个元素,避免wt,rd重合时的歧义(满还是空).
60 extern __webcam_linklist_manager_t* webcam_linklist_manager_init(void);
61 
62 #endif  /* _WEBCAM_LINKLIST_MANAGER_H_ */
63 
64