OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. V, O4 w8 \8 B9 F& H9 `0 s8 ]
  1. [code]EDMA sample test application' w' q' {% T$ e' R% X  P
  2. /*
    ( H7 B2 c/ h; w3 ], A+ Y  h
  3. * edma_test.c4 @9 T' U' m+ l) S7 o* |2 X
  4. *
    ; f% T" w1 }: @/ n% n& p3 m
  5. * brief  EDMA3 Test Application
    # t/ y9 G( o# j5 f5 T
  6. *+ C, V1 B! L5 [; j& w8 A1 }0 a- \
  7. *   This file contains EDMA3 Test code./ o$ Z% r# U1 l  v+ K: h* ^
  8. *
    , u7 p1 d7 D/ O+ t2 g  N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  o9 t* h; h5 r. j& V) p! b! k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ Y0 c9 x4 Z2 B& b1 D. ~
  11. *         TO CHANGE.
    1 f/ g% ~3 I3 K0 m0 r: n
  12. *
    . c, W" Q8 c* M* v1 J3 |: v1 w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 m6 D! \! X6 d, k9 N0 R
  14. *
    ; T6 B- M- x! ~% V0 O, L! |
  15. * This program is free software; you can redistribute it and/or0 P$ \: ^" N: A& Q1 e; s
  16. * modify it under the terms of the GNU General Public License as
    2 H9 {6 c" g# C) A. c+ }- e% {
  17. * published by the Free Software Foundation version 2.9 j2 o: u. y9 L% @9 t, n: B
  18. *! ?' u; U& B5 w5 A' S* P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / q6 R$ h2 N) _6 \+ Q$ R# t
  20. * kind, whether express or implied; without even the implied warranty
    - v4 j' q0 c0 X0 X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! d# E; j  V4 E7 E2 N1 {* Z
  22. * GNU General Public License for more details.
    9 y+ U1 D" y- Z; E
  23. */$ w6 M& E7 b* w. [
  24. & m; Z9 Z  v( ~* i8 j& A; T
  25. #include <linux/module.h>& K2 R1 {/ r; p" I% J
  26. #include <linux/init.h>- M( M9 P/ k; {4 j+ S: d' Z
  27. #include <linux/errno.h>
    " C( z/ {( A5 z3 @
  28. #include <linux/types.h>
    ) b/ B, h' f1 s$ l( o) c) m
  29. #include <linux/interrupt.h>. h  y0 p- J- O8 U2 Q0 y9 {! E
  30. #include <asm/io.h>
    : h+ v- I; Q5 y2 k% E/ c9 i0 `
  31. #include <linux/moduleparam.h>
    3 l5 S: v0 Z# x6 V! W1 X
  32. #include <linux/sysctl.h>1 I2 K8 Z8 A3 W# w( q
  33. #include <linux/mm.h>+ r& ?( U( H; B+ @0 w8 Z, H* M& d
  34. #include <linux/dma-mapping.h>
    3 [- I: c. a8 E# E
  35. 8 q  U' Y/ F" r3 a% o7 \5 s
  36. #include <mach/memory.h>
    / _  B$ i$ G: V
  37. #include <mach/hardware.h>
    # U+ ?$ L& V; }) r
  38. #include <mach/irqs.h>
    # I+ @4 {4 G$ \5 M* Y
  39. #include <asm/hardware/edma.h>" ]( G/ i7 ^- l- P+ B0 @# v
  40. ! \- V- k" f  L1 `6 e) c
  41. #undef EDMA3_DEBUG
    6 U9 `3 N  r0 h; I5 c; e
  42. /*#define EDMA3_DEBUG*/
    / J, n$ c' o) I: z

  43. + I+ q1 I# M, T
  44. #ifdef EDMA3_DEBUG( C; c/ z! q/ o, p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 C6 B9 ~4 s; K% D# k0 o% G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) D9 X% t* h# I) t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      k, @. T' {& N$ i9 \. F
  48. #else
    ( h3 O/ B8 M4 |% g; T
  49. #define DMA_PRINTK( x... )
    ; t9 L+ \+ o& q& u
  50. #define DMA_FN_IN! Y4 y& D% D9 @' R3 k
  51. #define DMA_FN_OUT
    " y5 t# S: s; V7 N4 J! Y
  52. #endif
    & N7 B0 A/ O9 e% B& P$ x/ n
  53. 1 `) T, n5 I5 }8 F" L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% [! s5 l3 w# @: r8 [! x
  55. #define STATIC_SHIFT                3
    $ Y& u) L4 A* t' A6 K
  56. #define TCINTEN_SHIFT               20
    " h; `8 K) K- K, w7 i1 s
  57. #define ITCINTEN_SHIFT              21
    ' L3 ~. e  u  u2 l
  58. #define TCCHEN_SHIFT                22/ D4 n% m/ b% w$ R. u, X
  59. #define ITCCHEN_SHIFT               23
    ( x! S: l+ N! m- n: k0 p$ N5 E
  60. ) P$ M9 \% v$ b( N  Q" ~4 {# ?
  61. static volatile int irqraised1 = 0;+ C1 [+ b# X. @- j& \2 b5 m' R
  62. static volatile int irqraised2 = 0;
    $ {+ K8 K; t: d: {
  63. - H5 A' u' m0 ^; J8 _* m; w' R3 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 R- E1 b. e! a0 r7 G# {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 R; }7 M! b6 g5 Z) m% t6 I% A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- }8 @) ?7 l7 e7 N

  67. . v5 Y" E6 y& e
  68. dma_addr_t dmaphyssrc1 = 0;  R2 I5 L2 v( l6 a3 Q5 \' c
  69. dma_addr_t dmaphyssrc2 = 0;3 B4 k( W! ~8 y2 i
  70. dma_addr_t dmaphysdest1 = 0;5 K' \8 t  Z2 a2 v/ F0 F+ A
  71. dma_addr_t dmaphysdest2 = 0;
    1 y* L4 S" X  [* s, G
  72. + Z, [  }  B; A( y/ X/ t6 G
  73. char *dmabufsrc1 = NULL;1 A" e# h0 U7 h2 g9 Y) G
  74. char *dmabufsrc2 = NULL;
    , N$ q/ i' I) U7 p! G: m4 X
  75. char *dmabufdest1 = NULL;* D9 u6 D+ m; y$ I, g; U% n
  76. char *dmabufdest2 = NULL;- \) N1 c$ D& X8 q' k8 N
  77. , Z- ?. F' n( J0 U$ s
  78. static int acnt = 512;5 @& @* U, ^& D. U3 i
  79. static int bcnt = 8;2 ]  ~+ ]" {, }& _& T
  80. static int ccnt = 8;
    $ s% S  a+ k5 z4 k$ ]; F# o
  81. : j) V9 K! i2 o4 Q) k7 u1 m- ]' `" M
  82. module_param(acnt, int, S_IRUGO);
    " `& Y! |4 g0 k/ j4 @
  83. module_param(bcnt, int, S_IRUGO);
    8 j9 \4 q  B5 d& _- c8 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) B; T' I1 m" P( a' i# a( J3 ~5 }: w5 }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, N& v0 ]; a9 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( Y! K% J7 G  a# F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& R9 \; Q% f9 b2 b. V% i

* s, q8 V1 s) Q( a8 [6 t/ ^) ~# R7 @! `2 z. ^) y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-14 03:56 , Processed in 0.042313 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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