| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #include "wanning.h"
- #include "fifo.h"
- #include "pthread.h"
- #include "rtthread.h"
- typedef struct {
- GenericFixedList *list;
- pthread_mutex_t mutex;
- }wanning_cache_t;
- static wanning_cache_t wan;
- waning_info_t *next = NULL;
- void wanning_init()
- {
- wan.list = generic_list_create(MAX_WANIING_LENTH);
- pthread_mutex_init(&wan.mutex,NULL);
- }
- void wanning_insert(waning_info_t wanning)
- {
- pthread_mutex_lock(&wan.mutex);
- generic_list_append(wan.list,&wanning,sizeof(waning_info_t));
- pthread_mutex_unlock(&wan.mutex);
- }
- int wanning_get_count()
- {
- int val = 0;
- pthread_mutex_lock(&wan.mutex);
- val = generic_list_get_count(wan.list);
- pthread_mutex_unlock(&wan.mutex);
- return val;
- }
- int wanning_clean()
- {
- pthread_mutex_lock(&wan.mutex);
- generic_list_clean(wan.list);
- pthread_mutex_unlock(&wan.mutex);
- }
- int wanning_get(waning_info_t *waning,uint8_t lenth)
- {
- if(waning)
- {
- pthread_mutex_lock(&wan.mutex);
- generic_list_get(wan.list,waning,lenth);
- pthread_mutex_unlock(&wan.mutex);
- }
- return 0;
- }
- waning_info_t * waning_get_info(uint8_t index)
- {
- waning_info_t *info = NULL;
- pthread_mutex_lock(&wan.mutex);
- info = (waning_info_t *)generic_list_get_index(wan.list,index);
- pthread_mutex_unlock(&wan.mutex);
- return info;
- }
- void wanning_deinit()
- {
-
- }
|