Skip to content

Commit 47a8c94

Browse files
committed
Add EG915U module support
Signed-off-by: Ajay Bhargav <[email protected]>
1 parent 304f21b commit 47a8c94

File tree

4 files changed

+190
-0
lines changed

4 files changed

+190
-0
lines changed

boards.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,45 @@ ec600u.upload.speed=460800
161161
ec600u.upload.require_upload_port=false
162162
ec600u.upload.wait_for_upload_port=false
163163

164+
# Quectel EG915U Module definition
165+
eg915u.name=Quectel EG915U LTE Cat.1 Module
166+
167+
# build
168+
eg915u.build.core=logicrom
169+
eg915u.build.cpu=armca5
170+
eg915u.build.f_cpu=500000000
171+
eg915u.build.board=EG915U
172+
eg915u.build.mcu=rda8910
173+
eg915u.build.variant=eg915u
174+
eg915u.build.vid=0x1782
175+
eg915u.build.pid=0x4D11
176+
eg915u.build.extra_flags=-DSOC_RDA8910=1 -DPLATFORM_EG915U=1
177+
eg915u.build.logicromlib=logicrom4g
178+
eg915u.build.ldscript=linkerscript_rda.ld
179+
eg915u.menu.debug.Release=Release
180+
eg915u.menu.debug.Release.build.build_type=
181+
eg915u.menu.debug.Debug=Debug
182+
eg915u.menu.debug.Debug.build.build_type=_debug
183+
eg915u.menu.stdio.none=None
184+
eg915u.menu.stdio.none.build.stdio_port=
185+
eg915u.menu.stdio.ttys0=Uart0 (/dev/ttyS0)
186+
eg915u.menu.stdio.ttys0.build.stdio_port=/dev/ttyS0
187+
eg915u.menu.stdio.ttys1=Uart1 (/dev/ttyS1)
188+
eg915u.menu.stdio.ttys1.build.stdio_port=/dev/ttyS1
189+
eg915u.menu.stdio.ttys2=Uart2 (/dev/ttyS2)
190+
eg915u.menu.stdio.ttys2.build.stdio_port=/dev/ttyS2
191+
eg915u.menu.stdio.ttyusb=USB Uart (/dev/ttyUSB0)
192+
eg915u.menu.stdio.ttyusb.build.stdio_port=/dev/ttyUSB0
193+
194+
# upload
195+
eg915u.upload.tool=logicromflasher_rda8910
196+
eg915u.upload.protocol=logicromflasher
197+
eg915u.upload.maximum_size=1048576
198+
eg915u.upload.maximum_ram_size=1048576
199+
eg915u.upload.speed=460800
200+
eg915u.upload.require_upload_port=false
201+
eg915u.upload.wait_for_upload_port=false
202+
164203
# Fibocom L610 Module definition
165204
l610.name=Fibocom L610 LTE Cat.1 Module
166205

variants/eg915u/pins_arduino.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
Copyright (c) 2011 Arduino. All right reserved.
3+
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
9+
This library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
See the GNU Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
// API compatibility
20+
#include "variant.h"
21+

variants/eg915u/variant.cpp

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
Copyright (c) Waybyte Solutions. All right reserved.
3+
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License..
8+
9+
This library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
See the GNU Lesser General Public License for more details.
13+
*/
14+
15+
#include "Arduino.h"
16+
17+
#ifdef __cplusplus
18+
extern "C"
19+
{
20+
#endif
21+
22+
int g_ioHandles[GPIO_PIN_MAX];
23+
int g_ioModes[GPIO_PIN_MAX];
24+
25+
static const uint32_t adc_channel_map[3][2] = {
26+
{GPIO_PIN_MAX, ADC_CH0},
27+
{GPIO_PIN_MAX + 1, ADC_CH1},
28+
};
29+
30+
int pin2adc_channel(uint32_t pin)
31+
{
32+
for (int i = 0; i < 3; i++) {
33+
if (adc_channel_map[i][0] == pin)
34+
return adc_channel_map[i][1];
35+
}
36+
37+
return -1;
38+
}
39+
40+
int pin2pwm_channel(uint32_t pin)
41+
{
42+
if (pin == GPIO_5)
43+
return PWM_CH0;
44+
else if (pin == GPIO_13)
45+
return PWM_CH1;
46+
47+
return -1;
48+
}
49+
50+
#ifdef __cplusplus
51+
}
52+
#endif
53+
54+
void variant_init(void)
55+
{
56+
/* variant init */
57+
}

variants/eg915u/variant.h

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#ifndef _VARIANT_EG915U_X_
2+
#define _VARIANT_EG915U_X_
3+
4+
/*
5+
* Headers
6+
*/
7+
#include <lib.h>
8+
#include <utils.h>
9+
#include <os_api.h>
10+
#include <hw/gpio.h>
11+
#include <hw/adc.h>
12+
#include <hw/pwm.h>
13+
#include <hw/i2c.h>
14+
#include <hw/spi.h>
15+
16+
#include <ril.h>
17+
18+
/* Default Definitions */
19+
#define VARIANT_MCK 500000000
20+
#define PWM_FREQUENCY 1000
21+
#ifndef DEFAULT_STDIO_PORT
22+
#define DEFAULT_STDIO_PORT "/dev/ttyUSB0"
23+
#endif
24+
25+
#define SPI_MAX_SPEED 40000000UL
26+
27+
/* Analog Pin definition */
28+
#define A0 GPIO_PIN_MAX
29+
#define A1 GPIO_PIN_MAX + 1
30+
31+
/* LED (NET_STATUS Pin on Module) */
32+
#define LED_BUILTIN GPIO_13
33+
34+
/*
35+
* SPI Interfaces
36+
*/
37+
#define SPI_INTERFACES_COUNT 2
38+
#define PIN_SPI_SS0 (-1)
39+
#define PIN_SPI_MISO (GPIO_PIN_MAX)
40+
#define PIN_SPI_SCK (GPIO_PIN_MAX)
41+
#define PIN_SPI_MOSI (GPIO_PIN_MAX)
42+
#define BOARD_SPI_SS0 (PIN_SPI_SS0)
43+
44+
static const uint8_t SS = BOARD_SPI_SS0;
45+
static const uint8_t MOSI = PIN_SPI_MOSI;
46+
static const uint8_t MISO = PIN_SPI_MISO;
47+
static const uint8_t SCK = PIN_SPI_SCK;
48+
49+
/* For Variant.cpp */
50+
#define CHECK_MODE(pin, mode) ((g_ioModes[pin] & 0xff) == IO_MODE_##mode)
51+
52+
enum _io_mode {
53+
IO_MODE_GPIO = 1,
54+
IO_MODE_ADC = 2,
55+
IO_MODE_PWM = 3,
56+
};
57+
58+
#ifdef __cplusplus
59+
extern "C"
60+
{
61+
#endif
62+
63+
extern int g_ioHandles[GPIO_PIN_MAX];
64+
extern int g_ioModes[GPIO_PIN_MAX];
65+
66+
int pin2adc_channel(uint32_t pin);
67+
int pin2pwm_channel(uint32_t pin);
68+
69+
#ifdef __cplusplus
70+
}
71+
#endif
72+
73+
#endif

0 commit comments

Comments
 (0)