2014-12-02 19:06:54 -05:00
|
|
|
subroutine jt9a()
|
2015-12-17 15:29:55 -05:00
|
|
|
use, intrinsic :: iso_c_binding, only: c_f_pointer
|
2014-12-02 19:06:54 -05:00
|
|
|
use prog_args
|
2015-12-27 10:40:57 -05:00
|
|
|
use timer_module, only: timer
|
|
|
|
use timer_impl, only: init_timer !, limtrace
|
2014-12-02 19:06:54 -05:00
|
|
|
|
2015-12-17 15:29:55 -05:00
|
|
|
include 'jt9com.f90'
|
|
|
|
|
2014-12-02 19:06:54 -05:00
|
|
|
! These routines connect the shared memory region to the decoder.
|
|
|
|
interface
|
|
|
|
function address_jt9()
|
2015-12-17 15:29:55 -05:00
|
|
|
use, intrinsic :: iso_c_binding, only: c_ptr
|
|
|
|
type(c_ptr) :: address_jt9
|
2014-12-02 19:06:54 -05:00
|
|
|
end function address_jt9
|
|
|
|
end interface
|
|
|
|
|
2020-02-14 11:16:54 -05:00
|
|
|
integer*2 id2a(180000)
|
2014-12-02 19:06:54 -05:00
|
|
|
integer*1 attach_jt9
|
|
|
|
! integer*1 lock_jt9,unlock_jt9
|
|
|
|
integer size_jt9
|
|
|
|
! Multiple instances:
|
|
|
|
character*80 mykey
|
2015-12-17 15:29:55 -05:00
|
|
|
type(dec_data), pointer :: shared_data
|
|
|
|
type(params_block) :: local_params
|
2014-12-02 19:06:54 -05:00
|
|
|
logical fileExists
|
|
|
|
|
|
|
|
! Multiple instances:
|
|
|
|
i0 = len(trim(shm_key))
|
|
|
|
|
2015-12-27 10:40:57 -05:00
|
|
|
call init_timer (trim(data_dir)//'/timer.out')
|
2015-04-22 13:48:03 -04:00
|
|
|
! open(23,file=trim(data_dir)//'/CALL3.TXT',status='unknown')
|
2014-12-02 19:06:54 -05:00
|
|
|
|
|
|
|
! limtrace=-1 !Disable all calls to timer()
|
|
|
|
|
|
|
|
! Multiple instances: set the shared memory key before attaching
|
|
|
|
mykey=trim(repeat(shm_key,1))
|
|
|
|
i0 = len(mykey)
|
|
|
|
i0=setkey_jt9(trim(mykey))
|
|
|
|
i1=attach_jt9()
|
2017-06-27 16:50:17 -04:00
|
|
|
msdelay=10
|
2014-12-02 19:06:54 -05:00
|
|
|
|
|
|
|
10 inquire(file=trim(temp_dir)//'/.lock',exist=fileExists)
|
|
|
|
if(fileExists) then
|
2017-06-27 16:50:17 -04:00
|
|
|
call sleep_msec(msdelay)
|
2014-12-02 19:06:54 -05:00
|
|
|
go to 10
|
|
|
|
endif
|
|
|
|
|
|
|
|
inquire(file=trim(temp_dir)//'/.quit',exist=fileExists)
|
|
|
|
if(fileExists) then
|
|
|
|
i1=detach_jt9()
|
|
|
|
go to 999
|
|
|
|
endif
|
|
|
|
if(i1.eq.999999) stop !Silence compiler warning
|
|
|
|
|
|
|
|
nbytes=size_jt9()
|
|
|
|
if(nbytes.le.0) then
|
|
|
|
print*,'jt9a: Shared memory mem_jt9 does not exist.'
|
|
|
|
print*,"Must start 'jt9 -s <thekey>' from within WSJT-X."
|
|
|
|
go to 999
|
|
|
|
endif
|
2015-12-17 15:29:55 -05:00
|
|
|
call c_f_pointer(address_jt9(),shared_data)
|
|
|
|
local_params=shared_data%params !save a copy because wsjtx carries on accessing
|
|
|
|
call flush(6)
|
|
|
|
call timer('decoder ',0)
|
2020-02-14 11:16:54 -05:00
|
|
|
if(local_params%nmode.eq.8 .and. local_params%ndiskdat) then
|
|
|
|
! "Early" decoding pass for data read from disk: FT8 only
|
2020-02-28 15:03:39 -05:00
|
|
|
nearly=41
|
2020-02-14 11:16:54 -05:00
|
|
|
local_params%nzhsym=nearly
|
|
|
|
id2a(1:nearly*3456)=shared_data%id2(1:nearly*3456)
|
|
|
|
id2a(nearly*3456+1:)=0
|
|
|
|
call multimode_decoder(shared_data%ss,id2a,local_params,12000)
|
|
|
|
local_params%nzhsym=50
|
|
|
|
endif
|
|
|
|
! Normal decoding pass
|
2015-12-29 18:52:55 -05:00
|
|
|
call multimode_decoder(shared_data%ss,shared_data%id2,local_params,12000)
|
2015-12-17 15:29:55 -05:00
|
|
|
call timer('decoder ',1)
|
2014-12-02 19:06:54 -05:00
|
|
|
|
|
|
|
100 inquire(file=trim(temp_dir)//'/.lock',exist=fileExists)
|
|
|
|
if(fileExists) go to 10
|
2017-06-27 16:50:17 -04:00
|
|
|
call sleep_msec(msdelay)
|
2014-12-02 19:06:54 -05:00
|
|
|
go to 100
|
|
|
|
|
2015-12-17 15:29:55 -05:00
|
|
|
999 call timer('decoder ',101)
|
2014-12-02 19:06:54 -05:00
|
|
|
|
|
|
|
return
|
|
|
|
end subroutine jt9a
|