Embedded GPLv2 license in drivers

This commit is contained in:
yiyue.fang 2013-06-28 00:36:54 +08:00
parent 90ac1c9ba4
commit 621fbdb90c
49 changed files with 3124 additions and 2481 deletions

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team * COPYRIGHT (C) 2006, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team * COPYRIGHT (C) 2006, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team * COPYRIGHT (C) 2006, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team * COPYRIGHT (C) 2006, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, Shanghai Real-Thread Technology Co., Ltd * COPYRIGHT (C) 2012, Shanghai Real-Thread Technology Co., Ltd
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -1,19 +1,30 @@
#ifndef __SD_H__
#define __SD_H__
/* /*
* File : sd.h * File : sd.h
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team * COPYRIGHT (C) 2006, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
* 2011-07-25 weety first version * 2011-07-25 weety first version
*/ */
#ifndef __SD_H__
#define __SD_H__
#include <rtthread.h> #include <rtthread.h>
#include <drivers/mmcsd_host.h> #include <drivers/mmcsd_host.h>

View File

@ -3,20 +3,28 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team * COPYRIGHT (C) 2006, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
* 2012-01-15 weety first version * 2012-01-15 weety first version
*/ */
#ifndef __SDIO_H__ #ifndef __SDIO_H__
#define __SDIO_H__ #define __SDIO_H__
#include <rtthread.h> #include <rtthread.h>
#include <drivers/mmcsd_host.h> #include <drivers/mmcsd_host.h>
#include <drivers/mmcsd_card.h> #include <drivers/mmcsd_card.h>
@ -30,100 +38,99 @@ extern "C" {
* Card Common Control Registers (CCCR) * Card Common Control Registers (CCCR)
*/ */
#define SDIO_REG_CCCR_CCCR_REV 0x00 #define SDIO_REG_CCCR_CCCR_REV 0x00
#define SDIO_CCCR_REV_1_00 0 /* CCCR/FBR Version 1.00 */ #define SDIO_CCCR_REV_1_00 0 /* CCCR/FBR Version 1.00 */
#define SDIO_CCCR_REV_1_10 1 /* CCCR/FBR Version 1.10 */ #define SDIO_CCCR_REV_1_10 1 /* CCCR/FBR Version 1.10 */
#define SDIO_CCCR_REV_1_20 2 /* CCCR/FBR Version 1.20 */ #define SDIO_CCCR_REV_1_20 2 /* CCCR/FBR Version 1.20 */
#define SDIO_SDIO_REV_1_00 0 /* SDIO Spec Version 1.00 */ #define SDIO_SDIO_REV_1_00 0 /* SDIO Spec Version 1.00 */
#define SDIO_SDIO_REV_1_10 1 /* SDIO Spec Version 1.10 */ #define SDIO_SDIO_REV_1_10 1 /* SDIO Spec Version 1.10 */
#define SDIO_SDIO_REV_1_20 2 /* SDIO Spec Version 1.20 */ #define SDIO_SDIO_REV_1_20 2 /* SDIO Spec Version 1.20 */
#define SDIO_SDIO_REV_2_00 3 /* SDIO Spec Version 2.00 */ #define SDIO_SDIO_REV_2_00 3 /* SDIO Spec Version 2.00 */
#define SDIO_REG_CCCR_SD_REV 0x01 #define SDIO_REG_CCCR_SD_REV 0x01
#define SDIO_SD_REV_1_01 0 /* SD Physical Spec Version 1.01 */ #define SDIO_SD_REV_1_01 0 /* SD Physical Spec Version 1.01 */
#define SDIO_SD_REV_1_10 1 /* SD Physical Spec Version 1.10 */ #define SDIO_SD_REV_1_10 1 /* SD Physical Spec Version 1.10 */
#define SDIO_SD_REV_2_00 2 /* SD Physical Spec Version 2.00 */ #define SDIO_SD_REV_2_00 2 /* SD Physical Spec Version 2.00 */
#define SDIO_REG_CCCR_IO_EN 0x02 #define SDIO_REG_CCCR_IO_EN 0x02
#define SDIO_REG_CCCR_IO_RDY 0x03 #define SDIO_REG_CCCR_IO_RDY 0x03
#define SDIO_REG_CCCR_INT_EN 0x04 /* Function/Master Interrupt Enable */ #define SDIO_REG_CCCR_INT_EN 0x04 /* Function/Master Interrupt Enable */
#define SDIO_REG_CCCR_INT_PEND 0x05 /* Function Interrupt Pending */ #define SDIO_REG_CCCR_INT_PEND 0x05 /* Function Interrupt Pending */
#define SDIO_REG_CCCR_IO_ABORT 0x06 /* function abort/card reset */ #define SDIO_REG_CCCR_IO_ABORT 0x06 /* function abort/card reset */
#define SDIO_REG_CCCR_BUS_IF 0x07 /* bus interface controls */ #define SDIO_REG_CCCR_BUS_IF 0x07 /* bus interface controls */
#define SDIO_BUS_WIDTH_1BIT 0x00 #define SDIO_BUS_WIDTH_1BIT 0x00
#define SDIO_BUS_WIDTH_4BIT 0x02 #define SDIO_BUS_WIDTH_4BIT 0x02
#define SDIO_BUS_ECSI 0x20 /* Enable continuous SPI interrupt */ #define SDIO_BUS_ECSI 0x20 /* Enable continuous SPI interrupt */
#define SDIO_BUS_SCSI 0x40 /* Support continuous SPI interrupt */ #define SDIO_BUS_SCSI 0x40 /* Support continuous SPI interrupt */
#define SDIO_BUS_ASYNC_INT 0x20 #define SDIO_BUS_ASYNC_INT 0x20
#define SDIO_BUS_CD_DISABLE 0x80 /* disable pull-up on DAT3 (pin 1) */ #define SDIO_BUS_CD_DISABLE 0x80 /* disable pull-up on DAT3 (pin 1) */
#define SDIO_REG_CCCR_CARD_CAPS 0x08 #define SDIO_REG_CCCR_CARD_CAPS 0x08
#define SDIO_CCCR_CAP_SDC 0x01 /* can do CMD52 while data transfer */ #define SDIO_CCCR_CAP_SDC 0x01 /* can do CMD52 while data transfer */
#define SDIO_CCCR_CAP_SMB 0x02 /* can do multi-block xfers (CMD53) */ #define SDIO_CCCR_CAP_SMB 0x02 /* can do multi-block xfers (CMD53) */
#define SDIO_CCCR_CAP_SRW 0x04 /* supports read-wait protocol */ #define SDIO_CCCR_CAP_SRW 0x04 /* supports read-wait protocol */
#define SDIO_CCCR_CAP_SBS 0x08 /* supports suspend/resume */ #define SDIO_CCCR_CAP_SBS 0x08 /* supports suspend/resume */
#define SDIO_CCCR_CAP_S4MI 0x10 /* interrupt during 4-bit CMD53 */ #define SDIO_CCCR_CAP_S4MI 0x10 /* interrupt during 4-bit CMD53 */
#define SDIO_CCCR_CAP_E4MI 0x20 /* enable ints during 4-bit CMD53 */ #define SDIO_CCCR_CAP_E4MI 0x20 /* enable ints during 4-bit CMD53 */
#define SDIO_CCCR_CAP_LSC 0x40 /* low speed card */ #define SDIO_CCCR_CAP_LSC 0x40 /* low speed card */
#define SDIO_CCCR_CAP_4BLS 0x80 /* 4 bit low speed card */ #define SDIO_CCCR_CAP_4BLS 0x80 /* 4 bit low speed card */
#define SDIO_REG_CCCR_CIS_PTR 0x09 /* common CIS pointer (3 bytes) */ #define SDIO_REG_CCCR_CIS_PTR 0x09 /* common CIS pointer (3 bytes) */
/* Following 4 regs are valid only if SBS is set */ /* Following 4 regs are valid only if SBS is set */
#define SDIO_REG_CCCR_BUS_SUSPEND 0x0c #define SDIO_REG_CCCR_BUS_SUSPEND 0x0c
#define SDIO_REG_CCCR_FUNC_SEL 0x0d #define SDIO_REG_CCCR_FUNC_SEL 0x0d
#define SDIO_REG_CCCR_EXEC_FLAG 0x0e #define SDIO_REG_CCCR_EXEC_FLAG 0x0e
#define SDIO_REG_CCCR_READY_FLAG 0x0f #define SDIO_REG_CCCR_READY_FLAG 0x0f
#define SDIO_REG_CCCR_FN0_BLKSIZE 0x10 /* 2bytes, 0x10~0x11 */ #define SDIO_REG_CCCR_FN0_BLKSIZE 0x10 /* 2bytes, 0x10~0x11 */
#define SDIO_REG_CCCR_POWER_CTRL 0x12 #define SDIO_REG_CCCR_POWER_CTRL 0x12
#define SDIO_POWER_SMPC 0x01 /* Supports Master Power Control */ #define SDIO_POWER_SMPC 0x01 /* Supports Master Power Control */
#define SDIO_POWER_EMPC 0x02 /* Enable Master Power Control */ #define SDIO_POWER_EMPC 0x02 /* Enable Master Power Control */
#define SDIO_REG_CCCR_SPEED 0x13 #define SDIO_REG_CCCR_SPEED 0x13
#define SDIO_SPEED_SHS 0x01 /* Supports High-Speed mode */ #define SDIO_SPEED_SHS 0x01 /* Supports High-Speed mode */
#define SDIO_SPEED_EHS 0x02 /* Enable High-Speed mode */ #define SDIO_SPEED_EHS 0x02 /* Enable High-Speed mode */
/* /*
* Function Basic Registers (FBR) * Function Basic Registers (FBR)
*/ */
#define SDIO_REG_FBR_BASE(f) ((f) * 0x100) /* base of function f's FBRs */ #define SDIO_REG_FBR_BASE(f) ((f) * 0x100) /* base of function f's FBRs */
#define SDIO_REG_FBR_STD_FUNC_IF 0x00 #define SDIO_REG_FBR_STD_FUNC_IF 0x00
#define SDIO_FBR_SUPPORTS_CSA 0x40 /* supports Code Storage Area */ #define SDIO_FBR_SUPPORTS_CSA 0x40 /* supports Code Storage Area */
#define SDIO_FBR_ENABLE_CSA 0x80 /* enable Code Storage Area */ #define SDIO_FBR_ENABLE_CSA 0x80 /* enable Code Storage Area */
#define SDIO_REG_FBR_STD_IF_EXT 0x01 #define SDIO_REG_FBR_STD_IF_EXT 0x01
#define SDIO_REG_FBR_POWER 0x02 #define SDIO_REG_FBR_POWER 0x02
#define SDIO_FBR_POWER_SPS 0x01 /* Supports Power Selection */ #define SDIO_FBR_POWER_SPS 0x01 /* Supports Power Selection */
#define SDIO_FBR_POWER_EPS 0x02 /* Enable (low) Power Selection */ #define SDIO_FBR_POWER_EPS 0x02 /* Enable (low) Power Selection */
#define SDIO_REG_FBR_CIS 0x09 /* CIS pointer (3 bytes) */ #define SDIO_REG_FBR_CIS 0x09 /* CIS pointer (3 bytes) */
#define SDIO_REG_FBR_CSA 0x0C /* CSA pointer (3 bytes) */ #define SDIO_REG_FBR_CSA 0x0C /* CSA pointer (3 bytes) */
#define SDIO_REG_FBR_CSA_DATA 0x0F #define SDIO_REG_FBR_CSA_DATA 0x0F
#define SDIO_REG_FBR_BLKSIZE 0x10 /* block size (2 bytes) */
#define SDIO_REG_FBR_BLKSIZE 0x10 /* block size (2 bytes) */
/* SDIO CIS Tuple code */ /* SDIO CIS Tuple code */
#define CISTPL_NULL 0x00 #define CISTPL_NULL 0x00
@ -142,55 +149,85 @@ extern "C" {
#define SDIO_ANY_MAN_ID 0xffff #define SDIO_ANY_MAN_ID 0xffff
#define SDIO_ANY_PROD_ID 0xffff #define SDIO_ANY_PROD_ID 0xffff
struct rt_sdio_device_id { struct rt_sdio_device_id
rt_uint8_t func_code; {
rt_uint16_t manufacturer; rt_uint8_t func_code;
rt_uint16_t product; rt_uint16_t manufacturer;
rt_uint16_t product;
}; };
struct rt_sdio_driver { struct rt_sdio_driver
char *name; {
rt_int32_t (*probe)(struct rt_mmcsd_card *card); char *name;
rt_int32_t (*remove)(struct rt_mmcsd_card *card); rt_int32_t (*probe)(struct rt_mmcsd_card *card);
struct rt_sdio_device_id *id; rt_int32_t (*remove)(struct rt_mmcsd_card *card);
struct rt_sdio_device_id *id;
}; };
rt_int32_t sdio_io_send_op_cond(struct rt_mmcsd_host *host,
rt_uint32_t ocr,
rt_int32_t sdio_io_send_op_cond(struct rt_mmcsd_host *host, rt_uint32_t ocr, rt_uint32_t rt_uint32_t *cmd5_resp);
*cmd5_resp); rt_int32_t sdio_io_rw_direct(struct rt_mmcsd_card *card,
rt_int32_t sdio_io_rw_direct(struct rt_mmcsd_card *card, rt_int32_t rw, rt_uint32_t fn, rt_int32_t rw,
rt_uint32_t reg_addr, rt_uint8_t *pdata, rt_uint8_t raw); rt_uint32_t fn,
rt_int32_t sdio_io_rw_extended(struct rt_mmcsd_card *card, rt_int32_t rw, rt_uint32_t fn, rt_uint32_t reg_addr,
rt_uint32_t addr, rt_int32_t op_code, rt_uint8_t *buf, rt_uint32_t blocks, rt_uint32_t blksize); rt_uint8_t *pdata,
rt_uint8_t raw);
rt_int32_t sdio_io_rw_extended(struct rt_mmcsd_card *card,
rt_int32_t rw,
rt_uint32_t fn,
rt_uint32_t addr,
rt_int32_t op_code,
rt_uint8_t *buf,
rt_uint32_t blocks,
rt_uint32_t blksize);
rt_uint8_t sdio_io_readb(struct rt_sdio_function *func, rt_uint8_t sdio_io_readb(struct rt_sdio_function *func,
rt_uint32_t reg, rt_int32_t *err); rt_uint32_t reg,
rt_int32_t *err);
rt_int32_t sdio_io_writeb(struct rt_sdio_function *func, rt_int32_t sdio_io_writeb(struct rt_sdio_function *func,
rt_uint32_t reg, rt_uint8_t data); rt_uint32_t reg,
rt_uint16_t sdio_io_readw(struct rt_sdio_function *func, rt_uint32_t addr, rt_int32_t *err); rt_uint8_t data);
rt_int32_t sdio_io_writew(struct rt_sdio_function *func, rt_uint16_t data, rt_uint32_t addr); rt_uint16_t sdio_io_readw(struct rt_sdio_function *func,
rt_uint32_t sdio_io_readl(struct rt_sdio_function *func, rt_uint32_t addr, rt_int32_t *err); rt_uint32_t addr,
rt_int32_t sdio_io_writel(struct rt_sdio_function *func, rt_uint32_t data, rt_uint32_t addr); rt_int32_t *err);
rt_int32_t sdio_io_writew(struct rt_sdio_function *func,
rt_uint16_t data,
rt_uint32_t addr);
rt_uint32_t sdio_io_readl(struct rt_sdio_function *func,
rt_uint32_t addr,
rt_int32_t *err);
rt_int32_t sdio_io_writel(struct rt_sdio_function *func,
rt_uint32_t data,
rt_uint32_t addr);
rt_int32_t sdio_io_read_multi_fifo_b(struct rt_sdio_function *func, rt_int32_t sdio_io_read_multi_fifo_b(struct rt_sdio_function *func,
rt_uint32_t addr, rt_uint8_t *buf, rt_uint32_t len); rt_uint32_t addr,
rt_uint8_t *buf,
rt_uint32_t len);
rt_int32_t sdio_io_write_multi_fifo_b(struct rt_sdio_function *func, rt_int32_t sdio_io_write_multi_fifo_b(struct rt_sdio_function *func,
rt_uint32_t addr, rt_uint8_t *buf, rt_uint32_t len); rt_uint32_t addr,
rt_uint8_t *buf,
rt_uint32_t len);
rt_int32_t sdio_io_read_multi_incr_b(struct rt_sdio_function *func, rt_int32_t sdio_io_read_multi_incr_b(struct rt_sdio_function *func,
rt_uint32_t addr, rt_uint8_t *buf, rt_uint32_t len); rt_uint32_t addr,
rt_uint8_t *buf,
rt_uint32_t len);
rt_int32_t sdio_io_write_multi_incr_b(struct rt_sdio_function *func, rt_int32_t sdio_io_write_multi_incr_b(struct rt_sdio_function *func,
rt_uint32_t addr, rt_uint8_t *buf, rt_uint32_t len); rt_uint32_t addr,
rt_uint8_t *buf,
rt_uint32_t len);
rt_int32_t init_sdio(struct rt_mmcsd_host *host, rt_uint32_t ocr); rt_int32_t init_sdio(struct rt_mmcsd_host *host, rt_uint32_t ocr);
rt_int32_t sdio_attach_irq(struct rt_sdio_function *func, rt_sdio_irq_handler_t *handler); rt_int32_t sdio_attach_irq(struct rt_sdio_function *func,
rt_sdio_irq_handler_t *handler);
rt_int32_t sdio_detach_irq(struct rt_sdio_function *func); rt_int32_t sdio_detach_irq(struct rt_sdio_function *func);
void sdio_irq_wakeup(struct rt_mmcsd_host *host); void sdio_irq_wakeup(struct rt_mmcsd_host *host);
rt_int32_t sdio_enable_func(struct rt_sdio_function *func); rt_int32_t sdio_enable_func(struct rt_sdio_function *func);
rt_int32_t sdio_disable_func(struct rt_sdio_function *func); rt_int32_t sdio_disable_func(struct rt_sdio_function *func);
rt_int32_t sdio_set_block_size(struct rt_sdio_function *func, rt_uint32_t blksize); rt_int32_t sdio_set_block_size(struct rt_sdio_function *func,
rt_uint32_t blksize);
rt_int32_t sdio_register_driver(struct rt_sdio_driver *driver); rt_int32_t sdio_register_driver(struct rt_sdio_driver *driver);
rt_int32_t sdio_unregister_driver(struct rt_sdio_driver *driver); rt_int32_t sdio_unregister_driver(struct rt_sdio_driver *driver);
void rt_sdio_init(void); void rt_sdio_init(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -3,34 +3,43 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team * COPYRIGHT (C) 2006, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
* 2012-02-26 weety first version * 2012-02-26 weety first version
*/ */
#ifndef __SDIO_FUNC_IDS_H__ #ifndef __SDIO_FUNC_IDS_H__
#define __SDIO_FUNC_IDS_H__ #define __SDIO_FUNC_IDS_H__
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* Standard SDIO Function Interfaces */ /* Standard SDIO Function Interfaces */
#define SDIO_FUNC_CODE_NONE 0x00 /* Not a SDIO standard interface */ #define SDIO_FUNC_CODE_NONE 0x00 /* Not a SDIO standard interface */
#define SDIO_FUNC_CODE_UART 0x01 /* SDIO Standard UART */ #define SDIO_FUNC_CODE_UART 0x01 /* SDIO Standard UART */
#define SDIO_FUNC_CODE_BT_A 0x02 /* SDIO Type-A for Bluetooth standard interface */ #define SDIO_FUNC_CODE_BT_A 0x02 /* SDIO Type-A for Bluetooth standard interface */
#define SDIO_FUNC_CODE_BT_B 0x03 /* SDIO Type-B for Bluetooth standard interface */ #define SDIO_FUNC_CODE_BT_B 0x03 /* SDIO Type-B for Bluetooth standard interface */
#define SDIO_FUNC_CODE_GPS 0x04 /* SDIO GPS standard interface */ #define SDIO_FUNC_CODE_GPS 0x04 /* SDIO GPS standard interface */
#define SDIO_FUNC_CODE_CAMERA 0x05 /* SDIO Camera standard interface */ #define SDIO_FUNC_CODE_CAMERA 0x05 /* SDIO Camera standard interface */
#define SDIO_FUNC_CODE_PHS 0x06 /* SDIO PHS standard interface */ #define SDIO_FUNC_CODE_PHS 0x06 /* SDIO PHS standard interface */
#define SDIO_FUNC_CODE_WLAN 0x07 /* SDIO WLAN interface */ #define SDIO_FUNC_CODE_WLAN 0x07 /* SDIO WLAN interface */
#define SDIO_FUNC_CODE_ATA 0x08 /* Embedded SDIO-ATA standard interface */ #define SDIO_FUNC_CODE_ATA 0x08 /* Embedded SDIO-ATA standard interface */
/* manufacturer id, product io */ /* manufacturer id, product io */

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, RT-Thread Development Team * COPYRIGHT (C) 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
@ -175,15 +185,16 @@ typedef struct udev_msg* udev_msg_t;
udevice_t rt_usbd_device_create(void); udevice_t rt_usbd_device_create(void);
uconfig_t rt_usbd_config_create(void); uconfig_t rt_usbd_config_create(void);
uclass_t rt_usbd_class_create(udevice_t device, udev_desc_t dev_desc, uclass_t rt_usbd_class_create(udevice_t device,
udev_desc_t dev_desc,
uclass_ops_t ops); uclass_ops_t ops);
uintf_t rt_usbd_interface_create(udevice_t device, uintf_handler_t handler); uintf_t rt_usbd_interface_create(udevice_t device, uintf_handler_t handler);
uep_t rt_usbd_endpoint_create(uep_desc_t ep_desc, udep_handler_t handler); uep_t rt_usbd_endpoint_create(uep_desc_t ep_desc, udep_handler_t handler);
ualtsetting_t rt_usbd_altsetting_create(rt_size_t desc_size); ualtsetting_t rt_usbd_altsetting_create(rt_size_t desc_size);
rt_err_t rt_usbd_core_init(void); rt_err_t rt_usbd_core_init(void);
rt_err_t rt_usb_device_init(const char* udc_name); rt_err_t rt_usb_device_init(const char *udc_name);
rt_err_t rt_usbd_post_event(struct udev_msg* msg, rt_size_t size); rt_err_t rt_usbd_post_event(struct udev_msg *msg, rt_size_t size);
rt_err_t rt_usbd_free_device(udevice_t device); rt_err_t rt_usbd_free_device(udevice_t device);
rt_err_t rt_usbd_device_set_controller(udevice_t device, udcd_t dcd); rt_err_t rt_usbd_device_set_controller(udevice_t device, udcd_t dcd);
rt_err_t rt_usbd_device_set_descriptor(udevice_t device, udev_desc_t dev_desc); rt_err_t rt_usbd_device_set_descriptor(udevice_t device, udev_desc_t dev_desc);
@ -193,14 +204,20 @@ rt_err_t rt_usbd_config_add_class(uconfig_t cfg, uclass_t cls);
rt_err_t rt_usbd_class_add_interface(uclass_t cls, uintf_t intf); rt_err_t rt_usbd_class_add_interface(uclass_t cls, uintf_t intf);
rt_err_t rt_usbd_interface_add_altsetting(uintf_t intf, ualtsetting_t setting); rt_err_t rt_usbd_interface_add_altsetting(uintf_t intf, ualtsetting_t setting);
rt_err_t rt_usbd_altsetting_add_endpoint(ualtsetting_t setting, uep_t ep); rt_err_t rt_usbd_altsetting_add_endpoint(ualtsetting_t setting, uep_t ep);
rt_err_t rt_usbd_altsetting_config_descriptor(ualtsetting_t setting, const void* desc, rt_off_t intf_pos); rt_err_t rt_usbd_altsetting_config_descriptor(ualtsetting_t setting,
const void *desc,
rt_off_t intf_pos);
rt_err_t rt_usbd_set_config(udevice_t device, rt_uint8_t value); rt_err_t rt_usbd_set_config(udevice_t device, rt_uint8_t value);
rt_err_t rt_usbd_set_altsetting(uintf_t intf, rt_uint8_t value); rt_err_t rt_usbd_set_altsetting(uintf_t intf, rt_uint8_t value);
udevice_t rt_usbd_find_device(udcd_t dcd); udevice_t rt_usbd_find_device(udcd_t dcd);
uconfig_t rt_usbd_find_config(udevice_t device, rt_uint8_t value); uconfig_t rt_usbd_find_config(udevice_t device, rt_uint8_t value);
uintf_t rt_usbd_find_interface(udevice_t device, rt_uint8_t value, uclass_t *pcls); uintf_t rt_usbd_find_interface(udevice_t device,
uep_t rt_usbd_find_endpoint(udevice_t device, uclass_t* pcls, rt_uint8_t ep_addr); rt_uint8_t value,
uclass_t *pcls);
uep_t rt_usbd_find_endpoint(udevice_t device,
uclass_t *pcls,
rt_uint8_t ep_addr);
uclass_t rt_usbd_class_mstorage_create(udevice_t device); uclass_t rt_usbd_class_mstorage_create(udevice_t device);
uclass_t rt_usbd_class_cdc_create(udevice_t device); uclass_t rt_usbd_class_cdc_create(udevice_t device);
@ -218,14 +235,18 @@ rt_inline rt_err_t dcd_set_address(udcd_t dcd, rt_uint8_t value)
return dcd->ops->set_address(value); return dcd->ops->set_address(value);
} }
rt_inline rt_err_t dcd_clear_feature(udcd_t dcd, rt_uint16_t value, rt_uint16_t index) rt_inline rt_err_t dcd_clear_feature(udcd_t dcd,
rt_uint16_t value,
rt_uint16_t index)
{ {
RT_ASSERT(dcd != RT_NULL); RT_ASSERT(dcd != RT_NULL);
return dcd->ops->clear_feature(value, index); return dcd->ops->clear_feature(value, index);
} }
rt_inline rt_err_t dcd_set_feature(udcd_t dcd, rt_uint8_t value, rt_uint16_t index) rt_inline rt_err_t dcd_set_feature(udcd_t dcd,
rt_uint8_t value,
rt_uint16_t index)
{ {
RT_ASSERT(dcd != RT_NULL); RT_ASSERT(dcd != RT_NULL);
@ -275,7 +296,9 @@ rt_inline rt_err_t dcd_ep_read(udcd_t dcd, uep_t ep, void *buffer,
return dcd->ops->ep_read(ep, buffer, size); return dcd->ops->ep_read(ep, buffer, size);
} }
rt_inline rt_size_t dcd_ep_write(udcd_t dcd, uep_t ep, void *buffer, rt_inline rt_size_t dcd_ep_write(udcd_t dcd,
uep_t ep,
void *buffer,
rt_size_t size) rt_size_t size)
{ {
RT_ASSERT(dcd != RT_NULL); RT_ASSERT(dcd != RT_NULL);

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2011, RT-Thread Development Team * COPYRIGHT (C) 2011, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
@ -167,23 +177,27 @@ void rt_usb_hub_thread(void);
uinst_t rt_usb_alloc_instance(void); uinst_t rt_usb_alloc_instance(void);
rt_err_t rt_usb_attatch_instance(uinst_t uinst); rt_err_t rt_usb_attatch_instance(uinst_t uinst);
rt_err_t rt_usb_detach_instance(uinst_t uinst); rt_err_t rt_usb_detach_instance(uinst_t uinst);
rt_err_t rt_usb_get_descriptor(uinst_t uinst, rt_uint8_t type, void* buffer, rt_err_t rt_usb_get_descriptor(uinst_t uinst,
int nbytes); rt_uint8_t type,
void *buffer,
int nbytes);
rt_err_t rt_usb_set_configure(uinst_t uinst, int config); rt_err_t rt_usb_set_configure(uinst_t uinst, int config);
rt_err_t rt_usb_set_address(uinst_t uinst); rt_err_t rt_usb_set_address(uinst_t uinst);
rt_err_t rt_usb_set_interface(uinst_t uinst, int intf); rt_err_t rt_usb_set_interface(uinst_t uinst, int intf);
rt_err_t rt_usb_clear_feature(uinst_t uinst, int endpoint, int feature); rt_err_t rt_usb_clear_feature(uinst_t uinst, int endpoint, int feature);
rt_err_t rt_usb_get_interface_descriptor(ucfg_desc_t cfg_desc, int num, rt_err_t rt_usb_get_interface_descriptor(ucfg_desc_t cfg_desc,
uintf_desc_t* intf_desc); int num,
rt_err_t rt_usb_get_endpoint_descriptor(uintf_desc_t intf_desc, int num, uintf_desc_t *intf_desc);
uep_desc_t* ep_desc); rt_err_t rt_usb_get_endpoint_descriptor(uintf_desc_t intf_desc,
int num,
uep_desc_t *ep_desc);
/* usb class driver interface */ /* usb class driver interface */
rt_err_t rt_usb_class_driver_init(void); rt_err_t rt_usb_class_driver_init(void);
rt_err_t rt_usb_class_driver_register(ucd_t drv); rt_err_t rt_usb_class_driver_register(ucd_t drv);
rt_err_t rt_usb_class_driver_unregister(ucd_t drv); rt_err_t rt_usb_class_driver_unregister(ucd_t drv);
rt_err_t rt_usb_class_driver_run(ucd_t drv, void* args); rt_err_t rt_usb_class_driver_run(ucd_t drv, void *args);
rt_err_t rt_usb_class_driver_stop(ucd_t drv, void* args); rt_err_t rt_usb_class_driver_stop(ucd_t drv, void *args);
ucd_t rt_usb_class_driver_find(int class_code, int subclass_code); ucd_t rt_usb_class_driver_find(int class_code, int subclass_code);
/* usb class driver implement */ /* usb class driver implement */
@ -197,28 +211,39 @@ uprotocal_t rt_usb_hid_protocal_kbd(void);
uprotocal_t rt_usb_hid_protocal_mouse(void); uprotocal_t rt_usb_hid_protocal_mouse(void);
/* usb adk class driver interface */ /* usb adk class driver interface */
rt_err_t rt_usb_adk_set_string(const char* manufacturer, const char* model, rt_err_t rt_usb_adk_set_string(const char *manufacturer,
const char* description, const char* version, const char* uri, const char *model,
const char* serial); const char *description,
const char *version,
const char *uri,
const char *serial);
/* usb hub interface */ /* usb hub interface */
rt_err_t rt_usb_hub_get_descriptor(uinst_t uinst, rt_uint8_t *buffer, rt_err_t rt_usb_hub_get_descriptor(uinst_t uinst,
rt_size_t size); rt_uint8_t *buffer,
rt_err_t rt_usb_hub_get_status(uinst_t uinst, rt_uint8_t* buffer); rt_size_t size);
rt_err_t rt_usb_hub_get_port_status(uhubinst_t uhub, rt_uint16_t port, rt_err_t rt_usb_hub_get_status(uinst_t uinst, rt_uint8_t *buffer);
rt_uint8_t* buffer); rt_err_t rt_usb_hub_get_port_status(uhubinst_t uhub,
rt_err_t rt_usb_hub_clear_port_feature(uhubinst_t uhub, rt_uint16_t port, rt_uint16_t port,
rt_uint16_t feature); rt_uint8_t *buffer);
rt_err_t rt_usb_hub_set_port_feature(uhubinst_t uhub, rt_uint16_t port, rt_err_t rt_usb_hub_clear_port_feature(uhubinst_t uhub,
rt_uint16_t feature); rt_uint16_t port,
rt_uint16_t feature);
rt_err_t rt_usb_hub_set_port_feature(uhubinst_t uhub,
rt_uint16_t port,
rt_uint16_t feature);
rt_err_t rt_usb_hub_reset_port(uhubinst_t uhub, rt_uint16_t port); rt_err_t rt_usb_hub_reset_port(uhubinst_t uhub, rt_uint16_t port);
rt_err_t rt_usb_post_event(struct uhost_msg* msg, rt_size_t size); rt_err_t rt_usb_post_event(struct uhost_msg* msg, rt_size_t size);
/* usb host controller driver interface */ /* usb host controller driver interface */
rt_inline rt_err_t rt_usb_hcd_alloc_pipe(uhcd_t hcd, upipe_t* pipe, rt_inline rt_err_t rt_usb_hcd_alloc_pipe(uhcd_t hcd,
uifinst_t ifinst, uep_desc_t ep, func_callback callback) upipe_t *pipe,
uifinst_t ifinst,
uep_desc_t ep,
func_callback callback)
{ {
if(ifinst == RT_NULL) return -RT_EIO; if (ifinst == RT_NULL)
return -RT_EIO;
return hcd->ops->alloc_pipe(pipe, ifinst, ep, callback); return hcd->ops->alloc_pipe(pipe, ifinst, ep, callback);
} }
@ -230,40 +255,59 @@ rt_inline rt_err_t rt_usb_hcd_free_pipe(uhcd_t hcd, upipe_t pipe)
return hcd->ops->free_pipe(pipe); return hcd->ops->free_pipe(pipe);
} }
rt_inline int rt_usb_hcd_bulk_xfer(uhcd_t hcd, upipe_t pipe, void* buffer, rt_inline int rt_usb_hcd_bulk_xfer(uhcd_t hcd,
int nbytes, int timeout) upipe_t pipe,
void *buffer,
int nbytes,
int timeout)
{ {
if(pipe == RT_NULL) return -1; if (pipe == RT_NULL)
if(pipe->ifinst == RT_NULL) return -1; return -1;
if(pipe->ifinst->uinst == RT_NULL) return -1; if (pipe->ifinst == RT_NULL)
if(pipe->ifinst->uinst->status == UINST_STATUS_IDLE) return -1;
if (pipe->ifinst->uinst == RT_NULL)
return -1;
if (pipe->ifinst->uinst->status == UINST_STATUS_IDLE)
return -1; return -1;
return hcd->ops->bulk_xfer(pipe, buffer, nbytes, timeout); return hcd->ops->bulk_xfer(pipe, buffer, nbytes, timeout);
} }
rt_inline int rt_usb_hcd_control_xfer(uhcd_t hcd, uinst_t uinst, ureq_t setup, rt_inline int rt_usb_hcd_control_xfer(uhcd_t hcd,
void* buffer, int nbytes, int timeout) uinst_t uinst,
ureq_t setup,
void *buffer,
int nbytes,
int timeout)
{ {
if(uinst->status == UINST_STATUS_IDLE) return -1; if (uinst->status == UINST_STATUS_IDLE)
return -1;
return hcd->ops->ctl_xfer(uinst, setup, buffer, nbytes, timeout); return hcd->ops->ctl_xfer(uinst, setup, buffer, nbytes, timeout);
} }
rt_inline int rt_usb_hcd_int_xfer(uhcd_t hcd, upipe_t pipe, void* buffer, rt_inline int rt_usb_hcd_int_xfer(uhcd_t hcd,
int nbytes, int timeout) upipe_t pipe,
void *buffer,
int nbytes,
int timeout)
{ {
if(pipe == RT_NULL) return -1; if (pipe == RT_NULL)
if(pipe->ifinst == RT_NULL) return -1; return -1;
if(pipe->ifinst->uinst == RT_NULL) return -1; if (pipe->ifinst == RT_NULL)
if(pipe->ifinst->uinst->status == UINST_STATUS_IDLE) return -1;
if (pipe->ifinst->uinst == RT_NULL)
return -1;
if (pipe->ifinst->uinst->status == UINST_STATUS_IDLE)
return -1; return -1;
return hcd->ops->int_xfer(pipe, buffer, nbytes, timeout); return hcd->ops->int_xfer(pipe, buffer, nbytes, timeout);
} }
rt_inline rt_err_t rt_usb_hcd_hub_control(uhcd_t hcd, rt_uint16_t port, rt_inline rt_err_t rt_usb_hcd_hub_control(uhcd_t hcd,
rt_uint8_t cmd, void *args) rt_uint16_t port,
rt_uint8_t cmd,
void *args)
{ {
return hcd->ops->hub_ctrl(port, cmd, args); return hcd->ops->hub_ctrl(port, cmd, args);
} }

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, Shanghai Real-Thread Technology Co., Ltd * COPYRIGHT (C) 2012, Shanghai Real-Thread Technology Co., Ltd
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,13 +3,23 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team * COPYRIGHT (C) 2006, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
* 2011-07-25 weety first version * 2011-07-25 weety first version
*/ */
#include <rtthread.h> #include <rtthread.h>
@ -21,11 +31,11 @@ static rt_list_t blk_devices;
struct mmcsd_blk_device struct mmcsd_blk_device
{ {
struct rt_mmcsd_card *card; struct rt_mmcsd_card *card;
rt_list_t list; rt_list_t list;
struct rt_device dev; struct rt_device dev;
struct dfs_partition part; struct dfs_partition part;
struct rt_device_blk_geometry geometry; struct rt_device_blk_geometry geometry;
}; };
#ifndef RT_MMCSD_MAX_PARTITION #ifndef RT_MMCSD_MAX_PARTITION
@ -34,409 +44,425 @@ struct mmcsd_blk_device
static rt_int32_t mmcsd_num_wr_blocks(struct rt_mmcsd_card *card) static rt_int32_t mmcsd_num_wr_blocks(struct rt_mmcsd_card *card)
{ {
rt_int32_t err; rt_int32_t err;
rt_uint32_t blocks; rt_uint32_t blocks;
struct rt_mmcsd_req req; struct rt_mmcsd_req req;
struct rt_mmcsd_cmd cmd; struct rt_mmcsd_cmd cmd;
struct rt_mmcsd_data data; struct rt_mmcsd_data data;
rt_uint32_t timeout_us; rt_uint32_t timeout_us;
rt_memset(&cmd, 0, sizeof(struct rt_mmcsd_cmd)); rt_memset(&cmd, 0, sizeof(struct rt_mmcsd_cmd));
cmd.cmd_code = APP_CMD; cmd.cmd_code = APP_CMD;
cmd.arg = card->rca << 16; cmd.arg = card->rca << 16;
cmd.flags = RESP_SPI_R1 | RESP_R1 | CMD_AC; cmd.flags = RESP_SPI_R1 | RESP_R1 | CMD_AC;
err = mmcsd_send_cmd(card->host, &cmd, 0); err = mmcsd_send_cmd(card->host, &cmd, 0);
if (err) if (err)
return -RT_ERROR; return -RT_ERROR;
if (!controller_is_spi(card->host) && !(cmd.resp[0] & R1_APP_CMD)) if (!controller_is_spi(card->host) && !(cmd.resp[0] & R1_APP_CMD))
return -RT_ERROR; return -RT_ERROR;
rt_memset(&cmd, 0, sizeof(struct rt_mmcsd_cmd)); rt_memset(&cmd, 0, sizeof(struct rt_mmcsd_cmd));
cmd.cmd_code = SD_APP_SEND_NUM_WR_BLKS; cmd.cmd_code = SD_APP_SEND_NUM_WR_BLKS;
cmd.arg = 0; cmd.arg = 0;
cmd.flags = RESP_SPI_R1 | RESP_R1 | CMD_ADTC; cmd.flags = RESP_SPI_R1 | RESP_R1 | CMD_ADTC;
rt_memset(&data, 0, sizeof(struct rt_mmcsd_data)); rt_memset(&data, 0, sizeof(struct rt_mmcsd_data));
data.timeout_ns = card->tacc_ns * 100; data.timeout_ns = card->tacc_ns * 100;
data.timeout_clks = card->tacc_clks * 100; data.timeout_clks = card->tacc_clks * 100;
timeout_us = data.timeout_ns / 1000; timeout_us = data.timeout_ns / 1000;
timeout_us += data.timeout_clks * 1000 / timeout_us += data.timeout_clks * 1000 /
(card->host->io_cfg.clock / 1000); (card->host->io_cfg.clock / 1000);
if (timeout_us > 100000) if (timeout_us > 100000)
{ {
data.timeout_ns = 100000000; data.timeout_ns = 100000000;
data.timeout_clks = 0; data.timeout_clks = 0;
} }
data.blksize = 4; data.blksize = 4;
data.blks = 1; data.blks = 1;
data.flags = DATA_DIR_READ; data.flags = DATA_DIR_READ;
data.buf = &blocks; data.buf = &blocks;
rt_memset(&req, 0, sizeof(struct rt_mmcsd_req)); rt_memset(&req, 0, sizeof(struct rt_mmcsd_req));
req.cmd = &cmd; req.cmd = &cmd;
req.data = &data; req.data = &data;
mmcsd_send_request(card->host, &req); mmcsd_send_request(card->host, &req);
if (cmd.err || data.err) if (cmd.err || data.err)
return -RT_ERROR; return -RT_ERROR;
return blocks; return blocks;
} }
static rt_err_t rt_mmcsd_req_blk(struct rt_mmcsd_card *card, rt_uint32_t sector, void *buf, rt_size_t blks, rt_uint8_t dir) static rt_err_t rt_mmcsd_req_blk(struct rt_mmcsd_card *card,
rt_uint32_t sector,
void *buf,
rt_size_t blks,
rt_uint8_t dir)
{ {
void *aligned_buf; void *aligned_buf;
struct rt_mmcsd_cmd cmd, stop; struct rt_mmcsd_cmd cmd, stop;
struct rt_mmcsd_data data; struct rt_mmcsd_data data;
struct rt_mmcsd_req req; struct rt_mmcsd_req req;
struct rt_mmcsd_host *host = card->host; struct rt_mmcsd_host *host = card->host;
rt_uint32_t r_cmd, w_cmd; rt_uint32_t r_cmd, w_cmd;
mmcsd_host_lock(host); mmcsd_host_lock(host);
rt_memset(&req, 0, sizeof(struct rt_mmcsd_req)); rt_memset(&req, 0, sizeof(struct rt_mmcsd_req));
rt_memset(&cmd, 0, sizeof(struct rt_mmcsd_cmd)); rt_memset(&cmd, 0, sizeof(struct rt_mmcsd_cmd));
rt_memset(&stop, 0, sizeof(struct rt_mmcsd_cmd)); rt_memset(&stop, 0, sizeof(struct rt_mmcsd_cmd));
rt_memset(&data, 0, sizeof(struct rt_mmcsd_data)); rt_memset(&data, 0, sizeof(struct rt_mmcsd_data));
req.cmd = &cmd; req.cmd = &cmd;
req.data = &data; req.data = &data;
cmd.arg = sector; cmd.arg = sector;
if (!(card->flags & CARD_FLAG_SDHC)) if (!(card->flags & CARD_FLAG_SDHC))
{ {
cmd.arg <<= 9; cmd.arg <<= 9;
} }
cmd.flags = RESP_SPI_R1 | RESP_R1 | CMD_ADTC; cmd.flags = RESP_SPI_R1 | RESP_R1 | CMD_ADTC;
data.blksize = SECTOR_SIZE; data.blksize = SECTOR_SIZE;
data.blks = blks; data.blks = blks;
if (blks > 1) if (blks > 1)
{ {
if (!controller_is_spi(card->host) || !dir) if (!controller_is_spi(card->host) || !dir)
{ {
req.stop = &stop; req.stop = &stop;
stop.cmd_code = STOP_TRANSMISSION; stop.cmd_code = STOP_TRANSMISSION;
stop.arg = 0; stop.arg = 0;
stop.flags = RESP_SPI_R1B | RESP_R1B | CMD_AC; stop.flags = RESP_SPI_R1B | RESP_R1B | CMD_AC;
} }
r_cmd = READ_MULTIPLE_BLOCK; r_cmd = READ_MULTIPLE_BLOCK;
w_cmd = WRITE_MULTIPLE_BLOCK; w_cmd = WRITE_MULTIPLE_BLOCK;
} }
else else
{ {
req.stop = NULL; req.stop = NULL;
r_cmd = READ_SINGLE_BLOCK; r_cmd = READ_SINGLE_BLOCK;
w_cmd = WRITE_BLOCK; w_cmd = WRITE_BLOCK;
} }
if (!dir) if (!dir)
{ {
cmd.cmd_code = r_cmd; cmd.cmd_code = r_cmd;
data.flags |= DATA_DIR_READ; data.flags |= DATA_DIR_READ;
} }
else else
{ {
cmd.cmd_code = w_cmd; cmd.cmd_code = w_cmd;
data.flags |= DATA_DIR_WRITE; data.flags |= DATA_DIR_WRITE;
} }
mmcsd_set_data_timeout(&data, card); mmcsd_set_data_timeout(&data, card);
data.buf = buf; data.buf = buf;
mmcsd_send_request(host, &req); mmcsd_send_request(host, &req);
if (!controller_is_spi(card->host) && dir != 0) if (!controller_is_spi(card->host) && dir != 0)
{ {
do do
{ {
rt_int32_t err; rt_int32_t err;
cmd.cmd_code = SEND_STATUS; cmd.cmd_code = SEND_STATUS;
cmd.arg = card->rca << 16; cmd.arg = card->rca << 16;
cmd.flags = RESP_R1 | CMD_AC; cmd.flags = RESP_R1 | CMD_AC;
err = mmcsd_send_cmd(card->host, &cmd, 5); err = mmcsd_send_cmd(card->host, &cmd, 5);
if (err) if (err)
{ {
rt_kprintf("error %d requesting status\n", err); rt_kprintf("error %d requesting status\n", err);
break; break;
} }
/* /*
* Some cards mishandle the status bits, * Some cards mishandle the status bits,
* so make sure to check both the busy * so make sure to check both the busy
* indication and the card state. * indication and the card state.
*/ */
} while (!(cmd.resp[0] & R1_READY_FOR_DATA) || } while (!(cmd.resp[0] & R1_READY_FOR_DATA) ||
(R1_CURRENT_STATE(cmd.resp[0]) == 7)); (R1_CURRENT_STATE(cmd.resp[0]) == 7));
} }
mmcsd_host_unlock(host); mmcsd_host_unlock(host);
if (cmd.err || data.err || stop.err) if (cmd.err || data.err || stop.err)
{ {
rt_kprintf("mmcsd request blocks error\n"); rt_kprintf("mmcsd request blocks error\n");
rt_kprintf("%d,%d,%d, 0x%08x,0x%08x\n", cmd.err, data.err, stop.err, data.flags, sector); rt_kprintf("%d,%d,%d, 0x%08x,0x%08x\n",
cmd.err, data.err, stop.err, data.flags, sector);
return -RT_ERROR; return -RT_ERROR;
} }
return RT_EOK; return RT_EOK;
} }
static rt_err_t rt_mmcsd_init(rt_device_t dev) static rt_err_t rt_mmcsd_init(rt_device_t dev)
{ {
return RT_EOK; return RT_EOK;
} }
static rt_err_t rt_mmcsd_open(rt_device_t dev, rt_uint16_t oflag) static rt_err_t rt_mmcsd_open(rt_device_t dev, rt_uint16_t oflag)
{ {
return RT_EOK; return RT_EOK;
} }
static rt_err_t rt_mmcsd_close(rt_device_t dev) static rt_err_t rt_mmcsd_close(rt_device_t dev)
{ {
return RT_EOK; return RT_EOK;
} }
static rt_err_t rt_mmcsd_control(rt_device_t dev, rt_uint8_t cmd, void *args) static rt_err_t rt_mmcsd_control(rt_device_t dev, rt_uint8_t cmd, void *args)
{ {
struct mmcsd_blk_device *blk_dev = (struct mmcsd_blk_device *)dev->user_data; struct mmcsd_blk_device *blk_dev = (struct mmcsd_blk_device *)dev->user_data;
switch (cmd) switch (cmd)
{ {
case RT_DEVICE_CTRL_BLK_GETGEOME: case RT_DEVICE_CTRL_BLK_GETGEOME:
rt_memcpy(args, &blk_dev->geometry, sizeof(struct rt_device_blk_geometry)); rt_memcpy(args, &blk_dev->geometry, sizeof(struct rt_device_blk_geometry));
break; break;
default: default:
break; break;
} }
return RT_EOK; return RT_EOK;
} }
static rt_size_t rt_mmcsd_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size) static rt_size_t rt_mmcsd_read(rt_device_t dev,
rt_off_t pos,
void *buffer,
rt_size_t size)
{ {
rt_err_t err; rt_err_t err;
struct mmcsd_blk_device *blk_dev = (struct mmcsd_blk_device *)dev->user_data; struct mmcsd_blk_device *blk_dev = (struct mmcsd_blk_device *)dev->user_data;
struct dfs_partition *part = &blk_dev->part; struct dfs_partition *part = &blk_dev->part;
if (dev == RT_NULL) if (dev == RT_NULL)
{ {
rt_set_errno(-DFS_STATUS_EINVAL); rt_set_errno(-DFS_STATUS_EINVAL);
return 0;
}
rt_sem_take(part->lock, RT_WAITING_FOREVER); return 0;
err = rt_mmcsd_req_blk(blk_dev->card, part->offset + pos, buffer, size, 0); }
rt_sem_release(part->lock);
/* the length of reading must align to SECTOR SIZE */ rt_sem_take(part->lock, RT_WAITING_FOREVER);
if (err) err = rt_mmcsd_req_blk(blk_dev->card, part->offset + pos, buffer, size, 0);
{ rt_sem_release(part->lock);
rt_set_errno(-DFS_STATUS_EIO);
return 0; /* the length of reading must align to SECTOR SIZE */
} if (err)
return size; {
rt_set_errno(-DFS_STATUS_EIO);
return 0;
}
return size;
} }
static rt_size_t rt_mmcsd_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size) static rt_size_t rt_mmcsd_write(rt_device_t dev,
rt_off_t pos,
const void *buffer,
rt_size_t size)
{ {
rt_err_t err; rt_err_t err;
struct mmcsd_blk_device *blk_dev = (struct mmcsd_blk_device *)dev->user_data; struct mmcsd_blk_device *blk_dev = (struct mmcsd_blk_device *)dev->user_data;
struct dfs_partition *part = &blk_dev->part; struct dfs_partition *part = &blk_dev->part;
if (dev == RT_NULL) if (dev == RT_NULL)
{ {
rt_set_errno(-DFS_STATUS_EINVAL); rt_set_errno(-DFS_STATUS_EINVAL);
return 0;
}
rt_sem_take(part->lock, RT_WAITING_FOREVER); return 0;
err = rt_mmcsd_req_blk(blk_dev->card, part->offset + pos, (void *)buffer, size, 1); }
rt_sem_release(part->lock);
/* the length of reading must align to SECTOR SIZE */ rt_sem_take(part->lock, RT_WAITING_FOREVER);
if (err) err = rt_mmcsd_req_blk(blk_dev->card, part->offset + pos, (void *)buffer, size, 1);
{ rt_sem_release(part->lock);
rt_set_errno(-DFS_STATUS_EIO);
return 0; /* the length of reading must align to SECTOR SIZE */
} if (err)
return size; {
rt_set_errno(-DFS_STATUS_EIO);
return 0;
}
return size;
} }
static rt_int32_t mmcsd_set_blksize(struct rt_mmcsd_card *card) static rt_int32_t mmcsd_set_blksize(struct rt_mmcsd_card *card)
{ {
struct rt_mmcsd_cmd cmd; struct rt_mmcsd_cmd cmd;
int err; int err;
/* Block-addressed cards ignore MMC_SET_BLOCKLEN. */ /* Block-addressed cards ignore MMC_SET_BLOCKLEN. */
if (card->flags & CARD_FLAG_SDHC) if (card->flags & CARD_FLAG_SDHC)
return 0; return 0;
mmcsd_host_lock(card->host); mmcsd_host_lock(card->host);
cmd.cmd_code = SET_BLOCKLEN; cmd.cmd_code = SET_BLOCKLEN;
cmd.arg = 512; cmd.arg = 512;
cmd.flags = RESP_SPI_R1 | RESP_R1 | CMD_AC; cmd.flags = RESP_SPI_R1 | RESP_R1 | CMD_AC;
err = mmcsd_send_cmd(card->host, &cmd, 5); err = mmcsd_send_cmd(card->host, &cmd, 5);
mmcsd_host_unlock(card->host); mmcsd_host_unlock(card->host);
if (err) if (err)
{ {
rt_kprintf("MMCSD: unable to set block size to %d: %d\n", cmd.arg, err); rt_kprintf("MMCSD: unable to set block size to %d: %d\n", cmd.arg, err);
return -RT_ERROR;
}
return 0; return -RT_ERROR;
}
return 0;
} }
rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card) rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card)
{ {
rt_int32_t err = 0; rt_int32_t err = 0;
rt_uint8_t i, status; rt_uint8_t i, status;
rt_uint8_t *sector; rt_uint8_t *sector;
char dname[4]; char dname[4];
char sname[8]; char sname[8];
struct mmcsd_blk_device *blk_dev = RT_NULL; struct mmcsd_blk_device *blk_dev = RT_NULL;
err = mmcsd_set_blksize(card); err = mmcsd_set_blksize(card);
if(err) if(err)
{ {
return err; return err;
} }
/* get the first sector to read partition table */ /* get the first sector to read partition table */
sector = (rt_uint8_t *) rt_malloc(SECTOR_SIZE); sector = (rt_uint8_t *)rt_malloc(SECTOR_SIZE);
if (sector == RT_NULL) if (sector == RT_NULL)
{ {
rt_kprintf("allocate partition sector buffer failed\n"); rt_kprintf("allocate partition sector buffer failed\n");
return -RT_ENOMEM;
}
status = rt_mmcsd_req_blk(card, 0, sector, 1, 0); return -RT_ENOMEM;
if (status == RT_EOK) }
{
for(i=0; i < RT_MMCSD_MAX_PARTITION; i++)
{
blk_dev = rt_malloc(sizeof(struct mmcsd_blk_device));
if (!blk_dev)
{
rt_kprintf("mmcsd:malloc mem failde\n");
break;
}
rt_memset((void *)blk_dev, 0, sizeof(struct mmcsd_blk_device));
/* get the first partition */
status = dfs_filesystem_get_partition(&blk_dev->part, sector, i);
if (status == RT_EOK)
{
rt_snprintf(dname, 4, "sd%d", i);
rt_snprintf(sname, 8, "sem_sd%d", i);
blk_dev->part.lock = rt_sem_create(sname, 1, RT_IPC_FLAG_FIFO);
/* register mmcsd device */ status = rt_mmcsd_req_blk(card, 0, sector, 1, 0);
blk_dev->dev.type = RT_Device_Class_Block; if (status == RT_EOK)
blk_dev->dev.init = rt_mmcsd_init; {
blk_dev->dev.open = rt_mmcsd_open; for (i = 0; i < RT_MMCSD_MAX_PARTITION; i++)
blk_dev->dev.close = rt_mmcsd_close; {
blk_dev->dev.read = rt_mmcsd_read; blk_dev = rt_malloc(sizeof(struct mmcsd_blk_device));
blk_dev->dev.write = rt_mmcsd_write; if (!blk_dev)
blk_dev->dev.control = rt_mmcsd_control; {
blk_dev->dev.user_data = blk_dev; rt_kprintf("mmcsd:malloc mem failde\n");
break;
}
rt_memset((void *)blk_dev, 0, sizeof(struct mmcsd_blk_device));
/* get the first partition */
status = dfs_filesystem_get_partition(&blk_dev->part, sector, i);
if (status == RT_EOK)
{
rt_snprintf(dname, 4, "sd%d", i);
rt_snprintf(sname, 8, "sem_sd%d", i);
blk_dev->part.lock = rt_sem_create(sname, 1, RT_IPC_FLAG_FIFO);
blk_dev->card = card; /* register mmcsd device */
blk_dev->dev.type = RT_Device_Class_Block;
blk_dev->dev.init = rt_mmcsd_init;
blk_dev->dev.open = rt_mmcsd_open;
blk_dev->dev.close = rt_mmcsd_close;
blk_dev->dev.read = rt_mmcsd_read;
blk_dev->dev.write = rt_mmcsd_write;
blk_dev->dev.control = rt_mmcsd_control;
blk_dev->dev.user_data = blk_dev;
blk_dev->geometry.bytes_per_sector = 1<<9; blk_dev->card = card;
blk_dev->geometry.block_size = card->card_blksize;
blk_dev->geometry.sector_count = blk_dev->part.size;
rt_device_register(&blk_dev->dev, dname, blk_dev->geometry.bytes_per_sector = 1<<9;
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE); blk_dev->geometry.block_size = card->card_blksize;
rt_list_insert_after(&blk_devices, &blk_dev->list); blk_dev->geometry.sector_count = blk_dev->part.size;
}
else
{
if(i == 0)
{
/* there is no partition table */
blk_dev->part.offset = 0;
blk_dev->part.size = 0;
blk_dev->part.lock = rt_sem_create("sem_sd0", 1, RT_IPC_FLAG_FIFO);
/* register mmcsd device */ rt_device_register(&blk_dev->dev, dname,
blk_dev->dev.type = RT_Device_Class_Block; RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE);
blk_dev->dev.init = rt_mmcsd_init; rt_list_insert_after(&blk_devices, &blk_dev->list);
blk_dev->dev.open = rt_mmcsd_open; }
blk_dev->dev.close = rt_mmcsd_close; else
blk_dev->dev.read = rt_mmcsd_read; {
blk_dev->dev.write = rt_mmcsd_write; if (i == 0)
blk_dev->dev.control = rt_mmcsd_control; {
blk_dev->dev.user_data = blk_dev; /* there is no partition table */
blk_dev->part.offset = 0;
blk_dev->part.size = 0;
blk_dev->part.lock = rt_sem_create("sem_sd0", 1, RT_IPC_FLAG_FIFO);
blk_dev->card = card; /* register mmcsd device */
blk_dev->dev.type = RT_Device_Class_Block;
blk_dev->dev.init = rt_mmcsd_init;
blk_dev->dev.open = rt_mmcsd_open;
blk_dev->dev.close = rt_mmcsd_close;
blk_dev->dev.read = rt_mmcsd_read;
blk_dev->dev.write = rt_mmcsd_write;
blk_dev->dev.control = rt_mmcsd_control;
blk_dev->dev.user_data = blk_dev;
blk_dev->geometry.bytes_per_sector = 1<<9; blk_dev->card = card;
blk_dev->geometry.block_size = card->card_blksize;
if (card->flags & CARD_FLAG_SDHC)
{
blk_dev->geometry.sector_count = (card->csd.c_size + 1) * 1024;
}
else
{
blk_dev->geometry.sector_count =
card->card_capacity * 1024 / 512;
}
rt_device_register(&blk_dev->dev, "sd0", blk_dev->geometry.bytes_per_sector = 1<<9;
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE); blk_dev->geometry.block_size = card->card_blksize;
rt_list_insert_after(&blk_devices, &blk_dev->list); if (card->flags & CARD_FLAG_SDHC)
{
blk_dev->geometry.sector_count = (card->csd.c_size + 1) * 1024;
}
else
{
blk_dev->geometry.sector_count =
card->card_capacity * 1024 / 512;
}
break; rt_device_register(&blk_dev->dev, "sd0",
} RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE);
else rt_list_insert_after(&blk_devices, &blk_dev->list);
{
rt_free(blk_dev);
blk_dev = RT_NULL;
break;
}
}
}
}
else
{
rt_kprintf("read mmcsd first sector failed\n");
err = -RT_ERROR;
}
/* release sector buffer */ break;
rt_free(sector); }
else
{
rt_free(blk_dev);
blk_dev = RT_NULL;
break;
}
}
}
}
else
{
rt_kprintf("read mmcsd first sector failed\n");
err = -RT_ERROR;
}
return err; /* release sector buffer */
rt_free(sector);
return err;
} }
void rt_mmcsd_blk_remove(struct rt_mmcsd_card *card) void rt_mmcsd_blk_remove(struct rt_mmcsd_card *card)
{ {
rt_list_t *l; rt_list_t *l;
struct mmcsd_blk_device *blk_dev; struct mmcsd_blk_device *blk_dev;
for (l = (&blk_devices)->next; l != &blk_devices; l = l->next) for (l = (&blk_devices)->next; l != &blk_devices; l = l->next)
{ {
blk_dev = (struct mmcsd_blk_device *)rt_list_entry(l, struct mmcsd_blk_device, list); blk_dev = (struct mmcsd_blk_device *)rt_list_entry(l, struct mmcsd_blk_device, list);
if (blk_dev->card == card) if (blk_dev->card == card)
{ {
rt_device_unregister(&blk_dev->dev); rt_device_unregister(&blk_dev->dev);
rt_list_remove(&blk_dev->list); rt_list_remove(&blk_dev->list);
rt_free(blk_dev); rt_free(blk_dev);
} }
} }
} }
void rt_mmcsd_blk_init(void) void rt_mmcsd_blk_init(void)
{ {
rt_list_init(&blk_devices); rt_list_init(&blk_devices);
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, RT-Thread Development Team * COPYRIGHT (C) 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, RT-Thread Development Team * COPYRIGHT (C) 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, RT-Thread Development Team * COPYRIGHT (C) 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, RT-Thread Development Team * COPYRIGHT (C) 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, RT-Thread Development Team * COPYRIGHT (C) 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, RT-Thread Development Team * COPYRIGHT (C) 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, RT-Thread Development Team * COPYRIGHT (C) 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, RT-Thread Development Team * COPYRIGHT (C) 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, RT-Thread Development Team * COPYRIGHT (C) 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, RT-Thread Development Team * COPYRIGHT (C) 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2011, RT-Thread Development Team * COPYRIGHT (C) 2011, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2011, RT-Thread Development Team * COPYRIGHT (C) 2011, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2011, RT-Thread Development Team * COPYRIGHT (C) 2011, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2011, RT-Thread Development Team * COPYRIGHT (C) 2011, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2011, RT-Thread Development Team * COPYRIGHT (C) 2011, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2011, RT-Thread Development Team * COPYRIGHT (C) 2011, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * This program is free software; you can redistribute it and/or modify
* found in the file LICENSE in this distribution or at * it under the terms of the GNU General Public License as published by
* http://www.rt-thread.org/license/LICENSE * 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes