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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! Z8 i8 w3 j1 U( _3 h+ Y
  1. [code]EDMA sample test application0 L& K% `6 X0 g7 S
  2. /*, V+ L/ W( k1 m$ C  q/ k
  3. * edma_test.c' o+ n& W2 a: X! e9 I0 v3 t  Z
  4. *: _4 }) U: l' _; e) o- `% m* B
  5. * brief  EDMA3 Test Application% v# q, B% Z3 B
  6. *$ }) P3 n1 ~7 ?2 ?/ Z. w5 o
  7. *   This file contains EDMA3 Test code.: D2 t: z  i# j6 M* o1 H! a% x' Q
  8. *
    ( [8 ~* ?) C: g' E! Q; j6 V7 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) }5 d! S* b" N3 @1 g8 `& |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # f: h) S1 s' D! k1 m: U0 h
  11. *         TO CHANGE.
    3 }  q$ J( L( j7 `1 h
  12. *; P! ?9 ]% ?: d( t7 f2 @0 Y  _  T6 C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      G  _1 _  I  C- M7 V
  14. *
    ( }" r7 j1 l4 m. l& ?+ i, D
  15. * This program is free software; you can redistribute it and/or! s( S6 u; T4 m* o# }% W
  16. * modify it under the terms of the GNU General Public License as2 T" `; L& c! h7 p
  17. * published by the Free Software Foundation version 2.' U' M6 H% _. V4 Q# D
  18. *. l, l# d& v& a0 G0 c2 P2 Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- |# _: Z6 f& T
  20. * kind, whether express or implied; without even the implied warranty
    6 z  a( k* f# |1 x: d1 |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 F6 c/ ?' v" z  G5 u5 Q4 j
  22. * GNU General Public License for more details.( l! P; v- J% w( b% R- g- u
  23. */
    , C& v/ g* q. L1 P; i3 j

  24. : z8 \4 f+ V6 Z8 W; h
  25. #include <linux/module.h>5 X& [) G7 o( b0 N$ j
  26. #include <linux/init.h>$ ~# J. n, G# n  }7 O
  27. #include <linux/errno.h>) P% R% `4 E5 V% ?2 C
  28. #include <linux/types.h>" K: y" f* ~3 ~* ?
  29. #include <linux/interrupt.h>/ c+ K# g1 k2 }7 g5 }( O
  30. #include <asm/io.h>! Z  v$ Q* c& [. Z
  31. #include <linux/moduleparam.h>, m( b, H  @2 C# B8 O( W! K: c
  32. #include <linux/sysctl.h>
    " V. k  f) ?: ^; i3 U! J9 {
  33. #include <linux/mm.h>, p( b$ y4 n& O8 t: g
  34. #include <linux/dma-mapping.h>
    , C7 x# C- l! @5 \% J7 o4 ?1 ^
  35. 2 L+ n! {6 s* ~1 `0 k* _  c$ J* \3 z
  36. #include <mach/memory.h>
    & M' m; ^, x  `& [% ~
  37. #include <mach/hardware.h>
    6 R% K# c1 U2 h0 q( D8 `! @  O
  38. #include <mach/irqs.h>% g. |8 T: V" e! P+ y
  39. #include <asm/hardware/edma.h>: {8 ^! Z/ k: G* |# s/ r& n# @
  40. 6 M/ K5 s7 L& B4 g, Z% \' x$ B
  41. #undef EDMA3_DEBUG1 T9 m% k$ N# F" D8 s. g
  42. /*#define EDMA3_DEBUG*/# J# W; G/ n) o8 M5 E$ J+ q

  43. 5 o, t8 a' H9 p% r
  44. #ifdef EDMA3_DEBUG( a* G, _1 J( M  ]/ r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 Y  Z; H" W. ^5 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 r1 z* P' S2 e3 ]- v( O. @: [# |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + P- H6 b- y% _7 d
  48. #else
    ( G1 _% s! {& Q: p" u* [( N! y$ p6 w4 {
  49. #define DMA_PRINTK( x... )
    ! p* s8 ^) N! E. i/ J6 ^4 G
  50. #define DMA_FN_IN
    0 T  L) g& `5 ~* t0 l
  51. #define DMA_FN_OUT* ?+ C3 h! i/ ?# e* p! E
  52. #endif8 a! O2 q* c) K( c# u' C

  53. * M, k$ Y( w6 i5 c6 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% y2 i3 h7 Z5 {1 S
  55. #define STATIC_SHIFT                3, e- J1 e3 e8 A  Q
  56. #define TCINTEN_SHIFT               20
    ( `- \+ a+ s1 r; r' c! z5 c& n
  57. #define ITCINTEN_SHIFT              21
    3 p# x4 ]# z% q: h+ `" Y
  58. #define TCCHEN_SHIFT                224 ^/ G. ], c+ F# G: A
  59. #define ITCCHEN_SHIFT               23
    + z' M$ S* O  F

  60. 6 V9 ~8 l9 l+ R7 c# n' h  _
  61. static volatile int irqraised1 = 0;3 }* ?. o8 C* K* Z, E# o+ k
  62. static volatile int irqraised2 = 0;
    1 _$ C" {3 D5 I) |: m) E7 z

  63. $ A; X: F$ C. D9 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- @4 ]. R* P1 u) X" M- |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  Z& J. M6 f) h+ J0 a3 j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / ]! ^6 r* B/ a3 m9 ~8 B8 x8 b

  67. , S' G! W5 v4 O* b4 W
  68. dma_addr_t dmaphyssrc1 = 0;
    ( b7 R, l( }5 h% _( P
  69. dma_addr_t dmaphyssrc2 = 0;) N: g+ {$ }. K3 H! {7 k
  70. dma_addr_t dmaphysdest1 = 0;0 V6 E! |$ a% O! I- T. Z7 v
  71. dma_addr_t dmaphysdest2 = 0;
    4 e( J' @" `- h1 ?: A
  72. 7 @* P5 Y/ ]- N6 x/ z' N
  73. char *dmabufsrc1 = NULL;" L2 ?2 B" a# @& p7 e" f8 q
  74. char *dmabufsrc2 = NULL;
    4 t, z. y( V2 L5 ]6 V$ e( C
  75. char *dmabufdest1 = NULL;
    . |! v3 v% S, {, ~4 t7 V) l: r
  76. char *dmabufdest2 = NULL;  u  X7 i# U9 R+ O/ }, R4 C" A

  77. % j4 \3 d( i( {* Z) Q; w* E% f8 y
  78. static int acnt = 512;
    7 E% Q! J: Y1 b5 }, P3 U
  79. static int bcnt = 8;7 ^8 B, p( U8 D1 y$ s$ \
  80. static int ccnt = 8;) _6 B6 z/ r5 V  ]
  81. 4 E: x0 j0 z) l/ \" G
  82. module_param(acnt, int, S_IRUGO);
    1 B- g1 b. e# ]' J7 y$ E
  83. module_param(bcnt, int, S_IRUGO);
    / ~( ]7 d2 u' y" N5 G& T* T% B$ i$ L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 y" R; R0 P( Z; O6 H- f
9 `! q# ]; i5 U5 ~3 w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; I" `$ }! A! I2 A" J4 i1 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: L8 X7 \' U- f) N% b6 }; Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: z$ q# G# n( p9 j7 a7 M, j) t+ a# H7 n* a' F: v
0 e# i/ C. ^! B- w2 _& G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 06:34 , Processed in 0.040266 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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