From 5f0474c8475fbd6c19023a2c28cb600e3db4db01 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Fri, 19 Apr 2024 05:05:17 -0700 Subject: [PATCH] Update 035 work, getting close to USB --- ch32v003fun/ch32v003fun.c | 36 ++--- ch32v003fun/ch32v003fun.h | 61 +++++---- ch32v003fun/ch32v003fun.mk | 2 +- examples_x035/sandbox/Makefile | 10 ++ examples_x035/sandbox/funconfig.h | 9 ++ examples_x035/sandbox/sandbox.c | 43 ++++++ examples_x035/usbdevice.incomplete/Makefile | 11 ++ examples_x035/usbdevice.incomplete/fsusb.c | 127 ++++++++++++++++++ examples_x035/usbdevice.incomplete/fsusb.h | 12 ++ .../usbdevice.incomplete/funconfig.h | 9 ++ .../usbdevice.incomplete/usbdevice.c | 51 +++++++ minichlink/pgm-wch-linke.c | 8 +- 12 files changed, 330 insertions(+), 49 deletions(-) create mode 100644 examples_x035/sandbox/Makefile create mode 100644 examples_x035/sandbox/funconfig.h create mode 100644 examples_x035/sandbox/sandbox.c create mode 100644 examples_x035/usbdevice.incomplete/Makefile create mode 100644 examples_x035/usbdevice.incomplete/fsusb.c create mode 100644 examples_x035/usbdevice.incomplete/fsusb.h create mode 100644 examples_x035/usbdevice.incomplete/funconfig.h create mode 100644 examples_x035/usbdevice.incomplete/usbdevice.c diff --git a/ch32v003fun/ch32v003fun.c b/ch32v003fun/ch32v003fun.c index 252899ea..5e59a986 100644 --- a/ch32v003fun/ch32v003fun.c +++ b/ch32v003fun/ch32v003fun.c @@ -840,7 +840,7 @@ void DMA2_Channel10_IRQHandler( void ) __attribute__((section(".text.vector_han void DMA2_Channel11_IRQHandler( void ) __attribute__((section(".text.vector_handler"))) __attribute((weak,alias("DefaultIRQHandler"))) __attribute__((used)); #endif -#if defined( CH32X03X ) +#if defined( CH32X03x) void USART2_IRQHandler( void ) __attribute__((section(".text.vector_handler"))) __attribute((weak,alias("DefaultIRQHandler"))) __attribute__((used)); void EXTI15_8_IRQHandler( void ) __attribute__((section(".text.vector_handler"))) __attribute((weak,alias("DefaultIRQHandler"))) __attribute__((used)); void EXTI25_16_IRQHandler( void ) __attribute__((section(".text.vector_handler"))) __attribute((weak,alias("DefaultIRQHandler"))) __attribute__((used)); @@ -940,23 +940,23 @@ void InterruptVectorDefault() .word TIM1_TRG_COM_IRQHandler /* TIM1 Trigger and Commutation */ \n\ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ \n\ .word TIM2_IRQHandler /* TIM2 */ \n" -#if defined( CH32X03X ) -" .word USART2_IRQn = 39, /* UART2 Interrupt */ \n\ - .word EXTI15_8_IRQn = 40, /* External Line[8:15] Interrupt */ \n\ - .word EXTI25_16_IRQn = 41, /* External Line[25:16] Interrupt */ \n\ - .word USART3_IRQn = 42, /* UART2 Interrupt */ \n\ - .word USART4_IRQn = 43, /* UART2 Interrupt */ \n\ - .word DMA1_Channel8_IRQn = 44, /* DMA1 Channel 8 global Interrupt */ \n\ - .word USBFS_IRQn = 45, /* USB Full-Speed Interrupt */ \n\ - .word USBFS_WakeUp_IRQn = 46, /* USB Full-Speed Wake-Up Interrupt */ \n\ - .word PIOC_IRQn = 47, /* Programmable IO Controller Interrupt */ \n\ - .word OPA_IRQn = 48, /* Op Amp Interrupt */ \n\ - .word USBPD_IRQn = 49, /* USB Power Delivery Interrupt */ \n\ - .word USBPD_WKUP_IRQn = 50, /* USB Power Delivery Wake-Up Interrupt */ \n\ - .word TIM2_CC_IRQn = 51, /* Timer 2 Compare Global Interrupt */ \n\ - .word TIM2_TRG_IRQn = 52, /* Timer 2 Trigger Global Interrupt */ \n\ - .word TIM2_BRK_IRQn = 53, /* Timer 2 Brk Global Interrupt */ \n\ - .word TIM3_IRQn = 54, /* Timer 3 Global Interrupt */" +#if defined( CH32X03x ) +" .word USART2_IRQHandler /* UART2 Interrupt */ \n\ + .word EXTI15_8_IRQHandler /* External Line[8:15] Interrupt */ \n\ + .word EXTI25_16_IRQHandler /* External Line[25:16] Interrupt */ \n\ + .word USART3_IRQHandler /* UART2 Interrupt */ \n\ + .word USART4_IRQHandler /* UART2 Interrupt */ \n\ + .word DMA1_Channel8_IRQHandler /* DMA1 Channel 8 global Interrupt */ \n\ + .word USBFS_IRQHandler /* USB Full-Speed Interrupt */ \n\ + .word USBFS_WakeUp_IRQHandler /* USB Full-Speed Wake-Up Interrupt */ \n\ + .word PIOC_IRQHandler /* Programmable IO Controller Interrupt */ \n\ + .word OPA_IRQHandler /* Op Amp Interrupt */ \n\ + .word USBPD_IRQHandler /* USB Power Delivery Interrupt */ \n\ + .word USBPD_WKUP_IRQHandler /* USB Power Delivery Wake-Up Interrupt */ \n\ + .word TIM2_CC_IRQHandler /* Timer 2 Compare Global Interrupt */ \n\ + .word TIM2_TRG_IRQHandler /* Timer 2 Trigger Global Interrupt */ \n\ + .word TIM2_BRK_IRQHandler /* Timer 2 Brk Global Interrupt */ \n\ + .word TIM3_IRQHandler /* Timer 3 Global Interrupt */" #endif ); #endif diff --git a/ch32v003fun/ch32v003fun.h b/ch32v003fun/ch32v003fun.h index 931cfee4..d836f673 100644 --- a/ch32v003fun/ch32v003fun.h +++ b/ch32v003fun/ch32v003fun.h @@ -1700,8 +1700,8 @@ typedef struct /* USB Full Speed Device Mode */ typedef struct { - __IO uint8_t BASE_CTLR; - __IO uint8_t UDEV_CTLR; // or host ctlr + __IO uint8_t BASE_CTRL; //XXX (spelling) + __IO uint8_t UDEV_CTRL; // or host ctlr __IO uint8_t INT_EN; __IO uint8_t DEV_ADDR; __IO uint8_t RESERVED0; @@ -1720,25 +1720,25 @@ typedef struct __IO uint32_t UEP2_DMA; // Also HOST_RX_DMA __IO uint32_t UEP3_DMA; // Also HOST_TX_DMA - //__IO uint32_t UEP0_CTLR; + //__IO uint32_t UEP0_CTRL; __IO uint16_t UEP0_TX_LEN; - __IO uint16_t UEP0_CTLR_H; + __IO uint16_t UEP0_CTRL_H; - //__IO uint32_t UEP1_CTLR; + //__IO uint32_t UEP1_CTRL; __IO uint16_t UEP1_TX_LEN; - __IO uint16_t UEP1_CTLR_H; // Also HOST_SETUP + __IO uint16_t UEP1_CTRL_H; // Also HOST_SETUP - //__IO uint32_t UEP2_CTLR; + //__IO uint32_t UEP2_CTRL; __IO uint16_t UEP2_TX_LEN; // Also HOST_PID - __IO uint16_t UEP2_CTLR_H; // Also HOST_RX_CTL + __IO uint16_t UEP2_CTRL_H; // Also HOST_RX_CTL - //__IO uint32_t UEP3_CTLR; + //__IO uint32_t UEP3_CTRL; __IO uint16_t UEP3_TX_LEN; // Also HOST_TX_LEN - __IO uint16_t UEP3_CTLR_H; // Also HOST_TX_CTL + __IO uint16_t UEP3_CTRL_H; // Also HOST_TX_CTL - //__IO uint32_t UEP4_CTLR; + //__IO uint32_t UEP4_CTRL; __IO uint16_t UEP4_TX_LEN; - __IO uint16_t UEP4_CTLR_H; + __IO uint16_t UEP4_CTRL_H; __IO uint32_t RESERVED3[8]; @@ -1748,27 +1748,39 @@ typedef struct __IO uint32_t RESERVED4; - //__IO uint32_t UEP5_CTLR; + //__IO uint32_t UEP5_CTRL; __IO uint16_t UEP5_TX_LEN; - __IO uint16_t UEP5_CTLR_H; + __IO uint16_t UEP5_CTRL_H; - //__IO uint32_t UEP6_CTLR; + //__IO uint32_t UEP6_CTRL; __IO uint16_t UEP6_TX_LEN; - __IO uint16_t UEP6_CTLR_H; + __IO uint16_t UEP6_CTRL_H; - //__IO uint32_t UEP7_CTLR; + //__IO uint32_t UEP7_CTRL; __IO uint16_t UEP7_TX_LEN; - __IO uint16_t UEP7_CTLR_H; + __IO uint16_t UEP7_CTRL_H; __IO uint32_t UEPX_MOD; } USBFS_TypeDef; +#define USB_PHY_V33 (1<<6) +#define USB_IOEN (1<<7) + +#define UDP_PUE_00 (0b00<<2) +#define UDP_PUE_01 (0b01<<2) +#define UDP_PUE_10 (0b10<<2) +#define UDP_PUE_11 (0b11<<2) +#define UDM_PUE_00 (0b00<<0) +#define UDM_PUE_01 (0b01<<0) +#define UDM_PUE_10 (0b10<<0) +#define UDM_PUE_11 (0b11<<0) + /* USB Host Mode */ typedef struct { __IO uint8_t RESERVED0; - __IO uint8_t HOST_CTLR; // or host ctlr + __IO uint8_t HOST_CTRL; __IO uint8_t RESERVED1; __IO uint8_t RESERVED2; __IO uint8_t RESERVED3; @@ -1778,14 +1790,14 @@ typedef struct __IO uint16_t RESERVED7; __IO uint16_t RESERVED8; __IO uint8_t RESERVED9; - __IO uint8_t HOST_EP_MOD; // Also HOST_EP_MOD + __IO uint8_t HOST_EP_MOD; __IO uint8_t RESERVED10; __IO uint8_t RESERVED11; __IO uint32_t RESERVED12; __IO uint32_t RESERVED13; - __IO uint32_t HOST_RX_DMA; // Also HOST_RX_DMA - __IO uint32_t HOST_TX_DMA; // Also HOST_TX_DMA + __IO uint32_t HOST_RX_DMA; + __IO uint32_t HOST_TX_DMA; __IO uint16_t RESERVED14; __IO uint16_t RESERVED15; @@ -5517,6 +5529,8 @@ typedef struct #define RCC_FLITFEN ((uint16_t)0x0010) /* FLITF clock enable */ #define RCC_CRCEN ((uint16_t)0x0040) /* CRC clock enable */ #define RCC_USBHD ((uint16_t)0x1000) +#define RCC_USBFS ((uint16_t)0x1000) +#define RCC_USBPD ((uint16_t)0x20000) /****************** Bit definition for RCC_APB2PCENR register *****************/ #define RCC_AFIOEN ((uint32_t)0x00000001) /* Alternate Function I/O clock enable */ @@ -11077,7 +11091,8 @@ typedef struct #define USART_FLAG_FE ((uint16_t)0x0002) #define USART_FLAG_PE ((uint16_t)0x0001) -#if defined(CH32V10x) +// While not truly CH32X035, we can re-use some of the USB register defs. +#if defined(CH32V10x) | defined(CH32X03x) /* ch32v10x_usb.h ------------------------------------------------------------*/ #ifndef NULL diff --git a/ch32v003fun/ch32v003fun.mk b/ch32v003fun/ch32v003fun.mk index a4cbcb69..750c2850 100644 --- a/ch32v003fun/ch32v003fun.mk +++ b/ch32v003fun/ch32v003fun.mk @@ -58,7 +58,7 @@ else TARGET_MCU_LD:=1 else ifeq ($(findstring CH32X03,$(TARGET_MCU)),CH32X03) # CH32X033, X035 TARGET_MCU_PACKAGE?=CH32X035F8U6 - CFLAGS_ARCH+= -march=rv32imac \ + CFLAGS_ARCH+=-march=rv32imac \ -mabi=ilp32 \ -DCH32X03x=1 diff --git a/examples_x035/sandbox/Makefile b/examples_x035/sandbox/Makefile new file mode 100644 index 00000000..2b907ec5 --- /dev/null +++ b/examples_x035/sandbox/Makefile @@ -0,0 +1,10 @@ +all : flash + +TARGET:=sandbox +TARGET_MCU:=CH32X035 + +include ../../ch32v003fun/ch32v003fun.mk + +flash : cv_flash +clean : cv_clean + diff --git a/examples_x035/sandbox/funconfig.h b/examples_x035/sandbox/funconfig.h new file mode 100644 index 00000000..a8a70b30 --- /dev/null +++ b/examples_x035/sandbox/funconfig.h @@ -0,0 +1,9 @@ +#ifndef _FUNCONFIG_H +#define _FUNCONFIG_H + +// Though this should be on by default we can extra force it on. +#define FUNCONF_USE_DEBUGPRINTF 1 +#define FUNCONF_DEBUGPRINTF_TIMEOUT (1<<31) // Wait for a very very long time. + +#endif + diff --git a/examples_x035/sandbox/sandbox.c b/examples_x035/sandbox/sandbox.c new file mode 100644 index 00000000..c341d2fd --- /dev/null +++ b/examples_x035/sandbox/sandbox.c @@ -0,0 +1,43 @@ +/* Small example showing how to use the SWIO programming pin to + do printf through the debug interface */ + +#include "ch32v003fun.h" +#include + +uint32_t count; + +int last = 0; +void handle_debug_input( int numbytes, uint8_t * data ) +{ + last = data[0]; + count += numbytes; +} + +int main() +{ + SystemInit(); + + funGpioInitAll(); + + funPinMode( PA0, GPIO_CFGLR_OUT_10Mhz_PP ); + + printf( "%08x\n", &USBPD->DMA ); + + while(1); + +#if 0 + while(1) + { + GPIOA->BSHR = 1; // Turn on GPIOs + printf( "+%lu %lu\n", count++ ); + Delay_Ms(100); + int i; + for( i = 0; i < 10000; i++ ) + poll_input(); + GPIOA->BSHR = (1<<16); // Turn off GPIODs + printf( "-%lu[%c]\n", count++, last ); + Delay_Ms(100); + } +#endif +} + diff --git a/examples_x035/usbdevice.incomplete/Makefile b/examples_x035/usbdevice.incomplete/Makefile new file mode 100644 index 00000000..e28de11d --- /dev/null +++ b/examples_x035/usbdevice.incomplete/Makefile @@ -0,0 +1,11 @@ +all : flash + +TARGET:=usbdevice +TARGET_MCU:=CH32X035 +ADDITIONAL_C_FILES:=fsusb.c + +include ../../ch32v003fun/ch32v003fun.mk + +flash : cv_flash +clean : cv_clean + diff --git a/examples_x035/usbdevice.incomplete/fsusb.c b/examples_x035/usbdevice.incomplete/fsusb.c new file mode 100644 index 00000000..e522dd6d --- /dev/null +++ b/examples_x035/usbdevice.incomplete/fsusb.c @@ -0,0 +1,127 @@ +#include "fsusb.h" +#include "ch32v003fun.h" + +uint32_t USBDEBUG0, USBDEBUG1, USBDEBUG2; +uint8_t EP0_DATA[64] __attribute__((aligned(32))); + +void USBFS_IRQHandler() __attribute__((section(".text.vector_handler"))) __attribute__((interrupt)); + +#define CRB_U_IS_NAK (1<<7) +#define CTOG_MATCH_SYNC (1<<6) +#define CRB_U_SIE_FREE (1<<5) +#define CRB_UIF_FIFO_OV (1<<4) +#define CRB_UIF_HST_SOF (1<<3) +#define CRB_UIF_SUSPEND (1<<2) +#define CRB_UIF_TRANSFER (1<<1) +#define CRB_UIF_BUS_RST (1<<0) +#define CSETUP_ACT (1<<15) +#define CRB_UIS_TOG_OK (1<<14) +#define CMASK_UIS_TOKEN (3<<12) +#define CMASK_UIS_ENDP (0xf<<8) + +#define CUIS_TOKEN_OUT 0x0 +#define CUIS_TOKEN_SOF 0x1 +#define CUIS_TOKEN_IN 0x2 +#define CUIS_TOKEN_SETUP 0x3 + +void USBFS_IRQHandler() +{ + // Combined FG + ST flag. + uint16_t intfgst = *(uint16_t*)(&USBFSD->INT_FG); + + GPIOA->BSHR = 1; + + // TODO: Check if needs to be do-while to re-check. + + + if( intfgst & CRB_UIF_TRANSFER ) + { + switch ( ( intfgst & CMASK_UIS_TOKEN) >> 12) + { + case CUIS_TOKEN_IN: + switch ( intst & ( USBFS_UIS_TOKEN_M + +/* while( ( flags = USBFS->INT_FG & 0x9f ) ) + { + if( flags & RB_UIF_TRANSFER ) + { + // Handle transfer. + USBDEBUG0++; + } + if( flags & RB_UIF_BUS_RST ) + { + // Handle transfer. + USBDEBUG0+=1000; + } + //USBDEBUG0 = USBFS->INT_FG; + USBFS->INT_FG = flags; + } +*/ + + *(uint16_t*)(&USBFSD->INT_FG) = intfgst; + //intfgst = *(uint16_t*)(&USBFSD->INT_FG); + GPIOA->BSHR = 1<<16; +} + +void USBFS_Poll() +{ + USBDEBUG2 = USBFS->INT_ST;//EP0_DATA[1]; + USBDEBUG1 = USBFS->MIS_ST; +} + +int FSUSBSetup() +{ + RCC->APB2PCENR |= RCC_APB2Periph_AFIO | RCC_APB2Periph_GPIOC; + RCC->AHBPCENR |= RCC_USBFS; + + NVIC_EnableIRQ( USBFS_IRQn ); + + AFIO->CTLR |= USB_PHY_V33; + + USBFS->BASE_CTRL = RB_UC_RESET_SIE | RB_UC_CLR_ALL; + USBFS->BASE_CTRL = RB_UC_DEV_PU_EN | RB_UC_INT_BUSY | RB_UC_DMA_EN; + + // Enter device mode. + USBFS->INT_EN = RB_UIE_SUSPEND | RB_UIE_TRANSFER | RB_UIE_BUS_RST; + USBFS->UEP4_1_MOD = 0; + USBFS->UEP2_3_MOD = 0; + USBFS->UEP567_MOD = 0; + USBFS->UEP0_DMA = ((intptr_t)EP0_DATA) & 0x7fff; + USBFS->DEV_ADDR = 0x00; + USBFS->UDEV_CTRL = RB_UD_PD_DIS | RB_UD_PORT_EN; + + // Go on-bus. + + // From the TRM: + // + // USB multiplexing IO pins enable: + // + // Enabling USB requires, in addition to USB_IOEN set to + // 1, the setting of: MODE=0 in GPIO configuration register + // GPIOC_CFGXR corresponding to PC16 and PC17 to + // select the input mode. + // + // for USB device, CNF=10 corresponding to PC17 to select + // the input mode with up and down For USB devices, PC17 + // corresponding to CNF=10 selects the input mode with up + // and down pull, PC17 corresponding to bit 1 in + // GPIOC_OUTDR selects the up pull, and PC16 + // corresponding to CNF=01 selects the floating input. + + + AFIO->CTLR = (AFIO->CTLR & ~(UDP_PUE_11 | UDM_PUE_11 )) | USB_PHY_V33 | USB_IOEN | UDP_PUE_11; //1.5k pullup + + // Enable PC16/17 Alternate Function (USB) + // According to EVT, GPIO16 = GPIO_Mode_IN_FLOATING, GPIO17 = GPIO_Mode_IPU + GPIOC->CFGXR &= ~(0xf<<(4*0)); + GPIOC->CFGXR |= (GPIO_CFGLR_IN_FLOAT)<<(4*0); // MSBs are CNF, LSBs are MODE + GPIOC->CFGXR &= ~(0xf<<(4*1)); + GPIOC->CFGXR |= (GPIO_CFGLR_IN_PUPD)<<(4*1); + GPIOC->BSXR = 1<<1; // PC17 on. + + USBFS->UDEV_CTRL = RB_UD_PORT_EN; + + // Go on-bus. + return 0; +} + diff --git a/examples_x035/usbdevice.incomplete/fsusb.h b/examples_x035/usbdevice.incomplete/fsusb.h new file mode 100644 index 00000000..76f794e4 --- /dev/null +++ b/examples_x035/usbdevice.incomplete/fsusb.h @@ -0,0 +1,12 @@ +#ifndef _FSUSB_H +#define _FSUSB_H + +#include + +extern uint32_t USBDEBUG0, USBDEBUG1, USBDEBUG2; + +int FSUSBSetup(); +void USBFS_Poll(); + +#endif + diff --git a/examples_x035/usbdevice.incomplete/funconfig.h b/examples_x035/usbdevice.incomplete/funconfig.h new file mode 100644 index 00000000..a8a70b30 --- /dev/null +++ b/examples_x035/usbdevice.incomplete/funconfig.h @@ -0,0 +1,9 @@ +#ifndef _FUNCONFIG_H +#define _FUNCONFIG_H + +// Though this should be on by default we can extra force it on. +#define FUNCONF_USE_DEBUGPRINTF 1 +#define FUNCONF_DEBUGPRINTF_TIMEOUT (1<<31) // Wait for a very very long time. + +#endif + diff --git a/examples_x035/usbdevice.incomplete/usbdevice.c b/examples_x035/usbdevice.incomplete/usbdevice.c new file mode 100644 index 00000000..2dbd754c --- /dev/null +++ b/examples_x035/usbdevice.incomplete/usbdevice.c @@ -0,0 +1,51 @@ +/* Small example showing how to use the SWIO programming pin to + do printf through the debug interface */ + +#include "ch32v003fun.h" +#include +#include "fsusb.h" + +uint32_t count; + +int last = 0; +void handle_debug_input( int numbytes, uint8_t * data ) +{ + last = data[0]; + count += numbytes; +} + +int main() +{ + SystemInit(); + + funGpioInitAll(); + + funPinMode( PA0, GPIO_CFGLR_OUT_10Mhz_PP ); + + FSUSBSetup(); + + +void USBFS_IRQHandler(); +//extern int USBFS_IRQHandler; + while(1) + { + printf( "%lu %lu %lu\n", USBDEBUG0, USBDEBUG1, USBDEBUG2 ); + USBFS_Poll(); + } + +#if 0 + while(1) + { + GPIOA->BSHR = 1; // Turn on GPIOs + printf( "+%lu %lu\n", count++ ); + Delay_Ms(100); + int i; + for( i = 0; i < 10000; i++ ) + poll_input(); + GPIOA->BSHR = (1<<16); // Turn off GPIODs + printf( "-%lu[%c]\n", count++, last ); + Delay_Ms(100); + } +#endif +} + diff --git a/minichlink/pgm-wch-linke.c b/minichlink/pgm-wch-linke.c index 68352980..f674f0f7 100644 --- a/minichlink/pgm-wch-linke.c +++ b/minichlink/pgm-wch-linke.c @@ -421,7 +421,7 @@ static int LESetupInterface( void * d ) return -1; } int flash_size = (rbuff[2]<<8) | rbuff[3]; - fprintf( stderr, "Flash Storage: %d kB\n", flash_size ); // Is this Flash size? + fprintf( stderr, "Flash Storage: %d kB\n", flash_size ); fprintf( stderr, "Part UUID : %02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x\n", rbuff[4], rbuff[5], rbuff[6], rbuff[7], rbuff[8], rbuff[9], rbuff[10], rbuff[11] ); fprintf( stderr, "PFlags : %02x-%02x-%02x-%02x\n", rbuff[12], rbuff[13], rbuff[14], rbuff[15] ); fprintf( stderr, "Part Type (B): %02x-%02x-%02x-%02x\n", rbuff[16], rbuff[17], rbuff[18], rbuff[19] ); @@ -806,12 +806,6 @@ static int LEWriteBinaryBlob( void * d, uint32_t address_to_write, uint32_t len, } } - uint32_t rr; - int r = MCF.ReadReg32( d, DMABSTRACTCS, &rr ); - printf( "PLX HALT %08x %d\n", rr, r ); - - r = MCF.ReadReg32( d, DMSTATUS, &rr ); - printf( "PLX HALT %08x %d\n", rr, r ); return 0; }