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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 ~: q  Y. `7 E: }  {
  1. [code]EDMA sample test application
    - Q$ b9 ^, @) J. d
  2. /*  K" m1 w( p' j. K6 a
  3. * edma_test.c+ ?! @! b& Q; O) i
  4. *7 G  H2 h& p$ u- v9 E
  5. * brief  EDMA3 Test Application% V0 R, k) I) e0 N* s5 R
  6. *. p2 V1 D' f) S% v
  7. *   This file contains EDMA3 Test code.
    + a- v# D; t8 [8 m
  8. *2 J$ v2 g+ |9 A' E% i  C/ ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ p' m5 c5 }; r+ M6 l! o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 I# j+ H% s, w3 t' c, J4 P
  11. *         TO CHANGE.4 y/ x8 J9 x( Z4 v
  12. *
    ! F. v* G6 g& |& X1 x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " y$ z9 v0 N) |  |2 f2 g' P% F
  14. *9 ~/ a; x1 Z. e# T+ S
  15. * This program is free software; you can redistribute it and/or
    4 N7 w; m8 a1 n/ p4 v
  16. * modify it under the terms of the GNU General Public License as* N3 W& H4 D$ |$ L. a/ g
  17. * published by the Free Software Foundation version 2.
    . R0 Z' g$ w6 i1 V. ?) _3 P
  18. *# M' ?+ O5 S! n6 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) T/ W) F) p- e
  20. * kind, whether express or implied; without even the implied warranty1 C+ s* K; L+ \) ~. k! _4 S! c; c( t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 X1 F' O" Y. P8 f% j( I
  22. * GNU General Public License for more details.# m$ Y/ ^* q4 w# @) @$ w
  23. */& n* A  z) w& g/ w( L

  24. ! q+ E! U2 f* o: O
  25. #include <linux/module.h>
    : q2 h) U+ Y" @% X8 \
  26. #include <linux/init.h>+ ?0 `$ w  D7 a8 k: `  a) o( y9 y; Z
  27. #include <linux/errno.h>  o$ ]/ S, C2 h: v, Z- Z' F1 W
  28. #include <linux/types.h>2 t: H6 n( q, c! H2 o6 m, V
  29. #include <linux/interrupt.h>
    1 A; v5 D" S( o8 h" E$ N0 Q6 Y
  30. #include <asm/io.h>% \3 ]. V7 e  Y: {6 d
  31. #include <linux/moduleparam.h>
    ) J# p* T3 c/ R2 v/ W  x2 R
  32. #include <linux/sysctl.h>
    : V% J% F" P. k+ I$ U2 a1 Y
  33. #include <linux/mm.h>
    . H# T& x6 S  t7 s# C7 I
  34. #include <linux/dma-mapping.h>
    . b& @1 n: V% H: l0 i
  35. ) v( S! P0 X2 b- f9 p! F1 `7 d
  36. #include <mach/memory.h>
    - p) K$ J: L6 Y0 }
  37. #include <mach/hardware.h>
    + q" k7 p$ i, c  B
  38. #include <mach/irqs.h>
      `" g# o" [" o9 E% a: C6 X. {: E
  39. #include <asm/hardware/edma.h>% a1 @' I! e' v
  40. : e: C, V4 p5 W) g  X) U; I
  41. #undef EDMA3_DEBUG8 P' q2 G% @' L6 N( ?) Y$ G2 D* K
  42. /*#define EDMA3_DEBUG*/6 i  X6 E5 i1 P" ~  g1 a  c- C
  43. 2 z1 C! l4 q! x" ^7 C. w/ X
  44. #ifdef EDMA3_DEBUG6 Q2 m. u7 v4 b! t  z- l/ A- V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / r# w( A% |' @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - p8 {( S$ C4 V8 M0 Y! p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - I/ P( x; B( V/ }4 f% x
  48. #else. h* L  D6 f: q; K5 l
  49. #define DMA_PRINTK( x... )& `  }! f" I5 ]$ j5 I1 B2 j
  50. #define DMA_FN_IN6 ^$ _& u7 p: B' Z3 p6 [# E5 n
  51. #define DMA_FN_OUT  C/ [, f2 A6 l0 o6 J* J
  52. #endif$ [+ U2 X$ _5 [+ L
  53. & G. ?7 y2 p/ p2 d7 n2 J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 F  Z  a, n( H0 C4 G
  55. #define STATIC_SHIFT                3
    , @* W  q* j% r' z
  56. #define TCINTEN_SHIFT               209 N, O/ ~2 ]0 b! O2 P
  57. #define ITCINTEN_SHIFT              21
    " t. V& n. r$ R' q' q
  58. #define TCCHEN_SHIFT                229 H- `4 H% \  C: `) k  v" u& N8 m8 v) H
  59. #define ITCCHEN_SHIFT               230 r5 i3 q3 x% y) L- ^% S1 J# z

  60. 2 @3 ^4 I/ k. v: @# y+ B
  61. static volatile int irqraised1 = 0;( N! t0 W/ q, l0 d; m% @
  62. static volatile int irqraised2 = 0;# J! n0 T9 R1 Y

  63. * F* d0 p/ _7 M% z: G/ d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 }2 X+ ~% D8 ^4 v( @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 {- ]2 d# k# l% J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 I' N1 d  ^* w7 c) w; s5 u  z
  67.   O+ `) S" h' C% X  [& u) i$ c- F
  68. dma_addr_t dmaphyssrc1 = 0;
    - b3 y5 K+ `+ S9 v. `2 g
  69. dma_addr_t dmaphyssrc2 = 0;7 ]' ~$ ^9 k: }. U
  70. dma_addr_t dmaphysdest1 = 0;8 v! q: Y7 f- i' W* _8 s" ]+ J& e- ?
  71. dma_addr_t dmaphysdest2 = 0;+ h2 t7 U4 N' Y3 `4 D

  72. : O  f3 B: g# o! E1 n# h+ x
  73. char *dmabufsrc1 = NULL;
    . N) {" g& K9 `; q! E" F: f, X
  74. char *dmabufsrc2 = NULL;, Y4 k4 [& T# r# F4 t8 K" x
  75. char *dmabufdest1 = NULL;
    8 j2 c  }( t2 D8 p7 E, I9 J6 B2 J
  76. char *dmabufdest2 = NULL;) D1 b) U+ L7 v: b3 _% g
  77. 7 X/ y) _8 M; q
  78. static int acnt = 512;
    + E4 p/ N) N5 ?( M" i
  79. static int bcnt = 8;
      Y6 _$ n& [" {9 G
  80. static int ccnt = 8;
    1 w3 g9 \$ }6 r* C/ H1 \
  81. ! m2 R8 ~+ i% d9 f2 s; S% J% d' r
  82. module_param(acnt, int, S_IRUGO);8 G; I5 s- i! ]
  83. module_param(bcnt, int, S_IRUGO);  H) B( @; z$ ~' S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 v* c7 h; J( V
$ M5 [$ _! ]: l/ i4 a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 H( H0 ~0 H, K/ H- x4 g1 h5 ^& 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 ]6 z' z6 f1 e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 _7 P: Y2 b: n; e$ t) y/ X+ d( ^9 I; q0 O; W1 f
. C, ?8 c* {  \& e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-14 05:29 , Processed in 0.050735 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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