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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! e' e* I6 X- N# R# O9 I5 n  H4 S
  1. [code]EDMA sample test application
    - ?& ~: |+ `0 c: R
  2. /*$ S& ?7 ]0 c: X7 x& E
  3. * edma_test.c
    ) h# u$ `7 X  `! n% K' N: w; L
  4. *9 j  U6 _5 F% P8 j* D
  5. * brief  EDMA3 Test Application+ U# g$ j# R# @$ o& Y
  6. *( X9 ?( y& Y, ?, e& }6 G; \
  7. *   This file contains EDMA3 Test code.
    " _. G* o; I  @( I
  8. *
      Y2 U; {( r. e6 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 q& E7 w: l% z# i5 A0 @3 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; c; x2 f0 B& w; b9 l; c
  11. *         TO CHANGE.
    , O" s! a2 E6 F/ r$ d; @
  12. *
    9 p8 f) Q- ^8 `  Q1 ]' u, u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* M( i, i4 o1 d
  14. *
    % Y! z# d: }& ~+ k
  15. * This program is free software; you can redistribute it and/or
    & j4 U7 ?2 K" N$ Q- t
  16. * modify it under the terms of the GNU General Public License as& Q4 w4 B& `8 s% G  a1 X7 @
  17. * published by the Free Software Foundation version 2.
    ) `0 y# c7 N7 ]$ K% U2 V; ]
  18. *
    5 r; V! u# |* V  k; ^0 l7 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 Z; B3 u0 `3 m$ U: a5 Z9 x
  20. * kind, whether express or implied; without even the implied warranty! ~) W; t; ~+ K# C) b" x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 h) g0 n9 Y) O- T$ W
  22. * GNU General Public License for more details.
    / b" p0 Z  \) E
  23. */
    2 x, t5 m( w! ~, `4 C6 z
  24. ; Y5 \0 t0 c8 m
  25. #include <linux/module.h>
    3 w0 A( y2 w+ ^( e) m
  26. #include <linux/init.h>  [3 s5 P; F! E' H
  27. #include <linux/errno.h>
    % S& M6 J4 ]6 ~& A
  28. #include <linux/types.h>
    " n1 `+ i4 z& H
  29. #include <linux/interrupt.h>
    % S6 V' n, a" _; l
  30. #include <asm/io.h>
    / v$ |3 J4 A& ?
  31. #include <linux/moduleparam.h>* m& y. i, a; [, Z4 k+ S) [: W
  32. #include <linux/sysctl.h>& S$ L0 _  e, |1 p5 r8 [
  33. #include <linux/mm.h>) x/ R$ G4 F. q9 u" ?0 }' W9 h
  34. #include <linux/dma-mapping.h>; r9 ~7 X; C" R) c" Q/ A7 Y

  35. 3 W  [  I  T( M- V" x
  36. #include <mach/memory.h>
    7 r/ {7 N& s% P$ ^/ b0 Q8 ~5 _
  37. #include <mach/hardware.h>$ @' x; F+ G3 V, {4 L
  38. #include <mach/irqs.h>
    ( T" u0 c$ H+ S1 _0 b
  39. #include <asm/hardware/edma.h>
    4 K; O  Q! v+ F- _5 e: W- V

  40. % J  c! k8 U, J% E3 A" Q) W
  41. #undef EDMA3_DEBUG
    ( T: H: j1 ?% ^4 W9 x4 w
  42. /*#define EDMA3_DEBUG*/8 M# ~" z4 w( {% c
  43. 0 j3 Q* L4 }2 c) O
  44. #ifdef EDMA3_DEBUG
    0 h' x" ~0 L7 b: w" \! |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ ]# Q' L2 B5 `  ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 _! \8 f( I! ?! k' r- P, b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* T' c0 b- H, ~9 V
  48. #else
    $ B. T# V; @: {+ f
  49. #define DMA_PRINTK( x... )* e1 U8 q/ u/ e+ n. p& U5 M
  50. #define DMA_FN_IN
    1 b( Q% c) j$ i! c
  51. #define DMA_FN_OUT. [: S" [! n% C* I
  52. #endif
    9 f. k- {  r% K' ]  S1 L8 v

  53. , p$ {- x' U6 d* \8 ^" Y. _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! l4 G9 M3 ~% G7 v% [
  55. #define STATIC_SHIFT                3
    0 c( g6 H, i" m2 A
  56. #define TCINTEN_SHIFT               20* z5 ~$ t8 A$ O/ `
  57. #define ITCINTEN_SHIFT              218 O% x7 U: c5 v" F$ M1 ^6 W0 n
  58. #define TCCHEN_SHIFT                22/ T& _# I- |9 \) c# r+ d) c
  59. #define ITCCHEN_SHIFT               23; F8 i+ ?  Q1 S1 p9 j, X. |2 F

  60. 3 V0 N& g* D  ]1 d( c
  61. static volatile int irqraised1 = 0;6 h0 V( m) X- k/ J
  62. static volatile int irqraised2 = 0;+ t$ P  K% d3 v  m
  63. 4 b- K/ v  Z8 _  z+ E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + `  n0 A8 r8 `3 s6 E/ @/ T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 \( `( W& V& v/ Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % |/ Y4 L9 [3 p2 ?, T! A
  67. ! o, m& F  h" \5 ~, z; w. o
  68. dma_addr_t dmaphyssrc1 = 0;" i7 X5 j! i* G) t% }6 M4 G
  69. dma_addr_t dmaphyssrc2 = 0;. I5 ~* b. U0 ^
  70. dma_addr_t dmaphysdest1 = 0;4 D( D4 m" A2 N7 p! R! y
  71. dma_addr_t dmaphysdest2 = 0;- C7 ?- [7 y1 s4 F1 z

  72. ! r: s* \" K% K4 e. g
  73. char *dmabufsrc1 = NULL;
    ( [: E+ h6 z( e) M7 R- f7 h
  74. char *dmabufsrc2 = NULL;  v1 p% p3 p0 c+ p8 v$ N
  75. char *dmabufdest1 = NULL;. a; Y& |9 s! I, ~6 t
  76. char *dmabufdest2 = NULL;  `$ s: D3 R, T$ `
  77. ; i' T0 w6 n1 ^; y5 w0 B9 D/ s
  78. static int acnt = 512;! t# D. {2 P5 J* j3 e
  79. static int bcnt = 8;
    / J7 F& T% `2 l( h, z! u
  80. static int ccnt = 8;. P5 T+ n: c# f( a
  81. # A1 R5 n! l5 @. x
  82. module_param(acnt, int, S_IRUGO);
    / @+ ~3 K0 p# H+ \# i5 ~
  83. module_param(bcnt, int, S_IRUGO);: }/ `* t: K. Z. X) q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" H, Y4 m; m5 ~
/ F* T) h8 z4 K6 {  N, R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* B3 k( w1 D5 o  h. f7 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 T  i5 y  a$ D% R2 E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 K. x( X6 ~* ]! `8 J- |, P2 R" |4 h8 j0 e

2 z2 Y, ~) f( |7 _5 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 08:25 , Processed in 0.045315 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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