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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ e* M' m' j7 H
  1. [code]EDMA sample test application
    % V, N5 W( L- q! _
  2. /*8 @" |1 S1 _9 ^$ _. I
  3. * edma_test.c
    8 g9 E% [9 ]- {! T
  4. *
    / s" w5 B7 v' J5 T, i8 |
  5. * brief  EDMA3 Test Application; `* d- }4 C7 t4 b
  6. *
    2 A; L: Z% _2 z7 p7 a
  7. *   This file contains EDMA3 Test code.
    8 ]2 ~/ Q* c$ y$ k' ^8 B
  8. *; u; L' Z$ `7 V: s5 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ w0 ]9 d; o. d) S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# X# z, z$ e8 ^) Z% G9 X: X
  11. *         TO CHANGE.5 j4 p3 q2 ?" u0 \9 b
  12. *; K9 H6 O& {# y; X' m* U- `" t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" }4 N8 m4 \5 g( V* E% N6 s
  14. *! m/ }% M5 v- f! P+ `/ n) j
  15. * This program is free software; you can redistribute it and/or; c9 D* x, K9 x
  16. * modify it under the terms of the GNU General Public License as
    ! F9 A+ B" ~4 s5 q0 F" s
  17. * published by the Free Software Foundation version 2.
    ) n0 L* h$ M$ F3 k+ e; N
  18. *3 D* {, n3 J  P1 w; s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 i; ~! ]% m+ o# w
  20. * kind, whether express or implied; without even the implied warranty8 b& d1 s* _' y2 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; y( h. w* u! e  o- M$ y0 z, m# x- A; }
  22. * GNU General Public License for more details." y# e9 u: {. |$ r' {
  23. */
    $ T+ O' Z' j! v
  24. 1 L9 T7 |# m  l8 g
  25. #include <linux/module.h>) p$ k* w# Q- x( m# L8 p
  26. #include <linux/init.h>
    6 \7 g2 K) r5 g
  27. #include <linux/errno.h>
    8 U- i0 ?+ |' L# A( Z
  28. #include <linux/types.h>1 r4 |% b  B8 K: j' x
  29. #include <linux/interrupt.h>; _2 ^- v0 O5 P5 l  S
  30. #include <asm/io.h>, [- ?9 M4 ]" ?1 T7 h
  31. #include <linux/moduleparam.h>0 A/ S* T* i6 c0 a$ w  k" H
  32. #include <linux/sysctl.h>" V- b" O( f- P# w* ~
  33. #include <linux/mm.h>
    " ]! P1 Q+ K) r& x/ K
  34. #include <linux/dma-mapping.h>
    ' E0 \$ v3 z# e5 m' ^
  35. ! U; x1 w" E& H; R" t$ E3 ~
  36. #include <mach/memory.h>
    * i! h& c$ i  X8 E3 O
  37. #include <mach/hardware.h>% B2 s8 U) n! k- t2 b1 o
  38. #include <mach/irqs.h>( P) R' Y( e) i( `' G  Z; h. V; F, z
  39. #include <asm/hardware/edma.h>
    4 N* j/ M" @" @8 e

  40. 6 `$ ]6 m: K; C, w
  41. #undef EDMA3_DEBUG
    8 q, V8 Y2 M; I5 _% }
  42. /*#define EDMA3_DEBUG*/2 T& `  D$ u. r4 o" z, n8 T
  43. 0 D( ~# Z/ _* ~" q" }$ T3 w
  44. #ifdef EDMA3_DEBUG, @1 D  E' z( c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! ~2 Q! k4 o' j: m+ n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 _1 V9 C- f. |* `8 j% t. i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) |1 @, e% p/ v( H3 p
  48. #else
    : J, y. M; G! H$ J+ v
  49. #define DMA_PRINTK( x... )
    * s% K; h+ K( S5 M9 Q1 V+ W
  50. #define DMA_FN_IN
    + _2 D$ u# N' f
  51. #define DMA_FN_OUT. h+ c+ c3 |! a& S! R$ z7 m
  52. #endif( X% A0 r1 h$ Q4 P! Y
  53. . ~- J8 x9 |: c+ H# C0 R3 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . |; g$ w* |- e, D5 Q! ?
  55. #define STATIC_SHIFT                3) m% y( |9 R- p: _+ B5 s0 P
  56. #define TCINTEN_SHIFT               20+ W8 j) S. K1 g0 t$ C! ?0 |* Z' P
  57. #define ITCINTEN_SHIFT              21
    ( b$ D) D. @& M9 J) X0 l
  58. #define TCCHEN_SHIFT                22
    * M5 O  X3 y7 v. e/ y
  59. #define ITCCHEN_SHIFT               23! a' K4 j+ g9 n  G. d5 r1 N6 [8 X& W8 y) \

  60. - [$ t; X  B: N5 a0 M. _
  61. static volatile int irqraised1 = 0;
    1 ]6 _* X+ P" j  b7 d, j
  62. static volatile int irqraised2 = 0;* R0 P2 I! T: K. X# F

  63. & B' [7 o0 X' |4 M. t: q7 f3 A$ k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 [( g" u5 e0 b5 H0 }) W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ h* T) d, p+ ~' \- U6 _% [: q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; r2 N9 s: W* I/ v5 j5 D  x
  67. ; d: T( k8 B& b2 x+ n9 m3 d
  68. dma_addr_t dmaphyssrc1 = 0;
    + w+ e7 s' S1 J$ P" b
  69. dma_addr_t dmaphyssrc2 = 0;+ i' b. ^; R1 u  m2 g* L
  70. dma_addr_t dmaphysdest1 = 0;0 u" B" B$ \+ u: |& D1 D0 [. x
  71. dma_addr_t dmaphysdest2 = 0;
    ! ]* a% W9 C) P

  72. 7 N" E$ g) ?* C6 S
  73. char *dmabufsrc1 = NULL;
    - D) I; q1 V; z- l
  74. char *dmabufsrc2 = NULL;& L7 U5 m# [) P% I- `2 X4 h' F* w
  75. char *dmabufdest1 = NULL;" C! r1 k. ^! |. q% m$ Q
  76. char *dmabufdest2 = NULL;
    ; ?9 `- F9 k+ x# Z# d# P

  77. ' m6 }0 v  P7 b- L3 J
  78. static int acnt = 512;1 G% L1 F/ w1 @. T2 p- O& f
  79. static int bcnt = 8;1 ~2 t! h9 A4 {7 S6 B
  80. static int ccnt = 8;
    6 p% K+ J$ I6 P1 F2 j  \

  81. & d' \- h- t9 R+ a1 l
  82. module_param(acnt, int, S_IRUGO);
    ' s  {. u' O1 i9 h
  83. module_param(bcnt, int, S_IRUGO);
    ) f. w4 [: K3 `  |2 v7 M+ m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  D0 d4 a3 t! [! u# i2 e

) J. U( R' h  ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 e9 m' q5 a# W' ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  R% u. t" A, x* S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; s6 e9 X2 C4 s. N' g4 c. \% L1 W2 u
& a7 t& C; c( u$ z' D- w0 F2 J3 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-14 06:32 , Processed in 0.040528 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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