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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ ^* k; V* g2 O' R7 O
  1. [code]EDMA sample test application
    / l$ j7 ]5 L5 z& c) x3 A% b- [# p
  2. /*
    . i9 j* l: y3 g4 E
  3. * edma_test.c
    9 B5 D  c& J. ~( z, \
  4. *
    ; f& |1 ]( O% O+ Z
  5. * brief  EDMA3 Test Application
    3 k: e5 A) X5 x( b$ Q
  6. *
    " y/ Y" y1 O: X- G
  7. *   This file contains EDMA3 Test code.( i: J0 a) I3 V6 f
  8. *
    , u% H; b9 @# T7 \  R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      ]( }& t: K9 y! n  z' d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " t3 }3 D3 x, ?$ r, W- i
  11. *         TO CHANGE.5 |' j4 s' g7 G& d2 T  f
  12. *% y: l6 w$ O! e; I; Q/ B+ ^. v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - D1 j0 E" B3 U9 r$ k/ ^. C4 o
  14. *6 L* D, k- E/ @5 H5 u3 k4 r4 {, Q
  15. * This program is free software; you can redistribute it and/or3 F! e2 }( J$ \7 w
  16. * modify it under the terms of the GNU General Public License as
      s1 G2 b+ a: `2 H, p! E) m; C( l4 v
  17. * published by the Free Software Foundation version 2.$ `0 ^( Q# [! D" A/ A# q* m
  18. *6 ?0 w; k) @2 k; n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 O6 A2 Z- {7 S0 y" _
  20. * kind, whether express or implied; without even the implied warranty/ m' l/ m" a! x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' w" S$ M& W1 ?( J' K) ^% k6 V) H
  22. * GNU General Public License for more details.
    4 }- C7 M, e$ |) {5 U5 Q
  23. */. Q5 X( l+ |" c* K$ l0 w& @
  24. # Z2 ~- l0 g, V5 U
  25. #include <linux/module.h>  E1 o) E$ ], O% p4 C6 W/ z" |& r: g1 |
  26. #include <linux/init.h>
    3 _& J8 K+ X/ p, t6 _7 p
  27. #include <linux/errno.h>  n" o9 [8 a& {" ^
  28. #include <linux/types.h>- G' n! N6 k0 A1 ?
  29. #include <linux/interrupt.h>
    9 W# }3 j5 `& t: l9 A) O# R
  30. #include <asm/io.h>
    " V2 t( D  W/ u. b
  31. #include <linux/moduleparam.h>( y; {, m/ x/ l# m1 ?6 H9 x
  32. #include <linux/sysctl.h>
    " l, S3 S" P& E( j* j1 L  L! w
  33. #include <linux/mm.h>1 S* D8 ~/ a4 D5 e
  34. #include <linux/dma-mapping.h>3 ]# k8 T2 t4 ^7 Z, Y! H1 ~) |. _! \

  35. 1 H+ `* C6 E) M2 u6 T) ^) [9 w
  36. #include <mach/memory.h>7 m+ w  C; z$ q+ n2 `
  37. #include <mach/hardware.h>
    / \0 C' I% h$ [4 h& x
  38. #include <mach/irqs.h>
    ; i0 Q$ G4 O+ a! S- @
  39. #include <asm/hardware/edma.h>- W. I, X( x2 C

  40. & ~2 r6 }+ O& ]* b
  41. #undef EDMA3_DEBUG; P0 ?( ?. `# i4 ]2 u
  42. /*#define EDMA3_DEBUG*/
    1 d; L' y" _0 l$ b! C* m  t
  43. : q# S8 b- k- i3 ]
  44. #ifdef EDMA3_DEBUG9 m7 W- s& J! X+ }& W2 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! [# l0 u* H) S- r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # k+ e! @- U7 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): ]" D& o0 i" s6 U
  48. #else
    * h; S+ [9 S' [4 ^
  49. #define DMA_PRINTK( x... )6 e, H- w: _/ e$ }7 p) ]: t
  50. #define DMA_FN_IN6 D  ~9 o9 E5 |4 B9 @
  51. #define DMA_FN_OUT
    2 C$ ~. [* a: @+ {2 C1 _# K
  52. #endif9 ~* t& ]% N: S9 U8 r: s4 e( W$ ]: s

  53. ( d5 U4 c( y0 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' e/ T/ Z( K6 L$ @+ F
  55. #define STATIC_SHIFT                3* I9 |9 p8 V2 C5 Z4 U$ u
  56. #define TCINTEN_SHIFT               20( i  |( q. ~+ @2 k
  57. #define ITCINTEN_SHIFT              21
    . [& g# d  P9 e
  58. #define TCCHEN_SHIFT                22
    + o0 c$ f" W* F
  59. #define ITCCHEN_SHIFT               23
    1 y  W% C! |5 s0 t# Z

  60. , t9 B# `1 I+ }" `* G4 H
  61. static volatile int irqraised1 = 0;2 f/ `  f6 E" J  J# `, g+ V
  62. static volatile int irqraised2 = 0;
    # q7 ~) r2 P% I" N9 p6 V4 b4 L/ ~, h
  63. * w) b" N6 H+ R! l7 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : v( M* P( t9 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 k' ~; w( M* K0 {8 ~& `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ^$ M) z6 K9 u; I
  67. 1 |" l" c3 h5 k8 f6 i8 o: _" \  _9 t
  68. dma_addr_t dmaphyssrc1 = 0;9 u; u. X; ^( L( C" o5 F
  69. dma_addr_t dmaphyssrc2 = 0;
    * u# W$ `+ [4 Z6 }4 g
  70. dma_addr_t dmaphysdest1 = 0;0 i5 O# J2 K& ~$ C1 O1 G+ T6 k
  71. dma_addr_t dmaphysdest2 = 0;9 q* \. Q1 R* k) H0 x+ @
  72. ! X. u" K. Y) a  k4 E3 D. n
  73. char *dmabufsrc1 = NULL;: K8 N! s. [! ?
  74. char *dmabufsrc2 = NULL;
    ; }: ]* F& r1 T3 A' W: X8 t
  75. char *dmabufdest1 = NULL;
    / K7 q$ w# o' W
  76. char *dmabufdest2 = NULL;/ o* X) ]( y: X( b) @
  77. 7 S) [7 y: H; O, i" X
  78. static int acnt = 512;
    9 D8 @2 W( N! K! |, x8 R
  79. static int bcnt = 8;
    ) u& }& f5 E# f) A
  80. static int ccnt = 8;
    1 a7 [- m) K! A+ N& k4 \( T

  81. . M% m4 M* w: Y: |6 Y  ?
  82. module_param(acnt, int, S_IRUGO);
      b8 j/ k) d9 o
  83. module_param(bcnt, int, S_IRUGO);
    : ]7 o  G. [7 e/ i5 w$ N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, B, n  g5 k$ ]% m8 I+ R4 y  ~' B2 _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  }) ?3 f* E7 b; V$ M9 ?& v6 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ k  ~# O7 N& s+ X; f* R+ W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 L- p5 O3 t3 q. i* T# {& z4 Q: x: \
8 z( J7 R# t$ g, c4 a1 v1 I; c
% b( R6 _8 O$ l6 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 17:43 , Processed in 0.037317 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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