From 7dd383f1946b198b8de1bbb08f1f06f03d16b120 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Mon, 22 Jan 2007 19:25:21 +0000 Subject: Merged revisions 1877 via svnmerge from https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1877 | kpfleming | 2007-01-22 12:58:34 -0600 (Mon, 22 Jan 2007) | 2 lines update to PR47 Octasic API kit, and use new GetCapacityPins API call to only attempt downloading the correct firmware for the modules we find ........ git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@1878 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- wct4xxp/vpm450m.c | 61 +++++++++++++++++++++++++------------------------------ 1 file changed, 28 insertions(+), 33 deletions(-) (limited to 'wct4xxp/vpm450m.c') diff --git a/wct4xxp/vpm450m.c b/wct4xxp/vpm450m.c index 89874ac..33e1164 100644 --- a/wct4xxp/vpm450m.c +++ b/wct4xxp/vpm450m.c @@ -10,12 +10,9 @@ #include #include #include -#ifdef HOTPLUG_FIRMWARE -#include -#endif -#include "oct6100api/oct6100_api.h" #include "vpm450m.h" +#include "oct6100api/oct6100_api.h" /* API for Octasic access */ UINT32 Oct6100UserGetTime(tPOCT6100_GET_TIME f_pTime) @@ -284,11 +281,8 @@ int vpm450m_checkirq(struct vpm450m *vpm450m) Oct6100InterruptServiceRoutineDef(&InterruptFlags); Oct6100InterruptServiceRoutine(vpm450m->pApiInstance, &InterruptFlags); - if (InterruptFlags.fToneEventsPending) { - printk("VPM450M: Tone events pending!\n"); - return 1; - } - return 0; + + return InterruptFlags.fToneEventsPending ? 1 : 0; } int vpm450m_getdtmf(struct vpm450m *vpm450m, int *channel, int *tone, int *start) @@ -370,11 +364,28 @@ int vpm450m_getdtmf(struct vpm450m *vpm450m, int *channel, int *tone, int *start return 0; } -#ifdef HOTPLUG_FIRMWARE +unsigned int get_vpm450m_capacity(void *wc) +{ + UINT32 ulResult; + + tOCT6100_API_GET_CAPACITY_PINS CapacityPins; + + Oct6100ApiGetCapacityPinsDef(&CapacityPins); + CapacityPins.pProcessContext = wc; + CapacityPins.ulMemoryType = cOCT6100_MEM_TYPE_DDR; + CapacityPins.fEnableMemClkOut = TRUE; + CapacityPins.ulMemClkFreq = cOCT6100_MCLK_FREQ_133_MHZ; + + ulResult = Oct6100ApiGetCapacityPins(&CapacityPins); + if (ulResult != cOCT6100_ERR_OK) { + printk("Failed to get chip capacity, code %08x!\n", ulResult); + return 0; + } + + return CapacityPins.ulCapacityValue; +} + struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans, const struct firmware *firmware) -#else -struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans) -#endif { tOCT6100_CHIP_OPEN ChipOpen; tOCT6100_GET_INSTANCE_SIZE InstanceSize; @@ -383,9 +394,9 @@ struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans) struct vpm450m *vpm450m; int x,y,law; - vpm450m = kmalloc(sizeof(struct vpm450m), GFP_KERNEL); - if (!vpm450m) + if (!(vpm450m = kmalloc(sizeof(struct vpm450m), GFP_KERNEL))) return NULL; + memset(vpm450m, 0, sizeof(struct vpm450m)); for (x=0;x<128;x++) vpm450m->ecmode[x] = -1; @@ -401,24 +412,8 @@ struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans) ChipOpen.pProcessContext = wc; -#ifdef HOTPLUG_FIRMWARE ChipOpen.pbyImageFile = firmware->data; ChipOpen.ulImageSize = firmware->size; -#else - if (vpm450m->numchans > 64) { - extern const unsigned char _binary_OCT6114_128D_ima_start[]; - extern const unsigned int _binary_OCT6114_128D_ima_size; - - ChipOpen.pbyImageFile = _binary_OCT6114_128D_ima_start; - ChipOpen.ulImageSize = _binary_OCT6114_128D_ima_size; - } else { - extern const unsigned char _binary_OCT6114_64D_ima_start[]; - extern const unsigned int _binary_OCT6114_64D_ima_size; - - ChipOpen.pbyImageFile = _binary_OCT6114_64D_ima_start; - ChipOpen.ulImageSize = _binary_OCT6114_64D_ima_size; - } -#endif ChipOpen.fEnableMemClkOut = TRUE; ChipOpen.ulMemClkFreq = cOCT6100_MCLK_FREQ_133_MHZ; @@ -448,9 +443,7 @@ struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans) return NULL; } - printk("Before chip open!\n"); ulResult = Oct6100ChipOpen(vpm450m->pApiInstance, &ChipOpen); - printk("After chip open!\n"); if (ulResult != cOCT6100_ERR_OK) { printk("Failed to open chip, code %08x!\n", ulResult); kfree(vpm450m); @@ -504,6 +497,7 @@ struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans) } } } + return vpm450m; } @@ -511,6 +505,7 @@ void release_vpm450m(struct vpm450m *vpm450m) { UINT32 ulResult; tOCT6100_CHIP_CLOSE ChipClose; + Oct6100ChipCloseDef(&ChipClose); ulResult = Oct6100ChipClose(vpm450m->pApiInstance, &ChipClose); if (ulResult != cOCT6100_ERR_OK) { -- cgit v1.2.3