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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! }  H" c* s3 v1 Q8 v  O7 f1 |
  1. [code]EDMA sample test application
    2 K* p. Q# w8 U  ~' R  K
  2. /*2 I7 x8 ?6 w1 B7 q+ A
  3. * edma_test.c' r" d1 S1 d8 q5 Q8 O* z
  4. *
    4 ^; v9 v: K$ F* e
  5. * brief  EDMA3 Test Application
    : m) K* k" `% ]7 P9 N7 O1 E/ @
  6. *
    ) x  D* h* I; b, |6 x# M
  7. *   This file contains EDMA3 Test code.
    : h% L1 V; w( ]; b! a0 d
  8. *
    6 E+ c) j9 k9 p9 N7 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 q2 B9 v4 x/ E7 B; w: ?4 |/ r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , q6 ^3 t0 u7 ^5 H
  11. *         TO CHANGE.
    2 t9 ?. G  \7 g1 ?6 N" P
  12. *0 v$ ~, J+ ^; ]' |/ A. k2 p% b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ ?9 L$ C/ ]. P5 G' g1 G1 C0 U, I
  14. *
    ; P0 f/ y# M% d9 @0 E
  15. * This program is free software; you can redistribute it and/or
    # ~9 P) S3 W2 r: d2 ?% F% y/ ^0 |% X' @
  16. * modify it under the terms of the GNU General Public License as
    1 R! B! C: [  M
  17. * published by the Free Software Foundation version 2.
    ! P0 k$ G1 }! Z  n$ r2 i/ \
  18. *( h4 h  h1 z9 E( y1 O; V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 q; @9 ?: \; D. V$ u& p7 o
  20. * kind, whether express or implied; without even the implied warranty
    6 S/ K: Z( \4 e% b# I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 }3 _3 J1 \, l
  22. * GNU General Public License for more details.
      P( m# B! ~0 C8 ?3 d
  23. */
    8 F) Z6 C5 e# w: t
  24. * K* A/ n: _0 D; f# h
  25. #include <linux/module.h>7 Q7 I7 y! M8 v6 P1 h4 g
  26. #include <linux/init.h>
    - Z% a, C' o, a9 H# V
  27. #include <linux/errno.h>
    2 G' G# _( C; g! W/ j( m" m9 q8 U0 [: o
  28. #include <linux/types.h>
    + w! G" d3 D) O8 r& ?2 E% x' N+ v
  29. #include <linux/interrupt.h>( ~5 r5 t2 s% V
  30. #include <asm/io.h>
    # N) e: C6 u- N/ b
  31. #include <linux/moduleparam.h>, ?" f# B3 [% N7 E
  32. #include <linux/sysctl.h>* s! a3 L+ R6 ]$ J6 k+ w. C
  33. #include <linux/mm.h>
    . C5 k/ q9 i- R% {. t( }  U; D3 Z
  34. #include <linux/dma-mapping.h>
    1 l4 S% N: c5 o3 L; e4 P0 s9 ]7 Z
  35. # o& O3 B* ]( V. k( D* m
  36. #include <mach/memory.h>/ i) a- d  m0 z- |
  37. #include <mach/hardware.h># h" d0 i" G5 w+ v; G
  38. #include <mach/irqs.h>; q, j0 a/ B( R
  39. #include <asm/hardware/edma.h>
    $ L9 [9 K$ h4 s
  40. 9 v0 k% l) \- K8 s6 i
  41. #undef EDMA3_DEBUG; C, [& |7 m. F) C( w, @1 b% Z
  42. /*#define EDMA3_DEBUG*/
    # y- w  H: l5 e" K& h2 Z; W
  43. ' i. ^( o. E/ Z6 Q1 ?
  44. #ifdef EDMA3_DEBUG& [% U+ [, R* w* z8 c) V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 P& F! ^; r1 f8 K: `8 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 Y2 |/ G. C1 U3 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); v$ d) A, M1 P
  48. #else
    2 B' L; ?7 C+ Z$ f4 a% t
  49. #define DMA_PRINTK( x... )
    / y7 s- t7 f! ]7 ]% i7 w3 g
  50. #define DMA_FN_IN$ d) c: Y1 a$ g& y- r
  51. #define DMA_FN_OUT9 W' p2 B2 s/ t$ v9 A2 a% \
  52. #endif
      A. X& ]; j8 c8 Y) e# m9 q

  53. 3 j$ Y3 ?& B  ?. h% Y5 x/ N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), H" |) G0 {7 V( G/ B" z0 `
  55. #define STATIC_SHIFT                3
    / ~  R" ]/ q: `
  56. #define TCINTEN_SHIFT               206 a6 V" Z+ w9 k! G5 K/ m! D
  57. #define ITCINTEN_SHIFT              21
    5 b! F. ?$ I) q# u6 _- |/ V
  58. #define TCCHEN_SHIFT                22$ A1 e7 d7 M9 q9 I+ U
  59. #define ITCCHEN_SHIFT               23
    1 g/ T' _+ s5 D

  60. 1 u: I  N& v$ g# N
  61. static volatile int irqraised1 = 0;
    5 H9 V9 L+ c; V; {
  62. static volatile int irqraised2 = 0;& R0 r" d5 }4 U, \9 }
  63. * b' N/ _: H( L4 C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) n# {. g  J3 ~0 x# _! p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      d& }% n/ l! r! T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; k- |0 X- a! _& x& F0 V
  67. / O6 A8 w( O! e: ~( t9 Z
  68. dma_addr_t dmaphyssrc1 = 0;) ?7 e3 Y; m2 C( ]7 f+ ?
  69. dma_addr_t dmaphyssrc2 = 0;; t! ?' Z" S6 S$ r7 l* K
  70. dma_addr_t dmaphysdest1 = 0;& F1 M+ _* ?) F
  71. dma_addr_t dmaphysdest2 = 0;. S% x, K1 A/ w/ P, a& z

  72. . S1 h) Z4 Q0 V  h
  73. char *dmabufsrc1 = NULL;' z; s  u' R, M& Y& c, h
  74. char *dmabufsrc2 = NULL;6 ~/ F# k2 b: e5 h, ?6 A: l& I# O
  75. char *dmabufdest1 = NULL;4 J- D6 i  Q: c! Y  |/ R
  76. char *dmabufdest2 = NULL;
    & J: Y+ p# V6 Y- g3 l3 N! R2 e

  77. & W3 ^% _7 c/ Y: j( Z2 ~3 l6 O3 x* V
  78. static int acnt = 512;; p; J3 i1 i3 g3 W1 B6 J- d
  79. static int bcnt = 8;
    0 t$ A; W1 Q* d- g6 N# K) o
  80. static int ccnt = 8;
    / H2 R! o% u5 d  B0 B/ g! P6 r4 R8 g

  81. # Z$ {3 z" `- k* `/ m! t* M
  82. module_param(acnt, int, S_IRUGO);
    6 C6 T% y: |. K9 e8 {: W' P3 G$ J
  83. module_param(bcnt, int, S_IRUGO);0 P2 e/ n8 Z% A+ Q1 _0 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* }# }; p3 g' g9 H* E  N6 q: E9 s
- Y/ C8 x7 `7 @0 g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 \1 h$ p7 \& I& h" S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 d$ ~3 }2 C2 ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. Y( M! ~4 \& z! L" a
& g9 X; c. a! Y( q. D  `
9 j4 Y* f  R+ Y9 y" w9 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 16:39 , Processed in 0.039516 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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