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
@ -214,9 +214,12 @@ static int usb_buffer_send(struct astribank_device *astribank, struct usb_buffer
|
||||
}
|
||||
DBG("%s: %d bytes recv\n", __func__, ret);
|
||||
phead = (struct xpp_packet_header *)buf;
|
||||
if(phead->header.op != SPI_RCV_XOP && phead->header.op != TST_RCV_XOP) {
|
||||
AB_ERR(astribank, "Got unexpected reply OP=0x%02X\n", phead->header.op);
|
||||
dump_packet(LOG_ERR, DBG_MASK, "hexline[ERR]", buf, ret);
|
||||
if (phead->header.op != SPI_RCV_XOP &&
|
||||
phead->header.op != TST_RCV_XOP) {
|
||||
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;
|
||||
}
|
||||
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];
|
||||
struct xpp_packet_header *phead = (struct xpp_packet_header *)buf;
|
||||
int pack_len;
|
||||
int spi_flags;
|
||||
|
||||
assert(astribank != NULL);
|
||||
spi_flags = 0x30 | (recv_answer ? 0x40 : 0x00) | (ver ? 0x01 : 0x00);
|
||||
pack_len = sizeof(phead->header) + sizeof(phead->alt.spi_pack);
|
||||
phead->header.len = pack_len;
|
||||
phead->header.op = SPI_SND_XOP;
|
||||
phead->header.unit = 0x40; /* EC has always this unit num */
|
||||
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_h = (addr >> 8) & 0xFF;
|
||||
phead->alt.spi_pack.data_l = (data >> 0) & 0xFF;
|
||||
@ -277,13 +282,14 @@ int test_send(struct astribank_device *astribank)
|
||||
phead->header.len = 6;
|
||||
phead->header.op = 0x35;
|
||||
phead->header.unit = 0x00;
|
||||
phead->alt.tst_pack.tid = 0x28; // EC TestId
|
||||
phead->alt.tst_pack.tsid = 0x00; // EC SubId
|
||||
phead->alt.tst_pack.tid = 0x28; /* EC TestId */
|
||||
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, &usb_buffer, buf, pack_len, TIMEOUT, 1);
|
||||
ret = usb_buffer_send(astribank,
|
||||
&usb_buffer, buf, pack_len, TIMEOUT, 1);
|
||||
if (ret < 0) {
|
||||
AB_ERR(astribank, "usb_buffer_send failed: %d\n", ret);
|
||||
return ret;
|
||||
@ -373,7 +379,8 @@ int load_file(char *filename, unsigned char **ppBuf, UINT32 *pLen)
|
||||
}
|
||||
fread(pbyFileData, 1, *pLen, 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 "
|
||||
"(size = %d, DUMP: first = %02X %02X, last = %02X %02X)\n",
|
||||
filename, *pLen,
|
||||
pbyFileData[0], pbyFileData[1],
|
||||
pbyFileData[(*pLen)-2], pbyFileData[(*pLen)-1]);
|
||||
@ -454,11 +461,14 @@ UINT32 Oct6100UserDriverWriteSmearApi(tPOCT6100_WRITE_SMEAR_PARAMS f_pSmearParam
|
||||
{
|
||||
unsigned int addr;
|
||||
unsigned int data;
|
||||
unsigned int len = f_pSmearParams->ulWriteLength;
|
||||
const struct echo_mod *echo_mod = (struct echo_mod *)f_pSmearParams->pProcessContext;
|
||||
struct astribank_device *astribank = echo_mod->astribank;
|
||||
unsigned int len;
|
||||
const struct echo_mod *echo_mod;
|
||||
struct astribank_device *astribank;
|
||||
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++) {
|
||||
int ret;
|
||||
|
||||
@ -499,10 +509,12 @@ UINT32 Oct6100UserDriverWriteBurstApi(tPOCT6100_WRITE_BURST_PARAMS f_pBurstParam
|
||||
UINT32 Oct6100UserDriverReadApi(tPOCT6100_READ_PARAMS f_pReadParams)
|
||||
{
|
||||
const unsigned int addr = f_pReadParams->ulReadAddress;
|
||||
const struct echo_mod *echo_mod = (struct echo_mod *)f_pReadParams->pProcessContext;
|
||||
struct astribank_device *astribank = echo_mod->astribank;
|
||||
const struct echo_mod *echo_mod;
|
||||
struct astribank_device *astribank;
|
||||
int ret;
|
||||
|
||||
echo_mod = (struct echo_mod *)f_pReadParams->pProcessContext;
|
||||
astribank = echo_mod->astribank;
|
||||
ret = echo_recv_data(astribank, addr);
|
||||
if (ret < 0) {
|
||||
ERR("echo_recv_data failed (%d)\n", ret);
|
||||
@ -515,11 +527,14 @@ UINT32 Oct6100UserDriverReadApi(tPOCT6100_READ_PARAMS f_pReadParams)
|
||||
UINT32 Oct6100UserDriverReadBurstApi(tPOCT6100_READ_BURST_PARAMS f_pBurstParams)
|
||||
{
|
||||
unsigned int addr;
|
||||
unsigned int len = f_pBurstParams->ulReadLength;
|
||||
const struct echo_mod *echo_mod = (struct echo_mod *)f_pBurstParams->pProcessContext;
|
||||
struct astribank_device *astribank = echo_mod->astribank;
|
||||
unsigned int len;
|
||||
const struct echo_mod *echo_mod;
|
||||
struct astribank_device *astribank;
|
||||
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++) {
|
||||
unsigned int ret;
|
||||
|
||||
@ -536,7 +551,6 @@ UINT32 Oct6100UserDriverReadBurstApi(tPOCT6100_READ_BURST_PARAMS f_pBurstParams)
|
||||
|
||||
inline int get_ver(struct astribank_device *astribank)
|
||||
{
|
||||
|
||||
return spi_send(astribank, 0, 0, 1, 1);
|
||||
}
|
||||
|
||||
@ -585,7 +599,8 @@ UINT32 init_octasic(char *filename, struct astribank_device *astribank, int is_a
|
||||
memset(&InstanceSize, 0, sizeof(tOCT6100_GET_INSTANCE_SIZE));
|
||||
memset(&OpenChip, 0, sizeof(tOCT6100_CHIP_OPEN));
|
||||
|
||||
if (!(echo_mod = malloc(sizeof(struct echo_mod)))) {
|
||||
echo_mod = malloc(sizeof(struct echo_mod));
|
||||
if (!echo_mod) {
|
||||
AB_ERR(astribank, "cannot allocate memory for echo_mod\n");
|
||||
return cOCT6100_ERR_FATAL;
|
||||
}
|
||||
@ -597,7 +612,8 @@ UINT32 init_octasic(char *filename, struct astribank_device *astribank, int is_a
|
||||
|
||||
ulResult = Oct6100ChipOpenDef(&OpenChip);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -655,14 +671,17 @@ UINT32 init_octasic(char *filename, struct astribank_device *astribank, int is_a
|
||||
OpenChip.pbyImageFile = pbyImageData;
|
||||
OpenChip.ulImageSize = ulImageByteSize;
|
||||
|
||||
/* Inserting default values into tOCT6100_GET_INSTANCE_SIZE structure parameters. */
|
||||
/*
|
||||
* Inserting default values into tOCT6100_GET_INSTANCE_SIZE
|
||||
* structure parameters.
|
||||
*/
|
||||
Oct6100GetInstanceSizeDef(&InstanceSize);
|
||||
|
||||
/* Get the size of the OCT6100 instance structure. */
|
||||
ulResult = Oct6100GetInstanceSize(&OpenChip, &InstanceSize);
|
||||
if (ulResult != cOCT6100_ERR_OK)
|
||||
{
|
||||
AB_ERR(astribank, "Oct6100GetInstanceSize failed (%08X)\n", ulResult);
|
||||
if (ulResult != cOCT6100_ERR_OK) {
|
||||
AB_ERR(astribank, "Oct6100GetInstanceSize failed (%08X)\n",
|
||||
ulResult);
|
||||
return ulResult;
|
||||
}
|
||||
|
||||
@ -671,14 +690,16 @@ UINT32 init_octasic(char *filename, struct astribank_device *astribank, int is_a
|
||||
echo_mod->astribank = astribank;
|
||||
|
||||
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",
|
||||
InstanceSize.ulApiInstanceSize);
|
||||
return cOCT6100_ERR_FATAL;
|
||||
}
|
||||
|
||||
/* Perform actual open of chip */
|
||||
ulResult = Oct6100ChipOpen(pApiInstance, &OpenChip);
|
||||
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;
|
||||
}
|
||||
DBG("%s: OCT6100 is open\n", __func__);
|
||||
|
Loading…
Reference in New Issue
Block a user