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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / b6 U% p/ @. [
  1. [code]EDMA sample test application
    " @4 ], C2 z2 Z' g' r* L% P, }" Z
  2. /*
    % m$ w" Q6 d3 ]0 s$ \& P) b
  3. * edma_test.c! V  I0 a8 K8 A  @: g
  4. *" R8 k4 c% }, A6 P3 N3 M! a
  5. * brief  EDMA3 Test Application
    3 e5 Q* S5 |! C9 p
  6. *$ }1 P1 R& S0 f5 H% A
  7. *   This file contains EDMA3 Test code.! E9 w4 _4 X: g# H
  8. *% d9 `0 u4 i& |1 [* D9 ]6 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; {" j) }% {, Y, h4 Z" O6 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) O8 q6 k8 [, K1 M; Z
  11. *         TO CHANGE.0 w8 C5 m" T' S/ t7 j, ?1 b
  12. *! N2 c( I, T! G3 b5 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( L/ g0 b" o$ [( C
  14. *
    : [" p, }+ O! V3 j3 f6 G: b
  15. * This program is free software; you can redistribute it and/or" A- O: }% h' O+ ?5 F2 Y, \
  16. * modify it under the terms of the GNU General Public License as2 \' C8 s9 m" X, Z2 Q1 ?
  17. * published by the Free Software Foundation version 2.1 n% J8 _2 L/ H! t2 e* C0 ~+ p
  18. *0 d/ B/ R% \5 h% Q) ]3 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; E2 {% D2 v6 a+ @  _2 j" p
  20. * kind, whether express or implied; without even the implied warranty/ Z$ E2 n0 i( O% C/ l0 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % G$ v2 y2 h, ]" @$ |
  22. * GNU General Public License for more details.* `; D6 Z, R, e. Z& R  y/ V: K% W
  23. */. V1 R0 k; y/ Q5 R9 k$ j* e

  24. 1 |0 M& h( w# S$ k5 K
  25. #include <linux/module.h>
    6 |9 R6 E7 i5 Q- h) d" F* {8 I
  26. #include <linux/init.h>
    0 c  m0 {4 k) S& x+ {# F
  27. #include <linux/errno.h>
    + e, V. V/ |; {2 K
  28. #include <linux/types.h>
    + @" F, j: v! G& J
  29. #include <linux/interrupt.h>
    # ]- i0 V* ~; F4 x: k1 D- c9 i8 m
  30. #include <asm/io.h>
    7 {( {9 ^9 _& Y5 t3 n* C- e
  31. #include <linux/moduleparam.h>; \) L+ n9 S' A; c5 {
  32. #include <linux/sysctl.h>6 V5 Z4 @: h4 d
  33. #include <linux/mm.h>, l7 N' `$ e' P' z+ U. f3 L' x
  34. #include <linux/dma-mapping.h>6 h3 n2 v) F8 e- \& P: M
  35. # F! D% O$ x$ E1 L- j
  36. #include <mach/memory.h>- A8 A% r5 `( ?: c
  37. #include <mach/hardware.h>
    5 d* J+ A, i8 R
  38. #include <mach/irqs.h>
    5 t. Y! k$ I' u0 l  K1 ?
  39. #include <asm/hardware/edma.h>
    - m) J( X! ]* o- ]

  40. ( @8 f9 q5 |2 L
  41. #undef EDMA3_DEBUG$ U% H. r6 C! G1 A
  42. /*#define EDMA3_DEBUG*/
    ; T4 b8 y; X: S

  43. 9 `  {3 |) ^" o! T  M; o
  44. #ifdef EDMA3_DEBUG
    # |7 V- R* i2 R, ^+ q$ l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; G, i6 p( k5 Z% Z1 R* k# j/ `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % A4 T2 ^# B9 O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 a. e+ P' Z2 d$ s
  48. #else
    - ?# R" {, U  R% u; @. U
  49. #define DMA_PRINTK( x... )$ E4 ?1 E5 l4 u  Z" T
  50. #define DMA_FN_IN
    % H; D) ~* j8 y/ o5 V
  51. #define DMA_FN_OUT
    6 i1 R  ]' r: T; z$ c
  52. #endif  t8 p# V5 R: F6 s) y  H
  53. ( G* B/ W0 [7 D; E- R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / w* G3 j' \/ w
  55. #define STATIC_SHIFT                3
    $ F4 W' S- B% _7 Y7 T$ T8 g
  56. #define TCINTEN_SHIFT               20$ @1 L2 j6 ]/ T% k: S
  57. #define ITCINTEN_SHIFT              21
    : L) O! b. R% R4 x, j
  58. #define TCCHEN_SHIFT                22
    / w5 `+ t3 a" \8 {
  59. #define ITCCHEN_SHIFT               23! a1 b6 r9 A4 o0 l" h
  60. . K7 A7 e" w) e* ?
  61. static volatile int irqraised1 = 0;. Z, w- E* S7 O3 J$ x
  62. static volatile int irqraised2 = 0;
    & l* g% z0 g- z, t. h6 v" c: p! `
  63. ) E: s' v6 @7 p. L- |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - G4 Y; S+ q1 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 z* Z& Y' w. h/ M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 {( K, a7 q' V2 W

  67. ; ?; c2 N3 ]( a* g6 f) B
  68. dma_addr_t dmaphyssrc1 = 0;: R+ n" a, S2 b; x2 x! K
  69. dma_addr_t dmaphyssrc2 = 0;; z6 S# X, K5 p/ \5 X
  70. dma_addr_t dmaphysdest1 = 0;6 S* j  h2 t+ l
  71. dma_addr_t dmaphysdest2 = 0;
    * K) u6 i- i; K& b& F
  72. ( Q0 D3 W9 g! S3 k" e  z
  73. char *dmabufsrc1 = NULL;/ i$ P( U' H0 S7 a2 @& d
  74. char *dmabufsrc2 = NULL;% B$ u4 V5 U( ^* @
  75. char *dmabufdest1 = NULL;/ }& \+ U' E  R( Q& s
  76. char *dmabufdest2 = NULL;" `" ~8 N+ W" w( @5 p% a1 c
  77. 9 d- d$ n$ h% h
  78. static int acnt = 512;
    ! {. z0 _" {7 r5 y
  79. static int bcnt = 8;5 i+ G8 x5 `1 ^8 }5 R
  80. static int ccnt = 8;
    , p4 T" e9 I7 P

  81. 3 E/ \: l: [. p( U
  82. module_param(acnt, int, S_IRUGO);5 R& O$ C0 p; B5 }, W' d2 n3 s
  83. module_param(bcnt, int, S_IRUGO);* O; m( K* y) u: m% V$ {1 s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% T) k+ `5 L, x4 ]! X* ^: [! Q$ V2 t+ `' l  r: X% b! N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 |5 L5 n2 s3 U  Y9 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ a8 R3 a  v- U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# Z" w7 v5 r: @7 a( f9 h+ D  T: C" t5 S; G9 ]( Q
& d& {5 \6 R) ~: l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 16:00 , Processed in 0.041095 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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