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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: C4 G9 y! x! {" I
  1. [code]EDMA sample test application# `1 \2 G+ W! X" q# h" N7 p" g
  2. /*
    $ L7 v! b& p4 B& ]. u9 V  A% v7 S
  3. * edma_test.c
    " d) i: i' Z2 w4 w& D8 S6 H
  4. *
    7 q3 l2 P) A5 A  K7 u/ u( M
  5. * brief  EDMA3 Test Application
    : t2 k# \9 y$ E  [
  6. *
    ( `; n) Q% ]* j1 [% v6 x: w
  7. *   This file contains EDMA3 Test code.2 }# g9 m5 w( i; z8 B( z
  8. *
    1 f2 s0 \0 j( j; a! Q# W. D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 y7 n- ^3 D$ C2 V" y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 a8 A2 L0 H5 S5 [4 Z9 W
  11. *         TO CHANGE.
    ' {6 t0 \2 v) Q/ r# v0 s: z
  12. *
    ; r0 l" w, t/ m1 n% r7 w8 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! J! ~. M7 K2 y
  14. *
    3 u5 {2 j9 F6 A( Z. F# w5 d
  15. * This program is free software; you can redistribute it and/or
    ! g+ C$ l+ @9 ^
  16. * modify it under the terms of the GNU General Public License as
    ' \: E  T" e( T) [/ @
  17. * published by the Free Software Foundation version 2.4 y# A* Y- r# [8 i% x" e2 ~
  18. *
    9 `3 V1 L2 ^2 ~* }5 c4 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - l, w1 m3 P$ P0 r
  20. * kind, whether express or implied; without even the implied warranty
    : c4 o7 k- k' ~- @5 ]$ c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 Y4 b" J# t/ `( ~4 {$ \# Q5 @! J
  22. * GNU General Public License for more details.( U% {6 C2 c% F6 W4 D4 m6 F6 A
  23. */
    . Q/ e; p' I9 Q6 A  l/ ^0 |
  24. 5 I% U( @( t* b' v- g1 n
  25. #include <linux/module.h>
    ) e2 i3 r' `7 m$ e7 C
  26. #include <linux/init.h>
    ) G. S9 A' F8 {! a; _0 f
  27. #include <linux/errno.h>
    6 i0 G; v: j  N  K# B6 q) Q
  28. #include <linux/types.h>% E- J  s0 x# T2 m# ^
  29. #include <linux/interrupt.h>* `; {) |5 E% B: s* ]
  30. #include <asm/io.h>
    + h. I4 _, y7 Y6 ?/ X. \
  31. #include <linux/moduleparam.h>
    . n  I$ G) e6 i' ~
  32. #include <linux/sysctl.h>. m/ e) V* K$ p$ S5 Q9 D/ D* C3 ~% x* W
  33. #include <linux/mm.h>
    # |, U. c" ^2 `* [9 ~* b( d1 w6 ]  q( M
  34. #include <linux/dma-mapping.h>: h( ^. v' f7 m9 u9 C: q# E

  35. ! |3 K3 {# y* k5 u/ B. c
  36. #include <mach/memory.h>
    / V: A7 D' ]. u* e# U. W
  37. #include <mach/hardware.h>' W4 d; e1 ^2 v' K5 g
  38. #include <mach/irqs.h>
    $ U0 E9 m; ^- U! d* f* e
  39. #include <asm/hardware/edma.h>3 w4 _' ~! v7 j) ]  U! b/ k- Q

  40. + x* K3 |& D) v7 p' w1 U( D: |1 |
  41. #undef EDMA3_DEBUG6 g9 n9 o" q! Q3 s8 u8 u
  42. /*#define EDMA3_DEBUG*/
    3 _+ F. n0 [& w6 O& e

  43. ! O4 X$ C& q0 B
  44. #ifdef EDMA3_DEBUG9 N0 B4 ]. s' \1 \# T, f0 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); G7 w; j! U! }0 a7 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; Y/ O) ?+ b+ g7 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& k0 j) ^" x. U- K7 }
  48. #else
    " i4 V7 b( H6 I% v' W1 {3 T
  49. #define DMA_PRINTK( x... )4 Y2 D8 v; G  {
  50. #define DMA_FN_IN) m) @( B2 u2 `' a
  51. #define DMA_FN_OUT
    " b, z# O% |  p% D' P( a
  52. #endif
    ; i: |- ~# B& x

  53. ) v' z3 `/ }* H) o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! `6 n* w: u! H0 A' K5 o
  55. #define STATIC_SHIFT                3, Y$ c. I4 s0 g0 }! u" \2 x! W
  56. #define TCINTEN_SHIFT               20& H+ P$ S: X: z. Z& c
  57. #define ITCINTEN_SHIFT              21
    # @# G! d0 R, ^! S1 M$ @
  58. #define TCCHEN_SHIFT                22
    5 u1 K9 Y5 y' g* D, H# w$ V3 M; W
  59. #define ITCCHEN_SHIFT               23
    ' V2 H7 A: q6 Z7 h8 M* Y: N3 b% m
  60. - ]2 F7 U2 o9 x2 C' g$ l  l; Q
  61. static volatile int irqraised1 = 0;
    % p- l: a, |+ z4 d0 a
  62. static volatile int irqraised2 = 0;' d9 ]8 W& r& E

  63. 8 L; @* A: }$ n$ R2 O4 ^4 t% y* z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. W" R9 l, }  {7 e) |8 Y' s. J& B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; z$ I1 B/ l% u9 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / \& P' {" s, Z9 c/ r
  67. - X1 g* ^( K, \0 s
  68. dma_addr_t dmaphyssrc1 = 0;
    4 b  I8 B% O% C4 |8 J5 T
  69. dma_addr_t dmaphyssrc2 = 0;7 g3 F/ t! R' c4 u
  70. dma_addr_t dmaphysdest1 = 0;7 M9 Z! p' Y! }; K) w
  71. dma_addr_t dmaphysdest2 = 0;3 C; o, F8 z: B% L
  72. 2 K5 `9 h+ ~0 M5 c9 Y$ [1 j
  73. char *dmabufsrc1 = NULL;; \* M+ u5 T7 J7 {) P" ~* M
  74. char *dmabufsrc2 = NULL;; A! c3 Y% G7 q+ G5 Y* r9 D
  75. char *dmabufdest1 = NULL;9 {( u/ d- w( u- S# f
  76. char *dmabufdest2 = NULL;
    2 |; q* w) P7 F, V5 O

  77. 4 E9 m: D* m& J. _- U# A( Q
  78. static int acnt = 512;
    0 R- O" g: d. u0 ~
  79. static int bcnt = 8;* M' c; F2 q# d( x  c2 H. g9 g) O
  80. static int ccnt = 8;
    . ?, Y8 `% d$ [% W6 L# X. X
  81. ; n" u4 H. g5 e
  82. module_param(acnt, int, S_IRUGO);
    ( B- G- f. u  ^) H0 _3 V8 F
  83. module_param(bcnt, int, S_IRUGO);! W. x2 s# ^# A; h, W/ G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  i$ u+ {# r4 _# ]* |$ g6 J, W5 K. J+ N9 s- u6 C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ j" L- ~9 e. q! `% V; k) f% \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 S) \1 ^$ Z! @9 q% {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 ]8 E. H5 |( ?9 ^8 l2 D6 J+ U
: C" a8 p8 Y: U  {8 h& W3 {

2 X+ b) u4 ]& M0 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 16:15 , Processed in 0.040235 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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