Popup_Lib.h 6.15 KB
Newer Older
hu's avatar
hu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
/**********************************************************************************************************
 * Copyright(C) 2017, HeiLongJiang TYW Co.,Ltd.
 *
 * @Filename:     	Popup_Lib.c
 *
 * @Description:  	前台显示链表
 *
 * @Functions List:
 *
 *
 * @History:       	Version: 		    V0.0.1
				    Date:      	  	    2018-05-02 09:46
                    Author: 		    myliu
                    Modification:       creat
 **********************************************************************************************************/
#ifndef _POPUP_LIB_H
#define _POPUP_LIB_H

/**********************************************************************************************************
 * Include
*/

/**********************************************************************************************************
 * Constants and defines
 */
/*
Platform_32Bit
Platform_16Bit
*/
#ifdef Platform_16Bit
    #define Popuplib_uint8_t  unsigned char
    #define Popuplib_uint16_t unsigned int
    #define Popuplib_uint32_t unsigned long
#else
    #define Popuplib_uint8_t  unsigned char
    #define Popuplib_uint16_t unsigned short
    #define Popuplib_uint32_t unsigned int
    #define Popuplib_uint64_t unsigned long long
#endif

#ifndef POPUPLIB_NULL
  #define POPUPLIB_NULL       0u
#endif /* NULL */

#define POPUP_LIB_OK          0u
#define POPUP_LIB_CBK_ERR     1u
#define POPUP_LIB_MEM_ERR     2u

typedef void (*PopupLib_IRQ_Enable)(void);
typedef void (*PopupLib_IRQ_Disable)(void);

typedef struct
{
    Popuplib_uint8_t data[8];
}CommMemBuf_t;

struct PopupList
{
    Popuplib_uint16_t  PopupID;
    Popuplib_uint8_t   Status;
    struct PopupList  *next;
};

typedef struct
{
    Popuplib_uint8_t        Type;
    Popuplib_uint8_t        Priority;
    Popuplib_uint8_t        SubPriority;
    Popuplib_uint8_t        IGNStatus;
    Popuplib_uint8_t        Class;
    const Popuplib_uint8_t  *pMbrList;
    Popuplib_uint8_t        MbrCnt;
hu's avatar
hu committed
73
    Popuplib_uint16_t       Message;
hu's avatar
hu committed
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
    Popuplib_uint8_t        DispMode;
    Popuplib_uint8_t        Snd;
    Popuplib_uint8_t        SndMode;
} Popup_Attribute_t;

typedef struct
{
    const Popup_Attribute_t *pPopupAttributeTable;
    CommMemBuf_t            *CommMemBuf;
    Popuplib_uint16_t        MaxCommMenSize;
    PopupLib_IRQ_Enable      IRQ_Enable;
    PopupLib_IRQ_Disable     IRQ_Disable;
} PopupList_Opt_t;

/**********************************************************************************************************
 * Local variables
 */

/**********************************************************************************************************
 * Local functions
 */

/**********************************************************************************************************
 * Global variables
 */

/**********************************************************************************************************
 * Global functions
 */
/**********************************************************************************************************
 *@Function: 			PopupList_Init
 *@Description: 	    链表初始化
 *@Calls: 				MY_MemInit/CommMemMalloc
 *@Updated: 			V0.0.1
 *@Input: 				none
 *@Return: 				PopupList_Opt_t *pPopupListOpt -- 回调
 *@Note:   				none
 **********************************************************************************************************/
Popuplib_uint8_t PopupList_Init ( PopupList_Opt_t  *pPopupListOpt);

/**********************************************************************************************************
 *@Function: 			PopupList_Malloc
 *@Description: 	链表内存申请
 *@Calls: 				CommMemMalloc
 *@Updated: 			V0.0.1
 *@Input: 				none
 *@Return: 				struct PopupList *head -- 内存指针
 *@Note:   				none
 **********************************************************************************************************/
struct PopupList *PopupList_Malloc ( void );

/**********************************************************************************************************
 *@Function: 			PopupList_Select
 *@Description: 	读取链表
 *@Calls: 				STM32_Lib_3.30
 *@Updated: 			V0.0.1
 *@Input: 				none
 *@Return: 				struct PopupList *head -- 头链表
 *@Note:   				none
 **********************************************************************************************************/
struct PopupList *PopupList_Select ( struct PopupList *head, Popuplib_uint16_t *pPopupID );

/**********************************************************************************************************
 *@Function: 			PopupList_Insert
 *@Description: 	链表插入操作
 *@Calls: 				STM32_Lib_3.30
 *@Updated: 			V0.0.1
 *@Input: 				struct PopupList *head -- 头链表
 *              	struct PopupList *newList -- 需插入链表
 *@Return: 				struct PopupList *head -- 头链表
 *@Note:   				none
 **********************************************************************************************************/
struct PopupList *PopupList_Insert ( struct PopupList *head, struct PopupList *newList );

/**********************************************************************************************************
 *@Function: 			PopupList_Delete
 *@Description: 	删除固定编号的消息
 *@Calls: 				STM32_Lib_3.30
 *@Updated: 			V0.0.1
 *@Input: 				uint8_t num -- 消息编号
 *@Return: 				struct PopupList *RecvMsgPollHead -- 消息池头
 *@Note:   				none
 **********************************************************************************************************/
struct PopupList *PopupList_Delete ( struct PopupList *head, Popuplib_uint16_t PopupID );

/**********************************************************************************************************
 *@Function: 			PopupList_Destroy
 *@Description:		消息池销毁操作
 *@Calls: 				STM32_Lib_3.30
 *@Updated: 			V0.0.1
 *@Input:					none
 *@Return: 				struct PopupList *head -- 消息池头
 *@Note:   				none
 **********************************************************************************************************/
struct PopupList *PopupList_Destroy ( struct PopupList *head );

/**********************************************************************************************************
 **********************************************************************************************************/
#endif