Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
hal.h
00001 /******************** (C) COPYRIGHT 2012 STMicroelectronics ******************** 00002 * File Name : hal.h 00003 * Author : AMS - HEA&RF BU 00004 * Version : V1.0.0 00005 * Date : 19-July-2012 00006 * Description : Header file which defines Hardware abstraction layer APIs 00007 * used by the BLE stack. It defines the set of functions 00008 * which needs to be ported to the target platform. 00009 ******************************************************************************** 00010 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 00011 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 00012 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 00013 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 00014 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 00015 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 00016 *******************************************************************************/ 00017 #ifndef __HAL_H__ 00018 #define __HAL_H__ 00019 00020 /****************************************************************************** 00021 * Includes 00022 *****************************************************************************/ 00023 #include <hal_types.h> 00024 #include <ble_status.h> 00025 00026 00027 /****************************************************************************** 00028 * Macros 00029 *****************************************************************************/ 00030 /* Little Endian buffer to host endianess conversion */ 00031 #define LE_TO_HOST_16(ptr) (uint16_t) ( ((uint16_t) \ 00032 *((uint8_t *)ptr)) | \ 00033 ((uint16_t) \ 00034 *((uint8_t *)ptr + 1) << 8 ) ) 00035 00036 #define LE_TO_HOST_32(ptr) (uint32_t) ( ((uint32_t) \ 00037 *((uint8_t *)ptr)) | \ 00038 ((uint32_t) \ 00039 *((uint8_t *)ptr + 1) << 8) | \ 00040 ((uint32_t) \ 00041 *((uint8_t *)ptr + 2) << 16) | \ 00042 ((uint32_t) \ 00043 *((uint8_t *)ptr + 3) << 24) ) 00044 00045 /* Big Endian buffer to host endianess conversion */ 00046 #define BE_TO_HOST_16(ptr) (uint16_t) ( ((uint16_t) \ 00047 *((uint8_t *)ptr)) << 8 | \ 00048 ((uint16_t) \ 00049 *((uint8_t *)ptr + 1) ) ) 00050 00051 /* Store Value into a buffer in Little Endian Format */ 00052 #define HOST_TO_LE_16(buf, val) ( ((buf)[0] = (uint8_t) (val) ) , \ 00053 ((buf)[1] = (uint8_t) (val>>8) ) ) 00054 00055 #define HOST_TO_LE_32(buf, val) ( ((buf)[0] = (uint8_t) (val) ) , \ 00056 ((buf)[1] = (uint8_t) (val>>8) ) , \ 00057 ((buf)[2] = (uint8_t) (val>>16) ) , \ 00058 ((buf)[3] = (uint8_t) (val>>24) ) ) 00059 00060 00061 /* Store Value into a buffer in Big Endian Format */ 00062 #define HOST_TO_BE_16(buf, val) ( ((buf)[1] = (uint8_t) (val) ) , \ 00063 ((buf)[0] = (uint8_t) (val>>8) ) ) 00064 00065 /****************************************************************************** 00066 * Types 00067 *****************************************************************************/ 00068 00069 /****************************************************************************** 00070 * Function Prototypes 00071 *****************************************************************************/ 00072 00073 /** 00074 * Writes data to a serial interface. 00075 * 00076 * @param[in] data1 1st buffer 00077 * @param[in] data2 2nd buffer 00078 * @param[in] n_bytes1 number of bytes in 1st buffer 00079 * @param[in] n_bytes2 number of bytes in 2nd buffer 00080 */ 00081 //void Hal_Write_Serial(const void* data1, const void* data2, uint16_t n_bytes1, uint16_t n_bytes2); 00082 00083 /** 00084 * Enable interrupts from HCI controller. 00085 */ 00086 void Enable_SPI_IRQ(void); 00087 00088 /** 00089 * Disable interrupts from BLE controller. 00090 */ 00091 void Disable_SPI_IRQ(void); 00092 00093 void Hal_Init_Timer(); 00094 uint32_t Hal_Get_Timer_Value(); 00095 void Hal_Start_Timer(uint32_t timeout); 00096 void Hal_Stop_Timer(); 00097 00098 #endif /* __HAL_H__ */ 00099
Generated on Tue Jul 12 2022 17:28:29 by
1.7.2