basic work on uart

This commit is contained in:
2018-01-13 19:49:12 +01:00
parent 8852f9f8b4
commit d49081b190
13 changed files with 275 additions and 140 deletions
+6 -4
View File
@@ -73,7 +73,7 @@ error_t rsc_claim(Unit *unit, Resource rsc)
assert_param(rsc < RESOURCE_COUNT);
assert_param(unit != NULL);
// dbg("%s claims %s", unit->name, rsc_get_name(rsc));
rsc_dbg("%s claims %s", unit->name, rsc_get_name(rsc));
if (RSC_IS_HELD(global_rscmap, rsc)) {
// this whole branch is just reporting the error
@@ -81,11 +81,13 @@ error_t rsc_claim(Unit *unit, Resource rsc)
Unit *holder = ureg_get_rsc_owner(rsc);
assert_param(holder != NULL);
dbg("ERROR!! Unit %s failed to claim resource %s, already held by %s!",
dbg("ERROR!! Unit %s failed to claim rsc %s, already held by %s!",
unit->name,
rsc_get_name(rsc),
holder->name);
if (holder == unit) dbg("DOUBLE CLAIM, This is probably a bug!");
unit->failed_rsc = rsc;
return E_RESOURCE_NOT_AVAILABLE;
@@ -156,7 +158,7 @@ void rsc_free(Unit *unit, Resource rsc)
assert_param(rsc_initialized);
assert_param(rsc < RESOURCE_COUNT);
// dbg("Free resource %s", rsc_get_name(rsc));
rsc_dbg("Free resource %s", rsc_get_name(rsc));
if (RSC_IS_FREE(global_rscmap, rsc)) return;
@@ -211,7 +213,7 @@ void rsc_teardown(Unit *unit)
assert_param(rsc_initialized);
assert_param(unit != NULL);
// dbg("Tearing down unit %s", unit->name);
rsc_dbg("Tearing down unit %s", unit->name);
deinit_unit_pins(unit);
for (uint32_t i = 0; i < RSCMAP_LEN; i++) {
+2
View File
@@ -9,6 +9,8 @@
#include "unit.h"
#include "rsc_enum.h"
#define rsc_dbg(fmt, ...) dbg("[RSC] "fmt, ##__VA_ARGS__)
#define CHECK_SUC() do { if (!suc) return false; } while (0)
void rsc_init_registry(void);
+2 -1
View File
@@ -15,7 +15,8 @@
X(TIM1) X(TIM2) X(TIM3) X(TIM4) X(TIM5) \
X(TIM6) X(TIM7) X(TIM8) X(TIM9) X(TIM10) X(TIM11) X(TIM12) X(TIM13) X(TIM14) \
X(TIM15) X(TIM16) X(TIM17) \
X(DMA1) X(DMA2)
X(DMA1_1) X(DMA1_2) X(DMA1_3) X(DMA1_4) X(DMA1_5) X(DMA1_6) X(DMA1_7) X(DMA1_8) \
X(DMA2_1) X(DMA2_2) X(DMA2_3) X(DMA2_4) X(DMA2_5) X(DMA2_6) X(DMA2_7) X(DMA2_8)
// Resources not used anywhere:
// X(I2S1) X(I2S2) X(I2S3)