- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

# spi_drv.h File Reference

,vSPI Low level drivers access. More...

`#include "config.h"`

Include dependency graph for spi_drv.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Defines
#define | MSK_SPI_SPIE 0x80
#define | MSK_SPI_SPE 0x40
#define | MSK_SPI_DORD 0x20
#define | MSK_SPI_MSTR 0x10
#define | MSK_SPI_CPOL 0x08
#define | MSK_SPI_CPHA 0x04
#define | MSK_SPI_SPR1 0x02
#define | MSK_SPI_SPR0 0x01
#define | MSK_SPI_ENABLE_IT 0x80
#define | MSK_SPI_ENABLE 0x40
#define | MSK_SPI_MASTER_MODE 0x10
#define | MSK_SPI_DOUBLESPEED 0x01
#define | MSK_SPI_DIV4 0x00
#define | MSK_SPI_DIV16 0x01
#define | MSK_SPI_DIV64 0x02
#define | MSK_SPI_DIV128 0x03
#define | MSK_SPI_CPHA_LEADING 0x00
#define | MSK_SPI_CPHA_TRAILING 0x04
#define | MSK_SPI_CPOL_HIGH 0x08
#define | MSK_SPI_CPOL_LOW 0x00
#define | MSK_SPI_LSBFIRST 0x20
#define | MSK_SPI_MSBFIRST 0x00
#define | MSK_SPI_CONF 0x2F
#define | MSK_SPI_SPIF 0x80
#define | MSK_SPI_MODE 0x0C
#define | MSK_MSTR 0x10
#define | SPI_MASTER_MODE_0 (Byte)(MSK_MSTR)
#define | SPI_MASTER_MODE_1 (Byte)(MSK_MSTR|0x04)
#define | SPI_MASTER_MODE_2 (Byte)(MSK_MSTR|0x08)
#define | SPI_MASTER_MODE_3 (Byte)(MSK_MSTR|0x0C)
#define | SPI_SLAVE_MODE_0 (Byte)0x00
#define | SPI_SLAVE_MODE_1 (Byte)0x04
#define | SPI_SLAVE_MODE_2 (Byte)0x08
#define | SPI_SLAVE_MODE_3 (Byte)0x0C
#define | SPI_RATE_1 (Byte)0x00
#define | SPI_RATE_3 (Byte)0x01
#define | SPI_RATE_5 (Byte)0x02
#define | SPI_RATE_6 (Byte)0x03
#define | Spi_enable() (SPCR |=MSK_SPI_ENABLE)
#define | Spi_disable() (SPCR &= ~MSK_SPI_ENABLE)
#define | Spi_enable_it() (SPCR|= MSK_SPI_ENABLE_IT)
#define | Spi_disable_it() (SPCR&=~MSK_SPI_ENABLE_IT)
#define | Spi_select_slave_mode() (SPCR&=~MSK_SPI_MASTER_MODE)
#define | Spi_select_master_mode() (SPCR|= MSK_SPI_MASTER_MODE)
#define | Spi_set_mode(mode) (SPCR &= ~(MSK_SPI_MASTER_MODE|MSK_SPI_MODE )); (SPCR |= mode);Spi_init_bus()
#define | Spi_read_data() (SPDR)
#define | Spi_get_byte() (SPDR)
#define | Spi_write_data(ch) (SPDR=ch);Spi_wait_spif();
#define | Spi_send_byte(ch) (SPDR=ch);Spi_wait_spif();
#define | Spi_wait_spif() while ((SPSR & MSK_SPI_SPIF) == 0)
#define | Spi_wait_eor() while ((SPSR & MSK_SPI_SPIF) == 0)
#define | Spi_wait_eot() while ((SPSR & MSK_SPI_SPIF) == 0)
#define | Spi_eor() ((SPSR & MSK_SPI_SPIF) == MSK_SPI_SPIF)
#define | Spi_eot() ((SPSR & MSK_SPI_SPIF) == MSK_SPI_SPIF)
#define | Spi_set_doublespeed() (SPSR|= MSK_SPI_DOUBLESPEED)
#define | Spi_hw_init(conf) (SPCR&=~MSK_SPI_CONF, SPCR|=conf)
#define | Spi_get_colision_status() (SPSR&(1<<WCOL))
#define | Spi_get_byte() (SPDR)
#define | Spi_tx_ready() (SPSR & (1<<SPIF))
#define | Spi_rx_ready() Spi_tx_ready()
#define | Spi_init_bus() ((DDRB |= (1<<DDB2)|(1<<DDB1)))
#define | Spi_disable_ss()
#define | Spi_enble_ss()
#define | Spi_write_dummy() (SPDR = 0x00);Spi_wait_spif();
#define | Spi_read_dummy() (0x00 = SPDR)
#define | Spi_config_speed(config) (SPCR &= ~(MSK_SPI_SPR1|MSK_SPI_SPR0), (SPCR |= config))
#define | Spi_ack_read() (DUMMY = SPSR)
#define | Spi_ack_write() (DUMMY = SPDR)
#define | Spi_ack_cmd() (DUMMY = SPSR)

## Detailed Description

,vSPI Low level drivers access.

Copyright (c) 2005 Atmel.

Please read file license.txt for copyright notice.

Version:
  1.3 at90usb162-2enum-mouse_ms-1_0_1

Todo:

Bug:

Definition in file spi_drv.h.

## Define Documentation

#define MSK_SPI_SPIE 0x80

Definition at line 27 of file spi_drv.h.

#define MSK_SPI_SPE 0x40

Definition at line 28 of file spi_drv.h.

#define MSK_SPI_DORD 0x20

Definition at line 29 of file spi_drv.h.

#define MSK_SPI_MSTR 0x10

Definition at line 30 of file spi_drv.h.

#define MSK_SPI_CPOL 0x08

Definition at line 31 of file spi_drv.h.

#define MSK_SPI_CPHA 0x04

Definition at line 32 of file spi_drv.h.

#define MSK_SPI_SPR1 0x02

Definition at line 33 of file spi_drv.h.

#define MSK_SPI_SPR0 0x01

Definition at line 34 of file spi_drv.h.

#define MSK_SPI_ENABLE_IT 0x80

Definition at line 37 of file spi_drv.h.

#define MSK_SPI_ENABLE 0x40

Definition at line 38 of file spi_drv.h.

#define MSK_SPI_MASTER_MODE 0x10

Definition at line 39 of file spi_drv.h.

#define MSK_SPI_DOUBLESPEED 0x01

Definition at line 40 of file spi_drv.h.

#define MSK_SPI_DIV4 0x00

Definition at line 42 of file spi_drv.h.

#define MSK_SPI_DIV16 0x01

Definition at line 43 of file spi_drv.h.

#define MSK_SPI_DIV64 0x02

Definition at line 44 of file spi_drv.h.

#define MSK_SPI_DIV128 0x03

Definition at line 45 of file spi_drv.h.

#define MSK_SPI_CPHA_LEADING 0x00

Definition at line 46 of file spi_drv.h.

#define MSK_SPI_CPHA_TRAILING 0x04

Definition at line 47 of file spi_drv.h.

#define MSK_SPI_CPOL_HIGH 0x08

Definition at line 48 of file spi_drv.h.

#define MSK_SPI_CPOL_LOW 0x00

Definition at line 49 of file spi_drv.h.

#define MSK_SPI_LSBFIRST 0x20

Definition at line 50 of file spi_drv.h.

#define MSK_SPI_MSBFIRST 0x00

Definition at line 51 of file spi_drv.h.

#define MSK_SPI_CONF 0x2F

Definition at line 52 of file spi_drv.h.

#define MSK_SPI_SPIF 0x80

Definition at line 53 of file spi_drv.h.

#define MSK_SPI_MODE 0x0C

Definition at line 54 of file spi_drv.h.

#define MSK_MSTR 0x10

Definition at line 55 of file spi_drv.h.

#define SPI_MASTER_MODE_0 (Byte)(MSK_MSTR)

Definition at line 58 of file spi_drv.h.

#define SPI_MASTER_MODE_1 (Byte)(MSK_MSTR|0x04)

Definition at line 59 of file spi_drv.h.

#define SPI_MASTER_MODE_2 (Byte)(MSK_MSTR|0x08)

Definition at line 60 of file spi_drv.h.

#define SPI_MASTER_MODE_3 (Byte)(MSK_MSTR|0x0C)

Definition at line 61 of file spi_drv.h.

Referenced by df_spi_init().

#define SPI_SLAVE_MODE_0 (Byte)0x00

Definition at line 63 of file spi_drv.h.

#define SPI_SLAVE_MODE_1 (Byte)0x04

Definition at line 64 of file spi_drv.h.

#define SPI_SLAVE_MODE_2 (Byte)0x08

Definition at line 65 of file spi_drv.h.

#define SPI_SLAVE_MODE_3 (Byte)0x0C

Definition at line 66 of file spi_drv.h.

#define SPI_RATE_1 (Byte)0x00

Definition at line 70 of file spi_drv.h.

Referenced by df_spi_init().

#define SPI_RATE_3 (Byte)0x01

Definition at line 72 of file spi_drv.h.

#define SPI_RATE_5 (Byte)0x02

Definition at line 74 of file spi_drv.h.

#define SPI_RATE_6 (Byte)0x03

Definition at line 75 of file spi_drv.h.

#define Spi_enable | ( |  | ) | (SPCR |=MSK_SPI_ENABLE)

Definition at line 80 of file spi_drv.h.

Referenced by df_spi_init(), and spi_init().

#define Spi_disable | ( |  | ) | (SPCR &= ~MSK_SPI_ENABLE)

Definition at line 81 of file spi_drv.h.

#define Spi_enable_it | ( |  | ) | (SPCR|= MSK_SPI_ENABLE_IT)

Definition at line 82 of file spi_drv.h.

#define Spi_disable_it | ( |  | ) | (SPCR&=~MSK_SPI_ENABLE_IT)

Definition at line 83 of file spi_drv.h.

#define Spi_select_slave_mode | ( |  | ) | (SPCR&=~MSK_SPI_MASTER_MODE)

Definition at line 84 of file spi_drv.h.

Referenced by spi_init().

#define Spi_select_master_mode | ( |  | ) | (SPCR|= MSK_SPI_MASTER_MODE)

Definition at line 85 of file spi_drv.h.

Referenced by spi_init().

#define Spi_set_mode | ( | mode |  | ) | (SPCR &= ~(MSK_SPI_MASTER_MODE|MSK_SPI_MODE )); (SPCR |= mode);Spi_init_bus()

Definition at line 86 of file spi_drv.h.

Referenced by df_spi_init().

#define Spi_read_data | ( |  | ) | (SPDR)

Definition at line 87 of file spi_drv.h.

Referenced by df_mem_check(), df_read_sector(), df_read_sector_2_ram(), and df_wait_busy().

#define Spi_get_byte | ( |  | ) | (SPDR)

Definition at line 99 of file spi_drv.h.

Referenced by spi_getchar().

#define Spi_write_data | ( | ch |  | ) | (SPDR=ch);Spi_wait_spif();

Definition at line 89 of file spi_drv.h.

Referenced by df_mem_check(), df_read_open(), df_wait_busy(), df_write_close(), df_write_open(), df_write_sector(), and df_write_sector_from_ram().

#define Spi_send_byte | ( | ch |  | ) | (SPDR=ch);Spi_wait_spif();

Definition at line 90 of file spi_drv.h.

Referenced by spi_putchar(), and SPI_Transmit_Master().

#define Spi_wait_spif | ( |  | ) | while ((SPSR & MSK_SPI_SPIF) == 0)

Definition at line 91 of file spi_drv.h.

#define Spi_wait_eor | ( |  | ) | while ((SPSR & MSK_SPI_SPIF) == 0)

Definition at line 92 of file spi_drv.h.

#define Spi_wait_eot | ( |  | ) | while ((SPSR & MSK_SPI_SPIF) == 0)

Definition at line 93 of file spi_drv.h.

Referenced by SPI_Transmit_Master().

#define Spi_eor | ( |  | ) | ((SPSR & MSK_SPI_SPIF) == MSK_SPI_SPIF)

Definition at line 94 of file spi_drv.h.

#define Spi_eot | ( |  | ) | ((SPSR & MSK_SPI_SPIF) == MSK_SPI_SPIF)

Definition at line 95 of file spi_drv.h.

#define Spi_set_doublespeed | ( |  | ) | (SPSR|= MSK_SPI_DOUBLESPEED)

Definition at line 96 of file spi_drv.h.

Referenced by df_spi_init(), and spi_init().

#define Spi_hw_init | ( | conf |  | ) | (SPCR&=~MSK_SPI_CONF, SPCR|=conf)

Definition at line 97 of file spi_drv.h.

Referenced by spi_init().

#define Spi_get_colision_status | ( |  | ) | (SPSR&(1<<WCOL))

Definition at line 98 of file spi_drv.h.

#define Spi_get_byte | ( |  | ) | (SPDR)

Definition at line 99 of file spi_drv.h.

#define Spi_tx_ready | ( |  | ) | (SPSR & (1<<SPIF))

Definition at line 100 of file spi_drv.h.

Referenced by spi_putchar().

#define Spi_rx_ready | ( |  | ) | Spi_tx_ready()

Definition at line 101 of file spi_drv.h.

Referenced by spi_getchar(), and spi_test_hit().

#define Spi_init_bus | ( |  | ) | ((DDRB |= (1<<DDB2)|(1<<DDB1)))

Definition at line 102 of file spi_drv.h.

Referenced by spi_init().

#define Spi_disable_ss | ( |  | ) |

Definition at line 103 of file spi_drv.h.

Referenced by df_spi_init().

#define Spi_enble_ss | ( |  | ) |

Definition at line 104 of file spi_drv.h.

#define Spi_write_dummy | ( |  | ) | (SPDR = 0x00);Spi_wait_spif();

Definition at line 106 of file spi_drv.h.

Referenced by df_mem_check(), df_read_sector(), df_read_sector_2_ram(), df_wait_busy(), and df_write_open().

#define Spi_read_dummy | ( |  | ) | (0x00 = SPDR)

Definition at line 107 of file spi_drv.h.

#define Spi_config_speed | ( | config |  | ) | (SPCR &= ~(MSK_SPI_SPR1|MSK_SPI_SPR0), (SPCR |= config))

Definition at line 108 of file spi_drv.h.

Referenced by df_spi_init().

#define Spi_ack_read | ( |  | ) | (DUMMY = SPSR)

Definition at line 114 of file spi_drv.h.

#define Spi_ack_write | ( |  | ) | (DUMMY = SPDR)

Definition at line 115 of file spi_drv.h.

Referenced by df_read_open(), df_wait_busy(), df_write_close(), df_write_open(), df_write_sector(), and df_write_sector_from_ram().

#define Spi_ack_cmd | ( |  | ) | (DUMMY = SPSR)

Definition at line 116 of file spi_drv.h.