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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 `, \7 P9 ^- Y8 y
  1. [code]EDMA sample test application
    9 g7 U1 Q, }/ i5 w. c
  2. /*/ y7 s  N% V4 o' k5 m9 a, J
  3. * edma_test.c: ~  K1 h5 n+ \& a* L8 \
  4. *
    ; Y  O! ]. `1 |4 C- R
  5. * brief  EDMA3 Test Application
    9 D0 Y5 r; x$ Z0 A! F8 D
  6. *
    ; I+ b. g6 ?) `
  7. *   This file contains EDMA3 Test code.8 {6 ?& q+ j: ~4 L; T+ i1 M
  8. *2 A6 ^! O& p# X" ?# j3 X+ T) X6 Z: {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! Q; M% c$ `; i( Z" I! m1 h- _5 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; z- u/ [  ]6 y
  11. *         TO CHANGE.! |$ v: K3 ^# {
  12. *) }% S$ y( ?! }5 N! l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 x/ M# M% U% B/ ?3 S
  14. *
      F6 P! F/ M: {) E
  15. * This program is free software; you can redistribute it and/or
    5 M, n9 ~8 [3 Z3 g  ^' M9 t
  16. * modify it under the terms of the GNU General Public License as) p1 Q2 e6 F) Q( p3 m9 a
  17. * published by the Free Software Foundation version 2.. Q8 }+ Y) {# y, U: |
  18. *
    ) N# B8 t/ X& @) {% V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ z& K0 V; m# n
  20. * kind, whether express or implied; without even the implied warranty: w* U  y, c" J6 a' n9 f" h/ l' O& ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 j# _/ u: n: u5 y# v0 j* S
  22. * GNU General Public License for more details.3 D8 b2 J; W5 A; l1 W8 c" [
  23. */9 i) D: e3 ~) \1 |5 z& m
  24. 1 B; a7 w$ N- m/ c: {
  25. #include <linux/module.h>% _: `- r, X8 K( v- @6 M
  26. #include <linux/init.h>  X0 w  |9 q! a! n9 a7 u% r
  27. #include <linux/errno.h>
    - M6 Y, }; D0 W9 a! t; H- M
  28. #include <linux/types.h>
    7 Z7 K* O4 Q" O0 x( k' S% O
  29. #include <linux/interrupt.h>
    4 D+ y# N# s- _( ?
  30. #include <asm/io.h>. N3 ?2 ^' s2 k4 J0 Z
  31. #include <linux/moduleparam.h>
    5 [8 X0 \) E5 x& x: K
  32. #include <linux/sysctl.h>8 t# E- |: N% x& G8 j2 o" u5 Q
  33. #include <linux/mm.h>9 Y$ u* t" A: i) I
  34. #include <linux/dma-mapping.h>
    % z1 W' @: ~2 g5 q; H2 s

  35. : F7 H- s- `+ j9 f
  36. #include <mach/memory.h>+ c/ H5 h6 W' y  O& X
  37. #include <mach/hardware.h>% }" E  Q9 \& W& U
  38. #include <mach/irqs.h>
    & l$ F; ?7 S9 V2 W$ y( |
  39. #include <asm/hardware/edma.h>9 ^. e. K7 Z$ k6 M7 r
  40. + k$ R/ U6 T3 o/ t" J
  41. #undef EDMA3_DEBUG) Q. v& M: S- _; X# k8 k+ `) Z  e
  42. /*#define EDMA3_DEBUG*/0 \7 e1 i9 G3 @; V% n$ t

  43. ) i9 f2 c! M7 N( Q$ e3 F/ e( x
  44. #ifdef EDMA3_DEBUG1 }$ X0 V+ M& l/ E% S9 _7 v5 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- a9 W. S6 D( A, f( q; q: D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): \1 B2 y2 d( _/ X* ^! Q6 \# K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 w1 c+ [3 Q: I, d6 U3 v7 e' z
  48. #else
    9 {4 `! d4 V3 p& b
  49. #define DMA_PRINTK( x... )! w, A5 F6 |4 ^3 F1 L$ \9 }
  50. #define DMA_FN_IN1 L0 U% Y; M& m/ R0 I* P
  51. #define DMA_FN_OUT. C4 T6 L3 d- _, w0 o  Y
  52. #endif
    : k9 d2 i6 K; D" N

  53. ' S% M: x: }* ]* I6 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : m" Y/ Y6 e, d% U. _5 M# n
  55. #define STATIC_SHIFT                37 N* o; O+ ~' Z- j
  56. #define TCINTEN_SHIFT               20% `$ ]& m3 x5 q! c) w, m" a& B
  57. #define ITCINTEN_SHIFT              21
    ) g6 V3 Z3 k9 m+ n9 l8 j" p
  58. #define TCCHEN_SHIFT                22" l0 K* B* f9 Y  F& {$ W
  59. #define ITCCHEN_SHIFT               23
    6 n8 E) `0 c, M$ A% i  n7 v! l
  60. ( F. L0 B6 h8 j2 l: q- B
  61. static volatile int irqraised1 = 0;
    ! ^# a7 s( f: |& J! Q8 A' @; ]
  62. static volatile int irqraised2 = 0;
    , Z$ o/ r. k5 V; _, N8 R9 j

  63. ! H8 P" h, K. C, u# Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : `& b) Z$ m2 y' ?  y2 [( E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 b7 h3 s% v) y6 b+ Z" X# T4 B" h+ w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % e: F% _8 O& E* _
  67. 6 n  }, t8 u2 A& g, }, O
  68. dma_addr_t dmaphyssrc1 = 0;
    1 i: i  w9 O) `; U2 ~9 E9 C0 i
  69. dma_addr_t dmaphyssrc2 = 0;
    9 {9 K$ J' V* {, v" h
  70. dma_addr_t dmaphysdest1 = 0;
    3 ]8 @- @( N9 Z$ m, G3 k# i; C
  71. dma_addr_t dmaphysdest2 = 0;
    7 H5 j  o- {6 R6 w9 d

  72. & S) X; `3 `2 `. E8 n
  73. char *dmabufsrc1 = NULL;
    0 o2 a6 P; L7 A
  74. char *dmabufsrc2 = NULL;; `( h0 ~0 Y0 n- w% M7 B
  75. char *dmabufdest1 = NULL;; B# D1 W8 N2 b! S$ D# ~
  76. char *dmabufdest2 = NULL;2 y4 {; f5 \( E1 Y
  77. " p6 \9 e. {% x8 k# E  n
  78. static int acnt = 512;
    ( {" x, a" o- a' j0 Y6 d3 K
  79. static int bcnt = 8;
    % L0 K% X, h$ S- B; Q
  80. static int ccnt = 8;
    4 T5 ~' S0 r8 z5 r' r( @

  81. ) C" o/ O2 \" F  f; E
  82. module_param(acnt, int, S_IRUGO);; s+ i* p: u& s& |' p
  83. module_param(bcnt, int, S_IRUGO);$ j* E2 ]7 H0 }8 {/ Y% l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. `' a' Y5 F# ]* Z, w

- H; E3 `( B2 [# V2 t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( P& s: Q3 G1 |9 b) O+ |6 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: t5 E' J) d$ B9 O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ |6 A: Z- D8 U5 A5 a4 p
' u3 n+ }6 g, t. L& ^2 N
5 \" j# u2 C, [+ Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 01:08 , Processed in 0.055629 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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