Send CT_END on chanend before closing it, to prevent illegal resource exception.

This commit is contained in:
Russell
2012-01-09 14:48:55 +00:00
parent 8b0ad92d87
commit 3141dec113
2 changed files with 89 additions and 59 deletions

View File

@@ -1,7 +1,7 @@
#########################################################
# XMOS Compiled Assembly File #
#########################################################
# generated: Fri Jan 06 2012, 16:13 #
# generated: Mon Jan 09 2012, 13:44 #
# product: XS1-040 #
# compiler: XMOS 32-bit XC Compiler 11.11.0beta1 (build 2136)#
# input: reboot.xi #
@@ -193,10 +193,14 @@
.cc_top device_reboot.function,device_reboot
.align 4
.LDBG5:
.call device_reboot, __builtin_outct
.call device_reboot, get_core_id
.call device_reboot, read_sswitch_reg
.call device_reboot, write_sswitch_reg_blind
.call device_reboot, write_sswitch_reg_blind
.set __builtin_outct, 0
.linkset __builtin_outct.locnoside, 0
.linkset __builtin_outct.locnochandec, 1
.globl device_reboot, "f{0}(chd)"
.globl device_reboot.nstackwords
.globl device_reboot.maxthreads
@@ -224,10 +228,10 @@
# -----1-| _t0
# -----0-| rsvd
# ------------------------
# r0 = [f:spare, l:core_id, t:8, t:9, t:10, t:12, t:13, t:14, t:15, t:17, t:18, t:19, t:22]
# r1 = [t:21, t:23, t:24]
# r2 = [t:11, t:16, t:20]
# r4 = [t:7]
# r0 = [f:spare, t:8, l:core_id, t:10, t:11, t:12, t:14, t:15, t:16, t:17, t:19, t:21, t:24]
# r1 = [t:23, t:25, t:26]
# r2 = [t:13, t:18, t:22]
# r4 = [t:9, t:20]
# r5 = [t:1]
# r6 = [t:2]
# r7 = [t:3]
@@ -243,58 +247,67 @@ device_reboot:
.file 1 "../../../sc_usb_audio/module_usb_aud_shared/reboot.xc"
.loc 1 9 0
.L1_bb_begin:
.loc 1 10 0
.L2_bb_begin:
.loc 1 10 0
.loc 1 10 0
.L17_EndPoint:
outct res[r0], 0x1 # output ctrl token on `_t0_r0'
.L4_bb_begin:
freer res[r0]
.LDBG6:
.loc 1 16 0
.loc 1 17 0
.L14_Call:
.L18_Call:
bl get_core_id
mov r4, r0 # move r4 <-- r0
.L4_bb_begin:
.loc 1 17 0
.L7_bb_begin:
.loc 1 17 0
ldaw r2, sp[0x2]
ldc r1, 0x6
.loc 1 17 0
.L15_Call:
bl read_sswitch_reg
.loc 1 18 0
.L10_bb_begin:
.loc 1 18 0
ldaw r2, sp[0x2]
ldc r1, 0x6
.loc 1 18 0
.L19_Call:
bl read_sswitch_reg
.loc 1 19 0
.L13_bb_begin:
.loc 1 19 0
ldc r0, 0x8000
xor r0, r4, r0
ldw r2, sp[0x2]
ldc r1, 0x6
.loc 1 18 0
.loc 1 19 0
.L16_Call:
.L20_Call:
bl write_sswitch_reg_blind
.loc 1 19 0
.loc 1 20 0
.L12_bb_begin:
.loc 1 19 0
.L15_bb_begin:
.loc 1 20 0
mov r0, r4 # move r0 <-- r4
ldw r2, sp[0x2]
mov r0, r4 # move r0 <-- r4
ldc r1, 0x6
.loc 1 19 0
.loc 1 20 0
.L17_Call:
.L21_Call:
bl write_sswitch_reg_blind
.LDBG7:
.loc 1 21 0
.loc 1 22 0
.LDBG13:
ldw r4, sp[0x1]
.LDBG14:
.L13_bb_begin:
.L16_bb_begin:
retsp 0x3 # return: dealloc and link (pc=r15=mem[sp])
.LDBG10:
.LDBG15:
@@ -497,7 +510,7 @@ device_reboot:
.uleb128 0x6
.asciiz "pllVal"
.byte 0x01
.short 0x000f
.short 0x0010
.short .LDBG47-.LDBG46
.int .LDBG28-.LDBG22
.int .LDBG48
@@ -519,7 +532,7 @@ device_reboot:
.uleb128 0x6
.asciiz "core_id"
.byte 0x01
.short 0x0010
.short 0x0011
.short 0x0000
.int .LDBG28-.LDBG22
.int .LDBG51
@@ -641,48 +654,64 @@ device_reboot:
.byte 0x00
.byte 0x00
.section .xtacalltable, "", @progbits
.L18_xta_begin:
.int .L19_xta_end-.L18_xta_begin
.section .xtaendpointtable, "", @progbits
.L22_xta_begin:
.int .L23_xta_end-.L22_xta_begin
.int 0x00000000
.asciiz "/local/USBAudio/sw_usb_aud_l1_ios/app_usb_aud_l1/.build"
.cc_top device_reboot.function, device_reboot
.asciiz "../../../sc_usb_audio/module_usb_aud_shared/reboot.xc"
.int 0x0000000a
.long .L17_EndPoint
.cc_bottom device_reboot.function
.L23_xta_end:
.section .xtacalltable, "", @progbits
.L24_xta_begin:
.int .L25_xta_end-.L24_xta_begin
.int 0x00000000
.asciiz "/local/USBAudio/sw_usb_aud_l1_ios/app_usb_aud_l1/.build"
.cc_top device_reboot.function, device_reboot
.asciiz "../../../sc_usb_audio/module_usb_aud_shared/reboot.xc"
.int 0x00000014
.long .L21_Call
.cc_bottom device_reboot.function
.cc_top device_reboot.function, device_reboot
.asciiz "../../../sc_usb_audio/module_usb_aud_shared/reboot.xc"
.int 0x00000013
.long .L17_Call
.long .L20_Call
.cc_bottom device_reboot.function
.cc_top device_reboot.function, device_reboot
.asciiz "../../../sc_usb_audio/module_usb_aud_shared/reboot.xc"
.int 0x00000012
.long .L16_Call
.long .L19_Call
.cc_bottom device_reboot.function
.cc_top device_reboot.function, device_reboot
.asciiz "../../../sc_usb_audio/module_usb_aud_shared/reboot.xc"
.int 0x00000011
.long .L15_Call
.long .L18_Call
.cc_bottom device_reboot.function
.cc_top device_reboot.function, device_reboot
.asciiz "../../../sc_usb_audio/module_usb_aud_shared/reboot.xc"
.int 0x00000010
.long .L14_Call
.cc_bottom device_reboot.function
.L19_xta_end:
.L25_xta_end:
.section .xtalabeltable, "", @progbits
.L20_xta_begin:
.int .L21_xta_end-.L20_xta_begin
.L26_xta_begin:
.int .L27_xta_end-.L26_xta_begin
.int 0x00000000
.asciiz "/local/USBAudio/sw_usb_aud_l1_ios/app_usb_aud_l1/.build"
.cc_top device_reboot.function, device_reboot
.asciiz "../../../sc_usb_audio/module_usb_aud_shared/reboot.xc"
.int 0x00000015
.int 0x00000015
# line info for line 21
.long .L13_bb_begin
.int 0x00000016
.int 0x00000016
# line info for line 22
.long .L16_bb_begin
.asciiz "../../../sc_usb_audio/module_usb_aud_shared/reboot.xc"
.int 0x00000014
.int 0x00000014
# line info for line 20
.long .L15_bb_begin
.asciiz "../../../sc_usb_audio/module_usb_aud_shared/reboot.xc"
.int 0x00000013
.int 0x00000013
# line info for line 19
.long .L12_bb_begin
.long .L13_bb_begin
.asciiz "../../../sc_usb_audio/module_usb_aud_shared/reboot.xc"
.int 0x00000012
.int 0x00000012
@@ -694,17 +723,17 @@ device_reboot:
# line info for line 17
.long .L7_bb_begin
.asciiz "../../../sc_usb_audio/module_usb_aud_shared/reboot.xc"
.int 0x00000010
.int 0x00000010
# line info for line 16
.int 0x0000000c
.int 0x0000000c
# line info for line 12
.long .L4_bb_begin
.asciiz "../../../sc_usb_audio/module_usb_aud_shared/reboot.xc"
.int 0x0000000b
.int 0x0000000b
# line info for line 11
.long .L1_bb_begin
.int 0x0000000a
.int 0x0000000a
# line info for line 10
.long .L2_bb_begin
.cc_bottom device_reboot.function
.L21_xta_end:
.L27_xta_end:
.section .dp.data, "adw", @progbits
.align 4
.align 4
@@ -715,5 +744,5 @@ device_reboot:
.corerev "REVB"
# memory access instructions: 6
# total instructions: 18
# total instructions: 19
########################################

View File

@@ -7,6 +7,7 @@ int write_sswitch_reg_blind(unsigned coreid, unsigned reg, unsigned data);
/* Reboots XMOS device by writing to the PLL config register */
void device_reboot(chanend spare)
{
outct(spare, XS1_CT_END); // have to do this before freeing the chanend
// Need a spare chanend so we can talk to the pll register
asm("freer res[%0]"::"r"(spare));
// Need to tell the mapper we have freed one