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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- v0 j3 M: Q4 j$ v4 n
  1. [code]EDMA sample test application2 E, i- v+ J/ n' q
  2. /*1 E! p/ x. _# h8 x1 b. f9 S
  3. * edma_test.c7 Q, A0 O& X! _1 _; k
  4. *4 D7 f$ {# }3 c: ?
  5. * brief  EDMA3 Test Application
    % l7 S# |9 _0 u9 {
  6. *
    ; v: P3 ^9 [) g* i  x6 C' h
  7. *   This file contains EDMA3 Test code.& Z3 I1 D3 l, r) A$ e  m6 U) s
  8. *- j8 N8 ^8 E& ?# H7 a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. x! }/ I( r* Y$ b+ {2 _  I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 X  a, k1 n  Y" [& U& j; I6 F  v
  11. *         TO CHANGE.
    + h- j2 f0 Z7 J* ?) i
  12. *
    * U! \6 V0 _2 I2 b. ]. ]9 q  Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* |; D4 J$ l4 s, N
  14. *
    0 o% A! g; m8 i+ e
  15. * This program is free software; you can redistribute it and/or
    0 r' j! U% U/ g0 t& T- y
  16. * modify it under the terms of the GNU General Public License as
    6 j* v2 u, p: x, D  |  x' K; D( m
  17. * published by the Free Software Foundation version 2.* c1 W  E; [4 }- [' r8 [" L5 P  ]
  18. *
    1 o" S- l! ^4 f- E+ A% c5 H+ y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 s; ?+ u: z4 w# R) V4 O: |
  20. * kind, whether express or implied; without even the implied warranty+ [# h* T, ?$ G0 |4 q. ^6 c( j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! V0 i7 O7 z+ z# l
  22. * GNU General Public License for more details.- A4 O% g1 m- e7 o1 L! O3 ^
  23. */
      @9 O/ Z. ^1 z+ g  _. R) Q
  24. 4 p* I* W3 Y3 p+ h- T& e
  25. #include <linux/module.h>
    6 }2 W8 D1 q) L) N6 O% a
  26. #include <linux/init.h>0 `  G% K8 Y+ A: |, I( D4 ?, s
  27. #include <linux/errno.h>
    ; ]. i, N! L9 j
  28. #include <linux/types.h>3 |3 F( E( j! k1 g% J) l
  29. #include <linux/interrupt.h>
    ' w1 q; \6 i# h1 c; @& S7 v5 {( c
  30. #include <asm/io.h>- v# n; C& H. X, W
  31. #include <linux/moduleparam.h>
    ; T! ?6 A" C" a8 X
  32. #include <linux/sysctl.h># d/ e! m. [: w: z$ Q
  33. #include <linux/mm.h>
    ' |8 v$ B0 y7 H
  34. #include <linux/dma-mapping.h>' k  J7 B$ U9 W6 I* v0 E
  35. + N! W1 D" @( S4 W' J' |) U
  36. #include <mach/memory.h>
    1 s8 H; G  L  f8 ~
  37. #include <mach/hardware.h>/ ]6 Y2 `* ~/ f# ~! @
  38. #include <mach/irqs.h>
    4 @* N; Q$ R+ a9 k3 i
  39. #include <asm/hardware/edma.h>
    * T- Y* d0 T; X

  40. 4 ~1 [" f' L" g8 G( {: \/ O
  41. #undef EDMA3_DEBUG/ n$ \$ Q- S+ W  B0 l/ M
  42. /*#define EDMA3_DEBUG*/
    ; w1 l4 g. v* W" v
  43. 5 O/ Y" c6 D* o# h, A! m6 L- r
  44. #ifdef EDMA3_DEBUG
    3 B' E* W1 q" O# P$ n! V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 C% t6 M3 B' n. Q6 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 j0 t* B7 y; p& R- W9 M9 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 b. h# g+ u% S
  48. #else
    1 E. c3 n& @4 t! B! C
  49. #define DMA_PRINTK( x... )
    9 u7 I1 w7 [* w5 A. h* c& N) m) Z
  50. #define DMA_FN_IN0 ^1 _% l9 X, }, h! P$ J- ^# H
  51. #define DMA_FN_OUT
    " Q0 c  d5 t* v( W# F8 ]9 y
  52. #endif: P  U; D1 C8 v1 ]
  53. 5 ~1 q7 P" k- R. C& ~2 }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 U9 U6 e  a8 n1 F1 \  ]! W+ U, g
  55. #define STATIC_SHIFT                3
    - M  b" Y' k8 `5 M/ b! z/ _4 `
  56. #define TCINTEN_SHIFT               20
    + H! Y2 c+ D) b: a
  57. #define ITCINTEN_SHIFT              212 }4 s7 N- I  _9 W1 X
  58. #define TCCHEN_SHIFT                22+ ~- E( f; _: e4 i6 p
  59. #define ITCCHEN_SHIFT               235 R2 k1 [9 D1 D3 L+ _  }& Z
  60. . n9 f7 t9 z; b2 Z# Y
  61. static volatile int irqraised1 = 0;0 ~8 F5 @7 H9 J% Z; R
  62. static volatile int irqraised2 = 0;9 c& h) H* T0 [, q0 _
  63. 6 g- P, s, m% E: x1 B- x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( ~8 j2 i: \) Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 K% i$ p) o- t) y3 v$ y, \. c( L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! H9 X- Z( H7 }& `5 ]" l# a

  67. & d8 ?: t; t2 h- _* V9 d
  68. dma_addr_t dmaphyssrc1 = 0;9 ~7 B$ `$ E4 c; e; X! M5 d. {
  69. dma_addr_t dmaphyssrc2 = 0;
    ! K8 U8 A) u/ g8 D/ F0 m5 P4 Z
  70. dma_addr_t dmaphysdest1 = 0;
    1 h+ {' K" P1 W: o; R* d
  71. dma_addr_t dmaphysdest2 = 0;
    . a+ q$ T4 H. e) W; q- V# O, }

  72. : ?/ d( y+ m& z+ W' n
  73. char *dmabufsrc1 = NULL;5 {8 w) V  |$ ]* N! Q6 e$ l2 K  |
  74. char *dmabufsrc2 = NULL;* p: b  ]$ I: F' f
  75. char *dmabufdest1 = NULL;3 q( K! f+ H/ ^7 Z0 \' p4 o
  76. char *dmabufdest2 = NULL;
    9 c* f  L8 A) U6 r! ]
  77. * L. g+ H  h2 {, m5 h8 Y4 b
  78. static int acnt = 512;. j& w$ V! e* g' s4 m
  79. static int bcnt = 8;
    - h% N6 s2 l1 e7 P( B, t( r
  80. static int ccnt = 8;
    + E5 Q) w8 j$ V# B+ x/ p; N' F

  81. 2 X4 |! ^# B( ]: {; o+ M7 y
  82. module_param(acnt, int, S_IRUGO);( n4 c) {, ~; g% x$ g+ ~" T
  83. module_param(bcnt, int, S_IRUGO);
    8 Q+ B! I8 l9 @, _7 u7 S/ K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& g, D! x" k6 h5 R0 |; [+ O0 i; c) |/ o, n2 h7 h5 N9 c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- y& u- I. m& e. 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  `1 P' Z" B- ?/ G6 o* \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 y. A1 g# W6 N7 h' J, J1 o
4 b) g% K$ R' {& m+ ]

, K. V- x+ @% a  [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 17:04 , Processed in 0.045929 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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