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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & W- f# [5 Y& m' D# g9 C6 [6 o
  1. [code]EDMA sample test application
    2 v( k" ]+ q. G- ]/ [+ [1 i
  2. /*
    " K7 g- ]# U5 [1 J+ F
  3. * edma_test.c+ B- j( c3 U! b. u: J) Z
  4. *' u& e5 d' J" h7 W* R- }
  5. * brief  EDMA3 Test Application
    7 X, [7 Y- f4 R2 U/ |
  6. *+ o/ ^* K( g: T% x" g) O
  7. *   This file contains EDMA3 Test code.
    ! T- E# ~6 F9 z3 R. y$ I
  8. *
    3 G$ f% i5 y- z# f! P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, c1 w& S2 P# L3 p( |1 {5 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! a+ Y) ?& X" I9 N+ s1 ?- H& V9 \! O) p
  11. *         TO CHANGE./ d% X, P3 c) \# F- N2 i  K
  12. *0 h& L0 e- G' R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , I7 s, j" A! n* ~* K) P* b
  14. *
    3 o) L# u0 Z" r3 `* K
  15. * This program is free software; you can redistribute it and/or* ~6 [5 S' w8 [( N! b
  16. * modify it under the terms of the GNU General Public License as( D$ A% n' J2 z* w% y
  17. * published by the Free Software Foundation version 2.
    . l3 l( k. v0 D! @: M3 O% H
  18. *7 L' I6 u. M+ g5 N6 \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / ~+ T/ T4 w' ~4 J, d/ \( }2 t
  20. * kind, whether express or implied; without even the implied warranty0 r8 N- \2 u2 f2 M! K9 p' U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      V& f) k/ \! Q; O
  22. * GNU General Public License for more details.5 s; c& C) u1 z0 h6 U. C! x6 k9 s
  23. */
    " G) g# y3 |% o2 q
  24. % X) j' y6 h2 U* l
  25. #include <linux/module.h>% x8 C5 X7 G1 I
  26. #include <linux/init.h>5 Y7 B3 e2 c. }9 \: e
  27. #include <linux/errno.h>
    . q8 u2 ^  W1 ~+ Q0 }
  28. #include <linux/types.h>" V. D  q2 ?. K; Z- p
  29. #include <linux/interrupt.h>
    & a3 n  r6 q1 u% Y0 U
  30. #include <asm/io.h>" p) k$ D& N! z% z, V1 ]9 |
  31. #include <linux/moduleparam.h>
    7 O+ S! O" e. l( H8 N0 }
  32. #include <linux/sysctl.h>
    5 P3 M* o0 f' B8 Z1 m8 z3 E
  33. #include <linux/mm.h>
    & ~& y1 }$ }8 `4 D2 y3 ?( x% V
  34. #include <linux/dma-mapping.h>
    : y5 w0 X& I* G

  35. ) R. M& U/ l! b, f, H
  36. #include <mach/memory.h>+ z, W. F+ e8 Q8 r9 g+ N
  37. #include <mach/hardware.h>9 a" E; X$ p& z8 O
  38. #include <mach/irqs.h>$ x  N1 l# l2 r. J; X1 c2 F
  39. #include <asm/hardware/edma.h>: _1 r* e4 y' d  p5 ~

  40. % z) M, F' F, w, }9 E+ W/ c
  41. #undef EDMA3_DEBUG
    1 n$ {2 Y7 A" l! l% m: j, P/ x, c) r
  42. /*#define EDMA3_DEBUG*/* N  ^$ |1 n( S" _8 @! H* P2 @

  43. " W" L7 d: f* L) C3 {3 y
  44. #ifdef EDMA3_DEBUG
    " D3 n. g3 C, n: l3 s6 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 H" h/ S) N/ X3 @( D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " r2 T1 Y+ U  _  F, V) R6 S# Y8 {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 i9 A7 K+ d# K$ `* l
  48. #else
    8 s3 W% c5 R; @5 r' K0 t
  49. #define DMA_PRINTK( x... )
    1 Q/ E$ R2 q( g3 ~' f9 u1 ]" m
  50. #define DMA_FN_IN
      s: \/ @1 `, Z
  51. #define DMA_FN_OUT& m+ d2 I% }- y/ ~. F/ Y
  52. #endif
    7 g( b( f" E2 X. N

  53. " F6 v: B8 F; O" L* _$ j  |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; R9 D6 u) }# a  {: z
  55. #define STATIC_SHIFT                3) l, @& |" W9 s7 Q0 Y2 Y
  56. #define TCINTEN_SHIFT               204 l1 {7 x/ t9 Z: r/ w; a) V( Q
  57. #define ITCINTEN_SHIFT              21# ]7 e5 g- _+ ]2 k- W) C9 d
  58. #define TCCHEN_SHIFT                221 H( ~8 C' G  B4 e1 |  j  W& u
  59. #define ITCCHEN_SHIFT               23
    7 ?3 o9 N) S7 e) W
  60. 9 ?; E  Z4 J8 B4 Y9 b
  61. static volatile int irqraised1 = 0;3 @& ~8 j8 ^" P& C/ s
  62. static volatile int irqraised2 = 0;7 F( Z; l+ z2 l

  63. ( j, y# D) L) r& B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 E, \( {1 m/ m( M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Z) |& B8 M/ |; Q+ B8 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 j0 p) E# ~( D* T. N/ i8 G

  67. # x) [& Q2 w4 ?: p+ J
  68. dma_addr_t dmaphyssrc1 = 0;
    ' F& q- o4 l8 L( U$ W6 O
  69. dma_addr_t dmaphyssrc2 = 0;& y5 C* X: Y$ _2 Q5 c8 d( c9 H# a
  70. dma_addr_t dmaphysdest1 = 0;0 F  N9 Y1 c$ R7 Z( `
  71. dma_addr_t dmaphysdest2 = 0;
    ( v" g& m+ i& p: N. L
  72. ( }: p4 w* m" l" a1 ~: {
  73. char *dmabufsrc1 = NULL;2 E3 K7 o8 |' p, z9 c( @1 S! d
  74. char *dmabufsrc2 = NULL;
    / l* P2 a& W0 A/ K! v/ T3 Y# D" n
  75. char *dmabufdest1 = NULL;
    . l7 W5 E. S% I& }8 X  J& l
  76. char *dmabufdest2 = NULL;& d4 o2 _8 X- ^- q9 [/ O5 s
  77. - q4 e& H# }2 w* Z
  78. static int acnt = 512;
    & H- w; |( [4 @$ z
  79. static int bcnt = 8;
    8 b, L& [+ n  w" g/ a) ]9 P) C
  80. static int ccnt = 8;  C( F& _# g- p0 n% ], x. h, v

  81. 4 n' D8 _. Y' K4 [4 r; N" K; \
  82. module_param(acnt, int, S_IRUGO);
    4 {# I% z9 a& X- G7 N
  83. module_param(bcnt, int, S_IRUGO);
    8 r" F  N0 z6 _0 ]% L6 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 @# F0 M, B* b! u

: ~( j0 A" F. e8 G8 K$ `( z/ U) R' M: [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; ^, ]7 V% R3 m- b. 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ h% g( T& `4 |6 x$ V3 o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) q+ W# D7 G( z% D  r/ u; I) F/ M% q: P+ n0 M9 p
2 C& y, Q2 [# e* }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 20:32 , Processed in 0.040097 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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