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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( U& w3 n( r' J. g
  1. [code]EDMA sample test application
    / \) R3 Q& d* K( \/ [
  2. /*0 |! I# l- @' f) N& [% {8 J7 u
  3. * edma_test.c. h5 B* Z* z) c, N0 Y5 Y' I
  4. *
    . \6 l# {. S9 M
  5. * brief  EDMA3 Test Application( t0 v1 a" a! {% T  T
  6. *
    2 R. `* d# l" C+ ]' Z9 H. ~- ?
  7. *   This file contains EDMA3 Test code.9 b/ i. n  Y: _
  8. *
    ( X% j% C4 r6 }/ B# ^: j" q: l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; s/ J, z  N; T' t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% Z& P$ D9 \6 W5 {! H  i
  11. *         TO CHANGE./ b/ Q5 A' u. K. I7 [: C
  12. *+ s1 B7 ?% f* }* `* Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ L0 {" ~+ u/ b
  14. *
    + b5 X  |2 a* j" M1 h7 Z
  15. * This program is free software; you can redistribute it and/or
    ; V$ U  Z9 m) C$ o
  16. * modify it under the terms of the GNU General Public License as2 k2 i+ |0 k2 B4 V4 D+ u
  17. * published by the Free Software Foundation version 2.
    ' O7 [" {3 Y6 X/ L
  18. *. x+ r; b& f5 I+ }- h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      X9 M: i3 |- I' v  i+ E' E  K
  20. * kind, whether express or implied; without even the implied warranty
    - `& o/ H: c4 O( a2 v$ U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & F! ]0 Z+ g" y  w1 z- B: w
  22. * GNU General Public License for more details.
    2 V6 G$ F% V8 M2 H. {; g
  23. */6 U5 ]0 y# p! w% Y' c
  24. * k5 G( ^- x4 E) `
  25. #include <linux/module.h>
    * y* J' C; D5 h6 K2 C# G
  26. #include <linux/init.h>8 z, v. o: K4 {2 e
  27. #include <linux/errno.h>+ o/ \8 l, E- p6 g8 J' r  w3 z
  28. #include <linux/types.h>6 `+ U' P/ ~3 o" v/ W) g; f! j
  29. #include <linux/interrupt.h>. D: \+ m( b. A1 E+ `4 d2 L- N. q; P
  30. #include <asm/io.h>
    / N5 W$ X7 Q! Q1 K; X4 S
  31. #include <linux/moduleparam.h>) r5 r2 U& d1 d
  32. #include <linux/sysctl.h>; J! y* g& v8 P1 ^6 ?) P/ h
  33. #include <linux/mm.h>
    5 t  |6 d7 u/ q- F' m0 Z  f: f* u
  34. #include <linux/dma-mapping.h>: W8 C9 y$ \$ ~* X6 X
  35. 5 t* h# G1 A, J$ S* S. v0 N
  36. #include <mach/memory.h>
    & H6 n' T' X+ L# f3 g0 m
  37. #include <mach/hardware.h>& T; U7 G8 }( G  N& V  g. Z* V
  38. #include <mach/irqs.h>
    % |3 o* L4 V/ J* q, E
  39. #include <asm/hardware/edma.h>' U0 X( l4 T: b/ R* z# @2 _

  40.   ~$ d; u+ k* A3 y0 I
  41. #undef EDMA3_DEBUG
    . m+ w) N# G. _! e! X
  42. /*#define EDMA3_DEBUG*/7 P& @, _5 h" A0 z. H

  43. " c: K1 \' _7 |; @! k
  44. #ifdef EDMA3_DEBUG9 ^$ r, j& o! H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" ~1 b. r$ [- c; O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 c5 V0 v' v, O6 V0 [. t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( @+ e% g$ s# W  j3 S
  48. #else' @' K: |. ]' G7 j2 ~6 D
  49. #define DMA_PRINTK( x... )
    " E, X+ d8 H: T+ h5 k
  50. #define DMA_FN_IN
    $ K, t; _( Q+ Q4 |7 _5 [
  51. #define DMA_FN_OUT
    5 b. F7 `+ t5 G8 S
  52. #endif5 l8 p4 Q5 S" {3 y
  53. ' c* |( b/ u/ E5 |) q; @# f7 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) c. H$ K- ^4 ^2 d* Q7 D
  55. #define STATIC_SHIFT                3) S: B8 Y3 ]) k7 i2 T; [- h
  56. #define TCINTEN_SHIFT               20' m$ |( D2 l4 S: K4 v
  57. #define ITCINTEN_SHIFT              21
    2 ?$ ~7 i8 ?( z3 j
  58. #define TCCHEN_SHIFT                22
    7 C4 _% m& E# G1 I
  59. #define ITCCHEN_SHIFT               23
    % l9 [) H& j7 E( J& }! m6 S: _8 r

  60. . X3 [! F& G5 _1 ^! q
  61. static volatile int irqraised1 = 0;" @) o0 |9 b& H3 V7 B; @* A
  62. static volatile int irqraised2 = 0;: G1 @. x) Q8 n& {! f, x* V, C3 S
  63. $ ^" C# y/ J$ Q& y; r/ Z4 t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 `, A, a, f5 f  j5 r9 q5 j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 r' \# o# b" w& V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % T$ b3 `- {0 B  ?
  67. 2 u9 y+ P8 n6 P# m& T
  68. dma_addr_t dmaphyssrc1 = 0;
    / s1 \$ ~# h+ {  ]: T
  69. dma_addr_t dmaphyssrc2 = 0;1 Q' `  D/ Q8 _. ~! c: V( Z4 l
  70. dma_addr_t dmaphysdest1 = 0;" Q4 p/ g# [0 y
  71. dma_addr_t dmaphysdest2 = 0;& D, U1 |8 x, l, N- E2 C
  72. 2 y1 {& L' w9 Q2 @3 C) [# _7 u
  73. char *dmabufsrc1 = NULL;+ s* W* T' }4 e2 _( w' K& [
  74. char *dmabufsrc2 = NULL;
    9 u- o6 ^( r* f4 N8 D2 ~8 D1 b
  75. char *dmabufdest1 = NULL;
    8 L$ _4 s1 t: P; T) g' S" }/ O
  76. char *dmabufdest2 = NULL;4 H5 M* q% n% J

  77. ( i# R3 \- W% |* B4 S' q, w
  78. static int acnt = 512;8 D' v. N6 C9 c; u% u2 l5 F
  79. static int bcnt = 8;; \: }! `) r4 g0 ]- q0 R
  80. static int ccnt = 8;
    & A( n7 {. t9 F: A) I

  81. 5 [; c) I2 b* O3 v$ o) q( t
  82. module_param(acnt, int, S_IRUGO);
    ' l& O: L  B+ F5 K# n
  83. module_param(bcnt, int, S_IRUGO);
    # M' M1 W6 M  D% W9 c# N% T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ X+ G5 r& X0 u
$ d7 l6 \2 C0 V& x0 Z% T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 _; W0 E: b6 _: R  Y5 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; T. A& g- G; x5 O2 T* Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 b- j, P2 p1 Y, b- e
4 x# S7 P/ P  O/ Y& s7 e) Z
/ K0 K# w0 m7 r% Q) |" g1 T, O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 00:31 , Processed in 0.040324 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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