~ubuntu-branches/ubuntu/raring/avr-libc/raring-proposed

« back to all changes in this revision

Viewing changes to include/avr/boot.h

  • Committer: Bazaar Package Importer
  • Author(s): Hakan Ardo
  • Date: 2010-02-21 11:54:12 UTC
  • mfrom: (1.1.9 upstream) (4.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100221115412-jtvrd3t0vo3qbmvg
Tags: 1:1.6.8-1
* New upstream release 
* Replaced builddep on gs-gpl with ghostscript
* Autotools executed during build.
* Now build-depends on doxygen >= 1.6.2 
* Errors in first two latex passes ignored (closes: #562312)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007  Eric B. Weddington
 
1
/* Copyright (c) 2002,2003,2004,2005,2006,2007,2008,2009  Eric B. Weddington
2
2
   All rights reserved.
3
3
 
4
4
   Redistribution and use in source and binary forms, with or without
26
26
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
27
  POSSIBILITY OF SUCH DAMAGE. */
28
28
 
29
 
/* $Id: boot.h,v 1.27.2.5 2009/04/25 21:29:10 arcanum Exp $ */
 
29
/* $Id: boot.h,v 1.27.2.6 2009/09/14 07:52:23 arcanum Exp $ */
30
30
 
31
31
#ifndef _AVR_BOOT_H_
32
32
#define _AVR_BOOT_H_    1
211
211
        "clr  r1\n\t"                            \
212
212
        :                                        \
213
213
        : "i" (_SFR_MEM_ADDR(__SPM_REG)),        \
214
 
          "r" ((uint8_t)__BOOT_PAGE_FILL),       \
215
 
          "z" ((uint16_t)address),               \
216
 
          "r" ((uint16_t)data)                   \
 
214
          "r" ((uint8_t)(__BOOT_PAGE_FILL)),     \
 
215
          "z" ((uint16_t)(address)),             \
 
216
          "r" ((uint16_t)(data))                 \
217
217
        : "r0"                                   \
218
218
    );                                           \
219
219
}))
230
230
        "clr  r1\n\t"                            \
231
231
        :                                        \
232
232
        : "i" (_SFR_MEM_ADDR(__SPM_REG)),        \
233
 
          "r" ((uint8_t)__BOOT_PAGE_FILL),       \
234
 
          "z" ((uint16_t)address),               \
235
 
          "r" ((uint16_t)data)                   \
 
233
          "r" ((uint8_t)(__BOOT_PAGE_FILL)),     \
 
234
          "z" ((uint16_t)(address)),             \
 
235
          "r" ((uint16_t)(data))                 \
236
236
        : "r0"                                   \
237
237
    );                                           \
238
238
}))
250
250
        :                                        \
251
251
        : "i" (_SFR_MEM_ADDR(__SPM_REG)),        \
252
252
          "i" (_SFR_MEM_ADDR(RAMPZ)),            \
253
 
          "r" ((uint8_t)__BOOT_PAGE_FILL),       \
254
 
          "r" ((uint32_t)address),               \
255
 
          "r" ((uint16_t)data)                   \
 
253
          "r" ((uint8_t)(__BOOT_PAGE_FILL)),     \
 
254
          "r" ((uint32_t)(address)),             \
 
255
          "r" ((uint16_t)(data))                 \
256
256
        : "r0", "r30", "r31"                     \
257
257
    );                                           \
258
258
}))
265
265
        "spm\n\t"                                \
266
266
        :                                        \
267
267
        : "i" (_SFR_MEM_ADDR(__SPM_REG)),        \
268
 
          "r" ((uint8_t)__BOOT_PAGE_ERASE),      \
269
 
          "z" ((uint16_t)address)                \
 
268
          "r" ((uint8_t)(__BOOT_PAGE_ERASE)),    \
 
269
          "z" ((uint16_t)(address))              \
270
270
    );                                           \
271
271
}))
272
272
 
280
280
        "nop\n\t"                                \
281
281
        :                                        \
282
282
        : "i" (_SFR_MEM_ADDR(__SPM_REG)),        \
283
 
          "r" ((uint8_t)__BOOT_PAGE_ERASE),      \
284
 
          "z" ((uint16_t)address)                \
 
283
          "r" ((uint8_t)(__BOOT_PAGE_ERASE)),    \
 
284
          "z" ((uint16_t)(address))              \
285
285
    );                                           \
286
286
}))
287
287
 
296
296
        :                                        \
297
297
        : "i" (_SFR_MEM_ADDR(__SPM_REG)),        \
298
298
          "i" (_SFR_MEM_ADDR(RAMPZ)),            \
299
 
          "r" ((uint8_t)__BOOT_PAGE_ERASE),      \
300
 
          "r" ((uint32_t)address)                \
 
299
          "r" ((uint8_t)(__BOOT_PAGE_ERASE)),    \
 
300
          "r" ((uint32_t)(address))              \
301
301
        : "r30", "r31"                           \
302
302
    );                                           \
303
303
}))
310
310
        "spm\n\t"                                \
311
311
        :                                        \
312
312
        : "i" (_SFR_MEM_ADDR(__SPM_REG)),        \
313
 
          "r" ((uint8_t)__BOOT_PAGE_WRITE),      \
314
 
          "z" ((uint16_t)address)                \
 
313
          "r" ((uint8_t)(__BOOT_PAGE_WRITE)),    \
 
314
          "z" ((uint16_t)(address))              \
315
315
    );                                           \
316
316
}))
317
317
 
325
325
        "nop\n\t"                                \
326
326
        :                                        \
327
327
        : "i" (_SFR_MEM_ADDR(__SPM_REG)),        \
328
 
          "r" ((uint8_t)__BOOT_PAGE_WRITE),      \
329
 
          "z" ((uint16_t)address)                \
 
328
          "r" ((uint8_t)(__BOOT_PAGE_WRITE)),    \
 
329
          "z" ((uint16_t)(address))              \
330
330
    );                                           \
331
331
}))
332
332
 
341
341
        :                                        \
342
342
        : "i" (_SFR_MEM_ADDR(__SPM_REG)),        \
343
343
          "i" (_SFR_MEM_ADDR(RAMPZ)),            \
344
 
          "r" ((uint8_t)__BOOT_PAGE_WRITE),      \
345
 
          "r" ((uint32_t)address)                \
 
344
          "r" ((uint8_t)(__BOOT_PAGE_WRITE)),    \
 
345
          "r" ((uint32_t)(address))              \
346
346
        : "r30", "r31"                           \
347
347
    );                                           \
348
348
}))
355
355
        "spm\n\t"                                \
356
356
        :                                        \
357
357
        : "i" (_SFR_MEM_ADDR(__SPM_REG)),        \
358
 
          "r" ((uint8_t)__BOOT_RWW_ENABLE)       \
 
358
          "r" ((uint8_t)(__BOOT_RWW_ENABLE))     \
359
359
    );                                           \
360
360
}))
361
361
 
369
369
        "nop\n\t"                                \
370
370
        :                                        \
371
371
        : "i" (_SFR_MEM_ADDR(__SPM_REG)),        \
372
 
          "r" ((uint8_t)__BOOT_RWW_ENABLE)       \
 
372
          "r" ((uint8_t)(__BOOT_RWW_ENABLE))     \
373
373
    );                                           \
374
374
}))
375
375
 
402
402
        "spm\n\t"                                          \
403
403
        :                                                  \
404
404
        : "i" (_SFR_MEM_ADDR(__SPM_REG)),                  \
405
 
          "r" ((uint8_t)__BOOT_LOCK_BITS_SET),             \
 
405
          "r" ((uint8_t)(__BOOT_LOCK_BITS_SET)),           \
406
406
          "r" (value)                                      \
407
407
        : "r0", "r30", "r31"                               \
408
408
    );                                                     \
422
422
        "nop\n\t"                                          \
423
423
        :                                                  \
424
424
        : "i" (_SFR_MEM_ADDR(__SPM_REG)),                  \
425
 
          "r" ((uint8_t)__BOOT_LOCK_BITS_SET),             \
 
425
          "r" ((uint8_t)(__BOOT_LOCK_BITS_SET)),           \
426
426
          "r" (value)                                      \
427
427
        : "r0", "r30", "r31"                               \
428
428
    );                                                     \
489
489
        "lpm %0, Z\n\t"                                    \
490
490
        : "=r" (__result)                                  \
491
491
        : "i" (_SFR_MEM_ADDR(__SPM_REG)),                  \
492
 
          "r" ((uint8_t)__BOOT_LOCK_BITS_SET),             \
493
 
          "z" ((uint16_t)address)                          \
 
492
          "r" ((uint8_t)(__BOOT_LOCK_BITS_SET)),           \
 
493
          "z" ((uint16_t)(address))                        \
494
494
    );                                                     \
495
495
    __result;                                              \
496
496
}))
509
509
#define __BOOT_SIGROW_READ (_BV(__SPM_ENABLE) | _BV(SIGRD))
510
510
 
511
511
#define boot_signature_byte_get(addr) \
512
 
(__extension__({                      \
513
 
      uint16_t __addr16 = (uint16_t)(addr);     \
514
 
      uint8_t __result;                         \
515
 
      __asm__ __volatile__                      \
516
 
      (                                         \
517
 
        "sts %1, %2\n\t"                        \
518
 
        "lpm %0, Z" "\n\t"                      \
519
 
        : "=r" (__result)                       \
520
 
        : "i" (_SFR_MEM_ADDR(__SPM_REG)),       \
521
 
          "r" ((uint8_t) __BOOT_SIGROW_READ),   \
522
 
          "z" (__addr16)                        \
523
 
      );                                        \
524
 
      __result;                                 \
 
512
(__extension__({                      \
 
513
      uint8_t __result;                         \
 
514
      __asm__ __volatile__                      \
 
515
      (                                         \
 
516
        "sts %1, %2\n\t"                        \
 
517
        "lpm %0, Z" "\n\t"                      \
 
518
        : "=r" (__result)                       \
 
519
        : "i" (_SFR_MEM_ADDR(__SPM_REG)),       \
 
520
          "r" ((uint8_t)(__BOOT_SIGROW_READ)),  \
 
521
          "z" ((uint16_t)(addr))                \
 
522
      );                                        \
 
523
      __result;                                 \
525
524
}))
526
525
 
527
526
/** \ingroup avr_boot