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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; j2 s+ ~7 j0 x5 q' @$ o$ [
  1. [code]EDMA sample test application% Z+ C8 X' s6 x. x
  2. /*
    : L, h! f8 b. R. B- ?' T
  3. * edma_test.c
    , U4 g9 R! b$ P. Z$ w
  4. *$ o" A. ]% g; k
  5. * brief  EDMA3 Test Application
    + g- p2 c% p1 M- |5 P
  6. *
    3 ?1 @) i# E1 _; A/ i: U1 e1 C
  7. *   This file contains EDMA3 Test code.
    1 \$ `3 y" U7 d# F; V
  8. *
    - D8 k* Q& ?5 M' q7 L" `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 X$ N; }2 A3 z; K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 L+ ^& }0 e4 k( v8 H5 S1 I. ?
  11. *         TO CHANGE.4 q% E% K  e+ X3 K
  12. *
    + b9 r' ?1 t1 h4 `) s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 h! F/ t- s! C. U0 z) i! {
  14. *; ]8 ?, N7 V/ k: s+ ^! T
  15. * This program is free software; you can redistribute it and/or
    / Y& ^4 D" j! s( k7 m7 N
  16. * modify it under the terms of the GNU General Public License as- ?7 T6 R/ b: S: a0 S, T
  17. * published by the Free Software Foundation version 2.
    % F6 N# t% U' I% v/ F
  18. *& Y) i. }, @  O/ h3 Z5 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 d1 V9 i$ `: _/ D# y4 O/ _* N
  20. * kind, whether express or implied; without even the implied warranty
    : _: f$ R6 c/ s; h7 V9 F* x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. c( ]; d% n! `+ G) ^& I
  22. * GNU General Public License for more details.
    6 e" W( [! j7 _1 m: E: I0 A( R
  23. */
    5 ?% @. O, h& V% G9 V$ K. F; q$ w# ]$ K
  24. 9 T- f8 Q; {' X# g
  25. #include <linux/module.h>
    ( P9 V" Y) a$ D4 U4 H6 Y
  26. #include <linux/init.h>5 G( s& `, Y5 v4 F2 k6 B
  27. #include <linux/errno.h>/ a4 p; M& m! K2 ^7 B0 q  h
  28. #include <linux/types.h>
    2 p# Z1 r; K2 Q( a$ p
  29. #include <linux/interrupt.h>
    . G+ }( H( W. t% M
  30. #include <asm/io.h># I  u- f! x. F) |! i& u/ O
  31. #include <linux/moduleparam.h>
    3 w6 ]  L2 L* U: O" Z/ o0 c8 }
  32. #include <linux/sysctl.h>4 F: r& O/ p' {/ g! {1 I4 }
  33. #include <linux/mm.h>2 a: z1 S* L$ Y/ ~, |+ B
  34. #include <linux/dma-mapping.h>* c! Z$ C, @7 t& c4 R1 b

  35. % L4 d( G. j5 g9 q! ?: V
  36. #include <mach/memory.h>5 ^' f2 O$ s4 P8 O3 Q, b9 q  r
  37. #include <mach/hardware.h>
    ) g  X# M3 |& ~4 P1 S) S' ~$ Y, n
  38. #include <mach/irqs.h>
    + d, ?( X& r) _0 z
  39. #include <asm/hardware/edma.h>
    ( ]- `& C8 m9 ?' C; h  N
  40. ; U7 B* F* T8 {9 Y0 T
  41. #undef EDMA3_DEBUG2 l! x& u# B- g* V, V; S
  42. /*#define EDMA3_DEBUG*/+ M, r5 Y7 e1 }, Q9 X/ ~& b; w

  43. 2 W5 ^: c! A, Q# S4 _
  44. #ifdef EDMA3_DEBUG# b, U8 w- [- l, Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' e$ @$ Q: Q6 B3 e/ m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : q' T3 b+ S9 E  f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 l  b/ J) {) @* S0 I) M0 @
  48. #else
    1 z7 m! c' K  S1 e
  49. #define DMA_PRINTK( x... )" \: g7 h7 U! n! v$ R# i' k4 c
  50. #define DMA_FN_IN
    ( @/ R; r  d' a' r. \/ _6 |! Q5 ]
  51. #define DMA_FN_OUT( E' @! b$ @$ x+ Q) C' E
  52. #endif
    5 G2 d9 J' Z# U1 e

  53. ' x8 |- Q: `0 ^. q5 y! [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) C; ^+ W: V! d/ y2 P
  55. #define STATIC_SHIFT                3
    : F$ x5 O# t; r( N% O5 A
  56. #define TCINTEN_SHIFT               20
    5 l' k& A3 \6 C  }1 l
  57. #define ITCINTEN_SHIFT              21% b, u2 i' U5 q! R
  58. #define TCCHEN_SHIFT                22
    ; Y1 l  t' u1 w# \" ?
  59. #define ITCCHEN_SHIFT               231 @9 q( d& Z3 w% q+ h

  60. : w/ @9 o! Z! j# M+ q9 i7 f
  61. static volatile int irqraised1 = 0;; L, g4 o8 e9 S8 N5 j, |
  62. static volatile int irqraised2 = 0;4 w' Z! v3 L; W; D, i# f; ~

  63. 0 j$ T! T- l3 m8 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # l+ T0 l( M' G# c0 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" o$ D6 ?1 P9 w  K) h+ D5 G7 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* o4 T# ?' j  Y2 d% [  X
  67. & m- B$ @0 [+ o2 q& J4 w9 w, G
  68. dma_addr_t dmaphyssrc1 = 0;
    4 N! B4 A" n; i( }" W9 }
  69. dma_addr_t dmaphyssrc2 = 0;
    ; e0 @8 t9 S2 i& G4 L: }
  70. dma_addr_t dmaphysdest1 = 0;
    8 A" I, q$ e# u3 V+ c/ ^
  71. dma_addr_t dmaphysdest2 = 0;) H' i& n( Z( h& b) q( e

  72. 8 f" {: Z  ]- |3 Z5 W: Q
  73. char *dmabufsrc1 = NULL;
    ) U* A) `3 c' V8 `0 ~
  74. char *dmabufsrc2 = NULL;' [4 t3 Q0 z7 R
  75. char *dmabufdest1 = NULL;" y- H3 J) D' h" o0 m6 m0 s
  76. char *dmabufdest2 = NULL;
    ( h# H; Y, u4 G: E% h

  77. ! [6 V. |3 u% p% W7 R5 q# l) q
  78. static int acnt = 512;! x1 ?+ ]7 l6 f* E7 z/ H( j! i6 |- Y
  79. static int bcnt = 8;
    $ I) K* X; S1 s
  80. static int ccnt = 8;
    ) f' o( E. K% z8 E. e, `
  81. & v1 [3 c+ n+ M/ E* i' y
  82. module_param(acnt, int, S_IRUGO);
    4 z* u# [+ x; _+ d5 m/ D2 }+ O
  83. module_param(bcnt, int, S_IRUGO);
    0 R  S+ l/ t0 i& J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& n8 N: Z( r$ j/ T7 O1 s

. T- {" p3 I" X" d* O+ u3 J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 K2 T+ M8 o6 X* r2 M" r2 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ D4 U- X1 Y% R! z, x. t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& y- |' `9 A- h! t$ i/ L$ X+ e! k7 ]# K8 ~3 S% t3 o

7 @* W: b& r0 K7 s! _  \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-2 00:20 , Processed in 0.046165 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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