HP85 GPIB Disk Emulator  1.0
HP85GPIBDiskEmulator
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions
hal.h File Reference
#include "gpio-1284p.h"

Go to the source code of this file.

Functions

void gpio_pin_out (uint8_t pin, uint8_t val)
 AVR GPIO MACROs. More...
 
uint8_t gpio_pin_rd (uint8_t pin)
 read GPIO pin More...
 
void chip_select_init (uint8_t pin)
 CHIP select HAL. More...
 
void chip_select (uint8_t pin)
 set GPIO to select - LOW More...
 
void chip_deselect (uint8_t pin)
 set GPIO to deselect - HI More...
 
void chip_addr_init (void)
 ADDRESS select HAL. More...
 
void chip_addr (int addr __attribute__((unused)))
 set address on GPIO lines More...
 
void spi_waitReady (void)
 SPI bus wrapper functions for multiple device support. More...
 
void spi_init (uint32_t clock, int pin)
 
void spi_begin (uint32_t clock, int pin)
 SPI chip enable function Function waits for current tranaction to finish before proceeding. More...
 
void spi_end (uint8_t pin)
 SPI chip disable function wait for current tranaction to finish! More...
 
uint8_t spi_chip_select_status (void)
 SPI CS pin status return CS GPIO pin number or 0xff. More...
 
void spi_TX_buffer (const uint8_t *data, int count)
 SPI write buffer. More...
 
void spi_RX_buffer (const uint8_t *data, int count)
 SPI read buffer. More...
 
void spi_TXRX_buffer (const uint8_t *data, int count)
 SPI write/read buffer. More...
 
uint8_t spi_RX (void)
 SPI read 1 byte. More...
 
void spi_TX (uint8_t data)
 SPI write 1 byte. More...
 
uint8_t spi_TXRX (uint8_t data)
 SPI read and write 1 byte. More...
 
void set_error (uint8_t error)
 Set error condition. More...
 
void clear_error (void)
 Set error condition. More...
 
uint8_t is_error (void)
 is error - test More...
 

Function Documentation

◆ chip_addr()

void chip_addr ( int addr   __attribute__(unused))

set address on GPIO lines

See also
chip_addr_init
Parameters
[in]addrdevice address
Returns
void

Definition at line 271 of file hal.c.

◆ chip_addr_init()

void chip_addr_init ( )

ADDRESS select HAL.

initialize GPIO pin as address lines for a device

Returns
void

Definition at line 241 of file hal.c.

◆ chip_deselect()

void chip_deselect ( uint8_t  pin)

set GPIO to deselect - HI

Parameters
[in]pinGPIO pin number
Returns
void

Definition at line 225 of file hal.c.

Referenced by spi_end(), and spi_init().

◆ chip_select()

void chip_select ( uint8_t  pin)

set GPIO to select - LOW

Parameters
[in]pinGPIO pin number
Returns
void

Definition at line 210 of file hal.c.

Referenced by spi_begin().

◆ chip_select_init()

void chip_select_init ( uint8_t  pin)

CHIP select HAL.

initilize GPIO as an active HI chip select

Parameters
[in]pinGPIO pin number
Returns
void

Definition at line 194 of file hal.c.

Referenced by mmc_spi_init().

◆ clear_error()

void clear_error ( )

Set error condition.

Returns
void

Definition at line 513 of file hal.c.

Referenced by main(), and mmc_init().

◆ gpio_pin_out()

void gpio_pin_out ( uint8_t  pin,
uint8_t  val 
)

AVR GPIO MACROs.

ESP8266 GPIO MACROs

AVR GPIO MACROs.

Parameters
[in]pinGPIO pin number
[in]val1 for output, 0 for input
Returns
void

Definition at line 150 of file hal.c.

◆ gpio_pin_rd()

uint8_t gpio_pin_rd ( uint8_t  pin)

read GPIO pin

Parameters
[in]pinGPIO pin number
Returns
1 or 0

Definition at line 174 of file hal.c.

◆ is_error()

uint8_t is_error ( )

is error - test

Returns
0 = ok, !0 = error

Definition at line 521 of file hal.c.

◆ set_error()

void set_error ( uint8_t  error)

Set error condition.

Returns
void

Definition at line 505 of file hal.c.

Referenced by mmc_disk_read(), mmc_disk_timerproc(), mmc_init(), and mmc_task().

◆ spi_begin()

void spi_begin ( uint32_t  clock,
int  pin 
)

SPI chip enable function Function waits for current tranaction to finish before proceeding.

See also
spi_waitReady
chip_select
Parameters
[in]clockSPI clock rate
[in]pinGPIO CS pin
Returns
void

initialize pin in case it has not been done yet @ we cache the clock frequency seeting for multiple device support

Definition at line 357 of file hal.c.

Referenced by mmc_spi_begin().

◆ spi_chip_select_status()

uint8_t spi_chip_select_status ( void  )

SPI CS pin status return CS GPIO pin number or 0xff.

Definition at line 408 of file hal.c.

◆ spi_end()

void spi_end ( uint8_t  pin)

SPI chip disable function wait for current tranaction to finish!

See also
spi_waitReady
chip_deselect
Parameters
[in]pinGPIO CS pin
Returns
void

Definition at line 391 of file hal.c.

Referenced by mmc_spi_end().

◆ spi_init()

void spi_init ( uint32_t  clock,
int  pin 
)

Definition at line 328 of file hal.c.

Referenced by main(), and spi_begin().

◆ spi_RX()

uint8_t spi_RX ( )

SPI read 1 byte.

Returns
uint8_t value

Definition at line 461 of file hal.c.

◆ spi_RX_buffer()

void spi_RX_buffer ( const uint8_t *  data,
int  count 
)

SPI read buffer.

Parameters
[in]*datatransmit buffer
[in]countnumber of bytes to write
Returns
void

Definition at line 433 of file hal.c.

Referenced by mmc_spi_RX_buffer().

◆ spi_TX()

void spi_TX ( uint8_t  data)

SPI write 1 byte.

Parameters
[in]datavalue to transmit
Returns
void

Definition at line 477 of file hal.c.

Referenced by spi_init().

◆ spi_TX_buffer()

void spi_TX_buffer ( const uint8_t *  data,
int  count 
)

SPI write buffer.

Parameters
[in]*datatransmit buffer
[in]countnumber of bytes to write
Returns
void

Definition at line 418 of file hal.c.

Referenced by mmc_spi_TX_buffer().

◆ spi_TXRX()

uint8_t spi_TXRX ( uint8_t  data)

SPI read and write 1 byte.

Parameters
[in]datavalue to transmit
Returns
uint8_t value read

Definition at line 491 of file hal.c.

Referenced by mmc_spi_TXRX().

◆ spi_TXRX_buffer()

void spi_TXRX_buffer ( const uint8_t *  data,
int  count 
)

SPI write/read buffer.

Parameters
[in]*datatransmit/receive buffer
[in]countnumber of bytes to write
Returns
void

Definition at line 448 of file hal.c.

◆ spi_waitReady()

void spi_waitReady ( )

SPI bus wrapper functions for multiple device support.

Function waits for current SPI tranaction to finish before proceeding

Returns
void

Definition at line 307 of file hal.c.

Referenced by spi_begin(), spi_end(), and spi_init().