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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . J4 {) `5 K0 Q& }) l8 r' |& n2 E; }
  1. [code]EDMA sample test application7 a  I+ L% r& {6 U, z, k
  2. /*
    . F1 w' o: E  y/ f
  3. * edma_test.c* j' F2 [" K; f, G. h
  4. *, O2 U) I5 k3 C) \+ F2 Q
  5. * brief  EDMA3 Test Application
    , v5 d/ r2 Q& W' c
  6. *
    ) N; G" ?, u3 s; d
  7. *   This file contains EDMA3 Test code.
    ! U. A5 R( Q# T3 q( D" l
  8. *
    / ?5 r8 C0 m+ m" y' m% ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , T- t7 O1 X; i, P/ M( ^* f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # M8 c8 q/ y4 q- F
  11. *         TO CHANGE.
    & k- Z6 ]; [/ X7 k" {; f( g
  12. *3 z6 C6 i9 \! o0 ]! S$ o! w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " l3 y& x: }! y6 r( O- v
  14. *
    : H. T6 ~' r! \9 x" W
  15. * This program is free software; you can redistribute it and/or
    + |& ]; k2 }- @/ `6 t! v& _3 N1 V3 g
  16. * modify it under the terms of the GNU General Public License as0 x( b4 ^- I0 S
  17. * published by the Free Software Foundation version 2.% t" k) m/ ]& G% w
  18. *
    1 _' f5 V1 ~% F( g1 I4 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- `8 Z/ g( z, d9 I
  20. * kind, whether express or implied; without even the implied warranty
    9 n$ ]. K" Q+ I5 W$ A5 \+ x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! k) Z3 w7 ^) H% z+ U# m. G
  22. * GNU General Public License for more details.0 v7 Q8 Z9 H0 |
  23. */
    7 i5 _( Q+ }+ T, S

  24. 4 Q( L  ~" C9 Z  e0 }9 @" _
  25. #include <linux/module.h>3 H8 C9 g  ?. t' U' p1 |  U
  26. #include <linux/init.h>- z0 l' S/ T; X
  27. #include <linux/errno.h>) v/ u0 K: f3 \# b: X' i  D
  28. #include <linux/types.h>- \9 S& O; W7 P* w4 F  f
  29. #include <linux/interrupt.h>% ^) L# \+ ^6 j( g7 \* I. W" n2 g9 Z
  30. #include <asm/io.h>. m$ C6 g$ x( w+ A  E! ^  Q3 [
  31. #include <linux/moduleparam.h>; ]; g/ L/ S% D* S
  32. #include <linux/sysctl.h>
    " Q) l- F: |8 L
  33. #include <linux/mm.h>: Z' _( V3 C$ O. X* Q; m; N
  34. #include <linux/dma-mapping.h>6 K  k5 i- J% t

  35. $ i0 V( G8 D4 x" K) C
  36. #include <mach/memory.h>( x$ v! B7 x2 V/ e+ T
  37. #include <mach/hardware.h>% o& u1 k% {5 f2 N  y' `, O' W
  38. #include <mach/irqs.h>
    2 k4 f: C6 O* ?8 T6 C/ W
  39. #include <asm/hardware/edma.h>) y7 }4 `; e$ X3 G+ R$ O# n! E7 _

  40. ( T9 L: E% B/ K% Q2 S% L1 G" d
  41. #undef EDMA3_DEBUG
    ' O$ S& K5 Q& L$ w' h- X6 z
  42. /*#define EDMA3_DEBUG*/
    7 y; e2 S3 z7 U4 g/ M
  43. , r. L3 v2 l0 B5 r
  44. #ifdef EDMA3_DEBUG
    8 u7 d% s' m3 \' B4 q3 s5 K  ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - c; |, k' Z- c+ \/ p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 D3 w$ R" r4 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 G$ g1 ~5 W: f: N8 K  K
  48. #else/ ?, C4 \$ X0 L4 F
  49. #define DMA_PRINTK( x... )
    & o# K. g" c/ x* p9 j% H! \# h
  50. #define DMA_FN_IN9 e6 i8 U+ d4 @6 f: X% U
  51. #define DMA_FN_OUT
      X$ X7 q6 E7 d; I" ~! L7 V. s
  52. #endif* O+ ]1 @, @  X0 H; C: F
  53. 6 b( [3 g- @# w) ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ {# `( B! ~3 R: E5 `) C) I
  55. #define STATIC_SHIFT                3
    " A; u% X8 t, `0 Q
  56. #define TCINTEN_SHIFT               20
    9 j+ C. q+ E6 d' q8 V4 A/ v  ~
  57. #define ITCINTEN_SHIFT              213 e1 S) Z* }, ^; x3 i7 C7 g) ^
  58. #define TCCHEN_SHIFT                22
    / |3 I4 }; i4 e9 [. k, x" l
  59. #define ITCCHEN_SHIFT               23
    0 E1 Y! t7 r9 a( l( e
  60.   x$ w6 L  i9 H9 l6 F) Z/ A
  61. static volatile int irqraised1 = 0;! k3 |6 W6 m- [8 B5 K! \
  62. static volatile int irqraised2 = 0;* [# C1 t  \! b% s: f

  63. ' j2 F) I+ H. z  V7 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ~; Q* b0 V( n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* }, o3 O8 G) K' P! k5 |0 E# L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( J0 p% ?5 \- t; p) Z
  67. + Y8 c- L. B( k' J
  68. dma_addr_t dmaphyssrc1 = 0;( X* g9 O" Y. O$ K; L( ]
  69. dma_addr_t dmaphyssrc2 = 0;& d2 W0 y7 x' C/ B- ]# S
  70. dma_addr_t dmaphysdest1 = 0;
      v9 a$ e% z- N) Y# S
  71. dma_addr_t dmaphysdest2 = 0;
    ' x2 C- ?5 }. M& @, ?

  72. 4 U+ W: r  r+ j
  73. char *dmabufsrc1 = NULL;9 W; X  C* m4 J
  74. char *dmabufsrc2 = NULL;' G- N3 j4 H& j2 J) N
  75. char *dmabufdest1 = NULL;
    % C7 X# J3 W$ _- K; w9 I9 f
  76. char *dmabufdest2 = NULL;
    " y# c1 B6 T2 M( N4 _
  77. + o  S5 R$ Z1 u4 l, M9 ?
  78. static int acnt = 512;- X4 F0 w  j! E$ `* d; ?& Y
  79. static int bcnt = 8;  S+ q# t: x7 A; a& z# i
  80. static int ccnt = 8;
    , p$ ^$ [0 f, @8 A9 r, B2 {

  81. + ~$ U% u+ ~; Z+ Y7 x; e0 q
  82. module_param(acnt, int, S_IRUGO);7 ]' n+ @/ v  Y2 E3 C
  83. module_param(bcnt, int, S_IRUGO);
    3 _7 L; j6 ~6 {: u( \% T. F9 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- B8 n: L" z: V
  m3 ?3 B# t, r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 R3 f$ y1 m# ^' ~1 c. P) Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) K- }# d. Y: ~  c: s9 G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 J$ x0 ^# o/ H' Q( `

# E3 [4 n+ |# H% }* f! L; a+ M9 K2 Q% n. ~0 E3 D& h) s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 17:16 , Processed in 0.037664 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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