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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- i1 g3 ]" R! t" N  l( `6 F
  1. [code]EDMA sample test application, ~! C$ O6 W4 j2 o
  2. /*
    : {. a  L  R( f1 v
  3. * edma_test.c5 O) c! A* R* D6 Z# w
  4. *' S3 y4 Y+ g7 U: X4 v) I3 T) Y1 f
  5. * brief  EDMA3 Test Application
    " _: I5 F# m* m) K
  6. *
    ; G- `/ T+ Y9 [
  7. *   This file contains EDMA3 Test code.( `: Q1 g; h2 Z% M+ `0 {7 }9 H
  8. *3 c3 J3 [" v( M( q$ p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      Q, f+ @. f. g* k: i, O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : z  j& c$ ~4 J" Z) v% S
  11. *         TO CHANGE.! s! \- o6 ^+ ~
  12. *1 c3 x$ }( e* X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ S; Y) C7 p& b8 f! O2 [( `( C' N; p
  14. *$ r  g+ W0 n! m: J  w# h' U
  15. * This program is free software; you can redistribute it and/or, h) e5 B2 T4 V- l9 f
  16. * modify it under the terms of the GNU General Public License as
    " l' `$ B1 B5 F4 X
  17. * published by the Free Software Foundation version 2.
    ) H" r- Q. @$ z/ a  K$ w$ P
  18. *0 `; v6 T& K) v) k% V4 B. p5 y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 e+ u5 I: b% p6 e" Q
  20. * kind, whether express or implied; without even the implied warranty
    # t5 R2 v: Z; |/ `* m6 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / u3 I! h3 |* g
  22. * GNU General Public License for more details.+ ]8 N+ o$ |( i( J3 \0 O
  23. */* Q7 @. @- p4 O0 S5 `# z
  24. 4 D2 D" O5 D; L, `
  25. #include <linux/module.h>
    / q' o% x8 l" v- V3 O4 Q8 W
  26. #include <linux/init.h># d$ D5 H# ?, V% w
  27. #include <linux/errno.h>
    7 x; m# ^3 I1 a! Z$ y0 N0 E
  28. #include <linux/types.h>
    : y' a+ u% ~! R! r# v1 o
  29. #include <linux/interrupt.h>) p0 U9 O& S) X0 N) ~# w
  30. #include <asm/io.h>
    : B" L% |: L- S+ B( x
  31. #include <linux/moduleparam.h>
    # b: ?, J' P( a8 O
  32. #include <linux/sysctl.h>! B" v! [6 Q+ ^6 |4 R* ?3 }
  33. #include <linux/mm.h># r9 @/ [4 F; L5 m1 v% Y% L
  34. #include <linux/dma-mapping.h>
    2 B3 z' [! J1 T% Y7 ~
  35. " i$ T* E. x6 J( ?0 a  D
  36. #include <mach/memory.h>
    * I2 c) q2 y( Q; D) _- B+ c/ H% I
  37. #include <mach/hardware.h>
      V. G4 o: l: W8 f
  38. #include <mach/irqs.h>
    0 C' e0 r4 x+ ^, W
  39. #include <asm/hardware/edma.h>
    + ^0 R) j. V( J/ R" U5 w
  40. : V# y: G  T! w( G" L
  41. #undef EDMA3_DEBUG6 K+ d' S* T: a" N
  42. /*#define EDMA3_DEBUG*/
    $ @) k, H5 k7 B* {7 ~( _4 K
  43. 4 M9 w* y+ V. |5 Q+ C
  44. #ifdef EDMA3_DEBUG7 G8 ^2 R2 [  d& {6 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# l$ J0 R; J- c  y& z( `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ X# r6 D: [# J" W: n  L$ r; r# I& A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 u3 t8 Q" r4 p5 a  i
  48. #else
    : F7 u# r/ M% [5 k! E
  49. #define DMA_PRINTK( x... )
    8 E& `1 |6 @" @
  50. #define DMA_FN_IN+ _* i- W7 f, N$ y# h1 V! t
  51. #define DMA_FN_OUT
    % C1 Y' y* F# f$ ^" Z
  52. #endif4 h+ |, Q, m0 M3 K. P1 e2 _
  53. 0 `/ J" q; w" I# `; |) ^; D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( T- @; G& e' u
  55. #define STATIC_SHIFT                3
    2 M3 W: V$ |& }6 E4 ~
  56. #define TCINTEN_SHIFT               20
    ( f" S* ^  b! p
  57. #define ITCINTEN_SHIFT              217 P4 N& y& }3 x) t: F% J9 y: u6 O
  58. #define TCCHEN_SHIFT                222 ^) G- K% Z" Y* [7 P6 h' h: W3 H
  59. #define ITCCHEN_SHIFT               23
    , j( S! {1 X' h
  60. * R( o9 x0 a/ U" C. E4 G" B
  61. static volatile int irqraised1 = 0;
    $ V4 Y' w. |1 L, G
  62. static volatile int irqraised2 = 0;
    : z% v) j  c6 U
  63. ) t( y  y' R" q- I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! M; |+ w& N) b3 C, C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 X" w" A, |7 l$ K) o5 d- o, e+ G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 ]. i4 t% |4 H4 i5 z; g  i5 h4 _

  67. 1 f1 B* V) n6 [
  68. dma_addr_t dmaphyssrc1 = 0;) @' Z; ?0 c  c* I% e2 l# C2 P
  69. dma_addr_t dmaphyssrc2 = 0;, B  Q! d# H- Z& A0 }) {
  70. dma_addr_t dmaphysdest1 = 0;" e1 z8 v  M5 X. v) b" x; O
  71. dma_addr_t dmaphysdest2 = 0;
    8 ]* I& N$ `  S$ Z! @
  72. % |! ^( U2 Z6 E) m
  73. char *dmabufsrc1 = NULL;
    ! A$ `. Z9 B4 a+ ]
  74. char *dmabufsrc2 = NULL;
    5 s) z- h& c% H
  75. char *dmabufdest1 = NULL;
    : C/ {# S7 M& M
  76. char *dmabufdest2 = NULL;
    : q& R! p  X. _' ^

  77. $ h. G4 k! `" U* H+ s9 T
  78. static int acnt = 512;
    + ]3 ^5 }8 n, o! `: g  H
  79. static int bcnt = 8;0 m2 K$ C1 a+ C- i$ b' m) R2 d
  80. static int ccnt = 8;
    + S* ~) L- ^4 |( n! A
  81. 4 _3 u! ]' l3 w) i
  82. module_param(acnt, int, S_IRUGO);
    ! w& M# ^- w* X6 U
  83. module_param(bcnt, int, S_IRUGO);' f, k3 y7 m  t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" X% E& u. k/ Q; g, z5 |
: w# k) N+ [3 n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% Q5 Y  u3 @' `# n& o5 P$ q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 B9 D  t! S8 h8 \+ q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" J4 E+ t% u# s3 w/ h% ?% l4 q4 q, e6 }  |  D: f
* T$ j) n( n" h7 A7 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 17:42 , Processed in 0.038422 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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