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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ m. U& n6 f& q6 x& b
  1. [code]EDMA sample test application5 T7 o0 B! J7 a/ E- h7 t
  2. /*
    # J% o. }4 u* j
  3. * edma_test.c
    0 [& C# j) L! F4 [( W0 P
  4. *# K: Z8 p& u7 F3 e$ p' V$ }8 i/ @( z
  5. * brief  EDMA3 Test Application
    & u: {1 A+ {8 d$ h; T) V
  6. *
    # U+ m0 ^* k) m: [) Q: P  ^
  7. *   This file contains EDMA3 Test code.( L! b# d& k+ Q5 R+ m/ {% g& d4 O* a
  8. *
    ! u9 Z, P6 U7 w9 {- g& P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - h( I) q& ~! B! X: `9 ~( \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % I4 k% D5 l: i
  11. *         TO CHANGE.: P4 B3 |) k  P7 m9 W7 l
  12. *
    0 z# `$ B9 G% n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. S& A! g4 s0 A8 b5 m5 H
  14. *
    0 y' n' G4 T) X2 Q6 _6 J2 U, P
  15. * This program is free software; you can redistribute it and/or1 ]' L4 X% q/ m" M) n
  16. * modify it under the terms of the GNU General Public License as5 b, }0 e: f# {
  17. * published by the Free Software Foundation version 2.! {1 ^, d5 C& Q
  18. *4 h. h9 \5 W; w" r; P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 @; D- |' |0 t
  20. * kind, whether express or implied; without even the implied warranty
    9 \9 G. Z% H' X5 X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . k! x2 P& Z% H
  22. * GNU General Public License for more details.: x7 f( _- P3 v3 j+ j
  23. */
    % E  ]+ H; {4 h- `* I6 z$ |4 {
  24. + |$ _6 s. F* u% L1 v3 j: V
  25. #include <linux/module.h>( l4 ^1 {0 L" _  ~; l
  26. #include <linux/init.h>) d0 m; l8 f9 k# H
  27. #include <linux/errno.h>
    4 T+ q; u4 B3 y1 W: J
  28. #include <linux/types.h>' ~2 I1 k! F. C% o, }4 ~2 c1 q
  29. #include <linux/interrupt.h>
    8 D" h9 a  }9 u  V: c, N7 F: O
  30. #include <asm/io.h>
    ( I& A; s' ]) z, I0 S& O9 m; V
  31. #include <linux/moduleparam.h>, V% l6 {' \+ Y1 j: C0 y: o( K
  32. #include <linux/sysctl.h>( z; }; C% L( O6 K9 T
  33. #include <linux/mm.h>! t2 p- ^, f2 q
  34. #include <linux/dma-mapping.h>4 C3 k: G" l' T' ]  x9 ]. f. x* D

  35. - x4 N' l: Z, ]+ G/ f
  36. #include <mach/memory.h>4 ~% D# b" C3 j; w1 f& k8 @4 s
  37. #include <mach/hardware.h>2 P% A# p, P7 a* y7 Z, U7 N
  38. #include <mach/irqs.h>
    & X- o$ M2 o" S  l0 }: ^  T
  39. #include <asm/hardware/edma.h>! }+ C9 V) ^. l- x+ [0 d) B

  40. % h' g* W2 d9 n4 }* H  U" Q
  41. #undef EDMA3_DEBUG' o' s# P/ x2 g; l
  42. /*#define EDMA3_DEBUG*/
    " l, u6 U( _* z' W

  43. ( D2 y5 l, s1 w5 m7 ]3 N5 V
  44. #ifdef EDMA3_DEBUG0 s3 {+ f/ n4 z) m+ E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 [! X: ]* y4 Z2 `& a% p' h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 G, {2 x9 Q5 V9 ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! t& S# M5 R; X# U+ _$ J& W& J$ o0 G  Z
  48. #else
    - j  o: s% @3 |
  49. #define DMA_PRINTK( x... )
    3 `* o6 f6 F2 F* ], x9 i/ Q
  50. #define DMA_FN_IN3 N, \* W; }  ?" e
  51. #define DMA_FN_OUT
    2 a, T# {: m- S7 {" p4 n
  52. #endif+ w# p7 K! d3 y- z

  53. + Y! }$ J/ F) l' t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 I7 Z, v9 [0 ?8 E4 }7 ^/ i
  55. #define STATIC_SHIFT                3
    3 ~8 ^% f3 k) i! Z
  56. #define TCINTEN_SHIFT               20
    * f) L- Z/ l7 i+ q; c  a2 B
  57. #define ITCINTEN_SHIFT              21
    0 \* A5 A* M/ u
  58. #define TCCHEN_SHIFT                22
    " q% |  }$ T! ?2 v
  59. #define ITCCHEN_SHIFT               23
    ( J, W  q2 F  m' y
  60. , e4 y2 j. x2 v5 Z! [
  61. static volatile int irqraised1 = 0;
    1 z1 u0 P( W7 ?
  62. static volatile int irqraised2 = 0;7 {3 q! h6 o  W1 r2 q

  63. ( {# j  F7 K- e% W! e; a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # r8 w/ g3 H; t' _7 I, o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ N( i) o8 W$ ^9 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, l" {. z( e3 x) y

  67. % F! g9 ^4 V6 r" w
  68. dma_addr_t dmaphyssrc1 = 0;6 z( N$ W" c; k' q
  69. dma_addr_t dmaphyssrc2 = 0;: d7 x; x2 A+ U' J% m8 M
  70. dma_addr_t dmaphysdest1 = 0;" w( q( ?2 m6 Z, T7 i
  71. dma_addr_t dmaphysdest2 = 0;
    + Q. Y% E7 x$ H1 E
  72. . _( R9 k) z* j* n/ U
  73. char *dmabufsrc1 = NULL;' U" K) I3 E, W, ~' K( j& @& U5 k1 F
  74. char *dmabufsrc2 = NULL;$ H( y! s0 S+ b* z$ g/ l. ?
  75. char *dmabufdest1 = NULL;
    * K0 x/ ~5 T* u- F; ~9 _
  76. char *dmabufdest2 = NULL;: O3 y1 W5 z. v5 a( ?

  77. ) Y' g2 [/ M  v& S7 d; {% Y
  78. static int acnt = 512;
    + _. n" ?: m' c* z
  79. static int bcnt = 8;1 ?6 |6 s9 T* o# X, b: z" \9 }
  80. static int ccnt = 8;
    2 a0 W" m$ J% O2 s. f4 R

  81. 6 [" E& ]: e1 w: B, v% {& T" \  }
  82. module_param(acnt, int, S_IRUGO);
    ; V; {' r$ T; F5 K% v  f$ c
  83. module_param(bcnt, int, S_IRUGO);+ `! Z5 g+ j: H  z4 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, j+ H' U. M1 K$ k: S  Y) f+ @. e: o. n4 h- q! K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 a/ u6 h0 ~9 w$ k, D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% E! A' x; x, y6 S, q: x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 _* [% @! C' j! ^/ h

7 h/ K" f8 [8 A6 L5 @
- k; c* t, P; H9 p# b9 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 06:57 , Processed in 0.039419 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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