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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! K& Y. a' l7 \0 w- Y3 X
  1. [code]EDMA sample test application5 [4 |. t- d8 w6 e/ t
  2. /*
    , G6 |/ g' D6 }$ W' }# I. _
  3. * edma_test.c% x$ e9 f+ A( w8 ]3 w. |. b( O& g
  4. *
    2 ~# I7 W; R5 Y3 @3 S/ X
  5. * brief  EDMA3 Test Application) e. h! z& r% {2 ]
  6. *
    # r; c+ [. b9 K$ E1 o: O% E
  7. *   This file contains EDMA3 Test code.
    ' }" \3 P7 E% q+ Z1 d" F4 p  f
  8. *
    $ o* j5 W$ l+ B/ r4 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. k& D% j+ Y3 F3 Y2 l* |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' |3 q: y( n$ l* J6 N
  11. *         TO CHANGE.
    " `4 m, A5 u& Z  G  |# |
  12. *
    2 ]5 o6 z$ u% u9 O+ e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 o4 Y2 D  d# N1 T
  14. *% y7 c& ]4 U6 m  ]
  15. * This program is free software; you can redistribute it and/or
    # U, H% e& S/ T
  16. * modify it under the terms of the GNU General Public License as
    7 ]# d; R# V. D; Z+ h! C& W. o
  17. * published by the Free Software Foundation version 2.
    8 g: ^& }" M! H* k9 i
  18. *
    * @, ]$ i' D! f  @; _$ f# v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # h7 D' k9 D8 f1 O% T# w& z* X
  20. * kind, whether express or implied; without even the implied warranty4 X( R9 s  ~; I( s  `# y* C# g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. {# Y7 e0 [0 a: W" O! s
  22. * GNU General Public License for more details.8 T) K* O$ Y4 }4 _3 c6 G
  23. */: X1 i1 }; N& q5 x  k1 t

  24. : j# J- [4 f' ]- r4 p
  25. #include <linux/module.h>. `7 }+ {" M% T! ]+ D
  26. #include <linux/init.h>1 K+ g* G4 j# {
  27. #include <linux/errno.h>- m/ F- u" m; j, I# l
  28. #include <linux/types.h>+ r% \6 a; _. x2 e
  29. #include <linux/interrupt.h>
    : f' V/ M) m' }) o0 f6 ?# O: U
  30. #include <asm/io.h>
    7 F" ^" s9 D( _8 ^' R8 r& P  B$ b
  31. #include <linux/moduleparam.h>
    1 ~; l4 Z; Y1 c  N- _$ l" C1 j; `' H
  32. #include <linux/sysctl.h>
    # s. h" `- \0 S+ x6 ]1 J4 O
  33. #include <linux/mm.h>+ H2 ^) A& p9 T, L# K% {
  34. #include <linux/dma-mapping.h>0 s( l# Y/ K" \  m* E  s" q
  35. ( |$ c, @* b1 i1 N* J
  36. #include <mach/memory.h>
    * H3 V. G* n) A# q! O* ]$ }; m
  37. #include <mach/hardware.h>8 q/ o, D! G# s$ d
  38. #include <mach/irqs.h>9 o4 o5 r# }/ Y* k. ?
  39. #include <asm/hardware/edma.h>+ W; B. m2 S, ~# X8 o4 L

  40. ; I% C5 S. e1 D: z/ y
  41. #undef EDMA3_DEBUG& I0 L+ {. o1 f8 q/ @' a  L- I
  42. /*#define EDMA3_DEBUG*/
    9 L8 C, R* l+ [5 [0 S$ e. i( P

  43. . c9 L0 B3 @0 V5 L& S/ N
  44. #ifdef EDMA3_DEBUG1 V$ p4 _% _; a9 C3 @9 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 f& G( Z, F1 \- J2 ^" T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . |& [. D) c; z- H3 C, r7 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ x& Z# M, E2 Z; x/ \) T) b% @
  48. #else
    4 K# i0 Q! Q7 b4 |, P
  49. #define DMA_PRINTK( x... )
    5 v4 z+ R- p6 N1 n' h4 A/ `; K- R
  50. #define DMA_FN_IN9 j- k6 M  Y) U2 t/ ^0 T. t  m
  51. #define DMA_FN_OUT' k. M6 K& _! j2 e( g, X- S& m
  52. #endif
    ) m4 \, h' U, ~) O: N/ w; J
  53. , n% D: Q: n2 u1 G% B0 l% c: E/ [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 {5 N. Q# M( }; i
  55. #define STATIC_SHIFT                3
    ! a8 Z# P4 q, ~5 X0 j3 l1 n
  56. #define TCINTEN_SHIFT               20
    8 [9 w) L1 _+ z% F3 y
  57. #define ITCINTEN_SHIFT              21
    % a4 J! T3 B( ?( ]( q: O
  58. #define TCCHEN_SHIFT                228 |1 u+ j/ g5 W, e; j
  59. #define ITCCHEN_SHIFT               23
    ! t8 ^; l: Q1 t) ^! R$ \1 H, ^, U

  60. 5 u: g) _  E& V* P/ C- j
  61. static volatile int irqraised1 = 0;6 o5 c" k6 e" X" \( |5 h
  62. static volatile int irqraised2 = 0;
    7 _( X  u! X' b$ O" Q8 a
  63. ( g% o' x4 L2 d& L3 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * Z+ R" G1 U: u, o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# f& {" L& v* W+ Q, d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 p: s. e% j  k& n, ~- a- l; M

  67. 1 p7 W: I/ Z7 m0 ^
  68. dma_addr_t dmaphyssrc1 = 0;1 T; R7 A# w6 ]- f
  69. dma_addr_t dmaphyssrc2 = 0;/ N( Z: D: D& ~" ~
  70. dma_addr_t dmaphysdest1 = 0;
    $ l% i9 F" a! U; O! e
  71. dma_addr_t dmaphysdest2 = 0;; r1 U+ V* L9 U3 c2 S9 C% N

  72. ! w/ D: n* [- H1 p% |% R1 h
  73. char *dmabufsrc1 = NULL;
    $ K, i% R. m6 v
  74. char *dmabufsrc2 = NULL;
    9 {& J8 k& K% ^0 `' s1 }
  75. char *dmabufdest1 = NULL;
    . ]7 B- T( w. q9 a5 R8 g- U! `
  76. char *dmabufdest2 = NULL;6 M9 W1 r: e/ S; `* ^5 h* a

  77. ' ]% P. e1 S9 z* x' J
  78. static int acnt = 512;  a4 s4 t: }; A- @
  79. static int bcnt = 8;
    : r3 [7 [2 J9 V+ q3 O
  80. static int ccnt = 8;
    / q" y7 y4 M/ u0 l+ o2 r9 p) I

  81. 4 g0 C* O3 T: p% l0 W
  82. module_param(acnt, int, S_IRUGO);; N3 w7 Q8 {0 ~5 _$ y8 m  i, |0 d) u
  83. module_param(bcnt, int, S_IRUGO);
    4 }; k% j4 Q! |3 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 h/ ]! [2 \1 ?7 i& b
; K1 N4 b/ x( o2 A6 F/ ?5 l" a7 }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ I8 D, c9 y3 Y6 J; Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 @  F2 ], l# W) m6 F( a. B: A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 P/ l% E: h6 _# p' S
6 N' L  h; M* I# b+ w

( w2 |  B7 ~0 t1 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 06:00 , Processed in 0.079023 second(s), 36 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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