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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% u! P9 M1 G8 A3 h% r' ]
  1. [code]EDMA sample test application
    1 X: |+ U4 r; ]
  2. /*
    0 p* }% S' h2 ]' j
  3. * edma_test.c
    & E' R8 l5 B4 W
  4. *
    - ]" }# `0 }) K0 G5 i( g- Z
  5. * brief  EDMA3 Test Application
    : g; s2 A0 {# n8 H0 q0 n0 Y) j
  6. *
    3 E* C4 K. H; W/ O+ Y
  7. *   This file contains EDMA3 Test code.
    ' q% y* ?7 H$ s0 [
  8. *
    ( t1 g' h3 h( \: N9 ~9 k3 P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . K( H  \' o% y5 ^# N1 u( m& F+ f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      `0 e0 t. ]3 @0 V' N  s/ Q
  11. *         TO CHANGE.& J6 t( }" t2 B
  12. *
    / }' Z) ?/ X& s& P* Q, i9 b6 x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- K/ B+ l0 C, o; \* H* A7 f, [
  14. *
    & C( G& V% i9 }  Y" i8 n. x
  15. * This program is free software; you can redistribute it and/or
    : C8 {; ~7 A# N  @7 C
  16. * modify it under the terms of the GNU General Public License as
    ' {- A2 v- R) z
  17. * published by the Free Software Foundation version 2.
    & _+ y" q( v. B6 q
  18. *
    & }+ [- E( Q& ?7 |' w, j2 y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- H) |7 ?' |4 k5 _: d6 J$ N
  20. * kind, whether express or implied; without even the implied warranty
    2 d- ?2 D1 o  ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 j# P, h0 l: M+ h( w
  22. * GNU General Public License for more details.0 |. a! w$ b1 V
  23. */
    . k: m# ]& L* a' p) i) h6 N; P

  24. 7 V( E: R. z# ]1 X
  25. #include <linux/module.h>
    ( b/ k8 N) C1 C3 A6 V" x3 l  @
  26. #include <linux/init.h>, p/ B- I2 F5 g$ G) B" |8 k8 y# P
  27. #include <linux/errno.h>
    5 r; ^2 A0 v( s& D" P. V
  28. #include <linux/types.h>" q# k& \/ @2 W; ~6 A
  29. #include <linux/interrupt.h>
    1 V8 R  K9 m- X$ W
  30. #include <asm/io.h>
    : D& S; y! e, L
  31. #include <linux/moduleparam.h>
    " i: ^6 w" l" Q& X
  32. #include <linux/sysctl.h>
    ' ?% Z8 h4 A$ [
  33. #include <linux/mm.h>
    0 r" r. t  t- v! R0 u2 j
  34. #include <linux/dma-mapping.h>
    . ], G; \+ _: B

  35. : W) d2 l1 `* g
  36. #include <mach/memory.h>
    # W# A4 j( P) J" c
  37. #include <mach/hardware.h>
    & _8 Y! V) P. }. T
  38. #include <mach/irqs.h>
    ; ^- ~) `3 k0 v, `! ^5 h
  39. #include <asm/hardware/edma.h>" o* ?7 ?+ L. M

  40. 1 D6 Z; @* p4 ?" _  d2 S0 o( m
  41. #undef EDMA3_DEBUG
    - f5 E1 r4 t$ P
  42. /*#define EDMA3_DEBUG*/
    % G6 f; z/ J2 I  Y+ B' }

  43. . k4 j& J. q! v0 `5 `
  44. #ifdef EDMA3_DEBUG
    : H! p" O* I# t# i! q7 y3 R4 Q+ x. s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 Q$ g& n6 w+ l$ m) }$ l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / {" I* w- y( U6 f3 u* |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 i% i3 ~0 n- z, z% D2 L* C
  48. #else# S3 Y4 K% p4 ~5 w
  49. #define DMA_PRINTK( x... )
    + w7 x% L, ]' S+ d
  50. #define DMA_FN_IN& p! z& |. ]2 J2 X* F" T( |4 a
  51. #define DMA_FN_OUT1 n2 s# z# t7 O, h
  52. #endif
    ' a) A/ K" @$ j) ?6 H, c

  53. 0 k) H' D- K" ~( \- c8 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      t' m7 w) m, `) B6 O5 e( A/ J' `2 \
  55. #define STATIC_SHIFT                3
    5 V0 H& s+ S2 U& P, x+ q$ }8 x
  56. #define TCINTEN_SHIFT               20
    0 U6 q, Y+ m" d* a0 u
  57. #define ITCINTEN_SHIFT              21
    2 B9 n) S. i: {
  58. #define TCCHEN_SHIFT                22$ e0 i! c& y: ~- }# L. S' |+ U0 E# Y
  59. #define ITCCHEN_SHIFT               23) u, T4 G$ {3 {+ T3 P7 ~; o
  60. - S/ q- b7 t  b  v7 D; e, U; }" V
  61. static volatile int irqraised1 = 0;
    ( i6 f1 R' R5 V8 b2 O) v0 P/ {
  62. static volatile int irqraised2 = 0;7 e* n4 D+ A' A1 J2 U/ b

  63.   M7 ^3 b( [. g, G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ H; E4 h9 J% A1 O& ?" k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  L, H; K8 U' p" L* a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, @# c4 |+ d% f% V5 y( g

  67. 8 N3 I7 [  E9 D7 E8 F( c0 g  r6 m
  68. dma_addr_t dmaphyssrc1 = 0;9 f. y; o+ b% u6 u* r; E$ `
  69. dma_addr_t dmaphyssrc2 = 0;
    ( h# \3 @- y+ L5 i6 C9 M7 d# \% P
  70. dma_addr_t dmaphysdest1 = 0;
    . T* ~0 d7 @2 H* @, B. i: `  Z
  71. dma_addr_t dmaphysdest2 = 0;( A, L5 Y4 N6 ?

  72. / D6 S+ F! l, V0 W  G
  73. char *dmabufsrc1 = NULL;
    - t$ h$ ^/ T9 D$ p; X* ^
  74. char *dmabufsrc2 = NULL;
    ( d$ R. I8 m! L! p/ ^
  75. char *dmabufdest1 = NULL;
    9 ]  [& U5 O8 K- t/ e/ @
  76. char *dmabufdest2 = NULL;
    3 |# @( k* Z" J
  77. ' |  ]. J; S1 P/ r4 ^
  78. static int acnt = 512;% _1 j5 |$ |3 v. S7 T$ ^. }5 z
  79. static int bcnt = 8;" \! v- Z* d, B) N9 m/ @
  80. static int ccnt = 8;
    : ?3 a/ u1 N0 _) E8 J- n, T
  81.   \$ Z. N/ [8 M
  82. module_param(acnt, int, S_IRUGO);
    0 m& W9 u& M/ `9 r6 P! T& e
  83. module_param(bcnt, int, S_IRUGO);, D9 {8 {# K# D" l- C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ V/ @; Q$ ^  M$ f" Y4 H. n- ~' N. J7 V: V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ M. Z0 N5 @9 h/ \* H
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 I2 n$ C: F/ i; J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( \( t/ y; N& N; }! |4 k8 f
' I/ G" z1 p( C7 p0 X5 ~

, G1 X( w) y1 ?( N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 19:13 , Processed in 0.039838 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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