cocoOS
4.0.0
Main Page
Data Structures
Files
File List
Globals
cocoos.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2012 Peter Eckstrand
3
*
4
* All rights reserved.
5
*
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted (subject to the limitations in the
8
* disclaimer below) provided that the following conditions are met:
9
*
10
* 1. Redistributions of source code must retain the above copyright
11
* notice, this list of conditions and the following disclaimer.
12
*
13
* 2. Redistributions in binary form must reproduce the above copyright
14
* notice, this list of conditions and the following disclaimer in the
15
* documentation and/or other materials provided with the
16
* distribution.
17
*
18
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
19
* GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
20
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
21
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
27
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
29
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
30
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
*
32
* This file is part of the cocoOS operating system.
33
* Author: Peter Eckstrand <info@cocoos.net>
34
*/
35
36
37
38
#ifndef COCOOS_H
39
#define COCOOS_H
40
43
#include <inttypes.h>
44
#include "os_port.h"
45
#include "os_typedef.h"
46
#include "
os_defines.h
"
47
#include "
os_event.h
"
48
#include "
os_sem.h
"
49
#include "
os_task.h
"
50
#include "os_assert.h"
51
#include "
os_msgqueue.h
"
52
#include "
os_applAPI.h
"
53
54
#ifdef __cplusplus
55
56
extern
"C"
{
57
58
#endif
59
60
#define NO_TID 255
61
#define NO_EVENT 255
62
#define NO_QUEUE 255
63
#define NO_SEM 255
64
65
/* Total number of semaphores needed */
66
#define N_TOTAL_SEMAPHORES ( N_SEMAPHORES + N_QUEUES )
67
68
69
/* Total number of events needed */
70
#define N_TOTAL_EVENTS ( N_EVENTS + N_QUEUES )
71
72
73
74
75
76
77
78
79
#define OS_BEGIN uint16_t os_task_state = os_task_internal_state_get(running_tid); switch ( os_task_state ) { case 0:
80
81
#define OS_END os_task_kill(running_tid);\
82
running_tid = NO_TID;\
83
return;}
84
85
86
#define OS_SCHEDULE(ofs) os_task_internal_state_set(running_tid, __LINE__+ofs);\
87
running_tid = NO_TID;\
88
return;\
89
case (__LINE__+ofs):
90
91
92
93
94
#define OS_WAIT_TICKS(x,y) do {\
95
os_task_wait_time_set( running_tid, y, x );\
96
OS_SCHEDULE(0);\
97
} while ( 0 )
98
99
100
101
extern
uint8_t running_tid;
102
extern
uint8_t last_running_task;
103
extern
uint8_t running;
104
105
uint8_t os_running(
void
);
106
107
#ifdef __cplusplus
108
109
}
110
111
#endif
112
113
#endif
os_msgqueue.h
os_event.h
os_sem.h
os_defines.h
os_task.h
os_applAPI.h
Source
cocoos.h
Generated on Fri Feb 20 2015 19:00:28 for cocoOS by
1.8.9.1