xpp: echo_loader: whitespace cleanup
Signed-off-by: Oron Peled <oron.peled@xorcom.com> Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com> git-svn-id: http://svn.astersk.org/svn/dahdi/tools/trunk@10500 17933a7a-c749-41c5-a318-cba88f637d49
This commit is contained in:
parent
bccb264100
commit
273230b044
@ -141,7 +141,7 @@ static int usb_buffer_flush(struct astribank_device *astribank, struct usb_buffe
|
|||||||
if (ub->curr == 0)
|
if (ub->curr == 0)
|
||||||
return 0;
|
return 0;
|
||||||
ret = xusb_send(astribank->xusb, ub->data, ub->curr, TIMEOUT);
|
ret = xusb_send(astribank->xusb, ub->data, ub->curr, TIMEOUT);
|
||||||
if(ret < 0) {
|
if (ret < 0) {
|
||||||
AB_ERR(astribank, "xusb_send failed: %d\n", ret);
|
AB_ERR(astribank, "xusb_send failed: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -208,15 +208,18 @@ static int usb_buffer_send(struct astribank_device *astribank, struct usb_buffer
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
ret = xusb_recv(astribank->xusb, buf, PACKET_SIZE, TIMEOUT);
|
ret = xusb_recv(astribank->xusb, buf, PACKET_SIZE, TIMEOUT);
|
||||||
if(ret <= 0) {
|
if (ret <= 0) {
|
||||||
AB_ERR(astribank, "No USB packs to read: %s\n", strerror(-ret));
|
AB_ERR(astribank, "No USB packs to read: %s\n", strerror(-ret));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
DBG("%s: %d bytes recv\n", __func__, ret);
|
DBG("%s: %d bytes recv\n", __func__, ret);
|
||||||
phead = (struct xpp_packet_header *)buf;
|
phead = (struct xpp_packet_header *)buf;
|
||||||
if(phead->header.op != SPI_RCV_XOP && phead->header.op != TST_RCV_XOP) {
|
if (phead->header.op != SPI_RCV_XOP &&
|
||||||
AB_ERR(astribank, "Got unexpected reply OP=0x%02X\n", phead->header.op);
|
phead->header.op != TST_RCV_XOP) {
|
||||||
dump_packet(LOG_ERR, DBG_MASK, "hexline[ERR]", buf, ret);
|
AB_ERR(astribank, "Got unexpected reply OP=0x%02X\n",
|
||||||
|
phead->header.op);
|
||||||
|
dump_packet(LOG_ERR, DBG_MASK, "hexline[ERR]",
|
||||||
|
buf, ret);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
dump_packet(LOG_DEBUG, DBG_MASK, "dump:echoline[R]", (char *)phead, phead->header.len);
|
dump_packet(LOG_DEBUG, DBG_MASK, "dump:echoline[R]", (char *)phead, phead->header.len);
|
||||||
@ -240,14 +243,16 @@ int spi_send(struct astribank_device *astribank, uint16_t addr, uint16_t data, i
|
|||||||
char buf[PACKET_SIZE];
|
char buf[PACKET_SIZE];
|
||||||
struct xpp_packet_header *phead = (struct xpp_packet_header *)buf;
|
struct xpp_packet_header *phead = (struct xpp_packet_header *)buf;
|
||||||
int pack_len;
|
int pack_len;
|
||||||
|
int spi_flags;
|
||||||
|
|
||||||
assert(astribank != NULL);
|
assert(astribank != NULL);
|
||||||
|
spi_flags = 0x30 | (recv_answer ? 0x40 : 0x00) | (ver ? 0x01 : 0x00);
|
||||||
pack_len = sizeof(phead->header) + sizeof(phead->alt.spi_pack);
|
pack_len = sizeof(phead->header) + sizeof(phead->alt.spi_pack);
|
||||||
phead->header.len = pack_len;
|
phead->header.len = pack_len;
|
||||||
phead->header.op = SPI_SND_XOP;
|
phead->header.op = SPI_SND_XOP;
|
||||||
phead->header.unit = 0x40; /* EC has always this unit num */
|
phead->header.unit = 0x40; /* EC has always this unit num */
|
||||||
phead->alt.spi_pack.header = 0x05;
|
phead->alt.spi_pack.header = 0x05;
|
||||||
phead->alt.spi_pack.flags = 0x30 | (recv_answer ? 0x40: 0x00) | (ver ? 0x01: 0x00);
|
phead->alt.spi_pack.flags = spi_flags;
|
||||||
phead->alt.spi_pack.addr_l = (addr >> 0) & 0xFF;
|
phead->alt.spi_pack.addr_l = (addr >> 0) & 0xFF;
|
||||||
phead->alt.spi_pack.addr_h = (addr >> 8) & 0xFF;
|
phead->alt.spi_pack.addr_h = (addr >> 8) & 0xFF;
|
||||||
phead->alt.spi_pack.data_l = (data >> 0) & 0xFF;
|
phead->alt.spi_pack.data_l = (data >> 0) & 0xFF;
|
||||||
@ -257,7 +262,7 @@ int spi_send(struct astribank_device *astribank, uint16_t addr, uint16_t data, i
|
|||||||
|
|
||||||
|
|
||||||
ret = usb_buffer_send(astribank, &usb_buffer, buf, pack_len, TIMEOUT, recv_answer);
|
ret = usb_buffer_send(astribank, &usb_buffer, buf, pack_len, TIMEOUT, recv_answer);
|
||||||
if(ret < 0) {
|
if (ret < 0) {
|
||||||
AB_ERR(astribank, "usb_buffer_send failed: %d\n", ret);
|
AB_ERR(astribank, "usb_buffer_send failed: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -267,29 +272,30 @@ int spi_send(struct astribank_device *astribank, uint16_t addr, uint16_t data, i
|
|||||||
|
|
||||||
int test_send(struct astribank_device *astribank)
|
int test_send(struct astribank_device *astribank)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char buf[PACKET_SIZE];
|
char buf[PACKET_SIZE];
|
||||||
struct xpp_packet_header *phead = (struct xpp_packet_header *)buf;
|
struct xpp_packet_header *phead = (struct xpp_packet_header *)buf;
|
||||||
int pack_len;
|
int pack_len;
|
||||||
|
|
||||||
assert(astribank != NULL);
|
assert(astribank != NULL);
|
||||||
pack_len = sizeof(phead->header) + sizeof(phead->alt.tst_pack);
|
pack_len = sizeof(phead->header) + sizeof(phead->alt.tst_pack);
|
||||||
phead->header.len = 6;
|
phead->header.len = 6;
|
||||||
phead->header.op = 0x35;
|
phead->header.op = 0x35;
|
||||||
phead->header.unit = 0x00;
|
phead->header.unit = 0x00;
|
||||||
phead->alt.tst_pack.tid = 0x28; // EC TestId
|
phead->alt.tst_pack.tid = 0x28; /* EC TestId */
|
||||||
phead->alt.tst_pack.tsid = 0x00; // EC SubId
|
phead->alt.tst_pack.tsid = 0x00; /* EC SubId */
|
||||||
|
|
||||||
dump_packet(LOG_DEBUG, DBG_MASK, "dump:echoline[W]", (char *)phead, pack_len);
|
dump_packet(LOG_DEBUG, DBG_MASK, "dump:echoline[W]",
|
||||||
|
(char *)phead, pack_len);
|
||||||
|
|
||||||
|
ret = usb_buffer_send(astribank,
|
||||||
ret = usb_buffer_send(astribank, &usb_buffer, buf, pack_len, TIMEOUT, 1);
|
&usb_buffer, buf, pack_len, TIMEOUT, 1);
|
||||||
if(ret < 0) {
|
if (ret < 0) {
|
||||||
AB_ERR(astribank, "usb_buffer_send failed: %d\n", ret);
|
AB_ERR(astribank, "usb_buffer_send failed: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
DBG("%s: Written %d bytes\n", __func__, ret);
|
DBG("%s: Written %d bytes\n", __func__, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int echo_send_data(struct astribank_device *astribank, const unsigned int addr, const unsigned int data)
|
int echo_send_data(struct astribank_device *astribank, const unsigned int addr, const unsigned int data)
|
||||||
@ -341,7 +347,7 @@ int echo_recv_data(struct astribank_device *astribank, const unsigned int addr)
|
|||||||
ret = spi_send(astribank, 0x0004, data , 1, 0);
|
ret = spi_send(astribank, 0x0004, data , 1, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto failed;
|
goto failed;
|
||||||
return ret;
|
return ret;
|
||||||
failed:
|
failed:
|
||||||
AB_ERR(astribank, "echo_recv_data: spi_send failed (ret = %d)\n", ret);
|
AB_ERR(astribank, "echo_recv_data: spi_send failed (ret = %d)\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
@ -349,32 +355,33 @@ failed:
|
|||||||
|
|
||||||
int load_file(char *filename, unsigned char **ppBuf, UINT32 *pLen)
|
int load_file(char *filename, unsigned char **ppBuf, UINT32 *pLen)
|
||||||
{
|
{
|
||||||
unsigned char * pbyFileData = NULL;
|
unsigned char *pbyFileData = NULL;
|
||||||
FILE* pFile;
|
FILE *pFile;
|
||||||
|
|
||||||
DBG("Loading %s file...\n", filename);
|
DBG("Loading %s file...\n", filename);
|
||||||
pFile = fopen( filename, "rb" );
|
pFile = fopen(filename, "rb");
|
||||||
if (pFile == NULL) {
|
if (pFile == NULL) {
|
||||||
ERR("fopen\n");
|
ERR("fopen\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
fseek( pFile, 0L, SEEK_END );
|
fseek(pFile, 0L, SEEK_END);
|
||||||
*pLen = ftell( pFile );
|
*pLen = ftell(pFile);
|
||||||
fseek( pFile, 0L, SEEK_SET );
|
fseek(pFile, 0L, SEEK_SET);
|
||||||
|
|
||||||
pbyFileData = (unsigned char *)malloc(*pLen);
|
pbyFileData = (unsigned char *)malloc(*pLen);
|
||||||
if (pbyFileData == NULL) {
|
if (pbyFileData == NULL) {
|
||||||
fclose( pFile );
|
fclose(pFile);
|
||||||
ERR("malloc\n" );
|
ERR("malloc\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
} else {
|
} else {
|
||||||
DBG("allocated mem for pbyFileData\n");
|
DBG("allocated mem for pbyFileData\n");
|
||||||
}
|
}
|
||||||
fread(pbyFileData, 1, *pLen, pFile);
|
fread(pbyFileData, 1, *pLen, pFile);
|
||||||
fclose(pFile);
|
fclose(pFile);
|
||||||
DBG("Successful loading %s file into memory (size = %d, DUMP: first = %02X %02X, last = %02X %02X)\n",
|
DBG("Successful loading %s file into memory "
|
||||||
filename, *pLen,
|
"(size = %d, DUMP: first = %02X %02X, last = %02X %02X)\n",
|
||||||
|
filename, *pLen,
|
||||||
pbyFileData[0], pbyFileData[1],
|
pbyFileData[0], pbyFileData[1],
|
||||||
pbyFileData[(*pLen)-2], pbyFileData[(*pLen)-1]);
|
pbyFileData[(*pLen)-2], pbyFileData[(*pLen)-1]);
|
||||||
*ppBuf = pbyFileData;
|
*ppBuf = pbyFileData;
|
||||||
@ -389,7 +396,7 @@ UINT32 Oct6100UserGetTime(tPOCT6100_GET_TIME f_pTime)
|
|||||||
unsigned int mask = ~0;
|
unsigned int mask = ~0;
|
||||||
|
|
||||||
gettimeofday(&tv, 0);
|
gettimeofday(&tv, 0);
|
||||||
total_usecs = (((unsigned long long)(tv.tv_sec)) * 1000000) +
|
total_usecs = (((unsigned long long)(tv.tv_sec)) * 1000000) +
|
||||||
(((unsigned long long)(tv.tv_usec)));
|
(((unsigned long long)(tv.tv_usec)));
|
||||||
f_pTime->aulWallTimeUs[0] = (total_usecs & mask);
|
f_pTime->aulWallTimeUs[0] = (total_usecs & mask);
|
||||||
f_pTime->aulWallTimeUs[1] = (total_usecs >> 32);
|
f_pTime->aulWallTimeUs[1] = (total_usecs >> 32);
|
||||||
@ -452,13 +459,16 @@ UINT32 Oct6100UserDriverWriteApi(tPOCT6100_WRITE_PARAMS f_pWriteParams)
|
|||||||
|
|
||||||
UINT32 Oct6100UserDriverWriteSmearApi(tPOCT6100_WRITE_SMEAR_PARAMS f_pSmearParams)
|
UINT32 Oct6100UserDriverWriteSmearApi(tPOCT6100_WRITE_SMEAR_PARAMS f_pSmearParams)
|
||||||
{
|
{
|
||||||
unsigned int addr;
|
unsigned int addr;
|
||||||
unsigned int data;
|
unsigned int data;
|
||||||
unsigned int len = f_pSmearParams->ulWriteLength;
|
unsigned int len;
|
||||||
const struct echo_mod *echo_mod = (struct echo_mod *)f_pSmearParams->pProcessContext;
|
const struct echo_mod *echo_mod;
|
||||||
struct astribank_device *astribank = echo_mod->astribank;
|
struct astribank_device *astribank;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
len = f_pSmearParams->ulWriteLength;
|
||||||
|
echo_mod = (struct echo_mod *)f_pSmearParams->pProcessContext;
|
||||||
|
astribank = echo_mod->astribank;
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -475,8 +485,8 @@ UINT32 Oct6100UserDriverWriteSmearApi(tPOCT6100_WRITE_SMEAR_PARAMS f_pSmearParam
|
|||||||
|
|
||||||
UINT32 Oct6100UserDriverWriteBurstApi(tPOCT6100_WRITE_BURST_PARAMS f_pBurstParams)
|
UINT32 Oct6100UserDriverWriteBurstApi(tPOCT6100_WRITE_BURST_PARAMS f_pBurstParams)
|
||||||
{
|
{
|
||||||
unsigned int addr;
|
unsigned int addr;
|
||||||
unsigned int data;
|
unsigned int data;
|
||||||
unsigned int len = f_pBurstParams->ulWriteLength;
|
unsigned int len = f_pBurstParams->ulWriteLength;
|
||||||
const struct echo_mod *echo_mod = (struct echo_mod *)f_pBurstParams->pProcessContext;
|
const struct echo_mod *echo_mod = (struct echo_mod *)f_pBurstParams->pProcessContext;
|
||||||
struct astribank_device *astribank = echo_mod->astribank;
|
struct astribank_device *astribank = echo_mod->astribank;
|
||||||
@ -498,11 +508,13 @@ UINT32 Oct6100UserDriverWriteBurstApi(tPOCT6100_WRITE_BURST_PARAMS f_pBurstParam
|
|||||||
|
|
||||||
UINT32 Oct6100UserDriverReadApi(tPOCT6100_READ_PARAMS f_pReadParams)
|
UINT32 Oct6100UserDriverReadApi(tPOCT6100_READ_PARAMS f_pReadParams)
|
||||||
{
|
{
|
||||||
const unsigned int addr = f_pReadParams->ulReadAddress;
|
const unsigned int addr = f_pReadParams->ulReadAddress;
|
||||||
const struct echo_mod *echo_mod = (struct echo_mod *)f_pReadParams->pProcessContext;
|
const struct echo_mod *echo_mod;
|
||||||
struct astribank_device *astribank = echo_mod->astribank;
|
struct astribank_device *astribank;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
echo_mod = (struct echo_mod *)f_pReadParams->pProcessContext;
|
||||||
|
astribank = echo_mod->astribank;
|
||||||
ret = echo_recv_data(astribank, addr);
|
ret = echo_recv_data(astribank, addr);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
ERR("echo_recv_data failed (%d)\n", ret);
|
ERR("echo_recv_data failed (%d)\n", ret);
|
||||||
@ -514,12 +526,15 @@ UINT32 Oct6100UserDriverReadApi(tPOCT6100_READ_PARAMS f_pReadParams)
|
|||||||
|
|
||||||
UINT32 Oct6100UserDriverReadBurstApi(tPOCT6100_READ_BURST_PARAMS f_pBurstParams)
|
UINT32 Oct6100UserDriverReadBurstApi(tPOCT6100_READ_BURST_PARAMS f_pBurstParams)
|
||||||
{
|
{
|
||||||
unsigned int addr;
|
unsigned int addr;
|
||||||
unsigned int len = f_pBurstParams->ulReadLength;
|
unsigned int len;
|
||||||
const struct echo_mod *echo_mod = (struct echo_mod *)f_pBurstParams->pProcessContext;
|
const struct echo_mod *echo_mod;
|
||||||
struct astribank_device *astribank = echo_mod->astribank;
|
struct astribank_device *astribank;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
len = f_pBurstParams->ulReadLength;
|
||||||
|
echo_mod = (struct echo_mod *)f_pBurstParams->pProcessContext;
|
||||||
|
astribank = echo_mod->astribank;
|
||||||
for (i = 0;i < len; i++) {
|
for (i = 0;i < len; i++) {
|
||||||
unsigned int ret;
|
unsigned int ret;
|
||||||
|
|
||||||
@ -536,7 +551,6 @@ UINT32 Oct6100UserDriverReadBurstApi(tPOCT6100_READ_BURST_PARAMS f_pBurstParams)
|
|||||||
|
|
||||||
inline int get_ver(struct astribank_device *astribank)
|
inline int get_ver(struct astribank_device *astribank)
|
||||||
{
|
{
|
||||||
|
|
||||||
return spi_send(astribank, 0, 0, 1, 1);
|
return spi_send(astribank, 0, 0, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -581,29 +595,31 @@ UINT32 init_octasic(char *filename, struct astribank_device *astribank, int is_a
|
|||||||
/* 1) Configure and Open the OCT6100. */
|
/* 1) Configure and Open the OCT6100. */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
memset(&InstanceSize, 0, sizeof(tOCT6100_GET_INSTANCE_SIZE));
|
|
||||||
memset(&OpenChip, 0, sizeof(tOCT6100_CHIP_OPEN));
|
|
||||||
|
|
||||||
if (!(echo_mod = malloc(sizeof(struct echo_mod)))) {
|
memset(&InstanceSize, 0, sizeof(tOCT6100_GET_INSTANCE_SIZE));
|
||||||
AB_ERR(astribank, "cannot allocate memory for echo_mod\n");
|
memset(&OpenChip, 0, sizeof(tOCT6100_CHIP_OPEN));
|
||||||
return cOCT6100_ERR_FATAL;
|
|
||||||
}
|
echo_mod = malloc(sizeof(struct echo_mod));
|
||||||
|
if (!echo_mod) {
|
||||||
|
AB_ERR(astribank, "cannot allocate memory for echo_mod\n");
|
||||||
|
return cOCT6100_ERR_FATAL;
|
||||||
|
}
|
||||||
DBG("allocated mem for echo_mod\n");
|
DBG("allocated mem for echo_mod\n");
|
||||||
|
|
||||||
memset(echo_mod, 0, sizeof(struct echo_mod));
|
memset(echo_mod, 0, sizeof(struct echo_mod));
|
||||||
|
|
||||||
/* Fill the OCT6100 Chip Open configuration structure with default values */
|
/* Fill the OCT6100 Chip Open configuration structure with default values */
|
||||||
|
|
||||||
ulResult = Oct6100ChipOpenDef( &OpenChip );
|
ulResult = Oct6100ChipOpenDef(&OpenChip);
|
||||||
if (ulResult != cOCT6100_ERR_OK) {
|
if (ulResult != cOCT6100_ERR_OK) {
|
||||||
AB_ERR(astribank, "Oct6100ChipOpenDef failed: result=%X\n", ulResult);
|
AB_ERR(astribank, "Oct6100ChipOpenDef failed: result=%X\n",
|
||||||
|
ulResult);
|
||||||
return ulResult;
|
return ulResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenChip.pProcessContext = echo_mod;
|
OpenChip.pProcessContext = echo_mod;
|
||||||
/* Configure clocks */
|
/* Configure clocks */
|
||||||
|
|
||||||
/* upclk oscillator is at 33.33 Mhz */
|
/* upclk oscillator is at 33.33 Mhz */
|
||||||
OpenChip.ulUpclkFreq = cOCT6100_UPCLK_FREQ_33_33_MHZ;
|
OpenChip.ulUpclkFreq = cOCT6100_UPCLK_FREQ_33_33_MHZ;
|
||||||
|
|
||||||
@ -632,17 +648,17 @@ UINT32 init_octasic(char *filename, struct astribank_device *astribank, int is_a
|
|||||||
|
|
||||||
/* External Memory Settings: Use DDR memory*/
|
/* External Memory Settings: Use DDR memory*/
|
||||||
OpenChip.ulMemoryType = cOCT6100_MEM_TYPE_DDR;
|
OpenChip.ulMemoryType = cOCT6100_MEM_TYPE_DDR;
|
||||||
|
|
||||||
OpenChip.ulNumMemoryChips = 1;
|
OpenChip.ulNumMemoryChips = 1;
|
||||||
OpenChip.ulMemoryChipSize = cOCT6100_MEMORY_CHIP_SIZE_32MB;
|
OpenChip.ulMemoryChipSize = cOCT6100_MEMORY_CHIP_SIZE_32MB;
|
||||||
|
|
||||||
|
|
||||||
/* Load the image file */
|
/* Load the image file */
|
||||||
ulResult = load_file( filename,
|
ulResult = load_file( filename,
|
||||||
&pbyImageData,
|
&pbyImageData,
|
||||||
&ulImageByteSize );
|
&ulImageByteSize);
|
||||||
|
|
||||||
if ( ulResult != 0 ) {
|
if (ulResult != 0) {
|
||||||
AB_ERR(astribank, "Failed load_file %s (%08X)\n", filename, ulResult);
|
AB_ERR(astribank, "Failed load_file %s (%08X)\n", filename, ulResult);
|
||||||
return ulResult;
|
return ulResult;
|
||||||
}
|
}
|
||||||
@ -655,47 +671,52 @@ UINT32 init_octasic(char *filename, struct astribank_device *astribank, int is_a
|
|||||||
OpenChip.pbyImageFile = pbyImageData;
|
OpenChip.pbyImageFile = pbyImageData;
|
||||||
OpenChip.ulImageSize = ulImageByteSize;
|
OpenChip.ulImageSize = ulImageByteSize;
|
||||||
|
|
||||||
/* Inserting default values into tOCT6100_GET_INSTANCE_SIZE structure parameters. */
|
/*
|
||||||
Oct6100GetInstanceSizeDef ( &InstanceSize );
|
* Inserting default values into tOCT6100_GET_INSTANCE_SIZE
|
||||||
|
* structure parameters.
|
||||||
|
*/
|
||||||
|
Oct6100GetInstanceSizeDef(&InstanceSize);
|
||||||
|
|
||||||
/* Get the size of the OCT6100 instance structure. */
|
/* Get the size of the OCT6100 instance structure. */
|
||||||
ulResult = Oct6100GetInstanceSize(&OpenChip, &InstanceSize );
|
ulResult = Oct6100GetInstanceSize(&OpenChip, &InstanceSize);
|
||||||
if (ulResult != cOCT6100_ERR_OK)
|
if (ulResult != cOCT6100_ERR_OK) {
|
||||||
{
|
AB_ERR(astribank, "Oct6100GetInstanceSize failed (%08X)\n",
|
||||||
AB_ERR(astribank, "Oct6100GetInstanceSize failed (%08X)\n", ulResult);
|
ulResult);
|
||||||
return ulResult;
|
return ulResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
pApiInstance = malloc(InstanceSize.ulApiInstanceSize);
|
pApiInstance = malloc(InstanceSize.ulApiInstanceSize);
|
||||||
echo_mod->pApiInstance = pApiInstance;
|
echo_mod->pApiInstance = pApiInstance;
|
||||||
echo_mod->astribank = astribank;
|
echo_mod->astribank = astribank;
|
||||||
|
|
||||||
if (!pApiInstance) {
|
if (!pApiInstance) {
|
||||||
AB_ERR(astribank, "Out of memory (can't allocate %d bytes)!\n", InstanceSize.ulApiInstanceSize);
|
AB_ERR(astribank, "Out of memory (can't allocate %d bytes)!\n",
|
||||||
return cOCT6100_ERR_FATAL;
|
InstanceSize.ulApiInstanceSize);
|
||||||
}
|
return cOCT6100_ERR_FATAL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Perform actual open of chip */
|
/* Perform actual open of chip */
|
||||||
ulResult = Oct6100ChipOpen(pApiInstance, &OpenChip);
|
ulResult = Oct6100ChipOpen(pApiInstance, &OpenChip);
|
||||||
if (ulResult != cOCT6100_ERR_OK) {
|
if (ulResult != cOCT6100_ERR_OK) {
|
||||||
AB_ERR(astribank, "Oct6100ChipOpen failed: result=%X\n", ulResult);
|
AB_ERR(astribank, "Oct6100ChipOpen failed: result=%X\n",
|
||||||
|
ulResult);
|
||||||
return ulResult;
|
return ulResult;
|
||||||
}
|
}
|
||||||
DBG("%s: OCT6100 is open\n", __func__);
|
DBG("%s: OCT6100 is open\n", __func__);
|
||||||
|
|
||||||
/* Free the image file data */
|
/* Free the image file data */
|
||||||
free( pbyImageData );
|
free(pbyImageData);
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/* 2) Open channels in echo cancellation mode. */
|
/* 2) Open channels in echo cancellation mode. */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
for( nChan = 0; nChan < ECHO_MAX_CHANS; nChan++ ) {
|
for (nChan = 0; nChan < ECHO_MAX_CHANS; nChan++) {
|
||||||
nSlot = nChan;
|
nSlot = nChan;
|
||||||
/* open a channel.*/
|
/* open a channel.*/
|
||||||
Oct6100ChannelOpenDef( &ChannelOpen );
|
Oct6100ChannelOpenDef(&ChannelOpen);
|
||||||
|
|
||||||
/* Assign the handle memory.*/
|
/* Assign the handle memory.*/
|
||||||
ChannelOpen.pulChannelHndl = &ulChanHndl;
|
ChannelOpen.pulChannelHndl = &ulChanHndl;
|
||||||
@ -717,7 +738,7 @@ UINT32 init_octasic(char *filename, struct astribank_device *astribank, int is_a
|
|||||||
ChannelOpen.TdmConfig.ulRoutPcmLaw = pcmLaw;
|
ChannelOpen.TdmConfig.ulRoutPcmLaw = pcmLaw;
|
||||||
ChannelOpen.TdmConfig.ulRoutStream = ECHO_ROUT_STREAM;
|
ChannelOpen.TdmConfig.ulRoutStream = ECHO_ROUT_STREAM;
|
||||||
ChannelOpen.TdmConfig.ulRoutTimeslot = nSlot;
|
ChannelOpen.TdmConfig.ulRoutTimeslot = nSlot;
|
||||||
|
|
||||||
ChannelOpen.TdmConfig.ulSoutPcmLaw = pcmLaw;
|
ChannelOpen.TdmConfig.ulSoutPcmLaw = pcmLaw;
|
||||||
ChannelOpen.TdmConfig.ulSoutStream = ECHO_SOUT_STREAM;
|
ChannelOpen.TdmConfig.ulSoutStream = ECHO_SOUT_STREAM;
|
||||||
ChannelOpen.TdmConfig.ulSoutTimeslot = nSlot;
|
ChannelOpen.TdmConfig.ulSoutTimeslot = nSlot;
|
||||||
@ -728,13 +749,13 @@ UINT32 init_octasic(char *filename, struct astribank_device *astribank, int is_a
|
|||||||
ChannelOpen.VqeConfig.fSinDcOffsetRemoval = TRUE;
|
ChannelOpen.VqeConfig.fSinDcOffsetRemoval = TRUE;
|
||||||
|
|
||||||
ChannelOpen.VqeConfig.ulComfortNoiseMode = cOCT6100_COMFORT_NOISE_NORMAL;
|
ChannelOpen.VqeConfig.ulComfortNoiseMode = cOCT6100_COMFORT_NOISE_NORMAL;
|
||||||
/* cOCT6100_COMFORT_NOISE_NORMAL
|
/* cOCT6100_COMFORT_NOISE_NORMAL
|
||||||
cOCT6100_COMFORT_NOISE_EXTENDED,
|
cOCT6100_COMFORT_NOISE_EXTENDED,
|
||||||
cOCT6100_COMFORT_NOISE_OFF,
|
cOCT6100_COMFORT_NOISE_OFF,
|
||||||
cOCT6100_COMFORT_NOISE_FAST_LATCH
|
cOCT6100_COMFORT_NOISE_FAST_LATCH
|
||||||
*/
|
*/
|
||||||
ulResult = Oct6100ChannelOpen( pApiInstance,
|
ulResult = Oct6100ChannelOpen( pApiInstance,
|
||||||
&ChannelOpen );
|
&ChannelOpen);
|
||||||
if (ulResult != cOCT6100_ERR_OK) {
|
if (ulResult != cOCT6100_ERR_OK) {
|
||||||
AB_ERR(astribank, "Found error on chan %d\n", nChan);
|
AB_ERR(astribank, "Found error on chan %d\n", nChan);
|
||||||
return ulResult;
|
return ulResult;
|
||||||
@ -747,10 +768,10 @@ UINT32 init_octasic(char *filename, struct astribank_device *astribank, int is_a
|
|||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
for( nChan = 8; nChan < 32; nChan++ ) {
|
for (nChan = 8; nChan < 32; nChan++) {
|
||||||
nSlot = (nChan >> 3) * 32 + (nChan & 0x07);
|
nSlot = (nChan >> 3) * 32 + (nChan & 0x07);
|
||||||
/* open a channel.*/
|
/* open a channel.*/
|
||||||
Oct6100ChannelOpenDef( &ChannelOpen );
|
Oct6100ChannelOpenDef(&ChannelOpen);
|
||||||
|
|
||||||
/* Assign the handle memory.*/
|
/* Assign the handle memory.*/
|
||||||
ChannelOpen.pulChannelHndl = &ulChanHndl;
|
ChannelOpen.pulChannelHndl = &ulChanHndl;
|
||||||
@ -767,7 +788,7 @@ UINT32 init_octasic(char *filename, struct astribank_device *astribank, int is_a
|
|||||||
|
|
||||||
ChannelOpen.TdmConfig.ulRoutStream = ECHO_ROUT_STREAM2;
|
ChannelOpen.TdmConfig.ulRoutStream = ECHO_ROUT_STREAM2;
|
||||||
ChannelOpen.TdmConfig.ulRoutTimeslot = nSlot;
|
ChannelOpen.TdmConfig.ulRoutTimeslot = nSlot;
|
||||||
|
|
||||||
ChannelOpen.TdmConfig.ulSoutStream = ECHO_SOUT_STREAM2;
|
ChannelOpen.TdmConfig.ulSoutStream = ECHO_SOUT_STREAM2;
|
||||||
ChannelOpen.TdmConfig.ulSoutTimeslot = nSlot;
|
ChannelOpen.TdmConfig.ulSoutTimeslot = nSlot;
|
||||||
|
|
||||||
@ -777,13 +798,13 @@ UINT32 init_octasic(char *filename, struct astribank_device *astribank, int is_a
|
|||||||
ChannelOpen.VqeConfig.fSinDcOffsetRemoval = TRUE;
|
ChannelOpen.VqeConfig.fSinDcOffsetRemoval = TRUE;
|
||||||
|
|
||||||
ChannelOpen.VqeConfig.ulComfortNoiseMode = cOCT6100_COMFORT_NOISE_NORMAL;
|
ChannelOpen.VqeConfig.ulComfortNoiseMode = cOCT6100_COMFORT_NOISE_NORMAL;
|
||||||
/* cOCT6100_COMFORT_NOISE_NORMAL
|
/* cOCT6100_COMFORT_NOISE_NORMAL
|
||||||
cOCT6100_COMFORT_NOISE_EXTENDED,
|
cOCT6100_COMFORT_NOISE_EXTENDED,
|
||||||
cOCT6100_COMFORT_NOISE_OFF,
|
cOCT6100_COMFORT_NOISE_OFF,
|
||||||
cOCT6100_COMFORT_NOISE_FAST_LATCH
|
cOCT6100_COMFORT_NOISE_FAST_LATCH
|
||||||
*/
|
*/
|
||||||
ulResult = Oct6100ChannelOpen( pApiInstance,
|
ulResult = Oct6100ChannelOpen( pApiInstance,
|
||||||
&ChannelOpen );
|
&ChannelOpen);
|
||||||
if (ulResult != cOCT6100_ERR_OK) {
|
if (ulResult != cOCT6100_ERR_OK) {
|
||||||
AB_ERR(astribank, "Found error on chan %d\n", nChan);
|
AB_ERR(astribank, "Found error on chan %d\n", nChan);
|
||||||
return ulResult;
|
return ulResult;
|
||||||
@ -803,7 +824,7 @@ int load_echo(struct astribank_device *astribank, char *filename, int is_alaw)
|
|||||||
{
|
{
|
||||||
int iLen;
|
int iLen;
|
||||||
int ret;
|
int ret;
|
||||||
unsigned char *pbyFileData = NULL;
|
unsigned char *pbyFileData = NULL;
|
||||||
UINT32 octasic_status;
|
UINT32 octasic_status;
|
||||||
|
|
||||||
AB_INFO(astribank, "Loading ECHOCAN Firmware: %s (%s)\n",
|
AB_INFO(astribank, "Loading ECHOCAN Firmware: %s (%s)\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user