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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, h, H  Y2 @! h- o% `
  1. [code]EDMA sample test application
    * B' G% p3 d' C2 k+ @* ], c/ a
  2. /*1 s, ~: D7 Q5 s- v/ ]
  3. * edma_test.c2 }- x* J5 s- N% X
  4. *
    6 g$ F$ m! I) S6 ]+ P
  5. * brief  EDMA3 Test Application. q* f0 V2 _2 M" Z0 d6 c3 `  R  ~$ G
  6. *
      Y0 [8 [5 f+ M* a5 M
  7. *   This file contains EDMA3 Test code.
      J# q5 h! v  ^
  8. *% x+ e+ O* z. ]" k3 ]: z9 b7 y1 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ g' P' S+ J$ `8 l+ P+ C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 T* w" b; L* E  O! N7 C
  11. *         TO CHANGE.
    6 {# o* q# b. y6 q& I2 N
  12. *
    9 h6 s7 z' C  y' O. ]7 b) Z/ f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  _' C7 B6 R6 J, ~! m+ s. p
  14. *
    . t  U" c9 S! J
  15. * This program is free software; you can redistribute it and/or
    ; _8 V. P, A$ {7 ]7 C* E
  16. * modify it under the terms of the GNU General Public License as' b) u# r% D, r, i! b9 T; n
  17. * published by the Free Software Foundation version 2.% n! L* i; M! G4 J! w
  18. *
    $ O5 W8 O5 ?* n' b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  T& `+ [0 ^6 i  ?0 w. ^2 H, q
  20. * kind, whether express or implied; without even the implied warranty" D5 z: z6 Z- N+ U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  z$ G/ k1 [! u7 N
  22. * GNU General Public License for more details.
      B5 h8 d! X1 Q& A' s
  23. */% _+ ?: h" r% q2 y& u4 R7 I

  24. % L& ?" T+ I$ S8 E% `
  25. #include <linux/module.h>
    $ A9 b& N) I; a3 f6 E) `
  26. #include <linux/init.h>& K* M+ J) P! n; T5 p
  27. #include <linux/errno.h>! h. s; {* H3 b* C
  28. #include <linux/types.h>
    4 k2 y# H0 ?" X5 R" x1 n8 P& X6 N
  29. #include <linux/interrupt.h>
    / Z) n4 J$ S! P3 [* G9 N
  30. #include <asm/io.h>& N# w5 h  R( m( F
  31. #include <linux/moduleparam.h>" ^8 r! J' E& j$ {1 b
  32. #include <linux/sysctl.h>* R" |- h9 o; V4 v
  33. #include <linux/mm.h>
    " ~" d) O8 W9 Q
  34. #include <linux/dma-mapping.h>( E) q- ^% p3 R# j# U

  35. 9 D# C) q$ B0 L  i5 b+ x! a, y
  36. #include <mach/memory.h>0 R1 D8 J5 U2 S0 N" _! x7 v; v
  37. #include <mach/hardware.h>+ F0 m4 t+ A' n7 R9 R' F; W
  38. #include <mach/irqs.h>7 {" t8 n! @/ o  z) F1 z4 i
  39. #include <asm/hardware/edma.h>
    3 y! z) b- |9 Z4 K

  40. , e# t7 A3 o! d7 ?6 J
  41. #undef EDMA3_DEBUG
    % m7 ~  q: ?1 }3 C6 s( n& B
  42. /*#define EDMA3_DEBUG*/! N" X  x/ X5 Q3 [

  43. ! P* V. m5 h* e) ~
  44. #ifdef EDMA3_DEBUG
    - Z! x1 X2 x" S3 W2 `! g+ }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 I* N* h8 G2 D9 N5 h  q" ?8 z6 ~; c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' e& v( t) D& j* G. H( b8 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( d& r  Y5 }* h. A
  48. #else$ c! Q+ C- c& ^$ _+ M
  49. #define DMA_PRINTK( x... )$ f  _- l6 k# U5 J: C
  50. #define DMA_FN_IN
    5 w& [* C6 d$ c
  51. #define DMA_FN_OUT
    / T) u( Q; s6 Z$ \
  52. #endif6 E8 l( ]6 ~2 d1 r

  53. ( A4 c; ]3 f% |5 V7 J: S) H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 C( m- |2 w% ^1 w
  55. #define STATIC_SHIFT                3# v4 s0 T% `8 n. D+ W) K* R
  56. #define TCINTEN_SHIFT               20: G8 g8 X5 y8 |! r3 I0 H* I3 H
  57. #define ITCINTEN_SHIFT              21# p4 G. R) D: n  U: X
  58. #define TCCHEN_SHIFT                227 z' n% l. Q7 O& L2 A% u* M
  59. #define ITCCHEN_SHIFT               23
    # l- h( g5 G" t* `$ Z9 I
  60. 0 {, N6 X3 @% W& ?( o
  61. static volatile int irqraised1 = 0;2 o# F' n  m! M: p$ o
  62. static volatile int irqraised2 = 0;' h8 V7 g7 ]! o

  63. ! N6 I; i/ W* ^) y# o) o8 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ A  g* j4 v0 L2 v/ V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! j2 H1 @3 E1 ]' f! G. g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) @9 e8 X0 q+ W
  67. 7 H5 h  ~3 _, l
  68. dma_addr_t dmaphyssrc1 = 0;) f0 ^# ]. n8 i' U
  69. dma_addr_t dmaphyssrc2 = 0;1 @) b; @# ~# t& k
  70. dma_addr_t dmaphysdest1 = 0;# J1 S; i; T/ U8 h
  71. dma_addr_t dmaphysdest2 = 0;5 V" v+ S" }3 G' u# P! x2 R
  72. / P3 s7 ~' V5 P/ O
  73. char *dmabufsrc1 = NULL;1 j0 q  }8 i$ n# m8 U3 \
  74. char *dmabufsrc2 = NULL;
    - u9 ]2 [2 \- E( z  s/ i
  75. char *dmabufdest1 = NULL;! h4 {- F: O- L. L
  76. char *dmabufdest2 = NULL;
    " ^8 n' F# [) U1 o/ n) m
  77. : T- f' e. X6 n! A9 H: F" e
  78. static int acnt = 512;  Z8 m1 L  s: j- t
  79. static int bcnt = 8;. b9 _2 E! `6 L( c$ Z+ z5 \6 E
  80. static int ccnt = 8;; o) O6 m5 ]3 _& E5 m6 X# e1 A

  81.   X  N# d6 W: D) ~. P! J
  82. module_param(acnt, int, S_IRUGO);. ?' D$ I& f5 m" m8 A. c2 D9 T3 t# w
  83. module_param(bcnt, int, S_IRUGO);
    6 M, b" R. n& r8 _" M- j8 ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. F$ b5 {7 z9 K
; r+ S; p$ D! Z/ r, L; Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* W: o" D' f5 C2 }9 Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; _, X# k3 x) u$ z) p: N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- r8 l& f* F+ T* M9 m: ?  R. ?. r9 n- H4 y7 K

$ z$ }0 ^) e4 @$ k( ]! a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-23 23:29 , Processed in 0.040014 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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