| /* |
| * ANT Stack |
| * |
| * Copyright 2009 Dynastream Innovations |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| /******************************************************************************\ |
| * |
| * FILE NAME: ANT_utils.c |
| * |
| * BRIEF: |
| * This file contains utility functions |
| * |
| * |
| \******************************************************************************/ |
| |
| #include "ant_types.h" |
| #include "ant_utils.h" |
| |
| |
| ANT_U16 ANT_UTILS_BEtoHost16(ANT_U8 * num) |
| { |
| return (ANT_U16)(((ANT_U16) *(num) << 8) | ((ANT_U16) *(num+1))); |
| } |
| ANT_U16 ANT_UTILS_LEtoHost16(ANT_U8 * num) |
| { |
| return (ANT_U16)(((ANT_U16) *(num+1) << 8) | ((ANT_U16) *(num))); |
| } |
| void ANT_UTILS_StoreBE16(ANT_U8 *buff, ANT_U16 be_value) |
| { |
| buff[0] = (ANT_U8)(be_value>>8); |
| buff[1] = (ANT_U8)be_value; |
| } |
| void ANT_UTILS_StoreLE16(ANT_U8 *buff, ANT_U16 le_value) |
| { |
| buff[1] = (ANT_U8)(le_value>>8); |
| buff[0] = (ANT_U8)le_value; |
| } |
| |
| void ANT_UTILS_StoreBE32(ANT_U8 *buff, ANT_U32 be_value) |
| { |
| buff[0] = (ANT_U8)(be_value>>24); |
| buff[1] = (ANT_U8)(be_value>>16); |
| buff[2] = (ANT_U8)(be_value>>8); |
| buff[3] = (ANT_U8)be_value; |
| } |