コード例 #1
0
ファイル: wdttest001.c プロジェクト: cedar-renjun/CoX_TI_LM3S
//*****************************************************************************
//
//! \brief something should do after the test execute of xwdt001 test.
//!
//! \return None.
//
//*****************************************************************************
static void xwdt001TearDown(void)
{
    //
    // Disable Wdt
    //
    SysCtlPeripheralDisable(SYSCTL_PERIPH_WDOG0);
    SysCtlPeripheralDisable(SYSCTL_PERIPH_WDOG1);
}
コード例 #2
0
ファイル: dmatest02.c プロジェクト: 0xc0170/cox
//*****************************************************************************
//
//! \brief something should do after the test execute of xdma001 test.
//!
//! \return None.
//
//*****************************************************************************
static void xDma002TearDown(void)
{
    //
    // Disable Peripheral DMA
    //    
    SysCtlPeripheralDisable(SYSCTL_PERIPH_DMA); 
    SysCtlPeripheralDisable(SYSCTL_PERIPH_DMAMUX); 
}
コード例 #3
0
void CommutationControllerClass::releasePeripherals()
{
	TimerIntDisable(TIMER_BASE, TIMER_TIMA_TIMEOUT);
	TimerIntUnregister(TIMER_BASE, TIMER_A);
	TimerDisable(TIMER_BASE, TIMER_A);
	SysCtlPeripheralDisable(SYSCTL_PERIPH_TIMER);
}
コード例 #4
0
//*****************************************************************************
//
//	Initializes the hardware's system clock and the SysTick Interrupt
//
//*****************************************************************************
void SysTickInit() {
    //
    // Set the clocking to run directly from the crystal.
    //
    SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);

	//
	// Get the system clock speed.
	//
	systemClock = SysCtlClockGet();

    //
    // Configure SysTick interrupts
    //
    SysTickPeriodSet(systemClock / SYSTICK_FREQUENCY);
    SysTickIntEnable();
    SysTickEnable();
	
    //
	// 	Code to cause a wait for a "Select Button" press
    //
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
	GPIOPinTypeGPIOInput(GPIO_PORTG_BASE, GPIO_PIN_7);
	RIT128x96x4Init(1000000);
	RIT128x96x4StringDraw("Press \"Select\" Button", 0, 24, 15);
	RIT128x96x4StringDraw("To Continue", 32, 32, 15);
	while(GPIOPinRead(GPIO_PORTG_BASE, GPIO_PIN_7));
	SysCtlPeripheralDisable(SYSCTL_PERIPH_GPIOG);
	SysCtlPeripheralReset(SYSCTL_PERIPH_GPIOG);

}
コード例 #5
0
void SystemInit(void)
{
    //Disable protection
    HWREG(SYSCTL_MWRALLOW) = 0xA5A5A5A5;

    // Sets up PLL (M3 running at 75MHz and C28 running at 150MHz)
    SysCtlClockConfigSet(SYSCTL_USE_PLL | (SYSCTL_SPLLIMULT_M & 0xF) |
                         SYSCTL_SYSDIV_1 | SYSCTL_M3SSDIV_2 | SYSCTL_XCLKDIV_4);

    //Initialize Flash wait-states
    //FlashInit();

    //Disable clock for watchdog modules
    SysCtlPeripheralDisable(SYSCTL_PERIPH_WDOG1);
    SysCtlPeripheralDisable(SYSCTL_PERIPH_WDOG0);
}
コード例 #6
0
ファイル: xSysctltest02.c プロジェクト: Karplyak/cox
//*****************************************************************************
//
//! \brief xsysctl 001 test of Peripheral Disable test .
//!
//! \return None.
//
//*****************************************************************************
static void xsysctl_SysCtlPeripheralDisable_test(void)
{
#if 0
    unsigned long ulTemp,ulRegVal,i;
    
    for(i = 0; i < 9; i++)
    {
        ulTemp = xHWREG(SIM_SCGC4);
        SysCtlPeripheralDisable(ulSYSCTL_PERIPH[i]);
        ulRegVal = xHWREG(SIM_SCGC4);
        TestAssert((0 == (ulRegVal & ulPeriphEnableMask[i]) && 
        ((ulTemp & (~ulPeriphEnableMask[i]))== ulRegVal)),"xsysctl API error!");
        
    }
    
    for(i = 9; i < 16; i++)
    {
        ulTemp = xHWREG(SIM_SCGC5);
        SysCtlPeripheralDisable(ulSYSCTL_PERIPH[i]);
        ulRegVal = xHWREG(SIM_SCGC5);
        TestAssert((0 == (ulRegVal & ulPeriphEnableMask[i]) && 
        ((ulTemp & (~ulPeriphEnableMask[i]))== ulRegVal)),"xsysctl API error!");
        
    }

    for(i = 16; i < 25; i++)
    {
        ulTemp = xHWREG(SIM_SCGC6);
        SysCtlPeripheralDisable(ulSYSCTL_PERIPH[i]);
        ulRegVal = xHWREG(SIM_SCGC6);
        TestAssert((0 == (ulRegVal & ulPeriphEnableMask[i]) && 
        ((ulTemp & (~ulPeriphEnableMask[i]))== ulRegVal)),"xsysctl API error!");
        
    }

    for(i = 25; i < 26; i++)
    {
        ulTemp = xHWREG(SIM_SCGC7);
        SysCtlPeripheralDisable(ulSYSCTL_PERIPH[i]);
        ulRegVal = xHWREG(SIM_SCGC7);
        TestAssert((0 == (ulRegVal & ulPeriphEnableMask[i]) && 
        ((ulTemp & (~ulPeriphEnableMask[i]))== ulRegVal)),"xsysctl API error!");
        
    }
#endif
}
コード例 #7
0
ファイル: dmatest00.c プロジェクト: 0xc0170/cox
//*****************************************************************************
//
//! \brief something should do after the test execute of xdma001 test.
//!
//! \return None.
//
//*****************************************************************************
static void xDma001TearDown(void)
{   
    SysCtlPeripheralClockSourceSet(SYSCTL_PERIPH_UART_S_EXT12M);
    SysCtlIPClockDividerSet(SYSCTL_PERIPH_UART_D | 1);
    //
    // Disable Peripheral PDMA
    //    
    SysCtlPeripheralDisable(SYSCTL_PERIPH_PDMA);  
}
コード例 #8
0
ファイル: Device_Init.c プロジェクト: summerkaka/axio_mcb
void DisablePeripherals(void)
{
    SysCtlPeripheralDisable(SYSCTL_PERIPH_USB0);
    SysCtlPeripheralDisable(SYSCTL_PERIPH_SPI0);
    SysCtlPeripheralDisable(SYSCTL_PERIPH_SPI1);
    SysCtrlRegs.PCLKCR0.bit.I2CAENCLK = 0;
    EALLOW;
    SysCtrlRegs.PCLKCR0.bit.ECANAENCLK= 0;
    SysCtrlRegs.PCLKCR1.bit.EQEP1ENCLK = 0;
    SysCtrlRegs.PCLKCR1.bit.EPWM1ENCLK = 0;
    SysCtrlRegs.PCLKCR1.bit.EPWM2ENCLK = 0;
    SysCtrlRegs.PCLKCR1.bit.EPWM3ENCLK = 0;
    SysCtrlRegs.PCLKCR1.bit.EPWM4ENCLK = 0;
    SysCtrlRegs.PCLKCR1.bit.EPWM5ENCLK = 0;
    SysCtrlRegs.PCLKCR1.bit.EPWM6ENCLK = 0;
    EDIS;
    StopCpuTimer0();
    StopCpuTimer1();
    StopCpuTimer2();
}
コード例 #9
0
//*****************************************************************************
//
//	Task to output Initial screen.
//
//*****************************************************************************
void PrintInit(){
    //
	// 	Code to cause a wait for a "Select Button" press
    //
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
	GPIOPinTypeGPIOInput(GPIO_PORTG_BASE, GPIO_PIN_7);
    GPIOPadConfigSet(GPIO_PORTG_BASE, GPIO_PIN_7, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
	RIT128x96x4Init(1000000);
	RIT128x96x4StringDraw("FreeRTOS starting\n", 8, 0, 15);
	RIT128x96x4StringDraw("Press \"Select\" Button", 0, 24, 15);
	RIT128x96x4StringDraw("To Continue", 32, 32, 15);
	while(GPIOPinRead(GPIO_PORTG_BASE, GPIO_PIN_7));
	SysCtlPeripheralReset(SYSCTL_PERIPH_GPIOG);
	SysCtlPeripheralDisable(SYSCTL_PERIPH_GPIOG);
}
コード例 #10
0
void uartb_init(unsigned long speed){
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);

    GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0|GPIO_PIN_1);

    GPIOPinConfigure(GPIO_PB0_U1RX);
    GPIOPinConfigure(GPIO_PB1_U1TX);

    SysCtlPeripheralDisable(SYSCTL_PERIPH_UART0);

    SysCtlPeripheralEnable(UART_BUFFERIZED_PERIF);

    // Initialize the UART. Set the baud rate, number of data bits, turn off
    // parity, number of stop bits, and stick mode.
    UARTConfigSetExpClk(UART_BUFFERIZED_BASE, SysCtlClockGet(), speed, UART_BUFFERIZED_FLAGS);

    // Enable the UART.
    UARTEnable(UART_BUFFERIZED_BASE);

    // Use hardware FIFO to reduce the amount of interruptions
    UARTFIFOEnable(UART_BUFFERIZED_BASE);

    // Set fifo limit for interruption triggering at 7/8 th of the fifo size
    UARTFIFOLevelSet(UART_BUFFERIZED_BASE,UART_FIFO_TX7_8,UART_FIFO_RX7_8);

    // Flush characters. Spin here until bus is empty
//    while(UARTCharGetNonBlocking(UART_BUFFERIZED_BASE)>=0);

    // Register UART interrupt
    UARTIntRegister(UART_BUFFERIZED_BASE,uartb_intHandler);

    // Enable UART interruptions
    IntEnable(INT_UART1);
    UARTIntDisable(UART_BUFFERIZED_BASE,UART_INT_TX);
    UARTIntEnable(UART_BUFFERIZED_BASE,UART_INT_RT|UART_INT_RX);

//    IntMasterEnable();
}
コード例 #11
0
ファイル: usb_host.c プロジェクト: fejerson108/Stellarisware
//*****************************************************************************
//
// Clean up and release all USB hardware resources.
//
//*****************************************************************************
void
ScopeUSBHostTerm(void)
{
    //
    // If necessary, unmount the USB flash drive.
    //
    if((g_eState == STATE_DEVICE_ENUM) || (g_eState == STATE_DEVICE_READY))
    {
        FileMountUSB(false);
    }

    //
    // Nothing is connected any more.
    //
    g_eState = STATE_NO_DEVICE;

    //
    // Close our MSC drive instance.
    //
    USBHMSCDriveClose(g_ulMSCInstance);
    g_ulMSCInstance = 0;

    //
    // Tell the USB library that we are finished using the host controller.
    //
    USBHCDTerm(0);

    //
    // Turn off USB Phy clock.
    //
    SysCtlUSBPLLDisable();

    //
    // Disable the USB peripheral
    //
    SysCtlPeripheralDisable(SYSCTL_PERIPH_USB0);
}
コード例 #12
0
ファイル: spitest01.c プロジェクト: 0xc0170/cox
//*****************************************************************************
//
//! \brief something should do after the test execute of xspi001 test.
//!
//! \return None.
//
//*****************************************************************************
static void xSpi004TearDown(void)
{   
    SysCtlPeripheralDisable(SYSCTL_PERIPH_SPI0);
}
コード例 #13
0
ファイル: oled.c プロジェクト: SLongofono/Classwork-Resume
// The function to generate and hold the initial start screen
//Note, this function does not have a while loop, nor does it set a "vTaskDelay", meaning
//it will only execute once.
//This is reflected in the way we use it in main; we call it a single time as a part of
//our system set up (as a blocking task), and then we enter the task scheduler loop
void startScreen(){
    /*
     * The RIT128x96x4** functions are a part of the driver API for the OLED
     * The details for this API can be found in drivers/rit128x96x4.c
     *
     * Create a frame for the OLED display
     * 		The ImageDraw function takes an array of unsigned char
     * 		each 8-bit char represents 2 pixels (side-by-side)
     * 		so, 4 of these bits represent a single pixel's brightness
     * 		with valid brightness values ranging (0-15)
     * 		and the pixels are represented in pairs.
     *
     *  Since the pixels are represented in pairs along the horizontal,
     *  	and the OLED is 128x96 pixels,
     *  	the horizontal frame only needs 64 elements (64 * 2 = 128).
     *  However the vertical frames will require two separate arrays,
     *  	each will have 94 elements (the OLED is 96 pixels high
     *  	but we have taken care of the two ends with the horizontal lines)
     *  The left frame will set the right column of pixels to zero,
     *  	and the right frame will set the left column of pixels to zero.
     *  The blank array elements are initialized to 0 to turn-off pixels later.
     *  It only needs 62 elements because we don't want to erase the frame.
     */
    unsigned char lframe[94], rframe[94], hframe[64], blank[62];

    // The loop is used to initialize the arrays
    unsigned int i;
    for(i = 0; i < 94; i++){
    	lframe[i] = 0xF0; 				// Vertical line for the left edge
    	rframe[i] = 0x0F; 				// Vertical line for the right edge
    	if(i < 64) hframe[i] = 0xFF; 	// Horizontal line for top and bottom
    	if(i < 62) blank[i] = 0x00; 	// The blank line used to clear the screen
    }

    //  Initialize the OLED display
    RIT128x96x4Init(1000000);
    /*
     *  Draw the frame
     *  ImageDraw takes an array of unsigned char as the first argument
     *  the next two arguments are the x and y coordinates (respectively)
     *  of the screen position to start drawing, and the final two arguments
     *  are the width and height (respectively) to which the image is scaled.
     */
    // Draw upper frame starting at (0,0) with width = 128 pixels and height = 1 pixel
    // 	(width and height should match the size of array measured in pixels)
    RIT128x96x4ImageDraw(hframe, 0, 0, 128, 1);
    // Draws lower frame starting at (0,95) width = 128, height = 1
    RIT128x96x4ImageDraw(hframe, 0, 95, 128, 1);
    // Draws left frame starting at (0,1) width = 2, height = 94
    RIT128x96x4ImageDraw(lframe, 0, 1, 2, 94);
    // Draws right frame starting at (127,1) width = 2, height = 94
    RIT128x96x4ImageDraw(rframe, 127, 1, 2, 94);

    /*
     * 	Draw the message
     * 	StringDraw takes a string as the first argument
     * 	the next two arguments are again the x and y coordinates of the starting position
     * 	and the final argument is pixel brightness for the
     * 	The first function writes the first part of the message at (32,24)
     * 	with a brightness of 15 (full brightness)
     */
	RIT128x96x4StringDraw(" Press the", 32, 24, 15);
	RIT128x96x4StringDraw("\"Select\" Button", 16, 33, 15);
	RIT128x96x4StringDraw("To Continue", 32, 42, 15);

	// Enable the select button, wait for the press, then reset and disable the port
	// The button is disabled after the splash screen and the port is reset to default for future use.
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
	GPIOPinTypeGPIOInput(GPIO_PORTG_BASE, GPIO_PIN_7); 	// Set the select button signal PG7 as input
	while(GPIOPinRead(GPIO_PORTG_BASE, GPIO_PIN_7));	// Wait until the signal changes (button pressed)
	SysCtlPeripheralReset(SYSCTL_PERIPH_GPIOG);
	SysCtlPeripheralDisable(SYSCTL_PERIPH_GPIOG);

	/*
	 *  When the select button is pressed we need to wipe the message leaving the frame on the OLED.
	 *  The loop sets the pixels to 0 everywhere except the screen's edges.
	 */
	for(i = 24; i < 50; i++)
		RIT128x96x4ImageDraw(blank, 2, i, 124, 1);
}
コード例 #14
0
ファイル: wdttest01.c プロジェクト: 0xc0170/cox
//*****************************************************************************
//
//! \brief something should do after the test execute of xwdt002 test.
//!
//! \return None.
//
//*****************************************************************************
static void xwdt002TearDown(void)
{
    SysCtlPeripheralReset(SYSCTL_PERIPH_WDT);
    SysCtlPeripheralDisable(SYSCTL_PERIPH_WDT);
}
コード例 #15
0
ファイル: uart_driver.cpp プロジェクト: thumbos/tmos
void dcr_SerialDriver(UART_DRIVER_INFO* drv_info, unsigned int reason, HANDLE hnd)
{
	UART_Type * Uart = drv_info->hw_base;
	UART_DRIVER_DATA *drv_data = drv_info->drv_data;
	switch(reason)
	{
		case DCR_ISR:
			TX_CTS(drv_data, Uart, (unsigned int)hnd);
			return;
		case DCR_RESET:
			SysCtlPeripheralReset(drv_info->info.peripheral_indx);
			SysCtlPeripheralDisable(drv_info->info.peripheral_indx); // ??? turn off
			return;

		case DCR_OPEN:
		{
			UART_DRIVER_MODE *uart_mode = (UART_DRIVER_MODE *)(hnd->mode.as_voidptr);
			if(uart_mode)
			{
				//unsigned long mode, baudrate;
				if(drv_data->cnt)
				{
					if( uart_mode->mode != drv_data->mode.mode ||
					    uart_mode->baudrate != drv_data->mode.baudrate ||
					    uart_mode->hw_flow != drv_data->mode.hw_flow )
					{
						return;
					}
				}
				else
				{
					// Enable AND Reset the UART peripheral
					SysCtlPeripheralReset(drv_info->info.peripheral_indx);
					if(drv_data->mode.hw_flow)
					{
						PIO_Cfg_List((PIN_DESC *)&drv_info->uart_pins[UART_LIST_ALL_PINS]);
						ConfigureUart(drv_info, drv_data, uart_mode);
#ifdef HW_VER_10
						if(drv_info->info.drv_index != UART1_IRQn)
							TX_CTS(drv_data, Uart, PIO_Read(drv_info->uart_pins[CTS_PIN]));
#endif
					}
					else
					{
						PIO_Cfg_List((PIN_DESC *)&drv_info->uart_pins[UART_LIST_RX_TX_PINS]);
						ConfigureUart(drv_info, drv_data, uart_mode);
					}
					START_RX_BUF(Uart, drv_info, drv_data);
				}
				drv_data->cnt++;
				hnd->res = RES_OK;
			}
			return;
		}

		case DCR_CLOSE:
			if(drv_data->cnt)
				drv_data->cnt--;

		case DCR_CANCEL:
    	{
    		if( !(hnd->res & FLG_BUSY))
    			return;

    		if (hnd->cmd & FLAG_READ)
    	    {
    			if(hnd == drv_data->hnd_rcv)
    			{
    				STOP_RX(Uart);
    	      		if(hnd->len > drv_data->rx_remaining || hnd->mode0 )
    	      		{
    	      			hnd->len = drv_data->rx_remaining;
    	      			hnd->res = RES_SIG_OK;
    	      		}
    	      		else
    	      			hnd->res = RES_SIG_IDLE;

    	      		drv_data->hnd_rcv = hnd->next;
    	      		svc_HND_SET_STATUS(hnd, hnd->res);

    		      	if( (hnd=drv_data->hnd_rcv) )
    		          	START_RX_HND(Uart, drv_info, hnd);
    		      	else
    					START_RX_BUF(Uart, drv_info, drv_data);
    			}
    			else
    			{
    				// try cnacel
    				hnd->svc_list_cancel(drv_data->hnd_rcv);
    			}
    		}
    		else
    		{
    			if(hnd == drv_data->hnd_snd)
    			{
    				STOP_TX(Uart);
    				drv_data->hnd_snd = hnd->next;
    	      		svc_HND_SET_STATUS(hnd, RES_SIG_IDLE);
					if( (hnd=drv_data->hnd_snd) )
						START_TX_HND(Uart, hnd);
    			}
    			else
    			{
    				hnd->svc_list_cancel(drv_data->hnd_snd);
    			}

    		}
        	if(!drv_data->cnt)
			{
					NVIC->NVIC_DisableIRQ(drv_info->info.drv_index);
					Uart->UARTDisable();
					STOP_RX(Uart);
					STOP_TX(Uart);
					SysCtlPeripheralDisable(drv_info->info.peripheral_indx);
					SYSCTL->SysCtlPeripheralDeepSleepDisable(drv_info->info.peripheral_indx);
				    SYSCTL->SysCtlPeripheralSleepDisable(drv_info->info.peripheral_indx);

					if(drv_data->mode.hw_flow)
						PIO_Free_List((PIN_DESC *)&drv_info->uart_pins[UART_LIST_ALL_PINS]);
					else
						PIO_Free_List((PIN_DESC *)&drv_info->uart_pins[UART_LIST_RX_TX_PINS]);
			}
        	return;
    	}
        case DCR_CLOCK:
        	return;
	}
}