X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fhw%2Fhw_tc520.h;fp=bertos%2Fhw%2Fhw_tc520.h;h=34501ca53c3e08c9c3ce812fea062c583a54c7d4;hb=791e167e053bdd9250d34a9a5ccae6ccde4d6679;hp=0000000000000000000000000000000000000000;hpb=faf2f6bfd5933ff75e6cc01e3d48f9277f731d8f;p=bertos.git diff --git a/bertos/hw/hw_tc520.h b/bertos/hw/hw_tc520.h new file mode 100644 index 00000000..34501ca5 --- /dev/null +++ b/bertos/hw/hw_tc520.h @@ -0,0 +1,76 @@ +/** + * \file + * + * + * \version $Id$ + * + * \brief TC520 hardware-specific definitions + * + * \version $Id$ + * \author Francesco Sacchi + */ + +#ifndef HW_TC520_H +#define HW_TC520_H + +#include +#include + +#define CE_PIN PE6 +#define DV_PIN PE5 +#define LOAD_PIN PE3 +#define READ_PIN PE4 + +#define TC520_DDR DDRE +#define TC520_PORT PORTE +#define TC520_PIN PINE + +#define DV_HIGH() (TC520_PIN & BV(DV_PIN)) +#define DV_LOW() (!DV_HIGH()) + +#define CE_HIGH() (TC520_PORT |= BV(CE_PIN)) +#define CE_LOW() (TC520_PORT &= ~BV(CE_PIN)) + +#define LOAD_HIGH() (TC520_PORT |= BV(LOAD_PIN)) +#define LOAD_LOW() (TC520_PORT &= ~BV(LOAD_PIN)) + +#define READ_HIGH() (TC520_PORT |= BV(READ_PIN)) +#define READ_LOW() (TC520_PORT &= ~BV(READ_PIN)) + +#define TC520_HW_INIT \ +do\ +{\ + TC520_PORT |= (BV(CE_PIN) | BV(LOAD_PIN) | BV(READ_PIN));\ + TC520_DDR |= (BV(CE_PIN) | BV(LOAD_PIN) | BV(READ_PIN));\ + TC520_DDR &= ~BV(DV_PIN);\ +}\ +while(0) + +#endif /* HW_TC520_H */