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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) o& n: G8 z$ U4 {- [6 i! H  X- i
  1. [code]EDMA sample test application! J9 j0 @: a/ O( p1 u3 v3 }
  2. /*
    - M2 N4 M+ ~* Q$ V/ O( P6 v0 E
  3. * edma_test.c; t( a( j) Y. }$ b/ S/ d
  4. *
    ! n* u3 K5 e% r$ B, w# r. m; h1 U
  5. * brief  EDMA3 Test Application4 `+ q* I3 l; \
  6. *
    8 q- W8 N2 ^+ ^* J1 ~
  7. *   This file contains EDMA3 Test code.
    0 _+ J, @/ Z1 C) O3 `1 k
  8. *' Q6 F' R. S8 E, f& b5 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 F( l1 {# V8 ]$ @  B& R0 W& \4 ?; A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 Q  X* B$ w; L! f; F
  11. *         TO CHANGE.
    4 f/ K/ Z0 Q4 H
  12. *: Z/ `' ^) G. F7 k$ Q* k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : C2 P; s6 `: s# e0 c
  14. *
    5 s# N; H- @# C- F" a- v, P
  15. * This program is free software; you can redistribute it and/or8 p3 S, e- Q2 l$ p. Y) ]9 u
  16. * modify it under the terms of the GNU General Public License as
    + {3 O! a- s  b- J4 y) u5 S
  17. * published by the Free Software Foundation version 2.
    + d, h+ ]. }/ v; K" X
  18. *$ \: h) @- `! [: o  d$ [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - y. a: K: @0 @# w. r3 V. E7 Z
  20. * kind, whether express or implied; without even the implied warranty
    / Q: ^) _, j" e0 N0 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) D( [  Q' B# [5 [* I  \, {2 P
  22. * GNU General Public License for more details.2 h, s* v# W6 K1 c5 W
  23. */
    ; z' {9 b, V  D* R7 q+ e

  24. ( Q3 N: ^9 Q! }5 _# E" {
  25. #include <linux/module.h>
    ( q4 O: {2 H6 h+ o$ F/ T. r3 n
  26. #include <linux/init.h>
    3 w; F, |1 ~0 f7 v5 j- F3 c
  27. #include <linux/errno.h>0 r8 F5 p% L" V9 `
  28. #include <linux/types.h>4 W8 ]) f6 S- ?) {
  29. #include <linux/interrupt.h>5 m* f9 ]( v2 ]: j
  30. #include <asm/io.h>1 m" S5 a/ h4 }& H  r: P
  31. #include <linux/moduleparam.h>0 s  h, y/ {  {8 E; ?( |
  32. #include <linux/sysctl.h>9 A2 g- f" u; S* t6 r3 D
  33. #include <linux/mm.h>1 z/ U/ ~/ ?" f: o8 ~
  34. #include <linux/dma-mapping.h># L: r. A3 \: B+ V0 R4 L, v

  35. 0 a4 ?: t9 k9 h4 a
  36. #include <mach/memory.h>) }- A3 n/ |' k5 d5 {
  37. #include <mach/hardware.h>
    : Q& a6 I" p6 ]
  38. #include <mach/irqs.h>: w, N! b3 \' V3 f- j* n: ~2 S
  39. #include <asm/hardware/edma.h>
    : E3 E) K) P& j* z
  40. " l: g" j) Z0 r6 b# y; ^
  41. #undef EDMA3_DEBUG9 W" B! o; L6 A. F! \5 V' E+ E# y1 p. s
  42. /*#define EDMA3_DEBUG*/9 Z* a0 H2 U/ z* ^; a7 F( m# ]
  43. ; }$ F9 \  A/ z0 P+ h
  44. #ifdef EDMA3_DEBUG3 l1 J, W. J4 I  c3 k& a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 e" V" j/ V6 ?0 t7 k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ e8 ~8 ^# R5 Y- V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . W7 }. m6 H0 U, Z
  48. #else: y4 U. L. L% y# Y& X8 H, n) _
  49. #define DMA_PRINTK( x... )
    8 a6 _* P9 G$ |. w, E, H
  50. #define DMA_FN_IN, r/ }. R1 J0 m- W! X1 b5 Q1 y
  51. #define DMA_FN_OUT$ M' G* \: J, v0 |8 J5 F
  52. #endif6 v5 m8 P' I" X$ {0 N4 U1 r  |& d
  53. 5 j, z* I& |% m+ H5 D* Z" s7 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - ]" V9 n3 v3 e# P; A
  55. #define STATIC_SHIFT                3: T5 C. N3 ?" p7 K
  56. #define TCINTEN_SHIFT               20
    0 _0 t: i, x4 |; R/ Q
  57. #define ITCINTEN_SHIFT              21; s" b! n- G: K- F- I
  58. #define TCCHEN_SHIFT                22
    ; W, x; O; R% Z1 N( o
  59. #define ITCCHEN_SHIFT               23
    9 ~( A* M, a! T: s- t8 L
  60. " @3 H# k+ q9 w, N
  61. static volatile int irqraised1 = 0;7 {4 z3 O6 [$ H; l% n
  62. static volatile int irqraised2 = 0;2 ]7 ^$ W: p/ V+ r" p$ H& v
  63. 6 W; j1 N5 b0 j7 b) q" m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      [/ V/ q5 }& m+ o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 O6 X  H% d9 L' v$ r* Q6 P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 z; O- V1 v- l& G

  67. 1 K" n' X, v' }2 l7 _+ I+ |
  68. dma_addr_t dmaphyssrc1 = 0;) P/ o/ l- S  M8 g; `
  69. dma_addr_t dmaphyssrc2 = 0;
    3 O5 ]" d3 J5 s3 ~
  70. dma_addr_t dmaphysdest1 = 0;" u: u8 l, z3 o+ ?' m8 ]
  71. dma_addr_t dmaphysdest2 = 0;1 |9 ~& i! f3 P0 C

  72. + Y7 J+ g2 q# R5 y' \5 q
  73. char *dmabufsrc1 = NULL;
    2 ?* R- U( t  i" H% a
  74. char *dmabufsrc2 = NULL;
    $ z; i; [, d+ d+ l: e/ ~
  75. char *dmabufdest1 = NULL;3 G  i* t' {' Q1 e5 v, `
  76. char *dmabufdest2 = NULL;
    ! O! f& ]/ o( t" M

  77. % p$ P5 Y6 H6 \' R
  78. static int acnt = 512;
    : W! J2 L9 E5 a& x2 y
  79. static int bcnt = 8;" p( z: F" {$ o/ u
  80. static int ccnt = 8;3 d, @# F1 I( E% l, B5 l

  81. ; t, k1 O# j0 w4 U( m" x8 s
  82. module_param(acnt, int, S_IRUGO);" l+ V6 o& M" [9 L7 D# {
  83. module_param(bcnt, int, S_IRUGO);
      D. g, \' y1 o0 N  J, z; C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, \: j! ~8 @, m
. t, j+ N) Z1 f- p2 g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( [4 S/ S( X* @4 a2 S- B( Barm-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/ B2 S) ~& k  i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 o  V* N5 @7 X9 o  V6 B

3 g9 t+ P( K& c% y  }0 u
7 ~3 P4 g% @5 Y5 h$ J% Q9 E4 L2 A& n/ v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 02:27 , Processed in 0.041589 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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