/********************************************************************************************************************************************************************************** Fichier HARDWARE.H Contient tous les define liés à l'interface avec le matériel. **********************************************************************************************************************************************************************************/ // Nombre max physique : // Timings : #define BASE_TEMPS_TIMER 10 // En ms //********************************************************************************************************************************************************************************** // General : //********************************************************************************************************************************************************************************** #define PAGE_SIZE (4*1024) #define BLOCK_SIZE (4*1024) // CM3+ : #define BCM2837_ADRESSE_BASE_PERIPH 0x3F000000 // Adresse physique de base de la zone I/O PERIPHERALS à partir de RPI 3 (idem RPI 2) // CM4 : #define BCM2711_ADRESSE_BASE_PERIPH 0xFE000000 // Adresse physique de base de la zone I/O PERIPHERALS pour CM4 //********************************************************************************************************************************************************************************** // General Purpose IO (GPIO) : //********************************************************************************************************************************************************************************** // CM3+ : #define CM3P_OFFSET_GPIO_BASE 0x200000 #define CM3P_OFFSET_GPIO_OUT_SET_0 7 // Positionne à HIGH les sorties 0 à 31 (1 bit / sortie) - (cf page 95) #define CM3P_OFFSET_GPIO_OUT_SET_1 8 // Positionne à HIGH les sorties 32 à 53 (1 bit / sortie) - (cf page 95) #define CM3P_OFFSET_GPIO_OUT_CLEAR_0 10 // Positionne à LOW les sorties 0 à 31 (1 bit / sortie) - (cf page 95) #define CM3P_OFFSET_GPIO_OUT_CLEAR_1 11 // Positionne à LOW les sorties 32 à 53 (1 bit / sortie) - (cf page 95 & 96) #define CM3P_OFFSET_GPIO_PIN_LEVEL_0 13 // Lecture des IO 0 à 31 (1 bit / IO) - (cf page 96) #define CM3P_OFFSET_GPIO_PIN_LEVEL_1 14 // Lecture des IO 32 à 53 (1 bit / IO) - (cf page 96) #define CM3P_OFFSET_GPIO_PIN_PULL_UP_DOWN_ENABLE 37 // Config du type de pull-up/pull-down à utiliser lors de l'application de la ENABLE_CLOCK suivante (2 bits au total) - (cf page 101) #define CM3P_OFFSET_GPIO_PIN_PULL_UP_DOWN_ENABLE_CLOCK_0 38 // Config des IO 0 à 31 (1 bit / IO) qui seront soumis au pull-up/pull-down ci-dessus - (cf page 101) #define CM3P_OFFSET_GPIO_PIN_PULL_UP_DOWN_ENABLE_CLOCK_1 39 // Config des IO 32 à 53 (1 bit / IO) qui seront soumis au pull-up/pull-down ci-dessus - (cf page 101) #define CM3P_NO_PUP_PDN 0x00 // 00 = No resistor is selected #define CM3P_PULL_DOWN 0x01 // 01 = Enable Pull Down control #define CM3P_PULL_UP 0x02 // 10 = Enable Pull Up control // CM4 : #define CM4_OFFSET_GPIO_BASE 0x200000 #define CM4_OFFSET_GPIO_OUT_SET_0 7 // Positionne à HIGH les sorties 0 à 31 (1 bit / sortie) - (cf page 95) #define CM4_OFFSET_GPIO_OUT_SET_1 8 // Positionne à HIGH les sorties 32 à 53 (1 bit / sortie) - (cf page 95) #define CM4_OFFSET_GPIO_OUT_CLEAR_0 10 // Positionne à LOW les sorties 0 à 31 (1 bit / sortie) - (cf page 95) #define CM4_OFFSET_GPIO_OUT_CLEAR_1 11 // Positionne à LOW les sorties 32 à 53 (1 bit / sortie) - (cf page 95 & 96) #define CM4_OFFSET_GPIO_PIN_LEVEL_0 13 // Lecture des IO 0 à 31 (1 bit / IO) - (cf page 96) #define CM4_OFFSET_GPIO_PIN_LEVEL_1 14 // Lecture des IO 32 à 53 (1 bit / IO) - (cf page 96) #define CM4_OFFSET_GPIO_PUP_PDN_CNTRL_REG0 57 // The GPIO Pull-up / Pull-down Registers control the actuation of the internal pull-up/down resistors. Reading these registers gives the current pull-state. (cf page 74) #define CM4_OFFSET_GPIO_PUP_PDN_CNTRL_REG1 58 #define CM4_OFFSET_GPIO_PUP_PDN_CNTRL_REG2 59 #define CM4_OFFSET_GPIO_PUP_PDN_CNTRL_REG3 60 #define CM4_NO_PUP_PDN 0x00 // 00 = No resistor is selected #define CM4_PULL_UP 0x01 // 01 = Pull up resistor is selected #define CM4_PULL_DOWN 0x02 // 10 = Pull down resistor is selected // Type d'E/S utilisés dans GPIO_FUNCTION_SEL_x : #define GPIO_TYPE_INPUT 0x00 #define GPIO_TYPE_OUTPUT 0x01 #define GPIO_TYPE_ALT_FUNCTION_0 0x04 #define GPIO_TYPE_ALT_FUNCTION_1 0x05 #define GPIO_TYPE_ALT_FUNCTION_2 0x06 #define GPIO_TYPE_ALT_FUNCTION_3 0x07 #define GPIO_TYPE_ALT_FUNCTION_4 0x03 #define GPIO_TYPE_ALT_FUNCTION_5 0x02 #define GPIO_TYPE_UNKNOWN 0xFF // Type de pull-up/down : #define NO_PUP_PDN 0 #define PULL_DOWN 1 #define PULL_UP 2