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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   ]$ C+ H9 N! n; m4 b& D3 Z
  1. [code]EDMA sample test application
    % J5 q4 K: j2 D; z
  2. /*
    . x1 L! [+ L# E0 F( u0 `
  3. * edma_test.c
    2 h% J' B* n2 R2 S4 a+ ^; c3 J
  4. *% x3 N  j* P" y7 R5 r; T
  5. * brief  EDMA3 Test Application( h2 C$ x: H, B' i5 w/ u4 T
  6. *0 ]$ @" E! k2 {$ ]. _+ d* |
  7. *   This file contains EDMA3 Test code.
    , ^8 s% V; F/ p1 r: H& s7 V2 F/ m
  8. *
    + b( I0 k5 x) n8 a, L; b" g9 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ K" E" y3 `# Q. l3 T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , v* ?% \6 @3 f: U2 m* C' W) L
  11. *         TO CHANGE.
    ( f4 G$ l8 Z! q1 j
  12. *& p4 N, J! P( W& a7 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . F2 Y' |9 m7 c( K) r
  14. ** M* l" F/ l1 g0 ^
  15. * This program is free software; you can redistribute it and/or" `7 f; h* a0 @5 |& o8 {
  16. * modify it under the terms of the GNU General Public License as
    / p! K. U, @) E1 w
  17. * published by the Free Software Foundation version 2.
    9 A4 [* j( W9 B: z5 H
  18. *
    + S# q, W* j2 F% e1 k7 T5 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + c4 h. Z) t, b% c8 e! `
  20. * kind, whether express or implied; without even the implied warranty
    1 T* M& N; _$ y, U5 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      p+ n( X+ T9 ~& r) d
  22. * GNU General Public License for more details.$ C2 |  k' P) a7 U7 F
  23. */
    . N5 \7 j1 w1 J# p3 o2 V( F/ B5 ^  _
  24. : z- L& T! r1 R1 L0 B
  25. #include <linux/module.h>- f. K( Y. h! E, c. c  y/ l
  26. #include <linux/init.h>
    - I# t7 t6 `& e; w
  27. #include <linux/errno.h>
    % @  P4 m" I& f# N8 i; c7 x
  28. #include <linux/types.h>- m; ~% Q9 s$ B9 Q, v/ A+ Y( i
  29. #include <linux/interrupt.h>/ M# {6 P+ G  W+ }
  30. #include <asm/io.h>
    6 w/ I; g6 S; m) z% I
  31. #include <linux/moduleparam.h>
    ( v. y5 R4 w$ H* \& B( ]
  32. #include <linux/sysctl.h>3 k0 ?: {) @! }" H
  33. #include <linux/mm.h># c, x+ ?' a4 |) ]6 f
  34. #include <linux/dma-mapping.h>+ q/ j5 K/ G5 ^7 K0 y( s' W
  35. $ g- c! h# K% r8 Z
  36. #include <mach/memory.h>
    ; n+ u3 ?) m: l
  37. #include <mach/hardware.h>
    1 k: z; i3 Z, s( X
  38. #include <mach/irqs.h>
    # y6 O" m5 A# J7 M7 Y
  39. #include <asm/hardware/edma.h>0 ?& Z# i: @& x" E- S
  40. ( m& h; h$ J' z! L& z
  41. #undef EDMA3_DEBUG! E' G* W+ J* q1 e+ N  ^- ?
  42. /*#define EDMA3_DEBUG*/
    6 t: D. e* q1 |

  43. ! z" L6 K4 |$ _# A/ U  T
  44. #ifdef EDMA3_DEBUG6 Q9 A6 H8 f& T9 m4 a7 [- z& S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), ?! Y: G+ U) n) ~; \, K) f: b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% q7 G( k2 M, H9 A, X, v: Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* M' s- l3 A4 i5 G# g1 b
  48. #else! j6 t6 X0 L1 w- b( {+ g4 Z
  49. #define DMA_PRINTK( x... )% T1 M  u/ S; [: ^
  50. #define DMA_FN_IN# d+ v2 _( R+ _$ V4 z5 s
  51. #define DMA_FN_OUT
    6 i& r7 h' @6 Q* z: m
  52. #endif6 V) {# b  i6 Z+ g7 j% w
  53. / D: Z' |4 G8 Z  ^- Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' C& H8 n) {% N/ h  }0 G
  55. #define STATIC_SHIFT                3
    6 C$ b% e1 K& W3 c# d3 v
  56. #define TCINTEN_SHIFT               20; W- ]- n2 j" T
  57. #define ITCINTEN_SHIFT              21! T1 }6 \4 X) h% a+ v% j
  58. #define TCCHEN_SHIFT                223 @/ u: i) d3 b, E% S0 _% m1 O
  59. #define ITCCHEN_SHIFT               235 C0 u# K& g' o7 D
  60. 0 P% M  |2 B; i" _8 m; l% [4 J
  61. static volatile int irqraised1 = 0;
    : a9 M2 C! L5 ~. ^, p1 e
  62. static volatile int irqraised2 = 0;( b; A( L1 M& B/ H

  63. 3 F; Q1 {( U2 E; x2 d. _. \% s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 {+ k! w- X& C7 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; S4 A0 [/ V& r7 t0 O, T' f8 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" g# I9 X4 ]) k% V3 i; _' U

  67. ( g; z/ m* d# z9 _/ J
  68. dma_addr_t dmaphyssrc1 = 0;
    ' D! {# Y+ f/ Z4 }
  69. dma_addr_t dmaphyssrc2 = 0;6 t8 `/ s' l5 V3 k" x+ C3 {. r
  70. dma_addr_t dmaphysdest1 = 0;
    . V* \$ T$ K) [1 f& w
  71. dma_addr_t dmaphysdest2 = 0;4 S! ]( ?/ n$ j, D) H) G- K6 H) b
  72. * b4 w7 W: S$ \: U  N0 O$ u$ Z2 H  H
  73. char *dmabufsrc1 = NULL;
    ( v+ z/ R! l( N: L/ Q) P. W
  74. char *dmabufsrc2 = NULL;; ^  s# q) G# W$ b' x$ S# n
  75. char *dmabufdest1 = NULL;
    ' x% G% N1 f9 Q. k. w; {1 h& B
  76. char *dmabufdest2 = NULL;! i( g. X0 u  ~. |( s
  77.   C- V, s+ Q2 d) U0 d  P7 Y7 P
  78. static int acnt = 512;
      M- M: S3 P& W4 w: i% k* l: N
  79. static int bcnt = 8;9 |" D. y3 d  c
  80. static int ccnt = 8;- a* n) u' t- w1 X3 n& B; E( r+ g

  81. & ~$ a; V) N' b
  82. module_param(acnt, int, S_IRUGO);, H1 ?# e3 n& C% [3 X, N
  83. module_param(bcnt, int, S_IRUGO);, D% _6 m$ Z8 |. ~; m; j2 z7 R$ U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 S6 O6 p% t! L' f
- p# Y9 D& S$ s2 K9 w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; |6 C" U3 _- R% L: P( J1 `. ]" @# r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 F6 t- b$ G0 X% ]( ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- l# J  B; ~: a5 w0 m, e) ]8 c) P$ d
! n( ~( d+ Q' }% b; Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-11 10:04 , Processed in 0.045765 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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