MiniOS用户手册.doc

Size: px
Start display at page:

Download "MiniOS用户手册.doc"

Transcription

1 V C TEL : FAX : unsp@sunpluscomcn

2 ,,,,,,,,, Sunplus University Program 2

3 OS OS MiniOS OS_intStatus CPU OS_ReadyTable OS_intNest OS_lockNest OS_pCurTask (TCB) OS_iCurTask OS_intSource OS_tickCount ini OS API int SpSInit(void); int SpSStart(void);51 Sunplus University Program unsp@sunpluscomcn 3

4 int SpSTaskCreate(pTask function, void *pparameter, void *pstacktop, int iprio); int SpSTaskExit(void); int SpSTaskDel(unsigned int iprio); int SpSTaskSuspend(int iprio); int SpSTaskResume(int iprio); void SpSTimeDly(unsigned int itimecount); int SpSTimeDlyResume(int iprio); void SpSSchedLock(void); void SpSSchedUnLock(void); HEvent SpSSemCreate(unsigned int ivalue); int SpSSemPend(HEvent hevent, unsigned int itimeout); int SpSSemPost(HEvent hevent); int SpSSemAccept(HEvent hevent); HEvent SpSMboxCreate(void* pmail); void* SpSMboxPend(HEvent hevent, unsigned int itimeout, int* err); int SpSMboxPost(HEvent hevent, void* pmail); void* SpSMboxAccept(HEvent hevent); HEvent SpSQCreate(void* pstart, unsigned int isize); void* SpSQPend(HEvent hevent, unsigned int itimeout, int* err); int SpSQPost(HEvent hevent, void* pmsg); int SpSQPostFront(HEvent hevent, void* pmsg); void* SpSQAccept(HEvent hevent); void SpSSetVector(int Vector_No, void (*pisr)()); void SpFAddINTVec(unsigned long ulvector); void SpFDelINTVec(unsigned long ulvector); unsigned long SpFGetINTVec(void); HMem SpSMemCreate(void* pstart, unsigned int iblock, unsigned int isize, int *err); void* SpSMemGet(HMem hmem); void* SpSMemGetWait(HMem hmem, unsigned int itimeout, int *err); int SpSMemPut(HMem hmem, void* pblk); int SpSGetPri(); int SpSVersion(); Sunplus University Program 4

5 1 MiniOS 15X 15X OS MiniOS CPU--µ nsp CPU OS OS MiniOS MiniOS MHz 49152MHz MiniOS Sunplus University Program unsp@sunpluscomcn 5

6 C MiniOS API RAM 85 2 CPU Sunplus University Program unsp@sunpluscomcn 6

7 2 OS OS 21 CPU 8 KeyPress() Uart() KeyPress() Uart() UART while(1) function1(); // 1 function2(); // 2 function3(); // 3 KeyPress(); // 4 function5(); // 5 function6(); // 6 function7(); // 7 Uart(); // 8 Sunplus University Program unsp@sunpluscomcn 7

8 KeyPress() Uart() UART UART Uart() function1 function7 Uart() function7 OS CPU CPU OS OS int a=0; function() a = ; // a a 1, // ISR a ;, Sunplus University Program unsp@sunpluscomcn 8

9 Linux CPU MiniOS 1 Ready 2 Ready 3 4 OS API OS API ( ) Sunplus University Program unsp@sunpluscomcn 9

10 22 OS MiniOS API SpSInit(); SpSTaskCreate(,,, ) MiniOS CPU CPU 15 CPU CPU 15 // 1 B // example 1: single task // descriptions: port B low byte: connect to 8 LEDs // Program run to turn on LEDs one by one,control signal output from port B // author: Taiyun Wang // date: 2003/2/22 /////////////////////////////////////////////////////////////////////////// Sunplus University Program unsp@sunpluscomcn 10

11 #include "sposvarh" #include "sposh" int err; int t1stack[20]; //err No //Task stack volatile unsigned int *P_IOB_DATA =(unsigned int*)(0x7005); //Port B data register volatile unsigned int *P_IOB_DIR =(unsigned int*)(0x7007); volatile unsigned int *P_IOB_ATTRIB = (unsigned int*)(0x7008); //Port B direction register //Port B attribute register main() void Task1(); SpSInit(); *P_IOB_DIR = 0XFFFF; *P_IOB_ATTRIB = 0XFFFF; //initialize OS kernel //Set Prot B is output //Set prot B attribute err = SpSTaskCreate(Task1,0,t1stack+19,1); //Create a task SpSStart(); //Start kernel void Task1() //task one unsigned int i = 1; while(1) *P_IOB_DATA = i; i<<=1; if(i == 0x0100) i = 1; SpSTimeDly(20); //Delay 20 tick API CPU tick MiniOS 128Hz tick 1/ ICE // // example 2: two tasks // descriptions: This example based on example 1, // two tasks do not communicate with each other and run independently Sunplus University Program unsp@sunpluscomcn 11

12 // author: Taiyun Wang // date: 2003/2/22 /////////////////////////////////////////////////////////////////////////// #include "sposvarh" #include "sposh" int err; int t1stack[20]; int t2stack[20]; //err No //Task 1 stack //Task 2 stack volatile unsigned int *P_IOA_DATA =(unsigned int*)(0x7000); //Port A data register volatile unsigned int *P_IOA_DIR =(unsigned int*)(0x7002); //Port A direction register volatile unsigned int *P_IOA_ATTRIB = (unsigned int*)(0x7003); //Port A attribute register volatile unsigned int *P_IOB_DATA =(unsigned int*)(0x7005); //Port B data register volatile unsigned int *P_IOB_DIR =(unsigned int*)(0x7007); //Port B direction register volatile unsigned int *P_IOB_ATTRIB = (unsigned int*)(0x7008); //Port B attribute register main() void Task1(); void Task2(); SpSInit(); //Initialize OS kernel *P_IOA_DIR = 0XFFFF; *P_IOA_ATTRIB = 0XFFFF; //Set Port A output //Set Port A attribute *P_IOB_DIR = 0XFFFF; *P_IOB_ATTRIB = 0XFFFF; //Set port B output //Set port b attribute err = SpSTaskCreate(Task1,0,t1stack+19,1); //Create first task err = SpSTaskCreate(Task2,0,t2stack+19,2); //Create second task SpSStart(); //Start kenel void Task1() //task 1 unsigned int i = 1; while(1) *P_IOB_DATA = i; i<<=1; if(i == 0x0100) Sunplus University Program unsp@sunpluscomcn 12

13 i = 1; SpSTimeDly(30); //Delay 30 tick void Task2() //task 2 unsigned int i=0; while(1) *P_IOA_DATA = i; i<<=1; if(i == 0) i = 1; SpSTimeDly(5); //Delay 5 tick OS 1 2 C 3 4 IDE OS Sunplus University Program unsp@sunpluscomcn 13

14 3 MiniOS 15X MiniOS 15X sposvarh sposh RAM ROM sposvarh sposvarh sposconfigh sysstructh sposconfigh #define BODY_SPCE061A // 1 #define MAXTASK 5 // 2 #define MAXEVENT 3 // 3 #define MAXQUEUE 3 // 4 #define MAXMCB 3 // 5 #define MAXIFT 3 // 6 #define STACKSIZE 128 // 7 #define BODY_SPCE061A, body spce061a sposvarh sposh #define MAXTASK OS 15 MAXTASK #define MAXEVENT 3 MAXTASK 0 RAM #define MAXQUEUE 3 0 MAXEVENT #define MAXMCB 3 #define MAXIFT 3 #define STACKSIZE 128 sposvarh sysstructh TCB ECB sposvarh TCB TCB_struct OS_TCB[MAXTASK]; TCB_struct sysstructh TCB OS_TCB, MAXTASK, sposconfigh sposconfigh MAXTASK Sunplus University Program unsp@sunpluscomcn 14

15 TCB C C sposh API body sposconfigh sysstructh sposbodyh sposbodyh sposconfigh body BODY_SPCE061A sposce061ah body body body spce061a #ifdef BODY_SPCE061A // #include "sposce061ah" //spce061 body #endif sposce061ah extern void SpFAddINTVec(unsigned int ulvector); extern void SPFDelINTVec(unsigned int ulvector); extern unsigned int SpFGetINTVec(void); body body body os body body sposconfigh #define BODY_SPCE061A body define sposconfigh Sunplus University Program unsp@sunpluscomcn 15

16 CPU 3 B 8 // // example 3: semaphore // descriptions: The first task turned on LEDs from left to right,moved slowly until the eighth LED lighten, // then the second task started up, it turned on LEDs from right to left,moved fleetly // until the first LED lighten,and then the first task started up againthe program repeat endless // author: Taiyun Wang // date: 2003/2/22 /////////////////////////////////////////////////////////////////////////// Sunplus University Program unsp@sunpluscomcn 16

17 #include "sposvarh" #include "sposh" int err; int t1stack[20]; int t2stack[20]; HEvent sem; //error No //Task 1 stack //Task 2 stack //Event handle volatile unsigned int *P_IOB_DATA =(unsigned int*)(0x7005); //Port B data register volatile unsigned int *P_IOB_DIR =(unsigned int*)(0x7007); //Port B direction register volatile unsigned int *P_IOB_ATTRIB = (unsigned int*)(0x7008); //port B attribute register main() void Task1(); SpSInit(); *P_IOB_DIR = 0XFFFF; *P_IOB_ATTRIB = 0XFFFF; err = SpSTaskCreate(Task1,0,t1stack+19,1); sem = SpSSemCreate(1); SpSStart(); //Initialize OS kernel //Set port B direction //Set prot B attribute //Create first task //Create a semaphone //Start kernel void Task1() //task 1 void Task2(); unsigned int i = 1; err = SpSTaskCreate(Task2,0,t2stack+19,2); //Create second task while(1) SpSSemPend(sem,0); // Waiting semaphone for(i = 1;i<0x100;i<<=1) *P_IOB_DATA = i; SpSTimeDly(30); //Delay 30 tick SpSSemPost(sem); //Release semaphone void Task2() //task 2 volatile unsigned int *P_IOB_DATA = (unsigned int*)(0x7005); unsigned int i = 0x80; Sunplus University Program unsp@sunpluscomcn 17

18 while(1) SpSSemPend(sem,0); //Waiting semaphone for(i = 0x80;i!= 0;i>>=1) *P_IOB_DATA = i; SpSTimeDly(5); //Delay 5 tick SpSSemPost(sem); //Release semaphone 8 B synchronism 4 05 ICE IDE // // example 4: task synchronization // descriptions: The first task wait for a semaphore,when the semaphore is Realeased, // this task turn on LEDs one by one // The second task sends a semaphore at the rate of 05 second // author: Taiyun Wang // date: 2003/2/22 /////////////////////////////////////////////////////////////////////////// #include "sposvarh" #include "sposh" int err; int t1stack[20]; int t2stack[20]; //Error No //Task 1 stack //Task 2 stack Sunplus University Program unsp@sunpluscomcn 18

19 HEvent sem; //Event handle volatile unsigned int *P_IOB_DATA =(unsigned int*)(0x7005); volatile unsigned int *P_IOB_DIR =(unsigned int*)(0x7007); volatile unsigned int *P_IOB_ATTRIB = (unsigned int*)(0x7008); //Port B data register //Port B dirction register //Port B attribue register main() void Task1(); SpSInit(); *P_IOB_DIR = 0XFFFF; *P_IOB_ATTRIB = 0XFFFF; //Set Port B output //Set Port B attribute err = SpSTaskCreate(Task1,0,t1stack+19,1); //Create first task sem = SpSSemCreate(0); SpSStart(); //Create semaphore //Start kernel void Task1() //Task one void Task2(); unsigned int i = 1; err = SpSTaskCreate(Task2,0,t2stack+19,2); //Create second task while(1) for(i = 1;i<0x100;i<<=1) SpSSemPend(sem,0); //Waiting semaphore *P_IOB_DATA = i; void Task2() while(1) SpSSemPost(sem); SpSTimeDly(32); //Realease semaphore //Delay 64 tick tick 1 Sunplus University Program unsp@sunpluscomcn 19

20 1 0 PEND N N 0 m m<n m // // example 5: counting semaphore // descriptions: Semaphore initialized is 3, thus 3 LEDs can be turned on at the same time // There are 8 initialized tasks,one task corresponds to one LED,they share the // resource each other Each task occupys the semaphore some cycles, then it releases // the semaphore,so other task can gain semaphore and turn on its own LED // author: Taiyun Wang // date: 2003/2/22 /////////////////////////////////////////////////////////////////////////// #include "sposvarh" #include "sposh" typedef struct int portval; int dlyval; par_t; //parameter struct int err; int stack[8][25]; HEvent sem; //Error No //Task stack //Event handle volatile unsigned int *P_IOB_DATA =(unsigned int*)(0x7005); volatile unsigned int *P_IOB_DIR =(uns igned int*)(0x7007); //Port B data register //Port B direction register Sunplus University Program unsp@sunpluscomcn 20

21 volatile unsigned int *P_IOB_ATTRIB = (unsigned int*)(0x7008); //Port B attribute register int portb = 0; main() void Task(void* inval); int i; par_t par[8]; int dlypar[8] = 53,43,31,29,23,19,17,13; //structure array //Delay tick of every task SpSInit(); *P_IOB_DIR = 0XFFFF; *P_IOB_ATTRIB = 0XFFFF; //Set Port B is output //Set Port B attribute for(i = 0;i<8;i++) par[i]portval = 1<<i; par[i]dlyval = dlypar[i]; for (i = 0; i<8;i++) err = SpSTaskCreate(Task,(void*)&par[i],&stack[i][24],i+1); sem = SpSSemCreate(3); //Create task //Create semaphore SpSStart(); //Start OS kernel void Task(void* inval) //task n(n=18) while(1) SpSSemPend(sem,0); //Waiting semaphore portb = ((par_t*)inval)->portval; *P_IOB_DATA = portb; SpSTimeDly(((par_t*)inval)->dlyval); portb &= ~((par_t*)inval)->portval; *P_IOB_DATA = portb; SpSSemPost(sem); SpSTimeDly(((par_t*)inval)->dlyval); //Release semaphore //Delay 8 8 PC 8 void Sunplus University Program unsp@sunpluscomcn 21

22 42 void* 6 char // // example 6: Mail box // descriptions: First task displays the value of byte in binary way, // the second task sends the value to the first task in runing time // author: Taiyun Wang // date: 2003/2/22 /////////////////////////////////////////////////////////////////////////// #include "sposvarh" #include "sposh" int err; int t1stack[25]; int t2stack[25]; HEvent mailbox; //Error No //Task 1 stack //Task 2 stack //Event handle volatile unsigned int *P_IOB_DATA =(unsigned int*)(0x7005); volatile unsigned int *P_IOB_DIR =(unsigned int*)(0x7007); //Port B data register //Port B direction register volatile unsigned int *P_IOB_ATTRIB = (unsigned int*)(0x7008) ; //Port B attribute register int portb = 0; main() void Task1(); Sunplus University Program unsp@sunpluscomcn 22

23 void Task2(); SpSInit(); *P_IOB_DIR = 0XFFFF; *P_IOB_ATTRIB = 0XFFFF; err = SpSTaskCreate(Task1,0,t1stack+24,1); err = SpSTaskCreate(Task2,0,t2stack+24,2); mailbox = SpSMboxCreate((void*)0); SpSStart(); void Task1() int msg = 0; SpSMboxPost(mailbox,&msg); while(1) void Task2() int msg; int * pmsg; int err; while(1) SpSTimeDly(128); msg = (msg+1)%256; //Set Port B is output //Set Port B arribute //Create first task //Create second task //Create mailbox //Start OS kernel //Delay 128 tick SpSMboxPost(mailbox,&msg); //Send a mail to task 2 pmsg = SpSMboxPend(mailbox,0,&err); msg = *pmsg; *P_IOB_DATA = msg; //Waiting mail //Copy mail to local variable //Write mail value to prot B 43 Sunplus University Program unsp@sunpluscomcn 23

24 CPU // // example 7: This program demo how to use Message queue // descriptions: The first task send message with front insert mode, // the second task receive message and display time // author: Taiyun Wang // date: 2003/2/22 /////////////////////////////////////////////////////////////////////////// #include "sposvarh" #include "sposh" int err; int t1stack[25]; int t2stack[25]; HEvent queue; int *Q[5]; //Error No //Task 1 stack //Task 2 stack //Event handle //Message queue array volatile unsigned int *P_IOB_DATA =(unsigned int*)(0x7005); volatile unsigned int *P_IOB_DIR =(unsigned int*)(0x7007); volatile unsigned int *P_IOB_ATTRIB = (unsigned int*)(0x7008); //Port B data register //Port B direction register //Port B attribute register int portb = 0; main() void Task1(); void Task2(); SpSInit(); *P_IOB_DIR = 0XFFFF; *P_IOB_ATTRIB = 0XFFFF; err = SpSTaskCreate(Task1,0,t1stack+24,1); err = SpSTaskCreate(Task2,0,t2stack+24,2); queue = SpSQCreate((void*)Q,5); //Set Port B output //Set Prot B attribute //Create fist task //Create second task //Create Message queue Sunplus University Program unsp@sunpluscomcn 24

25 SpSStart(); void Task1() int msg[2]; msg[0]=0; msg[1]=1; SpSQPostFront(queue,&msg[0]); SpSQPostFront(queue,&msg[1]); //SpSQPost(queue,&msg[0]); //SpSQPost(queue,&msg[1]); while(1) SpSTimeDly(256); msg[0] = (msg[0]+2)%256; msg[1] = msg[0]+1; SpSQPostFront(queue,&msg[0]); SpSQPostFront(queue,&msg[1]); //SpSQPost(queue,&msg[0]); //SpSQPost(queue,&msg[1]); void Task2() int msg; int * pmsg; int err; while(1) pmsg = SpSQPend(queue,0,&err); msg = *pmsg; *P_IOB_DATA = msg; SpSTimeDly(128); pmsg = SpSQPend(queue,0,&err); msg = *pmsg; *P_IOB_DATA = msg; SpSTimeDly(128); //Start Os kernel //insert queue head //insert queue head //insert queue //insert queue //Delay 256 tick //Waiting first message //Send first message to prot B //Waiting second message //Send second message to prot B 44 Sunplus University Program unsp@sunpluscomcn 25

26 API 1 SpSSemCreate() SpSSemPend() SpSSemPost() 2 SpSMboxCreate() SpSMboxPend() SpSMboxPost() 3 SpSQCreate() SpSQPend() SpSQPost() SpSQPostFront() tick tick // // example 8: Use mail to create complex task: // 1The main program creates first task and runs OS kenel // 2First task creates second task, // send the third task's structure including parameter and address and so on // and turn on lamp every other 17 tick // 3 Second task receives mailbox create third task and turn on lamp every other 11 tick // 4 After third task delay 4 second, it delete first task and second task and display lamp // author: Taiyun Wang // date:2003/2/22 /////////////////////////////////////////////////////////////////////////// #include "sposvarh" #include "sposh" typedef struct void (*start_add)(void *para); //function pointer Sunplus University Program unsp@sunpluscomcn 26

27 void* para; //task parameter int* stacktop; //task stack size int priority; //task priority stru_task; //structure name int err; int t1stack[25]; int t2stack[25]; int t3stack[25]; HEvent mailbox; //Error No //Task 1 stack //Task 2 stack //Task 3 stack //Event handle volatile unsigned int *P_IOB_DATA =(unsigned int*)(0x7005); volatile unsigned int *P_IOB_DIR =(unsigned int*)(0x7007); volatile unsigned int *P_IOB_ATTRIB = (unsigned int*)(0x7008); int portb = 0; //Port B data register //Port B direction register //Port B attribute register main() void Task1(); SpSInit(); *P_IOB_DIR = 0XFFFF; //Set port B direction *P_IOB_ATTRIB = 0XFFFF; //Set prot B attribute err = SpSTaskCreate(Task1,0,t1stack+24,1); //Create first task mailbox = SpSMboxCreate((void*)0); //create mailbox SpSStart(); //Start OS kernel void Task1() void Task2(); void Task3(); stru_task msg; msgstart_add = Task3; msgpara = (void*) 0; msgstacktop = t3stack+24; msgpriority = 3; err = SpSTaskCreate(Task2,0,t2stack+24,2); //Create second task SpSTimeDly(20); //Delay 20 tick,running task2 SpSMboxPost(mailbox,&msg); //Send mail to task 2 while(1) *P_IOB_DATA = 0x55; SpSTimeDly(17); Sunplus University Program unsp@sunpluscomcn 27

28 void Task2() stru_task msg; stru_task* pmsg; int err; pmsg = SpSMboxPend(mailbox,0,&err); msg = *pmsg; //Waiting mail //copy mail to local variable //create task 3 err = SpSTaskCreate(msgstart_add,msgpara,msgstacktop,msgpriority); while(1) *P_IOB_DATA = 0xAA; SpSTimeDly(11); void Task3() int i = 1; SpSTimeDly(512); //Delay 512 tick SpSTaskDel(1); //Delete task 1 SpSTaskDel(2); //Delete task 2 while(1) *P_IOB_DATA = i; i <<=1; if (i == 0x100) i = 1; SpSTimeDly(20); //Delay 20 tick Sunplus University Program unsp@sunpluscomcn 28

29 5 51 OS OS OS SR 4 CPU MiniOS API MiniOS API void SpSSetVector(int Vector_No,void (*pisr)()); unsigned long SpFGetINTVec(void); void SpFAddINTVec(unsigned long ulvector); OS void SPFDelINTVec(unsigned long ulvector); Sunplus University Program unsp@sunpluscomcn 29

30 MiniOS 4 MiniOS API API Void Interrupt_function(); Unsinged int t1stack[20]; Main() SpSInit(); // // Interrupt_function() 1 // 1 // SpSSetVector(0x1,Interrupt_fuction); // 1 SpFAddINTVec(0x1); tid1 = SpSTaskCreate(Task1,0,t1stack+19,1); SpSStart(); // Void Interrupt_function() // OS OS 8 SpSSetVector(0x1,Interrupt_function); 0x1 bodyh define, spce061a #define FIQ_PWM_VEC 0 #define FIQ_TMA_VEC 1 #define FIQ_TMB_VEC 2 #define IRQ0_PWM_VEC 3 #define IRQ1_TMA_VEC 4 #define IRQ2_TMB_VEC 5 Sunplus University Program unsp@sunpluscomcn 30

31 #define IRQ3_EXT2_VEC 6 #define IRQ3_EXT1_VEC 7 #define IRQ3_KEY_VEC 8 #define IRQ4_4KHZ_VEC 9 #define IRQ4_2KHZ_VEC 10 #define IRQ4_1KHZ_VEC 11 #define IRQ5_4HZ_VEC 12 #define IRQ5_2HZ_VEC 13 #define IRQ6_TMB1_VEC 14 #define IRQ6_TMB2_VEC 15 #define UART_RX_VEC 16 #define UART_TX_VEC 17 SpSSetVector(FIQ_PWM_VEC,Interrupt_function); PWM 52 1 Pend SpSSemPend, SpSMboxpend, SpSQPend Pend Accept, ( SpSSemAccept SpSQAccept ) tick Timer tick // // example 9: Send message in interrupt // descriptions: The interrupt function send semaphore to task 1 and task 2 Sunplus University Program unsp@sunpluscomcn 31

32 // pay attention to the interrupt function that lie in system clock interrupt // author: Taiyun Wang // date: 2003/2/22 /////////////////////////////////////////////////////////////////////////// #include "sposvarh" #include "sposh" int err; int t1stack[20]; int t2stack[20]; HEvent sem1,sem2; int tick1 = 0,tick2 = 0; //Error No //Task 1 stack //Task 2 stack //Event handle volatile unsigned int *P_IOA_DATA =(unsigned int*)(0x7000); volatile unsigned int *P_IOA_DIR =(unsigned int*)(0x7002); volatile unsigned int *P_IOA_ATTRIB = (unsigned int*)(0x7003); //Port A data register //Port A direction register //Port A attribute register volatile unsigned int *P_IOB_DATA =(unsigned int*)(0x7005); volatile unsigned int *P_IOB_DIR =(unsigned int*)(0x7007); volatile unsigned int *P_IOB_ATTRIB = (unsigned int*)(0x7008); //Port B data register //Port B direction register //Port B attribute register main() void Timer_INT(void); void Task1(); void Task2(); SpSInit(); *P_IOA_DIR = 0XFFFF; *P_IOA_ATTRIB = 0XFFFF; //Set Port A direction //Set Port A attribute *P_IOB_DIR = 0XFFFF; *P_IOB_ATTRIB = 0XFFFF; SpSSetVector(IRQ6_TMB2_VEC,Timer_INT); err = SpSTaskCreate(Task1,0,t1stack+19,1); err = SpSTaskCreate(Task2,0,t2stack+19,2); sem1 = SpSSemCreate(0); sem2 = SpSSemCreate(0); SpSStart(); //Set Port B direction //Set Port B attribute //Set interrupt function //Create first task //Create second task //Create semaphore //Start OS kernel void Task1() //task one Sunplus University Program unsp@sunpluscomcn 32

33 unsigned int i = 1; while(1) SpSSemPend(sem1,0); *P_IOB_DATA = i; i<<=1; if(i == 0x0100) i = 1; //Waiting semaphore void Task2() //task two unsigned int i=0; while(1) SpSSemPend(sem2,0); //Waiting semaphore *P_IOA_DATA = i; i<<=1; if(i == 0) i = 1; void Timer_INT(void) tick1++; tick2++; if (tick1 == 30) //tick==30? SpSSemPost(sem1); //Release semaphore 1,running task 1 tick1 = 0; if (tick2 == 5) //tick==5 SpSSemPost(sem2); //Release semaphore 2,running task 2 tick2 = 0; Sunplus University Program unsp@sunpluscomcn 33

34 6 API MiniOS 15X, // // example This program show to memoroy management API // author: Taiyun Wang // date:2003/2/22 /////////////////////////////////////////////////////////////////////////// #include "sposvarh" #include "sposh" int taskerr; //Error No int t1stack[25]; //Task 1 stack int t2stack[25]; //Task 2 stack int t3stack[25]; //Task 3 stack int MemPart[6][8]; //Partition HMem pmem; //Memory control block data structure pointer main() void Task(); unsigned int err; int *a; SpSInit(); pmem = SpSMemCreate(MemPart,6,8,&err); //Create memory control block taskerr = SpSTaskCreate(&Task,0,t1stack+24,1); //Create first task taskerr = SpSTaskCreate(&Task,0,t2stack+24,2); //Create second task taskerr = SpSTaskCreate(&Task,0,t3stack+24,3); //Create third task SpSStart(); void Task() int *a,*b,*c; int err; Sunplus University Program unsp@sunpluscomcn 34

35 a=(int*)spsmemget(pmem); //Obtaining a memory block if(a) *a = 1; b=(int*)spsmemget(pmem); //Obtaining a memory block if(b) *b = 2; c=(int*)spsmemgetwait(pmem,0,&err); //Obtaining a memory block if(c) *c = 3; SpSTimeDly(5); SpSMemPut(pmem,(void*)a); SpSMemPut(pmem,(void*)b); SpSMemPut(pmem,(void*)c); //default call SpSTaskExit Sunplus University Program unsp@sunpluscomcn 35

36 7 Windows Linux Windows DDK DDK DDK Linux 386 Windows Linux UART UART UART LED Sunplus University Program unsp@sunpluscomcn 36

37 8 10 MiniOS ICE ICE J24 J25 // // example 10: This example Plays original sound on OS, explain how to Play sound on OS // author: Taiyun Wang // date:2003/2/22 /////////////////////////////////////////////////////////////////////////// #include "sposvarh" #include "sposh" #define BUFLEN 60 #define BUFSIZE 2 extern long RES_ORIG2_RAW_SA; extern long RES_ORIG2_RAW_EA; unsigned int* pstart; unsigned int* pend; int SegStart; int SegEnd; int playpointer = 0; int playbuf = 0; int buff[bufsize][buflen]; //sound buffer int err; int t1stack[32]; int t2stack[20]; //Error No //Task 1 stack //Task 2 stack Sunplus University Program unsp@sunpluscomcn 37

38 HEvent sem; //Event handle volatile unsigned int *P_IOB_DATA =(unsigned int*)(0x7005); volatile unsigned int *P_IOB_DIR =(unsigned int*)(0x7007); volatile unsigned int *P_IOB_ATTRIB = (unsigned int*)(0x7008); //Port B data register //Port B direction register //Port B attribute register volatile unsigned int* P_DAC_Ctrl = (unsigned int*) 0x7015; volatile unsigned int* P_DAC1 = (unsigned int*) 0x7017; volatile unsigned int* P_DAC2 = (uns igned int*) 0x7016; //DAC control register //DAC1 data register //DAC2 data register void int_func(void); //interrupt function main() void Task1(); void Task2(); void DACInit(); SpSInit(); *P_IOB_DIR = 0XFFFF; *P_IOB_ATTRIB = 0XFFFF; DACInit(); *P_DAC1 = 0x0; *P_DAC2 = 0x0; //Set Port B direction //Set Port B attribute err = SpSTaskCreate(Task1,(void*)0,t1stack+31,1); //Create first task err = SpSTaskCreate(Task2,(void*)0,t2stack+19,2); //Create second task sem = SpSSemCreate(0); SpSStart(); //Start OS kernel void DACInit() pstart = (unsigned int *)(int)res_orig2_raw_sa; //Start pointer pend = (unsigned int *)(int)res_orig2_raw_ea; //End pointer SegStart = (unsigned int)(res_orig2_raw_sa>>6)&0xfc00; //Start segment SegEnd = (unsigned int)(res_orig2_raw_ea>>6)&0xfc00; //End segment SpFSetTimer(OS_SET_TIMEA,0x0030,0xFA23); void Task1() int fillbuf(int buffno); int ret; Sunplus University Program unsp@sunpluscomcn 38

39 fillbuf(0); fillbuf(1); SpSSetVector(FIQ_TMA_VEC,int_func); SpFAddINTVec(FIQ_TMA_EN); while(1) SpSSemPend(sem,0); ret = fillbuf(((unsigned int)(playbuf-1)%bufsize)); if(ret) SpSTimeDly(1); SpFDelINTVec(FIQ_TMA_EN); *P_DAC1 = 0x78f0; *P_DAC2 = 0x78f0; SpSTaskExit(); void Task2() unsigned int i = 1; while(1) *P_IOB_DATA = i; i<<=1; if(i == 0x0100) i = 1; SpSTimeDly(20); void int_func(void) *P_DAC1 = (unsigned char)buff[playbuf][playpointer]; *P_DAC2 = (unsigned char)buff[playbuf][playpointer++]; if(playpointer == BUFLEN) playbuf = (unsigned int)(playbuf+1)%bufsize; playpointer = 0; SpSSemPost(sem); int fillbuf(int buffno) int i; Sunplus University Program unsp@sunpluscomcn 39

40 unsigned int tmp; asm ("INT OFF \n\t" //Set data segment "SR = SR AND 0x03FF \n\t" "SR = SR OR %0" : :"m"(segstart) ); SpSEnableINT(); //Enable interrupt for(i = 0;i <= BUFLEN;i++) asm ("%0 = D:[%1] \n\t" //Read sound data to tmp :"=r"(tmp) :"r"(pstart) ); pstart++; buff[buffno][i] = tmp; if((pstart >= pend)&&(segstart == SegEnd)) //Play finished return 1; if(pstart == (void*)0) SegStart+=0x0400; asm ("INT OFF \n\t" //Set data segment "SR = SR AND 0x03FF \n\t" "SR = SR OR %0" : :"m"(segstart) ); SpSEnableINT(); return 0; 48Kbps 16K S480 for MiniOS library 1 2 SpSSemPend, Sunplus University Program unsp@sunpluscomcn 40

41 SpSSemAccept SpSSemPend SpSSemAccept void* 0 3 S480 S ICE, MiniOS 15X S480 for MiniOS library A 8 B 8 VDD 1 2 SW1 1 2 SW2 1 2 SW3 1 2 SW4 1 2 SW5 1 2 SW6 1 2 SW7 Pin0 Pin1 Pin2 Pin3 Pin4 Pin5 Pin6 Pin0 Pin1 Pin2 Pin3 Pin4 Pin5 Pin6 Pin7 LED1 LED2 LED3 LED4 LED5 LED6 LED7 LED8 100 R6 100 R6 100 R6 100 R6 100 R6 100 R6 100 R6 100 R6 1 2 SW8 Pin7 // // example 11: S480 on MiniOS // description: The program uses a semaphore to synchronize decoding task and interrupt playing task // keyboard scan uses a mailbox to save key value // author: Taiyun Wang // date: 2003/2/22 /////////////////////////////////////////////////////////////////////////// #include "sposvarh" #include "sposh" Sunplus University Program unsp@sunpluscomcn 41

42 #include "s480h" #define MaxSpeechNum 3 #define MaxVolume 15 void CDecoderTask(); void shiftled(); void ScanKeyTask(); int t1stack[20]; int t2stack[20]; int t3stack[100]; HEvent hdecodersem; HEvent hkeymbox; //Task 1 stack //Task 2 stack //task 3 stack //Event handle //Event handle volatile unsigned int *P_IOA_DATA=(unsigned int*)(0x7000); volatile unsigned int *P_IOB_DATA =(unsigned int*)(0x7005); volatile unsigned int *P_IOB_DIR =(unsigned int*)(0x7007); volatile unsigned int *P_IOB_ATTRIB = (unsigned int*)(0x7008); // int main() SpSInit(); hkeymbox = SpSMboxCreate(0); //Create mialbox SpSTaskCreate(CDecoderTask,0,t3stack+99,3); //Create task of decoder SpSTaskCreate(shiftLED,0,t2stack+19,2); //Create task of LED SpSTaskCreate(ScanKeyTask,0,t1stack+19,1); //Create task of scan keyboard SpSStart(); //Start OS kernel void ScanKeyTask( ) unsigned int bdown=0; unsigned int bkeepdown=0; unsigned int itemp; while(1) itemp = *P_IOA_DATA; itemp &=0x00FF; if(itemp == 0) bdown = 0; bkeepdown = 0; Sunplus University Program unsp@sunpluscomcn 42

43 else if(bdown == 0) bdown = 1; else if (bkeepdown == 0) SpSMboxPost(hKeyMbox,&iTemp); bkeepdown = 1; SpSTimeDly(2); void shiftled( ) unsigned int i = 1; while(1) *P_IOB_DIR = 0XFFFF; *P_IOB_ATTRIB = 0XFFFF; *P_IOB_DATA = i; i<<=1; if(i == 0x0100) i = 1; SpSTimeDly(20); void CDecoderTask() int Ret = 0; long Addr; int Mode; //Send scan keyboard value void * pkey; int Key = 0; int SpeechIndex = 0; int VolumeIndex = 8; unsigned int i=0; Mode = Auto; SpSSetVector(FIQ_TMA_VEC,F_FIQ_Service_SACM_S480); hdecodersem = SpSSemCreate(1); while(mode == Auto) //Set interrupt function //Create semaphore Sunplus University Program unsp@sunpluscomcn 43

44 Ret = System_Initial(); Ret = SACM_S480_Initial(Auto); SACM_S480_Play(SpeechIndex,DAC1+DAC2, Ramp_UpDn_On); while(1) pkey=spsmboxaccept(hkeymbox); //Read key if(pkey!= (void*)0) Key = *(unsigned int*)pkey; else Key = 0; switch(key) case 0x01: SACM_S480_Play(SpeechIndex,DAC1+DAC2, Ramp_UpDn_On); break; case 0x02: SACM_S480_Stop(); break; case 0x04: SACM_S480_Pause(); break; case 0x08: SACM_S480_Resume(); break; case 0x10: VolumeIndex++; if(volumeindex > MaxVolume) VolumeIndex = MaxVolume; SACM_S480_Volume(VolumeIndex); break; case 0x20: if(volumeindex == 0) VolumeIndex = 0; else VolumeIndex--; SACM_S480_Volume(VolumeIndex); break; case 0x40: if( ++SpeechIndex == MaxSpeechNum) SpeechIndex = 0; SACM_S480_Play(SpeechIndex,DAC1+DAC2, Ramp_UpDn_On); break; case 0x80: Sunplus University Program unsp@sunpluscomcn 44

45 if( --SpeechIndex < 0) SpeechIndex = MaxSpeechNum-1; SACM_S480_Play(SpeechIndex,DAC1+DAC2, Ramp_UpDn_On); break; default: break; SACM_S480_ServiceLoop(); MiniOS Sunplus University Program unsp@sunpluscomcn 45

46 9 MiniOS OS 5 C 5 91 OS_intStatus OS_readyTable OS_intNest OS_lockNest OS_pCurTask OS_iCurTask OS_intSource OS_tickCount FIQ IRQ 1 0 TCB 1 1/ OS_intStatus CPU 912 OS_ReadyTable ( ) 0 : Sunplus University Program unsp@sunpluscomcn 46

47 913 OS_intNest 0 1 IRQ FIQ OS_lockNest OS_pCurTask (TCB) idle, idle 916 OS_iCurTask, OS_intSource 16 16, 1, 918 OS_tickCount 1/128, 128, 92 TCB_head[16] 16 TCB_head[3] 3 TCB TCB_head TCB typedef struct TCB_struct TCB_reg* SP; enum Tsk_status taskstate; unsigned int tasktimedly; struct ECB_struct* eventptr; TCB_struct; //Register struct //task state //Time delay count //waiting event handle TCB_reg typedef struct TCB_reg unsigned int reserved; unsigned int SB; unsigned int R1; unsigned int R2; // // shift buffer // Sunplus University Program unsp@sunpluscomcn 47

48 unsigned int R3; unsigned int R4; unsigned int BP; unsigned int SR; unsigned int PC; TCB_reg; SHTBUF shift buffer enum Tsk_status taskstate, enum Tsk_status Unused = 0x00, Ready = 0x01, Running = 0x02, SusPend = 0x04, Delay = 0x08, WaitSem = 0x10, WaitMail = 0x20, WaitQueue = 0x40, waitflag = 0x80, waitmem = 0x100, SemDly = 0x18, MailDly = 0x28, QDly = 0x48, FlagDly = 0x88, MemDly = 0x108, SemSus = 0x14, MailSus = 0x24, QSus = 0x44, FlagSus = 0x84, MemSus = 0x104, SemDlySus = 0x1C, MailDlySus = 0x2C, Sunplus University Program unsp@sunpluscomcn 48

49 ; MQDlySus = 0x4C, FlagDlySus = 0x8C, MemDlySus = 0x10C unsigned int tasktimedly tick 0 tick 0 void *eventptr 93 ISR_head[18] body SPCE ISR_head body body typedef struct IFT_struct struct IFT_struct *next; unsigned int SR; void (*function)(void); IFT_struct; 94 typedef struct ECB_struct enum Event_type eventtype; unsigned int waittable[2]; union unsigned int count; unsigned int flag_grp; void *msg; struct QCB_struct *p_qcb; comm; ECB_struct; 4 word word 1 enum Event_type eventtpe Sunplus University Program unsp@sunpluscomcn 49

50 enum Event_type None = 0, Semaphore, Mailbox, Queue, Flag ; word count, typedef struct QCB_struct void *start; void *end; void *in; void *out; unsigned int entries; QCB_struct; +1 FIFO 95 typedef struct MCB_struct void *MCB_freeList; int waittable[2]; MCB_struct; 3 word MCB_freeList OS_readyTable Sunplus University Program unsp@sunpluscomcn 50

51 10 ini OS API int SpSInit(void); OS_NO_ERR OS_OVER_MAX 15 OS_UNDER_ONE 0 SpSInit( ) SpSStart( ) Void main() SpSInit(); /* Initialize MiniOS*/ SpSStart(); /* Start Multi-Tasking */ 1012 int SpSStart(void); OS_NO_TASK SpSInit( ) SpSStart( ) SpSStart( ) SpSInit( ) int SpSTaskCreate(pTask function, void *pparameter, void *pstacktop, int iprio); function pparameter pstacktop Sunplus University Program unsp@sunpluscomcn 51

52 iprio OS_NO_ERR OS_PRIO_EXIST OS_PRIO_INVALID 14 OS_NO_TCB TCB 15 int err; /* error number */ int t1stack[20]; /* Task stack */ Void main() void Task1(); SpSInit(); /* Initialize minios*/ err = SpSTaskCreate(Task1,0,t1stack+19,1); /* Create a task */ SpSStart(); /* Start Multi-Tasking */ void Task1() 1022 int SpSTaskExit(void); OS_IN_ISR SpSTaskExit( ) void TaskN() SpSTaskExit(); Sunplus University Program unsp@sunpluscomcn 52

53 1023 int SpSTaskDel(unsigned int iprio); SpSTaskDel SpSTaskExit SpSTaskDel SpSTaskExit OS_NO_ERR OS_PRIO_INVALID 14 OS_PRIO_NULL void TaskN() SpSTaskDel(10); /* delete task with priority 10 */ 1024 int SpSTaskSuspend(int iprio); SpSTaskResume() OS_NO_ERR OS_PRIO_INVALID 14 OS_PRIO_NULL SpSTaskResume() void TaskN() while(1) err = SpSTaskSuspend(10); /* suspend task with priority 10 */ Sunplus University Program unsp@sunpluscomcn 53

54 1025 int SpSTaskResume(int iprio); SpSTaskSuspend OS_NO_ERR OS_PRIO_INVALID 14 OS_PRIO_NULL OS_RESUME_SELF OS_NO_SUSPEND void TaskN() while(1) err = SpSTaskResume(10); /*resume task with priority 10 */ 1026 void SpSTimeDly(unsigned int itimecount); 0 time tick MiniOS 1 tick = 1/128s 78ms void TaskN() while(1) SpSTimeDly(10); /* delay task for 10 ticks */ Sunplus University Program unsp@sunpluscomcn 54

55 1027 int SpSTimeDlyResume(int iprio); SpSTimeDly OS_NO_ERR OS_PRIO_INVALID 14 OS_PRIO_NULL OS_NO_TIMEDLY SpSTimeDlyResume () void TaskN() int err; while(1) err = SpSTimeDlyResume(10); /* resume task with priority */ if (err == OS_NO_ERR) 1028 void SpSSchedLock(void); SpSSchedUnLock 1 0 SpSSchedLock SpSTimeDly SpSSemPend API Void TaskN(void *parm) SpSSchedLock(); /* Prevent other tasks to run */ /* code protected from content switch */ SpSSchedUnLock(); /* Enable other tasks to run */ Sunplus University Program unsp@sunpluscomcn 55

56 1029 void SpSSchedUnLock(void); 0 SpSSchedLock HEvent SpSSemCreate(unsigned int ivalue); ECB NULL ECB HEvent sem; //Event handle main() SpSInit(); sem = SpSSemCreate(0); //Create semaphore SpSStart(); //Start kernel 1032 int SpSSemPend(HEvent hevent, unsigned int itimeout); 0 SpSTaskSuspend() SpSTaskResume() hevent itimeout TICK OS_NO_ERR OS_PEVENT_NULL OS_ECB_TYYPE_ERR Sunplus University Program unsp@sunpluscomcn 56

57 OS_IN_ISR OS_TIME_OUT HEvent sem1; //Event handle void TaskN() while (1) SpSSemPend (sem1, 0); //Waiting semaphore 1033 int SpSSemPost(HEvent hevent); 0 1 SpSSemPost OS_NO_ERR OS_ECB_TYPE_ERR OS_PEVENT_NULL HEvent sem; /* Event handle */ void TaskN() while(1) SpSSemPost(sem); /* Realease semaphore */ 1034 int SpSSemAccept(HEvent hevent); SpSSemPend Sunplus University Program unsp@sunpluscomcn 57

58 0 1 0 HEvent sem; //Event handle void TaskN() int value; while(1) value = SpSSemAccept(sem); //reading semaphore if (value>0) 1035 HEvent SpSMboxCreate(void* pmail); ( ) pmail ECB NULL HEvent mailbox; //Event handle main() SpSInit(); mailbox = SpSMboxCreate((void*)0); //Create mailbox SpSStart(); //Start OS kernel Sunplus University Program unsp@sunpluscomcn 58

59 1036 void* SpSMboxPend(HEvent hevent, unsigned int itimeout, int* err); SpSMboxPend SpSMboxPend SpSTaskSuspend SpSTaskResume hevent itimeout tick err OS_TIME_OUT 0 err Err OS_NO_ERR OS_PEVENT_NULL OS_ECB_TYPE_ERR ECB OS_IN_ISR OS_TIME_OUT err OS_NO_ERR NULL err SpSTaskSuspend HEvent mailbox; /* Event handle */ void TaskN() int * pmsg; int err; while(1) pmsg = SpSMboxPend(mailbox, 0, &err); /* Waiting mail */ if (err == OS_NO_ERR) 1037 int SpSMboxPost(HEvent hevent, void* pmail); OS_MBOX_FULL Sunplus University Program unsp@sunpluscomcn 59

60 hevent pmail OS_NO_ERR OS_PEVENT_NULL OS_ECB_TYPE_ERR OS_MBOX_FULL pmail HEvent mailbox; /* Event handle */ void TaskN() int err, msg = 0; while(1) err = SpSMboxPost(mailbox, &msg); /* Waiting mail */ 1038 void* SpSMboxAccept(HEvent hevent); SpSMboxPend () NULL NULL HEvent mailbox; /* Event handle */ void TaskN() void *msg; while(1) msg = SpSMboxAccept (mailbox); /* Waiting mail */ if (msg!= (void *)0) Sunplus University Program unsp@sunpluscomcn 60

61 else 1039 HEvent SpSQCreate(void* pstart, unsigned int isize); ISR pstart isize ECB NULL ECB QCB HEvent queue; /* Event handle */ int *Q[5]; /* Message queue array */ void main(void) SpSInit(); queue = SpSQCreate((void*)Q,5); /* Create Message queue */ SpSStart(); /* Start Os kernel */ void* SpSQPend(HEvent hevent, unsigned int itimeout, int* err); SpSQPend SpSTaskSuspend SpSTaskResume hevent itimeout err OS_TIME_OUT 0 err OS_NO_ERR Sunplus University Program unsp@sunpluscomcn 61

62 OS_TIME_OUT OS_ECB_TYPE_ERR OS_IN_ISR OS_PEVENT_NULL err OS_NO_ERR err int err; //Error No HEvent queue1; //Event handle void TaskN() unsigned int *pmsg; while(1) pmsg = SpSQPend (queue1, 0, &err); //waiting queue int SpSQPost(HEvent hevent, void* pmsg); (FIFO) hevent pmsg OS_NO_ERR OS_QUEUE_FULL OS_ECB_TYPE_ERR OS_PEVENT_NULL HEvent queue; //Event handle int msg[5]; Sunplus University Program unsp@sunpluscomcn 62

63 void TaskN() while(1) SpSQPost(queue, &msg[0]); //insert queue int SpSQPostFront(HEvent hevent, void* pmsg); SpSQPost (LIFO) SpSQPost hevent pmsg OS_NO_ERR OS_QUEUE_FULL OS_ECB_TYPE_ERR OS_PEVENT_NULL HEvent queue; //Event handle int msg[5]; void TaskN() while(1) SpSQPostFront (queue, &msg[0]); //insert queue void* SpSQAccept(HEvent hevent); SpSQPend Pend NULL Sunplus University Program 63

64 NULL HEvent queue; /* Event handle */ void TaskN() void *msg; while(1) msg = SpSQAccept (queue); /* check queue for a message */ if (msg!= (void *)0) /* message received, process */ else /* message not received */ void SpSSetVector(int Vector_No, void (*pisr)()); Vector_NO ( SposCE061Ah pisr OS_NO_ERR OS_NO_IFT Void TaskN() void func1(); SpSSetVector(FIQ_TMA_VEC, func1); void func1() Sunplus University Program unsp@sunpluscomcn 64

65 1042 void SpFAddINTVec(unsigned long ulvector); bit 1 Void TaskN() void func1(); SpSSetVector(FIQ_TMA_VEC, func1); SpFAddINTVec(FIQ_TMA_EN); 1043 void SpFDelINTVec(unsigned long ulvector); Void TaskN() for(; ; ) SpFDelINTVec(FIQ_TMA_EN); 1044 unsigned long SpFGetINTVec(void); Void TaskN() unsigned long ulintvector; Sunplus University Program unsp@sunpluscomcn 65

66 ulintvector = SpFGetINTVec(); HMem SpSMemCreate(void* pstart, unsigned int iblock, unsigned int isize, int *err); pstart iblock isize err: OS_NO_ERR OS_MEM_INV_ADDR OS_MEM_INV_BLKS OS_MEM_INV_SIZE OS_MEM_NOMCB NULL int MemPart[6][8]; //Partition HMem pmem; //Memory control block data structure pointer void main(void) unsigned int err; SpSInit(); pmem = SpSMemCreate(MemPart,6,8,&err); //Create memory control block SpSStart(); 1052 void* SpSMemGet(HMem hmem); hmem, NULL Sunplus University Program unsp@sunpluscomcn 66

67 HMem pmem; //Memory control block data structure pointer void Task(void) int *a; for (; ;) a=(int*)spsmemget(pmem); //Obtaining a memory block 1053 void* SpSMemGetWait(HMem hmem, unsigned int itimeout, int *err); hmem itimeout err OS_NO_ERR OS_MEM_HANDLE_NULL OS_IN_ISR OS_TIME_OUT NULL HMem pmem; //Memory control block data structure pointer void Task(void) int *a; for (; ;) a= (int*)spsmemgetwait(pmem, 0, &err); //Obtaining a memory block if(a) *a = 1; 1054 int SpSMemPut(HMem hmem, void* pblk); Sunplus University Program unsp@sunpluscomcn 67

68 hmem pblk OS_NO_ERR OS_MEM_HANDLE_NULL OS_MEM_PBLK_NULL ; HMem pmem; /* Memory control block data structure pointer */ int * a; void Task(void) for (; ;) SpSMemPut(pmem, (void*)a); /* memory block released */ int SpSGetPri(); Void TaskN(void) int pid; for (; ;) pid = SpSGetPri(); /* get priority */ 1062 int SpSVersion(); OS Sunplus University Program unsp@sunpluscomcn 68

69 Void TaskN(void) int os_version; for (; ;) os_version = SpSVersion(); /* obtain MiniOS version */ Sunplus University Program unsp@sunpluscomcn 69

70 11 ROM 2735 RAM 85 CODE TEXT IRAM RAM SpSInit SpSStart SpSTimeTick SpSsetVector kern_sched SpSTaskCreate SpSTimeDly SpSIdle SpSSchedLock SpSSchedUnLock SpSTimeDlyResume SpSGetPri SpSTaskDel SpSTaskExit SpSTaskSuspend SpSTaskResume SpSSemPost SpSSemPend SpSSemCreate SpSSemAccept SpSMboxPost SpSMboxPend SpSMboxCreate SpSMboxAccept SpSQPost SpSQPend SpSQCreate SpSQPostFront SpSQAccept Sunplus University Program unsp@sunpluscomcn 70

71 SpSMemCreate SpSMemGet SpSMemGetWait SpSMemPut var SpFAddINTVec SpFSetINTStatus SpFGetINTVec SpFDelINTVec kern_break kern_fiq kern_irq kern_irq kern_irq kern_irq kern_irq kern_irq kern_irq kern_irq kern_intentry SpSversion SpSEnableIN ROM ( OS API) 2735 word RAM 128Hz 24 word 85 word RAM 1 4 word 2 3 word 3 5 word 4 3 word 5 3 word sposconfigh MHz M 1237 Sunplus University Program unsp@sunpluscomcn 71

, 7, Windows,,,, : ,,,, ;,, ( CIP) /,,. : ;, ( 21 ) ISBN : -. TP CIP ( 2005) 1

, 7, Windows,,,, : ,,,, ;,, ( CIP) /,,. : ;, ( 21 ) ISBN : -. TP CIP ( 2005) 1 21 , 7, Windows,,,, : 010-62782989 13501256678 13801310933,,,, ;,, ( CIP) /,,. : ;, 2005. 11 ( 21 ) ISBN 7-81082 - 634-4... - : -. TP316-44 CIP ( 2005) 123583 : : : : 100084 : 010-62776969 : 100044 : 010-51686414

More information

CC213

CC213 : (Ken-Yi Lee), E-mail: feis.tw@gmail.com 49 [P.51] C/C++ [P.52] [P.53] [P.55] (int) [P.57] (float/double) [P.58] printf scanf [P.59] [P.61] ( / ) [P.62] (char) [P.65] : +-*/% [P.67] : = [P.68] : ,

More information

Important Notice SUNPLUS TECHNOLOGY CO. reserves the right to change this documentation without prior notice. Information provided by SUNPLUS TECHNOLO

Important Notice SUNPLUS TECHNOLOGY CO. reserves the right to change this documentation without prior notice. Information provided by SUNPLUS TECHNOLO Car DVD New GUI IR Flow User Manual V0.1 Jan 25, 2008 19, Innovation First Road Science Park Hsin-Chu Taiwan 300 R.O.C. Tel: 886-3-578-6005 Fax: 886-3-578-4418 Web: www.sunplus.com Important Notice SUNPLUS

More information

Bus Hound 5

Bus Hound 5 Bus Hound 5.0 ( 1.0) 21IC 2007 7 BusHound perisoft PC hound Bus Hound 6.0 5.0 5.0 Bus Hound, IDE SCSI USB 1394 DVD Windows9X,WindowsMe,NT4.0,2000,2003,XP XP IRP Html ZIP SCSI sense USB Bus Hound 1 Bus

More information

1... 4 2... 5 2.1... 5 2.2... 5 2.3... 6 2.4... 6 2.5... 7 2.6... 7 3 2005... 8 3.1... 8 3.2... 9 3.3... 9 3.4 ( RMB100,000)... 9 3.5... 9 4...11 4.1.

1... 4 2... 5 2.1... 5 2.2... 5 2.3... 6 2.4... 6 2.5... 7 2.6... 7 3 2005... 8 3.1... 8 3.2... 9 3.3... 9 3.4 ( RMB100,000)... 9 3.5... 9 4...11 4.1. http://www.unsp.com.cn 1... 4 2... 5 2.1... 5 2.2... 5 2.3... 6 2.4... 6 2.5... 7 2.6... 7 3 2005... 8 3.1... 8 3.2... 9 3.3... 9 3.4 ( RMB100,000)... 9 3.5... 9 4...11 4.1... 11 4.2... 12 5... 13 5.1...

More information

int *p int a 0x00C7 0x00C7 0x00C int I[2], *pi = &I[0]; pi++; char C[2], *pc = &C[0]; pc++; float F[2], *pf = &F[0]; pf++;

int *p int a 0x00C7 0x00C7 0x00C int I[2], *pi = &I[0]; pi++; char C[2], *pc = &C[0]; pc++; float F[2], *pf = &F[0]; pf++; Memory & Pointer trio@seu.edu.cn 2.1 2.1.1 1 int *p int a 0x00C7 0x00C7 0x00C7 2.1.2 2 int I[2], *pi = &I[0]; pi++; char C[2], *pc = &C[0]; pc++; float F[2], *pf = &F[0]; pf++; 2.1.3 1. 2. 3. 3 int A,

More information

Windows RTEMS 1 Danilliu MMI TCP/IP QEMU i386 QEMU ARM POWERPC i386 IPC PC104 uc/os-ii uc/os MMI TCP/IP i386 PORT Linux ecos Linux ecos ecos eco

Windows RTEMS 1 Danilliu MMI TCP/IP QEMU i386 QEMU ARM POWERPC i386 IPC PC104 uc/os-ii uc/os MMI TCP/IP i386 PORT Linux ecos Linux ecos ecos eco Windows RTEMS 1 Danilliu MMI TCP/IP 80486 QEMU i386 QEMU ARM POWERPC i386 IPC PC104 uc/os-ii uc/os MMI TCP/IP i386 PORT Linux ecos Linux ecos ecos ecos Email www.rtems.com RTEMS ecos RTEMS RTEMS Windows

More information

AN INTRODUCTION TO PHYSICAL COMPUTING USING ARDUINO, GRASSHOPPER, AND FIREFLY (CHINESE EDITION ) INTERACTIVE PROTOTYPING

AN INTRODUCTION TO PHYSICAL COMPUTING USING ARDUINO, GRASSHOPPER, AND FIREFLY (CHINESE EDITION ) INTERACTIVE PROTOTYPING AN INTRODUCTION TO PHYSICAL COMPUTING USING ARDUINO, GRASSHOPPER, AND FIREFLY (CHINESE EDITION ) INTERACTIVE PROTOTYPING 前言 - Andrew Payne 目录 1 2 Firefly Basics 3 COMPONENT TOOLBOX 目录 4 RESOURCES 致谢

More information

bingdian001.com

bingdian001.com TSM12M TSM12 STM8L152C6, STM8L152R8 MSP430F5325 whym1987@126.com! /******************************************************************************* * : TSM12.c * : * : 2013/10/21 * : TSM12, STM8L f(sysclk)

More information

C/C++ - 函数

C/C++ - 函数 C/C++ Table of contents 1. 2. 3. & 4. 5. 1 2 3 # include # define SIZE 50 int main ( void ) { float list [ SIZE ]; readlist (list, SIZE ); sort (list, SIZE ); average (list, SIZE ); bargragh

More information

C语言的应用.PDF

C语言的应用.PDF AVR C 9 1 AVR C IAR C, *.HEX, C,,! C, > 9.1 AVR C MCU,, AVR?! IAR AVR / IAR 32 ALU 1KBytes - 8MBytes (SPM ) 16 MBytes C C *var1, *var2; *var1++ = *--var2; AVR C 9 2 LD R16,-X ST Z+,R16 Auto (local

More information

Microsoft PowerPoint - os_4.ppt

Microsoft PowerPoint - os_4.ppt 行 程 資 科 系 林 偉 川 行 程 概 念 行 程 與 程 式 主 要 的 不 同 點 : 程 式 是 被 放 在 外 部 的 儲 存 裝 置 如 磁 碟 上, 而 行 程 則 被 放 在 記 憶 體 中 程 式 在 儲 存 裝 置 中 是 靜 態 的, 而 行 程 在 記 憶 體 中 是 動 態 的, 它 會 隨 著 一 些 事 件 的 發 生 而 產 生 相 對 的 改 變 行 程, 就 是

More information

提纲 1 2 OS Examples for 3

提纲 1 2 OS Examples for 3 第 4 章 Threads2( 线程 2) 中国科学技术大学计算机学院 October 28, 2009 提纲 1 2 OS Examples for 3 Outline 1 2 OS Examples for 3 Windows XP Threads I An Windows XP application runs as a seperate process, and each process may

More information

untitled

untitled 3 C++ 3.1 3.2 3.3 3.4 new delete 3.5 this 3.6 3.7 3.1 3.1 class struct union struct union C class C++ C++ 3.1 3.1 #include struct STRING { typedef char *CHARPTR; // CHARPTR s; // int strlen(

More information

穨control.PDF

穨control.PDF TCP congestion control yhmiu Outline Congestion control algorithms Purpose of RFC2581 Purpose of RFC2582 TCP SS-DR 1998 TCP Extensions RFC1072 1988 SACK RFC2018 1996 FACK 1996 Rate-Halving 1997 OldTahoe

More information

(Load Project) (Save Project) (OffLine Mode) (Help) Intel Hex Motor

(Load Project) (Save Project) (OffLine Mode) (Help) Intel Hex Motor 1 4.1.1.1 (Load) 14 1.1 1 4.1.1.2 (Save) 14 1.1.1 1 4.1.2 (Buffer) 16 1.1.2 1 4.1.3 (Device) 16 1.1.3 1 4.1.3.1 (Select Device) 16 2 4.1.3.2 (Device Info) 16 2.1 2 4.1.3.3 (Adapter) 17 2.1.1 CD-ROM 2 4.1.4

More information

Fun Time (1) What happens in memory? 1 i n t i ; 2 s h o r t j ; 3 double k ; 4 char c = a ; 5 i = 3; j = 2; 6 k = i j ; H.-T. Lin (NTU CSIE) Referenc

Fun Time (1) What happens in memory? 1 i n t i ; 2 s h o r t j ; 3 double k ; 4 char c = a ; 5 i = 3; j = 2; 6 k = i j ; H.-T. Lin (NTU CSIE) Referenc References (Section 5.2) Hsuan-Tien Lin Deptartment of CSIE, NTU OOP Class, March 15-16, 2010 H.-T. Lin (NTU CSIE) References OOP 03/15-16/2010 0 / 22 Fun Time (1) What happens in memory? 1 i n t i ; 2

More information

C/C++ - 文件IO

C/C++ - 文件IO C/C++ IO Table of contents 1. 2. 3. 4. 1 C ASCII ASCII ASCII 2 10000 00100111 00010000 31H, 30H, 30H, 30H, 30H 1, 0, 0, 0, 0 ASCII 3 4 5 UNIX ANSI C 5 FILE FILE 6 stdio.h typedef struct { int level ;

More information

P4i45GL_GV-R50-CN.p65

P4i45GL_GV-R50-CN.p65 1 Main Advanced Security Power Boot Exit System Date System Time Floppy Drives IDE Devices BIOS Version Processor Type Processor Speed Cache Size Microcode Update Total Memory DDR1 DDR2 Dec 18 2003 Thu

More information

目 录

目 录 1 Quick51...1 1.1 SmartSOPC Quick51...1 1.2 Quick51...1 1.3 Quick51...2 2 Keil C51 Quick51...4 2.1 Keil C51...4 2.2 Keil C51...4 2.3 1 Keil C51...4 2.4 Flash Magic...9 2.5 ISP...9 2.6...10 2.7 Keil C51...12

More information

a b c d e f g C2 C1 2

a b c d e f g C2 C1 2 a b c d e f g C2 C1 2 IN1 IN2 0 2 to 1 Mux 1 IN1 IN2 0 2 to 1 Mux 1 Sel= 0 M0 High C2 C1 Sel= 1 M0 Low C2 C1 1 to 2 decoder M1 Low 1 to 2 decoder M1 High 3 BCD 1Hz clk 64Hz BCD 4 4 0 1 2 to 1 Mux sel 4

More information

6 C51 ANSI C Turbo C C51 Turbo C C51 C51 C51 C51 C51 C51 C51 C51 C C C51 C51 ANSI C MCS-51 C51 ANSI C C C51 bit Byte bit sbit

6 C51 ANSI C Turbo C C51 Turbo C C51 C51 C51 C51 C51 C51 C51 C51 C C C51 C51 ANSI C MCS-51 C51 ANSI C C C51 bit Byte bit sbit 6 C51 ANSI C Turbo C C51 Turbo C C51 C51 C51 C51 C51 C51 C51 C51 C51 6.1 C51 6.1.1 C51 C51 ANSI C MCS-51 C51 ANSI C C51 6.1 6.1 C51 bit Byte bit sbit 1 0 1 unsigned char 8 1 0 255 Signed char 8 11 128

More information

目录

目录 ALTERA_CPLD... 3 11SY_03091... 3 12SY_03091...4....5 21 5 22...8 23..10 24..12 25..13..17 3 1EPM7128SLC.......17 3 2EPM7032SLC.......18 33HT46R47......19..20 41..20 42. 43..26..27 5151DEMO I/O...27 52A/D89C51...28

More information

els0xu_zh_nf_v8.book Page Wednesday, June, 009 9:5 AM ELS-0/0C.8

els0xu_zh_nf_v8.book Page Wednesday, June, 009 9:5 AM ELS-0/0C.8 els0xu_zh_nf_v8.book Page Wednesday, June, 009 9:5 AM ELS-0/0C.8 Yamaha ELS-0/0C..8 LCD ELS-0/0C v. typeu LCD ELS-0/0C typeu / -6 / [SEARCH] / - ZH ELS-0/0C.8 els0xu_zh_nf_v8.book Page Wednesday, June,

More information

C PICC C++ C++ C C #include<pic.h> C static volatile unsigned char 0x01; static volatile unsigned char 0x02; static volatile unsigned cha

C PICC C++ C++ C C #include<pic.h> C static volatile unsigned char 0x01; static volatile unsigned char 0x02; static volatile unsigned cha CYPOK CYPOK 1 UltraEdit Project-->Install Language Tool: Language Suite----->hi-tech picc Tool Name ---->PICC Compiler Executable ---->c:hi-picinpicc.exe ( Command-line Project-->New Project-->File Name--->myc

More information

錄...1 說...2 說 說...5 六 率 POST PAY PREPAY DEPOSIT 更

錄...1 說...2 說 說...5 六 率 POST PAY PREPAY DEPOSIT 更 AX5000 Version 1.0 2006 年 9 錄...1 說...2 說...3...4 說...5 六...6 6.1 率...7 6.2 POST PAY...8 6.3 PREPAY DEPOSIT...9 6.4...10 6.5...11 更...12...12 LCD IC LED Flash 更 兩 RJ11 ( ) DC ON OFF ON 狀 狀 更 OFF 復 狀 說

More information

C/C++ - 字符输入输出和字符确认

C/C++ - 字符输入输出和字符确认 C/C++ Table of contents 1. 2. getchar() putchar() 3. (Buffer) 4. 5. 6. 7. 8. 1 2 3 1 // pseudo code 2 read a character 3 while there is more input 4 increment character count 5 if a line has been read,

More information

untitled

untitled A, 3+A printf( ABCDEF ) 3+ printf( ABCDEF ) 2.1 C++ main main main) * ( ) ( ) [ ].* ->* ()[] [][] ** *& char (f)(int); ( ) (f) (f) f (int) f int char f char f(int) (f) char (*f)(int); (*f) (int) (

More information

FY.DOC

FY.DOC 高 职 高 专 21 世 纪 规 划 教 材 C++ 程 序 设 计 邓 振 杰 主 编 贾 振 华 孟 庆 敏 副 主 编 人 民 邮 电 出 版 社 内 容 提 要 本 书 系 统 地 介 绍 C++ 语 言 的 基 本 概 念 基 本 语 法 和 编 程 方 法, 深 入 浅 出 地 讲 述 C++ 语 言 面 向 对 象 的 重 要 特 征 : 类 和 对 象 抽 象 封 装 继 承 等 主

More information

PTS7_Manual.PDF

PTS7_Manual.PDF User Manual Soliton Technologies CO., LTD www.soliton.com.tw - PCI V2.2. - PCI 32-bit / 33MHz * 2 - Zero Skew CLK Signal Generator. - (each Slot). -. - PCI. - Hot-Swap - DOS, Windows 98/2000/XP, Linux

More information

PIC16F F MPLAB 08 16F LED 15 LED

PIC16F F MPLAB 08 16F LED 15 LED PIC16F877 PIC16F877 03 16F877 05 06 MPLAB 08 16F877 13 LED 15 LED 17 20 24 2 PIC16F877 PIC16F877 DIP VDD VSS CLOCK CPU :,AND,OR,XOR ROM: CPU ROM RAM: CPU,CPU I/O:CPU, CPU,, 16F877 RAM 512 128 Bank Bank

More information

ebook14-4

ebook14-4 4 TINY LL(1) First F o l l o w t o p - d o w n 3 3. 3 backtracking parser predictive parser recursive-descent parsing L L ( 1 ) LL(1) parsing L L ( 1 ) L L ( 1 ) 1 L 2 L 1 L L ( k ) k L L ( 1 ) F i r s

More information

1.ai

1.ai HDMI camera ARTRAY CO,. LTD Introduction Thank you for purchasing the ARTCAM HDMI camera series. This manual shows the direction how to use the viewer software. Please refer other instructions or contact

More information

untitled

untitled Lwip Swedish Institute of Computer Science February 20, 2001 Adam Dunkels adam@sics.se (QQ: 10205001) (QQ: 329147) (QQ:3232253) (QQ:3232253) QQ ARM TCPIP LCD10988210 LWIP TCP/IP LWIP LWIP lwip API lwip

More information

1.1 ML_ONOFF = 1 Q 3 Q 8 C 0.3V M 2 L 1 ML_ONOFF = 0 Q 3 Q 8 C 1. + R31 VCC R21 10K ML_ONOFF R15 0:off 1:on 1K Green Light VCC=5V L1 Q VDD=12V C

1.1 ML_ONOFF = 1 Q 3 Q 8 C 0.3V M 2 L 1 ML_ONOFF = 0 Q 3 Q 8 C 1. + R31 VCC R21 10K ML_ONOFF R15 0:off 1:on 1K Green Light VCC=5V L1 Q VDD=12V C AUTOMATIC TROLLEY H K Hwang K K Chen J-S Lin S-C Wang M-L Li C-C Lin W-B Lin Dept. Of Electrical Engineering Far East College ABSTRACT This paper proposes an automatic trolley which can move automatically

More information

AL-M200 Series

AL-M200 Series NPD4754-00 TC ( ) Windows 7 1. [Start ( )] [Control Panel ()] [Network and Internet ( )] 2. [Network and Sharing Center ( )] 3. [Change adapter settings ( )] 4. 3 Windows XP 1. [Start ( )] [Control Panel

More information

新版 明解C言語入門編

新版 明解C言語入門編 328, 4, 110, 189, 103, 11... 318. 274 6 ; 10 ; 5? 48 & & 228! 61!= 42 ^= 66 _ 82 /= 66 /* 3 / 19 ~ 164 OR 53 OR 164 = 66 ( ) 115 ( ) 31 ^ OR 164 [] 89, 241 [] 324 + + 4, 19, 241 + + 22 ++ 67 ++ 73 += 66

More information

uc/os 1

uc/os 1 uc/os 1 uc/os-ii Source Code ANSI C, uc/os-ii 8/16/32 bits microprocessor Preemptive real-time Task 64 Stack Size ROMable (C compiler, assembler and linker/locator) uc/os-ii Mailboxes, Queues, Semaphores,

More information

1 Project New Project 1 2 Windows 1 3 N C test Windows uv2 KEIL uvision2 1 2 New Project Ateml AT89C AT89C51 3 KEIL Demo C C File

1 Project New Project 1 2 Windows 1 3 N C test Windows uv2 KEIL uvision2 1 2 New Project Ateml AT89C AT89C51 3 KEIL Demo C C File 51 C 51 51 C C C C C C * 2003-3-30 pnzwzw@163.com C C C C KEIL uvision2 MCS51 PLM C VC++ 51 KEIL51 KEIL51 KEIL51 KEIL 2K DEMO C KEIL KEIL51 P 1 1 1 1-1 - 1 Project New Project 1 2 Windows 1 3 N C test

More information

Microsoft Word - 11.doc

Microsoft Word - 11.doc 除 錯 技 巧 您 將 於 本 章 學 到 以 下 各 項 : 如 何 在 Visual C++ 2010 的 除 錯 工 具 控 制 下 執 行 程 式? 如 何 逐 步 地 執 行 程 式 的 敘 述? 如 何 監 看 或 改 變 程 式 中 的 變 數 值? 如 何 監 看 程 式 中 計 算 式 的 值? 何 謂 Call Stack? 何 謂 診 斷 器 (assertion)? 如 何

More information

JLX

JLX PRODUCT:LCD MODULE. Model No.: JLX177-006 Product Type: 1.77 inch QVGA TFT Modoule. 产品规格书 晶联讯研发研发部 : Written By Checked By Approved By 客户名称 : 结构电子核准 地址 : 深圳市宝安区西乡宝安大道东华工业区 A3 栋 6 楼电话 :0755-29784961 Http://www.jlxlcd.cn

More information

Abstract arm linux tool-chain root NET-Start! 2

Abstract arm linux tool-chain root NET-Start! 2 Lab III - Embedding Linux 1 Abstract arm linux tool-chain root NET-Start! 2 Part 1.4 Step1. tool-chain 4 Step2. PATH 4 Part 2 kernel 5 Step1. 5 Step2... 6 Step3...8 Part 3 root. 8 Step1. 8 Step2. 8 Part

More information

Microsoft Word - MSP430 Launchpad 指导书.docx

Microsoft Word - MSP430 Launchpad 指导书.docx Contents 3... 9... 14 MSP430 LAUNCHPAD 指导书 3 第一部分第一个工程 New Project File > New > CCS Project Project name: ButtonLED Device>Family: MSP430 Variant: MSP430G2553 Project templates and examples : Empty Project

More information

CA-C750К

CA-C750К 1 3 3 4 PC 4 USB 5 5 6 8 9 11 mediasync Manager?...13 mediasync Manager 15 25 38 39 41 41 DRM...44 Image Manager...44 47 49 49 50 50 51 51 51 52 / 52 A-B 53 MP3 53 /FM 54 FM 55 FM 55 BMP56 56 57 57 58

More information

Microsoft PowerPoint - STU_EC_Ch08.ppt

Microsoft PowerPoint - STU_EC_Ch08.ppt 樹德科技大學資訊工程系 Chapter 8: Counters Shi-Huang Chen Fall 2010 1 Outline Asynchronous Counter Operation Synchronous Counter Operation Up/Down Synchronous Counters Design of Synchronous Counters Cascaded Counters

More information

1 CPU

1 CPU 2000 Tel 82316285 82317634 Mail liuxd@buaa.edu.cn 1 CPU 2 CPU 7 72 A B 85 15 3 1/2 M301 2~17 : 3/4 1/2 323 IBM PC 1. 2. 3. 1. 2. 3. 1.1 Hardware Software 1.2 M3 M2 M1 1.2 M3 M1 M2 M2 M1 M1 M1 1.2 M3 M1

More information

新・解きながら学ぶC言語

新・解きながら学ぶC言語 330!... 67!=... 42 "... 215 " "... 6, 77, 222 #define... 114, 194 #include... 145 %... 21 %... 21 %%... 21 %f... 26 %ld... 162 %lf... 26 %lu... 162 %o... 180 %p... 248 %s... 223, 224 %u... 162 %x... 180

More information

Application Note Format

Application Note Format USB 說 2 - AD PWM Office: 6F, No. 12, Innovation 1st. RD., Science-Based Industrial Park, Hsin-Chu City, Taiwan, R.O.C Tel: +886-3-6661766 ext.1672 Fax: +886-3-6661765 Etoms Electronics Corp. Publication

More information

Go构建日请求千亿微服务最佳实践的副本

Go构建日请求千亿微服务最佳实践的副本 Go 构建 请求千亿级微服务实践 项超 100+ 700 万 3000 亿 Goroutine & Channel Goroutine Channel Goroutine func gen() chan int { out := make(chan int) go func(){ for i:=0; i

More information

51 C 51 isp 10 C PCB C C C C KEIL

51 C 51 isp 10   C   PCB C C C C KEIL http://wwwispdowncom 51 C " + + " 51 AT89S51 In-System-Programming ISP 10 io 244 CPLD ATMEL PIC CPLD/FPGA ARM9 ISP http://wwwispdowncom/showoneproductasp?productid=15 51 C C C C C ispdown http://wwwispdowncom

More information

概述

概述 OPC Version 1.6 build 0910 KOSRDK Knight OPC Server Rapid Development Toolkits Knight Workgroup, eehoo Technology 2002-9 OPC 1...4 2 API...5 2.1...5 2.2...5 2.2.1 KOS_Init...5 2.2.2 KOS_InitB...5 2.2.3

More information

User ID 150 Password - User ID 150 Password Mon- Cam-- Invalid Terminal Mode No User Terminal Mode No User Mon- Cam-- 2

User ID 150 Password - User ID 150 Password Mon- Cam-- Invalid Terminal Mode No User Terminal Mode No User Mon- Cam-- 2 Terminal Mode No User User ID 150 Password - User ID 150 Password Mon- Cam-- Invalid Terminal Mode No User Terminal Mode No User Mon- Cam-- 2 Mon1 Cam-- Mon- Cam-- Prohibited M04 Mon1 Cam03 Mon1 Cam03

More information

C++ 程式設計

C++ 程式設計 C C 料, 數, - 列 串 理 列 main 數串列 什 pointer) 數, 數, 數 數 省 不 不, 數 (1) 數, 不 數 * 料 * 數 int *int_ptr; char *ch_ptr; float *float_ptr; double *double_ptr; 數 (2) int i=3; int *ptr; ptr=&i; 1000 1012 ptr 數, 數 1004

More information

ICD ICD ICD ICD ICD

ICD ICD ICD ICD ICD MPLAB ICD2 MPLAB ICD2 PIC MPLAB-IDE V6.0 ICD2 usb PC RS232 MPLAB IDE PC PC 2.0 5.5V LED EEDATA MPLAB ICD2 Microchip MPLAB-IDE v6.0 Windows 95/98 Windows NT Windows 2000 www.elc-mcu.com 1 ICD2...4 1.1 ICD2...4

More information

SA-DK2-U3Rユーザーズマニュアル

SA-DK2-U3Rユーザーズマニュアル USB3.0 SA-DK2-U3R 2007.0 2 3 4 5 6 7 8 System Info. Manual Rebuild Delete RAID RAID Alarm Rebuild Rate Auto compare Temp Management Load Default Elapse time Event Log 0 2 3 4 2 3 4 ESC 5

More information

新版 明解C++入門編

新版 明解C++入門編 511!... 43, 85!=... 42 "... 118 " "... 337 " "... 8, 290 #... 71 #... 413 #define... 128, 236, 413 #endif... 412 #ifndef... 412 #if... 412 #include... 6, 337 #undef... 413 %... 23, 27 %=... 97 &... 243,

More information

PIC_SERVER (11) SMTP ( ) ( ) PIC_SERVER (10) SMTP PIC_SERVER (event driven) PIC_SERVER SMTP 1. E-

PIC_SERVER (11) SMTP  ( ) ( ) PIC_SERVER (10) SMTP  PIC_SERVER (event driven)  PIC_SERVER SMTP  1.  E- (2005-02-01) (2005-04-28) PIC_SERVER (10) SMTP E-mail PIC_SERVER (event driven) E-mail PIC_SERVER SMTP E-mail 1. E-mail E-mail 1 (1) (2) (3) (4) 1 1. 2 E-mail A E-mail B E-mail SMTP(Simple Mail Transfer

More information

ch08.PDF

ch08.PDF 8-1 CCNA 8.1 CLI 8.1.1 8-2 8-3 8.1.21600 2500 1600 2500 / IOS 8-4 8.2 8.2.1 A 5 IP CLI 1600 2500 8-5 8.1.2-15 Windows 9598NT 2000 HyperTerminal Hilgraeve Microsoft Cisco HyperTerminal Private Edition (PE)

More information

Serial ATA ( Silicon Image SiI3114)...2 (1) SATA... 2 (2) B I O S S A T A... 3 (3) RAID BIOS RAID... 5 (4) S A T A... 8 (5) S A T A... 10

Serial ATA ( Silicon Image SiI3114)...2 (1) SATA... 2 (2) B I O S S A T A... 3 (3) RAID BIOS RAID... 5 (4) S A T A... 8 (5) S A T A... 10 Serial ATA ( Silicon Image SiI3114)...2 (1) SATA... 2 (2) B I O S S A T A... 3 (3) RAID BIOS RAID... 5 (4) S A T A... 8 (5) S A T A... 10 Ác Åé å Serial ATA ( Silicon Image SiI3114) S A T A (1) SATA (2)

More information

2/80 2

2/80 2 2/80 2 3/80 3 DSP2400 is a high performance Digital Signal Processor (DSP) designed and developed by author s laboratory. It is designed for multimedia and wireless application. To develop application

More information

新・明解C言語入門編『索引』

新・明解C言語入門編『索引』 !... 75!=... 48 "... 234 " "... 9, 84, 240 #define... 118, 213 #include... 148 %... 23 %... 23, 24 %%... 23 %d... 4 %f... 29 %ld... 177 %lf... 31 %lu... 177 %o... 196 %p... 262 %s... 242, 244 %u... 177

More information

(Microsoft Word - Motion Program \270\305\264\272\276\363 \307\245\301\366 \271\327 \270\361\302\367.doc)

(Microsoft Word - Motion Program \270\305\264\272\276\363 \307\245\301\366 \271\327 \270\361\302\367.doc) : TBFAT-G5MP-MN004-11 1 GX Series PLC Program Manual 2 GX Series PLC Program Manual Contents Contents...3 1... 1-1 1.1... 1-2 1.2... 1-3 1.2.1... 1-3 1.2.2... 1-4 1.2.3... 1-4 1.2.4... 1-6 1.3... 1-7 1.3.1...

More information

2 2 3 DLight CPU I/O DLight Oracle Solaris (DTrace) C/C++ Solaris DLight DTrace DLight DLight DLight C C++ Fortran CPU I/O DLight AM

2 2 3 DLight CPU I/O DLight Oracle Solaris (DTrace) C/C++ Solaris DLight DTrace DLight DLight DLight C C++ Fortran CPU I/O DLight AM Oracle Solaris Studio 12.2 DLight 2010 9 2 2 3 DLight 3 3 6 13 CPU 16 18 21 I/O DLight Oracle Solaris (DTrace) C/C++ Solaris DLight DTrace DLight DLight DLight C C++ Fortran CPU I/O DLight AMP Apache MySQL

More information

Microsoft Word - InoTouch Editor编程软件手册2012.2.10.doc

Microsoft Word - InoTouch Editor编程软件手册2012.2.10.doc 目 录 第 一 章 关 于 InoTouch Editor 编 程 软 件 的 安 装... - 6-1.1 InoTouch 系 列 HMI 和 InoTouch Editor 软 件 的 简 介... - 6-1.2 安 装 InoTouch Editor 编 程 软 件... - 10-1.3 系 统 连 接 图... - 12-1.4 InoTouch 系 列 人 机 界 面 的 系 统 设

More information

IP505SM_manual_cn.doc

IP505SM_manual_cn.doc IP505SM 1 Introduction 1...4...4...4...5 LAN...5...5...6...6...7 LED...7...7 2...9...9...9 3...11...11...12...12...12...14...18 LAN...19 DHCP...20...21 4 PC...22...22 Windows...22 TCP/IP -...22 TCP/IP

More information

KDC-U5049 KDC-U4049 Made for ipod, and Made for iphone mean that an electronic accessory has been designed to connect specifically to ipod, or iphone,

KDC-U5049 KDC-U4049 Made for ipod, and Made for iphone mean that an electronic accessory has been designed to connect specifically to ipod, or iphone, KDC-U5049 KDC-U4049 Made for ipod, and Made for iphone mean that an electronic accessory has been designed to connect specifically to ipod, or iphone, respectively, and has been certified by the developer

More information

untitled

untitled MODBUS 1 MODBUS...1 1...4 1.1...4 1.2...4 1.3...4 1.4... 2...5 2.1...5 2.2...5 3...6 3.1 OPENSERIAL...6 3.2 CLOSESERIAL...8 3.3 RDMULTIBIT...8 3.4 RDMULTIWORD...9 3.5 WRTONEBIT...11 3.6 WRTONEWORD...12

More information

audiogram3 Owners Manual

audiogram3 Owners Manual USB AUDIO INTERFACE ZH 2 AUDIOGRAM 3 ( ) * Yamaha USB Yamaha USB ( ) ( ) USB Yamaha (5)-10 1/2 AUDIOGRAM 3 3 MIC / INST (XLR ) (IEC60268 ): 1 2 (+) 3 (-) 2 1 3 Yamaha USB Yamaha Yamaha Steinberg Media

More information

Panasonic ( ) : : Microsoft Windows / Pentium / Intel : ( PCC ) PCC Panasonic Communications Co., Ltd

Panasonic ( ) : : Microsoft Windows / Pentium / Intel : ( PCC ) PCC Panasonic Communications Co., Ltd : KX-FLM553CN Panasonic ( ) : : Microsoft Windows / Pentium / Intel : ( PCC ) PCC Panasonic Communications Co., Ltd. 2002 2002 2 B. C. 1. D. 2. 3. 4. E. F. 5. 14. / 6. 15. 7. : 8. 9. 10. : 11. : 12. 13.

More information

untitled

untitled 1-1 1-2 1-3 1-4 1-5 1-6 1-7 1-8 1-1-1 C int main(void){ int x,y,z; int sum=0; double avg=0.0; scanf("%d",&x) ; scanf("%d",&y) ; scanf("%d",&z) ; sum=x+y+z ; avg=sum/3.0; printf("%f\n",avg); system("pause");

More information

CMX多任务执行体

CMX多任务执行体 C M X R T O S 2 0 0 5 5 9 CMX-RTOS CMX (RTOS) CMX C CMX 1 CMX CMX CMX (preemption) CMX ( ) ( ) CMX CPU * Tick* CMX tick CMX CMX RTOS cmx_tick CMX 1.1 CMX CMX CMX-RTOS CMX ( ) CMX CMX ( ) ( CPU ) 1.2 (

More information

Huawei Technologies Co

Huawei Technologies Co Testbench Preliminary itator 1 TESTBENCH... 3 2 TESTBENCH... 3 2.1 Testbench... 3 2.2... 4 2.2.1 HDL... 4 2.2.2... 5 2.2.3 PLI... 5 2.3... 6 2.4... 6 2.4.1... 6 2.4.2... 7 3 TESTBENCH... 9 3.1 2-4... 9

More information

ebook

ebook 3 3 3.1 3.1.1 ( ) 90 3 1966 B e r n s t e i n P ( i ) R ( i ) W ( i P ( i P ( j ) 1) R( i) W( j)=φ 2) W( i) R( j)=φ 3) W( i) W( j)=φ 3.1.2 ( p r o c e s s ) 91 Wi n d o w s Process Control Bl o c k P C

More information

Outline USB Application Requirements Variable Definition Communications Code for VB Code for Keil C Practice

Outline USB Application Requirements Variable Definition Communications Code for VB Code for Keil C Practice 路 ESW 聯 USB Chapter 9 Applications For Windows Outline USB Application Requirements Variable Definition Communications Code for VB Code for Keil C Practice USB I/O USB / USB 3 料 2 1 3 路 USB / 列 料 料 料 LED

More information

(Guangzhou) AIT Co, Ltd V 110V [ ]! 2

(Guangzhou) AIT Co, Ltd V 110V [ ]! 2 (Guangzhou) AIT Co, Ltd 020-84106666 020-84106688 http://wwwlenxcn Xi III Zebra XI III 1 (Guangzhou) AIT Co, Ltd 020-84106666 020-84106688 http://wwwlenxcn 230V 110V [ ]! 2 (Guangzhou) AIT Co, Ltd 020-84106666

More information

Microsoft Word - 01.DOC

Microsoft Word - 01.DOC 第 1 章 JavaScript 简 介 JavaScript 是 NetScape 公 司 为 Navigator 浏 览 器 开 发 的, 是 写 在 HTML 文 件 中 的 一 种 脚 本 语 言, 能 实 现 网 页 内 容 的 交 互 显 示 当 用 户 在 客 户 端 显 示 该 网 页 时, 浏 览 器 就 会 执 行 JavaScript 程 序, 用 户 通 过 交 互 式 的

More information

C C C The Most Beautiful Language and Most Dangerous Language in the Programming World! C 2 C C C 4 C 40 30 10 Project 30 C Project 3 60 Project 40

C C C The Most Beautiful Language and Most Dangerous Language in the Programming World! C 2 C C C 4 C 40 30 10 Project 30 C Project 3 60 Project 40 C C trio@seu.edu.cn C C C C The Most Beautiful Language and Most Dangerous Language in the Programming World! C 2 C C C 4 C 40 30 10 Project 30 C Project 3 60 Project 40 Week3 C Week5 Week5 Memory & Pointer

More information

Microsoft PowerPoint - Lecture7II.ppt

Microsoft PowerPoint - Lecture7II.ppt Lecture 8II SUDOKU PUZZLE SUDOKU New Play Check 軟體實作與計算實驗 1 4x4 Sudoku row column 3 2 } 4 } block 1 4 軟體實作與計算實驗 2 Sudoku Puzzle Numbers in the puzzle belong {1,2,3,4} Constraints Each column must contain

More information

目 录 目 录 1. 安 装 和 快 速 入 门 附 件 1.1 随 机 附 件... 3 1.2 附 件 信 息... 3 连 接 和 设 定 1.3 连 接... 3 1.4 记 录 纸... 4 快 速 入 门 1.5 发 送 传 真 / 复 印... 5 1.6 接 收 传 真... 5 2

目 录 目 录 1. 安 装 和 快 速 入 门 附 件 1.1 随 机 附 件... 3 1.2 附 件 信 息... 3 连 接 和 设 定 1.3 连 接... 3 1.4 记 录 纸... 4 快 速 入 门 1.5 发 送 传 真 / 复 印... 5 1.6 接 收 传 真... 5 2 KX-FT832CN KX-FT836CN KX-FT836 感 谢 您 购 买 Panasonic 传 真 机 请 于 使 用 前 仔 细 阅 读 操 作 使 用 说 明 书, 并 妥 善 保 管 本 机 与 来 电 显 示 兼 容 您 必 须 向 服 务 供 应 商 / 电 话 公 司 申 请 并 取 得 相 应 的 服 务 目 录 目 录 1. 安 装 和 快 速 入 门 附 件 1.1 随

More information

#FT66/68CN(01~07)

#FT66/68CN(01~07) : KX-FT66CN KX-FT68CN KX-FT66 Panasonic Panasonic ( ) KX-FT66 KX-FT68 : CN KX-FT66 : ( KME ) KME Kyushu Matsushita Electric Co., Ltd. 2000 2000 2 E. F. 1. 14. ( 2. ) 3. 15. 4. 5. / 6. 1. 2. 7. 3. 4. 8.

More information

Oracle 4

Oracle 4 Oracle 4 01 04 Oracle 07 Oracle Oracle Instance Oracle Instance Oracle Instance Oracle Database Oracle Database Instance Parameter File Pfile Instance Instance Instance Instance Oracle Instance System

More information

学习MSP430单片机推荐参考书

学习MSP430单片机推荐参考书 MSP430 16 MSP430 C MSP430 C MSP430 FLASH 16 1 CPU 16 ALU 16 PC SP SR R4~R15 2 3 00-FFH 100-1FFH 4 5 1 2 51 24 27 6 1 2 3 4 5 6 4 12 SR SP SR CPU SR CPU C Z N GIE CPUOff CPU OscOff SCG0 SCG1 CPU EXIT SP

More information

untitled

untitled www.mcudriver.cn 1.1 / 1) WinAVR20070525 2) Source Insight 3) ISP 4) PonyProg ISP 5) USB 6) 1.2. MCU ATMEGA16 1.3. AVR8 1.4 LED0~LED7 1 1.5 #include // Program 1.1 LED.C #define uchar unsigned

More information

V6800/V6600 3D

V6800/V6600 3D V6800/V6600 3D V6600/V6800 3D R 2000 2 3 4 5 R 6 7 8 The VIP (Video Interface Port) Connector are used for third party add-on modules, such as video capture cards or television tuners. DDR: Double Data

More information

untitled

untitled 8086/8088 CIP /. 2004.8 ISBN 7-03-014239-X.... TP313 CIP 2004 086019 16 100717 http://www.sciencep.com * 2004 8 2004 8 1 5 500 787 1092 1/16 16 1/2 391 000 1 2 ii 1 2 CAI CAI 3 To the teacher To the student

More information

第一章 概论

第一章  概论 1 2 3 4 5 6 7 8 Linux 7.1 7.1.1 1 1 2 3 2 3 1 2 3 3 1 2 3 7.1.2 1 2 1 2 3 4 5 7.1.3 1 1 2 3 2 7.1 3 7.1.4 1 1 PCB 2 3 2 PCB PCB PCB PCB PCB 4 1 2 PSW 3 CPU CPU 4 PCB PCB CPU PCB PCB PCB PCB PCB PCB PCB

More information

典型自编教材

典型自编教材 河 南 科 技 大 学 计 算 机 实 验 教 学 中 心 1. 计 算 机 文 化 基 础 实 验 指 导 书 2. 数 据 结 构 实 验 指 导 书 3. 操 作 系 统 实 验 指 导 书 4. 面 向 对 象 程 序 设 计 实 验 指 导 书 5. 数 据 库 原 理 实 验 指 导 书 6. 编 译 原 理 实 验 指 导 书 7. JAVA 程 序 设 计 实 验 指 导 书 8.

More information

Microsoft PowerPoint - ch6 [相容模式]

Microsoft PowerPoint - ch6 [相容模式] UiBinder wzyang@asia.edu.tw UiBinder Java GWT UiBinder XML UI i18n (widget) 1 2 UiBinder HelloWidget.ui.xml: UI HelloWidgetBinder HelloWidget.java XML UI Owner class ( Composite ) UI XML UiBinder: Owner

More information

1 4 1.1 4 1.2..4 2..4 2.1..4 3.4 3.1 Java.5 3.1.1..5 3.1.2 5 3.1.3 6 4.6 4.1 6 4.2.6 5 7 5.1..8 5.1.1 8 5.1.2..8 5.1.3..8 5.1.4..9 5.2..9 6.10 6.1.10

1 4 1.1 4 1.2..4 2..4 2.1..4 3.4 3.1 Java.5 3.1.1..5 3.1.2 5 3.1.3 6 4.6 4.1 6 4.2.6 5 7 5.1..8 5.1.1 8 5.1.2..8 5.1.3..8 5.1.4..9 5.2..9 6.10 6.1.10 Java V1.0.1 2007 4 10 1 4 1.1 4 1.2..4 2..4 2.1..4 3.4 3.1 Java.5 3.1.1..5 3.1.2 5 3.1.3 6 4.6 4.1 6 4.2.6 5 7 5.1..8 5.1.1 8 5.1.2..8 5.1.3..8 5.1.4..9 5.2..9 6.10 6.1.10 6.2.10 6.3..10 6.4 11 7.12 7.1

More information

Microsoft Word - template.doc

Microsoft Word - template.doc HGC efax Service User Guide I. Getting Started Page 1 II. Fax Forward Page 2 4 III. Web Viewing Page 5 7 IV. General Management Page 8 12 V. Help Desk Page 13 VI. Logout Page 13 Page 0 I. Getting Started

More information

1 TPIS TPIS 2 2

1 TPIS TPIS 2 2 1 1 TPIS TPIS 2 2 1. 2. 3. 4. 3 3 4 5 4 TPIS TPIS 6 5 350 Mark Coil F3/F6 350 M 150 M 25 M 7.12M 8 M F3 F6 F4 F7 F8 8M AA 7 350 28V 5V IC HCPL2731 0.5mA 6 8 (TPIS) TPIS 9 7 IC AT89C2051 AT89C2051 CMOS8

More information

碩命題橫式

碩命題橫式 一 解釋名詞 :(50%) 1. Two s complement of an integer in binary 2. Arithmetic right shift of a signed integer 3. Pipelining in instruction execution 4. Highest and lowest layers in the TCP/IP protocol suite

More information

Computer Architecture

Computer Architecture ECE 3120 Computer Systems Assembly Programming Manjeera Jeedigunta http://blogs.cae.tntech.edu/msjeedigun21 Email: msjeedigun21@tntech.edu Tel: 931-372-6181, Prescott Hall 120 Prev: Basic computer concepts

More information

AL-MX200 Series

AL-MX200 Series PostScript Level3 Compatible NPD4760-00 TC Seiko Epson Corporation Seiko Epson Corporation ( ) Seiko Epson Corporation Seiko Epson Corporation Epson Seiko Epson Corporation Apple Bonjour ColorSync Macintosh

More information

投影片 1

投影片 1 2 理 1 2-1 CPU 2-2 CPU 理 2-3 CPU 類 2 什 CPU CPU Central Processing Unit ( 理 ), 理 (Processor), CPU 料 ( 例 ) 邏 ( 例 ),, 若 了 CPU, 3 什 CPU CPU 了, 行, 利 CPU 力 來 行 4 什 CPU 5 2-2-1 CPU CPU 了 (CU, Control Unit) / 邏

More information

逢 甲 大 學

逢  甲  大  學 益 老 年 不 易更 例 不 異 列 - I - 錄 錄 流 錄 六 來 錄 - II - 錄 錄 錄 錄 錄 錄 參 料 錄 - III - 料 讀 讀 錄 讀 數 錄 錄 錄 錄 錄 - IV - 錄 錄 行 錄 錄 錄 錄 讀 錄 錄 錄 讀 錄 錄 - V - 了 說 力 兩 了 - 1 - 列 邏 路 列 不 不 FLEX 10K Devices at a Glance Feature

More information

PCM-3386用户手册.doc

PCM-3386用户手册.doc PCM-3386 BBPC-4x86 10/100M PC/104 (Lanry technology Co. Ltd. Zhuhai) 38 1012836 (Address: Room 1012,Linhai Building,No. 38,west of Shihua Road,Zhuhai City,Guangdong Province,China) (post code)519015 (phone)0756-3366659

More information

第7章-并行计算.ppt

第7章-并行计算.ppt EFEP90 10CDMP3 CD t 0 t 0 To pull a bigger wagon, it is easier to add more oxen than to grow a gigantic ox 10t 0 t 0 n p Ts Tp if E(n, p) < 1 p, then T (n) < T (n, p) s p S(n,p) = p : f(x)=sin(cos(x))

More information

2013 C 1 #include <stdio.h> 2 int main(void) 3 { 4 int cases, i; 5 long long a, b; 6 scanf("%d", &cases); 7 for (i = 0; i < cases; i++) 8 { 9 scanf("%

2013 C 1 #include <stdio.h> 2 int main(void) 3 { 4 int cases, i; 5 long long a, b; 6 scanf(%d, &cases); 7 for (i = 0; i < cases; i++) 8 { 9 scanf(% 2013 ( 28 ) ( ) 1. C pa.c, pb.c, 2. C++ pa.cpp, pb.cpp Compilation Error long long cin scanf Time Limit Exceeded 1: A 10 B 1 C 1 D 5 E 5 F 1 G II 5 H 30 1 2013 C 1 #include 2 int main(void) 3

More information