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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* r  w- V% K, K4 z  O
  1. [code]EDMA sample test application7 i  B/ w9 B9 F5 M
  2. /*
    ; V6 @: X* {# |- S  I* h9 }1 n7 p
  3. * edma_test.c& f" Y5 x. s8 U0 R  r' D0 }
  4. *. @9 L" D: I% c
  5. * brief  EDMA3 Test Application
    + I% R2 V; i$ r6 v8 K! Q- I
  6. *
    ' F) R! F* ^9 J! Q* n
  7. *   This file contains EDMA3 Test code.+ N; V$ f# s% \
  8. *% X2 l# z# S- v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 v% f) S( r( A' r% W& \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 w0 \* \6 o/ r4 O0 c' f4 K
  11. *         TO CHANGE.6 x+ M* w  N/ A5 O9 e9 U8 _: G
  12. *
    5 A6 _' }4 P! a( @2 L$ N" @$ i( k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. Y7 b4 O; m8 C8 d% y6 s; D4 N
  14. *
    + F/ y8 j9 z  `- S
  15. * This program is free software; you can redistribute it and/or
    " _9 k% @; g. M! Z$ e$ f3 k
  16. * modify it under the terms of the GNU General Public License as
    & t+ n# g* J2 j' t( ~
  17. * published by the Free Software Foundation version 2.- ]2 ^- Q% k( m& c
  18. *
    + Y. P8 s, z1 J" w2 H! R( L; u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 w. b0 X# j3 R$ I3 b
  20. * kind, whether express or implied; without even the implied warranty6 Q& S# ?: ^# X' g- b1 B4 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, F& G0 s  X; f/ y7 c6 h& v  T
  22. * GNU General Public License for more details.; ?+ {. g" j: M1 P4 W8 v' f
  23. */4 m& m( u8 c- ]8 p' R  J* T
  24. % Z3 ]4 y& Z  N3 I9 f. J! W
  25. #include <linux/module.h>! y+ W. o( N6 x& M9 ~/ t
  26. #include <linux/init.h>
    ( c! n6 m7 r3 Y) s. Q! o- H# S
  27. #include <linux/errno.h>+ _+ V- O; h9 f. d) |6 J
  28. #include <linux/types.h>; o& C0 y4 k* w# r! r0 b7 L
  29. #include <linux/interrupt.h>
    : e! h/ G' L. ?3 P4 y3 C' p5 F
  30. #include <asm/io.h>
      C8 w5 s' q' `4 x3 R4 X9 X
  31. #include <linux/moduleparam.h>8 ~! i& H0 u: _' g8 r
  32. #include <linux/sysctl.h>  G* c  d8 T; w' \* b
  33. #include <linux/mm.h>- P) u# {" O: _& o; V
  34. #include <linux/dma-mapping.h>  Z) M5 q- O( \- x
  35. 7 d% n3 B4 r- Y$ I5 u
  36. #include <mach/memory.h># O. G  ^, T8 Z) N% g1 I( j
  37. #include <mach/hardware.h>
    ! Y% L& E3 r/ J  O
  38. #include <mach/irqs.h>3 n; m. D) ~% ?: n6 i
  39. #include <asm/hardware/edma.h>' ~- n$ x+ F: ~7 U6 u2 T
  40. ' A3 i( l* M# I* o2 `  M% o
  41. #undef EDMA3_DEBUG9 d. ?6 w, q; o; W/ v
  42. /*#define EDMA3_DEBUG*/0 x( c; U/ r$ Y8 M
  43. 4 G  K8 i( {8 D5 \) P9 _
  44. #ifdef EDMA3_DEBUG
    3 R: x6 J& y# n% W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 m! C3 C6 K1 S) D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , O( U, @; g/ `4 k2 \9 W8 i/ n3 p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# a; ?) v2 e* N/ l4 Z  C9 ]3 c
  48. #else! a2 m( G9 z. g
  49. #define DMA_PRINTK( x... )
    $ W5 u+ m' M  V" p7 Z, E
  50. #define DMA_FN_IN
    6 ^; I$ B/ @' Z+ T$ H* L  H
  51. #define DMA_FN_OUT
    3 i3 N+ l. }2 ]8 l9 k$ t8 {
  52. #endif* x& E: K% f" @0 u' G: q# D6 P# F

  53. 1 S9 O% Z- |9 Z8 K; t; s% I- g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 N$ u0 T- D3 r2 t) L6 h+ d1 V" [# p
  55. #define STATIC_SHIFT                3$ Y  _3 T6 P( a3 w2 `) X1 V4 v
  56. #define TCINTEN_SHIFT               20
    + U, Y% [: o/ N8 t9 d. }4 L
  57. #define ITCINTEN_SHIFT              21, Y9 _: Z/ x8 n% y
  58. #define TCCHEN_SHIFT                221 ?9 ]5 ~( ^8 H2 T8 v9 m* J
  59. #define ITCCHEN_SHIFT               23
    , g' B# p# X) ]  A& i$ T' @+ K
  60. * S1 a6 ]2 c+ b0 ~  Z
  61. static volatile int irqraised1 = 0;
    * Z" n) i, R( G+ q# w
  62. static volatile int irqraised2 = 0;8 ]# I9 V: O2 n1 s1 M

  63. : _: x* r$ S$ B& X6 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 ^- q3 w( p5 Q: o! e- w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 h7 R1 t; }; F  ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * N+ V% c8 S6 `9 y1 t& r
  67. ( B& |% t+ ], _
  68. dma_addr_t dmaphyssrc1 = 0;8 {7 a9 a1 ~, a6 M1 o; Q1 I9 m
  69. dma_addr_t dmaphyssrc2 = 0;
    5 C4 N/ m* Q6 J. A1 T$ S& ~6 t  q
  70. dma_addr_t dmaphysdest1 = 0;% N5 |2 Z1 @8 Y' I" K
  71. dma_addr_t dmaphysdest2 = 0;* J7 Q$ I9 p# s3 O
  72. . i- [- p. G/ \" p) @
  73. char *dmabufsrc1 = NULL;8 q& _8 f5 N4 x' z
  74. char *dmabufsrc2 = NULL;
    4 U2 @# a: w& q4 z( e6 f& W/ P
  75. char *dmabufdest1 = NULL;
    , A4 v# V- ^( j0 I) Q
  76. char *dmabufdest2 = NULL;
    . k( N+ u7 l- q

  77. ! }2 G, E) s) L  w
  78. static int acnt = 512;) K' {. n3 D' R* c1 H, h8 e
  79. static int bcnt = 8;  G) W! y/ l. u: P! W! \
  80. static int ccnt = 8;
      |- r* T/ u9 G7 X0 R/ w0 h2 N

  81. 1 _9 B+ x/ o* e2 Q8 d8 J
  82. module_param(acnt, int, S_IRUGO);
    & a5 {( C9 H0 ?/ @( _  ^& u; r
  83. module_param(bcnt, int, S_IRUGO);% J% u5 ~, l& U/ M+ h+ h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 {7 o+ f# \* _7 o( Z8 B
2 e  L) I  C( I! h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 i& h! K+ g( v: l; [; P1 s2 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ n  P% W5 R9 I& D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 S" s+ k! N( X8 B5 q

7 O  Z+ K  U' r- R7 X& {, R9 z! l! t6 b  E$ @. v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 12:21 , Processed in 0.040642 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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