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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& M9 N$ f+ n4 i* j9 y6 l
  1. [code]EDMA sample test application' u. `# H2 O1 v3 G& m) S/ u+ m$ ~( W
  2. /*
    5 a" K6 h8 U+ t( y
  3. * edma_test.c
    " {+ c- _1 |: [9 F
  4. *
    5 J, g, F3 U. q, n0 t9 u6 D
  5. * brief  EDMA3 Test Application! J9 ^7 V, g3 y0 j* ?
  6. *" W4 F* X8 c$ ]8 w% c, [6 h
  7. *   This file contains EDMA3 Test code.
    , j  \7 _4 w( L
  8. *% f' d3 E) M4 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      G' U( Y7 T9 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 |3 M" S! Z+ e+ \  `* d
  11. *         TO CHANGE.
    2 [7 Y2 G5 A- O
  12. *% A! m7 |' L2 m5 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  d+ v+ O# F1 R; n  l" k
  14. *
    6 C3 t+ p9 {* X8 s$ }# B
  15. * This program is free software; you can redistribute it and/or
    . {* H5 f4 \/ C% G3 W
  16. * modify it under the terms of the GNU General Public License as
    + E4 S  |0 r, j
  17. * published by the Free Software Foundation version 2.9 k+ q' I! c9 x
  18. *
    0 ^: y; y) u% R) K. n1 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 p! C) ]( O# n6 H/ R0 B* q
  20. * kind, whether express or implied; without even the implied warranty
    + p/ s; v7 r$ q6 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " u# o- F" e/ T& {& c
  22. * GNU General Public License for more details.* J* L3 k6 D7 S% |
  23. */
    / F! U, L) q( R$ Y" K1 O9 p

  24. # T1 s5 M' y. O* f* q, J" H' C
  25. #include <linux/module.h>6 Y0 n9 C0 C$ @! a; [4 H
  26. #include <linux/init.h>
    8 n) l/ K5 M+ c% D
  27. #include <linux/errno.h>
    & i; I5 n; Q8 Y
  28. #include <linux/types.h>
    8 F7 [) F6 r9 `
  29. #include <linux/interrupt.h>  q, W( E$ o: _7 R. _
  30. #include <asm/io.h>, @: k' ]4 \5 ]. b# R7 f. J) X
  31. #include <linux/moduleparam.h>9 H( a0 h. i; |! a
  32. #include <linux/sysctl.h>7 x4 s8 c" M! x( ]$ @! {9 S
  33. #include <linux/mm.h>
    7 E6 v$ C. W/ ], U# p, n: K! z, |
  34. #include <linux/dma-mapping.h>& Y( X5 R/ Z8 u- N0 ]
  35. ! ^* A  O% Y. F4 ?! @# w- w
  36. #include <mach/memory.h>, x! v& w0 q3 s8 G
  37. #include <mach/hardware.h>
    ( C$ M5 B% I8 k+ o: N
  38. #include <mach/irqs.h>
    4 n8 E. X9 C( r
  39. #include <asm/hardware/edma.h>
    8 V" I" S+ ?4 y9 B9 N, t/ M1 m  V
  40. $ E: Q, ^2 w( Q2 Q3 }3 X3 C
  41. #undef EDMA3_DEBUG* ]5 A; x2 e/ v' P: B
  42. /*#define EDMA3_DEBUG*/
    " q2 N7 m0 L8 t5 ~& k7 Z4 C
  43. ' s  S' V% p' s0 @1 k
  44. #ifdef EDMA3_DEBUG
    : h% W2 r" b; Z  T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " j% ~( x' [( r, J" S: f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " ^2 w/ t. D% z" f9 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 k( y% p" G& `0 N9 `" f4 G
  48. #else
    ! V1 \' X$ y, F0 \$ z5 y+ l
  49. #define DMA_PRINTK( x... )
    * N: H+ w, r* P
  50. #define DMA_FN_IN
    & }9 O, n1 W, p7 b! v
  51. #define DMA_FN_OUT
    ) U, [/ f! E5 C+ x
  52. #endif2 n$ U3 l4 ?# F
  53. . I7 Y- d! W! U1 Q0 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 S2 q: B) O) E7 `; A
  55. #define STATIC_SHIFT                34 ?+ T4 w5 w! w
  56. #define TCINTEN_SHIFT               20
    $ D& h+ T0 r: n" M2 U2 G: c2 r/ O) X
  57. #define ITCINTEN_SHIFT              21
    8 C2 i$ r: l: i# N" E* z
  58. #define TCCHEN_SHIFT                22
    4 C$ ]. _3 f" j  k6 L! o
  59. #define ITCCHEN_SHIFT               230 i# b' S* L& d* h' a9 R

  60. ) \% T! K0 \& z# ]2 O- ^
  61. static volatile int irqraised1 = 0;, s4 U+ Z8 D1 [. ~/ d
  62. static volatile int irqraised2 = 0;, F' Q7 Z! o6 Z6 K7 {

  63. , R, [; n; E% ^* {: T: H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Q1 ?5 Z2 [( ]& t8 B6 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; A, E, E  d) }" y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& g% n+ t$ e8 `: L) E) ?
  67. 1 Y" _7 z  Q5 N, ]) [& g
  68. dma_addr_t dmaphyssrc1 = 0;
    - f' ]; W5 s+ R5 k; E: L( e
  69. dma_addr_t dmaphyssrc2 = 0;( O# o  k* |: i4 I
  70. dma_addr_t dmaphysdest1 = 0;) n" N; D2 m. @4 E- Z
  71. dma_addr_t dmaphysdest2 = 0;
    ) B( p. F8 D7 G3 W

  72. ) u1 Y2 ^1 h) F+ X
  73. char *dmabufsrc1 = NULL;
    ( U1 _& w2 i' e8 ^7 L# k0 f: p5 u
  74. char *dmabufsrc2 = NULL;
    : N2 Q4 Q8 f1 `; W9 p; `" h
  75. char *dmabufdest1 = NULL;
    7 V1 j; P3 B- N7 `( Y+ R/ r( X& i
  76. char *dmabufdest2 = NULL;1 n; {) x2 P4 u  B- O3 l
  77. 7 t; y+ \9 V4 Y! X+ m
  78. static int acnt = 512;
    , g$ b7 M3 O" X5 n, R2 l  F& W
  79. static int bcnt = 8;
    . a- D' N5 w$ E2 A0 ]7 _
  80. static int ccnt = 8;
    / Q! X; t0 [0 |" G) r# B4 U

  81. 4 Q0 _7 B7 f0 N" K1 D$ q
  82. module_param(acnt, int, S_IRUGO);
    : S4 E- D% @( N7 A; L3 F9 U, z2 R
  83. module_param(bcnt, int, S_IRUGO);
    6 ~! b, X9 s7 F3 F8 v) j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 A$ ?" Y$ P$ X. Q& u- K
# f& O9 @; N9 ]/ r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; o. t; J7 p% m( xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 W* H6 C; |7 S& T% q0 \& B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( y1 H5 r" N: [* M8 X) ]1 ~6 s1 ?, E
, w2 a) [* v4 g$ [4 R: k8 E4 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-23 15:34 , Processed in 0.041704 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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