mbed library sources. Supersedes mbed-src. Fixed broken STM32F1xx RTC on rtc_api.c

Dependents:   Nucleo_F103RB_RTC_battery_bkup_pwr_off_okay

Fork of mbed-dev by mbed official

Committer:
<>
Date:
Tue Nov 08 17:45:16 2016 +0000
Revision:
150:02e0a0aed4ec
This updates the lib to the mbed lib v129

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 150:02e0a0aed4ec 1 /*******************************************************************************
<> 150:02e0a0aed4ec 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
<> 150:02e0a0aed4ec 3 *
<> 150:02e0a0aed4ec 4 * Permission is hereby granted, free of charge, to any person obtaining a
<> 150:02e0a0aed4ec 5 * copy of this software and associated documentation files (the "Software"),
<> 150:02e0a0aed4ec 6 * to deal in the Software without restriction, including without limitation
<> 150:02e0a0aed4ec 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
<> 150:02e0a0aed4ec 8 * and/or sell copies of the Software, and to permit persons to whom the
<> 150:02e0a0aed4ec 9 * Software is furnished to do so, subject to the following conditions:
<> 150:02e0a0aed4ec 10 *
<> 150:02e0a0aed4ec 11 * The above copyright notice and this permission notice shall be included
<> 150:02e0a0aed4ec 12 * in all copies or substantial portions of the Software.
<> 150:02e0a0aed4ec 13 *
<> 150:02e0a0aed4ec 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
<> 150:02e0a0aed4ec 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
<> 150:02e0a0aed4ec 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
<> 150:02e0a0aed4ec 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
<> 150:02e0a0aed4ec 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
<> 150:02e0a0aed4ec 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
<> 150:02e0a0aed4ec 20 * OTHER DEALINGS IN THE SOFTWARE.
<> 150:02e0a0aed4ec 21 *
<> 150:02e0a0aed4ec 22 * Except as contained in this notice, the name of Maxim Integrated
<> 150:02e0a0aed4ec 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
<> 150:02e0a0aed4ec 24 * Products, Inc. Branding Policy.
<> 150:02e0a0aed4ec 25 *
<> 150:02e0a0aed4ec 26 * The mere transfer of this software does not imply any licenses
<> 150:02e0a0aed4ec 27 * of trade secrets, proprietary technology, copyrights, patents,
<> 150:02e0a0aed4ec 28 * trademarks, maskwork rights, or any other form of intellectual
<> 150:02e0a0aed4ec 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
<> 150:02e0a0aed4ec 30 * ownership rights.
<> 150:02e0a0aed4ec 31 *
<> 150:02e0a0aed4ec 32 * $Date: 2016-04-27 09:05:41 -0500 (Wed, 27 Apr 2016) $
<> 150:02e0a0aed4ec 33 * $Revision: 22529 $
<> 150:02e0a0aed4ec 34 *
<> 150:02e0a0aed4ec 35 ******************************************************************************/
<> 150:02e0a0aed4ec 36
<> 150:02e0a0aed4ec 37 #include <stddef.h>
<> 150:02e0a0aed4ec 38 #include "mxc_config.h"
<> 150:02e0a0aed4ec 39 #include "ioman.h"
<> 150:02e0a0aed4ec 40
<> 150:02e0a0aed4ec 41 /******************************************************************************/
<> 150:02e0a0aed4ec 42 int IOMAN_Config(const ioman_cfg_t *cfg)
<> 150:02e0a0aed4ec 43 {
<> 150:02e0a0aed4ec 44
<> 150:02e0a0aed4ec 45 if(cfg == NULL) {
<> 150:02e0a0aed4ec 46 return E_NULL_PTR;
<> 150:02e0a0aed4ec 47 }
<> 150:02e0a0aed4ec 48
<> 150:02e0a0aed4ec 49 if ((cfg->req_reg == &MXC_IOMAN->i2cm0_req) || (cfg->req_reg == &MXC_IOMAN->i2cm1_req)) {
<> 150:02e0a0aed4ec 50 /* Request pin mapping */
<> 150:02e0a0aed4ec 51 *cfg->req_reg = cfg->req_val.value;
<> 150:02e0a0aed4ec 52
<> 150:02e0a0aed4ec 53 /* Check for acknowledgment */
<> 150:02e0a0aed4ec 54 /* Mask the I2CM SCL push/pull bit because it does not have an ack bit*/
<> 150:02e0a0aed4ec 55 if (*cfg->ack_reg != (cfg->req_val.value & ~(MXC_F_IOMAN_I2CM0_REQ_SCL_PUSH_PULL))) {
<> 150:02e0a0aed4ec 56 return E_BUSY;
<> 150:02e0a0aed4ec 57 }
<> 150:02e0a0aed4ec 58 } else {
<> 150:02e0a0aed4ec 59 if (*cfg->ack_reg != cfg->req_val.value) {
<> 150:02e0a0aed4ec 60 /* Request pin mapping */
<> 150:02e0a0aed4ec 61 *cfg->req_reg = cfg->req_val.value;
<> 150:02e0a0aed4ec 62
<> 150:02e0a0aed4ec 63 /* Check for acknowledgment */
<> 150:02e0a0aed4ec 64 if (*cfg->ack_reg != cfg->req_val.value) {
<> 150:02e0a0aed4ec 65 return E_BUSY;
<> 150:02e0a0aed4ec 66 }
<> 150:02e0a0aed4ec 67 }
<> 150:02e0a0aed4ec 68 }
<> 150:02e0a0aed4ec 69
<> 150:02e0a0aed4ec 70 return E_NO_ERROR;
<> 150:02e0a0aed4ec 71 }