2014-12-02 19:06:54 -05:00
|
|
|
subroutine jt9a()
|
2020-03-16 10:27:22 -04:00
|
|
|
use, intrinsic :: iso_c_binding, only: c_f_pointer, c_null_char, c_bool
|
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
|
2020-03-16 10:27:22 -04:00
|
|
|
use shmem
|
2014-12-02 19:06:54 -05:00
|
|
|
|
2015-12-17 15:29:55 -05:00
|
|
|
include 'jt9com.f90'
|
|
|
|
|
2020-02-14 11:16:54 -05:00
|
|
|
integer*2 id2a(180000)
|
2014-12-02 19:06:54 -05:00
|
|
|
! Multiple instances:
|
2020-03-16 10:27:22 -04:00
|
|
|
type(dec_data), pointer, volatile :: shared_data !also makes target volatile
|
2015-12-17 15:29:55 -05:00
|
|
|
type(params_block) :: local_params
|
2020-03-16 10:27:22 -04:00
|
|
|
logical(c_bool) :: ok
|
2014-12-02 19:06:54 -05:00
|
|
|
|
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
|
2020-03-16 10:27:22 -04:00
|
|
|
call shmem_setkey(trim(shm_key)//c_null_char)
|
|
|
|
ok=shmem_attach()
|
|
|
|
if(.not.ok) call abort
|
2020-03-14 17:06:54 -04:00
|
|
|
msdelay=30
|
2020-03-16 10:27:22 -04:00
|
|
|
call c_f_pointer(shmem_address(),shared_data)
|
2014-12-02 19:06:54 -05:00
|
|
|
|
2020-03-16 10:35:08 -04:00
|
|
|
<<<<<<< HEAD
|
2020-03-16 10:27:22 -04:00
|
|
|
<<<<<<< HEAD
|
|
|
|
! Terminate if ipc(2) is 999
|
2020-03-14 20:25:35 -04:00
|
|
|
10 call lock_jt9()
|
2020-03-16 10:27:22 -04:00
|
|
|
if(shared_data%ipc(2).eq.999) then
|
2020-03-14 20:25:35 -04:00
|
|
|
call unlock_jt9()
|
2014-12-02 19:06:54 -05:00
|
|
|
i1=detach_jt9()
|
|
|
|
go to 999
|
|
|
|
endif
|
2020-03-16 10:27:22 -04:00
|
|
|
! Wait here until GUI has set ipc(2) to 1
|
|
|
|
if(shared_data%ipc(2).ne.1) then
|
2020-03-14 20:25:35 -04:00
|
|
|
call unlock_jt9()
|
2020-03-16 10:27:22 -04:00
|
|
|
=======
|
|
|
|
! Wait here until GUI has set ips(2) to 1.0
|
2020-03-16 10:35:08 -04:00
|
|
|
10 ok=shmem_lock()
|
|
|
|
if(.not.ok) call abort
|
|
|
|
if(shared_data%ipc(2).eq.999.0) then
|
|
|
|
ok=shmem_unlock()
|
|
|
|
ok=shmem_detach()
|
|
|
|
go to 999
|
|
|
|
endif
|
|
|
|
if(shared_data%ipc(2).ne.1.0) then
|
|
|
|
ok=shmem_unlock()
|
|
|
|
if(.not.ok) call abort
|
|
|
|
>>>>>>> 488c2e8066c538e496ff5d7caf8655a065525976
|
|
|
|
=======
|
2020-03-15 14:25:56 -04:00
|
|
|
! Wait here until GUI has set ips(2) to 1.0
|
2020-03-16 10:27:22 -04:00
|
|
|
10 ok=shmem_lock()
|
|
|
|
if(.not.ok) call abort
|
|
|
|
if(shared_data%ipc(2).eq.999.0) then
|
|
|
|
ok=shmem_unlock()
|
|
|
|
ok=shmem_detach()
|
|
|
|
go to 999
|
|
|
|
endif
|
|
|
|
if(shared_data%ipc(2).ne.1.0) then
|
|
|
|
ok=shmem_unlock()
|
|
|
|
if(.not.ok) call abort
|
|
|
|
>>>>>>> 488c2e8066c538e496ff5d7caf8655a065525976
|
2020-03-14 17:06:54 -04:00
|
|
|
call sleep_msec(msdelay)
|
|
|
|
go to 10
|
|
|
|
endif
|
2020-03-15 14:25:56 -04:00
|
|
|
shared_data%ipc(2)=0
|
2014-12-02 19:06:54 -05:00
|
|
|
|
2020-03-16 10:27:22 -04:00
|
|
|
nbytes=shmem_size()
|
2014-12-02 19:06:54 -05:00
|
|
|
if(nbytes.le.0) then
|
2020-03-16 10:27:22 -04:00
|
|
|
ok=shmem_unlock()
|
|
|
|
ok=shmem_detach()
|
|
|
|
print*,'jt9a: Shared memory does not exist.'
|
2014-12-02 19:06:54 -05:00
|
|
|
print*,"Must start 'jt9 -s <thekey>' from within WSJT-X."
|
|
|
|
go to 999
|
|
|
|
endif
|
2020-03-12 14:31:02 -04:00
|
|
|
local_params=shared_data%params !save a copy because wsjtx carries on accessing
|
2020-03-16 10:27:22 -04:00
|
|
|
ok=shmem_unlock()
|
|
|
|
if(.not.ok) call abort
|
2015-12-17 15:29:55 -05:00
|
|
|
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
|
2020-03-05 15:37:31 -05:00
|
|
|
! Early decoding pass, FT8 only, when wsjtx reads from disk
|
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
|
2020-03-15 14:25:56 -04:00
|
|
|
call multimode_decoder(shared_data%ipc(1),shared_data%ss,id2a, &
|
|
|
|
local_params,12000)
|
2020-03-05 15:37:31 -05:00
|
|
|
nearly=47
|
|
|
|
local_params%nzhsym=nearly
|
|
|
|
id2a(1:nearly*3456)=shared_data%id2(1:nearly*3456)
|
|
|
|
id2a(nearly*3456+1:)=0
|
2020-03-15 14:25:56 -04:00
|
|
|
call multimode_decoder(shared_data%ipc(1),shared_data%ss,id2a, &
|
|
|
|
local_params,12000)
|
2020-02-14 11:16:54 -05:00
|
|
|
local_params%nzhsym=50
|
|
|
|
endif
|
|
|
|
! Normal decoding pass
|
2020-03-15 14:25:56 -04:00
|
|
|
call multimode_decoder(shared_data%ipc(1),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
|
|
|
|
|
|
|
|
2020-03-16 10:35:08 -04:00
|
|
|
<<<<<<< HEAD
|
2020-03-16 10:27:22 -04:00
|
|
|
<<<<<<< HEAD
|
|
|
|
! Wait here until GUI routine decodeDone() has set ipc(3) to 1
|
2020-03-14 20:25:35 -04:00
|
|
|
100 call lock_jt9()
|
2020-03-16 10:27:22 -04:00
|
|
|
if(shared_data%ipc(3).ne.1) then
|
2020-03-14 20:25:35 -04:00
|
|
|
call unlock_jt9()
|
2020-03-16 10:27:22 -04:00
|
|
|
=======
|
2020-03-16 10:35:08 -04:00
|
|
|
=======
|
|
|
|
>>>>>>> 488c2e8066c538e496ff5d7caf8655a065525976
|
2020-03-16 10:27:22 -04:00
|
|
|
! Wait here until GUI routine decodeDone() has set ipc(3) to 1.0
|
|
|
|
100 ok=shmem_lock()
|
|
|
|
if(.not.ok) call abort
|
|
|
|
if(shared_data%ipc(3).ne.1.0) then
|
|
|
|
ok=shmem_unlock()
|
|
|
|
if(.not.ok) call abort
|
2020-03-16 10:35:08 -04:00
|
|
|
<<<<<<< HEAD
|
|
|
|
>>>>>>> 488c2e8066c538e496ff5d7caf8655a065525976
|
|
|
|
=======
|
2020-03-16 10:27:22 -04:00
|
|
|
>>>>>>> 488c2e8066c538e496ff5d7caf8655a065525976
|
2020-03-14 17:06:54 -04:00
|
|
|
call sleep_msec(msdelay)
|
|
|
|
go to 100
|
|
|
|
endif
|
2020-03-15 14:25:56 -04:00
|
|
|
shared_data%ipc(3)=0
|
2020-03-16 10:27:22 -04:00
|
|
|
ok=shmem_unlock()
|
|
|
|
if(.not.ok) call abort
|
2020-03-14 17:06:54 -04:00
|
|
|
go to 10
|
|
|
|
|
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
|