~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include <linux/netdevice.h>
31
31
#include <linux/timer.h>
32
32
#include <linux/delay.h>
33
 
#include <linux/slab.h>
34
33
#include <asm/io.h>
35
34
#include <asm/uaccess.h>
36
35
#include <linux/vmalloc.h>
96
95
USHORT hdr_checksum(PPSEUDO_HDR pHdr);
97
96
 
98
97
typedef struct _DSP_FILE_HDR {
99
 
        long build_date;
100
 
        long dsp_coff_date;
101
 
        long loader_code_address;
102
 
        long loader_code_size;
103
 
        long loader_code_end;
104
 
        long dsp_code_address;
105
 
        long dsp_code_size;
106
 
        long dsp_code_end;
107
 
        long reserved[8];
 
98
        u32  build_date;
 
99
        u32  dsp_coff_date;
 
100
        u32  loader_code_address;
 
101
        u32  loader_code_size;
 
102
        u32  loader_code_end;
 
103
        u32  dsp_code_address;
 
104
        u32  dsp_code_size;
 
105
        u32  dsp_code_end;
 
106
        u32  reserved[8];
108
107
} __attribute__ ((packed)) DSP_FILE_HDR, *PDSP_FILE_HDR;
109
108
 
110
109
typedef struct _DSP_FILE_HDR_5 {
111
 
        long version_id;        // Version ID of this image format.
112
 
        long package_id;        // Package ID of code release.
113
 
        long build_date;        // Date/time stamp when file was built.
114
 
        long commands_offset;   // Offset to attached commands in Pseudo Hdr format.
115
 
        long loader_offset;     // Offset to bootloader code.
116
 
        long loader_code_address;       // Start address of bootloader.
117
 
        long loader_code_end;   // Where bootloader code ends.
118
 
        long loader_code_size;
119
 
        long version_data_offset;       // Offset were scrambled version data begins.
120
 
        long version_data_size; // Size, in words, of scrambled version data.
121
 
        long nDspImages;        // Number of DSP images in file.
 
110
        u32  version_id;        // Version ID of this image format.
 
111
        u32  package_id;        // Package ID of code release.
 
112
        u32  build_date;        // Date/time stamp when file was built.
 
113
        u32  commands_offset;   // Offset to attached commands in Pseudo Hdr format.
 
114
        u32  loader_offset;     // Offset to bootloader code.
 
115
        u32  loader_code_address;       // Start address of bootloader.
 
116
        u32  loader_code_end;   // Where bootloader code ends.
 
117
        u32  loader_code_size;
 
118
        u32  version_data_offset;       // Offset were scrambled version data begins.
 
119
        u32  version_data_size; // Size, in words, of scrambled version data.
 
120
        u32  nDspImages;        // Number of DSP images in file.
122
121
} __attribute__ ((packed)) DSP_FILE_HDR_5, *PDSP_FILE_HDR_5;
123
122
 
124
123
typedef struct _DSP_IMAGE_INFO {
125
 
        long coff_date;         // Date/time when DSP Coff image was built.
126
 
        long begin_offset;      // Offset in file where image begins.
127
 
        long end_offset;        // Offset in file where image begins.
128
 
        long run_address;       // On chip Start address of DSP code.
129
 
        long image_size;        // Size of image.
130
 
        long version;           // Embedded version # of DSP code.
 
124
        u32  coff_date;         // Date/time when DSP Coff image was built.
 
125
        u32  begin_offset;      // Offset in file where image begins.
 
126
        u32  end_offset;        // Offset in file where image begins.
 
127
        u32  run_address;       // On chip Start address of DSP code.
 
128
        u32  image_size;        // Size of image.
 
129
        u32  version;           // Embedded version # of DSP code.
131
130
} __attribute__ ((packed)) DSP_IMAGE_INFO, *PDSP_IMAGE_INFO;
132
131
 
133
132
typedef struct _DSP_IMAGE_INFO_V6 {
134
 
        long coff_date;         // Date/time when DSP Coff image was built.
135
 
        long begin_offset;      // Offset in file where image begins.
136
 
        long end_offset;        // Offset in file where image begins.
137
 
        long run_address;       // On chip Start address of DSP code.
138
 
        long image_size;        // Size of image.
139
 
        long version;           // Embedded version # of DSP code.
 
133
        u32  coff_date;         // Date/time when DSP Coff image was built.
 
134
        u32  begin_offset;      // Offset in file where image begins.
 
135
        u32  end_offset;        // Offset in file where image begins.
 
136
        u32  run_address;       // On chip Start address of DSP code.
 
137
        u32  image_size;        // Size of image.
 
138
        u32  version;           // Embedded version # of DSP code.
140
139
        unsigned short checksum;        // Dsp File checksum
141
140
        unsigned short pad1;
142
141
} __attribute__ ((packed)) DSP_IMAGE_INFO_V6, *PDSP_IMAGE_INFO_V6;
310
309
        return chksum;
311
310
}
312
311
 
313
 
int card_download(struct net_device *dev, void *pFileStart, UINT FileLength)
 
312
int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength)
314
313
{
315
314
        FT1000_INFO *info = (PFT1000_INFO) netdev_priv(dev);
316
315
        int Status = SUCCESS;
847
846
                        break;
848
847
 
849
848
                case STATE_DONE_DWNLD:
850
 
                        if (((UINT) (pUcFile) - (UINT) pFileStart) >=
851
 
                                (UINT) FileLength) {
 
849
                        if (((unsigned long) (pUcFile) - (unsigned long) pFileStart) >=
 
850
                                (unsigned long) FileLength) {
852
851
                                uiState = STATE_DONE_FILE;
853
852
                                break;
854
853
                        }
902
901
                                                                  &info->prov_list);
903
902
                                                // Move to next entry if available
904
903
                                                pUcFile =
905
 
                                                        (UCHAR *) ((UINT) pUcFile +
906
 
                                                                   (UINT) ((usHdrLength + 1) & 0xFFFFFFFE) + sizeof(PSEUDO_HDR));
907
 
                                                if ((UINT) (pUcFile) -
908
 
                                                        (UINT) (pFileStart) >=
909
 
                                                        (UINT) FileLength) {
 
904
                                                        (UCHAR *) ((unsigned long) pUcFile +
 
905
                                                                   (unsigned long) ((usHdrLength + 1) & 0xFFFFFFFE) + sizeof(PSEUDO_HDR));
 
906
                                                if ((unsigned long) (pUcFile) -
 
907
                                                        (unsigned long) (pFileStart) >=
 
908
                                                        (unsigned long) FileLength) {
910
909
                                                        uiState =
911
910
                                                                STATE_DONE_FILE;
912
911
                                                }