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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 G0 U. O; }4 e
  1. [code]EDMA sample test application
      e; W  a* E7 F1 o
  2. /*6 q' I/ J& u5 X- p  {
  3. * edma_test.c; `8 I$ `( |; z! i
  4. *
    9 a: f; O, Q+ K# B- c
  5. * brief  EDMA3 Test Application
    / f5 K& R, `9 W* Y
  6. ** ~# `2 S' x2 r$ j8 E
  7. *   This file contains EDMA3 Test code.% Y6 q. \7 `6 ^8 F3 ?
  8. *
    , r( g7 C; S* v2 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 ?# _3 N, |! o$ `; H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / e" z- [  ]6 W3 Q
  11. *         TO CHANGE.% s! c5 \" B3 ?: G
  12. *2 a2 G, N2 d$ ]4 V3 T% I3 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 j# @) @4 \. o: P8 A* p
  14. *
    $ q( I# E$ [; M) `/ w  ~* @2 E- I( [
  15. * This program is free software; you can redistribute it and/or! k0 l% i# F  w* j; [, x
  16. * modify it under the terms of the GNU General Public License as. u/ d7 `% F4 D) A
  17. * published by the Free Software Foundation version 2.+ Z+ K; ?1 i$ P4 Z% n  \& b
  18. *
    2 p4 V* G+ {' I4 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* B# S  E9 v5 Y* g* {
  20. * kind, whether express or implied; without even the implied warranty
    8 B7 _9 F: H, R0 W4 Z3 T9 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ i; I  j" `9 r5 g/ I
  22. * GNU General Public License for more details.
    8 L: v6 N( `" u" V
  23. */
    0 e' b6 C  q# ?
  24. 8 w+ `0 Q3 z7 J, t' B, S
  25. #include <linux/module.h>- e$ o2 |; }2 a5 a% V% q; l) i
  26. #include <linux/init.h>! B2 u  X2 b4 W& r
  27. #include <linux/errno.h>3 p( f9 d+ R9 e# G
  28. #include <linux/types.h>  v4 I' q/ o+ b) n4 y6 A
  29. #include <linux/interrupt.h>8 ?& k6 D% e3 t7 i- n6 @, u
  30. #include <asm/io.h>
    $ ]! d9 ~# S- }8 N) Y7 }
  31. #include <linux/moduleparam.h>$ e; |$ Y( ]4 }8 j" ?" E4 ]' F4 I
  32. #include <linux/sysctl.h>
    4 |6 k/ c& P. }
  33. #include <linux/mm.h>3 E9 V* Q" L- T) Z) m4 x5 Z! _" F
  34. #include <linux/dma-mapping.h>
    , D* e$ ^  Y6 L, ?% f$ T
  35. % ?6 Y' u7 b$ B6 Q9 H! r' a$ }. r2 J
  36. #include <mach/memory.h>- v9 Z; W1 q3 k- L- q2 r
  37. #include <mach/hardware.h>0 @" S8 [6 [4 C
  38. #include <mach/irqs.h>
    0 b% I" _) M7 }5 O: G
  39. #include <asm/hardware/edma.h>
    0 u. d& ?4 a. h( L3 o
  40. 1 s* P6 `4 |% [2 F% i
  41. #undef EDMA3_DEBUG
    " C" p6 S) z# @# Y6 k
  42. /*#define EDMA3_DEBUG*/
    9 m" V. i! N+ D+ m4 a. O- E
  43. / u1 {% T% B% |
  44. #ifdef EDMA3_DEBUG
    & `2 }- R3 T6 h& R0 k& e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + P: w, ?! b9 H, \2 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 t9 V, U+ m8 V" G0 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 a& T5 w1 [, X- K: R; Z2 j
  48. #else3 C; n) w. C4 ^, i3 Z9 [# m4 F/ Z
  49. #define DMA_PRINTK( x... )# z: _2 U, Y4 Y/ J/ L5 G# z: ~
  50. #define DMA_FN_IN6 Z6 H" y2 q& t1 n' S; z5 ?! \
  51. #define DMA_FN_OUT- J( H$ l1 D1 X4 j1 X
  52. #endif3 ?* _$ v6 Q/ b% d2 @
  53. 3 @* D& W. Z* L( S" L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . ^% u& Y5 V0 R7 |5 f: {
  55. #define STATIC_SHIFT                3, C7 S( _1 B8 `3 L# T
  56. #define TCINTEN_SHIFT               20+ u/ T! V. S1 }$ y* u1 Q
  57. #define ITCINTEN_SHIFT              21
    . Z% b, Z8 j) C" c
  58. #define TCCHEN_SHIFT                22, O& _2 J7 E- `. s
  59. #define ITCCHEN_SHIFT               23
    6 G. ?! [+ W+ _) L9 y8 K

  60. ) K3 {3 r' k' J7 h% r
  61. static volatile int irqraised1 = 0;% J  b0 c; v6 K( A: D" k9 t
  62. static volatile int irqraised2 = 0;! |  Q6 J4 l6 i3 n( A0 }

  63. 5 A- h) P. Q4 @. H8 F% M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 Q- q6 N2 ~# {# O8 L8 t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 O/ ^2 t& p/ L/ Y( i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 E. \7 U) _1 _! e) U2 @

  67. + h3 \" ]- _  Y8 d. N
  68. dma_addr_t dmaphyssrc1 = 0;( p7 I( T7 p3 D0 Q9 J
  69. dma_addr_t dmaphyssrc2 = 0;
    8 _7 R5 `; F, [& q% A# X5 @
  70. dma_addr_t dmaphysdest1 = 0;
    9 X# E- z7 E9 ~# M/ E
  71. dma_addr_t dmaphysdest2 = 0;8 k+ H6 T, o! e5 y

  72. : V, ?$ S. N. `( U4 t1 k6 `- c1 b
  73. char *dmabufsrc1 = NULL;8 B, \: l% t' o; K8 x# K
  74. char *dmabufsrc2 = NULL;8 U% p; L& ?" h, ]) P
  75. char *dmabufdest1 = NULL;
    * R' V, X1 i% U- R: P% W
  76. char *dmabufdest2 = NULL;5 K+ m1 B- _6 D# I8 s
  77. 1 x' j0 f: O! S% \" v+ y- y1 f
  78. static int acnt = 512;
    - w6 m: [* u. H
  79. static int bcnt = 8;1 [' a3 \  [. Y
  80. static int ccnt = 8;2 }% z6 s/ Q* R0 v6 _) Q

  81. ( L$ g6 h- O  n! O0 P* ^
  82. module_param(acnt, int, S_IRUGO);
    ) g, O' G: s* V5 g
  83. module_param(bcnt, int, S_IRUGO);
    7 }/ b) [2 D% v2 O8 Q# C6 ~! _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) k6 |' \- J9 T- A2 E0 S6 u7 W, W- H- k; m* A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ T& m, @% N+ Z! [. Z' 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 v2 ?0 I/ k$ l& }7 Z& u, y) y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 E. d) l% k7 g4 G) ^- o7 `
! t' M6 \* U! T

2 M& a! x" k; e/ O& U" S" Y0 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 08:14 , Processed in 0.040408 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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