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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " }- N) I  F! |" G- @! V( |0 o6 P
  1. [code]EDMA sample test application6 ?3 B) _: O- _  p
  2. /*) `5 F' V9 A* C/ {
  3. * edma_test.c' u/ O0 |7 q( `, R
  4. *- U* w9 o# I9 k; N1 N/ T( ~
  5. * brief  EDMA3 Test Application( ^1 q: B$ O+ T
  6. *
    , D5 R. l: L2 ]# a0 I- ^7 V& d
  7. *   This file contains EDMA3 Test code.& {/ w1 R) f5 i- O, a
  8. *1 O$ ]* N& u6 }4 A) [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 \: C. t0 _6 \3 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , F! h% J4 ^8 F! U# z7 E" D0 @0 ?
  11. *         TO CHANGE.6 w! [% U( l* p( V
  12. *
    % `% |! n% Z% j, S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; g! C- W# x# o% r# N5 i
  14. *3 Y4 |' ?2 I/ ], H
  15. * This program is free software; you can redistribute it and/or2 ]& B! h" O8 L# I. t
  16. * modify it under the terms of the GNU General Public License as# r9 A3 F9 b2 x- V  c' s
  17. * published by the Free Software Foundation version 2.4 J" O3 x. e( S( \  I. A. R
  18. *& Z8 S8 ~! f/ R4 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # w( w! r7 ]9 ^. S! r$ a
  20. * kind, whether express or implied; without even the implied warranty2 M: X9 \" c8 e4 X7 e' N' I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 s  b1 S6 `9 X( t# B2 N5 b
  22. * GNU General Public License for more details.( z6 v' F: m+ \/ I+ Y8 e* t
  23. */- ^' e1 X  ^; r6 X7 j7 y

  24. - v/ \2 F6 O* O( z; o8 L$ X* X. }7 g
  25. #include <linux/module.h>0 W7 ~, ?( [/ T7 s3 T6 B2 g
  26. #include <linux/init.h>8 n8 E% G7 P- s- F* Z  P9 c( B+ C
  27. #include <linux/errno.h>
    2 a( E; \" P7 m) A
  28. #include <linux/types.h>
    2 a2 a: T) B: R2 C% X# I, `1 }
  29. #include <linux/interrupt.h>& \% J' [' @6 ]. [$ q
  30. #include <asm/io.h>
    . n" _! p( ~/ m4 D8 h7 P
  31. #include <linux/moduleparam.h>* [! s$ E/ ]& B' L
  32. #include <linux/sysctl.h>
    ( {$ p# H5 }! y2 N  N
  33. #include <linux/mm.h>+ p5 g% `) m; o, s& U
  34. #include <linux/dma-mapping.h>
    - E. @/ |) p" ^
  35. 1 r; e9 m& C$ c$ g" Y! J# z
  36. #include <mach/memory.h>
    % \2 p, G0 s. }4 @7 z/ W
  37. #include <mach/hardware.h>9 V, M! w$ R! j1 L5 M5 k
  38. #include <mach/irqs.h>1 p9 Z# d$ }/ I8 w
  39. #include <asm/hardware/edma.h>5 T0 R# g7 ?! @5 g( N7 A% C

  40. $ H- O3 \% p6 ^: G; E
  41. #undef EDMA3_DEBUG
    ! y, q; l, Q& I
  42. /*#define EDMA3_DEBUG*/
    7 G# h5 V/ C5 k

  43. ( J: |# }4 Y) F, Q9 I
  44. #ifdef EDMA3_DEBUG* z1 B. w- U8 O; r8 X& r! u4 ?2 A- S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 X+ n2 `! p" t% w/ C2 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + f' {. A; d# x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 D) j# D/ E  D( X$ V0 X8 _  w
  48. #else
    4 ^# K! e7 H* \' Y' t0 D
  49. #define DMA_PRINTK( x... )
    ! L+ N& A) A; q8 K/ Y) m, g
  50. #define DMA_FN_IN
    : u$ B, n" t3 d9 D
  51. #define DMA_FN_OUT
    ) H" ~. B0 {1 N
  52. #endif0 r. h: O8 K$ t2 A
  53. % U9 _! I+ ~3 \. a9 y4 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& ?+ j! W" \+ ]% ?1 \
  55. #define STATIC_SHIFT                3# b0 ~% I3 c  g& b4 D, p3 h
  56. #define TCINTEN_SHIFT               20
    0 `: y- I5 c) w0 T5 D
  57. #define ITCINTEN_SHIFT              21
    9 p% @. f0 `* C" y, F7 V8 j8 E
  58. #define TCCHEN_SHIFT                22
    / R- e$ j% D2 e. t7 e! P. q
  59. #define ITCCHEN_SHIFT               23
    3 z5 e: m1 ^; t! k0 R! s$ b
  60. 5 x; O' W7 z" A
  61. static volatile int irqraised1 = 0;
    8 j7 }) E" O& j. k( ]4 ~0 _. {
  62. static volatile int irqraised2 = 0;
    3 S. |& J" T1 o  R) n6 ?1 b

  63. ) X' {4 `; s5 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" q/ x$ v) R. C3 I, u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ T8 A3 z9 W( S7 Y" y# d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . ?, D6 N0 ~, [, V" |: ]
  67. 9 |# r2 b" A. ?$ x
  68. dma_addr_t dmaphyssrc1 = 0;. W! f# l. c- w7 a
  69. dma_addr_t dmaphyssrc2 = 0;
    3 H* P  z! M9 Z$ n7 s
  70. dma_addr_t dmaphysdest1 = 0;7 b$ D2 F4 Q  ~) A, T$ A0 d4 k
  71. dma_addr_t dmaphysdest2 = 0;
    / |: K1 m& Y0 p% _0 v

  72. & a2 A: v* V8 S! p* g
  73. char *dmabufsrc1 = NULL;
    4 X- J) N, n) ]: r$ M5 H1 }  M
  74. char *dmabufsrc2 = NULL;" z+ m6 y+ u( H1 z3 k' ]
  75. char *dmabufdest1 = NULL;3 S5 R  Q5 f# `' L' E( j
  76. char *dmabufdest2 = NULL;5 @! l% A7 L, b
  77. 9 p" M6 O0 N8 e8 T: O: x
  78. static int acnt = 512;
    $ _8 }- n: E4 o% Y
  79. static int bcnt = 8;1 U% J- |7 H  d# P. q3 {$ I
  80. static int ccnt = 8;
    9 U6 O. X1 v6 n
  81. 9 k, T& \$ g4 u4 {
  82. module_param(acnt, int, S_IRUGO);  e: L- A0 D. R+ u$ l. D+ |! J
  83. module_param(bcnt, int, S_IRUGO);
    ' r9 T0 P8 J& j) h8 _8 c8 ]& o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 [5 a7 \1 L2 A
4 U" g9 N( Z" W3 O, F2 Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( A% g* |* }3 l+ f" O1 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" O- W4 o) ~. D" i% }9 S$ F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 R( d: b& g7 C. T+ s

. W# ~( B% |: e, }+ N+ s1 ^
& V5 e5 w# S$ G( u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 19:28 , Processed in 0.038250 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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