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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- R* r) {! m, F% R
  1. [code]EDMA sample test application
    # K! h/ }- d; Q, H, L0 b# f- O1 T
  2. /*
    - I* c$ B  U+ \
  3. * edma_test.c* h7 V( m: o. d& J* U
  4. *: W. A. H* T, w% g
  5. * brief  EDMA3 Test Application
    6 N- j/ j2 L; e5 r6 a8 t
  6. *
    5 `& k) S# I) N. c
  7. *   This file contains EDMA3 Test code.
    . D5 B& `6 _- ^+ N% y: b: b4 W
  8. *
    * O4 M4 Y7 y$ f/ f# f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( p% F: t  g6 u. T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- U9 q% ^9 G% x6 Z& i. F' Q7 D
  11. *         TO CHANGE.7 m, [% T5 u$ l1 ?# L) p
  12. *
    1 x* `8 O, |! e+ \4 X* n: J+ U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 c& {  K: b6 G6 L2 f$ _! o0 d
  14. *
    ! |" d/ c/ c2 f/ _9 a* d3 x
  15. * This program is free software; you can redistribute it and/or
    $ b3 P+ d6 I% s: H3 K; c
  16. * modify it under the terms of the GNU General Public License as; c9 j9 S0 }0 V8 H7 q
  17. * published by the Free Software Foundation version 2.
    1 \( p2 B' b9 d; R' d4 v" b9 h
  18. *- y% e  Y8 [& P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% e3 ^  l! p) m; c5 L
  20. * kind, whether express or implied; without even the implied warranty
    / f+ `7 }# E1 N3 y) P, Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; Z2 T0 _% S: Q( P, E
  22. * GNU General Public License for more details.9 `/ {# p$ [" C
  23. */4 L( E5 S4 L2 y% L  M- K. v2 q

  24. ) @. O" m& z& F8 B$ p  X3 N2 ~
  25. #include <linux/module.h>
    1 p( T0 M% b) ^9 _
  26. #include <linux/init.h>. q+ I; [( u' }8 ?! `
  27. #include <linux/errno.h>
    7 c$ U: r7 ~- i2 {
  28. #include <linux/types.h>
    ' j! @; p4 w1 g- t; e* w6 Y
  29. #include <linux/interrupt.h>3 i: t. v) w! c; T4 u7 \
  30. #include <asm/io.h>8 @8 g8 E4 ~* _1 n7 ^
  31. #include <linux/moduleparam.h>% |9 q9 O% R+ C# ?
  32. #include <linux/sysctl.h>
    * K' [( C% U9 N6 G8 p1 \# c
  33. #include <linux/mm.h>( E9 S4 _  ]( H. z5 i( _
  34. #include <linux/dma-mapping.h>
    ( H9 p. j* s9 n, |+ q
  35. ) Y; z6 q) }% t" J" w
  36. #include <mach/memory.h>( I& n, v7 @9 W- |' f2 S9 d. a
  37. #include <mach/hardware.h>
    : y$ A& D1 k- y1 {
  38. #include <mach/irqs.h>* a( s% A4 M  W  b1 y, R( c8 Q& y
  39. #include <asm/hardware/edma.h>+ w, O8 ?" h; ^$ G# c/ ~
  40. 9 m1 R- H' s! ^' @0 i
  41. #undef EDMA3_DEBUG
    $ y& k$ P! d. `5 |/ E% k
  42. /*#define EDMA3_DEBUG*/
    ) p1 h, Z& s/ z: C3 c
  43. $ i+ k  `8 \! Q) ^
  44. #ifdef EDMA3_DEBUG5 }$ a- o' W) T" d. `; |. U: t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! ^" C8 m* A( `( G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ R7 e6 P$ b9 e2 D0 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : ^" S" q7 f. J  B* h
  48. #else
    / y- H8 `$ v$ \
  49. #define DMA_PRINTK( x... )3 l) h3 g3 w5 p) w
  50. #define DMA_FN_IN$ x, Z/ c, V3 }4 n' ]9 W
  51. #define DMA_FN_OUT
      r, r; t5 H- G: r
  52. #endif
    # l, o" B9 g! [+ X! G) J

  53. & N" }( d; v. ^1 y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ M. Y  t! J$ \! `5 r
  55. #define STATIC_SHIFT                3
    7 s* H% A( p( U- y
  56. #define TCINTEN_SHIFT               20  f; U, v5 H* j, P7 G7 F% z" H, S
  57. #define ITCINTEN_SHIFT              21
    1 H" A! U3 o2 u1 Y
  58. #define TCCHEN_SHIFT                22
    ) z( J) @  W) W+ R3 m. ^" x! Q! W
  59. #define ITCCHEN_SHIFT               23
    # B& U1 w8 L) k  T! O+ ^4 I
  60. ; ~. {. E# X/ p  _
  61. static volatile int irqraised1 = 0;
    + I$ ]: \5 w6 |2 @; _% R  i
  62. static volatile int irqraised2 = 0;5 r! t8 _. d0 S0 [: W* S7 ^

  63. ! p' S$ H& r5 C$ A' b' ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 O6 d* g+ K, e" I9 N' c# n% m8 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% J9 u1 \9 A. Y/ f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : J+ M+ `) R8 `
  67. 1 `+ m# _& Y: A. P
  68. dma_addr_t dmaphyssrc1 = 0;, {. ]0 N0 j- j9 I4 o6 M( j
  69. dma_addr_t dmaphyssrc2 = 0;' I( v; A1 ^& N2 O, {0 e" P
  70. dma_addr_t dmaphysdest1 = 0;
    3 }9 p# k  Z! p$ K
  71. dma_addr_t dmaphysdest2 = 0;
    2 K0 z! o& @$ k' ^3 P

  72. " B8 X7 u: r! j( Z: e5 ^
  73. char *dmabufsrc1 = NULL;
    & S* p+ D9 v: S  a) h8 Q  R
  74. char *dmabufsrc2 = NULL;% W( L' [4 J; m3 q$ I/ i+ ~5 R
  75. char *dmabufdest1 = NULL;
    & A) `, h0 e# X8 {- x& ^
  76. char *dmabufdest2 = NULL;0 l; z. r" x" D) {3 K$ w9 z

  77. 5 |# y, m! }, c+ [. g7 a5 @+ z
  78. static int acnt = 512;+ M& a/ ^( B) u
  79. static int bcnt = 8;3 C& F2 M( A* G4 |* k3 ^
  80. static int ccnt = 8;
    8 s+ o+ L  d' u- |' ?

  81. 3 q7 w8 H' K9 a
  82. module_param(acnt, int, S_IRUGO);( p/ c+ S' g# S- y
  83. module_param(bcnt, int, S_IRUGO);
    0 n: ^- r7 p$ X& e" S4 G8 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 G5 s2 H3 |" {, W. r# U+ ^3 w7 \4 }2 }2 r# p! J# I1 `; i8 d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) C: e- \" W8 @4 l4 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 E8 |6 z/ k' W0 g8 Z* s: F# h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 Q" w! Q% c# J0 s& W2 p: ~; P: H8 S* S( Q! ^

0 M4 }' X$ b, _: [, f  c+ g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-29 08:36 , Processed in 0.040925 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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