⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cxfunc1.h

📁 外部接传感器完成数据采集
💻 H
字号:
#include <cxdefine.h>
#include <cxvendor.h>
#include <cxstruct.h>

byte K_Task_Create(byte,byte xdata *,CMX_FP,word16) reentrant;	/* create task. */
byte K_Task_Create_Stack(byte,byte xdata *,CMX_FP,word16 xdata *) reentrant;	/* create task. */
byte K_Task_Start(byte) reentrant;		/* start task */
byte K_Task_Wait(word16) reentrant;	/*	have task wait, with or without time period */
byte K_I_Wake_Common(byte,byte) reentrant;	/* common wake routine */	
#define K_Task_Wake(A) K_I_Wake_Common(A,0)	 /* wake a task that was waiting. */
#define K_Task_Wake_Force(A) K_I_Wake_Common(A,1) /* wake a task, regardless of what task waiting on */
byte K_Task_Priority(byte,byte) reentrant;	/* change a task priority. */
void K_Task_Lock(void) reentrant;		/* disable task switching */
void K_Task_Unlock(void) reentrant;		/* re-enable task switching. */
void K_Task_Coop_Sched(void) reentrant;		/* do a cooperative task switch. */
void K_Task_End(void) reentrant;		/* must be called by all task prior to end brace. */
byte K_Task_Delete(byte) reentrant;		/* remove a task. */
byte K_Task_Name(byte,char *) reentrant;	/* declare a name for task. */

word16 K_Event_Wait(word16,word16,byte) reentrant;	/* wait on events, with/without time period */
byte K_Event_Signal(byte,byte,word16) reentrant;	/* signal an event */
byte K_Event_Reset(byte tskid,word16 event) reentrant;	/* reset events bits */

byte K_I_Resource_Common(byte,word16,byte) reentrant;			/* common resource reserve/get function */
#define K_Resource_Wait(A,B) K_I_Resource_Common(A,B,0)	/* reserve a resource, with or without time period */
#define K_Resource_Get(A) K_I_Resource_Common(A,0,1)		/* get a resource if free */
byte K_Resource_Release(byte) reentrant;		/* release a resource */

byte K_Que_Create(sign_word16,byte,byte xdata *,byte) reentrant;	/* create a circular queue */
byte K_Que_Reset(byte) reentrant;	/* reset a queue */
byte K_I_Que_Add_Common(byte,void *,sign_word16) reentrant;	/* common add to queue routine */
#define K_Que_Add_Top(A,B) K_I_Que_Add_Common(A,B,1)	/* add to queues top */
#define K_Que_Add_Bottom(A,B) K_I_Que_Add_Common(A,B,0)	/* add to queue's bottom */
byte K_I_Que_Get_Common(byte,void *,sign_word16) reentrant;	/* common remove from queue routine */
#define K_Que_Get_Top(A,B) K_I_Que_Get_Common(A,B,1)	/* remove from queue's top */
#define K_Que_Get_Bottom(A,B) K_I_Que_Get_Common(A,B,0)	/* remove from queue's bottom */

void * K_I_Mesg_Wait_Common(byte,word16,byte) reentrant;		/* common message get/wait function */
#define K_Mesg_Wait(A,B) K_I_Mesg_Wait_Common(A,B,0)	/* wait for message, with or without time period */
#define K_Mesg_Get(A) K_I_Mesg_Wait_Common(A,0,1)		/* get a message if one is available */
byte K_I_Mesg_Send_Common(byte,word16,void *,byte) reentrant;	/* common message send/wait function */
#define K_Mesg_Send(A,B) K_I_Mesg_Send_Common(A,0,B,0)	/* send message to a mailbox */
#define K_Mesg_Send_Wait(A,B,C) K_I_Mesg_Send_Common(A,B,C,1)	/* send message, wait for reciever to ACK */
byte K_Mbox_Event_Set(byte,byte,word16) reentrant;		/* mailbox event setting parameters */
byte K_Mesg_Ack_Sender(void) reentrant;		/* wake task that sent message */

byte K_Timer_Create(byte,byte,byte,word16) reentrant;	/* create cyclic timer */
byte K_I_Cyclic_Common(byte,word16,word16,byte) reentrant;	/* common function for next 4 functions */
#define K_Timer_Start(A,B,C) K_I_Cyclic_Common(A,B,C,3)	/* start cyclic timer */
#define K_Timer_Restart(A) K_I_Cyclic_Common(A,0,0,0)		/* re-start cyclic timer */
#define K_Timer_Initial(A,B) K_I_Cyclic_Common(A,B,0,1)		/* re-start timer, with new initial time */
#define K_Timer_Cyclic(A,B) K_I_Cyclic_Common(A,0,B,2)		/* re-start timer, with new cyclic time */
byte K_Timer_Stop(byte) reentrant;				/* stop cyclic timer */

void K_Mem_FB_Create(void xdata *,word16,word16) reentrant;	/* create fixed memory block */
byte K_Mem_FB_Get(void xdata *,byte xdata **) reentrant;			/* get a block of memory */
void K_Mem_FB_Release(void xdata *,byte xdata *) reentrant; 			/* release a block of memory */

byte K_I_Semaphore_Get_Common(byte,word16,byte) reentrant;
#define K_Semaphore_Get(A) K_I_Semaphore_Get_Common(A,0,1)
#define K_Semaphore_Wait(A,B) K_I_Semaphore_Get_Common(A,B,0)
byte K_Semaphore_Post(byte) reentrant;
byte K_Semaphore_Create(byte,word16) reentrant;
byte K_Semaphore_Reset(byte,byte) reentrant;	
byte K_OS_Task_Slot_Get(void) reentrant;
word32 K_OS_Tick_Get_Ctr(void) reentrant;

void K_OS_Slice_On(void) reentrant;		/* Enable time slicing */
void K_OS_Slice_Off(void) reentrant;		/* Disable time slicing */

void K_OS_Init(void) reentrant;		/* initialize CMX */
void K_OS_Low_Power_Func(void);	/* reduced CPU power down function */
void K_I_Intrp_Pipe_Out(void) reentrant;	/* executes the interrupts CMX function requests */
void K_OS_Start(void) reentrant;		/* enter CMX OS */

void K_I_Timer_Task(void) reentrant;	/* CMX's timer task */
void K_OS_Tick_Update(void) reentrant;		/* called by interrupt, system tick */

/****************************************************
 The following functions are for the CMX UART module
****************************************************/
void K_Init_Xmit(void) reentrant;		/* initialize transmitter and buffer */
void K_Init_Recv(void) reentrant;		/* initailize reciever and buffer */
void K_Update_Xmit(void) reentrant;	/* called by transmitter interrupt handler. */
void K_Update_Recv(void) reentrant;	/* called by reciever interrupt handler. */
void K_Init_Xmit_r(void) reentrant;		/* initialize transmitter and buffer */
void K_Init_Recv_r(void) reentrant;		/* initailize reciever and buffer */
void K_Update_Xmit_r(void) reentrant;	/* called by transmitter interrupt handler. */
void K_Update_Recv_r(void) reentrant;	/* called by reciever interrupt handler. */
byte K_Put_Str(void *,void *,word16) reentrant;	/* put chars into transmit buffer */
byte K_Put_Str_Wait(void *,void *,word16,word16) reentrant;	/* same as above and wait if need be*/
byte K_Put_Char(void *,void *) reentrant;		/* put 1 char into transmit buffer */
byte K_Put_Char_Wait(void *,void *,word16) reentrant;	/* same as above and wait if need be */
word16 K_Get_Str(void *,void *,word16) reentrant;	/* get chars from reciever buffer */
word16 K_Get_Str_Wait(void *,void *,word16,word16) reentrant; /* same as above with wait */
word16 K_Get_Char(void *,void *) reentrant;	/* get single char from recieve buffer */
word16 K_Get_Char_Wait(void *,void *,word16) reentrant; /* same as above with wait */
word16 K_Get_Str_Wait_Return(void *,void *,word16,word16) reentrant; /* get requested number with wait */
word16 K_Get_Str_Return(void *,void *) reentrant;	/* get variable number from buffer */
word16 K_Recv_Count(void *) reentrant;	/* count of number of characters in receive buff */

/***************************************************************
	external assembly routines
***************************************************************/
extern void K_OS_Disable_Interrupts(void);	/* clears JUST I BIT */
extern void K_OS_Enable_Interrupts(void);		/* sets JUST I BIT */
extern void K_OS_Save_Interrupts(void);	/* clears JUST I BIT */
extern void K_OS_Restore_Interrupts(void);		/* sets JUST I BIT */
extern void K_I_Sched(void);
extern void K_I_Scheduler(void);
extern void K_OS_Intrp_Exit(void);
/*******************************************************
* the following functions are not to be called by user *
* used ONLY by other cmx functions  						 *
*******************************************************/

void K_I_Unlink(tcbpointer) reentrant;
void K_I_Priority_In(tcbpointer,byte) reentrant;
void K_I_Copy(byte *,byte *,byte) reentrant;
byte K_I_Get_Ptr(byte,tcbpointer *) reentrant;
void K_I_Func_Return(void) reentrant;
byte K_I_Time_Common(word16,byte) reentrant;

byte K_I_Intrp_Pipe_In(byte,byte,byte,word16,void *) reentrant;
#define K_Intrp_Task_Wake(A) K_I_Intrp_Pipe_In(0,A,0,0,0)
#define K_Intrp_Task_Wake_Force(A) K_I_Intrp_Pipe_In(1,A,0,0,0)
#define K_Intrp_Task_Start(A) K_I_Intrp_Pipe_In(2,A,0,0,0)
#define K_Intrp_Timer_Stop(A) K_I_Intrp_Pipe_In(3,A,0,0,0)
#define K_Intrp_Timer_Restart(A) K_I_Intrp_Pipe_In(4,A,0,0,0)
#define K_Intrp_Timer_Initial(A,B) K_I_Intrp_Pipe_In(5,A,0,B,0)
#define K_Intrp_Timer_Cyclic(A,B) K_I_Intrp_Pipe_In(6,A,0,B,0)
#define K_Intrp_Mesg_Send(A,B) K_I_Intrp_Pipe_In(7,A,0,0,B)
#define K_Intrp_Event_Signal(A,B,C) K_I_Intrp_Pipe_In(8,A,B,C,0)
#define K_Intrp_Semaphore_Post(A) K_I_Intrp_Pipe_In(9,A,0,0,0)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -