Kévin Redon | 9a12d68 | 2018-07-08 13:21:16 +0200 | [diff] [blame] | 1 | /* OWHW board definition |
| 2 | * |
| 3 | * (C) 2015-2017 by Harald Welte <hwelte@hmw-consulting.de> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA |
| 18 | */ |
Harald Welte | 849269f | 2015-11-30 12:16:53 +0100 | [diff] [blame] | 19 | #pragma once |
| 20 | #include "board_common.h" |
Kévin Redon | a1012b1 | 2018-07-01 18:11:01 +0200 | [diff] [blame] | 21 | #include "simtrace_usb.h" |
Harald Welte | 849269f | 2015-11-30 12:16:53 +0100 | [diff] [blame] | 22 | |
| 23 | /** Name of the board */ |
| 24 | #define BOARD_NAME "OWHW" |
| 25 | /** Board definition */ |
| 26 | #define owhw |
| 27 | |
Kévin Redon | e2b0f97 | 2018-08-28 19:13:06 +0200 | [diff] [blame^] | 28 | /** oscillator used as main clock source (in Hz) */ |
Harald Welte | a02b641 | 2016-08-21 18:32:12 +0200 | [diff] [blame] | 29 | #define BOARD_MAINOSC 18432000 |
Kévin Redon | e2b0f97 | 2018-08-28 19:13:06 +0200 | [diff] [blame^] | 30 | /** desired main clock frequency (in Hz, based on BOARD_MAINOSC) */ |
| 31 | #define BOARD_MCK 58982400 // 18.432 * 16 / 5 |
Harald Welte | a02b641 | 2016-08-21 18:32:12 +0200 | [diff] [blame] | 32 | |
Harald Welte | 849269f | 2015-11-30 12:16:53 +0100 | [diff] [blame] | 33 | /* USIM 2 interface (USART) */ |
| 34 | #define PIN_USIM2_CLK {PIO_PA2, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT} |
| 35 | #define PIN_USIM2_IO {PIO_PA6, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} |
| 36 | #define PINS_ISO7816_USIM2 PIN_USIM2_CLK, PIN_USIM2_IO |
| 37 | |
| 38 | /* USIM 2 interface (TC) */ |
| 39 | #define PIN_USIM2_IO_TC {PIO_PA1, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT} |
| 40 | #define PIN_USIM2_CLK_TC {PIO_PA4, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT} |
| 41 | #define PINS_TC_USIM2 PIN_USIM2_IO_TC, PIN_USIM2_CLK_TC |
| 42 | |
| 43 | /* USIM 1 interface (USART) */ |
| 44 | #define PIN_USIM1_IO {PIO_PA22, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} |
| 45 | #define PIN_USIM1_CLK {PIO_PA23, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} |
| 46 | #define PINS_ISO7816_USIM1 PIN_USIM1_CLK, PIN_USIM1_IO |
| 47 | |
| 48 | /* USIM 1 interface (TC) */ |
| 49 | #define PIN_USIM1_IO_TC {PIO_PA27, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT} |
| 50 | #define PIN_USIM1_CLK_TC {PIO_PA29, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT} |
| 51 | #define PINS_TC_USIM1 PIN_USIM1_IO_TC, PIN_USIM1_CLK_TC |
| 52 | |
Harald Welte | 0eaa992 | 2016-03-04 03:03:49 +0100 | [diff] [blame] | 53 | #define PIN_SET_USIM1_PRES {PIO_PA12, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT} |
Harald Welte | b086ab0 | 2016-02-29 10:05:53 +0100 | [diff] [blame] | 54 | #define PIN_USIM1_nRST {PIO_PA24, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT} |
Harald Welte | 2fb5996 | 2016-02-28 12:34:26 +0100 | [diff] [blame] | 55 | #define PIN_USIM1_VCC {PIO_PB3, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT} |
Harald Welte | 849269f | 2015-11-30 12:16:53 +0100 | [diff] [blame] | 56 | |
Harald Welte | 2fb5996 | 2016-02-28 12:34:26 +0100 | [diff] [blame] | 57 | #define PIN_SET_USIM2_PRES {PIO_PA14, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT} |
Harald Welte | 849269f | 2015-11-30 12:16:53 +0100 | [diff] [blame] | 58 | #define PIN_USIM2_nRST {PIO_PA7, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT} |
Harald Welte | 2fb5996 | 2016-02-28 12:34:26 +0100 | [diff] [blame] | 59 | #define PIN_USIM2_VCC {PIO_PB2, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT} |
Harald Welte | 849269f | 2015-11-30 12:16:53 +0100 | [diff] [blame] | 60 | |
| 61 | #define PINS_USIM1 PINS_TC_USIM1, PINS_ISO7816_USIM1, PIN_USIM1_nRST, PIN_SET_USIM1_PRES |
| 62 | #define PINS_USIM2 PINS_TC_USIM2, PINS_ISO7816_USIM2, PIN_USIM2_nRST, PIN_SET_USIM2_PRES |
| 63 | |
Harald Welte | 390760a | 2016-02-27 16:23:46 +0100 | [diff] [blame] | 64 | #define PINS_CARDSIM { PIN_SET_USIM1_PRES, PIN_SET_USIM2_PRES } |
| 65 | |
Harald Welte | 3ecbf67 | 2017-03-03 02:10:34 +0100 | [diff] [blame] | 66 | #define BOARD_USB_BMATTRIBUTES USBConfigurationDescriptor_SELFPOWERED_NORWAKEUP |
| 67 | |
Harald Welte | c6e482d | 2017-03-05 16:24:29 +0100 | [diff] [blame] | 68 | #define BOARD_USB_VENDOR_ID USB_VENDOR_OPENMOKO |
| 69 | #define BOARD_USB_PRODUCT_ID USB_PRODUCT_OWHW_SAM3 |
| 70 | #define BOARD_DFU_USB_PRODUCT_ID USB_PRODUCT_OWHW_SAM3_DFU |
| 71 | #define BOARD_USB_RELEASE 0x010 |
Harald Welte | 2fb5996 | 2016-02-28 12:34:26 +0100 | [diff] [blame] | 72 | |
Harald Welte | 6dcacf3 | 2016-03-19 14:01:31 +0100 | [diff] [blame] | 73 | #define CARDEMU_SECOND_UART |
Harald Welte | 07872b6 | 2016-03-20 11:45:36 +0100 | [diff] [blame] | 74 | /* Disable VCC/ADC detection, as OWHWv2 has no ADCVREF */ |
| 75 | //#define DETECT_VCC_BY_ADC |
Harald Welte | 6dcacf3 | 2016-03-19 14:01:31 +0100 | [diff] [blame] | 76 | |
Harald Welte | 2fb5996 | 2016-02-28 12:34:26 +0100 | [diff] [blame] | 77 | #define HAVE_CARDEM |