11/6/03            Bob Webber

 

Booster VCO Program Flow Documentation

 

 

 

Interrupts

 

rst_svc                 chip reset routine

source –

            DSP board or chip hardware reset

calls –

init_21k

exits with –

            jump to main

 

irq1_svc              interrupt vector to set up for new Booster cycle

source –

            external trigger to hardware input IRQ1 (generally TCLK Booster reset events)

exits with –

jump to begin_cycle

 

cb7_svc                interrupt vector for frequency curve circular buffer

source –

            frequency curve circular buffer overflow (address wrap-around)

exits with –

jump to cb7i_asserted

 

cb15_svc             interrupt vector for bias curve circular buffer

source –

            bias curve circular buffer overflow (address wrap-around)

exits with –

jump to cb15i_asserted

 

tmzl_svc               interrupt vector to initiate playing out curves

source –

            DSP timer time-out; in this case, timer started in begin_cycle

exits with –

jump to play_curve (with delayed branch clear of time high priority interrupt latch)

 

tmzh_svc             interrupt vector to DDS update

source –

            DSP timer time-out; in this case, timer started in play_curve and occurs every 4 usec while curves play

exits with –

jump to timer_hi_prior

 

sft0_svc               interrupt vector to check newparameters, do housekeeping, and end cycle

source –

            software interrupt set in cb15i_asserted

exits with –

jump to sft0i_asserted

 

ep1_svc                interrupt vector for end of dma process

source –

            dma-complete interrupt for dma process initiated in NOT USED

exits with –

rti

 

 

Service Routines and Subroutines

 

init_21k              initializes board and program at power-up or reset

contains –

            rtn_default

calls –

            get_btparam

            tst_params     

            tst_tblsize

            get_tables

            tst_tables

crv_builder

exits with –

            rts

 

 

main                              idle loop awaiting interrupts

            idle

exits only with external interrupt

 

 

begin_cycle                  initialization for a new Booster cycle

contains –

            rtn_int (local jump label)

exits with –

            rti

 

 

play_curve                    enables fast timer and interrupt  to actually begin playing curves

exits with –

            rti

 

 

timer_hi_prior             interrupt service for fast DDS frequency updates

contains –

            return (never referenced)

exits with –

            rti

 

 

cb7i_asserted          interrupt service for frequency curve circular buffer wraps

contains –

            fin_fcrv (local jump label)

            ddn (local jump label)

fin_int (local jump label)

exits with –

            rti (with delayed branch toggle of ustat1 UP-SWP bit)

 

 

cb15i_asserted          interrupt service for bias curve circular buffer wraps

contains –

            fin_bcrv(local jump label)

exits with –

            rti

 

 

sft0i_asserted           interrupt service for “both curves finished” to check newparameters, do housekeeping, and end cycle

contains –

            end_sft0i (local jump label)

calls –

            new_params

            tst_params

            new_tables

            echo_tables

            restore_inj

            inj_crv

exits with –

rti

 

get_btparam          retrieve program parameters from boot memory at program initialization

calls –

            dma_32

exits with –

            rts

 

 

tst_params                    check parameters for allowed values

calls –

            compare

exits with –

            rts

 

 

compare                        low level value comparison routine

exits with –

            rts

 

 

get_tables                     retrieve freq and bias curves from boot memory at program initialization

calls –

            get_tbl

returns with –

            rts

 

 

tst_tblsize                      test freq and bias curves for allowed size

calls –

            tst_size

exits with –

            rts

 

 

tst_size                           test freq and bias curves for allowed size

exits with –

            jump to default_tbls

or         rts       

 

 

tst_tables                      setup test for monotonic time values in freq and bias tables

calls –

            tst_time

exits with –

            jump to default_tbls

or         rts

 

 

tst_time                         test for monotonically increasing time

contains –

            time_tst (local loop label)

 

exits with –

            jump to default_tbls

or         rts

 

           

default_tbls          compute and load default freq and bias curves

calls –

            crv_builder

exits with –

            rts

 

 

get_tbl                 loop to read freq or bias table from boot memory

contains –

            get_loop (local loop label)

calls –

            dma_32

exits with –

            rts

 

 

dma_32               low level routine to read 32 bits from boot memory

calls –

            pack_boot

contains –

            wait_dma32 (local loop label)

exits with –

            rts

 

 

pack_boot                     low level routine to pack 4x8 bit data into 32 bit word

exits with –

            rts

 

 

new_params     read new parameter values from shared memory

contains –

            echo_inj (local jump label)

            echo_crvdly (local jump label)

            echo_revs (local jump label)

            echo_ninj (local jump label)

            echo_gain (local jump label)

            echo_eplfreq (local jump label)

param_rtn (local jump label)

calls –

            write_boot

exits with –

            rts

 

 

new_tables          check and control reading new freq and bias tables from shared memory and saving in boot memory

contains –

            new_btbl (local jump label)

calls –

            get_ftbl

            tst_tblsize

            tst_tables

            write_boot

            send_tbl

intrp_freq

crvmirr

get_btbl

intrp_bias

exits with –

            rts

 

 

echo_tables          check and control writing of freq and bias tables to shared memory for readback purposes

contains –

            echo_bias (local)

calls –

            echo_ftbl

            echo_btbl

exits with –

            rts

 

 

send_tbl              write freq or bias table to boot memory

contains –

            send_loop (local loop label)

calls –

            write_boot

exits with –

            rts

 

 

get_ftbl                sets up dma of freq table from shared memory

calls –

            dma_tbl

exits with –

            rts

 

 

get_btbl               sets up dma of bias table from shared memory

calls –

            dma_tbl

exits with –

            rts

 

 

echo_ftbl             sets up dma of freq table to shared memory

calls –

            dma_tbl

exits with –

            rts

 

 

echo_btbl            sets up dma of bias table to shared memory

calls –

            dma_tbl

exits with –

            rts

 

 

dma_tbl               dma table to shared memory

contains –

            dma_wait

            rtn(local jump label)

exits with –

            rts (with two delayed branch instructions)

 

 

intrp_freq           sets up for interpolation of freq curve

calls –

            intrp_crv

exits with –

            rts

 

 

intrp_bias           sets up for interpolation of bias curve

calls –

            intrp_crv

exits with –

            rts

 

 

intrp_crv             performs curve interpolation

calls –

            get_next

contains –

            intrp_loop (local loop label)

exits with –

            rts

 

 

get_next              subroutine of curve interpolation routine

contains –

calc_next (local loop label)

nu_slope (local jump label)

calls –

            divide

exits with –

            rts

 

 

write_boot           control write of 32 bit word to boot memory

calls –

            dma_16

exits with –

            rts (with two delayed branch instructions)

 

 

dma_16               low level subroutine of write_boot

contains –

            wait_dma8 (local jump label)

exits with –

            rts

 

crv_builder          builds curves from tables

calls –

            intrp_freq

            crvmirr

inj_crv

intrp_bias

exits with –

            rts

 

 

inj_crv                 update injection portion of frequency curve for requested injection frequency

calls –

            divide

contains –

            injlp (local loop label)

exits with –

            rts

 

 

crvmirr                backup injection portion of freq curve otherwise altered injection frequency

contains –

            mrloop (local loop label)

exits with –

            rts

 

 

restore_inj           restore unaltered injection portion of frequency curve

contains –

            mrloop1 (local loop label)

exits with –

            rts

 

 

divide                   low level floating point division routine

exits with –

            rts

 

 

 

Normal Program Flow

 

 

Reset or power-on

rst_svc

call init_21k

call get_btparam

call tst_params

call tst_tblsize

call get_tables

call tst_tables

call crv_builder

enables IRQ1 interrupt

rts

                        jump main

 

external interrupt IRQ1

            irq1_svc

jump begin_cycle

disables IRQ1 interrupt

enables timer low priority/software 0/cb7/cb15 interrupts

starts timer (curve delay)

rti (to main)

 

timer interrupt (low priority)

            tmzl_svc

                        jump play_curve (delayed branch clears TMZHI latch)

                                    disables timer low priority interrupt

                                    enables timer high priority interrupt (for every 4 usec interrupt)

rti (to main)

 

timer interrupt (high priority)

            tmzh_svc

                        jump timer_hi_prior

does the fast critical stuff

rti (to main)

 

freq circular buffer interrupt  execute when leave timer_hi_prior that reached top end of frequency curve

            cb7_svc

                        jump cb7i_asserted

                                    disable timer to prevent timer interrupt

                                    switch freq curve direction and rate to play down

                                    enable timer

                                    rti (to main)

 

bias circular buffer interrupt  execute when leave timer_hi_prior that reached end of bias curve

            cb15_svc

                        jump cv15i_asserted

                                    disable timer to prevent timer interrupt

                                    disable cb15 interrupt

indicate bias curve finished

                                    enable timer

                                    rti (to main)

 

freq circular buffer interrupt  execute when leave timer_hi_prior that reached bottom end of frequency curve

            cb7_svc

                        jump cb7i_asserted

                                    disable timer to prevent timer interrupt

                                    switch freq curve direction and rate to play down

                                    enable timer

                                    set software interrupt 0

                                    rti (to main)

 

software interrupt SFT0    set when both freq and bias curves have played out completely

            sft0_svc

                        jump sft0i_asserted

                                    call new_params

                                    call tst_params

                                    call new_tables

                                    call echo_tables

                                    call restore_inj

call inj_crv

                                    enable IRQ1 interrupt to permit next cycle

rti