Bluetooth: controller: Remove util/config.h

Remove util/config.h and unnecessary redefinitions of
caller ids.

Change-id: I85bb9ae3ab7ff9fcce18c886cfa3e33c91ebb670
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
This commit is contained in:
Vinayak Chettimada 2017-03-30 10:12:56 +02:00 committed by Johan Hedberg
commit 1277eea15e
7 changed files with 102 additions and 148 deletions

View file

@ -22,7 +22,6 @@
#include "hal/radio.h"
#include "hal/debug.h"
#include "util/config.h"
#include "util/util.h"
#include "util/mem.h"
#include "util/memq.h"

View file

@ -64,9 +64,9 @@
#define RADIO_TICKER_USERS 3
#define RADIO_TICKER_USER_ID_WORKER TICKER_MAYFLY_CALL_ID_WORKER0
#define RADIO_TICKER_USER_ID_JOB TICKER_MAYFLY_CALL_ID_JOB0
#define RADIO_TICKER_USER_ID_APP TICKER_MAYFLY_CALL_ID_PROGRAM
#define RADIO_TICKER_USER_ID_WORKER MAYFLY_CALL_ID_0
#define RADIO_TICKER_USER_ID_JOB MAYFLY_CALL_ID_1
#define RADIO_TICKER_USER_ID_APP MAYFLY_CALL_ID_PROGRAM
#define RADIO_TICKER_USER_ID_WORKER_PRIO TICKER_MAYFLY_CALL_ID_WORKER0_PRIO
#define RADIO_TICKER_USER_ID_JOB_PRIO TICKER_MAYFLY_CALL_ID_JOB0_PRIO

View file

@ -25,7 +25,6 @@
#include "hal/radio.h"
#include "hal/debug.h"
#include "util/config.h"
#include "util/util.h"
#include "util/mem.h"
#include "util/mayfly.h"

View file

@ -8,7 +8,6 @@
#include <stdint.h>
#include <soc.h>
#include "util/config.h"
#include "hal/cntr.h"
#include "ticker.h"
@ -1181,34 +1180,40 @@ static inline void ticker_job(struct ticker_instance *instance)
static uint8_t ticker_instance0_caller_id_get(uint8_t user_id)
{
if (user_id == TICKER_MAYFLY_CALL_ID_PROGRAM) {
return CALL_ID_USER;
} else if (user_id == TICKER_MAYFLY_CALL_ID_JOB0) {
return CALL_ID_JOB;
} else if (user_id == TICKER_MAYFLY_CALL_ID_WORKER0) {
switch (user_id) {
case MAYFLY_CALL_ID_0:
return CALL_ID_WORKER;
} else if (user_id == TICKER_MAYFLY_CALL_ID_TRIGGER) {
return CALL_ID_TRIGGER;
}
LL_ASSERT(0);
case MAYFLY_CALL_ID_1:
return CALL_ID_JOB;
case MAYFLY_CALL_ID_PROGRAM:
return CALL_ID_USER;
case MAYFLY_CALL_ID_2:
default:
LL_ASSERT(0);
break;
}
return 0;
}
static uint8_t ticker_instance1_caller_id_get(uint8_t user_id)
{
if (user_id == TICKER_MAYFLY_CALL_ID_PROGRAM) {
return CALL_ID_USER;
} else if (user_id == TICKER_MAYFLY_CALL_ID_JOB1) {
switch (user_id) {
case MAYFLY_CALL_ID_2:
return CALL_ID_JOB;
} else if (user_id == TICKER_MAYFLY_CALL_ID_WORKER1) {
return CALL_ID_WORKER;
} else if (user_id == TICKER_MAYFLY_CALL_ID_TRIGGER) {
return CALL_ID_TRIGGER;
}
LL_ASSERT(0);
case MAYFLY_CALL_ID_PROGRAM:
return CALL_ID_USER;
case MAYFLY_CALL_ID_0:
case MAYFLY_CALL_ID_1:
default:
LL_ASSERT(0);
break;
}
return 0;
}
@ -1232,24 +1237,8 @@ static void ticker_instance0_sched(uint8_t caller_id, uint8_t callee_id,
(void *)ticker_worker
};
mayfly_enqueue(TICKER_MAYFLY_CALL_ID_TRIGGER,
TICKER_MAYFLY_CALL_ID_WORKER0,
chain,
&m);
}
break;
case CALL_ID_JOB:
{
static void *link[2];
static struct mayfly m = {
0, 0, link,
(void *)&_instance[0],
(void *)ticker_job
};
mayfly_enqueue(TICKER_MAYFLY_CALL_ID_TRIGGER,
TICKER_MAYFLY_CALL_ID_JOB0,
mayfly_enqueue(MAYFLY_CALL_ID_0,
MAYFLY_CALL_ID_0,
chain,
&m);
}
@ -1272,8 +1261,8 @@ static void ticker_instance0_sched(uint8_t caller_id, uint8_t callee_id,
(void *)ticker_job
};
mayfly_enqueue(TICKER_MAYFLY_CALL_ID_WORKER0,
TICKER_MAYFLY_CALL_ID_JOB0,
mayfly_enqueue(MAYFLY_CALL_ID_0,
MAYFLY_CALL_ID_1,
chain,
&m);
}
@ -1296,8 +1285,8 @@ static void ticker_instance0_sched(uint8_t caller_id, uint8_t callee_id,
(void *)ticker_worker
};
mayfly_enqueue(TICKER_MAYFLY_CALL_ID_JOB0,
TICKER_MAYFLY_CALL_ID_WORKER0,
mayfly_enqueue(MAYFLY_CALL_ID_1,
MAYFLY_CALL_ID_0,
chain,
&m);
}
@ -1312,8 +1301,33 @@ static void ticker_instance0_sched(uint8_t caller_id, uint8_t callee_id,
(void *)ticker_job
};
mayfly_enqueue(TICKER_MAYFLY_CALL_ID_JOB0,
TICKER_MAYFLY_CALL_ID_JOB0,
mayfly_enqueue(MAYFLY_CALL_ID_1,
MAYFLY_CALL_ID_1,
chain,
&m);
}
break;
default:
LL_ASSERT(0);
break;
}
break;
case CALL_ID_USER:
switch (callee_id) {
case CALL_ID_JOB:
{
static void *link[2];
static struct mayfly m = {
0, 0, link,
(void *)&_instance[0],
(void *)ticker_job
};
/* TODO: scheduler lock, if OS used */
mayfly_enqueue(MAYFLY_CALL_ID_PROGRAM,
MAYFLY_CALL_ID_1,
chain,
&m);
}
@ -1326,28 +1340,7 @@ static void ticker_instance0_sched(uint8_t caller_id, uint8_t callee_id,
break;
default:
switch (callee_id) {
case CALL_ID_JOB:
{
static void *link[2];
static struct mayfly m = {
0, 0, link,
(void *)&_instance[0],
(void *)ticker_job
};
/* TODO: scheduler lock, if OS used */
mayfly_enqueue(TICKER_MAYFLY_CALL_ID_PROGRAM,
TICKER_MAYFLY_CALL_ID_JOB0,
chain,
&m);
}
break;
default:
LL_ASSERT(0);
break;
}
LL_ASSERT(0);
break;
}
}
@ -1371,24 +1364,8 @@ static void ticker_instance1_sched(uint8_t caller_id, uint8_t callee_id,
(void *)ticker_worker
};
mayfly_enqueue(TICKER_MAYFLY_CALL_ID_TRIGGER,
TICKER_MAYFLY_CALL_ID_WORKER1,
chain,
&m);
}
break;
case CALL_ID_JOB:
{
static void *link[2];
static struct mayfly m = {
0, 0, link,
(void *)&_instance[1],
(void *)ticker_job
};
mayfly_enqueue(TICKER_MAYFLY_CALL_ID_TRIGGER,
TICKER_MAYFLY_CALL_ID_JOB1,
mayfly_enqueue(MAYFLY_CALL_ID_0,
MAYFLY_CALL_ID_2,
chain,
&m);
}
@ -1411,8 +1388,8 @@ static void ticker_instance1_sched(uint8_t caller_id, uint8_t callee_id,
(void *)ticker_job
};
mayfly_enqueue(TICKER_MAYFLY_CALL_ID_WORKER1,
TICKER_MAYFLY_CALL_ID_JOB1,
mayfly_enqueue(MAYFLY_CALL_ID_2,
MAYFLY_CALL_ID_2,
chain,
&m);
}
@ -1435,8 +1412,8 @@ static void ticker_instance1_sched(uint8_t caller_id, uint8_t callee_id,
(void *)ticker_worker
};
mayfly_enqueue(TICKER_MAYFLY_CALL_ID_JOB1,
TICKER_MAYFLY_CALL_ID_WORKER1,
mayfly_enqueue(MAYFLY_CALL_ID_2,
MAYFLY_CALL_ID_2,
chain,
&m);
}
@ -1451,8 +1428,33 @@ static void ticker_instance1_sched(uint8_t caller_id, uint8_t callee_id,
(void *)ticker_job
};
mayfly_enqueue(TICKER_MAYFLY_CALL_ID_JOB1,
TICKER_MAYFLY_CALL_ID_JOB1,
mayfly_enqueue(MAYFLY_CALL_ID_2,
MAYFLY_CALL_ID_2,
chain,
&m);
}
break;
default:
LL_ASSERT(0);
break;
}
break;
case CALL_ID_USER:
switch (callee_id) {
case CALL_ID_JOB:
{
static void *link[2];
static struct mayfly m = {
0, 0, link,
(void *)&_instance[1],
(void *)ticker_job
};
/* TODO: scheduler lock, if OS used */
mayfly_enqueue(MAYFLY_CALL_ID_PROGRAM,
MAYFLY_CALL_ID_2,
chain,
&m);
}
@ -1465,28 +1467,7 @@ static void ticker_instance1_sched(uint8_t caller_id, uint8_t callee_id,
break;
default:
switch (callee_id) {
case CALL_ID_JOB:
{
static void *link[2];
static struct mayfly m = {
0, 0, link,
(void *)&_instance[1],
(void *)ticker_job
};
/* TODO: scheduler lock, if OS used */
mayfly_enqueue(TICKER_MAYFLY_CALL_ID_PROGRAM,
TICKER_MAYFLY_CALL_ID_JOB1,
chain,
&m);
}
break;
default:
LL_ASSERT(0);
break;
}
LL_ASSERT(0);
break;
}
}

View file

@ -1,30 +0,0 @@
/*
* Copyright (c) 2016 Nordic Semiconductor ASA
* Copyright (c) 2016 Vinayak Kariappa Chettimada
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _CONFIG_H_
#define _CONFIG_H_
#define MAYFLY_CALL_ID_0 0
#define MAYFLY_CALL_ID_1 1
#define MAYFLY_CALL_ID_2 2
#define MAYFLY_CALL_ID_PROGRAM 3
#define MAYFLY_CALLER_COUNT 4
#define MAYFLY_CALLEE_COUNT 4
#define TICKER_MAYFLY_CALL_ID_TRIGGER MAYFLY_CALL_ID_0
#define TICKER_MAYFLY_CALL_ID_WORKER0 MAYFLY_CALL_ID_0
#define TICKER_MAYFLY_CALL_ID_WORKER1 MAYFLY_CALL_ID_2
#define TICKER_MAYFLY_CALL_ID_JOB0 MAYFLY_CALL_ID_1
#define TICKER_MAYFLY_CALL_ID_JOB1 MAYFLY_CALL_ID_2
#define TICKER_MAYFLY_CALL_ID_PROGRAM MAYFLY_CALL_ID_PROGRAM
#define TICKER_MAYFLY_CALL_ID_WORKER0_PRIO 0
#define TICKER_MAYFLY_CALL_ID_WORKER1_PRIO 1
#define TICKER_MAYFLY_CALL_ID_JOB0_PRIO 0
#define TICKER_MAYFLY_CALL_ID_JOB1_PRIO 1
#endif /* _CONFIG_H_ */

View file

@ -9,8 +9,6 @@
#include "memq.h"
#include "mayfly.h"
#include "config.h"
static struct {
void *head;
void *tail;

View file

@ -8,6 +8,13 @@
#ifndef _MAYFLY_H_
#define _MAYFLY_H_
#define MAYFLY_CALL_ID_0 0
#define MAYFLY_CALL_ID_1 1
#define MAYFLY_CALL_ID_2 2
#define MAYFLY_CALL_ID_PROGRAM 3
#define MAYFLY_CALLER_COUNT 4
#define MAYFLY_CALLEE_COUNT 4
struct mayfly {
uint8_t volatile _req;
uint8_t _ack;