Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop dfd03160d -> 83309483d


remove legacy hal files for native


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/abd1d90d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/abd1d90d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/abd1d90d

Branch: refs/heads/develop
Commit: abd1d90de03a60f1d4446909c6dac04301688234
Parents: dfd0316
Author: Sterling Hughes <sterl...@apache.org>
Authored: Thu Sep 22 22:46:38 2016 -0700
Committer: Sterling Hughes <sterl...@apache.org>
Committed: Thu Sep 22 22:46:38 2016 -0700

----------------------------------------------------------------------
 hw/mcu/native/src/hal_adc.c | 239 ---------------------------------------
 hw/mcu/native/src/hal_dac.c | 115 -------------------
 hw/mcu/native/src/hal_pwm.c | 134 ----------------------
 3 files changed, 488 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/abd1d90d/hw/mcu/native/src/hal_adc.c
----------------------------------------------------------------------
diff --git a/hw/mcu/native/src/hal_adc.c b/hw/mcu/native/src/hal_adc.c
deleted file mode 100644
index f54acc7..0000000
--- a/hw/mcu/native/src/hal_adc.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.
- */
-#if 0
-#include <fcntl.h>
-#include <unistd.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <hal/hal_adc.h>
-#include <hal/hal_adc_int.h>
-#include <mcu/mcu_hal.h>
-
-
-/* forwards for the const structure below */
-static int native_adc_rand_read(struct hal_adc *padc);
-static int native_adc_rand_bits(struct hal_adc *padc);
-static int native_adc_rand_refmv(struct hal_adc *padc);
-
-/* This ADC had two channels that return 8-bit 
- * random numbers */
-const struct hal_adc_funcs random_adc_funcs = {
-    .hadc_get_ref_mv = &native_adc_rand_refmv,
-    .hadc_get_bits = &native_adc_rand_bits,
-    .hadc_read = &native_adc_rand_read,
-};
-
-struct hal_adc * 
-native_adc_random_create(enum native_adc_channel chan) 
-{
-    struct hal_adc *padc = NULL;
-    if ((chan == MCU_ADC_CHANNEL_0) || (chan == MCU_ADC_CHANNEL_1)) {
-        padc = malloc(sizeof(struct hal_adc));
-        
-        if (padc) {
-            padc->driver_api = &random_adc_funcs;
-            
-            /* no other internal state to set */
-        }
-    }
-    return padc;
-}
-
-static int 
-native_adc_rand_bits(struct hal_adc *padc) 
-{
-    if (padc && padc->driver_api == &random_adc_funcs) {
-         return 8;        
-    }
-    return -1;
-}
-
-static int 
-native_adc_rand_refmv(struct hal_adc *padc) 
-{
-    if (padc && padc->driver_api == &random_adc_funcs) {
-        return 5000;    
-    }
-    return -1;
-}
-
-static int 
-native_adc_rand_read(struct hal_adc *padc) 
-{
-    if (padc && padc->driver_api == &random_adc_funcs) {
-    return rand() & 0xff;
-    }
-    return -1;    
-}
-
-/* forwards for the const structure below */
-static int native_adc_mmm_read(struct hal_adc *padc);
-static int native_adc_mmm_get_bits(struct hal_adc *padc);
-static int native_adc_mmm_get_refmv(struct hal_adc *padc);
-
-/* This ADC had two channels that return 8-bit 
- * random numbers */
-const struct hal_adc_funcs mmm_adc_funcs = {
-    .hadc_get_ref_mv = &native_adc_mmm_get_refmv,
-    .hadc_get_bits = &native_adc_mmm_get_bits,
-    .hadc_read = &native_adc_mmm_read,
-};
-
-/* This driver needs to keep a bit of state */
-struct mmm_adc_device {
-    struct hal_adc parent;
-    enum native_adc_channel  channel;   
-};
-
-struct hal_adc*
-native_adc_mmm_create(enum native_adc_channel  chan) 
-{
-    struct mmm_adc_device *padc = NULL;
-    if ((chan == MCU_ADC_CHANNEL_2) ||
-        (chan == MCU_ADC_CHANNEL_3) ||
-        (chan == MCU_ADC_CHANNEL_4)) {
-        padc = malloc(sizeof(struct mmm_adc_device));
-        
-        if (padc) {
-            padc->parent.driver_api = &mmm_adc_funcs;
-            padc->channel = chan;
-        }
-    }
-    return &padc->parent;
-}
-
-static int 
-native_adc_mmm_get_bits(struct hal_adc *padc) 
-{
-    if (padc && padc->driver_api == &mmm_adc_funcs) {
-         return 12;        
-    }
-    return -1;
-}
-
-static int 
-native_adc_mmm_get_refmv(struct hal_adc *padc) 
-{
-    if (padc && padc->driver_api == &mmm_adc_funcs) {
-        return 3300;    
-    }
-    return -1;
-}
-
-static int 
-native_adc_mmm_read(struct hal_adc *padc) 
-{
-    struct mmm_adc_device *pmmmadc = (struct mmm_adc_device*) padc;
-    
-    if (padc && padc->driver_api == &mmm_adc_funcs) {
-
-        switch(pmmmadc->channel) {
-            case MCU_ADC_CHANNEL_2:
-                return 0;
-            case MCU_ADC_CHANNEL_3:
-                return 0xfff >> 1;
-            case MCU_ADC_CHANNEL_4:
-                return 0xfff;
-            default:
-                break;
-        }
-    }
-    
-    return -1;    
-}
-
-/* forwards for the const structure below */
-static int native_adc_file_read(struct hal_adc *padc);
-static int native_adc_file_get_bits(struct hal_adc *padc);
-static int native_adc_file_get_refmv(struct hal_adc *padc);
-
-/* This ADC had two channels that return 8-bit 
- * random numbers */
-const struct hal_adc_funcs file_adc_funcs = {
-    .hadc_get_ref_mv = &native_adc_file_get_refmv,
-    .hadc_get_bits = &native_adc_file_get_bits,
-    .hadc_read = &native_adc_file_read,
-};
-
-/* This driver needs to keep a bit of state */
-struct file_adc_device {
-    struct hal_adc  parent;
-    int             native_fs;
-};
-
-struct hal_adc*
-native_adc_file_create(enum native_adc_channel chan, const char *fname) 
-{
-    struct file_adc_device *padc = NULL;
-    if (chan == MCU_ADC_CHANNEL_5) {
-        padc = malloc(sizeof(struct file_adc_device));
-        
-        if (padc) {
-            padc->parent.driver_api = &file_adc_funcs;
-            padc->native_fs = open(fname, O_RDONLY);
-            if (padc->native_fs < 0) {
-                free(padc);
-                padc = NULL;
-            }
-        } 
-    }
-    return &padc->parent;
-}
-
-static int 
-native_adc_file_get_bits(struct hal_adc *padc) 
-{
-    if (padc && padc->driver_api == &file_adc_funcs) {
-         return 8;        
-    }
-    return -1;
-}
-
-static int 
-native_adc_file_get_refmv(struct hal_adc *padc) 
-{
-    if (padc && padc->driver_api == &file_adc_funcs) {
-        return 3600;    
-    }
-    return -1;
-}
-
-static int 
-native_adc_file_read(struct hal_adc *padc) 
-{
-    uint8_t val;
-    int rc;    
-    struct file_adc_device *pfileadc = (struct file_adc_device*) padc;
-    
-    if ( padc && (padc->driver_api == &file_adc_funcs) && 
-         (pfileadc->native_fs > 0) ){
-        
-        rc = read(pfileadc->native_fs,  &val, 1);
-
-        if (rc == 1) {
-            return (int) val;
-        } else {
-            close(pfileadc->native_fs);
-        }      
-    }
-    
-    return -1;    
-}
-
-#endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/abd1d90d/hw/mcu/native/src/hal_dac.c
----------------------------------------------------------------------
diff --git a/hw/mcu/native/src/hal_dac.c b/hw/mcu/native/src/hal_dac.c
deleted file mode 100644
index d5055ce..0000000
--- a/hw/mcu/native/src/hal_dac.c
+++ /dev/null
@@ -1,115 +0,0 @@
-#if 0
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.
- */
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <hal/hal_dac.h>
-#include <hal/hal_dac_int.h>
-#include <mcu/hal_dac.h>
-
-/* forwards for the const structure below */
-static int native_dac_write(struct hal_dac *pdac, int val);
-static int native_dac_bits(struct hal_dac *pdac);
-static int native_dac_current(struct hal_dac *pdac);
-static int native_dac_refmv(struct hal_dac *pdac);
-
-/* This DAC had four channels that print out the value  
- * random numbers */
-const struct hal_dac_funcs native_dac_funcs = {
-    .hdac_current = &native_dac_current,
-    .hdac_get_ref_mv = &native_dac_refmv,
-    .hdac_get_bits = &native_dac_bits,
-    .hdac_write = &native_dac_write,
-};
-
-struct native_hal_dac {
-    struct hal_dac parent;
-    uint8_t        channel;
-    uint8_t        last_written_val;
-};
-
-struct hal_dac * 
-native_dac_create(enum native_dac_channel chan) 
-{
-    struct native_hal_dac *pdac = NULL;
-    
-    switch(chan) {
-        case NATIVE_MCU_DAC0:
-        case NATIVE_MCU_DAC1:
-        case NATIVE_MCU_DAC2:
-        case NATIVE_MCU_DAC3:
-            pdac = malloc(sizeof(struct native_hal_dac));
-            if (pdac) {
-                pdac->parent.driver_api = &native_dac_funcs;
-                pdac->channel = chan;
-                pdac->last_written_val = 0;
-            }
-    }    
-    return &pdac->parent;
-}
-
-int 
-native_dac_bits(struct hal_dac *pdac) 
-{
-    struct native_hal_dac *pn = (struct native_hal_dac *) pdac;
-    if (pn && pn->parent.driver_api == &native_dac_funcs) {
-         return 8;        
-    }
-    return -1;
-}
-
-int 
-native_dac_refmv(struct hal_dac *pdac) 
-{
-    struct native_hal_dac *pn = (struct native_hal_dac *) pdac;
-    if (pn && pn->parent.driver_api == &native_dac_funcs) {
-         return 5000;        
-    }
-    return -1;
-}
-
-
-int 
-native_dac_current(struct hal_dac *pdac) 
-{
-    struct native_hal_dac *pn = (struct native_hal_dac *) pdac;
-    if (pn && pn->parent.driver_api == &native_dac_funcs) {
-         return (int) pn->last_written_val;        
-    }
-    return -1;
-}
-
-int 
-native_dac_write(struct hal_dac *pdac, int val) 
-{
-    struct native_hal_dac *pn = (struct native_hal_dac *) pdac;
-    
-    if (val > 255) {
-        val = 255;
-    }
-        
-    if (pn && pn->parent.driver_api == &native_dac_funcs) {
-        pn->last_written_val = val;
-        return 0;
-    }
-    return -1;    
-}
-#endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/abd1d90d/hw/mcu/native/src/hal_pwm.c
----------------------------------------------------------------------
diff --git a/hw/mcu/native/src/hal_pwm.c b/hw/mcu/native/src/hal_pwm.c
deleted file mode 100644
index 032bcad..0000000
--- a/hw/mcu/native/src/hal_pwm.c
+++ /dev/null
@@ -1,134 +0,0 @@
-#if 0
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.
- */
-
-#include <inttypes.h>
-#include <stdlib.h>
-#include <hal/hal_pwm.h>
-#include <hal/hal_pwm_int.h>
-#include <mcu/hal_pwm.h>
-#include <console/console.h>
-
-/* if you change this, you have to change sizes below */
-#define NATIVE_PWM_BITS (16)
-#define NATIVE_PWM_CLK_FREQ_HZ  (1000000)
-
-struct native_pwm_drv {
-    struct hal_pwm   driver;    
-    uint8_t          channel;
-    uint8_t          status;
-    uint16_t         on_ticks;
-    uint16_t         period_ticks;
-};
-
-static int native_pwm_off(struct hal_pwm *ppwm);
-static int native_pwm_enable_duty(struct hal_pwm *ppwm, uint16_t frac_duty);
-static int native_pwm_get_bits(struct hal_pwm *ppwm);
-static int native_pwm_get_clock(struct hal_pwm *ppwm);
-
-/* the function API for the driver  */
-static const struct hal_pwm_funcs  native_pwm_funcs = 
-{
-    .hpwm_get_bits = &native_pwm_get_bits,
-    .hpwm_get_clk = &native_pwm_get_clock,
-    .hpwm_disable = &native_pwm_off,
-    .hpwm_ena_duty = &native_pwm_enable_duty,
-};
-
-struct hal_pwm *
-native_pwm_create (enum native_pwm_channel chan)
-{
-    struct native_pwm_drv *ppwm;
-    
-    if(chan >= NATIVE_MCU_PWM_MAX) 
-    {
-        return NULL;
-    }
-    
-    ppwm = malloc(sizeof(struct native_pwm_drv));
-    
-    if(ppwm) 
-    {
-        ppwm->driver.driver_api =  &native_pwm_funcs;
-        ppwm->period_ticks = 0xffff;        
-        /* 50% duty cycle */
-        ppwm->on_ticks = ppwm->period_ticks >> 1;
-        ppwm->status = 0;
-        ppwm->channel = chan;
-    }
-    return &ppwm->driver;
-}
-
-int 
-native_pwm_on(struct hal_pwm *ppwm) 
-{
-    struct native_pwm_drv *pn = (struct native_pwm_drv *) ppwm;
-    if(pn) 
-    {
-        console_printf("Device %p %d started with period=%u on=%u\n", 
-                pn, pn->channel, pn->period_ticks, pn->on_ticks);
-        return 0;
-    }
-    return -1;
-}
-
-int 
-native_pwm_off(struct hal_pwm *ppwm)
-{
-    struct native_pwm_drv *pn = (struct native_pwm_drv *) ppwm;
- 
-    if(pn) 
-    {
-        console_printf("Device %p %d stopped with period=%u on=%u\n", 
-                pn, pn->channel, pn->period_ticks, pn->on_ticks);    
-        return 0;
-    }
-
-    return -1;
-}
-
-static int native_pwm_get_bits(struct hal_pwm *ppwm) {
-    if(ppwm) {
-        return NATIVE_PWM_BITS;
-    }
-    return -1;
-}
-
-static int native_pwm_get_clock(struct hal_pwm *ppwm) {
-    if(ppwm) {
-        return NATIVE_PWM_CLK_FREQ_HZ;
-    }
-    return -1;
-    
-}
-
-int 
-native_pwm_enable_duty(struct hal_pwm *ppwm, uint16_t fraction)
-{
-    struct native_pwm_drv *pn = (struct native_pwm_drv *) ppwm;
- 
-    if(pn) 
-    {    
-        pn->period_ticks = 65535;
-        pn->on_ticks = fraction;
-        return 0;
-    }
-    return -2;
-}
-#endif

Reply via email to