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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 d! B: \6 M0 o* i5 g" f
  1. [code]EDMA sample test application+ U5 ?% n* v  r/ F+ H) \# \; W$ O
  2. /*
    ! |. e* Y; Z. i
  3. * edma_test.c8 q( [1 _( H, g, _! M- t. d
  4. *
    ( X2 \1 W2 R- D2 M, g  W! g- p
  5. * brief  EDMA3 Test Application
    1 ]2 w* u9 _; i/ m# v% P( M% }, {
  6. *
    7 q1 x1 B8 y- U8 Y3 t0 t
  7. *   This file contains EDMA3 Test code., j7 |; U, e  V! C. J
  8. *
    2 s7 S. O# l' a9 J9 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " z, U$ o9 E( Q! q# \& B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  U" I, f- Q1 A. F- Q
  11. *         TO CHANGE.
    1 b3 \; O) P  O! }
  12. *
    % O& H8 c$ h- F8 E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( R# `0 d+ v5 I- e0 n
  14. *
    " L) t1 f7 h* z. T4 N. S: H
  15. * This program is free software; you can redistribute it and/or- K, m- D9 A( ~$ b& \  s
  16. * modify it under the terms of the GNU General Public License as
    - _, T# P2 l6 O4 X/ m7 o$ j
  17. * published by the Free Software Foundation version 2.8 K) E0 h0 L* x$ ~& @6 @* I8 F  E
  18. *1 `( `6 m' _6 O" D+ Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + A9 M1 \8 D0 @3 R( ]0 }0 t
  20. * kind, whether express or implied; without even the implied warranty
    8 w+ `" h+ c0 q5 G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ {1 k3 o  `* }  o- u
  22. * GNU General Public License for more details.- R! p: z$ H* m& u7 g9 n# _& q" o
  23. */- l& k% l# K$ K' Q( a

  24. / q$ l& y3 E( v3 [
  25. #include <linux/module.h>
    ; O, X. h. v: i) i. o/ e
  26. #include <linux/init.h>
    6 D* M$ W- r$ s2 A1 F
  27. #include <linux/errno.h>. I, {2 Q6 y6 a) D$ ]  P
  28. #include <linux/types.h>
    2 G- j- n+ f- L$ w! B8 j1 Z
  29. #include <linux/interrupt.h>1 U$ |2 N. V/ x* y9 N' W
  30. #include <asm/io.h>2 V! h3 J; v: P
  31. #include <linux/moduleparam.h>9 c# L! Z( x1 L. Z
  32. #include <linux/sysctl.h>
    , g8 e6 W# [7 P" ?1 X. q
  33. #include <linux/mm.h>
    $ u: G4 k5 \0 J- n. j$ D, D" q
  34. #include <linux/dma-mapping.h>1 }$ _) ]; {9 B. J0 M0 P

  35. ) l/ w+ u+ @7 q! r! o9 c5 c$ S
  36. #include <mach/memory.h>  P+ n% y  v: h
  37. #include <mach/hardware.h>
    - K& n( z$ A5 o4 t
  38. #include <mach/irqs.h>
    , a* w8 U+ u+ D) E- x2 K/ B
  39. #include <asm/hardware/edma.h>" K7 c& [) t+ ~

  40. 0 r0 \4 r8 H% y1 L
  41. #undef EDMA3_DEBUG
    3 |9 w6 N* h! _1 u" e
  42. /*#define EDMA3_DEBUG*/6 L7 @0 N. I. a5 F6 g8 R
  43. : s- T; f4 _& U' p# l
  44. #ifdef EDMA3_DEBUG3 u& G! N+ l& t3 J# q1 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 P4 l9 ]* R! H8 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( M7 S7 |" a/ l+ ^7 j! x: e& o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " p$ N9 Y. }1 |2 W, E
  48. #else0 T, ], b/ Q0 l$ p+ L1 u
  49. #define DMA_PRINTK( x... )/ a; C+ [2 n; `0 Y0 x& ]
  50. #define DMA_FN_IN6 X) D! S1 Z$ @
  51. #define DMA_FN_OUT
    ) S9 G6 F& @7 P$ I5 L
  52. #endif
    0 J( h- E/ Y% \* S8 K
  53. 4 e/ ?, W+ g5 T* D6 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' B; n6 G5 N  j
  55. #define STATIC_SHIFT                32 Q4 W, E3 ?' z( t4 i
  56. #define TCINTEN_SHIFT               20
    ) K  w1 u* u/ Q3 F* K; p5 V* v
  57. #define ITCINTEN_SHIFT              21
    / _- p( D+ I# w" N
  58. #define TCCHEN_SHIFT                22
    ' @. A! w. d. j6 o
  59. #define ITCCHEN_SHIFT               233 J: |, s3 C2 N$ ^

  60. 7 `  S  d9 Z6 G! }- e
  61. static volatile int irqraised1 = 0;' w5 u, h( p$ g) N7 Y9 ^
  62. static volatile int irqraised2 = 0;
    3 O4 L( d" j2 \
  63. & d' `- f( e+ s7 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 q+ L1 F- b* \1 T! ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 l5 r1 N% l; I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , d5 `! ]% t. r3 \3 B& g
  67. & W9 M# `! X  n3 X! K* l) U$ H+ g
  68. dma_addr_t dmaphyssrc1 = 0;
    8 T/ m# v% p6 @( T: [/ G
  69. dma_addr_t dmaphyssrc2 = 0;
    7 a; Q( T* b/ Y8 S4 ~; k
  70. dma_addr_t dmaphysdest1 = 0;
    , y4 l# e7 D' s
  71. dma_addr_t dmaphysdest2 = 0;
    $ [% B5 D) t; i% T9 d' G! E
  72. , y: q* s( J( H# r) m0 |# i) y/ r( v
  73. char *dmabufsrc1 = NULL;1 `8 y2 A& ~- H! R* G, N" x
  74. char *dmabufsrc2 = NULL;, ]3 o9 U, p3 `' G/ t6 S  N% ~
  75. char *dmabufdest1 = NULL;/ K8 U6 O6 N( }$ S) X
  76. char *dmabufdest2 = NULL;6 A* K: c( N+ l, v/ g

  77.   F% z' P9 Y, N% L  G  ?
  78. static int acnt = 512;
    & ^$ _# ?4 b1 V8 m) h* q) U
  79. static int bcnt = 8;8 ~8 Y- a/ u/ k: h2 V
  80. static int ccnt = 8;7 E3 E+ D) C. j+ g6 z( B

  81. % j$ g# _0 u5 T' z9 }% t$ V
  82. module_param(acnt, int, S_IRUGO);% O; W# g  C4 g0 Z4 P* u
  83. module_param(bcnt, int, S_IRUGO);  Y3 h, b; D, }# Y( R; X/ Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 Q: u" C4 A' R, R9 u$ e3 }; j2 S$ n  Z& K' q% d; A6 A% U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 S# x- |$ }& u7 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ W1 p- v$ g/ l4 _$ D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 Z% G/ j" m1 U, N) f6 y! s0 R
3 [9 ?' R( Q! I2 b6 h' h

5 x: \( ^" n" P7 ]$ w6 c& r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 11:54 , Processed in 0.041235 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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