OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' \  j  }: @, U0 z; U4 u
  1. [code]EDMA sample test application1 t( U( U1 d8 p' z
  2. /*5 M' f6 M+ l# f; q/ P% ?( e$ {
  3. * edma_test.c' X) d; z4 z9 s+ X' S
  4. *
    9 b8 \; m, Y8 ?, }$ i/ |, C+ {
  5. * brief  EDMA3 Test Application
    1 R2 D; S( X" V% O0 Y; J
  6. *) [: n1 |- A! t
  7. *   This file contains EDMA3 Test code.
    " _% J, f1 Z0 u7 @! J5 N
  8. *
    0 q3 }# z' X4 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ q, ^1 W; i+ n- g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: Y& W$ k# w2 j3 [. R9 A8 i
  11. *         TO CHANGE.. R  T. `$ \9 N. s
  12. *9 z0 [- g% p' L+ v. ^* F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : T+ B0 B8 y9 ~! Q) b! {
  14. *) Y. J6 h1 N3 r  \* \+ T/ d/ ]
  15. * This program is free software; you can redistribute it and/or4 Y; @7 t% ]' d
  16. * modify it under the terms of the GNU General Public License as5 T7 N" y: a4 F9 I
  17. * published by the Free Software Foundation version 2.5 ?/ [6 g0 q* [7 `* @4 d) W
  18. *
    5 |' u9 E3 I9 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: t! K+ O. @" G/ Z" N
  20. * kind, whether express or implied; without even the implied warranty9 d7 t( c# N1 Y, S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! ~1 P$ h' s( d& i7 A& X; \
  22. * GNU General Public License for more details.7 s9 H- B# Y. k& A' B1 I1 }
  23. */- ~/ W" w/ }! ~* j

  24. & K5 C* L( b! s( ?+ v7 L9 D
  25. #include <linux/module.h>9 J+ u$ U& y/ z* c
  26. #include <linux/init.h>' ]& y/ I& J4 I+ C6 E/ x: _
  27. #include <linux/errno.h>$ u6 Q0 B3 f8 }+ {
  28. #include <linux/types.h>
    5 c" Z! w; G* _+ ]
  29. #include <linux/interrupt.h>
    ( l9 s( c0 l5 L6 f4 h0 Q8 k
  30. #include <asm/io.h>/ E) L: k" n4 j' D& Y4 U
  31. #include <linux/moduleparam.h>
    + m/ J& L  h' `9 U$ A. }, J9 T* Q
  32. #include <linux/sysctl.h>
    6 b* C) v. ]2 [; E9 e
  33. #include <linux/mm.h>' k, e; |* s/ t4 ?) j0 \) B
  34. #include <linux/dma-mapping.h>
    ; B' h3 X' c+ F% G6 S5 d1 R
  35. # O. r& C, B4 N. p- {8 y! b3 \
  36. #include <mach/memory.h>
    # G+ @. y5 p) X/ ?
  37. #include <mach/hardware.h>
    2 Q+ y+ h7 |2 E: b5 n$ h- ?
  38. #include <mach/irqs.h>
    3 k8 k- Z7 ]9 g& s& S- Z
  39. #include <asm/hardware/edma.h>2 \# h5 E1 w( d8 ^. F: U
  40. * E8 q9 }- [0 m4 Z1 B0 B, \2 [
  41. #undef EDMA3_DEBUG5 y( K2 ]" g3 F
  42. /*#define EDMA3_DEBUG*/
    ; ^+ s; `5 ~4 p. m
  43. : z: |6 q$ H- X3 [, J* n9 r
  44. #ifdef EDMA3_DEBUG
    : }* e4 c4 d! A7 r+ s4 o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 K9 b, B0 f- m2 d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      b5 o1 }3 J0 A4 A0 B% t& G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 b" H+ d. t3 b, }8 k
  48. #else
    $ o7 Z. G, J- @# p/ \" }: `
  49. #define DMA_PRINTK( x... )
    & _( O# \8 D: B% @5 j
  50. #define DMA_FN_IN$ ^* B' Y# T8 q' [, `
  51. #define DMA_FN_OUT
    / E' |: c7 L+ R& P' }
  52. #endif$ H, [$ W" S0 U) D  A# M
  53. . l0 N* @2 ?* S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 e' I- Y6 Z. v2 e9 n# x6 u
  55. #define STATIC_SHIFT                3
    , k2 _# C3 P- J% e5 H
  56. #define TCINTEN_SHIFT               20
    5 V3 y" w9 m( y$ _5 u; U  z
  57. #define ITCINTEN_SHIFT              21
    # w% M! }- W- Y. {3 n
  58. #define TCCHEN_SHIFT                22& F* m8 G7 J* Y; a7 F. K
  59. #define ITCCHEN_SHIFT               23
    3 r. u, F: e  w7 @

  60. ( h4 I5 d1 f( i* l0 B9 o: k: q
  61. static volatile int irqraised1 = 0;' k& c8 m3 R$ a  w, X5 }# D1 m" G
  62. static volatile int irqraised2 = 0;
    7 b+ {0 ?2 N# C# ^7 z/ j
  63. " f) w+ x: a2 n5 i/ y1 s: w- s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 Z9 j: s; @" A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ F; t7 L+ I; J$ F$ v/ m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 Z: S( z' h4 s7 w, o# E

  67. $ H1 g9 |5 D  i+ {( b; u, J* B
  68. dma_addr_t dmaphyssrc1 = 0;
      Q' L; X6 l) v
  69. dma_addr_t dmaphyssrc2 = 0;
    : d4 ~5 p" z5 E5 s4 }
  70. dma_addr_t dmaphysdest1 = 0;
      S7 f9 M- P$ O! E2 E
  71. dma_addr_t dmaphysdest2 = 0;  U- P( B; D7 V  D. {" [3 Y* Y4 N
  72. , F1 P  i- E! Q* a$ c* ]9 _
  73. char *dmabufsrc1 = NULL;% `1 O2 L8 g* T; N* @, B
  74. char *dmabufsrc2 = NULL;' y! n4 @5 m# u6 _& G+ t! N) i9 X
  75. char *dmabufdest1 = NULL;
    9 w8 a, j0 J; p# j! R$ v
  76. char *dmabufdest2 = NULL;
    ; G; k8 h) A8 u* v' }* {: g3 ?

  77. , R, U" W4 @0 _5 D) `3 ^
  78. static int acnt = 512;
    2 {( O5 l" u3 ?3 Q
  79. static int bcnt = 8;7 U2 c" \( i" g; u- K
  80. static int ccnt = 8;3 ~0 \! f# Z$ ]# c# f7 ~& k

  81. + L( T- u0 D2 G8 c3 M$ V6 H) e2 d
  82. module_param(acnt, int, S_IRUGO);
    - Y7 X# }3 W$ o* I, G" V  d0 p
  83. module_param(bcnt, int, S_IRUGO);
    ! `2 r1 [3 {. ^6 O5 X) V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' o8 }4 a6 i2 u; A5 e8 ~
6 k2 I: `$ f  D: |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 s6 A% j0 `: x- {6 G- W) U  Y9 Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( Z/ ~8 E7 R- n3 j% s# m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 e1 z4 V9 f" {" }

/ p& Y7 R1 t" u) O
1 S" L$ l9 s& N( ^: X  n2 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 14:47 , Processed in 0.037206 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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