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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 q: J0 g7 p* e# ~8 _; B5 Y
  1. [code]EDMA sample test application
    4 g4 R& }& b( d1 S) f% B
  2. /*
    ; o4 H1 _" K* Z' T* _0 G4 [& w
  3. * edma_test.c+ m; m( y8 Z2 m9 [/ i
  4. *' S3 u( d1 e) a. M0 f" v1 s" a
  5. * brief  EDMA3 Test Application
    2 E* V0 z6 N9 D! o' _5 w9 ]
  6. *
    + X, }2 p& U$ y0 o
  7. *   This file contains EDMA3 Test code.
    % @. b6 v7 ~( E9 v
  8. *
      M- j- Y) l* L" m: G3 d, u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 r, O2 `% Q0 h5 q) }5 E! K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) O/ n+ k5 S; R& D
  11. *         TO CHANGE.
    1 h, f1 K+ }6 l7 w+ k2 |
  12. *
    / _+ T* u+ `/ P# f# y$ K+ H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* m' O1 C  {! g9 \' R8 g' H3 }
  14. *
    - k/ G; w! `/ \1 \! s, e, C- e
  15. * This program is free software; you can redistribute it and/or# S7 ]% @0 Y4 P% X
  16. * modify it under the terms of the GNU General Public License as
    " k5 P4 k- O9 v' |: R- ^
  17. * published by the Free Software Foundation version 2./ r3 k3 ]' P4 H8 [% C6 m' F, @
  18. *
    5 s4 V7 A7 @! O2 O- u  \( |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * q3 T- l+ k, l& K* c0 Q; s: ^
  20. * kind, whether express or implied; without even the implied warranty$ M% ], y$ R9 ~) |3 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 o4 Q: k8 }! m8 [2 G
  22. * GNU General Public License for more details.
    * I# v% C' e2 f+ p2 n
  23. */) H( d$ k& K4 D! u

  24. - o6 Y1 ?0 L& [# c' r
  25. #include <linux/module.h>6 r6 N* V+ `5 l! H
  26. #include <linux/init.h>
    + b. j0 k. `- @& D
  27. #include <linux/errno.h>
    5 O2 t, C8 S% H  F
  28. #include <linux/types.h>
    6 \/ E6 O" f& p0 d
  29. #include <linux/interrupt.h>
    ; D3 D" l1 V% }7 A$ B
  30. #include <asm/io.h>9 j) {' k) W% o6 |; A1 u" Y
  31. #include <linux/moduleparam.h>
    % u% m( T* ~$ P, e( j3 ^
  32. #include <linux/sysctl.h>9 R+ G: f/ q" B1 a! N5 I6 }
  33. #include <linux/mm.h># c, q: c8 z2 N2 p! ]6 o, n
  34. #include <linux/dma-mapping.h>0 s) e' V! H) [3 {+ R, U7 [
  35. % l3 l) k0 i& {0 F) U7 _% t
  36. #include <mach/memory.h>2 J1 D: k! A( N; p) M+ p- G
  37. #include <mach/hardware.h>
      M% _% o" s" C( w7 ^
  38. #include <mach/irqs.h>( @$ f  N- |) b: @9 |
  39. #include <asm/hardware/edma.h>. Q, p, O3 _: ^/ f4 H

  40. % V) P5 I1 N% b; R' k3 @5 ?
  41. #undef EDMA3_DEBUG
    9 o! m1 O& ^8 Y+ c6 R
  42. /*#define EDMA3_DEBUG*/
    * m/ Z: b& \2 f& t$ s* m3 d  w7 x
  43. - I! \% C) ]3 }* p  u& j
  44. #ifdef EDMA3_DEBUG
    7 e7 q1 S& `& R3 [( ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & ~4 @0 V* `. i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) A4 r' q$ N3 D  _( z2 f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! t4 q$ b- D2 X
  48. #else6 _1 h0 |+ d" e3 T
  49. #define DMA_PRINTK( x... )( P6 Z- b6 A' G( {- j% H
  50. #define DMA_FN_IN
    $ S  a$ {: e& j$ b
  51. #define DMA_FN_OUT8 J1 y& c% J. [1 s' W- r  p( I
  52. #endif" ]$ q3 B) U) l8 Y: G' f3 I8 Q1 D

  53. " h& I2 U& G3 O: E( x# [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( h1 U/ C& n1 b! A4 E
  55. #define STATIC_SHIFT                3% Q5 O" Q; K# f
  56. #define TCINTEN_SHIFT               204 b: s9 U% T+ |) ~
  57. #define ITCINTEN_SHIFT              21. c$ p6 ]* a  D  r' `8 @4 k6 M
  58. #define TCCHEN_SHIFT                22
    4 S, B) L9 E2 K1 {/ Z. E
  59. #define ITCCHEN_SHIFT               23
    / K( D3 `* W' \7 E# Q3 e$ q" r4 P1 B

  60. 8 `# E1 K/ }6 ?* F! L
  61. static volatile int irqraised1 = 0;8 f" H( s& D4 b6 Z& Y9 Y) Y
  62. static volatile int irqraised2 = 0;0 T9 b! V1 b( V# e4 f

  63. % ]9 p# I  f6 u9 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : \. j5 t! c" A* Z0 z, p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 f1 t5 E/ {3 G+ C8 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 C! A. J. C; X. Q
  67. , Y8 j% `/ a  a$ O) ^% y$ I  s
  68. dma_addr_t dmaphyssrc1 = 0;5 F, G" B$ D9 j9 k& v
  69. dma_addr_t dmaphyssrc2 = 0;
    6 w* ^1 Z5 j6 x) s0 T! u/ B
  70. dma_addr_t dmaphysdest1 = 0;
    # E  T8 L; v- ?
  71. dma_addr_t dmaphysdest2 = 0;- V) s. P% ?+ g6 \. e$ Z) [& ]4 S

  72. $ K) L/ n7 w" `0 V. L
  73. char *dmabufsrc1 = NULL;/ i$ F( m/ h) c$ A3 Z4 ?
  74. char *dmabufsrc2 = NULL;' V/ G6 J3 Y5 _8 C/ Z
  75. char *dmabufdest1 = NULL;
    4 }; |( ^+ q0 w: Q; r( |5 s% P
  76. char *dmabufdest2 = NULL;4 D$ u; P" T& P2 z: {

  77. 5 G5 M! P* s" L. Q& D5 B0 Z7 ]
  78. static int acnt = 512;
    1 G- }, F  S3 F; p! O3 p4 s& s
  79. static int bcnt = 8;  ~; B* r4 A3 n. Y4 V9 W
  80. static int ccnt = 8;7 B( x7 c" s& N3 p

  81. 2 }; V: p. b9 c
  82. module_param(acnt, int, S_IRUGO);. N$ A+ `1 G3 X& [& [' |
  83. module_param(bcnt, int, S_IRUGO);
    2 u4 ]4 t9 b. y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" O+ u/ P" [/ j; R( G

$ H+ d' N! d4 @  C9 u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 G4 T" @0 R- X7 {( s6 n; n2 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# f3 g: A, t$ y' `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 z) t, P. d' @; ^1 }3 y
2 @2 V0 g  n* ^
. j. `8 J; W9 d6 a6 o: J- G) b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 01:00 , Processed in 0.039092 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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