Skip to content

Commit 12c943c

Browse files
author
lbednarz
committed
merged RX stuff
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@6831 35acf78f-673a-0410-8e92-d51de3d6d3f4
1 parent d6a4133 commit 12c943c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+20809
-1
lines changed

boards/RENESAS_RPBRX62N/board.c

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
#include "ch.h"
18+
#include "hal.h"
19+
20+
/**
21+
* @brief PAL setup.
22+
* @details Digital I/O ports static configuration as defined in @p board.h.
23+
* This variable is used by the HAL when initializing the PAL driver.
24+
*/
25+
#if HAL_USE_PAL || defined(__DOXYGEN__)
26+
const PALConfig pal_default_config = {
27+
{VAL_PORT0DATA, VAL_PORT0DIR, VAL_PORT0ICR, VAL_PORT0ODR, 0},
28+
{VAL_PORT1DATA, VAL_PORT1DIR, VAL_PORT1ICR, VAL_PORT1ODR, 0},
29+
{VAL_PORT2DATA, VAL_PORT2DIR, VAL_PORT2ICR, VAL_PORT2ODR, 0},
30+
{VAL_PORT3DATA, VAL_PORT3DIR, VAL_PORT3ICR, VAL_PORT3ODR, 0},
31+
{VAL_PORT4DATA, VAL_PORT4DIR, VAL_PORT4ICR, 0 , 0},
32+
{VAL_PORT5DATA, VAL_PORT5DIR, VAL_PORT5ICR, 0 , 0},
33+
{VAL_PORTADATA, VAL_PORTADIR, VAL_PORTAICR, 0 , VAL_PORTAPCR},
34+
{VAL_PORTBDATA, VAL_PORTBDIR, VAL_PORTBICR, 0 , VAL_PORTBPCR},
35+
{VAL_PORTCDATA, VAL_PORTCDIR, VAL_PORTCICR, VAL_PORTCODR, VAL_PORTCPCR},
36+
{VAL_PORTDDATA, VAL_PORTDDIR, VAL_PORTDICR, 0 , VAL_PORTDPCR},
37+
{VAL_PORTEDATA, VAL_PORTEDIR, VAL_PORTEICR, 0 , VAL_PORTEPCR},
38+
};
39+
#endif
40+
41+
/**
42+
* @brief CMT3 interrupt handler.
43+
*/
44+
CH_IRQ_HANDLER(Excep_CMTU1_CMT3) {
45+
46+
CH_IRQ_PROLOGUE();
47+
48+
chSysLockFromIsr();
49+
chSysTimerHandlerI();
50+
chSysUnlockFromIsr();
51+
52+
CH_IRQ_EPILOGUE();
53+
}
54+
55+
/*
56+
* Early initialization code.
57+
* This initialization must be performed just after stack setup and before
58+
* any other initialization.
59+
*/
60+
void __early_init(void) {
61+
62+
rx62n_clock_init();
63+
}
64+
65+
/*
66+
* Board-specific initialization code.
67+
*/
68+
void boardInit(void) {
69+
70+
/* Setup tick timer */
71+
MSTP(CMT3) = 0; /* Enable CMT3 timer (cancel module stop state) */
72+
CMT.CMSTR1.BIT.STR3 = 0; /* Stop timer */
73+
CMT3.CMCR.BIT.CKS = 2; /* PCLK/128 */
74+
CMT3.CMCNT = 0;
75+
CMT3.CMCOR = RX62N_PERCLK / 128 / CH_FREQUENCY;
76+
CMT3.CMCR.BIT.CMIE = 1; /* Enable compare match interrupts */
77+
IEN(CMT3,CMI3) = 1; /* Set Interrupt Enable Register */
78+
IPR(CMT3,CMI3) = 8; /* Setup interrupt priority */
79+
CMT.CMSTR1.BIT.STR3 = 1; /* Start timer */
80+
}

boards/RENESAS_RPBRX62N/board.h

+224
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
/*
2+
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
#ifndef _BOARD_H_
18+
#define _BOARD_H_
19+
20+
/*
21+
* Setup for Renesas RPBRX62N board
22+
*/
23+
24+
/*
25+
* Board identifiers.
26+
*/
27+
#define BOARD_RPBRX62N
28+
#define BOARD_NAME "Renesas RPBRX62N"
29+
30+
/*
31+
* Board frequencies.
32+
*/
33+
#define EXTALCLK 12000000
34+
#define SUBCLK 32768
35+
36+
/*
37+
* MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
38+
*/
39+
#define RX62NXBDFP
40+
41+
/* TODO: move this to hal/include/mii.h */
42+
#define MII_LAN8700_ID 0x0007C0C4
43+
44+
/*
45+
* Ethernet PHY type.
46+
*/
47+
#define BOARD_PHY_ID MII_LAN8700_ID
48+
49+
/*
50+
* Ethernet PHY address.
51+
*/
52+
#define BOARD_PHY_ADDRESS 31
53+
54+
#define RX62N_MAC_PHY_TIMEOUT 0
55+
56+
/*
57+
* Use ethernet PHY RMII interface (if defined).
58+
*/
59+
/*#define BOARD_PHY_RMII*/
60+
61+
/*
62+
* Ethernet PHY hardware reset
63+
* PORTA_ETH_RESETOUT must be held low for at least 100us.
64+
*/
65+
#define BOARD_PHY_RESET() do { \
66+
palClearPad(GPIO10, PORTA_ETH_RESETOUT); \
67+
asm volatile ("mov.l #2640,r2 \n\t" \
68+
"1: \n\t" \
69+
"sub #1,r2 \n\t" \
70+
"bne.b 1b \n\t"); \
71+
palSetPad(GPIO10, PORTA_ETH_RESETOUT); \
72+
} while(0)
73+
74+
/*
75+
* PORT 0 initial setup.
76+
*/
77+
#define VAL_PORT0DIR 0x00
78+
#define VAL_PORT0DATA 0x00
79+
#define VAL_PORT0ICR 0x00
80+
#define VAL_PORT0ODR 0x00
81+
82+
/*
83+
* PORT 1 initial setup.
84+
*/
85+
#define VAL_PORT1DIR 0x00
86+
#define VAL_PORT1DATA 0x00
87+
#define VAL_PORT1ICR 0x00
88+
#define VAL_PORT1ODR 0x00
89+
90+
/*
91+
* PORT 2 initial setup.
92+
*/
93+
#define VAL_PORT2DIR 0x00
94+
#define VAL_PORT2DATA 0x00
95+
#define VAL_PORT2ICR 0x00
96+
#define VAL_PORT2ODR 0x00
97+
98+
/*
99+
* PORT 3 initial setup.
100+
*/
101+
#define VAL_PORT3DIR 0x00
102+
#define VAL_PORT3DATA 0x00
103+
#define VAL_PORT3ICR 0x00
104+
#define VAL_PORT3ODR 0x00
105+
106+
/*
107+
* PORT 4 initial setup.
108+
*/
109+
#define VAL_PORT4DIR 0x00
110+
#define VAL_PORT4DATA 0x00
111+
#define VAL_PORT4ICR 0x00
112+
113+
/*
114+
* PORT 5 initial setup.
115+
*/
116+
#define VAL_PORT5DIR 0x00
117+
#define VAL_PORT5DATA 0x00
118+
#define VAL_PORT5ICR 0x00
119+
120+
/*
121+
* GPIO A initial setup.
122+
*/
123+
#define VAL_PORTADIR PAL_PORT_BIT(PORTA_LED0) | \
124+
PAL_PORT_BIT(PORTA_LED1) | \
125+
PAL_PORT_BIT(PORTA_LED2) | \
126+
PAL_PORT_BIT(PORTA_MII_MDIO) | \
127+
PAL_PORT_BIT(PORTA_MII_MDC) | \
128+
PAL_PORT_BIT(PORTA_ETH_LINKSTA) | \
129+
PAL_PORT_BIT(PORTA_ETH_RESETOUT)
130+
#define VAL_PORTADATA PAL_PORT_BIT(PORTA_LED0) | \
131+
PAL_PORT_BIT(PORTA_LED1) | \
132+
PAL_PORT_BIT(PORTA_LED2) | \
133+
PAL_PORT_BIT(PORTA_ETH_RESETOUT)
134+
#define VAL_PORTAICR PAL_PORT_BIT(PORTA_MII_MDIO) | \
135+
PAL_PORT_BIT(PORTA_ETH_LINKSTA)
136+
#define VAL_PORTAPCR 0x00
137+
138+
/*
139+
* PORT B initial setup.
140+
*/
141+
#define VAL_PORTBDIR PAL_PORT_BIT(PORTB_MII_TXD1) | \
142+
PAL_PORT_BIT(PORTB_MII_TXD0) | \
143+
PAL_PORT_BIT(PORTB_MII_TXEN)
144+
#define VAL_PORTBDATA 0x00
145+
#define VAL_PORTBICR PAL_PORT_BIT(PORTB_MII_CRS) | \
146+
PAL_PORT_BIT(PORTB_MII_RXER) | \
147+
PAL_PORT_BIT(PORTB_MII_RXCLK) | \
148+
PAL_PORT_BIT(PORTB_MII_RXD0) | \
149+
PAL_PORT_BIT(PORTB_MII_RXD1)
150+
#define VAL_PORTBPCR 0x00
151+
152+
/*
153+
* PORT C initial setup.
154+
*/
155+
#define VAL_PORTCDIR PAL_PORT_BIT(PORTC_MII_TXD3) | \
156+
PAL_PORT_BIT(PORTC_MII_TXD2) | \
157+
PAL_PORT_BIT(PORTC_MII_TXER)
158+
#define VAL_PORTCDATA 0x00
159+
#define VAL_PORTCICR PAL_PORT_BIT(PORTC_MII_COL) | \
160+
PAL_PORT_BIT(PORTC_MII_TXCLK) | \
161+
PAL_PORT_BIT(PORTC_MII_TXER) | \
162+
PAL_PORT_BIT(PORTC_MII_RXDV) | \
163+
PAL_PORT_BIT(PORTC_MII_RXD2) | \
164+
PAL_PORT_BIT(PORTC_MII_RXD3)
165+
#define VAL_PORTCODR 0x00
166+
#define VAL_PORTCPCR 0x00
167+
168+
/*
169+
* PORT D initial setup.
170+
*/
171+
#define VAL_PORTDDIR 0x00
172+
#define VAL_PORTDDATA 0x00
173+
#define VAL_PORTDICR 0x00
174+
#define VAL_PORTDPCR 0x00
175+
176+
/*
177+
* PORT E initial setup.
178+
*/
179+
#define VAL_PORTEDIR 0x00
180+
#define VAL_PORTEDATA 0x00
181+
#define VAL_PORTEICR 0x00
182+
#define VAL_PORTEPCR 0x00
183+
184+
185+
/*
186+
* Pin definitions.
187+
*/
188+
#define PORTA_ETH_RESETOUT 7
189+
#define PORTA_ETH_LINKSTA 5
190+
#define PORTA_MII_MDC 4
191+
#define PORTA_MII_MDIO 3
192+
#define PORTA_LED0 2
193+
#define PORTA_LED1 1
194+
#define PORTA_LED2 0
195+
196+
#define PORTB_MII_CRS 7
197+
#define PORTB_MII_TXD1 6
198+
#define PORTB_MII_TXD0 5
199+
#define PORTB_MII_TXEN 4
200+
#define PORTB_MII_RXER 3
201+
#define PORTB_MII_RXCLK 2
202+
#define PORTB_MII_RXD0 1
203+
#define PORTB_MII_RXD1 0
204+
205+
#define PORTC_MII_COL 7
206+
#define PORTC_MII_TXD3 6
207+
#define PORTC_MII_TXD2 5
208+
#define PORTC_MII_TXCLK 4
209+
#define PORTC_MII_TXER 3
210+
#define PORTC_MII_RXDV 2
211+
#define PORTC_MII_RXD2 1
212+
#define PORTC_MII_RXD3 0
213+
214+
#if !defined(_FROM_ASM_)
215+
#ifdef __cplusplus
216+
extern "C" {
217+
#endif
218+
void boardInit(void);
219+
#ifdef __cplusplus
220+
}
221+
#endif
222+
#endif /* _FROM_ASM_ */
223+
224+
#endif /* _BOARD_H_ */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
set path=c:\Program Files (x86)\SEGGER\JLinkARM_V442a
3+
jlink.exe r5f562n8bdfp_ram_wr.script
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
set path=c:\Program Files (x86)\SEGGER\JLinkARM_V442a
3+
jlink.exe r5f562n8bdfp_rd.script
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
set path=c:\Program Files (x86)\SEGGER\JLinkARM_V432b
3+
jlink.exe reset.script
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
set path="d:\Program Files\KPIT\GNURX\rx-elf\rx-elf\bin"
3+
rx-elf-objdump -h -S rx62n_demo.exe >rx62n_demo.lss
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
exec device = RX62N
2+
speed auto
3+
loadbin rx62n_demo.bin, 0x00000000
4+
r
5+
g
6+
q
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
exec device = RX62N
2+
speed auto
3+
savebin ram_dump.bin, 0x00000000, 0x18000
4+
r
5+
g
6+
q
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
exec device = RX62N
2+
speed auto
3+
r
4+
g
5+
q
Binary file not shown.

0 commit comments

Comments
 (0)