OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 14402|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ G- z# L/ \0 I. a! u
  1. [code]EDMA sample test application
    4 v% w* g$ ?% `! C
  2. /*$ G2 g) y: N3 i2 U& E) g  J' Z
  3. * edma_test.c- m9 u7 e, o( G5 q& a  L$ S# k
  4. *; k6 a& ~6 o% [- C4 Y1 a+ o+ w# L
  5. * brief  EDMA3 Test Application
    2 l( B4 y  D1 |9 w
  6. *2 {  S( n3 _# M4 X* M
  7. *   This file contains EDMA3 Test code.
    5 `/ Z1 k: n% J" l
  8. */ H/ i! b6 V" R+ U) l0 U* Z& D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 g, Q* ~, e! T8 [9 K3 X; K/ Z& I) {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 k" e# G! Q% f* a6 R5 p
  11. *         TO CHANGE.
    ) P$ o* c2 g2 N# f* @
  12. *1 I2 J5 ]# l7 w8 w" \0 {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # x2 I$ {5 u: t) q
  14. *
    0 s; s  v. O5 t0 s, X/ K- M
  15. * This program is free software; you can redistribute it and/or+ o- o# T7 p9 o% ?" b* u6 {
  16. * modify it under the terms of the GNU General Public License as
    ( y9 i* f& G1 F5 [) L8 m$ n7 y+ l
  17. * published by the Free Software Foundation version 2.
    : \. c% d4 ?% B9 U, i2 q- S1 }# X
  18. *9 f1 _0 g3 _! z9 N) F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 b% [# X' }- x( a0 w+ a! b0 e
  20. * kind, whether express or implied; without even the implied warranty4 ?: J9 v" n, n$ h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 r" h  D, x" W7 J( H  M7 `3 z: E3 U
  22. * GNU General Public License for more details.  e( _4 }1 d; W9 ~
  23. */
    0 t. H8 l; K5 d! Z, o9 F6 s

  24. : K2 ]' R' k7 q. r+ _
  25. #include <linux/module.h>
      J( x, O' M8 ~" F3 s( a# P; k
  26. #include <linux/init.h>! D9 T2 P; J# q' G  p! \/ x
  27. #include <linux/errno.h>6 l$ t% n/ `, `! E) n
  28. #include <linux/types.h>- u4 Q9 d7 G+ b5 k
  29. #include <linux/interrupt.h>9 ]$ p2 C/ M/ O) G% j4 u. \  c
  30. #include <asm/io.h>1 ]3 T6 x& J; U' @6 D( H% \
  31. #include <linux/moduleparam.h>
    7 ]  G' c/ w% |7 K
  32. #include <linux/sysctl.h>  O9 F2 m! Y5 Z/ D2 K( U3 h5 I
  33. #include <linux/mm.h>
    , F7 u0 Z) ~. k! k# X2 U. h7 R
  34. #include <linux/dma-mapping.h>
    ' a  j7 k) |$ F# L

  35. + M$ I2 [0 x0 n7 Z
  36. #include <mach/memory.h>
    1 s$ U9 ~/ ~  _( K9 d& C5 @" F
  37. #include <mach/hardware.h>. y+ s; h  J+ |  K5 {
  38. #include <mach/irqs.h>) Q$ [+ {- {' I+ D( r5 [
  39. #include <asm/hardware/edma.h>
    ! l; F9 @1 E2 k5 s  |

  40. , ?$ @+ Z3 N" l- N1 i( `- N  e+ F; ?
  41. #undef EDMA3_DEBUG7 M# l5 D6 Y: X( |! p9 i9 t5 D
  42. /*#define EDMA3_DEBUG*/
      S. H# C6 o6 l! i/ P1 Y

  43. , R; M, g/ c$ E& \) }
  44. #ifdef EDMA3_DEBUG* v) }$ m' E6 I2 ]0 p/ F: F- p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" G$ L0 c& e, |- u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - R4 v9 {: z  p/ i; v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . E1 Z3 v6 k- `
  48. #else: Z- j9 J  x9 \% Z
  49. #define DMA_PRINTK( x... )) U* k- F; P& f5 v0 z7 ^4 G  R( v
  50. #define DMA_FN_IN
    ; d; c/ Y- u; G$ }' u' S- Y( p
  51. #define DMA_FN_OUT- r/ O+ g( Q& u0 q
  52. #endif
    & M( q7 V" w; E5 q: U0 r
  53. 2 A8 N3 b) S  i' j9 d4 }+ V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) h3 p: L, n% `; K+ g
  55. #define STATIC_SHIFT                3
    $ J; F* u3 l, {6 u
  56. #define TCINTEN_SHIFT               20' ~! y6 |$ I' h/ |
  57. #define ITCINTEN_SHIFT              21! u( I) N" b, @+ J6 Y# G
  58. #define TCCHEN_SHIFT                22
    * F$ g" O4 n. t$ N- N* h. C
  59. #define ITCCHEN_SHIFT               23
    5 B4 g$ R5 N3 A
  60. , E( i" |$ p: @
  61. static volatile int irqraised1 = 0;
      ]5 a2 x8 _' ]) n# ]7 u
  62. static volatile int irqraised2 = 0;
    : ~9 A" @, V5 \3 i, x1 T! B. O

  63. 6 \2 N6 `. o7 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ^4 j  u8 {; ], s1 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! O1 p) }+ n# x3 U3 `3 Y5 |2 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% h0 ^4 ~) V6 n4 e; O$ G

  67. 9 J/ ]) Q6 v: I! [* Q+ C
  68. dma_addr_t dmaphyssrc1 = 0;+ g% t, O0 |* U: s! r  [* h$ i
  69. dma_addr_t dmaphyssrc2 = 0;3 w$ ]; g# r2 G  R$ z
  70. dma_addr_t dmaphysdest1 = 0;5 _- m; Z1 G. F) @  ^6 a) P& M% G
  71. dma_addr_t dmaphysdest2 = 0;3 z9 P" F' A$ M9 s

  72. ) Q1 W( l" @" U. U
  73. char *dmabufsrc1 = NULL;7 t/ `% K" R- p( }  Q4 A
  74. char *dmabufsrc2 = NULL;
    $ k7 M) y! r4 U/ n7 c% v1 r
  75. char *dmabufdest1 = NULL;
    ! ~) n9 [1 V. s) m( q
  76. char *dmabufdest2 = NULL;
    ! n) |- J* Q" _0 y% P, n

  77. 7 }3 k2 Z% g% ?  v5 J) m
  78. static int acnt = 512;$ ^( V# S) Q# P% J
  79. static int bcnt = 8;
    . i/ g, L: w2 n* t$ z( V
  80. static int ccnt = 8;2 a) s: T( h; }4 M& s
  81. 7 H- k6 ^$ X1 j6 u0 v
  82. module_param(acnt, int, S_IRUGO);
    0 }: p, m4 H8 g( ~
  83. module_param(bcnt, int, S_IRUGO);
    2 U# }6 ]4 j# }4 v- S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 j( L+ A" s1 v0 j
3 |* |6 n* T2 V. ?) M* r$ r2 a# g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 y: J: \" h; D2 I! q
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; ]4 j& Q5 I+ a9 R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 @; ^" v- E# l5 [
" N( m5 y0 ?$ v( \  m

) O, \! d. i& [& Y) e: j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号 ) 

GMT+8, 2026-11-8 19:39 , Processed in 0.038046 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表