samples: use k_thread_create()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
68d3678abb
commit
39962dc92c
|
@ -30,6 +30,7 @@
|
|||
|
||||
static struct device *hci_uart_dev;
|
||||
static BT_STACK_NOINIT(tx_thread_stack, CONFIG_BLUETOOTH_HCI_TX_STACK_SIZE);
|
||||
static struct k_thread tx_thread_data;
|
||||
|
||||
/* HCI command buffers */
|
||||
#define CMD_BUF_SIZE BT_BUF_RX_SIZE
|
||||
|
@ -348,8 +349,9 @@ void main(void)
|
|||
/* Spawn the TX thread and start feeding commands and data to the
|
||||
* controller
|
||||
*/
|
||||
k_thread_spawn(tx_thread_stack, sizeof(tx_thread_stack), tx_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);
|
||||
k_thread_create(&tx_thread_data, tx_thread_stack,
|
||||
sizeof(tx_thread_stack), tx_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);
|
||||
|
||||
while (1) {
|
||||
struct net_buf *buf;
|
||||
|
|
|
@ -36,6 +36,7 @@ static struct in6_addr in6addr_my = MY_IP6ADDR;
|
|||
|
||||
#define STACKSIZE 2000
|
||||
char __noinit __stack thread_stack[STACKSIZE];
|
||||
static struct k_thread thread_data;
|
||||
|
||||
#define MAX_DBG_PRINT 64
|
||||
|
||||
|
@ -357,7 +358,7 @@ void main(void)
|
|||
|
||||
printk("Advertising successfully started\n");
|
||||
|
||||
k_thread_spawn(&thread_stack[0], STACKSIZE,
|
||||
(k_thread_entry_t)listen,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
k_thread_create(&thread_data, thread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)listen,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
|
@ -412,6 +412,7 @@ exit:
|
|||
|
||||
#define STACK_SIZE 4096
|
||||
u8_t stack[STACK_SIZE];
|
||||
static struct k_thread thread_data;
|
||||
|
||||
static inline int init_app(void)
|
||||
{
|
||||
|
@ -440,6 +441,7 @@ void main(void)
|
|||
return;
|
||||
}
|
||||
|
||||
k_thread_spawn(stack, STACK_SIZE, (k_thread_entry_t) dtls_client,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
k_thread_create(&thread_data, stack, STACK_SIZE,
|
||||
(k_thread_entry_t) dtls_client,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
|
@ -633,6 +633,7 @@ exit:
|
|||
|
||||
#define STACK_SIZE 4096
|
||||
u8_t stack[STACK_SIZE];
|
||||
static struct k_thread thread_data;
|
||||
|
||||
static inline int init_app(void)
|
||||
{
|
||||
|
@ -660,7 +661,8 @@ void main(void)
|
|||
return;
|
||||
}
|
||||
|
||||
k_thread_spawn(stack, STACK_SIZE, (k_thread_entry_t) dtls_server,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
k_thread_create(&thread_data, stack, STACK_SIZE,
|
||||
(k_thread_entry_t) dtls_server,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#define STACKSIZE 2000
|
||||
char __noinit __stack thread_stack[STACKSIZE];
|
||||
static struct k_thread thread_data;
|
||||
|
||||
static struct net_mgmt_event_callback mgmt_cb;
|
||||
|
||||
|
@ -78,7 +79,7 @@ void main(void)
|
|||
{
|
||||
NET_INFO("In main");
|
||||
|
||||
k_thread_spawn(&thread_stack[0], STACKSIZE,
|
||||
(k_thread_entry_t)main_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
k_thread_create(&thread_data, &thread_stack[0], STACKSIZE,
|
||||
(k_thread_entry_t)main_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#define STACKSIZE 2000
|
||||
char __noinit __stack thread_stack[STACKSIZE];
|
||||
static struct k_thread thread_data;
|
||||
|
||||
#define DNS_TIMEOUT 2000 /* ms */
|
||||
|
||||
|
@ -281,7 +282,7 @@ void main(void)
|
|||
{
|
||||
NET_INFO("Starting DNS resolve sample");
|
||||
|
||||
k_thread_spawn(&thread_stack[0], STACKSIZE,
|
||||
(k_thread_entry_t)network_setup,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
k_thread_create(&thread_data, thread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)network_setup,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
|
@ -160,10 +160,12 @@ static struct sockaddr_in6 peer_addr6 = {
|
|||
|
||||
#if defined(CONFIG_NET_UDP)
|
||||
static char __noinit __stack ipv6_udp_stack[STACKSIZE];
|
||||
static struct k_thread ipv6_udp_thread_data;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_TCP)
|
||||
static char __noinit __stack ipv6_tcp_stack[STACKSIZE];
|
||||
static struct k_thread ipv6_tcp_thread_data;
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_NET_IPV6 */
|
||||
|
@ -189,10 +191,12 @@ static struct sockaddr_in peer_addr4 = {
|
|||
|
||||
#if defined(CONFIG_NET_UDP)
|
||||
static char __noinit __stack ipv4_udp_stack[STACKSIZE];
|
||||
static struct k_thread ipv4_udp_thread_data;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_TCP)
|
||||
static char __noinit __stack ipv4_tcp_stack[STACKSIZE];
|
||||
static struct k_thread ipv4_tcp_thread_data;
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_NET_IPV4 */
|
||||
|
@ -870,27 +874,27 @@ static void event_iface_up(struct net_mgmt_event_callback *cb,
|
|||
}
|
||||
|
||||
#if defined(CONFIG_NET_IPV4) && defined(CONFIG_NET_UDP)
|
||||
k_thread_spawn(ipv4_udp_stack, STACKSIZE,
|
||||
(k_thread_entry_t)send_udp_ipv4,
|
||||
udp_send4, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
k_thread_create(&ipv4_udp_thread_data, ipv4_udp_stack, STACKSIZE,
|
||||
(k_thread_entry_t)send_udp_ipv4,
|
||||
udp_send4, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_IPV4) && defined(CONFIG_NET_TCP)
|
||||
k_thread_spawn(ipv4_tcp_stack, STACKSIZE,
|
||||
(k_thread_entry_t)send_tcp_ipv4,
|
||||
tcp_send4, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
k_thread_create(&ipv4_tcp_thread_data, ipv4_tcp_stack, STACKSIZE,
|
||||
(k_thread_entry_t)send_tcp_ipv4,
|
||||
tcp_send4, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_IPV6) && defined(CONFIG_NET_UDP)
|
||||
k_thread_spawn(ipv6_udp_stack, STACKSIZE,
|
||||
(k_thread_entry_t)send_udp_ipv6,
|
||||
udp_send6, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
k_thread_create(&ipv6_udp_thread_data, ipv6_udp_stack, STACKSIZE,
|
||||
(k_thread_entry_t)send_udp_ipv6,
|
||||
udp_send6, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_IPV6) && defined(CONFIG_NET_TCP)
|
||||
k_thread_spawn(ipv6_tcp_stack, STACKSIZE,
|
||||
(k_thread_entry_t)send_tcp_ipv6,
|
||||
tcp_send6, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
k_thread_create(&ipv6_tcp_thread_data, ipv6_tcp_stack, STACKSIZE,
|
||||
(k_thread_entry_t)send_tcp_ipv6,
|
||||
tcp_send6, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -90,6 +90,7 @@ static struct net_buf_pool *data_udp_pool(void)
|
|||
|
||||
#define STACKSIZE 2000
|
||||
char __noinit __stack thread_stack[STACKSIZE];
|
||||
static struct k_thread thread_data;
|
||||
|
||||
#define MAX_DBG_PRINT 64
|
||||
|
||||
|
@ -582,7 +583,7 @@ void main(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
k_thread_spawn(&thread_stack[0], STACKSIZE,
|
||||
(k_thread_entry_t)receive,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
k_thread_create(&thread_data, thread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)receive,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
|
@ -367,6 +367,7 @@ exit:
|
|||
|
||||
#define STACK_SIZE 8192
|
||||
u8_t stack[STACK_SIZE];
|
||||
struct k_thread https_thread;
|
||||
|
||||
static inline int init_app(void)
|
||||
{
|
||||
|
@ -400,7 +401,7 @@ void https_server_start(void)
|
|||
return;
|
||||
}
|
||||
|
||||
k_thread_spawn(stack, STACK_SIZE, (k_thread_entry_t) https_server,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
|
||||
k_thread_create(&https_thread, stack, STACK_SIZE,
|
||||
(k_thread_entry_t) https_server,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#define STACK_SIZE 2048
|
||||
u8_t stack[STACK_SIZE];
|
||||
static struct k_thread bot_thread;
|
||||
|
||||
#define CMD_BUFFER_SIZE 256
|
||||
static u8_t cmd_buf[CMD_BUFFER_SIZE];
|
||||
|
@ -1068,6 +1069,7 @@ static void irc_bot(void)
|
|||
|
||||
void main(void)
|
||||
{
|
||||
k_thread_spawn(stack, STACK_SIZE, (k_thread_entry_t)irc_bot,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
k_thread_create(&bot_thread, stack, STACK_SIZE,
|
||||
(k_thread_entry_t)irc_bot,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
|
@ -285,6 +285,7 @@ exit:
|
|||
|
||||
#define STACK_SIZE 8192
|
||||
u8_t stack[STACK_SIZE];
|
||||
static struct k_thread dtls_thread;
|
||||
|
||||
static inline int init_app(void)
|
||||
{
|
||||
|
@ -328,7 +329,8 @@ void main(void)
|
|||
return;
|
||||
}
|
||||
|
||||
k_thread_spawn(stack, STACK_SIZE, (k_thread_entry_t) dtls_client,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
k_thread_create(&dtls_thread, stack, STACK_SIZE,
|
||||
(k_thread_entry_t) dtls_client,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
|
||||
}
|
||||
|
|
|
@ -363,6 +363,7 @@ exit:
|
|||
|
||||
#define STACK_SIZE 8192
|
||||
u8_t stack[STACK_SIZE];
|
||||
static struct k_thread dtls_thread;
|
||||
|
||||
static inline int init_app(void)
|
||||
{
|
||||
|
@ -405,7 +406,7 @@ void main(void)
|
|||
return;
|
||||
}
|
||||
|
||||
k_thread_spawn(stack, STACK_SIZE, (k_thread_entry_t) dtls_server,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
|
||||
k_thread_create(&dtls_thread, stack, STACK_SIZE,
|
||||
(k_thread_entry_t) dtls_server,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
|
@ -316,9 +316,11 @@ exit:
|
|||
|
||||
#define STACK_SIZE 8192
|
||||
u8_t stack[STACK_SIZE];
|
||||
static struct k_thread tls_thread;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
k_thread_spawn(stack, STACK_SIZE, (k_thread_entry_t) tls_client,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
k_thread_create(&tls_thread, stack, STACK_SIZE,
|
||||
(k_thread_entry_t) tls_client,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ static bool fake_led;
|
|||
#define DEFAULT_PORT 4222
|
||||
|
||||
static u8_t stack[2048];
|
||||
static struct k_thread thread_data;
|
||||
|
||||
static void panic(const char *msg)
|
||||
{
|
||||
|
@ -320,6 +321,7 @@ static void nats_client(void)
|
|||
|
||||
void main(void)
|
||||
{
|
||||
k_thread_spawn(stack, sizeof(stack), (k_thread_entry_t)nats_client,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
k_thread_create(&thread_data, stack, sizeof(stack),
|
||||
(k_thread_entry_t)nats_client,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#define STACKSIZE 2000
|
||||
char __noinit __stack thread_stack[STACKSIZE];
|
||||
static struct k_thread thread_data;
|
||||
|
||||
#if defined(CONFIG_NET_DHCPV4)
|
||||
static struct net_mgmt_event_callback mgmt_cb;
|
||||
|
@ -144,7 +145,7 @@ void main(void)
|
|||
{
|
||||
NET_INFO("Starting Telnet sample");
|
||||
|
||||
k_thread_spawn(&thread_stack[0], STACKSIZE,
|
||||
(k_thread_entry_t)network_setup,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
k_thread_create(&thread_data, thread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)network_setup,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
|
@ -43,11 +43,13 @@ enum slip_state {
|
|||
/* RX queue */
|
||||
static struct k_fifo rx_queue;
|
||||
static char __noinit __stack rx_stack[1024];
|
||||
static struct k_thread rx_thread_data;
|
||||
|
||||
/* TX queue */
|
||||
static struct k_sem tx_sem;
|
||||
static struct k_fifo tx_queue;
|
||||
static char __noinit __stack tx_stack[1024];
|
||||
static struct k_thread tx_thread_data;
|
||||
|
||||
/* Buffer for SLIP encoded data for the worst case */
|
||||
static u8_t slip_buf[1 + 2 * CONFIG_NET_BUF_DATA_SIZE];
|
||||
|
@ -470,8 +472,9 @@ static void init_rx_queue(void)
|
|||
{
|
||||
k_fifo_init(&rx_queue);
|
||||
|
||||
k_thread_spawn(rx_stack, sizeof(rx_stack), (k_thread_entry_t)rx_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(8), 0, K_NO_WAIT);
|
||||
k_thread_create(&rx_thread_data, rx_stack, sizeof(rx_stack),
|
||||
(k_thread_entry_t)rx_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(8), 0, K_NO_WAIT);
|
||||
}
|
||||
|
||||
static void init_tx_queue(void)
|
||||
|
@ -479,8 +482,9 @@ static void init_tx_queue(void)
|
|||
k_sem_init(&tx_sem, 0, UINT_MAX);
|
||||
k_fifo_init(&tx_queue);
|
||||
|
||||
k_thread_spawn(tx_stack, sizeof(tx_stack), (k_thread_entry_t)tx_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(8), 0, K_NO_WAIT);
|
||||
k_thread_create(&tx_thread_data, tx_stack, sizeof(tx_stack),
|
||||
(k_thread_entry_t)tx_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(8), 0, K_NO_WAIT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -76,6 +76,7 @@ static struct k_fifo tx_queue;
|
|||
* Stack for the tx thread.
|
||||
*/
|
||||
static char __noinit __stack tx_stack[1024];
|
||||
static struct k_thread tx_thread_data;
|
||||
|
||||
#define DEV_DATA(dev) \
|
||||
((struct wpanusb_dev_data_t * const)(dev)->driver_data)
|
||||
|
@ -530,8 +531,9 @@ static void init_tx_queue(void)
|
|||
/* Transmit queue init */
|
||||
k_fifo_init(&tx_queue);
|
||||
|
||||
k_thread_spawn(tx_stack, sizeof(tx_stack), (k_thread_entry_t)tx_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(8), 0, K_NO_WAIT);
|
||||
k_thread_create(&tx_thread_data, tx_stack, sizeof(tx_stack),
|
||||
(k_thread_entry_t)tx_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(8), 0, K_NO_WAIT);
|
||||
}
|
||||
|
||||
extern enum net_verdict ieee802154_radio_handle_ack(struct net_if *iface,
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#define TCP_RX_FIBER_STACK_SIZE 1024
|
||||
|
||||
static char __noinit __stack zperf_tcp_rx_stack[TCP_RX_FIBER_STACK_SIZE];
|
||||
static struct k_thread zperf_tcp_rx_thread_data;
|
||||
|
||||
#if defined(CONFIG_NET_IPV6)
|
||||
static struct sockaddr_in6 *in6_addr_my;
|
||||
|
@ -240,8 +241,9 @@ void zperf_tcp_receiver_init(int port)
|
|||
in4_addr_my = zperf_get_sin();
|
||||
#endif
|
||||
|
||||
k_thread_spawn(zperf_tcp_rx_stack, sizeof(zperf_tcp_rx_stack),
|
||||
(k_thread_entry_t)zperf_tcp_rx_thread,
|
||||
INT_TO_POINTER(port), 0, 0,
|
||||
K_PRIO_COOP(7), 0, K_NO_WAIT);
|
||||
k_thread_create(&zperf_tcp_rx_thread_data, zperf_tcp_rx_stack,
|
||||
sizeof(zperf_tcp_rx_stack),
|
||||
(k_thread_entry_t)zperf_tcp_rx_thread,
|
||||
INT_TO_POINTER(port), 0, 0,
|
||||
K_PRIO_COOP(7), 0, K_NO_WAIT);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
/* Static data */
|
||||
static char __noinit __stack zperf_rx_stack[RX_THREAD_STACK_SIZE];
|
||||
static struct k_thread zperf_rx_thread_data;
|
||||
|
||||
static struct sockaddr_in6 *in6_addr_my;
|
||||
static struct sockaddr_in *in4_addr_my;
|
||||
|
@ -383,8 +384,9 @@ void zperf_receiver_init(int port)
|
|||
in4_addr_my = zperf_get_sin();
|
||||
#endif
|
||||
|
||||
k_thread_spawn(zperf_rx_stack, sizeof(zperf_rx_stack),
|
||||
(k_thread_entry_t)zperf_rx_thread,
|
||||
INT_TO_POINTER(port), 0, 0,
|
||||
K_PRIO_COOP(7), 0, K_NO_WAIT);
|
||||
k_thread_create(&zperf_rx_thread_data, zperf_rx_stack,
|
||||
sizeof(zperf_rx_stack),
|
||||
(k_thread_entry_t)zperf_rx_thread,
|
||||
INT_TO_POINTER(port), 0, 0,
|
||||
K_PRIO_COOP(7), 0, K_NO_WAIT);
|
||||
}
|
||||
|
|
|
@ -230,8 +230,8 @@ static void start_threads(void)
|
|||
for (int i = 0; i < NUM_PHIL; i++) {
|
||||
int prio = new_prio(i);
|
||||
|
||||
k_thread_spawn(&stacks[i][0], STACK_SIZE,
|
||||
philosopher, (void *)i, NULL, NULL, prio, 0, 0);
|
||||
k_thread_create(&threads[i], &stacks[i][0], STACK_SIZE,
|
||||
philosopher, (void *)i, NULL, NULL, prio, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -157,5 +157,6 @@ static fork_t forks[NUM_PHIL] = {
|
|||
};
|
||||
|
||||
static char __stack __noinit stacks[NUM_PHIL][STACK_SIZE];
|
||||
static struct k_thread threads[NUM_PHIL];
|
||||
|
||||
#endif /* phil_obj_abstract__h */
|
||||
|
|
|
@ -15,8 +15,12 @@
|
|||
|
||||
static u8_t printer_stack[1024];
|
||||
static u8_t calc_stack[1024];
|
||||
|
||||
static u8_t sysview_stack[2048];
|
||||
|
||||
static struct k_thread printer_thread_data;
|
||||
static struct k_thread calc_thread_data;
|
||||
static struct k_thread sysview_thread_data;
|
||||
|
||||
static u32_t timestamp, interrupt;
|
||||
|
||||
extern SEGGER_RTT_CB _SEGGER_RTT;
|
||||
|
@ -245,14 +249,18 @@ static void calc_thread(void)
|
|||
|
||||
void main(void)
|
||||
{
|
||||
k_thread_spawn(sysview_stack, sizeof(sysview_stack),
|
||||
(k_thread_entry_t)sysview_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(1), 0, 0);
|
||||
k_thread_create(&sysview_thread_data, sysview_stack,
|
||||
sizeof(sysview_stack),
|
||||
(k_thread_entry_t)sysview_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(1), 0, 0);
|
||||
|
||||
k_thread_spawn(printer_stack, sizeof(printer_stack),
|
||||
(k_thread_entry_t)printer_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(1), 0, 0);
|
||||
k_thread_spawn(calc_stack, sizeof(calc_stack),
|
||||
(k_thread_entry_t)calc_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(1), 0, 0);
|
||||
k_thread_create(&printer_thread_data, printer_stack,
|
||||
sizeof(printer_stack),
|
||||
(k_thread_entry_t)printer_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(1), 0, 0);
|
||||
|
||||
k_thread_create(&calc_thread_data, calc_stack,
|
||||
sizeof(calc_stack),
|
||||
(k_thread_entry_t)calc_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(1), 0, 0);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ QUARK_SE_IPM_DEFINE(message_ipm2, 3, QUARK_SE_IPM_OUTBOUND);
|
|||
#define TASK_PRIO 7
|
||||
|
||||
char thread_stacks[2][STACKSIZE];
|
||||
static struct k_thread threads[2];
|
||||
|
||||
u32_t scss_reg(u32_t offset)
|
||||
{
|
||||
|
@ -133,11 +134,12 @@ void main(void)
|
|||
{
|
||||
printk("===== app started ========\n");
|
||||
|
||||
k_thread_spawn(&thread_stacks[0][0], STACKSIZE, main_thread,
|
||||
0, 0, 0, K_PRIO_COOP(MAIN_FIBER_PRI), 0, 0);
|
||||
|
||||
k_thread_spawn(&thread_stacks[1][0], STACKSIZE, ping_source_thread,
|
||||
0, 0, 0, K_PRIO_COOP(PING_FIBER_PRI), 0, 0);
|
||||
k_thread_create(&threads[0], &thread_stacks[0][0], STACKSIZE,
|
||||
main_thread, 0, 0, 0,
|
||||
K_PRIO_COOP(MAIN_FIBER_PRI), 0, 0);
|
||||
|
||||
k_thread_create(&threads[0], &thread_stacks[1][0], STACKSIZE,
|
||||
ping_source_thread, 0, 0, 0,
|
||||
K_PRIO_COOP(PING_FIBER_PRI), 0, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ void threadB(void *dummy1, void *dummy2, void *dummy3)
|
|||
}
|
||||
|
||||
char __noinit __stack threadB_stack_area[STACKSIZE];
|
||||
|
||||
static struct k_thread threadB_data;
|
||||
|
||||
/* threadA is a static thread that is spawned automatically */
|
||||
|
||||
|
@ -78,8 +78,9 @@ void threadA(void *dummy1, void *dummy2, void *dummy3)
|
|||
ARG_UNUSED(dummy3);
|
||||
|
||||
/* spawn threadB */
|
||||
k_thread_spawn(threadB_stack_area, STACKSIZE, threadB, NULL, NULL, NULL,
|
||||
PRIORITY, 0, K_NO_WAIT);
|
||||
k_thread_create(&threadB_data, threadB_stack_area, STACKSIZE,
|
||||
threadB, NULL, NULL, NULL,
|
||||
PRIORITY, 0, K_NO_WAIT);
|
||||
|
||||
/* invoke routine to ping-pong hello messages with threadB */
|
||||
helloLoop(__func__, &threadA_sem, &threadB_sem);
|
||||
|
|
Loading…
Reference in a new issue