PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Utility
libsimpletools
source
cogrun.c
1
/*
2
* @file cogrun.c
3
*
4
* @author Andy Lindsay
5
*
6
* @copyright
7
* Copyright (C) Parallax, Inc. 2014. All Rights MIT Licensed.
8
*
9
* @brief Source code for cog_run function.
10
*/
11
12
13
#include "
simpletools.h
"
14
15
int
*
cog_run
(
void
(*
function
)(
void
*par),
int
stacksize)
16
{
17
int
*addr;
18
addr = malloc(stacksize += 4 + 176 + (stacksize * 4));
19
*addr = 1 +
cogstart
(
function
, NULL, addr + 4, stacksize - 4);
20
if
(*addr == 0)
21
{
22
free(addr);
23
return
(
int
*) 0;
24
}
25
return
addr;
26
}
27
28
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
cog_run
int * cog_run(void(*function)(void *par), int stacksize)
Run a function's code in the next available cog (processor).
Definition:
cogrun.c:15
cogstart
int cogstart(void(*func)(void *), void *par, void *stack, size_t stacksize)
Start a new propeller LMM function/thread in another COG.
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17