* @brief This function will take (force) an id in an IDA object * * @param ida is the IDA object * * @param id is the id that want to take * * @return the result of taking */
| 94 | * @return the result of taking |
| 95 | */ |
| 96 | rt_bool_t rt_dm_ida_take(struct rt_dm_ida *ida, int id) |
| 97 | { |
| 98 | RT_ASSERT(ida != RT_NULL); |
| 99 | RT_ASSERT(id >= 0); |
| 100 | |
| 101 | rt_spin_lock(&ida->lock); |
| 102 | |
| 103 | if (!rt_bitmap_test_bit(ida->map, id)) |
| 104 | { |
| 105 | rt_bitmap_set_bit(ida->map, id); |
| 106 | } |
| 107 | else |
| 108 | { |
| 109 | id = RT_DM_IDA_NUM; |
| 110 | } |
| 111 | |
| 112 | rt_spin_unlock(&ida->lock); |
| 113 | |
| 114 | return id != RT_DM_IDA_NUM; |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * @brief This function will release an id in an IDA object |
nothing calls this directly
no test coverage detected