📄 vmcconf.c
字号:
/***************************************************************************
*
* Copyright (c) 1994 MICROTEC RESEARCH INCORPORATED.
*
* All rights reserved. MICROTEC RESEARCH's source code is an unpublished
* work and the use of a copyright notice does not imply otherwise.
* This source code contains confidential, trade secret material of
* MICROTEC RESEARCH. Any attempt or participation in deciphering,
* decoding, reverse engineering or in any way altering the source code
* is strictly prohibited, unless the prior written consent of
* MICROTEC RESEARCH is obtained.
*
*
* Module Name: %M%
*
* Identification: %Z% %I% %M%
*
* Date: %G% %U%
*
****************************************************************************
*/
#include <vrtxil.h>
typedef struct TCB {
char vmc[24]; /* Size of Task Control Block */
} TCB;
typedef struct QCB {
char vmc[8]; /* Size of Queue Control Block */
} QCB;
typedef struct PCB {
char vmc[10]; /* Size of Partition Control Block */
} PCB;
typedef struct ECB {
char vmc[8]; /* Size of Event Flag Group Control Block */
} ECB;
typedef struct VCB {
char vmc[16]; /* Size of Virtual Timer Control Block */
} VCB;
/*----------------------------------------------------------------*/
/* Task Declarations */
/* extern Declaration for Task Start Routines */
/* extern declarations for variables whose address is to be passed to the
task start routines - Note that these are declared as extern int */
/* declarations to allocate stack for each task defined.
If the stack is pre-allocated by the application then have an extern
declaration for those task stacks. */
extern void task1(void *);
char vmc_stack_task1[300];
extern void task2(void *);
char vmc_stack_task2[300];
/* Allocate space for TCBs and define a constant vmc_ntsk that contains number
of tasks (user tasks + 1 idle task) in the system */
TCB vmc_tasktab[3];
const int vmc_ntsk=3;
/* The following allocates space for message queues. Note that actual number
of queue slots is one more than the queue size */
char *vmc_queue_queue1[3];
/* Allocate space for Queue Control Blocks and define a constant vmc_nqueue
that contains number of queues in the system */
QCB vmc_qcb[1];
const int vmc_nqueue=1;
/* The following allocates space for partition memory. */
/* Allocate space for Partition Control Blocks and define a constant vmc_npart
that contains number of partitions in the system */
PCB *vmc_pcb;
const int vmc_npart=0;
/* Allocate space for Event Flag Group Control Blocks and define a constant
vmc_nflag that contains number of event flag groups in the system */
ECB *vmc_eventgroup;
const int vmc_nflag=0;
/* Allocate space for Virtual Timer Control Blocks and define a constant
vmc_ntimers that contains number of virtual timers in the system */
VCB *vmc_timers;
const int vmc_ntimers=0;
/* Idle Task Configuration - The variable vmc_idle_task_ptr contains the
pointer to the start routine of the idle task - 0 for default */
void (*const vmc_idle_task_ptr)(void) = 0;
/* The variable vmc_write_ptr contains the pointer to the serial polled
write routine that is called by the vmc_snapshot routine */
extern void vmc_write(char *, int);
void (*const vmc_write_ptr)(char *, int) = vmc_write;
/* The following variables vmc_tswitch, vmc_userexit_ptr and vmc_panic_ptr
contain the pointers to the routines for Task switch hook routine, Task
exit handler and user defined panic handler routines resp. */
void (*const vmc_tswitch)(TCB *, TCB *) = 0;
extern void vmc_userexit(void);
void (*const vmc_userexit_ptr)(void) = vmc_userexit;
void (*const vmc_panic_ptr)(void) = 0;
void (*const vmc_vt_handler_ptr)(unsigned) = 0;
/* The following declaration allocates space for interrupt stack and
define quantum for time slice */
const int vmc_istksize = 1024;
char vmc_stack[1024];
const int vmc_quantum = 0;
/*
unsigned char vmc_keep_FIQ_enabled;
*/
#define STACKSIZE 1024
const int stacksize = STACKSIZE; /* used to set up int stack in VMCISRST.S */
char vmc_interrupt_stack[STACKSIZE];
/*-------------------------------------------------------------------*/
/*
* vmc_usr_sysinit - This routine is called by vrtx_init system call to
* create user specified objects.
*/
int vmc_usr_sysinit(void)
{
int vmc_tcreate(void (*)(), char *, short, int, void *, char);
int vmc_qcreate(char **, unsigned short);
int vmc_pcreate(char *, unsigned long, unsigned long, unsigned char);
int vmc_fcreate(unsigned long);
int vmc_vtcreate(void);
/*
vmc_keep_FIQ_enabled = 0;
*/
if ((unsigned) vmc_ntsk > 255)
return ER_ICP;
if (vmc_tcreate(task1, vmc_stack_task1, 300, 1, (void *) 0 , 0))
return ER_ICP;
if (vmc_tcreate(task2, vmc_stack_task2, 300, 126, (void *) 0 , 0))
return ER_ICP;
if ((unsigned) vmc_nqueue > 255)
return ER_ICP;
if (vmc_qcreate(vmc_queue_queue1, 3))
return ER_ICP;
if ((unsigned) vmc_npart > 255)
return ER_ICP;
if ((unsigned) vmc_nflag > 255)
return ER_ICP;
if ((unsigned) vmc_ntimers > 255)
return ER_ICP;
return 0;
}
/*-------------------------------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -