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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' i' {+ a7 \4 O# G1 d
  1. [code]EDMA sample test application4 R% V8 S, }4 T
  2. /*0 t. B( q: J5 O' M" ^2 ]% [
  3. * edma_test.c! S! S- A# Z7 I: e+ f) l
  4. *
      j4 {) N: ^' E
  5. * brief  EDMA3 Test Application
    1 s0 w/ l4 ?% _
  6. *% ~" l8 B8 N0 C* p
  7. *   This file contains EDMA3 Test code.
    2 p- w  Y% e8 [
  8. *
    ; n9 q, ^" ^. x/ T/ |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) ]  y2 m( Y, o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; ^8 C$ S: s$ P( F( s
  11. *         TO CHANGE.
    * u% y0 N9 E2 R5 }( ^. [: K
  12. *- ^* e4 e% \$ i  k$ f3 k$ D* H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 C/ p1 N; Z# w& A7 a! a
  14. *) a4 y6 r( U4 ~; R
  15. * This program is free software; you can redistribute it and/or
    ; D/ {. ?/ v' A
  16. * modify it under the terms of the GNU General Public License as0 S) ]- E  X8 R
  17. * published by the Free Software Foundation version 2.: K( m/ d. C3 J8 m
  18. *5 }0 y; s- |7 [/ `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / M1 x* `$ a7 b) r
  20. * kind, whether express or implied; without even the implied warranty
    + v0 L8 Q4 Z! }' _, L" c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  Y1 ~, w9 y8 v4 H- T+ x" T
  22. * GNU General Public License for more details.
      ~/ W! j7 A" ~& `: D& g7 D
  23. */
    " b$ E7 B* g3 E1 H
  24. & |% K7 B1 M2 W
  25. #include <linux/module.h>' K8 S4 }$ E0 U  n9 ]& K5 Y+ N) X
  26. #include <linux/init.h>
    % o3 J  E4 w# C
  27. #include <linux/errno.h>6 h0 ?. ^. P) x8 g- G( J/ O
  28. #include <linux/types.h>
    ) h# K2 e8 |' L* V0 n
  29. #include <linux/interrupt.h>. U5 `7 F' O* a  ?0 a
  30. #include <asm/io.h>& V% x6 B4 ^: q9 B. b1 [! h" L" t  [
  31. #include <linux/moduleparam.h>. c# N! [' R+ s. X. b7 M
  32. #include <linux/sysctl.h>  T" k8 Y+ e5 L6 S( u6 K9 D5 W* W& V2 }
  33. #include <linux/mm.h>% i' g, ]' L1 Y# ^0 O
  34. #include <linux/dma-mapping.h>
    : T% \' l9 X6 W2 U& I. K

  35. 1 |: U" |& Z- m! [1 {# p# o1 i4 z
  36. #include <mach/memory.h># \9 S* {9 e% A) }. d
  37. #include <mach/hardware.h>
    & a8 z5 @/ C" N: m: p
  38. #include <mach/irqs.h>
    8 x# G. {+ M# d6 c7 j3 n9 e4 J- H
  39. #include <asm/hardware/edma.h>
    ) O7 C7 u: X+ Z
  40. ) t! G9 ~+ }9 }$ ~# `' ~
  41. #undef EDMA3_DEBUG
    9 U/ w0 J' t1 H& B1 B  y  X/ r
  42. /*#define EDMA3_DEBUG*/
    1 i, ~# g4 ]0 b; x4 H& o
  43. : z, e. W* K" X1 U5 H( [" C
  44. #ifdef EDMA3_DEBUG
    " V" }, ^5 j; x# ]( Y4 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 ]4 B2 A; ]4 q9 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* Q" P) k' ?+ b* j$ |! H$ u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): F' F; K  x* D) S/ x* \
  48. #else) f! O2 j% G. c5 j7 x
  49. #define DMA_PRINTK( x... )
    * F- c; `" G( }/ g+ ^# W8 H
  50. #define DMA_FN_IN
    " G* v5 k1 f  x9 r( K
  51. #define DMA_FN_OUT
    9 Z. f6 Q' {+ T! A3 L
  52. #endif
    , \* E8 L: o0 w  T

  53. # u9 n% r- `; d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! b; R6 b4 {/ L- J0 `# q0 h# Z4 A& Q
  55. #define STATIC_SHIFT                3! n, v- n! J. G5 O
  56. #define TCINTEN_SHIFT               20
    $ z! Z' W7 h4 H, k/ t6 `3 I9 T+ Y& o) F
  57. #define ITCINTEN_SHIFT              21
    0 B2 L; b: T/ S) _, y5 Y
  58. #define TCCHEN_SHIFT                22
    : k4 I& e* G7 U3 ?
  59. #define ITCCHEN_SHIFT               23
    & f+ `) K. A% n% B
  60. : |3 f( g8 I' i3 B0 X! ~2 G, d! G
  61. static volatile int irqraised1 = 0;5 _' P. ]5 u' @  c
  62. static volatile int irqraised2 = 0;# K. }8 k$ a+ p( c4 g

  63.   n3 d+ v* t7 H, i! J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ z% F9 Z3 n% q: Z6 v4 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 D) }% ^1 W% r5 ]4 v; U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 {4 f9 w; B+ ?7 _2 ?3 a
  67. 3 [& [- t2 H' A! `
  68. dma_addr_t dmaphyssrc1 = 0;
    / R! D; r2 e0 u( t: L- }8 N: A9 x
  69. dma_addr_t dmaphyssrc2 = 0;+ r% n+ v9 o1 p# }( J
  70. dma_addr_t dmaphysdest1 = 0;
    , w2 g! F' ~: `# d5 t: W2 ^3 _  f
  71. dma_addr_t dmaphysdest2 = 0;5 _" h. R( I1 g4 E
  72.   k3 t+ J7 a1 a* Q
  73. char *dmabufsrc1 = NULL;3 Z) }  F9 B6 `9 r; p  f/ Q5 T
  74. char *dmabufsrc2 = NULL;
    0 l7 _" ?/ \) b6 E' M
  75. char *dmabufdest1 = NULL;% X2 a2 k4 n. S! ~
  76. char *dmabufdest2 = NULL;0 g. X, }. h6 k; b$ W- G! B
  77. * E1 B3 H' ?9 c, \
  78. static int acnt = 512;
    - t' Q! `; G0 n  R
  79. static int bcnt = 8;& q* U  @, g  m& Z
  80. static int ccnt = 8;
    , ?6 g" \, Y4 F
  81. 0 z& K  T/ O+ }7 y) e
  82. module_param(acnt, int, S_IRUGO);
    1 F$ |# G1 e, J% ~9 n" r
  83. module_param(bcnt, int, S_IRUGO);/ m5 A' G% h; C7 _* e4 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 F8 d  T+ P9 a% |3 h
5 E. `0 j+ ~% k5 ~5 l7 ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& _: A! {( F. `! j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& A* b* t' ^- Q6 I: `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 K1 J# n. I8 b$ d) ]: b) b
/ V9 E6 E: k8 I5 |$ K6 v9 ~+ m* N
, j8 i  A+ ^& M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-10 00:42 , Processed in 0.045500 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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