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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 d! B$ `- S6 S4 ^6 |' U
  1. [code]EDMA sample test application
    # c: F, ^1 g+ f- b5 I! p+ J) O# e/ O, d
  2. /*
    ; P  ]$ t! e0 P, {$ ]7 ^! A
  3. * edma_test.c( k( V, t3 V  @" r5 D
  4. *
      j( |2 [6 Y* z
  5. * brief  EDMA3 Test Application
    ! n1 B) ?+ X  {
  6. *. y8 I. d5 c- y% F5 ]
  7. *   This file contains EDMA3 Test code.
    7 l. s( A8 v. L9 F/ ]; w
  8. *6 d# }' ?% C8 X2 }- n  w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 Q8 |& D( D8 [5 z( P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( Z1 I- n9 U0 G' p, G( D- c1 Y
  11. *         TO CHANGE.
    8 @3 s/ H1 A# v. u- L
  12. *
    - u* g3 u: d4 c& f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 I5 }7 Y9 \& n, x
  14. *, w; i  b. M3 E6 t
  15. * This program is free software; you can redistribute it and/or
    ; ~6 P0 l4 A; ^! E& q" D
  16. * modify it under the terms of the GNU General Public License as- M/ [: f: A9 c
  17. * published by the Free Software Foundation version 2.3 S$ X+ t1 j. W$ X% y. W& e
  18. *
    % G& C+ F) p: Z6 E; V4 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 j5 J1 N5 t& v  ]2 P& L
  20. * kind, whether express or implied; without even the implied warranty
    + S# \0 g0 `  K& S/ f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; B- e/ [: W, d: F" F  x
  22. * GNU General Public License for more details.
    & M* h1 G- m' A) M- J2 J
  23. */
    5 M, n* I& k7 e0 E

  24.   h4 Z' ?" ]  F# A( t: E5 V
  25. #include <linux/module.h>
    # A' Q/ k( L( u7 a7 d
  26. #include <linux/init.h>
    8 g' H8 ]3 k/ O) C( t: N
  27. #include <linux/errno.h>( z2 ]" Q% N9 y$ ]! V* X
  28. #include <linux/types.h>
    # Y) u# D; h# q' H
  29. #include <linux/interrupt.h>' N* @3 H& @7 p7 r* T' M# b
  30. #include <asm/io.h>
    ' y0 c' |  s. f& p9 X$ o- i8 z, U
  31. #include <linux/moduleparam.h>7 E3 G; F7 B/ r1 n! v
  32. #include <linux/sysctl.h>
    ( w0 e& N  h4 ?1 @" F
  33. #include <linux/mm.h>8 B" d: @5 }/ p
  34. #include <linux/dma-mapping.h>
    , X, h& ~( k8 k+ m6 q0 y8 {3 Q

  35. . x5 g9 n0 f1 b. ?  r1 q; j- P
  36. #include <mach/memory.h>
    - a- n! B. L6 D% u& x+ ^" R5 B
  37. #include <mach/hardware.h>1 y( G: B1 P% x' n' ^# a
  38. #include <mach/irqs.h>! t' v8 x3 O* T- X: ?& m- b
  39. #include <asm/hardware/edma.h>$ D0 M2 A4 c& p/ r& o0 ?' Z( I

  40. ( }3 j3 ]$ J6 r4 z! d6 ^
  41. #undef EDMA3_DEBUG- v$ s! `/ E$ j6 y% D
  42. /*#define EDMA3_DEBUG*/
    2 x% t3 ~, a3 F  H& r
  43. . r3 P5 {# W! j6 i# R$ ^/ ~
  44. #ifdef EDMA3_DEBUG
    ) S1 m' M0 M9 b0 k* e: g4 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / M7 S% w8 X* w9 C( T6 D: i% r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      G9 I1 x' V6 R8 R! k! d9 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . B% M1 H; B$ R2 J1 M
  48. #else7 ]- ^) O8 ~8 e) M
  49. #define DMA_PRINTK( x... )5 Z' ]8 M2 l6 t4 ~
  50. #define DMA_FN_IN* y) |4 v" e- _' Z  T8 q* A, h6 M
  51. #define DMA_FN_OUT
    + z, U/ O, S7 y) F& G; v) V
  52. #endif
    ! d* @: a2 T0 s3 O4 x3 u
  53. : Y4 n; k3 L2 V. O  [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # X- D! a- ^# J( C" h. z
  55. #define STATIC_SHIFT                3
    - _# W3 F3 ?  l9 h
  56. #define TCINTEN_SHIFT               206 D! C+ ^3 n4 Q  V4 z6 A
  57. #define ITCINTEN_SHIFT              21
    ( j8 E, D, g# E1 Q& w, M1 y
  58. #define TCCHEN_SHIFT                22
    ! o) {1 Q. U' g. E- c- {) m1 E
  59. #define ITCCHEN_SHIFT               23# ?9 Z0 g! `/ P6 g: W% y- g
  60. ) ?* c9 D- F& B( p6 ~$ n
  61. static volatile int irqraised1 = 0;& i1 J7 @+ @/ H7 W! @6 n: y* l3 L, [
  62. static volatile int irqraised2 = 0;! [" Z, b2 U9 M% R% t% P
  63. 0 G7 d5 N/ Q9 o3 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " g- ~- X6 a, n; K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& `5 e  y  q" x8 G& S$ I$ t0 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 {/ D; F, B- n" Z8 ~; K9 W

  67. : H& o$ j, \3 ~1 A: ?
  68. dma_addr_t dmaphyssrc1 = 0;1 H& D9 P  |9 o& ?& ?+ j1 f
  69. dma_addr_t dmaphyssrc2 = 0;6 b7 r9 S( L" {& C6 x% Z, f
  70. dma_addr_t dmaphysdest1 = 0;
    + G4 I+ r2 Q3 G
  71. dma_addr_t dmaphysdest2 = 0;+ G' V* ]8 w: G0 I& q3 Q

  72. 5 s( |4 q# Y- [3 M, x
  73. char *dmabufsrc1 = NULL;
    8 w5 m# K0 p% ]0 c$ I
  74. char *dmabufsrc2 = NULL;
    : _5 K# v5 Z4 P  [2 Y5 t
  75. char *dmabufdest1 = NULL;2 G; o, g+ a, }+ B" `" l
  76. char *dmabufdest2 = NULL;
    * q, F) R7 b1 m6 h4 K

  77. ; q* O: Z$ J6 {' _0 o9 {
  78. static int acnt = 512;  ^& j8 X& Y8 Y: r$ A( V
  79. static int bcnt = 8;
    # h$ j, O) F0 M* n7 C! F) ~% m* J
  80. static int ccnt = 8;
    " |) W7 o3 A, `+ j
  81. # k" W  I+ v. O
  82. module_param(acnt, int, S_IRUGO);
    $ z  u. n/ R: k
  83. module_param(bcnt, int, S_IRUGO);
    9 C1 u( ?/ Q6 L+ G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# h2 k' G) o7 A

5 K0 b+ S9 }8 e% T: M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. X, f3 B3 m# V  l: ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% q, J7 q. P3 a8 `; ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ }$ T7 e5 a6 L$ X

. k* f$ {# Y6 m4 H* c
4 ^' }. `7 _) j+ H9 z5 R7 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 00:06 , Processed in 0.039917 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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