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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " Q* A, Z1 m; W* l- Z
  1. [code]EDMA sample test application  p  k2 a: l/ R
  2. /*
    1 V2 \9 T) f# v4 h  D) }* o6 b
  3. * edma_test.c
    : d4 w5 Z" o5 _  l- b1 c
  4. *
    # \: E" \6 N* \; v. b- r5 D+ X
  5. * brief  EDMA3 Test Application0 ]0 `6 y7 g2 r4 k1 q7 d2 G* S9 x
  6. *2 M- D" X& D: h: `+ W
  7. *   This file contains EDMA3 Test code.6 O; O; [4 l: c' d3 O6 S  e1 K1 C
  8. *' Q& }/ i3 y, b% |) H! J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! A: B: m4 i8 x2 c8 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( O$ e" J. u, x  a
  11. *         TO CHANGE.5 {: S9 W+ L3 g" J: N
  12. *
    % C. I& x4 m" D$ `. k+ z5 s; K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + o# l6 u' s( y- D
  14. *' s$ I6 E$ b* H
  15. * This program is free software; you can redistribute it and/or; I, ^4 i. {; X" O# H1 a: m4 K, g! S: h
  16. * modify it under the terms of the GNU General Public License as4 m- ?5 k/ {7 f6 K: F$ Y
  17. * published by the Free Software Foundation version 2.
    & O" z( |4 p( N! [8 f
  18. *
    " [* ^7 R7 u. n' e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % Z' q  B7 |- n4 y6 B* K, q/ E" W
  20. * kind, whether express or implied; without even the implied warranty: @0 |( r8 A- e4 O8 Q4 T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! a% W$ s1 e! J4 J  \# Y
  22. * GNU General Public License for more details.
    & q: }" @4 q5 G% b7 f8 Z
  23. */% K; D0 [0 I( ?* v- T6 v6 I
  24. / F# p: Q- c1 h+ [& t& G
  25. #include <linux/module.h>
    ) H; D4 V% I# P- }1 N  o
  26. #include <linux/init.h>
    2 G6 M; v/ s+ ^. D
  27. #include <linux/errno.h>6 O. _9 r" {. }
  28. #include <linux/types.h>4 _6 \8 G7 p/ u2 n
  29. #include <linux/interrupt.h>
    3 m* @, l# a* @7 d
  30. #include <asm/io.h>6 E- T% C3 {! \: b
  31. #include <linux/moduleparam.h>
    " r2 \, r6 J9 A; r
  32. #include <linux/sysctl.h>
    " r: t" k/ M/ Y" G
  33. #include <linux/mm.h>! Q, }! ~9 y9 {
  34. #include <linux/dma-mapping.h>9 Z+ l. V2 L5 V% l

  35.   {( F! l$ U9 A4 s
  36. #include <mach/memory.h>
    # P2 i; u1 n7 g& T) O2 l1 n( H; l
  37. #include <mach/hardware.h>
    8 H! f/ n2 S5 g+ N
  38. #include <mach/irqs.h>/ p; J# I5 E7 F! k- S4 P. N
  39. #include <asm/hardware/edma.h>9 P4 S. G6 h5 B% |) _9 F6 J8 k" x. q
  40. 7 Y& k" h: j5 S8 o3 H5 U
  41. #undef EDMA3_DEBUG+ g" Y4 R* h6 c2 {+ V
  42. /*#define EDMA3_DEBUG*/
    5 E: N# f4 X2 E& O$ s

  43. # U& I! B5 P# a/ F  `6 t9 D
  44. #ifdef EDMA3_DEBUG
    1 Y* g! z" m# p2 X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 i9 B" J* Q) |- L& A+ h- U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 N$ f3 |( |5 d0 j  ]5 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , g! L5 |8 c( V! F. z
  48. #else
    # |; J) Z/ i/ ^
  49. #define DMA_PRINTK( x... )" j7 q" U- H; `/ M0 ^) E
  50. #define DMA_FN_IN
    " G/ N$ w. Z8 d( z! ^1 E" o2 A
  51. #define DMA_FN_OUT" ~' @( u7 Q) l
  52. #endif
    : ^5 V, e; D; `" d# l+ K

  53. 4 N8 W3 n, X3 T" S7 p7 Z2 O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 l5 V% t! N4 n& j
  55. #define STATIC_SHIFT                3
    0 R" ]  Y& I9 o! T* U9 B
  56. #define TCINTEN_SHIFT               20
    , {- X# s, d+ J# \1 R4 {8 F/ ?9 a
  57. #define ITCINTEN_SHIFT              21
    + G+ D' Q- _# ^6 h* a0 j' b
  58. #define TCCHEN_SHIFT                22
    2 g. M; H2 I8 q4 S/ t- n- S9 P% M
  59. #define ITCCHEN_SHIFT               235 g2 R6 Z8 M4 B8 ~

  60. ' v9 m+ j' ~1 j: v! q  ^9 J- T# m
  61. static volatile int irqraised1 = 0;6 m# k, a7 A8 F0 k% a0 ?. ~
  62. static volatile int irqraised2 = 0;
    - Q/ x+ w8 L) d

  63. ' w+ \  ]' J$ q) s5 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , a! I$ L: J3 b& t4 C  o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " W; i9 U3 }. [$ T2 L2 a  E2 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; K6 \" h) ?3 O" ^  O) A: \2 i- n
  67. ! }* Y9 l( d) I1 C5 ^+ j; J7 }
  68. dma_addr_t dmaphyssrc1 = 0;8 l  T* Q) {$ O" z* s( _
  69. dma_addr_t dmaphyssrc2 = 0;
    2 w& {$ a5 Y- o  V. c
  70. dma_addr_t dmaphysdest1 = 0;
    ; U6 `, Y+ ?3 Q; g
  71. dma_addr_t dmaphysdest2 = 0;2 E  Z& V2 i& ?5 _$ s, p
  72. 6 y; }! ?" j" s- |/ q& j$ f' x3 Q
  73. char *dmabufsrc1 = NULL;
    & N. U) ?( ?2 b. ^- _
  74. char *dmabufsrc2 = NULL;
    5 [/ _& O3 Y$ ?
  75. char *dmabufdest1 = NULL;
    2 E. Z8 I9 i1 z1 i
  76. char *dmabufdest2 = NULL;
    1 Z( J/ L7 |$ d& }! H4 ~7 i% _% C

  77. $ L6 C4 r! q% n0 a1 ~' f( D0 p' O+ h
  78. static int acnt = 512;# ~# |& s7 K# c% k; W/ l
  79. static int bcnt = 8;# B: C! m; T, T  n* N2 g
  80. static int ccnt = 8;, S  |( |- y2 E6 u7 [9 y
  81. ! C$ L" V6 v' F& C
  82. module_param(acnt, int, S_IRUGO);
    * b) Q" n0 {2 p. }. G9 G' `
  83. module_param(bcnt, int, S_IRUGO);- z2 _6 S8 s, R7 E0 J0 z. T7 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 \4 v' y! K* u$ {) h
/ d$ l- F8 |/ k2 X! _0 S3 N7 M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 i/ H. B2 ~1 sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 s3 s. {$ ]" H% ~! i0 q- `  e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* O3 h* d% E+ w' c& M
6 ?3 @: |7 L' p. L1 r4 {( l
/ D  b; @  q; q4 G8 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-23 05:28 , Processed in 0.037296 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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