test_2.c

来自「MANTIS是由科罗拉多大学开发的传感器网络嵌入式操作系统。 这是mantis」· C语言 代码 · 共 72 行

C
72
字号
/*  This file is part of MANTIS OS, Operating System for Nymph.  See http://mantis.cs.colorado.edu/  Copyright (C) 2003 University of Colorado, Boulder  This program is free software; you can redistribute it and/or  modify it under the terms of the GNU General Public License  as published by the Free Software Foundation; either version 2  of the License, or (at your option) any later version.  This program is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  GNU General Public License for more details.  You should have received a copy of the GNU General Public License  (See http://www.gnu.org/copyleft/gpl.html)  along with this program; if not, write to the Free Software  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,  USA, or send email to mantis-users@cs.colorado.edu.*//* Automated test for the Atmel-Flash */#include "command_daemon.h"#include "msched.h"#include "uart.h"#include "dev.h"#ifndef PLATFORM_LINUX#include "printf.h"#endif#define BUFFER_SIZE 64static uint8_t test[BUFFER_SIZE];static uint8_t returned[BUFFER_SIZE];thread_t *current_thread;static void test_atmel_flash (void){   uint8_t i;   for(i = 0; i < BUFFER_SIZE; i++)      test[i] = i;   dev_ioctl(DEV_ATMEL_FLASH, DEV_SEEK, (uint32_t)0);   dev_write(DEV_ATMEL_FLASH, test, BUFFER_SIZE);   dev_ioctl(DEV_ATMEL_FLASH, DEV_SEEK, (uint32_t)0);   dev_read(DEV_ATMEL_FLASH, returned, BUFFER_SIZE);   for(i = 0; i < BUFFER_SIZE; i++)      printf("%d\n", returned[i]);   mos_thread_resume(current_thread);}static void test_atmel_flash_func(void){   mos_thread_new (test_atmel_flash, 128, PRIORITY_NORMAL);   current_thread = mos_thread_current();   mos_thread_suspend();   mos_thread_sleep(10);   mos_thread_new (mos_command_daemon, 196, PRIORITY_NORMAL);}void start(void){   mos_thread_new(test_atmel_flash_func, 128, PRIORITY_NORMAL);}

⌨️ 快捷键说明

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