/*------------------------------------------------------------------------------------------*\ * * Copyright (C) 2007 AVM GmbH * * 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 * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \*------------------------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include #include /*--- #include ---*/ #include #include #include #include #include #include #if defined(CONFIG_PROC_FS) #include #endif /*--- #if defined(CONFIG_PROC_FS) ---*/ #include "tffs_local.h" #include #include unsigned int tffs_spi_mode = 0; unsigned int tffs_direct_nor_mode = 0; static struct file tffs_panic_file; static struct inode tffs_panic_inode; static unsigned int tffs_panic_open_flag; #if 1 void my_udelay(unsigned int usec) { udelay(usec); } EXPORT_SYMBOL(my_udelay); void my_cfi_udelay(unsigned int usec) { cfi_udelay(usec); } EXPORT_SYMBOL(my_cfi_udelay); #endif void tffs_panic_log_open(void) { int ret; if(tffs_panic_open_flag == 1) return; memset(&tffs_panic_file, 0, sizeof(tffs_panic_file)); memset(&tffs_panic_inode, 0, sizeof(tffs_panic_inode)); tffs_panic_file.f_flags = O_WRONLY; tffs_panic_inode.i_rdev = CONFIG_TFFS_PANIC_LOG_ID; /*--- major muss 0 sein fuer Kernel Mode ---*/ ret = tffs_open(&tffs_panic_inode, &tffs_panic_file); if(ret) return; tffs_panic_open_flag = 1; } void tffs_panic_log_write(char *buffer, unsigned int len) { static loff_t off; if(tffs_panic_open_flag == 0) return; tffs_write(&tffs_panic_file, buffer, len > 0x8000 ? 0x8000 : len, &off); } void tffs_panic_log_close(void) { if(tffs_panic_open_flag == 0) return; tffs_release(&tffs_panic_inode, &tffs_panic_file); } void tffs_panic_log_register_spi(void) { tffs_spi_mode = 1; } void tffs_panic_log_register_nor(void) { tffs_direct_nor_mode = 1; }