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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! v1 L; T0 x: o" I& ^+ y
  1. [code]EDMA sample test application
    9 p# T. `2 q9 @" `8 \
  2. /*
    3 ^8 U" @, A7 ~6 Z( M  G. Y
  3. * edma_test.c
    , \: J! O* Y8 S" r  k" ?
  4. *
    7 L. ?, ?+ z. j3 Q! J
  5. * brief  EDMA3 Test Application5 o1 L$ o' z$ D+ |1 D4 p
  6. *# x2 C: m$ t; f9 ^+ K
  7. *   This file contains EDMA3 Test code.; _5 j3 P4 \( m1 y6 K. T
  8. *1 i  q; X4 @0 Q) @# f: `/ d- [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; u5 t' h! [5 s5 V2 s$ k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " Z! Q2 A8 C7 ?7 J5 h; l
  11. *         TO CHANGE.. x- Y# q6 h% K& s0 q8 K2 L% C
  12. *, r- L  U8 ?" \3 O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 t( M9 }$ |. q2 `" n7 R9 D& F) h$ n
  14. *
    # O* \# A8 q- x
  15. * This program is free software; you can redistribute it and/or* r- T: x# w( M' D4 ~
  16. * modify it under the terms of the GNU General Public License as. i( I" U" P# V& i1 W( ^
  17. * published by the Free Software Foundation version 2." E. R. o6 R  }% w, C8 m. r' _3 p
  18. *
    5 N& Q: x8 a' ?) O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. s! m# N$ \0 P' {
  20. * kind, whether express or implied; without even the implied warranty8 @, c. }& F" M7 d5 }' \+ ~9 n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( g4 C0 e$ H$ c/ n  {
  22. * GNU General Public License for more details.
    ; m! v5 T- g& R2 c$ B0 w  J
  23. */
    % i+ L; ]# {) ]* u8 L# z  d: M

  24. , @( v# a1 v. W5 _2 }5 m
  25. #include <linux/module.h>9 X7 b0 V7 ?- U5 \, V) O
  26. #include <linux/init.h>  U* v- _* y+ b  K2 Z
  27. #include <linux/errno.h>
    ' S3 |5 I0 E5 W0 h, h+ w
  28. #include <linux/types.h>
    1 J( ~; D/ X. q8 ^5 a
  29. #include <linux/interrupt.h>
    2 M" L# S% m, a6 a3 n) Q+ n" i, b- ^/ ?2 g
  30. #include <asm/io.h>9 Q! B9 a& F1 L. n4 z: N5 F
  31. #include <linux/moduleparam.h>6 J1 n! R0 K# @- E" S8 K) D4 }
  32. #include <linux/sysctl.h>
    % u. q2 H; C* L5 ^1 i! B
  33. #include <linux/mm.h>
    ! ^8 \# b- @% E$ `  d1 O/ s
  34. #include <linux/dma-mapping.h>
    1 f5 ^6 R" k( @5 c* @

  35. . _6 m/ P1 N. f# l# c( X: {* d
  36. #include <mach/memory.h>* Y7 m( ~4 E- {# r& P" ]
  37. #include <mach/hardware.h>
    / i/ K/ k3 o5 x( C9 S. R
  38. #include <mach/irqs.h>6 X/ p6 {+ m9 Q
  39. #include <asm/hardware/edma.h>9 D* Z9 C2 G* a. L4 Z& {3 `/ I
  40. - y( k) S* [! `$ ~% I3 u
  41. #undef EDMA3_DEBUG( D* }, z  k- ~) u: ^; F! D
  42. /*#define EDMA3_DEBUG*/4 _4 a1 h& p5 B9 H. o

  43. 7 S2 e- p% {  O0 O5 F5 a
  44. #ifdef EDMA3_DEBUG
    # s% n( R! F" l% |# J8 z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 p% h# p% v1 D& J1 \9 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . n9 k4 S3 P- X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 |6 V$ Y8 y' c/ S
  48. #else, n7 u0 t7 |# q& d# N2 N
  49. #define DMA_PRINTK( x... )" K* k- m9 a, D+ X5 p
  50. #define DMA_FN_IN
    / `6 I( _- i- I& X4 [4 V
  51. #define DMA_FN_OUT& Q/ U' Q0 N5 n9 [& W4 X
  52. #endif
    6 C9 r0 G# _  I# H
  53. 6 ~7 K" s. p7 Y* K1 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " G: R: j% w' k' E; a# |3 [
  55. #define STATIC_SHIFT                3: V" R& @7 N* x; g, C5 W
  56. #define TCINTEN_SHIFT               20
    , c! ?: U* [1 H8 U
  57. #define ITCINTEN_SHIFT              21& @# ?; T: x1 R+ m- L( ?
  58. #define TCCHEN_SHIFT                225 C9 P7 C6 |* w" x1 p) N( k
  59. #define ITCCHEN_SHIFT               23- `7 a& Z( C( Y8 F* x
  60. ) q. P: b8 f5 l4 P" H$ @
  61. static volatile int irqraised1 = 0;
    3 D0 R% M& W# U3 x5 c+ D
  62. static volatile int irqraised2 = 0;
    * e1 m0 k( E5 h  {* g" E$ F

  63. : i$ k5 G7 ~& v" |6 O- h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - T5 G! Q: R6 _5 }  F+ U, Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % T  k9 d" V9 ^0 ?) z; A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 {  {: ]+ |* Y: Y$ ]& w+ T) F
  67.   w. C- H; t2 K& g! N
  68. dma_addr_t dmaphyssrc1 = 0;+ {& p3 ?% N$ N8 S
  69. dma_addr_t dmaphyssrc2 = 0;8 l0 F1 `( Z9 d0 ~& v9 s! H! }
  70. dma_addr_t dmaphysdest1 = 0;1 V/ \- H+ e/ d, X* s
  71. dma_addr_t dmaphysdest2 = 0;
    ( l* k# U) {) e) f

  72.   m" U0 H' T1 {7 \* H4 P4 G. y
  73. char *dmabufsrc1 = NULL;" Y& }0 U( n7 ^! _, N- f
  74. char *dmabufsrc2 = NULL;7 l% ~0 }0 F/ \7 S% p" X+ H
  75. char *dmabufdest1 = NULL;
    2 s/ i6 g0 A& y: }
  76. char *dmabufdest2 = NULL;, Z, O$ j5 S/ |; |% W! D
  77. 0 s1 i9 G6 c  m
  78. static int acnt = 512;
    % ]  `8 d. k2 G, j  m/ Z
  79. static int bcnt = 8;4 s* T2 `  z2 i; L, T
  80. static int ccnt = 8;% `7 j  M* a" O1 ]  V( s$ e
  81. ! |: ?9 G" j/ U3 H! N+ K
  82. module_param(acnt, int, S_IRUGO);% S6 x) S/ P+ v- I6 D$ P0 z  L/ s
  83. module_param(bcnt, int, S_IRUGO);" x- {0 G, k9 L8 A8 \- J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 O) u7 M3 |5 J7 h' t
* W) s" M& o% f* n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% s; J- w: f- I! A5 z! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 K  {2 I! S$ k8 M8 a# U% c# S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 n: o- g% z  B# L# W2 p* `+ p
2 L0 b) ~" K# {; ^9 ^
9 a: @* q' B; `7 m. I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 17:22 , Processed in 0.044909 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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