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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - [% X0 A7 x4 O' x  m, [
  1. [code]EDMA sample test application
    " G& s/ @1 @6 [5 v  H) b
  2. /*& B3 [$ \$ l% n- u) E1 R
  3. * edma_test.c, M/ _# |% T$ u. s6 c
  4. *
    . S: `2 o. c! h" W6 p& S
  5. * brief  EDMA3 Test Application
    " ~! {$ A' U- A3 ]  L
  6. *$ f2 ~$ J2 Y' P, w4 V$ `1 y, i
  7. *   This file contains EDMA3 Test code.9 O' G- e$ h% o
  8. *
    % h& f. Y/ E( N. r- f7 K$ K# v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! P, H' q6 J) f2 ~- b9 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 a' p6 N/ w& O! q$ B7 T7 h# S
  11. *         TO CHANGE.' @& E. g2 l  g0 G; v% P) f
  12. *. R1 x. g. O1 x) f5 y% L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 G9 ~8 W- ^) c# z  n) f
  14. *
    " G; @8 \% ~$ K3 }8 j5 n
  15. * This program is free software; you can redistribute it and/or3 }: u; F+ P5 J8 u. j4 b0 ?
  16. * modify it under the terms of the GNU General Public License as- o. S& _6 D2 ^7 r' m4 q9 Z
  17. * published by the Free Software Foundation version 2.
    & h" q9 P( p+ M* M
  18. *  b8 o$ y8 P4 [9 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! p) n4 {. ~3 e1 h$ I) j7 G5 K6 [
  20. * kind, whether express or implied; without even the implied warranty
      F% F7 }8 }6 U2 ~& C* j% H/ h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- K) K8 k3 ?* s  B1 x7 E
  22. * GNU General Public License for more details.$ U- N- t* U5 ^; x  Z" b
  23. */! T# }) m  Y& j: P! z

  24.   @8 p7 _6 Y+ |5 A
  25. #include <linux/module.h>
    ' `3 ]% u! Z- g) K; o1 l
  26. #include <linux/init.h>% u3 ]% m8 V: S
  27. #include <linux/errno.h>1 y8 R' c2 c5 }
  28. #include <linux/types.h>5 a0 n  T) X% S/ \
  29. #include <linux/interrupt.h>. p. u6 a& `, D& F$ j
  30. #include <asm/io.h>
    9 Q8 W" o( I- M
  31. #include <linux/moduleparam.h>
    9 G$ G: i! {7 i" ]
  32. #include <linux/sysctl.h>5 i) Z) C: E( a9 [6 X) B) e% h- v
  33. #include <linux/mm.h>
    , }; o+ _" x5 S: d+ i
  34. #include <linux/dma-mapping.h>1 C, m' j( ?0 A9 ^( E
  35. & O4 B, Y/ a0 }/ X0 N
  36. #include <mach/memory.h>1 k7 p: P; v8 _- h- q
  37. #include <mach/hardware.h>
    ( p* l9 A) [& b
  38. #include <mach/irqs.h>
    . k# V8 c$ A7 Q" V" P! j
  39. #include <asm/hardware/edma.h>8 k* Q3 I. l! ^9 N

  40. 0 H9 C1 K% K- |( F( E. i
  41. #undef EDMA3_DEBUG3 `: s# Z( u6 `! G
  42. /*#define EDMA3_DEBUG*/2 C& c1 I. [' X% d

  43. - j- H2 P. F  s- M1 {* v8 k
  44. #ifdef EDMA3_DEBUG: Q+ Z) [( {% y8 u2 H: s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ w, v2 N! U+ B/ }4 L3 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 I% H8 Z2 a5 C) i5 k% [1 K& r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % ~2 u) T3 U% A( F
  48. #else- v% C8 n1 ]" u! g# A
  49. #define DMA_PRINTK( x... )
    & a! N7 k- }. r  N; l
  50. #define DMA_FN_IN5 h# h: A: {3 R" s' k! y) a
  51. #define DMA_FN_OUT* e$ a4 K+ r! [) ^
  52. #endif
    7 C- \9 L" ]! ^* p/ @

  53. 2 x7 [2 E: v: p* \- O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( n7 m& ?  O$ o7 f% f; C0 E5 ^
  55. #define STATIC_SHIFT                3
    4 S5 Q. h) H" k3 k# J, Z
  56. #define TCINTEN_SHIFT               20
    + k; }& U! z' g" B* c5 R4 A
  57. #define ITCINTEN_SHIFT              213 _) o- n( x1 ?4 Q+ _- p
  58. #define TCCHEN_SHIFT                22
    , B( s9 t3 U1 n+ R  B1 ^# ]/ Z* P  d4 i; T7 y
  59. #define ITCCHEN_SHIFT               23
    # A( L2 v4 n  a0 y1 N* Y
  60. % G/ n0 S8 E, q& ]7 g- S) w
  61. static volatile int irqraised1 = 0;1 j4 I" M/ V; a: S5 Q3 f
  62. static volatile int irqraised2 = 0;
    # E; v1 E! O7 I/ h3 F2 X
  63. 5 q! B: R' \. V/ G8 V) p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' @6 G$ o5 ^4 ?/ O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 p. I' Q1 c8 {; Y- s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* s. A8 y8 {" }9 y2 D1 P

  67. 3 c8 h# l9 }; W# {3 p
  68. dma_addr_t dmaphyssrc1 = 0;' V' |  W9 ?( {- }5 b
  69. dma_addr_t dmaphyssrc2 = 0;. z2 t- S) N: y. ~4 V7 [
  70. dma_addr_t dmaphysdest1 = 0;+ Z, N. \( I$ Y5 c8 @( p
  71. dma_addr_t dmaphysdest2 = 0;
    - H$ V( M! e" s7 k' u
  72. + L# |$ y6 M. g& L! M
  73. char *dmabufsrc1 = NULL;7 N) ~( V: s, w2 D8 y
  74. char *dmabufsrc2 = NULL;" R& t" ~! K/ @$ x
  75. char *dmabufdest1 = NULL;
    ' G, \- [, P( ~5 H
  76. char *dmabufdest2 = NULL;0 R2 y, }' f+ U) H/ a8 |% h6 ~
  77. / T* e0 t0 V: @2 U, O; g
  78. static int acnt = 512;" I+ k( s& h  |
  79. static int bcnt = 8;! v  p, g$ ^4 u! n
  80. static int ccnt = 8;1 A$ z) v5 w& a1 `- x" H" n

  81. & I. H' T/ Z3 [8 f( ~
  82. module_param(acnt, int, S_IRUGO);
    - F3 h% a& ^  T3 d
  83. module_param(bcnt, int, S_IRUGO);
    # f+ L9 [" L3 l% v; S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( d. \0 x  [; V" h

4 Q2 K. X: M3 M! t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. Z3 r6 `/ U' x8 Q! t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 l! o4 x3 o' M& Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* P+ c6 T" ?1 g( k3 X2 W  H  F
0 U: O- R4 c, p: P7 Q% p# R4 W6 t3 h, R' w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-26 21:29 , Processed in 0.040381 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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