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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( Y' Z, m3 Q0 S( b5 P1 s
  1. [code]EDMA sample test application
    9 o" Q7 V" n" _+ Y6 a+ t
  2. /*
    & \! i7 R1 X2 U  R! {9 I
  3. * edma_test.c" J- Q2 N) k- O  j" f$ _
  4. *
    1 v) u3 Q, Q3 ?+ p, n9 ^4 U* x6 R
  5. * brief  EDMA3 Test Application
    4 k. I; J7 _, D! [4 S  x, C! A: G' ?+ Z
  6. *
    + L. T4 |6 z& a1 F0 c- C: w
  7. *   This file contains EDMA3 Test code.! M# V4 T% u& i! ^; u% v6 W( ?
  8. *
    " p" _: S! O- T3 K. I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* u/ N; y4 l2 r& V0 U7 E( q3 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , u& d  X) E# i9 j# d
  11. *         TO CHANGE.! F: K: u; R6 h/ R/ V5 H$ H2 K/ k
  12. *
    ' p9 f9 [+ G' u2 k+ o$ U1 o! V7 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 S2 W- F3 R5 o) p# `3 j. B" B
  14. *+ m0 Q2 p/ R0 t+ R/ M7 ?
  15. * This program is free software; you can redistribute it and/or- t" @: r) Y: B* n2 `- x* L
  16. * modify it under the terms of the GNU General Public License as2 V7 i" L9 f0 y8 u4 G
  17. * published by the Free Software Foundation version 2.* @5 B# Y' p! G( d4 f  G, q8 {. Y
  18. *8 }/ t2 f+ T0 t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 `, {# ?1 x8 X/ ~7 X- d8 t
  20. * kind, whether express or implied; without even the implied warranty" ?9 A  h. }2 D. _8 y) L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& T& E) L+ ^0 r7 [& u
  22. * GNU General Public License for more details.
    $ E, t: U) q. H
  23. */4 j9 J5 g( o0 P) i; F7 p7 K: v% H
  24. 1 w. z. L, _' d" G4 F
  25. #include <linux/module.h>0 H" J# b0 j) l& D- x' m
  26. #include <linux/init.h>: R/ ?7 Y) J$ x6 c5 B
  27. #include <linux/errno.h>( z+ H# U3 X* \1 g$ \& }+ q6 p. v
  28. #include <linux/types.h>
    # w5 z- e1 b4 b  K/ F/ |
  29. #include <linux/interrupt.h>
      A& m8 Z) r( T) T8 H& S0 u) R) K" Q
  30. #include <asm/io.h>
    2 b$ U  m4 F. Z3 j
  31. #include <linux/moduleparam.h>1 p; H# P0 e  h% v) H
  32. #include <linux/sysctl.h>
    ! n$ g3 D7 F( x% J, E, ~$ V( \8 R- F* B
  33. #include <linux/mm.h>
    4 t3 n7 f9 [2 V6 ~
  34. #include <linux/dma-mapping.h># n8 l/ S4 A4 N
  35. 7 G0 n' r8 S9 _* W, L2 {' ?9 P
  36. #include <mach/memory.h>- b& V5 R4 B+ @* P& p2 D
  37. #include <mach/hardware.h>
    + ^; N! `: d. Q% K! r/ P
  38. #include <mach/irqs.h>
    8 V+ r& ]8 g, \( C9 B2 y: t
  39. #include <asm/hardware/edma.h>6 q- p8 N4 f9 l

  40. ! E( N5 `3 ^# Y" d5 b" o
  41. #undef EDMA3_DEBUG: V9 J- R3 M. i. R% j. J! O. ^
  42. /*#define EDMA3_DEBUG*/
    " r1 k& A9 X" i$ {0 }1 i) t
  43. 2 G- B  z1 Z/ h; h3 W4 g) h9 J
  44. #ifdef EDMA3_DEBUG
    " H, n0 Z* ~$ X7 C7 V' a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' v2 k0 I; `# K4 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 [- n  F- @% a, ]: ^6 f2 A7 w8 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) `  V. _& \; r$ g0 x: S
  48. #else3 {2 k" b4 f5 J6 T
  49. #define DMA_PRINTK( x... ). Z' T0 g& o+ ?% D- g  ]
  50. #define DMA_FN_IN
    - F, t' r6 L7 X4 j% W9 q4 U1 o" ^
  51. #define DMA_FN_OUT
    5 Q; [8 y" k- A
  52. #endif/ [! A( I+ M1 P  o5 |; Q' H
  53. & c( \& w4 E, f5 g* O2 ~2 W  b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . f5 T+ }5 \* @3 E, ^" `
  55. #define STATIC_SHIFT                3
    - x" i& z5 x* P
  56. #define TCINTEN_SHIFT               20
      |1 e6 h2 a8 N4 _8 @' o
  57. #define ITCINTEN_SHIFT              21
    7 z) Y4 U4 H" H: w9 c4 r
  58. #define TCCHEN_SHIFT                22
    , b/ g* ^, @0 }) E
  59. #define ITCCHEN_SHIFT               23$ Y; J2 R- H$ [; n/ \

  60. 7 P+ G  Y4 R0 ]/ f3 D
  61. static volatile int irqraised1 = 0;
    : m  A, _* J) {* h7 q) p
  62. static volatile int irqraised2 = 0;1 `/ E; j/ d: [) Z) {5 N& c" }; W

  63. 9 ?) J& i8 p% X! F' r: [% u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 I  J+ g( Z  i# [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ?) f% y0 B! Y+ E4 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( \, W$ u  }* \% S+ {4 U$ c
  67. & |5 W* J; N# C& e. [& R# p/ t
  68. dma_addr_t dmaphyssrc1 = 0;- _& K% D8 w" y! Y( z- u
  69. dma_addr_t dmaphyssrc2 = 0;
    + J6 W9 U2 \* N. l  p3 }  r
  70. dma_addr_t dmaphysdest1 = 0;
    6 H8 H" M2 x% c* `+ L9 L
  71. dma_addr_t dmaphysdest2 = 0;5 Q4 {+ T, R( G1 c3 k, r& y

  72. # r% }$ v. @: |0 O4 q
  73. char *dmabufsrc1 = NULL;+ r0 j2 a5 Z) |# G4 A6 `
  74. char *dmabufsrc2 = NULL;
    8 l6 G1 j" h! D, |( M$ W
  75. char *dmabufdest1 = NULL;  W) l  \! z; w% w: ^
  76. char *dmabufdest2 = NULL;
    4 Z1 N( o1 o0 ?& T+ p9 Y* [

  77. $ g2 i- c* k) T4 [( ^% Q. L9 p" ?
  78. static int acnt = 512;6 ^8 c0 X/ V% v! O8 X0 Q3 M
  79. static int bcnt = 8;& e. ?8 f- ^5 `: O
  80. static int ccnt = 8;, N# M: L% d1 H
  81. , y8 z+ a( K/ p# u8 w# Y
  82. module_param(acnt, int, S_IRUGO);! w# v  {3 t8 U
  83. module_param(bcnt, int, S_IRUGO);
    2 x! f1 L8 s) b- d! [: m; u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 C$ @- k$ C9 K6 n- H
  O& O# ?/ x, s( t; L8 L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# d1 a( D3 k8 s5 Q& m! |! _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ f  c! s0 B+ h" G8 ~+ n# a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 ~$ `+ q. ?7 G( Z/ p
$ ^; C2 F* t: x; Z0 z3 f6 h0 p) g2 v" k3 b) v2 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 03:07 , Processed in 0.044094 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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