Download Dynamic DX-ARC-SWB User guide
Transcript
3.3. GLOBAL FUNCTIONS 77 CIN:y, POS:y, NAT:y res := sys(Sys usleep, usecs) Under cintsys, this call causes the system to sleep for usecs micro-seconds. Under cintpos, it causes the current task to sleep for usecs micro-seconds. CIN:n, POS:y, NAT:n sys(Sys waitirq, msecs) This call is typically only made from the body of the Cintpos Idle task. It suspends the interpreter until either some Cintpos device issues an interrupt request or the specified timeout occurs. It is typically implemented by waiting with a timeout on a host operating system condition variable. When a device thread wishes to interrupt the interpreter it send a signal via the appropriate condition variable. Unfortunately some operating systems may take hundreds of milliseconds to reschedule the interpreter thread. A possible but selfish solution is for the Idle task to execute a busy loop instead of calling waitirq. sys(Sys watch, addr) CIN:y, POS:y, NAT:n This sets the address of a location of Cintcode memory to be inspected every time the interpreter executes and instruction. When the watched value changes it returns with result 12. The watch feature is disabled if addr is zero or if fasterp is being used. n := sys(Sys write, fp, buf, len) CIN:y, POS:y, NAT:y This writes len bytes to the file specified by the file pointer fp from the byte buffer buf. The file pointer must have been created by a call of sys(Sys openwrite,...). The result is the number of bytes transferred, or zero if there was an error. pkt := taskwait() CIN:n, POS:y, NAT:n If there is a packet in the task’s queue it is dequeued and returned as the result. If there was no packet on the work queue this task is suspended in WAIT state and control given to a lower priority task. res := testbit(bitno, bitvec) CIN:y, POS:y, NAT:y This function returns a non zero value if and only if the specified bit in bitvec is a one. The bits are numbered from zero starting at the least significant bit of bitvec!0. bitvec!0 holds bits 0 to bitsperword-1, bitvec!1 holds bits bitsperword to 2*bitsperword-1, etc. res := testflags(flags) CIN:n, POS:y, NAT:n This Cintpos function tests and clears specified flags in the task control block of the current task. Flags are bits in the tcb flags field of the task control block, and they are normally called A, B, etc corresponding to consecutive bits from the least significant end of the field. A flag is set if the corresponding bit is a one. The argument flags is a bit pattern identifying which flags are being inspected. The result is FALSE if none of the specified flags were set, and TRUE if at least one was, in which case result2 is set to a bit pattern representing the flags that were set and have now been cleared. unloadseg(segl) CIN:y, POS:y, NAT:y This routine unloads the list of loaded program modules given by segl. res := unrdch() CIN:y, POS:y, NAT:y This attempts to step the current input stream back by one character position. It