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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + o' x" p1 L" X: b. P
  1. [code]EDMA sample test application. }  L: \, W( h% v5 Z4 `8 X  h
  2. /*
    % X; h5 [+ ]# p, m" x
  3. * edma_test.c* q' k; {' g8 `8 Q6 o5 O
  4. *$ u' c( y1 }* y6 ^) P/ ?
  5. * brief  EDMA3 Test Application
    . n2 R( B+ |6 o- V, h
  6. *; |+ k4 [$ k" J( n5 X1 R8 {- H
  7. *   This file contains EDMA3 Test code.0 A; r* s; L8 Y; e
  8. *
    7 w! R6 h( Z/ ?: D' \9 Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      V5 _# C5 G  U/ h; @3 `$ j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" G2 S! T2 t8 V
  11. *         TO CHANGE.* H7 B" F3 G: R* f7 d
  12. *! D. W! S3 B; |6 j' a! N; o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: ]$ {. m5 _9 L7 Y
  14. *
    ( ~+ n1 l& u  A
  15. * This program is free software; you can redistribute it and/or
    0 Q0 o, b* [" b4 x
  16. * modify it under the terms of the GNU General Public License as) r3 R$ ~) A; W6 Q0 d# X
  17. * published by the Free Software Foundation version 2.* H' v& s6 |, \1 u
  18. *& C# H5 ?% x, J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* H$ B  i2 L% N# y1 G! @$ U* D/ U1 o
  20. * kind, whether express or implied; without even the implied warranty
    ! ]3 v% s" ?3 ^4 U; G( Y) n7 B3 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 Y& }8 c7 ~  x* X! L2 Q! ^4 D* z
  22. * GNU General Public License for more details.
    4 D4 p0 P$ R3 J+ X' c& R% {  R0 f
  23. */
    , T# E1 q8 j. Y1 {8 Y9 g

  24. 9 F1 U! X+ G! X9 r" |! W
  25. #include <linux/module.h>; |' }& p4 Y( [% A) s# o. t
  26. #include <linux/init.h>
    & {! w6 j; p! r$ ]5 }7 X
  27. #include <linux/errno.h>6 x. C: I8 G0 A+ k6 @
  28. #include <linux/types.h>
    8 ]9 z1 S, t% ]1 n  ]5 ]4 x3 l1 o" E
  29. #include <linux/interrupt.h>- S( A3 h# Y% q% F' x, K/ u
  30. #include <asm/io.h>4 v0 Q! X/ q, v1 D4 v4 J* k, }* S
  31. #include <linux/moduleparam.h>
    ) u9 k, |1 n0 S& N8 v' d
  32. #include <linux/sysctl.h>
    * g; {# E) l5 O! ]9 q( g( d
  33. #include <linux/mm.h>5 i) }0 g8 F0 ]- I8 U8 c
  34. #include <linux/dma-mapping.h>0 q* C& {0 P- g4 V/ m" i" O
  35. 2 y) ^9 _' c5 F& l! [0 z
  36. #include <mach/memory.h>
    1 u6 O9 I7 j! b% S) c% D
  37. #include <mach/hardware.h>6 Z) \, P/ D- h# w& Q& {3 g9 ]; r( t# s
  38. #include <mach/irqs.h>
    ' H+ }# N$ {* {' ^
  39. #include <asm/hardware/edma.h>
    ( O1 d; O# ]# `! b1 K7 u( a

  40. / Z: h: z) y+ i- L
  41. #undef EDMA3_DEBUG
    6 ]4 y( P; [, j& i/ I5 b
  42. /*#define EDMA3_DEBUG*/
    6 W, Z# F) ?# b

  43. ' [- w9 @# |7 A  e$ F
  44. #ifdef EDMA3_DEBUG6 N9 H& s! d3 V; C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 g6 G. n( w* r9 c# N; z$ Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " l: T5 t4 z& ?9 g2 z& v- W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 H4 Y9 w( o4 G- [- ~
  48. #else: ?. D$ v$ |% I) Q6 Z3 }8 r1 ^, Q
  49. #define DMA_PRINTK( x... )
    ; g2 W- K* M- d( Y: ^
  50. #define DMA_FN_IN. d6 U; b2 A) Q# G# b0 }* k
  51. #define DMA_FN_OUT! t% ^( G/ k. }0 o5 {% ^
  52. #endif: x4 R# O9 s) `5 {' [

  53. , F2 D. }, r( n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , B- l* U$ w  n! j7 M
  55. #define STATIC_SHIFT                3' P, y( e* O4 J) |
  56. #define TCINTEN_SHIFT               20
    3 D8 G- z. W! K7 R  o
  57. #define ITCINTEN_SHIFT              21
    0 P4 N" q! r! P0 n# U, f
  58. #define TCCHEN_SHIFT                22
    * D, s, N  u5 r
  59. #define ITCCHEN_SHIFT               23
    / i$ N) o: ^9 X1 i- r

  60. 7 q4 X8 O- @/ v, q" @% K
  61. static volatile int irqraised1 = 0;
    3 P( [/ Q/ Y2 d# w
  62. static volatile int irqraised2 = 0;
    # C" A+ o* [5 ~+ S0 n$ v( K

  63. 5 W) ]; |- m( @9 x2 r! h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 d) b* z8 O. t  U/ P6 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + C$ d5 S3 ~' e. w$ h, t' d! R  t3 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 v9 r8 H# f4 f& F

  67. 4 ?) U. G; y1 U# N+ ]) \
  68. dma_addr_t dmaphyssrc1 = 0;
      t) e: E# |: l' F  v7 ?
  69. dma_addr_t dmaphyssrc2 = 0;
    9 ^( x9 E# ?, y& D7 ^( t; }& m3 o- D
  70. dma_addr_t dmaphysdest1 = 0;  N! B2 E& r) ^
  71. dma_addr_t dmaphysdest2 = 0;
    % y8 H0 f  N3 w, X/ y
  72. " N) W9 q3 b' d3 C9 E9 m, `6 V
  73. char *dmabufsrc1 = NULL;
    ) V% @% ^1 v' j! n. G4 n9 f3 G
  74. char *dmabufsrc2 = NULL;
    ' b  A; {( t1 ?
  75. char *dmabufdest1 = NULL;) t$ g: _$ L8 h. r7 `- l, Q% b% s
  76. char *dmabufdest2 = NULL;9 [; D2 c% ~* z

  77. 4 ?  `9 G9 c/ {* _
  78. static int acnt = 512;$ _7 J% m: r) p  `% u0 v* d- s& b
  79. static int bcnt = 8;! _4 X. F1 f* o  ]+ r
  80. static int ccnt = 8;. Z! d+ K2 f2 F( [" S) d- q

  81. - {; ^9 g% _2 x: G
  82. module_param(acnt, int, S_IRUGO);, x" K/ t4 s" n- i3 E* P0 L
  83. module_param(bcnt, int, S_IRUGO);" y# R6 f$ {  d3 O$ a, \( Z! F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 c# {; m: c9 N# p( g
2 D. D- l! a( }3 C1 `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ Z6 Y3 K* f0 p/ I. E9 x$ X0 larm-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 U+ p  S/ t) U6 e* c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# p# u8 r0 ]* B' g; Y8 ~/ V) l3 ]* j8 ~5 a- ^: g+ l0 X6 w+ ]
% i! h9 Q4 J- d' B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 23:04 , Processed in 0.039528 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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