ADuCM4x50 Device Drivers API Reference Manual  Release 4.0.0.0
adi_gpio.c
1 
13 #include <stddef.h>
14 #include <string.h>
15 #include <assert.h>
16 #include <drivers/gpio/adi_gpio.h>
17 #include <rtos_map/adi_rtos_map.h>
18 #include "adi_gpio_def.h"
19 
20 #ifdef __ICCARM__
21 /*
22 * IAR MISRA C 2004 error suppressions.
23 *
24 * Pm123 (rule 8.5): there shall be no definition of objects or functions in a header file
25 * This isn't a header as such.
26 *
27 * Pm073 (rule 14.7): a function should have a single point of exit
28 * Pm143 (rule 14.7): a function should have a single point of exit at the end of the function
29 * Multiple returns are used for error handling.
30 *
31 * Pm140 (rule 11.3): a cast should not be performed between a pointer type and an integral type
32 * The rule makes an exception for memory-mapped register accesses.
33 */
34 #pragma diag_suppress=Pm123,Pm073,Pm143,Pm140
35 #endif /* __ICCARM__ */
36 
37 /* Debug function declarations */
38 #ifdef ADI_DEBUG
39 static bool ArePinsValid (const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins);
40 #endif /* ADI_DEBUG */
41 
42 
43 static void CommonInterruptHandler (const ADI_GPIO_IRQ_INDEX index, const IRQn_Type eIrq);
44 void GPIO_A_Int_Handler(void);
45 void GPIO_B_Int_Handler(void);
46 
47 /*========== D A T A ==========*/
48 static ADI_GPIO_DRIVER adi_gpio_Device =
49 {
50  {
51  pADI_GPIO0, /* port 0 base address */
52  pADI_GPIO1, /* port 1 base address */
53  pADI_GPIO2, /* port 2 base address */
54 #if defined(__ADUCM4x50__)
55  pADI_GPIO3, /* port 3 base address */
56 #endif /* __ADUCM4x50__ */
57  },
58 
59  NULL
60 };
139  void* const pMemory,
140  uint32_t const MemorySize
141 )
142 {
143 
144 #ifdef ADI_DEBUG
145  /* Verify the given memory pointer */
146  if(NULL == pMemory)
147  {
149  }
150  /* Check if the memory size is sufficient to operate the driver */
151  if(MemorySize < ADI_GPIO_MEMORY_SIZE)
152  {
154  }
155  assert(ADI_GPIO_MEMORY_SIZE == sizeof(ADI_GPIO_DEV_DATA));
156 #endif
157 
158  /* Only initialize on 1st init call, i.e., preserve callbacks on multiple inits */
159  if (NULL == adi_gpio_Device.pData)
160  {
161  uint32_t i;
162 
163  adi_gpio_Device.pData = (ADI_GPIO_DEV_DATA*)pMemory;
164 
165  /* Initialize the callback table */
166  for (i = 0u; i < ADI_GPIO_NUM_INTERRUPTS; i++)
167  {
168  adi_gpio_Device.pData->CallbackTable[i].pfCallback = NULL;
169  adi_gpio_Device.pData->CallbackTable[i].pCBParam = NULL;
170  }
171 
172  /* Enable the group interrupts */
173  NVIC_EnableIRQ(SYS_GPIO_INTA_IRQn);
174  NVIC_EnableIRQ(SYS_GPIO_INTB_IRQn);
175  }
176 
177  return (ADI_GPIO_SUCCESS);
178 }
179 
180 
193 {
194 
195 #ifdef ADI_DEBUG
196  /* IF (not initialized) */
197  if (NULL == adi_gpio_Device.pData)
198  {
199  /* return error if not initialized */
200  return (ADI_GPIO_NOT_INITIALIZED);
201  }
202 #endif
203 
204  /* Disable the group interrupts */
205  NVIC_DisableIRQ(SYS_GPIO_INTA_IRQn);
206  NVIC_DisableIRQ(SYS_GPIO_INTB_IRQn);
207 
208  /* Clear the data pointer */
209  adi_gpio_Device.pData = NULL;
210 
211  return (ADI_GPIO_SUCCESS);
212 }
213 
214 
236 {
237  ADI_GPIO_TypeDef *pPort; /* pointer to port registers */
238  ADI_INT_STATUS_ALLOC();
239 #ifdef ADI_DEBUG
240  /* make sure we're initialized */
241  if (NULL == adi_gpio_Device.pData)
242  {
243  return (ADI_GPIO_NOT_INITIALIZED);
244  }
245 
246  /* validate the pins */
247  if (!ArePinsValid(Port, Pins))
248  {
249  return (ADI_GPIO_INVALID_PINS);
250  }
251 #endif
252 
253  pPort = adi_gpio_Device.pReg[Port];
254 
255  ADI_ENTER_CRITICAL_REGION();
256  switch (eIrq)
257  {
258  case SYS_GPIO_INTA_IRQn:
259  pPort->IENA = Pins;
260  break;
261  case SYS_GPIO_INTB_IRQn:
262  pPort->IENB = Pins;
263  break;
264  default:
265  break; /* This shall never reach */
266  }
267  ADI_EXIT_CRITICAL_REGION();
268 
269  return (ADI_GPIO_SUCCESS);
270 }
271 
272 
273 
294 {
295  ADI_GPIO_TypeDef *pPort; /* pointer to port registers */
296  uint16_t value = 0u;
297 
298 #ifdef ADI_DEBUG
299  /* make sure we're initialized */
300  if (NULL == adi_gpio_Device.pData)
301  {
302  return (ADI_GPIO_NOT_INITIALIZED);
303  }
304 
305  /* validate the eIrq */
306  if((eIrq != ADI_GPIO_INTA_IRQ) && (eIrq != ADI_GPIO_INTB_IRQ))
307  {
309  }
310 
311  /* The Port should be valid, as it will be typechecked by the compiler at
312  * build time. However, adding a check here for completeness. */
313  if((uint16_t)Port >= (uint16_t)(ADI_GPIO_NUM_PORTS))
314  {
315  return (ADI_GPIO_INVALID_PORT);
316  }
317 #endif
318 
319  pPort = adi_gpio_Device.pReg[Port];
320 
321  switch (eIrq)
322  {
323  case ADI_GPIO_INTA_IRQ:
324  value = pPort->IENA;
325  break;
326  case ADI_GPIO_INTB_IRQ:
327  value = pPort->IENB;
328  break;
329  default:
330  break; /* This shall never reach */
331  }
332 
333  *pValue = value;
334  return (ADI_GPIO_SUCCESS);
335 }
336 
358 {
359  ADI_GPIO_TypeDef *pPort; /* pointer to port registers */
360 
361 #ifdef ADI_DEBUG
362  /* make sure we're initialized */
363  if (NULL == adi_gpio_Device.pData)
364  {
365  return (ADI_GPIO_NOT_INITIALIZED);
366  }
367 
368  /* validate the pins */
369  if (!ArePinsValid(Port, Pins))
370  {
371  return (ADI_GPIO_INVALID_PINS);
372  }
373 #endif
374 
375  pPort = adi_gpio_Device.pReg[Port];
376 
377  pPort->POL = Pins;
378 
379  return (ADI_GPIO_SUCCESS);
380 }
381 
403 {
404  ADI_GPIO_TypeDef *pPort; /* pointer to port registers */
405 
406 #ifdef ADI_DEBUG
407  /* make sure we're initialized */
408  if (NULL == adi_gpio_Device.pData)
409  {
410  return (ADI_GPIO_NOT_INITIALIZED);
411  }
412 
413  /* The Port should be valid, as it will be typechecked by the compiler at
414  * build time. However, adding a check here for completeness. */
415  if((uint16_t)Port >= (uint16_t)(ADI_GPIO_NUM_PORTS))
416  {
417  return (ADI_GPIO_INVALID_PORT);
418  }
419 #endif
420 
421  pPort = adi_gpio_Device.pReg[Port];
422 
423  *pValue = (pPort->POL);
424 
425  return (ADI_GPIO_SUCCESS);
426 }
427 
453 {
454  ADI_GPIO_TypeDef *pPort; /* pointer to port registers */
455 
456 #ifdef ADI_DEBUG
457  /* make sure we're initialized */
458  if (NULL == adi_gpio_Device.pData)
459  {
460  return (ADI_GPIO_NOT_INITIALIZED);
461  }
462 
463  /* The Port should be valid, as it will be typechecked by the compiler at
464  * build time. However, adding a check here for completeness. */
465  if((uint16_t)Port >= (uint16_t)(ADI_GPIO_NUM_PORTS))
466  {
467  return (ADI_GPIO_INVALID_PORT);
468  }
469 
470  /* validate the pins */
471  if (!ArePinsValid(Port, Pins))
472  {
473  return (ADI_GPIO_INVALID_PINS);
474  }
475 #endif
476 
477  pPort = adi_gpio_Device.pReg[Port];
478 
479  if (bLowToHigh) {
480  pPort->POL |= Pins; /* set polarity the bits set in Pins to low to high */
481  }else{
482  pPort->POL &= ~Pins; /* set polarity the bits set in Pins to high to low */
483  }
484 
485  return (ADI_GPIO_SUCCESS);
486 }
487 
488 
515 ADI_GPIO_RESULT adi_gpio_OutputEnable(const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins, const bool bFlag)
516 {
517 
518  ADI_GPIO_TypeDef *pPort; /* pointer to port registers */
519  ADI_INT_STATUS_ALLOC();
520 
521 #ifdef ADI_DEBUG
522  /* make sure we're initialized */
523  if (NULL == adi_gpio_Device.pData)
524  {
525  return (ADI_GPIO_NOT_INITIALIZED);
526  }
527 
528  /* validate the pins */
529  if (!ArePinsValid(Port, Pins))
530  {
531  return (ADI_GPIO_INVALID_PINS);
532  }
533 #endif
534 
535  pPort = adi_gpio_Device.pReg[Port];
536 
537  ADI_ENTER_CRITICAL_REGION();
538  if (bFlag)
539  {
540  /* enable output */
541  pPort->OEN |= Pins;
542  } else
543  {
544  /* disable output */
545  pPort->OEN &= (uint16_t)~Pins;
546  }
547  ADI_EXIT_CRITICAL_REGION();
548 
549  return (ADI_GPIO_SUCCESS);
550 }
551 
552 
578 ADI_GPIO_RESULT adi_gpio_InputEnable(const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins, const bool bFlag)
579 {
580 
581  ADI_GPIO_TypeDef *pPort; /* pointer to port registers */
582  ADI_INT_STATUS_ALLOC();
583 
584 #ifdef ADI_DEBUG
585  /* make sure we're initialized */
586  if (NULL == adi_gpio_Device.pData) {
587  return (ADI_GPIO_NOT_INITIALIZED);
588  }
589 
590  /* validate the pins */
591  if (!ArePinsValid(Port, Pins)) {
592  return (ADI_GPIO_INVALID_PINS);
593  }
594 #endif
595 
596  pPort = adi_gpio_Device.pReg[Port];
597 
598  ADI_ENTER_CRITICAL_REGION();
599  if (bFlag)
600  {
601  /* enable input */
602  pPort->IEN |= Pins;
603  } else
604  {
605  /* disable input */
606  pPort->IEN &= (uint16_t)~Pins;
607  }
608  ADI_EXIT_CRITICAL_REGION();
609 
610  return (ADI_GPIO_SUCCESS);
611 }
612 
631 {
632 
633  ADI_GPIO_TypeDef *pPort; /* pointer to port registers */
634 
635 #ifdef ADI_DEBUG
636  /* make sure we're initialized */
637  if (NULL == adi_gpio_Device.pData)
638  {
639  return (ADI_GPIO_NOT_INITIALIZED);
640  }
641 
642  /* The Port should be valid, as it will be typechecked by the compiler at
643  * build time. However, adding a check here for completeness. */
644  if((uint16_t)Port >= (uint16_t)(ADI_GPIO_NUM_PORTS))
645  {
646  return (ADI_GPIO_INVALID_PORT);
647  }
648 #endif
649 
650  pPort = adi_gpio_Device.pReg[Port];
651 
652  *pValue = (pPort->OEN);
653 
654  return (ADI_GPIO_SUCCESS);
655 }
656 
682 ADI_GPIO_RESULT adi_gpio_PullUpEnable(const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins, const bool bFlag)
683 {
684 
685  ADI_GPIO_TypeDef *pPort; /* pointer to port registers */
686  ADI_INT_STATUS_ALLOC();
687 
688 #ifdef ADI_DEBUG
689  /* make sure we're initialized */
690  if (NULL == adi_gpio_Device.pData)
691  {
692  return (ADI_GPIO_NOT_INITIALIZED);
693  }
694 
695  /* validate the pins */
696  if (!ArePinsValid(Port, Pins))
697  {
698  return (ADI_GPIO_INVALID_PINS);
699  }
700 #endif
701 
702  pPort = adi_gpio_Device.pReg[Port];
703 
704  ADI_ENTER_CRITICAL_REGION();
705  if (bFlag)
706  {
707  pPort->PE |= Pins;
708  } else
709  {
710  pPort->PE &= (uint16_t)(~Pins);
711  }
712  ADI_EXIT_CRITICAL_REGION();
713 
714  return (ADI_GPIO_SUCCESS);
715 }
716 
743 {
744 
745  ADI_GPIO_TypeDef *pPort; /* pointer to port registers */
746  ADI_INT_STATUS_ALLOC();
747 
748 #ifdef ADI_DEBUG
749  /* make sure we're initialized */
750  if (NULL == adi_gpio_Device.pData)
751  {
752  return (ADI_GPIO_NOT_INITIALIZED);
753  }
754 
755  /* validate the pins */
756  if (!ArePinsValid(Port, Pins))
757  {
758  return (ADI_GPIO_INVALID_PINS);
759  }
760 #endif
761 
762  pPort = adi_gpio_Device.pReg[Port];
763 
764  ADI_ENTER_CRITICAL_REGION();
765  if (bFlag)
766  {
767  pPort->DS |= Pins;
768  } else
769  {
770  pPort->DS &= (uint16_t)(~Pins);
771  }
772  ADI_EXIT_CRITICAL_REGION();
773 
774  return (ADI_GPIO_SUCCESS);
775 }
776 
802 {
803 
804  ADI_GPIO_TypeDef *pPort; /* pointer to port registers */
805 
806 #ifdef ADI_DEBUG
807  /* make sure we're initialized */
808  if (NULL == adi_gpio_Device.pData)
809  {
810  return (ADI_GPIO_NOT_INITIALIZED);
811  }
812 
813  /* validate the pins */
814  if (!ArePinsValid(Port, Pins))
815  {
816  return (ADI_GPIO_INVALID_PINS);
817  }
818 #endif
819 
820  pPort = adi_gpio_Device.pReg[Port];
821 
822  /* set the given GPIOs high */
823  pPort->SET = Pins;
824 
825  return (ADI_GPIO_SUCCESS);
826 }
827 
828 
854 {
855 
856  ADI_GPIO_TypeDef *pPort; /* pointer to port registers */
857 
858 #ifdef ADI_DEBUG
859  /* make sure we're initialized */
860  if (NULL == adi_gpio_Device.pData)
861  {
862  return (ADI_GPIO_NOT_INITIALIZED);
863  }
864 
865  /* validate the pins */
866  if (!ArePinsValid(Port, Pins))
867  {
868  return (ADI_GPIO_INVALID_PINS);
869  }
870 #endif
871 
872  pPort = adi_gpio_Device.pReg[Port];
873 
874  /* set the given GPIOs low */
875  pPort->CLR = Pins;
876 
877  return (ADI_GPIO_SUCCESS);
878 }
879 
880 
909 {
910 
911  ADI_GPIO_TypeDef *pPort; /* pointer to port registers */
912 
913 #ifdef ADI_DEBUG
914  /* make sure we're initialized */
915  if (NULL == adi_gpio_Device.pData)
916  {
917  return (ADI_GPIO_NOT_INITIALIZED);
918  }
919 
920  /* validate the pins */
921  if (!ArePinsValid(Port, Pins))
922  {
923  return (ADI_GPIO_INVALID_PINS);
924  }
925 #endif
926 
927  pPort = adi_gpio_Device.pReg[Port];
928 
929  /* toggle the given GPIOs */
930  pPort->TGL = Pins;
931 
932  return (ADI_GPIO_SUCCESS);
933 }
934 
935 
959 {
960 
961  ADI_GPIO_TypeDef *pPort; /* pointer to port registers */
962 
963 #ifdef ADI_DEBUG
964  /* make sure we're initialized */
965  if (NULL == adi_gpio_Device.pData)
966  {
967  return (ADI_GPIO_NOT_INITIALIZED);
968  }
969 
970  /* validate the pins */
971  if (!ArePinsValid(Port, Pins))
972  {
973  return (ADI_GPIO_INVALID_PINS);
974  }
975 #endif
976 
977  pPort = adi_gpio_Device.pReg[Port];
978 
979  /* set the GPIOs as directed */
980  pPort->OUT = Pins;
981 
982  return (ADI_GPIO_SUCCESS);
983 }
984 
985 
1029 ADI_GPIO_RESULT adi_gpio_GetData (const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins, uint16_t* const pValue)
1030 {
1031 
1032  ADI_GPIO_TypeDef *pPort; /* pointer to port registers */
1033 
1034 #ifdef ADI_DEBUG
1035  /* make sure we're initialized */
1036  if (NULL == adi_gpio_Device.pData)
1037  {
1038  return (ADI_GPIO_NOT_INITIALIZED);
1039  }
1040 
1041  /* validate the pins */
1042  if (!ArePinsValid(Port, Pins))
1043  {
1044  return (ADI_GPIO_INVALID_PINS);
1045  }
1046 #endif
1047 
1048  pPort = adi_gpio_Device.pReg[Port];
1049 
1050  /* return the status of the GPIOs */
1051  *pValue = (pPort->IN) & Pins;
1052 
1053  return (ADI_GPIO_SUCCESS);
1054 }
1055 
1073 {
1074 
1075  ADI_GPIO_TypeDef *pPort; /* pointer to port registers */
1076 
1077 #ifdef ADI_DEBUG
1078  /* make sure we're initialized */
1079  if (NULL == adi_gpio_Device.pData)
1080  {
1081  return (ADI_GPIO_NOT_INITIALIZED);
1082  }
1083 
1084  /* The Port should be valid, as it will be typechecked by the compiler at
1085  * build time. However, adding a check here for completeness. */
1086  if((uint16_t)Port >= (uint16_t)(ADI_GPIO_NUM_PORTS))
1087  {
1088  return (ADI_GPIO_INVALID_PORT);
1089  }
1090 #endif
1091 
1092  pPort = adi_gpio_Device.pReg[Port];
1093 
1094  /* return the status of the oputput register */
1095  *pValue = (pPort->OUT);
1096 
1097  return (ADI_GPIO_SUCCESS);
1098 }
1099 
1126 ADI_GPIO_RESULT adi_gpio_RegisterCallback (const ADI_GPIO_IRQ eIrq, ADI_CALLBACK const pfCallback, void *const pCBParam )
1127 {
1128  uint16_t index = 0u;
1129  ADI_INT_STATUS_ALLOC();
1130 
1131 #ifdef ADI_DEBUG
1132  /* make sure we're initialized */
1133  if (NULL == adi_gpio_Device.pData)
1134  {
1135  return (ADI_GPIO_NOT_INITIALIZED);
1136  }
1137 #endif
1138 
1139  index = (uint16_t)eIrq - (uint16_t)SYS_GPIO_INTA_IRQn + ADI_GPIO_IRQ_GROUPA_INDEX;
1140 
1141  ADI_ENTER_CRITICAL_REGION();
1142 
1143  adi_gpio_Device.pData->CallbackTable[index].pfCallback = pfCallback;
1144  adi_gpio_Device.pData->CallbackTable[index].pCBParam = pCBParam;
1145 
1146  ADI_EXIT_CRITICAL_REGION();
1147 
1148  /* return the status */
1149  return (ADI_GPIO_SUCCESS);
1150 }
1151 
1152 
1153 
1157 /* All of the following is excluded from the doxygen output... */
1158 
1159 /* Common group (A/B) interrupt handler */
1160 static void CommonInterruptHandler(const ADI_GPIO_IRQ_INDEX index, const IRQn_Type eIrq)
1161 {
1162  ADI_GPIO_PORT Port;
1163  ADI_GPIO_TypeDef *pPort;
1164  ADI_GPIO_DATA Pins;
1165  ADI_GPIO_DATA nIntEnabledPins;
1166 
1167  ADI_GPIO_CALLBACK_INFO *pCallbackInfo = &adi_gpio_Device.pData->CallbackTable[index];
1168 
1169  /* Loop over all the ports. */
1170  for(Port=ADI_GPIO_PORT0; Port<ADI_GPIO_NUM_PORTS; Port++)
1171  {
1172  pPort = adi_gpio_Device.pReg[Port];
1173 
1174  /* Is the interrupt is for GROUP A */
1175  if(SYS_GPIO_INTA_IRQn == eIrq)
1176  {
1177  nIntEnabledPins = pPort->IENA;
1178  }
1179  else /* Is the interrupt is for GROUP B */
1180  {
1181  nIntEnabledPins = pPort->IENB;
1182  }
1183 
1184  /* Clear only required interrupts */
1185  Pins = ((pPort->INT) & nIntEnabledPins);
1186  pPort->INT = Pins;
1187 
1188  /* params list is: application-registered cbParam, Port number, and interrupt status */
1189  if((pCallbackInfo->pfCallback != NULL) && (Pins != 0u))
1190  {
1191  pCallbackInfo->pfCallback (pCallbackInfo->pCBParam, (uint32_t)Port, &Pins);
1192  }
1193  }
1194 }
1195 
1196 /* Interrupt A handler */
1197 void GPIO_A_Int_Handler(void)
1198 {
1199  ISR_PROLOG()
1200  CommonInterruptHandler(ADI_GPIO_IRQ_GROUPA_INDEX, SYS_GPIO_INTA_IRQn);
1201  ISR_EPILOG()
1202 }
1203 
1204 /* Interrupt B handler */
1205 void GPIO_B_Int_Handler (void)
1206 {
1207  ISR_PROLOG()
1208  CommonInterruptHandler(ADI_GPIO_IRQ_GROUPB_INDEX, SYS_GPIO_INTB_IRQn);
1209  ISR_EPILOG()
1210 }
1211 
1212 #ifdef ADI_DEBUG
1213 
1214 
1226 static bool ArePinsValid(const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins)
1227 {
1228  uint32_t PinValid = 0u;
1229 
1230  /* test for a valid pin */
1231  switch (Port)
1232  {
1233  case ADI_GPIO_PORT0:
1234  PinValid = ~ADI_GPIO_PORT0_PIN_AVL & Pins;
1235  break;
1236 
1237  case ADI_GPIO_PORT1:
1238  PinValid = ~ADI_GPIO_PORT1_PIN_AVL & Pins;
1239  break;
1240 
1241  case ADI_GPIO_PORT2:
1242  PinValid = ~ADI_GPIO_PORT2_PIN_AVL & Pins;
1243  break;
1244 #if defined(__ADUCM4x50__)
1245  case ADI_GPIO_PORT3:
1246  PinValid = ~ADI_GPIO_PORT3_PIN_AVL & Pins;
1247  break;
1248 #endif /* __ADUCM4x50__ */
1249  default:
1250  break;
1251  }
1252 
1253  if (PinValid == 0u)
1254  {
1255  return true;
1256  }
1257  else
1258  {
1259  return false;
1260  }
1261 }
1262 #endif /* ADI_DEBUG */
1263 
1266 /*
1267 ** EOF
1268 */
ADI_GPIO_RESULT adi_gpio_GetOutputEnable(const ADI_GPIO_PORT Port, ADI_GPIO_DATA *const pValue)
Gets the Output Driver Status for GPIO Pin(s)
Definition: adi_gpio.c:630
ADI_GPIO_RESULT adi_gpio_GroupInterruptPolarityEnable(const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins, const bool bFlag)
Determine if the interrupts are generated on the rising or falling edge of the corresponding GPIO pin...
Definition: adi_gpio.c:452
#define ADI_GPIO_PORT1_PIN_AVL
Definition: adi_gpio.h:116
ADI_GPIO_RESULT adi_gpio_SetData(const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins)
Sets the logic level of all GPIO pins on the given port to a given logic level.
Definition: adi_gpio.c:958
ADI_GPIO_RESULT adi_gpio_GetData(const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins, uint16_t *const pValue)
Gets/Senses the input level of all GPIO Pins on the given port.
Definition: adi_gpio.c:1029
ADI_GPIO_RESULT adi_gpio_SetHigh(const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins)
Sets the Given GPIO pin(s) to a Logical High Level.
Definition: adi_gpio.c:801
ADI_GPIO_RESULT adi_gpio_SetLow(const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins)
Sets the Given GPIO pin(s) to a Logical Low Level.
Definition: adi_gpio.c:853
ADI_GPIO_RESULT adi_gpio_InputEnable(const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins, const bool bFlag)
Enables/Disables the Input Drivers for GPIO Pin(s)
Definition: adi_gpio.c:578
ADI_GPIO_RESULT adi_gpio_PullUpEnable(const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins, const bool bFlag)
Enables/Disables the Pull-Up for GPIO Pin(s)
Definition: adi_gpio.c:682
ADI_GPIO_PORT
Definition: adi_gpio.h:86
ADI_GPIO_RESULT
Definition: adi_gpio.h:53
#define ADI_GPIO_MEMORY_SIZE
Definition: adi_gpio.h:46
ADI_GPIO_RESULT adi_gpio_Init(void *const pMemory, uint32_t const MemorySize)
Initializes the GPIO functions.
Definition: adi_gpio.c:138
ADI_GPIO_RESULT adi_gpio_Toggle(const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins)
Toggles the Logical Level of the Given GPIO pin(s)
Definition: adi_gpio.c:908
ADI_GPIO_RESULT adi_gpio_DriveStrengthEnable(const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins, const bool bFlag)
Enables/Disables increased Drive Strength capability for GPIO Pin(s)
Definition: adi_gpio.c:742
#define ADI_GPIO_PORT3_PIN_AVL
Definition: adi_gpio.h:120
ADI_GPIO_RESULT adi_gpio_GetGroupInterruptPins(const ADI_GPIO_PORT Port, const ADI_GPIO_IRQ eIrq, ADI_GPIO_DATA *const pValue)
Get a port's pin interrupt Group A/B mask register.
Definition: adi_gpio.c:293
#define ADI_GPIO_PORT2_PIN_AVL
Definition: adi_gpio.h:117
ADI_GPIO_RESULT adi_gpio_GetOutputData(const ADI_GPIO_PORT Port, ADI_GPIO_DATA *const pValue)
Gets the Output Level of all GPIO Pins on a given port.
Definition: adi_gpio.c:1072
ADI_GPIO_IRQ
Definition: adi_gpio.h:79
ADI_GPIO_RESULT adi_gpio_UnInit(void)
Un-initialize the GPIO driver.
Definition: adi_gpio.c:192
ADI_GPIO_RESULT adi_gpio_OutputEnable(const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins, const bool bFlag)
Enables/Disables the Output Drivers for GPIO Pin(s)
Definition: adi_gpio.c:515
ADI_GPIO_RESULT adi_gpio_SetGroupInterruptPolarity(const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins)
Set/clear the interrupt polarity for the given pins.
Definition: adi_gpio.c:357
#define ADI_GPIO_PORT0_PIN_AVL
Definition: adi_gpio.h:115
ADI_GPIO_RESULT adi_gpio_GetGroupInterruptPolarity(const ADI_GPIO_PORT Port, ADI_GPIO_DATA *const pValue)
Get a port's pin interrupt polarity register.
Definition: adi_gpio.c:402
ADI_GPIO_RESULT adi_gpio_SetGroupInterruptPins(const ADI_GPIO_PORT Port, const ADI_GPIO_IRQ eIrq, const ADI_GPIO_DATA Pins)
Group the pins for the given group interrupt.
Definition: adi_gpio.c:235
uint16_t ADI_GPIO_DATA
Definition: adi_gpio.h:49
ADI_GPIO_RESULT adi_gpio_RegisterCallback(const ADI_GPIO_IRQ eIrq, ADI_CALLBACK const pfCallback, void *const pCBParam)
Register or unregister an application callback function for group (A/B) interrupts.
Definition: adi_gpio.c:1126