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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + v- [: \  m, Y+ `, n; g
  1. [code]EDMA sample test application* u0 V" |1 W( a
  2. /*  ]1 V' I% }: Q" D4 |3 Z
  3. * edma_test.c
    # D4 p+ f* n3 V& Q9 c% a
  4. *
    & a5 w6 g9 R2 Y1 }1 Z3 b& P2 e
  5. * brief  EDMA3 Test Application
    4 X) Y+ |1 u9 ^. A2 d- \3 i
  6. *% A9 a4 [; D7 A! z/ ^
  7. *   This file contains EDMA3 Test code.- \: O$ h5 D7 l9 b  J, v5 K& b; T
  8. *$ v. p; G8 i5 T0 w" L$ _+ e% A8 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) Y9 x6 g( D, ~  m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 y1 ]: c) X, E; s
  11. *         TO CHANGE.* ^: q9 h. b/ h" r5 P0 c4 u
  12. *9 x( M/ B3 h, W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 p3 q6 }! H) d3 h$ o
  14. *
    ! h( g/ }% A, a
  15. * This program is free software; you can redistribute it and/or! E0 h7 d, H1 O/ |% D
  16. * modify it under the terms of the GNU General Public License as
    : @, |/ j5 l* }" [0 f/ Q4 W3 X( m( C$ q
  17. * published by the Free Software Foundation version 2.% V! J( ?* k" c0 |  S1 J
  18. *" M3 i0 i3 ^$ i3 ^% E/ r2 [3 c. Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . |5 Z- G& D: J, u0 U' H9 r  I
  20. * kind, whether express or implied; without even the implied warranty
    $ ^( W; ^( m2 T  J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( o& v1 a( N# ?0 G7 W, d6 `
  22. * GNU General Public License for more details.$ P% H$ S/ h2 L  S7 K7 m1 E
  23. */
    2 E# D8 C% F  Z, a: y* C; v2 H

  24. # \& x! a- l1 e/ Z5 i0 a
  25. #include <linux/module.h>
    ; ~  A5 q' `9 {
  26. #include <linux/init.h>
    3 u7 v! Z7 R3 W7 G- x0 F
  27. #include <linux/errno.h>
    - N, |1 u+ o5 g( E5 ?) r; l% E* k. A
  28. #include <linux/types.h>
    - }1 R6 V6 l5 u- ?! }) ^  E
  29. #include <linux/interrupt.h>
    9 d" k, Z, Y( H( Y) l' M  O
  30. #include <asm/io.h>
    & ?% F% Q7 q9 _/ u
  31. #include <linux/moduleparam.h>
    5 X$ i$ e8 m$ w% O6 W5 W
  32. #include <linux/sysctl.h>
    2 T  ]$ F: [% ]1 U3 |4 `
  33. #include <linux/mm.h>
    - v4 J) @5 R3 r: F9 s
  34. #include <linux/dma-mapping.h>% U  ~3 y/ x1 m2 X5 G, \! E5 H# J
  35. ; Q6 Q  @& h' i: J  K% e8 @* O7 r% o' y
  36. #include <mach/memory.h>4 g2 {# t3 b) C
  37. #include <mach/hardware.h>/ `# H, a( `& M. W$ E$ m
  38. #include <mach/irqs.h>2 l3 A8 `- Q% C: C
  39. #include <asm/hardware/edma.h>- W4 u  T/ _  `8 q/ I$ D: u; N
  40. 6 o9 f- l6 _$ R( T2 l2 |
  41. #undef EDMA3_DEBUG
    * f. q7 p/ Z* w. b4 }* ]) j
  42. /*#define EDMA3_DEBUG*/$ q: S7 [! Z. a0 ~2 u

  43. . f. K% X" N9 U6 n. x' }
  44. #ifdef EDMA3_DEBUG
    7 n; p# ]+ k+ w" F0 x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      W7 i; q" _1 N" B; r" c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ d. b( j2 S5 E3 W8 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' C6 y. m( F8 b% x+ k# E9 p
  48. #else
    2 p( y, ]% [3 X7 \# r) S& K  F+ B, C
  49. #define DMA_PRINTK( x... )3 [2 a0 Y4 [+ q* }$ @! e/ G
  50. #define DMA_FN_IN. s& \8 l  W' C2 Y1 t& |
  51. #define DMA_FN_OUT
    7 W# B$ p; X! S" d- `4 d% x
  52. #endif# ~, u/ A* s: P! W( g' c& g. p8 Q

  53. 9 }; r2 N) r4 s2 a, Z4 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* I% S6 `- A5 I$ m; a2 y% o5 H
  55. #define STATIC_SHIFT                3+ S. T9 A3 m, V% w
  56. #define TCINTEN_SHIFT               20
    . S/ R! g2 B8 o+ ?" n1 b2 q2 H" |
  57. #define ITCINTEN_SHIFT              21! V9 A5 @5 z7 y: Y" @
  58. #define TCCHEN_SHIFT                22+ }. T: s; R( O8 V6 [% {, A) W
  59. #define ITCCHEN_SHIFT               23
    ( T& F  D) Q$ r8 ]

  60. * H# j7 r% I2 ^" |+ J: V
  61. static volatile int irqraised1 = 0;4 x; t0 I( F8 b
  62. static volatile int irqraised2 = 0;
      A! g5 w3 d/ H2 a+ r

  63. 0 \- ?) N. h3 m! Z8 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Z$ v1 f: b2 X; s* E$ h" |: X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 r, m7 [/ A! Y2 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 a2 I+ A! R; N, p- L, r

  67. - J$ k3 z. Y3 s- ~) a* o
  68. dma_addr_t dmaphyssrc1 = 0;
    $ ^2 J: C  y5 l+ r
  69. dma_addr_t dmaphyssrc2 = 0;7 u" c: p4 A; y% l
  70. dma_addr_t dmaphysdest1 = 0;
    ! T( v' C3 h+ T* c
  71. dma_addr_t dmaphysdest2 = 0;
    / M2 i$ u; N1 W0 C6 e5 w# @
  72. # }' {) ^0 Q# J6 F. }$ C( K; x; h& w
  73. char *dmabufsrc1 = NULL;
    / }9 z- q  z1 F- u7 v& S- N" a! j. ]
  74. char *dmabufsrc2 = NULL;
    3 Z5 U5 U, T7 `; C  G1 ?
  75. char *dmabufdest1 = NULL;
    # N  y1 x* C0 M* V
  76. char *dmabufdest2 = NULL;
    # C3 f" E+ ^, f+ z5 e9 m, s

  77. " R7 K4 c# |+ w; c6 j6 H
  78. static int acnt = 512;
      O4 C3 H7 r. q: M9 o
  79. static int bcnt = 8;  n3 A* G9 l$ {5 a3 E6 |3 H( _! k" T
  80. static int ccnt = 8;+ F, q8 Y+ A. G, B; x' s4 z7 [

  81. 8 g$ @# T  _. a0 O% X" J" {
  82. module_param(acnt, int, S_IRUGO);
    4 E' C; ^  B- A! J* ~
  83. module_param(bcnt, int, S_IRUGO);& w9 }/ t: H# i3 r& h7 c) s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 ~) w8 m; Q1 [' G* p  z+ h% `: {7 B: F; z5 D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' X) I4 ~8 @+ z: S0 b1 n, N/ @6 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) a+ U2 V. |/ {; T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- X& J6 R+ c+ k/ [+ u

. X7 v. n/ n. ^; q' F- Q% k" e0 r2 ]. Z0 z0 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-17 09:08 , Processed in 0.046753 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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