BIOS: TI DSP的实时 *** 作系统
基于TI的DSP芯片的应用程序分为两种:一般应用程序,和DSP/BIOS应用程序。为简化编程,TI提供了一套C的编程接口,它以API和宏的形式封装了TI的所有硬件模块,这套接口统称DSP/BIOS。DSP/BIOS包含以下模块:System(包含MEM,SYS对象),Instrumentation(包含LOG,STS对象),Scheduling(包含CLK,PRD,HWI,SWI等等对象),Synchronization(包含SEM,MBX,QUE等等对象),Input/Output(包含RTDX,HST等等对象),Chip Support Library(包含DMA,GPIO等等对象)。
引自:http://blog.csdn.net/wangkeyen/article/details/8161237
需要手动加入库文件:C:/CCStudio_v3.1/C6000/csl/lib/cslDM642.lib/*
* 功能:CSL中cache module和timer module的使用示例
* 说明: 需要手动加入库文件:C:/CCStudio_v3.1/C6000/csl/lib/cslDM642.lib,建议到TI网站下载最新的CSL库更新,否则有些模块可能会出问题
* 设计者: 3881
* 日期: 2010-5-28
*/
#include <csl.h> //顶层应用程序模块,用于初始化CSL。
main初始化部分,分三部分代码麻烦分析,main调用,BSP部分,GUI初始化部分
<div class="blockcode"><blockquote>int main(void)
{
/* STM32F4xx HAL library initialization:
- Configure the Flash prefetch, instruction and Data caches
- Configure the Systick to generate an interrupt each 1 msec
- Set NVIC Group Priority to 4
- Global MSP (MCU Support Package) initialization
*/
HAL_Init()
/* Configure the system clock to 180 MHz */
SystemClock_Config()
BSP_Config()
/* Configure LED1 and LED3 */
BSP_LED_Init(LED1)
BSP_LED_Init(LED3)
file_isok = FatFS_Init()
/* Thread 1 definition */
osThreadDef(LED1, LED_Thread1, osPriorityNormal, 0, configMINIMAL_STACK_SIZE)
/* Thread 2 definition */
osThreadDef(LED3, LED_Thread2, osPriorityNormal, 0, configMINIMAL_STACK_SIZE)
osThreadDef(GUI_TASKID, GUI_Thread, osPriorityNormal, 0, 2048)
/* Start thread 1 */
LEDThread1Handle = osThreadCreate (osThread(LED1), NULL)
/* Start thread 2 */
LEDThread2Handle = osThreadCreate (osThread(LED3), NULL)
GUIThreadHandle = osThreadCreate (osThread(GUI_TASKID), NULL)
//init_gui()
/* Start scheduler */
osKernelStart()
/* We should never get here as control is now taken by the scheduler */
for()
}
void BSP_Config(void)
{
/* Initializes the SDRAM device */
BSP_SDRAM_Init()
/* Initialize the Touch screen */
BSP_TS_Init(800, 480)
//BSP_TS_Init(320, 240)
/* Enable the CRC Module */
__HAL_RCC_CRC_CLK_ENABLE()
__HAL_RCC_BKPSRAM_CLK_ENABLE()
/* Compute the prescaler value to have TIM3 counter clock equal to 10 KHz */
uwPrescalerValue = (uint32_t) ((SystemCoreClock /2) / 10000) - 1
/* Set TIMx instance */
TimHandle.Instance = TIM3
/* Initialize TIM3 peripheral as follows:
+ Period = 500 - 1
+ Prescaler = ((SystemCoreClock/2)/10000) - 1
+ ClockDivision = 0
+ Counter direction = Up
*/
TimHandle.Init.Period = 500 - 1
TimHandle.Init.Prescaler = uwPrescalerValue
TimHandle.Init.ClockDivision = 0
TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP
if(HAL_TIM_Base_Init(&TimHandle) != HAL_OK)
{
while(1)
{
}
}
/*##-2- Start the TIM Base generation in interrupt mode ####################*/
/* Start Channel1 */
if(HAL_TIM_Base_Start_IT(&TimHandle) != HAL_OK)
{
while(1)
{
}
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)