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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 C8 l1 B' M- n% N' M- G
  1. [code]EDMA sample test application/ I0 w1 q  }/ _; D8 q0 W4 q
  2. /*
    9 E' i* \  L4 x+ S7 `$ ]
  3. * edma_test.c
    0 ]0 \" N0 j! D* j: c5 v! l5 J5 ]) R
  4. *
    , e  \; |8 {7 I$ E9 M3 O1 w1 m6 s
  5. * brief  EDMA3 Test Application! ]- N8 @8 c0 i6 l2 u% Z! Y
  6. *
    : @+ n  X/ P0 d& Q, _- i
  7. *   This file contains EDMA3 Test code.
    % \% A& F' |1 T+ _' x
  8. *
    : F# I5 |6 j4 u% u+ C/ @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: Y+ Z# S6 c( F  E( w. v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , g& G2 |3 d5 A2 A* m
  11. *         TO CHANGE.
    2 _: d! a6 J6 T. z
  12. *# H9 |# a7 ?. ~7 n2 b4 z' U( l. \3 S- c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& W& s- y7 u$ E1 c! D
  14. *
      d( l& w0 |6 f+ Z/ m% o& {& K3 Q
  15. * This program is free software; you can redistribute it and/or- N$ ^3 C9 f3 h9 ?
  16. * modify it under the terms of the GNU General Public License as9 O9 o5 s1 ~# B1 ]
  17. * published by the Free Software Foundation version 2.
    * y0 O, x. C" r5 E1 y
  18. *1 [+ h) {# A1 L8 N' K/ L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - h$ Q2 x, c: M+ p$ n2 ]6 J( o% q  Q
  20. * kind, whether express or implied; without even the implied warranty! z( V7 o# ?& U6 |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 x% R3 X+ _% B8 Q: c! V
  22. * GNU General Public License for more details.
    - `3 U/ l3 Z6 ~2 [
  23. */2 b( s0 d; \  ]" f/ U6 \+ b1 h5 G

  24. 6 M7 W# V; R# K8 F$ M
  25. #include <linux/module.h>
    + D' d- D1 q4 c/ V
  26. #include <linux/init.h>
    % k, M8 @3 a, U: ?( m/ B& t- O& g
  27. #include <linux/errno.h>5 `# C" n3 j9 E0 i- j9 z$ Z; W
  28. #include <linux/types.h>5 i* I0 A# D7 q9 F
  29. #include <linux/interrupt.h>7 G9 h4 Q- d# A4 J' ^
  30. #include <asm/io.h>
    5 C& m1 Z& ]4 V, c! k& s/ a7 Y
  31. #include <linux/moduleparam.h>1 t6 U+ G- @! T, t
  32. #include <linux/sysctl.h>
    + h  F* ^- j3 z$ [
  33. #include <linux/mm.h>! g! B- y5 s2 x, ~" |& x
  34. #include <linux/dma-mapping.h>
    0 G$ [; K, |8 D  K& V

  35. 5 U0 D, ~8 y# \- M# U2 \
  36. #include <mach/memory.h>
    3 j# L  P5 W5 U: l" O7 q
  37. #include <mach/hardware.h>
    4 L" _4 z. B/ f1 a6 ~- U& a9 j: \% G
  38. #include <mach/irqs.h>7 u0 g: V  i8 f6 @* g0 ?& u7 U
  39. #include <asm/hardware/edma.h>
    9 X* j9 Z' E. E& u5 T% |

  40. " w$ q! F8 B. i/ m
  41. #undef EDMA3_DEBUG
    " ^- g# |: z( g0 u
  42. /*#define EDMA3_DEBUG*/  l1 K$ j; N* t, W. Z

  43. 7 F% k# a$ R4 }0 V% S/ P( o: G
  44. #ifdef EDMA3_DEBUG, R+ v1 h* M* [# h4 z1 i1 y  Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& t+ D# q. L# h* f2 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 b" p: L+ b8 }6 ?0 \6 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! h; k% W% O- r8 ?; x8 |
  48. #else5 a1 i. b$ X1 Q
  49. #define DMA_PRINTK( x... )
    ! a7 u# m2 A* w
  50. #define DMA_FN_IN
    - V: X. `% [& C9 B, `
  51. #define DMA_FN_OUT
    , x) q3 j/ Y. k& _
  52. #endif
    9 Q5 H8 c/ a: U1 G- Z
  53. 8 J3 C- ?3 P& ]3 ^  W; ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 |# I: q9 y: W; h+ Z0 q# {
  55. #define STATIC_SHIFT                3! |; X8 u) `: Q* o' P; p
  56. #define TCINTEN_SHIFT               20
    8 C9 S, x) H( l$ ?( B5 r/ u
  57. #define ITCINTEN_SHIFT              21+ G- G8 _5 W  q/ \, I+ H+ h
  58. #define TCCHEN_SHIFT                22  b+ S% [. G8 m% ~( l- x# }
  59. #define ITCCHEN_SHIFT               23' D- y1 M6 R' |+ M  s% E

  60. 8 ?$ j# b# F+ T' N1 Z
  61. static volatile int irqraised1 = 0;
    " {1 w% b% Y) @, b0 ^" n
  62. static volatile int irqraised2 = 0;
    ( W3 N2 Z, c' D* |" R) D* F* O/ ?
  63.   |  j: `) M+ m3 q3 C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 m- \3 z* Z3 K4 ]/ t- r0 F. w! V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! M/ l; }6 l6 `/ B7 P+ a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% P& [- G) q3 O0 h

  67. # b' E+ w! d& F/ a
  68. dma_addr_t dmaphyssrc1 = 0;
    % F2 s# {, I1 a. _/ n& j0 C
  69. dma_addr_t dmaphyssrc2 = 0;! _0 Y, T$ B/ |- e
  70. dma_addr_t dmaphysdest1 = 0;
    0 d( c$ o3 L, C3 M
  71. dma_addr_t dmaphysdest2 = 0;
    3 w4 O5 N" `2 A

  72. - e- h2 }+ Q8 f" ^
  73. char *dmabufsrc1 = NULL;
    ; Y9 ~+ E" P' w
  74. char *dmabufsrc2 = NULL;& A! u) ?- k1 n! I  t
  75. char *dmabufdest1 = NULL;
    % I/ X- j. [. H
  76. char *dmabufdest2 = NULL;
    9 P7 k# t7 J( a! r: e3 z% D" G
  77. * q5 y% n' @/ V  a
  78. static int acnt = 512;9 a0 C4 x2 K( j8 b
  79. static int bcnt = 8;' f! g7 x3 D$ n7 \
  80. static int ccnt = 8;
    9 O7 `5 O: H3 G
  81. * F+ W- r6 T) Y
  82. module_param(acnt, int, S_IRUGO);3 ~9 E* s7 A! c- ^( r% d
  83. module_param(bcnt, int, S_IRUGO);1 ]. n% \  f) U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ l; g( t& f$ O3 S) w$ A" f4 F1 @9 @3 ^( K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, U3 {7 i% }6 I; H9 i+ j! Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' r' [9 @+ n+ f5 z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 k: |! }: R+ i8 `8 V0 ^; i* J, f8 H# X! b# }, U2 J# B

2 Y- _  v9 [. r! s5 c. S) s& t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 12:40 , Processed in 0.042014 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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