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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( k& G1 |' i! c5 a7 I+ y5 `
  1. [code]EDMA sample test application* A  E& C" _5 A
  2. /*
    & W- k6 k$ M4 h$ ^0 S+ w
  3. * edma_test.c
    2 _6 V2 x, C9 T5 p, a& g$ d; ~1 H
  4. *
    8 ?( |+ N3 G4 F/ A0 l( {
  5. * brief  EDMA3 Test Application
    ) t+ r+ z- D' T. d; Y
  6. *6 b/ _! C6 `( H: u* c
  7. *   This file contains EDMA3 Test code.
    + v( b, K) {. l/ t/ R
  8. *! e4 E1 G" a" b! n4 I$ W1 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # q5 w3 m8 Z; f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      q8 s, j: p  `! t, C+ P
  11. *         TO CHANGE.
    , L: S5 ^) b1 [. R
  12. *
    $ c4 p5 q5 O6 O, a) K/ Y4 Z0 |3 q. m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, `1 R) k/ @% l" d
  14. *
    3 S0 k: M7 f" t. h$ Q) C& [+ U1 ~  F. R
  15. * This program is free software; you can redistribute it and/or( ^: N% ~: C, W( \; a
  16. * modify it under the terms of the GNU General Public License as# V. U7 r, h/ C7 [, U2 t; q) b
  17. * published by the Free Software Foundation version 2.
    - s+ E* o4 Y5 ^/ l7 z8 x, P4 q7 [# i
  18. *
    ) D) h( f* K/ F1 c9 N; c3 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 C. `% v0 N  V/ M
  20. * kind, whether express or implied; without even the implied warranty' l9 X" M7 g8 @2 n4 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ j+ _$ t- ^. X. Z% R% N4 Z
  22. * GNU General Public License for more details.! I! U1 b& T$ f# _2 }
  23. */
    0 T8 S' ~. P* e- _

  24. 9 C: v, z5 Q/ h
  25. #include <linux/module.h># A- `$ E' b/ I# |* T; `* R) ^
  26. #include <linux/init.h>
    , x7 M3 M7 N+ @* k8 F3 j4 g
  27. #include <linux/errno.h>
    & ?, `/ r% I. ?1 G$ N
  28. #include <linux/types.h>; k  c0 G: |" Q  r/ Y
  29. #include <linux/interrupt.h>
    3 n: p1 E* ?( w: G5 V% d" i( p
  30. #include <asm/io.h>$ b; X. g( v% C5 B0 D' P4 u
  31. #include <linux/moduleparam.h>
    , P; d  ?, O9 D2 I2 U) U
  32. #include <linux/sysctl.h>
    + \0 M( {/ o) B5 v, D% i$ `
  33. #include <linux/mm.h># n8 i+ I) x5 g3 l, B
  34. #include <linux/dma-mapping.h>+ J( z9 ^- a" O% N. C
  35. 3 w. f& x. C6 M3 ?4 Q5 j
  36. #include <mach/memory.h>
    0 ~( }" n5 B3 k, |5 d! i
  37. #include <mach/hardware.h>
    0 Q# }- Q5 P% A1 O2 A: k
  38. #include <mach/irqs.h>8 q2 @3 E# w0 H+ ]
  39. #include <asm/hardware/edma.h>
    9 x; V9 v2 q8 y
  40. 3 D& [# x* }, P( R
  41. #undef EDMA3_DEBUG8 G1 S! Z9 e0 D2 I5 M# ~. T: O
  42. /*#define EDMA3_DEBUG*/
    3 |7 ]6 Q( K, z9 _& J

  43. 6 l6 Q$ z* X, E. a$ a1 L1 d
  44. #ifdef EDMA3_DEBUG# `# Q$ ]3 w! |5 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      {" _& U# H0 D' F/ o9 E: G# c2 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      }5 d- h9 T+ q/ p5 p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& r$ n* P; R  K
  48. #else7 R9 b$ g: p7 B% _7 d# j8 P
  49. #define DMA_PRINTK( x... )
    # M% b( k2 [  t3 u$ j4 ?
  50. #define DMA_FN_IN9 J: s: ?3 A$ p
  51. #define DMA_FN_OUT
    1 w2 R) g- S4 g/ r; F( m
  52. #endif
    $ E  B+ h2 W4 E* A4 s; q; T
  53. " x3 t; a2 I9 L' y7 F4 T8 `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . g1 u4 g) F; T' Y5 w7 g1 g+ T% d; S
  55. #define STATIC_SHIFT                3+ X- N! X3 `6 }9 @3 v" K
  56. #define TCINTEN_SHIFT               20
    6 K/ R  w/ v0 {: F
  57. #define ITCINTEN_SHIFT              21
    5 B* O# h2 p: s+ }
  58. #define TCCHEN_SHIFT                22
    6 E% }! Q; C0 r  A: z" w  \7 S' }: Q
  59. #define ITCCHEN_SHIFT               235 L6 d& O  _8 \& S1 g' [* [

  60. & Q1 T& O, ^! @5 H; g' Q
  61. static volatile int irqraised1 = 0;) ^& a7 o* r' z9 X& \$ l
  62. static volatile int irqraised2 = 0;" f6 a) y7 U1 K# R% F/ U$ [

  63. 6 i0 q( _/ V% T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( ^: N4 o2 G* }! v' S3 k! D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. f" ?" f$ |( M  e- O0 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& H1 E; g$ [/ {$ p; A
  67. ! t$ h' h  M  Q, ?, \7 \0 ?
  68. dma_addr_t dmaphyssrc1 = 0;
    7 c0 H* g# T# e4 k+ u1 P
  69. dma_addr_t dmaphyssrc2 = 0;  L$ l: `7 g0 T8 U2 W% P8 I. t
  70. dma_addr_t dmaphysdest1 = 0;" A, h7 U& ~+ W5 Q+ I0 c: e
  71. dma_addr_t dmaphysdest2 = 0;
    + d! @' R' ^& @3 T5 v+ Q" x

  72. 1 r# e- J$ z- f1 f; H
  73. char *dmabufsrc1 = NULL;
    ( g: s, s/ w  S/ v" f& ]1 `& G2 W" X
  74. char *dmabufsrc2 = NULL;
    $ {# }& f9 a- l7 w$ e% L* D
  75. char *dmabufdest1 = NULL;/ D# z* y; S& }' K2 v6 s
  76. char *dmabufdest2 = NULL;
    , Q0 T, Y7 @2 `: h' I% {

  77. : q/ E/ m( ]: ?
  78. static int acnt = 512;5 s2 w% o6 D! L$ N
  79. static int bcnt = 8;/ T8 o" ^  y2 D% k1 X; d0 Z0 r
  80. static int ccnt = 8;
    ' ?+ y/ n4 [+ |  H

  81. 2 ~  N- |  r# m0 V
  82. module_param(acnt, int, S_IRUGO);
    4 T# C$ \' r" V9 t3 G
  83. module_param(bcnt, int, S_IRUGO);  n0 p' z" z# g4 m: V) \, `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% c' }( f$ ^4 _

2 w& t# Q( m& C. `0 s, x4 c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) B1 B; k1 f& e: ]0 `3 Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% M& I2 H. Z: \$ ?% @% S6 S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ e. ?+ h4 [! Z0 g0 B1 s/ b6 q6 M5 l/ s7 D# U# u0 r

0 q6 H1 R8 w1 r6 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 18:08 , Processed in 0.040075 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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