tilib: don't use clientHandle.

On 64-bit Windows systems, this callback argument isn't big enough to
hold a pointer. Use a global static variable instead.
This commit is contained in:
Daniel Beer 2015-06-08 11:40:06 +12:00
parent 4ea3856202
commit 7869fb7f6a
1 changed files with 11 additions and 10 deletions

View File

@ -39,6 +39,8 @@ struct tilib_device {
fperm_t active_fperm; fperm_t active_fperm;
}; };
static struct tilib_device *client_handle;
#define MID_SINGLE_STEP 0x01 #define MID_SINGLE_STEP 0x01
#define MID_BREAKPOINT 0x02 #define MID_BREAKPOINT 0x02
#define MID_STORAGE 0x04 #define MID_STORAGE 0x04
@ -58,16 +60,15 @@ static const MessageID_t my_message_ids = {
}; };
static void event_notify(unsigned int msg_id, unsigned int w_param, static void event_notify(unsigned int msg_id, unsigned int w_param,
long l_param, long client_handle) long l_param, long client_handle_unused)
{ {
struct tilib_device *dev = (struct tilib_device *)client_handle;
(void)w_param; (void)w_param;
(void)l_param; (void)l_param;
(void)client_handle_unused;
thread_lock_acquire(&dev->mb_lock); thread_lock_acquire(&client_handle->mb_lock);
dev->mailbox |= msg_id; client_handle->mailbox |= msg_id;
thread_lock_release(&dev->mb_lock); thread_lock_release(&client_handle->mb_lock);
} }
static uint32_t event_fetch(struct tilib_device *dev) static uint32_t event_fetch(struct tilib_device *dev)
@ -404,11 +405,10 @@ static void tilib_destroy(device_t dev_base)
} }
static void fw_progress(unsigned int msg_id, unsigned long w_param, static void fw_progress(unsigned int msg_id, unsigned long w_param,
unsigned long l_param, long client_handle) unsigned long l_param, long client_handle_unused)
{ {
struct tilib_device *dev = (struct tilib_device *)client_handle;
(void)l_param; (void)l_param;
(void)client_handle_unused;
switch (msg_id) { switch (msg_id) {
case BL_DATA_BLOCK_PROGRAMMED: case BL_DATA_BLOCK_PROGRAMMED:
@ -419,7 +419,7 @@ static void fw_progress(unsigned int msg_id, unsigned long w_param,
break; break;
case BL_UPDATE_ERROR: case BL_UPDATE_ERROR:
report_error(dev, "BL_UPDATE_ERROR"); report_error(client_handle, "BL_UPDATE_ERROR");
break; break;
case BL_WAIT_FOR_TIMEOUT: case BL_WAIT_FOR_TIMEOUT:
@ -601,6 +601,7 @@ static device_t tilib_open(const struct device_args *args)
free(dev); free(dev);
return NULL; return NULL;
} }
client_handle = dev;
/* Copy the args->path to the dev->uifPath buffer /* Copy the args->path to the dev->uifPath buffer
* we may need to change it for automatic detection, and * we may need to change it for automatic detection, and