//------------------------------------------------------------------- void pll_init ( void ) { //use the main (external) oscillator PUT32(SCS,1<<5); while((GET32(SCS)&(1<<6))==0) continue; PUT32(CLKSRCSEL,1); }
//------------------------------------------------------------------------- int notmain ( void ) { unsigned int ra; ra=GET32(GPFSEL4); ra&=~(7<<21); ra|=1<<21; PUT32(GPFSEL4,ra); //ra=GET32(GPFSEL3); //ra&=~(7<<15); //ra|=1<<15; //PUT32(GPFSEL3,ra); while(1) { PUT32(GPSET1,1<<(47-32)); //PUT32(GPCLR1,1<<(35-32)); for(ra=0;ra<0x100000;ra++) dummy(ra); PUT32(GPCLR1,1<<(47-32)); //PUT32(GPSET1,1<<(35-32)); for(ra=0;ra<0x100000;ra++) dummy(ra); } return(0); }
//------------------------------------------------------------------------ unsigned int pdi_command ( unsigned int cmd ) { unsigned int data; PUT32(AUX_SPI0_CS,0x004000B0); //TA=1 cs asserted while(1) { if(GET32(AUX_SPI0_CS)&(1<<18)) break; //TXD } PUT32(AUX_SPI0_FIFO,(cmd>>24)&0xFF); PUT32(AUX_SPI0_FIFO,(cmd>>16)&0xFF); PUT32(AUX_SPI0_FIFO,(cmd>> 8)&0xFF); PUT32(AUX_SPI0_FIFO,(cmd>> 0)&0xFF); while(1) if(GET32(AUX_SPI0_CS)&(1<<16)) break; while(1) if(GET32(AUX_SPI0_CS)&(1<<17)) break; data=GET32(AUX_SPI0_FIFO)&0xFF; while(1) if(GET32(AUX_SPI0_CS)&(1<<17)) break; data<<=8; data|=GET32(AUX_SPI0_FIFO)&0xFF; while(1) if(GET32(AUX_SPI0_CS)&(1<<17)) break; data<<=8; data|=GET32(AUX_SPI0_FIFO)&0xFF; while(1) if(GET32(AUX_SPI0_CS)&(1<<17)) break; data<<=8; data|=GET32(AUX_SPI0_FIFO)&0xFF; PUT32(AUX_SPI0_CS,0x00400000); //cs0 comes back up return(data); }
int notmain ( void ) { unsigned int beg,end; unsigned int one,two; uart_init(); hexstring(0x12345678); IRQEN(); FIQEN(); PUT32(TIMER1_MATCH,0xFFF); PUT32(TIMER_CONTROL,0x0C02); beg=GET32(0xD1000000); if(onetime()) return(1); end=GET32(0xD1000000); hexstring(end-beg); one=end-beg; hexstring(0x12345678); cache_enable(); beg=GET32(0xD1000000); if(onetime()) return(1); end=GET32(0xD1000000); hexstring(end-beg); two=end-beg; hexstring(0x12345678); hexstring(one-two); hexstring(0x12345678); return(0); }
//------------------------------------------------------------------------ void spi_init ( void ) { unsigned int ra; ra=GET32(AUX_ENABLES); ra|=2; //enable spi0 PUT32(AUX_ENABLES,ra); ra=GET32(GPFSEL0); ra&=~(7<<27); //gpio9 ra|=4<<27; //alt0 ra&=~(7<<24); //gpio8 ra|=4<<24; //alt0 ra&=~(7<<21); //gpio7 ra|=4<<21; //alt0 PUT32(GPFSEL0,ra); ra=GET32(GPFSEL1); ra&=~(7<<0); //gpio10/ ra|=4<<0; //alt0 ra&=~(7<<3); //gpio11/ ra|=4<<3; //alt0 PUT32(GPFSEL1,ra); PUT32(AUX_SPI0_CS,0x0000030); PUT32(AUX_SPI0_CLK,0x0000); //slowest possible, could probably go faster here }
void raspi_okled_action(doorid_t id, uint16_t size, struct Crate* crate) { if (crate->data[0] == 1) { PUT32(GPCLR0, OKLED); } else { PUT32(GPSET0, OKLED); } }
int notmain ( void ) { unsigned int ra; //PUT8(PADIR_L,GET8(PADIR_L)|0x01); PUT8(PASEL0_L,GET8(PASEL0_L)& ~0x01); PUT8(PASEL1_L,GET8(PASEL1_L)& ~0x01); PUT32(SYST_CSR,4); PUT32(SYST_RVR,1200000-1); PUT32(SYST_CVR,1200000-1); PUT32(SYST_CSR,5); ra=GET8(PAOUT_L); while(1) { ra^=1; PUT8(PAOUT_L,ra); delay(); ra^=1; PUT8(PAOUT_L,ra); delay(); } return(0); }
//------------------------------------------------------------------------ void notmain ( void ) { //unsigned int ra; switch_to_80Mhz(); uart_init(); hexstring(0x87654321); hexstring(0x12345678); //Cortex-M4 systick timer init PUT32(STCTRL,0x00000004); PUT32(STRELOAD,1000000-1); PUT32(STCURRENT,0); //value is a dont care PUT32(STCTRL,0x00000005); while(1) { uart_send(0x55); dowait(); uart_send(0x56); dowait(); } }
void kernel() { unsigned int then, now, delta; PUT32(0x40000054, INT_IRQ); // mboxes 1..3 *do* interrupt, via IRQ PUT32(0x40000058, INT_IRQ); PUT32(0x4000005C, INT_IRQ); flash_lonum(3); then = now_usec(); while (1) { now = now_usec(); delta = usec_diff( now, then ); //if (delta > ONE_MSEC) { if ( delta > (ONE_SEC) ) { //if (delta > ((7 * ONE_SEC) + (500 * ONE_MSEC))) { then = now; // flash_lonum(3); // oldwait(20); interrupt_core(1); // clear_interrupt(1); // while (1) continue; } } }
void polled_sys_timer_interrupt_handler(void) { static int led_on =0; if(is_system_timer_interrupt_pending() == 1) { //Reset the counter match register unsigned int start_tick = GET32(SYSTEM_TIMER_CL0_REG_LSB); PUT32(SYSTEM_TIMER_CMP1,(start_tick + (time_ms*1000))); //Clear the system timer match register System_timer_control_Reg_t systimctrl; systimctrl = (System_timer_control_Reg_t) GET32(SYSTEM_TIMER_CS_REG); systimctrl.mBits.System_timer1_match = 1; PUT32(SYSTEM_TIMER_CS_REG,systimctrl.mAsU32); if(led_on == 0) { LEDTurnon(); led_on = 1; } else { LEDTurnoff(); led_on = 0; } } }
//------------------------------------------------------------------------ static void switch_to_mosc ( void ) { unsigned int ra; PUT32(MOSCCTL,3); ra=GET32(RCC); ra|=1<<11; //BYPASS ra&=~(1<<22); //USESYS PUT32(RCC,ra); PUT32(MISC,1<<8); ra=GET32(RCC); ra&=~(1<<0); //MOSCDIS PUT32(RCC,ra); while(1) if(GET32(RIS)&(1<<8)) break; //0x15 16mhz ra=GET32(RCC); ra&=~(0x1F<<6); //XTAL ra|=0x15<<6; //XTAL ra&=~(0x3<<4); //OSCSRC ra|=0x0<<4; //OSCSRC ra|=(1<<13); //PWRDN PUT32(RCC,ra); }
void raspi_okled_set(int state) { if (state) { PUT32(GPCLR0, OKLED); } else { PUT32(GPSET0, OKLED); } }
void setup_for_jtag( void ){ unsigned int ra; //for jtag //alt4 = 0b011 3 //alt5 = 0b010 2 ra=GET32(GPFSEL0); ra&=~(7<<12); //gpio4 ra|=2<<12; //gpio4 alt5 ARM_TDI PUT32(GPFSEL0,ra); ra=GET32(GPFSEL2); ra&=~(7<<6); //gpio22 ra|=3<<6; //alt4 ARM_TRST ra&=~(7<<12); //gpio24 ra|=3<<12; //alt4 ARM_TDO ra&=~(7<<15); //gpio25 ra|=3<<15; //alt4 ARM_TCK ra&=~(7<<21); //gpio27 ra|=3<<21; //alt4 ARM_TMS PUT32(GPFSEL2,ra); }
//------------------------------------------------------------------------ void uart_init ( void ) { unsigned int ra; PUT32(UART0_CR,0); ra=GET32(GPFSEL1); ra&=~(7<<12); //gpio14 ra|=4<<12; //alt0 ra&=~(7<<15); //gpio15 ra|=4<<15; //alt0 PUT32(GPFSEL1,ra); PUT32(GPPUD,0); for(ra=0;ra<150;ra++) dummy(ra); PUT32(GPPUDCLK0,(1<<14)|(1<<15)); for(ra=0;ra<150;ra++) dummy(ra); PUT32(GPPUDCLK0,0); PUT32(UART0_ICR,0x7FF); PUT32(UART0_IBRD,1); PUT32(UART0_FBRD,40); PUT32(UART0_LCRH,0x70); PUT32(UART0_CR,0x301); }
void spi_init(void) { //Alternate fn 0 for GPIO 7,8,9,10,11 GPIO_Funtion_Select0_t gpiofnsel0; gpiofnsel0 = (GPIO_Funtion_Select0_t) GET32(GPIO_REG_GPFSEL0); gpiofnsel0.mBits.FunctionSelGPIO7 = GPIO_SET_alternate_function_0; gpiofnsel0.mBits.FunctionSelGPIO8 = GPIO_SET_alternate_function_0; gpiofnsel0.mBits.FunctionSelGPIO9 = GPIO_SET_alternate_function_0; PUT32(GPIO_REG_GPFSEL0,gpiofnsel0.mAsU32); GPIO_Funtion_Select1_t gpiofnsel1; gpiofnsel1 = (GPIO_Funtion_Select1_t) GET32(GPIO_REG_GPFSEL1); gpiofnsel1.mBits.FunctionSelGPIO10 = GPIO_SET_alternate_function_0; gpiofnsel1.mBits.FunctionSelGPIO11 = GPIO_SET_alternate_function_0; PUT32(GPIO_REG_GPFSEL1,gpiofnsel1.mAsU32); //Configure gpio 24,25 as output. 25 is for data/command selection. 24 is for Interrupt volatile GPIO_Funtion_Select2_t GPIOFnsel2; GPIOFnsel2 = (GPIO_Funtion_Select2_t)GET32(GPIO_REG_GPFSEL2); GPIOFnsel2.mBits.FunctionSelGPIO25 = GPIO_SET_AS_OUTPUT; PUT32(GPIO_REG_GPFSEL2,GPIOFnsel2.mAsU32); //Set clk speed SPI_clk_Reg_t spiclkspeed; spiclkspeed = (SPI_clk_Reg_t)GET32(SPI_CLK_DIVIDER); spiclkspeed.mBits.clk_div = BCM2835_SPI_CLOCK_DIVIDER_4; PUT32(SPI_CLK_DIVIDER,spiclkspeed.mAsU32); //Set the SPI control register SPI_control_Reg_t spictrlreg; spictrlreg = (SPI_control_Reg_t) GET32(SPI_CONTROL_STATUS_REGISTER); spictrlreg.mAsU32 = 0x00000030; PUT32(SPI_CONTROL_STATUS_REGISTER,spictrlreg.mAsU32); }
/* * audioixp_chip_init() * * Description: * This routine initializes ATI IXP audio controller and the AC97 * codec. * * Arguments: * audioixp_state_t *state The device's state structure * * Returns: * DDI_SUCCESS The hardware was initialized properly * DDI_FAILURE The hardware couldn't be initialized properly */ static int audioixp_chip_init(audioixp_state_t *statep) { /* * put the audio controller into quiet state, everything off */ CLR32(IXP_AUDIO_CMD, IXP_AUDIO_CMD_EN_OUT_DMA); CLR32(IXP_AUDIO_CMD, IXP_AUDIO_CMD_EN_IN_DMA); /* AC97 reset */ if (audioixp_reset_ac97(statep) != DDI_SUCCESS) { audio_dev_warn(statep->adev, "AC97 codec reset failed"); return (DDI_FAILURE); } if (audioixp_codec_ready(statep) != DDI_SUCCESS) { audio_dev_warn(statep->adev, "AC97 codec not ready"); return (DDI_FAILURE); } /* enable interrupts */ PUT32(IXP_AUDIO_INT, 0xffffffff); PUT32( IXP_AUDIO_INT_EN, IXP_AUDIO_INT_EN_IN_DMA_OVERFLOW | IXP_AUDIO_INT_EN_STATUS | IXP_AUDIO_INT_EN_OUT_DMA_UNDERFLOW); return (DDI_SUCCESS); } /* audioixp_chip_init() */
static void blink(void) { PUT32(GPSET0,1<<BIT); mdelay(500); PUT32(GPCLR0,1<<BIT); mdelay(500); }
void disable_watchdog ( void ) { PUT32(WDT_WSPR,0xAAAA); while(GET32(WDT_WWPS)&(1<<4)) continue; PUT32(WDT_WSPR,0x5555); while(GET32(WDT_WWPS)&(1<<4)) continue; }
//------------------------------------------------------------------------ void timer_init ( void ) { //0xF9+1 = 250 //250MHz/250 = 1MHz PUT32(ARM_TIMER_CTL,0x00F90000); PUT32(ARM_TIMER_CTL,0x00F90200); }
/* * Start_hw */ void init_hw() { unsigned int ra; unsigned int rx; for(unsigned int i=bss_start;i<bss_end;i+=4) PUT32(i,0); uart_init(); /* Init audio interface */ /* music_init(); */ /* /\* Make gpio pin tied to the led an output *\/ */ /* ra=GET32(GPFSEL1); */ /* ra&=~(7<<18); */ /* ra|=1<<18; */ /* PUT32(GPFSEL1,ra); */ /* PUT32(GPSET0,1<<16); //led off */ /* Set up delay before timer interrupt (we use CM1) */ rx=GET32(SYSTIMERCLO); rx += INTERVAL; PUT32(C1,rx); /* Enable irq triggering by the *system timer* peripheral */ /* - we use the compare module CM1 */ enable_timer_irq(); /* Enable interrupt *line* */ PUT32(0x2000B210, 0x00000002); }
void __attribute__((interrupt("FIQ"))) c_fiq_handler (void) { static int led_on = 0; //Reset the counter match register unsigned int start_tick = GET32(SYSTEM_TIMER_CL0_REG_LSB); PUT32(SYSTEM_TIMER_CMP1,(start_tick + (time_ms*1000))); //Clear the system timer match register volatile System_timer_control_Reg_t systimctrl; systimctrl = (System_timer_control_Reg_t) GET32(SYSTEM_TIMER_CS_REG); systimctrl.mBits.System_timer1_match = 1; PUT32(SYSTEM_TIMER_CS_REG,systimctrl.mAsU32); if(led_on == 0) { LEDTurnon(); led_on = 1; } else { LEDTurnoff(); led_on = 0; } }
int main (void) { //GPIO 16 configuration unsigned int aux; aux=GET32(GPFSEL1); aux&=~(7<<18); aux|=1<<18; PUT32(GPFSEL1,aux); //--------------------- unsigned int pT; while(1) { //starts blink toggle sequence PUT32(GPSET0,1<<16); for(pT=0;pT<0x100000;pT++) { dummy(pT); //this works like a NOPE instruction } PUT32(GPCLR0,1<<16); for(pT=0;pT<0x100000;pT++) { dummy(pT); //this works like a NOPE instruction } //ends blink toggle sequence } return(0); }
//------------------------------------------------------------------------ void do_command ( unsigned int ticks ) { unsigned int ra,rb,rc; PUT32(GPIOCBASE+0x18,0x00000200); rb=GET32(STK_CVR); while(1) { ra=GET32(STK_CVR); rc=(rb-ra)&0x00FFFFFF; if(rc>=ticks) { break; } } PUT32(GPIOCBASE+0x18,0x02000000); ticks=160000; while(1) { ra=GET32(STK_CVR); rc=(rb-ra)&0x00FFFFFF; if(rc>=ticks) { break; } } }
__attribute__((no_instrument_function)) int not_main(void) { unsigned int ra; serial_init(); printf("\n\rTesting UART and Timer INT\n\r"); int size; printf("Enter the size of malloc to be allocated \n\r "); scanf("%d",&size); unsigned int *ptr = (unsigned int*)malloc(size); if(ptr == NULL) printf("Malloc allocation failed\n\r"); printf("Address of malloc if size %d allocated 0x%x \n\r", size,ptr); PUT32(IRQ_DISABLE_BASIC,1); /* Selecting the GPIO Pin for OK LED and setting it to ouput */ ra=GET32(GPFSEL1); ra&=~(7<<18); ra|=1<<18; PUT32(GPFSEL1,ra); PUT32(GPSET0,1<<16); timer_init(3); PUT32(IRQ_ENABLE_BASIC,1); enable_irq(); printf("See the OK LED blinking\n\r"); while(1)continue; return(0); }
//------------------------------------------------------------------------ int notmain ( void ) { PUT32(IWDG_KR,0x5555); //enable access to IWDG_PR PUT32(IWDG_PR,0x3); PUT32(IWDG_KR,0xCCCC); //start IWDG while(1) dummy(0); return(0); }
void reboot() { uint32_t pm_rstc,pm_wdog; pm_rstc = GET32(PM_RSTC); pm_wdog = PM_PASSWORD | (1 & PM_WDOG_TIME_SET); // watchdog timer = timer clock / 16; need password (31:16) + value (11:0) pm_rstc = PM_PASSWORD | (pm_rstc & PM_RSTC_WRCFG_CLR) | PM_RSTC_WRCFG_FULL_RESET; PUT32(PM_WDOG,pm_wdog); PUT32(PM_RSTC,pm_rstc); }
/* * audioixp_reset_port() * * Description: * This routine resets the DMA engine pareparing it for work. * * Arguments: * audioixp_port_t *port Port of DMA engine to reset. */ static void audioixp_reset_port(audioixp_port_t *port) { audioixp_state_t *statep = port->statep; ASSERT(mutex_owned(&statep->inst_lock)); /* * XXX: reset counters. */ port->count = 0; if (statep->suspended) return; /* * Perform full reset of the engine, and enable its interrupts * but leave it turned off. */ if (port->num == IXP_REC) { PUT32(IXP_AUDIO_FIFO_FLUSH, IXP_AUDIO_FIFO_FLUSH_IN); SET32(IXP_AUDIO_CMD, IXP_AUDIO_CMD_INTER_IN); SET32(IXP_AUDIO_CMD, IXP_AUDIO_CMD_EN_IN_DMA); PUT32(IXP_AUDIO_IN_DMA_LINK_P, port->bdl_paddr | IXP_AUDIO_IN_DMA_LINK_P_EN); } else { uint32_t slot = GET32(IXP_AUDIO_OUT_DMA_SLOT_EN_THRESHOLD); PUT32(IXP_AUDIO_FIFO_FLUSH, IXP_AUDIO_FIFO_FLUSH_OUT); /* clear all slots */ slot &= ~ (IXP_AUDIO_OUT_DMA_SLOT_3 | IXP_AUDIO_OUT_DMA_SLOT_4 | IXP_AUDIO_OUT_DMA_SLOT_5 | IXP_AUDIO_OUT_DMA_SLOT_6 | IXP_AUDIO_OUT_DMA_SLOT_7 | IXP_AUDIO_OUT_DMA_SLOT_8 | IXP_AUDIO_OUT_DMA_SLOT_9 | IXP_AUDIO_OUT_DMA_SLOT_10 | IXP_AUDIO_OUT_DMA_SLOT_11 | IXP_AUDIO_OUT_DMA_SLOT_12); /* enable 6 channel out, unconditional for now */ slot |= IXP_AUDIO_OUT_DMA_SLOT_3 | IXP_AUDIO_OUT_DMA_SLOT_4 | IXP_AUDIO_OUT_DMA_SLOT_6 | IXP_AUDIO_OUT_DMA_SLOT_9 | IXP_AUDIO_OUT_DMA_SLOT_7 | IXP_AUDIO_OUT_DMA_SLOT_8; PUT32(IXP_AUDIO_OUT_DMA_SLOT_EN_THRESHOLD, slot); SET32(IXP_AUDIO_CMD, IXP_AUDIO_CMD_INTER_OUT); SET32(IXP_AUDIO_CMD, IXP_AUDIO_CMD_EN_OUT_DMA); PUT32(IXP_AUDIO_OUT_DMA_LINK_P, port->bdl_paddr | IXP_AUDIO_OUT_DMA_LINK_P_EN); } }
static mrb_value mrb_rs_gyro_initialize(mrb_state *mrb, mrb_value self) { //TODO update default value with parameters // gpio 7, 8, 9, 10, 11 unsigned int ra; unsigned int ra2; unsigned int rcv_data = 0; ra=GET32(AUX_ENABLES); ra|=2; //enable spi0 PUT32(AUX_ENABLES,ra); ra=GET32(GPFSEL0); ra&=~(7<<27); //gpio9 //MISO ra|=4<<27; //alt0 //ra|=1<<27; //output ra&=~(7<<24); //gpio8 //CE0 ra|=4<<24; //alt0 ra&=~(7<<21); //gpio7 //CE1; not used //ra|=4<<21; //alt0 ra|=1<<21; //output PUT32(GPFSEL0,ra); ra=GET32(GPFSEL1); ra&=~(7<<0); //gpio10 //MOSI ra|=4<<0; //alt0 ra&=~(7<<3); //gpio11 //SCLK ra|=4<<3; //alt0 PUT32(GPFSEL1,ra); *SPI_CONTROL = 0; *SPI_CONTROL &= ~(1 << SPI_CS_CSPOL0); //LOW *SPI_CONTROL &= ~((1 << SPI_CS_CS0) | (1 << SPI_CS_CS1));//CS0 // clear send/receive buffer *SPI_CONTROL |= (1 << SPI_CS_CLEAR_RX) | (1 << SPI_CS_CLEAR_TX); *SPI_CONTROL |= SPI_CS_MODE_00; *SPI_CLK = 128; // read "Who am I" reg(0x0F) for test rcv_data = spi_read(0x0F); // 0xD4 is collect if(rcv_data != 0xd4){ return mrb_false_value(); } // delay 500msec for(ra2=0;ra2<0x500000;ra2++) dummy(ra2); spi_write(0x20, 0xCF); spi_write(0x23, (0x01000000)); // delay 500msec for(ra2=0;ra2<0x500000;ra2++) dummy(ra2); return self; }
void notmain ( void ) { unsigned int ra,rb,rc,rd,re,rf; unsigned int lastcount,nowcount; unsigned int nticks; unsigned int oneled; //init GPIO ra=GET8(FIO1DIR2); ra|=0xB4; PUT8(FIO1DIR2,ra); ra=FIO1SET2; rb=FIO1CLR2; rc=0x80; rd=0x20; re=0x10; rf=0x04; PUT8(rb,rc); PUT8(rb,rd); PUT8(rb,re); PUT8(rb,rf); oneled=0; twoled=0; //4MHz, 12000000 counts is 3 seconds PUT32(STCTRL,0x00000004); PUT32(STRELOAD,12000000-1); PUT32(STCTRL,0x00000007); //interrupt enabled //4Mhz/4 = 1Mhz 500000 is half a second nticks=500000; PUT32(T0CR,1); //enable timer lastcount=GET32(T0TC); while(1) { nowcount=GET32(T0TC); nowcount-=lastcount; //upcounter if(nowcount>=nticks) { if(oneled&1) { PUT8(ra,rc); } else { PUT8(rb,rc); } oneled++; lastcount+=nticks; } } while(1) continue; }
void dbau1550_init(void) { uint16_t whoami; uint32_t sysclk; uint32_t pinfunc; if (MIPS_PRID_COPTS(mips_options.mips_cpu_id) != MIPS_AU1550) panic("dbau1550: CPU not Au1550"); /* check the whoami register for a match */ whoami = GET16(DBAU1550_WHOAMI); if (DBAU1550_WHOAMI_BOARD(whoami) != DBAU1550_WHOAMI_DBAU1550_REV1) panic("dbau1550: WHOAMI (%x) not DBAu1550!", whoami); printf("DBAu1550 (cabernet), CPLDv%d, ", DBAU1550_WHOAMI_CPLD(whoami)); if (DBAU1550_WHOAMI_DAUGHTER(whoami) != 0xf) printf("daughtercard 0x%x\n", DBAU1550_WHOAMI_DAUGHTER(whoami)); else printf("no daughtercard\n"); /* leave console and clocks alone -- YAMON should have got it right! */ /* * Initialize PSC clocks. * * PSC0 is SPI. Use 48MHz FREQ1. * PSC1 is AC97. * PSC2 is SMBus, and must be 48MHz. (Configured by YAMON) * PSC3 is I2S. * * FREQ2 is 48MHz for USBH/USBD. */ sysclk = GET32(SYS_CLKSRC); sysclk &= ~(SCS_MP0(7) | SCS_DP0 | SCS_CP0); sysclk |= SCS_MP0(3); PUT32(SYS_CLKSRC, sysclk); /* * Configure pin function for PSC devices. */ pinfunc = GET32(SYS_PINFUNC); /* configure PSC0 SYNC1 */ pinfunc |= SPF_S0; /* configure PSC2 for SMBus (YAMON default) */ pinfunc &= ~SPF_PSC2_MASK; pinfunc |= SPF_PSC2_SMBUS; /* configure PSC3 for I2S (YAMON default) */ pinfunc &= ~SPF_PSC3_MASK; pinfunc |= SPF_PSC3_I2S; PUT32(SYS_PINFUNC, pinfunc); }