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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   r; `2 f6 g3 I9 X: }
  1. [code]EDMA sample test application
    8 K1 u: F- G. N4 c, D$ Y
  2. /*
    4 g: u  u. _. ~
  3. * edma_test.c
    1 e) {4 r9 W/ P7 |& B8 S$ e4 L
  4. *
    + h+ {0 Z' ^0 E6 m0 X1 l1 l
  5. * brief  EDMA3 Test Application
    0 f- R3 X# h+ a4 f
  6. *9 Q3 m1 f0 u0 m0 k
  7. *   This file contains EDMA3 Test code.& Y/ o2 ?3 A- g* z6 g
  8. *
    2 A* p$ {: _8 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& ?) f+ X0 J* H$ T4 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 _0 P4 N' e8 Q5 G: I0 o, q4 ?  q
  11. *         TO CHANGE.
    - [2 Y/ D9 }# q% P4 Z: p+ |
  12. *
    7 w1 E; D3 U) b5 i) I. R4 M) ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - b2 ^7 O( f( [, a7 P
  14. *7 h- N/ y& m* l3 G0 C9 a8 w; Z- g, y
  15. * This program is free software; you can redistribute it and/or
    ; G7 e& j" E6 G+ j% @  w( b
  16. * modify it under the terms of the GNU General Public License as$ w0 J, D% t6 F  V, P8 T; B3 E
  17. * published by the Free Software Foundation version 2.' a9 s$ r, r) ]- v: x
  18. *9 ~. i* Z& f" _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 e) @& ~4 D4 I
  20. * kind, whether express or implied; without even the implied warranty
    , u6 p5 B' a9 B$ p4 y, _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! p, m- t7 F1 r9 k9 |9 f+ t$ t  a
  22. * GNU General Public License for more details.
    4 S9 w4 S; _  H- y$ c$ c( Q
  23. */- d$ [% C0 R2 y

  24. 1 Q+ b5 f* A9 o! s- A2 |6 n( r' m
  25. #include <linux/module.h>
    & |: k% X# N  C" S& B2 q0 t( T
  26. #include <linux/init.h>
    ' D2 S  R; f' ^! Y  ~
  27. #include <linux/errno.h>8 M/ g) r) T2 l8 n. w4 T/ n& ]
  28. #include <linux/types.h>8 K$ g( n$ E0 k; s9 x5 j
  29. #include <linux/interrupt.h>1 X  y4 G$ f% y6 T0 a
  30. #include <asm/io.h>: B3 h/ o/ Q9 @/ [  t6 q
  31. #include <linux/moduleparam.h>5 ?8 h. C' D. M9 |, Y
  32. #include <linux/sysctl.h>
    % W  \9 I: ]7 [
  33. #include <linux/mm.h>, t# w9 |! [3 x9 M  t
  34. #include <linux/dma-mapping.h>: ?# H) g/ D9 k) h" d

  35. " p1 ^. X+ z/ P; Z1 i2 o
  36. #include <mach/memory.h>3 \6 K" R0 Q) ]( H  r% |; F' m
  37. #include <mach/hardware.h>  w+ x1 Q! ]6 i9 {
  38. #include <mach/irqs.h>
    $ @" w( f/ d, _* m+ n/ ~( U
  39. #include <asm/hardware/edma.h>
    . ^) v& K9 q& d* Y$ L7 M: P# p# w7 d
  40. 4 U1 m! K; R$ i! D
  41. #undef EDMA3_DEBUG
    + x  C" p7 Y$ A" j( [
  42. /*#define EDMA3_DEBUG*/
    ( R' Q) p* S  h  A; ~, j

  43. 7 i9 F1 A8 ]& g4 v( j$ U
  44. #ifdef EDMA3_DEBUG  q& ~0 N; L7 x$ e$ s0 T  l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 |7 R" R! P" Q* u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 }5 V# E5 _  B1 R* T* _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 V. e. W5 W/ {5 P# [3 D
  48. #else
    " N  J4 U9 i% ]4 r5 M( K
  49. #define DMA_PRINTK( x... )
    + Y& d" l. F+ ^% P! C. V$ q
  50. #define DMA_FN_IN
    & G+ M/ E0 G5 n' z
  51. #define DMA_FN_OUT$ K4 _2 \0 u" ]3 M! C
  52. #endif: |& p( |6 ]* }+ A9 m6 P: o  Z% o
  53. 2 M9 F! |/ K! U* _/ d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 @( O+ q2 ?( s% s' `1 D
  55. #define STATIC_SHIFT                3! f6 O( t! f" O1 Q  N
  56. #define TCINTEN_SHIFT               20) }$ [  y- e* Y
  57. #define ITCINTEN_SHIFT              21. a) f) m! e% c! o# \) q, t, ?
  58. #define TCCHEN_SHIFT                229 `/ O; b' a! r: h- R/ j
  59. #define ITCCHEN_SHIFT               23- g. E9 H- k, `& r
  60.   Z) t) A7 A/ ^& a1 N7 A
  61. static volatile int irqraised1 = 0;
    - H% L0 z# n8 g6 l9 E3 t
  62. static volatile int irqraised2 = 0;
    6 u0 P3 @0 e: o' K8 ~2 N

  63. # W" K4 m$ F4 c/ ]& l, K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 ?% o. e+ [8 b4 s: i* [- R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " h- [9 f* {* x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 G" ^( B  ~" }: e0 N  `
  67. 0 t! |8 a- z( u! w7 L
  68. dma_addr_t dmaphyssrc1 = 0;
    ; H: z! p% ]# x* G6 G
  69. dma_addr_t dmaphyssrc2 = 0;9 |' p& ~# d  Z) h8 b/ C: \1 x
  70. dma_addr_t dmaphysdest1 = 0;
    2 ?: M- F6 E. c; z. @
  71. dma_addr_t dmaphysdest2 = 0;6 M% R% u4 Z+ g* s, _5 j) E
  72. * k' U( Q- ~8 _$ {0 {' d! ^' l
  73. char *dmabufsrc1 = NULL;
    5 Y5 K/ z: p& l3 X
  74. char *dmabufsrc2 = NULL;
    4 q  E7 {& z8 k- A, ^9 o4 g
  75. char *dmabufdest1 = NULL;  g5 c) B* z- _# e3 s4 q
  76. char *dmabufdest2 = NULL;
    * w' r% s- ~- g9 M
  77. % r8 F  v0 o9 K- y+ s& X
  78. static int acnt = 512;
      }# {$ ^  X* X1 i0 [6 z  C
  79. static int bcnt = 8;
    9 m$ w- T5 h' B# k! }
  80. static int ccnt = 8;
    5 _! T+ c* M9 c* S) C' R" x

  81. ' M1 p3 s$ z9 ]# x% o
  82. module_param(acnt, int, S_IRUGO);* k8 u! ]0 x( \+ a* d
  83. module_param(bcnt, int, S_IRUGO);' I4 B3 D2 }2 d- P4 S- w; _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 t: q- s& o+ U" T$ Y" B7 T, N* h
4 ]0 z. n0 V, P' w9 j5 i3 c' K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ C3 ?3 _- R5 f$ y3 n' Y, a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 `# j# r* ~: u" e; w+ R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, D7 A$ v; Q' x4 S  m$ j0 o- a% Z4 ]) w& p' M" x, {
; w$ y+ [* Z  m6 U; X4 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-4 23:11 , Processed in 0.046146 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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