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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' \; \' p, q* x0 i8 _4 W7 {8 Q, h5 w
  1. [code]EDMA sample test application
    , w4 ]; D: C3 \) V- }
  2. /*
    ) f& x3 [/ z  S9 X0 a0 M
  3. * edma_test.c7 d+ \8 @5 E/ \
  4. *0 p5 C4 Z5 g( @$ o& S" B
  5. * brief  EDMA3 Test Application
    1 U1 a* E) i: r3 R  T% b6 t
  6. *
    3 o- ]6 x4 T, s! \+ L
  7. *   This file contains EDMA3 Test code.! T* e. R/ f, P" B+ I- v
  8. *
    " R3 B0 m% ~0 X) ?) }4 H; q- m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  _. x3 Q9 k9 a8 T9 ^9 t! T3 R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 A4 x, X  H1 f/ z, [' ~
  11. *         TO CHANGE.
    9 f5 r. ^/ f1 I' ]
  12. *1 e' S4 R  [5 R! R2 g8 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 P, V) u' g( A; a8 [' ~- n7 R
  14. *
    ' t$ m4 b5 \' R0 W- G: \
  15. * This program is free software; you can redistribute it and/or; S2 o. m' h- U. M
  16. * modify it under the terms of the GNU General Public License as
    9 ?6 N7 G. X9 J% j
  17. * published by the Free Software Foundation version 2.
    0 Q& T9 X. O+ f) H
  18. *6 b+ z1 p% n4 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ Q5 n* i" O0 U! y
  20. * kind, whether express or implied; without even the implied warranty
    2 ]/ ~1 s" a- S2 ]0 @. B9 {: n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: G+ |- _3 W: N) ?6 R; r; b; Q
  22. * GNU General Public License for more details.+ \/ e1 _" a+ p- F: `7 ?8 a
  23. */' c; z6 p; J' H& V4 t: V! J
  24. ; @9 `1 _( B3 k
  25. #include <linux/module.h>
    5 O2 x: c  d5 v' \
  26. #include <linux/init.h>
    - y5 q! X2 s$ `2 X
  27. #include <linux/errno.h>, H  Q. H3 d9 L8 u' D0 `! k) |
  28. #include <linux/types.h>
    ( k! b2 g! Y  o5 V/ r$ b7 A7 ]
  29. #include <linux/interrupt.h>
    0 W. i) q1 ?8 `# K, V
  30. #include <asm/io.h>
    ! G) `+ |+ u' w; P- i
  31. #include <linux/moduleparam.h>
    4 q* {) z% ]* `: T; }
  32. #include <linux/sysctl.h>
    ( ?" {7 P. v0 u5 ^0 v
  33. #include <linux/mm.h>
    ' H7 i+ T# ^5 L/ y6 B5 \$ w
  34. #include <linux/dma-mapping.h>8 g; p. Y1 `' i8 N- n! R4 P
  35. " F. p( x* E1 f" b/ U- U
  36. #include <mach/memory.h>* n: |% Q7 m& b) O  v
  37. #include <mach/hardware.h>+ A* M: L0 f/ E2 n4 H
  38. #include <mach/irqs.h>8 g  f3 L4 h/ m& w- g
  39. #include <asm/hardware/edma.h>, X  G) [7 b& t: L

  40. 1 j* L- T/ U/ G2 e$ `8 Y
  41. #undef EDMA3_DEBUG' I5 r/ U$ Q. W" r3 @7 M6 C5 p$ u% Y
  42. /*#define EDMA3_DEBUG*/" e8 v& O  h3 y* G  D1 C+ f
  43. % _1 w8 A5 L. v* r
  44. #ifdef EDMA3_DEBUG/ t; |8 ^( T* G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 J! N; F- B1 X. ?; C( i# d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ e6 x( @  A9 `- ?+ W+ ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% S- |- {. O$ ^5 h* D
  48. #else: c: z7 k# `! q3 t5 ?7 g, |
  49. #define DMA_PRINTK( x... )
    $ a/ U/ y. y: T. h1 w
  50. #define DMA_FN_IN
    ( Q7 J2 a9 h7 t- s4 @! [# L
  51. #define DMA_FN_OUT% j8 I6 ]$ S0 y% d
  52. #endif; \& a5 M8 L/ y- I$ y3 K" C! O% Q3 G! I

  53. 4 C+ c2 k$ I7 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + r9 y  H# p1 x( b! D- G' A5 g
  55. #define STATIC_SHIFT                3( E- E4 \6 R1 B  w$ b. i9 n
  56. #define TCINTEN_SHIFT               20
      o+ A1 Q; L0 p
  57. #define ITCINTEN_SHIFT              21$ `* n6 d* O, P: j2 f* x! D$ w
  58. #define TCCHEN_SHIFT                222 d! p4 Z( z, j5 O- ^7 v
  59. #define ITCCHEN_SHIFT               23
    : {3 Y; v. v/ r& b( r8 o
  60. ! V, `+ J+ J& f9 a. C
  61. static volatile int irqraised1 = 0;
    ) z; B- {5 K& W( b* p# s
  62. static volatile int irqraised2 = 0;
    7 e: Z& C9 p0 V6 a4 w

  63. 6 j" T" e: w, y" s3 i# H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! e) `  y" X' {4 z8 T1 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * C" _6 ~$ n: E! S7 x5 b% K7 q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * o2 j9 O$ S. Z1 V" b
  67. 8 ^& E' w4 B# W! Y1 I0 e* z4 b3 a
  68. dma_addr_t dmaphyssrc1 = 0;
    ; }8 B& p2 V, y! E
  69. dma_addr_t dmaphyssrc2 = 0;
    ( s2 n$ d$ {) k6 x9 V( f' H' v
  70. dma_addr_t dmaphysdest1 = 0;" Z& ]1 [- X# {8 d
  71. dma_addr_t dmaphysdest2 = 0;$ K' z  Y! r8 H

  72. 3 k; }$ T; g9 i. r  Q( d  @
  73. char *dmabufsrc1 = NULL;
    ( ^: c1 Y9 s5 J$ A" f% I
  74. char *dmabufsrc2 = NULL;
    2 Y2 \  T4 M+ y: z, X$ q9 X  w
  75. char *dmabufdest1 = NULL;. S& K; a  V' v% M# q
  76. char *dmabufdest2 = NULL;! M/ A0 V* T  H) t* j

  77. $ v5 c+ Y+ Z  T" p5 q' Q
  78. static int acnt = 512;
    2 X5 c' K" \1 N3 c5 K
  79. static int bcnt = 8;
    * G1 Q# v& h% A% ^
  80. static int ccnt = 8;
    8 y/ j0 _- V. K

  81. 2 F) M4 `5 k3 v% P& H
  82. module_param(acnt, int, S_IRUGO);
    & b. i7 V* O# h4 [' T/ `
  83. module_param(bcnt, int, S_IRUGO);6 Q" H, A2 i! ~$ g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 x( g$ o# O6 j2 O% r+ d$ s
+ Q( a4 Q0 F) Z6 h: h) b% |; M( }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 [* c1 L' J: Q5 uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ U- N: t9 V) S- d2 W! f# q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- }0 e; A) Y" y; h

" `$ p9 ~9 A1 i0 R5 a/ @
1 N5 e8 T9 F$ w6 w# R8 t: P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 09:07 , Processed in 0.041491 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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