⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 ARM7 based on STR71x, UCOS migration
💻 C
字号:
/*
 *****************************************************************************
 *                                                                           *
 *  2.4GHz Spread Spectrum Purpletooth 3rd Generation Wireless Modem         *
 *                                                                           *
 *  Copyright (C) 2001-2004 REnex Technology Limited.  All rights reserved.  *
 *  No part of this document may be reproduced or utilized in any form or by *
 *  any means, electronic or mechanical, including photocopying and microfilm*
 *  , without permission in writing from REnex Technology Limited.           *
 *                                                                           *
 *****************************************************************************
 *                                                                           *
 *  Filename:   CEntry.c                                                     *
 *  Date:       AUG 25, 2004                                                 *
 *  Description:C source entry point -- system kernel                        *
 *  Version:    WM02/V2.00                                                   *
 *  Hardware:   BBM0110                                                      *
 *  Remarks:    For STR710FZ2T6 only                                         *
 *                                                                           *
 *****************************************************************************
 */
#include "71x_lib.h"
#include "Soft_Define.h"
#include "includes.h"

#define TASK_STK_SIZE	48

OS_STK	Task1Stk[TASK_STK_SIZE];
OS_STK	Task2Stk[TASK_STK_SIZE];
//OS_STK	Task3Stk[TASK_STK_SIZE];

void Enable_Interrupt(void)
{
	EIC->SIR[0] |= 0x000002;	// Configure the channel 0 priority
	EIC->IER |= 1<<0;			// Enable interrupts on channel 0

//	EIC->SIR[19] |= 0x00000001;	// Configure the channel 19 priority
//	EIC->IER |= 1<<19;			// Enable interrupt on channel 19

	EIC->ICR |= 0x00000003;		// Enable interrupts
}
void Hardware_Init (void)
{

/* Configure GPIO0 in Push-Pull output */
	GPIO0->PC0 = 0xFFFF;
	GPIO0->PC1 = 0x0000;
	GPIO0->PC2 = 0xFFFF;
	GPIO0->PD = 0x0000;		// reset pins

/* Configure GPIO1 in Push-Pull output */
	GPIO1->PC0 = 0xFFFF;
	GPIO1->PC1 = 0x0000;
	GPIO1->PC2 = 0xFFFF;
	GPIO1->PD = 0x0000;		// reset pins

/* TIM0 configuration */
	TIM0->CR2 &= ~0x4000;
	TIM0->CR2 = 0x400F;
	TIM0->CR1 = 0x8040;
	TIM0->OCAR = 0x619B;	// 0x09B4;
	TIM0->CNTR = 0xFFF0;

/* TIM1 configuration */
//	TIM1->CR2 &= ~0x2000;
//	TIM1->CR2 = 0x20FF;
//	TIM1->CR1 = 0x8000;
//	TIM1->CNTR = 0xFFFF;
}

void Task2 (void* pdata)
{
	pdata = pdata;

	for(;;)
	{
		GPIO1->PD = ~GPIO1->PD;
		OSTimeDly(30); // Delay 1.5 second
	}
}
/*
void Task2 (void* pdata)
{
	pdata = pdata;
	OSTaskCreate(Task3, (void*)0, (void*)&Task3Stk[0], 10);

	for(;;)
	{
		PCDR ^= 0x02; 
		OSTimeDly(40); // Delay 1 second
	}
}
*/
void Task1 (void* pdata)
{
	pdata = pdata;

	OSTaskCreate(Task2, (void*)0, (void*)&Task2Stk[TASK_STK_SIZE - 1], 9);

	Enable_Interrupt();

	for(;;) {
		GPIO0->PD = ~GPIO0->PD;
		OSTimeDly(10); // Delay 0.5 second
	}
}

/****************************************************************************
Function	: main															*
Purpose		: Main program loop												*
Parameter	: none															*
Return		: none															*
Remarks		:																*
****************************************************************************/
void main(void)
{
	/* Initialize the hardware */
	Hardware_Init();

	/* Initialize the OS, create the first task and start */
	OSInit();

	OSTaskCreate(Task1, (void*)0, (void*)&Task1Stk[TASK_STK_SIZE - 1], 8);

	OSStart();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -