Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

io76c711.h

00001 /* Copyright (c) 2002, Marek Michalkiewicz
00002    All rights reserved.
00003 
00004    Redistribution and use in source and binary forms, with or without
00005    modification, are permitted provided that the following conditions are met:
00006 
00007    * Redistributions of source code must retain the above copyright
00008      notice, this list of conditions and the following disclaimer.
00009    * Redistributions in binary form must reproduce the above copyright
00010      notice, this list of conditions and the following disclaimer in
00011      the documentation and/or other materials provided with the
00012      distribution.
00013 
00014   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00015   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00017   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00018   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00019   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00020   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00021   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00022   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00023   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00024   POSSIBILITY OF SUCH DAMAGE. */
00025 
00026 /* avr/io76c711.h - definitions for AT76C711 */
00027 
00028 #ifndef _AVR_IO76C711_H_
00029 #define _AVR_IO76C711_H_ 1
00030 
00031 /* This file should only be included from <avr/io.h>, never directly. */
00032 
00033 #ifndef _AVR_IO_H_
00034 #  error "Include <avr/io.h> instead of this file."
00035 #endif
00036 
00037 #ifndef _AVR_IOXXX_H_
00038 #  define _AVR_IOXXX_H_ "io76c711.h"
00039 #else
00040 #  error "Attempt to include more than one <avr/ioXXX.h> file."
00041 #endif 
00042 
00043 #include <avr/sfr_defs.h>
00044 
00045 /* I/O registers */
00046 
00047 /* 0x00-0x0C reserved */
00048 
00049 /* SPI */
00050 #define SPCR    _SFR_IO8(0x0D)
00051 #define SPSR    _SFR_IO8(0x0E)
00052 #define SPDR    _SFR_IO8(0x0F)
00053 
00054 /* Port D */
00055 #define PIND    _SFR_IO8(0x10)
00056 #define DDRD    _SFR_IO8(0x11)
00057 #define PORTD   _SFR_IO8(0x12)
00058 
00059 /* Peripheral Enable Register */
00060 #define PERIPHEN _SFR_IO8(0x13)
00061 
00062 /* Clock Control Register */
00063 #define CLK_CNTR _SFR_IO8(0x14)
00064 
00065 /* Data Register, Port C */
00066 #define PORTC   _SFR_IO8(0x15)
00067 
00068 /* Port B */
00069 #define PINB    _SFR_IO8(0x16)
00070 #define DDRB    _SFR_IO8(0x17)
00071 #define PORTB   _SFR_IO8(0x18)
00072 
00073 /* Port A */
00074 #define PINA    _SFR_IO8(0x19)
00075 #define DDRA    _SFR_IO8(0x1A)
00076 #define PORTA   _SFR_IO8(0x1B)
00077 
00078 /* 0x1C-0x1F reserved */
00079 
00080 #define IRDAMOD _SFR_IO8(0x20)
00081 
00082 #define WDTCR   _SFR_IO8(0x21)
00083 
00084 /* 0x22-0x25 reserved */
00085 /* Timer 1 */
00086 #define ICR1    _SFR_IO16(0x26)
00087 #define ICR1L   _SFR_IO8(0x26)
00088 #define ICR1H   _SFR_IO8(0x27)
00089 #define OCR1B   _SFR_IO16(0x28)
00090 #define OCR1BL  _SFR_IO8(0x28)
00091 #define OCR1BH  _SFR_IO8(0x29)
00092 #define OCR1A   _SFR_IO16(0x2A)
00093 #define OCR1AL  _SFR_IO8(0x2A)
00094 #define OCR1AH  _SFR_IO8(0x2B)
00095 #define TCNT1   _SFR_IO16(0x2C)
00096 #define TCNT1L  _SFR_IO8(0x2C)
00097 #define TCNT1H  _SFR_IO8(0x2D)
00098 #define TCCR1B  _SFR_IO8(0x2E)
00099 #define TCCR1A  _SFR_IO8(0x2F)
00100 
00101 /* 0x30 reserved */
00102 
00103 /* Timer 0 */
00104 #define PRELD   _SFR_IO8(0x31)
00105 #define TCNT0   _SFR_IO8(0x32)
00106 #define TCCR0   _SFR_IO8(0x33)
00107 
00108 #define MCUSR   _SFR_IO8(0x34)
00109 #define MCUCR   _SFR_IO8(0x35)
00110 
00111 #define TIFR    _SFR_IO8(0x36)
00112 #define TIMSK   _SFR_IO8(0x37)
00113 
00114 /* 0x38 reserved */
00115 
00116 #define EIMSK   _SFR_IO8(0x39)
00117 
00118 /* 0x3A-0x3C reserved */
00119 
00120 #define SPL     _SFR_IO8(0x3D)
00121 #define SPH     _SFR_IO8(0x3E)
00122 #define SREG    _SFR_IO8(0x3F)
00123 
00124 
00125 /* Interrupt vectors */
00126 
00127 #define SIG_SUSPEND_RESUME      _VECTOR(1)
00128 #define SIG_INTERRUPT0          _VECTOR(2)
00129 #define SIG_INPUT_CAPTURE1      _VECTOR(3)
00130 #define SIG_OUTPUT_COMPARE1A    _VECTOR(4)
00131 #define SIG_OUTPUT_COMPARE1B    _VECTOR(5)
00132 #define SIG_OVERFLOW1           _VECTOR(6)
00133 #define SIG_OVERFLOW0           _VECTOR(7)
00134 #define SIG_SPI                 _VECTOR(8)
00135 #define SIG_TDMAC               _VECTOR(9)
00136 #define SIG_UART0               _VECTOR(10)
00137 #define SIG_RDMAC               _VECTOR(11)
00138 #define SIG_USB_HW              _VECTOR(12)
00139 #define SIG_UART1               _VECTOR(13)
00140 #define SIG_INTERRUPT1          _VECTOR(14)
00141 
00142 #define _VECTORS_SIZE 60
00143 
00144 /* Bit numbers */
00145 
00146 /* EIMSK */
00147 /* bits 7-4 reserved */
00148 #define POL1    3
00149 #define POL0    2
00150 #define INT1    1
00151 #define INT0    0
00152 
00153 /* TIMSK */
00154 #define TOIE1   7
00155 #define OCIE1A  6
00156 #define OCIE1B  5
00157 /* bit 4 reserved */
00158 #define TICIE1  3
00159 /* bit 2 reserved */
00160 #define TOIE0   1
00161 /* bit 0 reserved */
00162 
00163 /* TIFR */
00164 #define TOV1    7
00165 #define OCF1A   6
00166 #define OCF1B   5
00167 /* bit 4 reserved */
00168 #define ICF1    3
00169 /* bit 2 reserved */
00170 #define TOV0    1
00171 /* bit 0 reserved */
00172 
00173 /* MCUCR */
00174 /* bits 7-6 reserved */
00175 #define SE      5
00176 #define SM1     4
00177 #define SM0     3
00178 /* bits 2-0 reserved */
00179 
00180 /* MCUSR */
00181 /* bits 7-2 reserved */
00182 #define EXTRF   1
00183 #define PORF    0
00184 
00185 /* TCCR0 */
00186 /* bits 7-6 reserved */
00187 #define COM01   5
00188 #define COM00   4
00189 #define CTC0    3
00190 #define CS02    2
00191 #define CS01    1
00192 #define CS00    0
00193 
00194 /* TCCR1A */
00195 #define COM1A1  7
00196 #define COM1A0  6
00197 #define COM1B1  5
00198 #define COM1B0  4
00199 /* bits 3-0 reserved */
00200 
00201 /* TCCR1B */
00202 #define ICNC1   7
00203 #define ICES1   6
00204 /* bits 5-4 reserved */
00205 #define CTC1    3
00206 #define CS12    2
00207 #define CS11    1
00208 #define CS10    0
00209 
00210 /* WDTCR */
00211 /* bits 7-5 reserved */
00212 #define WDTOE   4
00213 #define WDE     3
00214 #define WDP2    2
00215 #define WDP1    1
00216 #define WDP0    0
00217 
00218 /* IRDAMOD */
00219 /* bits 7-3 reserved */
00220 #define POL     2
00221 #define MODE    1
00222 #define EN      0
00223 
00224 /* PORTA */
00225 #define PA7     7
00226 #define PA6     6
00227 #define PA5     5
00228 #define PA4     4
00229 #define PA3     3
00230 #define PA2     2
00231 #define PA1     1
00232 #define PA0     0
00233 
00234 /* DDRA */
00235 #define DDA7    7
00236 #define DDA6    6
00237 #define DDA5    5
00238 #define DDA4    4
00239 #define DDA3    3
00240 #define DDA2    2
00241 #define DDA1    1
00242 #define DDA0    0
00243 
00244 /* PINA */
00245 #define PINA7   7
00246 #define PINA6   6
00247 #define PINA5   5
00248 #define PINA4   4
00249 #define PINA3   3
00250 #define PINA2   2
00251 #define PINA1   1
00252 #define PINA0   0
00253 
00254 /*
00255    PB7 = SCK
00256    PB6 = MISO
00257    PB5 = MOSI
00258    PB4 = SS#
00259    PB2 = ICP
00260    PB1 = T1
00261    PB0 = T0
00262  */
00263 
00264 /* PORTB */
00265 #define PB7     7
00266 #define PB6     6
00267 #define PB5     5
00268 #define PB4     4
00269 #define PB3     3
00270 #define PB2     2
00271 #define PB1     1
00272 #define PB0     0
00273 
00274 /* DDRB */
00275 #define DDB7    7
00276 #define DDB6    6
00277 #define DDB5    5
00278 #define DDB4    4
00279 #define DDB3    3
00280 #define DDB2    2
00281 #define DDB1    1
00282 #define DDB0    0
00283 
00284 /* PINB */
00285 #define PINB7   7
00286 #define PINB6   6
00287 #define PINB5   5
00288 #define PINB4   4
00289 #define PINB3   3
00290 #define PINB2   2
00291 #define PINB1   1
00292 #define PINB0   0
00293 
00294 /* PORTC */
00295 /* bits 7-4 reserved */
00296 #define PC3      3
00297 #define PC2      2
00298 #define PC1      1
00299 #define PC0      0
00300 
00301 /*
00302    PD7 = INT1 / OC1B
00303    PD6 = INT0 / OC1A
00304    PD1 = TXD
00305    PD0 = RXD
00306  */
00307 
00308 /* PORTD */
00309 #define PD7      7
00310 #define PD6      6
00311 #define PD5      5
00312 #define PD4      4
00313 #define PD3      3
00314 #define PD2      2
00315 #define PD1      1
00316 #define PD0      0
00317 
00318 /* DDRD */
00319 #define DDD7    7
00320 #define DDD6    6
00321 #define DDD5    5
00322 #define DDD4    4
00323 #define DDD3    3
00324 #define DDD2    2
00325 #define DDD1    1
00326 #define DDD0    0
00327 
00328 /* PIND */
00329 #define PIND7   7
00330 #define PIND6   6
00331 #define PIND5   5
00332 #define PIND4   4
00333 #define PIND3   3
00334 #define PIND2   2
00335 #define PIND1   1
00336 #define PIND0   0
00337 
00338 /* CLK_CNTR */
00339 /* bits 7-5 reserved */
00340 #define UOSC    4
00341 #define UCK     3
00342 #define IRCK    2
00343 /* bits 1-0 reserved */
00344 
00345 /* PERIPHEN */
00346 /* bits 7-3 reserved */
00347 #define IRDA    2
00348 #define UART    1
00349 #define USB     0
00350 
00351 /* SPSR */
00352 #define SPIF    7
00353 #define WCOL    6
00354 /* bits 5-0 reserved */
00355 
00356 /* SPCR */
00357 #define SPIE    7
00358 #define SPE     6
00359 #define DORD    5
00360 #define MSTR    4
00361 #define CPOL    3
00362 #define CPHA    2
00363 #define SPR1    1
00364 #define SPR0    0
00365 
00366 /* Memory mapped registers (XXX - not yet changed to use _SFR_MEM8() macros) */
00367 
00368 /* UART */
00369 #define UART0_BASE 0x2020
00370 #define UART1_BASE 0x2030
00371 /* offsets from the base address */
00372 #define US_RHR          0x00
00373 #define US_THR          0x00
00374 #define US_IER          0x01
00375 #define US_FCR          0x02
00376 #define US_PMR          0x03
00377 #define US_MR           0x04
00378 #define US_CSR          0x05
00379 #define US_CR           0x06
00380 #define US_BL           0x07
00381 #define US_BM           0x08
00382 #define US_RTO          0x09
00383 #define US_TTG          0x0A
00384 
00385 /* DMA */
00386 #define DMA_BASE 0x2000
00387 /* offsets from the base address */
00388 #define TXTADL          0x01
00389 #define TXPLL           0x03
00390 #define TXPLM           0x04
00391 #define TXTPLL          0x05
00392 #define TXTPLM          0x06
00393 #define RXTADL          0x07
00394 #define RXTADMEN        0x08
00395 #define RSPLL           0x09
00396 #define RXPLM           0x0A
00397 #define RXTPLL          0x0B
00398 #define RXTPLM          0x0C
00399 #define INTCST          0x0D
00400 /* XXX DPORG register mentioned on page 20, but undocumented */
00401 
00402 /* XXX Program Memory Control Bit mentioned on page 20, but undocumented */
00403 #define PROGRAM_MEMORY_CONTROL_BIT 0x2040
00404 
00405 /* USB */
00406 #define USB_BASE 0x1000
00407 /* offsets from the base address */
00408 #define FRM_NUM_H       0x0FD
00409 #define FRM_NUM_L       0x0FC
00410 #define GLB_STATE       0x0FB
00411 #define SPRSR           0x0FA
00412 #define SPRSIE          0x0F9
00413 #define UISR            0x0F7
00414 #define UIAR            0x0F5
00415 #define FADDR           0x0F2
00416 #define ENDPPGPG        0x0F1
00417 #define ECR0            0x0EF
00418 #define ECR1            0x0EE
00419 #define ECR2            0x0ED
00420 #define ECR3            0x0EC
00421 #define ECR4            0x0EB
00422 #define ECR5            0x0EA
00423 #define ECR6            0x0E9
00424 #define ECR7            0x0E8
00425 #define CSR0            0x0DF
00426 #define CSR1            0x0DE
00427 #define CSR2            0x0DD
00428 #define CSR3            0x0DC
00429 #define CSR4            0x0DB
00430 #define CSR5            0x0DA
00431 #define CSR6            0x0D9
00432 #define CSR7            0x0D8
00433 #define FDR0            0x0CF
00434 #define FDR1            0x0CE
00435 #define FDR2            0x0CD
00436 #define FDR3            0x0CC
00437 #define FDR4            0x0CB
00438 #define FDR5            0x0CA
00439 #define FDR6            0x0C9
00440 #define FDR7            0x0C8
00441 #define FBYTE_CNT0_L    0x0BF
00442 #define FBYTE_CNT1_L    0x0BE
00443 #define FBYTE_CNT2_L    0x0BD
00444 #define FBYTE_CNT3_L    0x0BC
00445 #define FBYTE_CNT4_L    0x0BB
00446 #define FBYTE_CNT5_L    0x0BA
00447 #define FBYTE_CNT6_L    0x0B9
00448 #define FBYTE_CNT7_L    0x0B8
00449 #define FBYTE_CNT0_H    0x0AF
00450 #define FBYTE_CNT1_H    0x0AE
00451 #define FBYTE_CNT2_H    0x0AD
00452 #define FBYTE_CNT3_H    0x0AC
00453 #define FBYTE_CNT4_H    0x0AB
00454 #define FBYTE_CNT5_H    0x0AA
00455 #define FBYTE_CNT6_H    0x0A9
00456 #define FBYTE_CNT7_H    0x0A8
00457 #define SLP_MD_EN       0x100
00458 #define IRQ_EN          0x101
00459 #define IRQ_STAT        0x102
00460 #define SUSP_WUP        0x103
00461 #define PA_EN           0x104
00462 #define USB_DMA_ADL     0x105
00463 #define USB_DMA_ADH     0x106
00464 #define USB_DMA_PLR     0x107
00465 #define USB_DMA_EAD     0x108
00466 #define USB_DMA_PLT     0x109
00467 #define USB_DMA_EN      0x10A
00468 
00469 /* Pointer registers (same for all AVR devices so far) */
00470 #define XL r26
00471 #define XH r27
00472 #define YL r28
00473 #define YH r29
00474 #define ZL r30
00475 #define ZH r31
00476 
00477 /* Last memory addresses */
00478 #define RAMEND          0x07FF
00479 #define XRAMEND         0x07FF
00480 #define E2END           0
00481 #define FLASHEND        0x3FFF
00482 
00483 /*
00484    AT76C711 data space memory map (ranges not listed are reserved):
00485    0x0000 - 0x001F - AVR registers
00486    0x0020 - 0x005F - AVR I/O space
00487    0x0060 - 0x07FF - AVR data SRAM
00488    0x1000 - 0x1FFF - USB (not all locations used)
00489    0x2000 - 0x201F - DMA controller
00490    0x2020 - 0x202F - UART0
00491    0x2030 - 0x203F - UART1 (IRDA)
00492    0x2040          - the mysterious Program Memory Control bit (???)
00493    0x3000 - 0x37FF - DPRAM
00494    0x8000 - 0xBFFF - program SRAM (read/write), would be nice if other
00495                      AVR devices did that as well (no need to use LPM!)
00496  */
00497 #endif /* _AVR_IO76C711_H_ */

Generated on Thu Jan 30 22:30:46 2003 for EduNet by doxygen1.2.18