···11+/***************************************************************************
22+ * __________ __ ___.
33+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
44+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
55+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
66+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
77+ * \/ \/ \/ \/ \/
88+ * $Id$
99+ *
1010+ * Copyright (C) 2024 - Tsiry Sandratraina
1111+ *
1212+ * This program is free software; you can redistribute it and/or
1313+ * modify it under the terms of the GNU General Public License
1414+ * as published by the Free Software Foundation; either version 2
1515+ * of the License, or (at your option) any later version.
1616+ *
1717+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
1818+ * KIND, either express or implied.
1919+ *
2020+ ****************************************************************************/
2121+#include "config.h"
2222+#include "system.h"
2323+#include "kernel.h"
2424+#include "logf.h"
2525+#include "appevents.h"
2626+2727+bool broker_is_initialized = false;
2828+2929+/* Broker thread */
3030+static long broker_stack[(DEFAULT_STACK_SIZE * 4)/sizeof(long)];
3131+static const char broker_thread_name[] = "broker";
3232+unsigned int broker_thread_id = 0;
3333+3434+extern void start_broker(void);
3535+3636+extern void debugfn(const char *fmt);
3737+3838+static void broker_thread(void) {
3939+ start_broker();
4040+}
4141+4242+/** -- Startup -- **/
4343+4444+/* Initialize the broker - called from init() in main.c */
4545+void INIT_ATTR broker_init(void)
4646+{
4747+ /* Can never do this twice */
4848+ if (broker_is_initialized)
4949+ {
5050+ logf("broker: already initialized");
5151+ return;
5252+ }
5353+5454+ logf("broker: initializing");
5555+5656+ /* Initialize queues before giving control elsewhere in case it likes
5757+ to send messages. Thread creation will be delayed however so nothing
5858+ starts running until ready if something yields such as talk_init. */
5959+ // queue_init(&server_queue, true);
6060+ broker_thread_id = create_thread(broker_thread, broker_stack,
6161+ sizeof(broker_stack), 0, broker_thread_name
6262+ IF_PRIO(, PRIORITY_USER_INTERFACE)
6363+ IF_COP(, CPU));
6464+6565+ sleep(HZ); /* Give it a chance to start */
6666+6767+ /* Probably safe to say */
6868+ broker_is_initialized = true;
6969+}
+27
apps/broker_thread.h
···11+/***************************************************************************
22+ * __________ __ ___.
33+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
44+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
55+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
66+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
77+ * \/ \/ \/ \/ \/
88+ * $Id$
99+ *
1010+ * Copyright (C) 2024 - Tsiry Sandratraina
1111+ *
1212+ * This program is free software; you can redistribute it and/or
1313+ * modify it under the terms of the GNU General Public License
1414+ * as published by the Free Software Foundation; either version 2
1515+ * of the License, or (at your option) any later version.
1616+ *
1717+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
1818+ * KIND, either express or implied.
1919+ *
2020+ ****************************************************************************/
2121+#ifndef BROKER_THREAD_H
2222+#define BROKER_THREAD_H
2323+2424+2525+void broker_init(void);
2626+2727+#endif /* BROKER_THREAD_H */
···77 * \/ \/ \/ \/ \/
88 * $Id$
99 *
1010- * Copyright (C) 2005-2007 Miika Pekkarinen
1111- * Copyright (C) 2007-2008 Nicolas Pennequin
1212- * Copyright (C) 2011-2013 Michael Sevakis
1010+ * Copyright (C) 2024 - Tsiry Sandratraina
1311 *
1412 * This program is free software; you can redistribute it and/or
1513 * modify it under the terms of the GNU General Public License
···2725#include "appevents.h"
28262927bool server_is_initialized = false;
3030-3131-/* Event queues */
3232-// struct event_queue server_queue SHAREDBSS_ATTR;
3333-// static struct queue_sender_list server_queue_sender_list SHAREDBSS_ATTR;
34283529/* Server thread */
3630static long server_stack[(DEFAULT_STACK_SIZE * 4)/sizeof(long)];
+1-7
apps/server_thread.h
···77 * \/ \/ \/ \/ \/
88 * $Id$
99 *
1010- * Copyright (C) 2005-2007 Miika Pekkarinen
1111- * Copyright (C) 2007-2008 Nicolas Pennequin
1212- * Copyright (C) 2011-2013 Michael Sevakis
1010+ * Copyright (C) 2024 - Tsiry Sandratraina
1311 *
1412 * This program is free software; you can redistribute it and/or
1513 * modify it under the terms of the GNU General Public License
···2220 ****************************************************************************/
2321#ifndef SERVER_THREAD_H
2422#define SERVER_THREAD_H
2525-2626-2727-/* (*) If you change these, you must check audio_clear_track_notifications
2828- in playback.c for correctness */
29233024void server_init(void);
3125