AG903ライブラリリファレンス
Body Source
AG903_GPIOMgrSetCallback 関数
本文ソース
コピコード
1: int32_t AG903_GPIOMgrSetCallback(uint8_t portch, uint32_t target,
AG903_GPIOMgrClbk
clbk) 2: { 3: int32_t retval =
AG903_ENONE
; 4:
AG903_INTMgrHdrPrm
inthdr; 5: int32_t hdrid; 6: uint32_t loop; 7: 8:
if
( (
AG903_GPIO_CH_NUM
<= portch) || 9: (NULL == clbk) ){ 10:
return
-
AG903_EINVAL
; 11: } 12: 13:
if
(0 == GpioChStat[portch].hdrid) { 14: inthdr.atr =
AG903_INT_HLNG
; 15: inthdr.intno =
AG903_IRQ40_GPIO0
+portch; 16: inthdr.func = (
void
*)GpioIntHdr[portch]; 17: hdrid =
AG903_INTMgrSetHandler
(&inthdr); 18:
if
(0 >= hdrid) { 19:
return
-
AG903_EFAULT
; 20: } 21: GpioChStat[portch].hdrid = hdrid; 22:
AG903_INTMgrEnableInt
(
AG903_IRQ40_GPIO0
+portch); 23: } 24: 25:
do
{ 26:
if
(
AG903_ENONE
!= retval) { 27:
break
; 28: } 29: 30:
for
(loop=0; loop<
AG903_GPIO_CALLBACK_NUM
; loop++) { 31:
if
(clbk == GpioChStat[portch].intr[loop].clbk) { 32: GpioChStat[portch].intr[loop].target |= target; 33:
break
; 34: } 35: } 36:
if
(
AG903_GPIO_CALLBACK_NUM
> loop) { 37:
break
; 38: } 39: 40:
for
(loop=0; loop<
AG903_GPIO_CALLBACK_NUM
; loop++) { 41:
if
(NULL == GpioChStat[portch].intr[loop].clbk) { 42: GpioChStat[portch].intr[loop].clbk = clbk; 43: GpioChStat[portch].intr[loop].target = target; 44:
break
; 45: } 46: } 47:
if
(
AG903_GPIO_CALLBACK_NUM
<= loop) { 48: retval = -
AG903_ENOBUFS
; 49: } 50: }
while
(0); 51: 52:
return
retval; 53: }
Copyright (c) 2017-2025 Axell Corporation. All rights reserved.
内容
|
インデックス
|
ホーム