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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- R) [6 z+ g/ U5 e) w
  1. [code]EDMA sample test application
    0 B: I4 v- A4 C7 d3 w. u1 p
  2. /*& }) i; B  L/ u1 h" x3 `# l
  3. * edma_test.c
    2 g1 h' [" @$ t0 i3 p) O: p6 x# q
  4. *" }! G) [8 ~5 h  k! P
  5. * brief  EDMA3 Test Application
    ) ^8 e  P/ z- I; x  s
  6. *
    ( a& j& f, H1 z! ^& Z: \3 O" T* a
  7. *   This file contains EDMA3 Test code.
    $ m8 N! f- D8 |( |1 `8 O& e
  8. *$ P: M  h( X0 e0 f6 Y. k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 |; R- l" v& _7 w, N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 A" n  H3 @& Z
  11. *         TO CHANGE.
    - g$ J; j* Y5 ]5 q# _* y! ?  W
  12. *
    4 _& p, u( C9 I- _3 s5 U3 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 R& \; {0 \' S9 c$ i5 _
  14. *" u5 p3 G- |8 R4 c" V
  15. * This program is free software; you can redistribute it and/or
    ' R& m* ^$ `; H: B2 k8 k
  16. * modify it under the terms of the GNU General Public License as% Z! ~% I4 w7 Z1 T/ E& n
  17. * published by the Free Software Foundation version 2.
    ) ?& R2 k* M8 d% {/ D9 l; D
  18. *
    8 H" g& g) i3 u, x$ r+ L. e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  ~0 b* {0 n1 ^& H  t4 e6 o
  20. * kind, whether express or implied; without even the implied warranty
    $ [5 X2 P4 i" `4 j1 x0 i. \' W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 W8 N- g, N) A9 t: g( L
  22. * GNU General Public License for more details.: q9 W; |- X; }
  23. */
    ! S* f$ W9 U8 `! S, ^3 m+ S' q$ |) Z

  24. ) s& H1 ~: v2 b. M; }
  25. #include <linux/module.h>
    + a, `6 n; F5 d; h
  26. #include <linux/init.h># V6 |* V% Q+ T: T9 H* D* ?
  27. #include <linux/errno.h>
    4 L3 S* }9 S) e  F7 a2 o7 w
  28. #include <linux/types.h>
    , Y) }  v% E( [7 p" E' v$ n
  29. #include <linux/interrupt.h>
    7 J3 p2 B& e2 h& Z5 }6 ]* G
  30. #include <asm/io.h>% y, q# Y5 J) Y0 R% ~$ @" Q, P4 w
  31. #include <linux/moduleparam.h>. o. E5 z1 F6 b* ]4 V" X$ n. ?
  32. #include <linux/sysctl.h>5 s" M3 R, ^' v6 k1 b/ A; `7 V/ \" _0 c
  33. #include <linux/mm.h>* Y' u0 Q3 T0 a4 l: n* q  m
  34. #include <linux/dma-mapping.h>
    , C2 e- n: X0 S$ S4 G7 q; H% j

  35. & P  a. v; O+ }: u$ Q2 _; x
  36. #include <mach/memory.h>
    ) Y  l& S+ z: Q$ v
  37. #include <mach/hardware.h>+ ]8 W5 @* Q, H- j* y
  38. #include <mach/irqs.h>4 E; h( C$ A9 N  f9 {
  39. #include <asm/hardware/edma.h>+ W" A8 x: X. A3 |3 L# m

  40. $ z6 u; [0 n/ w. R& U* }
  41. #undef EDMA3_DEBUG& [& ?: a2 \+ X' U
  42. /*#define EDMA3_DEBUG*/! @. i: S: W: H& Y5 P: g0 Q

  43. ! u2 X+ p% L8 K3 s
  44. #ifdef EDMA3_DEBUG
    / k) U% ~6 m$ T/ }/ i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' M. ^# _& C: m: Q' M: Q  p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 K8 d* O: o4 x$ l, \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 g% r" r- p2 y2 `( r3 b* n" O
  48. #else. a8 o! t2 E! ?% l% `" E9 V1 S; b
  49. #define DMA_PRINTK( x... )' T5 j* U2 k* t+ A' `5 C+ p
  50. #define DMA_FN_IN1 d$ O5 O9 V+ J
  51. #define DMA_FN_OUT
    8 ~5 A# U; \6 D- j% j; s/ V
  52. #endif
    3 Q0 m' t$ W- E% C6 [. [

  53. 1 ]+ A4 \% R5 J: M# P& ~: o/ v6 r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ X) E/ ?( v) r" q0 t3 ~6 q
  55. #define STATIC_SHIFT                3
    0 z/ q5 L' B2 b0 N9 x; y
  56. #define TCINTEN_SHIFT               20
    / `6 a4 A! m$ h& X7 z  w( h* E( i
  57. #define ITCINTEN_SHIFT              21
    % [& Z* |- ]4 q
  58. #define TCCHEN_SHIFT                22
    * e1 `' Z" [4 T1 j& y( f
  59. #define ITCCHEN_SHIFT               23
    3 r- l) t- t( V

  60. ) D* J$ K& x2 E4 ~
  61. static volatile int irqraised1 = 0;
    2 _" \* Z4 R) G6 h: V  E# ?
  62. static volatile int irqraised2 = 0;! a6 G) \/ {2 W) v; h2 ^& W9 r
  63. $ m# I3 c9 ?' H$ Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 Z; n; e& h  f4 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% I. S# G3 s5 b7 o7 q) `7 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! `4 Q) t8 A6 S  M2 m

  67. 7 d, ~# M, E) ^* a1 r( F# V5 R7 _
  68. dma_addr_t dmaphyssrc1 = 0;  `0 x* h$ B( g2 N7 ^; u9 ?# c
  69. dma_addr_t dmaphyssrc2 = 0;
    $ b' U9 q% [: @6 B. `: s  I
  70. dma_addr_t dmaphysdest1 = 0;4 G( D. A9 a6 c# x/ u% U( t
  71. dma_addr_t dmaphysdest2 = 0;1 N( Z9 [" H$ {9 ~

  72. 4 h3 E  Y% ]5 A/ C7 @. V$ W9 y7 E
  73. char *dmabufsrc1 = NULL;
    ( M- r* U" s* k# e) v, A5 {
  74. char *dmabufsrc2 = NULL;
    ) d! d1 k1 g* j" C% k) [
  75. char *dmabufdest1 = NULL;
    ' T3 d; R5 a1 f0 i! s2 G4 N
  76. char *dmabufdest2 = NULL;/ d4 V0 O! s6 y" H  K

  77. & \4 U- y. g) a6 y
  78. static int acnt = 512;
    . J+ V) ~& d7 y7 |. m2 M6 J
  79. static int bcnt = 8;% Z! ^& c+ Q9 @6 B* z3 c' |( R
  80. static int ccnt = 8;! B7 `" x. ~8 F( {7 F# ]6 V

  81. 2 Y! Y/ q: U* g% [5 e; ]$ t
  82. module_param(acnt, int, S_IRUGO);; @1 ]% E' R& `. t) O% I; Y" u
  83. module_param(bcnt, int, S_IRUGO);
    " g3 |. f7 B; Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! w  b1 a6 D& y  m2 {3 X0 D
) a" d8 f* U( |7 G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 ~% F! @9 {" b0 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 g: P" m7 P3 ~# D& f. X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* r8 t1 R9 h% {5 d; e6 B$ V8 G! h$ F1 w* M

1 W+ _4 a+ o- p- j
3 I' j" M8 M5 m8 S6 w) B8 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-4 10:12 , Processed in 0.040377 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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