OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 j6 ]7 v7 Q: |0 X" w" S
  1. [code]EDMA sample test application' X( t8 w2 J/ j5 _4 j+ F
  2. /*
    7 [; N, y( r4 Q+ |( A( |
  3. * edma_test.c
    + O4 b6 Q% `! {5 C" U
  4. *
    6 m. k9 Y& T8 V& B$ G
  5. * brief  EDMA3 Test Application
    % V0 `& p, i! f* V$ n6 f
  6. ** d. C6 T- I# h8 \1 [$ H
  7. *   This file contains EDMA3 Test code.- K; u$ }& ^# V6 P
  8. ** S9 T4 J! U4 h2 t, z- k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 ~$ ?* j, j; A5 X4 g% b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 ]8 _9 x; j& W
  11. *         TO CHANGE.
    0 K  E/ `. \& n( o
  12. *
    ' ~- J8 X" D5 g0 G* l2 ?1 B( A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " ~& Q3 B8 t$ i" y2 O" {9 D
  14. ** E( t: l( p0 |' F% Z, o8 |
  15. * This program is free software; you can redistribute it and/or
    # Q" B" F6 i3 p0 A
  16. * modify it under the terms of the GNU General Public License as
    0 r+ j! ^# l) x7 [9 r- t
  17. * published by the Free Software Foundation version 2.
      k: i: c2 }* [0 I: Y# Y9 D
  18. *
    & m+ P0 x/ u, _2 d; D! L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! r) ^. I; x  H3 B# N4 l- s0 z0 a
  20. * kind, whether express or implied; without even the implied warranty
    & u9 w) g! S# z5 `7 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- }* n+ Z# j8 R) N. g' S9 A- K
  22. * GNU General Public License for more details.
    ( b. T" J4 y' i2 W1 O
  23. */: ?6 ~. t) [5 x6 f5 S8 G. F
  24. : f* T5 L+ c7 w& R3 |  J$ ]
  25. #include <linux/module.h>
    1 Q: H3 y. K* f
  26. #include <linux/init.h>
    3 S. F7 g3 A+ ?* y
  27. #include <linux/errno.h>/ M" B* t( @8 Z8 n+ Y
  28. #include <linux/types.h>2 B& h# Z/ j2 V; ?" K
  29. #include <linux/interrupt.h>" S5 \) A7 ~( w
  30. #include <asm/io.h>& _5 C2 c4 A5 ^# k# d* }
  31. #include <linux/moduleparam.h>. J; @5 F6 L7 r* E3 ]8 o( |' D+ ?
  32. #include <linux/sysctl.h>
    ( F  z# m# ~/ _7 p+ s* v
  33. #include <linux/mm.h>, D2 c, O* q3 _8 z- \  Q/ h
  34. #include <linux/dma-mapping.h>
    3 E! X5 X% n4 [0 ]3 [& d8 Z9 K

  35. 9 l3 ^( \, L( i( l/ g) A, O
  36. #include <mach/memory.h>% p& V- A& S. d- U$ D
  37. #include <mach/hardware.h>
    . Q9 B3 a0 [' T8 P  V- ?
  38. #include <mach/irqs.h>) h7 \- l4 ^/ A* z* p. i3 s4 ~; {
  39. #include <asm/hardware/edma.h>
    8 Y) a- e8 Y; j* b) @$ S

  40. ! t: `) S9 J" V+ L" h7 \/ [( L
  41. #undef EDMA3_DEBUG1 s- N; E# [, j+ n- t; B. }
  42. /*#define EDMA3_DEBUG*/4 O: V% {% J7 f3 }3 J) r

  43. 2 O$ N7 |3 i8 s  E( y: T
  44. #ifdef EDMA3_DEBUG
    - d# y0 s( l! X- z% C8 e8 }7 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! S# p" u2 L$ L: T& |5 i, F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " y3 J; [6 y1 l4 Z% T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 N0 `$ Y+ V, X
  48. #else
    ) t6 s6 r2 k0 m8 K" P) W
  49. #define DMA_PRINTK( x... )( o5 T& t& [" H8 z1 X
  50. #define DMA_FN_IN: [$ ~8 F3 E- {$ |1 Q
  51. #define DMA_FN_OUT7 m, W1 s5 n0 C. c) d. c6 Q
  52. #endif
    ' y: l) s0 z: r/ i
  53. : B7 L4 V: G# g# p2 n7 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 y8 F% J0 n7 ^: W+ K( \. \
  55. #define STATIC_SHIFT                3# [# d( N  ]  A/ E0 i
  56. #define TCINTEN_SHIFT               20# @4 c: n% U$ d" C. s% f# l
  57. #define ITCINTEN_SHIFT              21
    " p, E/ U8 z! `; g& F( m( j
  58. #define TCCHEN_SHIFT                22- [8 k: C+ g/ B5 K- M
  59. #define ITCCHEN_SHIFT               233 Q) k' y  p- h) ~% R
  60. ! u8 k0 O4 G$ B! g
  61. static volatile int irqraised1 = 0;
    3 s* e/ x! M8 f, K$ o
  62. static volatile int irqraised2 = 0;) {1 S( ]1 y# s# k7 @
  63. ( \( P2 M9 v( r- w# i9 ^6 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 V2 B% V; `1 _& l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* j& H3 }. `4 Q3 J* @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- m$ D4 A6 f) {! s& i; t9 q

  67. ; N/ `/ V: r  V$ ?
  68. dma_addr_t dmaphyssrc1 = 0;; s& A* ?3 Q" p$ O
  69. dma_addr_t dmaphyssrc2 = 0;
    : e0 r, G+ N. B. i
  70. dma_addr_t dmaphysdest1 = 0;
      h2 y- G  ^$ P& y
  71. dma_addr_t dmaphysdest2 = 0;/ P: p8 ?/ q' S5 d+ j9 h
  72. 3 a% z" ?* C$ L) ~7 m
  73. char *dmabufsrc1 = NULL;0 a9 J" Z4 F+ Z* G4 A* P* d7 B
  74. char *dmabufsrc2 = NULL;
    . s6 t$ l# Z* |' H$ c% Q; u
  75. char *dmabufdest1 = NULL;
    % o6 W" m2 O. V! S. n) l
  76. char *dmabufdest2 = NULL;
    7 H4 |7 ^( w- A

  77. 7 u* ]0 D* S# |1 C/ A4 f& U3 S  ]
  78. static int acnt = 512;* `  Y' Y! L5 p' p( j! j6 ]* n6 U
  79. static int bcnt = 8;4 n  s3 {9 ^/ b  Z- n1 q
  80. static int ccnt = 8;& [; h5 F+ N* ~$ p0 u

  81. 6 V, o# w# p1 f; z. A
  82. module_param(acnt, int, S_IRUGO);9 _8 ]7 K1 n6 U  b0 j9 t8 T9 t0 k9 P
  83. module_param(bcnt, int, S_IRUGO);
    ' X0 H' F3 p# b' b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 G- ~! ^7 n! G. D7 T# O' R! f! N% N, H0 f- G6 R5 l) \9 |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 J1 K6 Q6 k( t$ m9 f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* z- I0 V& Y9 Y3 K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 B$ s# n# ?3 S3 C6 t0 T3 U; q! p

; M% z8 j! p! @8 {9 [9 R' I5 M; T9 M+ n' P+ P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-19 06:34 , Processed in 0.036904 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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