Lcd companion boards support (VKLCD50RTA & VKLCD70RT)
Embed:
(wiki syntax)
Show/hide line numbers
ssif_api.c
00001 /******************************************************************************* 00002 * DISCLAIMER 00003 * This software is supplied by Renesas Electronics Corporation and is only 00004 * intended for use with Renesas products. No other uses are authorized. This 00005 * software is owned by Renesas Electronics Corporation and is protected under 00006 * all applicable laws, including copyright laws. 00007 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING 00008 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT 00009 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 00010 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. 00011 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS 00012 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE 00013 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR 00014 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE 00015 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 00016 * Renesas reserves the right, without notice, to make changes to this software 00017 * and to discontinue the availability of this software. By using this software, 00018 * you agree to the additional terms and conditions found by accessing the 00019 * following link: 00020 * http://www.renesas.com/disclaimer* 00021 * Copyright (C) 2015 Renesas Electronics Corporation. All rights reserved. 00022 *******************************************************************************/ 00023 00024 #include "ssif_api.h" 00025 00026 static const PinMap PinMap_SSIF_SCK[] = { 00027 // pin ch func 00028 {P2_8 , 0 , 4}, 00029 {P4_4 , 0 , 5}, 00030 {P3_4 , 1 , 3}, 00031 {P7_1 , 1 , 6}, 00032 {P7_5 , 2 , 6}, 00033 {P9_5 , 2 , 3}, 00034 {P4_12 , 3 , 6}, 00035 {P7_8 , 3 , 2}, 00036 {P7_12 , 4 , 2}, 00037 {P8_12 , 4 , 8}, 00038 {P2_4 , 5 , 4}, 00039 {P4_8 , 5 , 5}, 00040 {P8_8 , 5 , 8}, 00041 {NC , NC , 0} 00042 }; 00043 00044 static const PinMap PinMap_SSIF_WS[] = { 00045 // pin ch func 00046 {P2_9 , 0 , 4}, 00047 {P4_5 , 0 , 5}, 00048 {P3_5 , 1 , 3}, 00049 {P7_2 , 1 , 6}, 00050 {P7_6 , 2 , 6}, 00051 {P9_6 , 2 , 3}, 00052 {P4_13 , 3 , 6}, 00053 {P7_9 , 3 , 2}, 00054 {P7_13 , 4 , 2}, 00055 {P8_13 , 4 , 8}, 00056 {P2_5 , 5 , 4}, 00057 {P4_9 , 5 , 5}, 00058 {P8_9 , 5 , 8}, 00059 {NC , NC , 0} 00060 }; 00061 00062 static const PinMap PinMap_SSIF_TxD[] = { 00063 // pin ch func 00064 {P2_11 , 0 , 4}, 00065 {P4_7 , 0 , 5}, 00066 {P7_4 , 1 , 6}, 00067 {P7_7 , 2 , 6}, /* SSIDATA2 */ 00068 {P9_7 , 2 , 3}, /* SSIDATA2 */ 00069 {P4_15 , 3 , 6}, 00070 {P7_11 , 3 , 2}, 00071 {P6_1 , 4 , 6}, /* SSIDATA4 */ 00072 {P7_14 , 4 , 2}, /* SSIDATA4 */ 00073 {P8_14 , 4 , 8}, /* SSIDATA4 */ 00074 {P2_7 , 5 , 4}, 00075 {P4_11 , 5 , 5}, 00076 {P8_10 , 5 , 8}, 00077 {NC , NC , 0} 00078 }; 00079 00080 static const PinMap PinMap_SSIF_RxD[] = { 00081 // pin ch func 00082 {P2_10 , 0 , 4}, 00083 {P4_6 , 0 , 5}, 00084 {P3_7 , 1 , 3}, 00085 {P7_3 , 1 , 6}, 00086 {P7_7 , 2 , 6}, /* SSIDATA2 */ 00087 {P9_7 , 2 , 3}, /* SSIDATA2 */ 00088 {P4_14 , 3 , 6}, 00089 {P7_10 , 3 , 2}, 00090 {P6_1 , 4 , 6}, /* SSIDATA4 */ 00091 {P7_14 , 4 , 2}, /* SSIDATA4 */ 00092 {P8_14 , 4 , 8}, /* SSIDATA4 */ 00093 {P2_6 , 5 , 4}, 00094 {P4_10 , 5 , 5}, 00095 {NC , NC , 0} 00096 }; 00097 00098 static void ssif_power_enable(uint32_t ssif_ch) { 00099 volatile uint8_t dummy; 00100 00101 switch (ssif_ch) { 00102 case 0: 00103 CPGSTBCR11 &= ~(0x20); 00104 break; 00105 case 1: 00106 CPGSTBCR11 &= ~(0x10); 00107 break; 00108 case 2: 00109 CPGSTBCR11 &= ~(0x08); 00110 break; 00111 case 3: 00112 CPGSTBCR11 &= ~(0x04); 00113 break; 00114 case 4: 00115 CPGSTBCR11 &= ~(0x02); 00116 break; 00117 case 5: 00118 CPGSTBCR11 &= ~(0x01); 00119 break; 00120 } 00121 dummy = CPGSTBCR11; 00122 } 00123 00124 int32_t ssif_init(PinName sck, PinName ws, PinName tx, PinName rx) { 00125 /* determine the ssif to use */ 00126 uint32_t ssif_sck = pinmap_peripheral(sck, PinMap_SSIF_SCK); 00127 uint32_t ssif_ws = pinmap_peripheral(ws, PinMap_SSIF_WS); 00128 uint32_t ssif_tx = pinmap_peripheral(tx, PinMap_SSIF_TxD); 00129 uint32_t ssif_rx = pinmap_peripheral(rx, PinMap_SSIF_RxD); 00130 uint32_t ssif_ch = pinmap_merge(ssif_tx, ssif_rx); 00131 00132 if ((ssif_ch == ssif_sck) && (ssif_ch == ssif_ws)) { 00133 ssif_power_enable(ssif_ch); 00134 pinmap_pinout(sck, PinMap_SSIF_SCK); 00135 pinmap_pinout(ws, PinMap_SSIF_WS); 00136 pinmap_pinout(tx, PinMap_SSIF_TxD); 00137 pinmap_pinout(rx, PinMap_SSIF_RxD); 00138 } else { 00139 ssif_ch = (uint32_t)NC; 00140 } 00141 00142 return (int32_t)ssif_ch; 00143 } 00144 00145
Generated on Tue Jul 12 2022 14:32:46 by
1.7.2