AG903ライブラリリファレンス
内容インデックスホーム
前へ上へ次へ
AG903_DMACMgrGetHandle 関数

DMACハンドル取得

Syntax
C++
int32_t AG903_DMACMgrGetHandle(int ch, AG903_DMACMgrHandle ** handle);
引数 
説明 
int ch 
[in] DMACチャンネル番号 
AG903_DMACMgrHandle ** handle 
[out] DMACハンドル 

エラーコード

返値の詳細 
説明 
正常終了 
-AG903_EINVAL 
パラメータ異常 
-AG903_EBUSY 
ハンドル使用中 

DMACハンドルの取得 (ch指定)

1: int32_t AG903_DMACMgrGetHandle(int ch, AG903_DMACMgrHandle **handle) 2: { 3: if(ch < 0 || AG903_DMAC_UNIT_NUM <= ch || NULL == handle) 4: { 5: return -AG903_EINVAL; 6: } 7: 8: if(handle_used_flag[ch] == true) 9: { 10: return -AG903_EBUSY; 11: } 12: 13: 14: uint32_t chpos = 1 << ch; 15: AG903_DMACPrmSetTIMECOUNT_INT_CLEAR(chpos); 16: AG903_DMACPrmSetERR_ABORT_INT_CLEAR(chpos, chpos, chpos); 17: 18: (*handle) = (AG903_DMACMgrHandle*)&handle_list[ch]; 19: handle_used_flag[ch] = true; 20: 21: handle_list[ch].unit_id = ch; 22: 23: handle_list[ch].cb_term = NULL; 24: handle_list[ch].cb_error = NULL; 25: handle_list[ch].cb_abt = NULL; 26: handle_list[ch].cb_wdt = NULL; 27: 28: return AG903_ENONE; 29: }
Copyright (c) 2017-2025 Axell Corporation. All rights reserved.