本文整理汇总了C++中PUT32函数的典型用法代码示例。如果您正苦于以下问题:C++ PUT32函数的具体用法?C++ PUT32怎么用?C++ PUT32使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PUT32函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pll_init
//-------------------------------------------------------------------
void pll_init ( void )
{
//use the main (external) oscillator
PUT32(SCS,1<<5);
while((GET32(SCS)&(1<<6))==0) continue;
PUT32(CLKSRCSEL,1);
}
示例2: notmain
//-------------------------------------------------------------------------
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);
}
示例3: pdi_command
//------------------------------------------------------------------------
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);
}
示例4: notmain
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);
}
示例5: spi_init
//------------------------------------------------------------------------
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
}
示例6: raspi_okled_action
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);
}
}
示例7: notmain
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);
}
示例8: notmain
//------------------------------------------------------------------------
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();
}
}
示例9: kernel
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;
}
}
}
示例10: polled_sys_timer_interrupt_handler
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;
}
}
}
示例11: switch_to_mosc
//------------------------------------------------------------------------
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);
}
示例12: raspi_okled_set
void raspi_okled_set(int state) {
if (state) {
PUT32(GPCLR0, OKLED);
} else {
PUT32(GPSET0, OKLED);
}
}
示例13: setup_for_jtag
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);
}
示例14: uart_init
//------------------------------------------------------------------------
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);
}
示例15: spi_init
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);
}