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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , ^- d; M4 ^; d; p; T# i
  1. [code]EDMA sample test application
    + t. C4 P+ \0 [$ Z; h5 B" `
  2. /*
    " O7 V. D3 b6 f% ~) K8 R* v
  3. * edma_test.c. Y) {) o" K' Z; b
  4. *
    ! g7 h1 p* Y# W
  5. * brief  EDMA3 Test Application
    8 [1 a) `1 k. ~) Y* Z" b* k$ z# U
  6. *
    # I, g. g( D: x
  7. *   This file contains EDMA3 Test code.
    ' E! m! T0 q/ z0 I# {
  8. *1 b" i& @) t6 R/ U" U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 _! [4 E' D) f, ~) S$ o  v! n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 h2 V& r! L5 k& g" K# E8 `" K- Z
  11. *         TO CHANGE.3 J8 O" Z2 B! W) ^
  12. *
    6 c) _" f  B! i3 L& [: I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. p9 R' s& W) ?. M6 ?% J! b
  14. *% a, W7 o# p3 n& }1 }0 t
  15. * This program is free software; you can redistribute it and/or
    . ]: u/ e9 h/ t5 n7 D( M
  16. * modify it under the terms of the GNU General Public License as
    0 e2 c7 ~8 k/ }4 M% [( R
  17. * published by the Free Software Foundation version 2./ I; n! Z* H; t
  18. *0 Z" \6 C" g4 i3 |$ F: E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 d& p  N4 K0 I# G; S
  20. * kind, whether express or implied; without even the implied warranty
    ; g7 j. B6 U: B* O- p: S1 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. w; W& r0 V! L5 M& `
  22. * GNU General Public License for more details.
    & Q9 a. ^/ H+ N  }5 d
  23. */, z3 R: K. A! C
  24. * z. s; J" P& l$ l/ l. R" _4 ~! G
  25. #include <linux/module.h>4 I7 t" p6 U! T& ?
  26. #include <linux/init.h>7 i' t/ \6 E  u9 g$ p" s7 o/ c
  27. #include <linux/errno.h>
    5 g$ Y# P3 G% ^4 V9 H' Z
  28. #include <linux/types.h>
    ! O' H6 }8 b# O7 |6 E! H3 Y
  29. #include <linux/interrupt.h>* `) b$ |; [) _) ~
  30. #include <asm/io.h>; X" s( n: x* C9 k" ]( d1 h# W
  31. #include <linux/moduleparam.h>4 F9 i7 A( }* P( y6 m) J/ ~
  32. #include <linux/sysctl.h>
    & ~8 o6 A+ {8 b* b" p0 ?
  33. #include <linux/mm.h>
    ( x) l6 X( O( c6 ~( _  C2 X% G
  34. #include <linux/dma-mapping.h>5 [) C; u8 g+ U+ @( |; y7 [

  35. * L; [+ E+ d! _' r
  36. #include <mach/memory.h>" m/ c+ S# D3 ?5 X8 h# y& J0 |: n
  37. #include <mach/hardware.h>- C+ Z+ o5 v9 C/ n4 }: |1 v5 o
  38. #include <mach/irqs.h>7 y0 m: {) Y$ Z6 j3 K
  39. #include <asm/hardware/edma.h>! e: z$ U4 _3 u, n

  40. , h, c" v" ^( c+ L# ~2 ]( W2 P/ s
  41. #undef EDMA3_DEBUG
    * V$ c- B9 I8 B
  42. /*#define EDMA3_DEBUG*/
    $ {& K0 _; o0 E" C2 t
  43. 7 c( B6 D: j9 ~4 @
  44. #ifdef EDMA3_DEBUG9 B% l, b9 [' _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 R6 i* X6 p' C# \0 B$ e+ m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 y6 V/ r: }: Z& }! N! @0 ?4 a, M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( d# w7 a4 e4 I- w) x, K$ P- `$ O2 T
  48. #else
    " V% A0 G( G& \( S) @4 `
  49. #define DMA_PRINTK( x... )' Z1 ?$ f4 I" q3 ]' r& ?. {  P
  50. #define DMA_FN_IN
    - z* N* O3 U4 s) b; a
  51. #define DMA_FN_OUT
    8 m5 j3 c9 c/ ]6 \! }9 R
  52. #endif& y8 }, _" W$ p/ g+ S% u$ c
  53. , \% r: J3 J2 Q2 k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      {8 X4 f7 G& r- k% Q( N* I
  55. #define STATIC_SHIFT                3
    3 d) e. {; S' r/ W, H
  56. #define TCINTEN_SHIFT               20
    * w. e3 T; L$ M+ Z9 y/ N! U) R" j/ T
  57. #define ITCINTEN_SHIFT              21; t) V. A" e% L7 ^' F7 C' m2 r
  58. #define TCCHEN_SHIFT                22$ N6 f: M* Q1 e1 _6 i; Q
  59. #define ITCCHEN_SHIFT               23, h+ q" i9 t7 ^3 C* E

  60. 2 L; S6 J2 ]+ {5 J. \  m0 k
  61. static volatile int irqraised1 = 0;/ M0 d6 {& J$ b
  62. static volatile int irqraised2 = 0;4 T+ h$ ]' M2 S  M

  63. 6 F' A+ `: b7 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 t0 x# \6 Y1 \: a4 q( a- T; L' b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 W8 S6 Y7 K/ {0 R" u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ @/ D! v7 F4 S  S( I' }; s
  67. + F9 B* [9 {* j: r
  68. dma_addr_t dmaphyssrc1 = 0;: `; N! m" g# i/ h4 O+ M3 l
  69. dma_addr_t dmaphyssrc2 = 0;
    + t& ]- Y4 R% g" T% J: C
  70. dma_addr_t dmaphysdest1 = 0;* v; }( f- x, Q6 E
  71. dma_addr_t dmaphysdest2 = 0;/ W- P+ H8 u/ c$ s' o! C# U+ o
  72. # J6 \/ U0 M: \3 r1 u
  73. char *dmabufsrc1 = NULL;$ I0 N, Q* Q2 y) E# B& V
  74. char *dmabufsrc2 = NULL;
    / D' @; g* k: K; S
  75. char *dmabufdest1 = NULL;2 {- h/ c0 n2 H5 ~0 O% e* C
  76. char *dmabufdest2 = NULL;# Y7 w9 `7 E8 g( B+ X
  77. , o/ d2 q( z0 \( V4 n
  78. static int acnt = 512;
    % N# `# d3 a) s* @) `# |
  79. static int bcnt = 8;
    ! i1 d0 L+ x7 Z6 ]
  80. static int ccnt = 8;, W' Q- M# H- n& U& K' H/ g& I/ w

  81. ; |( z+ E' ~) t. }7 N$ W
  82. module_param(acnt, int, S_IRUGO);
    & p( V0 }- w* e
  83. module_param(bcnt, int, S_IRUGO);
    ) x; V3 I: G) I3 f8 g3 y1 o3 L! o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 V2 i$ l1 v4 |6 _3 z
& k! T2 U' q4 |" M; a: h( M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ }3 I* G, a/ x1 C8 M( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 o: f1 L7 \. J! E, g8 f% j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 h% x# A6 ]& z4 ?
2 I# O9 i5 B1 s2 V3 _
+ p  X. ^7 Z: L5 F' @9 `% ]" H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 07:28 , Processed in 0.071926 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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