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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; G2 o+ ~' _7 t; d" }* F
  1. [code]EDMA sample test application% w" r, V  M0 `. l, z
  2. /*  G* f+ u9 K  |- @: A
  3. * edma_test.c+ `% {5 n& Y9 @/ m2 L2 S0 \6 q
  4. *: M/ M8 m( \" k; X% d  B
  5. * brief  EDMA3 Test Application
    / C4 M1 V, l. r. o0 y
  6. *& a* T) m  J; z) L( d& \2 |
  7. *   This file contains EDMA3 Test code.; \9 h1 H( U) b
  8. *" T8 g1 o$ n$ D2 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " g: I( t# l, @8 K# }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! }7 X$ A( T& h1 y" U  a/ _% B
  11. *         TO CHANGE.7 O# }: l" p- v! M/ \7 o6 G) z' E% }
  12. *; |7 D$ A# d5 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 Y* J  b1 o6 w6 V& w
  14. *. z$ n4 [  W. {5 r9 s8 j4 o; B
  15. * This program is free software; you can redistribute it and/or
    2 U! s6 f+ y2 n6 g# M
  16. * modify it under the terms of the GNU General Public License as
    5 h, g- `+ P6 ~$ V
  17. * published by the Free Software Foundation version 2.
    1 b7 g9 k2 }( C; e$ r% Z( S* A
  18. *) y$ P5 H" {4 M) U/ `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' `3 }0 O; g8 O' ~+ R' H/ m1 e& g
  20. * kind, whether express or implied; without even the implied warranty
      o) n5 G* Y( M1 g2 I# [6 {/ X0 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( c& t1 x  g) v9 p: ?
  22. * GNU General Public License for more details.
    * y1 Q0 Q$ D& d3 s5 {
  23. */! ~* u6 N: T1 Z6 Q# P' p

  24. 5 m. B7 Y$ g, {" h- B8 r) x& M; A
  25. #include <linux/module.h>
    # ~  w+ P, W" g5 E3 q9 A
  26. #include <linux/init.h>
    6 z( W- _/ q( E7 V% o
  27. #include <linux/errno.h>
    . X: T+ ]5 W# z! E' e, p
  28. #include <linux/types.h>
    & G& ?% Q  A, E2 j
  29. #include <linux/interrupt.h>
    3 `0 c/ }7 _! t- v8 W. D2 \
  30. #include <asm/io.h>+ i1 K; I4 M8 G
  31. #include <linux/moduleparam.h>6 ~6 D8 X1 }1 {6 K# e- g- x
  32. #include <linux/sysctl.h>
    : ^. d5 @' W/ k# ^- a
  33. #include <linux/mm.h>" Y" F4 v. C1 A4 x7 E
  34. #include <linux/dma-mapping.h>
    1 _7 o& Y# e% f( h" d  n

  35. + f  S" g7 v2 A3 X6 Y! [! s
  36. #include <mach/memory.h>
    9 e, c" m* o! Z8 I9 p% S
  37. #include <mach/hardware.h>) f6 B2 S' v8 F4 g& g
  38. #include <mach/irqs.h>
    6 a# }( ^6 a* f6 `6 f
  39. #include <asm/hardware/edma.h>
    7 i! W7 L  E) U- z% Z! b
  40. 1 v8 H% R& S7 |* a$ c
  41. #undef EDMA3_DEBUG
    - h9 X; _* D9 X; h
  42. /*#define EDMA3_DEBUG*/9 F& [3 A- ?$ Y3 j, z
  43. 0 J# Y9 {5 J/ \) r- S& l0 g0 C7 F6 L
  44. #ifdef EDMA3_DEBUG
    8 {% t3 k$ y  P1 o) s' ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) P; ^- q" m4 N3 h0 c7 D4 @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). T  V& b- M* o0 w8 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" l9 u* U2 c( l8 Q' G- F* b- \7 y
  48. #else
    $ K- ]  `$ y. c: q0 M5 Q7 Z
  49. #define DMA_PRINTK( x... )* Z+ P0 W: i6 E% D! N
  50. #define DMA_FN_IN
    4 p& g4 p% v* _. I- s: [% I1 |: b
  51. #define DMA_FN_OUT
    % z* J: Z' }8 D5 t9 L
  52. #endif
    ! _  P3 c/ K$ G9 y4 {: K& A" m
  53. 4 L/ V% F" \) c' W) h. ^4 r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" B2 k5 f% Y6 v- ?5 X$ x# S( k
  55. #define STATIC_SHIFT                3
    ( _; n1 p# n* n0 |2 v0 C
  56. #define TCINTEN_SHIFT               20. ], R$ o0 W$ n' }
  57. #define ITCINTEN_SHIFT              21
    # |/ q( o& }. |, |: m; v- e
  58. #define TCCHEN_SHIFT                22
    " B* Y6 y; s+ Q3 F# z) _/ s! T
  59. #define ITCCHEN_SHIFT               23
    2 ^+ H5 @  S3 b6 l3 x! C  j

  60. / a7 W0 \! ~8 T* q
  61. static volatile int irqraised1 = 0;
      J6 Q' H" S7 h2 a
  62. static volatile int irqraised2 = 0;
    , h6 q* B; o8 ^& h

  63. 1 Q6 z+ ]' e$ c7 Y# a$ G  i7 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- r: _& B: ?- t" r/ P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 J7 R3 N) k1 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. M) M% v& s; X( s( ^

  67. % h2 r  x0 e* x. l9 ]
  68. dma_addr_t dmaphyssrc1 = 0;* V% i; O- n( x7 B8 f/ k. `
  69. dma_addr_t dmaphyssrc2 = 0;; F! b( X5 V2 }3 V" x7 S4 o
  70. dma_addr_t dmaphysdest1 = 0;
    : ?) R. T& |; y) c: ~" G1 D0 y
  71. dma_addr_t dmaphysdest2 = 0;6 T7 |- G& r- V/ x, t

  72. 5 t) G0 ]! M0 T
  73. char *dmabufsrc1 = NULL;+ d1 w8 l. U0 B8 g
  74. char *dmabufsrc2 = NULL;
    # P& q7 a0 k) }1 _& t1 q
  75. char *dmabufdest1 = NULL;
    5 o" m& r& x1 k9 a9 F5 f! x( Z" w
  76. char *dmabufdest2 = NULL;) Q" d. C, j) K% h' {7 ^8 {; e% G

  77. & ]* ^9 D! K5 ^  S9 ]
  78. static int acnt = 512;1 S) o- b' t. w2 f; A  X) e% X
  79. static int bcnt = 8;" C8 [" L& Z' v* m0 ?/ ]3 q
  80. static int ccnt = 8;; |. [, t) d: G, j
  81. " I# t+ _* R! p' y! f9 u4 K
  82. module_param(acnt, int, S_IRUGO);0 I; v* ?# `! f' [2 c( D2 Q* A
  83. module_param(bcnt, int, S_IRUGO);' P# F% y  A: {. y7 e$ i: d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 u( @  n6 e! H) X* c. e

3 n4 Q3 e! T8 V- C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) e$ O7 s; W8 }# Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 ]: f; T4 k. {* K4 J! v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& ]* f3 M  i- N. ^( @8 j' Q# E( s1 K- |! |, W# t
& S9 \- k% l- f4 S* {2 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 17:17 , Processed in 0.043431 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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