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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 W$ p; M% J; X6 W
  1. [code]EDMA sample test application
    ! D( _; }" R( P. S1 s1 g+ l
  2. /*5 z3 ^) P( P) y$ K" S) N! E
  3. * edma_test.c: s3 M+ i/ L" G/ k
  4. *+ w# W5 q( ~- V+ e; W% A" b
  5. * brief  EDMA3 Test Application
    # x, K+ Z  u  c. O
  6. *9 S! w8 b0 v, m/ H% O9 _
  7. *   This file contains EDMA3 Test code.
    5 b2 l$ d* s3 i# F% Y+ D% p
  8. *1 Q1 ~' _5 E3 {5 u4 s% {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 ?: S, _& [. W7 [7 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . B+ @, ?0 d% Z# o/ H/ S* p3 M% D0 k
  11. *         TO CHANGE.. g; }) f6 y: W: _
  12. *
    : A: H/ i7 Q" {8 O: U, q. m7 ]8 s* A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 ~9 H2 F0 b$ R6 {* t
  14. *
    7 a0 P: \. B0 G- O0 z) O. Q3 v
  15. * This program is free software; you can redistribute it and/or
    $ G) o+ o2 ]$ W
  16. * modify it under the terms of the GNU General Public License as
    2 y3 j8 K4 x9 M" n4 o3 z
  17. * published by the Free Software Foundation version 2.; p7 h6 c0 E2 f+ A' k
  18. *  J7 B' J) i4 m0 T3 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! g. s% C1 t$ p
  20. * kind, whether express or implied; without even the implied warranty
    / {9 |0 K7 w& V" |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 P0 Y) C/ |+ w) y1 M
  22. * GNU General Public License for more details.
    5 E' ?: W+ }$ B6 a4 u. m0 `5 m
  23. */1 u, ?1 f0 a$ b) r, ~% ^2 ]

  24. ! ]# U8 @# v/ B% p; e' \4 `
  25. #include <linux/module.h>1 F9 d9 R8 X" V7 Z3 P6 t
  26. #include <linux/init.h>
    3 M2 H: m+ |3 h5 Y, l8 O% V3 M0 w
  27. #include <linux/errno.h>
    9 G$ a5 L4 n- p) `+ T
  28. #include <linux/types.h>
    # W! {1 l; k/ v2 @' F8 l9 |. x
  29. #include <linux/interrupt.h>
    / y) L9 g4 C8 J- i# [; ^/ |  b
  30. #include <asm/io.h>
    0 w9 [) C# c: p. d
  31. #include <linux/moduleparam.h>
    0 ?5 a2 t9 d. a. |' i4 Q% w
  32. #include <linux/sysctl.h>6 T$ d, r; K2 j2 A0 T/ P
  33. #include <linux/mm.h>
    2 t3 R) L- E% q# p
  34. #include <linux/dma-mapping.h>/ I4 ^) j* _' I7 d
  35. 1 x7 `* l* F+ s' ?4 {2 `1 l' f
  36. #include <mach/memory.h>
    # U9 @6 V) s2 U: K
  37. #include <mach/hardware.h>$ j' i$ Z+ D) v: u! J
  38. #include <mach/irqs.h>
    6 l' u2 p' C2 G2 S& a
  39. #include <asm/hardware/edma.h>5 }  ]9 {& `4 `9 e% C" P6 ?, ?

  40. , c; a! |7 i3 _$ V. q- E9 {
  41. #undef EDMA3_DEBUG2 }. O& O! x' g  h- J! I' E1 h
  42. /*#define EDMA3_DEBUG*/% m, Z7 v% j( n3 l! u

  43. 1 r6 v8 p6 t8 x: Y
  44. #ifdef EDMA3_DEBUG
    8 l6 _- H! u. Q& ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 b: F4 ?; J- e4 m9 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , r8 E7 E; e& b; x1 j8 a9 V  Y  T- d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& y2 r  n' @5 W1 H' _+ v
  48. #else/ Z! I; `! J/ |) c
  49. #define DMA_PRINTK( x... )
    ) S$ h+ q  B. U8 g
  50. #define DMA_FN_IN
    # R- O& B0 k; m) F
  51. #define DMA_FN_OUT
    ' Q4 d8 D% u: a5 s& f& |
  52. #endif
    . y6 g3 l7 ^' ~2 |% c
  53. " J! u" e; `0 P; Z: X& X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 [- Q2 S) Y5 Y- R
  55. #define STATIC_SHIFT                3* C6 T+ s) W2 y7 n1 j. F2 H! m, f& |3 I5 E
  56. #define TCINTEN_SHIFT               207 R9 {/ v& X* o2 s- Y/ P
  57. #define ITCINTEN_SHIFT              21
    # i+ i  S3 A( x7 h- \9 m# T
  58. #define TCCHEN_SHIFT                22
    ; d  E1 m8 _/ F1 X
  59. #define ITCCHEN_SHIFT               23
    . p0 q* i9 |0 ^0 c0 f0 x; u$ n- \

  60. 1 d* ^6 y/ u: f( S
  61. static volatile int irqraised1 = 0;% m- \; D! v7 \; ?- y( X" P& i3 z$ X
  62. static volatile int irqraised2 = 0;
    9 L2 J' A+ [1 ^7 I: b- `
  63. 9 X! ?$ @4 n7 P- i4 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , p  a5 Y8 Z" r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      v$ E) _8 n4 N. r& v3 f( g" ~+ c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # {% {( L2 s3 Y3 t! ^% W8 z0 K
  67. & s6 h( u' U5 Z, s- Z) X/ B0 B' h
  68. dma_addr_t dmaphyssrc1 = 0;
    ) }& M+ E. y+ }& V8 S0 {
  69. dma_addr_t dmaphyssrc2 = 0;. d% O& t6 m! [5 f' n  _
  70. dma_addr_t dmaphysdest1 = 0;6 k: T1 b# g# R6 I( G9 z. f" `
  71. dma_addr_t dmaphysdest2 = 0;
    : `! p6 h5 t/ y0 d  t+ z
  72. 2 E( x: V+ H. y4 V$ V. p  H
  73. char *dmabufsrc1 = NULL;# F- L6 \1 F, r* B, L( E
  74. char *dmabufsrc2 = NULL;0 w0 u: {& X8 _$ B; E3 V
  75. char *dmabufdest1 = NULL;
    + c% J3 c" o$ E
  76. char *dmabufdest2 = NULL;2 R" m2 u, }; y% o# N
  77.   z  {0 q# s2 S6 L
  78. static int acnt = 512;
    & Q" A9 M0 B" h
  79. static int bcnt = 8;9 Q$ O) w1 {/ M0 f) K
  80. static int ccnt = 8;9 U" @6 Q& M) B. O& b" e

  81. $ w- K0 G/ ?3 |% n9 x
  82. module_param(acnt, int, S_IRUGO);
    # g. v/ Q: I. @" z
  83. module_param(bcnt, int, S_IRUGO);
    6 d0 C) Q1 d5 H+ h. Y7 u# i- P2 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 \' _7 g5 T( w' R
: d$ R7 D# a+ U+ E6 t3 ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 e0 a% b0 P+ h* p% N8 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- _4 ^6 v$ e" h4 K/ Q) N, Q: Q) I6 ^3 Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& S) n" ]$ b) Z9 k6 C

: D4 F, J6 K; j& N8 m
" |( n/ ~- D" w8 D0 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-5 04:40 , Processed in 0.041826 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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