resource_id.h 647 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2021-08-25 RT-Thread First version
  9. */
  10. #ifndef RESOURCE_ID_H__
  11. #define RESOURCE_ID_H__
  12. #include <rthw.h>
  13. #include <rtthread.h>
  14. #define RESOURCE_ID_INIT(size, pool) {size, pool, 0, RT_NULL}
  15. typedef struct
  16. {
  17. int size;
  18. void **_res;
  19. int noused;
  20. void **_free;
  21. } resource_id_t;
  22. void resource_id_init(resource_id_t *mgr, int size, void **res);
  23. int resource_id_get(resource_id_t *mgr);
  24. void resource_id_put(resource_id_t *mgr, int no);
  25. #endif /*RESOURCE_ID_H__*/