static A_STATUS driver_thread_operation(A_VOID *pCxt) { A_DRIVER_CONTEXT *pDCxt = GET_DRIVER_COMMON(pCxt); union{ A_UINT32 param; }stackU; #define PARAM (stackU.param) #define PTR_REG_MOD ((ATH_REGQUERY*)(pQuery)) switch(PTR_REG_MOD->operation) { case ATH_REG_OP_READ: // read Driver_ReadRegDiag(pCxt, &PTR_REG_MOD->address, &(PTR_REG_MOD->value)); PTR_REG_MOD->value = A_CPU2LE32((PTR_REG_MOD->value)); break; case ATH_REG_OP_WRITE: //write- PTR_REG_MOD->value = A_CPU2LE32((PTR_REG_MOD->value)); Driver_WriteRegDiag(pCxt, &PTR_REG_MOD->address, &(PTR_REG_MOD->value)); break; case ATH_REG_OP_RMW: //read-mod-write if(A_OK != Driver_ReadRegDiag(pCxt, &PTR_REG_MOD->address, &PARAM)){ break; } PARAM = A_CPU2LE32(PARAM); PARAM &= ~PTR_REG_MOD->mask; PARAM |= PTR_REG_MOD->value; PARAM = A_CPU2LE32(PARAM); Driver_WriteRegDiag(pCxt, &PTR_REG_MOD->address, &PARAM); break; } pDCxt->asynchRequest = NULL; reg_query_bool = A_TRUE; CUSTOM_DRIVER_WAKE_USER(pCxt); #undef PTR_REG_MOD #undef PARAM return A_OK; }
/* Driver_WriteDataDiag - Writes a buffer of data starting at address. Length * of data is specified by length. Data is written to a contiguous chip * address memory/register space. * void *pCxt - the driver context. * uint32_t address - the device chip address to start the write. * uint8_t *data - the start of data source buffer. * uint32_t length - the length of data in bytes. *****************************************************************************/ A_STATUS Driver_WriteDataDiag(void *pCxt, uint32_t address, uint8_t *data, uint32_t length) { uint32_t count; A_STATUS status = A_OK; for (count = 0; count < length; count += 4, address += 4) { if ((status = Driver_WriteRegDiag(pCxt, &address, (uint32_t *)&data[count])) != A_OK) { break; } } return status; }