Change in ...libosmocore[master]: (minor) fix typo in comments
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/14442 Change subject: (minor) fix typo in comments .. (minor) fix typo in comments Change-Id: I697af428a2ea9a0ccd3f04ba8ec4664935ae29f8 --- M include/osmocom/core/utils.h 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/42/14442/1 diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h index 0673444..601bb56 100644 --- a/include/osmocom/core/utils.h +++ b/include/osmocom/core/utils.h @@ -48,7 +48,7 @@ int get_string_value(const struct value_string *vs, const char *str); char osmo_bcd2char(uint8_t bcd); -/* only works for numbers in ascci */ +/* only works for numbers in ASCII */ uint8_t osmo_char2bcd(char c); int osmo_bcd2str(char *dst, size_t dst_size, const uint8_t *bcd, int start_nibble, int end_nibble, bool allow_hex); @@ -92,7 +92,7 @@ rem -= ret; \ } while (0) -/*! Helper macro to terminate when an assertion failes +/*! Helper macro to terminate when an assertion fails * \param[in] exp Predicate to verify * This function will generate a backtrace and terminate the program if * the predicate evaluates to false (0). @@ -105,7 +105,7 @@ /*! duplicate a string using talloc and release its prior content (if any) * \param[in] ctx Talloc context to use for allocation * \param[out] dst pointer to string, will be updated with ptr to new string - * \param[in] newstr String that will be copieed to newly allocated string */ + * \param[in] newstr String that will be copied to newly allocated string */ static inline void osmo_talloc_replace_string(void *ctx, char **dst, const char *newstr) { if (*dst) -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14442 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I697af428a2ea9a0ccd3f04ba8ec4664935ae29f8 Gerrit-Change-Number: 14442 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon Gerrit-MessageType: newchange
Change in ...osmo-ccid-firmware[master]: CCID (minor): remove unused variables
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/14435 Change subject: CCID (minor): remove unused variables .. CCID (minor): remove unused variables Change-Id: Iaf5e13574c27a6f4b8efa541ac908dde452d1dcf --- M ccid/ccid_device.c 1 file changed, 3 insertions(+), 17 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/35/14435/1 diff --git a/ccid/ccid_device.c b/ccid/ccid_device.c index 346f77d..da2d7bb 100644 --- a/ccid/ccid_device.c +++ b/ccid/ccid_device.c @@ -397,7 +397,6 @@ static int ccid_handle_get_slot_status(struct ccid_slot *cs, struct msgb *msg) { const union ccid_pc_to_rdr *u = msgb_ccid_out(msg); - const struct ccid_header *ch = (const struct ccid_header *) u; uint8_t seq = u->get_slot_status.hdr.bSeq; struct msgb *resp; @@ -411,7 +410,6 @@ static int ccid_handle_icc_power_on(struct ccid_slot *cs, struct msgb *msg) { const union ccid_pc_to_rdr *u = msgb_ccid_out(msg); - const struct ccid_header *ch = (const struct ccid_header *) u; /* handle this asynchronously */ cs->ci->slot_ops->icc_power_on_async(cs, msg, >icc_power_on); @@ -422,7 +420,6 @@ static int ccid_handle_icc_power_off(struct ccid_slot *cs, struct msgb *msg) { const union ccid_pc_to_rdr *u = msgb_ccid_out(msg); - const struct ccid_header *ch = (const struct ccid_header *) u; uint8_t seq = u->icc_power_off.hdr.bSeq; struct msgb *resp; @@ -435,7 +432,6 @@ static int ccid_handle_xfr_block(struct ccid_slot *cs, struct msgb *msg) { const union ccid_pc_to_rdr *u = msgb_ccid_out(msg); - const struct ccid_header *ch = (const struct ccid_header *) u; /* handle this asynchronously */ cs->ci->slot_ops->xfr_block_async(cs, msg, >xfr_block); @@ -446,7 +442,6 @@ static int ccid_handle_get_parameters(struct ccid_slot *cs, struct msgb *msg) { const union ccid_pc_to_rdr *u = msgb_ccid_out(msg); - const struct ccid_header *ch = (const struct ccid_header *) u; uint8_t seq = u->get_parameters.hdr.bSeq; struct msgb *resp; @@ -459,7 +454,6 @@ static int ccid_handle_reset_parameters(struct ccid_slot *cs, struct msgb *msg) { const union ccid_pc_to_rdr *u = msgb_ccid_out(msg); - const struct ccid_header *ch = (const struct ccid_header *) u; uint8_t seq = u->reset_parameters.hdr.bSeq; struct msgb *resp; @@ -477,7 +471,6 @@ { const union ccid_pc_to_rdr *u = msgb_ccid_out(msg); const struct ccid_pc_to_rdr_set_parameters *spar = >set_parameters; - const struct ccid_header *ch = (const struct ccid_header *) u; uint8_t seq = u->set_parameters.hdr.bSeq; struct ccid_pars_decoded pars_dec; struct msgb *resp; @@ -518,7 +511,6 @@ static int ccid_handle_escape(struct ccid_slot *cs, struct msgb *msg) { const union ccid_pc_to_rdr *u = msgb_ccid_out(msg); - const struct ccid_header *ch = (const struct ccid_header *) u; uint8_t seq = u->escape.hdr.bSeq; struct msgb *resp; @@ -530,7 +522,6 @@ static int ccid_handle_icc_clock(struct ccid_slot *cs, struct msgb *msg) { const union ccid_pc_to_rdr *u = msgb_ccid_out(msg); - const struct ccid_header *ch = (const struct ccid_header *) u; uint8_t seq = u->icc_clock.hdr.bSeq; struct msgb *resp; @@ -543,7 +534,6 @@ static int ccid_handle_t0apdu(struct ccid_slot *cs, struct msgb *msg) { const union ccid_pc_to_rdr *u = msgb_ccid_out(msg); - const struct ccid_header *ch = (const struct ccid_header *) u; uint8_t seq = u->t0apdu.hdr.bSeq; struct msgb *resp; @@ -557,7 +547,6 @@ static int ccid_handle_secure(struct ccid_slot *cs, struct msgb *msg) { const union ccid_pc_to_rdr *u = msgb_ccid_out(msg); - const struct ccid_header *ch = (const struct ccid_header *) u; uint8_t seq = u->secure.hdr.bSeq; struct msgb *resp; @@ -570,7 +559,6 @@ static int ccid_handle_mechanical(struct ccid_slot *cs, struct msgb *msg) { const union ccid_pc_to_rdr *u = msgb_ccid_out(msg); - const struct ccid_header *ch = (const struct ccid_header *) u; uint8_t seq = u->mechanical.hdr.bSeq; struct msgb *resp; @@ -582,7 +570,6 @@ static int ccid_handle_abort(struct ccid_slot *cs, struct msgb *msg) { const union ccid_pc_to_rdr *u = msgb_ccid_out(msg); - const struct ccid_header *ch = (const struct ccid_header *) u; uint8_t seq = u->abort.hdr.bSeq; struct msgb *resp; @@ -611,7 +598,6 @@ static int ccid_handle_set_rate_and_clock(struct ccid_slot *cs, struct msgb *msg) { const union ccid_pc_to_rdr *u = msgb_ccid_out(msg); - const struct ccid_header *ch = (const struct ccid_header *) u; uint8_t se
Change in ...libosmocore[master]: minor: don't redefine macros
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/14434 Change subject: minor: don't redefine macros .. minor: don't redefine macros the DEBUG macro name and ARRAY_SIZE macro function are frequently used in other projects. If these projects also use libosmocore, the macros will be redefined. This also generates a warning message during compilation. Not redefining the macros removes the warning message and possible (but unlikely) mis-redefinition. Change-Id: I0ba91eae8eacc5542d1647601b372e417ed1713c --- M include/osmocom/core/logging.h M include/osmocom/core/utils.h 2 files changed, 4 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/34/14434/1 diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 295e5a8..803b4a9 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -16,7 +16,9 @@ /*! Maximum number of logging filters */ #define LOG_MAX_FILTERS8 +#ifndef DEBUG #define DEBUG +#endif #ifdef DEBUG /*! Log a debug message through the Osmocom logging framework diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h index f27359c..8cf4afb 100644 --- a/include/osmocom/core/utils.h +++ b/include/osmocom/core/utils.h @@ -14,7 +14,9 @@ * \file utils.h */ /*! Determine number of elements in an array of static size */ +#ifndef ARRAY_SIZE #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +#endif /*! Return the maximum of two specified values */ #define OSMO_MAX(a, b) ((a) >= (b) ? (a) : (b)) /*! Return the minimum of two specified values */ -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14434 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I0ba91eae8eacc5542d1647601b372e417ed1713c Gerrit-Change-Number: 14434 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon Gerrit-MessageType: newchange
Change in ...osmo-ccid-firmware[master]: ASF: minor, update copyright
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/14393 Change subject: ASF: minor, update copyright .. ASF: minor, update copyright upstream ASFv4 updated the copyright year. somehow they don't know you should use the range instead of the last year :/ this change is just so I can't continue diffing ASF files without false positive. Change-Id: Ic90e692815b30921bc8750c240ba0a5d3f4ccc70 --- M sysmoOCTSIM/gcc/gcc/same54n19a_flash.ld M sysmoOCTSIM/gcc/gcc/same54n19a_sram.ld M sysmoOCTSIM/gcc/gcc/startup_same54.c M sysmoOCTSIM/hal/utils/include/parts.h M sysmoOCTSIM/include/component/ac.h M sysmoOCTSIM/include/component/adc.h M sysmoOCTSIM/include/component/aes.h M sysmoOCTSIM/include/component/can.h M sysmoOCTSIM/include/component/ccl.h M sysmoOCTSIM/include/component/cmcc.h M sysmoOCTSIM/include/component/dac.h M sysmoOCTSIM/include/component/dmac.h M sysmoOCTSIM/include/component/eic.h M sysmoOCTSIM/include/component/evsys.h M sysmoOCTSIM/include/component/freqm.h M sysmoOCTSIM/include/component/gclk.h M sysmoOCTSIM/include/component/gmac.h M sysmoOCTSIM/include/component/hmatrixb.h M sysmoOCTSIM/include/component/i2s.h M sysmoOCTSIM/include/component/icm.h M sysmoOCTSIM/include/component/mclk.h M sysmoOCTSIM/include/component/osc32kctrl.h M sysmoOCTSIM/include/component/oscctrl.h M sysmoOCTSIM/include/component/pac.h M sysmoOCTSIM/include/component/pcc.h M sysmoOCTSIM/include/component/pdec.h M sysmoOCTSIM/include/component/pm.h M sysmoOCTSIM/include/component/port.h M sysmoOCTSIM/include/component/qspi.h M sysmoOCTSIM/include/component/ramecc.h M sysmoOCTSIM/include/component/rstc.h M sysmoOCTSIM/include/component/rtc.h M sysmoOCTSIM/include/component/sdhc.h M sysmoOCTSIM/include/component/sercom.h M sysmoOCTSIM/include/component/tc.h M sysmoOCTSIM/include/component/tcc.h M sysmoOCTSIM/include/component/trng.h M sysmoOCTSIM/include/component/usb.h M sysmoOCTSIM/include/component/wdt.h M sysmoOCTSIM/include/instance/ac.h M sysmoOCTSIM/include/instance/adc0.h M sysmoOCTSIM/include/instance/adc1.h M sysmoOCTSIM/include/instance/aes.h M sysmoOCTSIM/include/instance/can0.h M sysmoOCTSIM/include/instance/can1.h M sysmoOCTSIM/include/instance/ccl.h M sysmoOCTSIM/include/instance/cmcc.h M sysmoOCTSIM/include/instance/dac.h M sysmoOCTSIM/include/instance/dmac.h M sysmoOCTSIM/include/instance/eic.h M sysmoOCTSIM/include/instance/freqm.h M sysmoOCTSIM/include/instance/gclk.h M sysmoOCTSIM/include/instance/gmac.h M sysmoOCTSIM/include/instance/hmatrix.h M sysmoOCTSIM/include/instance/i2s.h M sysmoOCTSIM/include/instance/icm.h M sysmoOCTSIM/include/instance/mclk.h M sysmoOCTSIM/include/instance/nvmctrl.h M sysmoOCTSIM/include/instance/osc32kctrl.h M sysmoOCTSIM/include/instance/oscctrl.h M sysmoOCTSIM/include/instance/pac.h M sysmoOCTSIM/include/instance/pcc.h M sysmoOCTSIM/include/instance/pdec.h M sysmoOCTSIM/include/instance/pm.h M sysmoOCTSIM/include/instance/port.h M sysmoOCTSIM/include/instance/pukcc.h M sysmoOCTSIM/include/instance/qspi.h M sysmoOCTSIM/include/instance/ramecc.h M sysmoOCTSIM/include/instance/rstc.h M sysmoOCTSIM/include/instance/rtc.h M sysmoOCTSIM/include/instance/sdhc0.h M sysmoOCTSIM/include/instance/sdhc1.h M sysmoOCTSIM/include/instance/tc0.h M sysmoOCTSIM/include/instance/tc1.h M sysmoOCTSIM/include/instance/tc2.h M sysmoOCTSIM/include/instance/tc3.h M sysmoOCTSIM/include/instance/tc4.h M sysmoOCTSIM/include/instance/tc5.h M sysmoOCTSIM/include/instance/tc6.h M sysmoOCTSIM/include/instance/tc7.h M sysmoOCTSIM/include/instance/tcc0.h M sysmoOCTSIM/include/instance/tcc1.h M sysmoOCTSIM/include/instance/tcc2.h M sysmoOCTSIM/include/instance/tcc3.h M sysmoOCTSIM/include/instance/tcc4.h M sysmoOCTSIM/include/instance/trng.h M sysmoOCTSIM/include/instance/usb.h M sysmoOCTSIM/include/instance/wdt.h M sysmoOCTSIM/include/pio/same54n19a.h M sysmoOCTSIM/include/pio/same54n20a.h M sysmoOCTSIM/include/pio/same54p19a.h M sysmoOCTSIM/include/pio/same54p20a.h M sysmoOCTSIM/include/sam.h M sysmoOCTSIM/include/same54.h M sysmoOCTSIM/include/system_same54.h 95 files changed, 46,611 insertions(+), 46,611 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/93/14393/1 -- To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/14393 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-Change-Id: Ic90e692815b30921bc8750c240ba0a5d3f4ccc70 Gerrit-Change-Number: 14393 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon Gerrit-MessageType: newchange
Change in ...osmo-ccid-firmware[master]: ASF: add new utils
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/14394 Change subject: ASF: add new utils .. ASF: add new utils AFAIK these are not used yet, but have been added to the upstream ASFv4 library. I added them to avoid future false negative when diffing files. Change-Id: Icf6fb641050a1e7132ff2b14c1ce537ec9403b9f --- A sysmoOCTSIM/hal/utils/include/utils_decrement_macro.h A sysmoOCTSIM/hal/utils/include/utils_recursion_macro.h 2 files changed, 378 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/94/14394/1 diff --git a/sysmoOCTSIM/hal/utils/include/utils_decrement_macro.h b/sysmoOCTSIM/hal/utils/include/utils_decrement_macro.h new file mode 100644 index 000..2b52469 --- /dev/null +++ b/sysmoOCTSIM/hal/utils/include/utils_decrement_macro.h @@ -0,0 +1,309 @@ +/** + * \file + * + * \brief Decrement macro. + * + * Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries. + * + * \asf_license_start + * + * \page License + * + * Subject to your compliance with these terms, you may use Microchip + * software and any derivatives exclusively with Microchip products. + * It is your responsibility to comply with third party license terms applicable + * to your use of third party software (including open source software) that + * may accompany Microchip software. + * + * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, + * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, + * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, + * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE + * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL + * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE + * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE + * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT + * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY + * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, + * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. + * + * \asf_license_stop + * + */ + +#ifndef _UTILS_DECREMENT_MACRO_H +#define _UTILS_DECREMENT_MACRO_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief Compile time decrement, result value is entire integer literal + * + * \param[in] val - value to be decremented + */ +#define DEC_VALUE(val) DEC_##val + +// Preprocessor increment implementation +#define DEC_256 255 +#define DEC_255 254 +#define DEC_254 253 +#define DEC_253 252 +#define DEC_252 251 +#define DEC_251 250 +#define DEC_250 249 +#define DEC_249 248 +#define DEC_248 247 +#define DEC_247 246 +#define DEC_246 245 +#define DEC_245 244 +#define DEC_244 243 +#define DEC_243 242 +#define DEC_242 241 +#define DEC_241 240 +#define DEC_240 239 +#define DEC_239 238 +#define DEC_238 237 +#define DEC_237 236 +#define DEC_236 235 +#define DEC_235 234 +#define DEC_234 233 +#define DEC_233 232 +#define DEC_232 231 +#define DEC_231 230 +#define DEC_230 229 +#define DEC_229 228 +#define DEC_228 227 +#define DEC_227 226 +#define DEC_226 225 +#define DEC_225 224 +#define DEC_224 223 +#define DEC_223 222 +#define DEC_222 221 +#define DEC_221 220 +#define DEC_220 219 +#define DEC_219 218 +#define DEC_218 217 +#define DEC_217 216 +#define DEC_216 215 +#define DEC_215 214 +#define DEC_214 213 +#define DEC_213 212 +#define DEC_212 211 +#define DEC_211 210 +#define DEC_210 209 +#define DEC_209 208 +#define DEC_208 207 +#define DEC_207 206 +#define DEC_206 205 +#define DEC_205 204 +#define DEC_204 203 +#define DEC_203 202 +#define DEC_202 201 +#define DEC_201 200 +#define DEC_200 199 +#define DEC_199 198 +#define DEC_198 197 +#define DEC_197 196 +#define DEC_196 195 +#define DEC_195 194 +#define DEC_194 193 +#define DEC_193 192 +#define DEC_192 191 +#define DEC_191 190 +#define DEC_190 189 +#define DEC_189 188 +#define DEC_188 187 +#define DEC_187 186 +#define DEC_186 185 +#define DEC_185 184 +#define DEC_184 183 +#define DEC_183 182 +#define DEC_182 181 +#define DEC_181 180 +#define DEC_180 179 +#define DEC_179 178 +#define DEC_178 177 +#define DEC_177 176 +#define DEC_176 175 +#define DEC_175 174 +#define DEC_174 173 +#define DEC_173 172 +#define DEC_172 171 +#define DEC_171 170 +#define DEC_170 169 +#define DEC_169 168 +#define DEC_168 167 +#define DEC_167 166 +#define DEC_166 165 +#define DEC_165 164 +#define DEC_164 163 +#define DEC_163 162 +#define DEC_162 161 +#define DEC_161 160 +#define DEC_160 159 +#define DEC_159 158 +#define DEC_158 157 +#define DEC_157 156 +#define DEC_156 155 +#define DEC_155 154 +#define DEC_154 153 +#define DEC_153 152 +#define DEC_152 151 +#define DEC_151 150 +#define DEC_150 149 +#define DEC_149 148 +#define DEC_148 147 +#define DEC_147 146 +#define DEC_146 145 +#define DEC_145 144
Change in ...osmo-ccid-firmware[master]: Makefile: add missing hpl/rtc directory
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/14389 Change subject: Makefile: add missing hpl/rtc directory .. Makefile: add missing hpl/rtc directory Change-Id: I3fed159173467d1da091758fe2a87bef2cd2e3c7 --- M sysmoOCTSIM/gcc/Makefile 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/89/14389/1 diff --git a/sysmoOCTSIM/gcc/Makefile b/sysmoOCTSIM/gcc/Makefile index 97c5ec1..01088cc 100644 --- a/sysmoOCTSIM/gcc/Makefile +++ b/sysmoOCTSIM/gcc/Makefile @@ -63,6 +63,7 @@ hpl/pm \ hpl/ramecc \ hpl/sercom \ + hpl/rtc \ hpl/usb \ stdio_redirect \ stdio_redirect/gcc \ -- To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/14389 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-Change-Id: I3fed159173467d1da091758fe2a87bef2cd2e3c7 Gerrit-Change-Number: 14389 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon Gerrit-MessageType: newchange
Change in ...osmo-ccid-firmware[master]: Makefile: automatically get output directory list
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/14395 Change subject: Makefile: automatically get output directory list .. Makefile: automatically get output directory list Change-Id: I8a18a5f04b03f9fa95a1b4f5ee77945e4fa8db07 --- M sysmoOCTSIM/gcc/Makefile 1 file changed, 2 insertions(+), 28 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/95/14395/1 diff --git a/sysmoOCTSIM/gcc/Makefile b/sysmoOCTSIM/gcc/Makefile index 01088cc..062a468 100644 --- a/sysmoOCTSIM/gcc/Makefile +++ b/sysmoOCTSIM/gcc/Makefile @@ -45,34 +45,6 @@ endif endif -# List the subdirectories for creating object files -SUB_DIRS += \ - ccid \ - dma_m2m \ - gcc \ - gcc/gcc \ - hal/src \ - hal/utils/src \ - hpl/cmcc \ - hpl/core \ - hpl/dmac \ - hpl/gclk \ - hpl/mclk \ - hpl/osc32kctrl \ - hpl/oscctrl \ - hpl/pm \ - hpl/ramecc \ - hpl/sercom \ - hpl/rtc \ - hpl/usb \ - stdio_redirect \ - stdio_redirect/gcc \ - usb \ - usb/class/ccid/device \ - usb/class/cdc/device \ - usb/device \ - $(NULL) - INC_DIRS = \ -I"../" \ -I"../CMSIS/Core/Include" \ @@ -167,6 +139,8 @@ # List the dependency files DEPS := $(OBJS:%.o=%.d) +# List the subdirectories for creating object files +SUB_DIRS := $(sort $(foreach obj,$(OBJS),$(dir $(obj OUTPUT_FILE_NAME := sysmoOCTSIM QUOTE := " -- To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/14395 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-Change-Id: I8a18a5f04b03f9fa95a1b4f5ee77945e4fa8db07 Gerrit-Change-Number: 14395 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon Gerrit-MessageType: newchange
Change in ...osmo-ccid-firmware[master]: ASF: add related RTC files
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/14390 Change subject: ASF: add related RTC files .. ASF: add related RTC files this add the documentation and (yet unused) RTC definitions so to by in sync with the ASFv4 upstream library Change-Id: If3e24ede24b4e8cc2724a796756a5a2aa81119de --- A sysmoOCTSIM/hal/documentation/calendar.rst A sysmoOCTSIM/hpl/rtc/hpl_rtc_base.h 2 files changed, 124 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/90/14390/1 diff --git a/sysmoOCTSIM/hal/documentation/calendar.rst b/sysmoOCTSIM/hal/documentation/calendar.rst new file mode 100644 index 000..8a3de6e --- /dev/null +++ b/sysmoOCTSIM/hal/documentation/calendar.rst @@ -0,0 +1,72 @@ +=== +The Calendar driver (bare-bone) +=== + +The Calendar driver provides means to set and get current date and time. +After enabling, an instance of the driver starts counting time from the base date with +the resolution of one second. The default base date is 00:00:00 1st of January 1970. +Only the base year of the base date can be changed via the driver API. + +The current date and time is kept internally in a relative form as the difference between +current date and time and the base date and time. This means that changing the base year changes +current date. + +The base date and time defines time "zero" or the earliest possible point in time that the calender driver can describe, +this means that current time and alarms can not be set to anything earlier than this time. + +The Calendar driver provides alarm functionality. +An alarm is a software trigger which fires on particular date and time with particular periodicity. +Upon firing the given callback function is called. + +An alarm can be in single-shot mode, firing only once at matching time; or in repeating mode, meaning that it will +reschedule a new alarm automatically based on repeating mode configuration. +In single-shot mode an alarm is removed from the alarm queue before its callback is called. It allows an application to +reuse the memory of expired alarm in the callback. + +An alarm can be triggered on the following events: match on second, minute, hour, day, month or year. +Matching on second means that the alarm is triggered when the value of seconds of the current time is equal to +the alarm's value of seconds. This means repeating alarm with match on seconds is triggered with the period of a minute. +Matching on minute means that the calendars minute and seconds values has to match the alarms, the rest of the date-time +value is ignored. In repeating mode this means a new alarm every hour. +The same logic is applied to match on hour, day, month and year. + +Each instance of the Calendar driver supports infinite amount of software alarms, only limited by the amount of RAM available. + +Features + +* Initialization and de-initialization +* Enabling and disabling +* Date and time operations +* Software alarms + +Applications + +* A source of current date and time for an embedded system. +* Periodical functionality in low-power applications since the driver is designed to use 1Hz clock. +* Periodical function calls in case if it is more convenient to operate with absolute time. + +Dependencies + +* This driver expects a counter to be increased by one every second to count date and time correctly. +* Each instance of the driver requires separate hardware timer. + +Concurrency +--- +The Calendar driver is an interrupt driven driver.This means that the interrupt that triggers an alarm may occur during +the process of adding or removing an alarm via the driver's API. In such case the interrupt processing is postponed +until the alarm adding or removing is complete. + +The alarm queue is not protected from the access by interrupts not used by the driver. Due to this +it is not recommended to add or remove an alarm from such interrupts: in case if a higher priority interrupt supersedes +the driver's interrupt, adding or removing an alarm may cause unpredictable behavior of the driver. + +Limitations +--- +* Only years divisible by 4 are deemed a leap year, this gives a correct result between the years 1901 to 2099. +* The driver is designed to work outside of an operating system environment, the software alarm queue is therefore processed in interrupt context which may delay execution of other interrupts. +* If there are a lot of frequently called interrupts with the priority higher than the driver's one, it may cause delay in alarm's triggering. +* Changing the base year or setting current date or time does not shift alarms' date and time accordingly or expires alarms. + +Knows issues and workarounds + +Not applicable
Change in ...osmo-ccid-firmware[master]: ASF: update E54 SERCOM library
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/14392 Change subject: ASF: update E54 SERCOM library .. ASF: update E54 SERCOM library E54 ASFv4 change from backend 1.5.122 update local files to stay in sync Change-Id: Iabeb2b94d51743a0347ea81fef8fa6236d8b12c0 --- M sysmoOCTSIM/hri/hri_sercom_e54.h 1 file changed, 19 insertions(+), 19 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/92/14392/1 diff --git a/sysmoOCTSIM/hri/hri_sercom_e54.h b/sysmoOCTSIM/hri/hri_sercom_e54.h index f5a52b0..fed00ff 100644 --- a/sysmoOCTSIM/hri/hri_sercom_e54.h +++ b/sysmoOCTSIM/hri/hri_sercom_e54.h @@ -3,7 +3,7 @@ * * \brief SAM SERCOM * - * Copyright (c) 2016-2018 Microchip Technology Inc. and its subsidiaries. + * Copyright (c) 2016-2019 Microchip Technology Inc. and its subsidiaries. * * \asf_license_start * @@ -3682,7 +3682,7 @@ { SERCOM_CRITICAL_SECTION_ENTER(); ((Sercom *)hw)->I2CM.CTRLB.reg |= SERCOM_I2CM_CTRLB_SMEN; - hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_MASK); + hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_SYSOP); SERCOM_CRITICAL_SECTION_LEAVE(); } @@ -3702,7 +3702,7 @@ tmp &= ~SERCOM_I2CM_CTRLB_SMEN; tmp |= value << SERCOM_I2CM_CTRLB_SMEN_Pos; ((Sercom *)hw)->I2CM.CTRLB.reg = tmp; - hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_MASK); + hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_SYSOP); SERCOM_CRITICAL_SECTION_LEAVE(); } @@ -3710,7 +3710,7 @@ { SERCOM_CRITICAL_SECTION_ENTER(); ((Sercom *)hw)->I2CM.CTRLB.reg &= ~SERCOM_I2CM_CTRLB_SMEN; - hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_MASK); + hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_SYSOP); SERCOM_CRITICAL_SECTION_LEAVE(); } @@ -3718,7 +3718,7 @@ { SERCOM_CRITICAL_SECTION_ENTER(); ((Sercom *)hw)->I2CM.CTRLB.reg ^= SERCOM_I2CM_CTRLB_SMEN; - hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_MASK); + hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_SYSOP); SERCOM_CRITICAL_SECTION_LEAVE(); } @@ -3726,7 +3726,7 @@ { SERCOM_CRITICAL_SECTION_ENTER(); ((Sercom *)hw)->I2CM.CTRLB.reg |= SERCOM_I2CM_CTRLB_QCEN; - hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_MASK); + hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_SYSOP); SERCOM_CRITICAL_SECTION_LEAVE(); } @@ -3746,7 +3746,7 @@ tmp &= ~SERCOM_I2CM_CTRLB_QCEN; tmp |= value << SERCOM_I2CM_CTRLB_QCEN_Pos; ((Sercom *)hw)->I2CM.CTRLB.reg = tmp; - hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_MASK); + hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_SYSOP); SERCOM_CRITICAL_SECTION_LEAVE(); } @@ -3754,7 +3754,7 @@ { SERCOM_CRITICAL_SECTION_ENTER(); ((Sercom *)hw)->I2CM.CTRLB.reg &= ~SERCOM_I2CM_CTRLB_QCEN; - hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_MASK); + hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_SYSOP); SERCOM_CRITICAL_SECTION_LEAVE(); } @@ -3762,7 +3762,7 @@ { SERCOM_CRITICAL_SECTION_ENTER(); ((Sercom *)hw)->I2CM.CTRLB.reg ^= SERCOM_I2CM_CTRLB_QCEN; - hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_MASK); + hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_SYSOP); SERCOM_CRITICAL_SECTION_LEAVE(); } @@ -3770,7 +3770,7 @@ { SERCOM_CRITICAL_SECTION_ENTER(); ((Sercom *)hw)->I2CM.CTRLB.reg |= SERCOM_I2CM_CTRLB_ACKACT; - hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_MASK); + hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_SYSOP); SERCOM_CRITICAL_SECTION_LEAVE(); } @@ -3790,7 +3790,7 @@ tmp &= ~SERCOM_I2CM_CTRLB_ACKACT; tmp |= value << SERCOM_I2CM_CTRLB_ACKACT_Pos; ((Sercom *)hw)->I2CM.CTRLB.reg = tmp; - hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_MASK); + hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_SYSOP); SERCOM_CRITICAL_SECTION_LEAVE(); } @@ -3798,7 +3798,7 @@ { SERCOM_CRITICAL_SECTION_ENTER(); ((Sercom *)hw)->I2CM.CTRLB.reg &= ~SERCOM_I2CM_CTRLB_ACKACT; - hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_MASK); + hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_SYSOP); SERCOM_CRITICAL_SECTION_LEAVE(); } @@ -3806,7 +3806,7 @@ { SERCOM_CRITICAL_SECTION_ENTER(); ((Sercom *)hw)->I2CM.CTRLB.reg ^= SERCOM_I2CM_CTRLB_ACKACT; - hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_MASK); + hri_sercomi2cm_wait_for_sync(hw, SERCOM_I2CM_SYNCBUSY_SYSOP); SERCOM_CRITICAL_SECTION_LEAVE(); } @@ -3867,7 +3867,7 @@ { S
Change in libosmocore[master]: fix isdigit taking unsigned as input
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/14149 Change subject: fix isdigit taking unsigned as input .. fix isdigit taking unsigned as input fixes the following error warnings when cross-compiling using: ./configure --enable-static --prefix=/usr/local/arm-none-eabi --host=arm-none-eabi --enable-embedded --disable-doxygen --disable-shared --disable-pseudotalloc --enable-external-tests CFLAGS="-Os -ffunction-sections -fdata-sections -nostartfiles -nodefaultlibs -Werror -Wno-error=deprecated -Wno-error=deprecated-declarations -Wno-error=cpp -mthumb -Os -mlong-calls -g3 -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -Wno-error=format" utils.c:1002:18: error: array subscript has type 'char' [-Werror=char-subscripts] 1002 | if (!isdigit(in[i])) gsm23003.c:414:34: error: array subscript has type 'char' [-Werror=char-subscripts] 414 | if (!mnc_str || !isdigit(mnc_str[0]) || strlen(mnc_str) > 3) Change-Id: Ia13fd5ee79fc6dc3291c0b99958ab3c01afee17d --- M src/gsm/gsm23003.c M src/utils.c 2 files changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/49/14149/1 diff --git a/src/gsm/gsm23003.c b/src/gsm/gsm23003.c index a97ed07..584654b 100644 --- a/src/gsm/gsm23003.c +++ b/src/gsm/gsm23003.c @@ -411,7 +411,7 @@ char *endptr; int rc = 0; - if (!mnc_str || !isdigit(mnc_str[0]) || strlen(mnc_str) > 3) + if (!mnc_str || !isdigit((unsigned char)mnc_str[0]) || strlen(mnc_str) > 3) return -EINVAL; errno = 0; diff --git a/src/utils.c b/src/utils.c index 59dc816..6b871c8 100644 --- a/src/utils.c +++ b/src/utils.c @@ -999,7 +999,7 @@ /* All input must be numbers */ for (i = 0; i < in_len; i++) { - if (!isdigit(in[i])) + if (!isdigit((unsigned char)in[i])) return -EINVAL; } -- To view, visit https://gerrit.osmocom.org/14149 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Ia13fd5ee79fc6dc3291c0b99958ab3c01afee17d Gerrit-Change-Number: 14149 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in simtrace2[master]: remove unused make define
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/14148 Change subject: remove unused make define .. remove unused make define Change-Id: Ia9ef8ce705803df06cf1e4c3ac9731ce69e5e6c5 --- M firmware/Makefile 1 file changed, 1 insertion(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/48/14148/1 diff --git a/firmware/Makefile b/firmware/Makefile index fa72bd3..0f70bf4 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -124,8 +124,6 @@ # only applicable for qmod board ALLOW_PEER_ERASE?=0 -DEBUG_PHONE_SNIFF?=0 - #CFLAGS+=-DUSB_NO_DEBUG=1 # Optimization level, put in comment for debugging @@ -167,7 +165,7 @@ #CFLAGS += -Wa,-a,-ad CFLAGS += -D__ARM CFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb # -mfix-cortex-m3-ldrd -CFLAGS += -ffunction-sections -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -DTRACE_LEVEL=$(TRACE_LEVEL) -DDEBUG_PHONE_SNIFF=$(DEBUG_PHONE_SNIFF) -DALLOW_PEER_ERASE=$(ALLOW_PEER_ERASE) +CFLAGS += -ffunction-sections -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -DTRACE_LEVEL=$(TRACE_LEVEL) -DALLOW_PEER_ERASE=$(ALLOW_PEER_ERASE) CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" CFLAGS += -DBOARD=\"$(BOARD)\" -DBOARD_$(BOARD) CFLAGS += -DAPPLICATION=\"$(APP)\" -DAPPLICATION_$(APP) -- To view, visit https://gerrit.osmocom.org/14148 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Ia9ef8ce705803df06cf1e4c3ac9731ce69e5e6c5 Gerrit-Change-Number: 14148 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in simtrace2[master]: add make DEFINE to remove assert ERASE code
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/14147 Change subject: add make DEFINE to remove assert ERASE code .. add make DEFINE to remove assert ERASE code remove code to assert peer ERASE line by default. see README for more information. Change-Id: I5f88ecf1e2dcf00c0297597f88dd361a6e088c1e --- M firmware/Makefile M firmware/README.txt M firmware/libboard/qmod/source/board_qmod.c 3 files changed, 17 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/47/14147/1 diff --git a/firmware/Makefile b/firmware/Makefile index c0f53f3..fa72bd3 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -120,6 +120,10 @@ # TRACE_LEVEL_NO_TRACE 0 TRACE_LEVEL ?= 4 +# allow asserting the peer SAM3S ERASE signal to completely erase the flash +# only applicable for qmod board +ALLOW_PEER_ERASE?=0 + DEBUG_PHONE_SNIFF?=0 #CFLAGS+=-DUSB_NO_DEBUG=1 @@ -163,7 +167,7 @@ #CFLAGS += -Wa,-a,-ad CFLAGS += -D__ARM CFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb # -mfix-cortex-m3-ldrd -CFLAGS += -ffunction-sections -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -DTRACE_LEVEL=$(TRACE_LEVEL) -DDEBUG_PHONE_SNIFF=$(DEBUG_PHONE_SNIFF) +CFLAGS += -ffunction-sections -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -DTRACE_LEVEL=$(TRACE_LEVEL) -DDEBUG_PHONE_SNIFF=$(DEBUG_PHONE_SNIFF) -DALLOW_PEER_ERASE=$(ALLOW_PEER_ERASE) CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" CFLAGS += -DBOARD=\"$(BOARD)\" -DBOARD_$(BOARD) CFLAGS += -DAPPLICATION=\"$(APP)\" -DAPPLICATION_$(APP) diff --git a/firmware/README.txt b/firmware/README.txt index dcbafb2..fa7f60a 100644 --- a/firmware/README.txt +++ b/firmware/README.txt @@ -76,6 +76,10 @@ ``` Accepted values: 0 (NO_TRACE) to 5 (DEBUG) +The qmod specific option `ALLOW_PEER_ERASE` controls if the UART debug command to assert the peer SAM3S ERASE line is present in the code. +Per default this is set to 0 to prevent accidentally erasing all firmware, including the DFU bootloader, which would then need to be flashed using SAM-BA or JTAG/SWD. +Setting `ALLOW_PEER_ERASE` to 1 enables back the debug command and should be used only for debugging or development purposes. + = Flashing To flash a firmware image follow the instructions provided in the [wiki](https://projects.osmocom.org/projects/simtrace2/wiki/). diff --git a/firmware/libboard/qmod/source/board_qmod.c b/firmware/libboard/qmod/source/board_qmod.c index cab5271..4d75b98 100644 --- a/firmware/libboard/qmod/source/board_qmod.c +++ b/firmware/libboard/qmod/source/board_qmod.c @@ -184,10 +184,12 @@ /* returns '1' in case we should break any endless loop */ void board_exec_dbg_cmd(int ch) { +#if (ALLOW_PEER_ERASE > 0) /* this variable controls if it is allowed to assert/release the ERASE line. this is done to prevent accidental ERASE on noisy serial input since only one character can trigger the ERASE. */ static bool allow_erase = false; +#endif switch (ch) { case '?': @@ -209,9 +211,11 @@ } printf("\tX\tRelease peer SAM3 from reset\n\r"); printf("\tx\tAssert peer SAM3 reset\n\r"); +#if (ALLOW_PEER_ERASE > 0) printf("\tY\tRelease peer SAM3 ERASE signal\n\r"); printf("\ta\tAllow asserting peer SAM3 ERASE signal\n\r"); printf("\ty\tAssert peer SAM3 ERASE signal\n\r"); +#endif printf("\tU\tProceed to USB Initialization\n\r"); printf("\t1\tGenerate 1ms reset pulse on WWAN1\n\r"); printf("\t2\tGenerate 1ms reset pulse on WWAN2\n\r"); @@ -245,6 +249,7 @@ printf("Setting _SIMTRACExx_RST -> SIMTRACExx_RST low (active)\n\r"); PIO_Set(_peer_rst); break; +#if (ALLOW_PEER_ERASE > 0) case 'Y': printf("Clearing SIMTRACExx_ERASE (inactive)\n\r"); PIO_Clear(_peer_erase); @@ -261,6 +266,7 @@ printf("Please first allow setting SIMTRACExx_ERASE\n\r"); } break; +#endif case '1': printf("Resetting Modem 1 (of this SAM3)\n\r"); wwan_perst_do_reset_pulse(0, 300); @@ -283,10 +289,12 @@ break; } +#if (ALLOW_PEER_ERASE > 0) // set protection back so it can only run for one command if ('a' != ch) { allow_erase = false; } +#endif } void board_main_top(void) -- To view, visit https://gerrit.osmocom.org/14147 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I5f88ecf1e2dcf00c0297597f88dd361a6e088c1e Gerrit-Change-Number: 14147 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in simtrace2[master]: make peer ERASE more robust
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/14144 Change subject: make peer ERASE more robust .. make peer ERASE more robust adds command 'a' to allow setting/asserting the peer SAM3S ERASE line on the next command. this prevents against accidental erase since only the command 'y' was required, without confirmation. this could happen not only through accidental user input, but noise on the serial line (noise would still cause other issues, but at least now it will not "brick" the device). now the sequence 'ay' is required, as any other command following 'a' would clear the permission again. note: since ERASE is only setting a GPIO within this command parsing function, not accidental function pointer problem calling 'board_exec_dbg_cmd' should cause accidental ERASE since it would need to be called two times with the exact sequence Change-Id: I06bfeaef09a397bd554bec84321e0dd64ccc3aac --- M firmware/libboard/qmod/source/board_qmod.c 1 file changed, 22 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/44/14144/1 diff --git a/firmware/libboard/qmod/source/board_qmod.c b/firmware/libboard/qmod/source/board_qmod.c index ad1f6b7..cab5271 100644 --- a/firmware/libboard/qmod/source/board_qmod.c +++ b/firmware/libboard/qmod/source/board_qmod.c @@ -1,7 +1,7 @@ /* sysmocom quad-modem sysmoQMOD application code * * (C) 2016-2017 by Harald Welte - * (C) 2018, sysmocom -s.f.m.c. GmbH, Author: Kevin Redon + * (C) 2018-2019, sysmocom -s.f.m.c. GmbH, Author: Kevin Redon * * 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 @@ -184,6 +184,11 @@ /* returns '1' in case we should break any endless loop */ void board_exec_dbg_cmd(int ch) { + /* this variable controls if it is allowed to assert/release the ERASE line. + this is done to prevent accidental ERASE on noisy serial input since only one character can trigger the ERASE. +*/ + static bool allow_erase = false; + switch (ch) { case '?': printf("\t?\thelp\n\r"); @@ -205,6 +210,7 @@ printf("\tX\tRelease peer SAM3 from reset\n\r"); printf("\tx\tAssert peer SAM3 reset\n\r"); printf("\tY\tRelease peer SAM3 ERASE signal\n\r"); + printf("\ta\tAllow asserting peer SAM3 ERASE signal\n\r"); printf("\ty\tAssert peer SAM3 ERASE signal\n\r"); printf("\tU\tProceed to USB Initialization\n\r"); printf("\t1\tGenerate 1ms reset pulse on WWAN1\n\r"); @@ -243,9 +249,17 @@ printf("Clearing SIMTRACExx_ERASE (inactive)\n\r"); PIO_Clear(_peer_erase); break; + case 'a': + printf("Asserting SIMTRACExx_ERASE allowed on next command\n\r"); + allow_erase = true; + break; case 'y': - printf("Seetting SIMTRACExx_ERASE (active)\n\r"); - PIO_Set(_peer_erase); + if (allow_erase) { + printf("Setting SIMTRACExx_ERASE (active)\n\r"); + PIO_Set(_peer_erase); + } else { + printf("Please first allow setting SIMTRACExx_ERASE\n\r"); + } break; case '1': printf("Resetting Modem 1 (of this SAM3)\n\r"); @@ -268,6 +282,11 @@ board_exec_dbg_cmd_st12only(ch); break; } + + // set protection back so it can only run for one command + if ('a' != ch) { + allow_erase = false; + } } void board_main_top(void) -- To view, visit https://gerrit.osmocom.org/14144 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I06bfeaef09a397bd554bec84321e0dd64ccc3aac Gerrit-Change-Number: 14144 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in libosmocore[master]: fix typo in FSM description
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13951 Change subject: fix typo in FSM description .. fix typo in FSM description Change-Id: I3559e9c0769b708cee0d1b221b60960c62f15bd4 --- M src/fsm.c 1 file changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/51/13951/1 diff --git a/src/fsm.c b/src/fsm.c index c32767b..882a2b4 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -47,15 +47,15 @@ * The general idea is that all actions performed within one state are * located at one position in the code (the state's action function), * as opposed to the 'message-centric' view of e.g. the existing - * state machines of the LAPD(m) coe, where there is one message for - * eahc possible event (primitive), and the function then needs to + * state machines of the LAPD(m) core, where there is one message for + * each possible event (primitive), and the function then needs to * concern itself on how to handle that event over all possible states. * * For each state, there is a bit-mask of permitted input events for * this state, as well as a bit-mask of permitted new output states to * which the state can change. Furthermore, there is a function * pointer implementing the actual handling of the input events - * occurring whilst in thta state. + * occurring whilst in that state. * * Furthermore, each state offers a function pointer that can be * executed just before leaving a state, and another one just after @@ -84,7 +84,7 @@ * NOTICE level is used for all other subscribers. * * In order to attach private state to the \ref osmo_fsm_inst, it - * offers an opaque priv pointer. + * offers an opaque private pointer. * * \file fsm.c */ -- To view, visit https://gerrit.osmocom.org/13951 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I3559e9c0769b708cee0d1b221b60960c62f15bd4 Gerrit-Change-Number: 13951 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-ccid-firmware[master]: finish implementing sim-iccid
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13950 Change subject: finish implementing sim-iccid .. finish implementing sim-iccid Change-Id: I71b5832703a60c0c967fa2c6bc0eec56883962c5 --- M sysmoOCTSIM/main.c 1 file changed, 38 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/50/13950/1 diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c index 327ac6d..6ab8bc8 100644 --- a/sysmoOCTSIM/main.c +++ b/sysmoOCTSIM/main.c @@ -658,13 +658,47 @@ // select MF printf("(%d) SELECT MF\r\n", slotnr); - // write SELECT MF APDU - const uint8_t select_mf_header[] = {0xa0, 0xa4, 0x00, 0x00, 0x02}; - const uint8_t select_mf_data[] = {0x3f, 0x00}; - int rc = slot_tpdu_xfer(slotnr, select_mf_header, (uint8_t*)select_mf_data, ARRAY_SIZE(select_mf_data), true); // transfer TPDU + const uint8_t select_header[] = {0xa0, 0xa4, 0x00, 0x00, 0x02}; // see TS 102.221 sec. 11.1.1 + const uint8_t select_data_mf[] = {0x3f, 0x00}; // see TS 102.221 sec. 13.1 + int rc = slot_tpdu_xfer(slotnr, select_header, (uint8_t*)select_data_mf, ARRAY_SIZE(select_data_mf), true); // transfer TPDU if (ERR_NONE != rc) { printf("error while SELECT MF (errno = %d)\r\n", rc); } + // ignore response data + + // select EF_ICCID + printf("(%d) SELECT EF_ICCID\r\n", slotnr); + const uint8_t select_data_ef_iccid[] = {0x2f, 0xe2}; // see TS 102.221 sec. 13.2 + rc = slot_tpdu_xfer(slotnr, select_header, (uint8_t*)select_data_ef_iccid, ARRAY_SIZE(select_data_ef_iccid), true); // transfer TPDU + if (ERR_NONE != rc) { + printf("error while SELECT EF_ICCID (errno = %d)\r\n", rc); + } + // ignore response data + + // read EF_ICCID + printf("(%d) READ EF_ICCID\r\n", slotnr); + uint8_t iccid[10]; + uint8_t read_binary[] = {0xa0, 0xb0, 0x00, 0x00, ARRAY_SIZE(iccid)}; // see TS 102.221 sec. 11.1.3 + rc = slot_tpdu_xfer(slotnr, read_binary, iccid, ARRAY_SIZE(iccid), false); // transfer TPDU + if (ERR_NONE != rc) { + printf("error while READ ICCID (errno = %d)\r\n", rc); + } + // ignore response data + + printf("(%d) ICCID: ", slotnr); + for (uint8_t i = 0; i < ARRAY_SIZE(iccid); i++) { + uint8_t nibble = iccid[i] & 0xf; + if (0xf == nibble) { + break; + } + printf("%x", nibble); + nibble = iccid[i] >> 4; + if (0xf == nibble) { + break; + } + printf("%x", nibble); + } + printf("\r\n"); // disable LED settings.led = false; -- To view, visit https://gerrit.osmocom.org/13950 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I71b5832703a60c0c967fa2c6bc0eec56883962c5 Gerrit-Change-Number: 13950 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-ccid-firmware[master]: add function to transfer TPDU
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13949 Change subject: add function to transfer TPDU .. add function to transfer TPDU this function takes care of reading and writing the complete TPDU to the card. note: the sim-iccid command uses this function, but still only to select MF. Change-Id: I50c90f3697580a4c93220a3e09cc33ec85889814 --- M sysmoOCTSIM/main.c 1 file changed, 184 insertions(+), 83 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/49/13949/1 diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c index 11849c7..327ac6d 100644 --- a/sysmoOCTSIM/main.c +++ b/sysmoOCTSIM/main.c @@ -226,7 +226,183 @@ // set baud rate uint32_t baudrate = (freq * d) / f; // calculate actual baud rate - return slot_set_baudrate(slotnr, baudrate); // // set baud rate + return slot_set_baudrate(slotnr, baudrate); // set baud rate +} + +/** write data to card + * @param[in] slotnr slot number on which to send data + * @param[in] data data to be transmitted + * @param[in] length length of data to be transmitted + * @return error code + */ +static int slot_card_write(uint8_t slotnr, const uint8_t* data, uint16_t length) +{ + // input checks + ASSERT(slotnr < ARRAY_SIZE(SIM_peripheral_descriptors)); + if (0 == length || NULL == data) { + return ERR_INVALID_ARG; + } + + struct usart_async_descriptor* sim = SIM_peripheral_descriptors[slotnr]; + ((Sercom *)sim->device.hw)->USART.CTRLB.bit.RXEN = 0; // disable receive (to avoid the echo back) + SIM_tx_count[slotnr] = false; // reset TX complete + for (uint16_t i = 0; i < length; i++) { // transmit data + while(!usart_async_is_tx_empty(sim)); // wait for previous byte to be transmitted (WARNING blocking) + if (1 != io_write(>io, [i], 1)) { // put but in transmit buffer + return ERR_IO; + } + } + while (!SIM_tx_count[slotnr]); // wait until transmission is complete (WARNING blocking) + ((Sercom *)sim->device.hw)->USART.CTRLB.bit.RXEN = 1; // enable receive again + + return ERR_NONE; +} + +/** read data from card + * @param[in] slotnr slot number on which to send data + * @param[out] data buffer for read data to be stored + * @param[in] length length of data to be read + * @param[in] wt Waiting Time in ETU + * @return error code + * TODO fix WT/ETU duration + */ +static int slot_card_read(uint8_t slotnr, uint8_t* data, uint16_t length, uint32_t wt) +{ + // input checks + ASSERT(slotnr < ARRAY_SIZE(SIM_peripheral_descriptors)); + if (0 == length || NULL == data) { + return ERR_INVALID_ARG; + } + + struct usart_async_descriptor* sim = SIM_peripheral_descriptors[slotnr]; + + ((Sercom *)sim->device.hw)->USART.CTRLB.bit.RXEN = 1; // ensure RX is enabled + uint32_t timeout = wt; // reset waiting time + for (uint16_t i = 0; i < length; i++) { // read all data + while (timeout && !usart_async_is_rx_not_empty(sim)) { // verify if data is present + delay_us(149); // wait for 1 ETU (372 / 1 / 2.5 MHz = 148.8 us) + timeout--; + } + if (0 == timeout) { // timeout reached + return ERR_TIMEOUT; + } + timeout = wt; // reset waiting time + if (1 != io_read(>io, [i], 1)) { // read one byte + return ERR_IO; + } + } + + return ERR_NONE; +} + +/** transfer TPDU + * @param[in] slotnr slot number on which to transfer the TPDU + * @param[in] header TPDU header to send + * @param[io] data TPDU data to transfer + * @param[in] data_length length of TPDU data to transfer + * @param[in] write if the data should be written (true) or read (false) + * TODO fix WT + * TODO the data length can be deduce from the header + */ +static int slot_tpdu_xfer(uint8_t slotnr, const uint8_t* header, uint8_t* data, uint16_t data_length, bool write) +{ + // input checks + ASSERT(slotnr < ARRAY_SIZE(SIM_peripheral_descriptors)); + if (NULL == header || (data_length > 0 && NULL == data)) { + return ERR_INVALID_ARG; + } + + int rc; + struct usart_async_descriptor* sim = SIM_peripheral_descriptors[slotnr]; // get USART peripheral + usart_async_flush_rx_buffer(sim); // flush RX buffer to start from scratch + + // send command header + printf("(%d) TPDU: ", slotnr); + for (uint8_t i = 0; i < 5; i++) { + printf("%02x ", header[i]); + } + rc = slot_card_write(slotnr, header, 5); // transmit header + if (ERR_NONE != rc) { + printf
Change in osmo-ccid-firmware[master]: add debug command to communicate with card
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/13943 to look at the new patch set (#3). Change subject: add debug command to communicate with card .. add debug command to communicate with card currently the sim-iccid command only selects MF. this is a proof of concept for card communication. the transmission/reception must be generalized to avoid copying the code multiple times. IMPORTANT: the sim-iccid commands only works after the sim-atr command, which sets up the cards correctly Change-Id: Icbcde783143694afce23af6e3f26bcd7a9a13b85 --- M sysmoOCTSIM/main.c 1 file changed, 145 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/43/13943/3 -- To view, visit https://gerrit.osmocom.org/13943 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: Icbcde783143694afce23af6e3f26bcd7a9a13b85 Gerrit-Change-Number: 13943 Gerrit-PatchSet: 3 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Jenkins Builder (102)
Change in osmo-ccid-firmware[master]: add async library with ring on TX
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/13677 to look at the new patch set (#11). Change subject: add async library with ring on TX .. add async library with ring on TX the standard async library expected the caller to wait until the transmission was complete (by counting using the transmit callback or checking using usart_async_get_status) before freeing/reusing the memory holding the data to be transmitted. this is not practical when using stdio on top of the peripheral since printf returns directly and reuses the memory. the new USART async library has a ring buffer for the data to be transmitted (similar to the data being received). WARNING: write is blocking when the TX buffer is full. this prevents loosing data. Change-Id: Iafd5295b90ef9f428f640314c24f6c31ee82c9d6 --- M sysmoOCTSIM/gcc/Makefile A sysmoOCTSIM/hal/include/hal_usart_async_rings.h A sysmoOCTSIM/hal/src/hal_usart_async_rings.c 3 files changed, 770 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/77/13677/11 -- To view, visit https://gerrit.osmocom.org/13677 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: Iafd5295b90ef9f428f640314c24f6c31ee82c9d6 Gerrit-Change-Number: 13677 Gerrit-PatchSet: 11 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Jenkins Builder (102)
Change in osmo-ccid-firmware[master]: switch UART_debug to ASYNC
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/13673 ) Change subject: switch UART_debug to ASYNC .. Patch Set 9: > I still don't like the fact that this looses serial output pretty > much all the time (e.g. if you type 'help' at the command line). fixed in https://gerrit.osmocom.org/#/c/osmo-ccid-firmware/+/13677/ patchset 10. the new async lib with tx buffer is now blocking when the buffer is full. I did not implemented a warning for buffer "overflow", but the buffer is already quite large and I saw it blocking only with very large text (e.g. help). -- To view, visit https://gerrit.osmocom.org/13673 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7 Gerrit-Change-Number: 13673 Gerrit-PatchSet: 9 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Thu, 09 May 2019 13:39:27 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in osmo-ccid-firmware[master]: add debug command to communicate with card
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13943 Change subject: add debug command to communicate with card .. add debug command to communicate with card currently the read-iccid command only selects MF. this is a proof of concept for card communication. the transmission/reception must be generalized to avoid copying the code multiple times. Change-Id: Icbcde783143694afce23af6e3f26bcd7a9a13b85 --- M sysmoOCTSIM/main.c 1 file changed, 145 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/43/13943/1 diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c index a895c14..11849c7 100644 --- a/sysmoOCTSIM/main.c +++ b/sysmoOCTSIM/main.c @@ -38,10 +38,28 @@ // TODO for now SIM7 is not present because used for debug static struct usart_async_descriptor* SIM_peripheral_descriptors[] = {, , , , , , , NULL}; +/** number of bytes transmitted on the SIM peripheral */ +static volatile bool SIM_tx_count[8]; + static void SIM_rx_cb(const struct usart_async_descriptor *const io_descr) { } +/** called when the transmission is complete + * e.g. this is when the byte has been sent and there is no data to transmit anymore + */ +static void SIM_tx_cb(const struct usart_async_descriptor *const io_descr) +{ + // find slotnr for corresponding USART + uint8_t slotnr; + for (slotnr = 0; slotnr < ARRAY_SIZE(SIM_peripheral_descriptors) && SIM_peripheral_descriptors[slotnr] != io_descr; slotnr++); + + // set flag + if (slotnr < ARRAY_SIZE(SIM_peripheral_descriptors)) { + SIM_tx_count[slotnr] = true; + } +} + /** possible clock sources for the SERCOM peripheral * warning: the definition must match the GCLK configuration */ @@ -80,6 +98,7 @@ continue; } usart_async_register_callback(SIM_peripheral_descriptors[i], USART_ASYNC_RXC_CB, SIM_rx_cb); // required for RX to work, even if the callback does nothing + usart_async_register_callback(SIM_peripheral_descriptors[i], USART_ASYNC_TXC_CB, SIM_tx_cb); // to count the number of bytes transmitted since we are using it asynchronously usart_async_enable(SIM_peripheral_descriptors[i]); } } @@ -360,7 +379,7 @@ // check if card is present (and read current settings) ncn8025_get(slotnr, ); if (!settings.simpres) { - printf("no card present in slot %d, aborting\r\n", slotnr); + printf("(%d) error: no card present\r\n", slotnr); return; } @@ -406,19 +425,19 @@ } // verify if one byte has been received if (!usart_async_is_rx_not_empty(SIM_peripheral_descriptors[slotnr])) { - printf("card in slot %d is not responding, aborting\r\n", slotnr); + printf("(%d) error: card not responsive\r\n", slotnr); return; } // read ATR (just do it until there is no traffic anymore) - // TODO the ATR should be parsed to read the right number of bytes + // TODO the ATR should be parsed to read the right number of bytes, instead we just wait until to end of WT printf("(%d) ATR: ", slotnr); uint8_t atr_byte; while (usart_async_is_rx_not_empty(SIM_peripheral_descriptors[slotnr])) { if (1 == io_read(_peripheral_descriptors[slotnr]->io, _byte, 1)) { printf("%02x ", atr_byte); } - uint16_t wt = 9600; // waiting time in ETU + uint16_t wt = ISO7816_3_DEFAULT_WT; // waiting time in ETU while (wt && !usart_async_is_rx_not_empty(SIM_peripheral_descriptors[slotnr])) { delay_us(149); // wait for 1 ETU (372 / 1 / 2.5 MHz = 148.8 us) wt--; @@ -426,9 +445,127 @@ } printf("\r\n"); - /* disable VCC and LED, re-enable RST */ - settings.cmdvcc = false; - settings.rstin = true; + /* disable LED */ + settings.led = false; + ncn8025_set(slotnr, ); +} + +DEFUN(sim_iccid, cmd_sim_iccid, "sim-iccid", "Read ICCID from SIM card") +{ + struct ncn8025_settings settings; + int slotnr = validate_slotnr(argc, argv, 1); + + if (slotnr < 0 || slotnr >= ARRAY_SIZE(SIM_peripheral_descriptors) || NULL == SIM_peripheral_descriptors[slotnr]) { + return; + } + + // read current settings and check if card is present and powered + ncn8025_get(slotnr, ); + if (!settings.simpres) { + printf("(%d) error: no card present\r\n", slotnr); + return; + } + if (!settings.cmdvcc) { + printf("(%d) error:
Change in osmo-ccid-firmware[master]: add async library with ring on TX
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/13677 to look at the new patch set (#10). Change subject: add async library with ring on TX .. add async library with ring on TX the standard async library expected the caller to wait until the transmission was complete (by counting using the transmit callback or checking using usart_async_get_status) before freeing/reusing the memory holding the data to be transmitted. this is not practical when using stdio on top of the peripheral since printf returns directly and reuses the memory. the new USART async library has a ring buffer for the data to be transmitted (similar to the data being received). WARNING: write is blocking when the TX buffer is full. this prevents loosing data. Change-Id: Iafd5295b90ef9f428f640314c24f6c31ee82c9d6 --- M sysmoOCTSIM/gcc/Makefile A sysmoOCTSIM/hal/include/hal_usart_async_rings.h A sysmoOCTSIM/hal/src/hal_usart_async_rings.c 3 files changed, 768 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/77/13677/10 -- To view, visit https://gerrit.osmocom.org/13677 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: Iafd5295b90ef9f428f640314c24f6c31ee82c9d6 Gerrit-Change-Number: 13677 Gerrit-PatchSet: 10 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Jenkins Builder (102)
Change in osmo-ccid-firmware[master]: add slot_set_isorate to the baud rate using ISO 7816 values
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/13847 to look at the new patch set (#2). Change subject: add slot_set_isorate to the baud rate using ISO 7816 values .. add slot_set_isorate to the baud rate using ISO 7816 values Change-Id: I604f72bb28944962aee055e6d88a435827f79bec --- M sysmoOCTSIM/main.c 1 file changed, 55 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/47/13847/2 -- To view, visit https://gerrit.osmocom.org/13847 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I604f72bb28944962aee055e6d88a435827f79bec Gerrit-Change-Number: 13847 Gerrit-PatchSet: 2 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon
Change in osmo-ccid-firmware[master]: add slot_set_isorate to the baud rate using ISO 7816 values
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/13847 ) Change subject: add slot_set_isorate to the baud rate using ISO 7816 values .. Patch Set 1: Code-Review-1 bug found -- To view, visit https://gerrit.osmocom.org/13847 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I604f72bb28944962aee055e6d88a435827f79bec Gerrit-Change-Number: 13847 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Thu, 02 May 2019 14:02:25 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-ccid-firmware[master]: add function to set baudrate
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13845 Change subject: add function to set baudrate .. add function to set baudrate it will set the GCLK as SERCOM core clock with the lowest baud rate error and set the closest baud rate in the SERCOM peripheral. Change-Id: I01db273f4c8170a4942049653c575010b93296ce --- M sysmoOCTSIM/main.c 1 file changed, 78 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/45/13845/1 diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c index 47d1cd1..70099e1 100644 --- a/sysmoOCTSIM/main.c +++ b/sysmoOCTSIM/main.c @@ -18,12 +18,14 @@ #include #include +#include #include #include #include #include "atmel_start.h" #include "atmel_start_pins.h" +#include "config/hpl_gclk_config.h" #include "i2c_bitbang.h" #include "octsim_i2c.h" @@ -39,6 +41,21 @@ { } +/** possible clock sources for the SERCOM peripheral + * warning: the definition must match the GCLK configuration + */ +static const uint8_t sercom_glck_sources[] = {GCLK_PCHCTRL_GEN_GCLK2_Val, GCLK_PCHCTRL_GEN_GCLK4_Val, GCLK_PCHCTRL_GEN_GCLK6_Val}; + +/** possible clock frequencies in MHz for the SERCOM peripheral + * warning: the definition must match the GCLK configuration + */ +static const double sercom_glck_freqs[] = {100E6 / CONF_GCLK_GEN_2_DIV, 100E6 / CONF_GCLK_GEN_4_DIV, 120E6 / CONF_GCLK_GEN_6_DIV}; + +/** the GCLK ID for the SERCOM SIM peripherals + * @note: used as index for PCHCTRL + */ +static const uint8_t SIM_peripheral_GCLK_ID[] = {SERCOM0_GCLK_ID_CORE, SERCOM1_GCLK_ID_CORE, SERCOM2_GCLK_ID_CORE, SERCOM3_GCLK_ID_CORE, SERCOM4_GCLK_ID_CORE, SERCOM5_GCLK_ID_CORE, SERCOM6_GCLK_ID_CORE, SERCOM7_GCLK_ID_CORE}; + static void board_init() { int i; @@ -81,6 +98,66 @@ return slotnr; } +/** change baud rate of card slot + * @param[in] slotnr slot number for which the baud rate should be set + * @param[in] baudrate baud rate in bps to set + * @return if the baud rate has been set, else a parameter is out of range + */ +static bool slot_set_baudrate(uint8_t slotnr, uint32_t baudrate) +{ + ASSERT(slotnr < ARRAY_SIZE(SIM_peripheral_descriptors)); + + // calculate the error corresponding to the clock sources + uint16_t bauds[ARRAY_SIZE(sercom_glck_freqs)]; + double errors[ARRAY_SIZE(sercom_glck_freqs)]; + for (uint8_t i = 0; i < ARRAY_SIZE(sercom_glck_freqs); i++) { + double freq = sercom_glck_freqs[i]; // remember possible SERCOM frequency + uint32_t min = freq / (2 * (255 + 1)); // calculate the minimum baud rate for this frequency + uint32_t max = freq / (2 * (0 + 1)); // calculate the maximum baud rate for this frequency + if (baudrate < min || baudrate > max) { // baud rate it out of supported range + errors[i] = NAN; + } else { + uint16_t baud = round(freq / (2 * baudrate) - 1); + bauds[i] = baud; + double actual = freq / (2 * (baud + 1)); + errors[i] = fabs(1.0 - (actual / baudrate)); + } + } + + // find the smallest error + uint8_t best = ARRAY_SIZE(sercom_glck_freqs); + for (uint8_t i = 0; i < ARRAY_SIZE(sercom_glck_freqs); i++) { + if (isnan(errors[i])) { + continue; + } + if (best >= ARRAY_SIZE(sercom_glck_freqs)) { + best = i; + } else if (errors[i] < errors[best]) { + best = i; + } + } + if (best >= ARRAY_SIZE(sercom_glck_freqs)) { // found no clock supporting this baud rate + return false; + } + + // set clock and baud rate + struct usart_async_descriptor* slot = SIM_peripheral_descriptors[slotnr]; // get slot + if (NULL == slot) { + return false; + } + printf("(%u) switching SERCOM clock to GCLK%u (freq = %lu kHz) and baud rate to %lu bps (baud = %u)\r\n", slotnr, (best + 1) * 2, (uint32_t)(round(sercom_glck_freqs[best] / 1000)), baudrate, bauds[best]); + while (!usart_async_is_tx_empty(slot)); // wait for transmission to complete (WARNING no timeout) + usart_async_disable(slot); // disable SERCOM peripheral + hri_gclk_clear_PCHCTRL_reg(GCLK, SIM_peripheral_GCLK_ID[slotnr], (1 << GCLK_PCHCTRL_CHEN_Pos)); // disable clock for this peripheral + while (hri_gclk_get_PCHCTRL_reg(GCLK, SIM_peripheral_GCLK_ID[slotnr], (1 << GCLK_PCHCTRL_CHEN_Pos))); // wait until clock is really disabled + // it does not seem we need to completely disable the peripheral using hri_mclk_clear_APBDMASK_SERCOMn_bit +
Change in osmo-ccid-firmware[master]: add slot_set_isorate to the baud rate using ISO 7816 values
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13847 Change subject: add slot_set_isorate to the baud rate using ISO 7816 values .. add slot_set_isorate to the baud rate using ISO 7816 values Change-Id: I604f72bb28944962aee055e6d88a435827f79bec --- M sysmoOCTSIM/main.c 1 file changed, 38 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/47/13847/1 diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c index 70099e1..55e3bd9 100644 --- a/sysmoOCTSIM/main.c +++ b/sysmoOCTSIM/main.c @@ -30,6 +30,7 @@ #include "i2c_bitbang.h" #include "octsim_i2c.h" #include "ncn8025.h" +#include "iso7816_3.h" #include "command.h" @@ -158,6 +159,40 @@ return true; } +/** change ISO baud rate of card slot + * @param[in] slotnr slot number for which the baud rate should be set + * @param[in] clkdiv can clock divider + * @param[in] f clock rate conversion integer F + * @param[in] d baud rate adjustment factor D + * @return if the baud rate has been set, else a parameter is out of range + */ +static bool slot_set_isorate(uint8_t slotnr, enum ncn8025_sim_clkdiv clkdiv, uint16_t f, uint8_t d) +{ + // input checks + ASSERT(slotnr < ARRAY_SIZE(SIM_peripheral_descriptors)); + if (clkdiv != 1 && clkdiv != 2 && clkdiv != 4 && clkdiv != 8) { + return false; + } + if (!iso7816_3_valid_f(f)) { + return false; + } + if (!iso7816_3_valid_d(d)) { + return false; + } + + // set clockdiv + struct ncn8025_settings settings; + ncn8025_get(slotnr, ); + if (settings.clkdiv != clkdiv) { + settings.clkdiv = clkdiv; + ncn8025_set(slotnr, ); + } + + // set baud rate + uint32_t baudrate = ((2000UL / (1 << clkdiv)) * d) / f; // calculate actual baud rate + return slot_set_baudrate(slotnr, baudrate); // // set baud rate +} + DEFUN(sim_status, cmd_sim_status, "sim-status", "Get state of specified NCN8025") { struct ncn8025_settings settings; @@ -322,10 +357,12 @@ // TODO wait some time for card to be completely deactivated usart_async_flush_rx_buffer(SIM_peripheral_descriptors[slotnr]); // flush RX buffer to start from scratch - slot_set_baudrate(slotnr, 250 / (372 / 1)); // set USART baud rate to match the interface (f = 2.5 MHz) and card default settings (Fd = 372, Dd = 1) + // set clock to lowest frequency (20 MHz / 8 = 2.5 MHz) // note: according to ISO/IEC 7816-3:2006 section 5.2.3 the minimum value is 1 MHz, and maximum is 5 MHz during activation settings.clkdiv = SIM_CLKDIV_8; + // set USART baud rate to match the interface (f = 2.5 MHz) and card default settings (Fd = 372, Dd = 1) + slot_set_isorate(slotnr, settings.clkdiv, ISO7816_3_DEFAULT_FD, ISO7816_3_DEFAULT_DD); // set card voltage to 3.0 V (the most supported) // note: according to ISO/IEC 7816-3:2006 no voltage should damage the card, and you should cycle from low to high settings.vsel = SIM_VOLT_3V0; -- To view, visit https://gerrit.osmocom.org/13847 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I604f72bb28944962aee055e6d88a435827f79bec Gerrit-Change-Number: 13847 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-ccid-firmware[master]: add ISO 7816-3 definitions and utilities
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13846 Change subject: add ISO 7816-3 definitions and utilities .. add ISO 7816-3 definitions and utilities Change-Id: Ice4eba380126ff92089b71d0ea328b0110f7ffec --- M sysmoOCTSIM/gcc/Makefile A sysmoOCTSIM/iso7816_3.c A sysmoOCTSIM/iso7816_3.h 3 files changed, 225 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/46/13846/1 diff --git a/sysmoOCTSIM/gcc/Makefile b/sysmoOCTSIM/gcc/Makefile index 5d21cb0..cf0484c 100644 --- a/sysmoOCTSIM/gcc/Makefile +++ b/sysmoOCTSIM/gcc/Makefile @@ -83,6 +83,7 @@ octsim_i2c.o \ ncn8025.o \ command.o \ +iso7816_3.o \ hpl/osc32kctrl/hpl_osc32kctrl.o \ driver_init.o \ hal/src/hal_usart_async.o \ @@ -132,6 +133,7 @@ "octsim_i2c.o" \ "ncn8025.o" \ "command.o" \ +"iso7816_3.o" \ "hpl/osc32kctrl/hpl_osc32kctrl.o" \ "driver_init.o" \ "hal/src/hal_usart_async.o" \ @@ -188,7 +190,8 @@ "octsim_i2c.d" \ "ncn8025.d" \ "command.d" \ -"hal/src/hal_cache.d" \ +"iso7816_3.d" \ +"hal/src/halcache.d" \ "hal/src/hal_sleep.d" \ "hal/utils/src/utils_ringbuffer.d" \ "hpl/sercom/hpl_sercom.d" \ diff --git a/sysmoOCTSIM/iso7816_3.c b/sysmoOCTSIM/iso7816_3.c new file mode 100644 index 000..f7262fb --- /dev/null +++ b/sysmoOCTSIM/iso7816_3.c @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2019 sysmocom -s.f.m.c. GmbH, Author: Kevin Redon + * + * 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. +*/ +#include +#include + +#include "utils.h" +#include "iso7816_3.h" + +const uint16_t iso7816_3_fi_table[16] = { + 372, 372, 558, 744, 1116, 1488, 1860, 0, + 0, 512, 768, 1024, 1536, 2048, 0, 0 +}; + +const uint32_t iso7816_3_fmax_table[16] = { + 400, 500, 600, 800, 1200, 1600, 2000, 0, + 0, 500, 750, 1000, 1500, 2000, 0, 0 +}; + +const uint8_t iso7816_3_di_table[16] = { + 0, 1, 2, 4, 8, 16, 32, 64, + 12, 20, 0, 0, 0, 0, 0, 0, +}; + +/* all values are based on the Elementary Time Unit (ETU), defined in ISO/IEC 7816-3 section 7.1 + * this is the time required to transmit a bit, and is calculated as follows: 1 ETU = (F / D) x (1 / f) where: + * - F is the clock rate conversion integer + * - D is the baud rate adjustment factor + * - f is the clock frequency + * the possible F, f(max), and D values are defined in ISO/IEC 7816-3 table 7 and 8 + * - the initial value for F (after reset) is Fd = 372 + * - the initial value for D (after reset) is Dd = 1 + * - the initial maximum frequency f(max) is 5 MHz + * the card must measure the ETU based on the clock signal provided by the reader + * one ETU (e.g. 1 bit) takes F/D clock cycles, which the card must count + * + * the card can indicate an alternative set of supported values Fi (with corresponding f(max)) and Di for higher baud rate in TA1 in the ATR (see ISO/IEC 7816-3 section 8.3) + * these values are selected according to ISO/IEC 7816-3 section 6.3.1: + * - card in specific mode: they are enforced if TA2 is present (the reader can deactivate the card if it does not support these values) + * - card in negotiable mode: + * -- they can be selected by the reader using the Protocol and Parameters Selection (PPS) procedure + * -- the first offered protocol and default values are used when no PPS is started + * + * PPS is done with Fd and Dd (see ISO/IEC 7816-3 section 9) + * the reader can propose any F and D values between from Fd to Fi, and from Dd to Di (Fi and Di are indicated in TA1) + * the in PPS agreed values F and D are called Fn and Dn and are applied after a successful exchange, corresponding to PPS1_Response bit 5 + * + * the F and D values must be provided to the SAM3S USART peripheral (after reset and PPS) + */ + +bool iso7816_3_valid_f(uint16_t f) +{ + if (0 == f) { + return false; + } + uint8_t i = 0; + for (i = 0; i < ARRAY_SIZE(iso7816_3_fi_table) && iso7816_3_fi_table[i] != f; i++); + return (i < ARRAY_SIZE(iso7816_3_fi_table) &
Change in osmo-ccid-firmware[master]: output 50 MHz for RMII
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13780 Change subject: output 50 MHz for RMII .. output 50 MHz for RMII in hardware revision 2 the Ethernet PHY RMII_CLOCK input clock is connected to the MCU pin PA10. GCLK4 of the MCU now outputs the required 50 MHz clock on this pin. the same clock is re-used for UART debug to generate the 921600 bps baud rate. Change-Id: Id3a3dee15c3986536b0623d0f39ca62e94acd1fd --- M sysmoOCTSIM/atmel_start_config.atstart M sysmoOCTSIM/atmel_start_pins.h M sysmoOCTSIM/config/hpl_gclk_config.h M sysmoOCTSIM/config/peripheral_clk_config.h M sysmoOCTSIM/driver_init.c 5 files changed, 63 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/80/13780/1 diff --git a/sysmoOCTSIM/atmel_start_config.atstart b/sysmoOCTSIM/atmel_start_config.atstart index 4fda2f8..6357a74 100644 --- a/sysmoOCTSIM/atmel_start_config.atstart +++ b/sysmoOCTSIM/atmel_start_config.atstart @@ -702,7 +702,7 @@ gclk_arch_gen_3_runstdby: false gclk_arch_gen_4_enable: true gclk_arch_gen_4_idc: false - gclk_arch_gen_4_oe: false + gclk_arch_gen_4_oe: true gclk_arch_gen_4_oov: false gclk_arch_gen_4_runstdby: false gclk_arch_gen_5_enable: true @@ -748,7 +748,7 @@ gclk_gen_3_div: 1 gclk_gen_3_div_sel: false gclk_gen_3_oscillator: 32kHz External Crystal Oscillator (XOSC32K) - gclk_gen_4_div: 1 + gclk_gen_4_div: 2 gclk_gen_4_div_sel: false gclk_gen_4_oscillator: Digital Phase Locked Loop (DPLL1) gclk_gen_5_div: 5 @@ -1462,6 +1462,16 @@ mode: Peripheral IO user_label: SIM2_IO configuration: null + RMII_CLOCK: +name: PA10 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PA10 +mode: Advanced +user_label: RMII_CLOCK +configuration: + pad_direction: Out + pad_function: M + pad_initial_level: Low + pad_pull_config: 'Off' SIMCLK_20MHZ: name: PA11 definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PA11 diff --git a/sysmoOCTSIM/atmel_start_pins.h b/sysmoOCTSIM/atmel_start_pins.h index 0264736..7cbaed5 100644 --- a/sysmoOCTSIM/atmel_start_pins.h +++ b/sysmoOCTSIM/atmel_start_pins.h @@ -31,6 +31,7 @@ #define SIM5_INT GPIO(GPIO_PORTA, 3) #define SIM0_IO GPIO(GPIO_PORTA, 4) #define SIM2_IO GPIO(GPIO_PORTA, 9) +#define RMII_CLOCK GPIO(GPIO_PORTA, 10) #define SIMCLK_20MHZ GPIO(GPIO_PORTA, 11) #define SIM1_IO GPIO(GPIO_PORTA, 16) #define VB0 GPIO(GPIO_PORTA, 20) diff --git a/sysmoOCTSIM/config/hpl_gclk_config.h b/sysmoOCTSIM/config/hpl_gclk_config.h index 71c26e1..81a1f03 100644 --- a/sysmoOCTSIM/config/hpl_gclk_config.h +++ b/sysmoOCTSIM/config/hpl_gclk_config.h @@ -349,7 +349,7 @@ // Indicates whether Output Enable is enabled or not // gclk_arch_gen_4_oe #ifndef CONF_GCLK_GEN_4_OE -#define CONF_GCLK_GEN_4_OE 0 +#define CONF_GCLK_GEN_4_OE 1 #endif // Output Off Value @@ -378,7 +378,7 @@ // Generic clock generator 4 division <0x-0x> // gclk_gen_4_div #ifndef CONF_GCLK_GEN_4_DIV -#define CONF_GCLK_GEN_4_DIV 1 +#define CONF_GCLK_GEN_4_DIV 2 #endif // // diff --git a/sysmoOCTSIM/config/peripheral_clk_config.h b/sysmoOCTSIM/config/peripheral_clk_config.h index 4bff6ff..2ae1f63 100644 --- a/sysmoOCTSIM/config/peripheral_clk_config.h +++ b/sysmoOCTSIM/config/peripheral_clk_config.h @@ -641,7 +641,7 @@ * \brief SERCOM7's Core Clock frequency */ #ifndef CONF_GCLK_SERCOM7_CORE_FREQUENCY -#define CONF_GCLK_SERCOM7_CORE_FREQUENCY 1 +#define CONF_GCLK_SERCOM7_CORE_FREQUENCY 5000 #endif /** diff --git a/sysmoOCTSIM/driver_init.c b/sysmoOCTSIM/driver_init.c index 0b6b190..1233d02 100644 --- a/sysmoOCTSIM/driver_init.c +++ b/sysmoOCTSIM/driver_init.c @@ -503,6 +503,53 @@ gpio_set_pin_function(SIM5_INT, GPIO_PIN_FUNCTION_OFF); + // GPIO on PA10 + + gpio_set_pin_direction(RMII_CLOCK, + // Pin direction + // pad_direction + // Off + // In + // Out + GPIO_DIRECTION_OUT); + + gpio_set_pin_level(RMII_CLOCK, + // Initial level + // pad_initial_level + // Low + // High + false); + + gpio_set_pin_pull_mode(RMII_CLOCK, + // Pull configuration + // pad_pull_config + // Off + // Pull-up + // Pull-down + GPIO_PULL_OFF); + + gpio_set_pin_function(RMII_CLOCK, + // Pin fu
Change in osmo-ccid-firmware[master]: configure GCLK for ISO baud rates
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13781 Change subject: configure GCLK for ISO baud rates .. configure GCLK for ISO baud rates the SERCOMM clock triplet 0.5 MHz (100 MHz / 200), 7.0588 MHz (120 MHz / 17), and 50 MHz (100 MHz / 2) allows to generate all possible ISO 7816 baud rates (from F = 2048 / D = 1 @ f = 2.5 MHz -> 1220 bps to F = 372 / D = 64 @ f = 20 MHz -> 3.4 Mbps) with a maximum baud rate error of 2.57 %, for available SIM clocks 2.5, 5, 10, 20 MHz. 2.57% means a bit more than quarter a bit might be wrong after the 11 bits ISO transmission (still less than half a bit). This triplet is one of the optimum when 3 clocks are used. An additional clock would be required for higher accuracy. The 50 MHz clock is re-used from the RMII clock output. Change-Id: I2c69848582e49031fa6453f535a2bf1408f8e22e --- M sysmoOCTSIM/atmel_start_config.atstart M sysmoOCTSIM/config/hpl_gclk_config.h M sysmoOCTSIM/config/peripheral_clk_config.h 3 files changed, 17 insertions(+), 17 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/81/13781/1 diff --git a/sysmoOCTSIM/atmel_start_config.atstart b/sysmoOCTSIM/atmel_start_config.atstart index 6357a74..3854fb5 100644 --- a/sysmoOCTSIM/atmel_start_config.atstart +++ b/sysmoOCTSIM/atmel_start_config.atstart @@ -666,7 +666,7 @@ enable_gclk_gen_3: true enable_gclk_gen_4: true enable_gclk_gen_5: true - enable_gclk_gen_6: false + enable_gclk_gen_6: true enable_gclk_gen_7: false enable_gclk_gen_8: false enable_gclk_gen_9: false @@ -710,7 +710,7 @@ gclk_arch_gen_5_oe: true gclk_arch_gen_5_oov: false gclk_arch_gen_5_runstdby: false - gclk_arch_gen_6_enable: false + gclk_arch_gen_6_enable: true gclk_arch_gen_6_idc: false gclk_arch_gen_6_oe: false gclk_arch_gen_6_oov: false @@ -742,7 +742,7 @@ gclk_gen_1_div: 1 gclk_gen_1_div_sel: false gclk_gen_1_oscillator: Digital Frequency Locked Loop (DFLL48M) - gclk_gen_2_div: 30 + gclk_gen_2_div: 200 gclk_gen_2_div_sel: false gclk_gen_2_oscillator: Digital Phase Locked Loop (DPLL1) gclk_gen_3_div: 1 @@ -754,9 +754,9 @@ gclk_gen_5_div: 5 gclk_gen_5_div_sel: false gclk_gen_5_oscillator: Digital Phase Locked Loop (DPLL1) - gclk_gen_6_div: 1 + gclk_gen_6_div: 17 gclk_gen_6_div_sel: false - gclk_gen_6_oscillator: External Crystal Oscillator 8-48MHz (XOSC1) + gclk_gen_6_oscillator: Digital Phase Locked Loop (DPLL0) gclk_gen_7_div: 1 gclk_gen_7_div_sel: false gclk_gen_7_oscillator: External Crystal Oscillator 8-48MHz (XOSC1) diff --git a/sysmoOCTSIM/config/hpl_gclk_config.h b/sysmoOCTSIM/config/hpl_gclk_config.h index 81a1f03..158fc93 100644 --- a/sysmoOCTSIM/config/hpl_gclk_config.h +++ b/sysmoOCTSIM/config/hpl_gclk_config.h @@ -226,7 +226,7 @@ // Generic clock generator 2 division <0x-0x> // gclk_gen_2_div #ifndef CONF_GCLK_GEN_2_DIV -#define CONF_GCLK_GEN_2_DIV 30 +#define CONF_GCLK_GEN_2_DIV 200 #endif // // @@ -463,7 +463,7 @@ // Indicates whether generic clock 6 configuration is enabled or not // enable_gclk_gen_6 #ifndef CONF_GCLK_GENERATOR_6_CONFIG -#define CONF_GCLK_GENERATOR_6_CONFIG 0 +#define CONF_GCLK_GENERATOR_6_CONFIG 1 #endif // Generic Clock Generator Control @@ -480,7 +480,7 @@ // This defines the clock source for generic clock generator 6 // gclk_gen_6_oscillator #ifndef CONF_GCLK_GEN_6_SOURCE -#define CONF_GCLK_GEN_6_SOURCE GCLK_GENCTRL_SRC_XOSC1 +#define CONF_GCLK_GEN_6_SOURCE GCLK_GENCTRL_SRC_DPLL0 #endif // Run in Standby @@ -522,7 +522,7 @@ // Indicates whether Generic Clock Generator Enable is enabled or not // gclk_arch_gen_6_enable #ifndef CONF_GCLK_GEN_6_GENEN -#define CONF_GCLK_GEN_6_GENEN 0 +#define CONF_GCLK_GEN_6_GENEN 1 #endif // @@ -530,7 +530,7 @@ // Generic clock generator 6 division <0x-0x> // gclk_gen_6_div #ifndef CONF_GCLK_GEN_6_DIV -#define CONF_GCLK_GEN_6_DIV 1 +#define CONF_GCLK_GEN_6_DIV 17 #endif // // diff --git a/sysmoOCTSIM/config/peripheral_clk_config.h b/sysmoOCTSIM/config/peripheral_clk_config.h index 2ae1f63..f794792 100644 --- a/sysmoOCTSIM/config/peripheral_clk_config.h +++ b/sysmoOCTSIM/config/peripheral_clk_config.h @@ -81,7 +81,7 @@ * \brief SERCOM0's Core Clock frequency */ #ifndef CONF_GCLK_SERCOM0_CORE_FREQUENCY -#define CONF_GCLK_SERCOM0_CORE_FREQUENCY 333 +#define CONF_GCLK_SERCOM0_CORE_FREQUENCY 50 #endif /** @@ -161,7 +161,7 @@ * \brief SERCOM1's Core Clock frequency */ #ifndef CONF_GCLK_SERCOM1_CORE_FREQUENCY -#define CONF_GCLK_SERCOM1_CORE_FREQUENCY 333 +#define CONF_GCLK_SERCOM1_CORE_FREQUENCY 50 #endif /** @@ -241,7 +241,7 @@ * \brief SERCOM2's Core Clock frequency */ #ifndef CONF_GCLK_SERC
Change in osmo-ccid-firmware[master]: switch UART_debug to ASYNC
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/13673 to look at the new patch set (#9). Change subject: switch UART_debug to ASYNC .. switch UART_debug to ASYNC using the synchronous HAL library causes RX overflow after 5 bytes on bulk incoming data (e.g. pasted). this mainly due to printing synchronously the character, but to further prevent congestion we switch to asynchronous (e.g. interrupt driven) communication. The RX part works great now (no overflow), but the TX part is malfunctioning because the HAL Async library does not buffer the data to be transmitted and expects it to be in memory until the transmission is complete (which printf does not do). This change will not be reflected in Atmel START since it does not allow to set the underlying STDIO redirect peripheral to async. Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7 --- M sysmoOCTSIM/command.c M sysmoOCTSIM/driver_init.c M sysmoOCTSIM/driver_init.h M sysmoOCTSIM/hpl/sercom/hpl_sercom.c M sysmoOCTSIM/main.c M sysmoOCTSIM/manual_test.c M sysmoOCTSIM/stdio_start.c 7 files changed, 73 insertions(+), 22 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/73/13673/9 -- To view, visit https://gerrit.osmocom.org/13673 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7 Gerrit-Change-Number: 13673 Gerrit-PatchSet: 9 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Jenkins Builder (102)
Change in osmo-ccid-firmware[master]: UART_debug now uses the async library with tx ring
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/13678 to look at the new patch set (#9). Change subject: UART_debug now uses the async library with tx ring .. UART_debug now uses the async library with tx ring Change-Id: I4cf689a8d3dc292201f1e2ce6c013aa1686ad6bc --- M sysmoOCTSIM/command.c M sysmoOCTSIM/driver_init.c M sysmoOCTSIM/driver_init.h M sysmoOCTSIM/manual_test.c M sysmoOCTSIM/stdio_start.c 5 files changed, 13 insertions(+), 18 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/78/13678/9 -- To view, visit https://gerrit.osmocom.org/13678 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I4cf689a8d3dc292201f1e2ce6c013aa1686ad6bc Gerrit-Change-Number: 13678 Gerrit-PatchSet: 9 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Jenkins Builder (102)
Change in osmo-ccid-firmware[master]: minor: change variable type to remove compiler warning
Kévin Redon has abandoned this change. ( https://gerrit.osmocom.org/13684 ) Change subject: minor: change variable type to remove compiler warning .. Abandoned compiler warning was related to other debug code not present in the commit -- To view, visit https://gerrit.osmocom.org/13684 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: abandon Gerrit-Change-Id: I8f537d6cbec820ad0406ec2ff0c9735759169fc0 Gerrit-Change-Number: 13684 Gerrit-PatchSet: 9 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Jenkins Builder (102) Gerrit-CC: Harald Welte
Change in osmo-ccid-firmware[master]: switch UART_debug to ASYNC
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/13673 to look at the new patch set (#8). Change subject: switch UART_debug to ASYNC .. switch UART_debug to ASYNC using the synchronous HAL library causes RX overflow after 5 bytes on bulk incoming data (e.g. pasted). this mainly due to printing synchronously the character, but to further prevent congestion we switch to asynchronous (e.g. interrupt driven) communication. The RX part works great now (no overflow), but the TX part is malfunctioning because the HAL Async library does not buffer the data to be transmitted and expects it to be in memory until the transmission is complete (which printf does not do). This change will not be reflected in Atmel START since it does not allow to set the underlying STDIO redirect peripheral to async. Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7 --- M sysmoOCTSIM/command.c M sysmoOCTSIM/driver_init.c M sysmoOCTSIM/driver_init.h M sysmoOCTSIM/hpl/sercom/hpl_sercom.c M sysmoOCTSIM/main.c M sysmoOCTSIM/manual_test.c M sysmoOCTSIM/stdio_start.c 7 files changed, 75 insertions(+), 106 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/73/13673/8 -- To view, visit https://gerrit.osmocom.org/13673 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7 Gerrit-Change-Number: 13673 Gerrit-PatchSet: 8 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Jenkins Builder (102)
Change in osmo-ccid-firmware[master]: switch UART_debug to ASYNC
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/13673 to look at the new patch set (#5). Change subject: switch UART_debug to ASYNC .. switch UART_debug to ASYNC using the synchronous HAL library causes RX overflow after 5 bytes on bulk incoming data (e.g. pasted). this mainly due to printing synchronously the character, but to further prevent congestion we switch to asynchronous (e.g. interrupt driven) communication. The RX part works great now (no overflow), but the TX part is malfunctioning because the HAL Async library does not buffer the data to be transmitted and expects it to be in memory until the transmission is complete (which printf does not do). This change will not be reflected in Atmel START since it does not allow to set the underlying STDIO redirect peripheral to async. Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7 --- M sysmoOCTSIM/command.c M sysmoOCTSIM/driver_init.c M sysmoOCTSIM/driver_init.h M sysmoOCTSIM/hpl/sercom/hpl_sercom.c M sysmoOCTSIM/main.c M sysmoOCTSIM/manual_test.c M sysmoOCTSIM/stdio_start.c 7 files changed, 75 insertions(+), 24 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/73/13673/5 -- To view, visit https://gerrit.osmocom.org/13673 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7 Gerrit-Change-Number: 13673 Gerrit-PatchSet: 5 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Jenkins Builder (102)
Change in osmo-ccid-firmware[master]: minor: improve documentation
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/13683 to look at the new patch set (#7). Change subject: minor: improve documentation .. minor: improve documentation Change-Id: I250209d45a57c5ad7d1265a68aa71fc31ec06f69 --- M sysmoOCTSIM/ncn8025.h 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/83/13683/7 -- To view, visit https://gerrit.osmocom.org/13683 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I250209d45a57c5ad7d1265a68aa71fc31ec06f69 Gerrit-Change-Number: 13683 Gerrit-PatchSet: 7 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102)
Change in osmo-ccid-firmware[master]: add sim-atr command
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/13681 to look at the new patch set (#7). Change subject: add sim-atr command .. add sim-atr command the sim-atr command resets the card and read the resulting answer to reset. Change-Id: I30b284cab60a50d4cd3080f46f4d332193bbf1ee --- M sysmoOCTSIM/main.c 1 file changed, 89 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/81/13681/7 -- To view, visit https://gerrit.osmocom.org/13681 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I30b284cab60a50d4cd3080f46f4d332193bbf1ee Gerrit-Change-Number: 13681 Gerrit-PatchSet: 7 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102)
Change in osmo-ccid-firmware[master]: remove SWO pin initialisation
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/13674 to look at the new patch set (#5). Change subject: remove SWO pin initialisation .. remove SWO pin initialisation using the SWO signal on TX has the advantage of being able to have printf debug while still using SERCOM7 in ISO7816 mode for the SIM card, but it has two drawbacks: - SWO outputs data only if a debug session is ongoing (e.g. a SWD debugger is connected). this saves output processing when no SWD is connected, but it is not possible to force output without having an SWD debugger connect (confirmed by Microchip help), which is not convenient for simple UART debugging. - no input is possible (SWO can only output). Thus instead we will still use SERCOM7 for UART debug, allowing commands to be input. SERCOM7 should only be used for UART debug when no card in present in SIM7. This check in not yet implemented. Change-Id: I199d6e356129526e65d5d1075a264eb35904d099 --- M sysmoOCTSIM/driver_init.c 1 file changed, 0 insertions(+), 47 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/74/13674/5 -- To view, visit https://gerrit.osmocom.org/13674 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I199d6e356129526e65d5d1075a264eb35904d099 Gerrit-Change-Number: 13674 Gerrit-PatchSet: 5 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Jenkins Builder (102) Gerrit-CC: Harald Welte
Change in osmo-ccid-firmware[master]: add sim-atr command
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/13681 to look at the new patch set (#2). Change subject: add sim-atr command .. add sim-atr command the sim-atr command resets the card and read the resulting answer to reset. Change-Id: I30b284cab60a50d4cd3080f46f4d332193bbf1ee --- M sysmoOCTSIM/main.c 1 file changed, 89 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/81/13681/2 -- To view, visit https://gerrit.osmocom.org/13681 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I30b284cab60a50d4cd3080f46f4d332193bbf1ee Gerrit-Change-Number: 13681 Gerrit-PatchSet: 2 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Jenkins Builder (102)
Change in osmo-ccid-firmware[master]: update ASFv4 library to 1.0.1465
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13688 Change subject: update ASFv4 library to 1.0.1465 .. update ASFv4 library to 1.0.1465 Change-Id: I828e87c7ededbb50a999d672cf0b738eef9a093a --- M sysmoOCTSIM/atmel_start_config.atstart M sysmoOCTSIM/hpl/dmac/hpl_dmac.c 2 files changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/88/13688/1 diff --git a/sysmoOCTSIM/atmel_start_config.atstart b/sysmoOCTSIM/atmel_start_config.atstart index f40c43a..4fda2f8 100644 --- a/sysmoOCTSIM/atmel_start_config.atstart +++ b/sysmoOCTSIM/atmel_start_config.atstart @@ -4,7 +4,7 @@ api: '1.0' backend: 1.5.122 commit: 820baecf7dd115d94b0d42ee3b0b9d6ba2da7113 - content: 1.0.1405 + content: 1.0.1465 content_pack_name: acme-packs-all format: '2' frontend: 1.5.1826 diff --git a/sysmoOCTSIM/hpl/dmac/hpl_dmac.c b/sysmoOCTSIM/hpl/dmac/hpl_dmac.c index 27021dd..b08448b 100644 --- a/sysmoOCTSIM/hpl/dmac/hpl_dmac.c +++ b/sysmoOCTSIM/hpl/dmac/hpl_dmac.c @@ -108,6 +108,7 @@ hri_dmac_write_CHPRILVL_reg(DMAC, i, _cfgs[i].prilvl); hri_dmac_write_CHEVCTRL_reg(DMAC, i, _cfgs[i].evctrl); hri_dmacdescriptor_write_BTCTRL_reg(&_descriptor_section[i], _cfgs[i].btctrl); + hri_dmacdescriptor_write_DESCADDR_reg(&_descriptor_section[i], 0x0); } for (i = 0; i < 5; i++) { -- To view, visit https://gerrit.osmocom.org/13688 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I828e87c7ededbb50a999d672cf0b738eef9a093a Gerrit-Change-Number: 13688 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-ccid-firmware[master]: minor: update atmel start project configuration
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13686 Change subject: minor: update atmel start project configuration .. minor: update atmel start project configuration Change-Id: I8e719f1687befb9a3657a2e582165dec3cd00094 --- M sysmoOCTSIM/atmel_start_config.atstart 1 file changed, 13 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/86/13686/1 diff --git a/sysmoOCTSIM/atmel_start_config.atstart b/sysmoOCTSIM/atmel_start_config.atstart index 51ec4f4..f40c43a 100644 --- a/sysmoOCTSIM/atmel_start_config.atstart +++ b/sysmoOCTSIM/atmel_start_config.atstart @@ -664,7 +664,7 @@ enable_gclk_gen_11: true enable_gclk_gen_2: true enable_gclk_gen_3: true - enable_gclk_gen_4: false + enable_gclk_gen_4: true enable_gclk_gen_5: true enable_gclk_gen_6: false enable_gclk_gen_7: false @@ -700,7 +700,7 @@ gclk_arch_gen_3_oe: false gclk_arch_gen_3_oov: false gclk_arch_gen_3_runstdby: false - gclk_arch_gen_4_enable: false + gclk_arch_gen_4_enable: true gclk_arch_gen_4_idc: false gclk_arch_gen_4_oe: false gclk_arch_gen_4_oov: false @@ -742,7 +742,7 @@ gclk_gen_1_div: 1 gclk_gen_1_div_sel: false gclk_gen_1_oscillator: Digital Frequency Locked Loop (DFLL48M) - gclk_gen_2_div: 1 + gclk_gen_2_div: 30 gclk_gen_2_div_sel: false gclk_gen_2_oscillator: Digital Phase Locked Loop (DPLL1) gclk_gen_3_div: 1 @@ -750,7 +750,7 @@ gclk_gen_3_oscillator: 32kHz External Crystal Oscillator (XOSC32K) gclk_gen_4_div: 1 gclk_gen_4_div_sel: false - gclk_gen_4_oscillator: External Crystal Oscillator 8-48MHz (XOSC1) + gclk_gen_4_oscillator: Digital Phase Locked Loop (DPLL1) gclk_gen_5_div: 5 gclk_gen_5_div_sel: false gclk_gen_5_oscillator: Digital Phase Locked Loop (DPLL1) @@ -976,7 +976,7 @@ usart_arch_ibon: false usart_arch_runstdby: false usart_arch_sfde: false - usart_baud_rate: 9600 + usart_baud_rate: 6720 usart_character_size: 8 bits usart_dsnack: The successive receive NACK is disable. usart_gtime: 2-bit times @@ -1023,7 +1023,7 @@ usart_arch_ibon: false usart_arch_runstdby: false usart_arch_sfde: false - usart_baud_rate: 9600 + usart_baud_rate: 6720 usart_character_size: 8 bits usart_dsnack: The successive receive NACK is disable. usart_gtime: 2-bit times @@ -1070,7 +1070,7 @@ usart_arch_ibon: false usart_arch_runstdby: false usart_arch_sfde: false - usart_baud_rate: 9600 + usart_baud_rate: 6720 usart_character_size: 8 bits usart_dsnack: The successive receive NACK is disable. usart_gtime: 2-bit times @@ -1117,7 +1117,7 @@ usart_arch_ibon: false usart_arch_runstdby: false usart_arch_sfde: false - usart_baud_rate: 9600 + usart_baud_rate: 6720 usart_character_size: 8 bits usart_dsnack: The successive receive NACK is disable. usart_gtime: 2-bit times @@ -1164,7 +1164,7 @@ usart_arch_ibon: false usart_arch_runstdby: false usart_arch_sfde: false - usart_baud_rate: 9600 + usart_baud_rate: 6720 usart_character_size: 8 bits usart_dsnack: The successive receive NACK is disable. usart_gtime: 2-bit times @@ -1211,7 +1211,7 @@ usart_arch_ibon: false usart_arch_runstdby: false usart_arch_sfde: false - usart_baud_rate: 9600 + usart_baud_rate: 6720 usart_character_size: 8 bits usart_dsnack: The successive receive NACK is disable. usart_gtime: 2-bit times @@ -1258,7 +1258,7 @@ usart_arch_ibon: false usart_arch_runstdby: false usart_arch_sfde: false - usart_baud_rate: 9600 + usart_baud_rate: 6720 usart_character_size: 8 bits usart_dsnack: The successive receive NACK is disable. usart_gtime: 2-bit times @@ -1330,7 +1330,7 @@ domain_group: nodes: - name: Core - input: Generic clock generator 2 + input: Generic clock generator 4 external: false external_frequency: 0 - name: Slow @@ -1338,7 +1338,7 @@ external: false external_frequency: 0 configuration: - core_gclk_selection: Generic clock generator 2 + core_gclk_selection: Generic clock generator 4 slow_gclk_selection: Generic clock generator 3 USB_DEVICE_INSTANCE: user_label: USB_DEVICE_INSTANCE -- To view, visit https://gerrit.osmocom.org/13686 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id
Change in osmo-ccid-firmware[master]: update CMSIS to 5.1.2
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13687 Change subject: update CMSIS to 5.1.2 .. update CMSIS to 5.1.2 this changes comes from Atmel START Change-Id: Ib9b00107836c1604c7169d69ba607fead8c55355 --- M sysmoOCTSIM/AtmelStart.gpdsc R sysmoOCTSIM/CMSIS/Core/Include/cmsis_armcc.h R sysmoOCTSIM/CMSIS/Core/Include/cmsis_armclang.h A sysmoOCTSIM/CMSIS/Core/Include/cmsis_compiler.h R sysmoOCTSIM/CMSIS/Core/Include/cmsis_gcc.h A sysmoOCTSIM/CMSIS/Core/Include/cmsis_iccarm.h A sysmoOCTSIM/CMSIS/Core/Include/cmsis_version.h R sysmoOCTSIM/CMSIS/Core/Include/core_armv8mbl.h R sysmoOCTSIM/CMSIS/Core/Include/core_armv8mml.h R sysmoOCTSIM/CMSIS/Core/Include/core_cm0.h R sysmoOCTSIM/CMSIS/Core/Include/core_cm0plus.h C sysmoOCTSIM/CMSIS/Core/Include/core_cm1.h R sysmoOCTSIM/CMSIS/Core/Include/core_cm23.h R sysmoOCTSIM/CMSIS/Core/Include/core_cm3.h R sysmoOCTSIM/CMSIS/Core/Include/core_cm33.h R sysmoOCTSIM/CMSIS/Core/Include/core_cm4.h R sysmoOCTSIM/CMSIS/Core/Include/core_cm7.h R sysmoOCTSIM/CMSIS/Core/Include/core_sc000.h R sysmoOCTSIM/CMSIS/Core/Include/core_sc300.h A sysmoOCTSIM/CMSIS/Core/Include/mpu_armv7.h A sysmoOCTSIM/CMSIS/Core/Include/mpu_armv8.h R sysmoOCTSIM/CMSIS/Core/Include/tz_context.h M sysmoOCTSIM/CMSIS/Documentation/Core/html/index.html D sysmoOCTSIM/CMSIS/Include/arm_common_tables.h D sysmoOCTSIM/CMSIS/Include/arm_const_structs.h D sysmoOCTSIM/CMSIS/Include/arm_math.h D sysmoOCTSIM/CMSIS/Include/cmsis_compiler.h M sysmoOCTSIM/gcc/Makefile 28 files changed, 29,295 insertions(+), 33,968 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/87/13687/1 -- To view, visit https://gerrit.osmocom.org/13687 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Ib9b00107836c1604c7169d69ba607fead8c55355 Gerrit-Change-Number: 13687 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-ccid-firmware[master]: minor: fix typo
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13682 Change subject: minor: fix typo .. minor: fix typo Change-Id: I57c743250af19713e7438606bc1c737cfe0c383c --- M sysmoOCTSIM/hal/include/hal_usart_async.h 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/82/13682/1 diff --git a/sysmoOCTSIM/hal/include/hal_usart_async.h b/sysmoOCTSIM/hal/include/hal_usart_async.h index 3a6de39..c883823 100644 --- a/sysmoOCTSIM/hal/include/hal_usart_async.h +++ b/sysmoOCTSIM/hal/include/hal_usart_async.h @@ -82,7 +82,7 @@ uint32_t flags; /** Number of characters transmitted */ uint16_t txcnt; - /** Number of characters receviced */ + /** Number of characters received */ uint16_t rxcnt; }; -- To view, visit https://gerrit.osmocom.org/13682 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I57c743250af19713e7438606bc1c737cfe0c383c Gerrit-Change-Number: 13682 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-ccid-firmware[master]: add ASFv4 M2M middleware
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13675 Change subject: add ASFv4 M2M middleware .. add ASFv4 M2M middleware Change-Id: Ib07755b2c5974af70817f5460fb0f358c631452a --- M sysmoOCTSIM/AtmelStart.gpdsc M sysmoOCTSIM/atmel_start.c M sysmoOCTSIM/atmel_start.h M sysmoOCTSIM/atmel_start_config.atstart M sysmoOCTSIM/config/hpl_dmac_config.h A sysmoOCTSIM/dma_m2m/dma_memory.c A sysmoOCTSIM/dma_m2m/dma_memory.h A sysmoOCTSIM/dma_m2m/dma_memory_config.h A sysmoOCTSIM/documentation/dma_m2m.rst M sysmoOCTSIM/gcc/Makefile 10 files changed, 359 insertions(+), 19 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/75/13675/1 diff --git a/sysmoOCTSIM/AtmelStart.gpdsc b/sysmoOCTSIM/AtmelStart.gpdsc index 5d35944..05dcb15 100644 --- a/sysmoOCTSIM/AtmelStart.gpdsc +++ b/sysmoOCTSIM/AtmelStart.gpdsc @@ -164,6 +164,9 @@ + + + @@ -210,6 +213,8 @@ + + @@ -225,6 +230,7 @@ + @@ -251,6 +257,8 @@ + + diff --git a/sysmoOCTSIM/atmel_start.c b/sysmoOCTSIM/atmel_start.c index fc6016a..fd566dd 100644 --- a/sysmoOCTSIM/atmel_start.c +++ b/sysmoOCTSIM/atmel_start.c @@ -1,5 +1,11 @@ #include +/** Memory to memory DMA callback */ +static void M2M_DMA_complete_cb(void) +{ + dma_m2m_complete_flag = true; +} + /** * Initializes MCU, drivers and middleware in the project **/ @@ -7,5 +13,7 @@ { system_init(); usb_init(); + dma_memory_init(); + dma_memory_register_callback(DMA_MEMORY_COMPLETE_CB, M2M_DMA_complete_cb); stdio_redirect_init(); } diff --git a/sysmoOCTSIM/atmel_start.h b/sysmoOCTSIM/atmel_start.h index 92afa47..4892cbd 100644 --- a/sysmoOCTSIM/atmel_start.h +++ b/sysmoOCTSIM/atmel_start.h @@ -5,10 +5,15 @@ extern "C" { #endif +#include + #include "driver_init.h" #include "usb_start.h" #include "stdio_start.h" +/** flag set when the memory to memory DMA is complete */ +volatile bool dma_m2m_complete_flag; + /** * Initializes MCU, drivers and middleware in the project **/ diff --git a/sysmoOCTSIM/atmel_start_config.atstart b/sysmoOCTSIM/atmel_start_config.atstart index 290fa89..51ec4f4 100644 --- a/sysmoOCTSIM/atmel_start_config.atstart +++ b/sysmoOCTSIM/atmel_start_config.atstart @@ -82,6 +82,15 @@ dependencies: USB Device Stack Core Instance: USB_DEVICE_STACK_CORE_INSTANCE USB Class CDC: USB_CLASS_CDC + M2M_DMA_0: +user_label: M2M_DMA_0 +configuration: + conf_channel: 0 +definition: Atmel:MEMORY_DMA:0.0.1::M2M_DMA +functionality: M2M_DMA +api: DMA:M2M:Core +dependencies: + DMAC: DMAC STDIO_REDIRECT_0: user_label: STDIO_REDIRECT_0 configuration: {} @@ -209,7 +218,7 @@ the transaction dmac_blockact_9: Channel will be disabled if it is the last block transfer in the transaction - dmac_channel_0_settings: false + dmac_channel_0_settings: true dmac_channel_10_settings: false dmac_channel_11_settings: false dmac_channel_12_settings: false @@ -242,7 +251,7 @@ dmac_channel_8_settings: false dmac_channel_9_settings: false dmac_dbgrun: false - dmac_dstinc_0: false + dmac_dstinc_0: true dmac_dstinc_1: false dmac_dstinc_10: false dmac_dstinc_11: false @@ -274,7 +283,7 @@ dmac_dstinc_7: false dmac_dstinc_8: false dmac_dstinc_9: false - dmac_enable: false + dmac_enable: true dmac_evact_0: No action dmac_evact_1: No action dmac_evact_10: No action @@ -479,7 +488,7 @@ dmac_runstdby_7: false dmac_runstdby_8: false dmac_runstdby_9: false - dmac_srcinc_0: false + dmac_srcinc_0: true dmac_srcinc_1: false dmac_srcinc_10: false dmac_srcinc_11: false diff --git a/sysmoOCTSIM/config/hpl_dmac_config.h b/sysmoOCTSIM/config/hpl_dmac_config.h index 90499fc..c736778 100644 --- a/sysmoOCTSIM/config/hpl_dmac_config.h +++ b/sysmoOCTSIM/config/hpl_dmac_config.h @@ -8,7 +8,7 @@ // Indicates whether dmac is enabled or not // dmac_enable #ifndef CONF_DMAC_ENABLE -#define CONF_DMAC_ENABLE 0 +#define CONF_DMAC_ENABLE 1 #endif // Priority Level 0 @@ -105,7 +105,7 @@ // Channel 0 settings // dmac_channel_0_settings #ifndef CONF_DMAC_CHANNEL_0_SETTINGS -#define CONF_DMAC_CHANNEL_0_SETTINGS 0 +#define CONF_DMAC_CHANNEL_0_SETTINGS 1 #endif // Channel Run in Standby @@ -284,14 +284,14 @@ // Indicates whether the source address incrementation is enabled or not // dmac_srcinc_0 #ifndef CONF_DMAC_SRCINC_0 -#define CONF_DMAC_
Change in osmo-ccid-firmware[master]: minor: improve documentation
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13683 Change subject: minor: improve documentation .. minor: improve documentation Change-Id: I250209d45a57c5ad7d1265a68aa71fc31ec06f69 --- M sysmoOCTSIM/ncn8025.h 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/83/13683/1 diff --git a/sysmoOCTSIM/ncn8025.h b/sysmoOCTSIM/ncn8025.h index 89b7f86..48d2a58 100644 --- a/sysmoOCTSIM/ncn8025.h +++ b/sysmoOCTSIM/ncn8025.h @@ -15,8 +15,8 @@ }; struct ncn8025_settings { - bool rstin; /* high: active */ - bool cmdvcc;/* high: active */ + bool rstin; /* Reset signal (true: de-asserted high) */ + bool cmdvcc;/* Command VCC pin. Activation sequence Enable (true: active low) */ bool simpres; /* high: active */ bool led; /* high: active */ bool interrupt; /* high: active */ -- To view, visit https://gerrit.osmocom.org/13683 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I250209d45a57c5ad7d1265a68aa71fc31ec06f69 Gerrit-Change-Number: 13683 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-ccid-firmware[master]: remove SWO pin initialisation
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13674 Change subject: remove SWO pin initialisation .. remove SWO pin initialisation Change-Id: I199d6e356129526e65d5d1075a264eb35904d099 --- M sysmoOCTSIM/driver_init.c 1 file changed, 0 insertions(+), 47 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/74/13674/1 diff --git a/sysmoOCTSIM/driver_init.c b/sysmoOCTSIM/driver_init.c index 0d5bb53..8a50925 100644 --- a/sysmoOCTSIM/driver_init.c +++ b/sysmoOCTSIM/driver_init.c @@ -723,53 +723,6 @@ gpio_set_pin_function(SDA1, GPIO_PIN_FUNCTION_OFF); - // GPIO on PB30 - - gpio_set_pin_direction(UART_TX, - // Pin direction - // pad_direction - // Off - // In - // Out - GPIO_DIRECTION_OUT); - - gpio_set_pin_level(UART_TX, - // Initial level - // pad_initial_level - // Low - // High - false); - - gpio_set_pin_pull_mode(UART_TX, - // Pull configuration - // pad_pull_config - // Off - // Pull-up - // Pull-down - GPIO_PULL_OFF); - - gpio_set_pin_function(UART_TX, - // Pin function - // pad_function - // Auto : use driver pinmux if signal is imported by driver, else turn off function - // Auto - // Off - // A - // B - // C - // D - // E - // F - // G - // H - // I - // J - // K - // L - // M - // N - GPIO_PIN_FUNCTION_H); - // GPIO on PC00 // Set pin direction to input -- To view, visit https://gerrit.osmocom.org/13674 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I199d6e356129526e65d5d1075a264eb35904d099 Gerrit-Change-Number: 13674 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-ccid-firmware[master]: minor: remove unnecessary hellow world command
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13685 Change subject: minor: remove unnecessary hellow world command .. minor: remove unnecessary hellow world command Change-Id: I414b2ddd0bacff692316fe212b9d3b506100a7ba --- M sysmoOCTSIM/main.c 1 file changed, 0 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/85/13685/1 diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c index 788343e..8d51161 100644 --- a/sysmoOCTSIM/main.c +++ b/sysmoOCTSIM/main.c @@ -68,12 +68,6 @@ } } -DEFUN(hello_fn, cmd_hello, - "hello", "Hello World example command") -{ - printf("Hello World!\r\n"); -} - static int validate_slotnr(int argc, char **argv, int idx) { int slotnr; @@ -308,7 +302,6 @@ board_init(); command_init("sysmoOCTSIM> "); - command_register(_hello); command_register(_sim_status); command_register(_sim_power); command_register(_sim_reset); -- To view, visit https://gerrit.osmocom.org/13685 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I414b2ddd0bacff692316fe212b9d3b506100a7ba Gerrit-Change-Number: 13685 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-ccid-firmware[master]: change SERCOM clock to 3.3 MHz
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13680 Change subject: change SERCOM clock to 3.3 MHz .. change SERCOM clock to 3.3 MHz we use the SERCOM peripheral for USART (in 7816 mode SIM card communication) in synchronous mode (TX and RX clock are the same). in this mode only the 8 least significant bits of the BAUD register are used (see TRM 33.6.2.3 Clock Generation – Baud-Rate Generator). When the SERCOM is clocked at 100 MHz the minimum resulting baud rate would be 100E6 / (2 * 255 + 1) = 195694 bps. clocking SERCOM at 3.33 MHz also to have a baud rate of 6720 bps (~ 3.33E6 / (2 * 247 + 1)), used after reset to read the ATR. Change-Id: Id60322e092a6652a89821fc737d5336d79a1420c --- M sysmoOCTSIM/config/hpl_gclk_config.h M sysmoOCTSIM/config/peripheral_clk_config.h 2 files changed, 12 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/80/13680/1 diff --git a/sysmoOCTSIM/config/hpl_gclk_config.h b/sysmoOCTSIM/config/hpl_gclk_config.h index 6b7586c..71c26e1 100644 --- a/sysmoOCTSIM/config/hpl_gclk_config.h +++ b/sysmoOCTSIM/config/hpl_gclk_config.h @@ -226,7 +226,7 @@ // Generic clock generator 2 division <0x-0x> // gclk_gen_2_div #ifndef CONF_GCLK_GEN_2_DIV -#define CONF_GCLK_GEN_2_DIV 1 +#define CONF_GCLK_GEN_2_DIV 30 #endif // // @@ -311,7 +311,7 @@ // Indicates whether generic clock 4 configuration is enabled or not // enable_gclk_gen_4 #ifndef CONF_GCLK_GENERATOR_4_CONFIG -#define CONF_GCLK_GENERATOR_4_CONFIG 0 +#define CONF_GCLK_GENERATOR_4_CONFIG 1 #endif // Generic Clock Generator Control @@ -328,7 +328,7 @@ // This defines the clock source for generic clock generator 4 // gclk_gen_4_oscillator #ifndef CONF_GCLK_GEN_4_SOURCE -#define CONF_GCLK_GEN_4_SOURCE GCLK_GENCTRL_SRC_XOSC1 +#define CONF_GCLK_GEN_4_SOURCE GCLK_GENCTRL_SRC_DPLL1 #endif // Run in Standby @@ -370,7 +370,7 @@ // Indicates whether Generic Clock Generator Enable is enabled or not // gclk_arch_gen_4_enable #ifndef CONF_GCLK_GEN_4_GENEN -#define CONF_GCLK_GEN_4_GENEN 0 +#define CONF_GCLK_GEN_4_GENEN 1 #endif // diff --git a/sysmoOCTSIM/config/peripheral_clk_config.h b/sysmoOCTSIM/config/peripheral_clk_config.h index 91c5c86..4bff6ff 100644 --- a/sysmoOCTSIM/config/peripheral_clk_config.h +++ b/sysmoOCTSIM/config/peripheral_clk_config.h @@ -81,7 +81,7 @@ * \brief SERCOM0's Core Clock frequency */ #ifndef CONF_GCLK_SERCOM0_CORE_FREQUENCY -#define CONF_GCLK_SERCOM0_CORE_FREQUENCY 1 +#define CONF_GCLK_SERCOM0_CORE_FREQUENCY 333 #endif /** @@ -161,7 +161,7 @@ * \brief SERCOM1's Core Clock frequency */ #ifndef CONF_GCLK_SERCOM1_CORE_FREQUENCY -#define CONF_GCLK_SERCOM1_CORE_FREQUENCY 1 +#define CONF_GCLK_SERCOM1_CORE_FREQUENCY 333 #endif /** @@ -241,7 +241,7 @@ * \brief SERCOM2's Core Clock frequency */ #ifndef CONF_GCLK_SERCOM2_CORE_FREQUENCY -#define CONF_GCLK_SERCOM2_CORE_FREQUENCY 1 +#define CONF_GCLK_SERCOM2_CORE_FREQUENCY 333 #endif /** @@ -321,7 +321,7 @@ * \brief SERCOM3's Core Clock frequency */ #ifndef CONF_GCLK_SERCOM3_CORE_FREQUENCY -#define CONF_GCLK_SERCOM3_CORE_FREQUENCY 1 +#define CONF_GCLK_SERCOM3_CORE_FREQUENCY 333 #endif /** @@ -401,7 +401,7 @@ * \brief SERCOM4's Core Clock frequency */ #ifndef CONF_GCLK_SERCOM4_CORE_FREQUENCY -#define CONF_GCLK_SERCOM4_CORE_FREQUENCY 1 +#define CONF_GCLK_SERCOM4_CORE_FREQUENCY 333 #endif /** @@ -481,7 +481,7 @@ * \brief SERCOM5's Core Clock frequency */ #ifndef CONF_GCLK_SERCOM5_CORE_FREQUENCY -#define CONF_GCLK_SERCOM5_CORE_FREQUENCY 1 +#define CONF_GCLK_SERCOM5_CORE_FREQUENCY 333 #endif /** @@ -561,7 +561,7 @@ * \brief SERCOM6's Core Clock frequency */ #ifndef CONF_GCLK_SERCOM6_CORE_FREQUENCY -#define CONF_GCLK_SERCOM6_CORE_FREQUENCY 1 +#define CONF_GCLK_SERCOM6_CORE_FREQUENCY 333 #endif /** @@ -601,7 +601,7 @@ // Select the clock source for CORE. #ifndef CONF_GCLK_SERCOM7_CORE_SRC -#define CONF_GCLK_SERCOM7_CORE_SRC GCLK_PCHCTRL_GEN_GCLK2_Val +#define CONF_GCLK_SERCOM7_CORE_SRC GCLK_PCHCTRL_GEN_GCLK4_Val #endif // Slow Clock Source -- To view, visit https://gerrit.osmocom.org/13680 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Id60322e092a6652a89821fc737d5336d79a1420c Gerrit-Change-Number: 13680 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-ccid-firmware[master]: minor: change variable type to remove compiler warning
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13684 Change subject: minor: change variable type to remove compiler warning .. minor: change variable type to remove compiler warning Change-Id: I8f537d6cbec820ad0406ec2ff0c9735759169fc0 --- M sysmoOCTSIM/command.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/84/13684/1 diff --git a/sysmoOCTSIM/command.c b/sysmoOCTSIM/command.c index 327a1a0..8fbaec4 100644 --- a/sysmoOCTSIM/command.c +++ b/sysmoOCTSIM/command.c @@ -78,7 +78,7 @@ /* yield CPU after maximum of 10 received characters */ while (usart_async_rings_is_rx_not_empty(_debug) && (i < 10)) { gpio_toggle_pin_level(USER_LED); // toggle LED to show we received something - int c = getchar(); + char c = getchar(); if (c < 0) return; putchar(c); -- To view, visit https://gerrit.osmocom.org/13684 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I8f537d6cbec820ad0406ec2ff0c9735759169fc0 Gerrit-Change-Number: 13684 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-ccid-firmware[master]: UART_debug now uses the async library with tx ring
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13678 Change subject: UART_debug now uses the async library with tx ring .. UART_debug now uses the async library with tx ring Change-Id: I4cf689a8d3dc292201f1e2ce6c013aa1686ad6bc --- M sysmoOCTSIM/command.c M sysmoOCTSIM/driver_init.c M sysmoOCTSIM/driver_init.h M sysmoOCTSIM/stdio_start.c 4 files changed, 12 insertions(+), 17 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/78/13678/1 diff --git a/sysmoOCTSIM/command.c b/sysmoOCTSIM/command.c index 7ac5662..327a1a0 100644 --- a/sysmoOCTSIM/command.c +++ b/sysmoOCTSIM/command.c @@ -76,7 +76,7 @@ unsigned int i = 0; /* yield CPU after maximum of 10 received characters */ - while (usart_async_is_rx_not_empty(_debug) && (i < 10)) { + while (usart_async_rings_is_rx_not_empty(_debug) && (i < 10)) { gpio_toggle_pin_level(USER_LED); // toggle LED to show we received something int c = getchar(); if (c < 0) diff --git a/sysmoOCTSIM/driver_init.c b/sysmoOCTSIM/driver_init.c index 8a50925..0b6b190 100644 --- a/sysmoOCTSIM/driver_init.c +++ b/sysmoOCTSIM/driver_init.c @@ -33,7 +33,7 @@ #define SIM6_BUFFER_SIZE 16 /*! The buffer size for USART */ -#define UART_DEBUG_BUFFER_SIZE 32 +#define UART_DEBUG_BUFFER_SIZE 256 struct usart_async_descriptor SIM0; struct usart_async_descriptor SIM1; @@ -51,9 +51,10 @@ static uint8_t SIM5_buffer[SIM5_BUFFER_SIZE]; static uint8_t SIM6_buffer[SIM6_BUFFER_SIZE]; -struct usart_async_descriptor UART_debug; +struct usart_async_rings_descriptor UART_debug; -static uint8_t UART_DEBUG_buffer[UART_DEBUG_BUFFER_SIZE]; +static uint8_t UART_DEBUG_buffer_rx[UART_DEBUG_BUFFER_SIZE]; +static uint8_t UART_DEBUG_buffer_tx[UART_DEBUG_BUFFER_SIZE]; /** * \brief USART Clock initialization function @@ -349,7 +350,7 @@ void UART_debug_init(void) { UART_debug_CLOCK_init(); - usart_async_init(_debug, SERCOM7, UART_DEBUG_buffer, UART_DEBUG_BUFFER_SIZE, (void *)NULL); + usart_async_rings_init(_debug, SERCOM7, UART_DEBUG_buffer_rx, UART_DEBUG_BUFFER_SIZE, UART_DEBUG_buffer_tx, UART_DEBUG_BUFFER_SIZE, (void *)NULL); UART_debug_PORT_init(); } diff --git a/sysmoOCTSIM/driver_init.h b/sysmoOCTSIM/driver_init.h index 9d009b9..6c4f3a1 100644 --- a/sysmoOCTSIM/driver_init.h +++ b/sysmoOCTSIM/driver_init.h @@ -21,15 +21,9 @@ #include #include -#include -#include -#include -#include -#include -#include -#include - #include +#include +#include #include "hal_usb_device.h" @@ -40,7 +34,7 @@ extern struct usart_async_descriptor SIM4; extern struct usart_async_descriptor SIM5; extern struct usart_async_descriptor SIM6; -extern struct usart_async_descriptor UART_debug; +extern struct usart_async_rings_descriptor UART_debug; void SIM0_PORT_init(void); void SIM0_CLOCK_init(void); diff --git a/sysmoOCTSIM/stdio_start.c b/sysmoOCTSIM/stdio_start.c index e2fb0c2..8a15c88 100644 --- a/sysmoOCTSIM/stdio_start.c +++ b/sysmoOCTSIM/stdio_start.c @@ -9,13 +9,13 @@ #include "atmel_start.h" #include "stdio_start.h" -static void UART_debug_rx_cb(const struct usart_async_descriptor *const io_descr) +static void UART_debug_rx_cb(const struct usart_async_rings_descriptor *const io_descr) { } void stdio_redirect_init(void) { - usart_async_register_callback(_debug, USART_ASYNC_RXC_CB, UART_debug_rx_cb); // if no callback function is registered receive won't work, even if the callback does nothing - usart_async_enable(_debug); + usart_async_rings_register_callback(_debug, USART_ASYNC_RXC_CB, UART_debug_rx_cb); // if no callback function is registered receive won't work, even if the callback does nothing + usart_async_rings_enable(_debug); stdio_io_init(_debug.io); } -- To view, visit https://gerrit.osmocom.org/13678 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I4cf689a8d3dc292201f1e2ce6c013aa1686ad6bc Gerrit-Change-Number: 13678 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-ccid-firmware[master]: add async library with ring on TX
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13677 Change subject: add async library with ring on TX .. add async library with ring on TX the standard async library expected the caller to wait until the transmission was complete (by counting using the transmit callback or checking using usart_async_get_status) before freeing/reusing the memory holding the data to be transmitted. this is not practical when using stdio on top of the peripheral since printf returns directly and reuses the memory. the new USART async library has a ring buffer for the data to be transmitted (similar to the data being received). WARNING: the ring buffer library overwrites old data when the buffer size is exceeded. We do not prevent this since don't want to block. To prevent this behaviour, provide a large enough buffer of check the buffer status yourself using usart_async_get_status. Change-Id: Iafd5295b90ef9f428f640314c24f6c31ee82c9d6 --- M sysmoOCTSIM/gcc/Makefile A sysmoOCTSIM/hal/include/hal_usart_async_rings.h A sysmoOCTSIM/hal/src/hal_usart_async_rings.c 3 files changed, 767 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/77/13677/1 diff --git a/sysmoOCTSIM/gcc/Makefile b/sysmoOCTSIM/gcc/Makefile index bd4bdb0..046970f 100644 --- a/sysmoOCTSIM/gcc/Makefile +++ b/sysmoOCTSIM/gcc/Makefile @@ -84,6 +84,7 @@ hpl/osc32kctrl/hpl_osc32kctrl.o \ driver_init.o \ hal/src/hal_usart_async.o \ +hal/src/hal_usart_async_rings.o \ hpl/sercom/hpl_sercom.o \ hal/utils/src/utils_ringbuffer.o \ main.o \ @@ -131,6 +132,7 @@ "hpl/osc32kctrl/hpl_osc32kctrl.o" \ "driver_init.o" \ "hal/src/hal_usart_async.o" \ +"hal/src/hal_usart_async_rings.o" \ "hpl/sercom/hpl_sercom.o" \ "hal/utils/src/utils_ringbuffer.o" \ "main.o" \ @@ -177,6 +179,7 @@ "driver_init.d" \ "stdio_redirect/gcc/read.d" \ "hal/src/hal_usart_async.d" \ +"hal/src/hal_usart_async_rings.d" \ "hpl/osc32kctrl/hpl_osc32kctrl.d" \ "i2c_bitbang.d" \ "octsim_i2c.d" \ diff --git a/sysmoOCTSIM/hal/include/hal_usart_async_rings.h b/sysmoOCTSIM/hal/include/hal_usart_async_rings.h new file mode 100644 index 000..c66e21c --- /dev/null +++ b/sysmoOCTSIM/hal/include/hal_usart_async_rings.h @@ -0,0 +1,341 @@ +/** + * \file + * + * \brief USART related functionality declaration. + * + * Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries. + * Copyright (C) 2019 sysmocom -s.f.m.c. GmbH, Author: Kevin Redon + * + * \asf_license_start + * + * \page License + * + * Subject to your compliance with these terms, you may use Microchip + * software and any derivatives exclusively with Microchip products. + * It is your responsibility to comply with third party license terms applicable + * to your use of third party software (including open source software) that + * may accompany Microchip software. + * + * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, + * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, + * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, + * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE + * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL + * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE + * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE + * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT + * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY + * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, + * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. + * + * \asf_license_stop + * + */ + +#ifndef _HAL_USART_ASYNC_RINGS_H_INCLUDED +#define _HAL_USART_ASYNC_RINGS_H_INCLUDED + +#include "hal_io.h" +#include +#include + +/** + * \addtogroup doc_driver_hal_usart_async + * + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief USART descriptor + * + * The USART descriptor forward declaration. + */ +struct usart_async_rings_descriptor; + +/** + * \brief USART callback type + */ +typedef void (*usart_rings_cb_t)(const struct usart_async_rings_descriptor *const descr); + +/** + * \brief USART callback types + */ +enum usart_async_rings_callback_type { USART_ASYNC_RINGS_RXC_CB, USART_ASYNC_RINGS_TXC_CB, USART_ASYNC_RINGS_ERROR_CB }; + +/** + * \brief USART callbacks + */ +struct usart_async_rings_callbacks { + usart_rings_cb_t tx_done; + usart_rings_cb_t rx_done; + usart_rings_cb_t error; +}; + +/** \brief USART status + * Status descriptor holds the current status of transfer. + */ +struct usart_async_rings_status { + /** Status flags */ + uint32_t flags; + /**
Change in osmo-ccid-firmware[master]: remove example code
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13676 Change subject: remove example code .. remove example code as the code will use alternative libraries, the examples will not be able to compile anymore. plus they are not required for the firmware and the example code can be downloaded from atmel start. Change-Id: If53df47089de9eb8498734c19d6a0420c1e79031 --- D sysmoOCTSIM/examples/driver_examples.c D sysmoOCTSIM/examples/driver_examples.h M sysmoOCTSIM/gcc/Makefile 3 files changed, 3 insertions(+), 284 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/76/13676/1 diff --git a/sysmoOCTSIM/examples/driver_examples.c b/sysmoOCTSIM/examples/driver_examples.c deleted file mode 100644 index 14f1ae5..000 --- a/sysmoOCTSIM/examples/driver_examples.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Code generated from Atmel Start. - * - * This file will be overwritten when reconfiguring your Atmel Start project. - * Please copy examples or other code you want to keep to a separate file - * to avoid losing it when reconfiguring. - */ - -#include "driver_examples.h" -#include "driver_init.h" -#include "utils.h" - -/** - * Example of using SIM0 to write "Hello World" using the IO abstraction. - * - * Since the driver is asynchronous we need to use statically allocated memory for string - * because driver initiates transfer and then returns before the transmission is completed. - * - * Once transfer has been completed the tx_cb function will be called. - */ - -static uint8_t example_SIM0[12] = "Hello World!"; - -static void tx_cb_SIM0(const struct usart_async_descriptor *const io_descr) -{ - /* Transfer completed */ -} - -void SIM0_example(void) -{ - struct io_descriptor *io; - - usart_async_register_callback(, USART_ASYNC_TXC_CB, tx_cb_SIM0); - /*usart_async_register_callback(, USART_ASYNC_RXC_CB, rx_cb); - usart_async_register_callback(, USART_ASYNC_ERROR_CB, err_cb);*/ - usart_async_get_io_descriptor(, ); - usart_async_enable(); - - io_write(io, example_SIM0, 12); -} - -/** - * Example of using SIM1 to write "Hello World" using the IO abstraction. - * - * Since the driver is asynchronous we need to use statically allocated memory for string - * because driver initiates transfer and then returns before the transmission is completed. - * - * Once transfer has been completed the tx_cb function will be called. - */ - -static uint8_t example_SIM1[12] = "Hello World!"; - -static void tx_cb_SIM1(const struct usart_async_descriptor *const io_descr) -{ - /* Transfer completed */ -} - -void SIM1_example(void) -{ - struct io_descriptor *io; - - usart_async_register_callback(, USART_ASYNC_TXC_CB, tx_cb_SIM1); - /*usart_async_register_callback(, USART_ASYNC_RXC_CB, rx_cb); - usart_async_register_callback(, USART_ASYNC_ERROR_CB, err_cb);*/ - usart_async_get_io_descriptor(, ); - usart_async_enable(); - - io_write(io, example_SIM1, 12); -} - -/** - * Example of using SIM2 to write "Hello World" using the IO abstraction. - * - * Since the driver is asynchronous we need to use statically allocated memory for string - * because driver initiates transfer and then returns before the transmission is completed. - * - * Once transfer has been completed the tx_cb function will be called. - */ - -static uint8_t example_SIM2[12] = "Hello World!"; - -static void tx_cb_SIM2(const struct usart_async_descriptor *const io_descr) -{ - /* Transfer completed */ -} - -void SIM2_example(void) -{ - struct io_descriptor *io; - - usart_async_register_callback(, USART_ASYNC_TXC_CB, tx_cb_SIM2); - /*usart_async_register_callback(, USART_ASYNC_RXC_CB, rx_cb); - usart_async_register_callback(, USART_ASYNC_ERROR_CB, err_cb);*/ - usart_async_get_io_descriptor(, ); - usart_async_enable(); - - io_write(io, example_SIM2, 12); -} - -/** - * Example of using SIM3 to write "Hello World" using the IO abstraction. - * - * Since the driver is asynchronous we need to use statically allocated memory for string - * because driver initiates transfer and then returns before the transmission is completed. - * - * Once transfer has been completed the tx_cb function will be called. - */ - -static uint8_t example_SIM3[12] = "Hello World!"; - -static void tx_cb_SIM3(const struct usart_async_descriptor *const io_descr) -{ - /* Transfer completed */ -} - -void SIM3_example(void) -{ - struct io_descriptor *io; - - usart_async_register_callback(, USART_ASYNC_TXC_CB, tx_cb_SIM3); - /*usart_async_register_callback(, USART_ASYNC_RXC_CB, rx_cb); - usart_async_register_callback(, USART_ASYNC_ERROR_CB, err_cb);*/ - usart_async_get_io_descriptor(,
Change in osmo-ccid-firmware[master]: change ISO baud rate default to 6720 bps
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13679 Change subject: change ISO baud rate default to 6720 bps .. change ISO baud rate default to 6720 bps the ISO7816 I/O baud rate is f / (Fd / Dd), with Fd 372, Dd = 1. f_max is 4 MHz, but we will use the minimum 20 / 8 = 2.5 MHz, thus the baud rate after reset will be 6720 bps. Change-Id: I9165575404f070c7429daaa3593838d08a5c5e10 --- M sysmoOCTSIM/config/hpl_sercom_config.h 1 file changed, 7 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/79/13679/1 diff --git a/sysmoOCTSIM/config/hpl_sercom_config.h b/sysmoOCTSIM/config/hpl_sercom_config.h index 735fdc2..beac040 100644 --- a/sysmoOCTSIM/config/hpl_sercom_config.h +++ b/sysmoOCTSIM/config/hpl_sercom_config.h @@ -59,7 +59,7 @@ // USART baud rate setting // usart_baud_rate #ifndef CONF_SERCOM_0_USART_BAUD -#define CONF_SERCOM_0_USART_BAUD 9600 +#define CONF_SERCOM_0_USART_BAUD 6720 #endif // @@ -331,7 +331,7 @@ // USART baud rate setting // usart_baud_rate #ifndef CONF_SERCOM_1_USART_BAUD -#define CONF_SERCOM_1_USART_BAUD 9600 +#define CONF_SERCOM_1_USART_BAUD 6720 #endif // @@ -603,7 +603,7 @@ // USART baud rate setting // usart_baud_rate #ifndef CONF_SERCOM_2_USART_BAUD -#define CONF_SERCOM_2_USART_BAUD 9600 +#define CONF_SERCOM_2_USART_BAUD 6720 #endif // @@ -875,7 +875,7 @@ // USART baud rate setting // usart_baud_rate #ifndef CONF_SERCOM_3_USART_BAUD -#define CONF_SERCOM_3_USART_BAUD 9600 +#define CONF_SERCOM_3_USART_BAUD 6720 #endif // @@ -1147,7 +1147,7 @@ // USART baud rate setting // usart_baud_rate #ifndef CONF_SERCOM_4_USART_BAUD -#define CONF_SERCOM_4_USART_BAUD 9600 +#define CONF_SERCOM_4_USART_BAUD 6720 #endif // @@ -1419,7 +1419,7 @@ // USART baud rate setting // usart_baud_rate #ifndef CONF_SERCOM_5_USART_BAUD -#define CONF_SERCOM_5_USART_BAUD 9600 +#define CONF_SERCOM_5_USART_BAUD 6720 #endif // @@ -1691,7 +1691,7 @@ // USART baud rate setting // usart_baud_rate #ifndef CONF_SERCOM_6_USART_BAUD -#define CONF_SERCOM_6_USART_BAUD 9600 +#define CONF_SERCOM_6_USART_BAUD 6720 #endif // -- To view, visit https://gerrit.osmocom.org/13679 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I9165575404f070c7429daaa3593838d08a5c5e10 Gerrit-Change-Number: 13679 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-ccid-firmware[master]: switch UART_debug to ASYNC
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13673 Change subject: switch UART_debug to ASYNC .. switch UART_debug to ASYNC using the synchronous HAL library causes RX overflow after 5 bytes on bulk incoming data (e.g. pasted). this mainly due to printing synchronously the character, but to further prevent congestion we switch to asynchronous (e.g. interrupt driven) communication. The RX part works great now (no overflow), but the TX part is malfunctioning because the HAL Async library does not buffer the data to be transmitted and expects it to be in memory until the transmission is complete (which printf does not do). This change will not be reflected in Atmel START since it does not allow to set the underlying STDIO redirect peripheral to async. Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7 --- M sysmoOCTSIM/command.c M sysmoOCTSIM/driver_init.c M sysmoOCTSIM/driver_init.h M sysmoOCTSIM/examples/driver_examples.c M sysmoOCTSIM/hpl/sercom/hpl_sercom.c M sysmoOCTSIM/main.c M sysmoOCTSIM/stdio_start.c 7 files changed, 94 insertions(+), 28 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/73/13673/1 diff --git a/sysmoOCTSIM/command.c b/sysmoOCTSIM/command.c index 9502f05..7ac5662 100644 --- a/sysmoOCTSIM/command.c +++ b/sysmoOCTSIM/command.c @@ -76,7 +76,8 @@ unsigned int i = 0; /* yield CPU after maximum of 10 received characters */ - while (usart_sync_is_rx_not_empty(_debug) && (i < 10)) { + while (usart_async_is_rx_not_empty(_debug) && (i < 10)) { + gpio_toggle_pin_level(USER_LED); // toggle LED to show we received something int c = getchar(); if (c < 0) return; diff --git a/sysmoOCTSIM/driver_init.c b/sysmoOCTSIM/driver_init.c index 06184ee..0d5bb53 100644 --- a/sysmoOCTSIM/driver_init.c +++ b/sysmoOCTSIM/driver_init.c @@ -32,6 +32,9 @@ /*! The buffer size for USART */ #define SIM6_BUFFER_SIZE 16 +/*! The buffer size for USART */ +#define UART_DEBUG_BUFFER_SIZE 32 + struct usart_async_descriptor SIM0; struct usart_async_descriptor SIM1; struct usart_async_descriptor SIM2; @@ -48,7 +51,9 @@ static uint8_t SIM5_buffer[SIM5_BUFFER_SIZE]; static uint8_t SIM6_buffer[SIM6_BUFFER_SIZE]; -struct usart_sync_descriptor UART_debug; +struct usart_async_descriptor UART_debug; + +static uint8_t UART_DEBUG_buffer[UART_DEBUG_BUFFER_SIZE]; /** * \brief USART Clock initialization function @@ -309,7 +314,26 @@ SIM6_PORT_init(); } -void UART_debug_PORT_init(void) +/** + * \brief USART Clock initialization function + * + * Enables register interface and peripheral clock + */ +void UART_debug_CLOCK_init() +{ + + hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM7_GCLK_ID_CORE, CONF_GCLK_SERCOM7_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); + hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM7_GCLK_ID_SLOW, CONF_GCLK_SERCOM7_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); + + hri_mclk_set_APBDMASK_SERCOM7_bit(MCLK); +} + +/** + * \brief USART pinmux initialization function + * + * Set each required pin to USART functionality + */ +void UART_debug_PORT_init() { gpio_set_pin_function(UART_TX, PINMUX_PB30C_SERCOM7_PAD0); @@ -317,18 +341,15 @@ gpio_set_pin_function(UART_RX, PINMUX_PB31C_SERCOM7_PAD1); } -void UART_debug_CLOCK_init(void) -{ - hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM7_GCLK_ID_CORE, CONF_GCLK_SERCOM7_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); - hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM7_GCLK_ID_SLOW, CONF_GCLK_SERCOM7_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); - - hri_mclk_set_APBDMASK_SERCOM7_bit(MCLK); -} - +/** + * \brief USART initialization function + * + * Enables USART peripheral, clocks and initializes USART driver + */ void UART_debug_init(void) { UART_debug_CLOCK_init(); - usart_sync_init(_debug, SERCOM7, (void *)NULL); + usart_async_init(_debug, SERCOM7, UART_DEBUG_buffer, UART_DEBUG_BUFFER_SIZE, (void *)NULL); UART_debug_PORT_init(); } diff --git a/sysmoOCTSIM/driver_init.h b/sysmoOCTSIM/driver_init.h index d809db8..9d009b9 100644 --- a/sysmoOCTSIM/driver_init.h +++ b/sysmoOCTSIM/driver_init.h @@ -40,8 +40,7 @@ extern struct usart_async_descriptor SIM4; extern struct usart_async_descriptor SIM5; extern struct usart_async_descriptor SIM6; - -extern struct usart_sync_descriptor UART_debug; +extern struct usart_async_descriptor UART_debug; void SIM0_PORT_init(void); void SIM0_CLOCK_init(void); diff --git a/sysmoOCTSIM/examples/driver_examples.c b/sysmoOCTSIM/examples/driver_examples.c index 4ab0ef4..14f1ae5 100644 --- a/sysmoOCTSIM/examples/driver_examples.c +++ b/sysmoOCTSIM/examples/driver_examples.c @@ -215,12 +215,29 @@ /** * Example of using UART_debug to write "Hello World" using the IO abstracti
Change in osmo-ccid-firmware[master]: add sim-atr command
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13681 Change subject: add sim-atr command .. add sim-atr command the sim-atr command resets the card and read the resulting answer to reset. Change-Id: I30b284cab60a50d4cd3080f46f4d332193bbf1ee --- M sysmoOCTSIM/main.c 1 file changed, 90 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/81/13681/1 diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c index afd7bf2..788343e 100644 --- a/sysmoOCTSIM/main.c +++ b/sysmoOCTSIM/main.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "atmel_start.h" #include "atmel_start_pins.h" @@ -31,6 +32,13 @@ #include "command.h" +// TODO put declaration in more global file +// TODO for now SIM7 is not present because used for debug +static struct usart_async_descriptor* SIM_peripheral_descriptors[] = {, , , , , , , NULL}; + +static void SIM_rx_cb(const struct usart_async_descriptor *const io_descr) +{ +} static void board_init() { @@ -49,6 +57,15 @@ /* increase drive strength of 20Mhz SIM clock output to 8mA * (there are 8 inputs + traces to drive!) */ hri_port_set_PINCFG_DRVSTR_bit(PORT, 0, 11); + + // enable SIM interfaces + for (uint8_t i = 0; i < ARRAY_SIZE(SIM_peripheral_descriptors); i++) { + if (NULL == SIM_peripheral_descriptors[i]) { + continue; + } + usart_async_register_callback(SIM_peripheral_descriptors[i], USART_ASYNC_RXC_CB, SIM_rx_cb); // required for RX to work, even if the callback does nothing + usart_async_enable(SIM_peripheral_descriptors[i]); + } } DEFUN(hello_fn, cmd_hello, @@ -210,6 +227,78 @@ ncn8025_set(slotnr, ); } +DEFUN(sim_atr, cmd_sim_atr, "sim-atr", "Read ATR from SIM card") +{ + struct ncn8025_settings settings; + int slotnr = validate_slotnr(argc, argv, 1); + + if (slotnr < 0 || slotnr >= ARRAY_SIZE(SIM_peripheral_descriptors) || NULL == SIM_peripheral_descriptors[slotnr]) { + return; + } + + // check if card is present (and read current settings) + ncn8025_get(slotnr, ); + if (!settings.simpres) { + printf("no card present in slot %d\r\n", slotnr); + return; + } + + // switch card off (assert reset and disable power) + // note: ISO/IEC 7816-3:2006 section 6.4 provides the deactivation sequence, but not the minimum corresponding times + settings.rstin = false; + settings.cmdvcc = false; + ncn8025_set(slotnr, ); + // TODO wait some time for card to be completely deactivated + usart_async_flush_rx_buffer(SIM_peripheral_descriptors[slotnr]); // flush RX buffer to start from scratch + //usart_async_set_baud_rate(SIM_peripheral_descriptors[slotnr], 250 / (372 / 1)); // set USART baud rate to match the interface (f = 2.5 MHz) and card default settings (Fd = 372, Dd = 1) + // set clock to lowest frequency (20 MHz / 8 = 2.5 MHz) + // note: according to ISO/IEC 7816-3:2006 section 5.2.3 the minimum value is 1 MHz, and maximum is 5 MHz during activation + settings.clkdiv = SIM_CLKDIV_8; + ncn8025_set(slotnr, ); + // set card voltage to 3.0 V (the most supported) + // note: according to ISO/IEC 7816-3:2006 no voltage should damage the card, and you should cycle from low to high + settings.vsel = SIM_VOLT_3V0; + ncn8025_set(slotnr, ); + // provide power (the NCN8025 should perform the activation according to spec) + // note: activation sequence is documented in ISO/IEC 7816-3:2006 section 6.2 + settings.cmdvcc = true; + ncn8025_set(slotnr, ); + // wait for Tb=400 cycles before re-asserting reset + delay_us(400 * 1 / 2500); // 400 cycles * 1000 for us, 2.5 MHz / 1000 for us + // de-assert reset to switch card back on + settings.rstin = true; + ncn8025_set(slotnr, ); + // wait for Tc=4 cycles for transmission to start + uint32_t cycles = 4; + while (cycles && !usart_async_is_rx_not_empty(SIM_peripheral_descriptors[slotnr])) { + delay_us(10); + cycles -= 25; // 10 us = 25 cycles at 2.5 MHz + } + if (!usart_async_is_rx_not_empty(SIM_peripheral_descriptors[slotnr])) { + delay_us(12 * 372 / 1 / 2); // wait more than one byte (approximate freq down to 2 MHz) + } + // verify if one byte has been received + if (!usart_async_is_rx_not_empty(SIM_peripheral_descriptors[slotnr])) { + printf("card in slot %d is not responding\r\n", slotnr); + return; + } + // read ATR (just do it until there is no traffic anymore) +
Change in osmo-ccid-firmware[master]: ncn8025: Add support for reading SIMx_INT status
Kévin Redon has submitted this change and it was merged. ( https://gerrit.osmocom.org/13038 ) Change subject: ncn8025: Add support for reading SIMx_INT status .. ncn8025: Add support for reading SIMx_INT status Change-Id: Iab9edc1214bb22ee304daa834fd9e2376d42c97c --- M sysmoOCTSIM/ncn8025.c M sysmoOCTSIM/ncn8025.h 2 files changed, 22 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified Kévin Redon: Looks good to me, approved diff --git a/sysmoOCTSIM/ncn8025.c b/sysmoOCTSIM/ncn8025.c index 5f9b03d..61509bc 100644 --- a/sysmoOCTSIM/ncn8025.c +++ b/sysmoOCTSIM/ncn8025.c @@ -11,6 +11,7 @@ #include #include #include +#include "atmel_start_pins.h" #include "octsim_i2c.h" #include "ncn8025.h" @@ -86,6 +87,20 @@ return 0x03; } +static const uint8_t slot2int_pin(unsigned int slot) +{ + static const uint8_t slot2pin[8] = { SIM0_INT, SIM1_INT, SIM2_INT, SIM3_INT, +SIM4_INT, SIM5_INT, SIM6_INT, SIM7_INT }; + ASSERT(slot < ARRAY_SIZE(slot2pin)); + return slot2pin[slot]; +} + +bool ncn8025_interrupt_active(uint8_t slot) +{ + uint8_t pin = slot2int_pin(slot); + return !gpio_get_pin_level(pin); +} + /*! Set a given NCN8025 as described in 'set'. * \param[in] slot Slot number (0..7) @@ -111,7 +126,9 @@ rc = i2c_read_reg(adap, SX1503_ADDR, reg); if (rc < 0) return rc; - return ncn8025_decode(rc, set); + rc = ncn8025_decode(rc, set); + set->interrupt = ncn8025_interrupt_active(slot); + return rc; } /*! default settings we use at start-up: powered off, in reset, slowest clock, 3V */ @@ -156,6 +173,8 @@ printf(", RST"); if (set->cmdvcc) printf(", VCC"); + if (set->interrupt) + printf(", INT"); if (set->simpres) printf(", SIMPRES"); if (set->led) diff --git a/sysmoOCTSIM/ncn8025.h b/sysmoOCTSIM/ncn8025.h index 79e8b60..89b7f86 100644 --- a/sysmoOCTSIM/ncn8025.h +++ b/sysmoOCTSIM/ncn8025.h @@ -19,11 +19,13 @@ bool cmdvcc;/* high: active */ bool simpres; /* high: active */ bool led; /* high: active */ + bool interrupt; /* high: active */ enum ncn8025_sim_clkdiv clkdiv; /* raw 2bit value */ enum ncn8025_sim_voltage vsel; /* raw 2bit value */ }; int ncn8025_set(uint8_t slot, const struct ncn8025_settings *set); int ncn8025_get(uint8_t slot, struct ncn8025_settings *set); +bool ncn8025_interrupt_active(uint8_t slot); int ncn8025_init(unsigned int slot); void ncn8025_dump(const struct ncn8025_settings *set); -- To view, visit https://gerrit.osmocom.org/13038 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: Iab9edc1214bb22ee304daa834fd9e2376d42c97c Gerrit-Change-Number: 13038 Gerrit-PatchSet: 4 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon
Change in osmo-ccid-firmware[master]: Add various SIM card related debug command
Kévin Redon has submitted this change and it was merged. ( https://gerrit.osmocom.org/13037 ) Change subject: Add various SIM card related debug command .. Add various SIM card related debug command this allows commands like sim-status 0 # read the status sim-voltage 0 5# set voltage to 5V sim-clkdiv 0 2 # set clock-divider to 2 (10 MHz) sim-reset 0 0 # disable reset sim-power 0 1 # enable power Change-Id: Id6131be60d37cba769c79952fa44f3ec6c976a38 --- M sysmoOCTSIM/main.c M sysmoOCTSIM/ncn8025.c M sysmoOCTSIM/ncn8025.h 3 files changed, 193 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified Kévin Redon: Looks good to me, approved diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c index ef87162..dc67406 100644 --- a/sysmoOCTSIM/main.c +++ b/sysmoOCTSIM/main.c @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include +#include #include #include #include @@ -55,6 +57,163 @@ printf("Hello World!\r\n"); } +static int validate_slotnr(int argc, char **argv, int idx) +{ + int slotnr; + if (argc < idx+1) { + printf("You have to specify the slot number (0..7)\r\n"); + return -1; + } + slotnr = atoi(argv[idx]); + if (slotnr < 0 || slotnr > 7) { + printf("You have to specify the slot number (0..7)\r\n"); + return -1; + } + return slotnr; +} + +DEFUN(sim_status, cmd_sim_status, "sim-status", "Get state of specified NCN8025") +{ + struct ncn8025_settings settings; + int slotnr = validate_slotnr(argc, argv, 1); + if (slotnr < 0) + return; + ncn8025_get(slotnr, ); + printf("SIM%d: ", slotnr); + ncn8025_dump(); + printf("\r\n"); +} + +DEFUN(sim_power, cmd_sim_power, "sim-power", "Enable/disable SIM card power") +{ + struct ncn8025_settings settings; + int slotnr = validate_slotnr(argc, argv, 1); + int enable; + + if (slotnr < 0) + return; + + if (argc < 3) { + printf("You have to specify 0=disable or 1=enable\r\n"); + return; + } + enable = atoi(argv[2]); + ncn8025_get(slotnr, ); + if (enable) + settings.cmdvcc = true; + else + settings.cmdvcc = false; + ncn8025_set(slotnr, ); +} + +DEFUN(sim_reset, cmd_sim_reset, "sim-reset", "Enable/disable SIM reset") +{ + struct ncn8025_settings settings; + int slotnr = validate_slotnr(argc, argv, 1); + int enable; + + if (slotnr < 0) + return; + + if (argc < 3) { + printf("You have to specify 0=disable or 1=enable\r\n"); + return; + } + enable = atoi(argv[2]); + ncn8025_get(slotnr, ); + if (enable) + settings.rstin = true; + else + settings.rstin = false; + ncn8025_set(slotnr, ); +} + +DEFUN(sim_clkdiv, cmd_sim_clkdiv, "sim-clkdiv", "Set SIM clock divider (1,2,4,8)") +{ + struct ncn8025_settings settings; + int slotnr = validate_slotnr(argc, argv, 1); + int clkdiv; + + if (slotnr < 0) + return; + + if (argc < 3) { + printf("You have to specify a valid divider (1,2,4,8)\r\n"); + return; + } + clkdiv = atoi(argv[2]); + if (clkdiv != 1 && clkdiv != 2 && clkdiv != 4 && clkdiv != 8) { + printf("You have to specify a valid divider (1,2,4,8)\r\n"); + return; + } + ncn8025_get(slotnr, ); + switch (clkdiv) { + case 1: + settings.clkdiv = SIM_CLKDIV_1; + break; + case 2: + settings.clkdiv = SIM_CLKDIV_2; + break; + case 4: + settings.clkdiv = SIM_CLKDIV_4; + break; + case 8: + settings.clkdiv = SIM_CLKDIV_8; + break; + } + ncn8025_set(slotnr, ); +} + +DEFUN(sim_voltage, cmd_sim_voltage, "sim-voltage", "Set SIM voltage (5/3/1.8)") +{ + struct ncn8025_settings settings; + int slotnr = validate_slotnr(argc, argv, 1); + + if (slotnr < 0) + return; + + if (argc < 3) { + printf("You have to specify a valid voltage (5/3/1.8)\r\n"); + return; + } + ncn8025_get(slotnr, ); + if (!strcmp(argv[2], "5")) + settings.vsel = SIM_VOLT_5V0; + else if (!strcmp(argv[2], "3")) + settings.vsel
Change in osmo-ccid-firmware[master]: Add mnimalistic command line interface "command.c"
Kévin Redon has submitted this change and it was merged. ( https://gerrit.osmocom.org/13036 ) Change subject: Add mnimalistic command line interface "command.c" .. Add mnimalistic command line interface "command.c" This is a very simplistic command line interface parser which various parts of the code can use to register textual commands on the debug UART. Change-Id: I2d289228fb97ecde5602e9756f3d7c51fa65a3b7 --- A sysmoOCTSIM/command.c A sysmoOCTSIM/command.h M sysmoOCTSIM/gcc/Makefile M sysmoOCTSIM/main.c 4 files changed, 135 insertions(+), 5 deletions(-) Approvals: Jenkins Builder: Verified Kévin Redon: Looks good to me, approved diff --git a/sysmoOCTSIM/command.c b/sysmoOCTSIM/command.c new file mode 100644 index 000..9502f05 --- /dev/null +++ b/sysmoOCTSIM/command.c @@ -0,0 +1,101 @@ +#include +#include +#include + +#include + +#include "atmel_start.h" +#include "command.h" + +struct cmd_state { + const char *prompt; + char buf[128]; + unsigned int buf_idx; + const struct command_fn *cmd[32]; + unsigned int cmd_idx; +}; + +static struct cmd_state g_cmds; + +int command_register(const struct command_fn *cmd) +{ + if (g_cmds.cmd_idx >= ARRAY_SIZE(g_cmds.cmd)) + return -1; + g_cmds.cmd[g_cmds.cmd_idx++] = cmd; + return 0; +} + +DEFUN(help, help_cmd, "help", "Print command reference") +{ + unsigned int i; + printf("Help:\r\n"); + printf(" Command Help\r\n"); + printf(" \r\n"); + for (i = 0; i < g_cmds.cmd_idx; i++) + printf(" %-16s %s\r\n", g_cmds.cmd[i]->command, g_cmds.cmd[i]->help); +} + +static void cmd_execute() +{ + char *argv[16]; + unsigned int i; + int argc = 0; + char *cur; + + printf("\r\n"); + memset(argv, 0, sizeof(argv)); + + for (cur = strtok(g_cmds.buf, " "); cur; cur = strtok(NULL, " ")) { + if (argc >= ARRAY_SIZE(argv)) + break; + argv[argc++] = cur; + } + + for (i = 0; i < g_cmds.cmd_idx; i++) { + if (!strcmp(g_cmds.cmd[i]->command, argv[0])) { + g_cmds.cmd[i]->fn(argc, argv); + return; + } + } + printf("Unknown command: '%s'\r\n", argv[0]); +} + +static void cmd_buf_reset(void) +{ + memset(g_cmds.buf, 0, sizeof(g_cmds.buf)); + g_cmds.buf_idx = 0; +} + +static void cmd_buf_append(char c) +{ + g_cmds.buf[g_cmds.buf_idx++] = c; +} + +void command_try_recv(void) +{ + unsigned int i = 0; + + /* yield CPU after maximum of 10 received characters */ + while (usart_sync_is_rx_not_empty(_debug) && (i < 10)) { + int c = getchar(); + if (c < 0) + return; + putchar(c); + if (c == '\r' || c == '\n' || g_cmds.buf_idx >= sizeof(g_cmds.buf)-1) { + cmd_execute(); + cmd_buf_reset(); + printf(g_cmds.prompt); + return; + } + /* append character */ + cmd_buf_append(c); + + i++; + } +} + +void command_init(const char *prompt) +{ + g_cmds.prompt = prompt; + command_register(_cmd); +} diff --git a/sysmoOCTSIM/command.h b/sysmoOCTSIM/command.h new file mode 100644 index 000..cdf256d --- /dev/null +++ b/sysmoOCTSIM/command.h @@ -0,0 +1,20 @@ +#pragma once + +struct command_fn { + const char *command; + const char *help; + void (*fn)(int argc, char **argv); +}; + +#define DEFUN(funcname, cmdname, cmdstr, helpstr) \ + static void funcname(int argc, char **argv);\ + static struct command_fn cmdname = {\ + .command = cmdstr, \ + .help = helpstr,\ + .fn = funcname, \ + }; \ + static void funcname(int argc, char **argv) + +void command_init(const char *prompt); +int command_register(const struct command_fn *cmd); +void command_try_recv(void); diff --git a/sysmoOCTSIM/gcc/Makefile b/sysmoOCTSIM/gcc/Makefile index 1c90257..7496377 100644 --- a/sysmoOCTSIM/gcc/Makefile +++ b/sysmoOCTSIM/gcc/Makefile @@ -80,6 +80,7 @@ i2c_bitbang.o \ octsim_i2c.o \ ncn8025.o \ +command.o \ hpl/osc32kctrl/hpl_osc32kctrl.o \ examples/driver_examples.o \ driver_init.o \ @@ -126,6 +127,7 @@ "i2c_bitbang.o" \ "octsim_i2c.o" \ "ncn8025.o" \ +"command.o" \ "hpl/osc32kctr
Change in osmo-ccid-firmware[master]: minor: rename MUX_SSTAT to MUX_STAT
Kévin Redon has submitted this change and it was merged. ( https://gerrit.osmocom.org/13058 ) Change subject: minor: rename MUX_SSTAT to MUX_STAT .. minor: rename MUX_SSTAT to MUX_STAT Change-Id: I5eee17de31fdce92346641772fc0c63d4c37507a --- M sysmoOCTSIM/atmel_start_config.atstart M sysmoOCTSIM/atmel_start_pins.h M sysmoOCTSIM/driver_init.c 3 files changed, 53 insertions(+), 6 deletions(-) Approvals: Kévin Redon: Looks good to me, approved Jenkins Builder: Verified diff --git a/sysmoOCTSIM/atmel_start_config.atstart b/sysmoOCTSIM/atmel_start_config.atstart index 1bbad8f..290fa89 100644 --- a/sysmoOCTSIM/atmel_start_config.atstart +++ b/sysmoOCTSIM/atmel_start_config.atstart @@ -1481,11 +1481,11 @@ mode: Digital input user_label: SWITCH configuration: null - MUX_SSTAT: + MUX_STAT: name: PC15 definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PC15 mode: Digital input -user_label: MUX_SSTAT +user_label: MUX_STAT configuration: null SIM1_IO: name: PA16 diff --git a/sysmoOCTSIM/atmel_start_pins.h b/sysmoOCTSIM/atmel_start_pins.h index 60b70bb..0264736 100644 --- a/sysmoOCTSIM/atmel_start_pins.h +++ b/sysmoOCTSIM/atmel_start_pins.h @@ -57,7 +57,7 @@ #define SIM2_INT GPIO(GPIO_PORTC, 2) #define SIM3_INT GPIO(GPIO_PORTC, 3) #define SWITCH GPIO(GPIO_PORTC, 14) -#define MUX_SSTAT GPIO(GPIO_PORTC, 15) +#define MUX_STAT GPIO(GPIO_PORTC, 15) #define SIM6_IO GPIO(GPIO_PORTC, 16) #define USER_LED GPIO(GPIO_PORTC, 26) #define SCL4 GPIO(GPIO_PORTC, 27) diff --git a/sysmoOCTSIM/driver_init.c b/sysmoOCTSIM/driver_init.c index 5808f01..06184ee 100644 --- a/sysmoOCTSIM/driver_init.c +++ b/sysmoOCTSIM/driver_init.c @@ -702,6 +702,53 @@ gpio_set_pin_function(SDA1, GPIO_PIN_FUNCTION_OFF); + // GPIO on PB30 + + gpio_set_pin_direction(UART_TX, + // Pin direction + // pad_direction + // Off + // In + // Out + GPIO_DIRECTION_OUT); + + gpio_set_pin_level(UART_TX, + // Initial level + // pad_initial_level + // Low + // High + false); + + gpio_set_pin_pull_mode(UART_TX, + // Pull configuration + // pad_pull_config + // Off + // Pull-up + // Pull-down + GPIO_PULL_OFF); + + gpio_set_pin_function(UART_TX, + // Pin function + // pad_function + // Auto : use driver pinmux if signal is imported by driver, else turn off function + // Auto + // Off + // A + // B + // C + // D + // E + // F + // G + // H + // I + // J + // K + // L + // M + // N + GPIO_PIN_FUNCTION_H); + // GPIO on PC00 // Set pin direction to input @@ -780,9 +827,9 @@ // GPIO on PC15 // Set pin direction to input - gpio_set_pin_direction(MUX_SSTAT, GPIO_DIRECTION_IN); + gpio_set_pin_direction(MUX_STAT, GPIO_DIRECTION_IN); - gpio_set_pin_pull_mode(MUX_SSTAT, + gpio_set_pin_pull_mode(MUX_STAT, // Pull configuration // pad_pull_config // Off @@ -790,7 +837,7 @@ // Pull-down GPIO_PULL_OFF); - gpio_set_pin_function(MUX_SSTAT, GPIO_PIN_FUNCTION_OFF); + gpio_set_pin_function(MUX_STAT, GPIO_PIN_FUNCTION_OFF); // GPIO on PC26 -- To view, visit https://gerrit.osmocom.org/13058 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I5eee17de31fdce92346641772fc0c63d4c37507a Gerrit-Change-Number: 13058 Gerrit-PatchSet: 3 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon
Change in osmo-ccid-firmware[master]: minor: rename MUX_SSTAT to MUX_STAT
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/13058 ) Change subject: minor: rename MUX_SSTAT to MUX_STAT .. Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/13058 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I5eee17de31fdce92346641772fc0c63d4c37507a Gerrit-Change-Number: 13058 Gerrit-PatchSet: 2 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Wed, 27 Feb 2019 13:22:24 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-ccid-firmware[master]: Add various SIM card related debug command
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/13037 ) Change subject: Add various SIM card related debug command .. Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/13037 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Id6131be60d37cba769c79952fa44f3ec6c976a38 Gerrit-Change-Number: 13037 Gerrit-PatchSet: 3 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Wed, 27 Feb 2019 13:22:01 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-ccid-firmware[master]: Add mnimalistic command line interface "command.c"
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/13036 ) Change subject: Add mnimalistic command line interface "command.c" .. Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/13036 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I2d289228fb97ecde5602e9756f3d7c51fa65a3b7 Gerrit-Change-Number: 13036 Gerrit-PatchSet: 2 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Wed, 27 Feb 2019 13:19:12 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-ccid-firmware[master]: switch UART debug to SIM7
Kévin Redon has abandoned this change. ( https://gerrit.osmocom.org/13053 ) Change subject: switch UART debug to SIM7 .. Abandoned SERCOM7 will be used as UART debug for now (R) and can be replaced in the future with SWO -- To view, visit https://gerrit.osmocom.org/13053 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: abandon Gerrit-Change-Id: Idfbd067b4b0e2034337732da2ff5b7cfef8fe4ae Gerrit-Change-Number: 13053 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Jenkins Builder (102)
Change in osmo-ccid-firmware[master]: Switch SERCOM7 (Debug UART) to sync mode + add STDIO
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/13035 ) Change subject: Switch SERCOM7 (Debug UART) to sync mode + add STDIO .. Patch Set 2: Code-Review+2 we decided to use SERCOM7 as UART debug for R because it provides an easy input. For the final production we can replace it with SWO. blocking UART could slow the code, but for R this is ok. SWO could have the advantage in the end to not block when no SWD adapter is connected to debug the code (no SWD disables SWO output) -- To view, visit https://gerrit.osmocom.org/13035 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ibf4ba961d4bbf8d787558f38f3d557422587aad3 Gerrit-Change-Number: 13035 Gerrit-PatchSet: 2 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Wed, 27 Feb 2019 13:17:15 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-ccid-firmware[master]: update ASFv4 library
Kévin Redon has abandoned this change. ( https://gerrit.osmocom.org/13059 ) Change subject: update ASFv4 library .. Abandoned I just found it easier to also integrate the line changes for future "git diff" (and this commit doesn't break the rest), but the -w option also exists for git. I'm fine with either way. -- To view, visit https://gerrit.osmocom.org/13059 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: abandon Gerrit-Change-Id: Ic08fd2494b63b611ac4b4e1f35c91bce9aa746c5 Gerrit-Change-Number: 13059 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Jenkins Builder (102) Gerrit-CC: Harald Welte
Change in osmo-ccid-firmware[master]: add debug tracing using SWO
Kévin Redon has abandoned this change. ( https://gerrit.osmocom.org/13055 ) Change subject: add debug tracing using SWO .. Abandoned -- To view, visit https://gerrit.osmocom.org/13055 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: abandon Gerrit-Change-Id: I4c6d66e7089971294d7c006fbb600e8085e58595 Gerrit-Change-Number: 13055 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-CC: Harald Welte
Change in osmo-ccid-firmware[master]: add debug tracing using SWO
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/13055 ) Change subject: add debug tracing using SWO .. Patch Set 1: > this is taking a quite different route than > https://gerrit.osmocom.org/#/c/osmo-ccid-firmware/+/13035/ right, see comment in the other gerrit to start the discussion. > The problem I see with SWO is that it's only uni-directional, while > we typically have some kind of textual debug console in our > devices. > > I guess for R it doesn't matter if you have 7 or 8 SIM cards > active. For production you can then enable the last one. > > Maybe in the end it will have to be a single #define at compile > time that decides if we use SWO or UART7 as output? agree. > It would be > great to align the code bases and use the I/O abstraction that ASF4 > provides, see the patch I referenced above: > https://gerrit.osmocom.org/#/c/osmo-ccid-firmware/+/13035/ I don't mind using the ASFv4 abstraction since we already started using it for the rest. I found just the code a bit to cumbersome, and it the end it does the same thing -- To view, visit https://gerrit.osmocom.org/13055 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I4c6d66e7089971294d7c006fbb600e8085e58595 Gerrit-Change-Number: 13055 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-CC: Harald Welte Gerrit-Comment-Date: Wed, 27 Feb 2019 13:06:52 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in osmo-ccid-firmware[master]: add RMII clock output
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/13054 ) Change subject: add RMII clock output .. Patch Set 1: > I don't see how this could work without a hardware bugfix, see > https://projects.sysmocom.de/issues/4482 right. I also noticed this issue because the clock was already configured to output 20 MHz, but forgot about it again. -- To view, visit https://gerrit.osmocom.org/13054 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Id8409779d2835b56bbae7db2e962034c82fa3b62 Gerrit-Change-Number: 13054 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Wed, 27 Feb 2019 13:02:52 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in osmo-ccid-firmware[master]: add RMII clock output
Kévin Redon has abandoned this change. ( https://gerrit.osmocom.org/13054 ) Change subject: add RMII clock output .. Abandoned -- To view, visit https://gerrit.osmocom.org/13054 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: abandon Gerrit-Change-Id: Id8409779d2835b56bbae7db2e962034c82fa3b62 Gerrit-Change-Number: 13054 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon
Change in osmo-ccid-firmware[master]: minor: rename MUX_SSTAT to MUX_STAT
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/13058 to look at the new patch set (#2). Change subject: minor: rename MUX_SSTAT to MUX_STAT .. minor: rename MUX_SSTAT to MUX_STAT Change-Id: I5eee17de31fdce92346641772fc0c63d4c37507a --- M sysmoOCTSIM/atmel_start_config.atstart M sysmoOCTSIM/atmel_start_pins.h M sysmoOCTSIM/driver_init.c 3 files changed, 53 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/58/13058/2 -- To view, visit https://gerrit.osmocom.org/13058 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I5eee17de31fdce92346641772fc0c63d4c37507a Gerrit-Change-Number: 13058 Gerrit-PatchSet: 2 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102)
Change in osmo-ccid-firmware[master]: minor: rename MUX_SSTAT to MUX_STAT
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13058 Change subject: minor: rename MUX_SSTAT to MUX_STAT .. minor: rename MUX_SSTAT to MUX_STAT Change-Id: I5eee17de31fdce92346641772fc0c63d4c37507a --- M sysmoOCTSIM/atmel_start_config.atstart M sysmoOCTSIM/atmel_start_pins.h M sysmoOCTSIM/driver_init.c 3 files changed, 31 insertions(+), 23 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/58/13058/1 diff --git a/sysmoOCTSIM/atmel_start_config.atstart b/sysmoOCTSIM/atmel_start_config.atstart index a5b73bd..948d1fb 100644 --- a/sysmoOCTSIM/atmel_start_config.atstart +++ b/sysmoOCTSIM/atmel_start_config.atstart @@ -1481,11 +1481,11 @@ mode: Digital input user_label: SWITCH configuration: null - MUX_SSTAT: + MUX_STAT: name: PC15 definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PC15 mode: Digital input -user_label: MUX_SSTAT +user_label: MUX_STAT configuration: null SIM1_IO: name: PA16 @@ -1571,6 +1571,16 @@ mode: Digital output user_label: SDA4 configuration: null + UART_TX: +name: PB30 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB30 +mode: Advanced +user_label: UART_TX +configuration: + pad_direction: Out + pad_function: H + pad_initial_level: Low + pad_pull_config: 'Off' SCL2: name: PB02 definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB02 @@ -1583,14 +1593,4 @@ mode: Digital output user_label: SDA2 configuration: null - UART_TX: -name: PB30 -definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB30 -mode: Advanced -user_label: UART_TX -configuration: - pad_direction: Out - pad_function: H - pad_initial_level: Low - pad_pull_config: 'Off' toolchain_options: [] diff --git a/sysmoOCTSIM/atmel_start_pins.h b/sysmoOCTSIM/atmel_start_pins.h index a2a4206..c6492fa 100644 --- a/sysmoOCTSIM/atmel_start_pins.h +++ b/sysmoOCTSIM/atmel_start_pins.h @@ -58,7 +58,7 @@ #define SIM2_INT GPIO(GPIO_PORTC, 2) #define SIM3_INT GPIO(GPIO_PORTC, 3) #define SWITCH GPIO(GPIO_PORTC, 14) -#define MUX_SSTAT GPIO(GPIO_PORTC, 15) +#define MUX_STAT GPIO(GPIO_PORTC, 15) #define SIM6_IO GPIO(GPIO_PORTC, 16) #define USER_LED GPIO(GPIO_PORTC, 26) #define SCL4 GPIO(GPIO_PORTC, 27) diff --git a/sysmoOCTSIM/driver_init.c b/sysmoOCTSIM/driver_init.c index f442359..d6eb401 100644 --- a/sysmoOCTSIM/driver_init.c +++ b/sysmoOCTSIM/driver_init.c @@ -708,6 +708,14 @@ // High false); + gpio_set_pin_pull_mode(RMII_CLOCK, + // Pull configuration + // pad_pull_config + // Off + // Pull-up + // Pull-down + GPIO_PULL_OFF); + gpio_set_pin_function(RMII_CLOCK, // Pin function // pad_function @@ -768,6 +776,13 @@ // Out GPIO_DIRECTION_OUT); + gpio_set_pin_level(UART_TX, + // Initial level + // pad_initial_level + // Low + // High + false); + gpio_set_pin_pull_mode(UART_TX, // Pull configuration // pad_pull_config @@ -776,13 +791,6 @@ // Pull-down GPIO_PULL_OFF); - gpio_set_pin_level(UART_TX, - // Initial level - // pad_initial_level - // Low - // High - false); - gpio_set_pin_function(UART_TX, // Pin function // pad_function @@ -883,9 +891,9 @@ // GPIO on PC15 // Set pin direction to input - gpio_set_pin_direction(MUX_SSTAT, GPIO_DIRECTION_IN); + gpio_set_pin_direction(MUX_STAT, GPIO_DIRECTION_IN); - gpio_set_pin_pull_mode(MUX_SSTAT, + gpio_set_pin_pull_mode(MUX_STAT, // Pull configuration // pad_pull_config // Off @@ -893,7 +901,7 @@ // Pull-down GPIO_PULL_OFF); - gpio_set_pin_function(MUX_SSTAT, GPIO_PIN_FUNCTION_OFF); + gpio_set_pin_function(MUX_STAT, GPIO_PIN_FUNCTION_OFF); // GPIO on PC26 -- To view, visit https://gerrit.osmocom.org/13058 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org
Change in osmo-ccid-firmware[master]: update ASFv4 library
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13059 Change subject: update ASFv4 library .. update ASFv4 library this just updates the ASFv4 library files. most of the time this is just about the line ending, but that will make it easier to see future ASFv4 changes Change-Id: Ic08fd2494b63b611ac4b4e1f35c91bce9aa746c5 --- M sysmoOCTSIM/CMSIS/Include/arm_common_tables.h M sysmoOCTSIM/CMSIS/Include/arm_const_structs.h M sysmoOCTSIM/CMSIS/Include/arm_math.h M sysmoOCTSIM/CMSIS/Include/cmsis_armcc.h M sysmoOCTSIM/CMSIS/Include/cmsis_armclang.h M sysmoOCTSIM/CMSIS/Include/cmsis_compiler.h M sysmoOCTSIM/CMSIS/Include/cmsis_gcc.h M sysmoOCTSIM/CMSIS/Include/core_armv8mbl.h M sysmoOCTSIM/CMSIS/Include/core_armv8mml.h M sysmoOCTSIM/CMSIS/Include/core_cm0.h M sysmoOCTSIM/CMSIS/Include/core_cm0plus.h M sysmoOCTSIM/CMSIS/Include/core_cm23.h M sysmoOCTSIM/CMSIS/Include/core_cm3.h M sysmoOCTSIM/CMSIS/Include/core_cm33.h M sysmoOCTSIM/CMSIS/Include/core_cm4.h M sysmoOCTSIM/CMSIS/Include/core_cm7.h M sysmoOCTSIM/CMSIS/Include/core_sc000.h M sysmoOCTSIM/CMSIS/Include/core_sc300.h M sysmoOCTSIM/CMSIS/Include/tz_context.h M sysmoOCTSIM/gcc/gcc/same54n19a_flash.ld M sysmoOCTSIM/gcc/gcc/same54n19a_sram.ld M sysmoOCTSIM/include/component-version.h M sysmoOCTSIM/include/component/ac.h M sysmoOCTSIM/include/component/adc.h M sysmoOCTSIM/include/component/aes.h M sysmoOCTSIM/include/component/can.h M sysmoOCTSIM/include/component/ccl.h M sysmoOCTSIM/include/component/cmcc.h M sysmoOCTSIM/include/component/dac.h M sysmoOCTSIM/include/component/dmac.h M sysmoOCTSIM/include/component/dsu.h M sysmoOCTSIM/include/component/eic.h M sysmoOCTSIM/include/component/evsys.h M sysmoOCTSIM/include/component/freqm.h M sysmoOCTSIM/include/component/gclk.h M sysmoOCTSIM/include/component/gmac.h M sysmoOCTSIM/include/component/hmatrixb.h M sysmoOCTSIM/include/component/i2s.h M sysmoOCTSIM/include/component/icm.h M sysmoOCTSIM/include/component/mclk.h M sysmoOCTSIM/include/component/nvmctrl.h M sysmoOCTSIM/include/component/osc32kctrl.h M sysmoOCTSIM/include/component/oscctrl.h M sysmoOCTSIM/include/component/pac.h M sysmoOCTSIM/include/component/pcc.h M sysmoOCTSIM/include/component/pdec.h M sysmoOCTSIM/include/component/picop.h M sysmoOCTSIM/include/component/pm.h M sysmoOCTSIM/include/component/port.h M sysmoOCTSIM/include/component/qspi.h M sysmoOCTSIM/include/component/ramecc.h M sysmoOCTSIM/include/component/rstc.h M sysmoOCTSIM/include/component/rtc.h M sysmoOCTSIM/include/component/sdhc.h M sysmoOCTSIM/include/component/sercom.h M sysmoOCTSIM/include/component/supc.h M sysmoOCTSIM/include/component/tc.h M sysmoOCTSIM/include/component/tcc.h M sysmoOCTSIM/include/component/trng.h M sysmoOCTSIM/include/component/usb.h M sysmoOCTSIM/include/component/wdt.h M sysmoOCTSIM/include/instance/ac.h M sysmoOCTSIM/include/instance/adc0.h M sysmoOCTSIM/include/instance/adc1.h M sysmoOCTSIM/include/instance/aes.h M sysmoOCTSIM/include/instance/can0.h M sysmoOCTSIM/include/instance/can1.h M sysmoOCTSIM/include/instance/ccl.h M sysmoOCTSIM/include/instance/cmcc.h M sysmoOCTSIM/include/instance/dac.h M sysmoOCTSIM/include/instance/dmac.h M sysmoOCTSIM/include/instance/dsu.h M sysmoOCTSIM/include/instance/eic.h M sysmoOCTSIM/include/instance/evsys.h M sysmoOCTSIM/include/instance/freqm.h M sysmoOCTSIM/include/instance/gclk.h M sysmoOCTSIM/include/instance/gmac.h M sysmoOCTSIM/include/instance/hmatrix.h M sysmoOCTSIM/include/instance/i2s.h M sysmoOCTSIM/include/instance/icm.h M sysmoOCTSIM/include/instance/mclk.h M sysmoOCTSIM/include/instance/nvmctrl.h M sysmoOCTSIM/include/instance/osc32kctrl.h M sysmoOCTSIM/include/instance/oscctrl.h M sysmoOCTSIM/include/instance/pac.h M sysmoOCTSIM/include/instance/pcc.h M sysmoOCTSIM/include/instance/pdec.h M sysmoOCTSIM/include/instance/picop.h M sysmoOCTSIM/include/instance/pm.h M sysmoOCTSIM/include/instance/port.h M sysmoOCTSIM/include/instance/pukcc.h M sysmoOCTSIM/include/instance/qspi.h M sysmoOCTSIM/include/instance/ramecc.h M sysmoOCTSIM/include/instance/rstc.h M sysmoOCTSIM/include/instance/rtc.h M sysmoOCTSIM/include/instance/sdhc0.h M sysmoOCTSIM/include/instance/sdhc1.h M sysmoOCTSIM/include/instance/sercom0.h M sysmoOCTSIM/include/instance/sercom1.h M sysmoOCTSIM/include/instance/sercom2.h M sysmoOCTSIM/include/instance/sercom3.h M sysmoOCTSIM/include/instance/sercom4.h M sysmoOCTSIM/include/instance/sercom5.h M sysmoOCTSIM/include/instance/sercom6.h M sysmoOCTSIM/include/instance/sercom7.h M sysmoOCTSIM/include/instance/supc.h M sysmoOCTSIM/include/instance/tc0.h M sysmoOCTSIM/include/instance/tc1.h M sysmoOCTSIM/include/instance/tc2.h M sysmoOCTSIM/include/instance/tc3.h M sysmoOCTSIM/include/instance/tc4.h M sysmoOCTSIM/include/instance/tc5.h M sysmoOCTSIM/include/instance/tc6.h M sysmoOCTSIM/include/instance/tc7.h M sysmoOCTSIM/include/instance/tcc0.h M sysmoOCTSIM/include/instance/tcc1.h M
Change in osmo-ccid-firmware[master]: Switch SERCOM7 (Debug UART) to sync mode + add STDIO
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/13035 ) Change subject: Switch SERCOM7 (Debug UART) to sync mode + add STDIO .. Patch Set 2: Code-Review-1 instead of using SERCOM7 for UART debug I propose we use exclusively for SIM7 and we can use SWO for debug output. this allows to also test SIM7 with debug output. see https://gerrit.osmocom.org/#/c/osmo-ccid-firmware/+/13055/ for the corresponding change. this also adds a less cluttered stdio/printf support. the only downside is SWO does not have a corresponding input (UART RX) but this can be implemented in software. -- To view, visit https://gerrit.osmocom.org/13035 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ibf4ba961d4bbf8d787558f38f3d557422587aad3 Gerrit-Change-Number: 13035 Gerrit-PatchSet: 2 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Tue, 26 Feb 2019 18:45:09 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-ccid-firmware[master]: add RMII clock output
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13054 Change subject: add RMII clock output .. add RMII clock output The TLK106 Ethernet PHY requires a 50 MHz input on XI in RMII mode. RMII_CLOCK is connected on the micro-controller on PA14 and PB11. PA14, with note "GTXCR" on the schematic, cannot be use to provide the 50 MHz clock since this is the clock output for GLK[0], which is reserved for the CPU running at 120 MHz. PB11 is the clock output pin for GCLK[5], which now divides DPLL1 at 100 MHz to the required 50 MHz. WARNING: I did not test if the output clock signal matches the requirement of the input clock signal. Change-Id: Id8409779d2835b56bbae7db2e962034c82fa3b62 --- M sysmoOCTSIM/atmel_start_config.atstart M sysmoOCTSIM/atmel_start_pins.h M sysmoOCTSIM/config/hpl_gclk_config.h M sysmoOCTSIM/driver_init.c 4 files changed, 52 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/54/13054/1 diff --git a/sysmoOCTSIM/atmel_start_config.atstart b/sysmoOCTSIM/atmel_start_config.atstart index 4590623..29ec468 100644 --- a/sysmoOCTSIM/atmel_start_config.atstart +++ b/sysmoOCTSIM/atmel_start_config.atstart @@ -734,7 +734,7 @@ gclk_gen_4_div: 1 gclk_gen_4_div_sel: false gclk_gen_4_oscillator: External Crystal Oscillator 8-48MHz (XOSC1) - gclk_gen_5_div: 5 + gclk_gen_5_div: 2 gclk_gen_5_div_sel: false gclk_gen_5_oscillator: Digital Phase Locked Loop (DPLL1) gclk_gen_6_div: 1 @@ -1453,6 +1453,16 @@ pad_function: M pad_initial_level: Low pad_pull_config: 'Off' + RMII_CLOCK: +name: PB11 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB11 +mode: Advanced +user_label: RMII_CLOCK +configuration: + pad_direction: Out + pad_function: M + pad_initial_level: Low + pad_pull_config: 'Off' SCL1: name: PB14 definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB14 diff --git a/sysmoOCTSIM/atmel_start_pins.h b/sysmoOCTSIM/atmel_start_pins.h index c877d5e..18a55fa 100644 --- a/sysmoOCTSIM/atmel_start_pins.h +++ b/sysmoOCTSIM/atmel_start_pins.h @@ -46,6 +46,7 @@ #define SCL3 GPIO(GPIO_PORTB, 6) #define SDA3 GPIO(GPIO_PORTB, 7) #define SIM4_IO GPIO(GPIO_PORTB, 8) +#define RMII_CLOCK GPIO(GPIO_PORTB, 11) #define SCL1 GPIO(GPIO_PORTB, 14) #define SDA1 GPIO(GPIO_PORTB, 15) #define SIM5_IO GPIO(GPIO_PORTB, 16) diff --git a/sysmoOCTSIM/config/hpl_gclk_config.h b/sysmoOCTSIM/config/hpl_gclk_config.h index 6b7586c..8c0beee 100644 --- a/sysmoOCTSIM/config/hpl_gclk_config.h +++ b/sysmoOCTSIM/config/hpl_gclk_config.h @@ -454,7 +454,7 @@ // Generic clock generator 5 division <0x-0x> // gclk_gen_5_div #ifndef CONF_GCLK_GEN_5_DIV -#define CONF_GCLK_GEN_5_DIV 5 +#define CONF_GCLK_GEN_5_DIV 2 #endif // // diff --git a/sysmoOCTSIM/driver_init.c b/sysmoOCTSIM/driver_init.c index e56ba0d..ef9c56b 100644 --- a/sysmoOCTSIM/driver_init.c +++ b/sysmoOCTSIM/driver_init.c @@ -691,6 +691,45 @@ gpio_set_pin_function(SDA3, GPIO_PIN_FUNCTION_OFF); + // GPIO on PB11 + + gpio_set_pin_direction(RMII_CLOCK, + // Pin direction + // pad_direction + // Off + // In + // Out + GPIO_DIRECTION_OUT); + + gpio_set_pin_level(RMII_CLOCK, + // Initial level + // pad_initial_level + // Low + // High + false); + + gpio_set_pin_function(RMII_CLOCK, + // Pin function + // pad_function + // Auto : use driver pinmux if signal is imported by driver, else turn off function + // Auto + // Off + // A + // B + // C + // D + // E + // F + // G + // H + // I + // J + // K + // L + // M + // N + GPIO_PIN_FUNCTION_M); + // GPIO on PB14 gpio_set_pin_level(SCL1, -- To view, visit https://gerrit.osmocom.org/13054 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newchange
Change in osmo-ccid-firmware[master]: add debug tracing using SWO
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13055 Change subject: add debug tracing using SWO .. add debug tracing using SWO the UART_TX debug pin is connected to PB30, allowing to output printf debug information using SWO and save SERCOM7 for SIM7. SWO is configured as UART output at 921600 bps, with blocking write. The DEBUG flag must be set to enable output. WARNING: SWO output is also only enabled if a SWD debugger is attached. I did not find in the datasheets how to always have it enabled. Change-Id: I4c6d66e7089971294d7c006fbb600e8085e58595 --- M sysmoOCTSIM/atmel_start_config.atstart M sysmoOCTSIM/atmel_start_pins.h M sysmoOCTSIM/driver_init.c M sysmoOCTSIM/gcc/Makefile M sysmoOCTSIM/main.c A sysmoOCTSIM/trace.c A sysmoOCTSIM/trace.h 7 files changed, 179 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/55/13055/1 diff --git a/sysmoOCTSIM/atmel_start_config.atstart b/sysmoOCTSIM/atmel_start_config.atstart index 29ec468..a5b73bd 100644 --- a/sysmoOCTSIM/atmel_start_config.atstart +++ b/sysmoOCTSIM/atmel_start_config.atstart @@ -1583,4 +1583,14 @@ mode: Digital output user_label: SDA2 configuration: null + UART_TX: +name: PB30 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB30 +mode: Advanced +user_label: UART_TX +configuration: + pad_direction: Out + pad_function: H + pad_initial_level: Low + pad_pull_config: 'Off' toolchain_options: [] diff --git a/sysmoOCTSIM/atmel_start_pins.h b/sysmoOCTSIM/atmel_start_pins.h index 18a55fa..a2a4206 100644 --- a/sysmoOCTSIM/atmel_start_pins.h +++ b/sysmoOCTSIM/atmel_start_pins.h @@ -52,6 +52,7 @@ #define SIM5_IO GPIO(GPIO_PORTB, 16) #define SIM3_IO GPIO(GPIO_PORTB, 20) #define SIM7_IO GPIO(GPIO_PORTB, 21) +#define UART_TX GPIO(GPIO_PORTB, 30) #define SIM0_INT GPIO(GPIO_PORTC, 0) #define SIM1_INT GPIO(GPIO_PORTC, 1) #define SIM2_INT GPIO(GPIO_PORTC, 2) diff --git a/sysmoOCTSIM/driver_init.c b/sysmoOCTSIM/driver_init.c index ef9c56b..f442359 100644 --- a/sysmoOCTSIM/driver_init.c +++ b/sysmoOCTSIM/driver_init.c @@ -758,6 +758,53 @@ gpio_set_pin_function(SDA1, GPIO_PIN_FUNCTION_OFF); + // GPIO on PB30 + + gpio_set_pin_direction(UART_TX, + // Pin direction + // pad_direction + // Off + // In + // Out + GPIO_DIRECTION_OUT); + + gpio_set_pin_pull_mode(UART_TX, + // Pull configuration + // pad_pull_config + // Off + // Pull-up + // Pull-down + GPIO_PULL_OFF); + + gpio_set_pin_level(UART_TX, + // Initial level + // pad_initial_level + // Low + // High + false); + + gpio_set_pin_function(UART_TX, + // Pin function + // pad_function + // Auto : use driver pinmux if signal is imported by driver, else turn off function + // Auto + // Off + // A + // B + // C + // D + // E + // F + // G + // H + // I + // J + // K + // L + // M + // N + GPIO_PIN_FUNCTION_H); + // GPIO on PC00 // Set pin direction to input diff --git a/sysmoOCTSIM/gcc/Makefile b/sysmoOCTSIM/gcc/Makefile index 5e3c38c..e5c7306 100644 --- a/sysmoOCTSIM/gcc/Makefile +++ b/sysmoOCTSIM/gcc/Makefile @@ -76,6 +76,7 @@ hpl/osc32kctrl/hpl_osc32kctrl.o \ examples/driver_examples.o \ driver_init.o \ +trace.o \ hal/src/hal_usart_async.o \ hpl/sercom/hpl_sercom.o \ hal/utils/src/utils_ringbuffer.o \ @@ -117,6 +118,7 @@ "hpl/osc32kctrl/hpl_osc32kctrl.o" \ "examples/driver_examples.o" \ "driver_init.o" \ +"trace.o" \ "hal/src/hal_usart_async.o" \ "hpl/sercom/hpl_sercom.o" \ "hal/utils/src/utils_ringbuffer.o" \ @@ -155,6 +157,7 @@ "hal/src/hal_init.d" \ "hpl/mclk/hpl_mclk.d" \ "driver_init.d" \ +"trace.d" \ "hal/src/hal_usart_async.d" \ "hpl/
Change in osmo-ccid-firmware[master]: fix ASFv4 USB stack
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13056 Change subject: fix ASFv4 USB stack .. fix ASFv4 USB stack this ASFv4 USB library change fixes USB transfer. two transfer-size issues existed: - on multi-packet transfer if the last packet was less than the USB transfer packet size, the packet would be received but not acknowledged - during normal transfer the packet size of a previous packet set the size of the current packet, ignoring the actual transfer size Change-Id: I4209072ee808f0e246bcd5e86917dcf1d213c26b --- M sysmoOCTSIM/hpl/usb/hpl_usb.c 1 file changed, 1 insertion(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/56/13056/1 diff --git a/sysmoOCTSIM/hpl/usb/hpl_usb.c b/sysmoOCTSIM/hpl/usb/hpl_usb.c index b5efe6c..eec9728 100644 --- a/sysmoOCTSIM/hpl/usb/hpl_usb.c +++ b/sysmoOCTSIM/hpl/usb/hpl_usb.c @@ -1135,6 +1135,7 @@ /* Short packet. */ ept->flags.bits.need_zlp = 0; ept->trans_count += last_trans; + _usbd_ep_set_out_trans(epn, 0, ept->size, 0); } else { /* Full packets. */ ept->trans_count += trans_size; @@ -1154,9 +1155,6 @@ if (trans_next > ept->size) { if (trans_next > USB_D_DEV_TRANS_MAX) { trans_next = USB_D_DEV_TRANS_MAX; - } else { - /* Must expect multiple of ep size. */ - trans_next -= trans_next & size_mask; } } else if (trans_next < ept->size) { /* Last un-aligned packet should be cached. */ -- To view, visit https://gerrit.osmocom.org/13056 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I4209072ee808f0e246bcd5e86917dcf1d213c26b Gerrit-Change-Number: 13056 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-ccid-firmware[master]: switch UART debug to SIM7
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13053 Change subject: switch UART debug to SIM7 .. switch UART debug to SIM7 SERCOM7 will mainly be used for the SIM7 interface. only if SIM7 is not present, the UART can be remapped to UART_debug. Change-Id: Idfbd067b4b0e2034337732da2ff5b7cfef8fe4ae --- M sysmoOCTSIM/atmel_start_config.atstart M sysmoOCTSIM/atmel_start_pins.h M sysmoOCTSIM/config/hpl_sercom_config.h M sysmoOCTSIM/driver_init.c M sysmoOCTSIM/driver_init.h M sysmoOCTSIM/examples/driver_examples.c M sysmoOCTSIM/examples/driver_examples.h M sysmoOCTSIM/main.c 8 files changed, 149 insertions(+), 190 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/53/13053/1 diff --git a/sysmoOCTSIM/atmel_start_config.atstart b/sysmoOCTSIM/atmel_start_config.atstart index a301385..4590623 100644 --- a/sysmoOCTSIM/atmel_start_config.atstart +++ b/sysmoOCTSIM/atmel_start_config.atstart @@ -1274,9 +1274,9 @@ configuration: core_gclk_selection: Generic clock generator 2 slow_gclk_selection: Generic clock generator 3 - UART_debug: -user_label: UART_debug -definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::SERCOM7::driver_config_definition::UART::HAL:Driver:USART.Async + SIM7: +user_label: SIM7 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::SERCOM7::driver_config_definition::USART.with.ISO7816::HAL:Driver:USART.Async functionality: USART api: HAL:Driver:USART_Async configuration: @@ -1285,30 +1285,28 @@ usart_arch_cloden: false usart_arch_dbgstop: Keep running usart_arch_dord: LSB is transmitted first - usart_arch_enc: No encoding - usart_arch_fractional: 0 usart_arch_ibon: false - usart_arch_lin_slave_enable: Disable usart_arch_runstdby: false - usart_arch_sampa: 7-8-9 (3-4-5 8-bit over-sampling) - usart_arch_sampr: 16x arithmetic usart_arch_sfde: false - usart_baud_rate: 921600 + usart_baud_rate: 9600 usart_character_size: 8 bits - usart_parity: No parity + usart_dsnack: The successive receive NACK is disable. + usart_gtime: 2-bit times + usart_inack: NACK is transmitted when a parity error is received. + usart_inverse_enabled: false + usart_iso7816_type: T=0 + usart_maxiter: 7 + usart_parity: Even parity usart_rx_enable: true usart_stop_bit: One stop bit usart_tx_enable: true optional_signals: [] variant: - specification: TXPO=0, RXPO=1, CMODE=0 + specification: TXPO=2, RXPO=0 required_signals: - name: SERCOM7/PAD/0 -pad: PB30 -label: TX - - name: SERCOM7/PAD/1 -pad: PB31 -label: RX +pad: PB21 +label: RX/TX clocks: domain_group: nodes: @@ -1503,6 +1501,12 @@ mode: Peripheral IO user_label: SIM3_IO configuration: null + SIM7_IO: +name: PB21 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB21 +mode: Peripheral IO +user_label: SIM7_IO +configuration: null VB0: name: PA20 definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PA20 @@ -1557,18 +1561,6 @@ mode: Digital output user_label: SDA4 configuration: null - UART_TX: -name: PB30 -definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB30 -mode: Peripheral IO -user_label: UART_TX -configuration: null - UART_RX: -name: PB31 -definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB31 -mode: Peripheral IO -user_label: UART_RX -configuration: null SCL2: name: PB02 definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB02 diff --git a/sysmoOCTSIM/atmel_start_pins.h b/sysmoOCTSIM/atmel_start_pins.h index 60b70bb..c877d5e 100644 --- a/sysmoOCTSIM/atmel_start_pins.h +++ b/sysmoOCTSIM/atmel_start_pins.h @@ -50,8 +50,7 @@ #define SDA1 GPIO(GPIO_PORTB, 15) #define SIM5_IO GPIO(GPIO_PORTB, 16) #define SIM3_IO GPIO(GPIO_PORTB, 20) -#define UART_TX GPIO(GPIO_PORTB, 30) -#define UART_RX GPIO(GPIO_PORTB, 31) +#define SIM7_IO GPIO(GPIO_PORTB, 21) #define SIM0_INT GPIO(GPIO_PORTC, 0) #define SIM1_INT GPIO(GPIO_PORTC, 1) #define SIM2_INT GPIO(GPIO_PORTC, 2) diff --git a/sysmoOCTSIM/config/hpl_sercom_config.h b/sysmoOCTSIM/config/hpl_sercom_config.h index 735fdc2..64607bb 100644 --- a/sysmoOCTSIM/config/hpl_sercom_config.h +++ b/sysmoOCTSIM/config/hpl_sercom_config.h @@ -1931,13 +1931,11 @@ #endif // Frame parity -// <0x0=>No parity // <0x1=>Even parity -// <0x2=>Odd parity // Parity bit mode for USART frame // usart_parity #ifndef CONF_SERCOM_7_USART_PARITY -#define CONF_SERCOM_7_USART_PARITY 0x0 +#define CONF_SERCOM_7_USART_PARITY 1 #endif // Character Size @@ -1961,11 +1959,75 @@ #define CONF_SERCOM_7_USART_SBMODE 0
Change in osmo-ccid-firmware[master]: PA11: Increase drive strength to 8mA
Kévin Redon has submitted this change and it was merged. ( https://gerrit.osmocom.org/13034 ) Change subject: PA11: Increase drive strength to 8mA .. PA11: Increase drive strength to 8mA It has been observed that the 20 MHz clock signal doesn't even remotely resemble a square shape unless DRVSTR=1 is set using this patch. Change-Id: I1366e13442eda829756aa4121be81eb15135c73e --- M sysmoOCTSIM/main.c 1 file changed, 5 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified Kévin Redon: Looks good to me, approved diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c index 09d766e..50e82c6 100644 --- a/sysmoOCTSIM/main.c +++ b/sysmoOCTSIM/main.c @@ -18,6 +18,7 @@ #include #include +#include #include "atmel_start.h" #include "atmel_start_pins.h" @@ -54,6 +55,10 @@ cache_init(); cache_enable(CMCC); + + /* increase drive strength of 20Mhz SIM clock output to 8mA +* (there are 8 inputs + traces to drive!) */ + hri_port_set_PINCFG_DRVSTR_bit(PORT, 0, 11); } int main(void) -- To view, visit https://gerrit.osmocom.org/13034 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I1366e13442eda829756aa4121be81eb15135c73e Gerrit-Change-Number: 13034 Gerrit-PatchSet: 2 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon
Change in osmo-ccid-firmware[master]: Enable cache via CMCC for higher performance
Kévin Redon has submitted this change and it was merged. ( https://gerrit.osmocom.org/13033 ) Change subject: Enable cache via CMCC for higher performance .. Enable cache via CMCC for higher performance Change-Id: I7a243a8d964fea3d3decc6c73c16e07036e4ee93 --- M sysmoOCTSIM/main.c 1 file changed, 6 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified Kévin Redon: Looks good to me, approved diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c index 40f2147..09d766e 100644 --- a/sysmoOCTSIM/main.c +++ b/sysmoOCTSIM/main.c @@ -16,6 +16,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include +#include + #include "atmel_start.h" #include "atmel_start_pins.h" @@ -48,6 +51,9 @@ /* only 7 slots, as last slot is debug uart! */ for (i = 0; i < 7; i++) ncn8025_init(i); + + cache_init(); + cache_enable(CMCC); } int main(void) -- To view, visit https://gerrit.osmocom.org/13033 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I7a243a8d964fea3d3decc6c73c16e07036e4ee93 Gerrit-Change-Number: 13033 Gerrit-PatchSet: 2 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder (1000002) Gerrit-Reviewer: Kévin Redon
Change in osmo-ccid-firmware[master]: Update from AtmelStart: Define all used GPIO pins
Kévin Redon has submitted this change and it was merged. ( https://gerrit.osmocom.org/13032 ) Change subject: Update from AtmelStart: Define all used GPIO pins .. Update from AtmelStart: Define all used GPIO pins Change-Id: I2cb67fd01f6e8602af16bbdb4960427586cdd9a4 --- M sysmoOCTSIM/atmel_start_config.atstart M sysmoOCTSIM/atmel_start_pins.h M sysmoOCTSIM/driver_init.c 3 files changed, 366 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified Kévin Redon: Looks good to me, approved diff --git a/sysmoOCTSIM/atmel_start_config.atstart b/sysmoOCTSIM/atmel_start_config.atstart index 58f05f6..a301385 100644 --- a/sysmoOCTSIM/atmel_start_config.atstart +++ b/sysmoOCTSIM/atmel_start_config.atstart @@ -1367,6 +1367,66 @@ configuration: usb_gclk_selection: Generic clock generator 1 pads: + SIM0_INT: +name: PC00 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PC00 +mode: Digital input +user_label: SIM0_INT +configuration: null + SIM1_INT: +name: PC01 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PC01 +mode: Digital input +user_label: SIM1_INT +configuration: null + SIM2_INT: +name: PC02 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PC02 +mode: Digital input +user_label: SIM2_INT +configuration: null + SIM3_INT: +name: PC03 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PC03 +mode: Digital input +user_label: SIM3_INT +configuration: null + SIM4_INT: +name: PA02 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PA02 +mode: Digital input +user_label: SIM4_INT +configuration: null + SIM5_INT: +name: PA03 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PA03 +mode: Digital input +user_label: SIM5_INT +configuration: null + SIM6_INT: +name: PB04 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB04 +mode: Digital input +user_label: SIM6_INT +configuration: null + SIM7_INT: +name: PB05 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB05 +mode: Digital input +user_label: SIM7_INT +configuration: null + SCL3: +name: PB06 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB06 +mode: Digital output +user_label: SCL3 +configuration: null + SDA3: +name: PB07 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB07 +mode: Digital output +user_label: SDA3 +configuration: null SIM4_IO: name: PB08 definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB08 @@ -1395,12 +1455,30 @@ pad_function: M pad_initial_level: Low pad_pull_config: 'Off' + SCL1: +name: PB14 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB14 +mode: Digital output +user_label: SCL1 +configuration: null + SDA1: +name: PB15 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB15 +mode: Digital output +user_label: SDA1 +configuration: null SWITCH: name: PC14 definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PC14 mode: Digital input user_label: SWITCH configuration: null + MUX_SSTAT: +name: PC15 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PC15 +mode: Digital input +user_label: MUX_SSTAT +configuration: null SIM1_IO: name: PA16 definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PA16 @@ -1467,6 +1545,18 @@ mode: Digital output user_label: USER_LED configuration: null + SCL4: +name: PC27 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PC27 +mode: Digital output +user_label: SCL4 +configuration: null + SDA4: +name: PC28 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PC28 +mode: Digital output +user_label: SDA4 +configuration: null UART_TX: name: PB30 definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB30 @@ -1479,4 +1569,16 @@ mode: Peripheral IO user_label: UART_RX configuration: null + SCL2: +name: PB02 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB02 +mode: Digital output +user_label: SCL2 +configuration: null + SDA2: +name: PB03 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PB03 +mode: Digital output +user_label: SDA2 +configuration: null toolchain_options: [] diff --git a/sysmoOCTSIM/atmel_start_pins.h b/sysmoOCTSIM/atmel_start_pins.h index ad5f27b..60b70bb 100644 --- a/sysmoOCTSIM/atmel_start_pins.h +++ b/sysmoOCTSIM/atmel_start_pins.h @@ -27,6 +27,8 @@ #define GPIO_PIN_FUNCTION_M 12 #define GPIO_PIN_FUNCTION_N 13 +#define SIM4_INT GPIO(GPIO_PORTA, 2) +#define SIM5_INT GPIO(GPIO_PORTA, 3) #define SIM0_IO GPIO(GPIO_PORTA, 4
Change in osmo-ccid-firmware[master]: update from Atmel Start (just loading + re-exporting the project)
Kévin Redon has submitted this change and it was merged. ( https://gerrit.osmocom.org/13031 ) Change subject: update from Atmel Start (just loading + re-exporting the project) .. update from Atmel Start (just loading + re-exporting the project) Change-Id: I59b2442a95871b8052bfdfdac6d77a7207d8b70a --- M sysmoOCTSIM/AtmelStart.gpdsc M sysmoOCTSIM/atmel_start_config.atstart M sysmoOCTSIM/hal/include/hpl_spi_m_async.h M sysmoOCTSIM/hal/include/hpl_spi_m_dma.h M sysmoOCTSIM/hal/include/hpl_spi_m_sync.h M sysmoOCTSIM/hal/include/hpl_spi_s_async.h M sysmoOCTSIM/hal/include/hpl_spi_s_sync.h 7 files changed, 73 insertions(+), 12 deletions(-) Approvals: Jenkins Builder: Verified Kévin Redon: Looks good to me, approved diff --git a/sysmoOCTSIM/AtmelStart.gpdsc b/sysmoOCTSIM/AtmelStart.gpdsc index 51851db..6546fb5 100644 --- a/sysmoOCTSIM/AtmelStart.gpdsc +++ b/sysmoOCTSIM/AtmelStart.gpdsc @@ -67,11 +67,6 @@ - - - - - @@ -169,6 +164,11 @@ + + + + + diff --git a/sysmoOCTSIM/atmel_start_config.atstart b/sysmoOCTSIM/atmel_start_config.atstart index 975423d..58f05f6 100644 --- a/sysmoOCTSIM/atmel_start_config.atstart +++ b/sysmoOCTSIM/atmel_start_config.atstart @@ -2,12 +2,12 @@ name: sysmoOCTSIM versions: api: '1.0' - backend: 1.4.93 - commit: 9c29f8365cf76e9937d19b1e765a83bc7a80e4e9 - content: 1.0.1340 + backend: 1.5.122 + commit: 820baecf7dd115d94b0d42ee3b0b9d6ba2da7113 + content: 1.0.1405 content_pack_name: acme-packs-all format: '2' - frontend: 1.4.1810 + frontend: 1.5.1826 board: identifier: CustomBoard device: SAME54N19A-AF @@ -773,6 +773,8 @@ nodes: - name: CPU input: CPU + external: false + external_frequency: 0 configuration: {} OSC32KCTRL: user_label: OSC32KCTRL @@ -981,8 +983,12 @@ nodes: - name: Core input: Generic clock generator 2 + external: false + external_frequency: 0 - name: Slow input: Generic clock generator 3 + external: false + external_frequency: 0 configuration: core_gclk_selection: Generic clock generator 2 slow_gclk_selection: Generic clock generator 3 @@ -1024,8 +1030,12 @@ nodes: - name: Core input: Generic clock generator 2 + external: false + external_frequency: 0 - name: Slow input: Generic clock generator 3 + external: false + external_frequency: 0 configuration: core_gclk_selection: Generic clock generator 2 slow_gclk_selection: Generic clock generator 3 @@ -1067,8 +1077,12 @@ nodes: - name: Core input: Generic clock generator 2 + external: false + external_frequency: 0 - name: Slow input: Generic clock generator 3 + external: false + external_frequency: 0 configuration: core_gclk_selection: Generic clock generator 2 slow_gclk_selection: Generic clock generator 3 @@ -1110,8 +1124,12 @@ nodes: - name: Core input: Generic clock generator 2 + external: false + external_frequency: 0 - name: Slow input: Generic clock generator 3 + external: false + external_frequency: 0 configuration: core_gclk_selection: Generic clock generator 2 slow_gclk_selection: Generic clock generator 3 @@ -1153,8 +1171,12 @@ nodes: - name: Core input: Generic clock generator 2 + external: false + external_frequency: 0 - name: Slow input: Generic clock generator 3 + external: false + external_frequency: 0 configuration: core_gclk_selection: Generic clock generator 2 slow_gclk_selection: Generic clock generator 3 @@ -1196,8 +1218,12 @@ nodes: - name: Core input: Generic clock generator 2 + external: false + external_frequency: 0 - name: Slow input: Generic clock generator 3 + external: false + external_frequency: 0 configuration: core_gclk_selection: Generic clock generator 2 slow_gclk_selection: Generic clock generator 3 @@ -1239,8 +1265,12 @@ nodes: - name: Core input: Generic clock generator 2 + external: false + external_frequency: 0 - name: Slow input: Generic clock generator 3 + external: false + external_frequency: 0 configuration: core_gclk_selection: Generic
Change in osmo-ccid-firmware[master]: ncn8025: Add support for reading SIMx_INT status
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/13038 ) Change subject: ncn8025: Add support for reading SIMx_INT status .. Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/13038 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Iab9edc1214bb22ee304daa834fd9e2376d42c97c Gerrit-Change-Number: 13038 Gerrit-PatchSet: 3 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Tue, 26 Feb 2019 18:12:44 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-ccid-firmware[master]: PA11: Increase drive strength to 8mA
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/13034 ) Change subject: PA11: Increase drive strength to 8mA .. Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/13034 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I1366e13442eda829756aa4121be81eb15135c73e Gerrit-Change-Number: 13034 Gerrit-PatchSet: 2 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Tue, 26 Feb 2019 18:08:21 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-ccid-firmware[master]: Update from AtmelStart: Define all used GPIO pins
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/13032 ) Change subject: Update from AtmelStart: Define all used GPIO pins .. Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/13032 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I2cb67fd01f6e8602af16bbdb4960427586cdd9a4 Gerrit-Change-Number: 13032 Gerrit-PatchSet: 2 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Tue, 26 Feb 2019 17:48:35 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-ccid-firmware[master]: Support for sysmoOCTSIM NCN8025/SX1503 control
Kévin Redon has submitted this change and it was merged. ( https://gerrit.osmocom.org/13030 ) Change subject: Support for sysmoOCTSIM NCN8025/SX1503 control .. Support for sysmoOCTSIM NCN8025/SX1503 control This adds an I2C bit-banging layer, defines the four busses on the sysmoOCTSIM and adds some high-level functions to control the NCN8025 for each SIM slot. Change-Id: Ic5287cf80d2be2070c504e9d40f7c6fc0d37d8b9 --- M sysmoOCTSIM/gcc/Makefile A sysmoOCTSIM/i2c_bitbang.c A sysmoOCTSIM/i2c_bitbang.h M sysmoOCTSIM/main.c A sysmoOCTSIM/ncn8025.c A sysmoOCTSIM/ncn8025.h A sysmoOCTSIM/octsim_i2c.c A sysmoOCTSIM/octsim_i2c.h 8 files changed, 440 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified Kévin Redon: Looks good to me, approved diff --git a/sysmoOCTSIM/gcc/Makefile b/sysmoOCTSIM/gcc/Makefile index 572fb21..5e3c38c 100644 --- a/sysmoOCTSIM/gcc/Makefile +++ b/sysmoOCTSIM/gcc/Makefile @@ -70,6 +70,9 @@ gcc/gcc/startup_same54.o \ hal/src/hal_usb_device.o \ main.o \ +i2c_bitbang.o \ +octsim_i2c.o \ +ncn8025.o \ hpl/osc32kctrl/hpl_osc32kctrl.o \ examples/driver_examples.o \ driver_init.o \ @@ -108,6 +111,9 @@ "gcc/gcc/startup_same54.o" \ "hal/src/hal_usb_device.o" \ "main.o" \ +"i2c_bitbang.o" \ +"octsim_i2c.o" \ +"ncn8025.o" \ "hpl/osc32kctrl/hpl_osc32kctrl.o" \ "examples/driver_examples.o" \ "driver_init.o" \ @@ -152,6 +158,9 @@ "hal/src/hal_usart_async.d" \ "hpl/osc32kctrl/hpl_osc32kctrl.d" \ "main.d" \ +"i2c_bitbang.d" \ +"octsim_i2c.d" \ +"ncn8025.d" \ "examples/driver_examples.d" \ "hal/src/hal_cache.d" \ "hal/src/hal_sleep.d" \ diff --git a/sysmoOCTSIM/i2c_bitbang.c b/sysmoOCTSIM/i2c_bitbang.c new file mode 100644 index 000..b1a9a62 --- /dev/null +++ b/sysmoOCTSIM/i2c_bitbang.c @@ -0,0 +1,189 @@ +/* Bit-banging I2C layer, inspired to a large extent from Linux kernel + * i2c-algo-bit.c code (C) 1995-2000 Simon G. Vogl. This particular + * implementation is (C) 2019 by Harald Welte + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include +#include +#include +#include "i2c_bitbang.h" + +#define setsda(adap, val) gpio_set_pin_level((adap)->pin_sda, val) +#define setscl(adap, val) gpio_set_pin_level((adap)->pin_scl, val) + +static int getsda(const struct i2c_adapter *adap) +{ + int rc; + gpio_set_pin_direction(adap->pin_sda, GPIO_DIRECTION_IN); + rc = gpio_get_pin_level(adap->pin_sda); + gpio_set_pin_direction(adap->pin_sda, GPIO_DIRECTION_OUT); + return rc; +} + +static int getscl(const struct i2c_adapter *adap) +{ + int rc; + gpio_set_pin_direction(adap->pin_scl, GPIO_DIRECTION_IN); + rc = gpio_get_pin_level(adap->pin_scl); + gpio_set_pin_direction(adap->pin_scl, GPIO_DIRECTION_OUT); + return rc; +} + +static inline void sdalo(const struct i2c_adapter *adap) +{ + setsda(adap, 0); + delay_us((adap->udelay+1) / 2); +} + +static inline void sdahi(const struct i2c_adapter *adap) +{ + setsda(adap, 1); + delay_us((adap->udelay+1) / 2); +} + +static inline void scllo(const struct i2c_adapter *adap) +{ + setscl(adap, 0); + delay_us(adap->udelay / 2); +} + + +static int sclhi(const struct i2c_adapter *adap) +{ + setscl(adap, 1); + + /* wait for slow slaves' clock stretching to complete */ + while (!getscl(adap)) { + /* FIXME: abort at some point */ + } + return 0; +} + +static void i2c_start(const struct i2c_adapter *adap) +{ + /* Assert: SCL + SDA are high */ + setsda(adap, 0);/* set SDA to low */ + delay_us(adap->udelay); /* delay */ + scllo(adap);/* Set SCL to low */ +} + +static void i2c_repstart(const struct i2c_adapter *adap) +{ + /* Assert: SCL is low */ + sdahi(adap); + sclhi(adap); + setsda(adap, 0); + delay_us(adap->udelay); + scllo(adap); +} + +static void i2c_stop(const struct i2c_adapter *adap) +{ + /* Assert: SCL is low */ + sdalo(adap);/* set SDA low */ + sclhi(adap);/* set SCL to high */ + setsda(adap, 1);/* set SDA to high */ + delay_us(adap->udelay); /* delay */ +} + +static int i2c_outb(const struct i2c_adapter *adap, uint8_t outdata) +{ + uint8_t sb; + int ack, i; + + /* Assert: SCL is low */ + for (i = 7; i >= 0; i--) { + sb = (outdata >> i) & 1; + setsda(adap, sb); + delay_us((adap->udelay + 1) / 2); + if (sclhi(adap) < 0) + return -ERR_TIMEOUT; + scllo(adap)
Change in osmo-ccid-firmware[master]: Support for sysmoOCTSIM NCN8025/SX1503 control
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/13030 ) Change subject: Support for sysmoOCTSIM NCN8025/SX1503 control .. Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/13030 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ic5287cf80d2be2070c504e9d40f7c6fc0d37d8b9 Gerrit-Change-Number: 13030 Gerrit-PatchSet: 3 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Tue, 26 Feb 2019 17:27:22 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-ccid-firmware[master]: Enable cache via CMCC for higher performance
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/13033 ) Change subject: Enable cache via CMCC for higher performance .. Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/13033 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I7a243a8d964fea3d3decc6c73c16e07036e4ee93 Gerrit-Change-Number: 13033 Gerrit-PatchSet: 2 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Tue, 26 Feb 2019 16:50:20 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-ccid-firmware[master]: update from Atmel Start (just loading + re-exporting the project)
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/13031 ) Change subject: update from Atmel Start (just loading + re-exporting the project) .. Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/13031 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I59b2442a95871b8052bfdfdac6d77a7207d8b70a Gerrit-Change-Number: 13031 Gerrit-PatchSet: 2 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Tue, 26 Feb 2019 16:49:36 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-asf4-dfu[master]: fix DFU magic address and linker script
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/12918 ) Change subject: fix DFU magic address and linker script .. Patch Set 2: > (1 comment) fixed. the same define is also used in the next commit -- To view, visit https://gerrit.osmocom.org/12918 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-asf4-dfu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I69ad101593e903b74084f179cfc97fdfa5a3 Gerrit-Change-Number: 12918 Gerrit-PatchSet: 2 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Fri, 15 Feb 2019 09:12:15 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in osmo-asf4-dfu[master]: minox: use RAM address define instead of hardcoded value
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/12920 Change subject: minox: use RAM address define instead of hardcoded value .. minox: use RAM address define instead of hardcoded value Change-Id: I81a42637194cbf0b5152fe38c691522021ab7582 --- M usb_dfu_main.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-asf4-dfu refs/changes/20/12920/1 diff --git a/usb_dfu_main.c b/usb_dfu_main.c index f431d29..19fe437 100644 --- a/usb_dfu_main.c +++ b/usb_dfu_main.c @@ -73,7 +73,7 @@ * if the SP is not in this range (e.g. flash has been erased) there is no valid application * the second entry in the vector table is the reset address, corresponding to the application start */ - return (0x2000 == ((*application_start_address) & 0xFFF8)); + return (HSRAM_ADDR == ((*application_start_address) & 0xFFF8)); } /** Start the application -- To view, visit https://gerrit.osmocom.org/12920 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-asf4-dfu Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I81a42637194cbf0b5152fe38c691522021ab7582 Gerrit-Change-Number: 12920 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-asf4-dfu[master]: fix DFU magic address and linker script
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/12918 Change subject: fix DFU magic address and linker script .. fix DFU magic address and linker script using the address specified in the linker script leads to a large output binary (as large as the address specified. instead the address is now specified in the source file. Change-Id: I69ad101593e903b74084f179cfc97fdfa5a3 --- M gcc/gcc/same54p20a_flash.ld M usb_dfu_main.c 2 files changed, 3 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-asf4-dfu refs/changes/18/12918/1 diff --git a/gcc/gcc/same54p20a_flash.ld b/gcc/gcc/same54p20a_flash.ld index 32ded77..6aa3fb1 100644 --- a/gcc/gcc/same54p20a_flash.ld +++ b/gcc/gcc/same54p20a_flash.ld @@ -48,12 +48,6 @@ /* Section Definitions */ SECTIONS { -/* Location of the DFU magic. The application must set the magic value "DFU!" (e.g. 0x44465521) at this address to force the DFU bootloader to start (e.g. to perform a DFU detach) */ -.dfu_magic 0x2000 : -{ -KEEP(*(.dfu_magic)) ; -} - .text : { . = ALIGN(4); diff --git a/usb_dfu_main.c b/usb_dfu_main.c index 7fd54d3..e6d933d 100644 --- a/usb_dfu_main.c +++ b/usb_dfu_main.c @@ -28,7 +28,7 @@ static uint32_t* application_start_address; /** Location of the DFU magic value to force starting DFU */ -static uint32_t dfu_magic __attribute__ ((section (".dfu_magic"))) __attribute__ ((__used__)); +static volatile uint32_t* dfu_magic = (uint32_t*)0x2000; // magic value should be written at start of RAM /** Check if the bootloader is valid * \return true if the bootloader is valid and can be run @@ -51,8 +51,8 @@ */ static bool check_force_dfu(void) { - if (0x44465521 == dfu_magic) { // check for the magic value which can be set by the main application - dfu_magic = 0; // erase value so we don't stay in the DFU bootloader upon reset + if (0x44465521 == *dfu_magic) { // check for the magic value which can be set by the main application + *dfu_magic = 0; // erase value so we don't stay in the DFU bootloader upon reset return true; } if (0 == gpio_get_pin_level(BUTTON_FORCE_DFU)) { // signal is low when button is pressed -- To view, visit https://gerrit.osmocom.org/12918 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-asf4-dfu Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I69ad101593e903b74084f179cfc97fdfa5a3 Gerrit-Change-Number: 12918 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-asf4-dfu[master]: set initial DFU state to ERROR if application is corrupt
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/12914 Change subject: set initial DFU state to ERROR if application is corrupt .. set initial DFU state to ERROR if application is corrupt as specified in DFU standard Change-Id: Icd503a2d19f829eb43a83c28b526b73d595640f0 --- M usb/class/dfu/device/dfudf.c M usb_dfu_main.c 2 files changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-asf4-dfu refs/changes/14/12914/1 diff --git a/usb/class/dfu/device/dfudf.c b/usb/class/dfu/device/dfudf.c index 8232979..223999a 100644 --- a/usb/class/dfu/device/dfudf.c +++ b/usb/class/dfu/device/dfudf.c @@ -306,7 +306,6 @@ usbdc_register_function(&_dfudf); usbdc_register_handler(USBDC_HDL_REQ, _req_h); - // TODO check if firmware is corrupted and set dfuERROR state if it is return ERR_NONE; } diff --git a/usb_dfu_main.c b/usb_dfu_main.c index 81b02f8..7fd54d3 100644 --- a/usb_dfu_main.c +++ b/usb_dfu_main.c @@ -101,6 +101,9 @@ if (!check_force_dfu() && check_application()) { // application is valid start_application(); // start application } else { + if (!check_application()) { // if the application is corrupted the start DFU start should be dfuERROR + dfu_state = USB_DFU_STATE_DFU_ERROR; + } usb_dfu(); // start DFU bootloader } } -- To view, visit https://gerrit.osmocom.org/12914 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-asf4-dfu Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Icd503a2d19f829eb43a83c28b526b73d595640f0 Gerrit-Change-Number: 12914 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-asf4-dfu[master]: minor: rename output binary to bootloader
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/12911 to look at the new patch set (#2). Change subject: minor: rename output binary to bootloader .. minor: rename output binary to bootloader Change-Id: I4dfa761c482d6d061eddf3ff8ee91ec049955f53 --- M README.md M gcc/Makefile 2 files changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-asf4-dfu refs/changes/11/12911/2 -- To view, visit https://gerrit.osmocom.org/12911 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-asf4-dfu Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I4dfa761c482d6d061eddf3ff8ee91ec049955f53 Gerrit-Change-Number: 12911 Gerrit-PatchSet: 2 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Jenkins Builder (102)
Change in osmo-asf4-dfu[master]: minor: rename output binary to bootloader
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/12911 Change subject: minor: rename output binary to bootloader .. minor: rename output binary to bootloader Change-Id: I4dfa761c482d6d061eddf3ff8ee91ec049955f53 --- M README.md M gcc/Makefile 2 files changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-asf4-dfu refs/changes/11/12911/1 diff --git a/README.md b/README.md index 58833aa..d6d8d69 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ The board name can be set in 'gcc/Makefile' *BOARD* variable, or provided while compiling (e.g. `make BOARD=SAME54_XPLAINED_PRO`). *SAME54_XPLAINED_PRO* is the default value. -The resulting firmware binary is `AtmelStart.bin`. +The resulting firmware binary is `bootlaoder.bin`. Flashing @@ -60,7 +60,7 @@ To flash the USB DFU bootloader, perform the following actions: * remove reserved bootloader space so we can erase it: `edbg --target atmel_cm4v2 --fuse wv,29:26,15` * erase the whole flash: `edbg --target atmel_cm4v2 --fuse v,29:26,15 --erase` -* program the bootloader: `edbg --target atmel_cm4v2 --fuse v,29:26,15 --program --verify --file AtmelStart.bin` +* program the bootloader: `edbg --target atmel_cm4v2 --fuse v,29:26,15 --program --verify --file bootloader.bin` * reserve bootloader space: `edbg --target atmel_cm4v2 --fuse wv,29:26,13` SWJ @@ -76,5 +76,5 @@ Using OpenOCD (with the [SAM E54 patch](http://openocd.zylin.com/#/c/4272/)) and a ST-LINK/V2 SWD adapter, run the following command: -`openocd --file interface/stlink.cfg --command "transport select hla_swd" --command "set CHIPNAME same54" --command "set CPUTAPID 0x2ba01477" --file target/atsame5x.cfg --command "init" --command "reset halt" --command "atsame5 bootloader 0" --command "flash erase_sector 0 0 last" --command "reset halt" --command "program ./AtmelStart.bin" --command "atsame5 bootloader 16384" --command "reset run" --command "shutdown"` +`openocd --file interface/stlink.cfg --command "transport select hla_swd" --command "set CHIPNAME same54" --command "set CPUTAPID 0x2ba01477" --file target/atsame5x.cfg --command "init" --command "reset halt" --command "atsame5 bootloader 0" --command "flash erase_sector 0 0 last" --command "reset halt" --command "program ./bootloader.bin" --command "atsame5 bootloader 16384" --command "reset run" --command "shutdown"` diff --git a/gcc/Makefile b/gcc/Makefile index 7ad24b1..0817806 100644 --- a/gcc/Makefile +++ b/gcc/Makefile @@ -167,7 +167,7 @@ "gcc/system_same54.d" \ "atmel_start.d" -OUTPUT_FILE_NAME :=AtmelStart +OUTPUT_FILE_NAME := bootloader QUOTE := " OUTPUT_FILE_PATH +=$(OUTPUT_FILE_NAME).elf OUTPUT_FILE_PATH_AS_ARGS +=$(OUTPUT_FILE_NAME).elf -- To view, visit https://gerrit.osmocom.org/12911 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-asf4-dfu Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I4dfa761c482d6d061eddf3ff8ee91ec049955f53 Gerrit-Change-Number: 12911 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-asf4-dfu[master]: add force DFU using magic value
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/12912 Change subject: add force DFU using magic value .. add force DFU using magic value if the string "DFU!" is found at the beginning of the RAM (e.g. as written by the main application during USB detach), the DFU bootloader will be started. Change-Id: I298e3697c06d352a6e0f47266097844c490e1722 --- M README.md M gcc/gcc/same54p20a_flash.ld M usb_dfu_main.c 3 files changed, 26 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-asf4-dfu refs/changes/12/12912/1 diff --git a/README.md b/README.md index d6d8d69..8402b13 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,16 @@ Set the corresponding attributes in the 'DFUD_IFACE_DESCB' macro definition in the 'usb/class/dfu/device/dfudf_desc.h' file. +To force the DFU bootloader to start there are several possibilities: + +* if the application following the bootloader is invalid (e.g. MSP is not in RAM) +* if a button is pressed (the button defined in *BUTTON_FORCE_DFU*) +* if the magic value "DFU!" (e.g. 0x44465521) is set at the start of the RAM (e.g. by the main application when performing a USB detach) + Compiling = -Use the 'Makefile' script to compile the source code using the ARM none EABI GCC cross-cimpilig toolchain: +Use the 'Makefile' script to compile the source code using the ARM none EABI GCC cross-compiling toolchain: ``` cd gcc make diff --git a/gcc/gcc/same54p20a_flash.ld b/gcc/gcc/same54p20a_flash.ld index 08099d2..32ded77 100644 --- a/gcc/gcc/same54p20a_flash.ld +++ b/gcc/gcc/same54p20a_flash.ld @@ -36,7 +36,8 @@ MEMORY { rom (rx) : ORIGIN = 0x, LENGTH = 0x0010 - ram (rwx) : ORIGIN = 0x2000, LENGTH = 0x0004 + /* The first word of the RAM is used for the DFU magic */ + ram (rwx) : ORIGIN = 0x2000 + 4, LENGTH = 0x0004 - 4 bkupram (rwx) : ORIGIN = 0x4700, LENGTH = 0x2000 qspi (rwx) : ORIGIN = 0x0400, LENGTH = 0x0100 } @@ -47,6 +48,12 @@ /* Section Definitions */ SECTIONS { +/* Location of the DFU magic. The application must set the magic value "DFU!" (e.g. 0x44465521) at this address to force the DFU bootloader to start (e.g. to perform a DFU detach) */ +.dfu_magic 0x2000 : +{ +KEEP(*(.dfu_magic)) ; +} + .text : { . = ALIGN(4); diff --git a/usb_dfu_main.c b/usb_dfu_main.c index 96032c5..81b02f8 100644 --- a/usb_dfu_main.c +++ b/usb_dfu_main.c @@ -27,6 +27,9 @@ */ static uint32_t* application_start_address; +/** Location of the DFU magic value to force starting DFU */ +static uint32_t dfu_magic __attribute__ ((section (".dfu_magic"))) __attribute__ ((__used__)); + /** Check if the bootloader is valid * \return true if the bootloader is valid and can be run * \remark initializes application_start_address @@ -48,7 +51,14 @@ */ static bool check_force_dfu(void) { - return (0 == gpio_get_pin_level(BUTTON_FORCE_DFU)); // signal is low when button is pressed + if (0x44465521 == dfu_magic) { // check for the magic value which can be set by the main application + dfu_magic = 0; // erase value so we don't stay in the DFU bootloader upon reset + return true; + } + if (0 == gpio_get_pin_level(BUTTON_FORCE_DFU)) { // signal is low when button is pressed + return true; + } + return false; } /** Check if the application is valid -- To view, visit https://gerrit.osmocom.org/12912 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-asf4-dfu Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I298e3697c06d352a6e0f47266097844c490e1722 Gerrit-Change-Number: 12912 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-asf4-dfu[master]: avoid mutli-packet USB transfer
Kévin Redon has abandoned this change. ( https://gerrit.osmocom.org/12595 ) Change subject: avoid mutli-packet USB transfer .. Abandoned USB transfer is now fixed -- To view, visit https://gerrit.osmocom.org/12595 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-asf4-dfu Gerrit-Branch: master Gerrit-MessageType: abandon Gerrit-Change-Id: Icb4c5f4bc06095f5f962152b8d8247054ef6a520 Gerrit-Change-Number: 12595 Gerrit-PatchSet: 2 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-CC: Harald Welte
Change in osmo-asf4-dfu[master]: fix USB transfer
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/12909 Change subject: fix USB transfer .. fix USB transfer this ASFv4 USB library change fixes USB transfer. two transfer-size issues existed: - on multi-packet transfer if the last packet was less than the USB transfer packet size, the packet would be received but not acknowledged - during normal transfer the packet size of a previous packet set the size of the current packet, ignoring the actual transfer size transfer with a combination of partial or full USB single packet, USB multi-packet, max transfer, and control endpoint sizes was successfully tested (in bytes): 4, 32, 64, 128, 129, 512, 516, 544, 576, 640, 641, 1024, 1028 Change-Id: Ic4e64168e865362e12e0b76386f964895b8b6c20 --- M hpl/usb/hpl_usb.c 1 file changed, 1 insertion(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-asf4-dfu refs/changes/09/12909/1 diff --git a/hpl/usb/hpl_usb.c b/hpl/usb/hpl_usb.c index 6bf09ab..cc6cc41 100644 --- a/hpl/usb/hpl_usb.c +++ b/hpl/usb/hpl_usb.c @@ -1135,6 +1135,7 @@ /* Short packet. */ ept->flags.bits.need_zlp = 0; ept->trans_count += last_trans; + _usbd_ep_set_out_trans(epn, 0, ept->size, 0); } else { /* Full packets. */ ept->trans_count += trans_size; @@ -1154,9 +1155,6 @@ if (trans_next > ept->size) { if (trans_next > USB_D_DEV_TRANS_MAX) { trans_next = USB_D_DEV_TRANS_MAX; - } else { - /* Must expect multiple of ep size. */ - trans_next -= trans_next & size_mask; } } else if (trans_next < ept->size) { /* Last un-aligned packet should be cached. */ -- To view, visit https://gerrit.osmocom.org/12909 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-asf4-dfu Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Ic4e64168e865362e12e0b76386f964895b8b6c20 Gerrit-Change-Number: 12909 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon
Change in osmo-asf4-dfu[master]: add specific board support, including sysmoOCTSIM
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/12910 Change subject: add specific board support, including sysmoOCTSIM .. add specific board support, including sysmoOCTSIM the board specific definitions should be coded when particular environment variable/marco is defined. this macro name is provided by the makefile in the BOARD variable. this allows to compile the bootloader for specific devices. see README for more information. the board definition for the sysmoOCTSIM is also added. Change-Id: Ie51a3af7c77ba76ac40570b871f31fd527fb255b --- M README.md M atmel_start_pins.h M config/usbd_config.h M driver_init.c M driver_init.h M gcc/Makefile M usb_dfu_main.c M usb_start.c 8 files changed, 109 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-asf4-dfu refs/changes/10/12910/1 diff --git a/README.md b/README.md index 031bc27..58833aa 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,22 @@ This is an implementation of the DFU mode of the [USB DFU Device Class Specification](https://usb.org/document-library/device-firmware-upgrade-11-new-version-31-aug-2004) for the Microchip SAM D5x/E5x micro-controller. It is meant to be used as bootloader to allow flashing the main application over USB. -The code has been developed for the Microchip [SAM E54 Xplained Pro](https://www.microchip.com/DevelopmentTools/ProductDetails/PartNo/ATSAME54-XPRO) development board using a [SAM E54](https://www.microchip.com/wwwproducts/en/ATSAME54P20A) micro-controller. +The code has been developed using a [SAM E54](https://www.microchip.com/wwwproducts/en/ATSAME54P20A) micro-controller. It should work on any chip of the SAM D5x/E5x device family by replacing the corresponding device-specific definitions (usually including the chip name in the file name). The code uses the [Atmel START](https://start.atmel.com/) ASFv4 library. +Board += + +The code can be compiled for specific boards: + +- Microchip [SAM E54 Xplained Pro](https://www.microchip.com/DevelopmentTools/ProductDetails/PartNo/ATSAME54-XPRO) development board, named *SAME54_XPLAINED_PRO* +- sysmocom sysmoOCTSIM, name *SYSMOOCTSIM* + +The board name can be set in 'gcc/Makefile' *BOARD* variable, or provided while compiling (e.g. `make BOARD=SAME54_XPLAINED_PRO`). +*SAME54_XPLAINED_PRO* is the default value. + USB DFU === @@ -26,13 +37,14 @@ make ``` +The board name can be set in 'gcc/Makefile' *BOARD* variable, or provided while compiling (e.g. `make BOARD=SAME54_XPLAINED_PRO`). +*SAME54_XPLAINED_PRO* is the default value. + The resulting firmware binary is `AtmelStart.bin`. Flashing -To flash the bootloader you can either use the [edbg tool](https://github.com/ataradov/edbg) over the EDBG interface of the SAM E54 Xplained Pro development board, or OpenICD with any SWJ adapter. - The USB DFU bootloader should be flashed in a protected area of the flash memory to prevent for erasing it, as specified in data sheet section 25.6.2 Memory Organization. The bootloader size is configured in the NVM user configuration BOOTPROT field, as specified in data sheet section 25.6.9 NVM User Configuration. The bit position of the BOOTPROT field is documented in data sheet section 9.4 NVM User Page Mapping. @@ -43,8 +55,26 @@ EDBG +To flash the bootloader using the [edbg tool](https://github.com/ataradov/edbg) over the EDBG interface of the SAM E54 Xplained Pro development board. + To flash the USB DFU bootloader, perform the following actions: * remove reserved bootloader space so we can erase it: `edbg --target atmel_cm4v2 --fuse wv,29:26,15` * erase the whole flash: `edbg --target atmel_cm4v2 --fuse v,29:26,15 --erase` * program the bootloader: `edbg --target atmel_cm4v2 --fuse v,29:26,15 --program --verify --file AtmelStart.bin` * reserve bootloader space: `edbg --target atmel_cm4v2 --fuse wv,29:26,13` + +SWJ +--- + +The bootloader can also be flashed over SWJ (e.g. JTAG or SWD). +You need to perform the following actions: + +* remove reserved bootloader space so we can erase it (and reset MCU for change to be effective) +* erase the whole flash +* program the bootloader +* reserve bootloader space + +Using OpenOCD (with the [SAM E54 patch](http://openocd.zylin.com/#/c/4272/)) and a ST-LINK/V2 SWD adapter, run the following command: + +`openocd --file interface/stlink.cfg --command "transport select hla_swd" --command "set CHIPNAME same54" --command "set CPUTAPID 0x2ba01477" --file target/atsame5x.cfg --command "init" --command "reset halt" --command "atsame5 bootloader 0" --command "flash erase_sector 0 0 last" --command "reset halt" --command "program ./AtmelStart.bin" --command "atsame5 bootloader 16384" --command "reset run" --command "shutdown&qu
Change in osmo-ccid-firmware[master]: relocate application to after the DFU bootloader
Kévin Redon has submitted this change and it was merged. ( https://gerrit.osmocom.org/12813 ) Change subject: relocate application to after the DFU bootloader .. relocate application to after the DFU bootloader without this relocation the DFU bootloader can jump to the application but following executed code would not be the one from the application. Change-Id: Ieeefcf80918fd10e48debab6ff08505f6588811c --- M sysmoOCTSIM/gcc/Makefile R sysmoOCTSIM/gcc/gcc/same54n19a_dfu.ld D sysmoOCTSIM/gcc/gcc/same54p20a_sram.ld 3 files changed, 5 insertions(+), 167 deletions(-) Approvals: Jenkins Builder: Verified Harald Welte: Looks good to me, approved diff --git a/sysmoOCTSIM/gcc/Makefile b/sysmoOCTSIM/gcc/Makefile index 7bc5fd3..572fb21 100644 --- a/sysmoOCTSIM/gcc/Makefile +++ b/sysmoOCTSIM/gcc/Makefile @@ -184,7 +184,7 @@ $(QUOTE)arm-none-eabi-gcc$(QUOTE) -o $(OUTPUT_FILE_NAME).elf $(OBJS_AS_ARGS) -Wl,--start-group -lm -Wl,--end-group -mthumb \ -Wl,-Map="$(OUTPUT_FILE_NAME).map" --specs=nano.specs -Wl,--gc-sections -mcpu=cortex-m4 \ \ --T"../gcc/gcc/same54n19a_flash.ld" \ +-T"../gcc/gcc/same54n19a_dfu.ld" \ -L"../gcc/gcc" @echo Finished building target: $@ diff --git a/sysmoOCTSIM/gcc/gcc/same54p20a_flash.ld b/sysmoOCTSIM/gcc/gcc/same54n19a_dfu.ld similarity index 95% rename from sysmoOCTSIM/gcc/gcc/same54p20a_flash.ld rename to sysmoOCTSIM/gcc/gcc/same54n19a_dfu.ld index 08099d2..7d76cc2 100644 --- a/sysmoOCTSIM/gcc/gcc/same54p20a_flash.ld +++ b/sysmoOCTSIM/gcc/gcc/same54n19a_dfu.ld @@ -1,7 +1,7 @@ /** * \file * - * \brief Linker script for running in internal FLASH on the SAME54P20A + * \brief Linker script for running in internal FLASH on the SAME54N19A * * Copyright (c) 2018 Microchip Technology Inc. * @@ -35,14 +35,14 @@ /* Memory Spaces Definitions */ MEMORY { - rom (rx) : ORIGIN = 0x, LENGTH = 0x0010 - ram (rwx) : ORIGIN = 0x2000, LENGTH = 0x0004 + rom (rx) : ORIGIN = 0x + 16K, LENGTH = 0x0008 - 16K + ram (rwx) : ORIGIN = 0x2000, LENGTH = 0x0003 bkupram (rwx) : ORIGIN = 0x4700, LENGTH = 0x2000 qspi (rwx) : ORIGIN = 0x0400, LENGTH = 0x0100 } /* The stack size used by the application. NOTE: you need to adjust according to your application. */ -STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x1; +STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0xC000; /* Section Definitions */ SECTIONS diff --git a/sysmoOCTSIM/gcc/gcc/same54p20a_sram.ld b/sysmoOCTSIM/gcc/gcc/same54p20a_sram.ld deleted file mode 100644 index b3be5b3..000 --- a/sysmoOCTSIM/gcc/gcc/same54p20a_sram.ld +++ /dev/null @@ -1,162 +0,0 @@ -/** - * \file - * - * \brief Linker script for running in internal SRAM on the SAME54P20A - * - * Copyright (c) 2018 Microchip Technology Inc. - * - * \asf_license_start - * - * \page License - * - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the Licence at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * \asf_license_stop - * - */ - - -OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") -OUTPUT_ARCH(arm) -SEARCH_DIR(.) - -/* Memory Spaces Definitions */ -MEMORY -{ - ram (rwx) : ORIGIN = 0x2000, LENGTH = 0x0004 - bkupram (rwx) : ORIGIN = 0x4700, LENGTH = 0x2000 - qspi (rwx) : ORIGIN = 0x0400, LENGTH = 0x0100 -} - -/* The stack size used by the application. NOTE: you need to adjust according to your application. */ -STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x1; - -/* Section Definitions */ -SECTIONS -{ -.text : -{ -. = ALIGN(4); -_sfixed = .; -KEEP(*(.vectors .vectors.*)) -*(.text .text.* .gnu.linkonce.t.*) -*(.glue_7t) *(.glue_7) -*(.rodata .rodata* .gnu.linkonce.r.*) -*(.ARM.extab* .gnu.linkonce.armextab.*) - -/* Support C constructors, and C destructors in both user code - and the C library. This also provides support for C++ code. */ -. = ALIGN(4); -KEEP(*(.init)) -. = ALIGN(4); -__preinit_array_start = .; -KEEP (*(.preinit_array)) -__preinit_array_end = .; - -. = ALIGN(4); -
Change in osmo-ccid-firmware[master]: add debug welcome message output
Kévin Redon has submitted this change and it was merged. ( https://gerrit.osmocom.org/12812 ) Change subject: add debug welcome message output .. add debug welcome message output Change-Id: I8dde644caa56152b17da674e187006726991ff9c --- M sysmoOCTSIM/main.c 1 file changed, 2 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified Harald Welte: Looks good to me, approved diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c index f2584d2..d74153d 100644 --- a/sysmoOCTSIM/main.c +++ b/sysmoOCTSIM/main.c @@ -44,6 +44,8 @@ usb_start(); + const char* welcome = "\r\n\r\nsysmocom sysmoOCTSIM\r\n"; + while (io_write(_debug.io, (const uint8_t*)welcome, strlen(welcome)) != strlen(welcome)); // print welcome message while (true) { // main loop if (data_arrived) { // input on UART debug data_arrived = false; // clear flag -- To view, visit https://gerrit.osmocom.org/12812 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I8dde644caa56152b17da674e187006726991ff9c Gerrit-Change-Number: 12812 Gerrit-PatchSet: 2 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon
Change in osmo-ccid-firmware[master]: name pin according to schematic
Kévin Redon has submitted this change and it was merged. ( https://gerrit.osmocom.org/12810 ) Change subject: name pin according to schematic .. name pin according to schematic Change-Id: I94a7f2216c288150b044a6190804f9b7247eb10c --- M sysmoOCTSIM/atmel_start_config.atstart M sysmoOCTSIM/atmel_start_pins.h M sysmoOCTSIM/driver_init.c M sysmoOCTSIM/main.c 4 files changed, 175 insertions(+), 7 deletions(-) Approvals: Jenkins Builder: Verified Harald Welte: Looks good to me, approved diff --git a/sysmoOCTSIM/atmel_start_config.atstart b/sysmoOCTSIM/atmel_start_config.atstart index 5c7cc2c..b6303f9 100644 --- a/sysmoOCTSIM/atmel_start_config.atstart +++ b/sysmoOCTSIM/atmel_start_config.atstart @@ -1030,6 +1030,46 @@ configuration: usb_gclk_selection: Generic clock generator 1 pads: + SIMCLK_20MHZ: +name: PA11 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PA11 +mode: Advanced +user_label: SIMCLK_20MHZ +configuration: + pad_direction: Out + pad_function: M + pad_initial_level: Low + pad_pull_config: 'Off' + SWITCH: +name: PC14 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PC14 +mode: Digital input +user_label: SWITCH +configuration: null + VB0: +name: PA20 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PA20 +mode: Digital input +user_label: VB0 +configuration: null + VB1: +name: PA21 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PA21 +mode: Digital input +user_label: VB1 +configuration: null + VB2: +name: PA22 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PA22 +mode: Digital input +user_label: VB2 +configuration: null + VB3: +name: PA23 +definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PA23 +mode: Digital input +user_label: VB3 +configuration: null USBUP_D_N: name: PA24 definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PA24 @@ -1042,11 +1082,11 @@ mode: Advanced user_label: USBUP_D_P configuration: null - LED_system: + USER_LED: name: PC26 definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PC26 mode: Digital output -user_label: LED_system +user_label: USER_LED configuration: null UART_TX: name: PB30 diff --git a/sysmoOCTSIM/atmel_start_pins.h b/sysmoOCTSIM/atmel_start_pins.h index 884a562..fea4388 100644 --- a/sysmoOCTSIM/atmel_start_pins.h +++ b/sysmoOCTSIM/atmel_start_pins.h @@ -27,10 +27,16 @@ #define GPIO_PIN_FUNCTION_M 12 #define GPIO_PIN_FUNCTION_N 13 +#define SIMCLK_20MHZ GPIO(GPIO_PORTA, 11) +#define VB0 GPIO(GPIO_PORTA, 20) +#define VB1 GPIO(GPIO_PORTA, 21) +#define VB2 GPIO(GPIO_PORTA, 22) +#define VB3 GPIO(GPIO_PORTA, 23) #define USBUP_D_N GPIO(GPIO_PORTA, 24) #define USBUP_D_P GPIO(GPIO_PORTA, 25) #define UART_TX GPIO(GPIO_PORTB, 30) #define UART_RX GPIO(GPIO_PORTB, 31) -#define LED_system GPIO(GPIO_PORTC, 26) +#define SWITCH GPIO(GPIO_PORTC, 14) +#define USER_LED GPIO(GPIO_PORTC, 26) #endif // ATMEL_START_PINS_H_INCLUDED diff --git a/sysmoOCTSIM/driver_init.c b/sysmoOCTSIM/driver_init.c index dea4ebc..4ab622f 100644 --- a/sysmoOCTSIM/driver_init.c +++ b/sysmoOCTSIM/driver_init.c @@ -176,9 +176,131 @@ { init_mcu(); + // GPIO on PA11 + + gpio_set_pin_direction(SIMCLK_20MHZ, + // Pin direction + // pad_direction + // Off + // In + // Out + GPIO_DIRECTION_OUT); + + gpio_set_pin_level(SIMCLK_20MHZ, + // Initial level + // pad_initial_level + // Low + // High + false); + + gpio_set_pin_pull_mode(SIMCLK_20MHZ, + // Pull configuration + // pad_pull_config + // Off + // Pull-up + // Pull-down + GPIO_PULL_OFF); + + gpio_set_pin_function(SIMCLK_20MHZ, + // Pin function + // pad_function + // Auto : use driver pinmux if signal is imported by driver, else turn off function + // Auto + // Off + // A + // B + // C + // D + // E + // F + // G + // H + // I
Change in osmo-ccid-firmware[master]: echo back UART input
Kévin Redon has submitted this change and it was merged. ( https://gerrit.osmocom.org/12807 ) Change subject: echo back UART input .. echo back UART input let main run the main loop instead of the CDC ACM example. also rename the CDC ACM example functions. Change-Id: I44b15079672b4058de1fa08365541317d54958dc --- M sysmoOCTSIM/main.c M sysmoOCTSIM/usb_start.c M sysmoOCTSIM/usb_start.h 3 files changed, 17 insertions(+), 17 deletions(-) Approvals: Jenkins Builder: Verified Harald Welte: Looks good to me, approved diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c index de954f4..dfe3b03 100644 --- a/sysmoOCTSIM/main.c +++ b/sysmoOCTSIM/main.c @@ -19,19 +19,19 @@ #include "atmel_start.h" #include "atmel_start_pins.h" -volatile static uint32_t data_arrived = 0; +volatile static bool data_arrived = false; static void tx_cb_UART_debug(const struct usart_async_descriptor *const io_descr) { /* Transfer completed */ - gpio_toggle_pin_level(LED_system); + //gpio_toggle_pin_level(LED_system); } static void rx_cb_UART_debug(const struct usart_async_descriptor *const io_descr) { /* Receive completed */ gpio_toggle_pin_level(LED_system); - data_arrived = 1; + data_arrived = true; } int main(void) @@ -42,5 +42,15 @@ usart_async_register_callback(_debug, USART_ASYNC_RXC_CB, rx_cb_UART_debug); usart_async_enable(_debug); - cdcd_acm_example(); + usb_start(); + + while (true) { // main loop + if (data_arrived) { // input on UART debug + data_arrived = false; // clear flag + uint8_t recv_char; // to store the input + while (io_read(_debug.io, _char, 1) == 1) { // read input + while (io_write(_debug.io, _char, 1) != 1); // echo back to output + } + } + } } diff --git a/sysmoOCTSIM/usb_start.c b/sysmoOCTSIM/usb_start.c index de86172..d02edc0 100644 --- a/sysmoOCTSIM/usb_start.c +++ b/sysmoOCTSIM/usb_start.c @@ -93,25 +93,15 @@ } /** - * Example of using CDC ACM Function. - * \note - * In this example, we will use a PC as a USB host: - * - Connect the DEBUG USB on XPLAINED board to PC for program download. - * - Connect the TARGET USB on XPLAINED board to PC for running program. - * The application will behave as a virtual COM. - * - Open a HyperTerminal or other COM tools in PC side. - * - Send out a character or string and it will echo the content received. + * \brief Start USB stack */ -void cdcd_acm_example(void) +void usb_start(void) { while (!cdcdf_acm_is_enabled()) { // wait cdc acm to be installed }; cdcdf_acm_register_callback(CDCDF_ACM_CB_STATE_C, (FUNC_PTR)usb_device_cb_state_c); - - while (1) { - } } void usb_init(void) diff --git a/sysmoOCTSIM/usb_start.h b/sysmoOCTSIM/usb_start.h index 48b2735..daf30cc 100644 --- a/sysmoOCTSIM/usb_start.h +++ b/sysmoOCTSIM/usb_start.h @@ -15,7 +15,7 @@ #include "cdcdf_acm.h" #include "cdcdf_acm_desc.h" -void cdcd_acm_example(void); +void usb_start(void); void cdc_device_acm_init(void); /** -- To view, visit https://gerrit.osmocom.org/12807 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I44b15079672b4058de1fa08365541317d54958dc Gerrit-Change-Number: 12807 Gerrit-PatchSet: 2 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon