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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 u/ _( V8 Z* q( j/ n" k) A. f
  1. [code]EDMA sample test application
    ) k& N- O- [1 Z# {. G
  2. /*
    ! q! B4 I9 p: t7 L3 A" K7 O4 O
  3. * edma_test.c
    8 [4 D" v# ^% T7 H  }/ r: r
  4. */ S$ I0 w, w% z; K0 y
  5. * brief  EDMA3 Test Application: _  F! H3 F+ i) ?' ^1 P
  6. *
    $ l& L2 _. [; r4 u
  7. *   This file contains EDMA3 Test code.
    0 K! |3 G% L1 m" d) K9 ?
  8. *
    5 ~$ I7 D5 R, Y, @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. G7 _! a: N, U2 k/ F6 W! V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( ~7 \- ]$ Q4 Z; k, b
  11. *         TO CHANGE.
    - [+ k7 c5 \# W5 W
  12. *9 Q8 h/ G2 J% N/ n2 m" u7 q/ |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( u2 D% I( l  Z! o) `. v
  14. *' S: ?9 Z" a) O: s7 t
  15. * This program is free software; you can redistribute it and/or4 K) N  R" L. H0 Q, f; c
  16. * modify it under the terms of the GNU General Public License as
    3 J0 s* f9 X" e* ?" G  g- G! J
  17. * published by the Free Software Foundation version 2./ k# W5 I! X. F$ \2 j
  18. ** h* K+ t$ N2 B) T: e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( ~3 v0 \0 n5 X: @. S1 P
  20. * kind, whether express or implied; without even the implied warranty+ e" t& Q9 O: Q, O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 u5 k3 V' m% O" [& s- ^
  22. * GNU General Public License for more details.
    ' m+ G/ U/ P5 H# Y+ U
  23. */
    & B' @5 C: k8 d+ F% N# e# W

  24. ! ^1 E- U$ r- ^7 @! D4 e, f/ M
  25. #include <linux/module.h>
    : G6 u" G8 n* k5 N' Y
  26. #include <linux/init.h>, g5 N0 W+ h, L; U1 `3 p% X3 x" S
  27. #include <linux/errno.h>
    ! U+ B( a3 h1 Q/ G5 c- Y/ }
  28. #include <linux/types.h>' R# A' S. d; Y2 z& j" J% {
  29. #include <linux/interrupt.h>; w8 c. w% @! v* f: K4 Y; F
  30. #include <asm/io.h># u& R$ M' U. c# h  H: U
  31. #include <linux/moduleparam.h>0 ^0 Q. b/ E$ ?" P8 s9 c& d
  32. #include <linux/sysctl.h>! B9 K& F; g2 _9 D4 w8 j
  33. #include <linux/mm.h>" o1 I; A  g0 s' K8 v! {( z1 Y
  34. #include <linux/dma-mapping.h>: a- _* o3 u* M' t. V9 |" |
  35. $ K0 ?7 g' A; U: |7 [0 a2 H
  36. #include <mach/memory.h>
    / [2 B3 @; Y. E; Y4 Q$ ^  X( k
  37. #include <mach/hardware.h>1 B. F7 y- x- W; ~3 x0 j3 `' k
  38. #include <mach/irqs.h>
    , t* G- L+ P' o) d3 l" J
  39. #include <asm/hardware/edma.h>
    6 G* \( L" T% v7 G- m( n
  40. 8 V9 T: D1 M7 n) [
  41. #undef EDMA3_DEBUG) g& {6 P* u2 n; U+ b
  42. /*#define EDMA3_DEBUG*/
    7 V* }  U) _& P6 B& y/ }8 v; N, O

  43. $ h* `" }, x; P% V
  44. #ifdef EDMA3_DEBUG
    0 t/ n: X0 Q2 N4 ^, c9 o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( |- O- }- o/ F: A7 R6 `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 H, v  h, Z' _+ \3 `# o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- B9 u  y& v$ L; S
  48. #else" R# u8 g. L$ c, B# d
  49. #define DMA_PRINTK( x... )
    ' i: A* Q) {8 d2 ]- `$ g9 O
  50. #define DMA_FN_IN" ]+ d7 i& ^% T* H9 _0 M2 f
  51. #define DMA_FN_OUT
    : k$ Z. T9 O7 L- X/ N. ^
  52. #endif$ ^# t/ U8 j$ W! B  P8 k8 E

  53. " q9 K9 ^- w: Q% T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! g1 h) y+ L0 `' N* [
  55. #define STATIC_SHIFT                3
    ' U! I5 C& i) X, s
  56. #define TCINTEN_SHIFT               20
    . D) n, J% j# V, t/ i  _1 [
  57. #define ITCINTEN_SHIFT              21
    6 ~7 q, z6 N# {0 d+ o
  58. #define TCCHEN_SHIFT                228 X) x; L6 ^" F" S$ Y; G
  59. #define ITCCHEN_SHIFT               23
    ) X" V6 Y+ I6 ~
  60. 7 ~5 h0 M3 l: F) [) a
  61. static volatile int irqraised1 = 0;
    " t& [& Q4 m! Q$ Z' g
  62. static volatile int irqraised2 = 0;
    ! B1 U; C! o' ], r
  63. ; _! u  Z% d5 ?+ ?' k+ X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # W2 P" b% Z: x( l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 @7 i5 U# u1 k/ M  g5 g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( C6 V. R% a0 X& i6 B

  67. ; h* i7 O$ C& n6 G; E8 s0 C% \
  68. dma_addr_t dmaphyssrc1 = 0;
    , F( {. ]% M9 E. k
  69. dma_addr_t dmaphyssrc2 = 0;
      Q& Q+ Z8 b$ C6 `+ d
  70. dma_addr_t dmaphysdest1 = 0;
    5 g: H4 Z& a# [$ u
  71. dma_addr_t dmaphysdest2 = 0;% ~9 C+ e$ b8 _- ?
  72. 1 e  X; E" R4 Q3 Z$ ~: ~7 ^
  73. char *dmabufsrc1 = NULL;2 C2 s) W+ C( v8 \$ a
  74. char *dmabufsrc2 = NULL;) E1 T0 D2 p" e- X4 Y
  75. char *dmabufdest1 = NULL;
    3 a; c# y; x& O0 t( H& C
  76. char *dmabufdest2 = NULL;/ D- B4 F, @- }( v! b

  77. $ y, D' M4 J) }
  78. static int acnt = 512;1 y% r5 E# h% C0 P- K+ f! k
  79. static int bcnt = 8;; Q7 `9 o, U9 f1 G+ k
  80. static int ccnt = 8;
    ! v: E! h, n& E3 l; |# k' I5 ~8 t
  81. 7 O6 }( R* i: r* @
  82. module_param(acnt, int, S_IRUGO);, w0 ~) R9 ~( @* e7 t4 C5 Z: d+ R* z
  83. module_param(bcnt, int, S_IRUGO);; a- k1 P) @. W& r8 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, [0 H$ G, t# w
( Z' X$ m5 M5 N! Y3 O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 e% z4 u( U  S% A, iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. y0 F7 Y- o, t: Q9 T6 T+ q" U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& U' o3 x) |7 z" f6 Z' |
7 i' u$ P, }  ?7 K, v9 M& Y) A8 B6 f% N, a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-10 17:39 , Processed in 0.044774 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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