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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, q: r1 S$ m  ~* @
  1. [code]EDMA sample test application0 q  E( o& l8 D% L
  2. /*8 O' d8 f# g7 Y+ K4 R' s
  3. * edma_test.c
    6 _4 g6 Z& [( n  ^" N
  4. *3 K, _9 y& _7 u9 K; D
  5. * brief  EDMA3 Test Application9 K4 x5 f3 ?" s; Q
  6. *
    4 h) v! R8 O2 F+ x  G
  7. *   This file contains EDMA3 Test code.
    4 s3 b" K$ b9 i, H
  8. *
    * a2 _# G; Y, K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) }' d/ G8 ^7 d6 l& w) f; G, r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( Y6 Z4 u9 a2 R% l8 A3 Q% W
  11. *         TO CHANGE.$ F9 c& z" [: {2 ?8 W) i& `4 U
  12. *) `- x! s3 f$ e0 d$ l+ C! [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( S, ~+ R# v% T0 D2 A, U& g  ]2 c$ ^, R5 y
  14. *% A7 e! P; V& p/ _- u3 g: G6 P; r
  15. * This program is free software; you can redistribute it and/or
    7 Z# v' _& Q/ s4 k, ~
  16. * modify it under the terms of the GNU General Public License as
    . Y5 v, a4 p6 N, N- B" h# W" {
  17. * published by the Free Software Foundation version 2.
    * \- x/ h" ~) {/ h
  18. *
    , X9 ?. A* k* S6 Z- ^4 S6 y) e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" }# d4 z2 |. i! G
  20. * kind, whether express or implied; without even the implied warranty9 [4 B5 [& k+ k, W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " w# [: a% j/ g% B, U
  22. * GNU General Public License for more details.8 {$ T* i8 k) m4 \$ c# T( h5 J1 U
  23. */) P0 P: V0 P- z5 Z
  24. ; ]$ a9 w) P' n6 z5 [" W0 V
  25. #include <linux/module.h>" {2 |; W- B0 ^/ _" Y# Y* [
  26. #include <linux/init.h>. T: p) {* D/ |3 w- ]
  27. #include <linux/errno.h>
    0 [- j# k, P- F( X& K: n9 M
  28. #include <linux/types.h>) x+ P# s8 F% z3 B! z0 G: @5 i. j
  29. #include <linux/interrupt.h>1 A( H, d7 f) A2 ~: G
  30. #include <asm/io.h>( B" x1 N: e& Y1 S3 a, m8 D4 |
  31. #include <linux/moduleparam.h>8 I1 F9 p1 n7 Y1 K; E
  32. #include <linux/sysctl.h>5 `* `- ?- Q, f# O$ _5 f$ [
  33. #include <linux/mm.h>
    " Y+ K$ ~3 G4 r+ t1 e* [
  34. #include <linux/dma-mapping.h>1 I2 `9 W  S2 s$ s- e. h3 U

  35. 9 }4 B4 `* W8 _  I/ D5 T0 I& `
  36. #include <mach/memory.h>
    0 g" C# S' [) g, f- o
  37. #include <mach/hardware.h>) i0 b8 t$ q& P0 p
  38. #include <mach/irqs.h>
    3 h, l8 r: p$ l# N4 ]5 ]
  39. #include <asm/hardware/edma.h>5 N& O( a5 V3 K$ P
  40. ) n, V, `7 P3 L, d( S
  41. #undef EDMA3_DEBUG
    / K% R4 o# Q, i* ~
  42. /*#define EDMA3_DEBUG*/
    * N9 k! r, t( C

  43. $ ]" W+ d* H5 R
  44. #ifdef EDMA3_DEBUG# ?; P: R; `& \( q, b6 H$ b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! D# m5 a# |, k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , y+ B, i& E  y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - ]. h! `2 F# G! f
  48. #else
    % F& L2 c$ u& ]+ d/ d0 J% R
  49. #define DMA_PRINTK( x... )
    ' {* m: m& @! J
  50. #define DMA_FN_IN  f+ M3 R5 N& Q# Z0 |3 [  H" z( s6 c, y
  51. #define DMA_FN_OUT
    . t; W( [& }3 U, F4 `
  52. #endif1 g: P  _# \  x4 A7 T
  53. , U$ k8 u0 G1 K" N/ ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : q' L3 \% M1 d# c) f3 a
  55. #define STATIC_SHIFT                3
    7 D; P* g/ z$ `7 _# ?) w, n
  56. #define TCINTEN_SHIFT               20
    5 P4 D$ c* d" O: L$ D. X7 i* x  t
  57. #define ITCINTEN_SHIFT              21
    : B) G% M, @( ^2 z
  58. #define TCCHEN_SHIFT                22
      f7 @" j5 w0 c
  59. #define ITCCHEN_SHIFT               236 G. N9 a# J  B8 n

  60.   ]: W8 |' U$ F# i
  61. static volatile int irqraised1 = 0;
    5 _3 d9 [& O' {0 ]
  62. static volatile int irqraised2 = 0;" ~/ x# [# b/ |+ |9 P
  63. ) Q- ?$ t- X( J; X8 T% O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 C6 D5 ]5 C# d' g# }1 R4 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , P1 u  ?  e$ B( d! I) d! \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 V3 r3 ^- ], }: ]' r4 t

  67. 1 S+ v# }" t3 \1 k9 H
  68. dma_addr_t dmaphyssrc1 = 0;# D. P& F8 m# T& M7 @( i
  69. dma_addr_t dmaphyssrc2 = 0;
    - n# P2 ~+ V( I) E  d
  70. dma_addr_t dmaphysdest1 = 0;9 p. q# Q- T1 l! B/ i
  71. dma_addr_t dmaphysdest2 = 0;1 n% n) e. o+ b; R1 v

  72. % T# m7 z8 I4 t+ U. j  z0 {
  73. char *dmabufsrc1 = NULL;# |# V' b! f& Q0 u2 J& F
  74. char *dmabufsrc2 = NULL;
    ) f+ e* }) j, X4 ?9 p5 J! w( {1 g
  75. char *dmabufdest1 = NULL;
    7 n) V0 ]1 b) [' n
  76. char *dmabufdest2 = NULL;
    4 I7 R3 E! \& L* K% J7 n, N) Y( ]9 T

  77. $ n1 s* s! A7 w% p* ^
  78. static int acnt = 512;( X1 q3 E" t8 a. y
  79. static int bcnt = 8;
    ( W- d2 G1 {  f9 v  W
  80. static int ccnt = 8;
    * E7 D& c) n, G# d

  81. 0 n. b# T4 @- ?% Z  k  ~
  82. module_param(acnt, int, S_IRUGO);
    % f( S* I' W2 ^4 D, {, S6 w5 G
  83. module_param(bcnt, int, S_IRUGO);
    ( g5 v" Z0 Q8 ]3 Q/ J$ t2 K( Z# Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* N, H5 W, H5 Z  u
8 w; G5 m+ }( k4 S+ q0 O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) Q' S9 h( U! w, B9 {4 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 `/ q% g9 p% y+ d3 S# s0 x& b- }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( n8 z# f* R% H  N& h) L* @! v* }( \$ ]1 L8 j

7 A- d+ U: D5 i( t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-27 19:08 , Processed in 0.039002 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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