|
krnl 1
|
Go to the source code of this file.
Data Structures | |
| struct | k_t |
| struct | k_msg_t |
Macros | |
| #define | KRNL_VRS 20250606 |
| #define | KRNLBUG |
| #define | BACKSTOPPER |
| #define | DYNMEMORY |
| #define | K_TICK 1 |
| #define | WDT_PERIOD WDTO_1S |
| #define | QHD_PRIO 102 |
| #define | ZOMBI_PRIO (QHD_PRIO - 1) |
| #define | DMY_PRIO (QHD_PRIO - 2) |
| #define | DMY_STK_SZ 90 |
| #define | STAK_HASH 0x5c |
| #define | MAX_SEM_VAL 30000 |
| #define | MAX_INT 0x7FFF |
| #define | CEILINGFAILNOTCEIL -3 |
| #define | CEILINGFAILPRIO -4 |
| #define | lo8(X) |
| #define | hi8(X) |
| #define | DI() |
| #define | EI() |
| #define | RETI() |
| #define | K_CHG_STAK() |
Functions | |
| void * | k_malloc (int k) |
| overruled malloc call malloc protected by DI and EI if dft as weak so you can supply with your own | |
| void | k_free (void *m) |
| a krnl free which do nothing. call free empty - no function if dft as weak so you can supply with your own | |
| void | k_wdt_enable (int t) |
| enable HW watchdog Call wdt_enable (AVR lib) DI(); wdt_enable(WDT_PERIOD); EI(); WDT_PERIOD is in KRNL i sec | |
| void | k_wdt_disable () |
| disable HW watchdog disable wdt Disable the watchdog timer | |
| unsigned long | ki_millis (void) |
| returns no msec since start - no DI/EI lock Returns nr of milliseconds since krnl was started by k_start | |
| unsigned long | k_millis (void) |
| return no of millisec sincs start NB no leap seconds - its clean | |
| void | k_eat_msec (unsigned int eatTime) |
| eat milliseconds - to mimik time consuming code | |
| void | ki_task_shift (void) |
| shift running to task in front in AQ | |
| int | k_sleep (int time) |
| let task sleep for a number of milliseconds | |
| struct k_t * | k_crt_task (void(*pTask)(void), char prio, char *pS, int stkSize) |
| create a task - only to be called before k_start creates a task and put it in the active Q | |
| int | k_set_prio (char prio) |
| struct k_t * | k_crt_sem (int init_val, int maxvalue) |
| change task priority and reinserts it in task Q and do a task shift | |
| struct k_t * | k_crt_mut (char ceiling_prio, int init_val, int maxvalue) |
| crt a std semaphore to be used as mutex | |
| int | k_mut_ceil_set (struct k_t *sem, char prio) |
| set ceiling priority on a mutex | |
| int | k_mut_ceil_enter (struct k_t *sem, int timeout) |
| set ceiling priority on a mutex | |
| int | k_mut_ceil_leave (struct k_t *sem) |
| leave a "ceiled mutex" enter with k_mut_ceil_enter | |
| int | k_mut_ceil (struct k_t *sem, int timeout, void(*fct)(void)) |
| mutex entet, call fct, leave ceil in one call | |
| int | k_set_sem_timer (struct k_t *sem, int val) |
| attach a periodic timer to a semaphore, to be used for realtime | |
| int | ki_signal (struct k_t *sem) |
| signal a semaphore from AN ISR - no task shift , do not enable intr,... | |
| int | k_signal (struct k_t *sem) |
| Signal a semaphore w eventually task shift. | |
| int | k_wait (struct k_t *sem, int timeout) |
| stand wait on semaphore call with timeout facility | |
| int | k_wait2 (struct k_t *sem, int timeout, int *nrClip) |
| wait with add info .´- nr of in max limit from signals since last time(saturation) | |
| int | k_sem_signals_lost (struct k_t *sem) |
| return signals lost on a sem(saturation) (and reset the saturation counter) Returns how many signals has been lost on semaphore due to saturation | |
| int | ki_wait (struct k_t *sem, int timeout) |
| a wait call with no disable - fct might no be usefull | |
| int | ki_semval (struct k_t *sem) |
| return sem counter value - Its a ki_ fct so intr is not enabled by leave | |
| int | k_semval (struct k_t *sem) |
| as ki_semval but to enable intr after leave | |
| int | k_clear_sem (struct k_t *sem) |
| reset sem counter to 0 is no tasks is waiting - usefull ? | |
| int | ki_msg_count (struct k_msg_t *msgbuffer) |
| returns no of pending msg on msgf sem - a ki_ fct so no enable of interrupt | |
| int | k_msg_count (struct k_msg_t *m) |
| return no of pending messages | |
| void | k_sem_clip (unsigned char nr, int nrClip) |
| void | k_sem_signal (unsigned char nr, int val) |
| breakout for k_signal | |
| void | k_sem_wait (unsigned char nr, int val) |
| breakout for k_wait | |
| void | k_send_Q_clip (unsigned char nr, int nrClip) |
| breakout for k_send | |
| struct k_msg_t * | k_crt_send_Q (int nr_el, int el_size, void *pBuf) |
| char | ki_send (struct k_msg_t *pB, void *el) |
| char | k_send (struct k_msg_t *pB, void *el) |
| char | k_receive (struct k_msg_t *pB, void *el, int timeout, int *lost_msg) |
| char | ki_receive (struct k_msg_t *pB, void *el, int *lost_msg) |
| int | ki_clear_msg_Q (struct k_msg_t *pB) |
| int | k_clear_msg_Q (struct k_msg_t *pB) |
| int | k_tmrInfo (void) |
| int | k_init (int nrTask, int nrSem, int nrMsg) |
| int | k_start (void) |
| int | k_stop () |
| void | k_reset () |
| int | k_stk_chk (struct k_t *t) |
| int | ki_unused_stak (struct k_t *t) |
| int | k_unused_stak (struct k_t *t) |
| int | ki_my_unused_stak () |
| void | k_round_robbin (void) |
| void | k_release (void) |
| void | k_set_coop_multitask (unsigned char onn) |
| int | freeRam (void) |
| void | k_breakout (void) |
Variables | |
| unsigned char | k_coopFlag |
| int | k_task |
| int | k_sem |
| int | k_msg |
| volatile char | krnl_preempt_flag |
| char | dmy_stk [90] |
| volatile char | k_wdt_enabled |
| struct k_t * | task_pool |
| struct k_t * | sem_pool |
| struct k_t | AQ |
| struct k_t * | pmain_el |
| struct k_t * | pAQ |
| struct k_t * | pDmy |
| struct k_t * | pRun |
| struct k_t * | pSleepSem |
| struct k_msg_t * | send_pool |
| char | nr_task |
| char | nr_sem |
| char | nr_send |
| volatile char | k_running |
| volatile char | k_err_cnt |
| unsigned long | k_millis_counter |
| char | k_preempt_flag |
| volatile char | k_bug_on |
| #define CEILINGFAILNOTCEIL -3 |
Definition at line 301 of file krnl.h.
Referenced by k_mut_ceil_enter().
| #define CEILINGFAILPRIO -4 |
Definition at line 302 of file krnl.h.
Referenced by k_mut_ceil_enter().
| #define DI | ( | ) |
Definition at line 478 of file krnl.h.
Referenced by bugBitReset(), bugBitSet(), initISR(), installISR2(), k_clear_msg_Q(), k_clear_sem(), k_malloc(), k_millis(), k_mut_ceil_enter(), k_mut_ceil_leave(), k_receive(), k_release(), k_round_robbin(), k_sem_signals_lost(), k_send(), k_set_prio(), k_set_sem_timer(), k_signal(), k_start(), k_stop(), k_unused_stak(), k_wait(), k_wait2(), k_wdt_disable(), k_wdt_enable(), ki_millis(), ki_msg_count(), ki_receive(), ki_semval(), ki_signal(), ki_wait(), rd(), setup(), t1(), t2(), task(), task1(), task2(), tperiodic(), and wr().
| #define DMY_PRIO (QHD_PRIO - 2) |
Definition at line 292 of file krnl.h.
Referenced by k_crt_task(), k_init(), k_mut_ceil_set(), and k_set_prio().
| #define EI | ( | ) |
Definition at line 479 of file krnl.h.
Referenced by bugBitReset(), bugBitSet(), initISR(), installISR2(), k_clear_msg_Q(), k_clear_sem(), k_malloc(), k_millis(), k_msg_count(), k_mut_ceil_enter(), k_mut_ceil_leave(), k_receive(), k_release(), k_round_robbin(), k_sem_signals_lost(), k_semval(), k_send(), k_set_prio(), k_set_sem_timer(), k_signal(), k_start(), k_stop(), k_unused_stak(), k_wait(), k_wait2(), k_wdt_disable(), k_wdt_enable(), rd(), setup(), t1(), t2(), task(), task1(), task2(), tperiodic(), and wr().
| #define hi8 | ( | X | ) |
Definition at line 476 of file krnl.h.
Referenced by k_crt_task().
| #define K_CHG_STAK | ( | ) |
| #define lo8 | ( | X | ) |
Definition at line 475 of file krnl.h.
Referenced by k_crt_task().
| #define MAX_SEM_VAL 30000 |
Definition at line 298 of file krnl.h.
Referenced by k_crt_sem(), ki_send(), and ki_signal().
| #define QHD_PRIO 102 |
Definition at line 290 of file krnl.h.
Referenced by k_crt_sem(), and k_init().
| #define RETI | ( | ) |
| #define STAK_HASH 0x5c |
Definition at line 297 of file krnl.h.
Referenced by k_crt_task(), ki_my_unused_stak(), and ki_unused_stak().
| int freeRam | ( | void | ) |
| void k_breakout | ( | void | ) |
Definition at line 93 of file k02twotasks.ino.
References cntt1, cntt2, k_millis_counter, led13, logg, pRun, reg, and wI.
| int k_clear_msg_Q | ( | struct k_msg_t * | pB | ) |
Empty sendQ See ki_clear_msg-Q for description
Definition at line 900 of file krnl.c.
References DI, EI, ki_clear_msg_Q(), and k_msg_t::r.

| int k_clear_sem | ( | struct k_t * | sem | ) |
reset sem counter to 0 is no tasks is waiting - usefull ?
Clear semaphore if possible. Will set semaphore vallue 0 if possible (if no tasks is waiting)
| [in] | sem | pointer ref to semaphore |
| struct k_t * k_crt_mut | ( | char | ceiling_prio, |
| int | init_val, | ||
| int | maxvalue ) |
crt a std semaphore to be used as mutex
creates a standard mutex. It can be initialized to values in range [0..maxvalue]
| [in] | ceiling_prio | priority - task ceiling prio |
| [in] | init_val | startvalue of semaphore 0,1,2,... maxvalue |
| [in] | maxvalue | which is maxvalue semaphore can reach |
Definition at line 703 of file krnl.c.
References k_t::ceiling_prio, k_crt_sem(), k_err_cnt, and k_running.
Referenced by setup().


| struct k_t * k_crt_sem | ( | int | init_val, |
| int | maxvalue ) |
change task priority and reinserts it in task Q and do a task shift
creates a standard Dijkstra semaphore. It can be initialized to values in range [0..maxvalue]
| [in] | init_val | startvalue of semaphore 0,1,2,... maxvalue |
| [in] | maxvalue | which is maxvalue semaphore can reach |
Definition at line 544 of file krnl.c.
References k_err_cnt, k_running, k_sem, MAX_SEM_VAL, nr_sem, QHD_PRIO, sem, and sem_pool.
Referenced by initSemaphores(), k_crt_mut(), k_crt_send_Q(), k_init(), rdWrLockInit(), and setup().

| struct k_msg_t * k_crt_send_Q | ( | int | nr_el, |
| int | el_size, | ||
| void * | pBuf ) |
Definition at line 841 of file krnl.c.
References k_msg_t::el_size, k_crt_sem(), k_err_cnt, k_msg, k_running, k_sem, k_msg_t::nr_el, nr_sem, nr_send, k_msg_t::pBuf, pMsg, and send_pool.
Referenced by setup().


| struct k_t * k_crt_task | ( | void(* | pTask )(void), |
| char | prio, | ||
| char * | pS, | ||
| int | stkSize ) |
create a task - only to be called before k_start creates a task and put it in the active Q
| [in] | pTask | pointer to function for code ( void task(void) ...) |
| [in] | prio | - task prio max: 1 lowest < DUMMY_PRIO |
| [in] | pS | - ptr to bye to be used as stack |
| [in] | stkSize | size of data area(in bytes) to be used for stak |
Definition at line 328 of file krnl.c.
References k_t::cnt1, k_t::cnt2, k_t::cnt3, DMY_PRIO, hi8, i, jumper(), k_err_cnt, k_running, k_task, lo8, k_t::maxv, k_t::nr, nr_task, pAQ, k_t::prio, prio_enQ(), k_t::pt, pTask, s, k_t::sp_hi, k_t::sp_lo, STAK_HASH, and task_pool.
Referenced by initTasks(), and setup().


| void k_eat_msec | ( | unsigned int | eatTime | ) |
eat milliseconds - to mimik time consuming code
Eat time in milliseconds starting from now but not from next tick (1 msec)
| [in] | eatTime | number of ticks to eat |
Definition at line 246 of file krnl.c.
References delayMicroseconds().
Referenced by getDataInCritRegion(), t1(), t1(), t2(), t2(), task(), task1(), task2(), tgeneric(), tnoise(), and tperiodic().


| void k_free | ( | void * | m | ) |
| int k_init | ( | int | nrTask, |
| int | nrSem, | ||
| int | nrMsg ) |
Initialise KRNL. First function to be called. You have to give max number of tasks, semaphores and message queues you will use
| [in] | nrTask | ... |
| [in] | nrSem | ... |
| [in] | nrMsg | ... |
Definition at line 1108 of file krnl.c.
References AQ, DMY_PRIO, k_crt_sem(), k_err_cnt, k_msg, k_running, k_sem, k_task, nr_send, nr_task, pAQ, pmain_el, prio_enQ(), pSleepSem, QHD_PRIO, sem_pool, send_pool, and task_pool.
Referenced by setup().


| void * k_malloc | ( | int | k | ) |
| unsigned long k_millis | ( | void | ) |
return no of millisec sincs start NB no leap seconds - its clean
Returns nr of milliseconds since krnl was started by k_start
Definition at line 1247 of file krnl.c.
References DI, EI, k_millis_counter, and l.
Referenced by setup(), t2(), task1(), and wr().

| int k_msg_count | ( | struct k_msg_t * | m | ) |
return no of pending messages
| [in] | m | msg Q handle |
Definition at line 833 of file krnl.c.
References EI, ki_msg_count(), and m.

| int k_mut_ceil | ( | struct k_t * | sem, |
| int | timeout, | ||
| void(* | fct )(void) ) |
mutex entet, call fct, leave ceil in one call
Mutex enter and leave w imm priority ceiling in one operation
| sem | mutex with ceiling |
| timeout | 0 == forever |
| fct | void fct(void) the function w critical code |
Definition at line 726 of file krnl.c.
References k_mut_ceil_enter(), k_mut_ceil_leave(), and sem.

| int k_mut_ceil_enter | ( | struct k_t * | sem, |
| int | timeout ) |
set ceiling priority on a mutex
Enter mutex (eq to k_wait...) use k_mut_enter / k_mut_leave instead of wait and signal
| [in] | sem | aka mutex |
| [in] | timeout | timeout value |
Definition at line 739 of file krnl.c.
References CEILINGFAILNOTCEIL, CEILINGFAILPRIO, deQ(), DI, EI, ki_task_shift(), ki_wait(), pAQ, prio_enQ(), pRun, and sem.
Referenced by controlTask(), getDataInCritRegion(), k_mut_ceil(), lowTask(), saveDataInCritRegion(), task1(), and task2().


| int k_mut_ceil_leave | ( | struct k_t * | sem | ) |
leave a "ceiled mutex" enter with k_mut_ceil_enter
Leave mutex (eq to k_signal...) use k_mut_enter/ k_mut_leave instead of wait and signal
| [in] | sem | used as mutex |
Definition at line 771 of file krnl.c.
References deQ(), DI, EI, ki_signal(), ki_task_shift(), pAQ, prio_enQ(), pRun, and sem.
Referenced by controlTask(), getDataInCritRegion(), k_mut_ceil(), lowTask(), saveDataInCritRegion(), task1(), and task2().


| int k_mut_ceil_set | ( | struct k_t * | sem, |
| char | prio ) |
| char k_receive | ( | struct k_msg_t * | pB, |
| void * | el, | ||
| int | timeout, | ||
| int * | lost_msg ) |
Receive data (one element of el_size)in the ringbuffer if there are data DONE BY COPY !
| [in] | pB | Ref to message buffer |
| [out] | el | Reference to where data shall be copied to at your site |
| [in] | timeout | Max time you want to wait on data, -1: never, 0: forever, positive: nr of KRNL timer quants |
| [out] | lost_msg | nr of lost messages since last receive. will clip at
|
Definition at line 991 of file krnl.c.
References k_msg_t::cnt, DI, EI, k_msg_t::el_size, i, ki_wait(), k_msg_t::lost_msg, k_msg_t::nr_el, k_msg_t::pBuf, k_msg_t::r, and k_msg_t::sem.
Referenced by t1(), t2(), task1(), and task2().


| void k_release | ( | void | ) |
release switch running to task in front of Active Q calls ki_task_shift (); enveloped by a DI and EI no round robbin
Definition at line 1084 of file krnl.c.
References DI, EI, and ki_task_shift().

| void k_reset | ( | ) |
Reset by disable interrupt plus activate watchdog (15 millisseconds) and just wait...
| void k_round_robbin | ( | void | ) |
round robbin reinsert running task in activeQ. so running will be inserted after other tasks with same or higher priority
Definition at line 1073 of file krnl.c.
References deQ(), DI, EI, ki_task_shift(), pAQ, prio_enQ(), and pRun.

| void k_sem_clip | ( | unsigned char | nr, |
| int | nrClip ) |
a function for overloading on usersite which is called when a semaphore is overflooding no occur - it's only reading out semaphore idendity Signal operations has not taken place ! 1: means first semahore allocated by user, 2 the next etc Interrupt is disabled when called and must not be enabled during.. so no print etc
| [in] | nr | id of semaphore 1,2,3,... |
| [in] | nrClip | number of times clip has occured (may be reset by call k_wait_lost) |
Definition at line 100 of file k04periodic-clip.ino.
References cnt, i, led13, and k_t::nr.
Referenced by ki_signal().

| void k_sem_signal | ( | unsigned char | nr, |
| int | val ) |
breakout for k_signal
called in a signal call val is sem val AFTER signal has taken place
| [out] | nr | number of semaphore. Semaphores are allocated by user buth] val |
| [in] | val | sem val also in message queues. So it may be diff to find the semaphore... |
Definition at line 1345 of file krnl.c.
Referenced by ki_signal().

| int k_sem_signals_lost | ( | struct k_t * | sem | ) |
return signals lost on a sem(saturation) (and reset the saturation counter) Returns how many signals has been lost on semaphore due to saturation
| [in] | sem | semaphore handle |
| void k_sem_wait | ( | unsigned char | nr, |
| int | val ) |
| int k_semval | ( | struct k_t * | sem | ) |
as ki_semval but to enable intr after leave
returns value of semaphore
| [in] | sem | semaphore handle |
Definition at line 807 of file krnl.c.
References EI, ki_semval(), and sem.

| char k_send | ( | struct k_msg_t * | pB, |
| void * | el ) |
Put data (one element of el_size)in the ringbuffer if there are room for it. DONE BY COPY !
| [in] | pB | Ref to message buffer |
| [in] | el | Reference to data to be put in buffer. Size if already given in k_crt_send |
Definition at line 944 of file krnl.c.
References DI, EI, ki_send(), and ki_task_shift().
Referenced by t2(), and task1().


| void k_send_Q_clip | ( | unsigned char | nr, |
| int | nrClip ) |
breakout for k_send
a function for overloading on usersite which is called when a msgQ is overflooding no reset occur - it's only readind out smsgQ idendity 1: means first msgQ allocated by user etc Interrupt is disabled when called and must not be enabled during.. so no print etc
| [out] | nr | : id of send Q 0,1,2,... |
| [out] | nrClip | number of times clip has occured (may be reset by call k_receive and lost parm not eq NULL) |
Definition at line 91 of file akrnlschedule.ino.
Referenced by ki_send().

| void k_set_coop_multitask | ( | unsigned char | onn | ) |
Definition at line 1236 of file krnl.c.
References k_coopFlag.
| int k_set_prio | ( | char | prio | ) |
change priority of calling task)
| [in] | prio | new prio, Priority 1: highest (QHEAD_PRIO-1): lowest |
Definition at line 503 of file krnl.c.
References deQ(), DI, DMY_PRIO, EI, i, k_running, ki_task_shift(), pAQ, k_t::prio, prio_enQ(), and pRun.
Referenced by jumper().


| int k_set_sem_timer | ( | struct k_t * | sem, |
| int | val ) |
attach a periodic timer to a semaphore, to be used for realtime
attach a timer to the semaphore so KRNL will signal the semaphore with regular intervals. Can be used for cyclic real time run of a task.
| [in] | sem | semaphore handle |
| [in] | val | interval in quant of KRNL ticks (0: disable cyclic timer, 1,2,3... cyclic quant) |
Definition at line 586 of file krnl.c.
Referenced by controlTask(), highprio(), initSemaphores(), lowprio(), medprio(), t1(), t1(), t2(), t2(), task(), task1(), task2(), task2Body(), task3(), and tperiodic().

| int k_signal | ( | struct k_t * | sem | ) |
Signal a semaphore w eventually task shift.
Signal and has higher priority than you. Task shift will task place if a task is started by the signal has higher prio than you
| [in] | sem | semaphore handle |
Definition at line 636 of file krnl.c.
References DI, EI, ki_signal(), ki_task_shift(), and sem.
Referenced by controlTask(), getDataInCritRegion(), lowTask(), rdEnter(), rdLeave(), saveDataInCritRegion(), saveDataInCritRegionNoWait(), t1(), t1Code(), t2(), t2(), t2Code(), task(), task1(), task2(), task2Body(), wrEnter(), and wrLeave().


| int k_sleep | ( | int | time | ) |
let task sleep for a number of milliseconds
Set task asleep for a number of msec.
| [in] | time | millisec to sleep |
Definition at line 445 of file krnl.c.
References k_wait(), and pSleepSem.
Referenced by code(), lowTask(), rd(), t1(), t1(), t2(), t2(), task(), task2(), tgeneric(), tnoise(), and wr().


| int k_start | ( | void | ) |
Starts krnl is possible If there has been ciritcal errors between k_init and k_start (like no more task descriptors) k_start will return a negative number indicatin how many errors
If k_start starts you will not return from k_start
Definition at line 1149 of file krnl.c.
References DI, EI, k_err_cnt, k_running, k_tick_size, ki_task_shift(), pmain_el, and pRun.
Referenced by setup().


| int k_stk_chk | ( | struct k_t * | t | ) |
Initialise blink on pin 13 ON when dummy is running Nov 2014 - fake do not use it bq it will not work for emergency use :-) returns nr of unbytes bytes on stak. For chekking if stak is too big or to small...
| [in] | t | Reference to task (by task handle) If null then yourself |
| int k_stop | ( | ) |
stop KRNL parm can be 1 or 10 can only run 1 og 10 msec tick speed If krnl is not yet running you will return with a -1 as return value If krnl is running interrupt will be disabled and k_stop ends in an infinite loop
Definition at line 1212 of file krnl.c.
References DI, EI, and k_running.
Referenced by t1().

| int k_tmrInfo | ( | void | ) |
| int k_unused_stak | ( | struct k_t * | t | ) |
Returns amount of unused stak
| [in] | t | Ptr to taskdescriptor. If NULL it is yourself |
Definition at line 493 of file krnl.c.
References DI, EI, i, and ki_unused_stak().
Referenced by t1().


| int k_wait | ( | struct k_t * | sem, |
| int | timeout ) |
stand wait on semaphore call with timeout facility
Wait on a semaphore. Task shift will task place if you are blocked.
| [in] | sem | semaphore handle |
| [in] | timeout | "<0" you will be started after timeout ticks, "=0" wait forever "-1" you will not wait |
Definition at line 683 of file krnl.c.
References DI, EI, ki_wait(), and sem.
Referenced by controlTask(), getDataInCritRegion(), highprio(), k_sleep(), lowprio(), lowTask(), medprio(), rdEnter(), rdLeave(), saveDataInCritRegion(), saveDataInCritRegionNoWait(), t1(), t1(), t1Code(), t2(), t2(), t2Code(), task(), task1(), task1Body(), task2(), task2Body(), task3(), taskBody(), tperiodic(), wrEnter(), and wrLeave().


| int k_wait2 | ( | struct k_t * | sem, |
| int | timeout, | ||
| int * | nrClip ) |
wait with add info .´- nr of in max limit from signals since last time(saturation)
Wait on a semaphore. Task shift will task place if you are blocked.
| [in] | sem | semaphore handle |
| [in] | timeout | "<0" you will be started after timeout ticks, "=0" wait forever "-1" you will not wait |
| [out] | nrClip | If not NULL you will get in return nr of clip on signals on sem and clip counter will be set to 0 |
Definition at line 691 of file krnl.c.
References DI, EI, ki_wait(), and sem.
Referenced by task1().


| void k_wdt_disable | ( | ) |
disable HW watchdog disable wdt Disable the watchdog timer
Definition at line 1376 of file krnl.c.
References DI, EI, and k_wdt_enabled.
| void k_wdt_enable | ( | int | t | ) |
enable HW watchdog Call wdt_enable (AVR lib) DI(); wdt_enable(WDT_PERIOD); EI(); WDT_PERIOD is in KRNL i sec
| [t] | watchdog timout WDT_PERIOD is 1 sec See avrlib docu for more info The watchdog is reset in krnls timer ISR when active |
Definition at line 1369 of file krnl.c.
References DI, EI, i, and k_wdt_enabled.
| int ki_clear_msg_Q | ( | struct k_msg_t * | pB | ) |
Empty sendQ
Definition at line 882 of file krnl.c.
References k_msg_t::cnt, k_t::cnt1, k_running, k_msg_t::lost_msg, k_msg_t::r, k_msg_t::sem, and k_msg_t::w.
Referenced by k_clear_msg_Q().

| unsigned long ki_millis | ( | void | ) |
returns no msec since start - no DI/EI lock Returns nr of milliseconds since krnl was started by k_start
Definition at line 1240 of file krnl.c.
References DI, k_millis_counter, and l.
Referenced by if(), myISR_Debounce(), myISR_No_Debounce(), and wr().

| int ki_msg_count | ( | struct k_msg_t * | msgbuffer | ) |
returns no of pending msg on msgf sem - a ki_ fct so no enable of interrupt
| [in] | msgbuffer | handle |
Definition at line 828 of file krnl.c.
Referenced by k_msg_count().

| int ki_my_unused_stak | ( | ) |
| char ki_receive | ( | struct k_msg_t * | pB, |
| void * | el, | ||
| int * | lost_msg ) |
Receive data (one element of el_size)in the ringbuffer if there are data DONE BY COPY ! No blocking if no data Interrupt will not be enabled after ki_receive and intr must be blocked prior to call
| [in] | pB | Ref to message buffer |
| [out] | el | Reference to where data shall be copied to at your site |
| [out] | lost_msg | nr of lost messages since last receive. will clip at
|
Definition at line 959 of file krnl.c.
References k_msg_t::cnt, DI, k_msg_t::el_size, i, ki_wait(), k_msg_t::lost_msg, k_msg_t::nr_el, k_msg_t::pBuf, k_msg_t::r, and k_msg_t::sem.

| int ki_semval | ( | struct k_t * | sem | ) |
return sem counter value - Its a ki_ fct so intr is not enabled by leave
returns value of semaphore
| [in] | sem | semaphore handle |
Definition at line 801 of file krnl.c.
Referenced by k_semval(), and rdEnter().

| char ki_send | ( | struct k_msg_t * | pB, |
| void * | el ) |
Put data (one element of el_size)in the ringbuffer if there are room for it. Intended for ISR use DONE BY COPY !
| [in] | pB | Ref to message buffer |
| [in] | el | Reference to data to be put in buffer. Size if already given in k_crt_send |
Definition at line 908 of file krnl.c.
References k_msg_t::cnt, k_msg_t::el_size, i, k_send_Q_clip(), ki_signal(), k_msg_t::lost_msg, MAX_SEM_VAL, k_msg_t::nr, k_msg_t::nr_el, k_msg_t::pBuf, k_msg_t::sem, and k_msg_t::w.
Referenced by ISR(), ISR(), k_send(), myISR_Debounce(), and myISR_No_Debounce().


| int ki_signal | ( | struct k_t * | sem | ) |
signal a semaphore from AN ISR - no task shift , do not enable intr,...
Signal a semaphore. Can be called from an ISR when interrupt is disabled. No task shift will occur - only queue manipulation.
| [in] | sem | semaphore handle |
Definition at line 605 of file krnl.c.
References deQ(), DI, k_sem_clip(), k_sem_signal(), MAX_SEM_VAL, pAQ, prio_enQ(), and sem.
Referenced by for(), if(), ISR(), k_mut_ceil_leave(), k_signal(), ki_send(), myISR(), myISR_Debounce(), myISR_No_Debounce(), and xxx().


| void ki_task_shift | ( | void | ) |
shift running to task in front in AQ
HERE
Definition at line 302 of file krnl.c.
References K_CHG_STAK, PUSHREGS(), and RETI.
Referenced by k_mut_ceil_enter(), k_mut_ceil_leave(), k_release(), k_round_robbin(), k_send(), k_set_prio(), k_signal(), k_start(), and ki_wait().


| int ki_unused_stak | ( | struct k_t * | t | ) |
Returns amount of unused stak
| [in] | t | Ptr to taskdescriptor. If NULL it is yourself |
Definition at line 472 of file krnl.c.
References k_t::cnt1, i, pRun, and STAK_HASH.
Referenced by k_unused_stak().

| int ki_wait | ( | struct k_t * | sem, |
| int | timeout ) |
a wait call with no disable - fct might no be usefull
Like k_wait with the exception interrupt is NOT enabled when leaving
| [in] | sem | semaphore handle |
| [in] | timeout | "<0" you will be started after timeout ticks, "=0" wait forever "-1" you will not wait |
Definition at line 653 of file krnl.c.
References deQ(), DI, enQ(), ki_task_shift(), pRun, and sem.
Referenced by k_mut_ceil_enter(), k_receive(), k_wait(), k_wait2(), and ki_receive().


|
extern |
|
extern |
|
extern |
Definition at line 166 of file krnl.c.
Referenced by if(), and k_set_coop_multitask().
|
extern |
Definition at line 156 of file krnl.c.
Referenced by k_crt_mut(), k_crt_sem(), k_crt_send_Q(), k_crt_task(), k_init(), and k_start().
|
extern |
|
extern |
Definition at line 156 of file krnl.c.
Referenced by if(), ISR(), ISR(), k_crt_mut(), k_crt_sem(), k_crt_send_Q(), k_crt_task(), k_init(), k_mut_ceil_set(), k_set_prio(), k_start(), k_stop(), ki_clear_msg_Q(), PUSHREGS(), and xxx().
|
extern |
Definition at line 153 of file krnl.c.
Referenced by k_crt_task(), and k_init().
|
extern |
Referenced by k_wdt_disable(), and k_wdt_enable().
|
extern |
|
extern |
Definition at line 154 of file krnl.c.
Referenced by k_crt_task(), and k_init().
|
extern |
Definition at line 151 of file krnl.c.
Referenced by k_crt_send_Q(), and k_init().
|
extern |
Definition at line 143 of file krnl.c.
Referenced by k_crt_task(), and k_init().