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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % r$ o+ y( x# E) _) m$ E" C5 M
  1. [code]EDMA sample test application
    0 X) i9 D, H  S# k( _, p
  2. /*' s, u, ~# @# {7 B+ V# f
  3. * edma_test.c6 r5 m, W, N2 Z, t( ?
  4. *
    7 p+ i6 f6 E/ l0 Q  m
  5. * brief  EDMA3 Test Application+ V$ o& ~* C" T
  6. *
    8 }$ s! n6 p! {' u5 n  V
  7. *   This file contains EDMA3 Test code.
      y3 i/ F5 i5 M5 Y* @( O# r6 _
  8. *
    - ?  [  {* L" ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : q7 J* s8 R2 j# `2 I0 Q% M( M3 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : D/ d* @: K. `2 G) g
  11. *         TO CHANGE.
    & g6 T, \9 c/ a
  12. *: M6 m! |; h% H5 p% j$ \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# L6 G7 e( B. F! p& Q9 U
  14. *
    ) Q' R0 ]- c# g3 E: _; p
  15. * This program is free software; you can redistribute it and/or
    # J5 H1 X$ V7 ]/ b+ ]9 h0 A9 s
  16. * modify it under the terms of the GNU General Public License as' d; P* P6 a8 e+ m7 e$ a
  17. * published by the Free Software Foundation version 2.
    # T  Y! V; G; m; H; [
  18. *3 }# }: g" N: [! ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' q, |7 {% l) B: H
  20. * kind, whether express or implied; without even the implied warranty$ Y, l% I0 N) k& t8 S2 A. E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 m2 n$ x( c0 m, j- i
  22. * GNU General Public License for more details." Z2 s4 M3 s6 d* `
  23. */5 i8 d' ~9 G- p* F0 \+ A( T' A/ t; I
  24. 3 g1 ~& g- V6 e
  25. #include <linux/module.h>
    % t# N/ I3 c6 f- g; S, j
  26. #include <linux/init.h>
    & H+ z2 f/ ?" ~  D$ H0 P" T+ r# M
  27. #include <linux/errno.h>. a- J+ e# d! V* |! ~0 y
  28. #include <linux/types.h>' \! p8 c1 v! z6 ~! Z4 @8 b
  29. #include <linux/interrupt.h>
    1 P: D" {2 l) p
  30. #include <asm/io.h>$ I! q/ p  ]8 V' d( V9 `) A+ X0 S& K/ n
  31. #include <linux/moduleparam.h>
    . ~! f! D/ Q7 }" P$ x8 W
  32. #include <linux/sysctl.h>
    5 n9 u; ~& C. q; s
  33. #include <linux/mm.h>
    ' e+ ~- M$ s" p4 i
  34. #include <linux/dma-mapping.h>; ]2 V% W; v) m0 ~0 g3 l
  35.   N6 o/ j+ p+ @0 b) Q) C; _
  36. #include <mach/memory.h>  V9 k9 A  ^8 k; c' i& n
  37. #include <mach/hardware.h>
    9 G; [# _$ E) Y3 y( ?. \2 u
  38. #include <mach/irqs.h>
    7 z7 b' ^( f. c5 w
  39. #include <asm/hardware/edma.h>0 _0 g% O( W0 p6 D- u: u* y
  40. : W' F2 J. T0 I3 H
  41. #undef EDMA3_DEBUG, g) ]; A: e5 ?" e. Z0 s9 y% ?
  42. /*#define EDMA3_DEBUG*/- v- z/ {& @9 R' L7 i

  43. 9 S* s6 Y: g6 {6 ~9 R- K
  44. #ifdef EDMA3_DEBUG2 R( y9 b! Q0 G% o3 h$ S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) W2 k' e% ?8 o1 N9 D! Q- E9 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      w9 [5 u7 l/ `- j0 T6 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ G& }, U4 h9 H  T1 F
  48. #else! R. F  U4 l8 J0 }
  49. #define DMA_PRINTK( x... )
    / B2 g. X% Y/ y% _$ l) L
  50. #define DMA_FN_IN2 {0 e! o: h2 x4 k' T8 s
  51. #define DMA_FN_OUT
    1 I; c8 ~# H# O# U1 C% M
  52. #endif7 J% t  I0 k5 v. {+ h8 q. F# {
  53. . `6 n; o" A: b2 J+ H- z8 u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# O- O/ D' Z+ P1 G; U% U! z
  55. #define STATIC_SHIFT                31 T4 G" t6 ]  M3 G& \
  56. #define TCINTEN_SHIFT               20
    7 {9 @! C3 n) M/ z' v
  57. #define ITCINTEN_SHIFT              21
      c4 _. d! g$ v( E
  58. #define TCCHEN_SHIFT                22' F( T  R8 R% Z1 ~7 N
  59. #define ITCCHEN_SHIFT               23
    : z' E! t9 K) e  S' T
  60. % L/ ?* F7 r: N  x3 b# f
  61. static volatile int irqraised1 = 0;# n/ N% q: s% O1 ?! B
  62. static volatile int irqraised2 = 0;
    + N1 R: Q+ U/ |
  63. 3 C; G; G" v6 I5 v+ g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 g6 g$ S: ~; L0 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + j& ^% b; }) {5 j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 j" w# U" b2 E
  67. , t& D6 p4 l  {% v/ }
  68. dma_addr_t dmaphyssrc1 = 0;
    3 L$ y  |3 k  O/ g1 i3 Z
  69. dma_addr_t dmaphyssrc2 = 0;
    " b; v1 y! l9 E" S) V
  70. dma_addr_t dmaphysdest1 = 0;
    4 U0 r" {1 |& I2 v0 {4 [3 l
  71. dma_addr_t dmaphysdest2 = 0;
      O: \( G# d$ o" a% d

  72. ( D* p6 n9 K7 v9 ?# d/ F
  73. char *dmabufsrc1 = NULL;, ~! E4 f. ?# @/ T
  74. char *dmabufsrc2 = NULL;
    . Y3 Z: Y' f1 P3 ?# d# Z& r$ Z. ?! y& Z
  75. char *dmabufdest1 = NULL;5 |! I$ ]3 |$ @& i" w) @5 D8 M
  76. char *dmabufdest2 = NULL;/ s3 C% I" z8 }; I+ [& A

  77. ; b( f* @' [5 D% L
  78. static int acnt = 512;" E9 @& ~6 {( k7 l& `# N
  79. static int bcnt = 8;! l/ M9 Y! K4 }6 }0 t3 z
  80. static int ccnt = 8;7 s* q) Z4 L, X' n* v. m
  81. ; N1 G! K% F( ^8 I! d6 }
  82. module_param(acnt, int, S_IRUGO);
    - q- ~5 V1 P: U7 l
  83. module_param(bcnt, int, S_IRUGO);8 G0 `4 P" Y" n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* \6 y1 ?4 B: `- K! ^0 \8 W5 l- |' a2 p9 `
0 V: k) v! |( K' Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ }! C8 x6 W: z4 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 u* Z; X) K0 z9 C$ Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! v% A0 D8 P1 C) f# O/ O# j

1 G" P; j5 u  Y
8 u  z2 I0 T# ?+ Y5 E; G9 E* }+ b6 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-5 21:26 , Processed in 0.042542 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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