mutex.h
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:2k
- /*
- * include/mutex.h
- *
- * Copyright (C) STMicroelectronics Limited 2002. All rights reserved.
- *
- * Public header file for the OS20 mutex objects
- */
- #ifndef __os20_mutex_h
- #define __os20_mutex_h
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include "semaphor.h"
- struct mutex_class_s;
- typedef struct mutex_s {
- const struct mutex_class_s *mutex_class; /* class pointer */
- semaphore_t mutex_sem; /* underlying semaphore */
- task_t *mutex_owner; /* owner task */
- int mutex_count; /* lock count */
- struct mutex_s *mutex_next; /* link when listed */
- } mutex_t;
- #ifdef __CORE__
- #pragma ST_translate (mutex_init_fifo, "mutex_init_fifo%os")
- #pragma ST_translate (mutex_create_fifo, "mutex_create_fifo%os")
- #pragma ST_translate (mutex_init_priority, "mutex_init_priority%os")
- #pragma ST_translate (mutex_create_priority, "mutex_create_priority%os")
- #pragma ST_translate (mutex_delete, "mutex_delete%os")
- #pragma ST_translate (mutex_lock, "mutex_lock%os")
- #pragma ST_translate (mutex_release, "mutex_release%os")
- #pragma ST_translate (mutex_trylock, "mutex_trylock%os")
- #else
- #pragma IMS_translate (mutex_init_fifo, "mutex_init_fifo%os")
- #pragma IMS_translate (mutex_create_fifo, "mutex_create_fifo%os")
- #pragma IMS_translate (mutex_init_priority, "mutex_init_priority%os")
- #pragma IMS_translate (mutex_create_priority, "mutex_create_priority%os")
- #pragma IMS_translate (mutex_delete, "mutex_delete%os")
- #pragma IMS_translate (mutex_lock, "mutex_lock%os")
- #pragma IMS_translate (mutex_release, "mutex_release%os")
- #endif
- void mutex_init_fifo (mutex_t *mutex);
- mutex_t *mutex_create_fifo (void);
- void mutex_init_priority (mutex_t *mutex);
- mutex_t *mutex_create_priority (void);
- int mutex_delete (mutex_t *mutex);
- void mutex_lock (mutex_t *mutex);
- int mutex_release (mutex_t *mutex);
- int mutex_trylock (mutex_t *mutex);
- #ifdef __cplusplus
- }
- #endif
- #endif /* __os20_mutex_h */