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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ ~0 V5 n( i1 S$ R* p' y  V
  1. [code]EDMA sample test application, l( Y+ B8 O7 H( T0 A$ S: T: ]
  2. /*
      ^1 `' k, v& `8 k! V
  3. * edma_test.c! m' Y$ c1 L+ K+ T
  4. *% t5 Y! Z: S7 e2 f% M# ?
  5. * brief  EDMA3 Test Application
    ! c" P1 M7 j! V& |
  6. *
    5 P" n* y' i3 a3 h' q
  7. *   This file contains EDMA3 Test code.
    " X0 `3 X! {$ X( z, h! h
  8. *
    ) o' O# u; l) C# r6 A% q$ }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  l! [  Q$ Z2 q7 ?: t9 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' e2 q2 i6 o! O5 k; I
  11. *         TO CHANGE.
    3 z. g5 q3 r. `& N
  12. *
    1 \' Y1 y# d7 p, ?" B! m$ H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# s+ n. g2 \9 _" u7 b
  14. ** _! D3 f. P- ^
  15. * This program is free software; you can redistribute it and/or2 s9 T- a7 [, G# E+ I% x% l2 U9 K
  16. * modify it under the terms of the GNU General Public License as
    6 K* ^6 p; b' \
  17. * published by the Free Software Foundation version 2.7 w% ]  v; p/ Y1 L
  18. *+ }: h4 n/ z* d% P" }( l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' Z# `1 F+ X$ ?6 W* k$ q4 h
  20. * kind, whether express or implied; without even the implied warranty
    ) `( H, \  C0 w; S( e$ U; B4 e# `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( B5 U" v& ~) G: Y. z8 G; N
  22. * GNU General Public License for more details.
    8 \& X: T0 K( A2 J9 j. y% @1 i
  23. */
    0 i6 i" H& q  N( C( c' E

  24. 8 ^& @0 A/ v" D0 s
  25. #include <linux/module.h>
    6 U( y* {1 V% L% h! o. c
  26. #include <linux/init.h>$ p! w# t6 z# @' {! @0 P1 A
  27. #include <linux/errno.h>
    2 m- z) B  ]" u  t; n: e
  28. #include <linux/types.h>
    . X: w+ m/ H3 [/ a# T+ |
  29. #include <linux/interrupt.h>
    1 e8 e( z8 M+ U0 k! y) h! W  ^
  30. #include <asm/io.h>8 B8 ?; u% S: u' T! _1 s4 b
  31. #include <linux/moduleparam.h>! {' O; k! J7 G. {5 z
  32. #include <linux/sysctl.h>) q" i- \; g( B3 {+ [3 q
  33. #include <linux/mm.h>
    & i, g! K; M# S$ n$ d3 y3 y
  34. #include <linux/dma-mapping.h>! E- J6 V3 K9 u  |) P$ p) O

  35. % q. b+ d' K+ a
  36. #include <mach/memory.h>. p- A+ b) m/ g
  37. #include <mach/hardware.h>
    4 p6 l  z5 v; A, l
  38. #include <mach/irqs.h>
    $ Y6 c) R4 A; ^# S9 w5 R6 f9 x. v
  39. #include <asm/hardware/edma.h>0 n! J, j* c* l: g

  40. 2 o; b& F5 Z; \+ u% }' e/ V, L0 H
  41. #undef EDMA3_DEBUG5 c+ k' D2 T! h2 A4 o
  42. /*#define EDMA3_DEBUG*/' e' z; Y! T5 v7 C0 E; [5 X
  43. 3 e1 [, a# Q4 e  J$ S: I' j
  44. #ifdef EDMA3_DEBUG
    0 E5 P6 t+ _( B% J! F7 I( ^3 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* g5 |; A' s7 }* O3 k6 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). Y8 Z' P& q2 }2 F, p+ _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * v/ \( ]" ?1 s! I+ p( |8 v) V0 E  ^
  48. #else
    6 P# }* I9 i, D5 p% l5 q
  49. #define DMA_PRINTK( x... )# c7 J2 M; h) j* v  }! [
  50. #define DMA_FN_IN
    ! @9 b! v& T3 q3 R8 B
  51. #define DMA_FN_OUT
    : B) F1 R1 [& R! l' l% Y5 y1 N2 w
  52. #endif  p/ r/ a- E) M+ t
  53. % C! W+ ?1 A! J$ }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). {, j( r8 w. R; {; B. p
  55. #define STATIC_SHIFT                3
    ( S( t5 q9 H1 m
  56. #define TCINTEN_SHIFT               20! b4 `' N+ Q, Q8 W) t) @
  57. #define ITCINTEN_SHIFT              21
      w9 l$ K* Y. Y6 j! d4 O; s
  58. #define TCCHEN_SHIFT                22/ N' k. l: b6 A, t4 S$ `: F
  59. #define ITCCHEN_SHIFT               23" R1 \9 `: Z& ?( ~7 Y

  60. $ T. ]3 L9 i4 J1 @  M1 p1 R6 j+ D
  61. static volatile int irqraised1 = 0;6 X: W7 |/ a- H+ [
  62. static volatile int irqraised2 = 0;
    . g- w9 m' \- i7 O

  63. & L, I( ~8 B+ k) I$ U6 U9 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) e3 X3 N+ W! n  O# |7 t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * i% I1 ^; B1 T+ [1 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 O/ C6 Y2 e- T$ E! h

  67. : R* `4 k: b9 p; t# P( y6 D
  68. dma_addr_t dmaphyssrc1 = 0;! U4 P3 I% h$ ?; a
  69. dma_addr_t dmaphyssrc2 = 0;% N  g, h+ I6 J# O" S
  70. dma_addr_t dmaphysdest1 = 0;
    ' O$ A3 T) W/ m7 W% K3 U
  71. dma_addr_t dmaphysdest2 = 0;2 X' i, n. R/ {6 u$ i8 {5 [

  72. 2 ~$ l* L) m2 X, d
  73. char *dmabufsrc1 = NULL;
    - l  B# V2 b3 i: w$ c) K1 K5 z. f
  74. char *dmabufsrc2 = NULL;3 ]2 {, n% x3 s( |5 P% Z9 ^
  75. char *dmabufdest1 = NULL;, {' X: _8 u# S/ W8 f5 G
  76. char *dmabufdest2 = NULL;
    4 @* ~& P6 v% J% O

  77. 9 z$ \: M& ]- `7 I+ S
  78. static int acnt = 512;+ A: \/ _1 d* L: m, v
  79. static int bcnt = 8;' r9 Q0 m% g* o9 }
  80. static int ccnt = 8;8 P+ X1 m  T; t$ Q! ^" a

  81. ; L7 y4 W  v! A" h
  82. module_param(acnt, int, S_IRUGO);7 T: `; F) ~$ |* ?; `: C: E; S
  83. module_param(bcnt, int, S_IRUGO);
    6 ~3 g* s0 w1 o, i# x: I# R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 ~- G+ w1 N  a" l) W6 g' _
2 k* d3 I; P( G+ T/ c0 \0 x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 J- V$ g- b+ S7 q2 d3 y- w4 X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 y' q! f6 S; y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' a" `% k& D4 U5 ?7 V5 w
/ V( t! ~9 k) `* N" t# o- f; H
* ~' W, d# M2 i6 }3 A/ n, L) Q- {% |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 15:50 , Processed in 0.044173 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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