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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : j5 P$ G+ z/ A" [# ~
  1. [code]EDMA sample test application$ L9 k! [# ?1 L" N4 V3 T- m
  2. /*
    / k. [' b% v# G& \6 }
  3. * edma_test.c
    " e# k% v# B# Q6 e- Q
  4. *
    . w$ p3 W/ x% E6 J
  5. * brief  EDMA3 Test Application
    ( r: D4 s6 F6 i
  6. *
    4 P! V+ ]+ [2 g5 _4 b7 [0 \
  7. *   This file contains EDMA3 Test code.
    ) i; @( E: U- B$ ~  S7 Q
  8. *% I% b  x& i0 O! ^. q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , E7 Y+ B4 M/ N4 M: l! T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . Y# y; {# `0 b& y
  11. *         TO CHANGE.' e& T, X1 A; H- O
  12. *6 [3 {) ~7 _3 x0 K3 G, _. f. f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ e5 U/ ]0 f) y! c) \8 U6 v) }3 V% E
  14. *+ k# w4 D8 a  ~" t
  15. * This program is free software; you can redistribute it and/or
    ; N% m3 o" X6 Q* |8 U# g* |& [
  16. * modify it under the terms of the GNU General Public License as
    ! {; t) N7 P0 f3 S/ w9 D  h
  17. * published by the Free Software Foundation version 2.: v+ G# y* k& E) q- j
  18. *
    / n5 `+ l  R9 ]/ N- K) ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 Y% e8 U* M: i0 ~( z7 v
  20. * kind, whether express or implied; without even the implied warranty
    5 J& R+ U1 B, d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' F1 T: Y% n9 m& g) t( x/ `
  22. * GNU General Public License for more details.
    + E$ |: v4 k( j
  23. */
    2 Q& s. g3 \8 F6 g$ M
  24. 7 I5 j. P4 }8 \3 `
  25. #include <linux/module.h>
    ! Q7 j) K* |" c9 U7 q( Y
  26. #include <linux/init.h>
    5 d! F  e. b# R+ t! v6 Q! Z* e: L1 C
  27. #include <linux/errno.h>
    " ^3 t$ \3 y* I& a9 Z4 p
  28. #include <linux/types.h>
    # \2 Z' h9 q( x% w! D
  29. #include <linux/interrupt.h>" a$ x; k) Z; Q/ f) H8 ~" X
  30. #include <asm/io.h>
    1 ]3 V9 b& Z) a6 f+ u: O% t( K
  31. #include <linux/moduleparam.h>
    6 ~: P. Q  d: Y( g0 _4 H8 [8 l
  32. #include <linux/sysctl.h>
    & Z0 g/ s4 |  t! f5 S# ?. w& g+ a
  33. #include <linux/mm.h>
    ; [1 I; E* H4 V; w
  34. #include <linux/dma-mapping.h>" L3 w& l2 l9 B) D; C, u8 l1 S' d

  35. # M9 m9 ?  d; [: j) V' D
  36. #include <mach/memory.h>
    * B+ f+ p8 _5 h' m
  37. #include <mach/hardware.h>+ A8 j* y$ D, Y- I
  38. #include <mach/irqs.h>
    0 V/ V  r1 C# k% s4 _+ K; c1 h, D
  39. #include <asm/hardware/edma.h>- Q5 v9 V/ Z1 H4 K4 m; V1 ^8 n" f

  40. 3 m3 `0 d3 H7 L
  41. #undef EDMA3_DEBUG$ Y. e' c/ w7 }( S) F
  42. /*#define EDMA3_DEBUG*/
    ! }+ ^5 J6 K% _2 F$ s
  43. 5 n- t" H, \4 @4 |1 `, z, b
  44. #ifdef EDMA3_DEBUG
    ! K3 P. K7 K5 Z1 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 ?" O. d; U4 T* o+ p, p" v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - E! }' N: P2 [! `3 e, [. b: V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; E2 F4 A1 [4 l
  48. #else
    0 w) o' y. K5 |, e
  49. #define DMA_PRINTK( x... )6 y5 _! l& Y1 u5 C' Y4 G5 m; Q
  50. #define DMA_FN_IN
    : A: f3 G! O! l
  51. #define DMA_FN_OUT0 `( h: }/ I% \5 _
  52. #endif
    + y1 |& y) @1 v4 D1 G. g* s+ ~- u
  53. 2 T* k& j- ?  @) z5 q' X( F- o  r: x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , f# ~& E* ~. x" P  g! t& G
  55. #define STATIC_SHIFT                3
    ( C" v) b1 s2 A1 o; a0 M
  56. #define TCINTEN_SHIFT               203 C- o! m8 F# {: \5 e
  57. #define ITCINTEN_SHIFT              21
    & e; d# f/ }2 N  g/ `3 u0 u5 G
  58. #define TCCHEN_SHIFT                22
    8 [. M2 F4 ~0 U. |6 h% h3 M
  59. #define ITCCHEN_SHIFT               23; z9 J0 ]6 L2 L4 v' R: I
  60. 2 f; ~) _4 @5 ~3 m1 m7 r) B
  61. static volatile int irqraised1 = 0;
    ! Q! Q9 i$ D. J/ c
  62. static volatile int irqraised2 = 0;( O2 y* O  v* u3 B$ g* V+ b

  63. $ z. h9 D# y' p% d) x+ h1 n6 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 [. i+ M* K5 L1 ]$ Y& V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; `' Q' F9 m. o; G$ N! ?. ?, a/ \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 P' J: F, f; V
  67. + D. V9 r) P2 x; X0 |. r6 J- k
  68. dma_addr_t dmaphyssrc1 = 0;& A9 D4 a1 C" A/ S& u
  69. dma_addr_t dmaphyssrc2 = 0;% s- V, H9 u' l
  70. dma_addr_t dmaphysdest1 = 0;
    ' T4 k8 N4 D) H: G: |" b
  71. dma_addr_t dmaphysdest2 = 0;* N  P. T/ s- y9 a" L% ~

  72. . A! _; _7 G, o6 m* E2 n1 P4 [
  73. char *dmabufsrc1 = NULL;7 d" w% G/ c: h- Q6 _9 O
  74. char *dmabufsrc2 = NULL;$ M9 m/ ]2 e) v7 f! ?! }% Q. [3 t! G
  75. char *dmabufdest1 = NULL;
    ; x( y, g% x  v8 O# `
  76. char *dmabufdest2 = NULL;
    / e; b3 k9 s; E1 \/ h+ n
  77. . y7 a% s0 J# Y/ N; I7 d& ?$ q
  78. static int acnt = 512;# T' @7 ^# v4 ]% k* P6 o2 O8 l, G
  79. static int bcnt = 8;. K( x( {' R+ L$ m
  80. static int ccnt = 8;0 a3 U( p% {! L
  81. & s7 Z+ i) w, i% ^
  82. module_param(acnt, int, S_IRUGO);* u: m+ r$ i$ U1 `( a+ Z
  83. module_param(bcnt, int, S_IRUGO);
    7 E% a: x; e5 l5 K" n' j" A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! G, A3 r2 Z3 ]! m. s& s
1 E$ I) w3 C8 k, |% z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 s. b8 v9 H$ @6 w/ marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# _$ D" ?; I, o! q: [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% a+ F( \$ B9 e6 V1 l+ u0 F' ]
' q: n( q0 Q, h% [- s3 y( _; L9 @

4 t2 B9 `! f6 [# Q. Z/ ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 14:15 , Processed in 0.040493 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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