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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  S+ Q/ K( J8 q1 o# ^
  1. [code]EDMA sample test application' T4 D0 Z& L4 m
  2. /*$ H% R% F! u8 o
  3. * edma_test.c
    - E1 L. q! t  q
  4. *
    - f( a- P+ e  ?, r
  5. * brief  EDMA3 Test Application
    ! l' P7 Z+ v& Z1 W4 ^
  6. *1 w7 Z9 y9 d% V, ]
  7. *   This file contains EDMA3 Test code.- `& G0 Z& [5 W: O
  8. *4 K2 M' O+ T/ i1 L1 U/ a5 i* g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , {; L$ x; t$ v* T# y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 M' E2 I# [5 n8 v8 }# \
  11. *         TO CHANGE.
    1 j: e8 J! j+ u0 F" Q
  12. *  E$ Y6 S8 n' |$ _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ R# E+ [5 ^& u! p5 b
  14. *8 l" B. K- v2 T
  15. * This program is free software; you can redistribute it and/or
    $ M) f% _4 }9 i
  16. * modify it under the terms of the GNU General Public License as* i' k6 w, b4 h- t( {# x
  17. * published by the Free Software Foundation version 2.
    - g- r- }3 H; U  c. M) i
  18. *
      d" Y9 S  x0 m$ p8 h, a+ |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % [' m8 X4 Z- W0 j5 n
  20. * kind, whether express or implied; without even the implied warranty. P4 h+ l3 [! Q6 P9 k+ ~& P8 m! v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! W, z" H5 ?/ R: R$ l% O
  22. * GNU General Public License for more details.
    " E4 R9 \+ p( z0 k: X
  23. */( h- E# J6 L. g' p' {

  24. ( b! a3 n- v& O" q2 l
  25. #include <linux/module.h>* Q9 v1 O1 O! _  |. I3 G, V! D
  26. #include <linux/init.h>* t' O+ t* c+ f, N' W4 x5 q2 ?
  27. #include <linux/errno.h>% ?/ _) i- `1 A2 a  J& u
  28. #include <linux/types.h>
    6 P3 U5 D5 p2 ~) {9 p
  29. #include <linux/interrupt.h>
    . q7 ^, Z+ N  Z  V1 v7 J9 K( T
  30. #include <asm/io.h>& o$ m/ X4 g' }) b1 }
  31. #include <linux/moduleparam.h>& ?5 e  a9 E5 {: C
  32. #include <linux/sysctl.h>/ e" e3 S) Q) N+ S
  33. #include <linux/mm.h>
    " v5 n* T) B0 g# a. K6 X
  34. #include <linux/dma-mapping.h>& b. J! i2 F+ ?: _; K' U5 W

  35. " o  P' n$ x/ v' D8 l3 q$ n
  36. #include <mach/memory.h>; \: J! Y3 A4 B& h5 x
  37. #include <mach/hardware.h>
    & E+ S( g! Y+ z) e$ g9 f; S& t
  38. #include <mach/irqs.h>
    : W6 L: q2 P9 `* l. |5 H
  39. #include <asm/hardware/edma.h>" C6 D, U4 N) q3 M/ K. ~

  40. $ M' ~  ~7 G6 ?" v# r- F# @
  41. #undef EDMA3_DEBUG+ ]( C- D8 M/ ?
  42. /*#define EDMA3_DEBUG*/7 R4 @) F+ K1 w) M  t) b
  43.   d( D& `' C. K0 e
  44. #ifdef EDMA3_DEBUG4 a) C* D& p( u6 S7 b+ V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" M: A! e. x; [& z1 a- F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 m! m+ e$ q& |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 |3 p. l( _7 Y& T0 O6 O
  48. #else0 u' @6 \- B& t  E( G0 ~4 ~$ W
  49. #define DMA_PRINTK( x... )
    6 B7 H1 _# j9 F# Z# i
  50. #define DMA_FN_IN
    " b5 U; E+ B8 b* x; m& s) e* d
  51. #define DMA_FN_OUT% Z6 |/ A3 h6 {! f# Q0 |; ^5 K* G+ c
  52. #endif
    + S) {' O3 t+ ^/ k& A
  53. - s- p% M. M2 Q' Y! L3 D  v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( K7 Z6 R, m" e& O
  55. #define STATIC_SHIFT                39 Z6 i8 u% z/ G# p4 ^. \' V5 @
  56. #define TCINTEN_SHIFT               207 I! O. p3 ?- x5 E( \$ }
  57. #define ITCINTEN_SHIFT              21
    / }- v- C3 A' w1 {$ P
  58. #define TCCHEN_SHIFT                22
    6 X1 a+ m3 N. z3 a+ r6 C
  59. #define ITCCHEN_SHIFT               23; `/ U' F4 H. O1 o5 P3 u

  60. ) [& U9 S, i5 h. b# h
  61. static volatile int irqraised1 = 0;) ~3 Q1 Y6 ^  ^* s5 O3 L
  62. static volatile int irqraised2 = 0;
    + F1 P% n* z0 \7 j# r  M

  63. % ]0 O9 J  B" L9 @; n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' [/ Z& U  K) y2 Q: }; H) q8 a# e! m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - p6 j4 N' t3 ]( v. U) x6 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      K* i! A* R' N/ o8 p( o# O
  67. 5 k5 C- |, ?4 t5 g7 Z
  68. dma_addr_t dmaphyssrc1 = 0;# Z8 _& T$ W1 m# {) }
  69. dma_addr_t dmaphyssrc2 = 0;
    0 E- w3 E1 m) B9 T; F
  70. dma_addr_t dmaphysdest1 = 0;7 S1 h6 v& W+ a
  71. dma_addr_t dmaphysdest2 = 0;
    4 O3 T  |- a. F
  72. ) D; [4 V, h* m& M
  73. char *dmabufsrc1 = NULL;
    3 }2 Z. U# P) [, k
  74. char *dmabufsrc2 = NULL;- j* O- M; P3 C4 w- x
  75. char *dmabufdest1 = NULL;  z& A1 j6 \  ^8 ]
  76. char *dmabufdest2 = NULL;
    4 s5 d8 o* k9 ^9 }9 {8 U% A  Q. M7 z
  77. ; |- ~2 b$ g1 D& m( w/ O% Y" G
  78. static int acnt = 512;
    " @, C$ S- E+ |, U
  79. static int bcnt = 8;7 s8 M6 _4 M$ k5 j, x
  80. static int ccnt = 8;
    1 P% D' q3 R. W/ I
  81. 1 G: T- E- g- R7 i+ s4 _
  82. module_param(acnt, int, S_IRUGO);7 S. m$ [8 O% m  w/ P  K5 x
  83. module_param(bcnt, int, S_IRUGO);+ P6 V- a0 V' e# s7 R7 o% k- ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 Q& \  [" U+ e& p! ?) U, P

9 g4 ]2 E3 [" G0 o- C" N; e6 R, J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: X* F: _; s0 u2 T. Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 J# L* O& |* ]1 ^$ \9 O3 m8 Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" s9 I2 s, y' d- [% j; |
* U% |& w* z" f& F- S
2 i0 n) d+ g$ n) o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-29 09:03 , Processed in 0.039299 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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