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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( W7 W/ p( H4 \3 r
  1. [code]EDMA sample test application5 c* r8 Z1 N$ B! D6 I( `7 K( B
  2. /*
    # P& I: L# l# f2 M- i
  3. * edma_test.c' x2 I! _/ W. W: G8 B$ i
  4. *
    . d( {7 t2 {, U; `' u
  5. * brief  EDMA3 Test Application
    6 R  _7 y& `0 f( e# F7 u
  6. *& q5 N1 y, U% }
  7. *   This file contains EDMA3 Test code.
    0 H( w( D- @  z% q( h
  8. ** C) x1 l- @$ ?4 ]' Q1 Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" _+ T- ]' H3 a( m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 z' p1 D( b% m9 c* a% T
  11. *         TO CHANGE.
    - O0 A8 d; W) k/ \* a- X/ E: L
  12. *
    + q* x8 f8 A6 C- T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( w7 [# z. n7 F. h0 }. U8 N
  14. *& _- {/ N( _5 k7 v! G
  15. * This program is free software; you can redistribute it and/or
    $ F0 E) [, M) {/ ?- X
  16. * modify it under the terms of the GNU General Public License as- Z1 ?/ P5 d( }& I4 ~6 h
  17. * published by the Free Software Foundation version 2., g0 z) I/ X- b9 ]$ V
  18. *
    * ^4 b7 k( |! _1 k8 J) R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" A& a! L0 m* t7 h/ H4 O7 m% B2 {+ W
  20. * kind, whether express or implied; without even the implied warranty; l1 s+ g0 P4 E2 [4 z- g" m4 [& r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; W; c* i7 s# U5 J
  22. * GNU General Public License for more details.5 N. H& f4 W# R* s3 ~  N7 o6 z' |0 q
  23. */
    7 a3 e2 a3 L8 l3 w3 O( D
  24. 1 ~( w7 n# K* q+ s
  25. #include <linux/module.h>/ d5 e0 |0 X0 M3 Y% ~- T
  26. #include <linux/init.h>
    " V, f) p, H& o/ B, _
  27. #include <linux/errno.h>, a) F) O) u: q* N3 C0 p1 S/ v
  28. #include <linux/types.h>" f' E) {. T8 L3 V; P5 R( ]
  29. #include <linux/interrupt.h>
      Y; ]0 y: G0 @/ ?6 b
  30. #include <asm/io.h>
    8 G0 T; T8 N2 o* K
  31. #include <linux/moduleparam.h>
    : w4 J  P8 `. \! l( n5 s0 R
  32. #include <linux/sysctl.h>5 F3 {& }3 c2 i2 C; o# G" n- J
  33. #include <linux/mm.h>
    + w9 J" U# Y& e* i1 J; W
  34. #include <linux/dma-mapping.h>
    / C1 g, n# `# P  }& O+ n+ \, a
  35. 8 F1 i* m  U6 [. i
  36. #include <mach/memory.h>
    & I  v: @$ N0 @/ b! X9 E: N9 S
  37. #include <mach/hardware.h>, ^  t9 k1 v8 S3 B, K" |
  38. #include <mach/irqs.h>% @2 v. I9 f( t+ c- R8 V
  39. #include <asm/hardware/edma.h>2 R: ~3 B# s: V# `' T
  40. : W% [3 ^5 \4 }5 ~
  41. #undef EDMA3_DEBUG- S/ ?9 g1 I& C7 Y- N
  42. /*#define EDMA3_DEBUG*/4 g9 g' u/ L- y$ k, c: n6 N

  43. % Z5 B! S# P1 E
  44. #ifdef EDMA3_DEBUG
    5 [3 d' {# n3 K& ]& ]4 O2 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # K0 J1 k0 h/ L) N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; _, C+ s$ ]; l1 g: j# A0 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ u7 e" y4 P8 w  T. G* g4 |/ i; g
  48. #else
    , S8 l  ?2 |! `, r3 d
  49. #define DMA_PRINTK( x... )6 A: |3 {. B4 c5 n4 ?& l/ l
  50. #define DMA_FN_IN
    1 h& s( i( W0 n1 @+ e
  51. #define DMA_FN_OUT
    6 M( r, x& T  ^% f0 M) ]
  52. #endif' S9 o  C0 ?$ c

  53. . r7 s. N1 i. [/ f/ R/ J1 q' [# Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % W  A( B# \. t2 \' z
  55. #define STATIC_SHIFT                3
    - _6 j, W/ _" @( E) U
  56. #define TCINTEN_SHIFT               20% {9 \. F: n+ e) B+ l) ?3 `
  57. #define ITCINTEN_SHIFT              21
    ' y8 D9 u' f! E0 a9 R) _
  58. #define TCCHEN_SHIFT                22% Z7 l0 F/ z* i
  59. #define ITCCHEN_SHIFT               23
    5 v3 u; A. k7 `. T5 |5 b) i

  60. ( y  N3 I$ [+ M. C4 o
  61. static volatile int irqraised1 = 0;
    " f, C2 Y" ^. Z& d( E: x0 Y, z
  62. static volatile int irqraised2 = 0;( B, Q1 T6 S& {

  63. : b" Y0 l9 s- Z" x5 e% ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 M, I& w, |" s: N4 u, g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & M+ r' J; `" c2 Y2 F+ R$ Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ s3 ?( p4 n/ S  a( Z

  67. 2 i# r: [8 Z1 b4 ?" [& g& Y
  68. dma_addr_t dmaphyssrc1 = 0;
    0 R( E  U7 K3 f8 I1 l9 i; U
  69. dma_addr_t dmaphyssrc2 = 0;& q! t1 a: B# t& Z& k) r
  70. dma_addr_t dmaphysdest1 = 0;0 n$ K: U8 C1 X' D, {0 @
  71. dma_addr_t dmaphysdest2 = 0;
    3 N6 J0 a" b$ b( v
  72. # z' I% Q4 z0 s) [" I' b: |! w
  73. char *dmabufsrc1 = NULL;9 D( i% _6 j& M7 y
  74. char *dmabufsrc2 = NULL;0 X# e0 g: H! j: _. s( R* p# N) W
  75. char *dmabufdest1 = NULL;
      I: n: C# \5 T4 T8 x
  76. char *dmabufdest2 = NULL;0 b$ T) N; ^4 i9 }7 j0 |. w$ y7 a, S
  77. 6 Q4 K' U2 v2 [" [! z+ [% ~4 ]
  78. static int acnt = 512;/ f/ L( l1 H- l( W4 d
  79. static int bcnt = 8;# I, c. x! o4 K1 a0 z! N0 \+ v
  80. static int ccnt = 8;
    % v5 i' o9 R9 r5 _+ U) n

  81. 5 B  Z% q! b! d; w, J  Q9 e
  82. module_param(acnt, int, S_IRUGO);$ l: w6 p$ H. b  D  l7 B0 v! ^
  83. module_param(bcnt, int, S_IRUGO);
      a3 {. Q0 Y# |9 E- H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& J# x% W* c  o9 h* p  ]( ?; f- h! r7 N+ F2 z0 T3 p# p0 W# s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' @8 a; v# P8 U$ X. t3 D7 }5 {- @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 q+ I, f; W  P9 f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- ~4 n6 |0 o8 j4 s  z/ S+ E8 {8 O: b  O" R5 b8 |
9 [+ m; m( N  q0 x  h3 |( f+ `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-23 19:38 , Processed in 0.037609 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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