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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / P) P) m  z+ _' G* G
  1. [code]EDMA sample test application
    / F& z7 }# R4 O: ^
  2. /*  ]' g" L" g& U* U; n% J$ A
  3. * edma_test.c7 n1 ]  A2 d3 Q
  4. *
    9 ^: l  b- z; X3 x; l/ X- l
  5. * brief  EDMA3 Test Application& M" w# P  G3 }# e, j
  6. *' G, V! q% t9 G2 |
  7. *   This file contains EDMA3 Test code.
    $ F3 M3 ]( V; p  l0 [5 n
  8. *
    % y9 e. J. U; X5 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( i/ ~7 t2 p$ J( u6 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( v6 D; l) `9 m: ~3 D1 w2 X
  11. *         TO CHANGE.$ h* r  o" H' T- p  Q
  12. *; W" V7 a1 i/ H0 ^- H7 l" a+ }4 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) a3 L& C% s! O! D& t% l& W5 m
  14. *
    " A) I* F; t  ]+ A5 u
  15. * This program is free software; you can redistribute it and/or
    4 s5 n4 b+ I  [8 n* l( Q
  16. * modify it under the terms of the GNU General Public License as
      O9 w7 \$ l" i) m' b
  17. * published by the Free Software Foundation version 2.- _& y1 H7 V; V2 I
  18. *
    8 M- m7 V8 u; t/ F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! \5 n. x' Y6 L
  20. * kind, whether express or implied; without even the implied warranty
    7 c) ~- V" }% x. ^. a  J" l* v) q+ O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) e( |; i) X- q: U
  22. * GNU General Public License for more details.5 Z6 @0 w0 @4 h  C. S
  23. */
    6 Q, ~" x( [; z9 y
  24. . M$ N1 w% F* g% u
  25. #include <linux/module.h>7 j" v# f/ ]& J5 I
  26. #include <linux/init.h>
    ' a! Y* f! S$ @* S5 o
  27. #include <linux/errno.h>9 @" S( o. s8 l- u+ M. X( K! Z* X
  28. #include <linux/types.h>% ~6 n5 u6 z5 X& t. m2 O
  29. #include <linux/interrupt.h>* c3 S* d% M. B/ |# T
  30. #include <asm/io.h>! G4 m( R3 ]& B7 _# j0 R( Z: n0 K
  31. #include <linux/moduleparam.h>/ e: T9 [; S+ q# w, C! ^' _; x& k; G& f
  32. #include <linux/sysctl.h>- i$ v2 r6 h* Y( h: t( j
  33. #include <linux/mm.h>+ t4 x' z! o4 M. e
  34. #include <linux/dma-mapping.h>( [8 }0 ]9 x0 f1 y" K7 n+ R6 Z
  35. 3 t. d7 ^5 u7 A
  36. #include <mach/memory.h>
    , {. y0 t" E# G/ A
  37. #include <mach/hardware.h>
    + F) b2 C# T4 ^. ?( z5 n
  38. #include <mach/irqs.h>1 u5 ]3 N; V0 p- b: b; A
  39. #include <asm/hardware/edma.h>1 @/ J1 n/ P7 U. \0 u

  40. 9 J" |9 h! P0 _- N0 W+ \9 A9 X3 D
  41. #undef EDMA3_DEBUG
    " t( s. V+ x% f: A/ K$ b# w2 b
  42. /*#define EDMA3_DEBUG*/
    + ?  M# Y/ ]. ]4 x7 [
  43. 1 ?+ b' i2 f7 E0 S7 W: B1 g  L
  44. #ifdef EDMA3_DEBUG
    ' M! S5 V, t* @) u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " f# h+ C) `5 {* _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 r! ?$ ~- {9 H' G1 q# Q$ E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - K4 Q2 _# q8 m9 }: f8 @) `
  48. #else
    " ]4 z* I7 J8 V) R6 I
  49. #define DMA_PRINTK( x... )
    5 S- V* W' y1 k5 U; R, u
  50. #define DMA_FN_IN; F6 F6 |9 f1 [2 Z( e
  51. #define DMA_FN_OUT7 y- p  ?+ U8 O  ?2 T
  52. #endif, r' e2 a& M' A& }( @8 Q9 l' {

  53. 8 Z" r  ?5 M& S+ q, l0 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) U1 Z0 ]3 K: |/ f2 Y6 N; }, K; R
  55. #define STATIC_SHIFT                3( S9 n: M3 I$ [$ O, D( S% X5 z$ c/ \; v5 \
  56. #define TCINTEN_SHIFT               20
    " i9 V- l* z. F; _1 Q$ y' K: u
  57. #define ITCINTEN_SHIFT              217 j9 J; m3 X$ U
  58. #define TCCHEN_SHIFT                22
    4 \  Z/ g5 V9 ?* x
  59. #define ITCCHEN_SHIFT               23
    9 B* p* R* w: D2 t' C
  60. 2 V: D% E8 S9 m/ C( a
  61. static volatile int irqraised1 = 0;
    - L7 X9 z5 u4 R4 B
  62. static volatile int irqraised2 = 0;5 D0 T0 O' X$ @% R" D( P/ u

  63. 8 v- c' f( U1 C$ t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 R1 S" S0 A2 G9 i" }; s: `$ B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* B% y7 x6 x% U/ O2 j1 f% l/ o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ~( P7 E3 _: B& }  m1 q( t; _$ {

  67. 9 [! _5 y  l7 Q+ S( g
  68. dma_addr_t dmaphyssrc1 = 0;
    2 l. C% ~) i/ a: f4 D7 s/ Y
  69. dma_addr_t dmaphyssrc2 = 0;
    * C8 [1 O( l  n0 S3 v) U
  70. dma_addr_t dmaphysdest1 = 0;1 `* k$ X! U" B/ [
  71. dma_addr_t dmaphysdest2 = 0;) \( U2 |3 a1 B  Y% ^
  72.   u& i2 V: ?' x, L: r4 a
  73. char *dmabufsrc1 = NULL;
    # h, l5 E; e; J7 M& ]3 `% V, s6 b3 H, s
  74. char *dmabufsrc2 = NULL;5 S2 s. R! L+ D9 X" X: L- [6 R2 L
  75. char *dmabufdest1 = NULL;9 D' p) b5 |& [' N, E4 F
  76. char *dmabufdest2 = NULL;, o5 K/ y  t  d8 v2 O* x! c

  77. ( O8 e+ Y) p7 ^. z! M7 e
  78. static int acnt = 512;
    3 A4 E& t" N/ w: w! a
  79. static int bcnt = 8;
    " a  X. ~1 J/ k) R' f
  80. static int ccnt = 8;
    8 ^* ^& Z9 A! U9 M

  81. ! f; _( l2 T/ v# G# V$ W1 e
  82. module_param(acnt, int, S_IRUGO);
    9 J1 R: t* P7 @6 P( E7 G2 w' K1 c
  83. module_param(bcnt, int, S_IRUGO);! ^( v2 D* R: F) U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: G2 o9 e" j, @
$ N- k3 `' V5 w+ j( @" B# c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* Q6 U8 [; B7 W% r2 k1 g1 @$ t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) F5 x5 Y# Y. q! v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ ]5 N& \" y# l" ^
+ g" l7 K% q$ j% b
0 V, [' ]' K9 ]6 \5 o- h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 22:59 , Processed in 0.040815 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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