Use the in-kernel s32 type instead.
Cc: Mikko Virkkilä <mikko.virkkila@bluegiga.com>
Cc: Lauri Hintsala <Lauri.Hintsala@bluegiga.com>
Cc: Riku Mettälä <riku.mettala@bluegiga.com>
Cc: Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
#include "csr_formatted_io.h"
#include "csr_util.h"
-CsrInt32 CsrSnprintf(CsrCharString *dest, CsrSize n, const CsrCharString *fmt, ...)
+s32 CsrSnprintf(CsrCharString *dest, CsrSize n, const CsrCharString *fmt, ...)
{
- CsrInt32 r;
+ s32 r;
va_list args;
va_start(args, fmt);
r = CsrVsnprintf(dest, n, fmt, args);
#include "csr_types.h"
-CsrInt32 CsrSnprintf(CsrCharString *dest, CsrSize n, const CsrCharString *fmt, ...);
+s32 CsrSnprintf(CsrCharString *dest, CsrSize n, const CsrCharString *fmt, ...);
#ifdef __cplusplus
}
* CsrTime - "t1" - "t2".
*
*----------------------------------------------------------------------------*/
-#define CsrTimeSub(t1, t2) ((CsrInt32) (t1) - (CsrInt32) (t2))
+#define CsrTimeSub(t1, t2) ((s32) (t1) - (s32) (t2))
/*----------------------------------------------------------------------------*
* NAME
typedef uintptr_t CsrUintptr; /* Unsigned integer large enough to hold any pointer (ISO/IEC 9899:1999 7.18.1.4) */
typedef ptrdiff_t CsrIntptr; /* intptr_t is not defined in kernel. Use the equivalent ptrdiff_t. */
-/* Signed fixed width types */
-typedef int32_t CsrInt32;
-
/* Boolean */
typedef u8 CsrBool;
CsrUtf16String *CsrUtf16String2XML(CsrUtf16String *str);
CsrUtf16String *CsrXML2Utf16String(CsrUtf16String *str);
-CsrInt32 CsrUtf8StrCmp(const CsrUtf8String *string1, const CsrUtf8String *string2);
-CsrInt32 CsrUtf8StrNCmp(const CsrUtf8String *string1, const CsrUtf8String *string2, CsrSize count);
+s32 CsrUtf8StrCmp(const CsrUtf8String *string1, const CsrUtf8String *string2);
+s32 CsrUtf8StrNCmp(const CsrUtf8String *string1, const CsrUtf8String *string2, CsrSize count);
u32 CsrUtf8StringLengthInBytes(const CsrUtf8String *string);
/*******************************************************************************
return resultString;
}
-CsrInt32 CsrUtf8StrCmp(const CsrUtf8String *string1, const CsrUtf8String *string2)
+s32 CsrUtf8StrCmp(const CsrUtf8String *string1, const CsrUtf8String *string2)
{
return CsrStrCmp((const CsrCharString *) string1, (const CsrCharString *) string2);
}
-CsrInt32 CsrUtf8StrNCmp(const CsrUtf8String *string1, const CsrUtf8String *string2, CsrSize count)
+s32 CsrUtf8StrNCmp(const CsrUtf8String *string1, const CsrUtf8String *string2, CsrSize count)
{
return CsrStrNCmp((const CsrCharString *) string1, (const CsrCharString *) string2, count);
}
/* Convert signed 32 bit (or less) integer to string */
#define I2B10_MAX 12
-void CsrIntToBase10(CsrInt32 number, CsrCharString *str)
+void CsrIntToBase10(s32 number, CsrCharString *str)
{
- CsrInt32 digit;
+ s32 digit;
u8 index;
CsrCharString res[I2B10_MAX];
CsrBool foundDigit = FALSE;
}
EXPORT_SYMBOL_GPL(CsrMemMove);
-CsrInt32 CsrMemCmp(const void *buf1, const void *buf2, CsrSize count)
+s32 CsrMemCmp(const void *buf1, const void *buf2, CsrSize count)
{
return memcmp(buf1, buf2, count);
}
}
EXPORT_SYMBOL_GPL(CsrStrLen);
-CsrInt32 CsrStrCmp(const CsrCharString *string1, const CsrCharString *string2)
+s32 CsrStrCmp(const CsrCharString *string1, const CsrCharString *string2)
{
return strcmp(string1, string2);
}
-CsrInt32 CsrStrNCmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count)
+s32 CsrStrNCmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count)
{
return strncmp(string1, string2, count);
}
}
#endif
-CsrInt32 CsrVsnprintf(CsrCharString *string, CsrSize count, const CsrCharString *format, va_list args)
+s32 CsrVsnprintf(CsrCharString *string, CsrSize count, const CsrCharString *format, va_list args)
{
return vsnprintf(string, count, format, args);
}
CsrBool CsrHexStrToUint16(const CsrCharString *string, u16 *returnValue);
CsrBool CsrHexStrToUint32(const CsrCharString *string, u32 *returnValue);
u32 CsrPow(u32 base, u32 exponent);
-void CsrIntToBase10(CsrInt32 number, CsrCharString *str);
+void CsrIntToBase10(s32 number, CsrCharString *str);
void CsrUInt16ToHex(u16 number, CsrCharString *str);
void CsrUInt32ToHex(u32 number, CsrCharString *str);
#define CsrStrNCpy strncpy
#define CsrStrCat strcat
#define CsrStrNCat strncat
-#define CsrMemCmp(s1, s2, n) ((CsrInt32) memcmp((s1), (s2), (n)))
-#define CsrStrCmp(s1, s2) ((CsrInt32) strcmp((s1), (s2)))
-#define CsrStrNCmp(s1, s2, n) ((CsrInt32) strncmp((s1), (s2), (n)))
+#define CsrMemCmp(s1, s2, n) ((s32) memcmp((s1), (s2), (n)))
+#define CsrStrCmp(s1, s2) ((s32) strcmp((s1), (s2)))
+#define CsrStrNCmp(s1, s2, n) ((s32) strncmp((s1), (s2), (n)))
#define CsrStrChr strchr
#define CsrStrStr strstr
#define CsrMemSet memset
CsrCharString *CsrStrNCpy(CsrCharString *dest, const CsrCharString *src, CsrSize count);
CsrCharString *CsrStrCat(CsrCharString *dest, const CsrCharString *src);
CsrCharString *CsrStrNCat(CsrCharString *dest, const CsrCharString *src, CsrSize count);
-CsrInt32 CsrMemCmp(const void *buf1, const void *buf2, CsrSize count);
-CsrInt32 CsrStrCmp(const CsrCharString *string1, const CsrCharString *string2);
-CsrInt32 CsrStrNCmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count);
+s32 CsrMemCmp(const void *buf1, const void *buf2, CsrSize count);
+s32 CsrStrCmp(const CsrCharString *string1, const CsrCharString *string2);
+s32 CsrStrNCmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count);
CsrCharString *CsrStrChr(const CsrCharString *string, CsrCharString c);
CsrCharString *CsrStrStr(const CsrCharString *string1, const CsrCharString *string2);
void *CsrMemSet(void *dest, u8 c, CsrSize count);
CsrSize CsrStrLen(const CsrCharString *string);
#endif /* !CSR_USE_STDC_LIB */
-CsrInt32 CsrVsnprintf(CsrCharString *string, CsrSize count, const CsrCharString *format, va_list args);
+s32 CsrVsnprintf(CsrCharString *string, CsrSize count, const CsrCharString *format, va_list args);
/*------------------------------------------------------------------*/
/* Non-standard utility functions */
* CSR_RESULT_SUCCESS if successful
* ---------------------------------------------------------------------------
*/
-CsrResult unifi_init_card(card_t *card, CsrInt32 led_mask)
+CsrResult unifi_init_card(card_t *card, s32 led_mask)
{
CsrResult r;
* CsrResult error code on failure.
* ---------------------------------------------------------------------------
*/
-CsrResult unifi_download(card_t *card, CsrInt32 led_mask)
+CsrResult unifi_download(card_t *card, s32 led_mask)
{
CsrResult r;
void *dlpriv;
*/
CsrResult card_wait_for_firmware_to_start(card_t *card, u32 *paddr)
{
- CsrInt32 i;
+ s32 i;
u16 mbox0, mbox1;
CsrResult r;
static CsrResult card_access_panic(card_t *card)
{
u16 data_u16 = 0;
- CsrInt32 i;
+ s32 i;
CsrResult r, sr;
func_enter();
{
u16 q_len, active_queues = 0, excess_queue_slots, div_extra_slots,
queue_fair_share, reserved_slots = 0, q, excess_need_queues = 0, unmovable_slots = 0;
- CsrInt32 i;
+ s32 i;
q_t *sigq;
u16 num_data_slots = card->config_data.num_fromhost_data_slots - UNIFI_RESERVED_COMMAND_SLOTS;
for (i = 0; i < UNIFI_NO_OF_TX_QS; i++)
{
- if (i != (CsrInt32)queue)
+ if (i != (s32)queue)
{
reserved_slots += card->dynamic_slot_data.from_host_reserved_slots[i];
}
- if ((i == (CsrInt32)queue) || (card->dynamic_slot_data.from_host_reserved_slots[i] > 0))
+ if ((i == (s32)queue) || (card->dynamic_slot_data.from_host_reserved_slots[i] > 0))
{
active_queues++;
}
* CSR_RESULT_SUCCESS if OK, or CSR error
* ---------------------------------------------------------------------------
*/
-CsrResult unifi_check_io_status(card_t *card, CsrInt32 *status)
+CsrResult unifi_check_io_status(card_t *card, s32 *status)
{
u8 io_en;
CsrResult r;
if ((io_en & (1 << card->function)) == 0)
{
- CsrInt32 fw_count;
+ s32 fw_count;
*status = 1;
unifi_error(card->ospriv, "UniFi has spontaneously reset.\n");
void unifi_get_hip_qos_info(card_t *card, unifi_HipQosInfo *hipqosinfo)
{
- CsrInt32 count_fhr;
+ s32 count_fhr;
s16 t;
u32 occupied_fh;
* We assume these are connected to LEDs. The main firmware gets
* the mask from a MIB entry.
*/
- CsrInt32 loader_led_mask;
+ s32 loader_led_mask;
/*
* Support for flow control. When the from-host queue of signals
* These are the modulo-256 count of signals written to or read from UniFi
* The value is incremented for every signal.
*/
- CsrInt32 from_host_signals_w;
- CsrInt32 from_host_signals_r;
- CsrInt32 to_host_signals_r;
- CsrInt32 to_host_signals_w;
+ s32 from_host_signals_w;
+ s32 from_host_signals_r;
+ s32 to_host_signals_r;
+ s32 to_host_signals_w;
/* Should specify buffer size as a number of signals */
CsrResult unifi_set_proc_select(card_t *card, enum unifi_dbg_processors_select select);
-CsrInt32 card_read_signal_counts(card_t *card);
+s32 card_read_signal_counts(card_t *card);
bulk_data_desc_t* card_find_data_slot(card_t *card, s16 slot);
CsrResult unifi_read32(card_t *card, u32 unifi_addr, u32 *pdata);
CsrResult unifi_readnz(card_t *card, u32 unifi_addr,
void *pdata, u16 len);
-CsrInt32 unifi_read_shared_count(card_t *card, u32 addr);
+s32 unifi_read_shared_count(card_t *card, u32 addr);
CsrResult unifi_writen(card_t *card, u32 unifi_addr, void *pdata, u16 len);
static CsrResult flush_fh_buffer(card_t *card);
-static CsrResult check_fh_sig_slots(card_t *card, u16 needed, CsrInt32 *space);
+static CsrResult check_fh_sig_slots(card_t *card, u16 needed, s32 *space);
-static CsrResult read_to_host_signals(card_t *card, CsrInt32 *processed);
-static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed);
+static CsrResult read_to_host_signals(card_t *card, s32 *processed);
+static CsrResult process_to_host_signals(card_t *card, s32 *processed);
static CsrResult process_bulk_data_command(card_t *card,
const u8 *cmdptr,
s16 cmd, u16 len);
static CsrResult process_clear_slot_command(card_t *card,
const u8 *cmdptr);
-static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed);
-static CsrResult process_fh_traffic_queue(card_t *card, CsrInt32 *processed);
+static CsrResult process_fh_cmd_queue(card_t *card, s32 *processed);
+static CsrResult process_fh_traffic_queue(card_t *card, s32 *processed);
static void restart_packet_flow(card_t *card);
static CsrResult process_clock_request(card_t *card);
void unifi_debug_buf_dump(void)
{
- CsrInt32 offset = unifi_dbgbuf_ptr - unifi_debug_output;
+ s32 offset = unifi_dbgbuf_ptr - unifi_debug_output;
unifi_error(NULL, "HIP debug buffer offset=%d\n", offset);
dump_str(unifi_debug_output + offset, UNIFI_DEBUG_GBUFFER_SIZE - offset);
CsrResult r;
CsrResult csrResult;
CsrBool pending;
- CsrInt32 iostate, j;
+ s32 iostate, j;
const enum unifi_low_power_mode low_power_mode = card->low_power_mode;
u16 data_slots_used = 0;
static CsrResult handle_host_protocol(card_t *card, CsrBool *processed_something)
{
CsrResult r;
- CsrInt32 done;
+ s32 done;
*processed_something = FALSE;
* CSR error code if an error occurred.
* ---------------------------------------------------------------------------
*/
-static CsrResult read_to_host_signals(card_t *card, CsrInt32 *processed)
+static CsrResult read_to_host_signals(card_t *card, s32 *processed)
{
- CsrInt32 count_thw, count_thr;
- CsrInt32 unread_chunks, unread_bytes;
+ s32 count_thw, count_thr;
+ s32 unread_chunks, unread_bytes;
CsrResult r;
*processed = 0;
* indicate all data, as we have read it from the device.
* ---------------------------------------------------------------------------
*/
-static CsrResult process_to_host_signals(card_t *card, CsrInt32 *processed)
+static CsrResult process_to_host_signals(card_t *card, s32 *processed)
{
s16 pending;
s16 remaining;
/* Use a safe copy because source and destination may overlap */
u8 *d = card->th_buffer.buf;
u8 *s = bufptr;
- CsrInt32 n = remaining;
+ s32 n = remaining;
while (n--)
{
*d++ = *s++;
* CSR_RESULT_SUCCESS, otherwise CSR error code on error.
* ---------------------------------------------------------------------------
*/
-static CsrResult check_fh_sig_slots(card_t *card, u16 needed, CsrInt32 *space_fh)
+static CsrResult check_fh_sig_slots(card_t *card, u16 needed, s32 *space_fh)
{
u32 count_fhw;
u32 occupied_fh, slots_fh;
- CsrInt32 count_fhr;
+ s32 count_fhr;
count_fhw = card->from_host_signals_w;
count_fhr = card->from_host_signals_r;
* structure that describes the queue to make the distiction.
* ---------------------------------------------------------------------------
*/
-static CsrResult process_fh_cmd_queue(card_t *card, CsrInt32 *processed)
+static CsrResult process_fh_cmd_queue(card_t *card, s32 *processed)
{
q_t *sigq = &card->fh_command_queue;
u16 pending_sigs;
u16 pending_chunks;
u16 needed_chunks;
- CsrInt32 space_chunks;
+ s32 space_chunks;
u16 q_index;
*processed = 0;
* and any UDI clients interspersed.
* ---------------------------------------------------------------------------
*/
-static CsrResult process_fh_traffic_queue(card_t *card, CsrInt32 *processed)
+static CsrResult process_fh_traffic_queue(card_t *card, s32 *processed)
{
q_t *sigq = card->fh_traffic_queue;
CsrResult r;
s16 n = 0;
- CsrInt32 q_no;
+ s32 q_no;
u16 pending_sigs = 0;
u16 pending_chunks = 0;
u16 needed_chunks;
- CsrInt32 space_chunks;
+ s32 space_chunks;
u16 q_index;
u32 host_tag = 0;
u16 slot_num = 0;
addr += 2;
}
- *num = (CsrInt32)(cptr - (u8 *)pdata);
+ *num = (s32)(cptr - (u8 *)pdata);
return CSR_RESULT_SUCCESS;
}
card->dmem_page = page;
}
- *paddr = ((CsrInt32)addr * 2) + (dmem_addr & 1);
+ *paddr = ((s32)addr * 2) + (dmem_addr & 1);
return CSR_RESULT_SUCCESS;
} /* set_dmem_page() */
card->pmem_page = page;
}
- *paddr = ((CsrInt32)addr * 2) + (pmem_addr & 1);
+ *paddr = ((s32)addr * 2) + (pmem_addr & 1);
return CSR_RESULT_SUCCESS;
} /* set_pmem_page() */
*/
static CsrResult set_page(card_t *card, u32 generic_addr, u32 *paddr)
{
- CsrInt32 space;
+ s32 space;
u32 addr;
CsrResult r = CSR_RESULT_SUCCESS;
* Value read from memory (0-127) or -1 on error
* ---------------------------------------------------------------------------
*/
-CsrInt32 unifi_read_shared_count(card_t *card, u32 addr)
+s32 unifi_read_shared_count(card_t *card, u32 addr)
{
u8 b;
/* I've increased this count, because I have seen cases where
* with increasing this limit. It's better to take a while to
* recover than to fail. */
#define SHARED_READ_RETRY_LIMIT 10
- CsrInt32 i;
+ s32 i;
/*
* Get the to-host-signals-written count.
* This avoids a race between driver read and firmware write of the
* word, the value we need is in the lower 8 bits anway.
*/
- return (CsrInt32)(b & 0xff);
+ return (s32)(b & 0xff);
}
}
/* Decode a windowed access to the chip. */
-CsrInt32 ChipHelper_DecodeWindow(ChipDescript *chip_help,
+s32 ChipHelper_DecodeWindow(ChipDescript *chip_help,
enum chip_helper_window_index window,
enum chip_helper_window_type type,
u32 offset,
CHIP_HELPER_DEF0(m, (u32, PROGRAM_MEMORY_FLASH_OFFSET, prog_offset.flash)) \
CHIP_HELPER_DEF0(m, (u32, PROGRAM_MEMORY_EXT_SRAM_OFFSET, prog_offset.ext_sram)) \
CHIP_HELPER_DEF0(m, (u16, DATA_MEMORY_RAM_OFFSET, data_offset.ram)) \
- CHIP_HELPER_DEF0(m, (CsrInt32, HasFlash, bools.has_flash)) \
- CHIP_HELPER_DEF0(m, (CsrInt32, HasExtSram, bools.has_ext_sram)) \
- CHIP_HELPER_DEF0(m, (CsrInt32, HasRom, bools.has_rom)) \
- CHIP_HELPER_DEF0(m, (CsrInt32, HasBt, bools.has_bt)) \
- CHIP_HELPER_DEF0(m, (CsrInt32, HasWLan, bools.has_wlan)) \
+ CHIP_HELPER_DEF0(m, (s32, HasFlash, bools.has_flash)) \
+ CHIP_HELPER_DEF0(m, (s32, HasExtSram, bools.has_ext_sram)) \
+ CHIP_HELPER_DEF0(m, (s32, HasRom, bools.has_rom)) \
+ CHIP_HELPER_DEF0(m, (s32, HasBt, bools.has_bt)) \
+ CHIP_HELPER_DEF0(m, (s32, HasWLan, bools.has_wlan)) \
CHIP_HELPER_DEF1(m, (u16, WINDOW_ADDRESS, enum chip_helper_window_index, window)) \
CHIP_HELPER_DEF1(m, (u16, WINDOW_SIZE, enum chip_helper_window_index, window)) \
CHIP_HELPER_DEF1(m, (u16, MapAddress_SPI2HOST, u16, addr)) \
address in the XAPs 16 address map to read from. 'len'
is the length that we can read without having to change
the page registers. */
-CsrInt32 ChipHelper_DecodeWindow(ChipDescript *chip_help,
+s32 ChipHelper_DecodeWindow(ChipDescript *chip_help,
enum chip_helper_window_index window,
enum chip_helper_window_type type,
u32 offset,
/* The DecodeWindow function, see the description of the C version. */
- CsrInt32 DecodeWindow(chip_helper_window_index window,
+ s32 DecodeWindow(chip_helper_window_index window,
chip_helper_window_type type,
u32 offset,
u16 &page, u16 &addr, u32 &len) const;
written to the page register. */
struct window_shift_info_t
{
- CsrInt32 allowed;
+ s32 allowed;
u32 page_shift;
u16 page_offset;
};
address of GBL_CHIP_VERSION is FF9A, else its FE81. */
struct chip_version_t
{
- CsrInt32 pre_bc7;
+ s32 pre_bc7;
u16 mask;
u16 result;
u8 sdio;
CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 2))
-CsrInt32 get_packed_struct_size(const u8 *buf);
+s32 get_packed_struct_size(const u8 *buf);
CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig);
CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len);
{
u32 offset;
u8 *buf;
- CsrInt32 data_len;
+ s32 data_len;
u32 write_len;
CsrResult r;
const u16 buf_size = 2 * 1024;
static CsrResult do_patch_download(card_t *card, void *dlpriv, xbv1_t *pfwinfo, u32 boot_ctrl_addr)
{
CsrResult r;
- CsrInt32 i;
+ s32 i;
u16 loader_version;
u16 handle;
u32 total_bytes;
static CsrResult unifi_coredump_read_zones(card_t *card, coredump_buffer *dump_buf);
static CsrResult unifi_coredump_read_zone(card_t *card, u16 *zone,
const struct coredump_zone *def);
-static CsrInt32 get_value_from_coredump(const coredump_buffer *dump,
+static s32 get_value_from_coredump(const coredump_buffer *dump,
const unifi_coredump_space_t space, const u16 offset);
/* Table of chip memory zones we capture on mini-coredump */
* Notes:
* ---------------------------------------------------------------------------
*/
-static CsrInt32 get_value_from_coredump(const coredump_buffer *coreDump,
+static s32 get_value_from_coredump(const coredump_buffer *coreDump,
const unifi_coredump_space_t space,
const u16 offset_in_space)
{
- CsrInt32 r = -1;
+ s32 r = -1;
u16 offset_in_zone;
u32 zone_end_offset;
- CsrInt32 i;
+ s32 i;
const struct coredump_zone *def = &zonedef_table[0];
/* Search zone def table for a match with the requested memory space */
{
/* Calculate the offset of data within the zone buffer */
offset_in_zone = offset_in_space - def->offset;
- r = (CsrInt32) * (coreDump->zone[i] + offset_in_zone);
+ r = (s32) * (coreDump->zone[i] + offset_in_zone);
unifi_trace(NULL, UDBG6,
"sp %d, offs 0x%04x = 0x%04x (in z%d 0x%04x->0x%04x)\n",
CsrResult unifi_coredump_get_value(card_t *card, struct unifi_coredump_req *req)
{
CsrResult r;
- CsrInt32 i = 0;
+ s32 i = 0;
coredump_buffer *find_dump = NULL;
func_enter();
static CsrResult unifi_coredump_read_zones(card_t *card, coredump_buffer *dump_buf)
{
CsrResult r = CSR_RESULT_SUCCESS;
- CsrInt32 i;
+ s32 i;
func_enter();
{
coredump_buffer *newnode = NULL;
u16 *newzone = NULL;
- CsrInt32 i;
+ s32 i;
u32 zone_size;
/* Allocate node header */
* This is useful for stepping past the signal to the object in the buffer.
* ---------------------------------------------------------------------------
*/
-CsrInt32 get_packed_struct_size(const u8 *buf)
+s32 get_packed_struct_size(const u8 *buf)
{
- CsrInt32 size = 0;
+ s32 size = 0;
u16 sig_id;
sig_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(buf);
*/
CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig)
{
- CsrInt32 index = 0;
+ s32 index = 0;
sig->SignalPrimitiveHeader.SignalId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
index += SIZEOF_UINT16;
#include "csr_wifi_hip_unifi.h"
-CsrInt32 SigGetSize(const CSR_SIGNAL *aSignal)
+s32 SigGetSize(const CSR_SIGNAL *aSignal)
{
switch (aSignal->SignalPrimitiveHeader.SignalId)
{
}
-CsrInt32 SigGetDataRefs(CSR_SIGNAL *aSignal, CSR_DATAREF **aDataRef)
+s32 SigGetDataRefs(CSR_SIGNAL *aSignal, CSR_DATAREF **aDataRef)
{
- CsrInt32 numRefs = 0;
+ s32 numRefs = 0;
switch (aSignal->SignalPrimitiveHeader.SignalId)
{
* RETURNS:
* The number of data-refs in the signal.
*/
-CsrInt32 SigGetDataRefs(CSR_SIGNAL *aSignal, CSR_DATAREF **aDataRef);
+s32 SigGetDataRefs(CSR_SIGNAL *aSignal, CSR_DATAREF **aDataRef);
/******************************************************************************
* SigGetSize - Retrieve the size (in bytes) of a given signal.
* RETURNS:
* The size (in bytes) of the given signal.
*/
-CsrInt32 SigGetSize(const CSR_SIGNAL *aSignal);
+s32 SigGetSize(const CSR_SIGNAL *aSignal);
#ifdef __cplusplus
}
* None.
* ---------------------------------------------------------------------------
*/
-CsrInt32 unifi_print_status(card_t *card, CsrCharString *str, CsrInt32 *remain)
+s32 unifi_print_status(card_t *card, CsrCharString *str, s32 *remain)
{
CsrCharString *p = str;
sdio_config_data_t *cfg;
u16 i, n;
- CsrInt32 remaining = *remain;
- CsrInt32 written;
+ s32 remaining = *remain;
+ s32 written;
#ifdef CSR_UNSAFE_SDIO_ACCESS
- CsrInt32 iostate;
+ s32 iostate;
CsrResult r;
static const CsrCharString *const states[] = {
"AWAKE", "DROWSY", "TORPID"
typedef struct unifi_coredump_req
{
/* From user */
- CsrInt32 index; /* 0=newest, -1=oldest */
+ s32 index; /* 0=newest, -1=oldest */
unifi_coredump_space_t space; /* memory space */
u32 offset; /* register offset in space */
/* From driver */
u32 drv_build; /* Driver build id */
u32 chip_ver; /* Chip version */
u32 fw_ver; /* Firmware version */
- CsrInt32 requestor; /* Requestor: 0=auto dump, 1=manual */
+ s32 requestor; /* Requestor: 0=auto dump, 1=manual */
CsrTime timestamp; /* time of capture by driver */
u32 serial; /* capture serial number */
- CsrInt32 value; /* register value */
+ s32 value; /* register value */
} unifi_coredump_req_t; /* mini-coredumped reg value request */
*
* @ingroup upperedge
*/
-CsrResult unifi_init_card(card_t *card, CsrInt32 led_mask);
+CsrResult unifi_init_card(card_t *card, s32 led_mask);
/**
*
*
* @ingroup upperedge
*/
-CsrResult unifi_check_io_status(card_t *card, CsrInt32 *status);
+CsrResult unifi_check_io_status(card_t *card, s32 *status);
/**
*
* @ingroup upperedge
*/
-CsrInt32 unifi_fw_read(void *ospriv, void *arg, u32 offset, void *buf, u32 len);
+s32 unifi_fw_read(void *ospriv, void *arg, u32 offset, void *buf, u32 len);
/**
*
* that excludes HIP initialization.
*/
CsrResult unifi_init(card_t *card);
-CsrResult unifi_download(card_t *card, CsrInt32 led_mask);
+CsrResult unifi_download(card_t *card, s32 led_mask);
/*
* unifi_start_processors() ensures both on-chip processors are running
* This is used in the linux /proc interface and might be useful
* in other systems.
*/
-CsrInt32 unifi_print_status(card_t *card, CsrCharString *str, CsrInt32 *remain);
+s32 unifi_print_status(card_t *card, CsrCharString *str, s32 *remain);
#define UNIFI_SNPRINTF_RET(buf_p, remain, written) \
do { \
typedef struct
{
void *dlpriv;
- CsrInt32 ioffset;
+ s32 ioffset;
fwreadfn_t iread;
} ct_t;
struct
{
xbv_container container;
- CsrInt32 ioffset_end;
+ s32 ioffset_end;
} s[XBV_STACK_SIZE];
u32 ptr;
} xbv_stack_t;
-static CsrInt32 read_tag(card_t *card, ct_t *ct, tag_t *tag);
-static CsrInt32 read_bytes(card_t *card, ct_t *ct, void *buf, u32 len);
-static CsrInt32 read_uint(card_t *card, ct_t *ct, u32 *u, u32 len);
-static CsrInt32 xbv_check(xbv1_t *fwinfo, const xbv_stack_t *stack,
+static s32 read_tag(card_t *card, ct_t *ct, tag_t *tag);
+static s32 read_bytes(card_t *card, ct_t *ct, void *buf, u32 len);
+static s32 read_uint(card_t *card, ct_t *ct, u32 *u, u32 len);
+static s32 xbv_check(xbv1_t *fwinfo, const xbv_stack_t *stack,
xbv_mode new_mode, xbv_container old_cont);
-static CsrInt32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack,
+static s32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack,
xbv_mode new_mode, xbv_container old_cont,
xbv_container new_cont, u32 ioff);
/* Now scan the file */
while (1)
{
- CsrInt32 n;
+ s32 n;
n = read_tag(card, &ct, &tag);
if (n < 0)
/* Check the the XBV file is of a consistant sort (either firmware or
* patch) and that we are in the correct containing list type. */
-static CsrInt32 xbv_check(xbv1_t *fwinfo, const xbv_stack_t *stack,
+static s32 xbv_check(xbv1_t *fwinfo, const xbv_stack_t *stack,
xbv_mode new_mode, xbv_container old_cont)
{
/* If the new file mode is unknown the current packet could be in
/* Make checks as above and then enter a new list */
-static CsrInt32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack,
+static s32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack,
xbv_mode new_mode, xbv_container old_cont,
xbv_container new_cont, u32 new_ioff)
{
}
-static u32 xbv2uint(u8 *ptr, CsrInt32 len)
+static u32 xbv2uint(u8 *ptr, s32 len)
{
u32 u = 0;
s16 i;
}
-static CsrInt32 read_tag(card_t *card, ct_t *ct, tag_t *tag)
+static s32 read_tag(card_t *card, ct_t *ct, tag_t *tag)
{
u8 buf[8];
- CsrInt32 n;
+ s32 n;
n = (*ct->iread)(card->ospriv, ct->dlpriv, ct->ioffset, buf, 8);
if (n <= 0)
} /* read_tag() */
-static CsrInt32 read_bytes(card_t *card, ct_t *ct, void *buf, u32 len)
+static s32 read_bytes(card_t *card, ct_t *ct, void *buf, u32 len)
{
/* read the tag value */
- if ((*ct->iread)(card->ospriv, ct->dlpriv, ct->ioffset, buf, len) != (CsrInt32)len)
+ if ((*ct->iread)(card->ospriv, ct->dlpriv, ct->ioffset, buf, len) != (s32)len)
{
return -1;
}
} /* read_bytes() */
-static CsrInt32 read_uint(card_t *card, ct_t *ct, u32 *u, u32 len)
+static s32 read_uint(card_t *card, ct_t *ct, u32 *u, u32 len)
{
u8 buf[4];
* Number of SLUT entries in the f/w, or -1 if the image was corrupt.
* ---------------------------------------------------------------------------
*/
-CsrInt32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo,
+s32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo,
symbol_t *slut, u32 slut_len)
{
s16 i;
- CsrInt32 offset;
+ s32 offset;
u32 magic;
u32 count = 0;
ct_t ct;
} xbv1_t;
-typedef CsrInt32 (*fwreadfn_t)(void *ospriv, void *dlpriv, u32 offset, void *buf, u32 len);
+typedef s32 (*fwreadfn_t)(void *ospriv, void *dlpriv, u32 offset, void *buf, u32 len);
CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo);
-CsrInt32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo,
+s32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo,
symbol_t *slut, u32 slut_len);
void* xbv_to_patch(card_t *card, fwreadfn_t readfn, const void *fw_buf, const xbv1_t *fwinfo,
u32 *size);
DECLARE_MUTEX(udi_mutex);
#endif
-CsrInt32 CsrHipResultToStatus(CsrResult csrResult)
+s32 CsrHipResultToStatus(CsrResult csrResult)
{
- CsrInt32 r = -EIO;
+ s32 r = -EIO;
switch (csrResult)
{
* The number of bytes read from the firmware image, or -ve on error
* ---------------------------------------------------------------------------
*/
-CsrInt32
+s32
unifi_fw_read(void *ospriv, void *arg, u32 offset, void *buf, u32 len)
{
const struct dlpriv *dlpriv = arg;
unifi_priv_t *priv;
int actual_amount_to_copy;
char *p, *orig_p;
- CsrInt32 remain = UNIFI_DEBUG_TXT_BUFFER;
- CsrInt32 written;
+ s32 remain = UNIFI_DEBUG_TXT_BUFFER;
+ s32 written;
int i;
/*
int unifi_putest_coredump_prepare(unifi_priv_t *priv, unsigned char *arg)
{
u16 data_u16;
- CsrInt32 i;
+ s32 i;
CsrResult r;
unifi_info(priv, "Preparing for SDIO coredump\n");
int sme_mgt_wifi_on(unifi_priv_t *priv)
{
int r,i;
- CsrInt32 csrResult;
+ s32 csrResult;
if (priv == NULL) {
return -EINVAL;
void update_tim(unifi_priv_t * priv, u16 aid, u8 setTim, u16 interfaceTag, u32 handle)
{
CSR_SIGNAL signal;
- CsrInt32 r;
+ s32 r;
CSR_MLME_SET_TIM_REQUEST *req = &signal.u.MlmeSetTimRequest;
bulk_data_param_t *bulkdata = NULL;
netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
#define UNLOCK_DRIVER(_p) (void)(_p); /* as nothing */
#endif /* USE_DRIVER_LOCK */
-CsrInt32 CsrHipResultToStatus(CsrResult csrResult);
+s32 CsrHipResultToStatus(CsrResult csrResult);
/*