Table of Contents Previous Chapter ACIS

4.0 Interfaces (36-53204 02-)

This section describes the main interfaces used by the ACIS Science Instrument Software.

4.1 R3000 Core Processor Interfaces

The Mongoose Microcontroller is based on an R3000 processor. The following sections provide a brief overview the R3000 Core Processor. This information is taken from "MIPS RISC Architecture," by Kane, published by Prentice Hall, and from "The MIPS Programmer's Handbook," by Farquhar and Bunce, published by Morgan Kaufmann. A description of the Mongoose extensions to the R3000 is provided in Section 4.2 .

4.1.1 Instruction Set

This section provides a brief overview of some aspects of the R3000 instruction set. The R3000 is a reduced-instruction-set-computer (RISC) and has a reasonably small instruction set. Each processor instruction occupies 1 32-bit word, and, barring memory waits, is effectively executed in 1 machine cycle. Certain instructions, however, require the compiler, assembler or software engineer to be careful in the ordering of instructions. For example, memory load instructions prohibit the instruction immediately following it from using the fetched value, and conditional and unconditional branch instructions always execute the instruction immediately following the branch instruction, regardless of whether the branch is taken or not.

The R3000 assemblers are "smart" in that they provide enhanced instructions, and make code-generation decisions when possible. For example, most of the assemblers provide a "Load Constant Address" instruction which the assembler may translate into one or two core instructions depending on the nature of the address. If the address has non zero values in both the upper and lower 16-bits, the assembler will produce a "lui" to load the upper 16-bits, followed by a "ori" to add in the lower 16-bit of the address. If the lower 16-bits are zero, the assembler will omit the "ori" operation. If the upper 16-bits are zero, the assembler will just use a "li" instruction to load the lower 16-bits and zero the upper 16.

The following is a list of the core R3000 instructions provided by the processor:

TABLE 4. R3000 Core Instruction Set

-------------------------------------------------------
Mnemonic    Instruction                                  
-------------------------------------------------------
                Arithmetic Instructions                  
add         Add                                          
addi        Add Immediate (16-bit)                       
addiu       Add Unsigned Immediate                       
addu        Add Unsigned                                 
and         AND                                          
andi        AND Immediate                                
div         Divide                                       
divu        Divide Unsigned                              
mult        Multiply                                     
multu       Multiply Unsigned                            
nor         NOR                                          
or          OR                                           
ori         OR Immediate                                 
sll         Shift Logical Left                           
sllv        Shift Logical Left Variable                  
sra         Shift Right Arithmetic                       
srav        Shift Right Arithmetic Variable              
srl         Shift Logical Right                          
srlv        Shift Logical Right Variable                 
sub         Subtract                                     
subu        Subtract Unsigned                            
xor         XOR                                          
xori        XOR Immediate                                
              Branch and Jump Instructions               
bczf        Branch Co-processor Z Flag False             
bczt        Branch Co-processor Z Flag True              
beq         Branch if Registers Equal                    
bgez        Branch if register >= 0                      
bgezal      Branch and Link if register >= 0             
bgtz        Branch register > 0                          
blez        Branch register <= 0                         
bltz        Branch register < 0                          
bltzal      Branch and Link register < 0                 
bne         Branch if registers not equal                
j           Jump                                         
jal         Jump and Link                                
jlr         Jump and Link Register                       
jr          Jump Register                                
               Co-processor Instructions                 
cfcz        Move from Co-processor Z Control Register    
copz        Co-processor Z Operation                     
ctcz        Move to Co-processor Z Control Register      
lwcz        Load Word to Co-processor Z Register         
mfc0        Move from System Co-processor Register       
mfcz        Move from Co-processor Z Register            
mtc0        Move to System Co-processor Register         
mtcz        Move to Co-processor Z Register              
tlbp        System Co-processor Probe TLB for Match      
tlbr        System Co-processor Read Indexed TLB Entry   
tlbwi       System Co-processor Write Indexed TLB Entry  
tlbwr       System Co-processor Write Random TLB Entry   
rfe         System Co-processor  Return from Exception   
swcz        Store Word from Co-processor Z Register      
              Load and Store Instructions                
lb          Load byte                                    
lbu         Load byte unsigned                           
lh          Load half-word                               
lhu         Load half-word unsigned                      
lui         Load Upper 16-bits immediate                 
lw          Load Word                                    
lwl         Unaligned Load Word Left                     
lwr         Unaligned Load Word Right                    
mfhi        Move to High Accumulator (mult,div)          
mflo        Move from Low Accumulator                    
mthi        Move to High Accumulator                     
mtlo        Move to Low Accumulator                      
sb          Store Byte                                   
sh          Store Half-word                              
sw          Store Word                                   
swl         Unaligned Store Word Left                    
swr         Unaligned Store Word Right                   
               Miscellaneous Instructions                
break       Breakpoint                                   
slt         Set on Less Than                             
slti        Set on Less Than Immediate                   
sltiu       Set on Less Than Immediate Unsigned          
sltu        Set on Less Than Unsigned                    
syscall     System Call                                  
                                                         
-------------------------------------------------------

4.1.2 System Co-processor (C0)

This section provides an overview of the R3000's System Co-processor (CU0). This co-processor's registers can be read via the "mfc0" CPU instruction, and written to via the "mtc0" CPU instruction. This co-processor provides the following registers:

4.1.2.1 Status Register (C0_SR)

This section describes the R3000 System Co-processor's Status Register. The following lists the bit fields contained within this register:

--------------------------------------------------------------------------------------------
31  28  27  23   22   21   20   19   18    17    16   15      8  7  6   5    4    3    2    1    0   
--------------------------------------------------------------------------------------------
  CU       0    BEV   TS   PE   CM   PZ   SwC   IsC    IntMask     0   KUo   IEo   KUp   IEp   KUc   IEc   
--------------------------------------------------------------------------------------------
IEc, IEp, IEo
Interrupt Enable (Current, Previous, Old)
KUc, KUp, KUo
Kernel/User Mode (Current, Previous Old)
IntMask
Interrupt Mask
IsC
Isolate Cache (unused on Mongoose)
SwC
Swap Caches (unused on Mongoose)
PZ
Parity Zero (unused on Mongoose)
CM
Cache Miss (unused on Mongoose)
PE
Parity Error (unused on Mongoose)
TS
TLB Shutdown (unused on Mongoose)
BEV
Bootstrap-Exception Vectors
CU (0-3)
Co-processor Usable (CU0 only on Mongoose)

The following is a detailed breakdown of the IntMask and Co-processor Usable bits:

--------------------------------------------
 15    14    13    12    11    10    9    8   
--------------------------------------------
INT6   INT5   INT4   INT3   INT2   INT1   Sw2   Sw1   
--------------------------------------------
Sw
Software Interrupts
INT
Hardware Interrupts

------------------
 31    30    29    28   
------------------
CU3   CU2   CU1   CU0  
                    
------------------
CU0
System Co-processor Usable (must always be 1)
CU1
Math Co-processor Usable (on ACIS, always 0)
CU2
Co-processor 2 Usable (on ACIS, always 0)
CU3
Co-processor 3 Usable (on ACIS, always 0)
Interrupt Enable Bits
These bits define whether interrupts are enabled or not (0=disabled, 1=enabled). The IEc bit is cleared upon reset or hardware interrupt. The software uses this bit to disable all interrupts, and to enable those interrupts indicated by the IntMask field. When an interrupt or exception occurs, the IEc bit is copied in to the IEp slot, and the IEp slot is copied into the IEo slot. When a return-from-exception co-processor instruction (rfe) is executed, the previous contents of the IEp and IEc bits are restored. The IEo bit is left unmodified.
Kernel/User Mode Bits
These bits define whether the processor is in Kernel or User mode (0=kernel mode, 1=user mode). The ACIS software always runs in Kernel mode.
Interrupt Mask
These bits are used by the software to individually enable or disable interrupts tied to the corresponding mask bits (0=disable, 1=enable). The Software Interrupts (Sw1, Sw2) are caused by writing the associated bits in the Cause Register. The remaining bits (INT1..INT6) are cause by physical hardware devices connected to the corresponding interrupt lines. The Mongoose Processor reserves INT3 for the extended Mongoose interrupts and exceptions.
Bootstrap Exception Vectors
This bit is set by hardware upon reset, and may be set or cleared by software. When set, this bit causes the General Exception Vector to be mapped into the Boot ROM address space (virtual address 0xbfc000c0). When this bit is 0, the General Exception Vector is mapped into Instruction Cache space (virtual address 0x80080080).
Co-processor Usable Bits
These bits indicate which R3000 System Co-processor s are present and usable (0=unuseable, 1=usable). On ACIS, only the System Co-processor (which contains this Status Register) is usable.
4.1.2.2 Cause Register (C0_CAUSE)

This section describes the R3000 System Co-processor's Interrupt Cause Register.

--------------------------------------------------------------
31   30   29  28  27  16  15      10  9  8  7  6  5      2  1  0  
--------------------------------------------------------------
BD    0     CE       0     IP[5..0]    Sw     0    ExcCode     0   
--------------------------------------------------------------
ExcCode
Exception Code
Sw
Software Interrupts
IP[5..0]
Interrupt Pending
CE
Co-processor Error
BD
Branch Delay
ExcCode
This field contains the Exception Code for the current exception. It may contain one of the following values:

TABLE 5. Cause Register Exception Code Values

-------------------------------------------------------------
Code       Cause                                               
-------------------------------------------------------------
0 - Int:   External Interrupt (including Mongoose CSI)         
1 - MOD:   TLB Modification exception (not on Mongoose)        
2 - TLBL:  Load or fetch TLB miss exception (not on Mongoose)  
3 - TLBS:  Store TLB miss exception (not on Mongoose)          
4 - AdEL:  Load or fetch Address Error Exception               
5 - AdES:  Store Address Error Exception                       
6 - IBE:   Instruction Bus Exception                           
7 - DBE:   Data Bus Exception                                  
8 - Sys:   SysCall Exception                                   
9 - Bp:    Breakpoint Exception                                
10 - RI:   Reserved Instruction Exception                      
11 - CpU:  Co-processor Unusable Exception                     
12 - Ovf:  Arithmetic Overflow Exception                       
13-15:     Reserved                                            
-------------------------------------------------------------
Sw[0,1]
These bits correspond to the pending software interrupts. Writing to these bits sets or clears the software interrupts
IP[0..5]
These bits correspond to the pending external interrupts.
CE[0..1]
These bits identify which co-processor cause a Co-processor Unusable Exception
BD
This bit indicates whether an exception was taken while executing in a branch delay slot (i.e. the instruction immediately following a branch).
4.1.2.3 Exception Program Counter (C0_EPC)

This section describes the R3000 System Co-processor's Exception Program Counter Register. This register contains the address to resume after processing an interrupt or exception. Typical code for ending an exception is as follows:

mfc0    k0,C0_EPC      # Get return address into kernel register 0 
nop          # 1 instruction delay after a mfc0 before value valid 
jr  k0        # Jump to resumption address 
rfe          # Use delay slot to tell CU0 to restore flags
4.1.2.4 Bad Virtual Address Register (C0_BVADDR)

This section describes the R3000 System Co-processor's Bad Virtual Address Register. This register contains the virtual address which caused an address exception. This register is not used for bus errors.

4.2 Mongoose Hardware Interface

The following sections provide a brief overview of the Mongoose Microcontroller registers. This information is taken from "Mongoose ASIC Microcontroller Programming Guide, September 1993," by Brian Smith, NASA Reference Publication 1319.

4.2.1 Microboot Control Word (0xbffffffc)

This section describes the Mongoose Microboot Control Word. This word is located in the last location in Boot ROM (or RAM in the case of the FEPs) and is used by the Mongoose during hardware initialization (prior to any software activity) to configure its Instruction and Data cache memory chip layout. The format of this register is as follows:

-------------------------------------------------
31    8  7          5  4      3  2      1     0    
-------------------------------------------------
 Unused    Mux. Decode    I-cache    D-cache   Unused  
                                                   
-------------------------------------------------
D-cache
Number of D-cache Chip Selects [0:One chip select, 1:Two chip selects, 2:Illegal, 3:Four chip selects]
I-cache
Number of I-cache Chip Selects [0:One chip select, 1:Two chip selects, 2:Illegal, 3:Four chip selects]
Mux. Decode
Cache chip select address mux. decode [0:decode address(13:12), 1:decode address(14:13), 2:decode address(15:14), 3:decode address(16:15), 4:decode address(17:16), 5:decode address(18:17), 6:decode address(19:18), 7:all chip selects not active]

For the Back End Processor, the value to use for this control word is 0x0ba.

For all of the Front End Processors, the value to use for this control word is 0x0a0.

4.2.2 Command/Status Interface (CSI) Registers (0xb4c00000)

This section provides an overview of the Mongoose Command and Status interface registers. The Mongoose Microcontroller provides a block of command and status interface registers, located at address 0xb4c00000. This block contains the following registers:

The following illustrates the memory layout for this block of registers:

Extended Interrupt Mask  0xbf400000
Extended Interrupt Cause  0xbf400004
Configuration Register  0xbf400008
DMA Origin  0xbf40000c
DMA Destination  0xbf400010
DMA Word Count  0xbf400014
Watchdog Count  0xbf400018
Timer Count  0xbf40001c
Uart Command/Status  0xbf400024
Uart Data  0xbf400028
I-cache Address  0xbf40002c
I-cache Data  0xbf400030

4.2.3 Configuration Register

This section describes the Mongoose Configuration Register. This register is used to enable/disable the general purpose timer, to initiate memory transfers using the DMA Controller, and to select the number of memory wait-states to use in external, uncached memory. The format of the configuration register is as follows:

-----------------------------------------------------------------------
31  30       29         28    27      26  25  21  20        17  16    0  
-----------------------------------------------------------------------
Unused   Timer Enable   Unused    DMA Type   Unused    Wait State    Unused   
-----------------------------------------------------------------------
Wait State
Number of memory wait-state cycles to use [0:15]
DMA Type
DMA Transfer Mode [0:Off, 1:D-Cache to Memory, 2:Memory to D-Cache, 3:Memory-to-Memory]
Timer Enable
General Purpose Timer Enable/Disable Control [0:Disabled, 1:Enabled]

4.2.4 Instruction Cache Access

This section describes the Mongoose's Instruction Cache access registers and the procedure used to read and write the contents of the Instruction Cache. The Mongoose Instruction cache is loaded and dumped using an address and data register. The format of the Mongoose Instruction Cache Address register is as follows:

-----------------------------------------------------
31   30   29  20  19                            2  1  0  
-----------------------------------------------------
 R    W      0     Instruction Address Bits 2:19     0   
-----------------------------------------------------
Instruction Address
Source or destination word address within I-cache
W
Write-to-Icache Control Bit
R
Read-from-Icache Control Bit

To write into the instruction cache, clear the bits 0, 1 and 20 through 31 of the destination address, OR a 1 into the Write-to-Icache control bit, write the desired data word to the data register, wait at least one CPU cycle, then write the formatted address to the Instruction Cache address register.

To read a word, zero bits 0, 1 and 20 through 31 of the source address, OR a 1 into the Read-command bit, write the formatted address into the Instruction Cache address register, wait at least one CPU cycle, and then read the Instruction Cache data register.

4.2.5 Extended Interrupts

This section describes the Mongoose Extended Interrupts. The Mongoose supports a set of extended interrupts and exceptions, which when asserted and unmasked, cause INT3 (IP[2]) to be asserted on the R3000 Core (see Section 4.1.2.1 and Section 4.1.2.2 ). The set of interrupts and exceptions include:

4.2.5.1 Extended Mask Register

This section describes the Mongoose Extended Interrupt Mask Register. This register is used to prevent one or more of the extended interrupt sources from causing an interrupt. A `1' in the mask allows interrupts from the corresponding source, and a `0' prevents the source from interrupting the processor. The format of the extended mask register is as follows:

----------------------------------------------------------------------------------------------------
31  16     15       14    13   12   11    10     9       8      7     6     5      4      3    2      0  
----------------------------------------------------------------------------------------------------
Unused   Watchdog   Timer   DMA   Rx   Tx   MemE   InsBE   DataBE  DmaBE   WBE  Int3a   Int3b   Int3c    Unused   
----------------------------------------------------------------------------------------------------
Int3c
External Interrupt 3c
Int3b
External Interrupt 3b
Int3a
External Interrupt 3a
WBE
Write Bus Error
DmaBE
DMA Bus Error
DataBE
Data Read Bus Error
InsBE
Instruction Read Bus Error
MemE
External Memory Bus Time-out
Tx
UART Transmit Ready Interrupt
Rx
UART Receiver Ready Interrupt
DMA
DMA Transfer Complete Interrupt
Timer
General Purpose Timer End of Count Interrupt
Watchdog
Watchdog TImer End of Count Interrupt
4.2.5.2 Extended Cause Register

This section describes the Mongoose Extended Cause Register. When read, this register returns the list of sources which have requested interrupt service. A `1' indicates that the corresponding device has asserted an interrupt request. A `0' indicates that no interrupt request is pending from the device. When written to, this register clears the pending request. The format for this register is identical to that for the Extended Mask Register (see Section 4.2.5.1 ).

4.2.6 DMA Controller

This section describes the Mongoose DMA Controller. The Mongoose DMA Controller is configured using the DMA Controller Starting Origin Register, DMA Controller Starting Destination Register, the DMA Controller Count Register, and the DMA Type bits in the Mongoose Configuration Register (see Section 4.2.3 ).

4.2.7 Watchdog Timer

This section describes the Mongoose Watchdog Timer. The Watchdog Timer's time-out duration is established by writing a value into its Count Register. Upon reset, the counter's value is 0xffffffff. This count register decrements with each CPU cycle (10MHz). When the count reaches 0, the timer generates a hardware pulse, which on ACIS, is connected to the processor's reset logic.

4.2.8 General Purpose Timer

This section describes the Mongoose General Purpose Timer. The General Purpose Timer's time-out duration is established by writing a value into its Count Register. Upon reset, the counter's value is 0xffffffff, and the timer is disabled. When enabled via the Configuration Register (see Section 4.2.3 ), this count register decrements with each CPU cycle (10MHz). When the count reaches 0, the timer asserts the Timer End of Count extended interrupt (see Section 4.2.5 ), and the counter wraps to 0xffffffff and continues to decrement with each CPU cycle.

4.3 Back End Processor Hardware Interfaces

The following sections describe the Back End Processor hardware interfaces. This information is taken from the "DPA Hardware Specification and System Description, Rev. 04," by Dorothy Gordon, MIT Drawing Number 36-02104. Additional information is included in advance of future publications of this document, and is marked as TBD.

4.3.1 Memory Map Overview

This section illustrates the overall Back End Processor hardware memory map:

TABLE 6. Back End Processor Memory Map Overview

-----------------------------------------------------------------------------------------
Virtual     Byte Size  Name                   Use                                          
Address                                                                                    
-----------------------------------------------------------------------------------------
0xbfc00000  0x8000     Boot ROM               Contains Bootstrap loader software (see      
                                              Section 13.0 ) and Microboot Control         
                                              Word (see Section 4.2.1 )                    
0xbf800000  N/A        External Debug Board   Debug board used for development/pre-        
                                              flight testing                               
0xbf400000  0x30       Mongoose CSI Subblock  see Section 4.2                              
0xb8000000  0x100000   Flight ROM             Contains the delivered image of the          
                                              instrument software code and initialized     
                                              data. This image is copied into I-cache      
                                              and D-cache by the Bootstrap loader soft     
                                              ware.                                        
0xa8000000  0x7ff0000  FEP Shared Memory      Shared FEP RAM used for mailboxes,           
                       Addresses              ring-buffers, and bias maps and bias par     
                                              ity planes.                                  
0xa0180000  N/A        BEP I/O Devices        see below                                    
0xa0000000  1 MB       Bulk Memory and FEP    BEP-populated RAM used for telemetry         
                       Shared Memory          buffers.                                     
                       Addresses                                                           
0x80080000  0x80000    Instruction Cache      Contains copy of patched and running         
                       (SEU-immune)           code.                                        
                                              Since this RAM can only be written to via    
                                              the Mongoose CSI (see Section 4.2.4 ),       
                                              portions of this area are used to preserve   
                                              patch lists, system configuration parame     
                                              ters, science parameter blocks, and DEA      
                                              parameter blocks across resets.              
0x80000000  0x20000    Data Cache             Contains copy of patched initialized data.   
                       (SEU-immune)           Used for run-time stacks, RTX resources,     
                                              and program data.                            
                                                                                           
-----------------------------------------------------------------------------------------

4.3.2 Control Register (0xA0180000)

This section describes the Back End Processor's Control Register. This read/write register controls the state of various Back End Processor devices. The format of this register is as follows:

-------------------------------------------------------------
31  12   11        6  5                 2      1         0     
-------------------------------------------------------------
Unused   FEPPOW[0-5]    SW_BLT0 - SW_BLT3   DNLKTRENB   UPLKENB   
-------------------------------------------------------------
UPLNKENB
Enable command data reception
DNLKTRENB
Enable telemetry data transmission
SW_BLT(0-3)
BiLevel discretes
FEPPOW[0-5]
FEP power control

4.3.3 Status Register (0xA0180004)

This section describes the Back End Processor's Status Register. This read-only register provides status information on the various Back End Processor Devices. A `1' in a given bit indicates the presence of the corresponding condition. A `0' indicates that the corresponding condition is not currently present. Some conditions persist until reset via the Pulse Register (see Section 4.3.4 ). The format of this register is as follows:

------------------------------------------------------------------------------------------
23    22   21   20  19  18   17   16   15    14    13   12      7   6    5    4    3    2    1    0   
------------------------------------------------------------------------------------------
RS[1-0]   BID  CR  WD  RAD  ST   BT    X   DSR   DCB   FI(0-5)    RM  DI   UFE   UFF   UI   UFA   UE  
                                                                                            
------------------------------------------------------------------------------------------
UE
UPLKERR: Error in command data reception
UFA
UPLKFULLAT: TBD
UI
UPLKINT: End of packet or error condition
UFF
UPLKFULL: Command FIFO full
UFE
UPLKFEMP: Command FIFO empty
DI
DNLKINT: Downlink transfer complete
RM
RADMONDET: Spacecraft has detected high radiation
FI(0-5)
FEPINT0-5: FEP interrupt requested
DCB
DEACMDBUSY: DEA receiving data
DSR
DEASTATRDY: DEA has sent status data
X
unused
BT
BOOT_MOD: Boot modifier bit asserted

ST
STAN_MOD: Hardware in standby mode
RAD
RAD_MON: High radiation environment detected
WD
WDOGRST: Watchdog reset occured
CR
CMDRST: Command reset issued
BID
BEP ID set via backplane slot
RS[1-0]
ROM_SEG[1-0]: Segment of Boot Rom used for boot.

4.3.4 Pulse Register (0xA0180008)

This section describes the Back End Processor's Pulse Register. This write-only register resets various status and interrupt conditions. Writing a `1' to a given bit performs the corresponding action. Writing a `0' to a bit has no effect on the corresponding item. The format of this register is as follows:

------------------------------------------------------------------------------
   13      12      11      10      9    8              3     2      1      0    
------------------------------------------------------------------------------
FIFORST   DEARST  CLRCMD  CLRWD   CLRDEA    CLRFEPINT(0-5)   CLRRMD   CLRDI   CLRUI   
------------------------------------------------------------------------------
CLRUI
CLRUPLKINT:Clear Uplink Controller interrupt
CLRDI
CLRDNLKINT:Clear Downlink Transfer Controller interrupt
CRLRMD
CLRRADMONDET:Clear Radiation Monitor Detect interrupt
CLRFEPINT(0-5)
CLRFEPINT0-5:Clear Front End Processor interrupt (1 bit for each FEP)
CLRDEA
CLRDEASTATRDY:Clear DEA Status Port Ready flag
CLRWD
CLRWDOGRST:Clear Watchdog Reset flag
CLRCMD
CLRCMDRST:Clear Commanded Reset flag
DEARST
DEARST:Reset Detector Electronics Assembly
FIFORST
FIFORST:Reset Command FIFO

4.3.5 Command FIFO and Uplink Controller (0xA0180014)

This section describes the Back End Processor's Command FIFO. As the Back End Processor hardware receives 16-bit command words from the Remote Command and Telemetry Unit (RCTU), it writes these words into a 256-word deep hardware FIFO. The hardware always stores received words into the FIFO, even when the Uplink Controller is disabled.

When enabled, the Uplink Controller monitors the acquisition of ACIS packets. After being enabled, the controller interprets the first received 16-bit word as the total number of words in the incoming ACIS command packet. It then counts down each received word until all the words of the packet have been acquired. It then generates an interrupt to the Back End Processor, indicating that a complete packet has been received. It then interprets the next 16-bit word as the word count of the next command packet. The format of this register is as follows:

-----------------------------------
31   30      17   16   15          0  
-----------------------------------
FNE    Undefined   PFW    Command Word   
-----------------------------------

Command Word
16-bit command word
PFW
Packet First Word Flag
FNE
FIFO-Not-Empty

4.3.6 Downlink Transfer Controller

This section describes the behavior of the Back End Processor's Downlink Transfer Controller (DTC). This controller is responsible for sending telemetry packets from bulk, uncached memory, to the Remote Command and Telemetry Unit (RCTU) interface hardware. The software initiates a packet transfer by programming the start address and end address of the block of words to telemeter, and then enabling the controller via the Back End's Control Register (see Section 4.3.2 ). Once enabled, the controller autonomously copies words from the bulk memory to the RCTU interface as the spacecraft demands telemetry data from the serial data port. Once the last word has been copied from bulk to the controller's RCTU interface logic, the DTC causes an interrupt to indicate that a new transfer may be started.

The DTC provides effectively a 64-bits FIFO between bulk memory and the RCTU. If no data is available to send when the spacecraft asks for data, the DTC supplies a fill pattern, 0xb7

The RCTU will request data no faster than 128Kbps. To avoid the fill pattern when there is data to send, the software has 0.5ms after being interrupted to start a new transfer.

The transfer controller uses a page-based addressing scheme, where each page contains 4096 continguous 32-bit words. Each programmed transfer must be within a 4096 word page block, and must not cross a page boundary.

4.3.6.1 DTC Start Address Register (0xA0180018)

This register specifies the starting location of a block of data to be telemetered by the Downlink Transfer Controller. The addresses stored in this register must be within bulk (uncached) memory, and must be on a 32-bit boundary. The following illustrates the format of the start address register:

---------------------------------------------------------------
31  20  19              14  13                      2  1      0  
---------------------------------------------------------------
Unused    DTC Page Address    12-bit Longword Address    Unused   
---------------------------------------------------------------
12-bit Longword Address
This is the offset, relative to the start of the page, of the first 32-bit word to transfer.
DTC Page Address
This is the page containing the data to transfer

To set the starting address of the transfer, take the virtual address of the buffer in bulk memory, and mask off the lower two bits and upper 12 bits of the address and write the result in to the DTC Start Address Register.

4.3.6.2 DTC End Address Register (0xA018001C)

This register specifies the last location of a block of data to be telemetered by the Downlink Transfer Controller. The addresses stored in this register must be within bulk (uncached) memory, must be on a 32-bit boundary, and must be greater than the current address stored in the DTC Start Address Register. The format of this register is identical to the DTC Start Address Register, except that the DTC Page Address bits are unused.

4.3.6.3 DTC Address Count Register (0xA0180020)

This register specifies the current longword count of a DTC transfer in progress. Bits 0 and 1 always read back as zero.

4.3.7 DEA Command Register (0xA0180010)

This section describes the Back End Processor's Detector Electronics Assembly (DEA) Command Register. This register is used to send command words to one or more of the DEA subsystems. When a word is written into this register, the hardware sets the DEA Command Port busy flag in the Back End's Status Register (see Section 4.3.3 ), and serially shifts the command word to the DEA. Once the entire command has been sent to the DEA, the hardware de-asserts the busy flag in the status register, indicating that the port is ready for the next command.

---------------------------------
31  24  23                      0  
---------------------------------
unused    DEA to DPA Command Word   
---------------------------------

4.3.8 DEA Status Register (0xA018000C)

This section describes the Back End Processor's Detector Electronics Assembly (DEA) Status Register. This register is used to hold 24-bit status words sent by one of the DEA to the Back End Processor in response to a query command. Once a status word has been received, the hardware sets the DEA Status Port has data flag in the Back End Processor's Status Register (see Section 4.3.3 ). This flag remains asserted until cleared by writing a `1' to the "Clear DEA Status Port ready flag" in the Pulse Register (see Section 4.3.8 ).

4.3.9 S/C Counter - Latched Count (0xA0180024)

This register contains a 32-bit value of the Spacecraft counter. This value indicates the time of the last command sent to the DEA..

4.3.10 S/C Counter - Running Count(0xA0180028)

This register contains a 32-bit value of the running Spacecraft counter.

4.3.11 FEP Shared Memory Interface (0xA8000000)

This section describes the Back End Processor's interface to each Front End Processor's shared memory section. Each Front End Processor contains several sections of memory, including the Front End Processor's Boot RAM, which are shared with the Back End Processor. These memory sections are mapped into the Back End Processor's virtual address space, and can be read from and written to simultaneously by Front End Processor and the Back End Processor. The shared memory interfaces are used by the Back End Processor to perform the following functions:

The base address for the FEP shared memory is listed in the memory map (and above). To access the shared memory for a particulare FEP, the fep id (0x00 - 0x05) is added to the upper 16 bits of the base address.

4.3.12 BEP to FEP Command Registers

The BEP to FEP Command registers physically reside in each Front End Processor, but are controlled by the Back End Processor via the shared memory interface. See section Section 4.4.10 for a detailed explanation of these registers.

4.3.13 Interrupts

This section describes the Back End Processor interrupts. The following table lists the interrupts used by the Back End Processor, describes the priorities, interrupt input assignments and timing requirements of each interrupt:

TABLE 7. Back End Processor Interrupts

-------------------------------------------------------------------------------------------
Priority     Input    Name           Causes                       Response   Frequency       
(0 highest)                                                        Time                      
-------------------------------------------------------------------------------------------
0            INT0     Command        Command Ready,               < 1ms     peak 4/second    
                      Interrupt      Length Error,                          avg. 1/hour      
                                     FIFO Full                                               
1            INT1     DTC Interrupt  Telemetry transfer complete  Goal <    peak 100/second  
                                                                  0.5ms     avg. 3/second    
2            INT3(a)  Timer Tick     Timer Count expired          < 1ms     10/second        
3            INT3(b)  DMA Done       DMA Transfer Complete        < 1ms     Varies on trans  
                                                                            fer length       
4            INT2     FEP Interrupt  One or more FEPs request     < 10ms    peak 60/second   
                                     ing service                            avg. 10/second   
5            INT4     RadMon         Radiation Monitor Asserted   < 10ms    peak 4/second    
                                                                                             
-------------------------------------------------------------------------------------------

(a)
Mongoose Extended Interrupt - Timer EOC (see Section4.2.5 )

(b)
Mongoose Extended Interrupt - DMA Done (see Section4.2.5 )

4.4 Front End Processor Hardware Interfaces

The following sections describe the Front End Processor hardware interfaces. This information is taken from the "DPA Hardware Specification and System Description, Rev. 04," by Dorothy Gordon, MIT Drawing Number 36-02104. Additional information is included in advance of future publications of this document, and is marked as TBD.

NOTE: Although the BEP to FEP Command Registers physically reside on each FEP, they are under the control of the BEP and serve as BEP to FEP interface, and are described in Section 4.3.12 .

4.4.1 Memory Map Overview

This section illustrates the overall Front End Processor hardware memory map:

TABLE 8. Front End Processor Memory Map Overview

------------------------------------------------------------------------------------------------
Virtual      Byte Size  Name                   Use                                                
Address                                                                                           
------------------------------------------------------------------------------------------------
0xbfc00000   0x8000     Boot RAM               Contains Bootstrap loader software (see Sec        
aliased to                                     tion Section 40.0 ) and Microboot Control          
portion of                                     Word (see Section 4.2.1 ). This area MUST be       
Auxiliary                                      loaded by the Back End Processor via the           
Image Data                                     shared memory interface prior to releasing the     
area                                           FEPs reset line.                                   
0xbf800000   N/A        External Debug Board   Used for developement and pre-flight testing       
0xbf400000   0x30       Mongoose CSI Sub       see Section 4.2                                    
                        block                                                                     
0xa0c00000   12Mbits    Bias Map Memory        Stores one 12-bit bias value for each pixel in a   
                                               CCD image. The bias values are set by soft         
                                               ware.                                              
0xa0800000   12Mbits    Image Memory           Contains 12-bit image pixel values read by the     
                                               FEPs image acquisition hardware                    
0xa0401000   0x40       Image Control Regis    see below                                          
                        ters                                                                      
0xa0400000   0x18       FEP I/O Devices        see below                                          
0xa0000000   1.5MB      Auxiliary Image Data   Contains scratch data space, overclock pixel       
                        (Bulk Memory)          buffers, threshold bit-plane, bias parity error    
                                               plane, BEP-to-FEP command mailbox, FEP-            
                                               to-BEP request mailbox, FEP-to-BEP ring            
                                               buffer. A portion of this RAM is also used for     
                                               the Boot RAM area. If the Boot RAM area is         
                                               used for another purpose when the system is        
                                               running, the BEP is required to re-load the        
                                               area prior to re-booting the FEP.                  
0x80080000   0x20000    Instruction Cache      Contains copy of code loaded from the BEP          
                        (SEU-immune)           using a program loaded by the BEP into the         
                                               FEP's Boot RAM.                                    
0x80000000   0x20000    Data Cache             Contains data space for run-time stacks, and       
                        (SEU-immune)           FEP program data.                                  
                                                                                                  
------------------------------------------------------------------------------------------------

4.4.2 Control Register (0xA0400000)

This section describes the Control Register residing on each Front End Processor. This register controls the state of various Front End Processor devices. The format of this register is as follows:

-------------------------------
31    2       1           0      
-------------------------------
 unused   OCLOCKWENB  TPLANEWENB  
-------------------------------
TPLANWENB
Enable writes to the threshold plane.
OCLOCKWENB
Enable writes into the overclock buffer.

4.4.3 Status Register (0xA0400004)

This section describes the Status Register residing on each Front End Processor. This register supplies the current state of various Front End Processor devices. The format of this register is as follows:

-------------------------------------------
31    7  6    4       2             1        
-------------------------------------------
 unused    FEPID   WDOGRSTLAT   BEPTOFEPINTLAT   
-------------------------------------------
BEPTOFEPINTLAT
Indicates interrupt received from BEP.
WDOGRSTLAT
Indicates if last reset was caused by watchdog timeout.
FEPID
FEP id.

4.4.4 Pulse Register (0xA0400008)

This section describes the Pulse Register residing on each Front End Processor. This register resets various status and interrupt conditions. The format of this register is as follows:

-------------------------------------------
31    3       2          1           0       
-------------------------------------------
 unused   CLRWDOGRST   CLRBEPINT   FEPTOBEPINT   
-------------------------------------------
FEPTOBEPINT
Generates interrupt to BEP.
CLRBEPINT
Clear BEP interrupt latch.
CLRWDOGRST
Clears WDOGRSTLAT in FEP status register.

4.4.5 FEP Image Buffer (0xA0800000

Each Front End Processor contains a region of memory into which the image acquisition hardware stores incoming pixels. The buffer can hold a 1024 x 1024 pixel image. Each pixel is stored as a 12-bit value. From the software point of view, 16-bit reads from a given location return the pixel pulse height in the least significant 12-bits, and zeros in the remaining 4-bits. 32-bit reads return two pixels. The least significant half of the word represents one pixel in the row, and the most-significant half represents the pixel in the next column (or the first pixel in the next row if at the end of a row).

Whether or not an image is written to the image buffer by the hardware is controlled using the "enable next image" flag in the Image Pulse Register (see Section 4.4.15 ). If the "enable next image" flag is asserted when a new image arrives at the FEP, the hardware de-asserts the flag, and starts writing the new image into the image buffer. If the flag is de-asserted when a new image arrives, the hardware silently discards the image data until the next image. The hardware continues to discard data until an image arrives and the flag has been asserted by the software.

4.4.6 FEP Pixel Bias Map (0xA0C00000)

Each Front End Processor contains a region of memory which is used to contain 12-bit pixel bias values. Each pixel bias value in the map corresponds to a pixel in the image buffer. Prior to processing data, the software running on the FEP computes the bias level for a given pixel and stores the bias value into this map. As the hardware acquires pixel data, it subtracts the bias value from the pixel data and compares the result to the value contained in a threshold register. If the pixel minus its bias value is greater than the threshold register value, the hardware sets a bit in a threshold plane corresponding to the pixel.

Each 16-bit location within the bias map corresponds to 1 pixel. The least-significant 12-bits are the bias value for the corresponding pixel. The next significant bit is a copy of the parity bit for the bias map value. The most significant bit in the 16-bit word is the parity error bit. If this bit is set, then one or more of the bits within the pixel bias map entry, or the pixel parity bit, have been corrupted (see Section 4.4.7 ).

4.4.7 FEP Pixel Bias Parity Plane

Since pixel bias map memory is vulnerable to single-event upsets (SEUs), and that pixel bias values are used over an entire science run, the hardware provides a pixel bias parity plane. Each bit corresponds to one pixel bias map location. The memory for the plane can be located anywhere within Auxiliary Image Data memory on a 64K byte boundary, and is set by the software using the Bulk Memory Segment Allocation Register Section 4.4.9 . The hardware uses ODD parity, meaning that if there are an even number of `1s' in a given pixel bias map value, the corresponding parity bit is set to `1' to make the total come out to an odd number. If there are an odd number of `1s', then the parity bit is `0.'

4.4.8 FEP Threshold Plane

Each pixel in the image buffer has a corresponding bit in the threshold bit plane. The location of the threshold plane can be anywhere within the Auxiliary Image Data memory, and is set by software via the Bulk Memory Segment Allocation Register Section 4.4.9 . As images are acquired by the hardware, the threshold logic compares the pixel value minus its bias map value, to the threshold register associated with the pixel's column. If the adjust pixel pulse height exceeds the threshold register level, the hardware sets the corresponding bit in the threshold plane to `1.' Otherwise, it sets the bit to `0.' The software uses the threshold plane to quickly search for candidate events, 32 at a time.

4.4.9 Bulk Memory Segment Allocation Register (0xA0400008)

This section describes the Bulk Memory Segment Allocation Register residing on each Front End Processor. This register designates which segment of the bulk memory contains the bias map parity plane, the pixel threshold plane and the overclock buffer. The format of this register is as follows:

------------------------------------------
31    9  11      8  7        4  3        0  
------------------------------------------
 unused    OCLKSEG    TPLNESEG    PPLNESEG   
------------------------------------------
PPLNESEG
Page where parity plane is stored.
TPLNESEG
Page where threshold plane is stored.
OCLKSEG
Page where overclock buffer is stored.

4.4.10 BEPtoFEP Command Register (0xA040000C)

This section describes the BEPtoFEP command register. This register is actually controlled by the BEP and is read-only to the Front End Processor. It allows the BEP to reset and interrupt a particulare FEP. The format of this register is as follows:

------------------------------
31    2      1          0       
------------------------------
 unused   FEPReset   BEPTOFEPInt   
------------------------------
BEPTOFEPInt
Generate an interrupt in the FEP.
FEPReset
Reset the FEP.

4.4.11 Latched Timestamp Register (0xA0400020)

This register contains a 24-bit latched timestamp of the FEP slave counter. It is set upon the detection of a beginning of frame from the DEA sequencer.

4.4.12 Running Timestamp (0xA04000014)

This register contains a 24-bit running timestamp of the FEP slave counter.

4.4.13 Image Control Register (0xA0401000)

This section describes the Image Control Register residing on each Front End Processor. This register controls the state of various Front End Processor devices relating to image processing. The format of this register is as follows:

--------------------------------------
31    2     1      6    5     4   3  0   
--------------------------------------
 unused   BIASEN   PAREN    CNTMODE   UPDN   
--------------------------------------
UPDN
Count direction of four video chain (VC) cameras. 1 bit per counter, 0 indicates "count up", 1 indicates "count down".
CNTMODE
Number of VC counters used to calculate the image address. (00 - use 1, 01 use 2, 1x - use 4)
PAREN
Enabel parity checking
BIASEN
Enable use of bias map.

4.4.14 Image Status Register (0xA0401004)

This section describes the Image Status Register residing on each Front End Processor. This register supplies the current state of various Front End Processor devices related to the image processing. The format of this register is as follows:

---------------------------------------------
31    5      4         3         2        1    
---------------------------------------------
 unused   NXTACQENB   SQERROR  PARERRPR   BOFINT   
                                               
---------------------------------------------
BOFINT
Beginning of Frame interrupt.
PARERROR
Parity error detected.
SQERROR
Sequencer error detected.
NXTACQENB
Feedback of corresponding pulse register bit.

4.4.15 Image Pulse Register (0xA0401004)

This section describes the Pulse Register residing on each Front End Processor. This register resets various status and interrupt conditions. The format of this register is as follows:

-------------------------------------------------------
31    4      3           2            1           0      
-------------------------------------------------------
 unused   ARMNXTACQ   CLRSEQERROR   CLRPARERROR   CLRBOFINT   
-------------------------------------------------------
CLRBOFINT
Clears BOF interrupt latch..

CLRPARERROR
Clears Parity Error latch.

CLRSEQERROR
Clears Sequencer Error latch.
ARMNXTACQ
Enable hardware to capture next image.

4.4.16 FEP Threshold Registers (0xA0401010)

Each CCD has four output nodes, each of which feed an associated video chain within the DEA. Within an acquired image, some columns of pixels are produced from one output node, the next group of columns another, and so on. Each Front End Processor has four threshold registers, one for each video chain. As images are acquired by the FEP hardware, their adjusted pixel values are compared with the contents of the threshold register corresponding to the node which produced the pixel. The threshold value is a 14-bit 2's complement number.

4.4.17 StartCnt Registers (0xA0401020)

There are four start counts, one per video chain (VC) counter. The start count is a 10-bit unsigned value.

4.4.18 Image Start Address (0xA0401030)

The image start address is a 10-bit value which determines where the address generator starts writing values into the image memory for each exposure.

4.4.19 CCD Start Address (0xA0401034)

The CCD start address is a 10-bit value which determines how many rows, if any, of a CCD image frame that should be skipped before enabling active image acquisition.

4.4.20 CCD Num Rows (0xA0401038)

The CCD number of rows is a 10-bit value which determines how many rows of a CCD image frame are included in the active image frame.

4.4.21 CCD Select (0xA040103C)

The CCD select is a 4-bit value which indicates which CCDs are active. A value of 0-9 selects one of the 10 CCD inputs driven by the DEA. A value of A-F disables image acquistion.

4.4.22 Interrupts

This section describes the Front End Processor Interrupts. The Front End Processor hardware supports three external interrupts, and all Mongoose Extended Interrupts. The software running on a Front End Processor expects to use only two of these interrupts. The following table lists the interrupts used by the Front End Processors, interrupt input assignments and timing requirements of each interrupt:

TABLE 9. Front End Processor Interrupts

------------------------------------------------------------------------------------
Input    Name      Causes                             Response Time  Frequency        
------------------------------------------------------------------------------------
INT0     BEPINT    Back End Processor (not cur        -              -                
                   rently used)                                                       
INT1     BOFINT    DEA PRAM-generated Begin           < 0.1ms        peak 10/second   
                   ning of Image Frame                                                
INT2     SEQERR    Sequencer Error Detected (not      -              -                
                   currently used)                                                    
INT3(a)  DMA Done  DMA transfer complete              < 0.1ms        Varies on tranf  
                                                                     ser length       
INT4     PARERR    Bias Pixel Map Parity Error (not   -              -                
                   currently used)                                                    
------------------------------------------------------------------------------------

(a)
Mongoose Extended Interrupt - DMA Done (see Section4.2.5 )

4.5 Nucleus Real-Time Executive Functions and Formats

This section lists the interfaces to Nucleus RTX, by Accelerated Technologies Inc. The information presented in this section is derived from the "Nucleus RTX Reference Manual," by Accelerated Technology, Inc.

The structure definitions and function prototypes are supplied with the Nucleus source code distribution, under a source code license agreement with MIT, and are not provided in this document.

4.5.1 Configuration and Startup

This section describes how Nucleus RTX is configured during startup. Nucleus RTX is configured using a set of named data structures, initialized prior to starting Nucleus. In the RTX documentation, the provided examples initialize these structures are initialized at compile time, although there is no reason they cannot be filled at run-time, prior to starting the executive.

The first data location that Nucleus RTX may use to allocate its structures during startup is delimited by the address of the unsigned pointer variable IN_Last_Address_Used. After startup, the contents of IN_Last_Address_Used indicates how much memory has been used by Nucleus. The unsigned pointer variable IN_Last_Memory_Address points to the very last memory location available to Nucleus RTX.

NOTE: If the dynamic heap feature of Nucleus is used, after initialization, Nucleus uses the space between the locations pointed to by the IN_Last_Address_Used and IN_Last_Memory_Address as its general purpose memory heap. ACIS does not use this feature.

4.5.1.1 Task Setup

Nucleus RTX tasks are configured using an array of Task Definition Structures named IN_System_Tasks. Each structure entry within the array defines a Nucleus RTX task, where the array index of the entry defines the RTX Task Id of the corresponding task. Each entry defines the starting address of the task, the size of the task's stack in 32-bit words, the priority of the task, whether or not to start the task upon startup, whether or not the task allows preemption when it is started, and whether or not to time-slice the task, and if so, how many timer-ticks to allow the task to run in its slice. The end of the array is delimited by an entry whose task address is 0.

4.5.1.2 Memory Pool Setup

Nucleus RTX fixed size memory pools are configured using an array of Fixed Partition Structures named IN_Fixed_Partitions. Each structure entry within the array defines a Nucleus RTX fixed size pool of memory buffers, where the array index of the entry defines the RTX Pool Id of the corresponding pool. Each entry specifies the number of 32-bit words in a single buffer in the pool, and the number of buffers to maintain in the pool. The end of the array is delimited by a entry which specifies zero for the buffer size.

4.5.1.3 Queue Setup

Nucleus RTX queues support a pre-configured number of fixed size items. The queues are configured using an array of Queue Definition Structures named IN_System_Queues. Each structure entry within the array defines a Nucleus RTX queue, where the array index of the entry defines the RTX Queue Id of the corresponding queue. Each entry specifies the number of items which can be held by the queue, and the size of an item, in 32-bit words. The end of the array is delimited by a entry which specifies a queue capacity of zero items.

4.5.1.4 Event Group Setup

Nucleus RTX event groups are configured by specifying the number of desired groups in the IN_System_Event_Groups unsigned integer variable. The event group identifiers will range from 0 to (IN_System_Event_Groups - 1).

4.5.1.5 Semaphore Setup

Nucleus RTX semaphores are configured by specifying the number of desired semaphores in the IN_System_Resources unsigned integer variable. The semaphore identifiers will range from 0 to (IN_System_Resources - 1).

4.5.2 Task Management Functions


This section lists and briefly describes each of the Nucleus functions used to manage tasks.

4.5.2.1 NU_Change_Priority()
Inputs
Nucleus Task Id
New Priority
Outputs
Success or error code
Description
This function changes the priority of the task specified by the Task Id.

4.5.2.2 NU_Change_Time_Slice()
Inputs
Nucleus Task Id
New Time Slice
Outputs
Success or error code
Description
This function changes the time-slice of the task specified by the Task Id.

4.5.2.3 NU_Control_Interrupts()
Inputs
Whether to enable or disable interrupts
Outputs
Previous interrupt state
Description
This function enables or disables interrupts, returning the previous interrupt state.

4.5.2.4 NU_Current_Task_Id()
Inputs
None
Outputs
Task Id of currently running task
Description
This function returns the id of the currently running task, or the task which was interrupted if this function is called within an interrupt handler.

4.5.2.5 NU_Disable_Preemption()
Inputs
None
Outputs
None
Description
This function disables preemption of the currently running task by another task. Calls to this function may made more than once. To re-enable preemption, an equal number of calls to NU_Enable_Preemption() must be made

4.5.2.6 NU_Enable_Preemption()
Inputs
None
Outputs
None
Description
Each call to this function unwinds one previous call to NU_Disable_Preemption(). Once unwound, other tasks may preempt the currently running task.

4.5.2.7 NU_Relinquish()
Inputs
None
Outputs
None
Description
This function causes the currently running task to yield control to other tasks of the same priority.

4.5.2.8 NU_Reset()
Inputs
Task Id
Outputs
Success or error
Description
This function resets the state of the task specified by Task Id. The task must be in a stopped state at the time of this call.

4.5.2.9 NU_Retrieve_Task_Status()
Inputs
Task Id
Outputs
Success or error
Running state or reason for suspension
Number of times task has been scheduled
Description
This function retrieves the current status of the task specified by Task Id.

4.5.2.10 NU_Sleep()
Inputs
Number of Timer Ticks
Outputs
None
Description
This function causes the current task to suspend for the specified number of Timer Ticks (in ACIS, each timer tick is 1/10 second).

4.5.2.11 NU_Start()
Inputs
Task Id
Outputs
Success or error
Description
This function causes the task specified by Task Id to resume execution from a stopped state. If the task was never started, or if has been reset via NU_Reset() it will start execution from the start address specified in the initial configuration (see Section 4.5.1.1 ). If it was stopped via a call to NU_Stop(), but not reset, it will resume execution from the point at which it was stopped.

4.5.2.12 NU_Stop()
Inputs
Task Id
Outputs
Success or error
Description
This function causes the active task specified by Task Id to stop execution, until started via NU_Start().

4.5.3 Event Management Functions


Nucleus manages events using Event Groups. An individual Event Group can contain 32 distinct event flags (i.e. the number of bits in an unsigned integer).

4.5.3.1 NU_Set_Events()
Inputs
Event Group Id
Operation (AND or OR)
List of Events
Outputs
Success or Error
Description
This function logically modifies the events in the indicated event group based on the input operation. If an AND operation is specified, the event list is ANDed with the event flags in the group (i.e. events which are not in the list are de-asserted within the group). If an OR operation is selected, the event list is ORed with the event flags in the group (i.e. events in the list are asserted within the group).

4.5.3.2 NU_Wait_For_Events()
Inputs
Event Group Id
Operation (wait for all, wait for one or more)
De-assert events option
List of Events
Time-out Selection (immediate, never, or # ticks)
Outputs
Success, time-out, or error
Received events
Description
This function suspends the current task until the desired event conditions are met, or until the time-out expires. The input operations include: Wait until all listed events are asserted in the group; wait until one or more of the listed events are asserted in the group. The caller also has the option to de-assert the indicated event(s) once they've been detected.

4.5.4 Resource Management Functions


Nucleus refers to semaphores as "resources."

4.5.4.1 NU_Release_Resource()
Inputs
Resource Id
Outputs
Success or error
Description
This function releases the indicated resource (semaphore). The resource must have been previously allocated via NU_Request_Resource().

4.5.4.2 NU_Request_Resource()
Inputs
Resource Id
Time-out Selection (immediate, never, or # ticks)
Outputs
Success, time-out, or error
Description
This function suspends the current task until the indicated resource (semaphore) is available, and then allocates the resource.

4.5.4.3 NU_Retrieve_Resource_Status()
Inputs
Resource Id
Outputs
Success or error
Number of tasks requesting resource
Description
This function returns the number of tasks attempting to obtain the indicated resource. 0 indicates that the resource is available, 1 indicates that the resource is allocated, but no other tasks are waiting for it, and 2 or greater indicates that one or more tasks are suspended, waiting for the resource.

4.5.5 Queue Management Functions


Nucleus manages fixed length first-in/first-out lists of fixed size items using pre-configured queues.

4.5.5.1 NU_Force_Item_In_Front()
Inputs
Queue Id
Item
Outputs
Success or error
Description
This function copies the supplied item into the front of the identified queue. If the queue is full, the last item in the queue is discarded.

4.5.5.2 NU_Retrieve_Item()
Inputs
Queue Id
Time-out selection (immediate, never, # ticks)
Outputs
Success or error
Copy of de-queued item
Description
This function suspends the current task until the identified queue has an item. It then copies the first item in the queue and removes it from the queue.

4.5.5.3 NU_Retrieve_Item_Multi()
Inputs
Three Queue Ids
Time-out selection (immediate, never, # ticks)
Outputs
Success, queue(s) empty, time-out, or error
Copy of de-queued item
Description
This function suspends the current task until one of the three identified queues is not empty, and then attempts to retrieve one item from the queue. The function copies the first item and removes it from the queue.

4.5.5.4 NU_Retrieve_Queue_Status()
Inputs
Queue Id
Outputs
Success or error
Number of items current in queue
Size of a single item in the queue
Description
This function returns the number of items currently in the identified queue, and the item size supported by the queue (in 32-bit words).

4.5.5.5 NU_Send_Item()
Inputs
Queue Id
Item
Time-out selection (immediate, never, # ticks)
Outputs
Success, queue full, time-out, or error
Description
This function suspends the current task until the identified queue has room to store an additional item, and then copies the supplied item to the end of the queue.

4.5.6 Memory Partition Functions


Nucleus supplies two types of memory management services. The first is a general-purpose memory heap, which supports allocation of arbitrarily sized buffers from a common area. ACIS does not use this service, and its functions are not described in this document. The second type of management supports a pre-configured number of memory pools, each of which manages a fixed number, of fixed size buffers. The following describe the functions which manipulate these pools.

4.5.6.1 NU_Alloc_Partition()
Inputs
Partition Id
Time-out selection (immediate, never, # ticks)
Outputs
Success, partition empty, time-out, or error
Allocated buffer address
Description
This function suspends the current task until the identified partition has a buffer available, and then allocates the buffer and returns the buffer address to the caller.

4.5.6.2 NU_Available_Partitions()
Inputs
Partition Id
Outputs
Success or error
Number of available buffers
Description
This function returns the number of free buffers currently available in the indicated partition.

4.5.6.3 NU_Dealloc_Partition()
Inputs
Allocated buffer address
Outputs
Success or error
Description
This function releases an allocated buffer back to its partition.

4.5.7 Time Management Functions


Nucleus keeps track of a system timer tick counter, and provides functions to set and read this counter.

4.5.7.1 NU_Read_Time()
Inputs
None
Outputs
Current value of system clock
Description
This function returns the value of its timer tick counter, the system clock. Within ACIS, this counter increments with each timer-tick interrupt (10 per second).

4.5.7.2 NU_Set_Time()
Inputs
Initial clock value
Outputs
None
Description
This function stores the indicated value into the system clock. This value is subsequently advanced with each timer-tick interrupt (10 per second). The current value of the clock is obtained using NU_Read_Time().

4.5.8 Low-level Functions


In order to provide its services, Nucleus requires that certain functions be invoked at certain times.

4.5.8.1 INP_Initialize()
Inputs
Initialized configuration tables
Outputs
None
Description
This function starts Nucleus. This function must be invoked prior to using any of the Nucleus service routines, and requires that the Nucleus configuration tables are initialized. This function starts the multi-tasking executive and never returns.

4.5.8.2 SKD_Interrupt_Context_Save()
Inputs
None
Outputs
None
Description
This function must be called by the ACIS interrupt handler, prior to calling any "C/C++" functions or Nucleus service functions. This function saves the registers associated with the interrupted task. This function is an integral part of the context switching features of Nucleus.

4.5.8.3 SKD_Interrupt_Context_Restore()
Inputs
None
Outputs
None
Description
This function must be called by the ACIS interrupt handler to restore the previously saved register context, and to return control to the next task scheduled to run. This function restores the registers associated with the task being resumed.

4.5.8.4 CLD_Timer_Interrupt()
Inputs
None
Outputs
None
Description
This function must be called by the ACIS timer-tick interrupt handler to advance Nucleus's system clock, and to cause Nucleus to perform any time-based scheduling operations.

4.6 Command Packet Formats

The command packet formats for the ACIS instrument software are defined in the "ACIS Instrument Program and Command Language List," MIT 36-01410.

4.7 Telemetry Packet Formats

The telemetry packet formats for the ACIS instrument software are defined in the "ACIS Instrument Program and Command List," MIT 36-01410.

4.8 DEA Command and Status Formats

This section describes the interface to the Detector Electronics Assembly. The information described in this section is taken from the "DPA/DEA Interface Control Document," MIT 36-02205.

4.8.1 Command Format

DEA command words are 24-bits wide. Each command word takes about 25us to transmit to the DEA. When written into the DEA command port register, the upper 8-bits of the 32-bit word are ignored. The following illustrates the format of commands to the DEA:

---------------------------------------------------
31                      24  23    22    21   20      0  
---------------------------------------------------
 Unused (not sent to DEA)   CS   R/W   A/D    Argument   
                                                     
---------------------------------------------------
Argument
This field may contains data, address, or card selection arguments depending on bits 21:23.
A/D
Address/Data selector [0:Argument is Data, 1:Argument is Address]
R/W
Read/Write selector [0: Write, 1: Read]
CS
Card Selection Command [0: Register Command, 1: Card Select Command]

The following illustrates the argument format for Card Selection commands (CS=1):

-------------------------------------
20  16  15        12  11   10        0  
-------------------------------------
   0     Read Select    0    Write Mask   
                                       
-------------------------------------
Write Mask
This is a bit-field where each bit corresponds to one CCD Controller board. Bit 0 corresponds to board 0, bit 1 to board 1 and so on. When a bit is `1', the corresponding board is enabled, and will execute subsequent register sent to the DEA. When a bits is `0' the corresponding board ignores subsequent register commands sent to the DEA.
Read Select
This field selects which DEA board (CCD Controller, or System Control Board) will respond to a subsequent query. Only one such board can be enabled at a time.

The following table maps combinations of CS, R/W and A/D to specific command types:

TABLE 10. Command Types

---------------------------------------------------------------------------------------
CS  R/W  A/D  Argument     Command Type                                                  
---------------------------------------------------------------------------------------
0   0    0    Data         Write "argument" value to device/memory location indexed by   
                           address register                                              
0   0    1    Address      Write "argument" to address register                          
0   1    0    Unused       Read data from device/memory location indexed by address      
                           register                                                      
0   1    1    Unused       Read back address from address register                       
1   0    X    Card Select  Write card select word into all powered DEA boards            
1   1    X    Card Select  Read back card select from DEA board indexed by Read          
                           Select field.                                                 
---------------------------------------------------------------------------------------

4.8.2 Status Format

Status words, sent by one of the DEA boards in response to a command, are 24-bits in length. The response time to a command requesting status can be up to 100us. When read from the 32-bit DEA Status Port register, the unused upper 8-bits will have an unspecified value. The detailed format of a particular status response depends on the device being queried on the DEA.

4.8.3 DEA Boards and Devices

4.8.3.1 Board Register Memory Map

Each DEA board has a collection of memory-mapped registers and RAM. Each of these registers or locations is selected by writing to the board's address register (see Section 4.8.1 ). The addressed register or location is then read or written using a subsequent command. The following illustrates the DEA board memory map:

TABLE 11. DEA Memory Map

---------------------------------------------------------------------------------------
Device/        Address Range    Description                                              
Memory                                                                                   
Section                                                                                  
---------------------------------------------------------------------------------------
SRAM           0:0x7fff         Sequencer RAM (see Section 4.8.3.5 for the word format)  
PRAM           0x8000:0xffff    Program RAM (see Section 4.8.3.4                         
Subsystem      0x10000:0x1003f  Collection of various control/status registers           
Registers                                                                                
DAC Registers  0x10040:0x1005f  Collection of Digital-to-Analog Converters (Write-only)  
Housekeeping   0x10008:0x100ff  Collection of Housekeeping devices (Read-only)           
Registers                                                                                
---------------------------------------------------------------------------------------
4.8.3.2 Digital-to-Analog Converters

The command and status formats for the DACs are TBD.

4.8.3.3 Housekeeping Query Command and Status Formats

The Housekeeping command and status formats are TBD.

4.8.3.4 PRAM Format

The Sequencer Program RAM (PRAM) consists of an array of pairs of 16-bit words, organized into blocks. Each block starts with a header block, which specifies the number of times to repeat the block, and the number of subsequent pairs of words belong to the block. The format of this header is as follows:

---------------------------------------------
15   14    13    12   11                      0  
---------------------------------------------
 1    1     Option     PRAM Block Repeat Count   
 1    0    Page Jump         Couplet Count        
---------------------------------------------
PRAM Block Repeat Count
This specifies the number of times to repeat the entire block
Option
This specifies the next sequence option [0: Restart, 1:Continue, 2:Halt, 3:Page Jump]
Couplet Count
This specifies the number of PRAM word pairs (couplets) following the block
Page Jump
If Option is 3, this specifies the PRAM page to jump to

The following illustrates the format of the PRAM couplets within a block:

------------------------------------------
15   14   13     12   11      5  4   3      0  
------------------------------------------
 0    1     SRAM Page Address    0    PixCode   
 0    0     0     0      Major Cycle Count    
------------------------------------------
PixCode
This code is sent to the Front End Processor with each major cycle (pixel). Its values are TBD.
SRAM Page Address
This specifies which block of 64 SRAM blocks should be sequenced during a major cycle.
Major Cycle Count
This specifies how many times to repeat the selected SRAM block
4.8.3.5 SRAM Format

SRAM words are organized int blocks of 64 16-bit words. Each bit of the 16-bit word drives the state of one of the CCD or DEA clock signals. Spread over the period of 1 major cycle (1 pixel), the sequencer steps through each word in the 64 word block, driving the states of the clocking signals.

The bit assignments for the SRAM words are TBD.

4.9 BEP to FEP Communication Protocol

The following sections describe the communication protocol used between the Back End and Front End Processors.

4.9.1 Shared Memory Interface

This section describes the shared memory interface between the Back End and Front End Processors. Sections of each Front End Processor's memory, and some of its device ports, are mapped into the Back End Processor's address space. These memory sections are used by the Back End Processor to load and run code in the FEPs, and to interactively communicate with the FEPs while processing science.

The FEP sections and addresses, and the corresponding BEP addresses are TBD.

4.9.2 FEP Boot Procedure

This section describes the procedure used by the Back End Processor to start up each of the Front End Processors.

To start a Front End Processor, the Back End Processor performs the following steps:

  1. Power on the FEP (if it does not already have power). The FEP will come up in a reset state. Wait for at least 100ms before performing any other actions.

  2. If the power was already on, assert the reset line to the FEP (if is not already asserted)

  3. Load the Microboot Control Word to the last shared memory location of the FEP's Boot RAM

  4. Load boot start-up code to the reset vector location in the FEP's Boot RAM (0xbfc00000)

  5. Load the remainder of the boot-strap code into shared memory.

  6. Release the FEPs reset line to run the loaded boot-strap code.

  7. Complete the load using the running boot code.

NOTE: If the FEP's Watchdog timer expires, the FEP will assert and hold its reset line and generate an interrupt on the BEP. The BEP can then determine what action, if any, it needs to take to restart the FEP.

4.9.3 BEP to FEP Command Mailbox

This section describes the format of the BEP to FEP Command Mailbox. This mailbox is used to pass commands from the BEP to the FEP, and the FEP's reply to the command back to the BEP. The software on each Front End Processor establishes one of this type of mailbox at address TBD. The total length of the mailbox is 512 bytes. The format of this mailbox is as follows:

TABLE 12. BEP to FEP Command Mailbox Format

---------------------------------------------------------------------------------
Field  Type           Range                   Description                          
---------------------------------------------------------------------------------
state  enum           MBOX_NO_MESSAGE = 0,    This field indicates the current     
                      MBOX_NEW_MESSAGE = 1,   state of the mailbox.                
                      MBOX_REPLY_RDY = 2                                           
len    unsigned       1:129                   This field contains the length of    
                                              the remainder of the message, in     
                                              units of 32-bit words.               
type   int            TBD                     This field identifiers the type of   
                                              message and distinguishes whether    
                                              the command is handled by the        
                                              FEP's I/O library, or by the FEP's   
                                              Science Processing code.             
args   unsigned[128]  -                       This array contains any arguments    
                                              associated with "type."              
---------------------------------------------------------------------------------

NOTE: A detailed description of how science uses this mailbox is provided in Section 4.10 .

The dialog scenario for using the Command Mailbox is as follows:

4.9.4 BEP to FEP Command and Reply Formats

Detailed descriptions of FEP I/O library command and reply formats are provided in Section 39.0 . Detailed descriptions of the FEP Science command and reply formats are provided in Section 4.10 .

4.9.5 FEP to BEP Science Data Ring-Buffer

This section describes the structure of the FEP to BEP Science Data Ring-buffer. This buffer contains an array of TBD record structures, each of which consists of an array of 32 words.

TABLE 13. FEP to BEP Science Ring-Buffer Format

-----------------------------------------------------------------------------------------------
Field   Type            Range       Description                                                  
-----------------------------------------------------------------------------------------------
Write   unsigned        0:records   This field is an index into the ring buffer data area just   
Index                   in ring     beyond the last written location. This index wraps to 0      
                        buffer - 1  when it reaches the end of the buffer. This field must       
                                    only be modified by the FEP. If this value is equal to the   
                                    Read Index, then the ring-buffer is empty. If this value     
                                    is one less than the Read Index (or at its greatest value    
                                    if the Read Index is 0), then the ring buffer is full, and   
                                    no more data can be written.                                 
Read    unsigned        0:records   This field is an index into the ring buffer data area just   
Index                   in ring     beyond the last read location. This index wraps to 0         
                        buffer - 1  when it reaches the end of the buffer. This field must       
                                    only be modified by the BEP.                                 
Data    record[TBD] :   -           This is an array of records, where each record is 32         
Buffer  where each                  words in length (32-bit words). This buffer must only        
        record is                   be modified by the FEP.                                      
        unsigned[32]                                                                             
-----------------------------------------------------------------------------------------------

Table of Contents Next Chapter