mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-28 08:37:57 +08:00
[bsp] Add SmartloongV3 display,touch,msd, hw_i2c driver
This commit is contained in:
1 parent
123af35c94
commit
b08ff9eee2
11 files changed
+3075
-3
No files matched your search
@@ -5,6 +5,10 @@ src = Glob('*.c')
|
||||
|
||||
CPPPATH = [cwd]
|
||||
|
||||
|
||||
if GetDepend('RT_USING_RTGUI')== False:
|
||||
SrcRemove(src, 'touch.c')
|
||||
|
||||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
objs = []
|
||||
|
||||
+117
-1
@@ -15,11 +15,16 @@
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <drivers/spi.h>
|
||||
#include <rthw.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "uart.h"
|
||||
#include "ls1c.h"
|
||||
#include "ls1c_pin.h"
|
||||
#include "ls1c_spi.h"
|
||||
#include "ls1c_spi.h"
|
||||
#include "drv_spi.h"
|
||||
|
||||
/**
|
||||
* @addtogroup Loongson LS1B
|
||||
@@ -88,9 +93,92 @@ void rt_hw_board_init(void)
|
||||
|
||||
#ifdef RT_USING_CONSOLE
|
||||
/* set console device */
|
||||
rt_console_set_device("uart2");
|
||||
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef RT_USING_I2C
|
||||
#ifdef RT_USING_I2C0
|
||||
/*
|
||||
pin_set_purpose(2, PIN_PURPOSE_OTHER);
|
||||
pin_set_purpose(3, PIN_PURPOSE_OTHER);
|
||||
pin_set_remap(2, PIN_REMAP_SECOND);
|
||||
pin_set_remap(3, PIN_REMAP_SECOND);
|
||||
*/
|
||||
#endif
|
||||
#ifdef RT_USING_I2C1
|
||||
pin_set_purpose(2, PIN_PURPOSE_OTHER);
|
||||
pin_set_purpose(3, PIN_PURPOSE_OTHER);
|
||||
pin_set_remap(2, PIN_REMAP_SECOND);
|
||||
pin_set_remap(3, PIN_REMAP_SECOND);
|
||||
#endif
|
||||
#ifdef RT_USING_I2C2
|
||||
pin_set_purpose(51, PIN_PURPOSE_OTHER);
|
||||
pin_set_purpose(50, PIN_PURPOSE_OTHER);
|
||||
pin_set_remap(51, PIN_REMAP_FOURTH);
|
||||
pin_set_remap(50, PIN_REMAP_FOURTH);
|
||||
#endif
|
||||
rt_i2c_init();
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_SPI
|
||||
|
||||
#ifdef RT_USING_SPI0
|
||||
pin_set_purpose(78, PIN_PURPOSE_OTHER);
|
||||
pin_set_purpose(79, PIN_PURPOSE_OTHER);
|
||||
pin_set_purpose(80, PIN_PURPOSE_OTHER);
|
||||
pin_set_purpose(83, PIN_PURPOSE_OTHER);//cs2 - SD card
|
||||
pin_set_purpose(82, PIN_PURPOSE_OTHER);//cs1
|
||||
pin_set_remap(78, PIN_REMAP_FOURTH);
|
||||
pin_set_remap(79, PIN_REMAP_FOURTH);
|
||||
pin_set_remap(80, PIN_REMAP_FOURTH);
|
||||
pin_set_remap(83, PIN_REMAP_FOURTH);//cs2 - SD card
|
||||
pin_set_remap(82, PIN_REMAP_FOURTH);//cs1
|
||||
ls1c_spi_bus_register(LS1C_SPI_0,"spi0");
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_SPI1
|
||||
pin_set_purpose(46, PIN_PURPOSE_OTHER);
|
||||
pin_set_purpose(47, PIN_PURPOSE_OTHER);
|
||||
pin_set_purpose(48, PIN_PURPOSE_OTHER);
|
||||
pin_set_purpose(49, PIN_PURPOSE_OTHER);//CS0 - touch screen
|
||||
pin_set_remap(46, PIN_REMAP_THIRD);
|
||||
pin_set_remap(47, PIN_REMAP_THIRD);
|
||||
pin_set_remap(48, PIN_REMAP_THIRD);
|
||||
pin_set_remap(49, PIN_REMAP_THIRD);//CS0 - touch screen
|
||||
ls1c_spi_bus_register(LS1C_SPI_1,"spi1");
|
||||
|
||||
#endif
|
||||
#ifdef RT_USING_SPI0
|
||||
/* attach cs */
|
||||
{
|
||||
static struct rt_spi_device spi_device1;
|
||||
static struct rt_spi_device spi_device2;
|
||||
static struct ls1c_spi_cs spi_cs1;
|
||||
static struct ls1c_spi_cs spi_cs2;
|
||||
|
||||
/* spi02: CS2 SD Card*/
|
||||
spi_cs2.cs = LS1C_SPI_CS_2;
|
||||
rt_spi_bus_attach_device(&spi_device2, "spi02", "spi0", (void*)&spi_cs2);
|
||||
spi_cs1.cs = LS1C_SPI_CS_1;
|
||||
rt_spi_bus_attach_device(&spi_device1, "spi01", "spi0", (void*)&spi_cs1);
|
||||
msd_init("sd0", "spi02");
|
||||
}
|
||||
#endif
|
||||
#ifdef RT_USING_SPI1
|
||||
{
|
||||
static struct rt_spi_device spi_device;
|
||||
static struct ls1c_spi_cs spi_cs;
|
||||
|
||||
/* spi10: CS0 Touch*/
|
||||
spi_cs.cs = LS1C_SPI_CS_0;
|
||||
rt_spi_bus_attach_device(&spi_device, "spi10", "spi1", (void*)&spi_cs);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* init operating system timer */
|
||||
rt_hw_timer_init();
|
||||
|
||||
@@ -102,6 +190,34 @@ void rt_hw_board_init(void)
|
||||
rt_kprintf("current sr: 0x%08x\n", read_c0_status());
|
||||
}
|
||||
|
||||
|
||||
#ifdef RT_USING_RTGUI
|
||||
#include <rtgui/driver.h>
|
||||
#include "display_controller.h"
|
||||
/* initialize for gui driver */
|
||||
int rtgui_lcd_init(void)
|
||||
{
|
||||
rt_device_t dc;
|
||||
rt_kprintf("DC initied\n");
|
||||
|
||||
pin_set_purpose(76, PIN_PURPOSE_OTHER);
|
||||
pin_set_remap(76, PIN_REMAP_DEFAULT);
|
||||
|
||||
/* init Display Controller */
|
||||
rt_hw_dc_init();
|
||||
|
||||
/* find Display Controller device */
|
||||
dc = rt_device_find("dc");
|
||||
|
||||
/* set Display Controller device as rtgui graphic driver */
|
||||
rtgui_graphic_set_device(dc);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_DEVICE_EXPORT(rtgui_lcd_init);
|
||||
#endif
|
||||
|
||||
#define __raw_out_put(unr) \
|
||||
while (*ptr) \
|
||||
{ \
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* File : display_controller.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006-2012, RT-Thread Develop Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2011-08-08 lgnq first version for LS1B
|
||||
* 2015-07-06 chinesebear modified for loongson 1c
|
||||
* 2018-01-06 sundm75 modified for smartloong
|
||||
*/
|
||||
|
||||
#ifndef __DISPLAY_CONTROLLER_H__
|
||||
#define __DISPLAY_CONTROLLER_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
#include "ls1c.h"
|
||||
|
||||
#define DC_BASE 0xBC301240 //Display Controller
|
||||
|
||||
/* Frame Buffer registers */
|
||||
#define DC_FB_CONFIG __REG32(DC_BASE + 0x000)
|
||||
#define DC_FB_BUFFER_ADDR0 __REG32(DC_BASE + 0x020)
|
||||
#define DC_FB_BUFFER_STRIDE __REG32(DC_BASE + 0x040)
|
||||
#define DC_FB_BUFFER_ORIGIN __REG32(DC_BASE + 0x060)
|
||||
#define DC_DITHER_CONFIG __REG32(DC_BASE + 0x120)
|
||||
#define DC_DITHER_TABLE_LOW __REG32(DC_BASE + 0x140)
|
||||
#define DC_DITHER_TABLE_HIGH __REG32(DC_BASE + 0x160)
|
||||
#define DC_PANEL_CONFIG __REG32(DC_BASE + 0x180)
|
||||
#define DC_PANEL_TIMING __REG32(DC_BASE + 0x1A0)
|
||||
#define DC_HDISPLAY __REG32(DC_BASE + 0x1C0)
|
||||
#define DC_HSYNC __REG32(DC_BASE + 0x1E0)
|
||||
#define DC_VDISPLAY __REG32(DC_BASE + 0x240)
|
||||
#define DC_VSYNC __REG32(DC_BASE + 0x260)
|
||||
#define DC_FB_BUFFER_ADDR1 __REG32(DC_BASE + 0x340)
|
||||
|
||||
/* Display Controller driver for 1024x768 16bit */
|
||||
#define FB_XSIZE 480
|
||||
#define FB_YSIZE 272
|
||||
#define CONFIG_VIDEO_16BPP
|
||||
|
||||
#define OSC 24000000 /* Hz */
|
||||
|
||||
#define K1BASE 0xA0000000
|
||||
#define KSEG1(addr) ((void *)(K1BASE | (rt_uint32_t)(addr)))
|
||||
#define HW_FB_ADDR KSEG1(_rt_framebuffer)
|
||||
|
||||
struct vga_struct
|
||||
{
|
||||
long pclk;
|
||||
int hr,hss,hse,hfl;
|
||||
int vr,vss,vse,vfl;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* File :hw_i2c.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-01-04 Sundm75 the first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include "ls1c_i2c.h"
|
||||
|
||||
struct ls1c_i2c_bus
|
||||
{
|
||||
struct rt_i2c_bus_device parent;
|
||||
rt_uint32_t u32Module;
|
||||
};
|
||||
|
||||
rt_size_t rt_i2c_master_xfer(struct rt_i2c_bus_device *bus,
|
||||
struct rt_i2c_msg *msgs,
|
||||
rt_uint32_t num)
|
||||
{
|
||||
struct ls1c_i2c_bus * i2c_bus = (struct ls1c_i2c_bus *)bus;
|
||||
ls1c_i2c_info_t i2c_info;
|
||||
struct rt_i2c_msg *msg;
|
||||
int i;
|
||||
rt_int32_t ret = RT_EOK;
|
||||
i2c_info.clock = 50000; // 50kb/s
|
||||
i2c_info.I2Cx = i2c_bus->u32Module;
|
||||
i2c_init(&i2c_info);
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
msg = &msgs[i];
|
||||
if (msg->flags == RT_I2C_RD)
|
||||
{
|
||||
i2c_send_start_and_addr(&i2c_info, msg->addr, LS1C_I2C_DIRECTION_READ);
|
||||
i2c_receive_ack(&i2c_info);
|
||||
i2c_receive_data(&i2c_info, (rt_uint8_t *)msg->buf, msg->len);
|
||||
i2c_send_stop(&i2c_info);
|
||||
}
|
||||
else if(msg->flags == RT_I2C_WR)
|
||||
{
|
||||
i2c_send_start_and_addr(&i2c_info, msg->addr, LS1C_I2C_DIRECTION_WRITE);
|
||||
i2c_receive_ack(&i2c_info);
|
||||
i2c_send_data(&i2c_info, (rt_uint8_t *)msg->buf, msg->len);
|
||||
i2c_send_stop(&i2c_info);
|
||||
}
|
||||
ret++;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
rt_err_t rt_i2c_bus_control(struct rt_i2c_bus_device *bus,
|
||||
rt_uint32_t cmd,
|
||||
rt_uint32_t arg)
|
||||
{
|
||||
struct ls1c_i2c_bus * i2c_bus = (struct ls1c_i2c_bus *)bus;
|
||||
|
||||
RT_ASSERT(bus != RT_NULL);
|
||||
i2c_bus = (struct ls1c_i2c_bus *)bus->parent.user_data;
|
||||
|
||||
RT_ASSERT(i2c_bus != RT_NULL);
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case RT_DEVICE_CTRL_CONFIG :
|
||||
break;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static const struct rt_i2c_bus_device_ops ls1c_i2c_ops =
|
||||
{
|
||||
rt_i2c_master_xfer,
|
||||
RT_NULL,
|
||||
rt_i2c_bus_control
|
||||
};
|
||||
|
||||
|
||||
#ifdef RT_USING_I2C0
|
||||
static struct ls1c_i2c_bus ls1c_i2c_bus_0 =
|
||||
{
|
||||
{1},
|
||||
LS1C_I2C_0,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_I2C1
|
||||
static struct ls1c_i2c_bus ls1c_i2c_bus_1 =
|
||||
{
|
||||
{1},
|
||||
LS1C_I2C_1,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_I2C2
|
||||
static struct ls1c_i2c_bus ls1c_i2c_bus_2 =
|
||||
{
|
||||
{1},
|
||||
LS1C_I2C_2,
|
||||
};
|
||||
#endif
|
||||
|
||||
int rt_i2c_init(void)
|
||||
{
|
||||
struct ls1c_i2c_bus* ls1c_i2c;
|
||||
|
||||
#ifdef RT_USING_I2C0
|
||||
ls1c_i2c = &ls1c_i2c_bus_0;
|
||||
ls1c_i2c->parent.ops = &ls1c_i2c_ops;
|
||||
rt_i2c_bus_device_register(&ls1c_i2c->parent, "i2c0");
|
||||
rt_kprintf("i2c0_init!\n");
|
||||
#endif
|
||||
#ifdef RT_USING_I2C1
|
||||
ls1c_i2c = &ls1c_i2c_bus_1;
|
||||
ls1c_i2c->parent.ops = &ls1c_i2c_ops;
|
||||
rt_i2c_bus_device_register(&ls1c_i2c->parent, "i2c1");
|
||||
rt_kprintf("i2c1_init!\n");
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_I2C2
|
||||
ls1c_i2c = &ls1c_i2c_bus_2;
|
||||
ls1c_i2c->parent.ops = &ls1c_i2c_ops;
|
||||
rt_i2c_bus_device_register(&ls1c_i2c->parent, "i2c2");
|
||||
rt_kprintf("i2c2_init!\n");
|
||||
#endif
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* File : hw_i2c.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-01-04 Sundm75 the first version
|
||||
*/
|
||||
|
||||
#ifndef LS1C_I2C_H
|
||||
#define LS1C_I2C_H
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
int rt_i2c_init(void);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* File : msd.h
|
||||
* SPI mode SD Card Driver
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-04-17 Bernard first version.
|
||||
*/
|
||||
|
||||
#ifndef MSD_H_INCLUDED
|
||||
#define MSD_H_INCLUDED
|
||||
|
||||
#include <stdint.h>
|
||||
#include <drivers/spi.h>
|
||||
|
||||
/* SD command (SPI mode) */
|
||||
#define GO_IDLE_STATE 0 /* CMD0 R1 */
|
||||
#define SEND_OP_COND 1 /* CMD1 R1 */
|
||||
#define SWITCH_FUNC 6 /* CMD6 R1 */
|
||||
#define SEND_IF_COND 8 /* CMD8 R7 */
|
||||
#define SEND_CSD 9 /* CMD9 R1 */
|
||||
#define SEND_CID 10 /* CMD10 R1 */
|
||||
#define STOP_TRANSMISSION 12 /* CMD12 R1B */
|
||||
#define SEND_STATUS 13 /* CMD13 R2 */
|
||||
#define SET_BLOCKLEN 16 /* CMD16 R1 */
|
||||
#define READ_SINGLE_BLOCK 17 /* CMD17 R1 */
|
||||
#define READ_MULTIPLE_BLOCK 18 /* CMD18 R1 */
|
||||
#define WRITE_BLOCK 24 /* CMD24 R1 */
|
||||
#define WRITE_MULTIPLE_BLOCK 25 /* CMD25 R1 */
|
||||
#define PROGRAM_CSD 27 /* CMD27 R1 */
|
||||
#define SET_WRITE_PROT 28 /* CMD28 R1B */
|
||||
#define CLR_WRITE_PROT 29 /* CMD29 R1B */
|
||||
#define SEND_WRITE_PROT 30 /* CMD30 R1 */
|
||||
#define ERASE_WR_BLK_START_ADDR 32 /* CMD32 R1 */
|
||||
#define ERASE_WR_BLK_END_ADDR 33 /* CMD33 R1 */
|
||||
#define ERASE 38 /* CMD38 R1B */
|
||||
#define LOCK_UNLOCK 42 /* CMD42 R1 */
|
||||
#define APP_CMD 55 /* CMD55 R1 */
|
||||
#define GEN_CMD 56 /* CMD56 R1 */
|
||||
#define READ_OCR 58 /* CMD58 R3 */
|
||||
#define CRC_ON_OFF 59 /* CMD59 R1 */
|
||||
|
||||
/* Application-Specific Command */
|
||||
#define SD_STATUS 13 /* ACMD13 R2 */
|
||||
#define SEND_NUM_WR_BLOCKS 22 /* ACMD22 R1 */
|
||||
#define SET_WR_BLK_ERASE_COUNT 23 /* ACMD23 R1 */
|
||||
#define SD_SEND_OP_COND 41 /* ACMD41 R1 */
|
||||
#define SET_CLR_CARD_DETECT 42 /* ACMD42 R1 */
|
||||
#define SEND_SCR 51 /* ACMD51 R1 */
|
||||
|
||||
/* Start Data tokens */
|
||||
/* Tokens (necessary because at nop/idle (and CS active) only 0xff is on the data/command line) */
|
||||
#define MSD_TOKEN_READ_START 0xFE /* Data token start byte, Start Single Block Read */
|
||||
#define MSD_TOKEN_WRITE_SINGLE_START 0xFE /* Data token start byte, Start Single Block Write */
|
||||
|
||||
#define MSD_TOKEN_WRITE_MULTIPLE_START 0xFC /* Data token start byte, Start Multiple Block Write */
|
||||
#define MSD_TOKEN_WRITE_MULTIPLE_STOP 0xFD /* Data toke stop byte, Stop Multiple Block Write */
|
||||
|
||||
/* MSD reponses and error flags */
|
||||
#define MSD_RESPONSE_NO_ERROR 0x00
|
||||
#define MSD_IN_IDLE_STATE 0x01
|
||||
#define MSD_ERASE_RESET 0x02
|
||||
#define MSD_ILLEGAL_COMMAND 0x04
|
||||
#define MSD_COM_CRC_ERROR 0x08
|
||||
#define MSD_ERASE_SEQUENCE_ERROR 0x10
|
||||
#define MSD_ADDRESS_ERROR 0x20
|
||||
#define MSD_PARAMETER_ERROR 0x40
|
||||
#define MSD_RESPONSE_FAILURE 0xFF
|
||||
|
||||
/* Data response error */
|
||||
#define MSD_DATA_OK 0x05
|
||||
#define MSD_DATA_CRC_ERROR 0x0B
|
||||
#define MSD_DATA_WRITE_ERROR 0x0D
|
||||
#define MSD_DATA_OTHER_ERROR 0xFF
|
||||
#define MSD_DATA_RESPONSE_MASK 0x1F
|
||||
#define MSD_GET_DATA_RESPONSE(res) (res & MSD_DATA_RESPONSE_MASK)
|
||||
|
||||
#define MSD_CMD_LEN 6 /**< command, arg and crc. */
|
||||
#define MSD_RESPONSE_MAX_LEN 5 /**< response max len */
|
||||
#define MSD_CSD_LEN 16 /**< SD crad CSD register len */
|
||||
#define SECTOR_SIZE 512 /**< sector size, default 512byte */
|
||||
|
||||
/* card try timeout, unit: ms */
|
||||
#define CARD_TRY_TIMES 3000
|
||||
#define CARD_TRY_TIMES_ACMD41 800
|
||||
#define CARD_WAIT_TOKEN_TIMES 800
|
||||
|
||||
#define MSD_USE_PRE_ERASED /**< id define MSD_USE_PRE_ERASED, before CMD25, send ACMD23 */
|
||||
|
||||
/**
|
||||
* SD/MMC card type
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
MSD_CARD_TYPE_UNKNOWN = 0, /**< unknown */
|
||||
MSD_CARD_TYPE_MMC, /**< MultiMedia Card */
|
||||
MSD_CARD_TYPE_SD_V1_X, /**< Ver 1.X Standard Capacity SD Memory Card */
|
||||
MSD_CARD_TYPE_SD_V2_X, /**< Ver 2.00 or later Standard Capacity SD Memory Card */
|
||||
MSD_CARD_TYPE_SD_SDHC, /**< High Capacity SD Memory Card */
|
||||
MSD_CARD_TYPE_SD_SDXC, /**< later Extended Capacity SD Memory Card */
|
||||
}msd_card_type;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
response_type_unknown = 0,
|
||||
response_r1,
|
||||
response_r1b,
|
||||
response_r2,
|
||||
response_r3,
|
||||
response_r4,
|
||||
response_r5,
|
||||
response_r7,
|
||||
}response_type;
|
||||
|
||||
struct msd_device
|
||||
{
|
||||
struct rt_device parent; /**< RT-Thread device struct */
|
||||
struct rt_device_blk_geometry geometry; /**< sector size, sector count */
|
||||
struct rt_spi_device * spi_device; /**< SPI interface */
|
||||
msd_card_type card_type; /**< card type: MMC SD1.x SD2.0 SDHC SDXC */
|
||||
uint32_t max_clock; /**< MAX SPI clock */
|
||||
};
|
||||
|
||||
extern rt_err_t msd_init(const char * sd_device_name, const char * spi_device_name);
|
||||
|
||||
#endif // MSD_H_INCLUDED
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* File : touch.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-12-30 Sundm75 first version
|
||||
*/
|
||||
#ifndef __TOUCH_H__
|
||||
#define __TOUCH_H__
|
||||
|
||||
#define RT_TOUCH_NORMAL 0
|
||||
#define RT_TOUCH_CALIBRATION_DATA 1
|
||||
#define RT_TOUCH_CALIBRATION 2
|
||||
|
||||
//#define SAVE_CALIBRATION
|
||||
|
||||
|
||||
rt_uint16_t touch_read_x(void);
|
||||
rt_uint16_t touch_read_y(void);
|
||||
void touch_config(void);
|
||||
|
||||
|
||||
rt_err_t rtgui_touch_hw_init(const char * spi_device_name);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -108,7 +108,10 @@
|
||||
// </section>
|
||||
|
||||
// <section name="RT_USING_DFS" description="Device file system" default="true" >
|
||||
// #define RT_USING_DFS
|
||||
#define RT_USING_DFS
|
||||
#define RT_DFS_ELM_REENTRANT
|
||||
#define RT_DFS_ELM_DRIVES 2
|
||||
#define RT_DFS_ELM_MAX_SECTOR_SIZE 512
|
||||
// <bool name="DFS_USING_WORKDIR" description="Using working directory" default="true" />
|
||||
// #define DFS_USING_WORKDIR
|
||||
// <integer name="DFS_FILESYSTEMS_MAX" description="The maximal number of mounted file system" default="4" />
|
||||
@@ -121,9 +124,10 @@
|
||||
// <item description="LFN1">1</item>
|
||||
// <item description="LFN1">2</item>
|
||||
// </integer>
|
||||
#define RT_DFS_ELM_USE_LFN 1
|
||||
//#define RT_DFS_ELM_USE_LFN 1
|
||||
// <integer name="RT_DFS_ELM_MAX_LFN" description="Maximal size of file name length" default="255" />
|
||||
#define RT_DFS_ELM_MAX_LFN 64
|
||||
#define RT_DFS_ELM_CODE_PAGE 936
|
||||
// <bool name="RT_USING_DFS_YAFFS2" description="Using YAFFS2" default="false" />
|
||||
// #define RT_USING_DFS_YAFFS2
|
||||
// <bool name="RT_USING_DFS_UFFS" description="Using UFFS" default="false" />
|
||||
@@ -232,6 +236,8 @@
|
||||
#define RT_USING_SPI1
|
||||
|
||||
#define RT_USING_I2C
|
||||
#define RT_USING_I2C1
|
||||
#define RT_USING_I2C2
|
||||
#define RT_USING_I2C_BITOPS
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user