OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% D* [5 m8 {& ^9 R; j
  1. [code]EDMA sample test application
    & O; o) n% I+ d3 T5 I
  2. /*. y3 o7 _. `  P# z- E6 _5 O
  3. * edma_test.c
    ' h# M1 Q4 P9 z2 i
  4. *' I" z9 s4 t6 `/ t: ?  l9 [. c; F! d3 I
  5. * brief  EDMA3 Test Application7 l. O& j: `$ p; B: e
  6. *
    9 v+ [0 V7 j; E* ?9 w: E0 J! }
  7. *   This file contains EDMA3 Test code.
    ( I  h) S" c& ^
  8. *
    - r, |# X) S' K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 N8 ?% m* o+ j. X6 p8 N& V; d; x4 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 h2 K7 X0 x. ?9 C9 |# C
  11. *         TO CHANGE.
      T" D; r% ]+ D, q2 Y" D: g2 c1 o
  12. *
    . H. q/ o4 b! c+ e* f# e1 T2 z2 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 R1 v" W& y6 Q( L& V, i
  14. *5 Y' f: s& p  d+ Q
  15. * This program is free software; you can redistribute it and/or
    ) X1 a! l2 s! }5 t
  16. * modify it under the terms of the GNU General Public License as" L- Z# P2 K; v" N) c& c) N
  17. * published by the Free Software Foundation version 2.3 Q3 I9 A: |6 ~2 u
  18. *' L1 R9 d" R8 d( O- l/ m. V0 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: e6 G* O, E  p2 g8 ]
  20. * kind, whether express or implied; without even the implied warranty  g4 n) _' v; ^) Z  `+ R3 K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( v0 K! j% }) i5 ~$ r+ D" D
  22. * GNU General Public License for more details.
    - v$ b( ~4 X$ m9 u7 J
  23. */
    & s  E# ~  \8 q& ^5 r% T% J7 b( P

  24. ! H1 z1 u, i; ]% F1 t
  25. #include <linux/module.h>
    ! S( K: w2 N6 r/ A8 G/ v9 C2 ~
  26. #include <linux/init.h>8 L+ R+ r  x4 y9 V, E
  27. #include <linux/errno.h>
    4 M( K7 |; z. T6 Y0 h6 W, _
  28. #include <linux/types.h>0 g3 R) w# t3 R& |9 [8 s
  29. #include <linux/interrupt.h>9 ^) W6 t, [7 b
  30. #include <asm/io.h>1 c3 g- t0 Z4 R. x7 O$ g
  31. #include <linux/moduleparam.h>
    * {! K8 K/ |$ B- N4 g3 B- n- E
  32. #include <linux/sysctl.h>+ g4 `+ U( i0 _$ D; t/ j
  33. #include <linux/mm.h>9 v& S8 ]  R( j: c! Z
  34. #include <linux/dma-mapping.h>
    3 c/ D% a$ e9 G2 R' t3 d2 c/ \/ o
  35. * c! i% {. U: p
  36. #include <mach/memory.h>
    , p6 a2 R' x: q& k" \+ }! r  W0 y" I# R9 A
  37. #include <mach/hardware.h>( C% |' {7 T$ i. [
  38. #include <mach/irqs.h>0 K# U- }; I& N: `  s! H
  39. #include <asm/hardware/edma.h>% y8 W" ?. x0 O5 p, u8 F( I9 z3 u( C

  40. * [% t$ @1 \# a/ g$ l! E
  41. #undef EDMA3_DEBUG- O3 M+ S, v$ D! P5 Y
  42. /*#define EDMA3_DEBUG*/& L8 A# S' v) K3 o; H# o
  43. : ?2 o* W5 }8 m  B1 p9 X
  44. #ifdef EDMA3_DEBUG
    , R3 I( S, i( b2 ]& X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' R4 q+ Y0 z' N" C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- Q( q; n0 r: m/ X/ \% `. t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' s/ ~$ d4 X7 g0 |) C
  48. #else  K3 a) P8 @* B% x+ o: Q
  49. #define DMA_PRINTK( x... )" V4 n. z; d" G  q5 P
  50. #define DMA_FN_IN
    ' V2 [! V) f7 G; m& h4 f/ A) Q
  51. #define DMA_FN_OUT
    - }) T; D( E& E; E
  52. #endif5 r9 E9 g& T, o( d
  53. # k. M6 Z3 Z9 v+ J! K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; j" R: j1 ^2 {" S
  55. #define STATIC_SHIFT                3
    5 Q2 j( L, A) }. Q& u7 o$ i
  56. #define TCINTEN_SHIFT               202 e/ Q, p- K' ~& f& J
  57. #define ITCINTEN_SHIFT              21
    . D8 e- b$ V! z4 b3 \: L" {/ S0 G
  58. #define TCCHEN_SHIFT                220 i4 g2 I# l- Q/ r& F
  59. #define ITCCHEN_SHIFT               23
    0 f$ F+ O- I* |: S( u

  60. ( n0 V2 X8 v2 f, X7 I
  61. static volatile int irqraised1 = 0;- E) P' `; g  I% W. L( n* K
  62. static volatile int irqraised2 = 0;% }) a, G) ^# }" u, V/ {. k
  63. 2 G5 C9 o" C, k$ }4 B7 H% H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ b. d8 r' ]1 ^2 g/ y: o- M0 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " v4 I$ b4 S( Q+ w+ S% q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) _: i4 r7 ^3 x& p2 ^7 C

  67. 7 V5 G- z3 X2 f6 z  Q: \# j# ]9 c, V
  68. dma_addr_t dmaphyssrc1 = 0;
    0 Y( P! D$ }, O; w8 D( l$ i9 w
  69. dma_addr_t dmaphyssrc2 = 0;
    # J( {3 S; Q8 P. \: e. v: i" B
  70. dma_addr_t dmaphysdest1 = 0;' W+ o6 G# F: z( {) e2 d2 `9 r5 T9 \5 ?
  71. dma_addr_t dmaphysdest2 = 0;: X3 e- ]% B: j# N9 n2 l

  72. $ o8 N% D9 C/ g& y
  73. char *dmabufsrc1 = NULL;
    % H- x  ~- P! J$ _$ c. Y
  74. char *dmabufsrc2 = NULL;
    % g& \% s6 {8 L1 i) t: N  ^* ~
  75. char *dmabufdest1 = NULL;
    ' C# b! H4 ^" k. H! G# |
  76. char *dmabufdest2 = NULL;
    2 f2 n" L* O  k1 `8 s; O$ N

  77. 4 P. D9 P$ w) ~0 _, G
  78. static int acnt = 512;
    9 M1 a8 J3 P1 r, L
  79. static int bcnt = 8;' R; ^' Y% w. G) l
  80. static int ccnt = 8;9 t2 A* n9 `7 `5 d/ M9 g

  81. ) S! n" k9 S. a& P1 H
  82. module_param(acnt, int, S_IRUGO);- o1 g+ H9 g  z5 f" u  \1 d) Y5 n
  83. module_param(bcnt, int, S_IRUGO);7 o& O$ F" g0 ~0 B6 |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 V) u# I3 a0 C" O
' B. W6 ~. J5 M& [4 y, p" {" F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! A- O/ f% d/ K6 U8 N- M. qarm-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 r1 k3 t2 P, r- }# u' `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- E3 G4 }0 R8 V( I0 _6 |
- D- `  o8 c5 [# c- _
( y% |2 v" ?' F$ g5 T, {- p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-19 13:47 , Processed in 0.044831 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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