Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lypinator 0:bb348c97df44 1 /**
lypinator 0:bb348c97df44 2 *---------------------------------------------------------------------------
lypinator 0:bb348c97df44 3 * Copyright (c) 2016, u-blox Malmö, All Rights Reserved
lypinator 0:bb348c97df44 4 * SPDX-License-Identifier: LicenseRef-PBL
lypinator 0:bb348c97df44 5 *
lypinator 0:bb348c97df44 6 * This file and the related binary are licensed under the
lypinator 0:bb348c97df44 7 * Permissive Binary License, Version 1.0 (the "License");
lypinator 0:bb348c97df44 8 * you may not use these files except in compliance with the License.
lypinator 0:bb348c97df44 9 *
lypinator 0:bb348c97df44 10 * You may obtain a copy of the License here:
lypinator 0:bb348c97df44 11 * LICENSE-permissive-binary-license-1.0.txt and at
lypinator 0:bb348c97df44 12 * https://www.mbed.com/licenses/PBL-1.0
lypinator 0:bb348c97df44 13 *
lypinator 0:bb348c97df44 14 * See the License for the specific language governing permissions and
lypinator 0:bb348c97df44 15 * limitations under the License.
lypinator 0:bb348c97df44 16 *
lypinator 0:bb348c97df44 17 * Component : WLAN driver
lypinator 0:bb348c97df44 18 * File : cb_target.h
lypinator 0:bb348c97df44 19 *
lypinator 0:bb348c97df44 20 * Description : OWL222a Wireless LAN module representation
lypinator 0:bb348c97df44 21 *-------------------------------------------------------------------------*/
lypinator 0:bb348c97df44 22
lypinator 0:bb348c97df44 23 /**
lypinator 0:bb348c97df44 24 * @file cb_target.h Handles the lowest layer of communication to the target
lypinator 0:bb348c97df44 25 * before the SDIO stack.
lypinator 0:bb348c97df44 26 *
lypinator 0:bb348c97df44 27 * @note Create and Destroy methods are not specified here as these are not part
lypinator 0:bb348c97df44 28 * of the interface used by the driver. The application should specify these
lypinator 0:bb348c97df44 29 * as needed and simply supply the driver with a target handle.
lypinator 0:bb348c97df44 30 *
lypinator 0:bb348c97df44 31 * @ingroup port
lypinator 0:bb348c97df44 32 */
lypinator 0:bb348c97df44 33
lypinator 0:bb348c97df44 34 #ifndef _CB_TARGET_H_
lypinator 0:bb348c97df44 35 #define _CB_TARGET_H_
lypinator 0:bb348c97df44 36
lypinator 0:bb348c97df44 37 #include "cb_wlan_types.h"
lypinator 0:bb348c97df44 38
lypinator 0:bb348c97df44 39 #ifdef __cplusplus
lypinator 0:bb348c97df44 40 extern "C" {
lypinator 0:bb348c97df44 41 #endif
lypinator 0:bb348c97df44 42
lypinator 0:bb348c97df44 43 /*===========================================================================
lypinator 0:bb348c97df44 44 * DEFINES
lypinator 0:bb348c97df44 45 *=========================================================================*/
lypinator 0:bb348c97df44 46 #define cbTARGET_SDIO_BLOCK_SIZE (256)
lypinator 0:bb348c97df44 47
lypinator 0:bb348c97df44 48 /*===========================================================================
lypinator 0:bb348c97df44 49 * TYPES
lypinator 0:bb348c97df44 50 *=========================================================================*/
lypinator 0:bb348c97df44 51 typedef struct cbTARGET_Handle cbTARGET_Handle;
lypinator 0:bb348c97df44 52
lypinator 0:bb348c97df44 53 typedef struct cbTARGET_FunctionHandle cbTARGET_FunctionHandle;
lypinator 0:bb348c97df44 54
lypinator 0:bb348c97df44 55 typedef void(*cbTARGET_ISRHandler)(void* hCallback);
lypinator 0:bb348c97df44 56
lypinator 0:bb348c97df44 57
lypinator 0:bb348c97df44 58 typedef enum {
lypinator 0:bb348c97df44 59 cbTARGET_CBTYPE_IRQ,
lypinator 0:bb348c97df44 60 cbTARGET_CBTYPE_START,
lypinator 0:bb348c97df44 61 cbTARGET_CBTYPE_STOP,
lypinator 0:bb348c97df44 62 } cbTARGET_CallbackType;
lypinator 0:bb348c97df44 63
lypinator 0:bb348c97df44 64 typedef enum cbTARGET_SDIO_Function {
lypinator 0:bb348c97df44 65 cbTARGET_SDIO_FUNCTION_0,
lypinator 0:bb348c97df44 66 cbTARGET_SDIO_FUNCTION_1,
lypinator 0:bb348c97df44 67 cbTARGET_SDIO_FUNCTION_2,
lypinator 0:bb348c97df44 68 cbTARGET_SDIO_FUNCTION_3,
lypinator 0:bb348c97df44 69 cbTARGET_SDIO_FUNCTION_4,
lypinator 0:bb348c97df44 70 cbTARGET_SDIO_FUNCTION_5,
lypinator 0:bb348c97df44 71 cbTARGET_SDIO_FUNCTION_6,
lypinator 0:bb348c97df44 72 cbTARGET_SDIO_FUNCTION_7,
lypinator 0:bb348c97df44 73 } cbTARGET_SDIO_Function;
lypinator 0:bb348c97df44 74
lypinator 0:bb348c97df44 75 /*===========================================================================
lypinator 0:bb348c97df44 76 * FUNCTIONS
lypinator 0:bb348c97df44 77 *=========================================================================*/
lypinator 0:bb348c97df44 78
lypinator 0:bb348c97df44 79 /**
lypinator 0:bb348c97df44 80 * Map/resolve target handle from port specific identifier.
lypinator 0:bb348c97df44 81 *
lypinator 0:bb348c97df44 82 * @param targetId Port specific target identifier.
lypinator 0:bb348c97df44 83 * @return Target handle matching target identifier.
lypinator 0:bb348c97df44 84 */
lypinator 0:bb348c97df44 85 cbTARGET_Handle *cbTARGET_targetResolve(cb_int32 targetId);
lypinator 0:bb348c97df44 86
lypinator 0:bb348c97df44 87 /**
lypinator 0:bb348c97df44 88 * Perform a hardware reset of the TARGET.
lypinator 0:bb348c97df44 89 */
lypinator 0:bb348c97df44 90 void cbTARGET_reset(cbTARGET_Handle *hTarget);
lypinator 0:bb348c97df44 91
lypinator 0:bb348c97df44 92 /**
lypinator 0:bb348c97df44 93 * Register a interrupt handler with the TARGET.
lypinator 0:bb348c97df44 94 */
lypinator 0:bb348c97df44 95 void cbTARGET_registerISRHandler(cbTARGET_Handle *hTarget, cbTARGET_ISRHandler handler, void* hContext);
lypinator 0:bb348c97df44 96
lypinator 0:bb348c97df44 97
lypinator 0:bb348c97df44 98 /**
lypinator 0:bb348c97df44 99 * Initiate a SDIO function and return a controlling object.
lypinator 0:bb348c97df44 100 *
lypinator 0:bb348c97df44 101 * @param hTarget Handle to target object.
lypinator 0:bb348c97df44 102 * @param func SDIO function to initiate.
lypinator 0:bb348c97df44 103 * @return Handle to a SDIO function object.
lypinator 0:bb348c97df44 104 */
lypinator 0:bb348c97df44 105 cbTARGET_FunctionHandle* cbTARGET_initFunction(cbTARGET_Handle *hTarget, cbTARGET_SDIO_Function func);
lypinator 0:bb348c97df44 106
lypinator 0:bb348c97df44 107 /**
lypinator 0:bb348c97df44 108 * Write a buffer to the target using SDIO FIFO access.
lypinator 0:bb348c97df44 109 *
lypinator 0:bb348c97df44 110 * @param hFunction Handle to a SDIO target function object.
lypinator 0:bb348c97df44 111 * @param address SDIO address.
lypinator 0:bb348c97df44 112 * @param data Send buffer.
lypinator 0:bb348c97df44 113 * @param dataSize Number of valid data bytes in transfer.
lypinator 0:bb348c97df44 114 * @return True if successful, otherwise FALSE.
lypinator 0:bb348c97df44 115 */
lypinator 0:bb348c97df44 116 cb_boolean cbTARGET_FIFOWrite(cbTARGET_FunctionHandle* hFunction, cb_uint32 address, cb_uint8* data, cb_uint32 dataSize);
lypinator 0:bb348c97df44 117
lypinator 0:bb348c97df44 118 /**
lypinator 0:bb348c97df44 119 * Read from the target into a buffer using SDIO FIFO access.
lypinator 0:bb348c97df44 120 *
lypinator 0:bb348c97df44 121 * @param hFunction Handle to a SDIO target function object.
lypinator 0:bb348c97df44 122 * @param address SDIO address.
lypinator 0:bb348c97df44 123 * @param data Receive buffer.
lypinator 0:bb348c97df44 124 * @param dataSize Number of valid data bytes in transfer.
lypinator 0:bb348c97df44 125 * @return TRUE if successful, otherwise FALSE.
lypinator 0:bb348c97df44 126 */
lypinator 0:bb348c97df44 127 cb_boolean cbTARGET_FIFORead(cbTARGET_FunctionHandle* hFunction, cb_uint32 address, cb_uint8* data, cb_uint32 dataSize);
lypinator 0:bb348c97df44 128
lypinator 0:bb348c97df44 129 /**
lypinator 0:bb348c97df44 130 * Write a buffer to the target.
lypinator 0:bb348c97df44 131 *
lypinator 0:bb348c97df44 132 * @param hFunction Handle to a SDIO target function object.
lypinator 0:bb348c97df44 133 * @param address SDIO address.
lypinator 0:bb348c97df44 134 * @param data Send buffer.
lypinator 0:bb348c97df44 135 * @param dataSize Number of valid data bytes in transfer.
lypinator 0:bb348c97df44 136 * @return True if successful, otherwise FALSE.
lypinator 0:bb348c97df44 137 */
lypinator 0:bb348c97df44 138 cb_boolean cbTARGET_write(cbTARGET_FunctionHandle* hFunction, cb_uint32 address, cb_uint8* data, cb_uint32 dataSize);
lypinator 0:bb348c97df44 139
lypinator 0:bb348c97df44 140 /**
lypinator 0:bb348c97df44 141 * Read from the target into a buffer.
lypinator 0:bb348c97df44 142 *
lypinator 0:bb348c97df44 143 * @param hFunction Handle to a SDIO target function object.
lypinator 0:bb348c97df44 144 * @param address SDIO address.
lypinator 0:bb348c97df44 145 * @param data Receive buffer.
lypinator 0:bb348c97df44 146 * @param dataSize Number of valid data bytes in transfer.
lypinator 0:bb348c97df44 147 * @return TRUE if successful, otherwise FALSE.
lypinator 0:bb348c97df44 148 */
lypinator 0:bb348c97df44 149 cb_boolean cbTARGET_read(cbTARGET_FunctionHandle* hFunction, cb_uint32 address, cb_uint8* data, cb_uint32 dataSize);
lypinator 0:bb348c97df44 150
lypinator 0:bb348c97df44 151 /**
lypinator 0:bb348c97df44 152 * Write a single byte to the function 0 of the SDIO target.
lypinator 0:bb348c97df44 153 *
lypinator 0:bb348c97df44 154 * @param hTarget Handle to target object.
lypinator 0:bb348c97df44 155 * @param address SDIO address.
lypinator 0:bb348c97df44 156 * @param data Send buffer.
lypinator 0:bb348c97df44 157 * @return True if successful, otherwise FALSE.
lypinator 0:bb348c97df44 158 */
lypinator 0:bb348c97df44 159 cb_boolean cbTARGET_f0_writeByte(cbTARGET_Handle *hTarget, cb_uint32 address, cb_uint8 data);
lypinator 0:bb348c97df44 160
lypinator 0:bb348c97df44 161 /**
lypinator 0:bb348c97df44 162 * Read a single byte from the function 0 of the SDIO target.
lypinator 0:bb348c97df44 163 *
lypinator 0:bb348c97df44 164 * @param hTarget Handle to target object.
lypinator 0:bb348c97df44 165 * @param address SDIO address.
lypinator 0:bb348c97df44 166 * @param data Receive buffer.
lypinator 0:bb348c97df44 167 * @return TRUE if successful, otherwise FALSE.
lypinator 0:bb348c97df44 168 */
lypinator 0:bb348c97df44 169 cb_boolean cbTARGET_f0_readByte(cbTARGET_Handle *hTarget, cb_uint32 address, cb_uint8 *data);
lypinator 0:bb348c97df44 170
lypinator 0:bb348c97df44 171
lypinator 0:bb348c97df44 172 cb_uint16 cbTARGET_getBlockSize(cbTARGET_Handle *hTarget);
lypinator 0:bb348c97df44 173
lypinator 0:bb348c97df44 174 #ifdef __cplusplus
lypinator 0:bb348c97df44 175 }
lypinator 0:bb348c97df44 176 #endif
lypinator 0:bb348c97df44 177
lypinator 0:bb348c97df44 178 #endif