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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 ^& {2 t; {; W$ x5 @' w
  1. [code]EDMA sample test application
    . H- S1 Y7 M+ ^* d4 E! \0 u3 ~
  2. /*
    7 C! Y5 g* x$ A% V, X  R- }' h$ O
  3. * edma_test.c# w9 N( C. K1 u' y
  4. *
    - u9 A. x' X6 `- r5 [" k
  5. * brief  EDMA3 Test Application0 Q" ?) |4 ^" u
  6. *
    6 r; {2 ^4 j; I
  7. *   This file contains EDMA3 Test code.8 d' o3 J" z3 D4 H: o  b" D
  8. *
    6 Q& O1 H, |9 y9 e1 h) b+ t) n  c6 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# F3 B. I& a/ h9 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 c2 [) l) J3 Y; Y$ C7 B7 ]) h* n
  11. *         TO CHANGE.
    + J. `' G; y( F: r- {
  12. *
    & ~( _0 |! x3 C' L+ B) Q4 Y3 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 |6 v& G  y7 v) l& l/ _
  14. *
    ' r) x7 t. x- D; J9 v% g+ Q) P
  15. * This program is free software; you can redistribute it and/or
    : w+ p  s' f4 X3 k/ ]  Q& V  n2 T
  16. * modify it under the terms of the GNU General Public License as$ @) b% ^  B9 U7 F8 r5 X) e, E9 |
  17. * published by the Free Software Foundation version 2./ C/ N5 q' P2 E
  18. *- ~& E4 E( ~8 q! y5 e4 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 C, M: w4 E; L8 {7 K8 f" ^
  20. * kind, whether express or implied; without even the implied warranty, D5 j7 U& V& |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( p+ o( q# o# M2 C3 K
  22. * GNU General Public License for more details.
    ( d) j: p% j% [; u. i
  23. *// p6 J1 y- E( ^$ k
  24. . S( ?- P* i8 v% `
  25. #include <linux/module.h>
    % s; G4 k( Q( G5 N  I$ q6 F; p6 N% P
  26. #include <linux/init.h>
    1 A  j) D' p- w7 u0 E
  27. #include <linux/errno.h>% Q) P& b7 p  w! _# Q
  28. #include <linux/types.h>
    # O# n# N; g9 c0 j/ x( E
  29. #include <linux/interrupt.h>
    * g) _& B: y1 U# `6 ^
  30. #include <asm/io.h># V3 f& \3 S, R0 V1 n% h
  31. #include <linux/moduleparam.h>
    + ^; F% M1 y( m' X1 e" m1 }" m- v
  32. #include <linux/sysctl.h>
    3 W) A/ J) h; ~) ?
  33. #include <linux/mm.h>0 o8 j; a/ `- w
  34. #include <linux/dma-mapping.h>+ ^1 E9 w; _) M" f; y

  35. % _: h+ c+ z* f8 e
  36. #include <mach/memory.h># A+ O/ g$ C( F8 O7 n
  37. #include <mach/hardware.h>( ]) [; m  s' R( h3 @
  38. #include <mach/irqs.h>; y4 P, h' E$ r% z4 L% }
  39. #include <asm/hardware/edma.h>0 C4 P: T& e5 g' d6 }* h" B1 ^( {

  40. 9 d' i7 F" Q: j
  41. #undef EDMA3_DEBUG: f6 R' F! f3 f' U( O+ K
  42. /*#define EDMA3_DEBUG*/& R' U, s( d& p7 l6 u
  43. # F3 N$ i; @0 ^3 O) Z
  44. #ifdef EDMA3_DEBUG$ B; O1 h/ h" \. R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / }6 y+ e, p4 V( a8 R/ _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & ?+ `0 j7 ^+ G3 Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ?4 N/ V; x" J
  48. #else* k9 c! ^1 c/ j  ]+ g  o+ _  ^
  49. #define DMA_PRINTK( x... )6 x; @1 \! ]: N- U
  50. #define DMA_FN_IN
    # h. l4 y! c+ g0 v( f
  51. #define DMA_FN_OUT
      m# I/ H5 L3 L3 F* s. j
  52. #endif, a" M3 a9 Z6 E2 p9 Q- n  Z: @! A

  53. 4 s9 s6 a5 t  a. w  [' F' G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      G  K6 e. h/ N
  55. #define STATIC_SHIFT                3" Z3 A; r0 l5 b/ R' g7 ~$ ~* I
  56. #define TCINTEN_SHIFT               20
    ' J5 L% D) e1 ^2 ~
  57. #define ITCINTEN_SHIFT              21! I$ V" e* Z% w# e+ m- `, G+ I
  58. #define TCCHEN_SHIFT                22
    % Z8 G& `, S; y( S
  59. #define ITCCHEN_SHIFT               23; e( k$ }* P; I9 v- {  b
  60. 3 S8 i: K# M* i
  61. static volatile int irqraised1 = 0;- k8 \6 s0 M" b( A) \
  62. static volatile int irqraised2 = 0;
    8 D6 ]9 E  }" O, o4 l; s
  63. 3 A% j+ C: X5 Y# F+ q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 z% z5 `; D  N9 j) E; M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 a: L, m% k# k4 @  L1 {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; t5 ~% ]% t1 O( Y7 Q
  67. : \  W4 A, X; u* ?1 n3 z3 ?% L
  68. dma_addr_t dmaphyssrc1 = 0;
    % o% [' o/ S7 F
  69. dma_addr_t dmaphyssrc2 = 0;
    " `. g* \7 D2 g' @
  70. dma_addr_t dmaphysdest1 = 0;
    / c% q& r. a6 l% m
  71. dma_addr_t dmaphysdest2 = 0;
    1 M8 P# ?" [1 e7 A
  72. ' h7 H' b# s# |% j
  73. char *dmabufsrc1 = NULL;, K: {/ a3 R2 A  o' C1 H
  74. char *dmabufsrc2 = NULL;
    5 j, p3 h' O! [2 \/ [0 X  b
  75. char *dmabufdest1 = NULL;
    2 n9 U  ~8 Z: v
  76. char *dmabufdest2 = NULL;
    2 h: R% e+ l3 O3 W; U
  77. . G4 R, w% ]4 `4 O2 m8 D
  78. static int acnt = 512;
    1 O& B4 r+ u& J
  79. static int bcnt = 8;8 g" \/ v# z  z5 }' E( {
  80. static int ccnt = 8;7 {5 _# N) x& p8 w8 v. u6 \
  81. 1 m7 x9 u7 ~2 ~! x( R, _" l2 H& B
  82. module_param(acnt, int, S_IRUGO);8 J$ M  I2 p# w3 }% B9 M- E  c
  83. module_param(bcnt, int, S_IRUGO);
    1 r- V  }% I. _' l! g) H. T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) L6 z9 j3 j8 @; B7 K1 x, P
- c: w4 @& h: U8 p! |1 u; T: p- O6 |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. O  T+ |* s6 M+ _+ A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 j; T" R2 `" [- q6 l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 h& f$ t8 p, m, ?# |5 u0 w7 P
; H1 F+ ]) p- c, F  `9 r: s+ z' h9 c, O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-20 16:04 , Processed in 0.043138 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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