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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 K" |% }# y& A% q6 N
  1. [code]EDMA sample test application- _2 j3 \! `  M5 H9 A. T. P6 t
  2. /*
    0 x6 h  ]4 m2 k& v9 P
  3. * edma_test.c
    * B" G. V/ Y3 A+ y2 ?* B
  4. *
    : d; j% V: L/ G7 u6 B. q. Z) k  r
  5. * brief  EDMA3 Test Application
    , h, F; D! V2 I1 m* ]2 P
  6. *4 Y% h" c+ g0 O# s
  7. *   This file contains EDMA3 Test code.2 t- [0 R! Z& K. `, p& X8 s; V4 h
  8. *( C+ `. Q; w5 l! E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 g4 A6 i" [$ _$ p, }$ |+ ?; t) `2 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# b, D) e" t; X6 Z7 O
  11. *         TO CHANGE.2 \, C& e' @0 ^7 y
  12. *
    - x* K; `/ O; S) C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% P6 k, I# p0 g4 D% D
  14. *
    ( x/ r; R. P2 N7 r- r( K' h+ k& B
  15. * This program is free software; you can redistribute it and/or' K" ]5 j! q: K+ I2 j
  16. * modify it under the terms of the GNU General Public License as
    8 _# K6 [% a% _) m2 L
  17. * published by the Free Software Foundation version 2.
    . f+ l$ w' b6 z7 R' f
  18. *
    * j  h! y- T& {' W- J  X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 ?$ j4 R0 a- a3 g# o7 V( u. S
  20. * kind, whether express or implied; without even the implied warranty9 Q5 }% u+ k& V9 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  S% \% L0 P2 B9 }  z3 x2 E
  22. * GNU General Public License for more details.
    : B1 S) M9 {3 D4 ?4 c$ o( z
  23. */
    8 H' n0 j' O+ p$ _$ g# J9 K/ p$ ^, y

  24. - {+ x& [8 ~. k# S$ o, K* A
  25. #include <linux/module.h>5 w4 b9 b1 ?  h# `" X8 Q
  26. #include <linux/init.h>/ E5 c* m- ~+ G5 _( ^; ]  l" p
  27. #include <linux/errno.h>
    3 i- [4 Q) b, y) W. |3 M
  28. #include <linux/types.h>3 K" C4 ~* ~7 J9 [  v
  29. #include <linux/interrupt.h>  s1 o- r7 I6 u
  30. #include <asm/io.h>! [# |; D" q, |7 K8 O+ k4 V: O& w
  31. #include <linux/moduleparam.h>
    ) P5 K" i0 {1 T8 K! ?
  32. #include <linux/sysctl.h>
    5 ]4 a7 R4 `7 }3 H- t! u
  33. #include <linux/mm.h>
    , y0 C! Q7 \# D% z
  34. #include <linux/dma-mapping.h>4 \, O) r, e3 i: K& l6 m* B( `! J

  35. 5 F0 o) [6 s; {! o4 m0 L
  36. #include <mach/memory.h>5 n5 R! b; |" t8 s# a. `
  37. #include <mach/hardware.h>
    ' J) Q, S" P+ v1 V/ _/ V
  38. #include <mach/irqs.h>
    6 Q! L' {2 N' h) o  N: f
  39. #include <asm/hardware/edma.h>
    0 _" J, R7 e4 W4 d* r2 ~

  40. ; N3 L4 M' e0 j, k. t- A/ P, O
  41. #undef EDMA3_DEBUG
    6 [7 O4 v, V8 Y( u( @2 n
  42. /*#define EDMA3_DEBUG*/' f+ I- b8 o0 m( q
  43. ' p: \7 [# B% j& j# w' K$ \. t
  44. #ifdef EDMA3_DEBUG
    0 T. X- h6 H: J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ Y8 k' z9 J+ p6 e: ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  c7 r5 y' ~. R3 ?; x* w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) S( C* H- k) k5 L7 J
  48. #else# P  J( D' ~9 a" Z( Z! z% g
  49. #define DMA_PRINTK( x... )) h: h! m1 c' G
  50. #define DMA_FN_IN) o$ i. ~" O, ]1 a2 g9 a# h: n9 o
  51. #define DMA_FN_OUT+ J, L1 S/ S1 A0 K% S0 q$ e' D
  52. #endif3 J5 ]4 X% T: Z: I
  53. ( s3 f2 m5 b  S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % d. o3 v# y" U# @1 l5 I
  55. #define STATIC_SHIFT                3: |  x  m; s0 b. O+ }
  56. #define TCINTEN_SHIFT               20
    5 Z3 Y/ i* i7 ~- z' x$ e
  57. #define ITCINTEN_SHIFT              219 p6 a7 P! }9 \( T( ]  R; L$ S0 M
  58. #define TCCHEN_SHIFT                22
    5 B# m9 ^; _' U3 |  b, s% D, B
  59. #define ITCCHEN_SHIFT               23) ]) m9 _$ ~' C7 y- S: c% s5 k* |

  60. 2 u4 R* ]+ u( C5 C) A
  61. static volatile int irqraised1 = 0;4 I  c/ Z) S, a8 T, y3 V& a# ]( ^, Z( H
  62. static volatile int irqraised2 = 0;
    ; L; A, Y& x+ s& v3 b0 E; g

  63. & {9 V( B$ S0 |3 ]3 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: t9 W+ q: M7 I, @* @5 R0 a6 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 G9 Z# n0 ]; F' K+ T5 I# ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 }; d# @1 b  J# U5 t* m3 u: ]! s: d

  67. & T  Z5 m& Z' Z, Z. J* d: s
  68. dma_addr_t dmaphyssrc1 = 0;" i4 m+ o$ a8 {# i0 j
  69. dma_addr_t dmaphyssrc2 = 0;" e, w# r9 p+ `$ r6 B+ P8 x
  70. dma_addr_t dmaphysdest1 = 0;  Y" c4 _) F4 |( m2 }& o. M
  71. dma_addr_t dmaphysdest2 = 0;( ]: l6 r" n' H. T. B
  72. 4 n6 t* Z  K7 K5 b
  73. char *dmabufsrc1 = NULL;1 C, V  _& ]" @1 K
  74. char *dmabufsrc2 = NULL;
    + S9 E/ ^' U, p  }! K& s8 S
  75. char *dmabufdest1 = NULL;2 G" ]1 i7 z9 l& ?! i7 K
  76. char *dmabufdest2 = NULL;, g  b- b! h5 {) C0 o) g

  77. / G1 U8 }7 u' J, {: j
  78. static int acnt = 512;% n3 ?" n- f. F+ @+ e0 G
  79. static int bcnt = 8;5 m2 d/ D2 S5 Q- G# E
  80. static int ccnt = 8;" ?% U: l1 y  A7 M; K7 I

  81. 0 f1 @4 f5 e( s, a2 ~1 X
  82. module_param(acnt, int, S_IRUGO);
    7 e0 }; i% C" ?  |! V# m
  83. module_param(bcnt, int, S_IRUGO);
    0 o+ N- d  i/ x) [: M5 D; s& q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ d" z$ p4 g6 G0 k+ r' O- X/ z

, c0 Q, t2 t* t* Y  x# w; b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' V$ o# W: |# U7 Z0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 t) \: \8 ]& i* J, B# |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 m  I1 O0 H* a, b
' z+ }4 `. r& {4 @3 E' q5 E" h. l! _4 `! w; ^, r& F/ y6 h- z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 12:45 , Processed in 0.041534 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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