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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 ^. q! H/ @4 W$ `* s9 K3 V
  1. [code]EDMA sample test application
    0 T: E$ [- M0 U7 K
  2. /*2 A) W' |% s2 o4 d
  3. * edma_test.c
    ) m! e  s: l& B+ y- {5 `2 K
  4. *3 e# `, U9 P! D' v
  5. * brief  EDMA3 Test Application
    - C& b# I/ z6 o2 m
  6. *8 K# {  }& F- c9 {8 H( N- o
  7. *   This file contains EDMA3 Test code.
    9 \# m; M2 E7 R/ ^% c* I
  8. *
    ! j# T$ u, Y; d, Y% f: \, l) R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( w; q: g1 L) C  K% D8 [4 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% L' _" P9 e" ~0 H  Z: c* S
  11. *         TO CHANGE.
    : W5 g% o  F7 x/ W# y* j/ F
  12. *5 u' P  i6 a3 p& e# o. {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " p) d( l# s" n/ h
  14. *
    4 c1 p% e# Z0 F) ]
  15. * This program is free software; you can redistribute it and/or% ~0 o0 |' R" ^* X* g5 h
  16. * modify it under the terms of the GNU General Public License as4 A+ I: [% Q" M% k* L
  17. * published by the Free Software Foundation version 2.& J; Y- Z+ h3 C7 V5 I, ?+ ]# E
  18. *( T$ Y$ Y1 I- ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 K; y* o. T+ }7 A6 [7 M
  20. * kind, whether express or implied; without even the implied warranty
    ; n# [4 G+ G. X; O4 U* k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ W' B+ x8 a" N& `
  22. * GNU General Public License for more details.
    & p( l' a3 x$ ]. j6 T2 y
  23. */, K2 n/ t9 H9 _! H1 ^
  24. & O! C; t1 k( t8 {+ [
  25. #include <linux/module.h>
    0 P) D6 j4 Q% M6 ?* X3 s
  26. #include <linux/init.h>) }8 i+ I) H8 H7 t5 G" A( J
  27. #include <linux/errno.h>+ D1 \. z1 R+ a  q8 j7 ~& Z
  28. #include <linux/types.h>+ }( J) V5 `6 `: x/ Y
  29. #include <linux/interrupt.h>
    % L% ?/ B! o& F# o- L2 J
  30. #include <asm/io.h>2 u2 R; V( D' z/ Y# F- ~; C
  31. #include <linux/moduleparam.h>
    : h8 m0 V2 q# R4 B5 L& K. E
  32. #include <linux/sysctl.h>* V0 @% O) A* m3 z' H2 h4 Z3 `
  33. #include <linux/mm.h>4 p* p' K6 v5 h3 Y" I$ A6 i
  34. #include <linux/dma-mapping.h>! _+ o$ P% @8 V+ s* W7 ?% N
  35. ( O( {2 X  Z6 b
  36. #include <mach/memory.h>+ c. A9 |5 z( N0 q( g+ b
  37. #include <mach/hardware.h>5 ?+ Y* W& m) a8 Z' o
  38. #include <mach/irqs.h>% j& O2 A: h; F0 S
  39. #include <asm/hardware/edma.h>
      J1 d/ W; x0 r% w  Y# z; V( |9 i$ m7 J
  40. 7 S; Z7 ?. _0 d5 L4 `# X  }
  41. #undef EDMA3_DEBUG1 f! E6 n4 l% N' x! f! j( V4 P
  42. /*#define EDMA3_DEBUG*/
    + Q4 D3 g! A, x. i: ^6 V' N+ X
  43. + O- v* X& f' z1 k2 ^
  44. #ifdef EDMA3_DEBUG/ j$ w8 @$ U4 ~* N. F5 I: ~- w  J3 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - _/ d) M. o. v" x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " Z2 B& O+ V9 ~! G$ |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- p' ?: _2 k5 u' w
  48. #else
    / W9 g5 _5 b: T, M$ p
  49. #define DMA_PRINTK( x... )* o" z' X# h  C% O6 c6 H
  50. #define DMA_FN_IN, O) c; c: G. S1 f6 B
  51. #define DMA_FN_OUT
    8 \+ c% ~  B* z8 q1 }
  52. #endif# t5 B5 U# p( f/ f8 h' e

  53.   s, Z0 E$ p3 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 t4 a- g2 @6 q# t! z, Q* \
  55. #define STATIC_SHIFT                3
    ( Y( ^' k4 Q8 C# h4 s
  56. #define TCINTEN_SHIFT               20$ N' L8 h! X# p- a
  57. #define ITCINTEN_SHIFT              215 R/ m- z$ V  |! [
  58. #define TCCHEN_SHIFT                22
    1 ^3 s/ Y- O9 c6 L& h$ |
  59. #define ITCCHEN_SHIFT               23! W8 L7 z, y0 @2 d

  60. 4 S$ E) p1 H" m* b4 ?2 A" x9 e' P
  61. static volatile int irqraised1 = 0;+ Q" P# x' j# s% t! h+ ~6 B( c+ [
  62. static volatile int irqraised2 = 0;
    ' R) D/ [9 C% G# n5 _" b% s

  63. ! f* Q! z0 R' s0 j, q" K+ s* I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 O. V$ E0 e) }' e, F" z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . `& }. m5 j. G  K/ H) c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * R, {% N" a4 y9 z$ ?2 E* e' d) E! {
  67. 5 p2 P; t% E  |. H) X, _
  68. dma_addr_t dmaphyssrc1 = 0;
    " X7 w' ~/ R% n  K9 O
  69. dma_addr_t dmaphyssrc2 = 0;
    9 J, j8 @1 j* K; M' q3 L
  70. dma_addr_t dmaphysdest1 = 0;
    6 p: X; R4 j  ?# s4 k
  71. dma_addr_t dmaphysdest2 = 0;
    8 f7 g' S6 }' c! _' c
  72. # z0 i* L$ ?3 U- _# ~8 v3 o. V
  73. char *dmabufsrc1 = NULL;! U' K6 s' l: l7 E( m
  74. char *dmabufsrc2 = NULL;
    , V7 ~1 V6 T  s+ k8 B
  75. char *dmabufdest1 = NULL;% f/ w9 @7 X2 j. u& w, O; f/ K
  76. char *dmabufdest2 = NULL;" N2 s& H# y) g+ L

  77. 4 f% K/ l. j$ M. F
  78. static int acnt = 512;/ ?! f. P; d! Q& a/ U; h: G
  79. static int bcnt = 8;7 b; `3 X. t  s/ ~
  80. static int ccnt = 8;
    7 n$ j# m3 D6 V1 l) s
  81. 4 P. a# E( W$ E/ I  o) f
  82. module_param(acnt, int, S_IRUGO);
    ( y  e3 b. w( H! e1 w5 x
  83. module_param(bcnt, int, S_IRUGO);  N* g) U# p# y0 \* H  u  z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: w# @, e# _3 b& j- o0 Y5 ]0 x

! X8 W! i, [2 V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ o; p: o$ G; o# ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 [% k' Q0 {0 b9 v8 o6 T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' ?9 ^& [# g0 K/ Y- q
8 g6 ]) @, x5 H- _! j- {9 U9 c4 K" X2 v" w5 e! f2 ^1 ~+ A- P* N: S2 j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-26 21:11 , Processed in 0.042044 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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