mbed library sources. Supersedes mbed-src.
Fork of mbed-dev by
targets/TARGET_Maxim/TARGET_MAX32630/mxc/ioman.c@165:2dd56e6daeec, 2017-05-23 (annotated)
- Committer:
- ranaumarnaeem
- Date:
- Tue May 23 12:54:50 2017 +0000
- Revision:
- 165:2dd56e6daeec
- Parent:
- 157:ff67d9f36b67
jhjg
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 157:ff67d9f36b67 | 1 | /******************************************************************************* |
<> | 157:ff67d9f36b67 | 2 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
<> | 157:ff67d9f36b67 | 3 | * |
<> | 157:ff67d9f36b67 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
<> | 157:ff67d9f36b67 | 5 | * copy of this software and associated documentation files (the "Software"), |
<> | 157:ff67d9f36b67 | 6 | * to deal in the Software without restriction, including without limitation |
<> | 157:ff67d9f36b67 | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
<> | 157:ff67d9f36b67 | 8 | * and/or sell copies of the Software, and to permit persons to whom the |
<> | 157:ff67d9f36b67 | 9 | * Software is furnished to do so, subject to the following conditions: |
<> | 157:ff67d9f36b67 | 10 | * |
<> | 157:ff67d9f36b67 | 11 | * The above copyright notice and this permission notice shall be included |
<> | 157:ff67d9f36b67 | 12 | * in all copies or substantial portions of the Software. |
<> | 157:ff67d9f36b67 | 13 | * |
<> | 157:ff67d9f36b67 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
<> | 157:ff67d9f36b67 | 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
<> | 157:ff67d9f36b67 | 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
<> | 157:ff67d9f36b67 | 17 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
<> | 157:ff67d9f36b67 | 18 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
<> | 157:ff67d9f36b67 | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
<> | 157:ff67d9f36b67 | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
<> | 157:ff67d9f36b67 | 21 | * |
<> | 157:ff67d9f36b67 | 22 | * Except as contained in this notice, the name of Maxim Integrated |
<> | 157:ff67d9f36b67 | 23 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
<> | 157:ff67d9f36b67 | 24 | * Products, Inc. Branding Policy. |
<> | 157:ff67d9f36b67 | 25 | * |
<> | 157:ff67d9f36b67 | 26 | * The mere transfer of this software does not imply any licenses |
<> | 157:ff67d9f36b67 | 27 | * of trade secrets, proprietary technology, copyrights, patents, |
<> | 157:ff67d9f36b67 | 28 | * trademarks, maskwork rights, or any other form of intellectual |
<> | 157:ff67d9f36b67 | 29 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
<> | 157:ff67d9f36b67 | 30 | * ownership rights. |
<> | 157:ff67d9f36b67 | 31 | * |
<> | 157:ff67d9f36b67 | 32 | * $Date: 2016-04-27 15:26:08 -0500 (Wed, 27 Apr 2016) $ |
<> | 157:ff67d9f36b67 | 33 | * $Revision: 22543 $ |
<> | 157:ff67d9f36b67 | 34 | * |
<> | 157:ff67d9f36b67 | 35 | ******************************************************************************/ |
<> | 157:ff67d9f36b67 | 36 | |
<> | 157:ff67d9f36b67 | 37 | #include <stddef.h> |
<> | 157:ff67d9f36b67 | 38 | #include "mxc_config.h" |
<> | 157:ff67d9f36b67 | 39 | #include "ioman.h" |
<> | 157:ff67d9f36b67 | 40 | |
<> | 157:ff67d9f36b67 | 41 | /******************************************************************************/ |
<> | 157:ff67d9f36b67 | 42 | int IOMAN_Config(const ioman_cfg_t *cfg) |
<> | 157:ff67d9f36b67 | 43 | { |
<> | 157:ff67d9f36b67 | 44 | if(cfg == NULL) { |
<> | 157:ff67d9f36b67 | 45 | return E_NULL_PTR; |
<> | 157:ff67d9f36b67 | 46 | } |
<> | 157:ff67d9f36b67 | 47 | |
<> | 157:ff67d9f36b67 | 48 | if (*cfg->ack_reg != cfg->req_val.value) { |
<> | 157:ff67d9f36b67 | 49 | /* Request pin mapping */ |
<> | 157:ff67d9f36b67 | 50 | *cfg->req_reg = cfg->req_val.value; |
<> | 157:ff67d9f36b67 | 51 | |
<> | 157:ff67d9f36b67 | 52 | /* Check for acknowledgment */ |
<> | 157:ff67d9f36b67 | 53 | if (*cfg->ack_reg != cfg->req_val.value) { |
<> | 157:ff67d9f36b67 | 54 | return E_BUSY; |
<> | 157:ff67d9f36b67 | 55 | } |
<> | 157:ff67d9f36b67 | 56 | } |
<> | 157:ff67d9f36b67 | 57 | |
<> | 157:ff67d9f36b67 | 58 | return E_NO_ERROR; |
<> | 157:ff67d9f36b67 | 59 | } |