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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" H: t/ x9 J( ^  ^1 S9 _& F
  1. [code]EDMA sample test application
    : |2 F- X9 U1 f0 B: \2 l
  2. /*
    7 T. f7 z; B' ]9 k
  3. * edma_test.c' z) O+ g$ t+ W1 [- p- i
  4. *
    & N7 f8 y, F0 N: v( L
  5. * brief  EDMA3 Test Application9 [% y  |# H' r; x6 [
  6. *" a$ L+ Z: ]% ?: ^+ [& \; }# G: p
  7. *   This file contains EDMA3 Test code.
    7 [' _" ]6 x' J0 V" U
  8. *
    # P* C" ?) w6 b& f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 [/ _' {6 r! w1 ^! q  P, F6 Q# G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 z& y+ _0 c+ J2 g2 ~9 w
  11. *         TO CHANGE.
    , Q4 P& I; Y7 Z% m$ i' H, z
  12. *! g$ s1 T+ z/ R( H5 X$ L5 w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 o' E% V  ^: U) W! {& {
  14. *( _- L6 s: t! [: Y$ ~
  15. * This program is free software; you can redistribute it and/or
    ) [# g4 O$ T  k/ u& |
  16. * modify it under the terms of the GNU General Public License as
    & ^4 T- E: D2 _: o0 S' R
  17. * published by the Free Software Foundation version 2.0 ~3 X' T+ @# z8 |4 x" ~! t! ]
  18. ** V$ q% L. [, V  O4 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- L7 G# R  ~1 F
  20. * kind, whether express or implied; without even the implied warranty$ o# V: }! I* _, O* v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" T# e, E$ @0 O
  22. * GNU General Public License for more details.- `  e# e( i7 _; j; p$ f
  23. */
      \8 S/ k5 B0 y8 `* Z

  24. $ _' @3 V4 V# I( ]! X; q* I; t
  25. #include <linux/module.h>
    7 B8 O8 Y0 v2 c- h" Q
  26. #include <linux/init.h>$ N& X1 e% l& j4 D+ D4 v: M
  27. #include <linux/errno.h>8 I# k: C* ]$ d% D5 n, x
  28. #include <linux/types.h>8 i2 _8 U, \& h, ?- J
  29. #include <linux/interrupt.h>2 G2 C  q$ A+ j7 H
  30. #include <asm/io.h>
    - F# x' q- u+ E; \8 ~7 X4 d
  31. #include <linux/moduleparam.h>
    , M: A) A, s) y3 O; |* |  D
  32. #include <linux/sysctl.h>* V+ E/ M5 ]+ W: T9 p2 B1 E, B
  33. #include <linux/mm.h>
    5 h1 y3 L  j3 S  P0 A
  34. #include <linux/dma-mapping.h>8 {4 }% a4 }, W! l* l5 L" `/ F" b4 i

  35. # S+ r3 x. i* ?% N3 N0 y* _
  36. #include <mach/memory.h>* L7 a% F4 D4 F. U$ d6 n" V
  37. #include <mach/hardware.h>4 x3 r8 V; \  ]+ P" m
  38. #include <mach/irqs.h>  m+ A8 d- f, _& _2 g: \
  39. #include <asm/hardware/edma.h>. [$ q* ]2 I7 G* [

  40. ) }1 C+ {7 j- |$ {# M# h
  41. #undef EDMA3_DEBUG0 e4 Q1 f, g" `  u
  42. /*#define EDMA3_DEBUG*/# Q, v1 l% U  {

  43. , e* m$ @5 V: S
  44. #ifdef EDMA3_DEBUG
    9 ^. W# s# J# V2 h) ?' \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) n) R2 m: C1 K) \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 w+ y, p7 m7 U3 t+ K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& o  ~; ]0 }8 a, T: o, `# v
  48. #else
    & S  z1 ^- M1 ~4 t( T* ^# E( L
  49. #define DMA_PRINTK( x... )3 {. x, s4 X: p, p
  50. #define DMA_FN_IN: k7 X6 |# T. b% Z- R
  51. #define DMA_FN_OUT
    . f+ c! v/ f5 y" }, ]5 g' C9 S
  52. #endif
    ' U6 ]( {; r1 F7 a

  53. ; w/ L  c# Q2 k0 n5 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , t8 f+ i4 y! X/ `5 \
  55. #define STATIC_SHIFT                3
    " \! A1 _5 N$ {4 ^- U6 f$ Z# P
  56. #define TCINTEN_SHIFT               205 b% y5 W! ^& P' o
  57. #define ITCINTEN_SHIFT              21
    9 m. @' [. [4 H: E6 s$ v) v5 t1 n, }
  58. #define TCCHEN_SHIFT                22
    + L: L3 p: M- y: H0 F" ~( C
  59. #define ITCCHEN_SHIFT               23
    0 O4 m. N$ Z+ w2 Z% p& @

  60. ' L  a2 Y" v# H' x* N  l
  61. static volatile int irqraised1 = 0;
    8 o4 r2 d  p$ t
  62. static volatile int irqraised2 = 0;
    2 f: y$ t7 u* h/ S
  63. $ V# y' i  x! [! I+ x; o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ u. V" U# `7 F; y! e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 ~$ A+ Y! u/ X# b0 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: u/ L8 n) t# z5 D1 v( }( O+ V

  67. . T$ ~2 }) l. c* d. M. N9 s5 p
  68. dma_addr_t dmaphyssrc1 = 0;& W: V1 j9 @% t. W" L
  69. dma_addr_t dmaphyssrc2 = 0;7 {# I) n7 j  L" e$ [
  70. dma_addr_t dmaphysdest1 = 0;" c/ {1 t. U& k) W% r0 \* V3 ?
  71. dma_addr_t dmaphysdest2 = 0;
    2 v8 G+ r( u+ b- _6 E6 q7 {+ i" z
  72. 1 s* x- e! K& o7 ~+ u
  73. char *dmabufsrc1 = NULL;( x5 f0 c9 b3 j  W# ^5 ]& x$ t
  74. char *dmabufsrc2 = NULL;4 k) Q( O% M7 q
  75. char *dmabufdest1 = NULL;
    # _1 \8 b6 _4 P% ]
  76. char *dmabufdest2 = NULL;8 p4 ]/ A' [$ S

  77. 9 n/ X1 H. B2 A" w
  78. static int acnt = 512;
    4 ?4 G. N/ x& _; r' B  h. L, b
  79. static int bcnt = 8;% E9 @9 K& E* [" b4 S7 F$ B/ y
  80. static int ccnt = 8;
    ' h" g4 G7 V; P
  81. . v9 U* x  _) k
  82. module_param(acnt, int, S_IRUGO);
    . P& g1 C8 m2 S% I0 j
  83. module_param(bcnt, int, S_IRUGO);7 n$ g# H, j; w" P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 @4 G5 Z$ J5 P5 ]- `( s

  |4 T1 X& t4 r& I8 L/ O' U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* t6 ^: S( A8 G( u/ X+ K* L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& c+ m& C4 t6 P, N4 z; I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ N8 ]: A' B$ Z7 e5 b4 L9 j; O) K$ _- r( {' V* F# d

& k. z# j" H% V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 04:35 , Processed in 0.041653 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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