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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 x% z4 ]) i1 b, ~7 U' G
  1. [code]EDMA sample test application
    7 G  Z, n! X8 D- R5 e
  2. /*
    3 F5 T0 ^7 y7 Y
  3. * edma_test.c
    8 }! g/ g( {) ?* V% ^
  4. *6 Z3 m; v5 d" C5 b# ?/ F
  5. * brief  EDMA3 Test Application
    0 F) l1 t' B* @2 l, U
  6. *
    # j8 ?7 X4 S: u
  7. *   This file contains EDMA3 Test code.% a9 A" F& Y- T- M) X4 v% ~: @- j
  8. *
    4 M5 D# g0 M! m: u# F8 R  x* R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( n2 a2 W8 X. i6 y# ^, s2 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & e9 t: e6 o2 V6 Y+ b
  11. *         TO CHANGE.
    ( Z* E$ }5 R+ s7 u
  12. *
      l2 _. N; u0 L7 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' y4 {9 ?5 G! q1 u. f
  14. *8 x- M9 F8 B" r# b+ ^- y5 m" \4 r1 Z
  15. * This program is free software; you can redistribute it and/or7 I" L8 Y2 X  x, o/ U: k
  16. * modify it under the terms of the GNU General Public License as$ j3 J* E7 P+ q: f1 ~
  17. * published by the Free Software Foundation version 2.
    & y( ~9 C4 V7 ^
  18. *# Q9 A) G! t* Q$ [6 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , j1 m0 X) I, C, E$ H8 C( F
  20. * kind, whether express or implied; without even the implied warranty
    , ?4 J3 W* R- P. o) i- Z3 C9 r7 g" J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! T! t& N! ^* X: h, H
  22. * GNU General Public License for more details.
    1 |; B; k% l8 |3 f# ~* f
  23. */( C9 p2 m) q6 D# b* e

  24. 5 W% O. H# f  t( x
  25. #include <linux/module.h>
    + q+ K4 M! u  d% E* M
  26. #include <linux/init.h>0 j6 I* K4 j% j. L% [* O* Q
  27. #include <linux/errno.h>
    ! Q3 E. n; w+ p0 j" }
  28. #include <linux/types.h>9 \9 G$ {+ G9 u, B; j. B$ {
  29. #include <linux/interrupt.h>
    ) B; k# ~( B9 Z- v$ ]2 f, B
  30. #include <asm/io.h>
    ; W6 p' N. h5 Q3 e- j( P1 X+ L
  31. #include <linux/moduleparam.h>+ E2 K2 z, C, x& {( r+ @- |
  32. #include <linux/sysctl.h>
    ; e  U0 B8 Y6 z* i9 A
  33. #include <linux/mm.h>
    1 Y! O- I' d7 O" C# m) {
  34. #include <linux/dma-mapping.h>
    + J: [$ ]  ~% y

  35. 0 P! i4 `, i0 H5 i; Y3 [
  36. #include <mach/memory.h>
    ' l! Q$ A& p; _$ x0 n1 k
  37. #include <mach/hardware.h>
    & a6 a- {4 Z8 m) A
  38. #include <mach/irqs.h>
    : |; ^: D* z7 H7 S, r+ m6 V
  39. #include <asm/hardware/edma.h>
    - s7 |4 \# |+ J2 I7 D6 k! `; g. X6 C9 e4 R

  40. 8 A' c6 O3 B. [& `6 @5 ^' m9 t( R( U
  41. #undef EDMA3_DEBUG  R- T) L; z; M$ `& O; f0 f
  42. /*#define EDMA3_DEBUG*/
    1 w( ~6 p: S6 n0 F6 h' E/ Q& e5 W
  43. 1 w6 R! E. B: i  C! J
  44. #ifdef EDMA3_DEBUG
      G9 ^" ]6 I5 d. z8 b7 X) B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& ^/ {5 ^% R& N& n7 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 {  a9 ^8 M$ P' e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# l, N9 E2 G# H2 o( p4 n9 Z
  48. #else. r* _1 [, B  b) \' v/ F
  49. #define DMA_PRINTK( x... )* H: l$ R  d& l
  50. #define DMA_FN_IN
    ) T4 P1 f. r5 j0 Y
  51. #define DMA_FN_OUT% X, I" k) x: q: e. @, R
  52. #endif
    , a  K& J4 A7 a0 Z' s7 z# v
  53. ; C7 U" E: B- K* r0 R% I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) H' u5 r9 K5 i" u# x- t
  55. #define STATIC_SHIFT                3
    ; d$ M+ u. \& E
  56. #define TCINTEN_SHIFT               205 h8 {+ {. x) g0 s$ F5 ]" v
  57. #define ITCINTEN_SHIFT              214 m8 B; A  \$ T/ S
  58. #define TCCHEN_SHIFT                225 W0 [, Z/ M5 d6 t
  59. #define ITCCHEN_SHIFT               23% L! k/ N; f& @- _7 g6 S6 A
  60. 4 J  q+ a. Y1 x* H& c$ V3 i: |
  61. static volatile int irqraised1 = 0;( W5 L8 i- h+ P5 y9 w% B5 A1 Y
  62. static volatile int irqraised2 = 0;
    8 C$ j# n* l$ ?$ X$ m

  63. ) W! m# x/ f4 }$ ~, a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 _* f* _$ f5 ~1 E7 \  B+ u5 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: H% z" X, y5 B, I  X0 x6 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 u4 P* R/ m. u

  67. 2 F5 `6 V' f' V- _6 n/ d
  68. dma_addr_t dmaphyssrc1 = 0;; n9 H7 O7 y8 r" ?& q
  69. dma_addr_t dmaphyssrc2 = 0;2 }$ K9 H' }2 _* S0 J  [: d7 k
  70. dma_addr_t dmaphysdest1 = 0;4 ]/ k% v$ M5 n! E! _8 G4 N
  71. dma_addr_t dmaphysdest2 = 0;
    8 y9 ?8 l( z0 P) J# I
  72. + Z2 G8 c) g7 k$ T
  73. char *dmabufsrc1 = NULL;
    8 G& d/ k# x7 X- @4 R
  74. char *dmabufsrc2 = NULL;0 t% J% b. p3 E8 _' W  c$ v
  75. char *dmabufdest1 = NULL;
    4 t8 G5 n$ ~+ e
  76. char *dmabufdest2 = NULL;
    5 d1 _8 Y* [) R5 F; ]

  77. 3 j' i" B0 U0 k! u2 p8 l
  78. static int acnt = 512;* m6 Z+ d* ]) B! Q# P& n9 J$ z0 S4 H
  79. static int bcnt = 8;9 F& L3 i( T/ K# @( w
  80. static int ccnt = 8;5 K  O; M  c# E4 [" t- o' }# s0 e

  81. ! [3 k* a. y! E7 [
  82. module_param(acnt, int, S_IRUGO);
    * u4 v$ d5 e6 q4 B% D" x/ D. Q) R
  83. module_param(bcnt, int, S_IRUGO);
    4 G8 U) R/ L0 J# x# P, U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! e, I/ u7 N9 U1 @% B& o: O( ~- U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* w0 f+ P1 t) G/ f! p* k* tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  p7 @9 P$ m2 c. s" c& f/ O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 a' ?' K& T7 t  ?: [2 |. S1 y7 \. I/ x4 I7 u) o9 c0 f

: W8 [" r1 A. Z$ t- F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 08:44 , Processed in 0.038583 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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