OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 e8 l  w6 _: Z! {
  1. [code]EDMA sample test application
    # _' }9 N+ J+ Z' R  D/ ?# v
  2. /*9 {3 k" ^9 d0 ], D! O  R, P2 z. n4 @
  3. * edma_test.c' _. W) ^- J: S; @, `# Z
  4. *
    0 z* M! ^' }0 C0 h0 m$ ~
  5. * brief  EDMA3 Test Application
    ' t! g2 l4 U: |7 X" J: k
  6. *
    . I+ o6 h  e3 H
  7. *   This file contains EDMA3 Test code.& Y+ w, J/ o! h# j* r
  8. *
    ( G) |. q5 ~, y+ b4 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( U3 q( l# g  D# e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 t* S, \2 H2 ?# X& [' t% M$ m
  11. *         TO CHANGE.4 A6 I* c" E/ V  q4 _( k
  12. *4 ~9 N0 @( p0 O* g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ]+ m! k0 d" G, h
  14. *
    " _$ p6 e6 `- q0 y
  15. * This program is free software; you can redistribute it and/or
    ! F: j/ J1 @6 r$ G; F" M
  16. * modify it under the terms of the GNU General Public License as8 p# }5 `- H& x/ D$ z4 s7 e2 }. Q$ I
  17. * published by the Free Software Foundation version 2.
    & V1 m) x: Q6 l) s8 i1 H
  18. *
    4 {7 \; `: i' q3 w! h% \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 k2 {5 k9 ~* x
  20. * kind, whether express or implied; without even the implied warranty
    8 t# x+ N& \, f8 v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 M" w$ C0 g$ T: I4 c' U
  22. * GNU General Public License for more details.
    , [( g' @9 G! q
  23. */
    & r6 _3 i& v& t2 O
  24. & Y4 d* x  O) D9 _
  25. #include <linux/module.h>
    6 ]7 l0 V- _9 D2 \* f0 e& U: C
  26. #include <linux/init.h>
    $ f$ ]9 E) ?- O% K/ o5 o( U
  27. #include <linux/errno.h>, a* d8 O) k9 E' Z! j9 p
  28. #include <linux/types.h>
    + m1 m# i5 ^* m3 |# y
  29. #include <linux/interrupt.h>
    ! M8 s+ p1 j) m2 Y2 A  @6 `, O0 j; a
  30. #include <asm/io.h>
    " U; P5 E" }; ^! ?# n# D
  31. #include <linux/moduleparam.h>' K8 k6 q9 a; }. I
  32. #include <linux/sysctl.h>) G( M+ D6 }- ?% R: t+ o. P2 w
  33. #include <linux/mm.h>3 m5 B* ?9 Z& c: [0 Q
  34. #include <linux/dma-mapping.h>
    $ s# [( }8 i- S
  35. 0 m) e: a& u; @7 V7 Y, l
  36. #include <mach/memory.h>
    ; f; K& z, I4 A% ]. P0 S
  37. #include <mach/hardware.h>
    , u4 J3 K- l$ [2 @. q  K2 i0 K
  38. #include <mach/irqs.h>
    , O, \; X, |0 i* o# ~: J
  39. #include <asm/hardware/edma.h>3 W# V6 f0 m/ X3 |5 i* W6 B/ J% F

  40. ! O1 t8 z( ]8 g1 T& m- ~9 z
  41. #undef EDMA3_DEBUG3 }. n' O; w9 d% L5 p
  42. /*#define EDMA3_DEBUG*/
    0 j0 v' G$ X5 v  [( e. V
  43. , m- F0 e" ~& k+ N
  44. #ifdef EDMA3_DEBUG: f' @: l/ |0 e& z7 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 f3 q5 i, ~! q  G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). r5 H0 `5 ~. Z& p/ F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# g* B( n/ i6 \4 S- k
  48. #else* g/ Y" H% g! U6 R+ I9 t
  49. #define DMA_PRINTK( x... )
    % s4 I2 G5 ~1 E1 ~3 a
  50. #define DMA_FN_IN
    - H+ z  c6 s" P
  51. #define DMA_FN_OUT, F. N9 Z$ x: J1 g
  52. #endif8 o9 O* q7 o+ c  E  A- `7 Q

  53. : d) X/ `0 i9 c" M2 N& d; \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 ^1 Y& P0 _. @, |' f6 }0 _
  55. #define STATIC_SHIFT                3
    ) {3 O( o3 l5 S( M3 B0 z1 I
  56. #define TCINTEN_SHIFT               206 u% _- @4 s- K
  57. #define ITCINTEN_SHIFT              21
    * j/ l+ a6 t, H- w9 _: ~$ r
  58. #define TCCHEN_SHIFT                22
    3 \4 B; U, U5 m% A  o& b
  59. #define ITCCHEN_SHIFT               235 [; h/ ~, r) {* e
  60. ! G$ f6 y0 Z4 z6 {0 E/ ]
  61. static volatile int irqraised1 = 0;/ t" _! s- E$ j9 w6 t; N, K  E) N* \
  62. static volatile int irqraised2 = 0;
    - o% _' D% a3 L( u1 L

  63. ) \4 E" ?8 E, _+ y' R( g( Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 p: F% u' Y4 d" ^0 F; i# D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; b( \3 K  y9 i% A, F# B& H% m, l+ H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 l* b4 S; p, a: S* K

  67. 4 K8 x6 N; g! Z* E; y
  68. dma_addr_t dmaphyssrc1 = 0;
    0 G' j, s  x1 A
  69. dma_addr_t dmaphyssrc2 = 0;" {7 {' _! o8 t! `& _
  70. dma_addr_t dmaphysdest1 = 0;! `) R6 g9 D9 s6 n* F1 m
  71. dma_addr_t dmaphysdest2 = 0;* q& j2 E/ O9 t  ]: R4 g

  72. / u5 `8 y1 _, v5 u$ ^7 x  N. W4 b
  73. char *dmabufsrc1 = NULL;/ Y8 i5 A7 I3 M: t
  74. char *dmabufsrc2 = NULL;* c$ Z/ {0 k- T8 v1 |, D2 S
  75. char *dmabufdest1 = NULL;
    3 [: d* m# v) z; C: |* j2 K  Q$ v" f
  76. char *dmabufdest2 = NULL;& ^. {; R9 T. x% O

  77. 3 e: ^/ w: Y' i: Z" W
  78. static int acnt = 512;9 S! P0 r1 q# e" x$ \, @
  79. static int bcnt = 8;2 M4 F9 |' Y  H) S7 E
  80. static int ccnt = 8;" C, j" f( s. r5 f8 @- U3 w
  81. 3 Y. v3 X7 M$ G' x0 j
  82. module_param(acnt, int, S_IRUGO);
    ; Q: }2 w- q5 [- _! E# M. H
  83. module_param(bcnt, int, S_IRUGO);1 @! ]" r! V* W2 d" H% L( w/ s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& Y, X9 w$ v3 n, d" T# ]& ^  r' l: K6 }( F2 y6 E6 M; ~, Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 g' k6 i7 A7 U! e! q1 {  farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 h0 g1 ~, n& ~( E! P/ r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( Z! J7 P2 f+ }1 H
! V% W- a- a% d, c# p' {) i5 {, Q+ [2 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-11 03:35 , Processed in 0.037646 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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